PageSourceSearch

https://eghtesadsabzonline.ir/wp-content/themes/Aban-News-2.0/js/scripts.js

js eghtesadsabzonline.ir collected 2026-10-03 00:29:30 UTC 430,544 bytes, 7,225 lines download raw bytes

vendor: 4,250 bytes, lines 1-107
1/*!
2 * Lightbox v2.8.2
3 * by Lokesh Dhakar
4 *
5 * More info:
6 * http://lokeshdhakar.com/projects/lightbox2/
7 *
8 * Copyright 2007, 2015 Lokesh Dhakar
9 * Released under the MIT license
10 * https://github.com/lokesh/lightbox2/blob/master/LICENSE
11 */
12
13// Uses Node, AMD or browser globals to create a module.
14(function (root, factory) {
15    if (typeof define === 'function' && define.amd) {
16        // AMD. Register as an anonymous module.
17        define(['jquery'], factory);
18    } else if (typeof exports === 'object') {
19        // Node. Does not work with strict CommonJS, but
20        // only CommonJS-like environments that support module.exports,
21        // like Node.
22        module.exports = factory(require('jquery'));
23    } else {
24        // Browser globals (root is window)
25        root.lightbox = factory(root.jQuery);
26    }
27}(this, function ($) {
28
29  function Lightbox(options) {
30    this.album = [];
31    this.currentImageIndex = void 0;
32    this.init();
33
34    // options
35    this.options = $.extend({}, this.constructor.defaults);
36    this.option(options);
37  }
38
39  // Descriptions of all options available on the demo site:
40  // http://lokeshdhakar.com/projects/lightbox2/index.html#options
41  Lightbox.defaults = {
42    albumLabel: 'Image %1 of %2',
43    alwaysShowNavOnTouchDevices: false,
44    fadeDuration: 500,
45    fitImagesInViewport: true,
46    // maxWidth: 800,
47    // maxHeight: 600,
48    positionFromTop: 50,
49    resizeDuration: 700,
50    showImageNumberLabel: true,
51    wrapAround: false,
52    disableScrolling: false
53  };
54
55  Lightbox.prototype.option = function(options) {
56    $.extend(this.options, options);
57  };
58
59  Lightbox.prototype.imageCountLabel = function(currentImageNum, totalImages) {
60    return this.options.albumLabel.replace(/%1/g, currentImageNum).replace(/%2/g, totalImages);
61  };
62
63  Lightbox.prototype.init = function() {
64    this.enable();
65    this.build();
66  };
67
68  // Loop through anchors and areamaps looking for either data-lightbox attributes or rel attributes
69  // that contain 'lightbox'. When these are clicked, start lightbox.
70  Lightbox.prototype.enable = function() {
71    var self = this;
72    $('body').on('click', 'a[rel^=lightbox], area[rel^=lightbox], a[data-lightbox], area[data-lightbox]', function(event) {
73      self.start($(event.currentTarget));
74      return false;
75    });
76  };
77
78  // Build html for the lightbox and the overlay.
79  // Attach event handlers to the new DOM elements. click click click
80  Lightbox.prototype.build = function() {
81    var self = this;
82    $('<div id="lightboxOverlay" class="lightboxOverlay"></div><div id="lightbox" class="lightbox"><div class="lb-outerContainer"><div class="lb-container"><img class="lb-image" src="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" /><div class="lb-nav"><a class="lb-prev" href="" ></a><a class="lb-next" href="" ></a></div><div class="lb-loader"><a class="lb-cancel"></a></div></div></div><div class="lb-dataContainer"><div class="lb-data"><div class="lb-details"><span class="lb-caption"></span><span class="lb-number"></span></div><div class="lb-closeContainer"><a class="lb-close"></a></div></div></div></div>').appendTo($('body'));
83
84    // Cache jQuery objects
85    this.$lightbox       = $('#lightbox');
86    this.$overlay        = $('#lightboxOverlay');
87    this.$outerContainer = this.$lightbox.find('.lb-outerContainer');
88    this.$container      = this.$lightbox.find('.lb-container');
89
90    // Store css values for future lookup
91    this.containerTopPadding = parseInt(this.$container.css('padding-top'), 10);
92    this.containerRightPadding = parseInt(this.$container.css('padding-right'), 10);
93    this.containerBottomPadding = parseInt(this.$container.css('padding-bottom'), 10);
94    this.containerLeftPadding = parseInt(this.$container.css('padding-left'), 10);
95
96    // Attach event handlers to the newly minted DOM elements
97    this.$overlay.hide().on('click', function() {
98      self.end();
99      return false;
100    });
101
102    this.$lightbox.hide().on('click', function(event) {
103      if ($(event.target).attr('id') === 'lightbox') {
104        self.end();
105      }
106      return false;
107    });
108
109    this.$outerContainer.on('click', function(event) {
110      if ($(event.target).attr('id') === 'lightbox') {
111        self.end();
112      }
113      return false;
114    });
115
116    this.$lightbox.find('.lb-prev').on('click', function() {
117      if (self.currentImageIndex === 0) {
118        self.changeImage(self.album.length - 1);
119      } else {
120        self.changeImage(self.currentImageIndex - 1);
121      }
122      return false;
123    });
124
125    this.$lightbox.find('.lb-next').on('click', function() {
126      if (self.currentImageIndex === self.album.length - 1) {
127        self.changeImage(0);
128      } else {
129        self.changeImage(self.currentImageIndex + 1);
130      }
131      return false;
132    });
133
134    this.$lightbox.find('.lb-loader, .lb-close').on('click', function() {
135      self.end();
136      return false;
137    });
138  };
139
140  // Show overlay and lightbox. If the image is part of a set, add siblings to album array.
141  Lightbox.prototype.start = function($link) {
142    var self    = this;
143    var $window = $(window);
144
145    $window.on('resize', $.proxy(this.sizeOverlay, this));
146
147    $('select, object, embed').css({
148      visibility: 'hidden'
149    });
150
151    this.sizeOverlay();
152
153    this.album = [];
154    var imageNumber = 0;
155
156    function addToAlbum($link) {
157      self.album.push({
158        link: $link.attr('href'),
159        title: $link.attr('data-title') || $link.attr('title')
160      });
161    }
162
163    // Support both data-lightbox attribute and rel attribute implementations
164    var dataLightboxValue = $link.attr('data-lightbox');
165    var $links;
166
167    if (dataLightboxValue) {
168      $links = $($link.prop('tagName') + '[data-lightbox="' + dataLightboxValue + '"]');
169      for (var i = 0; i < $links.length; i = ++i) {
170        addToAlbum($($links[i]));
171        if ($links[i] === $link[0]) {
172          imageNumber = i;
173        }
174      }
175    } else {
176      if ($link.attr('rel') === 'lightbox') {
177        // If image is not part of a set
178        addToAlbum($link);
179      } else {
180        // If image is part of a set
181        $links = $($link.prop('tagName') + '[rel="' + $link.attr('rel') + '"]');
182        for (var j = 0; j < $links.length; j = ++j) {
183          addToAlbum($($links[j]));
184          if ($links[j] === $link[0]) {
185            imageNumber = j;
186          }
187        }
188      }
189    }
190
191    // Position Lightbox
192    var top  = $window.scrollTop() + this.options.positionFromTop;
193    var left = $window.scrollLeft();
194    this.$lightbox.css({
195      top: top + 'px',
196      left: left + 'px'
197    }).fadeIn(this.options.fadeDuration);
198
199    // Disable scrolling of the page while open
200    if (this.options.disableScrolling) {
201      $('body').addClass('lb-disable-scrolling');
202    }
203
204    this.changeImage(imageNumber);
205  };
206
207  // Hide most UI elements in preparation for the animated resizing of the lightbox.
208  Lightbox.prototype.changeImage = function(imageNumber) {
209    var self = this;
210
211    this.disableKeyboardNav();
212    var $image = this.$lightbox.find('.lb-image');
213
214    this.$overlay.fadeIn(this.options.fadeDuration);
215
216    $('.lb-loader').fadeIn('slow');
217    this.$lightbox.find('.lb-image, .lb-nav, .lb-prev, .lb-next, .lb-dataContainer, .lb-numbers, .lb-caption').hide();
218
219    this.$outerContainer.addClass('animating');
220
221    // When image to show is preloaded, we send the width and height to sizeContainer()
222    var preloader = new Image();
223    preloader.onload = function() {
224      var $preloader;
225      var imageHeight;
226      var imageWidth;
227      var maxImageHeight;
228      var maxImageWidth;
229      var windowHeight;
230      var windowWidth;
231
232      $image.attr('src', self.album[imageNumber].link);
233
234      $preloader = $(preloader);
235
236      $image.width(preloader.width);
237      $image.height(preloader.height);
238
239      if (self.options.fitImagesInViewport) {
240        // Fit image inside the viewport.
241        // Take into account the border around the image and an additional 10px gutter on each side.
242
243        windowWidth    = $(window).width();
244        windowHeight   = $(window).height();
245        maxImageWidth  = windowWidth - self.containerLeftPadding - self.containerRightPadding - 20;
246        maxImageHeight = windowHeight - self.containerTopPadding - self.containerBottomPadding - 120;
247
248        // Check if image size is larger then maxWidth|maxHeight in settings
249        if (self.options.maxWidth && self.options.maxWidth < maxImageWidth) {
250          maxImageWidth = self.options.maxWidth;
251        }
252        if (self.options.maxHeight && self.options.maxHeight < maxImageWidth) {
253          maxImageHeight = self.options.maxHeight;
254        }
255
256        // Is there a fitting issue?
257        if ((preloader.width > maxImageWidth) || (preloader.height > maxImageHeight)) {
258          if ((preloader.width / maxImageWidth) > (preloader.height / maxImageHeight)) {
259            imageWidth  = maxImageWidth;
260            imageHeight = parseInt(preloader.height / (preloader.width / imageWidth), 10);
261            $image.width(imageWidth);
262            $image.height(imageHeight);
263          } else {
264            imageHeight = maxImageHeight;
265            imageWidth = parseInt(preloader.width / (preloader.height / imageHeight), 10);
266            $image.width(imageWidth);
267            $image.height(imageHeight);
268          }
269        }
270      }
271      self.sizeContainer($image.width(), $image.height());
272    };
273
274    preloader.src          = this.album[imageNumber].link;
275    this.currentImageIndex = imageNumber;
276  };
277
278  // Stretch overlay to fit the viewport
279  Lightbox.prototype.sizeOverlay = function() {
280    this.$overlay
281      .width($(document).width())
282      .height($(document).height());
283  };
284
285  // Animate the size of the lightbox to fit the image we are showing
286  Lightbox.prototype.sizeContainer = function(imageWidth, imageHeight) {
287    var self = this;
288
289    var oldWidth  = this.$outerContainer.outerWidth();
290    var oldHeight = this.$outerContainer.outerHeight();
291    var newWidth  = imageWidth + this.containerLeftPadding + this.containerRightPadding;
292    var newHeight = imageHeight + this.containerTopPadding + this.containerBottomPadding;
293
294    function postResize() {
295      self.$lightbox.find('.lb-dataContainer').width(newWidth);
296      self.$lightbox.find('.lb-prevLink').height(newHeight);
297      self.$lightbox.find('.lb-nextLink').height(newHeight);
298      self.showImage();
299    }
300
301    if (oldWidth !== newWidth || oldHeight !== newHeight) {
302      this.$outerContainer.animate({
303        width: newWidth,
304        height: newHeight
305      }, this.options.resizeDuration, 'swing', function() {
306        postResize();
307      });
308    } else {
309      postResize();
310    }
311  };
312
313  // Display the image and its details and begin preload neighboring images.
314  Lightbox.prototype.showImage = function() {
315    this.$lightbox.find('.lb-loader').stop(true).hide();
316    this.$lightbox.find('.lb-image').fadeIn('slow');
317
318    this.updateNav();
319    this.updateDetails();
320    this.preloadNeighboringImages();
321    this.enableKeyboardNav();
322  };
323
324  // Display previous and next navigation if appropriate.
325  Lightbox.prototype.updateNav = function() {
326    // Check to see if the browser supports touch events. If so, we take the conservative approach
327    // and assume that mouse hover events are not supported and always show prev/next navigation
328    // arrows in image sets.
329    var alwaysShowNav = false;
330    try {
331      document.createEvent('TouchEvent');
332      alwaysShowNav = (this.options.alwaysShowNavOnTouchDevices) ? true : false;
333    } catch (e) {}
334
335    this.$lightbox.find('.lb-nav').show();
336
337    if (this.album.length > 1) {
338      if (this.options.wrapAround) {
339        if (alwaysShowNav) {
340          this.$lightbox.find('.lb-prev, .lb-next').css('opacity', '1');
341        }
342        this.$lightbox.find('.lb-prev, .lb-next').show();
343      } else {
344        if (this.currentImageIndex > 0) {
345          this.$lightbox.find('.lb-prev').show();
346          if (alwaysShowNav) {
347            this.$lightbox.find('.lb-prev').css('opacity', '1');
348          }
349        }
350        if (this.currentImageIndex < this.album.length - 1) {
351          this.$lightbox.find('.lb-next').show();
352          if (alwaysShowNav) {
353            this.$lightbox.find('.lb-next').css('opacity', '1');
354          }
355        }
356      }
357    }
358  };
359
360  // Display caption, image number, and closing button.
361  Lightbox.prototype.updateDetails = function() {
362    var self = this;
363
364    // Enable anchor clicks in the injected caption html.
365    // Thanks Nate Wright for the fix. @https://github.com/NateWr
366    if (typeof this.album[this.currentImageIndex].title !== 'undefined' &&
367      this.album[this.currentImageIndex].title !== '') {
368      this.$lightbox.find('.lb-caption')
369        .html(this.album[this.currentImageIndex].title)
370        .fadeIn('fast')
371        .find('a').on('click', function(event) {
372          if ($(this).attr('target') !== undefined) {
373            window.open($(this).attr('href'), $(this).attr('target'));
374          } else {
375            location.href = $(this).attr('href');
376          }
377        });
378    }
379
380    if (this.album.length > 1 && this.options.showImageNumberLabel) {
381      var labelText = this.imageCountLabel(this.currentImageIndex + 1, this.album.length);
382      this.$lightbox.find('.lb-number').text(labelText).fadeIn('fast');
383    } else {
384      this.$lightbox.find('.lb-number').hide();
385    }
386
387    this.$outerContainer.removeClass('animating');
388
389    this.$lightbox.find('.lb-dataContainer').fadeIn(this.options.resizeDuration, function() {
390      return self.sizeOverlay();
391    });
392  };
393
394  // Preload previous and next images in set.
395  Lightbox.prototype.preloadNeighboringImages = function() {
396    if (this.album.length > this.currentImageIndex + 1) {
397      var preloadNext = new Image();
398      preloadNext.src = this.album[this.currentImageIndex + 1].link;
399    }
400    if (this.currentImageIndex > 0) {
401      var preloadPrev = new Image();
402      preloadPrev.src = this.album[this.currentImageIndex - 1].link;
403    }
404  };
405
406  Lightbox.prototype.enableKeyboardNav = function() {
407    $(document).on('keyup.keyboard', $.proxy(this.keyboardAction, this));
408  };
409
410  Lightbox.prototype.disableKeyboardNav = function() {
411    $(document).off('.keyboard');
412  };
413
414  Lightbox.prototype.keyboardAction = function(event) {
415    var KEYCODE_ESC        = 27;
416    var KEYCODE_LEFTARROW  = 37;
417    var KEYCODE_RIGHTARROW = 39;
418
419    var keycode = event.keyCode;
420    var key     = String.fromCharCode(keycode).toLowerCase();
421    if (keycode === KEYCODE_ESC || key.match(/x|o|c/)) {
422      this.end();
423    } else if (key === 'p' || keycode === KEYCODE_LEFTARROW) {
424      if (this.currentImageIndex !== 0) {
425        this.changeImage(this.currentImageIndex - 1);
426      } else if (this.options.wrapAround && this.album.length > 1) {
427        this.changeImage(this.album.length - 1);
428      }
429    } else if (key === 'n' || keycode === KEYCODE_RIGHTARROW) {
430      if (this.currentImageIndex !== this.album.length - 1) {
431        this.changeImage(this.currentImageIndex + 1);
432      } else if (this.options.wrapAround && this.album.length > 1) {
433        this.changeImage(0);
434      }
435    }
436  };
437
438  // Closing time. :-(
439  Lightbox.prototype.end = function() {
440    this.disableKeyboardNav();
441    $(window).off('resize', this.sizeOverlay);
442    this.$lightbox.fadeOut(this.options.fadeDuration);
443    this.$overlay.fadeOut(this.options.fadeDuration);
444    $('select, object, embed').css({
445      visibility: 'visible'
446    });
447    if (this.options.disableScrolling) {
448      $('body').removeClass('lb-disable-scrolling');
449    }
450  };
451
452  return new Lightbox();
453}));
454
455
456
457
458
459
460
461(function($, window, document, undefined) {
462
463    'use strict';
464
465    var defaults = {
466
467        mode: 'lg-slide',
468
469        // Ex : 'ease'
470        cssEasing: 'ease',
471
472        //'for jquery animation'
473        easing: 'linear',
474        speed: 600,
475        height: '100%',
476        width: '100%',
477        addClass: '',
478        startClass: 'lg-start-zoom',
479        backdropDuration: 150,
480        hideBarsDelay: 6000,
481
482        useLeft: false,
483
484        closable: true,
485        loop: true,
486        escKey: true,
487        keyPress: true,
488        controls: true,
489        slideEndAnimatoin: true,
490        hideControlOnEnd: false,
491        mousewheel: true,
492
493        getCaptionFromTitleOrAlt: true,
494
495        // .lg-item || '.lg-sub-html'
496        appendSubHtmlTo: '.lg-sub-html',
497
498        /**
499         * @desc number of preload slides
500         * will exicute only after the current slide is fully loaded.
501         *
502         * @ex you clicked on 4th image and if preload = 1 then 3rd slide and 5th
503         * slide will be loaded in the background after the 4th slide is fully loaded..
504         * if preload is 2 then 2nd 3rd 5th 6th slides will be preloaded.. ... ...
505         *
506         */
507        preload: 1,
508        showAfterLoad: true,
509        selector: '',
510        selectWithin: '',
511        nextHtml: '',
512        prevHtml: '',
513
514        // 0, 1
515        index: false,
516
517        iframeMaxWidth: '100%',
518
519        download: true,
520        counter: true,
521        appendCounterTo: '.lg-toolbar',
522
523        swipeThreshold: 50,
524        enableSwipe: true,
525        enableDrag: true,
526
527        dynamic: false,
528        dynamicEl: [],
529        galleryId: 1
530    };
531
532    function Plugin(element, options) {
533
534        // Current lightGallery element
535        this.el = element;
536
537        // Current jquery element
538        this.$el = $(element);
539
540        // lightGallery settings
541        this.s = $.extend({}, defaults, options);
542
543        // When using dynamic mode, ensure dynamicEl is an array
544        if (this.s.dynamic && this.s.dynamicEl !== 'undefined' && this.s.dynamicEl.constructor === Array && !this.s.dynamicEl.length) {
545            throw ('When using dynamic mode, you must also define dynamicEl as an Array.');
546        }
547
548        // lightGallery modules
549        this.modules = {};
550
551        // false when lightgallery complete first slide;
552        this.lGalleryOn = false;
553
554        this.lgBusy = false;
555
556        // Timeout function for hiding controls;
557        this.hideBartimeout = false;
558
559        // To determine browser supports for touch events;
560        this.isTouch = ('ontouchstart' in document.documentElement);
561
562        // Disable hideControlOnEnd if sildeEndAnimation is true
563        if (this.s.slideEndAnimatoin) {
564            this.s.hideControlOnEnd = false;
565        }
566
567        // Gallery items
568        if (this.s.dynamic) {
569            this.$items = this.s.dynamicEl;
570        } else {
571            if (this.s.selector === 'this') {
572                this.$items = this.$el;
573            } else if (this.s.selector !== '') {
574                if (this.s.selectWithin) {
575                    this.$items = $(this.s.selectWithin).find(this.s.selector);
576                } else {
577                    this.$items = this.$el.find($(this.s.selector));
578                }
579            } else {
580                this.$items = this.$el.children();
581            }
582        }
583
584        // .lg-item
585        this.$slide = '';
586
587        // .lg-outer
588        this.$outer = '';
589
590        this.init();
591
592        return this;
593    }
594
595    Plugin.prototype.init = function() {
596
597        var _this = this;
598
599        // s.preload should not be more than $item.length
600        if (_this.s.preload > _this.$items.length) {
601            _this.s.preload = _this.$items.length;
602        }
603
604        // if dynamic option is enabled execute immediately
605        var _hash = window.location.hash;
606        if (_hash.indexOf('lg=' + this.s.galleryId) > 0) {
607
608            _this.index = parseInt(_hash.split('&slide=')[1], 10);
609
610            $('body').addClass('lg-from-hash');
611            if (!$('body').hasClass('lg-on')) {
612                setTimeout(function() {
613                    _this.build(_this.index);
614                    $('body').addClass('lg-on');
615                });
616            }
617        }
618
619        if (_this.s.dynamic) {
620
621            _this.$el.trigger('onBeforeOpen.lg');
622
623            _this.index = _this.s.index || 0;
624
625            // prevent accidental double execution
626            if (!$('body').hasClass('lg-on')) {
627                setTimeout(function() {
628                    _this.build(_this.index);
629                    $('body').addClass('lg-on');
630                });
631            }
632        } else {
633
634            // Using different namespace for click because click event should not unbind if selector is same object('this')
635            _this.$items.on('click.lgcustom', function(event) {
636
637                // For IE8
638                try {
639                    event.preventDefault();
640                    event.preventDefault();
641                } catch (er) {
642                    event.returnValue = false;
643                }
644
645                _this.$el.trigger('onBeforeOpen.lg');
646
647                _this.index = _this.s.index || _this.$items.index(this);
648
649                // prevent accidental double execution
650                if (!$('body').hasClass('lg-on')) {
651                    _this.build(_this.index);
652                    $('body').addClass('lg-on');
653                }
654            });
655        }
656
657    };
658
659    Plugin.prototype.build = function(index) {
660
661        var _this = this;
662
663        _this.structure();
664
665        // module constructor
666        $.each($.fn.lightGallery.modules, function(key) {
667            _this.modules[key] = new $.fn.lightGallery.modules[key](_this.el);
668        });
669
670        // initiate slide function
671        _this.slide(index, false, false);
672
673        if (_this.s.keyPress) {
674            _this.keyPress();
675        }
676
677        if (_this.$items.length > 1) {
678
679            _this.arrow();
680
681            setTimeout(function() {
682                _this.enableDrag();
683                _this.enableSwipe();
684            }, 50);
685
686            if (_this.s.mousewheel) {
687                _this.mousewheel();
688            }
689        }
690
691        _this.counter();
692
693        _this.closeGallery();
694
695        _this.$el.trigger('onAfterOpen.lg');
696
697        // Hide controllers if mouse doesn't move for some period
698        _this.$outer.on('mousemove.lg click.lg touchstart.lg', function() {
699
700            _this.$outer.removeClass('lg-hide-items');
701
702            clearTimeout(_this.hideBartimeout);
703
704            // Timeout will be cleared on each slide movement also
705            _this.hideBartimeout = setTimeout(function() {
706                _this.$outer.addClass('lg-hide-items');
707            }, _this.s.hideBarsDelay);
708
709        });
710
711    };
712
713    Plugin.prototype.structure = function() {
714        var list = '';
715        var controls = '';
716        var i = 0;
717        var subHtmlCont = '';
718        var template;
719        var _this = this;
720
721        $('body').append('<div class="lg-backdrop"></div>');
722        $('.lg-backdrop').css('transition-duration', this.s.backdropDuration + 'ms');
723
724        // Create gallery items
725        for (i = 0; i < this.$items.length; i++) {
726            list += '<div class="lg-item"></div>';
727        }
728
729        // Create controlls
730        if (this.s.controls && this.$items.length > 1) {
731            controls = '<div class="lg-actions">' +
732                '<div class="lg-prev lg-icon">' + this.s.prevHtml + '</div>' +
733                '<div class="lg-next lg-icon">' + this.s.nextHtml + '</div>' +
734                '</div>';
735        }
736
737        if (this.s.appendSubHtmlTo === '.lg-sub-html') {
738            subHtmlCont = '<div class="lg-sub-html"></div>';
739        }
740
741        template = '<div class="lg-outer ' + this.s.addClass + ' ' + this.s.startClass + '">' +
742            '<div class="lg" style="width:' + this.s.width + '; height:' + this.s.height + '">' +
743            '<div class="lg-inner">
743' + list + '</div>' +
744            '<div class="lg-toolbar group">' +
745            '<span class="lg-close lg-icon"></span>' +
746            '</div>' +
747            controls +
748            subHtmlCont +
749            '</div>' +
750            '</div>';
751
752        $('body').append(template);
753        this.$outer = $('.lg-outer');
754        this.$slide = this.$outer.find('.lg-item');
755
756        if (this.s.useLeft) {
757            this.$outer.addClass('lg-use-left');
758
759            // Set mode lg-slide if use left is true;
760            this.s.mode = 'lg-slide';
761        } else {
762            this.$outer.addClass('lg-use-css3');
763        }
764
765        // For fixed height gallery
766        _this.setTop();
767        $(window).on('resize.lg orientationchange.lg', function() {
768            setTimeout(function() {
769                _this.setTop();
770            }, 100);
771        });
772
773        // add class lg-current to remove initial transition
774        this.$slide.eq(this.index).addClass('lg-current');
775
776        // add Class for css support and transition mode
777        if (this.doCss()) {
778            this.$outer.addClass('lg-css3');
779        } else {
780            this.$outer.addClass('lg-css');
781
782            // Set speed 0 because no animation will happen if browser doesn't support css3
783            this.s.speed = 0;
784        }
785
786        this.$outer.addClass(this.s.mode);
787
788        if (this.s.enableDrag && this.$items.length > 1) {
789            this.$outer.addClass('lg-grab');
790        }
791
792        if (this.s.showAfterLoad) {
793            this.$outer.addClass('lg-show-after-load');
794        }
795
796        if (this.doCss()) {
797            var $inner = this.$outer.find('.lg-inner');
798            $inner.css('transition-timing-function', this.s.cssEasing);
799            $inner.css('transition-duration', this.s.speed + 'ms');
800        }
801
802        $('.lg-backdrop').addClass('in');
803
804        setTimeout(function() {
805            _this.$outer.addClass('lg-visible');
806        }, this.s.backdropDuration);
807
808        if (this.s.download) {
809            this.$outer.find('.lg-toolbar').append('<a id="lg-download" target="_blank" download class="lg-download lg-icon"></a>');
810        }
811
812        // Store the current scroll top value to scroll back after closing the gallery..
813        this.prevScrollTop = $(window).scrollTop();
814
815    };
816
817    // For fixed height gallery
818    Plugin.prototype.setTop = function() {
819        if (this.s.height !== '100%') {
820            var wH = $(window).height();
821            var top = (wH - parseInt(this.s.height, 10)) / 2;
822            var $lGallery = this.$outer.find('.lg');
823            if (wH >= parseInt(this.s.height, 10)) {
824                $lGallery.css('top', top + 'px');
825            } else {
826                $lGallery.css('top', '0px');
827            }
828        }
829    };
830
831    // Find css3 support
832    Plugin.prototype.doCss = function() {
833        // check for css animation support
834        var support = function() {
835            var transition = ['transition', 'MozTransition', 'WebkitTransition', 'OTransition', 'msTransition', 'KhtmlTransition'];
836            var root = document.documentElement;
837            var i = 0;
838            for (i = 0; i < transition.length; i++) {
839                if (transition[i] in root.style) {
840                    return true;
841                }
842            }
843        };
844
845        if (support()) {
846            return true;
847        }
848
849        return false;
850    };
851
852    /**
853     *  @desc Check the given src is video
854     *  @param {String} src
855     *  @return {Object} video type
856     *  Ex:{ youtube  :  ["//www.youtube.com/watch?v=c0asJgSyxcY", "c0asJgSyxcY"] }
857     */
858    Plugin.prototype.isVideo = function(src, index) {
859
860        var html;
861        if (this.s.dynamic) {
862            html = this.s.dynamicEl[index].html;
863        } else {
864            html = this.$items.eq(index).attr('data-html');
865        }
866
867        if (!src && html) {
868            return {
869                html5: true
870            };
871        }
872
873        var youtube = src.match(/\/\/(?:www\.)?youtu(?:\.be|be\.com)\/(?:watch\?v=|embed\/)?([a-z0-9\-\_\%]+)/i);
874        var vimeo = src.match(/\/\/(?:www\.)?vimeo.com\/([0-9a-z\-_]+)/i);
875        var dailymotion = src.match(/\/\/(?:www\.)?dai.ly\/([0-9a-z\-_]+)/i);
876        var vk = src.match(/\/\/(?:www\.)?(?:vk\.com|vkontakte\.ru)\/(?:video_ext\.php\?)(.*)/i);
877
878        if (youtube) {
879            return {
880                youtube: youtube
881            };
882        } else if (vimeo) {
883            return {
884                vimeo: vimeo
885            };
886        } else if (dailymotion) {
887            return {
888                dailymotion: dailymotion
889            };
890        } else if (vk) {
891            return {
892                vk: vk
893            };
894        }
895    };
896
897    /**
898     *  @desc Create image counter
899     *  Ex: 1/10
900     */
901    Plugin.prototype.counter = function() {
902        if (this.s.counter) {
903            $(this.s.appendCounterTo).append('<div id="lg-counter"><span id="lg-counter-current">' + (parseInt(this.index, 10) + 1) + '</span> / <span id="lg-counter-all">' + this.$items.length + '</span></div>');
904        }
905    };
906
907    /**
908     *  @desc add sub-html into the slide
909     *  @param {Number} index - index of the slide
910     */
911    Plugin.prototype.addHtml = function(index) {
912        var subHtml = null;
913        var subHtmlUrl;
914        if (this.s.dynamic) {
915            if (this.s.dynamicEl[index].subHtmlUrl) {
916                subHtmlUrl = this.s.dynamicEl[index].subHtmlUrl;
917            } else {
918                subHtml = this.s.dynamicEl[index].subHtml;
919            }
920        } else {
921            if (this.$items.eq(index).attr('data-sub-html-url')) {
922                subHtmlUrl = this.$items.eq(index).attr('data-sub-html-url');
923            } else {
924
925                subHtml = this.$items.eq(index).attr('data-sub-html');
926                if (this.s.getCaptionFromTitleOrAlt && !subHtml) {
927                    subHtml = this.$items.eq(index).attr('title') || this.$items.eq(index).find('img').first().attr('alt');
928                }
929            }
930        }
931
932        if (!subHtmlUrl) {
933            if (typeof subHtml !== 'undefined' && subHtml !== null) {
934
935                // get first letter of subhtml
936                // if first letter starts with . or # get the html form the jQuery object
937                var fL = subHtml.substring(0, 1);
938                if (fL === '.' || fL === '#') {
939                    subHtml = $(subHtml).html();
940                }
941            } else {
942                subHtml = '';
943            }
944        }
945
946        if (this.s.appendSubHtmlTo === '.lg-sub-html') {
947
948            if (subHtmlUrl) {
949                this.$outer.find(this.s.appendSubHtmlTo).load(subHtmlUrl);
950            } else {
951                this.$outer.find(this.s.appendSubHtmlTo).html(subHtml);
952            }
953
954        } else {
955
956            if (subHtmlUrl) {
957                this.$slide.eq(index).load(subHtmlUrl);
958            } else {
959                this.$slide.eq(index).append(subHtml);
960            }
961        }
962
963        // Add lg-empty-html class if title doesn't exist
964        if (typeof subHtml !== 'undefined' && subHtml !== null) {
965            if (subHtml === '') {
966                this.$outer.find(this.s.appendSubHtmlTo).addClass('lg-empty-html');
967            } else {
968                this.$outer.find(this.s.appendSubHtmlTo).removeClass('lg-empty-html');
969            }
970        }
971
972        this.$el.trigger('onAfterAppendSubHtml.lg', [index]);
973    };
974
975    /**
976     *  @desc Preload slides
977     *  @param {Number} index - index of the slide
978     */
979    Plugin.prototype.preload = function(index) {
980        var i = 1;
981        var j = 1;
982        for (i = 1; i <= this.s.preload; i++) {
983            if (i >= this.$items.length - index) {
984                break;
985            }
986
987            this.loadContent(index + i, false, 0);
988        }
989
990        for (j = 1; j <= this.s.preload; j++) {
991            if (index - j < 0) {
992                break;
993            }
994
995            this.loadContent(index - j, false, 0);
996        }
997    };
998
999    /**
1000     *  @desc Load slide content into slide.
1001     *  @param {Number} index - index of the slide.
1002     *  @param {Boolean} rec - if true call loadcontent() function again.
1003     *  @param {Boolean} delay - delay for adding complete class. it is 0 except first time.
1004     */
1005    Plugin.prototype.loadContent = function(index, rec, delay) {
1006
1007        var _this = this;
1008        var _hasPoster = false;
1009        var _$img;
1010        var _src;
1011        var _poster;
1012        var _srcset;
1013        var _sizes;
1014        var _html;
1015        var getResponsiveSrc = function(srcItms) {
1016            var rsWidth = [];
1017            var rsSrc = [];
1018            for (var i = 0; i < srcItms.length; i++) {
1019                var __src = srcItms[i].split(' ');
1020
1021                // Manage empty space
1022                if (__src[0] === '') {
1023                    __src.splice(0, 1);
1024                }
1025
1026                rsSrc.push(__src[0]);
1027                rsWidth.push(__src[1]);
1028            }
1029
1030            var wWidth = $(window).width();
1031            for (var j = 0; j < rsWidth.length; j++) {
1032                if (parseInt(rsWidth[j], 10) > wWidth) {
1033                    _src = rsSrc[j];
1034                    break;
1035                }
1036            }
1037        };
1038
1039        if (_this.s.dynamic) {
1040
1041            if (_this.s.dynamicEl[index].poster) {
1042                _hasPoster = true;
1043                _poster = _this.s.dynamicEl[index].poster;
1044            }
1045
1046            _html = _this.s.dynamicEl[index].html;
1047            _src = _this.s.dynamicEl[index].src;
1048
1049            if (_this.s.dynamicEl[index].responsive) {
1050                var srcDyItms = _this.s.dynamicEl[index].responsive.split(',');
1051                getResponsiveSrc(srcDyItms);
1052            }
1053
1054            _srcset = _this.s.dynamicEl[index].srcset;
1055            _sizes = _this.s.dynamicEl[index].sizes;
1056
1057        } else {
1058
1059            if (_this.$items.eq(index).attr('data-poster')) {
1060                _hasPoster = true;
1061                _poster = _this.$items.eq(index).attr('data-poster');
1062            }
1063
1064            _html = _this.$items.eq(index).attr('data-html');
1065            _src = _this.$items.eq(index).attr('href') || _this.$items.eq(index).attr('data-src');
1066
1067            if (_this.$items.eq(index).attr('data-responsive')) {
1068                var srcItms = _this.$items.eq(index).attr('data-responsive').split(',');
1069                getResponsiveSrc(srcItms);
1070            }
1071
1072            _srcset = _this.$items.eq(index).attr('data-srcset');
1073            _sizes = _this.$items.eq(index).attr('data-sizes');
1074
1075        }
1076
1077        //if (_src || _srcset || _sizes || _poster) {
1078
1079        var iframe = false;
1080        if (_this.s.dynamic) {
1081            if (_this.s.dynamicEl[index].iframe) {
1082                iframe = true;
1083            }
1084        } else {
1085            if (_this.$items.eq(index).attr('data-iframe') === 'true') {
1086                iframe = true;
1087            }
1088        }
1089
1090        var _isVideo = _this.isVideo(_src, index);
1091        if (!_this.$slide.eq(index).hasClass('lg-loaded')) {
1092            if (iframe) {
1093                _this.$slide.eq(index).prepend('<div class="lg-video-cont" style="max-width:' + _this.s.iframeMaxWidth + '"><div class="lg-video"><iframe class="lg-object" frameborder="0" src="' + _src + '"  allowfullscreen="true"></iframe></div></div>');
1094            } else if (_hasPoster) {
1095                var videoClass = '';
1096                if (_isVideo && _isVideo.youtube) {
1097                    videoClass = 'lg-has-youtube';
1098                } else if (_isVideo && _isVideo.vimeo) {
1099                    videoClass = 'lg-has-vimeo';
1100                } else {
1101                    videoClass = 'lg-has-html5';
1102                }
1103
1104                _this.$slide.eq(index).prepend('<div class="lg-video-cont ' + videoClass + ' "><div class="lg-video"><span class="lg-video-play"></span><img class="lg-object lg-has-poster" src="' + _poster + '" /></div></div>');
1105
1106            } else if (_isVideo) {
1107                _this.$slide.eq(index).prepend('<div class="lg-video-cont "><div class="lg-video"></div></div>');
1108                _this.$el.trigger('hasVideo.lg', [index, _src, _html]);
1109            } else {
1110                _this.$slide.eq(index).prepend('<div class="lg-img-wrap"><img class="lg-object lg-image" src="' + _src + '" /></div>');
1111            }
1112
1113            _this.$el.trigger('onAferAppendSlide.lg', [index]);
1114
1115            _$img = _this.$slide.eq(index).find('.lg-object');
1116            if (_sizes) {
1117                _$img.attr('sizes', _sizes);
1118            }
1119
1120            if (_srcset) {
1121                _$img.attr('srcset', _srcset);
1122                try {
1123                    picturefill({
1124                        elements: [_$img[0]]
1125                    });
1126                } catch (e) {
1127                    console.error('Make sure you have included Picturefill version 2');
1128                }
1129            }
1130
1131            if (this.s.appendSubHtmlTo !== '.lg-sub-html') {
1132                _this.addHtml(index);
1133            }
1134
1135            _this.$slide.eq(index).addClass('lg-loaded');
1136        }
1137
1138        _this.$slide.eq(index).find('.lg-object').on('load.lg error.lg', function() {
1139
1140            // For first time add some delay for displaying the start animation.
1141            var _speed = 0;
1142
1143            // Do not change the delay value because it is required for zoom plugin.
1144            // If gallery opened from direct url (hash) speed value should be 0
1145            if (delay && !$('body').hasClass('lg-from-hash')) {
1146                _speed = delay;
1147            }
1148
1149            setTimeout(function() {
1150                _this.$slide.eq(index).addClass('lg-complete');
1151                _this.$el.trigger('onSlideItemLoad.lg', [index, delay || 0]);
1152            }, _speed);
1153
1154        });
1155
1156        // @todo check load state for html5 videos
1157        if (_isVideo && _isVideo.html5 && !_hasPoster) {
1158            _this.$slide.eq(index).addClass('lg-complete');
1159        }
1160
1161        if (rec === true) {
1162            if (!_this.$slide.eq(index).hasClass('lg-complete')) {
1163                _this.$slide.eq(index).find('.lg-object').on('load.lg error.lg', function() {
1164                    _this.preload(index);
1165                });
1166            } else {
1167                _this.preload(index);
1168            }
1169        }
1170
1171        //}
1172    };
1173
1174    /**
1175    *   @desc slide function for lightgallery
1176        ** Slide() gets call on start
1177        ** ** Set lg.on true once slide() function gets called.
1178        ** Call loadContent() on slide() function inside setTimeout
1179        ** ** On first slide we do not want any animation like slide of fade
1180        ** ** So on first slide( if lg.on if false that is first slide) loadContent() should start loading immediately
1181        ** ** Else loadContent() should wait for the transition to complete.
1182        ** ** So set timeout s.speed + 50
1183    <=> ** loadContent() will load slide content in to the particular slide
1184        ** ** It has recursion (rec) parameter. if rec === true loadContent() will call preload() function.
1185        ** ** preload will execute only when the previous slide is fully loaded (images iframe)
1186        ** ** avoid simultaneous image load
1187    <=> ** Preload() will check for s.preload value and call loadContent() again accoring to preload value
1188        ** loadContent()  <====> Preload();
1189
1190    *   @param {Number} index - index of the slide
1191    *   @param {Boolean} fromTouch - true if slide function called via touch event or mouse drag
1192    *   @param {Boolean} fromThumb - true if slide function called via thumbnail click
1193    */
1194    Plugin.prototype.slide = function(index, fromTouch, fromThumb) {
1195
1196        var _prevIndex = this.$outer.find('.lg-current').index();
1197        var _this = this;
1198
1199        // Prevent if multiple call
1200        // Required for hsh plugin
1201        if (_this.lGalleryOn && (_prevIndex === index)) {
1202            return;
1203        }
1204
1205        var _length = this.$slide.length;
1206        var _time = _this.lGalleryOn ? this.s.speed : 0;
1207        var _next = false;
1208        var _prev = false;
1209
1210        if (!_this.lgBusy) {
1211
1212            if (this.s.download) {
1213                var _src;
1214                if (_this.s.dynamic) {
1215                    _src = _this.s.dynamicEl[index].downloadUrl !== false && (_this.s.dynamicEl[index].downloadUrl || _this.s.dynamicEl[index].src);
1216                } else {
1217                    _src = _this.$items.eq(index).attr('data-download-url') !== 'false' && (_this.$items.eq(index).attr('data-download-url') || _this.$items.eq(index).attr('href') || _this.$items.eq(index).attr('data-src'));
1218
1219                }
1220
1221                if (_src) {
1222                    $('#lg-download').attr('href', _src);
1223                    _this.$outer.removeClass('lg-hide-download');
1224                } else {
1225                    _this.$outer.addClass('lg-hide-download');
1226                }
1227            }
1228
1229            this.$el.trigger('onBeforeSlide.lg', [_prevIndex, index, fromTouch, fromThumb]);
1230
1231            _this.lgBusy = true;
1232
1233            clearTimeout(_this.hideBartimeout);
1234
1235            // Add title if this.s.appendSubHtmlTo === lg-sub-html
1236            if (this.s.appendSubHtmlTo === '.lg-sub-html') {
1237
1238                // wait for slide animation to complete
1239                setTimeout(function() {
1240                    _this.addHtml(index);
1241                }, _time);
1242            }
1243
1244            this.arrowDisable(index);
1245
1246            if (!fromTouch) {
1247
1248                // remove all transitions
1249                _this.$outer.addClass('lg-no-trans');
1250
1251                this.$slide.removeClass('lg-prev-slide lg-next-slide');
1252
1253                if (index < _prevIndex) {
1254                    _prev = true;
1255                    if ((index === 0) && (_prevIndex === _length - 1) && !fromThumb) {
1256                        _prev = false;
1257                        _next = true;
1258                    }
1259                } else if (index > _prevIndex) {
1260                    _next = true;
1261                    if ((index === _length - 1) && (_prevIndex === 0) && !fromThumb) {
1262                        _prev = true;
1263                        _next = false;
1264                    }
1265                }
1266
1267                if (_prev) {
1268
1269                    //prevslide
1270                    this.$slide.eq(index).addClass('lg-prev-slide');
1271                    this.$slide.eq(_prevIndex).addClass('lg-next-slide');
1272                } else if (_next) {
1273
1274                    // next slide
1275                    this.$slide.eq(index).addClass('lg-next-slide');
1276                    this.$slide.eq(_prevIndex).addClass('lg-prev-slide');
1277                }
1278
1279                // give 50 ms for browser to add/remove class
1280                setTimeout(function() {
1281                    _this.$slide.removeClass('lg-current');
1282
1283                    //_this.$slide.eq(_prevIndex).removeClass('lg-current');
1284                    _this.$slide.eq(index).addClass('lg-current');
1285
1286                    // reset all transitions
1287                    _this.$outer.removeClass('lg-no-trans');
1288                }, 50);
1289            } else {
1290
1291                var touchPrev = index - 1;
1292                var touchNext = index + 1;
1293
1294                if ((index === 0) && (_prevIndex === _length - 1)) {
1295
1296                    // next slide
1297                    touchNext = 0;
1298                    touchPrev = _length - 1;
1299                } else if ((index === _length - 1) && (_prevIndex === 0)) {
1300
1301                    // prev slide
1302                    touchNext = 0;
1303                    touchPrev = _length - 1;
1304                }
1305
1306                this.$slide.removeClass('lg-prev-slide lg-current lg-next-slide');
1307                _this.$slide.eq(touchPrev).addClass('lg-prev-slide');
1308                _this.$slide.eq(touchNext).addClass('lg-next-slide');
1309                _this.$slide.eq(index).addClass('lg-current');
1310            }
1311
1312            if (_this.lGalleryOn) {
1313                setTimeout(function() {
1314                    _this.loadContent(index, true, 0);
1315                }, this.s.speed + 50);
1316
1317                setTimeout(function() {
1318                    _this.lgBusy = false;
1319                    _this.$el.trigger('onAfterSlide.lg', [_prevIndex, index, fromTouch, fromThumb]);
1320                }, this.s.speed);
1321
1322            } else {
1323                _this.loadContent(index, true, _this.s.backdropDuration);
1324
1325                _this.lgBusy = false;
1326                _this.$el.trigger('onAfterSlide.lg', [_prevIndex, index, fromTouch, fromThumb]);
1327            }
1328
1329            _this.lGalleryOn = true;
1330
1331            if (this.s.counter) {
1332                $('#lg-counter-current').text(index + 1);
1333            }
1334
1335        }
1336
1337    };
1338
1339    /**
1340     *  @desc Go to next slide
1341     *  @param {Boolean} fromTouch - true if slide function called via touch event
1342     */
1343    Plugin.prototype.goToNextSlide = function(fromTouch) {
1344        var _this = this;
1345        if (!_this.lgBusy) {
1346            if ((_this.index + 1) < _this.$slide.length) {
1347                _this.index++;
1348                _this.$el.trigger('onBeforeNextSlide.lg', [_this.index]);
1349                _this.slide(_this.index, fromTouch, false);
1350            } else {
1351                if (_this.s.loop) {
1352                    _this.index = 0;
1353                    _this.$el.trigger('onBeforeNextSlide.lg', [_this.index]);
1354                    _this.slide(_this.index, fromTouch, false);
1355                } else if (_this.s.slideEndAnimatoin) {
1356                    _this.$outer.addClass('lg-right-end');
1357                    setTimeout(function() {
1358                        _this.$outer.removeClass('lg-right-end');
1359                    }, 400);
1360                }
1361            }
1362        }
1363    };
1364
1365    /**
1366     *  @desc Go to previous slide
1367     *  @param {Boolean} fromTouch - true if slide function called via touch event
1368     */
1369    Plugin.prototype.goToPrevSlide = function(fromTouch) {
1370        var _this = this;
1371        if (!_this.lgBusy) {
1372            if (_this.index > 0) {
1373                _this.index--;
1374                _this.$el.trigger('onBeforePrevSlide.lg', [_this.index, fromTouch]);
1375                _this.slide(_this.index, fromTouch, false);
1376            } else {
1377                if (_this.s.loop) {
1378                    _this.index = _this.$items.length - 1;
1379                    _this.$el.trigger('onBeforePrevSlide.lg', [_this.index, fromTouch]);
1380                    _this.slide(_this.index, fromTouch, false);
1381                } else if (_this.s.slideEndAnimatoin) {
1382                    _this.$outer.addClass('lg-left-end');
1383                    setTimeout(function() {
1384                        _this.$outer.removeClass('lg-left-end');
1385                    }, 400);
1386                }
1387            }
1388        }
1389    };
1390
1391    Plugin.prototype.keyPress = function() {
1392        var _this = this;
1393        if (this.$items.length > 1) {
1394            $(window).on('keyup.lg', function(e) {
1395                if (_this.$items.length > 1) {
1396                    if (e.keyCode === 37) {
1397                        e.preventDefault();
1398                        _this.goToPrevSlide();
1399                    }
1400
1401                    if (e.keyCode === 39) {
1402                        e.preventDefault();
1403                        _this.goToNextSlide();
1404                    }
1405                }
1406            });
1407        }
1408
1409        $(window).on('keydown.lg', function(e) {
1410            if (_this.s.escKey === true && e.keyCode === 27) {
1411                e.preventDefault();
1412                if (!_this.$outer.hasClass('lg-thumb-open')) {
1413                    _this.destroy();
1414                } else {
1415                    _this.$outer.removeClass('lg-thumb-open');
1416                }
1417            }
1418        });
1419    };
1420
1421    Plugin.prototype.arrow = function() {
1422        var _this = this;
1423        this.$outer.find('.lg-prev').on('click.lg', function() {
1424            _this.goToPrevSlide();
1425        });
1426
1427        this.$outer.find('.lg-next').on('click.lg', function() {
1428            _this.goToNextSlide();
1429        });
1430    };
1431
1432    Plugin.prototype.arrowDisable = function(index) {
1433
1434        // Disable arrows if s.hideControlOnEnd is true
1435        if (!this.s.loop && this.s.hideControlOnEnd) {
1436            if ((index + 1) < this.$slide.length) {
1437                this.$outer.find('.lg-next').removeAttr('disabled').removeClass('disabled');
1438            } else {
1439                this.$outer.find('.lg-next').attr('disabled', 'disabled').addClass('disabled');
1440            }
1441
1442            if (index > 0) {
1443                this.$outer.find('.lg-prev').removeAttr('disabled').removeClass('disabled');
1444            } else {
1445                this.$outer.find('.lg-prev').attr('disabled', 'disabled').addClass('disabled');
1446            }
1447        }
1448    };
1449
1450    Plugin.prototype.setTranslate = function($el, xValue, yValue) {
1451        // jQuery supports Automatic CSS prefixing since jQuery 1.8.0
1452        if (this.s.useLeft) {
1453            $el.css('left', xValue);
1454        } else {
1455            $el.css({
1456                transform: 'translate3d(' + (xValue) + 'px, ' + yValue + 'px, 0px)'
1457            });
1458        }
1459    };
1460
1461    Plugin.prototype.touchMove = function(startCoords, endCoords) {
1462
1463        var distance = endCoords - startCoords;
1464
1465        if (Math.abs(distance) > 15) {
1466            // reset opacity and transition duration
1467            this.$outer.addClass('lg-dragging');
1468
1469            // move current slide
1470            this.setTranslate(this.$slide.eq(this.index), distance, 0);
1471
1472            // move next and prev slide with current slide
1473            this.setTranslate($('.lg-prev-slide'), -this.$slide.eq(this.index).width() + distance, 0);
1474            this.setTranslate($('.lg-next-slide'), this.$slide.eq(this.index).width() + distance, 0);
1475        }
1476    };
1477
1478    Plugin.prototype.touchEnd = function(distance) {
1479        var _this = this;
1480
1481        // keep slide animation for any mode while dragg/swipe
1482        if (_this.s.mode !== 'lg-slide') {
1483            _this.$outer.addClass('lg-slide');
1484        }
1485
1486        this.$slide.not('.lg-current, .lg-prev-slide, .lg-next-slide').css('opacity', '0');
1487
1488        // set transition duration
1489        setTimeout(function() {
1490            _this.$outer.removeClass('lg-dragging');
1491            if ((distance < 0) && (Math.abs(distance) > _this.s.swipeThreshold)) {
1492                _this.goToNextSlide(true);
1493            } else if ((distance > 0) && (Math.abs(distance) > _this.s.swipeThreshold)) {
1494                _this.goToPrevSlide(true);
1495            } else if (Math.abs(distance) < 5) {
1496
1497                // Trigger click if distance is less than 5 pix
1498                _this.$el.trigger('onSlideClick.lg');
1499            }
1500
1501            _this.$slide.removeAttr('style');
1502        });
1503
1504        // remove slide class once drag/swipe is completed if mode is not slide
1505        setTimeout(function() {
1506            if (!_this.$outer.hasClass('lg-dragging') && _this.s.mode !== 'lg-slide') {
1507                _this.$outer.removeClass('lg-slide');
1508            }
1509        }, _this.s.speed + 100);
1510
1511    };
1512
1513    Plugin.prototype.enableSwipe = function() {
1514        var _this = this;
1515        var startCoords = 0;
1516        var endCoords = 0;
1517        var isMoved = false;
1518
1519        if (_this.s.enableSwipe && _this.isTouch && _this.doCss()) {
1520
1521            _this.$slide.on('touchstart.lg', function(e) {
1522                if (!_this.$outer.hasClass('lg-zoomed') && !_this.lgBusy) {
1523                    e.preventDefault();
1524                    _this.manageSwipeClass();
1525                    startCoords = e.originalEvent.targetTouches[0].pageX;
1526                }
1527            });
1528
1529            _this.$slide.on('touchmove.lg', function(e) {
1530                if (!_this.$outer.hasClass('lg-zoomed')) {
1531                    e.preventDefault();
1532                    endCoords = e.originalEvent.targetTouches[0].pageX;
1533                    _this.touchMove(startCoords, endCoords);
1534                    isMoved = true;
1535                }
1536            });
1537
1538            _this.$slide.on('touchend.lg', function() {
1539                if (!_this.$outer.hasClass('lg-zoomed')) {
1540                    if (isMoved) {
1541                        isMoved = false;
1542                        _this.touchEnd(endCoords - startCoords);
1543                    } else {
1544                        _this.$el.trigger('onSlideClick.lg');
1545                    }
1546                }
1547            });
1548        }
1549
1550    };
1551
1552    Plugin.prototype.enableDrag = function() {
1553        var _this = this;
1554        var startCoords = 0;
1555        var endCoords = 0;
1556        var isDraging = false;
1557        var isMoved = false;
1558        if (_this.s.enableDrag && !_this.isTouch && _this.doCss()) {
1559            _this.$slide.on('mousedown.lg', function(e) {
1560                // execute only on .lg-object
1561                if (!_this.$outer.hasClass('lg-zoomed')) {
1562                    if ($(e.target).hasClass('lg-object') || $(e.target).hasClass('lg-video-play')) {
1563                        e.preventDefault();
1564
1565                        if (!_this.lgBusy) {
1566                            _this.manageSwipeClass();
1567                            startCoords = e.pageX;
1568                            isDraging = true;
1569
1570                            // ** Fix for webkit cursor issue https://code.google.com/p/chromium/issues/detail?id=26723
1571                            _this.$outer.scrollLeft += 1;
1572                            _this.$outer.scrollLeft -= 1;
1573
1574                            // *
1575
1576                            _this.$outer.removeClass('lg-grab').addClass('lg-grabbing');
1577
1578                            _this.$el.trigger('onDragstart.lg');
1579                        }
1580
1581                    }
1582                }
1583            });
1584
1585            $(window).on('mousemove.lg', function(e) {
1586                if (isDraging) {
1587                    isMoved = true;
1588                    endCoords = e.pageX;
1589                    _this.touchMove(startCoords, endCoords);
1590                    _this.$el.trigger('onDragmove.lg');
1591                }
1592            });
1593
1594            $(window).on('mouseup.lg', function(e) {
1595                if (isMoved) {
1596                    isMoved = false;
1597                    _this.touchEnd(endCoords - startCoords);
1598                    _this.$el.trigger('onDragend.lg');
1599                } else if ($(e.target).hasClass('lg-object') || $(e.target).hasClass('lg-video-play')) {
1600                    _this.$el.trigger('onSlideClick.lg');
1601                }
1602
1603                // Prevent execution on click
1604                if (isDraging) {
1605                    isDraging = false;
1606                    _this.$outer.removeClass('lg-grabbing').addClass('lg-grab');
1607                }
1608            });
1609
1610        }
1611    };
1612
1613    Plugin.prototype.manageSwipeClass = function() {
1614        var touchNext = this.index + 1;
1615        var touchPrev = this.index - 1;
1616        var length = this.$slide.length;
1617        if (this.s.loop) {
1618            if (this.index === 0) {
1619                touchPrev = length - 1;
1620            } else if (this.index === length - 1) {
1621                touchNext = 0;
1622            }
1623        }
1624
1625        this.$slide.removeClass('lg-next-slide lg-prev-slide');
1626        if (touchPrev > -1) {
1627            this.$slide.eq(touchPrev).addClass('lg-prev-slide');
1628        }
1629
1630        this.$slide.eq(touchNext).addClass('lg-next-slide');
1631    };
1632
1633    Plugin.prototype.mousewheel = function() {
1634        var _this = this;
1635        _this.$outer.on('mousewheel.lg', function(e) {
1636
1637            if (!e.deltaY) {
1638                return;
1639            }
1640
1641            if (e.deltaY > 0) {
1642                _this.goToPrevSlide();
1643            } else {
1644                _this.goToNextSlide();
1645            }
1646
1647            e.preventDefault();
1648        });
1649
1650    };
1651
1652    Plugin.prototype.closeGallery = function() {
1653
1654        var _this = this;
1655        var mousedown = false;
1656        this.$outer.find('.lg-close').on('click.lg', function() {
1657            _this.destroy();
1658        });
1659
1660        if (_this.s.closable) {
1661
1662            // If you drag the slide and release outside gallery gets close on chrome
1663            // for preventing this check mousedown and mouseup happened on .lg-item or lg-outer
1664            _this.$outer.on('mousedown.lg', function(e) {
1665
1666                if ($(e.target).is('.lg-outer') || $(e.target).is('.lg-item ') || $(e.target).is('.lg-img-wrap')) {
1667                    mousedown = true;
1668                } else {
1669                    mousedown = false;
1670                }
1671
1672            });
1673
1674            _this.$outer.on('mouseup.lg', function(e) {
1675
1676                if ($(e.target).is('.lg-outer') || $(e.target).is('.lg-item ') || $(e.target).is('.lg-img-wrap') && mousedown) {
1677                    if (!_this.$outer.hasClass('lg-dragging')) {
1678                        _this.destroy();
1679                    }
1680                }
1681
1682            });
1683
1684        }
1685
1686    };
1687
1688    Plugin.prototype.destroy = function(d) {
1689
1690        var _this = this;
1691
1692        if (!d) {
1693            _this.$el.trigger('onBeforeClose.lg');
1694        }
1695
1696        $(window).scrollTop(_this.prevScrollTop);
1697
1698        /**
1699         * if d is false or undefined destroy will only close the gallery
1700         * plugins instance remains with the element
1701         *
1702         * if d is true destroy will completely remove the plugin
1703         */
1704
1705        if (d) {
1706            if (!_this.s.dynamic) {
1707                // only when not using dynamic mode is $items a jquery collection
1708                this.$items.off('click.lg click.lgcustom');
1709            }
1710
1711            $.removeData(_this.el, 'lightGallery');
1712        }
1713
1714        // Unbind all events added by lightGallery
1715        this.$el.off('.lg.tm');
1716
1717        // Distroy all lightGallery modules
1718        $.each($.fn.lightGallery.modules, function(key) {
1719            if (_this.modules[key]) {
1720                _this.modules[key].destroy();
1721            }
1722        });
1723
1724        this.lGalleryOn = false;
1725
1726        clearTimeout(_this.hideBartimeout);
1727        this.hideBartimeout = false;
1728        $(window).off('.lg');
1729        $('body').removeClass('lg-on lg-from-hash');
1730
1731        if (_this.$outer) {
1732            _this.$outer.removeClass('lg-visible');
1733        }
1734
1735        $('.lg-backdrop').removeClass('in');
1736
1737        setTimeout(function() {
1738            if (_this.$outer) {
1739                _this.$outer.remove();
1740            }
1741
1742            $('.lg-backdrop').remove();
1743
1744            if (!d) {
1745                _this.$el.trigger('onCloseAfter.lg');
1746            }
1747
1748        }, _this.s.backdropDuration + 50);
1749    };
1750
1751    $.fn.lightGallery = function(options) {
1752        return this.each(function() {
1753            if (!$.data(this, 'lightGallery')) {
1754                $.data(this, 'lightGallery', new Plugin(this, options));
1755            } else {
1756                try {
1757                    $(this).data('lightGallery').init();
1758                } catch (err) {
1759                    console.error('lightGallery has not initiated properly');
1760                }
1761            }
1762        });
1763    };
1764
1765    $.fn.lightGallery.modules = {};
1766
1767})(jQuery, window, document);
1768
1769
1770
1771
1772
1773
1774
1775(function($, window, document, undefined) {
1776
1777    'use strict';
1778
1779    var defaults = {
1780        thumbnail: true,
1781
1782        animateThumb: true,
1783        currentPagerPosition: 'middle',
1784
1785        thumbWidth: 100,
1786        thumbContHeight: 100,
1787        thumbMargin: 5,
1788
1789        exThumbImage: false,
1790        showThumbByDefault: true,
1791        toogleThumb: true,
1792        pullCaptionUp: true,
1793
1794        enableThumbDrag: true,
1795        enableThumbSwipe: true,
1796        swipeThreshold: 50,
1797
vendor: 10,592 bytes, lines 1798-2090
1798        loadYoutubeThumbnail: true,
1799        youtubeThumbSize: 1,
1800
1801        loadVimeoThumbnail: true,
1802        vimeoThumbSize: 'thumbnail_small',
1803
1804        loadDailymotionThumbnail: true
1805    };
1806
1807    var Thumbnail = function(element) {
1808
1809        // get lightGallery core plugin data
1810        this.core = $(element).data('lightGallery');
1811
1812        // extend module default settings with lightGallery core settings
1813        this.core.s = $.extend({}, defaults, this.core.s);
1814
1815        this.$el = $(element);
1816        this.$thumbOuter = null;
1817        this.thumbOuterWidth = 0;
1818        this.thumbTotalWidth = (this.core.$items.length * (this.core.s.thumbWidth + this.core.s.thumbMargin));
1819        this.thumbIndex = this.core.index;
1820
1821        // Thumbnail animation value
1822        this.left = 0;
1823
1824        this.init();
1825
1826        return this;
1827    };
1828
1829    Thumbnail.prototype.init = function() {
1830        var _this = this;
1831        if (this.core.s.thumbnail && this.core.$items.length > 1) {
1832            if (this.core.s.showThumbByDefault) {
1833                setTimeout(function(){
1834                    _this.core.$outer.addClass('lg-thumb-open');
1835                }, 700);
1836            }
1837
1838            if (this.core.s.pullCaptionUp) {
1839                this.core.$outer.addClass('lg-pull-caption-up');
1840            }
1841
1842            this.build();
1843            if (this.core.s.animateThumb) {
1844                if (this.core.s.enableThumbDrag && !this.core.isTouch && this.core.doCss()) {
1845                    this.enableThumbDrag();
1846                }
1847
1848                if (this.core.s.enableThumbSwipe && this.core.isTouch && this.core.doCss()) {
1849                    this.enableThumbSwipe();
1850                }
1851
1852                this.thumbClickable = false;
1853            } else {
1854                this.thumbClickable = true;
1855            }
1856
1857            this.toogle();
1858            this.thumbkeyPress();
1859        }
1860    };
1861
1862    Thumbnail.prototype.build = function() {
1863        var _this = this;
1864        var thumbList = '';
1865        var vimeoErrorThumbSize = '';
1866        var $thumb;
1867        var html = '<div class="lg-thumb-outer">' +
1868            '<div class="lg-thumb group">' +
1869            '</div>' +
1870            '</div>';
1871
1872        switch (this.core.s.vimeoThumbSize) {
1873            case 'thumbnail_large':
1874                vimeoErrorThumbSize = '640';
1875                break;
1876            case 'thumbnail_medium':
1877                vimeoErrorThumbSize = '200x150';
1878                break;
1879            case 'thumbnail_small':
1880                vimeoErrorThumbSize = '100x75';
1881        }
1882
1883        _this.core.$outer.addClass('lg-has-thumb');
1884
1885        _this.core.$outer.find('.lg').append(html);
1886
1887        _this.$thumbOuter = _this.core.$outer.find('.lg-thumb-outer');
1888        _this.thumbOuterWidth = _this.$thumbOuter.width();
1889
1890        if (_this.core.s.animateThumb) {
1891            _this.core.$outer.find('.lg-thumb').css({
1892                width: _this.thumbTotalWidth + 'px',
1893                position: 'relative'
1894            });
1895        }
1896
1897        if (this.core.s.animateThumb) {
1898            _this.$thumbOuter.css('height', _this.core.s.thumbContHeight + 'px');
1899        }
1900
1901        function getThumb(src, thumb, index) {
1902            var isVideo = _this.core.isVideo(src, index) || {};
1903            var thumbImg;
1904            var vimeoId = '';
1905
1906            if (isVideo.youtube || isVideo.vimeo || isVideo.dailymotion) {
1907                if (isVideo.youtube) {
1908                    if (_this.core.s.loadYoutubeThumbnail) {
1909                        thumbImg = '//img.youtube.com/vi/' + isVideo.youtube[1] + '/' + _this.core.s.youtubeThumbSize + '.jpg';
1910                    } else {
1911                        thumbImg = thumb;
1912                    }
1913                } else if (isVideo.vimeo) {
1914                    if (_this.core.s.loadVimeoThumbnail) {
1915                        thumbImg = '//i.vimeocdn.com/video/error_' + vimeoErrorThumbSize + '.jpg';
1916                        vimeoId = isVideo.vimeo[1];
1917                    } else {
1918                        thumbImg = thumb;
1919                    }
1920                } else if (isVideo.dailymotion) {
1921                    if (_this.core.s.loadDailymotionThumbnail) {
1922                        thumbImg = '//www.dailymotion.com/thumbnail/video/' + isVideo.dailymotion[1];
1923                    } else {
1924                        thumbImg = thumb;
1925                    }
1926                }
1927            } else {
1928                thumbImg = thumb;
1929            }
1930
1931            thumbList += '<div data-vimeo-id="' + vimeoId + '" class="lg-thumb-item" style="width:' + _this.core.s.thumbWidth + 'px; margin-right: ' + _this.core.s.thumbMargin + 'px"><img src="' + thumbImg + '" /></div>';
1932            vimeoId = '';
1933        }
1934
1935        if (_this.core.s.dynamic) {
1936            for (var i = 0; i < _this.core.s.dynamicEl.length; i++) {
1937                getThumb(_this.core.s.dynamicEl[i].src, _this.core.s.dynamicEl[i].thumb, i);
1938            }
1939        } else {
1940            _this.core.$items.each(function(i) {
1941
1942                if (!_this.core.s.exThumbImage) {
1943                    getThumb($(this).attr('href') || $(this).attr('data-src'), $(this).find('img').attr('src'), i);
1944                } else {
1945                    getThumb($(this).attr('href') || $(this).attr('data-src'), $(this).attr(_this.core.s.exThumbImage), i);
1946                }
1947
1948            });
1949        }
1950
1951        _this.core.$outer.find('.lg-thumb').html(thumbList);
1952
1953        $thumb = _this.core.$outer.find('.lg-thumb-item');
1954
1955        // Load vimeo thumbnails
1956        $thumb.each(function() {
1957            var $this = $(this);
1958            var vimeoVideoId = $this.attr('data-vimeo-id');
1959
1960            if (vimeoVideoId) {
1961                $.getJSON('//www.vimeo.com/api/v2/video/' + vimeoVideoId + '.json?callback=?', {
1962                    format: 'json'
1963                }, function(data) {
1964                    $this.find('img').attr('src', data[0][_this.core.s.vimeoThumbSize]);
1965                });
1966            }
1967        });
1968
1969        // manage active class for thumbnail
1970        $thumb.eq(_this.core.index).addClass('active');
1971        _this.core.$el.on('onBeforeSlide.lg.tm', function() {
1972            $thumb.removeClass('active');
1973            $thumb.eq(_this.core.index).addClass('active');
1974        });
1975
1976        $thumb.on('click.lg touchend.lg', function() {
1977            var _$this = $(this);
1978            setTimeout(function() {
1979
1980                // In IE9 and bellow touch does not support
1981                // Go to slide if browser does not support css transitions
1982                if ((_this.thumbClickable && !_this.core.lgBusy) || !_this.core.doCss()) {
1983                    _this.core.index = _$this.index();
1984                    _this.core.slide(_this.core.index, false, true);
1985                }
1986            }, 50);
1987        });
1988
1989        _this.core.$el.on('onBeforeSlide.lg.tm', function() {
1990            _this.animateThumb(_this.core.index);
1991        });
1992
1993        $(window).on('resize.lg.thumb orientationchange.lg.thumb', function() {
1994            setTimeout(function() {
1995                _this.animateThumb(_this.core.index);
1996                _this.thumbOuterWidth = _this.$thumbOuter.width();
1997            }, 200);
1998        });
1999
2000    };
2001
2002    Thumbnail.prototype.setTranslate = function(value) {
2003        // jQuery supports Automatic CSS prefixing since jQuery 1.8.0
2004        this.core.$outer.find('.lg-thumb').css({
2005            transform: 'translate3d(-' + (value) + 'px, 0px, 0px)'
2006        });
2007    };
2008
2009    Thumbnail.prototype.animateThumb = function(index) {
2010        var $thumb = this.core.$outer.find('.lg-thumb');
2011        if (this.core.s.animateThumb) {
2012            var position;
2013            switch (this.core.s.currentPagerPosition) {
2014                case 'left':
2015                    position = 0;
2016                    break;
2017                case 'middle':
2018                    position = (this.thumbOuterWidth / 2) - (this.core.s.thumbWidth / 2);
2019                    break;
2020                case 'right':
2021                    position = this.thumbOuterWidth - this.core.s.thumbWidth;
2022            }
2023            this.left = ((this.core.s.thumbWidth + this.core.s.thumbMargin) * index - 1) - position;
2024            if (this.left > (this.thumbTotalWidth - this.thumbOuterWidth)) {
2025                this.left = this.thumbTotalWidth - this.thumbOuterWidth;
2026            }
2027
2028            if (this.left < 0) {
2029                this.left = 0;
2030            }
2031
2032            if (this.core.lGalleryOn) {
2033                if (!$thumb.hasClass('on')) {
2034                    this.core.$outer.find('.lg-thumb').css('transition-duration', this.core.s.speed + 'ms');
2035                }
2036
2037                if (!this.core.doCss()) {
2038                    $thumb.animate({
2039                        left: -this.left + 'px'
2040                    }, this.core.s.speed);
2041                }
2042            } else {
2043                if (!this.core.doCss()) {
2044                    $thumb.css('left', -this.left + 'px');
2045                }
2046            }
2047
2048            this.setTranslate(this.left);
2049
2050        }
2051    };
2052
2053    // Enable thumbnail dragging and swiping
2054    Thumbnail.prototype.enableThumbDrag = function() {
2055
2056        var _this = this;
2057        var startCoords = 0;
2058        var endCoords = 0;
2059        var isDraging = false;
2060        var isMoved = false;
2061        var tempLeft = 0;
2062
2063        _this.$thumbOuter.addClass('lg-grab');
2064
2065        _this.core.$outer.find('.lg-thumb').on('mousedown.lg.thumb', function(e) {
2066            if (_this.thumbTotalWidth > _this.thumbOuterWidth) {
2067                // execute only on .lg-object
2068                e.preventDefault();
2069                startCoords = e.pageX;
2070                isDraging = true;
2071
2072                // ** Fix for webkit cursor issue https://code.google.com/p/chromium/issues/detail?id=26723
2073                _this.core.$outer.scrollLeft += 1;
2074                _this.core.$outer.scrollLeft -= 1;
2075
2076                // *
2077                _this.thumbClickable = false;
2078                _this.$thumbOuter.removeClass('lg-grab').addClass('lg-grabbing');
2079            }
2080        });
2081
2082        $(window).on('mousemove.lg.thumb', function(e) {
2083            if (isDraging) {
2084                tempLeft = _this.left;
2085                isMoved = true;
2086                endCoords = e.pageX;
2087
2088                _this.$thumbOuter.addClass('lg-dragging');
2089
2090                tempLeft = tempLeft - (endCoords - startCoords);
2091
2092                if (tempLeft > (_this.thumbTotalWidth - _this.thumbOuterWidth)) {
2093                    tempLeft = _this.thumbTotalWidth - _this.thumbOuterWidth;
2094                }
2095
2096                if (tempLeft < 0) {
2097                    tempLeft = 0;
2098                }
2099
2100                // move current slide
2101                _this.setTranslate(tempLeft);
2102
2103            }
2104        });
2105
2106        $(window).on('mouseup.lg.thumb', function() {
2107            if (isMoved) {
2108                isMoved = false;
2109                _this.$thumbOuter.removeClass('lg-dragging');
2110
2111                _this.left = tempLeft;
2112
2113                if (Math.abs(endCoords - startCoords) < _this.core.s.swipeThreshold) {
2114                    _this.thumbClickable = true;
2115                }
2116
2117            } else {
2118                _this.thumbClickable = true;
2119            }
2120
2121            if (isDraging) {
2122                isDraging = false;
2123                _this.$thumbOuter.removeClass('lg-grabbing').addClass('lg-grab');
2124            }
2125        });
2126
2127    };
2128
2129    Thumbnail.prototype.enableThumbSwipe = function() {
2130        var _this = this;
2131        var startCoords = 0;
2132        var endCoords = 0;
2133        var isMoved = false;
2134        var tempLeft = 0;
2135
2136        _this.core.$outer.find('.lg-thumb').on('touchstart.lg', function(e) {
2137            if (_this.thumbTotalWidth > _this.thumbOuterWidth) {
2138                e.preventDefault();
2139                startCoords = e.originalEvent.targetTouches[0].pageX;
2140                _this.thumbClickable = false;
2141            }
2142        });
2143
2144        _this.core.$outer.find('.lg-thumb').on('touchmove.lg', function(e) {
2145            if (_this.thumbTotalWidth > _this.thumbOuterWidth) {
2146                e.preventDefault();
2147                endCoords = e.originalEvent.targetTouches[0].pageX;
2148                isMoved = true;
2149
2150                _this.$thumbOuter.addClass('lg-dragging');
2151
2152                tempLeft = _this.left;
2153
2154                tempLeft = tempLeft - (endCoords - startCoords);
2155
2156                if (tempLeft > (_this.thumbTotalWidth - _this.thumbOuterWidth)) {
2157                    tempLeft = _this.thumbTotalWidth - _this.thumbOuterWidth;
2158                }
2159
2160                if (tempLeft < 0) {
2161                    tempLeft = 0;
2162                }
2163
2164                // move current slide
2165                _this.setTranslate(tempLeft);
2166
2167            }
2168        });
2169
2170        _this.core.$outer.find('.lg-thumb').on('touchend.lg', function() {
2171            if (_this.thumbTotalWidth > _this.thumbOuterWidth) {
2172
2173                if (isMoved) {
2174                    isMoved = false;
2175                    _this.$thumbOuter.removeClass('lg-dragging');
2176                    if (Math.abs(endCoords - startCoords) < _this.core.s.swipeThreshold) {
2177                        _this.thumbClickable = true;
2178                    }
2179
2180                    _this.left = tempLeft;
2181                } else {
2182                    _this.thumbClickable = true;
2183                }
2184            } else {
2185                _this.thumbClickable = true;
2186            }
2187        });
2188
2189    };
2190
2191    Thumbnail.prototype.toogle = function() {
2192        var _this = this;
2193        if (_this.core.s.toogleThumb) {
2194            _this.core.$outer.addClass('lg-can-toggle');
2195            _this.$thumbOuter.append('<span class="lg-toogle-thumb lg-icon"></span>');
2196            _this.core.$outer.find('.lg-toogle-thumb').on('click.lg', function() {
2197                _this.core.$outer.toggleClass('lg-thumb-open');
2198            });
2199        }
2200    };
2201
2202    Thumbnail.prototype.thumbkeyPress = function() {
2203        var _this = this;
2204        $(window).on('keydown.lg.thumb', function(e) {
2205            if (e.keyCode === 38) {
2206                e.preventDefault();
2207                _this.core.$outer.addClass('lg-thumb-open');
2208            } else if (e.keyCode === 40) {
2209                e.preventDefault();
2210                _this.core.$outer.removeClass('lg-thumb-open');
2211            }
2212        });
2213    };
2214
2215    Thumbnail.prototype.destroy = function() {
2216        if (this.core.s.thumbnail && this.core.$items.length > 1) {
2217            $(window).off('resize.lg.thumb orientationchange.lg.thumb keydown.lg.thumb');
2218            this.$thumbOuter.remove();
2219            this.core.$outer.removeClass('lg-has-thumb');
2220        }
2221    };
2222
2223    $.fn.lightGallery.modules.Thumbnail = Thumbnail;
2224
2225})(jQuery, window, document);
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236(function($, window, document, undefined) {
2237
2238    'use strict';
2239
2240    var defaults = {
2241        fullScreen: true
2242    };
2243
2244    var Fullscreen = function(element) {
2245
2246        // get lightGallery core plugin data
2247        this.core = $(element).data('lightGallery');
2248
2249        this.$el = $(element);
2250
2251        // extend module defalut settings with lightGallery core settings
2252        this.core.s = $.extend({}, defaults, this.core.s);
2253
2254        this.init();
2255
2256        return this;
2257    };
2258
2259    Fullscreen.prototype.init = function() {
2260        var fullScreen = '';
2261        if (this.core.s.fullScreen) {
2262
2263            // check for fullscreen browser support
2264            if (!document.fullscreenEnabled && !document.webkitFullscreenEnabled &&
2265                !document.mozFullScreenEnabled && !document.msFullscreenEnabled) {
2266                return;
2267            } else {
2268                fullScreen = '<span class="lg-fullscreen lg-icon"></span>';
2269                this.core.$outer.find('.lg-toolbar').append(fullScreen);
2270                this.fullScreen();
2271            }
2272        }
2273    };
2274
2275    Fullscreen.prototype.requestFullscreen = function() {
2276        var el = document.documentElement;
2277        if (el.requestFullscreen) {
2278            el.requestFullscreen();
2279        } else if (el.msRequestFullscreen) {
2280            el.msRequestFullscreen();
2281        } else if (el.mozRequestFullScreen) {
2282            el.mozRequestFullScreen();
2283        } else if (el.webkitRequestFullscreen) {
2284            el.webkitRequestFullscreen();
2285        }
2286    };
2287
2288    Fullscreen.prototype.exitFullscreen = function() {
2289        if (document.exitFullscreen) {
2290            document.exitFullscreen();
2291        } else if (document.msExitFullscreen) {
2292            document.msExitFullscreen();
2293        } else if (document.mozCancelFullScreen) {
2294            document.mozCancelFullScreen();
2295        } else if (document.webkitExitFullscreen) {
2296            document.webkitExitFullscreen();
2297        }
2298    };
2299
2300    // https://developer.mozilla.org/en-US/docs/Web/Guide/API/DOM/Using_full_screen_mode
2301    Fullscreen.prototype.fullScreen = function() {
2302        var _this = this;
2303
2304        $(document).on('fullscreenchange.lg webkitfullscreenchange.lg mozfullscreenchange.lg MSFullscreenChange.lg', function() {
2305            _this.core.$outer.toggleClass('lg-fullscreen-on');
2306        });
2307
2308        this.core.$outer.find('.lg-fullscreen').on('click.lg', function() {
2309            if (!document.fullscreenElement &&
2310                !document.mozFullScreenElement && !document.webkitFullscreenElement && !document.msFullscreenElement) {
2311                _this.requestFullscreen();
2312            } else {
2313                _this.exitFullscreen();
2314            }
2315        });
2316
2317    };
2318
2319    Fullscreen.prototype.destroy = function() {
2320
2321        // exit from fullscreen if activated
2322        this.exitFullscreen();
2323
2324        $(document).off('fullscreenchange.lg webkitfullscreenchange.lg mozfullscreenchange.lg MSFullscreenChange.lg');
2325    };
2326
2327    $.fn.lightGallery.modules.fullscreen = Fullscreen;
2328
2329})(jQuery, window, document);
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341/**
2342 * Autoplay Plugin
2343 * @version 1.2.0
2344 * @author Sachin N - @sachinchoolur
2345 * @license MIT License (MIT)
2346 */
2347
2348(function($, window, document, undefined) {
2349
2350    'use strict';
2351
2352    var defaults = {
2353        autoplay: false,
2354        pause: 5000,
2355        progressBar: true,
2356        fourceAutoplay: false,
2357        autoplayControls: true,
2358        appendAutoplayControlsTo: '.lg-toolbar'
2359    };
2360
2361    /**
2362     * Creates the autoplay plugin.
2363     * @param {object} element - lightGallery element
2364     */
2365    var Autoplay = function(element) {
2366
2367        this.core = $(element).data('lightGallery');
2368
2369        this.$el = $(element);
2370
2371        // Execute only if items are above 1
2372        if (this.core.$items.length < 2) {
2373            return false;
2374        }
2375
2376        this.core.s = $.extend({}, defaults, this.core.s);
2377        this.interval = false;
2378
2379        // Identify if slide happened from autoplay
2380        this.fromAuto = true;
2381
2382        // Identify if autoplay canceled from touch/drag
2383        this.canceledOnTouch = false;
2384
2385        // save fourceautoplay value
2386        this.fourceAutoplayTemp = this.core.s.fourceAutoplay;
2387
2388        // do not allow progress bar if browser does not support css3 transitions
2389        if (!this.core.doCss()) {
2390            this.core.s.progressBar = false;
2391        }
2392
2393        this.init();
2394
2395        return this;
2396    };
2397
2398    Autoplay.prototype.init = function() {
2399        var _this = this;
2400
2401        // append autoplay controls
2402        if (_this.core.s.autoplayControls) {
2403            _this.controls();
2404        }
2405
2406        // Create progress bar
2407        if (_this.core.s.progressBar) {
2408            _this.core.$outer.find('.lg').append('<div class="lg-progress-bar"><div class="lg-progress"></div></div>');
2409        }
2410
2411        // set progress
2412        _this.progress();
2413
2414        // Start autoplay
2415        if (_this.core.s.autoplay) {
2416            _this.startlAuto();
2417        }
2418
2419        // cancel interval on touchstart and dragstart
2420        _this.$el.on('onDragstart.lg.tm touchstart.lg.tm', function() {
2421            if (_this.interval) {
2422                _this.cancelAuto();
2423                _this.canceledOnTouch = true;
2424            }
2425        });
2426
2427        // restore autoplay if autoplay canceled from touchstart / dragstart
2428        _this.$el.on('onDragend.lg.tm touchend.lg.tm onSlideClick.lg.tm', function() {
2429            if (!_this.interval && _this.canceledOnTouch) {
2430                _this.startlAuto();
2431                _this.canceledOnTouch = false;
2432            }
2433        });
2434
2435    };
2436
2437    Autoplay.prototype.progress = function() {
2438
2439        var _this = this;
2440        var _$progressBar;
2441        var _$progress;
2442
2443        _this.$el.on('onBeforeSlide.lg.tm', function() {
2444
2445            // start progress bar animation
2446            if (_this.core.s.progressBar && _this.fromAuto) {
2447                _$progressBar = _this.core.$outer.find('.lg-progress-bar');
2448                _$progress = _this.core.$outer.find('.lg-progress');
2449                if (_this.interval) {
2450                    _$progress.removeAttr('style');
2451                    _$progressBar.removeClass('lg-start');
2452                    setTimeout(function() {
2453                        _$progress.css('transition', 'width ' + (_this.core.s.speed + _this.core.s.pause) + 'ms ease 0s');
2454                        _$progressBar.addClass('lg-start');
2455                    }, 20);
2456                }
2457            }
2458
2459            // Remove setinterval if slide is triggered manually and fourceautoplay is false
2460            if (!_this.fromAuto && !_this.core.s.fourceAutoplay) {
2461                _this.cancelAuto();
2462            }
2463
2464            _this.fromAuto = false;
2465
2466        });
2467    };
2468
2469    // Manage autoplay via play/stop buttons
2470    Autoplay.prototype.controls = function() {
2471        var _this = this;
2472        var _html = '<span class="lg-autoplay-button lg-icon"></span>';
2473
2474        // Append autoplay controls
2475        $(this.core.s.appendAutoplayControlsTo).append(_html);
2476
2477        _this.core.$outer.find('.lg-autoplay-button').on('click.lg', function() {
2478            if ($(_this.core.$outer).hasClass('lg-show-autoplay')) {
2479                _this.cancelAuto();
2480                _this.core.s.fourceAutoplay = false;
2481            } else {
2482                if (!_this.interval) {
2483                    _this.startlAuto();
2484                    _this.core.s.fourceAutoplay = _this.fourceAutoplayTemp;
2485                }
2486            }
2487        });
2488    };
2489
2490    // Autostart gallery
2491    Autoplay.prototype.startlAuto = function() {
2492        var _this = this;
2493
2494        _this.core.$outer.find('.lg-progress').css('transition', 'width ' + (_this.core.s.speed + _this.core.s.pause) + 'ms ease 0s');
2495        _this.core.$outer.addClass('lg-show-autoplay');
2496        _this.core.$outer.find('.lg-progress-bar').addClass('lg-start');
2497
2498        _this.interval = setInterval(function() {
2499            if (_this.core.index + 1 < _this.core.$items.length) {
2500                _this.core.index = _this.core.index;
2501            } else {
2502                _this.core.index = -1;
2503            }
2504
2505            _this.core.index++;
2506            _this.fromAuto = true;
2507            _this.core.slide(_this.core.index, false, false);
2508        }, _this.core.s.speed + _this.core.s.pause);
2509    };
2510
2511    // cancel Autostart
2512    Autoplay.prototype.cancelAuto = function() {
2513        clearInterval(this.interval);
2514        this.interval = false;
2515        this.core.$outer.find('.lg-progress').removeAttr('style');
2516        this.core.$outer.removeClass('lg-show-autoplay');
2517        this.core.$outer.find('.lg-progress-bar').removeClass('lg-start');
2518    };
2519
2520    Autoplay.prototype.destroy = function() {
2521
2522        this.cancelAuto();
2523        this.core.$outer.find('.lg-progress-bar').remove();
2524    };
2525
2526    $.fn.lightGallery.modules.autoplay = Autoplay;
2527
2528})(jQuery, window, document);
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539(function($, window, document, undefined) {
2540
2541    'use strict';
2542
2543    var defaults = {
2544        scale: 1,
2545        zoom: true,
2546        actualSize: true,
2547        enableZoomAfter: 300
2548    };
2549
2550    var Zoom = function(element) {
2551
2552        this.core = $(element).data('lightGallery');
2553
2554        this.core.s = $.extend({}, defaults, this.core.s);
2555
2556        if (this.core.s.zoom && this.core.doCss()) {
2557            this.init();
2558
2559            // Store the zoomable timeout value just to clear it while closing
2560            this.zoomabletimeout = false;
2561
2562            // Set the initial value center
2563            this.pageX = $(window).width() / 2;
2564            this.pageY = ($(window).height() / 2) + $(window).scrollTop();
2565        }
2566
2567        return this;
2568    };
2569
2570    Zoom.prototype.init = function() {
2571
2572        var _this = this;
2573        var zoomIcons = '<span id="lg-zoom-in" class="lg-icon"></span><span id="lg-zoom-out" class="lg-icon"></span>';
2574
2575        if (_this.core.s.actualSize) {
2576            zoomIcons += '<span id="lg-actual-size" class="lg-icon"></span>';
2577        }
2578
2579        this.core.$outer.find('.lg-toolbar').append(zoomIcons);
vendor: 16,384 bytes, lines 2580-3060
2580
2581        // Add zoomable class
2582        _this.core.$el.on('onSlideItemLoad.lg.tm.zoom', function(event, index, delay) {
2583
2584            // delay will be 0 except first time
2585            var _speed = _this.core.s.enableZoomAfter + delay;
2586
2587            // set _speed value 0 if gallery opened from direct url and if it is first slide
2588            if ($('body').hasClass('lg-from-hash') && delay) {
2589
2590                // will execute only once
2591                _speed = 0;
2592            } else {
2593
2594                // Remove lg-from-hash to enable starting animation.
2595                $('body').removeClass('lg-from-hash');
2596            }
2597
2598            _this.zoomabletimeout = setTimeout(function() {
2599                _this.core.$slide.eq(index).addClass('lg-zoomable');
2600            }, _speed + 30);
2601        });
2602
2603        var scale = 1;
2604        /**
2605         * @desc Image zoom
2606         * Translate the wrap and scale the image to get better user experience
2607         *
2608         * @param {String} scaleVal - Zoom decrement/increment value
2609         */
2610        var zoom = function(scaleVal) {
2611
2612            var $image = _this.core.$outer.find('.lg-current .lg-image');
2613            var _x;
2614            var _y;
2615
2616            // Find offset manually to avoid issue after zoom
2617            var offsetX = ($(window).width() - $image.width()) / 2;
2618            var offsetY = (($(window).height() - $image.height()) / 2) + $(window).scrollTop();
2619
2620            _x = _this.pageX - offsetX;
2621            _y = _this.pageY - offsetY;
2622
2623            var x = (scaleVal - 1) * (_x);
2624            var y = (scaleVal - 1) * (_y);
2625
2626            $image.css('transform', 'scale3d(' + scaleVal + ', ' + scaleVal + ', 1)').attr('data-scale', scaleVal);
2627
2628            $image.parent().css({
2629                left: -x + 'px',
2630                top: -y + 'px'
2631            }).attr('data-x', x).attr('data-y', y);
2632        };
2633
2634        var callScale = function() {
2635            if (scale > 1) {
2636                _this.core.$outer.addClass('lg-zoomed');
2637            } else {
2638                _this.resetZoom();
2639            }
2640
2641            if (scale < 1) {
2642                scale = 1;
2643            }
2644
2645            zoom(scale);
2646        };
2647
2648        var actualSize = function(event, $image, index, fromIcon) {
2649            var w = $image.width();
2650            var nw;
2651            if (_this.core.s.dynamic) {
2652                nw = _this.core.s.dynamicEl[index].width || $image[0].naturalWidth || w;
2653            } else {
2654                nw = _this.core.$items.eq(index).attr('data-width') || $image[0].naturalWidth || w;
2655            }
2656
2657            var _scale;
2658
2659            if (_this.core.$outer.hasClass('lg-zoomed')) {
2660                scale = 1;
2661            } else {
2662                if (nw > w) {
2663                    _scale = nw / w;
2664                    scale = _scale || 2;
2665                }
2666            }
2667
2668            if (fromIcon) {
2669                _this.pageX = $(window).width() / 2;
2670                _this.pageY = ($(window).height() / 2) + $(window).scrollTop();
2671            } else {
2672                _this.pageX = event.pageX || event.originalEvent.targetTouches[0].pageX;
2673                _this.pageY = event.pageY || event.originalEvent.targetTouches[0].pageY;
2674            }
2675
2676            callScale();
2677            setTimeout(function() {
2678                _this.core.$outer.removeClass('lg-grabbing').addClass('lg-grab');
2679            }, 10);
2680        };
2681
2682        var tapped = false;
2683
2684        // event triggered after appending slide content
2685        _this.core.$el.on('onAferAppendSlide.lg.tm.zoom', function(event, index) {
2686
2687            // Get the current element
2688            var $image = _this.core.$slide.eq(index).find('.lg-image');
2689
2690            $image.on('dblclick', function(event) {
2691                actualSize(event, $image, index);
2692            });
2693
2694            $image.on('touchstart', function(event) {
2695                if (!tapped) {
2696                    tapped = setTimeout(function() {
2697                        tapped = null;
2698                    }, 300);
2699                } else {
2700                    clearTimeout(tapped);
2701                    tapped = null;
2702                    actualSize(event, $image, index);
2703                }
2704
2705                event.preventDefault();
2706            });
2707
2708        });
2709
2710        // Update zoom on resize and orientationchange
2711        $(window).on('resize.lg.zoom scroll.lg.zoom orientationchange.lg.zoom', function() {
2712            _this.pageX = $(window).width() / 2;
2713            _this.pageY = ($(window).height() / 2) + $(window).scrollTop();
2714            zoom(scale);
2715        });
2716
2717        $('#lg-zoom-out').on('click.lg', function() {
2718            if (_this.core.$outer.find('.lg-current .lg-image').length) {
2719                scale -= _this.core.s.scale;
2720                callScale();
2721            }
2722        });
2723
2724        $('#lg-zoom-in').on('click.lg', function() {
2725            if (_this.core.$outer.find('.lg-current .lg-image').length) {
2726                scale += _this.core.s.scale;
2727                callScale();
2728            }
2729        });
2730
2731        $('#lg-actual-size').on('click.lg', function(event) {
2732            actualSize(event, _this.core.$slide.eq(_this.core.index).find('.lg-image'), _this.core.index, true);
2733        });
2734
2735        // Reset zoom on slide change
2736        _this.core.$el.on('onBeforeSlide.lg.tm', function() {
2737            scale = 1;
2738            _this.resetZoom();
2739        });
2740
2741        // Drag option after zoom
2742        if (!_this.core.isTouch) {
2743            _this.zoomDrag();
2744        }
2745
2746        if (_this.core.isTouch) {
2747            _this.zoomSwipe();
2748        }
2749
2750    };
2751
2752    // Reset zoom effect
2753    Zoom.prototype.resetZoom = function() {
2754        this.core.$outer.removeClass('lg-zoomed');
2755        this.core.$slide.find('.lg-img-wrap').removeAttr('style data-x data-y');
2756        this.core.$slide.find('.lg-image').removeAttr('style data-scale');
2757
2758        // Reset pagx pagy values to center
2759        this.pageX = $(window).width() / 2;
2760        this.pageY = ($(window).height() / 2) + $(window).scrollTop();
2761    };
2762
2763    Zoom.prototype.zoomSwipe = function() {
2764        var _this = this;
2765        var startCoords = {};
2766        var endCoords = {};
2767        var isMoved = false;
2768
2769        // Allow x direction drag
2770        var allowX = false;
2771
2772        // Allow Y direction drag
2773        var allowY = false;
2774
2775        _this.core.$slide.on('touchstart.lg', function(e) {
2776
2777            if (_this.core.$outer.hasClass('lg-zoomed')) {
2778                var $image = _this.core.$slide.eq(_this.core.index).find('.lg-object');
2779
2780                allowY = $image.outerHeight() * $image.attr('data-scale') > _this.core.$outer.find('.lg').height();
2781                allowX = $image.outerWidth() * $image.attr('data-scale') > _this.core.$outer.find('.lg').width();
2782                if ((allowX || allowY)) {
2783                    e.preventDefault();
2784                    startCoords = {
2785                        x: e.originalEvent.targetTouches[0].pageX,
2786                        y: e.originalEvent.targetTouches[0].pageY
2787                    };
2788                }
2789            }
2790
2791        });
2792
2793        _this.core.$slide.on('touchmove.lg', function(e) {
2794
2795            if (_this.core.$outer.hasClass('lg-zoomed')) {
2796
2797                var _$el = _this.core.$slide.eq(_this.core.index).find('.lg-img-wrap');
2798                var distanceX;
2799                var distanceY;
2800
2801                e.preventDefault();
2802                isMoved = true;
2803
2804                endCoords = {
2805                    x: e.originalEvent.targetTouches[0].pageX,
2806                    y: e.originalEvent.targetTouches[0].pageY
2807                };
2808
2809                // reset opacity and transition duration
2810                _this.core.$outer.addClass('lg-zoom-dragging');
2811
2812                if (allowY) {
2813                    distanceY = (-Math.abs(_$el.attr('data-y'))) + (endCoords.y - startCoords.y);
2814                } else {
2815                    distanceY = -Math.abs(_$el.attr('data-y'));
2816                }
2817
2818                if (allowX) {
2819                    distanceX = (-Math.abs(_$el.attr('data-x'))) + (endCoords.x - startCoords.x);
2820                } else {
2821                    distanceX = -Math.abs(_$el.attr('data-x'));
2822                }
2823
2824                if ((Math.abs(endCoords.x - startCoords.x) > 15) || (Math.abs(endCoords.y - startCoords.y) > 15)) {
2825                    _$el.css({
2826                        left: distanceX + 'px',
2827                        top: distanceY + 'px'
2828                    });
2829                }
2830
2831            }
2832
2833        });
2834
2835        _this.core.$slide.on('touchend.lg', function() {
2836            if (_this.core.$outer.hasClass('lg-zoomed')) {
2837                if (isMoved) {
2838                    isMoved = false;
2839                    _this.core.$outer.removeClass('lg-zoom-dragging');
2840                    _this.touchendZoom(startCoords, endCoords, allowX, allowY);
2841
2842                }
2843            }
2844        });
2845
2846    };
2847
2848    Zoom.prototype.zoomDrag = function() {
2849
2850        var _this = this;
2851        var startCoords = {};
2852        var endCoords = {};
2853        var isDraging = false;
2854        var isMoved = false;
2855
2856        // Allow x direction drag
2857        var allowX = false;
2858
2859        // Allow Y direction drag
2860        var allowY = false;
2861
2862        _this.core.$slide.on('mousedown.lg.zoom', function(e) {
2863
2864            // execute only on .lg-object
2865            var $image = _this.core.$slide.eq(_this.core.index).find('.lg-object');
2866
2867            allowY = $image.outerHeight() * $image.attr('data-scale') > _this.core.$outer.find('.lg').height();
2868            allowX = $image.outerWidth() * $image.attr('data-scale') > _this.core.$outer.find('.lg').width();
2869
2870            if (_this.core.$outer.hasClass('lg-zoomed')) {
2871                if ($(e.target).hasClass('lg-object') && (allowX || allowY)) {
2872                    e.preventDefault();
2873                    startCoords = {
2874                        x: e.pageX,
2875                        y: e.pageY
2876                    };
2877
2878                    isDraging = true;
2879
2880                    // ** Fix for webkit cursor issue https://code.google.com/p/chromium/issues/detail?id=26723
2881                    _this.core.$outer.scrollLeft += 1;
2882                    _this.core.$outer.scrollLeft -= 1;
2883
2884                    _this.core.$outer.removeClass('lg-grab').addClass('lg-grabbing');
2885                }
2886            }
2887        });
2888
2889        $(window).on('mousemove.lg.zoom', function(e) {
2890            if (isDraging) {
2891                var _$el = _this.core.$slide.eq(_this.core.index).find('.lg-img-wrap');
2892                var distanceX;
2893                var distanceY;
2894
2895                isMoved = true;
2896                endCoords = {
2897                    x: e.pageX,
2898                    y: e.pageY
2899                };
2900
2901                // reset opacity and transition duration
2902                _this.core.$outer.addClass('lg-zoom-dragging');
2903
2904                if (allowY) {
2905                    distanceY = (-Math.abs(_$el.attr('data-y'))) + (endCoords.y - startCoords.y);
2906                } else {
2907                    distanceY = -Math.abs(_$el.attr('data-y'));
2908                }
2909
2910                if (allowX) {
2911                    distanceX = (-Math.abs(_$el.attr('data-x'))) + (endCoords.x - startCoords.x);
2912                } else {
2913                    distanceX = -Math.abs(_$el.attr('data-x'));
2914                }
2915
2916                _$el.css({
2917                    left: distanceX + 'px',
2918                    top: distanceY + 'px'
2919                });
2920            }
2921        });
2922
2923        $(window).on('mouseup.lg.zoom', function(e) {
2924
2925            if (isDraging) {
2926                isDraging = false;
2927                _this.core.$outer.removeClass('lg-zoom-dragging');
2928
2929                // Fix for chrome mouse move on click
2930                if (isMoved && ((startCoords.x !== endCoords.x) || (startCoords.y !== endCoords.y))) {
2931                    endCoords = {
2932                        x: e.pageX,
2933                        y: e.pageY
2934                    };
2935                    _this.touchendZoom(startCoords, endCoords, allowX, allowY);
2936
2937                }
2938
2939                isMoved = false;
2940            }
2941
2942            _this.core.$outer.removeClass('lg-grabbing').addClass('lg-grab');
2943
2944        });
2945    };
2946
2947    Zoom.prototype.touchendZoom = function(startCoords, endCoords, allowX, allowY) {
2948
2949        var _this = this;
2950        var _$el = _this.core.$slide.eq(_this.core.index).find('.lg-img-wrap');
2951        var $image = _this.core.$slide.eq(_this.core.index).find('.lg-object');
2952        var distanceX = (-Math.abs(_$el.attr('data-x'))) + (endCoords.x - startCoords.x);
2953        var distanceY = (-Math.abs(_$el.attr('data-y'))) + (endCoords.y - startCoords.y);
2954        var minY = (_this.core.$outer.find('.lg').height() - $image.outerHeight()) / 2;
2955        var maxY = Math.abs(($image.outerHeight() * Math.abs($image.attr('data-scale'))) - _this.core.$outer.find('.lg').height() + minY);
2956        var minX = (_this.core.$outer.find('.lg').width() - $image.outerWidth()) / 2;
2957        var maxX = Math.abs(($image.outerWidth() * Math.abs($image.attr('data-scale'))) - _this.core.$outer.find('.lg').width() + minX);
2958
2959        if ((Math.abs(endCoords.x - startCoords.x) > 15) || (Math.abs(endCoords.y - startCoords.y) > 15)) {
2960            if (allowY) {
2961                if (distanceY <= -maxY) {
2962                    distanceY = -maxY;
2963                } else if (distanceY >= -minY) {
2964                    distanceY = -minY;
2965                }
2966            }
2967
2968            if (allowX) {
2969                if (distanceX <= -maxX) {
2970                    distanceX = -maxX;
2971                } else if (distanceX >= -minX) {
2972                    distanceX = -minX;
2973                }
2974            }
2975
2976            if (allowY) {
2977                _$el.attr('data-y', Math.abs(distanceY));
2978            } else {
2979                distanceY = -Math.abs(_$el.attr('data-y'));
2980            }
2981
2982            if (allowX) {
2983                _$el.attr('data-x', Math.abs(distanceX));
2984            } else {
2985                distanceX = -Math.abs(_$el.attr('data-x'));
2986            }
2987
2988            _$el.css({
2989                left: distanceX + 'px',
2990                top: distanceY + 'px'
2991            });
2992
2993        }
2994    };
2995
2996    Zoom.prototype.destroy = function() {
2997
2998        var _this = this;
2999
3000        // Unbind all events added by lightGallery zoom plugin
3001        _this.core.$el.off('.lg.zoom');
3002        $(window).off('.lg.zoom');
3003        _this.core.$slide.off('.lg.zoom');
3004        _this.core.$el.off('.lg.tm.zoom');
3005        _this.resetZoom();
3006        clearTimeout(_this.zoomabletimeout);
3007        _this.zoomabletimeout = false;
3008    };
3009
3010    $.fn.lightGallery.modules.zoom = Zoom;
3011
3012})(jQuery, window, document);
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022(function($, window, document, undefined) {
3023
3024    'use strict';
3025
3026    var defaults = {
3027        pager: false
3028    };
3029
3030    var Pager = function(element) {
3031
3032        this.core = $(element).data('lightGallery');
3033
3034        this.$el = $(element);
3035        this.core.s = $.extend({}, defaults, this.core.s);
3036        if (this.core.s.pager && this.core.$items.length > 1) {
3037            this.init();
3038        }
3039
3040        return this;
3041    };
3042
3043    Pager.prototype.init = function() {
3044        var _this = this;
3045        var pagerList = '';
3046        var $pagerCont;
3047        var $pagerOuter;
3048        var timeout;
3049
3050        _this.core.$outer.find('.lg').append('<div class="lg-pager-outer"></div>');
3051
3052        if (_this.core.s.dynamic) {
3053            for (var i = 0; i < _this.core.s.dynamicEl.length; i++) {
3054                pagerList += '<span class="lg-pager-cont"> <span class="lg-pager"></span><div class="lg-pager-thumb-cont"><span class="lg-caret"></span> <img src="' + _this.core.s.dynamicEl[i].thumb + '" /></div></span>';
3055            }
3056        } else {
3057            _this.core.$items.each(function() {
3058
3059                if (!_this.core.s.exThumbImage) {
3060                    pagerList += '<span class="lg-pager-cont"> <span class="lg-pager"></span><div class="lg-pager-thumb-cont"><span class="lg-caret"></span> <img src="' + $(this).find('img')
3060.attr('src') + '" /></div></span>';
3061                } else {
3062                    pagerList += '<span class="lg-pager-cont"> <span class="lg-pager"></span><div class="lg-pager-thumb-cont"><span class="lg-caret"></span> <img src="' + $(this).attr(_this.core.s.exThumbImage) + '" /></div></span>';
3063                }
3064
3065            });
3066        }
3067
3068        $pagerOuter = _this.core.$outer.find('.lg-pager-outer');
3069
3070        $pagerOuter.html(pagerList);
3071
3072        $pagerCont = _this.core.$outer.find('.lg-pager-cont');
3073        $pagerCont.on('click.lg touchend.lg', function() {
3074            var _$this = $(this);
3075            _this.core.index = _$this.index();
3076            _this.core.slide(_this.core.index, false, false);
3077        });
3078
3079        $pagerOuter.on('mouseover.lg', function() {
3080            clearTimeout(timeout);
3081            $pagerOuter.addClass('lg-pager-hover');
3082        });
3083
3084        $pagerOuter.on('mouseout.lg', function() {
3085            timeout = setTimeout(function() {
3086                $pagerOuter.removeClass('lg-pager-hover');
3087            });
3088        });
3089
3090        _this.core.$el.on('onBeforeSlide.lg.tm', function(e, prevIndex, index) {
3091            $pagerCont.removeClass('lg-pager-active');
3092            $pagerCont.eq(index).addClass('lg-pager-active');
3093        });
3094
3095    };
3096
3097    Pager.prototype.destroy = function() {
3098
3099    };
3100
3101    $.fn.lightGallery.modules.pager = Pager;
3102
3103})(jQuery, window, document);
3104
3105
3106
3107
3108jQuery(document).ready(function() {
3109 
3110
3111	//Scroll To top
3112	jQuery(window).scroll(function(){
3113		if (jQuery(this).scrollTop() > 100) {
3114			jQuery('#topcontrol').css({bottom:"15px"});
3115		} else {
3116			jQuery('#topcontrol').css({bottom:"-100px"});
3117		}
3118	});
3119	jQuery('#topcontrol').click(function(){
3120		jQuery('html, body').animate({scrollTop: '0px'}, 800);
3121		return false;
3122	});
3123	
3124	//tooltip();
3125$( document ).ready( function()
3126{
3127	var targets = $( '[rel~=tooltip]' ),
3128		target	= false,
3129		tooltip = false,
3130		title	= false;
3131
3132	targets.bind( 'mouseenter', function()
3133	{
3134		target	= $( this );
3135		tip		= target.attr( 'title' );
3136		tooltip	= $( '<div id="tooltip"></div>' );
3137
3138		if( !tip || tip == '' )
3139			return false;
3140
3141		target.removeAttr( 'title' );
3142		tooltip.css( 'opacity', 0 )
3143			   .html( tip )
3144			   .appendTo( 'body' );
3145
3146		var init_tooltip = function()
3147		{
3148			if( $( window ).width() < tooltip.outerWidth() * 1.5 )
3149				tooltip.css( 'max-width', $( window ).width() / 2 );
3150			else
3151				tooltip.css( 'max-width', 340 );
3152
3153			var pos_left = target.offset().left + ( target.outerWidth() / 2 ) - ( tooltip.outerWidth() / 2 ),
3154				pos_top	 = target.offset().top - tooltip.outerHeight() - 20;
3155
3156			if( pos_left < 0 )
3157			{
3158				pos_left = target.offset().left + target.outerWidth() / 2 - 20;
3159				tooltip.addClass( 'left' );
3160			}
3161			else
3162				tooltip.removeClass( 'left' );
3163
3164			if( pos_left + tooltip.outerWidth() > $( window ).width() )
3165			{
3166				pos_left = target.offset().left - tooltip.outerWidth() + target.outerWidth() / 2 + 20;
3167				tooltip.addClass( 'right' );
3168			}
3169			else
3170				tooltip.removeClass( 'right' );
3171
3172			if( pos_top < 0 )
3173			{
3174				var pos_top	 = target.offset().top + target.outerHeight();
3175				tooltip.addClass( 'top' );
3176			}
3177			else
3178				tooltip.removeClass( 'top' );
3179
3180			tooltip.css( { left: pos_left, top: pos_top } )
3181				   .animate( { top: '+=10', opacity: 1 }, 50 );
3182		};
3183
3184		init_tooltip();
3185		$( window ).resize( init_tooltip );
3186
3187		var remove_tooltip = function()
3188		{
3189			tooltip.animate( { top: '-=10', opacity: 0 }, 50, function()
3190			{
3191				$( this ).remove();
3192			});
3193
3194			target.attr( 'title', tip );
3195		};
3196
3197		target.bind( 'mouseleave', remove_tooltip );
3198		tooltip.bind( 'click', remove_tooltip );
3199	});
3200});
3201	
3202	
3203
3204	
3205	
3206//tabbed Boxes
3207	jQuery(".cat-tabs-wrap").hide();
3208	jQuery(".cat-tabs-header ul li:first").addClass("active").show();
3209	jQuery(".cat-tabs-wrap:first").show(); 
3210	jQuery(".cat-tabs-header ul li").click(function() {
3211		jQuery(".cat-tabs-header ul li").removeClass("active");
3212		jQuery(this).addClass("active");
3213		jQuery(".cat-tabs-wrap").hide();
3214		var activeTab = jQuery(this).find("a").attr("href");
3215		jQuery(activeTab).slideDown();
3216		return false;
3217	});
3218	
3219	jQuery("#tabbed-widget .tabs-wrap").hide();
3220	jQuery("#tabbed-widget div.posts-taps b:first").addClass("active").show();
3221	jQuery("#tabbed-widget .tabs-wrap:first").show(); 
3222	jQuery("#tabbed-widget  b.tabs").click(function() {
3223		jQuery("#tabbed-widget div.posts-taps b").removeClass("active");
3224		jQuery(this).addClass("active");
3225		jQuery("#tabbed-widget .tabs-wrap").hide();
3226		var activeTab = jQuery(this).find("a").attr("href");
3227		jQuery(activeTab).slideDown();
3228		return false;
3229	});
3230
3231
3232	
3233});
3234
3235
3236
3237
3238function createTicker(){    	
3239	var tickerLIs = jQuery(".breaking-news ul").children();          
3240	tickerItems = new Array();                                
3241	tickerLIs.each(function(el) {                             
3242		tickerItems.push( jQuery(this).html() );                
3243	});                                                       
3244	i = 0  ;                                                 
3245	rotateTicker();                                           
3246}                                                           
3247function rotateTicker(){                                    
3248	if( i == tickerItems.length ){                            
3249	  i = 0;                                                  
3250	}                                                         
3251  tickerText = tickerItems[i];                              
3252	c = 0;                                                    
3253	typetext();                                               
3254	setTimeout( "rotateTicker()", 5000 );                     
3255	i++;                                                      
3256}                                                           
3257var isInTag = false;                                        
3258function typetext() {
3259	if(jQuery('.breaking-news ul').length>0){
3260		var thisChar = tickerText.substr(c, 1);                   
3261		if( thisChar == '<' ){ isInTag = true; }                  
3262		if( thisChar == '>' ){ isInTag = false; }                 
3263		jQuery('.breaking-news ul').html(tickerText.substr(0, c++));   
3264		if(c < tickerText.length+1)                                     
3265			if( isInTag ){                                                
3266				typetext();                                                 
3267			}else{                                                        
vendor: 5,996 bytes, lines 3268-3281
3268				setTimeout("typetext()", 28);                               
3269			}                                                             
3270		else {                                                          
3271			c = 1;                                                        
3272			tickerText = "";                                              
3273		}
3274	}
3275} 
3276
3277// jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing
3278jQuery.easing["jswing"]=jQuery.easing["swing"];jQuery.extend(jQuery.easing,{def:"easeOutQuad",swing:function(a,b,c,d,e){return jQuery.easing[jQuery.easing.def](a,b,c,d,e)},easeInQuad:function(a,b,c,d,e){return d*(b/=e)*b+c},easeOutQuad:function(a,b,c,d,e){return-d*(b/=e)*(b-2)+c},easeInOutQuad:function(a,b,c,d,e){if((b/=e/2)<1)return d/2*b*b+c;return-d/2*(--b*(b-2)-1)+c},easeInCubic:function(a,b,c,d,e){return d*(b/=e)*b*b+c},easeOutCubic:function(a,b,c,d,e){return d*((b=b/e-1)*b*b+1)+c},easeInOutCubic:function(a,b,c,d,e){if((b/=e/2)<1)return d/2*b*b*b+c;return d/2*((b-=2)*b*b+2)+c},easeInQuart:function(a,b,c,d,e){return d*(b/=e)*b*b*b+c},easeOutQuart:function(a,b,c,d,e){return-d*((b=b/e-1)*b*b*b-1)+c},easeInOutQuart:function(a,b,c,d,e){if((b/=e/2)<1)return d/2*b*b*b*b+c;return-d/2*((b-=2)*b*b*b-2)+c},easeInQuint:function(a,b,c,d,e){return d*(b/=e)*b*b*b*b+c},easeOutQuint:function(a,b,c,d,e){return d*((b=b/e-1)*b*b*b*b+1)+c},easeInOutQuint:function(a,b,c,d,e){if((b/=e/2)<1)return d/2*b*b*b*b*b+c;return d/2*((b-=2)*b*b*b*b+2)+c},easeInSine:function(a,b,c,d,e){return-d*Math.cos(b/e*(Math.PI/2))+d+c},easeOutSine:function(a,b,c,d,e){return d*Math.sin(b/e*(Math.PI/2))+c},easeInOutSine:function(a,b,c,d,e){return-d/2*(Math.cos(Math.PI*b/e)-1)+c},easeInExpo:function(a,b,c,d,e){return b==0?c:d*Math.pow(2,10*(b/e-1))+c},easeOutExpo:function(a,b,c,d,e){return b==e?c+d:d*(-Math.pow(2,-10*b/e)+1)+c},easeInOutExpo:function(a,b,c,d,e){if(b==0)return c;if(b==e)return c+d;if((b/=e/2)<1)return d/2*Math.pow(2,10*(b-1))+c;return d/2*(-Math.pow(2,-10*--b)+2)+c},easeInCirc:function(a,b,c,d,e){return-d*(Math.sqrt(1-(b/=e)*b)-1)+c},easeOutCirc:function(a,b,c,d,e){return d*Math.sqrt(1-(b=b/e-1)*b)+c},easeInOutCirc:function(a,b,c,d,e){if((b/=e/2)<1)return-d/2*(Math.sqrt(1-b*b)-1)+c;return d/2*(Math.sqrt(1-(b-=2)*b)+1)+c},easeInElastic:function(a,b,c,d,e){var f=1.70158;var g=0;var h=d;if(b==0)return c;if((b/=e)==1)return c+d;if(!g)g=e*.3;if(h<Math.abs(d)){h=d;var f=g/4}else var f=g/(2*Math.PI)*Math.asin(d/h);return-(h*Math.pow(2,10*(b-=1))*Math.sin((b*e-f)*2*Math.PI/g))+c},easeOutElastic:function(a,b,c,d,e){var f=1.70158;var g=0;var h=d;if(b==0)return c;if((b/=e)==1)return c+d;if(!g)g=e*.3;if(h<Math.abs(d)){h=d;var f=g/4}else var f=g/(2*Math.PI)*Math.asin(d/h);return h*Math.pow(2,-10*b)*Math.sin((b*e-f)*2*Math.PI/g)+d+c},easeInOutElastic:function(a,b,c,d,e){var f=1.70158;var g=0;var h=d;if(b==0)return c;if((b/=e/2)==2)return c+d;if(!g)g=e*.3*1.5;if(h<Math.abs(d)){h=d;var f=g/4}else var f=g/(2*Math.PI)*Math.asin(d/h);if(b<1)return-.5*h*Math.pow(2,10*(b-=1))*Math.sin((b*e-f)*2*Math.PI/g)+c;return h*Math.pow(2,-10*(b-=1))*Math.sin((b*e-f)*2*Math.PI/g)*.5+d+c},easeInBack:function(a,b,c,d,e,f){if(f==undefined)f=1.70158;return d*(b/=e)*b*((f+1)*b-f)+c},easeOutBack:function(a,b,c,d,e,f){if(f==undefined)f=1.70158;return d*((b=b/e-1)*b*((f+1)*b+f)+1)+c},easeInOutBack:function(a,b,c,d,e,f){if(f==undefined)f=1.70158;if((b/=e/2)<1)return d/2*b*b*(((f*=1.525)+1)*b-f)+c;return d/2*((b-=2)*b*(((f*=1.525)+1)*b+f)+2)+c},easeInBounce:function(a,b,c,d,e){return d-jQuery.easing.easeOutBounce(a,e-b,0,d,e)+c},easeOutBounce:function(a,b,c,d,e){if((b/=e)<1/2.75){return d*7.5625*b*b+c}else if(b<2/2.75){return d*(7.5625*(b-=1.5/2.75)*b+.75)+c}else if(b<2.5/2.75){return d*(7.5625*(b-=2.25/2.75)*b+.9375)+c}else{return d*(7.5625*(b-=2.625/2.75)*b+.984375)+c}},easeInOutBounce:function(a,b,c,d,e){if(b<e/2)return jQuery.easing.easeInBounce(a,b*2,0,d,e)*.5+c;return jQuery.easing.easeOutBounce(a,b*2-e,0,d,e)*.5+d*.5+c}});
3279
3280//ELASTIC IMAGE SLIDESHOW
3281(function(a,b,c){var d=b.event,e;d.special.smartresize={setup:function(){b(this).bind("resize",d.special.smartresize.handler)},teardown:function(){b(this).unbind("resize",d.special.smartresize.handler)},handler:function(a,b){var c=this,d=arguments;a.type="smartresize";if(e){clearTimeout(e)}e=setTimeout(function(){jQuery.event.handle.apply(c,d)},b==="execAsap"?0:100)}};b.fn.smartresize=function(a){return a?this.bind("smartresize",a):this.trigger("smartresize",["execAsap"])};b.Slideshow=function(a,c){this.$el=b(c);this.$list=this.$el.find("ul.ei-slider-large");this.$imgItems=this.$list.children("li");this.itemsCount=this.$imgItems.length;this.$images=this.$imgItems.find("img:first");this.$sliderthumbs=this.$el.find("ul.ei-slider-thumbs").hide();this.$sliderElems=this.$sliderthumbs.children("li");this.$sliderElem=this.$sliderthumbs.children("li.ei-slider-element");this.$thumbs=this.$sliderElems.not(".ei-slider-element");this._init(a)};b.Slideshow.defaults={animation:"sides",autoplay:false,slideshow_interval:3e3,speed:800,easing:"",titlesFactor:.6,titlespeed:800,titleeasing:"",thumbMaxWidth:150};b.Slideshow.prototype={_init:function(a){this.options=b.extend(true,{},b.Slideshow.defaults,a);this.$imgItems.css("opacity",0);this.$imgItems.find("div.ei-title > *").css("opacity",0);this.current=0;var c=this;this.$loading=b('<div class="ei-slider-loading">Loading</div>').prependTo(c.$el);b.when(this._preloadImages()).done(function(){c.$loading.hide();c._setImagesSize();c._initThumbs();c.$imgItems.eq(c.current).css({opacity:1,"z-index":10}).show().find("div.ei-title > *").css("opacity",1);if(c.options.autoplay){c._startSlideshow()}c._initEvents()})},_preloadImages:function(){var a=this,c=0;return b.Deferred(function(d){a.$images.each(function(e){b("<img/>").load(function(){if(++c===a.itemsCount){d.resolve()}}).attr("src",b(this).attr("src"))})}).promise()},_setImagesSize:function(){this.elWidth=this.$el.width();var a=this;this.$images.each(function(c){var d=b(this);imgDim=a._getImageDim(d.attr("src"));
3281d.css({width:imgDim.width,height:imgDim.height,marginLeft:imgDim.left,marginTop:imgDim.top})})},_getImageDim:function(a){var b=new Image;b.src=a;var c=this.elWidth,d=this.$el.height(),e=d/c,f=b.width,g=b.height,h=g/f,i,j,k,l;if(e>h){j=d;i=d/h}else{j=c*h;i=c}return{width:i,height:j,left:(c-i)/2,top:(d-j)/2}},_initThumbs:function(){this.$sliderElems.css({"max-width":this.options.thumbMaxWidth+"%",width:100/this.itemsCount+"%"});this.$sliderthumbs.css("max-width",this.options.thumbMaxWidth*this.itemsCount+"%").show()},_startSlideshow:function(){var a=this;this.slideshow=setTimeout(function(){var b;a.current===a.itemsCount-1?b=0:b=a.current+1;a._slideTo(b);if(a.options.autoplay){a._startSlideshow()}},this.options.slideshow_interval)},_slideTo:function(a){if(a===this.current||this.isAnimating)return false;this.isAnimating=true;var c=this.$imgItems.eq(this.current),d=this.$imgItems.eq(a),e=this,f={zIndex:10},g={opacity:1};if(this.options.animation==="sides"){f.left=a>this.current?-1*this.elWidth:this.elWidth;g.left=0}d.find("div.ei-title > h2").css("margin-right",50+"px").stop().delay(this.options.speed*this.options.titlesFactor).animate({marginRight:0+"px",opacity:1},this.options.titlespeed,this.options.titleeasing).end().find("div.ei-title > h3").css("margin-right",-50+"px").stop().delay(this.options.speed*this.options.titlesFactor).animate({marginRight:0+"px",opacity:1},this.options.titlespeed,this.options.titleeasing);b.when(c.css("z-index",1).find("div.ei-title > *").stop().fadeOut(this.options.speed/2,function(){b(this).show().css("opacity",0)}),d.css(f).stop().animate(g,this.options.speed,this.options.easing),this.$sliderElem.stop().animate({left:this.$thumbs.eq(a).position().left},this.options.speed)).done(function(){c.css("opacity",0).find("div.ei-title > *").css("opacity",0);e.current=a;e.isAnimating=false})},_initEvents:function(){var c=this;b(a).on("smartresize.eislideshow",function(a){c._setImagesSize();c.$sliderElem.css("left",c.$thumbs.eq(c.current).position().left)});this.$thumbs.on("click.eislideshow",function(a){if(c.options.autoplay){clearTimeout(c.slideshow);c.options.autoplay=false}var d=b(this),e=d.index()-1;c._slideTo(e);return false})}};var f=function(a){if(this.console){console.error(a)}};b.fn.eislideshow=function(a){if(typeof a==="string"){var c=Array.prototype.slice.call(arguments,1);this.each(function(){var d=b.data(this,"eislideshow");if(!d){f("cannot call methods on eislideshow prior to initialization; "+"attempted to call method '"+a+"'");return}if(!b.isFunction(d[a])||a.charAt(0)==="_"){f("no such method '"+a+"' for eislideshow instance");return}d[a].apply(d,c)})}else{this.each(function(){var c=b.data(this,"eislideshow");if(!c){b.data(this,"eislideshow",new b.Slideshow(a,this))}})}return this}})(window,jQuery);
3282
3283// tipsy, version 1.0.0a
3284// (c) 2008-2010 jason frame [[email protected]]
3285// released under the MIT license
3286(function(a){function b(a,b){return typeof a=="function"?a.call(b):a}function c(a){while(a=a.parentNode){if(a==document)return true}return false}function d(b,c){this.$element=a(b);this.options=c;this.enabled=true;this.fixTitle()}d.prototype={show:function(){var c=this.getTitle();if(c&&this.enabled){var d=this.tip();d.find(".tipsy-inner")[this.options.html?"html":"text"](c);d[0].className="tipsy";d.remove().css({top:0,left:0,visibility:"hidden",display:"block"}).prependTo(document.body);var e=a.extend({},this.$element.offset(),{width:this.$element[0].offsetWidth,height:this.$element[0].offsetHeight});var f=d[0].offsetWidth,g=d[0].offsetHeight,h=b(this.options.gravity,this.$element[0]);var i;switch(h.charAt(0)){case"n":i={top:e.top+e.height+this.options.offset,left:e.left+e.width/2-f/2};break;case"s":i={top:e.top-g-this.options.offset,left:e.left+e.width/2-f/2};break;case"e":i={top:e.top+e.height/2-g/2,left:e.left-f-this.options.offset};break;case"w":i={top:e.top+e.height/2-g/2,left:e.left+e.width+this.options.offset};break}if(h.length==2){if(h.charAt(1)=="w"){i.left=e.left+e.width/2-15}else{i.left=e.left+e.width/2-f+15}}d.css(i).addClass("tipsy-"+h);d.find(".tipsy-arrow")[0].className="tipsy-arrow tipsy-arrow-"+h.charAt(0);if(this.options.className){d.addClass(b(this.options.className,this.$element[0]))}if(this.options.fade){d.stop().css({opacity:0,display:"block",visibility:"visible"}).animate({opacity:this.options.opacity})}else{d.css({visibility:"visible",opacity:this.options.opacity})}}},hide:function(){if(this.options.fade){this.tip().stop().fadeOut(function(){a(this).remove()})}else{this.tip().remove()}},fixTitle:function(){var a=this.$element;if(a.attr("title")||typeof a.attr("original-title")!="string"){a.attr("original-title",a.attr("title")||"").removeAttr("title")}},getTitle:function(){var a,b=this.$element,c=this.options;this.fixTitle();var a,c=this.options;if(typeof c.title=="string"){a=b.attr(c.title=="title"?"original-title":c.title)}else if(typeof c.title=="function"){a=c.title.call(b[0])}a=(""+a).replace(/(^\s*|\s*$)/,"");return a||c.fallback},tip:function(){if(!this.$tip){this.$tip=a('<div class="tipsy"></div>').html('<div class="tipsy-arrow"></div><div class="tipsy-inner"></div>');this.$tip.data("tipsy-pointee",this.$element[0])}return this.$tip},validate:function(){if(!this.$element[0].parentNode){this.hide();this.$element=null;this.options=null}},enable:function(){this.enabled=true},disable:function(){this.enabled=false},toggleEnabled:function(){this.enabled=!this.enabled}};a.fn.tipsy=function(b){function e(c){var e=a.data(c,"tipsy");if(!e){e=new d(c,a.fn.tipsy.elementOptions(c,b));a.data(c,"tipsy",e)}return e}function f(){var a=e(this);a.hoverState="in";if(b.delayIn==0){a.show()}else{a.fixTitle();setTimeout(function(){if(a.hoverState=="in")a.show()},b.delayIn)}}function g(){var a=e(this);a.hoverState="out";if(b.delayOut==0){a.hide()}else{setTimeout(function(){if(a.hoverState=="out")a.hide()},b.delayOut)}}if(b===true){return this.data("tipsy")}else if(typeof b=="string"){var c=this.data("tipsy");if(c)c[b]();return this}b=a.extend({},a.fn.tipsy.defaults,b);if(!b.live)this.each(function(){e(this)});if(b.trigger!="manual"){var h=b.live?"live":"bind",i=b.trigger=="hover"?"mouseenter":"focus",j=b.trigger=="hover"?"mouseleave":"blur";this[h](i,f)[h](j,g)}return this};a.fn.tipsy.defaults={className:null,delayIn:0,delayOut:0,fade:false,fallback:"",gravity:"n",html:false,live:false,offset:0,opacity:.8,title:"title",trigger:"hover"};a.fn.tipsy.revalidate=function(){a(".tipsy").each(function(){var b=a.data(this,"tipsy-pointee");if(!b||!c(b)){a(this).remove()}})};a.fn.tipsy.elementOptions=function(b,c){return a.metadata?a.extend({},c,a(b).metadata()):c};a.fn.tipsy.autoNS=function(){return a(this).offset().top>a(document).scrollTop()+a(window).height()/2?"s":"n"};a.fn.tipsy.autoWE=function(){return a(this).offset().left>a(document).scrollLeft()+a(window).width()/2?"e":"w"};a.fn.tipsy.autoBounds=function(b,c){return function(){var d={ns:c[0],ew:c.length>1?c[1]:false},e=a(document).scrollTop()+b,f=a(document).scrollLeft()+b,g=a(this);if(g.offset().top<e)d.ns="n";if(g.offset().left<f)d.ew="w";if(a(window).width()+a(document).scrollLeft()-g.offset().left<b)d.ew="e";if(a(window).height()+a(document).scrollTop()-g.offset().top<b)d.ns="s";return d.ns+(d.ew?d.ew:"")}}})(jQuery);
3287
3288//innerfade
3289function removeFilter(a){if(a.style.removeAttribute){a.style.removeAttribute("filter")}}(function(a){a.fn.innerfade=function(b){return this.each(function(){a.innerfade(this,b)})};a.innerfade=function(b,c){var d={animationtype:"fade",speed:"normal",type:"sequence",timeout:2e3,containerheight:"auto",runningclass:"innerfade",children:null};if(c)a.extend(d,c);if(d.children===null)var e=a(b).children();else var e=a(b).children(d.children);if(e.length>1){a(b).css("position","relative").css("height",d.containerheight).addClass(d.runningclass);for(var f=0;f<e.length;f++){a(e[f]).css("z-index",String(e.length-f)).css("position","absolute").hide()}if(d.type=="sequence"){setTimeout(function(){a.innerfade.next(e,d,1,0)},d.timeout);a(e[0]).show()}else if(d.type=="random"){var g=Math.floor(Math.random()*e.length);setTimeout(function(){do{h=Math.floor(Math.random()*e.length)}while(g==h);a.innerfade.next(e,d,h,g)},d.timeout);a(e[g]).show()}else if(d.type=="random_start"){d.type="sequence";var h=Math.floor(Math.random()*e.length);setTimeout(function(){a.innerfade.next(e,d,(h+1)%e.length,h)},d.timeout);a(e[h]).show()}else{alert("Innerfade-Type must either be 'sequence', 'random' or 'random_start'")}}};a.innerfade.next=function(b,c,d,e){if(c.animationtype=="slide"){a(b[e]).slideUp(c.speed);a(b[d]).slideDown(c.speed)}else if(c.animationtype=="fade"){a(b[e]).fadeOut(c.speed);a(b[d]).fadeIn(c.speed,function(){removeFilter(a(this)[0])})}else alert("Innerfade-animationtype must either be 'slide' or 'fade'");if(c.type=="sequence"){if(d+1<b.length){d=d+1;e=d-1}else{d=0;e=b.length-1}}else if(c.type=="random"){e=d;while(d==e)d=Math.floor(Math.random()*b.length)}else alert("Innerfade-Type must either be 'sequence', 'random' or 'random_start'");setTimeout(function(){a.innerfade.next(b,c,d,e)},c.timeout)}})(jQuery);
3290
3291// jQuery tab
3292function ddtabcontent(tabinterfaceid){
3293	this.tabinterfaceid=tabinterfaceid //ID of Tab Menu main container
3294	this.tabs=document.getElementById(tabinterfaceid).getElementsByTagName("a") //Get all tab links within container
3295	this.enabletabpersistence=true
3296	this.hottabspositions=[] //Array to store position of tabs that have a "rel" attr defined, relative to all tab links, within container
3297	this.currentTabIndex=0 //Index of currently selected hot tab (tab with sub content) within hottabspositions[] array
3298	this.subcontentids=[] //Array to store ids of the sub contents ("rel" attr values)
3299	this.revcontentids=[] //Array to store ids of arbitrary contents to expand/contact as well ("rev" attr values)
3300	this.selectedClassTarget="link" //keyword to indicate which target element to assign "selected" CSS class ("linkparent" or "link")
3301}
3302
3303ddtabcontent.getCookie=function(Name){ 
3304	var re=new RegExp(Name+"=[^;]+", "i"); //construct RE to search for target name/value pair
3305	if (document.cookie.match(re)) //if cookie found
3306		return document.cookie.match(re)[0].split("=")[1] //return its value
3307	return ""
3308}
3309
3310ddtabcontent.setCookie=function(name, value){
3311	document.cookie = name+"="+value+";path=/" //cookie value is domain wide (path=/)
3312}
3313
3314ddtabcontent.prototype={
3315
3316	expandit:function(tabid_or_position){ //PUBLIC function to select a tab either by its ID or position(int) within its peers
3317		this.cancelautorun() //stop auto cycling of tabs (if running)
3318		var tabref=""
3319		try{
3320			if (typeof tabid_or_position=="string" && document.getElementById(tabid_or_position).getAttribute("rel")) //if specified tab contains "rel" attr
3321				tabref=document.getElementById(tabid_or_position)
3322			else if (parseInt(tabid_or_position)!=NaN && this.tabs[tabid_or_position].getAttribute("rel")) //if specified tab contains "rel" attr
3323				tabref=this.tabs[tabid_or_position]
3324		}
3325		catch(err){alert("Invalid Tab ID or position entered!")}
3326		if (tabref!="") //if a valid tab is found based on function parameter
3327			this.expandtab(tabref) //expand this tab
3328	},
3329
3330	cycleit:function(dir, autorun){ //PUBLIC function to move foward or backwards through each hot tab (tabinstance.cycleit('foward/back') )
3331		if (dir=="next"){
3332			var currentTabIndex=(this.currentTabIndex<this.hottabspositions.length-1)? this.currentTabIndex+1 : 0
3333		}
3334		else if (dir=="prev"){
3335			var currentTabIndex=(this.currentTabIndex>0)? this.currentTabIndex-1 : this.hottabspositions.length-1
3336		}
3337		if (typeof autorun=="undefined") //if cycleit() is being called by user, versus autorun() function
3338			this.cancelautorun() //stop auto cycling of tabs (if running)
3339		this.expandtab(this.tabs[this.hottabspositions[currentTabIndex]])
3340	},
3341
3342	setpersist:function(bool){ //PUBLIC function to toggle persistence feature
3343			this.enabletabpersistence=bool
3344	},
3345
3346	setselectedClassTarget:function(objstr){ //PUBLIC function to set which target element to assign "selected" CSS class ("linkparent" or "link")
3347		this.selectedClassTarget=objstr || "link"
3348	},
3349
3350	getselectedClassTarget:function(tabref){ //Returns target element to assign "selected" CSS class to
3351		return (this.selectedClassTarget==("linkparent".toLowerCase()))? tabref.parentNode : tabref
3352	},
3353
3354	urlparamselect:function(tabinterfaceid){
3355		var result=window.location.search.match(new RegExp(tabinterfaceid+"=(\\d+)", "i")) //check for "?tabinterfaceid=2" in URL
3356		return (result==null)? null : parseInt(RegExp.$1) //returns null or index, where index (int) is the selected tab's index
3357	},
3358
3359	expandtab:function(tabref){
3360		var subcontentid=tabref.getAttribute("rel") //Get id of subcontent to expand
3361		//Get "rev" attr as a string of IDs in the format ",john,george,trey,etc," to easily search through
3362		var associatedrevids=(tabref.getAttribute("rev"))? ","+tabref.getAttribute("rev").replace(/\s+/, "")+"," : ""
3363		this.expandsubcontent(subcontentid)
3364		this.expandrevcontent(associatedrevids)
3365		for (var i=0; i<this.tabs.length; i++){ //Loop through all tabs, and assign only the selected tab the CSS class "selected"
3366			this.getselectedClassTarget(this.tabs[i]).className=(this.tabs[i].getAttribute("rel")==subcontentid)? "selected" : ""
3367		}
3368		if (this.enabletabpersistence) //if persistence enabled, save selected tab position(int) relative to its peers
3369			ddtabcontent.setCookie(this.tabinterfaceid, tabref.tabposition)
3370		this.setcurrenttabindex(tabref.tabposition) //remember position of selected tab within hottabspositions[] array
3371	},
3372
3373	expandsubcontent:function(subcontentid){
3374		for (var i=0; i<this.subcontentids.length; i++){
3375			var subcontent=document.getElementById(this.subcontentids[i]) //cache current subcontent obj (in for loop)
3376			subcontent.style.display=(subcontent.id==subcontentid)? "block" : "none" //"show" or hide sub content based on matching id attr value
3377		}
3378	},
3379
3380	expandrevcontent:function(associatedrevids){
3381		var allrevids=this.revcontentids
3382		for (var i=0; i<allrevids.length; i++){ //Loop through rev attributes for all tabs in this tab interface
3383			//if any values stored within associatedrevids matches one within allrevids, expand that DIV, otherwise, contract it
3384			document.getElementById(allrevids[i]).style.display=(associatedrevids.indexOf(","+allrevids[i]+",")!=-1)? "block" : "none"
3385		}
3386	},
3387
3388	setcurrenttabindex:function(tabposition){ //store current position of tab (within hottabspositions[] array)
3389		for (var i=0; i<this.hottabspositions.length; i++){
3390			if (tabposition==this.hottabspositions[i]){
3391				this.currentTabIndex=i
3392				break
3393			}
3394		}
3395	},
3396
3397	autorun:function(){ //function to auto cycle through and select tabs based on a set interval
3398		this.cycleit('next', true)
3399	},
3400
3401	cancelautorun:function(){
3402		if (typeof this.autoruntimer!="undefined")
3403			clearInterval(this.autoruntimer)
3404	},
3405
3406	init:function(automodeperiod){
3407		var persistedtab=ddtabcontent.getCookie(this.tabinterfaceid) //get position of persisted tab (applicable if persistence is enabled)
3408		var selectedtab=-1 //Currently selected tab index (-1 meaning none)
3409		var selectedtabfromurl=this.urlparamselect(this.tabinterfaceid) //returns null or index from: tabcontent.htm?tabinterfaceid=index
3410		this.automodeperiod=automodeperiod || 0
3411		for (var i=0; i<this.tabs.length; i++){
3412			this.tabs[i].tabposition=i //remember position of tab relative to its peers
3413			if (this.tabs[i].getAttribute("rel")){
3414				var tabinstance=this
3415				this.hottabspositions[this.hottabspositions.length]=i //store position of "hot" tab ("rel" attr defined) relative to its peers
3416				this.subcontentids[this.subcontentids.length]=this.tabs[i].getAttribute("rel") //store id of sub content ("rel" attr value)
3417				this.tabs[i].onclick=function(){
3418					tabinstance.expandtab(this)
3419					tabinstance.cancelautorun() //stop auto cycling of tabs (if running)
3420					return false
3421				}
3422				if (this.tabs[i].getAttribute("rev")){ //if "rev" attr defined, store each value within "rev" as an array element
3423					this.revcontentids=this.revcontentids.concat(this.tabs[i].getAttribute("rev").split(/\s*,\s*/))
3424				}
3425				if (selectedtabfromurl==i || this.enabletabpersistence && selectedtab==-1 && parseInt(persistedtab)==i || !this.enabletabpersistence && selectedtab==-1 && this.getselectedClassTarget(this.tabs[i]).className=="selected"){
3426					selectedtab=i //Selected tab index, if found
3427				}
3428			}
3429		} //END for loop
3430		if (selectedtab!=-1) //if a valid default selected tab index is found
3431			this.expandtab(this.tabs[selectedtab]) //expand selected tab (either from URL parameter, persistent feature, or class="selected" class)
3432		else //if no valid default selected index found
3433			this.expandtab(this.tabs[this.hottabspositions[0]]) //Just select first tab that contains a "rel" attr
3434		if (parseInt(this.automodeperiod)>500 && this.hottabspositions.length>1){
3435			this.autoruntimer=setInterval(function(){tabinstance.autorun()}, this.automodeperiod)
3436		}
3437	} //END int() function
3438
3439} //END Prototype assignment
3440
3441/* jQuery FlexSlider v2.0
3442 * Copyright 2012 WooThemes
3443 * Contributing Author: Tyler Smith
3444 */
3445;(function(d){d.flexslider=function(h,k){var a=d(h),c=d.extend({},d.flexslider.defaults,k),e=c.namespace,o="ontouchstart"in window||window.DocumentTouch&&document instanceof DocumentTouch,s=o?"touchend":"click",l="vertical"===c.direction,m=c.reverse,i=0<c.itemWidth,p="fade"===c.animation,r=""!==c.asNavFor,f={};d.data(h,"flexslider",a);f={init:function(){a.animating=!1;a.currentSlide=c.startAt;a.animatingTo=a.currentSlide;a.atEnd=0===a.currentSlide||a.currentSlide===a.last;a.containerSelector=c.selector.substr(0,
3446c.selector.search(" "));a.slides=d(c.selector,a);a.container=d(a.containerSelector,a);a.count=a.slides.length;a.syncExists=0<d(c.sync).length;"slide"===c.animation&&(c.animation="swing");a.prop=l?"top":"marginLeft";a.args={};a.manualPause=!1;a.transitions=!c.video&&!p&&c.useCSS&&function(){var b=document.createElement("div"),c=["perspectiveProperty","WebkitPerspective","MozPerspective","OPerspective","msPerspective"],d;
3446for(d in c)if(b.style[c[d]]!==void 0){a.pfx=c[d].replace("Perspective","").toLowerCase();
3447a.prop="-"+a.pfx+"-transform";return true}return false}();""!==c.controlsContainer&&(a.controlsContainer=0<d(c.controlsContainer).length&&d(c.controlsContainer));""!==c.manualControls&&(a.manualControls=0<d(c.manualControls).length&&d(c.manualControls));c.randomize&&(a.slides.sort(function(){return Math.round(Math.random())-0.5}),a.container.empty().append(a.slides));a.doMath();r&&f.asNav.setup();a.setup("init");c.controlNav&&f.controlNav.setup();c.directionNav&&f.directionNav.setup();c.keyboard&&
3448(1===d(a.containerSelector).length||c.multipleKeyboard)&&d(document).bind("keyup",function(b){b=b.keyCode;if(!a.animating&&(b===39||b===37)){b=b===39?a.getTarget("next"):b===37?a.getTarget("prev"):false;a.flexAnimate(b,c.pauseOnAction)}});c.mousewheel&&a.bind("mousewheel",function(b,g){b.preventDefault();var d=g<0?a.getTarget("next"):a.getTarget("prev");a.flexAnimate(d,c.pauseOnAction)});c.pausePlay&&f.pausePlay.setup();c.slideshow&&(c.pauseOnHover&&a.hover(function(){a.pause()},function(){a.manualPause||
3449a.play()}),0<c.initDelay?setTimeout(a.play,c.initDelay):a.play());o&&c.touch&&f.touch();(!p||p&&c.smoothHeight)&&d(window).bind("resize focus",f.resize);setTimeout(function(){c.start(a)},200)},asNav:{setup:function(){a.asNav=!0;a.animatingTo=Math.floor(a.currentSlide/a.move);a.currentItem=a.currentSlide;a.slides.removeClass(e+"active-slide").eq(a.currentItem).addClass(e+"active-slide");a.slides.click(function(b){b.preventDefault();var b=d(this),g=b.index();!d(c.asNavFor).data("flexslider").animating&&
3450!b.hasClass("active")&&(a.direction=a.currentItem<g?"next":"prev",a.flexAnimate(g,c.pauseOnAction,!1,!0,!0))})}},controlNav:{setup:function(){a.manualControls?f.controlNav.setupManual():f.controlNav.setupPaging()},setupPaging:function(){var b=1,g;a.controlNavScaffold=d('<ol class="'+e+"control-nav "+e+("thumbnails"===c.controlNav?"control-thumbs":"control-paging")+'"></ol>');if(1<a.pagingCount)for(var q=0;q<a.pagingCount;q++)g="thumbnails"===c.controlNav?'<img src="'+a.slides.eq(q).attr("data-thumb")+
3451'"/>':"<a>"+b+"</a>",a.controlNavScaffold.append("<li>"+g+"</li>"),b++;a.controlsContainer?d(a.controlsContainer).append(a.controlNavScaffold):a.append(a.controlNavScaffold);f.controlNav.set();f.controlNav.active();a.controlNavScaffold.delegate("a, img",s,function(b){b.preventDefault();var b=d(this),g=a.controlNav.index(b);b.hasClass(e+"active")||(a.direction=g>a.currentSlide?"next":"prev",a.flexAnimate(g,c.pauseOnAction))});o&&a.controlNavScaffold.delegate("a","click touchstart",function(a){a.preventDefault()})},
3452setupManual:function(){a.controlNav=a.manualControls;f.controlNav.active();a.controlNav.live(s,function(b){b.preventDefault();var b=d(this),g=a.controlNav.index(b);b.hasClass(e+"active")||(g>a.currentSlide?a.direction="next":a.direction="prev",a.flexAnimate(g,c.pauseOnAction))});o&&a.controlNav.live("click touchstart",function(a){a.preventDefault()})},set:function(){a.controlNav=d("."+e+"control-nav li "+("thumbnails"===c.controlNav?"img":"a"),a.controlsContainer?a.controlsContainer:a)},active:function(){a.controlNav.removeClass(e+
3453"active").eq(a.animatingTo).addClass(e+"active")},update:function(b,c){1<a.pagingCount&&"add"===b?a.controlNavScaffold.append(d("<li><a>"+a.count+"</a></li>")):1===a.pagingCount?a.controlNavScaffold.find("li").remove():a.controlNav.eq(c).closest("li").remove();f.controlNav.set();1<a.pagingCount&&a.pagingCount!==a.controlNav.length?a.update(c,b):f.controlNav.active()}},directionNav:{setup:function(){var b=d('<ul class="'+e+'direction-nav"><li><a class="'+e+'prev" href="#">'+c.prevText+'</a></li><li><a class="'+
3454e+'next" href="#">'+c.nextText+"</a></li></ul>");a.controlsContainer?(d(a.controlsContainer).append(b),a.directionNav=d("."+e+"direction-nav li a",a.controlsContainer)):(a.append(b),a.directionNav=d("."+e+"direction-nav li a",a));f.directionNav.update();a.directionNav.bind(s,function(b){b.preventDefault();b=d(this).hasClass(e+"next")?a.getTarget("next"):a.getTarget("prev");a.flexAnimate(b,c.pauseOnAction)});o&&a.directionNav.bind("click touchstart",function(a){a.preventDefault()})},update:function(){var b=
3455e+"disabled";c.animationLoop||(1===a.pagingCount?a.directionNav.addClass(b):0===a.animatingTo?a.directionNav.removeClass(b).filter("."+e+"prev").addClass(b):a.animatingTo===a.last?a.directionNav.removeClass(b).filter("."+e+"next").addClass(b):a.directionNav.removeClass(b))}},pausePlay:{setup:function(){var b=d('<div class="'+e+'pauseplay"><a></a></div>');a.controlsContainer?(a.controlsContainer.append(b),a.pausePlay=d("."+e+"pauseplay a",a.controlsContainer)):(a.append(b),a.pausePlay=d("."+e+"pauseplay a",
3456a));f.pausePlay.update(c.slideshow?e+"pause":e+"play");a.pausePlay.bind(s,function(b){b.preventDefault();if(d(this).hasClass(e+"pause")){a.pause();a.manualPause=true}else{a.play();a.manualPause=false}});o&&a.pausePlay.bind("click touchstart",function(a){a.preventDefault()})},update:function(b){"play"===b?a.pausePlay.removeClass(e+"pause").addClass(e+"play").text(c.playText):a.pausePlay.removeClass(e+"play").addClass(e+"pause").text(c.pauseText)}},touch:function(){function b(b){j=l?d-b.touches[0].pageY:
3457d-b.touches[0].pageX;o=l?Math.abs(j)<Math.abs(b.touches[0].pageX-e):Math.abs(j)<Math.abs(b.touches[0].pageY-e);if(!o||500<Number(new Date)-k)b.preventDefault(),!p&&a.transitions&&(c.animationLoop||(j/=0===a.currentSlide&&0>j||a.currentSlide===a.last&&0<j?Math.abs(j)/n+2:1),a.setProps(f+j,"setTouch"))}function g(){if(a.animatingTo===a.currentSlide&&!o&&null!==j){var i=m?-j:j,l=0<i?a.getTarget("next"):a.getTarget("prev");a.canAdvance(l)&&(550>Number(new Date)-k&&20<Math.abs(i)||Math.abs(i)>n/2)?a.flexAnimate(l,
3458c.pauseOnAction):a.flexAnimate(a.currentSlide,c.pauseOnAction,!0)}h.removeEventListener("touchmove",b,!1);h.removeEventListener("touchend",g,!1);f=j=e=d=null}var d,e,f,n,j,k,o=!1;h.addEventListener("touchstart",function(j){a.animating?j.preventDefault():1===j.touches.length&&(a.pause(),n=l?a.h:a.w,k=Number(new Date),f=i&&m&&a.animatingTo===a.last?0:i&&m?a.limit-(a.itemW+c.itemMargin)*a.move*a.animatingTo:i&&a.currentSlide===a.last?a.limit:i?(a.itemW+c.itemMargin)*a.move*a.currentSlide:m?(a.last-a.currentSlide+
3459a.cloneOffset)*n:(a.currentSlide+a.cloneOffset)*n,d=l?j.touches[0].pageY:j.touches[0].pageX,e=l?j.touches[0].pageX:j.touches[0].pageY,h.addEventListener("touchmove",b,!1),h.addEventListener("touchend",g,!1))},!1)},resize:function(){!a.animating&&a.is(":visible")&&(i||a.doMath(),p?f.smoothHeight():i?(a.slides.width(a.computedW),a.update(a.pagingCount),a.setProps()):l?(a.viewport.height(a.h),a.setProps(a.h,"setTotal")):(c.smoothHeight&&f.smoothHeight(),a.newSlides.width(a.computedW),a.setProps(a.computedW,
3460"setTotal")))},smoothHeight:function(b){if(!l||p){var c=p?a:a.viewport;b?c.animate({height:a.slides.eq(a.animatingTo).height()},b):c.height(a.slides.eq(a.animatingTo).height())}},sync:function(b){var g=d(c.sync).data("flexslider"),e=a.animatingTo;switch(b){case "animate":g.flexAnimate(e,c.pauseOnAction,!1,!0);break;case "play":!g.playing&&!g.asNav&&g.play();break;case "pause":g.pause()}}};
3460a.flexAnimate=function(b,g,q,h,k){if(!a.animating&&(a.canAdvance(b)||q)&&a.is(":visible")){if(r&&h)if(q=d(c.asNavFor).data("flexslider"),
3461a.atEnd=0===b||b===a.count-1,q.flexAnimate(b,!0,!1,!0,k),a.direction=a.currentItem<b?"next":"prev",q.direction=a.direction,Math.ceil((b+1)/a.visible)-1!==a.currentSlide&&0!==b)a.currentItem=b,a.slides.removeClass(e+"active-slide").eq(b).addClass(e+"active-slide"),b=Math.floor(b/a.visible);else return a.currentItem=b,a.slides.removeClass(e+"active-slide").eq(b).addClass(e+"active-slide"),!1;a.animating=!0;a.animatingTo=b;c.before(a);g&&a.pause();a.syncExists&&!k&&f.sync("animate");c.controlNav&&f.controlNav.active();
3462i||a.slides.removeClass(e+"active-slide").eq(b).addClass(e+"active-slide");a.atEnd=0===b||b===a.last;c.directionNav&&f.directionNav.update();b===a.last&&(c.end(a),c.animationLoop||a.pause());if(p)a.slides.eq(a.currentSlide).fadeOut(c.animationSpeed,c.easing),a.slides.eq(b).fadeIn(c.animationSpeed,c.easing,a.wrapup);else{var n=l?a.slides.filter(":first").height():a.computedW;i?(b=c.itemWidth>a.w?2*c.itemMargin:c.itemMargin,b=(a.itemW+b)*a.move*a.animatingTo,b=b>a.limit&&1!==a.visible?a.limit:b):b=
34630===a.currentSlide&&b===a.count-1&&c.animationLoop&&"next"!==a.direction?m?(a.count+a.cloneOffset)*n:0:a.currentSlide===a.last&&0===b&&c.animationLoop&&"prev"!==a.direction?m?0:(a.count+1)*n:m?(a.count-1-b+a.cloneOffset)*n:(b+a.cloneOffset)*n;a.setProps(b,"",c.animationSpeed);if(a.transitions){if(!c.animationLoop||!a.atEnd)a.animating=!1,a.currentSlide=a.animatingTo;a.container.unbind("webkitTransitionEnd transitionend");a.container.bind("webkitTransitionEnd transitionend",function(){a.wrapup(n)})}else a.container.animate(a.args,
3464c.animationSpeed,c.easing,function(){a.wrapup(n)})}c.smoothHeight&&f.smoothHeight(c.animationSpeed)}};a.wrapup=function(b){!p&&!i&&(0===a.currentSlide&&a.animatingTo===a.last&&c.animationLoop?a.setProps(b,"jumpEnd"):a.currentSlide===a.last&&(0===a.animatingTo&&c.animationLoop)&&a.setProps(b,"jumpStart"));a.animating=!1;a.currentSlide=a.animatingTo;c.after(a)};a.animateSlides=function(){a.animating||a.flexAnimate(a.getTarget("next"))};a.pause=function(){clearInterval(a.animatedSlides);a.playing=!1;
3465c.pausePlay&&f.pausePlay.update("play");a.syncExists&&f.sync("pause")};a.play=function(){a.animatedSlides=setInterval(a.animateSlides,c.slideshowSpeed);a.playing=!0;c.pausePlay&&f.pausePlay.update("pause");a.syncExists&&f.sync("play")};a.canAdvance=function(b){var d=r?a.pagingCount-1:a.last;return r&&0===a.currentItem&&b===a.pagingCount-1&&"next"!==a.direction?!1:b===a.currentSlide&&!r?!1:c.animationLoop?!0:a.atEnd&&0===a.currentSlide&&b===d&&"next"!==a.direction?!1:a.atEnd&&a.currentSlide===d&&0===
3466b&&"next"===a.direction?!1:!0};a.getTarget=function(b){a.direction=b;return"next"===b?a.currentSlide===a.last?0:a.currentSlide+1:0===a.currentSlide?a.last:a.currentSlide-1};a.setProps=function(b,d,e){var f=function(){var e=b?b:(a.itemW+c.itemMargin)*a.move*a.animatingTo;return-1*function(){if(i)return"setTouch"===d?b:m&&a.animatingTo===a.last?0:m?a.limit-(a.itemW+c.itemMargin)*a.move*a.animatingTo:a.animatingTo===a.last?a.limit:e;switch(d){case "setTotal":return m?(a.count-1-a.currentSlide+a.cloneOffset)*
3467b:(a.currentSlide+a.cloneOffset)*b;case "setTouch":return b;case "jumpEnd":return m?b:a.count*b;case "jumpStart":return m?a.count*b:b;default:return b}}()+"px"}();a.transitions&&(f=l?"translate3d(0,"+f+",0)":"translate3d("+f+",0,0)",e=void 0!==e?e/1E3+"s":"0s",a.container.css("-"+a.pfx+"-transition-duration",e));a.args[a.prop]=f;(a.transitions||void 0===e)&&a.container.css(a.args)};a.setup=function(b){if(p)a.slides.css({width:"100%","float":"left",marginRight:"-100%",position:"relative"}),"init"===
3468b&&a.slides.eq(a.currentSlide).fadeIn(c.animationSpeed,c.easing),c.smoothHeight&&f.smoothHeight();else{var g,h;"init"===b&&(a.viewport=d('<div class="flex-viewport"></div>').css({overflow:"hidden",position:"relative"}).appendTo(a).append(a.container),a.cloneCount=0,a.cloneOffset=0,m&&(h=d.makeArray(a.slides).reverse(),a.slides=d(h),a.container.empty().append(a.slides)));c.animationLoop&&!i&&(a.cloneCount=2,a.cloneOffset=1,"init"!==b&&a.container.find(".clone").remove(),a.container.append(a.slides.first().clone().addClass("clone")).prepend(a.slides.last().clone().addClass("clone")));
3469a.newSlides=d(c.selector,a);g=m?a.count-1-a.currentSlide+a.cloneOffset:a.currentSlide+a.cloneOffset;l&&!i?(a.container.height(200*(a.count+a.cloneCount)+"%").css("position","absolute").width("100%"),setTimeout(function(){a.newSlides.css({display:"block"});a.doMath();a.viewport.height(a.h);a.setProps(g*a.h,"init")},"init"===b?100:0)):(a.container.width(200*(a.count+a.cloneCount)+"%"),a.setProps(g*a.computedW,"init"),setTimeout(function(){a.doMath();a.newSlides.css({width:a.computedW,"float":"left",
3470display:"block"});c.smoothHeight&&f.smoothHeight()},"init"===b?100:0))}i||a.slides.removeClass(e+"active-slide").eq(a.currentSlide).addClass(e+"active-slide")};a.doMath=function(){var b=a.slides.first(),d=c.itemMargin,e=c.minItems,f=c.maxItems;a.w=a.width();a.h=b.height();a.boxPadding=b.outerWidth()-b.width();i?(a.itemT=c.itemWidth+d,a.minW=e?e*a.itemT:a.w,a.maxW=f?f*a.itemT:a.w,a.itemW=a.minW>a.w?(a.w-d*e)/e:a.maxW<a.w?(a.w-d*f)/f:c.itemWidth>a.w?a.w:c.itemWidth,a.visible=Math.floor(a.w/(a.itemW+
3471d)),a.move=0<c.move&&c.move<a.visible?c.move:a.visible,a.pagingCount=Math.ceil((a.count-a.visible)/a.move+1),a.last=a.pagingCount-1,a.limit=1===a.pagingCount?0:c.itemWidth>a.w?(a.itemW+2*d)*a.count-a.w-d:(a.itemW+d)*a.count-a.w):(a.itemW=a.w,a.pagingCount=a.count,a.last=a.count-1);a.computedW=a.itemW-a.boxPadding};a.update=function(b,d){a.doMath();i||(b<a.currentSlide?a.currentSlide+=1:b<=a.currentSlide&&0!==b&&(a.currentSlide-=1),a.animatingTo=a.currentSlide);
3471if(c.controlNav&&!a.manualControls)if("add"===
3472d&&!i||a.pagingCount>a.controlNav.length)f.controlNav.update("add");else if("remove"===d&&!i||a.pagingCount<a.controlNav.length)i&&a.currentSlide>a.last&&(a.currentSlide-=1,a.animatingTo-=1),f.controlNav.update("remove",a.last);c.directionNav&&f.directionNav.update()};a.addSlide=function(b,e){var f=d(b);a.count+=1;a.last=a.count-1;l&&m?void 0!==e?a.slides.eq(a.count-e).after(f):a.container.prepend(f):void 0!==e?a.slides.eq(e).before(f):a.container.append(f);a.update(e,"add");a.slides=d(c.selector+
3473":not(.clone)",a);a.setup();c.added(a)};a.removeSlide=function(b){var e=isNaN(b)?a.slides.index(d(b)):b;a.count-=1;a.last=a.count-1;isNaN(b)?d(b,a.slides).remove():l&&m?a.slides.eq(a.last).remove():a.slides.eq(b).remove();a.doMath();a.update(e,"remove");a.slides=d(c.selector+":not(.clone)",a);a.setup();c.removed(a)};f.init()};d.flexslider.defaults={namespace:"flex-",selector:".slides > li",animation:"fade",easing:"swing",direction:"horizontal",reverse:!1,animationLoop:!0,smoothHeight:!1,startAt:0,
3474slideshow:!0,slideshowSpeed:7E3,animationSpeed:600,initDelay:0,randomize:!1,pauseOnAction:!0,pauseOnHover:!1,useCSS:!0,touch:!0,video:!1,controlNav:!0,directionNav:!0,prevText:"Previous",nextText:"Next",keyboard:!0,multipleKeyboard:!1,mousewheel:!1,pausePlay:!1,pauseText:"Pause",playText:"Play",controlsContainer:"",manualControls:"",sync:"",asNavFor:"",itemWidth:0,itemMargin:0,minItems:0,maxItems:0,move:0,start:function(){},before:function(){},after:function(){},end:function(){},added:function(){},
3475removed:function(){}};d.fn.flexslider=function(h){h=h||{};if("object"===typeof h)return this.each(function(){var a=d(this),c=a.find(h.selector?h.selector:".slides > li");1===c.length?(c.fadeIn(400),h.start&&h.start(a)):void 0===a.data("flexslider")&&new d.flexslider(this,h)});var k=d(this).data("flexslider");switch(h){case "play":k.play();break;case "pause":k.pause();break;case "next":k.flexAnimate(k.getTarget("next"),!0);break;case "prev":case "previous":k.flexAnimate(k.getTarget("prev"),!0);break;
3476default:"number"===typeof h&&k.flexAnimate(h,!0)}}})(jQuery);
3477
3478/* ------------------------------------------------------------------------
3479	Class: prettyPhoto
3480	Use: Lightbox clone for jQuery
3481	Author: Stephane Caron (http://www.no-margin-for-errors.com)
3482	Version: 3.1.5
3483------------------------------------------------------------------------- */
3484(function(e){function t(){var e=location.href;hashtag=e.indexOf("#prettyPhoto")!==-1?decodeURI(e.substring(e.indexOf("#prettyPhoto")+1,e.length)):false;return hashtag}function n(){if(typeof theRel=="undefined")return;location.hash=theRel+"/"+rel_index+"/"}function r(){if(location.href.indexOf("#prettyPhoto")!==-1)location.hash="prettyPhoto"}function i(e,t){e=e.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var n="[\\?&]"+e+"=([^&#]*)";var r=new RegExp(n);var i=r.exec(t);return i==null?"":i[1]}e.prettyPhoto={version:"3.1.5"};e.fn.prettyPhoto=function(s){function g(){e(".pp_loaderIcon").hide();projectedTop=scroll_pos["scrollTop"]+(d/2-a["containerHeight"]/2);if(projectedTop<0)projectedTop=0;$ppt.fadeTo(settings.animation_speed,1);$pp_pic_holder.find(".pp_content").animate({height:a["contentHeight"],width:a["contentWidth"]},settings.animation_speed);$pp_pic_holder.animate({top:projectedTop,left:v/2-a["containerWidth"]/2<0?0:v/2-a["containerWidth"]/2,width:a["containerWidth"]},settings.animation_speed,function(){$pp_pic_holder.find(".pp_hoverContainer,#fullResImage").height(a["height"]).width(a["width"]);$pp_pic_holder.find(".pp_fade").fadeIn(settings.animation_speed);if(isSet&&S(pp_images[set_position])=="image"){$pp_pic_holder.find(".pp_hoverContainer").show()}else{$pp_pic_holder.find(".pp_hoverContainer").hide()}if(settings.allow_expand){if(a["resized"]){e("a.pp_expand,a.pp_contract").show()}else{e("a.pp_expand").hide()}}if(settings.autoplay_slideshow&&!m&&!f)e.prettyPhoto.startSlideshow();settings.changepicturecallback();f=true});C();s.ajaxcallback()}function y(t){$pp_pic_holder.find("#pp_full_res object,#pp_full_res embed").css("visibility","hidden");$pp_pic_holder.find(".pp_fade").fadeOut(settings.animation_speed,function(){e(".pp_loaderIcon").show();t()})}function b(t){t>1?e(".pp_nav").show():e(".pp_nav").hide()}function w(e,t){resized=false;E(e,t);imageWidth=e,imageHeight=t;if((p>v||h>d)&&doresize&&settings.allow_resize&&!u){resized=true,fitting=false;while(!fitting){if(p>v){imageWidth=v-200;imageHeight=t/e*imageWidth}else if(h>d){imageHeight=d-200;imageWidth=e/t*imageHeight}else{fitting=true}h=imageHeight,p=imageWidth}if(p>v||h>d){w(p,h)}E(imageWidth,imageHeight)}return{width:Math.floor(imageWidth),height:Math.floor(imageHeight),containerHeight:Math.floor(h),containerWidth:Math.floor(p)+settings.horizontal_padding*2,contentHeight:Math.floor(l),contentWidth:Math.floor(c),resized:resized}}function E(t,n){t=parseFloat(t);n=parseFloat(n);$pp_details=$pp_pic_holder.find(".pp_details");$pp_details.width(t);detailsHeight=parseFloat($pp_details.css("marginTop"))+parseFloat($pp_details.css("marginBottom"));$pp_details=$pp_details.clone().addClass(settings.theme).width(t).appendTo(e("body")).css({position:"absolute",top:-1e4});detailsHeight+=$pp_details.height();detailsHeight=detailsHeight<=34?36:detailsHeight;$pp_details.remove();$pp_title=$pp_pic_holder.find(".ppt");$pp_title.width(t);titleHeight=parseFloat($pp_title.css("marginTop"))+parseFloat($pp_title.css("marginBottom"));$pp_title=$pp_title.clone().appendTo(e("body")).css({position:"absolute",top:-1e4});titleHeight+=$pp_title.height();$pp_title.remove();l=n+detailsHeight;c=t;h=l+titleHeight+$pp_pic_holder.find(".pp_top").height()+$pp_pic_holder.find(".pp_bottom").height();p=t}function S(e){if(e.match(/youtube\.com\/watch/i)||e.match(/youtu\.be/i)){return"youtube"}else if(e.match(/vimeo\.com/i)){return"vimeo"}else if(e.match(/\b.mov\b/i)){return"quicktime"}else if(e.match(/\b.swf\b/i)){return"flash"}else if(e.match(/\biframe=true\b/i)){return"iframe"}else if(e.match(/\bajax=true\b/i)){return"ajax"}else if(e.match(/\bcustom=true\b/i)){return"custom"}else if(e.substr(0,1)=="#"){return"inline"}else{return"image"}}function x(){if(doresize&&typeof $pp_pic_holder!="undefined"){scroll_pos=T();contentHeight=$pp_pic_holder.height(),contentwidth=$pp_pic_holder.width();projectedTop=d/2+scroll_pos["scrollTop"]-contentHeight/2;if(projectedTop<0)projectedTop=0;if(contentHeight>d)return;
3484$pp_pic_holder.css({top:projectedTop,left:v/2+scroll_pos["scrollLeft"]-contentwidth/2})}}function T(){if(self.pageYOffset){return{scrollTop:self.pageYOffset,scrollLeft:self.pageXOffset}}else if(document.documentElement&&document.documentElement.scrollTop){return{scrollTop:document.documentElement.scrollTop,scrollLeft:document.documentElement.scrollLeft}}else if(document.body){return{scrollTop:document.body.scrollTop,scrollLeft:document.body.scrollLeft}}}function N(){d=e(window).height(),v=e(window).width();if(typeof $pp_overlay!="undefined")$pp_overlay.height(e(document).height()).width(v)}function C(){if(isSet&&settings.overlay_gallery&&S(pp_images[set_position])=="image"){itemWidth=52+5;navWidth=settings.theme=="facebook"||settings.theme=="pp_default"?50:30;itemsPerPage=Math.floor((a["containerWidth"]-100-navWidth)/itemWidth);itemsPerPage=itemsPerPage<pp_images.length?itemsPerPage:pp_images.length;totalPage=Math.ceil(pp_images.length/itemsPerPage)-1;if(totalPage==0){navWidth=0;$pp_gallery.find(".pp_arrow_next,.pp_arrow_previous").hide()}else{$pp_gallery.find(".pp_arrow_next,.pp_arrow_previous").show()}galleryWidth=itemsPerPage*itemWidth;fullGalleryWidth=pp_images.length*itemWidth;$pp_gallery.css("margin-left",-(galleryWidth/2+navWidth/2)).find("div:first").width(galleryWidth+5).find("ul").width(fullGalleryWidth).find("li.selected").removeClass("selected");goToPage=Math.floor(set_position/itemsPerPage)<totalPage?Math.floor(set_position/itemsPerPage):totalPage;e.prettyPhoto.changeGalleryPage(goToPage);$pp_gallery_li.filter(":eq("+set_position+")").addClass("selected")}else{$pp_pic_holder.find(".pp_content").unbind("mouseenter mouseleave")}}function k(t){if(settings.social_tools)facebook_like_link=settings.social_tools.replace("{location_href}",encodeURIComponent(location.href));settings.markup=settings.markup.replace("{pp_social}","");e("body").append(settings.markup);$pp_pic_holder=e(".pp_pic_holder"),$ppt=e(".ppt"),$pp_overlay=e("div.pp_overlay");if(isSet&&settings.overlay_gallery){currentGalleryPage=0;toInject="";for(var n=0;n<pp_images.length;n++){if(!pp_images[n].match(/\b(jpg|jpeg|png|gif)\b/gi)){classname="default";img_src=""}else{classname="";img_src=pp_images[n]}toInject+="<li class='"+classname+"'><a href='#'><img src='"+img_src+"' width='50' alt='' /></a></li>"}toInject=settings.gallery_markup.replace(/{gallery}/g,toInject);$pp_pic_holder.find("#pp_full_res").after(toInject);$pp_gallery=e(".pp_pic_holder .pp_gallery"),$pp_gallery_li=$pp_gallery.find("li");$pp_gallery.find(".pp_arrow_next").click(function(){e.prettyPhoto.changeGalleryPage("next");e.prettyPhoto.stopSlideshow();return false});$pp_gallery.find(".pp_arrow_previous").click(function(){e.prettyPhoto.changeGalleryPage("previous");e.prettyPhoto.stopSlideshow();return false});$pp_pic_holder.find(".pp_content").hover(function(){$pp_pic_holder.find(".pp_gallery:not(.disabled)").fadeIn()},function(){$pp_pic_holder.find(".pp_gallery:not(.disabled)").fadeOut()});itemWidth=52+5;$pp_gallery_li.each(function(t){e(this).find("a").click(function(){e.prettyPhoto.changePage(t);e.prettyPhoto.stopSlideshow();return false})})}if(settings.slideshow){$pp_pic_holder.find(".pp_nav").prepend('<a href="#" class="pp_play">Play</a>');$pp_pic_holder.find(".pp_nav .pp_play").click(function(){e.prettyPhoto.startSlideshow();return false})}$pp_pic_holder.attr("class","pp_pic_holder "+settings.theme);$pp_overlay.css({opacity:0,height:e(document).height(),width:e(window).width()}).bind("click",function(){if(!settings.modal)e.prettyPhoto.close()});e("a.pp_close").bind("click",function(){e.prettyPhoto.close();return false});if(settings.allow_expand){e("a.pp_expand").bind("click",function(t){if(e(this).hasClass("pp_expand")){e(this).removeClass("pp_expand").addClass("pp_contract");doresize=false}else{e(this).removeClass("pp_contract").addClass("pp_expand");doresize=true}y(function(){e.prettyPhoto.open()});return false})}$pp_pic_holder.find(".pp_previous, .pp_nav .pp_arrow_previous").bind("click",function(){e.prettyPhoto.changePage("previous");e.prettyPhoto.stopSlideshow();return false});$pp_pic_holder.find(".pp_next, .pp_nav .pp_arrow_next").bind("click",function(){e.prettyPhoto.changePage("next");e.prettyPhoto.stopSlideshow();return false});x()}s=jQuery.extend({hook:"rel",animation_speed:"fast",ajaxcallback:function(){},slideshow:5e3,autoplay_slideshow:false,opacity:.8,show_title:true,allow_resize:true,allow_expand:true,default_width:500,default_height:344,counter_separator_label:"/",theme:"pp_default",horizontal_padding:20,hideflash:false,wmode:"opaque",autoplay:true,modal:false,deeplinking:true,overlay_gallery:true,overlay_gallery_max:30,keyboard_shortcuts:true,changepicturecallback:function(){},callback:function(){},ie6_fallback:true,markup:'<div class="pp_pic_holder"> 						<div class="ppt"> </div> 						<div class="pp_top"> 							<div class="pp_left"></div> 							<div class="pp_middle"></div> 							<div class="pp_right"></div> 						</div> 						<div class="pp_content_container"> 							<div class="pp_left"> 							<div class="pp_right"> 								<div class="pp_content"> 									<div class="pp_loaderIcon"></div> 									<div class="pp_fade"> 										<a href="#" class="pp_expand" title="Expand the image">Expand</a> 										<div class="pp_hoverContainer"> 											<a class="pp_next" href="#">next</a> 											<a class="pp_previous" href="#">previous</a> 										</div> 										<div id="pp_full_res"></div> 										<div class="pp_details"> 											<div class="pp_nav"> 												<a href="#" class="pp_arrow_previous">Previous</a> 												<p class="currentTextHolder">0/0</p> 												<a href="#" class="pp_arrow_next">Next</a> 											</div> 											<p class="pp_description"></p> 											<div class="pp_social">{pp_social}</div> 											<a class="pp_close" href="#">Close</a> 										</div> 									</div> 								</div> 							</div> 							</div> 						</div> 						<div class="pp_bottom"> 							<div class="pp_left"></div> 							<div class="pp_middle"></div> 							<div class="pp_right"></div> 						</div> 					</div> 					<div class="pp_overlay"></div>',gallery_markup:'<div class="pp_gallery"> 								<a href="#" class="pp_arrow_previous">Previous</a> 								<div> 									<ul> 										{gallery} 									</ul> 								</div> 								<a href="#" class="pp_arrow_next">Next</a> 							</div>',image_markup:'<img id="fullResImage" src="{path}" />',flash_markup:'<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="{width}" height="{height}"><param name="wmode" value="{wmode}" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="{path}" /><embed src="{path}" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="{width}" height="{height}" wmode="{wmode}"></embed></object>',quicktime_markup:'<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" height="{height}" width="{width}"><param name="src" value="{path}"><param name="autoplay" value="{autoplay}"><param name="type" value="video/quicktime"><embed src="{path}" height="{height}" width="{width}" autoplay="{autoplay}" type="video/quicktime" pluginspage="http://www.apple.com/quicktime/download/"></embed></object>',iframe_markup:'<iframe src ="{path}" width="{width}" height="{height}" frameborder="no"></iframe>',inline_markup:'<div class="pp_inline">{content}</div>',custom_markup:"",social_tools:'<div class="twitter"><a href="http://twitter.com/share" class="twitter-share-button" data-count="none">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script></div><div class="facebook"><iframe src="//www.facebook.com/plugins/like.php?locale=en_US&href={location_href}&layout=button_count&show_faces=true&width=500&action=like&font&colorscheme=light&height=23" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:500px; height:23px;" allowTransparency="true"></iframe></div>'},s);var o=this,u=false,a,f,l,c,h,p,d=e(window).height(),v=e(window).width(),m;doresize=true,scroll_pos=T();e(window).unbind("resize.prettyphoto").bind("resize.prettyphoto",function(){x();N()});
3484if(s.keyboard_shortcuts){e(document).unbind("keydown.prettyphoto").bind("keydown.prettyphoto",function(t){if(typeof $pp_pic_holder!="undefined"){if($pp_pic_holder.is(":visible")){switch(t.keyCode){case 37:e.prettyPhoto.changePage("previous");t.preventDefault();break;case 39:e.prettyPhoto.changePage("next");t.preventDefault();break;case 27:if(!settings.modal)e.prettyPhoto.close();t.preventDefault();break}}}})}e.prettyPhoto.initialize=function(){settings=s;if(settings.theme=="pp_default")settings.horizontal_padding=16;theRel=e(this).attr(settings.hook);galleryRegExp=/\[(?:.*)\]/;isSet=galleryRegExp.exec(theRel)?true:false;pp_images=isSet?jQuery.map(o,function(t,n){if(e(t).attr(settings.hook).indexOf(theRel)!=-1)return e(t).attr("href")}):e.makeArray(e(this).attr("href"));pp_titles=isSet?jQuery.map(o,function(t,n){if(e(t).attr(settings.hook).indexOf(theRel)!=-1)return e(t).find("img").attr("alt")?e(t).find("img").attr("alt"):""}):e.makeArray(e(this).find("img").attr("alt"));pp_descriptions=isSet?jQuery.map(o,function(t,n){if(e(t).attr(settings.hook).indexOf(theRel)!=-1)return e(t).attr("title")?e(t).attr("title"):""}):e.makeArray(e(this).attr("title"));if(pp_images.length>settings.overlay_gallery_max)settings.overlay_gallery=false;set_position=jQuery.inArray(e(this).attr("href"),pp_images);rel_index=isSet?set_position:e("a["+settings.hook+"^='"+theRel+"']").index(e(this));k(this);if(settings.allow_resize)e(window).bind("scroll.prettyphoto",function(){x()});e.prettyPhoto.open();return false};e.prettyPhoto.open=function(t){if(typeof settings=="undefined"){settings=s;pp_images=e.makeArray(arguments[0]);pp_titles=arguments[1]?e.makeArray(arguments[1]):e.makeArray("");pp_descriptions=arguments[2]?e.makeArray(arguments[2]):e.makeArray("");isSet=pp_images.length>1?true:false;set_position=arguments[3]?arguments[3]:0;k(t.target)}if(settings.hideflash)e("object,embed,iframe[src*=youtube],iframe[src*=vimeo]").css("visibility","hidden");b(e(pp_images).size());e(".pp_loaderIcon").show();if(settings.deeplinking)n();if(settings.social_tools){facebook_like_link=settings.social_tools.replace("{location_href}",encodeURIComponent(location.href));$pp_pic_holder.find(".pp_social").html(facebook_like_link)}if($ppt.is(":hidden"))$ppt.css("opacity",0).show();$pp_overlay.show().fadeTo(settings.animation_speed,settings.opacity);$pp_pic_holder.find(".currentTextHolder").text(set_position+1+settings.counter_separator_label+e(pp_images).size());if(typeof pp_descriptions[set_position]!="undefined"&&pp_descriptions[set_position]!=""){$pp_pic_holder.find(".pp_description").show().html(unescape(pp_descriptions[set_position]))}else{$pp_pic_holder.find(".pp_description").hide()}movie_width=parseFloat(i("width",pp_images[set_position]))?i("width",pp_images[set_position]):settings.default_width.toString();movie_height=parseFloat(i("height",pp_images[set_position]))?i("height",pp_images[set_position]):settings.default_height.toString();u=false;if(movie_height.indexOf("%")!=-1){movie_height=parseFloat(e(window).height()*parseFloat(movie_height)/100-150);u=true}if(movie_width.indexOf("%")!=-1){movie_width=parseFloat(e(window).width()*parseFloat(movie_width)/100-150);u=true}$pp_pic_holder.fadeIn(function(){settings.show_title&&pp_titles[set_position]!=""&&typeof pp_titles[set_position]!="undefined"?$ppt.html(unescape(pp_titles[set_position])):$ppt.html(" ");imgPreloader="";skipInjection=false;switch(S(pp_images[set_position])){case"image":imgPreloader=new Image;nextImage=new Image;if(isSet&&set_position<e(pp_images).size()-1)nextImage.src=pp_images[set_position+1];prevImage=new Image;if(isSet&&pp_images[set_position-1])prevImage.src=pp_images[set_position-1];$pp_pic_holder.find("#pp_full_res")[0].innerHTML=settings.image_markup.replace(/{path}/g,pp_images[set_position]);imgPreloader.onload=function(){a=w(imgPreloader.width,imgPreloader.height);g()};imgPreloader.onerror=function(){alert("Image cannot be loaded. Make sure the path is correct and image exist.");e.prettyPhoto.close()};imgPreloader.src=pp_images[set_position];break;case"youtube":a=w(movie_width,movie_height);movie_id=i("v",pp_images[set_position]);if(movie_id==""){movie_id=pp_images[set_position].split("youtu.be/");movie_id=movie_id[1];if(movie_id.indexOf("?")>0)movie_id=movie_id.substr(0,movie_id.indexOf("?"));if(movie_id.indexOf("&")>0)movie_id=movie_id.substr(0,movie_id.indexOf("&"))}movie="http://www.youtube.com/embed/"+movie_id;i("rel",pp_images[set_position])?movie+="?rel="+i("rel",pp_images[set_position]):movie+="?rel=1";if(settings.autoplay)movie+="&autoplay=1";toInject=settings.iframe_markup.replace(/{width}/g,a["width"]).replace(/{height}/g,a["height"]).replace(/{wmode}/g,settings.wmode).replace(/{path}/g,movie);break;case"vimeo":a=w(movie_width,movie_height);movie_id=pp_images[set_position];var t=/http(s?):\/\/(www\.)?vimeo.com\/(\d+)/;var n=movie_id.match(t);movie="http://player.vimeo.com/video/"+n[3]+"?title=0&byline=0&portrait=0";if(settings.autoplay)movie+="&autoplay=1;";vimeo_width=a["width"]+"/embed/?moog_width="+a["width"];toInject=settings.iframe_markup.replace(/{width}/g,vimeo_width).replace(/{height}/g,a["height"]).replace(/{path}/g,movie);break;case"quicktime":a=w(movie_width,movie_height);a["height"]+=15;a["contentHeight"]+=15;a["containerHeight"]+=15;toInject=settings.quicktime_markup.replace(/{width}/g,a["width"]).replace(/{height}/g,a["height"]).replace(/{wmode}/g,settings.wmode).replace(/{path}
3484/g,pp_images[set_position]).replace(/{autoplay}/g,settings.autoplay);break;case"flash":a=w(movie_width,movie_height);flash_vars=pp_images[set_position];flash_vars=flash_vars.substring(pp_images[set_position].indexOf("flashvars")+10,pp_images[set_position].length);filename=pp_images[set_position];filename=filename.substring(0,filename.indexOf("?"));toInject=settings.flash_markup.replace(/{width}/g,a["width"]).replace(/{height}/g,a["height"]).replace(/{wmode}/g,settings.wmode).replace(/{path}/g,filename+"?"+flash_vars);break;case"iframe":a=w(movie_width,movie_height);frame_url=pp_images[set_position];frame_url=frame_url.substr(0,frame_url.indexOf("iframe")-1);toInject=settings.iframe_markup.replace(/{width}/g,a["width"]).replace(/{height}/g,a["height"]).replace(/{path}/g,frame_url);break;case"ajax":doresize=false;a=w(movie_width,movie_height);doresize=true;skipInjection=true;e.get(pp_images[set_position],function(e){toInject=settings.inline_markup.replace(/{content}/g,e);$pp_pic_holder.find("#pp_full_res")[0].innerHTML=toInject;g()});break;case"custom":a=w(movie_width,movie_height);toInject=settings.custom_markup;break;case"inline":myClone=e(pp_images[set_position]).clone().append('<br clear="all" />').css({width:settings.default_width}).wrapInner('<div id="pp_full_res"><div class="pp_inline"></div></div>').appendTo(e("body")).show();doresize=false;a=w(e(myClone).width(),e(myClone).height());doresize=true;e(myClone).remove();toInject=settings.inline_markup.replace(/{content}/g,e(pp_images[set_position]).html());break}if(!imgPreloader&&!skipInjection){$pp_pic_holder.find("#pp_full_res")[0].innerHTML=toInject;g()}});return false};e.prettyPhoto.changePage=function(t){currentGalleryPage=0;if(t=="previous"){set_position--;if(set_position<0)set_position=e(pp_images).size()-1}else if(t=="next"){set_position++;if(set_position>e(pp_images).size()-1)set_position=0}else{set_position=t}rel_index=set_position;if(!doresize)doresize=true;if(settings.allow_expand){e(".pp_contract").removeClass("pp_contract").addClass("pp_expand")}y(function(){e.prettyPhoto.open()})};e.prettyPhoto.changeGalleryPage=function(e){if(e=="next"){currentGalleryPage++;if(currentGalleryPage>totalPage)currentGalleryPage=0}else if(e=="previous"){currentGalleryPage--;if(currentGalleryPage<0)currentGalleryPage=totalPage}else{currentGalleryPage=e}slide_speed=e=="next"||e=="previous"?settings.animation_speed:0;slide_to=currentGalleryPage*itemsPerPage*itemWidth;$pp_gallery.find("ul").animate({left:-slide_to},slide_speed)};e.prettyPhoto.startSlideshow=function(){if(typeof m=="undefined"){$pp_pic_holder.find(".pp_play").unbind("click").removeClass("pp_play").addClass("pp_pause").click(function(){e.prettyPhoto.stopSlideshow();return false});m=setInterval(e.prettyPhoto.startSlideshow,settings.slideshow)}else{e.prettyPhoto.changePage("next")}};e.prettyPhoto.stopSlideshow=function(){$pp_pic_holder.find(".pp_pause").unbind("click").removeClass("pp_pause").addClass("pp_play").click(function(){e.prettyPhoto.startSlideshow();return false});clearInterval(m);m=undefined};e.prettyPhoto.close=function(){if($pp_overlay.is(":animated"))return;e.prettyPhoto.stopSlideshow();$pp_pic_holder.stop().find("object,embed").css("visibility","hidden");e("div.pp_pic_holder,div.ppt,.pp_fade").fadeOut(settings.animation_speed,function(){e(this).remove()});$pp_overlay.fadeOut(settings.animation_speed,function(){if(settings.hideflash)e("object,embed,iframe[src*=youtube],iframe[src*=vimeo]").css("visibility","visible");e(this).remove();e(window).unbind("scroll.prettyphoto");r();settings.callback();doresize=true;f=false;delete settings})};if(!pp_alreadyInitialized&&t()){pp_alreadyInitialized=true;hashIndex=t();hashRel=hashIndex;hashIndex=hashIndex.substring(hashIndex.indexOf("/")+1,hashIndex.length-1);hashRel=hashRel.substring(0,hashRel.indexOf("/"));setTimeout(function(){e("a["+s.hook+"^='"+hashRel+"']:eq("+hashIndex+")").trigger("click")},50)}return this.unbind("click.prettyphoto").bind("click.prettyphoto",e.prettyPhoto.initialize)};})(jQuery);var pp_alreadyInitialized=false;
3485
3486
3487
3488/* ------------------------------------------------------------------------
3489مدیا فوتر
3490------------------------------------------------------------------------- */
3491!function(a,b,c,d){function e(b,c){this.settings=null,this.options=a.extend({},e.Defaults,c),this.$element=a(b),this.drag=a.extend({},m),this.state=a.extend({},n),this.e=a.extend({},o),this._plugins={},this._supress={},this._current=null,this._speed=null,this._coordinates=[],this._breakpoint=null,this._width=null,this._items=[],this._clones=[],this._mergers=[],this._invalidated={},this._pipe=[],a.each(e.Plugins,a.proxy(function(a,b){this._plugins[a[0].toLowerCase()+a.slice(1)]=new b(this)},this)),a.each(e.Pipe,a.proxy(function(b,c){this._pipe.push({filter:c.filter,run:a.proxy(c.run,this)})},this)),this.setup(),this.initialize()}function f(a){if(a.touches!==d)return{x:a.touches[0].pageX,y:a.touches[0].pageY};if(a.touches===d){if(a.pageX!==d)return{x:a.pageX,y:a.pageY};if(a.pageX===d)return{x:a.clientX,y:a.clientY}}}
3491function g(a){var b,d,e=c.createElement("div"),f=a;for(b in f)if(d=f[b],"undefined"!=typeof e.style[d])return e=null,[d,b];return[!1]}function h(){return g(["transition","WebkitTransition","MozTransition","OTransition"])[1]}function i(){return g(["transform","WebkitTransform","MozTransform","OTransform","msTransform"])[0]}function j(){return g(["perspective","webkitPerspective","MozPerspective","OPerspective","MsPerspective"])[0]}function k(){return"ontouchstart"in b||!!navigator.msMaxTouchPoints}function l(){return b.navigator.msPointerEnabled}var m,n,o;m={start:0,startX:0,startY:0,current:0,currentX:0,currentY:0,offsetX:0,offsetY:0,distance:null,startTime:0,endTime:0,updatedX:0,targetEl:null},n={isTouch:!1,isScrolling:!1,isSwiping:!1,direction:!1,inMotion:!1},o={_onDragStart:null,_onDragMove:null,_onDragEnd:null,_transitionEnd:null,_resizer:null,_responsiveCall:null,_goToLoop:null,_checkVisibile:null},e.Defaults={items:3,loop:!1,center:!1,mouseDrag:!0,touchDrag:!0,pullDrag:!0,freeDrag:!1,margin:0,stagePadding:0,merge:!1,mergeFit:!0,autoWidth:!1,startPosition:0,rtl:!1,smartSpeed:250,fluidSpeed:!1,dragEndSpeed:!1,responsive:{},responsiveRefreshRate:200,responsiveBaseElement:b,responsiveClass:!1,fallbackEasing:"swing",info:!1,nestedItemSelector:!1,itemElement:"div",stageElement:"div",themeClass:"owl-theme",baseClass:"owl-carousel",itemClass:"owl-item",centerClass:"center",activeClass:"active"},e.Width={Default:"default",Inner:"inner",Outer:"outer"},e.Plugins={},e.Pipe=[{filter:["width","items","settings"],run:function(a){a.current=this._items&&this._items[this.relative(this._current)]}},{filter:["items","settings"],run:function(){var a=this._clones,b=this.$stage.children(".cloned");(b.length!==a.length||!this.settings.loop&&a.length>0)&&(this.$stage.children(".cloned").remove(),this._clones=[])}},{filter:["items","settings"],run:function(){var a,b,c=this._clones,d=this._items,e=this.settings.loop?c.length-Math.max(2*this.settings.items,4):0;for(a=0,b=Math.abs(e/2);b>a;a++)e>0?(this.$stage.children().eq(d.length+c.length-1).remove(),c.pop(),this.$stage.children().eq(0).remove(),c.pop()):(c.push(c.length/2),this.$stage.append(d[c[c.length-1]].clone().addClass("cloned")),c.push(d.length-1-(c.length-1)/2),this.$stage.prepend(d[c[c.length-1]].clone().addClass("cloned")))}},{filter:["width","items","settings"],run:function(){var a,b,c,d=this.settings.rtl?1:-1,e=(this.width()/this.settings.items).toFixed(3),f=0;for(this._coordinates=[],b=0,c=this._clones.length+this._items.length;c>b;b++)a=this._mergers[this.relative(b)],a=this.settings.mergeFit&&Math.min(a,this.settings.items)||a,f+=(this.settings.autoWidth?this._items[this.relative(b)].width()+this.settings.margin:e*a)*d,this._coordinates.push(f)}},{filter:["width","items","settings"],run:function(){var b,c,d=(this.width()/this.settings.items).toFixed(3),e={width:Math.abs(this._coordinates[this._coordinates.length-1])+2*this.settings.stagePadding,"padding-left":this.settings.stagePadding||"","padding-right":this.settings.stagePadding||""};if(this.$stage.css(e),e={width:this.settings.autoWidth?"auto":d-this.settings.margin},e[this.settings.rtl?"margin-left":"margin-right"]=this.settings.margin,!this.settings.autoWidth&&a.grep(this._mergers,function(a){return a>1}).length>0)for(b=0,c=this._coordinates.length;c>b;b++)e.width=Math.abs(this._coordinates[b])-Math.abs(this._coordinates[b-1]||0)-this.settings.margin,this.$stage.children().eq(b).css(e);else this.$stage.children().css(e)}},{filter:["width","items","settings"],run:function(a){a.current&&this.reset(this.$stage.children().index(a.current))}},{filter:["position"],run:function(){this.animate(this.coordinates(this._current))}},{filter:["width","position","items","settings"],run:function(){var a,b,c,d,e=this.settings.rtl?1:-1,f=2*this.settings.stagePadding,g=this.coordinates(this.current())+f,h=g+this.width()*e,i=[];for(c=0,d=this._coordinates.length;d>c;c++)a=this._coordinates[c-1]||0,b=Math.abs(this._coordinates[c])+f*e,(this.op(a,"<=",g)&&this.op(a,">",h)||this.op(b,"<",g)&&this.op(b,">",h))&&i.push(c);this.$stage.children("."+this.settings.activeClass).removeClass(this.settings.activeClass),this.$stage.children(":eq("+i.join("), :eq(")+")").addClass(this.settings.activeClass),this.settings.center&&(this.$stage.children("."+this.settings.centerClass).removeClass(this.settings.centerClass),this.$stage.children().eq(this.current()).addClass(this.settings.centerClass))}}],e.prototype.initialize=function(){if(this.trigger("initialize"),this.$element.addClass(this.settings.baseClass).addClass(this.settings.themeClass).toggleClass("owl-rtl",this.settings.rtl),this.browserSupport(),this.settings.autoWidth&&this.state.imagesLoaded!==!0){var b,c,e;if(b=this.$element.find("img"),c=this.settings.nestedItemSelector?"."+this.settings.nestedItemSelector:d,e=this.$element.children(c).width(),b.length&&0>=e)return this.preloadAutoWidthImages(b),!1}this.$element.addClass("owl-loading"),this.$stage=a("<"+this.settings.stageElement+' class="owl-stage"/>').wrap('<div class="owl-stage-outer">'),this.$element.append(this.$stage.parent()),this.replace(this.$element.children().not(this.$stage.parent())),this._width=this.$element.width(),this.refresh(),this.$element.removeClass("owl-loading").addClass("owl-loaded"),this.eventsCall(),this.internalEvents(),this.addTriggerableEvents(),this.trigger("initialized")},e.prototype.setup=function(){var b=this.viewport(),c=this.options.responsive,d=-1,e=null;c?(a.each(c,function(a){b>=a&&a>
3491d&&(d=Number(a))}),e=a.extend({},this.options,c[d]),delete e.responsive,e.responsiveClass&&this.$element.attr("class",function(a,b){return b.replace(/\b owl-responsive-\S+/g,"")}).addClass("owl-responsive-"+d)):e=a.extend({},this.options),(null===this.settings||this._breakpoint!==d)&&(this.trigger("change",{property:{name:"settings",value:e}}),this._breakpoint=d,this.settings=e,this.invalidate("settings"),this.trigger("changed",{property:{name:"settings",value:this.settings}}))},e.prototype.optionsLogic=function(){this.$element.toggleClass("owl-center",this.settings.center),this.settings.loop&&this._items.length<this.settings.items&&(this.settings.loop=!1),this.settings.autoWidth&&(this.settings.stagePadding=!1,this.settings.merge=!1)},e.prototype.prepare=function(b){var c=this.trigger("prepare",{content:b});return c.data||(c.data=a("<"+this.settings.itemElement+"/>").addClass(this.settings.itemClass).append(b)),this.trigger("prepared",{content:c.data}),c.data},e.prototype.update=function(){for(var b=0,c=this._pipe.length,d=a.proxy(function(a){return this[a]},this._invalidated),e={};c>b;)(this._invalidated.all||a.grep(this._pipe[b].filter,d).length>0)&&this._pipe[b].run(e),b++;this._invalidated={}},e.prototype.width=function(a){switch(a=a||e.Width.Default){case e.Width.Inner:case e.Width.Outer:return this._width;default:return this._width-2*this.settings.stagePadding+this.settings.margin}},e.prototype.refresh=function(){if(0===this._items.length)return!1;(new Date).getTime();this.trigger("refresh"),this.setup(),this.optionsLogic(),this.$stage.addClass("owl-refresh"),this.update(),this.$stage.removeClass("owl-refresh"),this.state.orientation=b.orientation,this.watchVisibility(),this.trigger("refreshed")},e.prototype.eventsCall=function(){this.e._onDragStart=a.proxy(function(a){this.onDragStart(a)},this),this.e._onDragMove=a.proxy(function(a){this.onDragMove(a)},this),this.e._onDragEnd=a.proxy(function(a){this.onDragEnd(a)},this),this.e._onResize=a.proxy(function(a){this.onResize(a)},this),this.e._transitionEnd=a.proxy(function(a){this.transitionEnd(a)},this),this.e._preventClick=a.proxy(function(a){this.preventClick(a)},this)},e.prototype.onThrottledResize=function(){b.clearTimeout(this.resizeTimer),this.resizeTimer=b.setTimeout(this.e._onResize,this.settings.responsiveRefreshRate)},e.prototype.onResize=function(){return this._items.length?this._width===this.$element.width()?!1:this.trigger("resize").isDefaultPrevented()?!1:(this._width=this.$element.width(),this.invalidate("width"),this.refresh(),void this.trigger("resized")):!1},e.prototype.eventsRouter=function(a){var b=a.type;"mousedown"===b||"touchstart"===b?this.onDragStart(a):"mousemove"===b||"touchmove"===b?this.onDragMove(a):"mouseup"===b||"touchend"===b?this.onDragEnd(a):"touchcancel"===b&&this.onDragEnd(a)},e.prototype.internalEvents=function(){var c=(k(),l());this.settings.mouseDrag?(this.$stage.on("mousedown",a.proxy(function(a){this.eventsRouter(a)},this)),this.$stage.on("dragstart",function(){return!1}),this.$stage.get(0).onselectstart=function(){return!1}):this.$element.addClass("owl-text-select-on"),this.settings.touchDrag&&!c&&this.$stage.on("touchstart touchcancel",a.proxy(function(a){this.eventsRouter(a)},this)),this.transitionEndVendor&&this.on(this.$stage.get(0),this.transitionEndVendor,this.e._transitionEnd,!1),this.settings.responsive!==!1&&this.on(b,"resize",a.proxy(this.onThrottledResize,this))},e.prototype.onDragStart=function(d){var e,g,h,i;if(e=d.originalEvent||d||b.event,3===e.which||this.state.isTouch)return!1;if("mousedown"===e.type&&this.$stage.addClass("owl-grab"),this.trigger("drag"),this.drag.startTime=(new Date).getTime(),this.speed(0),this.state.isTouch=!0,this.state.isScrolling=!1,this.state.isSwiping=!1,this.drag.distance=0,g=f(e).x,h=f(e).y,this.drag.offsetX=this.$stage.position().left,this.drag.offsetY=this.$stage.position().top,this.settings.rtl&&(this.drag.offsetX=this.$stage.position().left+this.$stage.width()-this.width()+this.settings.margin),this.state.inMotion&&this.support3d)i=this.getTransformProperty(),this.drag.offsetX=i,this.animate(i),this.state.inMotion=!0;else if(this.state.inMotion&&!this.support3d)return this.state.inMotion=!1,!1;this.drag.startX=g-this.drag.offsetX,this.drag.startY=h-this.drag.offsetY,this.drag.start=g-this.drag.startX,this.drag.targetEl=e.target||e.srcElement,this.drag.updatedX=this.drag.start,("IMG"===this.drag.targetEl.tagName||"A"===this.drag.targetEl.tagName)&&(this.drag.targetEl.draggable=!1),a(c).on("mousemove.owl.dragEvents mouseup.owl.dragEvents touchmove.owl.dragEvents touchend.owl.dragEvents",a.proxy(function(a){this.eventsRouter(a)},this))},e.prototype.onDragMove=function(a){var c,e,g,h,i,j;this.state.isTouch&&(this.state.isScrolling||(c=a.originalEvent||a||b.event,e=f(c).x,g=f(c).y,this.drag.currentX=e-this.drag.startX,this.drag.currentY=g-this.drag.startY,this.drag.distance=this.drag.currentX-this.drag.offsetX,this.drag.distance<0?this.state.direction=this.settings.rtl?"right":"left":this.drag.distance>0&&(this.state.direction=this.settings.rtl?"left":"right"),this.settings.loop?this.op(this.drag.currentX,">",this.coordinates(this.minimum()))&&"right"===this.state.direction?this.drag.currentX-=(this.settings.center&&this.coordinates(0))-this.coordinates(this._items.length):this.op(this.drag.currentX,"<",this.coordinates(this.maximum()))&&"left"===this.state.direction&&(this.drag.currentX+=(this.settings.center&&this.coordinates(0))-this.coordinates(this._items.length)):(h=this.coordinates(this.settings.rtl?this.maximum():this.minimum()),i=this.coordinates(this.settings.rtl?this.minimum():this.maximum()),j=this.settings.pullDrag?this.drag.distance/5:0,this.drag.currentX=Math.max(Math.min(this.drag.currentX,h+j),i+j)),(this.drag.distance>8||this.drag.distance<-8)&&(c.preventDefault!==d?c.preventDefault():c.returnValue=!1,this.state.isSwiping=!0),this.drag.updatedX=this.drag.currentX,(this.drag.currentY>16||this.drag.currentY<-16)&&this.state.isSwiping===!1&&(this.state.isScrolling=!0,this.drag.updatedX=this.drag.start),this.animate(this.drag.updatedX)))},e.prototype.onDragEnd=function(b){var d,e,f;if(this.state.isTouch){if("mouseup"===b.type&&this.$stage.removeClass("owl-grab"),this.trigger("dragged"),this.drag.targetEl.removeAttribute("draggable"),this.state.isTouch=!1,this.state.isScrolling=!1,this.state.isSwiping=!1,0===this.drag.distance&&this.state.inMotion!==!0)return this.state.inMotion=!1,!1;this.drag.endTime=(new Date).getTime(),d=this.drag.endTime-this.drag.startTime,e=Math.abs(this.drag.distance),(e>3||d>300)&&this.removeClick(this.drag.targetEl),f=this.closest(this.drag.updatedX),this.speed(this.settings.dragEndSpeed||this.settings.smartSpeed),this.current(f),this.invalidate("position"),this.update(),this.settings.pullDrag||this.drag.updatedX!==this.coordinates(f)||this.transitionEnd(),this.drag.distance=0,a(c).off(".owl.dragEvents")}},e.prototype.removeClick=function(c){this.drag.targetEl=c,a(c).on("click.preventClick",this.e._preventClick),b.setTimeout(function(){a(c).off("click.preventClick")},300)},e.prototype.preventClick=function(b){b.preventDefault?b.preventDefault():b.returnValue=!1,b.stopPropagation&&b.stopPropagation(),a(b.target).off("click.preventClick")},e.prototype.getTransformProperty=function(){var a,c;return a=b.getComputedStyle(this.$stage.get(0),null).getPropertyValue(this.vendorName+"transform"),a=a.replace(/matrix(3d)?\(|\)/g,"").split(","),c=16===a.length,c!==!0?a[4]:a[12]},e.prototype.closest=function(b){var c=-1,d=30,e=this.width(),f=this.coordinates();return this.settings.freeDrag||a.each(f,a.proxy(function(a,g){return b>g-d&&g+d>b?c=a:this.op(b,"<",g)&&this.op(b,">",f[a+1]||g-e)&&(c="left"===this.state.direction?a+1:a),-1===c},this)),this.settings.loop||(this.op(b,">",f[this.minimum()])?c=b=this.minimum():this.op(b,"<",f[this.maximum()])&&(c=b=this.maximum())),c},e.prototype.animate=function(b){this.trigger("translate"),this.state.inMotion=this.speed()>0,this.support3d?this.$stage.css({transform:"translate3d("+b+"px,0px, 0px)",transition:this.speed()/1e3+"s"}):this.state.isTouch?this.$stage.css({left:b+"px"}):this.$stage.animate({left:b},this.speed()/1e3,this.settings.fallbackEasing,a.proxy(function(){this.state.inMotion&&this.transitionEnd()},this))}
3491,e.prototype.current=function(a){if(a===d)return this._current;if(0===this._items.length)return d;if(a=this.normalize(a),this._current!==a){var b=this.trigger("change",{property:{name:"position",value:a}});b.data!==d&&(a=this.normalize(b.data)),this._current=a,this.invalidate("position"),this.trigger("changed",{property:{name:"position",value:this._current}})}return this._current},e.prototype.invalidate=function(a){this._invalidated[a]=!0},e.prototype.reset=function(a){a=this.normalize(a),a!==d&&(this._speed=0,this._current=a,this.suppress(["translate","translated"]),this.animate(this.coordinates(a)),this.release(["translate","translated"]))},e.prototype.normalize=function(b,c){var e=c?this._items.length:this._items.length+this._clones.length;return!a.isNumeric(b)||1>e?d:b=this._clones.length?(b%e+e)%e:Math.max(this.minimum(c),Math.min(this.maximum(c),b))},e.prototype.relative=function(a){return a=this.normalize(a),a-=this._clones.length/2,this.normalize(a,!0)},e.prototype.maximum=function(a){var b,c,d,e=0,f=this.settings;if(a)return this._items.length-1;if(!f.loop&&f.center)b=this._items.length-1;else if(f.loop||f.center)if(f.loop||f.center)b=this._items.length+f.items;else{if(!f.autoWidth&&!f.merge)throw"Can not detect maximum absolute position.";for(revert=f.rtl?1:-1,c=this.$stage.width()-this.$element.width();(d=this.coordinates(e))&&!(d*revert>=c);)b=++e}else b=this._items.length-f.items;return b},e.prototype.minimum=function(a){return a?0:this._clones.length/2},e.prototype.items=function(a){return a===d?this._items.slice():(a=this.normalize(a,!0),this._items[a])},e.prototype.mergers=function(a){return a===d?this._mergers.slice():(a=this.normalize(a,!0),this._mergers[a])},e.prototype.clones=function(b){var c=this._clones.length/2,e=c+this._items.length,f=function(a){return a%2===0?e+a/2:c-(a+1)/2};return b===d?a.map(this._clones,function(a,b){return f(b)}):a.map(this._clones,function(a,c){return a===b?f(c):null})},e.prototype.speed=function(a){return a!==d&&(this._speed=a),this._speed},e.prototype.coordinates=function(b){var c=null;return b===d?a.map(this._coordinates,a.proxy(function(a,b){return this.coordinates(b)},this)):(this.settings.center?(c=this._coordinates[b],c+=(this.width()-c+(this._coordinates[b-1]||0))/2*(this.settings.rtl?-1:1)):c=this._coordinates[b-1]||0,c)},e.prototype.duration=function(a,b,c){return Math.min(Math.max(Math.abs(b-a),1),6)*Math.abs(c||this.settings.smartSpeed)},e.prototype.to=function(c,d){if(this.settings.loop){var e=c-this.relative(this.current()),f=this.current(),g=this.current(),h=this.current()+e,i=0>g-h?!0:!1,j=this._clones.length+this._items.length;h<this.settings.items&&i===!1?(f=g+this._items.length,this.reset(f)):h>=j-this.settings.items&&i===!0&&(f=g-this._items.length,this.reset(f)),b.clearTimeout(this.e._goToLoop),this.e._goToLoop=b.setTimeout(a.proxy(function(){this.speed(this.duration(this.current(),f+e,d)),this.current(f+e),this.update()},this),30)}else this.speed(this.duration(this.current(),c,d)),this.current(c),this.update()},e.prototype.next=function(a){a=a||!1,this.to(this.relative(this.current())+1,a)},e.prototype.prev=function(a){a=a||!1,this.to(this.relative(this.current())-1,a)},e.prototype.transitionEnd=function(a){return a!==d&&(a.stopPropagation(),(a.target||a.srcElement||a.originalTarget)!==this.$stage.get(0))?!1:(this.state.inMotion=!1,void this.trigger("translated"))},e.prototype.viewport=function(){var d;if(this.options.responsiveBaseElement!==b)d=a(this.options.responsiveBaseElement).width();else if(b.innerWidth)d=b.innerWidth;else{if(!c.documentElement||!c.documentElement.clientWidth)throw"Can not detect viewport width.";d=c.documentElement.clientWidth}return d},e.prototype.replace=function(b){this.$stage.empty(),this._items=[],b&&(b=b instanceof jQuery?b:a(b)),this.settings.nestedItemSelector&&(b=b.find("."+this.settings.nestedItemSelector)),b.filter(function(){return 1===this.nodeType}).each(a.proxy(function(a,b){b=this.prepare(b),this.$stage.append(b),this._items.push(b),this._mergers.push(1*b.find("[data-merge]").andSelf("[data-merge]").attr("data-merge")||1)},this)),this.reset(a.isNumeric(this.settings.startPosition)?this.settings.startPosition:0),this.invalidate("items")},e.prototype.add=function(a,b){b=b===d?this._items.length:this.normalize(b,!0),this.trigger("add",{content:a,position:b}),0===this._items.length||b===this._items.length?(this.$stage.append(a),this._items.push(a),this._mergers.push(1*a.find("[data-merge]").andSelf("[data-merge]").attr("data-merge")||1)):(this._items[b].before(a),this._items.splice(b,0,a),this._mergers.splice(b,0,1*a.find("[data-merge]").andSelf("[data-merge]").attr("data-merge")||1)),this.invalidate("items"),this.trigger("added",{content:a,position:b})},e.prototype.remove=function(a){a=this.normalize(a,!0),a!==d&&(this.trigger("remove",{content:this._items[a],position:a}),this._items[a].remove(),this._items.splice(a,1),this._mergers.splice(a,1),this.invalidate("items"),this.trigger("removed",{content:null,position:a}))},e.prototype.addTriggerableEvents=function(){var b=a.proxy(function(b,c){return a.proxy(function(a){a.relatedTarget!==this&&(this.suppress([c]),b.apply(this,[].slice.call(arguments,1
3491)),this.release([c]))},this)},this);a.each({next:this.next,prev:this.prev,to:this.to,destroy:this.destroy,refresh:this.refresh,replace:this.replace,add:this.add,remove:this.remove},a.proxy(function(a,c){this.$element.on(a+".owl.carousel",b(c,a+".owl.carousel"))},this))},e.prototype.watchVisibility=function(){function c(a){return a.offsetWidth>0&&a.offsetHeight>0}function d(){c(this.$element.get(0))&&(this.$element.removeClass("owl-hidden"),this.refresh(),b.clearInterval(this.e._checkVisibile))}c(this.$element.get(0))||(this.$element.addClass("owl-hidden"),b.clearInterval(this.e._checkVisibile),this.e._checkVisibile=b.setInterval(a.proxy(d,this),500))},e.prototype.preloadAutoWidthImages=function(b){var c,d,e,f;c=0,d=this,b.each(function(g,h){e=a(h),f=new Image,f.onload=function(){c++,e.attr("src",f.src),e.css("opacity",1),c>=b.length&&(d.state.imagesLoaded=!0,d.initialize())},f.src=e.attr("src")||e.attr("data-src")||e.attr("data-src-retina")})},e.prototype.destroy=function(){this.$element.hasClass(this.settings.themeClass)&&this.$element.removeClass(this.settings.themeClass),this.settings.responsive!==!1&&a(b).off("resize.owl.carousel"),this.transitionEndVendor&&this.off(this.$stage.get(0),this.transitionEndVendor,this.e._transitionEnd);for(var d in this._plugins)this._plugins[d].destroy();(this.settings.mouseDrag||this.settings.touchDrag)&&(this.$stage.off("mousedown touchstart touchcancel"),a(c).off(".owl.dragEvents"),this.$stage.get(0).onselectstart=function(){},this.$stage.off("dragstart",function(){return!1})),this.$element.off(".owl"),this.$stage.children(".cloned").remove(),this.e=null,this.$element.removeData("owlCarousel"),this.$stage.children().contents().unwrap(),this.$stage.children().unwrap(),this.$stage.unwrap()},e.prototype.op=function(a,b,c){var d=this.settings.rtl;switch(b){case"<":return d?a>c:c>a;case">":return d?c>a:a>c;case">=":return d?c>=a:a>=c;case"<=":return d?a>=c:c>=a}},e.prototype.on=function(a,b,c,d){a.addEventListener?a.addEventListener(b,c,d):a.attachEvent&&a.attachEvent("on"+b,c)},e.prototype.off=function(a,b,c,d){a.removeEventListener?a.removeEventListener(b,c,d):a.detachEvent&&a.detachEvent("on"+b,c)},e.prototype.trigger=function(b,c,d){var e={item:{count:this._items.length,index:this.current()}},f=a.camelCase(a.grep(["on",b,d],function(a){return a}).join("-").toLowerCase()),g=a.Event([b,"owl",d||"carousel"].join(".").toLowerCase(),a.extend({relatedTarget:this},e,c));return this._supress[b]||(a.each(this._plugins,function(a,b){b.onTrigger&&b.onTrigger(g)}),this.$element.trigger(g),this.settings&&"function"==typeof this.settings[f]&&this.settings[f].apply(this,g)),g},e.prototype.suppress=function(b){a.each(b,a.proxy(function(a,b){this._supress[b]=!0},this))},e.prototype.release=function(b){a.each(b,a.proxy(function(a,b){delete this._supress[b]},this))},e.prototype.browserSupport=function(){if(this.support3d=j(),this.support3d){this.transformVendor=i();var a=["transitionend","webkitTransitionEnd","transitionend","oTransitionEnd"];this.transitionEndVendor=a[h()],this.vendorName=this.transformVendor.replace(/Transform/i,""),this.vendorName=""!==this.vendorName?"-"+this.vendorName.toLowerCase()+"-":""}this.state.orientation=b.orientation},a.fn.owlCarousel=function(b){return this.each(function(){a(this).data("owlCarousel")||a(this).data("owlCarousel",new e(this,b))})},a.fn.owlCarousel.Constructor=e}(window.Zepto||window.jQuery,window,document),function(a,b){var c=function(b){this._core=b,this._loaded=[],this._handlers={"initialized.owl.carousel change.owl.carousel":a.proxy(function(b){if(b.namespace&&this._core.settings&&this._core.settings.lazyLoad&&(b.property&&"position"==b.property.name||"initialized"==b.type))for(var c=this._core.settings,d=c.center&&Math.ceil(c.items/2)||c.items,e=c.center&&-1*d||0,f=(b.property&&b.property.value||this._core.current())+e,g=this._core.clones().length,h=a.proxy(function(a,b){this.load(b)},this);e++<d;)this.load(g/2+this._core.relative(f)),g&&a.each(this._core.clones(this._core.relative(f++)),h)},this)},this._core.options=a.extend({},c.Defaults,this._core.options),this._core.$element.on(this._handlers)};c.Defaults={lazyLoad:!1},c.prototype.load=function(c){var d=this._core.$stage.children().eq(c),e=d&&d.find(".owl-lazy");!e||a.inArray(d.get(0),this._loaded)>-1||(e.each(a.proxy(function(c,d){var e,f=a(d),g=b.devicePixelRatio>1&&f.attr("data-src-retina")||f.attr("data-src");this._core.trigger("load",{element:f,url:g},"lazy"),f.is("img")?f.one("load.owl.lazy",a.proxy(function(){f.css("opacity",1),this._core.trigger("loaded",{element:f,url:g},"lazy")},this)).attr("src",g):(e=new Image,e.onload=a.proxy(function(){f.css({"background-image":"url("+g+")",opacity:"1"}),this._core.trigger("loaded",{element:f,url:g},"lazy")},this),e.src=g)},this)),this._loaded.push(d.get(0)))},c.prototype.destroy=function(){var a,b;for(a in this.handlers)this._core.$element.off(a,this.handlers[a]);for(b in Object.getOwnPropertyNames(this))"function"!=typeof this[b]&&(this[b]=null)},a.fn.owlCarousel.Constructor.Plugins.Lazy=c}(window.Zepto||window.jQuery,window,document),function(a){var b=function(c){this._core=c,this._handlers={"initialized.owl.carousel":
3491a.proxy(function(){this._core.settings.autoHeight&&this.update()},this),"changed.owl.carousel":a.proxy(function(a){this._core.settings.autoHeight&&"position"==a.property.name&&this.update()},this),"loaded.owl.lazy":a.proxy(function(a){this._core.settings.autoHeight&&a.element.closest("."+this._core.settings.itemClass)===this._core.$stage.children().eq(this._core.current())&&this.update()},this)},this._core.options=a.extend({},b.Defaults,this._core.options),this._core.$element.on(this._handlers)};b.Defaults={autoHeight:!1,autoHeightClass:"owl-height"},b.prototype.update=function(){this._core.$stage.parent().height(this._core.$stage.children().eq(this._core.current()).height()).addClass(this._core.settings.autoHeightClass)},b.prototype.destroy=function(){var a,b;for(a in this._handlers)this._core.$element.off(a,this._handlers[a]);for(b in Object.getOwnPropertyNames(this))"function"!=typeof this[b]&&(this[b]=null)},a.fn.owlCarousel.Constructor.Plugins.AutoHeight=b}(window.Zepto||window.jQuery,window,document),function(a,b,c){var d=function(b){this._core=b,this._videos={},this._playing=null,this._fullscreen=!1,this._handlers={"resize.owl.carousel":a.proxy(function(a){this._core.settings.video&&!this.isInFullScreen()&&a.preventDefault()},this),"refresh.owl.carousel changed.owl.carousel":a.proxy(function(){this._playing&&this.stop()},this),"prepared.owl.carousel":a.proxy(function(b){var c=a(b.content).find(".owl-video");c.length&&(c.css("display","none"),this.fetch(c,a(b.content)))},this)},this._core.options=a.extend({},d.Defaults,this._core.options),this._core.$element.on(this._handlers),this._core.$element.on("click.owl.video",".owl-video-play-icon",a.proxy(function(a){this.play(a)},this))};d.Defaults={video:!1,videoHeight:!1,videoWidth:!1},d.prototype.fetch=function(a,b){var c=a.attr("data-vimeo-id")?"vimeo":"youtube",d=a.attr("data-vimeo-id")||a.attr("data-youtube-id"),e=a.attr("data-width")||this._core.settings.videoWidth,f=a.attr("data-height")||this._core.settings.videoHeight,g=a.attr("href");if(!g)throw new Error("Missing video URL.");if(d=g.match(/(http:|https:|)\/\/(player.|www.)?(vimeo\.com|youtu(be\.com|\.be|be\.googleapis\.com))\/(video\/|embed\/|watch\?v=|v\/)?([A-Za-z0-9._%-]*)(\&\S+)?/),d[3].indexOf("youtu")>-1)c="youtube";else{if(!(d[3].indexOf("vimeo")>-1))throw new Error("Video URL not supported.");c="vimeo"}d=d[6],this._videos[g]={type:c,id:d,width:e,height:f},b.attr("data-video",g),this.thumbnail(a,this._videos[g])},d.prototype.thumbnail=function(b,c){var d,e,f,g=c.width&&c.height?'style="width:'+c.width+"px;height:"+c.height+'px;"':"",h=b.find("img"),i="src",j="",k=this._core.settings,l=function(a){e='<div class="owl-video-play-icon"></div>',d=k.lazyLoad?'<div class="owl-video-tn '+j+'" '+i+'="'+a+'"></div>':'<div class="owl-video-tn" style="opacity:1;background-image:url('+a+')"></div>',b.after(d),b.after(e)};return b.wrap('<div class="owl-video-wrapper"'+g+"></div>"),this._core.settings.lazyLoad&&(i="data-src",j="owl-lazy"),h.length?(l(h.attr(i)),h.remove(),!1):void("youtube"===c.type?(f="http://img.youtube.com/vi/"+c.id+"/hqdefault.jpg",l(f)):"vimeo"===c.type&&a.ajax({type:"GET",url:"http://vimeo.com/api/v2/video/"+c.id+".json",jsonp:"callback",dataType:"jsonp",success:function(a){f=a[0].thumbnail_large,l(f)}}))},d.prototype.stop=function(){this._core.trigger("stop",null,"video"),this._playing.find(".owl-video-frame").remove(),this._playing.removeClass("owl-video-playing"),this._playing=null},d.prototype.play=function(b){this._core.trigger("play",null,"video"),this._playing&&this.stop();var c,d,e=a(b.target||b.srcElement),f=e.closest("."+this._core.settings.itemClass),g=this._videos[f.attr("data-video")],h=g.width||"100%",i=g.height||this._core.$stage.height();"youtube"===g.type?c='<iframe width="'+h+'" height="'+i+'" src="http://www.youtube.com/embed/'+g.id+"?autoplay=1&v="+g.id+'" frameborder="0" allowfullscreen></iframe>':"vimeo"===g.type&&(c='<iframe src="http://player.vimeo.com/video/'+g.id+'?autoplay=1" width="'+h+'" height="'+i+'" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>'),f.addClass("owl-video-playing"),this._playing=f,d=a('<div style="height:'+i+"px; width:"+h+'px" class="owl-video-frame">'+c+"</div>"),e.after(d)},d.prototype.isInFullScreen=function(){var d=c.fullscreenElement||c.mozFullScreenElement||c.webkitFullscreenElement;return d&&a(d).parent().hasClass("owl-video-frame")&&(this._core.speed(0),this._fullscreen=!0),d&&this._fullscreen&&this._playing?!1:this._fullscreen?(this._fullscreen=!1,!1):this._playing&&this._core.state.orientation!==b.orientation?(this._core.state.orientation=b.orientation,!1):!0},d.prototype.destroy=function(){var a,b;this._core.$element.off("click.owl.video");for(a in this._handlers)this._core.$element.off(a,this._handlers[a]);for(b in Object.getOwnPropertyNames(this))"function"!=typeof this[b]&&(this[b]=null)},a.fn.owlCarousel.Constructor.Plugins.Video=d}(window.Zepto||window.jQuery,window,document),function(a,b,c,d){var e=function(b){this.core=b,this.core.options=a.extend({},e.Defaults,this.core.options),this.swapping=!0,this.previous=d,this.next=d,this.handlers={"change.owl.carousel":
3491a.proxy(function(a){"position"==a.property.name&&(this.previous=this.core.current(),this.next=a.property.value)},this),"drag.owl.carousel dragged.owl.carousel translated.owl.carousel":a.proxy(function(a){this.swapping="translated"==a.type},this),"translate.owl.carousel":a.proxy(function(){this.swapping&&(this.core.options.animateOut||this.core.options.animateIn)&&this.swap()},this)},this.core.$element.on(this.handlers)};e.Defaults={animateOut:!1,animateIn:!1},e.prototype.swap=function(){if(1===this.core.settings.items&&this.core.support3d){this.core.speed(0);var b,c=a.proxy(this.clear,this),d=this.core.$stage.children().eq(this.previous),e=this.core.$stage.children().eq(this.next),f=this.core.settings.animateIn,g=this.core.settings.animateOut;this.core.current()!==this.previous&&(g&&(b=this.core.coordinates(this.previous)-this.core.coordinates(this.next),d.css({left:b+"px"}).addClass("animated owl-animated-out").addClass(g).one("webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend",c)),f&&e.addClass("animated owl-animated-in").addClass(f).one("webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend",c))}},e.prototype.clear=function(b){a(b.target).css({left:""}).removeClass("animated owl-animated-out owl-animated-in").removeClass(this.core.settings.animateIn).removeClass(this.core.settings.animateOut),this.core.transitionEnd()},e.prototype.destroy=function(){var a,b;for(a in this.handlers)this.core.$element.off(a,this.handlers[a]);for(b in Object.getOwnPropertyNames(this))"function"!=typeof this[b]&&(this[b]=null)},a.fn.owlCarousel.Constructor.Plugins.Animate=e}(window.Zepto||window.jQuery,window,document),function(a,b,c){var d=function(b){this.core=b,this.core.options=a.extend({},d.Defaults,this.core.options),this.handlers={"translated.owl.carousel refreshed.owl.carousel":a.proxy(function(){this.autoplay()
3492},this),"play.owl.autoplay":a.proxy(function(a,b,c){this.play(b,c)},this),"stop.owl.autoplay":a.proxy(function(){this.stop()},this),"mouseover.owl.autoplay":a.proxy(function(){this.core.settings.autoplayHoverPause&&this.pause()},this),"mouseleave.owl.autoplay":a.proxy(function(){this.core.settings.autoplayHoverPause&&this.autoplay()},this)},this.core.$element.on(this.handlers)};d.Defaults={autoplay:!1,autoplayTimeout:5e3,autoplayHoverPause:!1,autoplaySpeed:!1},d.prototype.autoplay=function(){this.core.settings.autoplay&&!this.core.state.videoPlay?(b.clearInterval(this.interval),this.interval=b.setInterval(a.proxy(function(){this.play()},this),this.core.settings.autoplayTimeout)):b.clearInterval(this.interval)},d.prototype.play=function(){return c.hidden===!0||this.core.state.isTouch||this.core.state.isScrolling||this.core.state.isSwiping||this.core.state.inMotion?void 0:this.core.settings.autoplay===!1?void b.clearInterval(this.interval):void this.core.next(this.core.settings.autoplaySpeed)},d.prototype.stop=function(){b.clearInterval(this.interval)},d.prototype.pause=function(){b.clearInterval(this.interval)},d.prototype.destroy=function(){var a,c;b.clearInterval(this.interval);for(a in this.handlers)this.core.$element.off(a,this.handlers[a]);for(c in Object.getOwnPropertyNames(this))"function"!=typeof this[c]&&(this[c]=null)},a.fn.owlCarousel.Constructor.Plugins.autoplay=d}(window.Zepto||window.jQuery,window,document),function(a){"use strict";var b=function(c){this._core=c,this._initialized=!1,this._pages=[],this._controls={},this._templates=[],this.$element=this._core.$element,this._overrides={next:this._core.next,prev:this._core.prev,to:this._core.to},this._handlers={"prepared.owl.carousel":a.proxy(function(b){this._core.settings.dotsData&&this._templates.push(a(b.content).find("[data-dot]").andSelf("[data-dot]").attr("data-dot"))},this),"add.owl.carousel":a.proxy(function(b){this._core.settings.dotsData&&this._templates.splice(b.position,0,a(b.content).find("[data-dot]").andSelf("[data-dot]").attr("data-dot"))},this),"remove.owl.carousel prepared.owl.carousel":a.proxy(function(a){this._core.settings.dotsData&&this._templates.splice(a.position,1)}
3492,this),"change.owl.carousel":a.proxy(function(a){if("position"==a.property.name&&!this._core.state.revert&&!this._core.settings.loop&&this._core.settings.navRewind){var b=this._core.current(),c=this._core.maximum(),d=this._core.minimum();a.data=a.property.value>c?b>=c?d:c:a.property.value<d?c:a.property.value}},this),"changed.owl.carousel":a.proxy(function(a){"position"==a.property.name&&this.draw()},this),"refreshed.owl.carousel":a.proxy(function(){this._initialized||(this.initialize(),this._initialized=!0),this._core.trigger("refresh",null,"navigation"),this.update(),this.draw(),this._core.trigger("refreshed",null,"navigation")},this)},this._core.options=a.extend({},b.Defaults,this._core.options),this.$element.on(this._handlers)};b.Defaults={nav:!1,navRewind:!0,navText:["prev","next"],navSpeed:!1,navElement:"div",navContainer:!1,navContainerClass:"owl-nav",navClass:["owl-prev","owl-next"],slideBy:1,dotClass:"owl-dot",dotsClass:"owl-dots",dots:!0,dotsEach:!1,dotData:!1,dotsSpeed:!1,dotsContainer:!1,controlsClass:"owl-control
3492s"},b.prototype.initialize=function(){var b,c,d=this._core.settings;d.dotsData||(this._templates=[a("<div>").addClass(d.dotClass).append(a("<span>")).prop("outerHTML")]),d.navContainer&&d.dotsContainer||(this._controls.$container=a("<div>").addClass(d.controlsClass).appendTo(this.$element)),this._controls.$indicators=d.dotsContainer?a(d.dotsContainer):a("<div>").hide().addClass(d.dotsClass).appendTo(this._controls.$container),this._controls.$indicators.on("click","div",a.proxy(function(b){var c=a(b.target).parent().is(this._controls.$indicators)?a(b.target).index():a(b.target).parent().index();b.preventDefault(),this.to(c,d.dotsSpeed)},this)),b=d.navContainer?a(d.navContainer):a("<div>").addClass(d.navContainerClass).prependTo(this._controls.$container),this._controls.$next=a("<"+d.navElement+">"),this._controls.$previous=this._controls.$next.clone(),this._controls.$previous.addClass(d.navClass[0]).html(d.navText[0]).hide().prependTo(b).on("click",a.proxy(function(){this.prev(d.navSpeed)},this)),this._controls.$next.addClass(d.navClass[1]).html(d.navText[1]).hide().appendTo(b).on("click",a.proxy(function(){this.next(d.navSpeed)},this));for(c in this._overrides)this._core[c]=a.proxy(this[c],this)},b.prototype.destroy=function(){var a,b,c,d;for(a in this._handlers)this.$element.off(a,this._handlers[a]);for(b in this._controls)this._controls[b].remove();for(d in this.overides)this._core[d]=this._overrides[d];for(c in Object.getOwnPropertyNames(this))"function"!=typeof this[c]&&(this[c]=null)},b.prototype.update=function(){var a,b,c,d=this._core.settings,e=this._core.clones().length/2,f=e+this._core.items().length,g=d.center||d.autoWidth||d.dotData?1:d.dotsEach||d.items;if("page"!==d.slideBy&&(d.slideBy=Math.min(d.slideBy,d.items)),d.dots||"page"==d.slideBy)for(this._pages=[],a=e,b=0,c=0;f>a;a++)(b>=g||0===b)&&(this._pages.push({start:a-e,end:a-e+g-1}),b=0,++c),b+=this._core.mergers(this._core.relative(a))},b.prototype.draw=function(){var b,c,d="",e=this._core.settings,f=(this._core.$stage.children(),this._core.relative(this._core.current()));if(!e.nav||e.loop||e.navRewind||(this._controls.$previous.toggleClass("disabled",0>=f),this._controls.$next.toggleClass("disabled",f>=this._core.maximum())),this._controls.$previous.toggle(e.nav),this._controls.$next.toggle(e.nav),e.dots){if(b=this._pages.length-this._controls.$indicators.children().length,e.dotData&&0!==b){for(c=0;c<this._controls.$indicators.children().length;c++)d+=this._templates[this._core.relative(c)];this._controls.$indicators.html(d)}else b>0?(d=new Array(b+1).join(this._templates[0]),this._controls.$indicators.append(d)):0>b&&this._controls.$indicators.children().slice(b).remove();this._controls.$indicators.find(".active").removeClass("active"),this._controls.$indicators.children().eq(a.inArray(this.current(),this._pages)).addClass("active")}this._controls.$indicators.toggle(e.dots)},b.prototype.onTrigger=function(b){var c=this._core.settings;b.page={index:a.inArray(this.current(),this._pages),count:this._pages.length,size:c&&(c.center||c.autoWidth||c.dotData?1:c.dotsEach||c.items)}},b.prototype.current=function(){var b=this._core.relative(this._core.current());return a.grep(this._pages,function(a){return a.start<=b&&a.end>=b}).pop()},b.prototype.getPosition=function(b){var c,d,e=this._core.settings;return"page"==e.slideBy?(c=a.inArray(this.current(),this._pages),d=this._pages.length,b?++c:--c,c=this._pages[(c%d+d)%d].start):(c=this._core.relative(this._core.current()),d=this._core.items().length,b?c+=e.slideBy:c-=e.slideBy),c},b.prototype.next=function(b){a.proxy(this._overrides.to,this._core)(this.getPosition(!0),b)},b.prototype.prev=function(b){a.proxy(this._overrides.to,this._core)(this.getPosition(!1),b)},b.prototype.to=function(b,c,d){var e;d?a.proxy(this._overrides.to,this._core)(b,c):(e=this._pages.length,a.proxy(this._overrides.to,this._core)(this._pages[(b%e+e)%e].start,c))},a.fn.owlCarousel.Constructor.Plugins.Navigation=b}(window.Zepto||window.jQuery,window,document),function(a,b){"use strict";var c=function(d){this._core=d,this._hashes={},this.$element=this._core.$element,this._handlers={"initialized.owl.carousel":
3492a.proxy(function(){"URLHash"==this._core.settings.startPosition&&a(b).trigger("hashchange.owl.navigation")},this),"prepared.owl.carousel":a.proxy(function(b){var c=a(b.content).find("[data-hash]").andSelf("[data-hash]").attr("data-hash");this._hashes[c]=b.content},this)},this._core.options=a.extend({},c.Defaults,this._core.options),this.$element.on(this._handlers),a(b).on("hashchange.owl.navigation",a.proxy(function(){var a=b.location.hash.substring(1),c=this._core.$stage.children(),d=this._hashes[a]&&c.index(this._hashes[a])||0;return a?void this._core.to(d,!1,!0):!1},this))};c.Defaults={URLhashListener:!1},c.prototype.destroy=function(){var c,d;a(b).off("hashchange.owl.navigation");for(c in this._handlers)this._core.$element.off(c,this._handlers[c]);for(d in Object.getOwnPropertyNames(this))"function"!=typeof this[d]&&(this[d]=null)},a.fn.owlCarousel.Constructor.Plugins.Hash=c}(window.Zepto||window.jQuery,window,document);
3493
3494/* ------------------------------------------------------------------------
3495مدیا فوتر
3496------------------------------------------------------------------------- */
3497function handleHasPages(){$(".has-pages").each(function(){var t=$(this),e=t.attr("data-conf"),a=void 0!==e?JSON.parse(e):{},n=$.extend({items:3},a);for(n.pages=t.find("ul li").length/parseInt(n.items),t.find("header .pagination").length||t.find("header").append('<div class="pagination"></div>'),i=0;i<n.pages;i++){active=0===i?' class="active"':"";var s="<div"+active+' data-start="'+i*n.items+'" data-end="'+(i*n.items+n.items-1)+'">'+(i+1)+"</div>";t.find("header .pagination").append(s)}var o=t.find("ul li"),r=0;o.each(function(t){t>=n.items?$(this).hide():r+=$(this).outerHeight(!0)}),t.find("> div").height(r),t.on("click",".pagination div:not(.active)",function(){var e=$
3497(this),a={start:e.attr("data-start"),end:e.attr("data-end")};t.find(".pagination div").removeClass("active"),e.addClass("active"),o.fadeOut(700,function(){}),$.each(o,function(){$(this).index()>=a.start&&$(this).index()<=a.end&&$(this).fadeIn(700)})});window.setInterval(function(){(t.find(".pagination div.active").index()+1===t.find(".pagination div").length?t.find(".pagination div:first"):t.find(".pagination div.active").next()).trigger("click")},7e3)})}function getUrlParameter(t,e){e||(e=window.location.href),t=t.replace(/[\[\]]/g,"\\$&");var a=new RegExp("[?&]"+t+"(=([^&#]*)|&|#|$)").exec(e);return a?a[2]?decodeURIComponent(a[2].replace(/\+/g," ")):"":null}function addTab(t,e){t.addClass("no-header tab-pane fade").attr("role","tabpanel");var a={title:t.find("header h2").text(),id:t.attr("id"),content:t},i=e;i.find("ul.nav").append('<li role="presentation"><a href="#'+a.id+'" role="tab" data-toggle="tab">'+a.title+"</a></li>"),i.find(".tab-content").append(a.content)}function addJoin(t,e,a,i){a&&t.addClass("col-sm-"+a),i&&e.addClass(i),e.find("> div").append(t)}function responsive_resize(){var t=$(window).width();t<768?$("body").addClass("_xs").removeClass("_sm _md _lg"):t>767&&t<992?$("body").addClass("_sm").removeClass("_xs _md _lg"):t>991&&t<1200?$("body").addClass("_md").removeClass("_xs _sm _lg"):t>1199&&$("body").addClass("_lg").removeClass("_xs _sm _md")}function appDownloadLink(t,e,a,i){return $(".box.downloads > div").append('<a href="'+t+'" class="button-dl-app"><i class="'+e+'"></i><div class="button-dl-text"><span>'+a+"</span><small>"+i+"</small></div></a>")}function randomIntFromInterval(t,e){return Math.floor(Math.random()*(e-t+1)+t)}function Comments(){this.initCommentForm=function(){$(".form-comment").each(function(t){console.log("form-comment: "+t);
3497var e=$(this),a=e.find(".comment-msg");e.on("submit",function(i){console.log("onsubmit: "+t),i.preventDefault();var n=[],s=e.find("input, textarea");return $.each(s,function(){var t=$(this);t.is("[required]")&&(void 0!==t.val()&&""!==t.val()||n.push(t.attr("name")))}),n.length>0?(alert("e"),a.html(e.attr("data-error")).removeClass("alert-danger").addClass("alert-success"),a.slideDown()):(alert("s"),$.ajax({url:e.attr("data-url"),type:e.attr("method"),data:e.serialize(),success:function(){a.html(e.attr("data-success")).removeClass("alert-success").addClass("alert-danger"),a.slideDown()}})),e.find("input, textarea").on("focusin",function(){a.is(":hidden")&&a.slideUp(),a.html("").removeClass("alert-success").removeClass("alert-danger")}),!1})})},this.initGoToCommentForm=function(){$(".insert-comment").click(function(){if(location.pathname.replace(/^\//,"")===this.pathname.replace(/^\//,"")&&location.hostname===this.hostname){var t=$(this.hash);if((t=t.length?t:$("[name="+this.hash.slice(1)+"]")).length)return $("html,body").animate({scrollTop:t.offset().top},1e3),!1}})},this.showDisclaimer=function(){$(".top-comment textarea,.top-comment input").click(function(){$(".hints").slideDown()})};!function(t){$(".form-comment").length&&(t.showDisclaimer(),t.initCommentForm(
3497),t.initGoToCommentForm())}(this)}function Item(){this.initTools=function(){function t(t){var e=$(".content-full-news"),a=parseInt(e.css("font-size"));"increase"===t?a+=1:"decrease"===t?a-=1:a=15,e.css("font-size",a)}$("#increase").click(function(){t("increase")}),$("#decrease").click(function(){t("decrease")}),$("#reset").click(function(){t("reset")})};!function(t){t.initTools()}(this)}function makeArchHref(){var t="/archive?pi=1";$("#topic").val()>0&&(t+="&tp="+$("#topic").val()),$("#newsType").val()>0&&(t+="&ty="+$("#newsType").val()),$("#place").val()>0&&(t+="&pl="+$("#place").val()),$("#keyword").val()&&(t+="&kw="+$("#keyword").val()),""!=$("#all").val()&&(t+="&all="+$("#all").val()),""!=$("#ni").val()&&(t+="&ni="+$("#ni").val()),""!=$("#nl").val()&&(t+="&nl="+$("#nl").val()),""!=$("#mosaic").val()&&(t+="&ms="+$("#mosaic").val()),""!=$("#ps").val()&&(t+="&ps="+$("#ps").val()),$("#toDay").val()>0&&(t+="&dy="+$("#toDay").val()),$("#toMonth").val()>0&&(t+="&mn="+$("#toMonth").val()),$("#toYear").val()>0&&(t+="&yr="+$("#toYear").val()),$("#doFindNews").attr("href",t)}var spinner='<i class="icon-spinner icon-spin"/>',uuid=0,debug=!1;
3497$(document).ready(function(){function t(){!0===i?(a.hide(),e.removeClass("is-open"),e.addClass("is-closed"),i=!1):(a.show(),e.removeClass("is-closed"),e.addClass("is-open"),i=!0)}$.cookie=function(t,e,a){if(arguments.length<2){for(var i=document.cookie.split(";"),n=0;n<i.length;n++){var s=i[n].replace(/^\s+/,"");if(0==s.indexOf(t+"="))return decodeURIComponent(s.substring(t.length+1).split("+").join(" "))}return null}var o=new Date;o.setTime(o.getTime()+a),document.cookie=t+"="+encodeURIComponent(e)+(a?";expires="+o.toGMTString():"")+";path=/"},$(".floating-ad").length&&($.each($(".floating-ad"),function(){var t=$(this),e=t.attr("id");window.setTimeout(function(){"hidden"!==$.parseJSON($.cookie("floating-ad_"+e))&&(console.log($.parseJSON($.cookie("floating-ad_"+e))),t.fadeIn("fast"))},300)}),$(".floating-ad").click(function(t){$(this).attr("id");t.target===this&&$(".floating-ad").fadeOut("fast",function(){})})),$(".fixed-ad").length&&($.each($(".fixed-ad"),function(){var t=$(this),e=t.attr("id");window.setTimeout(function(){"hidden"!==$.parseJSON($.cookie("fixed-ad_"+e))&&t.fadeIn("fast")},300)}),$(".fixed-ad").click(function(t){$(this).attr("id");t.target===this&&$(".fixed-ad").fadeOut("fast",function(){})})),$('[data-toggle="tooltip"]').tooltip(),$("li[data-id=15]>a").click(function(){return $("#linksWrapper").stop().slideToggle(),!1}),$("#close-links").click(function(){return $("#linksWrapper").stop().slideUp(),!1}),$(".close-breaking").click(function(){$("#breaking").fadeOut()}),$(".custom-search").length&&void 0!==$.fn.pDatepicker&&$(".custom-search input").pDatepicker({format:"YYYY/MM/DD",onSelect:function(){$(".custom-search").append('<input type="hidden" name="a" value="1"><input type="hidden" name="dr" value="custom">'),$(".custom-search input").pDatepicker("hide")}});var e=$(".hamburger"),a=$(".overlay"),i=!1;e.click(function(){t()}),$(".sidebar-toggle").click(function(){$("body").toggleClass("toggled")}),$(".overlay").click(function(){!0===i?(a.hide(),e.removeClass("is-open"),e.addClass("is-closed"),i=!1):(a.show(),e.removeClass("is-closed"),e.addClass("is-open"),i=!0),$("body").toggleClass("toggled")})}),$(window).load(function(){handleHasPages()}),$(function(){function t(t){var e=t.find("ul li").not(":visible"),a=0;$.each(e,function(){var t=JSON.parse($(this).attr("data-conf"));$(this).attr("data-from",a).attr("data-to",t.chance+a-1),a+=t.chance});var i=randomIntFromInterval(0,e.last().attr("data-to"));$.each(e,function(){i>=$(this).attr("data-from")&&i<=$(this).attr("data-to")&&$(this).show(1)})}$(".box.top").length&&$(".box.top").each(function(){var t=$(this).find("ul:first");t.find("> li").length<2||$(this).hasClass("no-indicators")||(controlSection='<div class="control-section"><ol class="carousel-indicators"></ol>',$(this).hasClass("no-arrows")||(controlSection+='<a class="slider-button prev-button" href="#" data-slide="prev"><i class="fa fa-angle-up"></i></a><a class="slider-button next-button" href="#" data-slide="next"><i class="fa fa-angle-down"></i></a>'),controlSection+="</div>",t.parent().append(controlSection),$.each(t.find("> li"),function(e){var a='<li data-slide-to="{index}" class="{type}{active}"><span>{title}{time}</span></li>'.replace(/{index}/,e.toString()).replace(/{type}/,$(this).attr("class")).replace(/{active}/,0==e?" active":"").replace(/{title}/,$(this).find("h3:first").text()).replace(/{time}/,$(this).find("time").length?"<time>"+$(this).find("time").html()+"</time>":"");t.parent().find(".carousel-indicators").append(a)}))}),$("form.has-selected").each(function(){$(this).find("select").each(function(){$(this).find("option").filter("[data-selected=selected]").attr("selected","selected"),$(this).find("option").filter("[data-disabled=disabled]").attr("disabled","disabled")})}),$("[data-toggle]").each(function(){var t=void 0!==$(this).attr("href")?$(this).attr("href"):$(this).attr("data-target");$(this).on("click",function(e){switch($(this).attr("data-toggle")){case"scroll":$("html, body").animate({scrollTop:$(t).offset().top},"slow");break;case"toggle":$(t).is(":visible")?$(t).fadeOut("fast"):$(t).fadeIn("fast"),void 0!==$(this).attr("data-focus")&&$($(this).attr("data-focus")).focus()}var a=$(this).attr("data-oncomplete");a&&window[a]&&window[a](this),e.preventDefault()})}),$(".ads-random").length&&$.each($(".ads-random"),function(){if(void 0!==$(this).attr("data-conf"))for(var e=JSON.parse($(this).attr("data-conf")),a=0;a<e.items;a++)t($(this))});
3497var e=$(".box time,.box .visits,.box .comments");if(e.length&&e.each(function(){var t=$(this).find("a");!t.find("span").length&&t.html()&&t.html(t.html().replace(/^([\S]+)/,"<span>$1</span>"))}),$(".box.social").length){var a=$(".box.social");$.trim(a.find("> div").html()).length||a.find("> div").html('<ul><li><a href="https://twitter.com/isna_farsi" class="twitter"><span class="social-icon"><i class="fa fa-twitter"></i></span></a></li><li><a href="https://i.instagram.com/isna.news" class="instagram"><span class="social-icon"><i class="fa fa-instagram"></i></span></a></li><li><a href="https://telegram.me/isna94" class="facebook"><span class="social-icon"><i class="fa fa-paper-plane"></i></span></a></li></ul>')}$(".box.has-tabs").length&&($(".box.has-tabs").each(function(){var t=$(this).attr("data-conf"),e=void 0!==t?JSON.parse(t):{};$("#"+e.tabGroup).length||$(this).before('<section class="tabs-container box" id="'+e.tabGroup+'"><ul class="nav nav-tabs" role="tablist"></ul><div class="tab-content"></div></section>'),addTab($(this),$("#"+e.tabGroup))}),$(".tabs-container.box").each(function(){$(this).find("ul.nav li:first").addClass("active"),$(this).find(".tab-content > *:first").addClass("active in")})),$(".box.has-more").length&&$(".box.has-more").each(function(){var t=$(this).find("> header").find("h2"),e=$(this).hasClass("has-more-default")?"بیشتر":t.text(),a='<a class="more" href="'+t.find("a").attr("href")+'">'+e+"</a>";$(this).hasClass("has-more-bottom")?$(this).find("footer").length?$(this).find("footer").append(a):$(this).append("<footer>"+a+"</footer>"):t.parents("header:first").append(a)}),$(".box.has-join").length&&$(".box.has-join").each(function(){var t=CarouselHelper.getConfig($(this));if(!$("#"+t.tabGroup).length){var e=$(this).find("header h2");$(this).before('<section class="join-container box" id="'+t.tabGroup+'"><header><h2><a href="'+e.find("a").attr("href")+'">'+e.text()+"</a></h2></header><div></div></section>")}var a=void 0!==t.cols&&t.cols?t.cols:null,i=void 0!==t.cssClass&&t.cssClass?t.cssClass:null;addJoin($(this),$("#"+t.tabGroup),a,i)});var i={items:1,auto:!1,fx:"fade",controls:!1,paging:!1,pagingHeader:!0,autoHeight:!1,ltr:!1};$(".has-carousel").each(function(){var t=$(this),e=CarouselHelper.getConfig(t),a=jQuery.extend({},i),n=$.extend(a,e);n.ltr=$("body.ltr").length,n.center=t.hasClass("full-width")||t.hasClass("centered"),n.paging&&(t.find(".pagination").length||(n.pagingHeader?t.find(".box-title").append('<div class="pagination"></div>'):t.find(".box-content").append('<div class="pagination"></div>')));var s=t.find(".pagination"),o=t.find("> div ul:first");if(!(o.find("> li").length<2)){1===n.items&&CarouselHelper.setDimensions(o),o.on("initialized.owl.carousel",function(){$(".carousel-indicators li:first").addClass("active"),n.paging&&s.find("div").each(function(t){$(this).text(t+1)}),$(".carousel-indicators li").click(function(t){$(this).parent().find("li").removeClass("active");var e=$(this).attr("data-slide-to");o.trigger("to.owl.carousel",[parseInt(e),500,!0]),$(this).addClass("active"),t.preventDefault()})}).on("changed.owl.carousel",function(t){var e=t.item.index-2===$(".carousel-indicators li").length?0:t.item.index-2;$(".carousel-indicators li").removeClass("active"),$(".carousel-indicators li[data-slide-to="+e+"]").addClass("active")});var r={left:t.hasClass("albums")?"&#xf104":"&#xf053",right:t.hasClass("albums")?"&#xf105":"&#xf054"};o.owlCarousel({loop:!0,rtl:!n.ltr,margin:n.items>1?10:0,startPosition:0,stagePadding:0,responsive:{},center:n.center,autoHeight:n.autoHeight,autoWidth:1===n.items,items:"variable"===n.items?3:n.items,singleItem:1===n.items,autoplay:!1!==n.auto,autoplayTimeout:!1!==n.auto&&n.auto,animateOut:"fade"===n.fx?n.fx+"Out":n.fx,animateIn:"fade"===n.fx?n.fx+"In":n.fx,dots:n.paging,dotsContainer:s,dotsClass:"",dotClass:"",paginationNumbers:!0,nav:n.controls,navText:[r.left,r.right]}),(n.controls||t.find(".slider-button").length)&&(t.find(".next-button").click(function(t){o.trigger("next"),t.preventDefault()}),t.find(".prev-button").click(function(t){o.trigger("prev"),t.preventDefault()}))}}),$(".box.has-cols.list").length&&$(".box.has-cols.list").each(function(t){var e=$
3497(this).find("> div");if(e.find("> ul").length<2){var a=e.find("> ul li");e.append("<ul></ul>");for(var i=a.length,t=0;t<Math.round(i/2)-1;t++)a.eq(t).appendTo(e.find("ul:last"))}}),$(".box.marquee").length&&$(".box.marquee").each(function(){var t=$(this).find("> div ul");t.replaceWith('<marquee direction="right" scrollamount="6">'+t.html()+"</marquee>")}),$(".box.ticker").length&&window.setInterval(function(){var t=$(".box.ticker ul");t.find("li:first").slideUp(500,function(){$(this).appendTo(t).slideDown(1)})},5e3);new Comments,new Item;$(".archive-fileds select.form-control, .search-form select.form-control").length&&$("select.form-control").select2({dir:"rtl"}),$("body:not(.photos) .fancybox-thumbs").length&&$(".fancybox-thumbs").fancybox({openEffect:"fade",closeEffect:"fade",nextEffect:"none",prevEffect:"none",padding:3,aspectRatio:"true",loop:"false",closeBtn:!0,arrows:!0,nextClick:!0,helpers:{title:{type:"inside"},overlay:{css:{background:"rgba(50, 46, 44, 0.91)"}},thumbs:{width:75,height:75}}});$("body.photos .fancybox-thumbs").length&&($(".fancybox-thumbs").fancybox({openEffect:"fade",closeEffect:"fade",nextEffect:"elastic",prevEffect:"elastic",fitToView:!0,maxHeight:688,padding:3,aspectRatio:!0,loop:!1,margin:[0,0,130,0],closeBtn:!1,scrolling:"no",mouseWheel:!1,arrows:!0,nextClick:!0,afterLoad:function(){var t=$(this.element),e='<div class="info row"><div class="col-xs-12 col-md-9"><h4>{title}</h4><div class="author photo">{author}</div><time>{time}</time></div><div class="col-xs-12 col-md-3"><div class="info"><ul class="list-inline text-left"><li class="close"><button class="btn btn-link close-fancy"><i class="fa fa-th-large"></i></button></li><li class="count">{count} عکس</li></ul></div><div class="item-sharing"><ul class="list-inline text-left"><li class="dl"><a href="{url}" target="_blank" class="download-link"><i class="fa fa-download"></i></a></li><li class="fb"><a href="{url}" target="_blank"><i class="fa fa-facebook"></i></a></li><li class="tw"><a href="{url}" target="_blank"><i class="fa fa-twitter"></i></a></li><li class="gp"><a href="{url}" target="_blank"><i class="fa fa-google-plus"></i></a></li><li class="li"><a href="{url}" target="_blank"><i class="fa fa-linkedin"></i></a></li></ul></div></div></div>'.replace(/{title}/g,this.title).replace(/{time}/g,t.attr("data-date")).replace(/{author}/g,t.attr("data-author")).replace(/{href}/g,this.href).replace(/{url}/g,location.href).replace(/{count}/g,t.parents("div:first").find("a").length);this.title='<div class="container container-hasmax"><div class="row">'+e+"</div></div>"},helpers:{title:{type:"outside"},overlay:{closeClick:!0,css:{background:"rgba(255, 255, 255, 1)"}}},beforeShow:function(){var t=$(this.element).parents("li:first"),e=$(".box.gallery > div li").index(t)+1;window.location.hash=e}}),$(document).on("click",".close-fancy",function(t){$.fancybox.close(),t.preventDefault()})),$(".box.lazy-player li.video").each(function(){var t=$(this);t.on("click","figure a",function(e){if(e.preventDefault(),!t.hasClass("has-player")){t.addClass("has-player");var a=JSON.parse(t.attr("data-conf")),i=t.find("figure:first").attr("id","media_"+uuid++),n=i.find("img").attr("src");return jwplayer(i.attr("id")).setup({file:a.mediaUrl,image:n,width:"100%",aspectratio:"3:2",autostart:!0}),!1}})}),$("form.search-form .search-button").on("click",function(){$("#searchpi").remove()}),$("form.search-form .advanced").on("click",function(){var t=$("form.has-selected #advanced");"1"==t.val()?t.val("0"):t.val("1")});var n=$(".item-body #divPlayer0");if(n.length&&($(".item-body>figure.item-img").hide(),n.detach().insertBefore($(".item-body .video-download"))),$("#item video,#item audio").each(function(){var t=$(this);t.is("[id]")||t.attr("id","media_"+uuid++),t.is("[src]")&&0===t.children("source").length&&t.append('<source src="'+t.attr("src")+'" />');var e=t.find("source:first").attr("src"),a=t.attr("poster");$("body").hasClass("_xs")?jwplayer(t.attr("id")).setup({file:e,image:a,width:"100%",aspectratio:"3:2"}):jwplayer(t.attr("id")).setup({file:e,image:a,width:"640",height:"400"})}),$("#item .embeddedvideo[objname]").each(function(){var t=$(this);t.attr("id","oldmedia_"+uuid++);var e="http://media.isna.ir/content/"+t.attr("objname");$("body").hasClass("_xs")?jwplayer(t.attr("id")).setup({file:e,width:"100%",aspectratio:"3:2"}):jwplayer(t.attr("id")).setup({file:e,width:"640",height:"400"})}),$("#dateRange").change(function(){$rangeInputs=$(".date-range-inputs"),console.log($(this).val()),"custom"===$(this).val()?($rangeInputs.find("input[disabled]").prop("disabled",!1),$rangeInputs.removeClass("hidden"),$rangeInputs.slideDown()):($rangeInputs.find("input[type=text]").prop("disabled",!0),$rangeInputs.addClass("hidden"),$rangeInputs.slideUp())}),$(".box.poll").length&&$.each($(".box.poll"),function(){var t=$(this),e=t.find("[type=radio]:first").attr("name").split("-")[1];void 0!==Storage.data.poll&&void 0!==Storage.data.poll[e]&&(t.find("input[type=button]").prop("disabled",!0),t.find("input[type=radio]").prop("disabled",!0),t.find("input[type=radio][id="+Storage.data.poll[e]+"]").prop("checked",!0),t.find(".percent.hidden").removeClass("hidden"),t.find(".vote-btn").remove())}),$(".page.item.gallery").length){var s=location.href.split("#")[1];void 0!==s&&null!==s&&$(".fancybox-thumbs").eq(s-1).length&&window.setTimeout(function(){$(".fancybox-thumbs").eq(s-1).trigger("click")},200)}var o=$("meta[property='nastooh:nid']").attr("content");void 0!==o&&o&&$.ajax({url:"/rest/visit",data:"nid="+o,type:"post"}),$(document).on("click",".reply-comment",function(t){t.preventDefault();
3497var e=$(this).parents(".comment:first"),a=$(".box.comment-form form:first"),i=a.find(".comment-info .alert"),n=e.attr("data-id");i.find("> span").text(e.find(".comment-name").text()),i.find("blockquote").text(e.find("p:first").text()),i.addClass("in").removeClass("hide"),a.find("input[name=reply]").attr("value",1),a.find("input[name=parentId]").attr("value",n),$("html, body").animate({scrollTop:a.offset().top})}),$(document).on("click",".comment-form .alert .close",function(){$(this).parent().removeClass("in").addClass("hide");var t=$(this).parents("form:first");t.find("input[name=reply]").attr("value",0),t.find("input[name=reply-id]").attr("value",0)}),$(".ads .auto-height").length&&$(".ads .auto-height").each(function(){var t=$(this).parent().width();$(this).height(t/$(this).data("ratio"))})}),$(window).resize(function(){responsive_resize(),CarouselHelper.setDimensions($(".box.top ul"))}),responsive_resize(),$(document).on("click",".box.poll input[type=button]",function(){var t=$(this).parents(".box:first").find("input[type=radio]:checked"),e={item:t.attr("id"),poll:t.attr("name").split("-")[1]},a="poll"in Storage.data?Storage.data.poll:null;a=null!==a&&void 0!==a[parseInt(e.poll)]?a[parseInt(e.poll)]:null,Storage.add("poll",parseInt(e.poll),e.item)});var Services={},CarouselHelper={getConfig:function(t){var e=t.attr("data-conf");return void 0!==e?JSON.parse(e):{}},setDimensions:function(t){var e=t.parents(".box:first");return($("body").hasClass("_xs")||e.hasClass("full-width")||e.hasClass("showcase"))&&t.find("li").each(function(){$(this).width($(this).parents("ul:first").width()),$(this).css({"min-height":$(this).find("img").height()})}),t}},Storage={key:window.location.host.replace(/\./g,"").replace(":","_"),data:{},init:function(){debug&&console.info("initializing Storage");var t=Storage.parse(localStorage.getItem(Storage.key));Storage.data=t||{}},parse:function(t){return JSON.parse(t)},get:function(t,e){if(localStorage.getItem(Storage.key)){var a=Storage.parse(localStorage.getItem(Storage.key));if(void 0!==a[t])return a[t][e]}return null},set:function(t){debug&&console.info("setting new data: "+JSON.stringify(t)),localStorage.setItem(Storage.key,JSON.stringify(t)),Storage.init()},add:function(t,e,a){debug&&console.info(t,e,a),void 0!==t&&(void 0===Storage.data[t]&&(Storage.data[t]={}),void 0!==e&&void 0===Storage.data[t][e]&&(Storage.data[t][e]=a)),Storage.set(Storage.data)},clear:function(){localStorage.clear(),Storage.init()}};Storage.init();var StringHelper={getFirstWord:function(t){return-1===t.indexOf(" ")?t:t.substr(0,t.indexOf(" "))},isInt:function(t){return"number"==typeof parseInt(t)&&isFinite(parseInt(t))&&parseInt(t)%1==0},ucfirst:function(t){return void 0!==t?t.charAt(0).toUpperCase()+t.slice(1):t}},Cookie={lifetime:600,title:"isna=",init:function(){},check:function(t){if(void 0===t)var t=Cookie.title;return Cookie.get(Cookie.title)},parse:function(t){return void 0!==t&&t},delete:function(t){if(void 0===t)var t=Cookie.title;document.cookie=t+"; Thu, 01 Jan 1970 00:00:01 GMT; path=/"},set:function(t,e){if(void 0===t)t=Cookie.title;var t=Cookie.title,a=new Date;a.setTime(a.getTime()+1e3*Cookie.lifetime);var i="expires="+a.toGMTString();return document.cookie=t+e+"; "+i+"; path=/",e},get:function(t){if(void 0===t)var t=Cookie.title;for(var e=document.cookie.split(";"),a=0;a<e.length;a++){var i=e[a].trim();if(0===i.indexOf(t))return Cookie.parse(i.substring(t.length,i.length))}return""}};$("#frmNewsArchive").size()>=1&&(makeArchHref(),$("#topic,#newsType,#place,#toDay,#toMonth,#toYear").change(function(){makeArchHref(),location.href=$("#doFindNews").attr("href")})),$("#frmSubscription").size()>=1&&($("input[name='newsletter_id']").change(function(){nl_id=$('input[name="newsletter_id"]:checked').val(),nl_md=$('input.NLMedium[alt="'+nl_id+'"]').val(),$(".reqCell").hide(),$(".reqEmail").hide(),"1"==nl_md?($(".reqEmail").show(),$("#cell").attr("required",null),$("#email").attr("required","true")):"2"==nl_md&&($(".reqCell").show(),$("#email").attr("required",null),$("#cell").attr("required","true"))}),$("input[name='newsletter_id']:first").click(),$("input[name='newsletter_id']").change()),$(".btnScr").click(function(){ds=$(this),ds.append(spinner),cid=$(this).attr("rel"),vote=$(this).hasClass("ps")?1:-1,voteSel=1==vote?"ps":"ng",$.ajax({type:"GET",url:"/rest/postCommentVote?commentId="+cid+"&vote="+vote,async:!1,cache:!1,success:function(t){t>0?(ds.find(".pn").text(t),ds.attr("atitle","قبلاً امتیاز داده‌اید‍")):"-2"==t?ds.attr("atitle","قبلاً امتیاز داده‌اید‍"):(ds.find(".pn").text("X"),ds.attr("atitle","اشکال در درج امتیاز"))},error:function(){ds.find(".pn").text("X"),ds.children(".icon-spinner").hide(300).remove()}}),ds.children(".icon-spinner").hide(300).remove()}),$("input.vote-btn").click(function(){var t=$(this),e=$(this).parents(".poll-box"),a=e.find("input:checked");a.length<=0||$.ajax({type:"POST",url:"/rest/vote?poid="+a.attr("id"),cache:!1,success:function(){t.remove(),e.find(":radio").attr("disabled",!0),e.find(".percent.hidden").removeClass("hidden")},error:function(){}})}),$("#frmSearchNews #btnAdvSearch").click(function(){$("#frmSearchNews #divAdvSearch").toggle(500);var t=$("#frmSearchNews #advanced");"1"==t.val()?(t.val("0"),$("#divAdvSearch select").prop("disabled",!0)):(t.val("1"),$("#divAdvSearch select").prop("disabled",!1))}),$("#frmSearchNews #btnDoSearch").submit(function(){var t=$("#frmSearchNews #txtQuery").val();return""!=t&&t!=$("#frmSearchNews #txtQuery").attr("placeholder")||($("#frmSearchNews #txtQuery").focus(),!1)}),$(".toggle-versions").on("click","a",function(t){switch($(this).attr("id")){case"de
3497sktop-version":$("meta[name=viewport]").attr("content","width=1000"),Cookie.set("saba-responsive","desktop"),$(".responsive-tools").removeClass("visible-xs"),$("#mobile-version").removeClass("hidden-xs");break;case"mobile-version":$("meta[name=viewport]").attr("content","width=device-width, initial-scale=1.0"),Cookie.delete("saba-responsive"),$("#mobile-version").addClass("hidden-xs")}t.preventDefault()}),$("form[data-url]").each(function(){var t=$(this),e="#"+$(this).attr("id");$(t).find("#btnSave").click(function(){$(this).parent().append(spinner);var a=!1;if($(e+" input,"+e+" textarea").each(function(){var e=$(this).val().trim();$(this).attr("required")&&""==e&&(a=!0,$(t).find(".msg").addClass("text-error").text($(this).attr("data-requiredmsg")).show(),$(this).focus()),null==$(this).attr("data-emailvalidation")||"true"!=$(this).attr("data-emailvalidation")||""==e||IsEmailValid(e)||(a=!0,$(t).find(".msg").addClass("text-error").text("لطفا‍‍ً رایانامه خود را به درستی وارد کنید!").show(),$(this).focus())}),!a){var i=$(t).serialize(),n=$(t).attr("data-url");$.post(n,i,function(a){if("1"==a){i=$(t).attr("data-success");$(t).find(".msg").addClass("text-success").text(i).show(),$("#btnSave,"+e+" input,"+e+" textarea").attr("disabled","disabled")}else if("2"==a){i=$(t).attr("data-captchaerror");$(t).find(".msg").addClass("text-error").text(i).show()}else{var i=$(t).attr("data-error");$(t).find(".msg").addClass("text-error").text(i).show(),$("#btnSave,"+e+" input,"+e+" textarea").attr("disabled","disabled")}},"json")}return $(this).parent().children(".icon-spinner").hide(300).remove(),!1})});
3498
3499
3500
3501
3502/*!
3503 * Bootstrap v3.3.6 (http://getbootstrap.com)
3504 * Copyright 2011-2015 Twitter, Inc.
3505 * Licensed under the MIT license
3506 */�
vendor: 32,004 bytes, lines 3506-3507
3506
3507if("undefined"==typeof jQuery)throw new Error("Bootstrap's JavaScript requires jQuery");+function(a){"use strict";var b=a.fn.jquery.split(" ")[0].split(".");if(b[0]<2&&b[1]<9||1==b[0]&&9==b[1]&&b[2]<1||b[0]>2)throw new Error("Bootstrap's JavaScript requires jQuery version 1.9.1 or higher, but lower than version 3")}(jQuery),+function(a){"use strict";function b(){var a=document.createElement("bootstrap"),b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var c in b)if(void 0!==a.style[c])return{end:b[c]};return!1}a.fn.emulateTransitionEnd=function(b){var c=!1,d=this;a(this).one("bsTransitionEnd",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(),a.support.transition&&(a.event.special.bsTransitionEnd={bindType:a.support.transition.end,delegateType:a.support.transition.end,handle:function(b){return a(b.target).is(this)?b.handleObj.handler.apply(this,arguments):void 0}})})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var c=a(this),e=c.data("bs.alert");e||c.data("bs.alert",e=new d(this)),"string"==typeof b&&e[b].call(c)})}var c='[data-dismiss="alert"]',d=function(b){a(b).on("click",c,this.close)};d.VERSION="3.3.6",d.TRANSITION_DURATION=150,d.prototype.close=function(b){function c(){g.detach().trigger("closed.bs.alert").remove()}var e=a(this),f=e.attr("data-target");f||(f=e.attr("href"),f=f&&f.replace(/.*(?=#[^\s]*$)/,""));var g=a(f);b&&b.preventDefault(),g.length||(g=e.closest(".alert")),g.trigger(b=a.Event("close.bs.alert")),b.isDefaultPrevented()||(g.removeClass("in"),a.support.transition&&g.hasClass("fade")?g.one("bsTransitionEnd",c).emulateTransitionEnd(d.TRANSITION_DURATION):c())};var e=a.fn.alert;a.fn.alert=b,a.fn.alert.Constructor=d,a.fn.alert.noConflict=function(){return a.fn.alert=e,this},a(document).on("click.bs.alert.data-api",c,d.prototype.close)}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.button"),f="object"==typeof b&&b;e||d.data("bs.button",e=new c(this,f)),"toggle"==b?e.toggle():b&&e.setState(b)})}var c=function(b,d){this.$element=a(b),this.options=a.extend({},c.DEFAULTS,d),this.isLoading=!1};c.VERSION="3.3.6",c.DEFAULTS={loadingText:"loading..."},c.prototype.setState=function(b){var c="disabled",d=this.$element,e=d.is("input")?"val":"html",f=d.data();b+="Text",null==f.resetText&&d.data("resetText",d[e]()),setTimeout(a.proxy(function(){d[e](null==f[b]?this.options[b]:f[b]),"loadingText"==b?(this.isLoading=!0,d.addClass(c).attr(c,c)):this.isLoading&&(this.isLoading=!1,d.removeClass(c).removeAttr(c))},this),0)},c.prototype.toggle=function(){var a=!0,b=this.$element.closest('[data-toggle="buttons"]');if(b.length){var c=this.$element.find("input");"radio"==c.prop("type")?(c.prop("checked")&&(a=!1),b.find(".active").removeClass("active"),this.$element.addClass("active")):"checkbox"==c.prop("type")&&(c.prop("checked")!==this.$element.hasClass("active")&&(a=!1),this.$element.toggleClass("active")),c.prop("checked",this.$element.hasClass("active")),a&&c.trigger("change")}else this.$element.attr("aria-pressed",!this.$element.hasClass("active")),this.$element.toggleClass("active")};var d=a.fn.button;a.fn.button=b,a.fn.button.Constructor=c,a.fn.button.noConflict=function(){return a.fn.button=d,this},a(document).on("click.bs.button.data-api",'[data-toggle^="button"]',function(c){var d=a(c.target);d.hasClass("btn")||(d=d.closest(".btn")),b.call(d,"toggle"),a(c.target).is('input[type="radio"]')||a(c.target).is('input[type="checkbox"]')||c.preventDefault()}).on("focus.bs.button.data-api blur.bs.button.data-api",'[data-toggle^="button"]',function(b){a(b.target).closest(".btn").toggleClass("focus",/^focus(in)?$/.test(b.type))})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.carousel"),f=a.extend({},c.DEFAULTS,d.data(),"object"==typeof b&&b),g="string"==typeof b?b:f.slide;e||d.data("bs.carousel",e=new c(this,f)),"number"==typeof b?e.to(b):g?e[g]():f.interval&&e.pause().cycle()})}var c=function(b,c){this.$element=a(b),this.$indicators=this.$element.find(".carousel-indicators"),this.options=c,this.paused=null,this.sliding=null,this.interval=null,this.$active=null,this.$items=null,this.options.keyboard&&this.$element.on("keydown.bs.carousel",a.proxy(this.keydown,this)),"hover"==this.options.pause&&!("ontouchstart"in document.documentElement)&&this.$element.on("mouseenter.bs.carousel",a.proxy(this.pause,this)).on("mouseleave.bs.carousel",a.proxy(this.cycle,this))};c.VERSION="3.3.6",c.TRANSITION_DURATION=600,c.DEFAULTS={interval:5e3,pause:"hover",wrap:!0,keyboard:!0},c.prototype.keydown=function(a){if(!/input|textarea/i.test(a.target.tagName)){switch(a.which){case 37:this.prev();break;case 39:this.next();break;default:return}a.preventDefault()}},c.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},c.prototype.getItemIndex=function(a){return this.$items=a.parent().children(".item"),this.$items.index(a||this.$active)},c.prototype.getItemForDirection=function(a,b){var c=this.getItemIndex(b),d="prev"==a&&0===c||"next"==a&&c==this.$items.length-1;if(d&&!this.options.wrap)return b;var e="prev"==a?-1:1,f=(c+e)%this.$items.length;return this.$items.eq(f)},c.prototype.to=function(a){var b=this,c=this.getItemIndex(this.$active=this.$element.find(".item.active"));return a>this.$items.length-1||0>a?void 0:this.sliding?this.$element.one("slid.bs.carousel",function(){b.to(a)}):c==a?this.pause().cycle():this.slide(a>c?"next":"prev",this.$items.eq(a))},c.prototype.pause=function(b){return b||(this.paused=!0),this.$element.find(".next, .prev").length&&a.support.transition&&(this.$element.trigger(a.support.transition.end),this.cycle(!0)),this.interval=clearInterval(this.interval),this},c.prototype.next=function(){return this.sliding?void 0:this.slide("next")},c.prototype.prev=function(){return this.sliding?void 0:this.slide("prev")},c.prototype.slide=function(b,d){var e=this.$element.find(".item.active"),f=d||this.getItemForDirection(b,e),g=this.interval,h="next"==b?"left":"right",i=this;if(f.hasClass("active"))return this.sliding=!1;var j=f[0],k=a.Event("slide.bs.carousel",{relatedTarget:j,direction:h});if(this.$element.trigger(k),!k.isDefaultPrevented()){if(this.sliding=!0,g&&this.pause(),this.$indicators.length){this.$indicators.find(".active").removeClass("active");var l=a(this.$indicators.children()[this.getItemIndex(f)]);l&&l.addClass("active")}var m=a.Event("slid.bs.carousel",{relatedTarget:j,direction:h});return a.support.transition&&this.$element.hasClass("slide")?(f.addClass(b),f[0].offsetWidth,e.addClass(h),f.addClass(h),e.one("bsTransitionEnd",function(){f.removeClass([b,h].join(" ")).addClass("active"),e.removeClass(["active",h].join(" ")),i.sliding=!1,setTimeout(function(){i.$element.trigger(m)},0)}).emulateTransitionEnd(c.TRANSITION_DURATION)):(e.removeClass("active"),f.addClass("active"),this.sliding=!1,this.$element.trigger(m)),g&&this.cycle(),this}};var d=a.fn.carousel;a.fn.carousel=b,a.fn.carousel.Constructor=c,a.fn.carousel.noConflict=function(){return a.fn.carousel=d,this};var e=function(c){var d,e=a(this),f=a(e.attr("data-target")||(d=e.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,""));if(f.hasClass("carousel")){var g=a.extend({},f.data(),e.data()),h=e.attr("data-slide-to");h&&(g.interval=!1),b.call(f,g),h&&f.data("bs.carousel").to(h),c.preventDefault()}};a(document).on("click.bs.carousel.data-api","[data-slide]",e).on("click.bs.carousel.data-api","[data-slide-to]",e),a(window).on("load",function(){a('[data-ride="carousel"]').each(function(){var c=a(this);b.call(c,c.data())})})}(jQuery),+function(a){"use strict";function b(b){var c,d=b.attr("data-target")||(c=b.attr("href"))&&c.replace(/.*(?=#[^\s]+$)/,"");return a(d)}function c(b){return this.each(function(){var c=a(this),e=c.data("bs.collapse"),f=a.extend({},d.DEFAULTS,c.data(),"object"==typeof b&&b);!e&&f.toggle&&/show|hide/.test(b)&&(f.toggle=!1),e||c.data("bs.collapse",e=new d(this,f)),"string"==typeof b&&e[b]()})}var d=function(b,c){this.$element=a(b),this.options=a.extend({},d.DEFAULTS,c),this.$trigger=a('[data-toggle="collapse"][href="#'+b.id+'"],[data-toggle="collapse"][data-target="#'+b.id+'"]'),this.transitioning=null,this.options.parent?this.$parent=this.getParent():this.addAriaAndCollapsedClass(this.$element,this.$trigger),this.options.toggle&&this.toggle()};d.VERSION="3.3.6",d.TRANSITION_DURATION=350,d.DEFAULTS={toggle:!0},d.prototype.dimension=function(){var a=this.$element.hasClass("width");return a?"width":"height"},d.prototype.show=function(){if(!this.transitioning&&!this.$element.hasClass("in")){var b,e=this.$parent&&this.$parent.children(".panel").children(".in, .collapsing");if(!(e&&e.length&&(b=e.data("bs.collapse"),b&&b.transitioning))){var f=a.Event("show.bs.collapse");if(this.$element.trigger(f),!f.isDefaultPrevented()){e&&e.length&&(c.call(e,"hide"),b||e.data("bs.collapse",null));var g=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[g](0).attr("aria-expanded",!0),this.$trigger.removeClass("collapsed").attr("aria-expanded",!0),this.transitioning=1;var h=function(){this.$element.removeClass("collapsing").addClass("collapse in")[g](""),this.transitioning=0,this.$element.trigger("shown.bs.collapse")};if(!a.support.transition)return h.call(this);var i=a.camelCase(["scroll",g].join("-"));this.$element.one("bsTransitionEnd",a.proxy(h,this)).emulateTransitionEnd(d.TRANSITION_DURATION)[g](this.$element[0][i])}}}},d.prototype.hide=function(){if(!this.transitioning&&this.$element.hasClass("in")){var b=a.Event("hide.bs.collapse");if(this.$element.trigger(b),!b.isDefaultPrevented()){var c=this.dimension();this.$element[c](this.$element[c]())[0].offsetHeight,this.$element.addClass("collapsing").removeClass("collapse in").attr("aria-expanded",!1),this.$trigger.addClass("collapsed").attr("aria-expanded",!1),this.transitioning=1;var e=function(){this.transitioning=0,this.$element.removeClass("collapsing").addClass("collapse").trigger("hidden.bs.collapse")};return a.support.transition?void this.$element[c](0).one("bsTransitionEnd",a.proxy(e,this)).emulateTransitionEnd(d.TRANSITION_DURATION):e.call(this)}}},d.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()},d.prototype.getParent=function(){return a(this.options.parent).find('[data-toggle="collapse"][data-parent="'+this.options.parent+'"]').each(a.proxy(function(c,d){var e=a(d);this.addAriaAndCollapsedClass(b(e),e)},this)).end()},d.prototype.addAriaAndCollapsedClass=function(a,b){var c=a.hasClass("in");a.attr("aria-expanded",c),b.toggleClass("collapsed",!c).attr("aria-expanded",c)};var e=a.fn.collapse;a.fn.collapse=c,a.fn.collapse.Constructor=d,a.fn.collapse.noConflict=function(){return a.fn.collapse=e,this},a(document).on("click.bs.collapse.data-api",'[data-toggle="collapse"]',function(d){var e=a(this);e.attr("data-target")||d.preventDefault();var f=b(e),g=f.data("bs.collapse"),h=g?"toggle":e.data();c.call(f,h)})}(jQuery),+function(a){"use strict";function b(b){var c=b.attr("data-target");c||(c=b.attr("href"),c=c&&/#[A-Za-z]/.test(c)&&c.replace(/.*(?=#[^\s]*$)/,""));var d=c&&a(c);return d&&d.length?d:b.parent()}function c(c){c&&3===c.which||(a(e).remove(),a(f).each(function(){var d=a(this),e=b(d),f={relatedTarget:this};e.hasClass("open")&&(c&&"click"==c.type&&/input|textarea/i.test(c.target.tagName)&&a.contains(e[0],c.target)||(e.trigger(c=a.Event("hide.bs.dropdown",f)),c.isDefaultPrevented()||(d.attr("aria-expanded","false"),e.removeClass("open").trigger(a.Event("hidden.bs.dropdown",f)))))}))}function d(b){return this.each(function(){var c=a(this),d=c.data("bs.dropdown");d||c.data("bs.dropdown",d=new g(this)),"string"==typeof b&&d[b].call(c)})}var e=".dropdown-backdrop",f='[data-toggle="dropdown"]',g=function(b){a(b).on("click.bs.dropdown",this.toggle)};g.VERSION="3.3.6",g.prototype.toggle=function(d){var e=a(this);if(!e.is(".disabled, :disabled")){var f=b(e),g=f.hasClass("open");if(c(),!g){"ontouchstart"in document.documentElement&&!f.closest(".navbar-nav").length&&a(document.createElement("div")).addClass("dropdown-backdrop").insertAfter(a(this)).on("click",c);var h={relatedTarget:this};if(f.trigger(d=a.Event("show.bs.dropdown",h)),d.isDefaultPrevented())return;e.trigger("focus").attr("aria-expanded","true"),f.toggleClass("open").trigger(a.Event("shown.bs.dropdown",h))}return!1}},g.prototype.keydown=function(c){if(/(38|40|27|32)/.test(c.which)&&!/input|textarea/i.test(c.target.tagName)){var d=a(this);if(c.preventDefault(),c.stopPropagation(),!d.is(".disabled, :disabled")){var e=b(d),g=e.hasClass("open");if(!g&&27!=c.which||g&&27==c.which)return 27==c.which&&e.find(f).trigger("focus"),d.trigger("click");var h=" li:not(.disabled):visible a",i=e.find(".dropdown-menu"+h);if(i.length){var j=i.index(c.target);38==c.which&&j>0&&j--,40==c.which&&j<i.length-1&&j++,~j||(j=0),i.eq(j).trigger("focus")}}}};var h=a.fn.dropdown;a.fn.dropdown=d,a.fn.dropdown.Constructor=g,a.fn.dropdown.noConflict=function(){return a.fn.dropdown=h,this},a(document).on("click.bs.dropdown.data-api",c).on("click.bs.dropdown.data-api",".dropdown form",function(a){a.stopPropagation()}).on("click.bs.dropdown.data-api",f,g.prototype.toggle).on("keydown.bs.dropdown.data-api",f,g.prototype.keydown).on("keydown.bs.dropdown.data-api",".dropdown-menu",g.prototype.keydown)}(jQuery),+function(a){"use strict";function b(b,d){return this.each(function(){var e=a(this),f=e.data("bs.modal"),g=a.extend({},c.DEFAULTS,e.data(),"object"==typeof b&&b);f||e.data("bs.modal",f=new c(this,g)),"string"==typeof b?f[b](d):g.show&&f.show(d)})}var c=function(b,c){this.options=c,this.$body=a(document.body),this.$element=a(b),this.$dialog=this.$element.find(".modal-dialog"),this.$backdrop=null,this.isShown=null,this.originalBodyPad=null,this.scrollbarWidth=0,this.ignoreBackdropClick=!1,this.options.remote&&this.$element.find(".modal-content").load(this.options.remote,a.proxy(function(){this.$element.trigger("loaded.bs.modal")},this))};c.VERSION="3.3.6",c.TRANSITION_DURATION=300,c.BACKDROP_TRANSITION_DURATION=150,c.DEFAULTS={backdrop:!0,keyboard:!0,show:!0},c.prototype.toggle=function(a){return this.isShown?this.hide():this.show(a)},c.prototype.show=function(b){var d=this,e=a.Event("show.bs.modal",{relatedTarget:b});this.$element.trigger(e),this.isShown||e.isDefaultPrevented()||(this.isShown=!0,this.checkScrollbar(),this.setScrollbar(),this.$body.addClass("modal-open"),this.escape(),this.resize(),this.$element.on("click.dismiss.bs.modal",'[data-dismiss="modal"]',a.proxy(this.hide,this)),this.$dialog.on("mousedown.dismiss.bs.modal",function(){d.$element.one("mouseup.dismiss.bs.modal",function(b){a(b.target).is(d.$element)&&(d.ignoreBackdropClick=!0)})}),this.backdrop(function(){var e=a.support.transition&&d.$element.hasClass("fade");d.$element.parent().length||d.$element.appendTo(d.$body),d.$element.show().scrollTop(0),d.adjustDialog(),e&&d.$element[0].offsetWidth,d.$element.addClass("in"),d.enforceFocus();var f=a.Event("shown.bs.modal",{relatedTarget:b});e?d.$dialog.one("bsTransitionEnd",function(){d.$element.trigger("focus").trigger(f)}).emulateTransitionEnd(c.TRANSITION_DURATION):d.$element.trigger("focus").trigger(f)}))},c.prototype.hide=function(b){b&&b.preventDefault(),b=a.Event("hide.bs.modal"),this.$element.trigger(b),this.isShown&&!b.isDefaultPrevented()&&(this.isShown=!1,this.escape(),this.resize(),a(document).off("focusin.bs.modal"),this.$element.removeClass("in").off("click.dismiss.bs.modal").off("mouseup.dismiss.bs.modal"),this.$dialog.off("mousedown.dismiss.bs.modal"),a.support.transition&&this.$element.hasClass("fade")?this.$element.one("bsTransitionEnd",a.proxy(this.hideModal,this)).emulateTransitionEnd(c.TRANSITION_DURATION):this.hideModal())},c.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.trigger("focus")},this))},c.prototype.escape=function(){this.isShown&&this.options.keyboard?this.$element.on("keydown.dismiss.bs.modal",a.proxy(function(a){27==a.which&&this.hide()},this)):this.isShown||this.$element.off("keydown.dismiss.bs.modal")},c.prototype.resize=function(){this.isShown?a(window).on("resize.bs.modal",a.proxy(this.handleUpdate,this)):a(window).off("resize.bs.modal")},c.prototype.hideModal=function(){var a=this;this.$element.hide(),this.backdrop(function(){a.$body.removeClass("modal-open"),a.resetAdjustments(),a.resetScrollbar(),a.$element.trigger("hidden.bs.modal")})},c.prototype.removeBackdrop=function(){this.$backdrop&&this.$backdrop.remove(),this.$backdrop=null},c.prototype.backdrop=function(b){var d=this,e=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var f=a.support.transition&&e;if(this.$backdrop=a(document.createElement("div")).addClass("modal-backdrop "+e).appendTo(this.$body),this.$element.on("click.dismiss.bs.modal",a.proxy(function(a){return this.ignoreBackdropClick?void(this.ignoreBackdropClick=!1):void(a.target===a.currentTarget&&("static"==this.options.backdrop?this.$element[0].focus():this.hide()))},this)),f&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),!b)return;f?this.$backdrop.one("bsTransitionEnd",b).emulateTransitionEnd(c.BACKDROP_TRANSITION_DURATION):b()}else if(!this.isShown&&this.$backdrop){this.$backdrop.removeClass("in");var g=function(){d.removeBackdrop(),b&&b()};a.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one("bsTransitionEnd",g).emulateTransitionEnd(c.BACKDROP_TRANSITION_DURATION):g()}else b&&b()},c.prototype.handleUpdate=function(){this.adjustDialog()},c.prototype.adjustDialog=function(){var a=this.$element[0].scrollHeight>document.documentElement.clientHeight;this.$element.css({paddingLeft:!this.bodyIsOverflowing&&a?this.scrollbarWidth:"",paddingRight:this.bodyIsOverflowing&&!a?this.scrollbarWidth:""})},c.prototype.resetAdjustments=function(){this.$element.css({paddingLeft:"",paddingRight:""})},c.prototype.checkScrollbar=function(){var a=window.innerWidth;if(!a){var b=document.documentElement.getBoundingClientRect();a=b.right-Math.abs(b.left)}this.bodyIsOverflowing=document.body.clientWidth<a,this.scrollbarWidth=this.measureScrollbar()},c.prototype.setScrollbar=function(){var a=parseInt(this.$body.css("padding-right")||0,10);this.originalBodyPad=document.body.style.paddingRight||"",this.bodyIsOverflowing&&this.$body.css("padding-right",a+this.scrollbarWidth)},c.prototype.resetScrollbar=function(){this.$body.css("padding-right",this.originalBodyPad)},c.prototype.measureScrollbar=function(){var a=document.createElement("div");a.className="modal-scrollbar-measure",this.$body.append(a);var b=a.offsetWidth-a.clientWidth;return this.$body[0].removeChild(a),b};var d=a.fn.modal;a.fn.modal=b,a.fn.modal.Constructor=c,a.fn.modal.noConflict=function(){return a.fn.modal=d,this},a(document).on("click.bs.modal.data-api",'[data-toggle="modal"]',function(c){var d=a(this),e=d.attr("href"),f=a(d.attr("data-target")||e&&e.replace(/.*(?=#[^\s]+$)/,"")),g=f.data("bs.modal")?"toggle":a.extend({remote:!/#/.test(e)&&e},f.data(),d.data());d.is("a")&&c.preventDefault(),f.one("show.bs.modal",function(a){a.isDefaultPrevented()||f.one("hidden.bs.modal",function(){d.is(":visible")&&d.trigger("focus")})}),b.call(f,g,this)})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.tooltip"),f="object"==typeof b&&b;(e||!/destroy|hide/.test(b))&&(e||d.data("bs.tooltip",e=new c(this,f)),"string"==typeof b&&e[b]())})}var c=function(a,b){this.type=null,this.options=null,this.enabled=null,this.timeout=null,this.hoverState=null,this.$element=null,this.inState=null,this.init("tooltip",a,b)};c.VERSION="3.3.6",c.TRANSITION_DURATION=150,c.DEFAULTS={animation:!0,placement:"top",selector:!1,template:'<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover focus",title:"",delay:0,html:!1,container:!1,viewport:{selector:"body",padding:0}},c.prototype.init=function(b,c,d){if(this.enabled=!0,this.type=b,this.$element=a(c),this.options=this.getOptions(d),this.$viewport=this.options.viewport&&a(a.isFunction(this.options.viewport)?this.options.viewport.call(this,this.$element):this.options.viewport.selector||this.options.viewport),this.inState={click:!1,hover:!1,focus:!1},this.$element[0]instanceof document.constructor&&!this.options.selector)throw new Error("`selector` option must be specified when initializing "+this.type+" on the window.document object!");for(var e=this.options.trigger.split(" "),f=e.length;f--;){var g=e[f];if("click"==g)this.$element.on("click."+this.type,this.options.selector,a.proxy(this.toggle,this));else if("manual"!=g){var h="hover"==g?"mouseenter":"focusin",i="hover"==g?"mouseleave":"focusout";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()},c.prototype.getDefaults=function(){return c.DEFAULTS},c.prototype.getOptions=function(b){return b=a.extend({},this.getDefaults(),this.$element.data(),b),b.delay&&"number"==typeof b.delay&&(b.delay={show:b.delay,hide:b.delay}),b},c.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},c.prototype.enter=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget).data("bs."+this.type);return c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c)),b instanceof a.Event&&(c.inState["focusin"==b.type?"focus":"hover"]=!0),c.tip().hasClass("in")||"in"==c.hoverState?void(c.hoverState="in"):(clearTimeout(c.timeout),c.hoverState="in",c.options.delay&&c.options.delay.show?void(c.timeout=setTimeout(function(){"in"==c.hoverState&&c.show()},c.options.delay.show)):c.show())},c.prototype.isInStateTrue=function(){for(var a in this.inState)if(this.inState[a])return!0;return!1},c.prototype.leave=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget).data("bs."+this.type);return c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c)),b instanceof a.Event&&(c.inState["focusout"==b.type?"focus":"hover"]=!1),c.isInStateTrue()?void 0:(clearTimeout(c.timeout),c.hoverState="out",c.options.delay&&c.options.delay.hide?void(c.timeout=setTimeout(function(){"out"==c.hoverState&&c.hide()},c.options.delay.hide)):c.hide())},c.prototype.show=function(){var b=a.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){this.$element.trigger(b);var d=a.contains(this.$element[0].ownerDocument.documentElement,this.$element[0]);if(b.isDefaultPrevented()||!d)return;var e=this,f=this.tip(),g=this.getUID(this.type);this.setContent(),f.attr("id",g),this.$element.attr("aria-describedby",g),this.options.animation&&f.addClass("fade");var h="function"==typeof this.options.placement?this.options.placement.call(this,f[0],this.$element[0]):this.options.placement,i=/\s?auto?\s?/i,j=i.test(h);j&&(h=h.replace(i,"")||"top"),f.detach().css({top:0,left:0,display:"block"}).addClass(h).data("bs."+this.type,this),this.options.container?f.appendTo(this.options.container):f.insertAfter(this.$element),this.$element.trigger("inserted.bs."+this.type);var k=this.getPosition(),l=f[0].offsetWidth,m=f[0].offsetHeight;if(j){var n=h,o=this.getPosition(this.$viewport);h="bottom"==h&&k.bottom+m>o.bottom?"top":"top"==h&&k.top-m<o.top?"bottom":"right"==h&&k.right+l>o.width?"left":"left"==h&&k.left-l<o.left?"right":h,f.removeClass(n).addClass(h)}var p=this.getCalculatedOffset(h,k,l,m);this.applyPlacement(p,h);var q=function(){var a=e.hoverState;e.$element.trigger("shown.bs."+e.type),e.hoverState=null,"out"==a&&e.leave(e)};a.support.transition&&this.$tip.hasClass("fade")?f.one("bsTransitionEnd",q).emulateTransitionEnd(c.TRANSITION_DURATION):q()}},c.prototype.applyPlacement=function(b,c){var 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),b.top+=g,b.left+=h,a.offset.setOffset(d[0],a.extend({using:function(a){d.css({top:Math.round(a.top),left:Math.round(a.left)})}},b),0),d.addClass("in");var i=d[0].offsetWidth,j=d[0].offsetHeight;"top"==c&&j!=f&&(b.top=b.top+f-j);var k=this.getViewportAdjustedDelta(c,b,i,j);k.left?b.left+=k.left:b.top+=k.top;var l=/top|bottom/.test(c),m=l?2*k.left-e+i:2*k.top-f+j,n=l?"offsetWidth":"offsetHeight";d.offset(b),this.replaceArrow(m,d[0][n],l)},c.prototype.replaceArrow=function(a,b,c){this.arrow().css(c?"left":"top",50*(1-a/b)+"%").css(c?"top":"left","")},c.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")},c.prototype.hide=function(b){function d(){"in"!=e.hoverState&&f.detach(),e.$element.removeAttr("aria-describedby").trigger("hidden.bs."+e.type),b&&b()}var e=this,f=a(this.$tip),g=a.Event("hide.bs."+this.type);return this.$element.trigger(g),g.isDefaultPrevented()?void 0:(f.removeClass("in"),a.support.transition&&f.hasClass("fade")?f.one("bsTransitionEnd",d).emulateTransitionEnd(c.TRANSITION_DURATION):d(),this.hoverState=null,this)},c.prototype.fixTitle=function(){var a=this.$element;(a.attr("title")||"string"!=typeof a.attr("data-original-title"))&&a.attr("data-original-title",a.attr("title")||"").attr("title","")},c.prototype.hasContent=function(){return this.getTitle()},c.prototype.getPosition=function(b){b=b||this.$element;var c=b[0],d="BODY"==c.tagName,e=c.getBoundingClientRect();null==e.width&&(e=a.extend({},e,{width:e.right-e.left,height:e.bottom-e.top}));var f=d?{top:0,left:0}:b.offset(),g={scroll:d?document.documentElement.scrollTop||document.body.scrollTop:b.scrollTop()},h=d?{width:a(window).width(),height:a(window).height()}:null;return a.extend({},e,g,h,f)},c.prototype.getCalculatedOffset=function(a,b,c,d){return"bottom"==a?{top:b.top+b.height,left:b.left+b.width/2-c/2}:"top"==a?{top:b.top-d,left:b.left+b.width/2-c/2}:"left"==a?{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}},c.prototype.getViewportAdjustedDelta=function(a,b,c,d){var e={top:0,left:0};if(!this.$viewport)return e;var f=this.options.viewport&&this.options.viewport.padding||0,g=this.getPosition(this.$viewport);if(/right|left/.test(a)){var h=b.top-f-g.scroll,i=b.top+f-g.scroll+d;h<g.top?e.top=g.top-h:i>g.top+g.height&&(e.top=g.top+g.height-i)}else{var j=b.left-f,k=b.left+f+c;j<g.left?e.left=g.left-j:k>g.right&&(e.left=g.left+g.width-k)}return e},c.prototype.getTitle=function(){var a,b=this.$element,c=this.options;return a=b.attr("data-original-title")||("function"==typeof c.title?c.title.call(b[0]):c.title)},c.prototype.getUID=function(a){do a+=~~(1e6*Math.random());while(document.getElementById(a));return a},c.prototype.tip=function(){if(!this.$tip&&(this.$tip=a(this.options.template),1!=this.$tip.length))throw new Error(this.type+" `template` option must consist of exactly 1 top-level element!");return this.$tip},c.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},c.prototype.enable=function(){this.enabled=!0},c.prototype.disable=function(){this.enabled=!1},c.prototype.toggleEnabled=function(){this.enabled=!this.enabled},c.prototype.toggle=function(b){var c=this;b&&(c=a(b.currentTarget).data("bs."+this.type),c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c))),b?(c.inState.click=!c.inState.click,c.isInStateTrue()?c.enter(c):c.leave(c)):c.tip().hasClass("in")?c.leave(c):c.enter(c)},c.prototype.destroy=function(){var a=this;clearTimeout(this.timeout),this.hide(function(){a.$element.off("."+a.type).removeData("bs."+a.type),a.$tip&&a.$tip.detach(),a.$tip=null,a.$arrow=null,a.$viewport=null})};var d=a.fn.tooltip;a.fn.tooltip=b,a.fn.tooltip.Constructor=c,a.fn.tooltip.noConflict=function(){return a.fn.tooltip=d,this}}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.popover"),f="object"==typeof b&&b;(e||!/destroy|hide/.test(b))&&(e||d.data("bs.popover",e=new c(this,f)),"string"==typeof b&&e[b]())})}var c=function(a,b){this.init("popover",a,b)};if(!a.fn.tooltip)throw new Error("Popover requires tooltip.js");c.VERSION="3.3.6",c.DEFAULTS=a.extend({},a.fn.tooltip.Constructor.DEFAULTS,{placement:"right",trigger:"click",content:"",template:'<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'}),c.prototype=a.extend({},a.fn.tooltip.Constructor.prototype),c.prototype.constructor=c,c.prototype.getDefaults=function(){return c.DEFAULTS},c.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").children().detach().end()[this.options.html?"string"==typeof c?"html":"append":"text"](c),a.removeClass("fade top bottom left right in"),a.find(".popover-title").html()||a.find(".popover-title").hide()},c.prototype.hasContent=function(){return this.getTitle()||this.getContent()},c.prototype.getContent=function(){var a=this.$element,b=this.options;return a.attr("data-content")||("function"==typeof b.content?b.content.call(a[0]):b.content)},c.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")};var d=a.fn.popover;a.fn.popover=b,a.fn.popover.Constructor=c,a.fn.popover.noConflict=function(){return a.fn.popover=d,this}}(jQuery),+function(a){"use strict";function b(c,d){this.$body=a(document.body),this.$scrollElement=a(a(c).is(document.body)?window:c),this.options=a.extend({},b.DEFAULTS,d),this.selector=(this.options.target||"")+" .nav li > a",this.offsets=[],this.targets=[],this.activeTarget=null,this.scrollHeight=0,this.$scrollElement.on("scroll.bs.scrollspy",a.proxy(this.process,this)),this.refresh(),this.process()}function c(c){return this.each(function(){var d=a(this),e=d.data("bs.scrollspy"),f="object"==typeof c&&c;e||d.data("bs.scrollspy",e=new b(this,f)),"string"==typeof c&&e[c]()})}b.VERSION="3.3.6",b.DEFAULTS={offset:10},b.prototype.getScrollHeight=function(){return this.$scrollElement[0].scrollHeight||Math.max(this.$body[0].scrollHeight,document.documentElement.scrollHeight)},b.prototype.refresh=function(){var b=this,c="offset",d=0;this.offsets=[],this.targets=[],this.scrollHeight=this.getScrollHeight(),a.isWindow(this.$scrollElement[0])||(c="position",d=this.$scrollElement.scrollTop()),this.$body.find(this.selector).map(function(){var b=a(this),e=b.data("target")||b.attr("href"),f=/^#./.test(e)&&a(e);return f&&f.length&&f.is(":visible")&&[[f[c]().top+d,e]]||null}).sort(function(a,b){return a[0]-b[0]}).each(function(){b.offsets.push(this[0]),b.targets.push(this[1])})},b.prototype.process=function(){var a,b=this.$scrollElement.scrollTop()+this.options.offset,c=this.getScrollHeight(),d=this.options.offset+c-this.$scrollElement.height(),e=this.offsets,f=this.targets,g=this.activeTarget;if(this.scrollHeight!=c&&this.refresh(),b>=d)return g!=(a=f[f.length-1])&&this.activate(a);if(g&&b<e[0])return this.activeTarget=null,this.clear();for(a=e.length;a--;)g!=f[a]&&b>=e[a]&&(void 0===e[a+1]||b<e[a+1])&&this.activate(f[a])},b.prototype.activate=function(b){this.activeTarget=b,this.clear();var c=this.selector+'[data-target="'+b+'"],'+this.selector+'[href="'+b+'"]',d=a(c).parents("li").addClass("active");
vendor: 2,455 bytes, lines 3507-3508
3507
3508d.parent(".dropdown-menu").length&&(d=d.closest("li.dropdown").addClass("active")),d.trigger("activate.bs.scrollspy")},b.prototype.clear=function(){a(this.selector).parentsUntil(this.options.target,".active").removeClass("active")};var d=a.fn.scrollspy;a.fn.scrollspy=c,a.fn.scrollspy.Constructor=b,a.fn.scrollspy.noConflict=function(){return a.fn.scrollspy=d,this},a(window).on("load.bs.scrollspy.data-api",function(){a('[data-spy="scroll"]').each(function(){var b=a(this);c.call(b,b.data())})})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.tab");e||d.data("bs.tab",e=new c(this)),"string"==typeof b&&e[b]()})}var c=function(b){this.element=a(b)};c.VERSION="3.3.6",c.TRANSITION_DURATION=150,c.prototype.show=function(){var b=this.element,c=b.closest("ul:not(.dropdown-menu)"),d=b.data("target");if(d||(d=b.attr("href"),d=d&&d.replace(/.*(?=#[^\s]*$)/,"")),!b.parent("li").hasClass("active")){var e=c.find(".active:last a"),f=a.Event("hide.bs.tab",{relatedTarget:b[0]}),g=a.Event("show.bs.tab",{relatedTarget:e[0]});if(e.trigger(f),b.trigger(g),!g.isDefaultPrevented()&&!f.isDefaultPrevented()){var h=a(d);this.activate(b.closest("li"),c),this.activate(h,h.parent(),function(){e.trigger({type:"hidden.bs.tab",relatedTarget:b[0]}),b.trigger({type:"shown.bs.tab",relatedTarget:e[0]})})}}},c.prototype.activate=function(b,d,e){function f(){g.removeClass("active").find("> .dropdown-menu > .active").removeClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!1),b.addClass("active").find('[data-toggle="tab"]').attr("aria-expanded",!0),h?(b[0].offsetWidth,b.addClass("in")):b.removeClass("fade"),b.parent(".dropdown-menu").length&&b.closest("li.dropdown").addClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!0),e&&e()}var g=d.find("> .active"),h=e&&a.support.transition&&(g.length&&g.hasClass("fade")||!!d.find("> .fade").length);g.length&&h?g.one("bsTransitionEnd",f).emulateTransitionEnd(c.TRANSITION_DURATION):f(),g.removeClass("in")};var d=a.fn.tab;a.fn.tab=b,a.fn.tab.Constructor=c,a.fn.tab.noConflict=function(){return a.fn.tab=d,this};var e=function(c){c.preventDefault(),b.call(a(this),"show")};a(document).on("click.bs.tab.data-api",'[data-toggle="tab"]',e).on("click.bs.tab.data-api",'[data-toggle="pill"]',e)}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.affix"),f="object"==typeof b&&b;
vendor: 3,106 bytes, lines 3508-3536
3508e||d.data("bs.affix",e=new c(this,f)),"string"==typeof b&&e[b]()})}var c=function(b,d){this.options=a.extend({},c.DEFAULTS,d),this.$target=a(this.options.target).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(b),this.affixed=null,this.unpin=null,this.pinnedOffset=null,this.checkPosition()};c.VERSION="3.3.6",c.RESET="affix affix-top affix-bottom",c.DEFAULTS={offset:0,target:window},c.prototype.getState=function(a,b,c,d){var e=this.$target.scrollTop(),f=this.$element.offset(),g=this.$target.height();if(null!=c&&"top"==this.affixed)return c>e?"top":!1;if("bottom"==this.affixed)return null!=c?e+this.unpin<=f.top?!1:"bottom":a-d>=e+g?!1:"bottom";var h=null==this.affixed,i=h?e:f.top,j=h?g:b;return null!=c&&c>=e?"top":null!=d&&i+j>=a-d?"bottom":!1},c.prototype.getPinnedOffset=function(){if(this.pinnedOffset)return this.pinnedOffset;this.$element.removeClass(c.RESET).addClass("affix");var a=this.$target.scrollTop(),b=this.$element.offset();return this.pinnedOffset=b.top-a},c.prototype.checkPositionWithEventLoop=function(){setTimeout(a.proxy(this.checkPosition,this),1)},c.prototype.checkPosition=function(){if(this.$element.is(":visible")){var b=this.$element.height(),d=this.options.offset,e=d.top,f=d.bottom,g=Math.max(a(document).height(),a(document.body).height());"object"!=typeof d&&(f=e=d),"function"==typeof e&&(e=d.top(this.$element)),"function"==typeof f&&(f=d.bottom(this.$element));var h=this.getState(g,b,e,f);if(this.affixed!=h){null!=this.unpin&&this.$element.css("top","");var i="affix"+(h?"-"+h:""),j=a.Event(i+".bs.affix");if(this.$element.trigger(j),j.isDefaultPrevented())return;this.affixed=h,this.unpin="bottom"==h?this.getPinnedOffset():null,this.$element.removeClass(c.RESET).addClass(i).trigger(i.replace("affix","affixed")+".bs.affix")}"bottom"==h&&this.$element.offset({top:g-b-f})}};var d=a.fn.affix;a.fn.affix=b,a.fn.affix.Constructor=c,a.fn.affix.noConflict=function(){return a.fn.affix=d,this},a(window).on("load",function(){a('[data-spy="affix"]').each(function(){var c=a(this),d=c.data();d.offset=d.offset||{},null!=d.offsetBottom&&(d.offset.bottom=d.offsetBottom),null!=d.offsetTop&&(d.offset.top=d.offsetTop),b.call(c,d)})})}(jQuery);
3509
3510
3511function testTheiaStickySidebars() {
3512    var me = {};
3513    me.scrollTopStep = 1;
3514    me.currentScrollTop = 0;
3515    me.values = null;
3516
3517    window.scrollTo(0, 1);
3518    window.scrollTo(0, 0);
3519
3520    $(window).scroll(function(me) {
3521        return function(event) {
3522            var newValues = [];
3523            
3524            // Get sidebar offsets.
3525            $('.theiaStickySidebar').each(function() {
3526                newValues.push($(this).offset().top);
3527            });
3528            
3529            if (me.values != null) {
3530                var ok = true;
3531                
3532                for (var j = 0; j < newValues.length; j++) {
3533                    var diff = Math.abs(newValues[j] - me.values[j]);
3534                    if (diff > 1) {
3535                        ok = false;
3536                        
3537                        console.log('Offset difference for sidebar #' + (j + 1) + ' is ' + diff + 'px');
3538                        
3539                        // Highlight sidebar.
3540                        $($('.theiaStickySidebar')[j]).css('background', 'yellow');
3541                    }
3542                }
3543                
3544                if (ok == false) {                    
3545                    // Stop test.
3546                    $(this).unbind(event);
3547                    
3548                    alert('Bummer. Offset difference is bigger than 1px for some sidebars, which will be highlighted in yellow. Check the logs. Aborting.');
3549                    
3550                    return;
3551                }
3552            }
3553            
3554            me.values = newValues;
3555            
3556            // Scroll to bottom. We don't cache ($(document).height() - $(window).height()) since it may change (e.g. after images are loaded).
3557            if (me.currentScrollTop < ($(document).height() - $(window).height()) && me.scrollTopStep == 1) {
3558                me.currentScrollTop += me.scrollTopStep;
3559                window.scrollTo(0, me.currentScrollTop);
3560            }
3561            // Then back up.
3562            else if (me.currentScrollTop > 0) {
3563                me.scrollTopStep = -1;
3564                me.currentScrollTop += me.scrollTopStep;
3565                window.scrollTo(0, me.currentScrollTop);
3566            }
3567            // Then stop.
3568            else {                    
3569                $(this).unbind(event);
3570                
3571                alert("Great success!");
3572            }
3573        };
3574    }(me));
3575}
3576
3577
3578
3579
3580
3581/*!
3582 * Theia Sticky Sidebar v1.5.0
3583 * https://github.com/WeCodePixels/theia-sticky-sidebar
3584 *
3585 * Glues your website's sidebars, making them permanently visible while scrolling.
3586 *
3587 * Copyright 2013-2016 WeCodePixels and other contributors
3588 * Released under the MIT license
3589 */
3590
3591(function ($) {
3592    $.fn.theiaStickySidebar = function (options) {
3593        var defaults = {
3594            'containerSelector': '',
3595            'additionalMarginTop': 0,
3596            'additionalMarginBottom': 0,
3597            'updateSidebarHeight': true,
3598            'minWidth': 0,
3599            'disableOnResponsiveLayouts': true,
3600            'sidebarBehavior': 'modern'
3601        };
3602        options = $.extend(defaults, options);
3603
3604        // Validate options
3605        options.additionalMarginTop = parseInt(options.additionalMarginTop) || 0;
3606        options.additionalMarginBottom = parseInt(options.additionalMarginBottom) || 0;
3607
3608        tryInitOrHookIntoEvents(options, this);
3609
3610        // Try doing init, otherwise hook into window.resize and document.scroll and try again then.
3611        function tryInitOrHookIntoEvents(options, $that) {
3612            var success = tryInit(options, $that);
3613
3614            if (!success) {
3615                console.log('TSS: Body width smaller than options.minWidth. Init is delayed.');
3616
3617                $(document).scroll(function (options, $that) {
3618                    return function (evt) {
3619                        var success = tryInit(options, $that);
3620
3621                        if (success) {
3622                            $(this).unbind(evt);
3623                        }
3624                    };
3625                }(options, $that));
3626                $(window).resize(function (options, $that) {
3627                    return function (evt) {
3628                        var success = tryInit(options, $that);
3629
3630                        if (success) {
3631                            $(this).unbind(evt);
3632                        }
3633                    };
3634                }(options, $that))
3635            }
3636        }
3637
3638        // Try doing init if proper conditions are met.
3639        function tryInit(options, $that) {
3640            if (options.initialized === true) {
3641                return true;
3642            }
3643
3644            if ($('body').width() < options.minWidth) {
3645                return false;
3646            }
3647
3648            init(options, $that);
3649
3650            return true;
3651        }
3652
3653        // Init the sticky sidebar(s).
3654        function init(options, $that) {
3655            options.initialized = true;
3656
3657            // Add CSS
3658            $('head').append($('<style>.theiaStickySidebar:after {content: ""; display: table; clear: both;}</style>'));
3659
3660            $that.each(function () {
3661                var o = {};
3662
3663                o.sidebar = $(this);
3664
3665                // Save options
3666                o.options = options || {};
3667
3668                // Get container
3669                o.container = $(o.options.containerSelector);
3670                if (o.container.length == 0) {
3671                    o.container = o.sidebar.parent();
3672                }
3673
3674                // Create sticky sidebar
3675                o.sidebar.parents().css('-webkit-transform', 'none'); // Fix for WebKit bug - https://code.google.com/p/chromium/issues/detail?id=20574
3676                o.sidebar.css({
3677                    'position': 'relative',
3678                    'overflow': 'visible',
3679                    // The "box-sizing" must be set to "content-box" because we set a fixed height to this element when the sticky 
3679sidebar has a fixed position.
3680                    '-webkit-box-sizing': 'border-box',
3681                    '-moz-box-sizing': 'border-box',
3682                    'box-sizing': 'border-box'
3683                });
3684
3685                // Get the sticky sidebar element. If none has been found, then create one.
3686                o.stickySidebar = o.sidebar.find('.theiaStickySidebar');
3687                if (o.stickySidebar.length == 0) {
3688                    // Remove <script> tags, otherwise they will be run again when added to the stickySidebar.
3689                    var javaScriptMIMETypes = /(?:text|application)\/(?:x-)?(?:javascript|ecmascript)/i;
3690                    o.sidebar.find('script').filter(function(index, script) {
3691                        return script.type.length === 0 || script.type.match(javaScriptMIMETypes);
3692                    }).remove();
3693
3694                    o.stickySidebar = $('<div>').addClass('theiaStickySidebar').append(o.sidebar.children());
3695                    o.sidebar.append(o.stickySidebar);
3696                }
3697
3698                // Get existing top and bottom margins and paddings
3699                o.marginBottom = parseInt(o.sidebar.css('margin-bottom'));
3700                o.paddingTop = parseInt(o.sidebar.css('padding-top'));
3701                o.paddingBottom = parseInt(o.sidebar.css('padding-bottom'));
3702
3703                // Add a temporary padding rule to check for collapsable margins.
3704                var collapsedTopHeight = o.stickySidebar.offset().top;
3705                var collapsedBottomHeight = o.stickySidebar.outerHeight();
3706                o.stickySidebar.css('padding-top', 1);
3707                o.stickySidebar.css('padding-bottom', 1);
3708                collapsedTopHeight -= o.stickySidebar.offset().top;
3709                collapsedBottomHeight = o.stickySidebar.outerHeight() - collapsedBottomHeight - collapsedTopHeight;
3710                if (collapsedTopHeight == 0) {
3711                    o.stickySidebar.css('padding-top', 0);
3712                    o.stickySidebarPaddingTop = 0;
3713                }
3714                else {
3715                    o.stickySidebarPaddingTop = 1;
3716                }
3717
3718                if (collapsedBottomHeight == 0) {
3719                    o.stickySidebar.css('padding-bottom', 0);
3720                    o.stickySidebarPaddingBottom = 0;
3721                }
3722                else {
3723                    o.stickySidebarPaddingBottom = 1;
3724                }
3725
3726                // We use this to know whether the user is scrolling up or down.
3727                o.previousScrollTop = null;
3728
3729                // Scroll top (value) when the sidebar has fixed position.
3730                o.fixedScrollTop = 0;
3731
3732                // Set sidebar to default values.
3733                resetSidebar();
3734
3735                o.onScroll = function (o) {
3736                    // Stop if the sidebar isn't visible.
3737                    if (!o.stickySidebar.is(":visible")) {
3738                        return;
3739                    }
3740
3741                    // Stop if the window is too small.
3742                    if ($('body').width() < o.options.minWidth) {
3743                        resetSidebar();
3744                        return;
3745                    }
3746
3747                    // Stop if the sidebar width is larger than the container width (e.g. the theme is responsive and the sidebar is now below the content)
3748                    if (o.options.disableOnResponsiveLayouts) {
3749                        var sidebarWidth = o.sidebar.outerWidth(o.sidebar.css('float') == 'none');
3750
3751                        if (sidebarWidth + 50 > o.container.width()) {
3752                            resetSidebar();
3753                            return;
3754                        }
3755                    }
3756
3757                    var scrollTop = $(document).scrollTop();
3758                    var position = 'static';
3759
3760                    // If the user has scrolled down enough for the sidebar to be clipped at the top, then we can consider changing its position.
3761                    if (scrollTop >= o.sidebar.offset().top + (o.paddingTop - o.options.additionalMarginTop)) {
3762                        // The top and bottom offsets, used in various calculations.
3763                        var offsetTop = o.paddingTop + options.additionalMarginTop;
3764                        var offsetBottom = o.paddingBottom + o.marginBottom + options.additionalMarginBottom;
3765
3766                        // All top and bottom positions are relative to the window, not to the parent elemnts.
3767                        var containerTop = o.sidebar.offset().top;
3768                        var containerBottom = o.sidebar.offset().top + getClearedHeight(o.container);
3769
3770                        // The top and bottom offsets relative to the window screen top (zero) and bottom (window height).
3771                        var windowOffsetTop = 0 + options.additionalMarginTop;
3772                        var windowOffsetBottom;
3773
3774                        var sidebarSmallerThanWindow = (o.stickySidebar.outerHeight() + offsetTop + offsetBottom) < $(window).height();
3775                        if (sidebarSmallerThanWindow) {
3776                            windowOffsetBottom = windowOffsetTop + o.stickySidebar.outerHeight();
3777                        }
3778                        else {
3779                            windowOffsetBottom = $(window).height() - o.marginBottom - o.paddingBottom - options.additionalMarginBottom;
3780                        }
3781
3782                        var staticLimitTop = containerTop - scrollTop + o.paddingTop;
3783                        var staticLimitBottom = containerBottom - scrollTop - o.paddingBottom - o.marginBottom;
3784
3785                        var top = o.stickySidebar.offset().top - scrollTop;
3786                        var scrollTopDiff = o.previousScrollTop - scrollTop;
3787
3788                        // If the sidebar position is fixed, then it won't move up or down by itself. So, we manually adjust the top coordinate.
3789                        if (o.stickySidebar.css('position') == 'fixed') {
3790                            if (o.options.sidebarBehavior == 'modern') {
3791                                top += scrollTopDiff;
3792                            }
3793                        }
3794
3795                        if (o.options.sidebarBehavior == 'stick-to-top') {
3796                            top = options.additionalMarginTop;
3797                        }
3798
3799                        if (o.options.sidebarBehavior == 'stick-to-bottom') {
3800                            top = windowOffsetBottom - o.stickySidebar.outerHeight();
3801                        }
3802
3803                        if (scrollTopDiff > 0) { // If the user is scrolling up.
3804                            top = Math.min(top, windowOffsetTop);
3805                        }
3806                        else { // If the user is scrolling down.
3807                            top = Math.max(top, windowOffsetBottom - o.stickySidebar.outerHeight());
3808                        }
3809
3810                        top = Math.max(top, staticLimitTop);
3811
3812                        top = Math.min(top, staticLimitBottom - o.stickySidebar.outerHeight());
3813
3814                        // If the sidebar is the same height as the container, we won't use fixed positioning.
3815                        var sidebarSameHeightAsContainer = o.container.height() == o.stickySidebar.outerHeight();
3816
3817                        if (!sidebarSameHeightAsContainer && top == windowOffsetTop) {
3818                            position = 'fixed';
3819                        }
3820                        else if (!sidebarSameHeightAsContainer && top == windowOffsetBottom - o.stickySidebar.outerHeight()) {
3821                            position = 'fixed';
3822                        }
3823                        else if (scrollTop + top - o.sidebar.offset().top - o.paddingTop <= options.additionalMarginTop) {
3824                            // Stuck to the top of the page. No special behavior.
3825                            position = 'static';
3826                        }
3827                        else {
3828                            // Stuck to the bottom of the page.
3829                            position = 'absolute';
3830                        }
3831                    }
3832
3833                    /*
3834                     * Performance notice: It's OK to set these CSS values at each resize/scroll, even if they don't change.
3835                     * It's way slower to first check if the values have changed.
3836                     */
3837                    if (position == 'fixed') {
3838                        o.stickySidebar.css({
3839                            'position': 'fixed',
3840                            'width': getWidthForObject(o.stickySidebar) + 'px',
3841                            'transform': 'translateY(' + top + 'px)',
3842                            'left': (o.sidebar.offset().left + parseInt(o.sidebar.css('padding-left'))) + 'px',
3843                            'top': '0px'
3844                        });
3845                    }
3846                    else if (position == 'absolute') {
3847                        var css = {};
3848
3849                        if (o.stickySidebar.css('position') != 'absolute') {
3850                            css.position = 'absolute';
3851                            css.transform = 'translateY(' + (scrollTop + top - o.sidebar.offset().top - o.stickySidebarPaddingTop - o.stickySidebarPaddingBottom) + 'px)';
3852                            css.top = '0px';
3853                        }
3854
3855                        css.width = getWidthForObject(o.stickySidebar) + 'px';
3856                        css.left = '';
3857
3858                        o.stickySidebar.css(css);
3859                    }
3860                    else if (position == 'static') {
3861                        resetSidebar();
3862                    }
3863
3864                    if (position != 'static') {
3865                        if (o.options.updateSidebarHeight == true) {
3866                            o.sidebar.css({
3867                                'min-height': o.stickySidebar.outerHeight() + o.stickySidebar.offset().top - o.sidebar.offset().top + o.paddingBottom
3868                            });
3869                        }
3870                    }
3871
3872                    o.previousScrollTop = scrollTop;
3873                };
3874
3875                // Initialize the sidebar's position.
3876                o.onScroll(o);
3877
3878                // Recalculate the sidebar's position on every scroll and resize.
3879                $(document).scroll(function (o) {
3880                    return function () {
3881                        o.onScroll(o);
3882                    };
3883                }(o));
3884                $(window).resize(function (o) {
3885                    return function () {
3886                        o.stickySidebar.css({'position': 'static'});
3887                        o.onScroll(o);
3888                    };
3889                }(o));
3890
3891                // Reset the sidebar to its default state
3892                function resetSidebar() {
3893                    o.fixedScrollTop = 0;
3894                    o.sidebar.css({
3895                        'min-height': '1px'
3896                    });
3897                    o.stickySidebar.css({
3898                        'position': 'static',
3899                        'width': '',
3900                        'transform': 'none'
3901                    });
3902                }
3903
3904                // Get the height of a div as if its floated children were cleared. Note that this function fails if the floats are more than one level deep.
3905                function getClearedHeight(e) {
3906                    var height = e.height();
3907
3908                    e.children().each(function () {
3909                        height = Math.max(height, $(this).height());
3910                    });
3911
3912                    return height;
3913                }
3914            });
3915        }
3916        
3917        function getWidthForObject(object) {
3918            var width;
3919            
3920            try {
3921                width = object[0].getBoundingClientRect().width;
3922            }
3923            catch(err) {
3924            }
3925            
3926            if (typeof width === "undefined") {
3927                width = object.width();
3928            }
3929            
3930            return width;
3931        }
3932    }
3933})(jQuery);
3934
3935
3936
3937
3938!function(a,b,c,d){var e={verticalScrolling:!0,horizontalScrolling:!1,verticalScrollerSide:"right",showOnHover:!1,scrollIncrement:20,minScrollbarLength:40,pollChanges:!0,drawCorner:!0,drawScrollButtons:!1,clickTrackToScroll:!0,easingDuration:500,propagateWheelEvent:!0,verticalTrackClass:"vertical-track",horizontalTrackClass:"horizontal-track",horizontalHandleClass:"horizontal-handle",verticalHandleClass:"vertical-handle",scrollUpButtonClass:"scroll-up-btn",scrollDownButtonClass:"scroll-down-btn",scrollLeftButtonClass:"scroll-left-btn",scrollRightButtonClass:"scroll-right-btn",cornerClass:"scrollbar-corner",zIndex:1,addPaddingToPane:!0,horizontalHandleHTML:'<div class="left"></div><div class="right"></div>',verticalHandleHTML:'<div class="top"></div><div class="bottom"></div>'},f=function(a){a.preventDefault?a.preventDefault():a.returnValue=!1,a.stopPropagation?a.stopPropagation():a.cancelBubble=!0},g=b.requestAnimationFrame||b.mozRequestAnimationFrame||b.webkitRequestAnimationFrame||b.oRequestAnimationFrame||b.msRequestAnimationFrame||function(a){setTimeout(a,17)},h=function(b,c){var d=a(b).css(c),e=/^-?\d+/.exec(d);return e?+e[0]:0},i=function(a){var b,c,d={width:"5px",height:"1px",overflow:"hidden",padding:"8px 0",visibility:"hidden",
3938whiteSpace:"pre-line",font:"10px/1 serif"},e=document.createElement(a),f=document.createTextNode("a\na");for(c in d)e.style[c]=d[c];return e.appendChild(f),document.body.appendChild(e),b=e.scrollHeight<28,document.body.removeChild(e),b},j=.5*Math.PI,k=10*Math.log(2),l=function(a,b,c){var d=j/b,e=a*d;return Math.round(e*Math.cos(d*c))},m=function(a,b,c){return Math.round(a*k*Math.pow(2,-10*c/b+1)/b)},n=function(a,b,c,d){return 2*c/Math.PI*Math.asin((d-a)/b)},o=function(b){var c=a(this).data("enscroll"),d=this,e=c.settings,f=function(){var b=a(this).data("enscroll"),c=b.settings;b&&c.showOnHover&&(c.verticalScrolling&&a(b.verticalTrackWrapper).is(":visible")&&a(b.verticalTrackWrapper).stop().fadeTo(275,0),c.horizontalScrolling&&a(b.horizontalTrackWrapper).is(":visible")&&a(b.horizontalTrackWrapper).stop().fadeTo(275,0),b._fadeTimer=null)};c&&e.showOnHover&&(c._fadeTimer?clearTimeout(c._fadeTimer):(e.verticalScrolling&&a(c.verticalTrackWrapper).is(":visible")&&a(c.verticalTrackWrapper).stop().fadeTo(275,1),e.horizontalScrolling&&a(c.horizontalTrackWrapper).is(":visible")&&a(c.horizontalTrackWrapper).stop().fadeTo(275,1)),b!==!1&&(c._fadeTimer=setTimeout(function(){f.call(d)},1750)))},p=function(b,c){var d=a(b),e=d.data("enscroll"),f=d.scrollTop();e&&e.settings.verticalScrolling&&(d.scrollTop(f+c),e.settings.showOnHover&&o.call(b))},q=function(b,c){var d=a(b),e=d.data("enscroll"),f=d.scrollLeft();e&&e.settings.horizontalScrolling&&(d.scrollLeft(f+c),e.settings.showOnHover&&o.call(b))},r=function(b){if(1===b.which){var d,e,f,h,i,j,k,l,m,n=b.data.pane,p=a(n),q=p.data("enscroll"),r=!0,s=function(){r&&(f!==h&&(q._scrollingY||(q._scrollingY=!0,q._startY=p.scrollTop(),g(function(){t(p)})),e.style.top=f+"px",q._endY=f*m/l,h=f),g(s),q.settings.showOnHover&&o.call(n))},u=function(a){return r&&(f=a.clientY-j-i,f=Math.min(0>f?0:f,l)),!1},v=function(){return r=!1,c.body.style.cursor=k,this.style.cursor="",d.removeClass("dragging"),a(c.body).off("mousemove.enscroll.vertical").off("mouseup.enscroll.vertical"),a(c).off("mouseout.enscroll.vertical"),p.on("scroll.enscroll.pane",function(a){x.call(this,a)}),!1};return d=a(q.verticalTrackWrapper).find(".enscroll-track"),e=d.children().first()[0],f=parseInt(e.style.top,10),m=n.scrollHeight-(q._scrollHeightNoPadding?a(n).height():a(n).innerHeight()),i=b.clientY-a(e).offset().top,l=d.height()-a(e).outerHeight(),j=d.offset().top,p.off("scroll.enscroll.pane"),a(c.body).on({"mousemove.enscroll.vertical":u,"mouseup.enscroll.vertical":function(a){v.call(e,a)}}),a(c).on("mouseout.enscroll.vertical",function(a){a.target.nodeName&&"HTML"===a.target.nodeName.toUpperCase()&&v.call(e,a)}),d.hasClass("dragging")||(d.addClass("dragging"),k=a(c.body).css("cursor"),this.style.cursor=c.body.style.cursor="grab"),g(s),!1}},s=function(b){if(1===b.which){var d,e,f,h,i,j,k,l,m,n=b.data.pane,p=a(n),q=a(n).data("enscroll"),r=!0,s=function(){r&&(f!==h&&(q._scrollingX||(q._scrollingX=!0,q._startX=p.scrollLeft(),g(function(){t(p)})),e.style.left=f+"px",q._endX=f*i/m,h=f),g(s),q.settings.showOnHover&&o.call(n))},u=function(a){return r&&(f=a.clientX-k-j,f=Math.min(0>f?0:f,m)),!1},v=function(){return r=!1,d.removeClass("dragging"),c.body.style.cursor=l,this.style.cursor="",d.removeClass("dragging"),a(c.body).off("mousemove.enscroll.horizontal").off("mouseup.enscroll.horizontal"),a(c).off("mouseout.enscroll.horizontal"),p.on("scroll.enscroll.pane",function(a){x.call(this,a)}),!1};return d=a(q.horizontalTrackWrapper).find(".enscroll-track"),e=d.children().first()[0],f=parseInt(e.style.left,10),i=n.scrollWidth-a(n).innerWidth(),j=b.clientX-a(e).offset().left,m=d.width()-a(e).outerWidth(),k=d.offset().left,p.off("scroll.enscroll.pane"),a(c.body).on({"mousemove.enscroll.horizontal":u,"mouseup.enscroll.horizontal":function(a){v.call(e,a)}}),a(c).on("mouseout.enscroll.horizontal",function(a){a.target.nodeName&&"HTML"===a.target.nodeName.toUpperCase()&&v.call(e,a)}),d.hasClass("dragging")||(d.addClass("dragging"),l=a("body").css("cursor"),this.style.cursor=c.body.style.cursor="grab"),g(s),!1}},t=function(a){var b,c,d,e=a.data("enscroll"),f=e._duration;e._scrollingX===!0&&(b=e._endX-e._startX,0===b?e._scrollingX=!1:(c=a.scrollLeft(),d=n(e._startX,b,f,c),b>0?c>=e._endX||c<e._startX?e._scrollingX=!1:(q(a,Math.max(1,l(b,f,d))),g(function(){t(a)})):c<=e._endX||c>e._startX?e._scrollingX=!1:(q(a,Math.min(-1,l(b,f,d))),g(function(){t(a)})))),e._scrollingY===!0&&(b=e._endY-e._startY,0===b?e._scrollingY=!1:(c=a.scrollTop(),d=n(e._startY,b,f,c),b>0?c>=e._endY||c<e._startY?e._scrollingY=!1:(p(a,Math.max(1,l(b,f,d))),g(function(){t(a)})):c<=e._endY||c>e._startY?e._scrollingY=!1:(p(a,Math.min(-1,l(b,f,d))),g(function(){t(a)}))))},u=function(a,b){var c=a.data("enscroll"),d=a.scrollLeft(),e=a[0].scrollWidth-a.innerWidth();return!c.settings.horizontalScrolling||c._scrollingY?!1:(c._scrollingX||(c._scrollingX=!0,c._startX=d,c._endX=c._startX,g(function(){t(a)})),c._endX=b>0?Math.min(d+b,e):Math.max(0,d+b),0>b&&d>0||b>0&&e>d)},v=function(a,b){var c=a.data("enscroll"),d=a.scrollTop(),e=a[0].scrollHeight-(c._scrollHeightNoPadding?a.height():a.innerHeight());return!c.settings.verticalScrolling||c._scrollingX?!1:(c._scrollingY||(c._scrollingY=!0,c._startY=d,c._endY=c._startY,g(function(){t(a)})),c._endY=b>0?Math.min(d+b,e):Math.max(0,d+b),0>b&&d>0||b>0&&e>d)},w=function(b){var c,d=a(this),e=d.data("enscroll"),g=e.settings.scrollIncrement,h="deltaX"in b?-b.deltaX:"wheelDeltaX"in b?b.wheelDeltaX:0,i="deltaY"in b?-b.deltaY:"wheelDeltaY"in b?b.wheelDeltaY:"wheelDelta"in b?b.wheelDelta:0;Math.abs(h)>Math.abs(i)?(c=(h>0?-g:g)<<2,(u(d,c)||!e.settings.propagateWheelEvent)&&f(b)):(c=(i>0?-g:g)<<2,(v(d,c)||!e.settings.propagateWheelEvent)&&f(b))},x=function(){var b,c,d,e=a(this),f=e.data("enscroll");f&&(f.settings.verticalScrolling&&(c=a(f.verticalTrackWrapper).find(".enscroll-track")[0],b=c.firstChild,d=e.scrollTop()/(this.scrollHeight-(f._scrollHeightNoPadding?e.height():e.innerHe
3938ight())),d=isNaN(d)?0:d,b.style.top=d*(a(c).height()-a(b).outerHeight())+"px"),f.settings.horizontalScrolling&&(c=a(f.horizontalTrackWrapper).find(".enscroll-track")[0],b=c.firstChild,d=e.scrollLeft()/(this.scrollWidth-e.innerWidth()),d=isNaN(d)?0:d,b.style.left=d*(a(c).width()-a(b).innerWidth())+"px"))},y=function(b){var c,d=a(this),e=d.data("enscroll");if(!/(input)|(select)|(textarea)/i.test(this.nodeName)&&b.target===this&&e){switch(c=e.settings.scrollIncrement,b.keyCode){case 32:case 34:return v(d,d.height()),!1;case 33:return v(d,-d.height()),!1;case 35:return v(d,this.scrollHeight),!1;case 36:return v(d,-this.scrollHeight),!1;case 37:return u(d,-c),!1;case 38:return v(d,-c),!1;case 39:return u(d,c),!1;case 40:return v(d,c),!1}return!0}},z=function(){var b=this,d=a(b).data("enscroll").settings,e=!0,f=0,h=0,i=a(b).offset().top,j=i+a(b).outerHeight(),k=a(b).offset().left,l=k+a(b).outerWidth(),m=function(a){var b=a.pageX,c=a.pageY;f=k>b?b-k:b>l?b-l:0,h=i>c?c-i:c>j?c-j:0},n=function(){d.horizontalScrolling&&f&&q(b,parseInt(f/4,10)),d.verticalScrolling&&h&&p(b,parseInt(h/4,10)),e&&g(n)},o=function(){e=!1,a(c).off("mousemove.enscroll.pane").off("mouseup.enscroll.pane")};g(n),a(c).on({"mousemove.enscroll.pane":m,"mouseup.enscroll.pane":o})},A=function(a){var b,c,e,h,i,j,k,l=this,n=function(a){b=a.touches[0].clientX,c=a.touches[0].clientY,e||(e=c===i&&b===h?d:Math.abs(i-c)>Math.abs(h-b)?"y":"x"),f(a)},o=function(){j&&("y"===e?(p(l,i-c),k=i-c,i=c):"x"===e&&(q(l,h-b),k=h-b,h=b),g(o))},r=function(){var a=0,b=Math.abs(1.5*k);this.removeEventListener("touchmove",n,!1),this.removeEventListener("touchend",r,!1),j=!1,g(function c(){var d;a===b||j||(d=m(k,b,a),isNaN(d)||0===d||(a+=1,"y"===e?p(l,d):q(l,d),g(c)))})};1===a.touches.length&&(h=a.touches[0].clientX,i=a.touches[0].clientY,j=!0,this.addEventListener("touchmove",n,!1),this.addEventListener("touchend",r,!1),g(o))},B={reposition:function(){return this.each(function(){var b,c,d,e=a(this),f=e.data("enscroll"),g=function(a,b,c){a.style.left=b+"px",a.style.top=c+"px"};f&&(d=e.position(),b=f.corner,f.settings.verticalScrolling&&(c=f.verticalTrackWrapper,g(c,"right"===f.settings.verticalScrollerSide?d.left+e.outerWidth()-a(c).width()-h(this,"border-right-width"):d.left+h(this,"border-left-width"),d.top+h(this,"border-top-width"))),f.settings.horizontalScrolling&&(c=f.horizontalTrackWrapper,g(c,d.left+h(this,"border-left-width"),d.top+e.outerHeight()-a(c).height()-h(this,"border-bottom-width"))),b&&g(b,d.left+e.outerWidth()-a(b).outerWidth()-h(this,"border-right-width"),d.top+e.outerHeight()-a(b).outerHeight()-h(this,"border-bottom-width")))})},resize:function(){return this.each(function(){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r=a(this),s=r.data("enscroll");return s?(b=s.settings,void(r.is(":visible")?(b.verticalScrolling&&(e=s.verticalTrackWrapper,c=r.innerHeight(),f=c/this.scrollHeight,g=a(e).find(".enscroll-track")[0],j=a(e).find("."+b.scrollUpButtonClass),k=a(e).find("."+b.scrollDownButtonClass),i=b.horizontalScrolling?c-a(s.horizontalTrackWrapper).find(".enscroll-track").outerHeight():c,i-=a(g).outerHeight()-a(g).height()+j.outerHeight()+k.outerHeight(),n=g.firstChild,p=Math.max(f*i,b.minScrollbarLength),p-=a(n).outerHeight()-a(n).height(),e.style.display="none",g.style.height=i+"px",n.style.height=p+"px",1>f&&(f=r.scrollTop()/(this.scrollHeight-r.height()),n.style.top=f*(i-p)+"px",e.style.display="block")),b.horizontalScrolling&&(e=s.horizontalTrackWrapper,d=r.innerWidth(),f=d/this.scrollWidth,g=a(e).find(".enscroll-track")[0],l=a(e).find("."+b.scrollLeftButtonClass),m=a(e).find("."+b.scrollRightButtonClass),h=b.verticalScrolling?d-a(s.verticalTrackWrapper).find(".enscroll-track").outerWidth():d,h-=a(g).outerWidth()-a(g).width()+l.outerWidth()+m.outerWidth(),n=g.firstChild,o=Math.max(f*h,b.minScrollbarLength),o-=a(n).outerWidth()-a(n).width(),e.style.display="none",g.style.width=h+"px",n.style.width=o+"px",1>f&&(f=r.scrollLeft()/(this.scrollWidth-r.width()),n.style.left=f*(h-o)+"px",e.style.display="block"),s._prybar&&(q=s._prybar,this.removeChild(q),b.verticalScrolling&&(q.style.width=this.scrollWidth+a(s.verticalTrackWrapper).find(".enscroll-track").outerWidth()+"px",this.appendChild(q)))),s.corner&&(s.corner.style.display=s.verticalTrackWrapper&&s.horizontalTrackWrapper&&a(s.verticalTrackWrapper).is(":visible")&&a(s.horizontalTrackWrapper).is(":visible")?""
3938:"none")):(b.verticalScrolling&&(s.verticalTrackWrapper.style.display="none"),b.horizontalScrolling&&(s.horizontalTrackWrapper.style.display="none"),s.corner&&(s.corner.style.display="none")))):!0})},startPolling:function(){return this.each(function(){var b,c=a(this).data("enscroll"),d=this,e=a(d),f=-1,g=-1,h=-1,i=-1,j=function(){if(c.settings.pollChanges){var a=d.scrollWidth,k=d.scrollHeight,l=e.width(),m=e.height(),n=e.offset();(c.settings.verticalScrolling&&(m!==g||k!==i)||c.settings.horizontalScrolling&&(l!==f||a!==h))&&(h=a,i=k,B.resize.call(e)),(b.left!==n.left||b.top!==n.top||l!==f||m!==g)&&(b=n,f=l,g=m,B.reposition.call(e)),setTimeout(j,350)}};c&&(c.settings.pollChanges=!0,i=d.scrollHeight,h=d.scrollWidth,b=e.offset(),j())})},stopPolling:function(){return this.each(function(){var b=a(this).data("enscroll");b&&(b.settings.pollChanges=!1)})},destroy:function(){return this.each(function(){var c,d,e=a(this),f=e.data("enscroll");f&&(B.stopPolling.call(e),d=f._mouseScrollHandler,f.settings.verticalScrolling&&(c=f.verticalTrackWrapper,a(c).remove(),c=null),f.settings.horizontalScrolling&&(c=f.horizontalTrackWrapper,a(c).remove(),c=null),f._fadeTimer&&clearTimeout(f._fadeTimer),f.corner&&a(f.corner).remove(),f._prybar&&f._prybar.parentNode&&f._prybar.parentNode===this&&a(f._prybar).remove(),this.setAttribute("style",f._style||""),f._hadTabIndex||e.removeAttr("tabindex"),e.off("scroll.enscroll.pane").off("keydown.enscroll.pane").off("mouseenter.enscroll.pane").off("mousedown.enscroll.pane").data("enscroll",null),this.removeEventListener?(this.removeEventListener("wheel",d,!1),this.removeEventListener("mousewheel",d,!1),this.removeEventListener("touchstart",A,!1)):this.detachEvent&&this.detachEvent("onmousewheel",d),a(b).off("resize.enscroll.window"))})}};a.fn.enscroll=function(d){var f;return B[d]?B[d].call(this):(f=a.extend({},e,d),this.each(function(){if(f.verticalScrolling||f.horizontalScrolling){var d,e,g,j,k,l,m,n,t,C,D,E,F,G,H,I,J,K,L=a(this),M=this,N=L.attr("style"),O=!0,P={position:"absolute","z-index":f.zIndex,margin:0,padding:0},Q=function(a){w.call(M,a)},R=function(b,c){"string"==typeof c?a(b).html(c):b.appendChild(c)};if(f.verticalScrolling){e=c.createElement("div"),j=c.createElement("div"),l=c.createElement("a"),a(j).css("position","relative").addClass("enscroll-track").addClass(f.verticalTrackClass).appendTo(e),f.drawScrollButtons&&(m=c.createElement("a"),n=c.createElement("a"),a(m).css({display:"block","text-decoration":"none"}).attr("href","").html("&nbsp;").addClass(f.scrollUpButtonClass).on("click",function(){return p(M,-f.scrollIncrement),!1}).insertBefore(j),a(n).css({display:"block","text-decoration":"none"}).attr("href","").html("&nbsp;").on("click",function(){return p(M,f.scrollIncrement),!1}).addClass(f.scrollDownButtonClass).appendTo(e)),f.clickTrackToScroll&&a(j).on("click",function(b){b.target===this&&v(L,b.pageY>a(l).offset().top?L.height():-L.height())}),a(l).css({position:"absolute","z-index":1}).attr("href","").addClass(f.verticalHandleClass).mousedown({pane:this},r).click(function(){return!1}).appendTo(j),R(l,f.verticalHandleHTML),a(e).css(P).insertAfter(this),f.showOnHover&&a(e).css("opacity",0).on("mouseover.enscroll.vertical",function(){o.call(M,!1)}).on("mouseout.enscroll.vertical",function(){o.call(M)}),E=a(j).outerWidth(),f.addPaddingToPane&&(K="right"===f.verticalScrollerSide?{"padding-right":h(this,"padding-right")+E+"px"}:{"padding-left":h(this,"padding-left")+E+"px"},L.css(a.extend({width:L.width()-E+"px"},K)));try{I=parseInt(L.css("outline-width"),10),0!==I&&!isNaN(I)||"none"!==L.css("outline-style")||L.css("outline","none")}catch(S){L.css("outline","none")}}f.horizontalScrolling&&(d=c.createElement("div"),g=c.createElement("div"),k=c.createElement("a"),a(g).css({position:"relative","z-index":1}).addClass("enscroll-track").addClass(f.horizontalTrackClass).appendTo(d),f.drawScrollButtons&&(t=c.createElement("a"),C=c.createElement("a"),a(t).css("display","block").attr("href","").on("click",function(){return q(M,-f.scrollIncrement),!1}).addClass(f.scrollLeftButtonClass).insertBefore(g),a(C).css("display","block").attr("href","").on("click",function(){return q(M,f.scrollIncrement),!1}).addClass(f.scrollRightButtonClass).appendTo(d)),f.clickTrackToScroll&&a(g).on("click",function(b){b.target===this&&u(L,b.pageX>a(k).offset().left?L.width():-L.width())}),a(k).css({position:"absolute","z-index":1}).attr("href","").addClass(f.horizontalHandleClass).click(function(){return!1}).mousedown({pane:this},s).appendTo(g),R(k,f.horizontalHandleHTML),a(d).css(P).insertAfter(this),f.showOnHover&&a(d).css("opacity",0).on("mouseover.enscroll.horizontal",function(){o.call(M,!1)}).on("mouseout.enscroll.horizontal",function(){o.call(M)}),D=a(g).outerHeight(),f.addPaddingToPane&&L.css({height:L.height()-D+"px","padding-bottom":parseInt(L.css("padding-bottom"),10)+D+"px"}),f.verticalScrolling&&(J=document.createElement("div"),a(J).css({width:"1px",height:"1px",visibility:"hidden",padding:0,margin:"-1px"}).appendTo(this))),f.verticalScrolling&&f.horizontalScrolling&&f.drawCorner&&(F=c.createElement("div"),a(F).addClass(f.cornerClass).css(P).insertAfter(this)),H=L.attr("tabindex"),H||(L.attr("tabindex",0),O=!1);try{G=L.css("outline"),(!G||G.length<1)&&L.css("outline","none")}catch(S){L.css("outline","none")}L.on({"scroll.enscroll.pane":function(a){x.call(this,a)},"keydown.enscroll.pane":y,"mousedown.enscroll.pane":z}).css("overflow","hidden").data("enscroll",{settings:f,horizontalTrackWrapper:d,verticalTrackWrapper:e,corner:F,_prybar:J,_mouseScrollHandler:Q,_hadTabIndex:O,_style:N,_scrollingX:!1,_scrollingY:!1,_startX:0,_startY:0,_endX:0,_endY:0,_duration:parseInt(f.easingDuration/16.66666,10),_scrollHeightNoPadding:i(this.nodeName)}),a(b).on("resize.enscroll.window",function(){B.reposition.call(L)}),f.showOnHover&&L.on("mouseenter.enscroll.pane",function(){o.call(this)}),this.addEventListener?("onwheel"in this||"WheelEvent"in b&&navigator.userAgent.toLowerCase().indexOf("msie")>=0?this.addEventListener("wheel",Q,!1):"onmousewheel"in this&&this.addEventListener("mousewheel",Q,!1),this.addEventListener("touchstart",A,!1)):this.attachEvent&&this.attachEvent("onmousewheel",Q),f.pollChanges&&B.startPolling.call(L),B.resize.call(L),B.reposition.call(L)}}))}}(jQuery,window,document);
3939
3940/* hs;v,g */
3941jQuery(document).ready(function($){
3942
3943    $(window).scroll(function() {
3944        if ($(this).scrollTop() > 200) {
3945            $('.scrolltop').fadeIn(200);
3946        } else {
3947            $('.scrolltop').fadeOut(200);
3948        }
3949    });
3950    $('.scrolltop').click(function(event) {
3951        event.preventDefault();
3952        $('html, body').animate({
3953            scrollTop: 0
3954        }, 1000);
3955    });
3956    $(".navicon").click(function() {
3957        $(".menu ul").animate({
3958            marginRight: "0px"
3959        }, 200, "linear");
3960        runmenu = 1;
3961    });
3962    $(".navicon2,.bodydeactive").click(function() {
3963        $(".menu ul").animate({
3964            marginRight: "-162px"
3965        }, 200, "linear");
3966    });
3967    $(".navicon").click(function() {
3968        $(".bodydeactive").fadeIn(400), $(".menu").animate({
3969            marginRight: "0px"
3970        }, 200, "linear")
3971    });
3972    $(".navicon2,.bodydeactive").click(function() {
3973        $(".menu").animate({
3974            marginRight: "0px"
3975        }, 200, "linear"), $(".bodydeactive").fadeOut(400)
3976    });
3977    $('a.poplight[href^=#]').click(function() {
3978        var popID = $(this).attr('rel');
3979        var popURL = $(this).attr('href');
3980        var query = popURL.split('?');
3981        var dim = query[1].split('&');
3982        var popWidth = dim[0].split('=')[1];
3983        $('#' + popID).fadeIn().prepend('<div class="close"></div>');
3984        var popMargTop = ($('#' + popID).height() + 80) / 2;
3985        var popMargLeft = ($('#' + popID).width() + 80) / 2;
3986        $('#' + popID).css({
3987            'margin-top': -popMargTop,
3988            'margin-left': -popMargLeft
3989        });
3990        $('body').append('<div id="fade"></div>');
3991        $('#fade').css({
3992            'filter': 'alpha(opacity=80)'
3993        }).fadeIn();
3994        return false;
3995    });
3996    $('.close, #fade').live('click', function() {
3997        $('#fade , .popup').fadeOut(function() {
3998            $('#fade, .close').remove();
3999        });
4000        return false;
4001    });
4002    $('.text .body,.jarchives,.post .screenshot,.post .tag h3').enscroll({
4003        verticalScrollerSide: "left",
4004        showOnHover: true,
4005        verticalTrackClass: 'track',
4006        verticalHandleClass: 'handle'
4007    });
4008    window.setInterval(function() {
4009        $('.download .links .des small,.notification i').toggleClass('blink');
4010    }, 1000);
4011    $(".ntc").click(function() {
4012        $(".ntc i").fadeOut(300);
4013        $(".bodydeactive2").fadeIn(100);
4014        $(".notification .notbox").fadeIn(100).animate({
4015            marginTop: "25px"
4016        }, 10);
4017    });
4018    $(".bodydeactive2,.notbox .title .close").click(function() {
4019        $(".bodydeactive2").fadeOut(300);
4020        $(".notification .notbox").fadeOut(300).animate({
4021            marginTop: "10px"
4022        }, 0);
4023        $(".ntc i").fadeIn(350);
4024    });
4025});
4026
4027
4028/*! jQuery Migrate v1.4.1 | (c) jQuery Foundation and other contributors | jquery.org/license */
4029"undefined"==typeof jQuery.migrateMute&&(jQuery.migrateMute=!0),function(a,b,c){function d(c){var d=b.console;f[c]||(f[c]=!0,a.migrateWarnings.push(c),d&&d.warn&&!a.migrateMute&&(d.warn("JQMIGRATE: "+c),a.migrateTrace&&d.trace&&d.trace()))}function e(b,c,e,f){if(Object.defineProperty)try{return void Object.defineProperty(b,c,{configurable:!0,enumerable:!0,get:function(){return d(f),e},set:function(a){d(f),e=a}})}catch(g){}a._definePropertyBroken=!0,b[c]=e}a.migrateVersion="1.4.1";var f={};a.migrateWarnings=[],b.console&&b.console.log&&b.console.log("JQMIGRATE: Migrate is installed"+(a.migrateMute?"":" with logging active")+", version "+a.migrateVersion),a.migrateTrace===c&&(a.migrateTrace=!0),a.migrateReset=function(){f={},a.migrateWarnings.length=0},"BackCompat"===document.compatMode&&d("jQuery is not compatible with Quirks Mode");var g=a("<input/>",{size:1}).attr("size")&&a.attrFn,h=a.attr,i=a.attrHooks.value&&a.attrHooks.value.get||function(){return null},j=a.attrHooks.value&&a.attrHooks.value.set||function(){return c},k=/^(?:input|button)$/i,l=/^[238]$/,m=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,n=/^(?:checked|selected)$/i;e(a,"attrFn",g||{},"jQuery.attrFn is deprecated"),a.attr=function(b,e,f,i){var j=e.toLowerCase(),o=b&&b.nodeType;return i&&(h.length<4&&d("jQuery.fn.attr( props, pass ) is deprecated"),b&&!l.test(o)&&(g?e in g:a.isFunction(a.fn[e])))?a(b)[e](f):("type"===e&&f!==c&&k.test(b.nodeName)&&b.parentNode&&d("Can't change the 'type' of an input or button in IE 6/7/8"),!a.attrHooks[j]&&m.test(j)&&(a.attrHooks[j]={get:function(b,d){var e,f=a.prop(b,d);return f===!0||"boolean"!=typeof f&&(e=b.getAttributeNode(d))&&e.nodeValue!==!1?d.toLowerCase():c},set:function(b,c,d){var e;return c===!1?a.removeAttr(b,d):(e=a.propFix[d]||d,e in b&&(b[e]=!0),b.setAttribute(d,d.toLowerCase())),d}},n.test(j)&&d("jQuery.fn.attr('"+j+"') might use property instead of attribute")),h.call(a,b,e,f))},a.attrHooks.value={get:function(a,b){var c=(a.nodeName||"").toLowerCase();return"button"===c?i.apply(this,arguments):("input"!==c&&"option"!==c&&d("jQuery.fn.attr('value') no longer gets properties"),b in a?a.value:null)},set:function(a,b){var c=(a.nodeName||"").toLowerCase();return"button"===c?j.apply(this,arguments):("input"!==c&&"option"!==c&&d("jQuery.fn.attr('value', val) no longer sets properties"),void(a.value=b))}};var o,p,q=a.fn.init,r=a.find,s=a.parseJSON,t=/^\s*</,u=/\[(\s*[-\w]+\s*)([~|^$*]?=)\s*([-\w#]*?#[-\w#]*)\s*\]/,v=/\[(\s*[-\w]+\s*)([~|^$*]?=)\s*([-\w#]*?#[-\w#]*)\s*\]/g,w=/^([^<]*)(<[\w\W]+>)([^>]*)$/;a.fn.init=function(b,e,f){var g,h;return b&&"string"==typeof b&&!a.isPlainObject(e)&&(g=w.exec(a.trim(b)))&&g[0]&&(t.test(b)||d("$(html) HTML strings must start with '<' character"),g[3]&&d("$(html) HTML text after last tag is ignored"),"#"===g[0].charAt(0)&&(d("HTML string cannot start with a '#' character"),a.error("JQMIGRATE: Invalid selector string (XSS)")),e&&e.context&&e.context.nodeType&&(e=e.context),a.parseHTML)?q.call(this,a.parseHTML(g[2],e&&e.ownerDocument||e||document,!0),e,f):(h=q.apply(this,arguments),b&&b.selector!==c?(h.selector=b.selector,h.context=b.context):(h.selector="string"==typeof b?b:"",b&&(h.context=b.nodeType?b:e||document)),h)},a.fn.init.prototype=a.fn,a.find=function(a){var b=Array.prototype.slice.call(arguments);if("string"==typeof a&&u.test(a))try{document.querySelector(a)}catch(c){a=a.replace(v,function(a,b,c,d){return"["+b+c+'"'+d+'"]'});try{document.querySelector(a),d("Attribute selector with '#' must be quoted: "+b[0]),b[0]=a}catch(e){d("Attribute selector with '#' was not fixed: "+b[0])}}return r.apply(this,b)};var x;for(x in r)Object.prototype.hasOwnProperty.call(r,x)&&(a.find[x]=r[x]);a.parseJSON=function(a){return a?s.apply(this,arguments):(d("jQuery.parseJSON requires a valid JSON string"),null)},a.uaMatch=function(a){a=a.toLowerCase();var b=/(chrome)[ \/]([\w.]+)/.exec(a)||/(webkit)[ \/]([\w.]+)/.exec(a)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(a)||/(msie) ([\w.]+)/.exec(a)||a.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(a)||[];return{browser:b[1]||"",version:b[2]||"0"}},a.browser||(o=a.uaMatch(navigator.userAgent),p={},o.browser&&(p[o.browser]=!0,p.version=o.version),p.chrome?p.webkit=!0:p.webkit&&(p.safari=!0),a.browser=p),e(a,"browser",a.browser,"jQuery.browser is deprecated"),a.boxModel=a.support.boxModel="CSS1Compat"===document.compatMode,e(a,"boxModel",a.boxModel,"jQuery.boxModel is deprecated"),e(
4029a.support,"boxModel",a.support.boxModel,"jQuery.support.boxModel is deprecated"),a.sub=function(){function b(a,c){return new b.fn.init(a,c)}a.extend(!0,b,this),b.superclass=this,b.fn=b.prototype=this(),b.fn.constructor=b,b.sub=this.sub,b.fn.init=function(d,e){var f=a.fn.init.call(this,d,e,c);return f instanceof b?f:b(f)},b.fn.init.prototype=b.fn;var c=b(document);return d("jQuery.sub() is deprecated"),b},a.fn.size=function(){return d("jQuery.fn.size() is deprecated; use the .length property"),this.length};var y=!1;a.swap&&a.each(["height","width","reliableMarginRight"],function(b,c){var d=a.cssHooks[c]&&a.cssHooks[c].get;d&&(a.cssHooks[c].get=function(){var a;return y=!0,a=d.apply(this,arguments),y=!1,a})}),a.swap=function(a,b,c,e){var f,g,h={};y||d("jQuery.swap() is undocumented and deprecated");for(g in b)h[g]=a.style[g],a.style[g]=b[g];f=c.apply(a,e||[]);for(g in b)a.style[g]=h[g];return f},a.ajaxSetup({converters:{"text json":a.parseJSON}});var z=a.fn.data;a.fn.data=function(b){var e,f,g=this[0];return!g||"events"!==b||1!==arguments.length||(e=a.data(g,b),f=a._data(g,b),e!==c&&e!==f||f===c)?z.apply(this,arguments):(d("Use of jQuery.fn.data('events') is deprecated"),f)};var A=/\/(java|ecma)script/i;a.clean||(a.clean=function(b,c,e,f){c=c||document,c=!c.nodeType&&c[0]||c,c=c.ownerDocument||c,d("jQuery.clean() is deprecated");var g,h,i,j,k=[];if(a.merge(k,a.buildFragment(b,c).childNodes),e)for(i=function(a){return!a.type||A.test(a.type)?f?f.push(a.parentNode?a.parentNode.removeChild(a):a):e.appendChild(a):void 0},g=0;null!=(h=k[g]);g++)a.nodeName(h,"script")&&i(h)||(e.appendChild(h),"undefined"!=typeof h.getElementsByTagName&&(j=a.grep(a.merge([],h.getElementsByTagName("script")),i),k.splice.apply(k,[g+1,0].concat(j)),g+=j.length));return k});var B=a.event.add,C=a.event.remove,D=a.event.trigger,E=a.fn.toggle,F=a.fn.live,G=a.fn.die,H=a.fn.load,I="ajaxStart|ajaxStop|ajaxSend|ajaxComplete|ajaxError|ajaxSuccess",J=new RegExp("\\b(?:"+I+")\\b"),K=/(?:^|\s)hover(\.\S+|)\b/,L=function(b){return"string"!=typeof b||a.event.special.hover?b:(K.test(b)&&d("'hover' pseudo-event is deprecated, use 'mouseenter mouseleave'"),b&&b.replace(K,"mouseenter$1 mouseleave$1"))};a.event.props&&"attrChange"!==a.event.props[0]&&a.event.props.unshift("attrChange","attrName","relatedNode","srcElement"),a.event.dispatch&&e(a.event,"handle",a.event.dispatch,"jQuery.event.handle is undocumented and deprecated"),a.event.add=function(a,b,c,e,f){a!==document&&J.test(b)&&d("AJAX events should be attached to document: "+b),B.call(this,a,L(b||""),c,e,f)},a.event.remove=function(a,b,c,d,e){C.call(this,a,L(b)||"",c,d,e)},a.each(["load","unload","error"],function(b,c){a.fn[c]=function(){var a=Array.prototype.slice.call(arguments,0);return"load"===c&&"string"==typeof a[0]?H.apply(this,a):(d("jQuery.fn."+c+"() is deprecated"),a.splice(0,0,c),arguments.length?this.bind.apply(this,a):(this.triggerHandler.apply(this,a),this))}}),a.fn.toggle=function(b,c){if(!a.isFunction(b)||!a.isFunction(c))return E.apply(this,arguments);d("jQuery.fn.toggle(handler, handler...) is deprecated");var e=arguments,f=b.guid||a.guid++,g=0,h=function(c){var d=(a._data(this,"lastToggle"+b.guid)||0)%g;return a._data(this,"lastToggle"+b.guid,d+1),c.preventDefault(),e[d].apply(this,arguments)||!1};for(h.guid=f;g<e.length;)e[g++].guid=f;return this.click(h)},a.fn.live=function(b,c,e){return d("jQuery.fn.live() is deprecated"),F?F.apply(this,arguments):(a(this.context).on(b,this.selector,c,e),this)},a.fn.die=function(b,c){return d("jQuery.fn.die() is deprecated"),G?G.apply(this,arguments):(a(this.context).off(b,this.selector||"**",c),this)},a.event.trigger=function(a,b,c,e){return c||J.test(a)||d("Global events are undocumented and deprecated"),D.call(this,a,b,c||document,e)},a.each(I.split("|"),function(b,c){a.event.special[c]={setup:function(){var b=this;return b!==document&&(a.event.add(document,c+"."+a.guid,function(){a.event.trigger(c,Array.prototype.slice.call(arguments,1),b,!0)}),a._data(this,c,a.guid++)),!1},teardown:function(){return this!==document&&a.event.remove(document,c+"."+a._data(this,c)),!1}}}),a.event.special.ready={setup:function(){this===document&&d("'ready' event is deprecated")}};var M=a.fn.andSelf||a.fn.addBack,N=a.fn.find;if(a.fn.andSelf=function(){return d("jQuery.fn.andSelf() replaced by jQuery.fn.addBack()"),M.apply(this,arguments)},a.fn.find=function(a){var b=N.apply(this,arguments);return b.context=this.context,b.selector=this.selector?this.selector+" "+a:a,b},a.Callbacks){var O=a.Deferred,P=[["resolve","done",a.Callbacks("once memory"),a.Callbacks("once memory"),"resolved"],["reject","fail",a.Callbacks("once memory"),a.Callbacks("once memory"),"rejected"],["notify","progress",a.Callbacks("memory"),a.Callbacks("memory")]];a.Deferred=function(b){var c=O(),e=c.promise();return c.pipe=e.pipe=function(){var b=arguments;return d("deferred.pipe() is deprecated"),a.Deferred(function(d){a.each(P,function(f,g){var h=a.isFunction(b[f])&&b[f];c[g[1]](function(){var b=h&&h.apply(this,arguments);b&&a.isFunction(b.promise)?b.promise().done(d.resolve).fail(d.reject).progress(d.notify):d[g[0]+"With"](this===e?d.promise():this,h?[b]:arguments)})}),b=null}).promise()},c.isResolved=function(){return d("deferred.isResolved is deprecated"),"resolved"===c.state()},c.isRejected=function(){return d("deferred.isRejected is deprecated"),"rejected"===c.state()},b&&b.call(c,c),c}}}(jQuery,window);
4030
4031
4032
4033
4034
4035	 $(".custom_load *").click(function() {
4036        return (false);
4037    });
4038
4039	 $(document).ready(function() {
4040                $('.province path').click(function() {
4041                    var province = $(this).attr('class');
4042                    var provinceName = $(this).attr('data-title');
4043                 	$('.province path').attr('data-active','');
4044					$(this).attr('data-active','active');
4045                });			
4046	 
4047	 
4048	 $("#menu-risponsive").prepend('<span class="fa fa-close" id="menu-close"></span> <h2>::</h2>');
4049     $tci = 1;
4050				$("#lay").click(function() {
4051					if($(".null").html()==null){
4052						$("#lay").hide();
4053                    $(".img").fadeOut("fast");
4054                    $(this).fadeOut("fast");
4055                    $("#tag").attr("autoplay","");
4056				}
4057                });
4058					
4059            $(".main-menu li.menu-item-has-children span.sub-arrow").click(function() {
4060                if($(this).text()=="+"){
4061                    $(this).addClass("rotatee");
4062                    $(this).text("-");
4063                }else if($(this).text()=="-"){
4064                    $(this).removeClass("rotatee");
4065                    $(this).text("+");
4066                }
4067
4068            });
4069
4070
4071            $("	#menu-risponsive li ul").hide();
4072     $("#menu-risponsive li.menu-item-has-children").prepend("<span class='arrow-nav-c'><i class='fa fa-plus' aria-hidden='true'></i></div>");
4073            $("#menu-risponsive li.menu-item-has-children span.arrow-nav-c").click(function() {
4074                $(this).next("a").next("ul").slideToggle('fast');
4075                if($(this).children("i").hasClass("fa-plus")){
4076                    $(this).children("i").removeClass("fa-plus");
4077                    $(this).children("i").addClass("fa-minus");
4078                }else{
4079                    $(this).children("i").addClass("fa-plus");
4080                    $(this).children("i").removeClass("fa-minus");
4081                }
4082            });
4083            $("#menu-close").click(function() {
4084				$(".bg-null").fadeOut("fast");
4085                    $("#menu-risponsive").toggleClass("menu-hidden");
4086                });
4087				$(".bg-null").click(function() {
4088				$(this).fadeOut("fast");
4089                    $("#menu-risponsive").toggleClass("menu-hidden");
4090                });
4091				$(".navbar-c-toggle").click(function() {
4092				$(".bg-null").fadeIn("fast");
4093                   $("#menu-risponsive").toggleClass("menu-hidden");
4094
4095                });
4096
4097
4098				$(".res-select-menu").change(function() {
4099                    window.location.href=$(this).val();
4100                });
4101				
4102		   });
4103
4104/*var xx = $(".main-menu .navbar-c-toggle").offset();
4105
4106jQuery(window).scroll(function(){
4107    if(jQuery(this).scrollTop() > xx.top){
4108        jQuery(".main-menu .navbar-c-toggle").addClass("fixednav");
4109    }else{
4110        jQuery(".main-menu .navbar-c-toggle").removeClass("fixednav");
4111    }
4112
4113    if(jQuery(this).scrollTop() > 250){
4114        jQuery("#back-top").slideDown("fast");
4115    }else{
4116        jQuery("#back-top").slideUp("fast");
4117    }
4118    
4119});*/
4120
4121
4122
4123/*!
4124 * Lightbox v2.8.2
4125 * by Lokesh Dhakar
4126 *
4127 * More info:
4128 * http://lokeshdhakar.com/projects/lightbox2/
4129 *
4130 * Copyright 2007, 2015 Lokesh Dhakar
4131 * Released under the MIT license
4132 * https://github.com/lokesh/lightbox2/blob/master/LICENSE
4133 */
4134
4135// Uses Node, AMD or browser globals to create a module.
4136(function (root, factory) {
4137    if (typeof define === 'function' && define.amd) {
4138        // AMD. Register as an anonymous module.
4139        define(['jquery'], factory);
4140    } else if (typeof exports === 'object') {
4141        // Node. Does not work with strict CommonJS, but
4142        // only CommonJS-like environments that support module.exports,
4143        // like Node.
4144        module.exports = factory(require('jquery'));
4145    } else {
4146        // Browser globals (root is window)
4147        root.lightbox = factory(root.jQuery);
4148    }
4149}(this, function ($) {
4150
4151  function Lightbox(options) {
4152    this.album = [];
4153    this.currentImageIndex = void 0;
4154    this.init();
4155
4156    // options
4157    this.options = $.extend({}, this.constructor.defaults);
4158    this.option(options);
4159  }
4160
4161  // Descriptions of all options available on the demo site:
4162  // http://lokeshdhakar.com/projects/lightbox2/index.html#options
4163  Lightbox.defaults = {
4164    albumLabel: 'Image %1 of %2',
4165    alwaysShowNavOnTouchDevices: false,
4166    fadeDuration: 500,
4167    fitImagesInViewport: true,
4168    // maxWidth: 800,
4169    // maxHeight: 600,
4170    positionFromTop: 50,
4171    resizeDuration: 700,
4172    showImageNumberLabel: true,
4173    wrapAround: false,
4174    disableScrolling: false
4175  };
4176
4177  Lightbox.prototype.option = function(options) {
4178    $.extend(this.options, options);
4179  };
4180
4181  Lightbox.prototype.imageCountLabel = function(currentImageNum, totalImages) {
4182    return this.options.albumLabel.replace(/%1/g, currentImageNum).replace(/%2/g, totalImages);
4183  };
4184
4185  Lightbox.prototype.init = function() {
4186    this.enable();
4187    this.build();
4188  };
4189
4190  // Loop through anchors and areamaps looking for either data-lightbox attributes or rel attributes
4191  // that contain 'lightbox'. When these are clicked, start lightbox.
4192  Lightbox.prototype.enable = function() {
4193    var self = this;
4194    $('body').on('click', 'a[rel^=lightbox], area[rel^=lightbox], a[data-lightbox], area[data-lightbox]', function(event) {
4195      self.start($(event.currentTarget));
4196      return false;
4197    });
4198  };
4199
4200  // Build html for the lightbox and the overlay.
4201  // Attach event handlers to the new DOM elements. click click click
4202  Lightbox.prototype.build = function() {
4203    var self = this;
4204    $('<div id="lightboxOverlay" class="lightboxOverlay"></div><div id="lightbox" class="lightbox"><div class="lb-outerContainer"><div class="lb-container"><img class="lb-image" src="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" /><div class="lb-nav"><a class="lb-prev" href="" ></a><a class="lb-next" href="" ></a></div><div class="lb-loader"><a class="lb-cancel"></a></div></div></div><div class="lb-dataContainer"><div class="lb-data"><div class="lb-details"><span class="lb-caption"></span><span class="lb-number"></span></div><div class="lb-closeContainer"><a class="lb-close"></a></div></div></div></div>').appendTo($('body'));
4205
4206    // Cache jQuery objects
4207    this.$lightbox       = $('#lightbox');
4208    this.$overlay        = $('#lightboxOverlay');
4209    this.$outerContainer = this.$lightbox.find('.lb-outerContainer');
4210    this.$container      = this.$lightbox.find('.lb-container');
4211
4212    // Store css values for future lookup
4213    this.containerTopPadding = parseInt(this.$container.css('padding-top'), 10);
4214    this.containerRightPadding = parseInt(this.$container.css('padding-right'), 10);
4215    this.containerBottomPadding = parseInt(this.$container.css('padding-bottom'), 10);
4216    this.containerLeftPadding = parseInt(this.$container.css('padding-left'), 10);
4217
4218    // Attach event handlers to the newly minted DOM elements
4219    this.$overlay.hide().on('click', function() {
4220      self.end();
4221      return false;
4222    });
4223
4224    this.$lightbox.hide().on('click', function(event) {
4225      if ($(event.target).attr('id') === 'lightbox') {
4226        self.end();
4227      }
4228      return false;
4229    });
4230
4231    this.$outerContainer.on('click', function(event) {
4232      if ($(event.target).attr('id') === 'lightbox') {
4233        self.end();
4234      }
4235      return false;
4236    });
4237
4238    this.$lightbox.find('.lb-prev').on('click', function() {
4239      if (self.currentImageIndex === 0) {
4240        self.changeImage(self.album.length - 1);
4241      } else {
4242        self.changeImage(self.currentImageIndex - 1);
4243      }
4244      return false;
4245    });
4246
4247    this.$lightbox.find('.lb-next').on('click', function() {
4248      if (self.currentImageIndex === self.album.length - 1) {
4249        self.changeImage(0);
4250      } else {
4251        self.changeImage(self.currentImageIndex + 1);
4252      }
4253      return false;
4254    });
4255
4256    this.$lightbox.find('.lb-loader, .lb-close').on('click', function() {
4257      self.end();
4258      return false;
4259    });
4260  };
4261
4262  // Show overlay and lightbox. If the image is part of a set, add siblings to album array.
4263  Lightbox.prototype.start = function($link) {
4264    var self    = this;
4265    var $window = $(window);
4266
4267    $window.on('resize', $.proxy(this.sizeOverlay, this));
4268
4269    $('select, object, embed').css({
4270      visibility: 'hidden'
4271    });
4272
4273    this.sizeOverlay();
4274
4275    this.album = [];
4276    var imageNumber = 0;
4277
4278    function addToAlbum($link) {
4279      self.album.push({
4280        link: $link.attr('href'),
4281        title: $link.attr('data-title') || $link.attr('title')
4282      });
4283    }
4284
4285    // Support both data-lightbox attribute and rel attribute implementations
4286    var dataLightboxValue = $link.attr('data-lightbox');
4287    var $links;
4288
4289    if (dataLightboxValue) {
4290      $links = $($link.prop('tagName') + '[data-lightbox="' + dataLightboxValue + '"]');
4291      for (var i = 0; i < $links.length; i = ++i) {
4292        addToAlbum($($links[i]));
4293        if ($links[i] === $link[0]) {
4294          imageNumber = i;
4295        }
4296      }
4297    } else {
4298      if ($link.attr('rel') === 'lightbox') {
4299        // If image is not part of a set
4300        addToAlbum($link);
4301      } else {
4302        // If image is part of a set
4303        $links = $($link.prop('tagName') + '[rel="' + $link.attr('rel') + '"]');
4304        for (var j = 0; j < $links.length; j = ++j) {
4305          addToAlbum($($links[j]));
4306          if ($links[j] === $link[0]) {
4307            imageNumber = j;
4308          }
4309        }
4310      }
4311    }
4312
4313    // Position Lightbox
4314    var top  = $window.scrollTop() + this.options.positionFromTop;
4315    var left = $window.scrollLeft();
4316    this.$lightbox.css({
4317      top: top + 'px',
4318      left: left + 'px'
4319    }).fadeIn(this.options.fadeDuration);
4320
4321    // Disable scrolling of the page while open
4322    if (this.options.disableScrolling) {
4323      $('body').addClass('lb-disable-scrolling');
4324    }
4325
4326    this.changeImage(imageNumber);
4327  };
4328
4329  // Hide most UI elements in preparation for the animated resizing of the lightbox.
4330  Lightbox.prototype.changeImage = function(imageNumber) {
4331    var self = this;
4332
4333    this.disableKeyboardNav();
4334    var $image = this.$lightbox.find('.lb-image');
4335
4336    this.$overlay.fadeIn(this.options.fadeDuration);
4337
4338    $('.lb-loader').fadeIn('slow');
4339    this.$lightbox.find('.lb-image, .lb-nav, .lb-prev, .lb-next, .lb-dataContainer, .lb-numbers, .lb-caption').hide();
4340
4341    this.$outerContainer.addClass('animating');
4342
4343    // When image to show is preloaded, we send the width and height to sizeContainer()
4344    var preloader = new Image();
4345    preloader.onload = function() {
4346      var $preloader;
4347      var imageHeight;
4348      var imageWidth;
4349      var maxImageHeight;
4350      var maxImageWidth;
4351      var windowHeight;
4352      var windowWidth;
4353
4354      $image.attr('src', self.album[imageNumber].link);
4355
4356      $preloader = $(preloader);
4357
4358      $image.width(preloader.width);
4359      $image.height(preloader.height);
4360
4361      if (self.options.fitImagesInViewport) {
4362        // Fit image inside the viewport.
4363        // Take into account the border around the image and an additional 10px gutter on each side.
4364
4365        windowWidth    = $(window).width();
4366        windowHeight   = $(window).height();
4367        maxImageWidth  = windowWidth - self.containerLeftPadding - self.containerRightPadding - 20;
4368        maxImageHeight = windowHeight - self.containerTopPadding - self.containerBottomPadding - 120;
4369
4370        // Check if image size is larger then maxWidth|maxHeight in settings
4371        if (self.options.maxWidth && self.options.maxWidth < maxImageWidth) {
4372          maxImageWidth = self.options.maxWidth;
4373        }
4374        if (self.options.maxHeight && self.options.maxHeight < maxImageWidth) {
4375          maxImageHeight = self.options.maxHeight;
4376        }
4377
4378        // Is there a fitting issue?
4379        if ((preloader.width > maxImageWidth) || (preloader.height > maxImageHeight)) {
4380          if ((preloader.width / maxImageWidth) > (preloader.height / maxImageHeight)) {
4381            imageWidth  = maxImageWidth;
4382            imageHeight = parseInt(preloader.height / (preloader.width / imageWidth), 10);
4383            $image.width(imageWidth);
4384            $image.height(imageHeight);
4385          } else {
4386            imageHeight = maxImageHeight;
4387            imageWidth = parseInt(preloader.width / (preloader.height / imageHeight), 10);
4388            $image.width(imageWidth);
4389            $image.height(imageHeight);
4390          }
4391        }
4392      }
4393      self.sizeContainer($image.width(), $image.height());
4394    };
4395
4396    preloader.src          = this.album[imageNumber].link;
4397    this.currentImageIndex = imageNumber;
4398  };
4399
4400  // Stretch overlay to fit the viewport
4401  Lightbox.prototype.sizeOverlay = function() {
4402    this.$overlay
4403      .width($(document).width())
4404      .height($(document).height());
4405  };
4406
4407  // Animate the size of the lightbox to fit the image we are showing
4408  Lightbox.prototype.sizeContainer = function(imageWidth, imageHeight) {
4409    var self = this;
4410
4411    var oldWidth  = this.$outerContainer.outerWidth();
4412    var oldHeight = this.$outerContainer.outerHeight();
4413    var newWidth  = imageWidth + this.containerLeftPadding + this.containerRightPadding;
4414    var newHeight = imageHeight + this.containerTopPadding + this.containerBottomPadding;
4415
4416    function postResize() {
4417      self.$lightbox.find('.lb-dataContainer').width(newWidth);
4418      self.$lightbox.find('.lb-prevLink').height(newHeight);
4419      self.$lightbox.find('.lb-nextLink').height(newHeight);
4420      self.showImage();
4421    }
4422
4423    if (oldWidth !== newWidth || oldHeight !== newHeight) {
4424      this.$outerContainer.animate({
4425        width: newWidth,
4426        height: newHeight
4427      }, this.options.resizeDuration, 'swing', function() {
4428        postResize();
4429      });
4430    } else {
4431      postResize();
4432    }
4433  };
4434
4435  // Display the image and its details and begin preload neighboring images.
4436  Lightbox.prototype.showImage = function() {
4437    this.$lightbox.find('.lb-loader').stop(true).hide();
4438    this.$lightbox.find('.lb-image').fadeIn('slow');
4439
4440    this.updateNav();
4441    this.updateDetails();
4442    this.preloadNeighboringImages();
4443    this.enableKeyboardNav();
4444  };
4445
4446  // Display previous and next navigation if appropriate.
4447  Lightbox.prototype.updateNav = function() {
4448    // Check to see if the browser supports touch events. If so, we take the conservative approach
4449    // and assume that mouse hover events are not supported and always show prev/next navigation
4450    // arrows in image sets.
4451    var alwaysShowNav = false;
4452    try {
4453      document.createEvent('TouchEvent');
4454      alwaysShowNav = (this.options.alwaysShowNavOnTouchDevices) ? true : false;
4455    } catch (e) {}
4456
4457    this.$lightbox.find('.lb-nav').show();
4458
4459    if (this.album.length > 1) {
4460      if (this.options.wrapAround) {
4461        if (alwaysShowNav) {
4462          this.$lightbox.find('.lb-prev, .lb-next').css('opacity', '1');
4463        }
4464        this.$lightbox.find('.lb-prev, .lb-next').show();
4465      } else {
4466        if (this.currentImageIndex > 0) {
4467          this.$lightbox.find('.lb-prev').show();
4468          if (alwaysShowNav) {
4469            this.$lightbox.find('.lb-prev').css('opacity', '1');
4470          }
4471        }
4472        if (this.currentImageIndex < this.album.length - 1) {
4473          this.$lightbox.find('.lb-next').show();
4474          if (alwaysShowNav) {
4475            this.$lightbox.find('.lb-next').css('opacity', '1');
4476          }
4477        }
4478      }
4479    }
4480  };
4481
4482  // Display caption, image number, and closing button.
4483  Lightbox.prototype.updateDetails = function() {
4484    var self = this;
4485
4486    // Enable anchor clicks in the injected caption html.
4487    // Thanks Nate Wright for the fix. @https://github.com/NateWr
4488    if (typeof this.album[this.currentImageIndex].title !== 'undefined' &&
4489      this.album[this.currentImageIndex].title !== '') {
4490      this.$lightbox.find('.lb-caption')
4491        .html(this.album[this.currentImageIndex].title)
4492        .fadeIn('fast')
4493        .find('a').on('click', function(event) {
4494          if ($(this).attr('target') !== undefined) {
4495            window.open($(this).attr('href'), $(this).attr('target'));
4496          } else {
4497            location.href = $(this).attr('href');
4498          }
4499        });
4500    }
4501
4502    if (this.album.length > 1 && this.options.showImageNumberLabel) {
4503      var labelText = this.imageCountLabel(this.currentImageIndex + 1, this.album.length);
4504      this.$lightbox.find('.lb-number').text(labelText).fadeIn('fast');
4505    } else {
4506      this.$lightbox.find('.lb-number').hide();
4507    }
4508
4509    this.$outerContainer.removeClass('animating');
4510
4511    this.$lightbox.find('.lb-dataContainer').fadeIn(this.options.resizeDuration, function() {
4512      return self.sizeOverlay();
4513    });
4514  };
4515
4516  // Preload previous and next images in set.
4517  Lightbox.prototype.preloadNeighboringImages = function() {
4518    if (this.album.length > this.currentImageIndex + 1) {
4519      var preloadNext = new Image();
4520      preloadNext.src = this.album[this.currentImageIndex + 1].link;
4521    }
4522    if (this.currentImageIndex > 0) {
4523      var preloadPrev = new Image();
4524      preloadPrev.src = this.album[this.currentImageIndex - 1].link;
4525    }
4526  };
4527
4528  Lightbox.prototype.enableKeyboardNav = function() {
4529    $(document).on('keyup.keyboard', $.proxy(this.keyboardAction, this));
4530  };
4531
4532  Lightbox.prototype.disableKeyboardNav = function() {
4533    $(document).off('.keyboard');
4534  };
4535
4536  Lightbox.prototype.keyboardAction = function(event) {
4537    var KEYCODE_ESC        = 27;
4538    var KEYCODE_LEFTARROW  = 37;
4539    var KEYCODE_RIGHTARROW = 39;
4540
4541    var keycode = event.keyCode;
4542    var key     = String.fromCharCode(keycode).toLowerCase();
4543    if (keycode === KEYCODE_ESC || key.match(/x|o|c/)) {
4544      this.end();
4545    } else if (key === 'p' || keycode === KEYCODE_LEFTARROW) {
4546      if (this.currentImageIndex !== 0) {
4547        this.changeImage(this.currentImageIndex - 1);
4548      } else if (this.options.wrapAround && this.album.length > 1) {
4549        this.changeImage(this.album.length - 1);
4550      }
4551    } else if (key === 'n' || keycode === KEYCODE_RIGHTARROW) {
4552      if (this.currentImageIndex !== this.album.length - 1) {
4553        this.changeImage(this.currentImageIndex + 1);
4554      } else if (this.options.wrapAround && this.album.length > 1) {
4555        this.changeImage(0);
4556      }
4557    }
4558  };
4559
4560  // Closing time. :-(
4561  Lightbox.prototype.end = function() {
4562    this.disableKeyboardNav();
4563    $(window).off('resize', this.sizeOverlay);
4564    this.$lightbox.fadeOut(this.options.fadeDuration);
4565    this.$overlay.fadeOut(this.options.fadeDuration);
4566    $('select, object, embed').css({
4567      visibility: 'visible'
4568    });
4569    if (this.options.disableScrolling) {
4570      $('body').removeClass('lb-disable-scrolling');
4571    }
4572  };
4573
4574  return new Lightbox();
4575}));
4576
4577
4578
4579
4580
4581
4582
4583(function($, window, document, undefined) {
4584
4585    'use strict';
4586
4587    var defaults = {
4588
4589        mode: 'lg-slide',
4590
4591        // Ex : 'ease'
4592        cssEasing: 'ease',
4593
4594        //'for jquery animation'
4595        easing: 'linear',
4596        speed: 600,
4597        height: '100%',
4598        width: '100%',
4599        addClass: '',
4600        startClass: 'lg-start-zoom',
4601        backdropDuration: 150,
4602        hideBarsDelay: 6000,
4603
4604        useLeft: false,
4605
4606        closable: true,
4607        loop: true,
4608        escKey: true,
4609        keyPress: true,
4610        controls: true,
4611        slideEndAnimatoin: true,
4612        hideControlOnEnd: false,
4613        mousewheel: true,
4614
4615        getCaptionFromTitleOrAlt: true,
4616
4617        // .lg-item || '.lg-sub-html'
4618        appendSubHtmlTo: '.lg-sub-html',
4619
4620        /**
4621         * @desc number of preload slides
4622         * will exicute only after the current slide is fully loaded.
4623         *
4624         * @ex you clicked on 4th image and if preload = 1 then 3rd slide and 5th
4625         * slide will be loaded in the background after the 4th slide is fully loaded..
4626         * if preload is 2 then 2nd 3rd 5th 6th slides will be preloaded.. ... ...
4627         *
4628         */
4629        preload: 1,
4630        showAfterLoad: true,
4631        selector: '',
4632        selectWithin: '',
4633        nextHtml: '',
4634        prevHtml: '',
4635
4636        // 0, 1
4637        index: false,
4638
4639        iframeMaxWidth: '100%',
4640
4641        download: true,
4642        counter: true,
4643        appendCounterTo: '.lg-toolbar',
4644
4645        swipeThreshold: 50,
4646        enableSwipe: true,
4647        enableDrag: true,
4648
4649        dynamic: false,
4650        dynamicEl: [],
4651        galleryId: 1
4652    };
4653
4654    function Plugin(element, options) {
4655
4656        // Current lightGallery element
4657        this.el = element;
4658
4659        // Current jquery element
4660        this.$el = $(element);
4661
4662        // lightGallery settings
4663        this.s = $.extend({}, defaults, options);
4664
4665        // When using dynamic mode, ensure dynamicEl is an array
4666        if (this.s.dynamic && this.s.dynamicEl !== 'undefined' && this.s.dynamicEl.constructor === Array && !this.s.dynamicEl.length) {
4667            throw ('When using dynamic mode, you must also define dynamicEl as an Array.');
4668        }
4669
4670        // lightGallery modules
4671        this.modules = {};
4672
4673        // false when lightgallery complete first slide;
4674        this.lGalleryOn = false;
4675
4676        this.lgBusy = false;
4677
4678        // Timeout function for hiding controls;
4679        this.hideBartimeout = false;
4680
4681        // To determine browser supports for touch events;
4682        this.isTouch = ('ontouchstart' in document.documentElement);
4683
4684        // Disable hideControlOnEnd if sildeEndAnimation is true
4685        if (this.s.slideEndAnimatoin) {
4686            this.s.hideControlOnEnd = false;
4687        }
4688
4689        // Gallery items
4690        if (this.s.dynamic) {
4691            this.$items = this.s.dynamicEl;
4692        } else {
4693            if (this.s.selector === 'this') {
4694                this.$items = this.$el;
4695            } else if (this.s.selector !== '') {
4696                if (this.s.selectWithin) {
4697                    this.$items = $(this.s.selectWithin).find(this.s.selector);
4698                } else {
4699                    this.$items = this.$el.find($(this.s.selector));
4700                }
4701            } else {
4702                this.$items = this.$el.children();
4703            }
4704        }
4705
4706        // .lg-item
4707        this.$slide = '';
4708
4709        // .lg-outer
4710        this.$outer = '';
4711
4712        this.init();
4713
4714        return this;
4715    }
4716
4717    Plugin.prototype.init = function() {
4718
4719        var _this = this;
4720
4721        // s.preload should not be more than $item.length
4722        if (_this.s.preload > _this.$items.length) {
4723            _this.s.preload = _this.$items.length;
4724        }
4725
4726        // if dynamic option is enabled execute immediately
4727        var _hash = window.location.hash;
4728        if (_hash.indexOf('lg=' + this.s.galleryId) > 0) {
4729
4730            _this.index = parseInt(_hash.split('&slide=')[1], 10);
4731
4732            $('body').addClass('lg-from-hash');
4733            if (!$('body').hasClass('lg-on')) {
4734                setTimeout(function() {
4735                    _this.build(_this.index);
4736                    $('body').addClass('lg-on');
4737                });
4738            }
4739        }
4740
4741        if (_this.s.dynamic) {
4742
4743            _this.$el.trigger('onBeforeOpen.lg');
4744
4745            _this.index = _this.s.index || 0;
4746
4747            // prevent accidental double execution
4748            if (!$('body').hasClass('lg-on')) {
4749                setTimeout(function() {
4750                    _this.build(_this.index);
4751                    $('body').addClass('lg-on');
4752                });
4753            }
4754        } else {
4755
4756            // Using different namespace for click because click event should not unbind if selector is same object('this')
4757            _this.$items.on('click.lgcustom', function(event) {
4758
4759                // For IE8
4760                try {
4761                    event.preventDefault();
4762                    event.preventDefault();
4763                } catch (er) {
4764                    event.returnValue = false;
4765                }
4766
4767                _this.$el.trigger('onBeforeOpen.lg');
4768
4769                _this.index = _this.s.index || _this.$items.index(this);
4770
4771                // prevent accidental double execution
4772                if (!$('body').hasClass('lg-on')) {
4773                    _this.build(_this.index);
4774                    $('body').addClass('lg-on');
4775                }
4776            });
4777        }
4778
4779    };
4780
4781    Plugin.prototype.build = function(index) {
4782
4783        var _this = this;
4784
4785        _this.structure();
4786
4787        // module constructor
4788        $.each($.fn.lightGallery.modules, function(key) {
4789            _this.modules[key] = new $.fn.lightGallery.modules[key](_this.el);
4790        });
4791
4792        // initiate slide function
4793        _this.slide(index, false, false);
4794
4795        if (_this.s.keyPress) {
4796            _this.keyPress();
4797        }
4798
4799        if (_this.$items.length > 1) {
4800
4801            _this.arrow();
4802
4803            setTimeout(function() {
4804                _this.enableDrag();
4805                _this.enableSwipe();
4806            }, 50);
4807
4808            if (_this.s.mousewheel) {
4809                _this.mousewheel();
4810            }
4811        }
4812
4813        _this.counter();
4814
4815        _this.closeGallery();
4816
4817        _this.$el.trigger('onAfterOpen.lg');
4818
4819        // Hide controllers if mouse doesn't move for some period
4820        _this.$outer.on('mousemove.lg click.lg touchstart.lg', function() {
4821
4822            _this.$outer.removeClass('lg-hide-items');
4823
4824            clearTimeout(_this.hideBartimeout);
4825
4826            // Timeout will be cleared on each slide movement also
4827            _this.hideBartimeout = setTimeout(function() {
4828                _this.$outer.addClass('lg-hide-items');
4829            }, _this.s.hideBarsDelay);
4830
4831        });
4832
4833    };
4834
4835    Plugin.prototype.structure = function() {
4836        var list = '';
4837        var controls = '';
4838        var i = 0;
4839        var subHtmlCont = '';
4840        var template;
4841        var _this = this;
4842
4843        $('body').append('<div class="lg-backdrop"></div>');
4844        $('.lg-backdrop').css('transition-duration', this.s.backdropDuration + 'ms');
4845
4846        // Create gallery items
4847        for (i = 0; i < this.$items.length; i++) {
4848            list += '<div class="lg-item"></div>';
4849        }
4850
4851        // Create controlls
4852        if (this.s.controls && this.$items.length > 1) {
4853            controls = '<div class="lg-actions">' +
4854                '<div class="lg-prev lg-icon">' + this.s.prevHtml + '</div>' +
4855                '<div class="lg-next lg-icon">' + this.s.nextHtml + '</div>' +
4856                '</div>';
4857        }
4858
4859        if (this.s.appendSubHtmlTo === '.lg-sub-html') {
4860            subHtmlCont = '<div class="lg-sub-html"></div>';
4861        }
4862
4863        template = '<div class="lg-outer ' + this.s.addClass + ' ' + this.s.startClass + '">' +
4864            '<div class="lg" style="width:' + this.s.width + '; height:' + this.s.height + '">' +
4865            '<div class="lg-inner">
4865' + list + '</div>' +
4866            '<div class="lg-toolbar group">' +
4867            '<span class="lg-close lg-icon"></span>' +
4868            '</div>' +
4869            controls +
4870            subHtmlCont +
4871            '</div>' +
4872            '</div>';
4873
4874        $('body').append(template);
4875        this.$outer = $('.lg-outer');
4876        this.$slide = this.$outer.find('.lg-item');
4877
4878        if (this.s.useLeft) {
4879            this.$outer.addClass('lg-use-left');
4880
4881            // Set mode lg-slide if use left is true;
4882            this.s.mode = 'lg-slide';
4883        } else {
4884            this.$outer.addClass('lg-use-css3');
4885        }
4886
4887        // For fixed height gallery
4888        _this.setTop();
4889        $(window).on('resize.lg orientationchange.lg', function() {
4890            setTimeout(function() {
4891                _this.setTop();
4892            }, 100);
4893        });
4894
4895        // add class lg-current to remove initial transition
4896        this.$slide.eq(this.index).addClass('lg-current');
4897
4898        // add Class for css support and transition mode
4899        if (this.doCss()) {
4900            this.$outer.addClass('lg-css3');
4901        } else {
4902            this.$outer.addClass('lg-css');
4903
4904            // Set speed 0 because no animation will happen if browser doesn't support css3
4905            this.s.speed = 0;
4906        }
4907
4908        this.$outer.addClass(this.s.mode);
4909
4910        if (this.s.enableDrag && this.$items.length > 1) {
4911            this.$outer.addClass('lg-grab');
4912        }
4913
4914        if (this.s.showAfterLoad) {
4915            this.$outer.addClass('lg-show-after-load');
4916        }
4917
4918        if (this.doCss()) {
4919            var $inner = this.$outer.find('.lg-inner');
4920            $inner.css('transition-timing-function', this.s.cssEasing);
4921            $inner.css('transition-duration', this.s.speed + 'ms');
4922        }
4923
4924        $('.lg-backdrop').addClass('in');
4925
4926        setTimeout(function() {
4927            _this.$outer.addClass('lg-visible');
4928        }, this.s.backdropDuration);
4929
4930        if (this.s.download) {
4931            this.$outer.find('.lg-toolbar').append('<a id="lg-download" target="_blank" download class="lg-download lg-icon"></a>');
4932        }
4933
4934        // Store the current scroll top value to scroll back after closing the gallery..
4935        this.prevScrollTop = $(window).scrollTop();
4936
4937    };
4938
4939    // For fixed height gallery
4940    Plugin.prototype.setTop = function() {
4941        if (this.s.height !== '100%') {
4942            var wH = $(window).height();
4943            var top = (wH - parseInt(this.s.height, 10)) / 2;
4944            var $lGallery = this.$outer.find('.lg');
4945            if (wH >= parseInt(this.s.height, 10)) {
4946                $lGallery.css('top', top + 'px');
4947            } else {
4948                $lGallery.css('top', '0px');
4949            }
4950        }
4951    };
4952
4953    // Find css3 support
4954    Plugin.prototype.doCss = function() {
4955        // check for css animation support
4956        var support = function() {
4957            var transition = ['transition', 'MozTransition', 'WebkitTransition', 'OTransition', 'msTransition', 'KhtmlTransition'];
4958            var root = document.documentElement;
4959            var i = 0;
4960            for (i = 0; i < transition.length; i++) {
4961                if (transition[i] in root.style) {
4962                    return true;
4963                }
4964            }
4965        };
4966
4967        if (support()) {
4968            return true;
4969        }
4970
4971        return false;
4972    };
4973
4974    /**
4975     *  @desc Check the given src is video
4976     *  @param {String} src
4977     *  @return {Object} video type
4978     *  Ex:{ youtube  :  ["//www.youtube.com/watch?v=c0asJgSyxcY", "c0asJgSyxcY"] }
4979     */
4980    Plugin.prototype.isVideo = function(src, index) {
4981
4982        var html;
4983        if (this.s.dynamic) {
4984            html = this.s.dynamicEl[index].html;
4985        } else {
4986            html = this.$items.eq(index).attr('data-html');
4987        }
4988
4989        if (!src && html) {
4990            return {
4991                html5: true
4992            };
4993        }
4994
4995        var youtube = src.match(/\/\/(?:www\.)?youtu(?:\.be|be\.com)\/(?:watch\?v=|embed\/)?([a-z0-9\-\_\%]+)/i);
4996        var vimeo = src.match(/\/\/(?:www\.)?vimeo.com\/([0-9a-z\-_]+)/i);
4997        var dailymotion = src.match(/\/\/(?:www\.)?dai.ly\/([0-9a-z\-_]+)/i);
4998        var vk = src.match(/\/\/(?:www\.)?(?:vk\.com|vkontakte\.ru)\/(?:video_ext\.php\?)(.*)/i);
4999
5000        if (youtube) {
5001            return {
5002                youtube: youtube
5003            };
5004        } else if (vimeo) {
5005            return {
5006                vimeo: vimeo
5007            };
5008        } else if (dailymotion) {
5009            return {
5010                dailymotion: dailymotion
5011            };
5012        } else if (vk) {
5013            return {
5014                vk: vk
5015            };
5016        }
5017    };
5018
5019    /**
5020     *  @desc Create image counter
5021     *  Ex: 1/10
5022     */
5023    Plugin.prototype.counter = function() {
5024        if (this.s.counter) {
5025            $(this.s.appendCounterTo).append('<div id="lg-counter"><span id="lg-counter-current">' + (parseInt(this.index, 10) + 1) + '</span> / <span id="lg-counter-all">' + this.$items.length + '</span></div>');
5026        }
5027    };
5028
5029    /**
5030     *  @desc add sub-html into the slide
5031     *  @param {Number} index - index of the slide
5032     */
5033    Plugin.prototype.addHtml = function(index) {
5034        var subHtml = null;
5035        var subHtmlUrl;
5036        if (this.s.dynamic) {
5037            if (this.s.dynamicEl[index].subHtmlUrl) {
5038                subHtmlUrl = this.s.dynamicEl[index].subHtmlUrl;
5039            } else {
5040                subHtml = this.s.dynamicEl[index].subHtml;
5041            }
5042        } else {
5043            if (this.$items.eq(index).attr('data-sub-html-url')) {
5044                subHtmlUrl = this.$items.eq(index).attr('data-sub-html-url');
5045            } else {
5046
5047                subHtml = this.$items.eq(index).attr('data-sub-html');
5048                if (this.s.getCaptionFromTitleOrAlt && !subHtml) {
5049                    subHtml = this.$items.eq(index).attr('title') || this.$items.eq(index).find('img').first().attr('alt');
5050                }
5051            }
5052        }
5053
5054        if (!subHtmlUrl) {
5055            if (typeof subHtml !== 'undefined' && subHtml !== null) {
5056
5057                // get first letter of subhtml
5058                // if first letter starts with . or # get the html form the jQuery object
5059                var fL = subHtml.substring(0, 1);
5060                if (fL === '.' || fL === '#') {
5061                    subHtml = $(subHtml).html();
5062                }
5063            } else {
5064                subHtml = '';
5065            }
5066        }
5067
5068        if (this.s.appendSubHtmlTo === '.lg-sub-html') {
5069
5070            if (subHtmlUrl) {
5071                this.$outer.find(this.s.appendSubHtmlTo).load(subHtmlUrl);
5072            } else {
5073                this.$outer.find(this.s.appendSubHtmlTo).html(subHtml);
5074            }
5075
5076        } else {
5077
5078            if (subHtmlUrl) {
5079                this.$slide.eq(index).load(subHtmlUrl);
5080            } else {
5081                this.$slide.eq(index).append(subHtml);
5082            }
5083        }
5084
5085        // Add lg-empty-html class if title doesn't exist
5086        if (typeof subHtml !== 'undefined' && subHtml !== null) {
5087            if (subHtml === '') {
5088                this.$outer.find(this.s.appendSubHtmlTo).addClass('lg-empty-html');
5089            } else {
5090                this.$outer.find(this.s.appendSubHtmlTo).removeClass('lg-empty-html');
5091            }
5092        }
5093
5094        this.$el.trigger('onAfterAppendSubHtml.lg', [index]);
5095    };
5096
5097    /**
5098     *  @desc Preload slides
5099     *  @param {Number} index - index of the slide
5100     */
5101    Plugin.prototype.preload = function(index) {
5102        var i = 1;
5103        var j = 1;
5104        for (i = 1; i <= this.s.preload; i++) {
5105            if (i >= this.$items.length - index) {
5106                break;
5107            }
5108
5109            this.loadContent(index + i, false, 0);
5110        }
5111
5112        for (j = 1; j <= this.s.preload; j++) {
5113            if (index - j < 0) {
5114                break;
5115            }
5116
5117            this.loadContent(index - j, false, 0);
5118        }
5119    };
5120
5121    /**
5122     *  @desc Load slide content into slide.
5123     *  @param {Number} index - index of the slide.
5124     *  @param {Boolean} rec - if true call loadcontent() function again.
5125     *  @param {Boolean} delay - delay for adding complete class. it is 0 except first time.
5126     */
5127    Plugin.prototype.loadContent = function(index, rec, delay) {
5128
5129        var _this = this;
5130        var _hasPoster = false;
5131        var _$img;
5132        var _src;
5133        var _poster;
5134        var _srcset;
5135        var _sizes;
5136        var _html;
5137        var getResponsiveSrc = function(srcItms) {
5138            var rsWidth = [];
5139            var rsSrc = [];
5140            for (var i = 0; i < srcItms.length; i++) {
5141                var __src = srcItms[i].split(' ');
5142
5143                // Manage empty space
5144                if (__src[0] === '') {
5145                    __src.splice(0, 1);
5146                }
5147
5148                rsSrc.push(__src[0]);
5149                rsWidth.push(__src[1]);
5150            }
5151
5152            var wWidth = $(window).width();
5153            for (var j = 0; j < rsWidth.length; j++) {
5154                if (parseInt(rsWidth[j], 10) > wWidth) {
5155                    _src = rsSrc[j];
5156                    break;
5157                }
5158            }
5159        };
5160
5161        if (_this.s.dynamic) {
5162
5163            if (_this.s.dynamicEl[index].poster) {
5164                _hasPoster = true;
5165                _poster = _this.s.dynamicEl[index].poster;
5166            }
5167
5168            _html = _this.s.dynamicEl[index].html;
5169            _src = _this.s.dynamicEl[index].src;
5170
5171            if (_this.s.dynamicEl[index].responsive) {
5172                var srcDyItms = _this.s.dynamicEl[index].responsive.split(',');
5173                getResponsiveSrc(srcDyItms);
5174            }
5175
5176            _srcset = _this.s.dynamicEl[index].srcset;
5177            _sizes = _this.s.dynamicEl[index].sizes;
5178
5179        } else {
5180
5181            if (_this.$items.eq(index).attr('data-poster')) {
5182                _hasPoster = true;
5183                _poster = _this.$items.eq(index).attr('data-poster');
5184            }
5185
5186            _html = _this.$items.eq(index).attr('data-html');
5187            _src = _this.$items.eq(index).attr('href') || _this.$items.eq(index).attr('data-src');
5188
5189            if (_this.$items.eq(index).attr('data-responsive')) {
5190                var srcItms = _this.$items.eq(index).attr('data-responsive').split(',');
5191                getResponsiveSrc(srcItms);
5192            }
5193
5194            _srcset = _this.$items.eq(index).attr('data-srcset');
5195            _sizes = _this.$items.eq(index).attr('data-sizes');
5196
5197        }
5198
5199        //if (_src || _srcset || _sizes || _poster) {
5200
5201        var iframe = false;
5202        if (_this.s.dynamic) {
5203            if (_this.s.dynamicEl[index].iframe) {
5204                iframe = true;
5205            }
5206        } else {
5207            if (_this.$items.eq(index).attr('data-iframe') === 'true') {
5208                iframe = true;
5209            }
5210        }
5211
5212        var _isVideo = _this.isVideo(_src, index);
5213        if (!_this.$slide.eq(index).hasClass('lg-loaded')) {
5214            if (iframe) {
5215                _this.$slide.eq(index).prepend('<div class="lg-video-cont" style="max-width:' + _this.s.iframeMaxWidth + '"><div class="lg-video"><iframe class="lg-object" frameborder="0" src="' + _src + '"  allowfullscreen="true"></iframe></div></div>');
5216            } else if (_hasPoster) {
5217                var videoClass = '';
5218                if (_isVideo && _isVideo.youtube) {
5219                    videoClass = 'lg-has-youtube';
5220                } else if (_isVideo && _isVideo.vimeo) {
5221                    videoClass = 'lg-has-vimeo';
5222                } else {
5223                    videoClass = 'lg-has-html5';
5224                }
5225
5226                _this.$slide.eq(index).prepend('<div class="lg-video-cont ' + videoClass + ' "><div class="lg-video"><span class="lg-video-play"></span><img class="lg-object lg-has-poster" src="' + _poster + '" /></div></div>');
5227
5228            } else if (_isVideo) {
5229                _this.$slide.eq(index).prepend('<div class="lg-video-cont "><div class="lg-video"></div></div>');
5230                _this.$el.trigger('hasVideo.lg', [index, _src, _html]);
5231            } else {
5232                _this.$slide.eq(index).prepend('<div class="lg-img-wrap"><img class="lg-object lg-image" src="' + _src + '" /></div>');
5233            }
5234
5235            _this.$el.trigger('onAferAppendSlide.lg', [index]);
5236
5237            _$img = _this.$slide.eq(index).find('.lg-object');
5238            if (_sizes) {
5239                _$img.attr('sizes', _sizes);
5240            }
5241
5242            if (_srcset) {
5243                _$img.attr('srcset', _srcset);
5244                try {
5245                    picturefill({
5246                        elements: [_$img[0]]
5247                    });
5248                } catch (e) {
5249                    console.error('Make sure you have included Picturefill version 2');
5250                }
5251            }
5252
5253            if (this.s.appendSubHtmlTo !== '.lg-sub-html') {
5254                _this.addHtml(index);
5255            }
5256
5257            _this.$slide.eq(index).addClass('lg-loaded');
5258        }
5259
5260        _this.$slide.eq(index).find('.lg-object').on('load.lg error.lg', function() {
5261
5262            // For first time add some delay for displaying the start animation.
5263            var _speed = 0;
5264
5265            // Do not change the delay value because it is required for zoom plugin.
5266            // If gallery opened from direct url (hash) speed value should be 0
5267            if (delay && !$('body').hasClass('lg-from-hash')) {
5268                _speed = delay;
5269            }
5270
5271            setTimeout(function() {
5272                _this.$slide.eq(index).addClass('lg-complete');
5273                _this.$el.trigger('onSlideItemLoad.lg', [index, delay || 0]);
5274            }, _speed);
5275
5276        });
5277
5278        // @todo check load state for html5 videos
5279        if (_isVideo && _isVideo.html5 && !_hasPoster) {
5280            _this.$slide.eq(index).addClass('lg-complete');
5281        }
5282
5283        if (rec === true) {
5284            if (!_this.$slide.eq(index).hasClass('lg-complete')) {
5285                _this.$slide.eq(index).find('.lg-object').on('load.lg error.lg', function() {
5286                    _this.preload(index);
5287                });
5288            } else {
5289                _this.preload(index);
5290            }
5291        }
5292
5293        //}
5294    };
5295
5296    /**
5297    *   @desc slide function for lightgallery
5298        ** Slide() gets call on start
5299        ** ** Set lg.on true once slide() function gets called.
5300        ** Call loadContent() on slide() function inside setTimeout
5301        ** ** On first slide we do not want any animation like slide of fade
5302        ** ** So on first slide( if lg.on if false that is first slide) loadContent() should start loading immediately
5303        ** ** Else loadContent() should wait for the transition to complete.
5304        ** ** So set timeout s.speed + 50
5305    <=> ** loadContent() will load slide content in to the particular slide
5306        ** ** It has recursion (rec) parameter. if rec === true loadContent() will call preload() function.
5307        ** ** preload will execute only when the previous slide is fully loaded (images iframe)
5308        ** ** avoid simultaneous image load
5309    <=> ** Preload() will check for s.preload value and call loadContent() again accoring to preload value
5310        ** loadContent()  <====> Preload();
5311
5312    *   @param {Number} index - index of the slide
5313    *   @param {Boolean} fromTouch - true if slide function called via touch event or mouse drag
5314    *   @param {Boolean} fromThumb - true if slide function called via thumbnail click
5315    */
5316    Plugin.prototype.slide = function(index, fromTouch, fromThumb) {
5317
5318        var _prevIndex = this.$outer.find('.lg-current').index();
5319        var _this = this;
5320
5321        // Prevent if multiple call
5322        // Required for hsh plugin
5323        if (_this.lGalleryOn && (_prevIndex === index)) {
5324            return;
5325        }
5326
5327        var _length = this.$slide.length;
5328        var _time = _this.lGalleryOn ? this.s.speed : 0;
5329        var _next = false;
5330        var _prev = false;
5331
5332        if (!_this.lgBusy) {
5333
5334            if (this.s.download) {
5335                var _src;
5336                if (_this.s.dynamic) {
5337                    _src = _this.s.dynamicEl[index].downloadUrl !== false && (_this.s.dynamicEl[index].downloadUrl || _this.s.dynamicEl[index].src);
5338                } else {
5339                    _src = _this.$items.eq(index).attr('data-download-url') !== 'false' && (_this.$items.eq(index).attr('data-download-url') || _this.$items.eq(index).attr('href') || _this.$items.eq(index).attr('data-src'));
5340
5341                }
5342
5343                if (_src) {
5344                    $('#lg-download').attr('href', _src);
5345                    _this.$outer.removeClass('lg-hide-download');
5346                } else {
5347                    _this.$outer.addClass('lg-hide-download');
5348                }
5349            }
5350
5351            this.$el.trigger('onBeforeSlide.lg', [_prevIndex, index, fromTouch, fromThumb]);
5352
5353            _this.lgBusy = true;
5354
5355            clearTimeout(_this.hideBartimeout);
5356
5357            // Add title if this.s.appendSubHtmlTo === lg-sub-html
5358            if (this.s.appendSubHtmlTo === '.lg-sub-html') {
5359
5360                // wait for slide animation to complete
5361                setTimeout(function() {
5362                    _this.addHtml(index);
5363                }, _time);
5364            }
5365
5366            this.arrowDisable(index);
5367
5368            if (!fromTouch) {
5369
5370                // remove all transitions
5371                _this.$outer.addClass('lg-no-trans');
5372
5373                this.$slide.removeClass('lg-prev-slide lg-next-slide');
5374
5375                if (index < _prevIndex) {
5376                    _prev = true;
5377                    if ((index === 0) && (_prevIndex === _length - 1) && !fromThumb) {
5378                        _prev = false;
5379                        _next = true;
5380                    }
5381                } else if (index > _prevIndex) {
5382                    _next = true;
5383                    if ((index === _length - 1) && (_prevIndex === 0) && !fromThumb) {
5384                        _prev = true;
5385                        _next = false;
5386                    }
5387                }
5388
5389                if (_prev) {
5390
5391                    //prevslide
5392                    this.$slide.eq(index).addClass('lg-prev-slide');
5393                    this.$slide.eq(_prevIndex).addClass('lg-next-slide');
5394                } else if (_next) {
5395
5396                    // next slide
5397                    this.$slide.eq(index).addClass('lg-next-slide');
5398                    this.$slide.eq(_prevIndex).addClass('lg-prev-slide');
5399                }
5400
5401                // give 50 ms for browser to add/remove class
5402                setTimeout(function() {
5403                    _this.$slide.removeClass('lg-current');
5404
5405                    //_this.$slide.eq(_prevIndex).removeClass('lg-current');
5406                    _this.$slide.eq(index).addClass('lg-current');
5407
5408                    // reset all transitions
5409                    _this.$outer.removeClass('lg-no-trans');
5410                }, 50);
5411            } else {
5412
5413                var touchPrev = index - 1;
5414                var touchNext = index + 1;
5415
5416                if ((index === 0) && (_prevIndex === _length - 1)) {
5417
5418                    // next slide
5419                    touchNext = 0;
5420                    touchPrev = _length - 1;
5421                } else if ((index === _length - 1) && (_prevIndex === 0)) {
5422
5423                    // prev slide
5424                    touchNext = 0;
5425                    touchPrev = _length - 1;
5426                }
5427
5428                this.$slide.removeClass('lg-prev-slide lg-current lg-next-slide');
5429                _this.$slide.eq(touchPrev).addClass('lg-prev-slide');
5430                _this.$slide.eq(touchNext).addClass('lg-next-slide');
5431                _this.$slide.eq(index).addClass('lg-current');
5432            }
5433
5434            if (_this.lGalleryOn) {
5435                setTimeout(function() {
5436                    _this.loadContent(index, true, 0);
5437                }, this.s.speed + 50);
5438
5439                setTimeout(function() {
5440                    _this.lgBusy = false;
5441                    _this.$el.trigger('onAfterSlide.lg', [_prevIndex, index, fromTouch, fromThumb]);
5442                }, this.s.speed);
5443
5444            } else {
5445                _this.loadContent(index, true, _this.s.backdropDuration);
5446
5447                _this.lgBusy = false;
5448                _this.$el.trigger('onAfterSlide.lg', [_prevIndex, index, fromTouch, fromThumb]);
5449            }
5450
5451            _this.lGalleryOn = true;
5452
5453            if (this.s.counter) {
5454                $('#lg-counter-current').text(index + 1);
5455            }
5456
5457        }
5458
5459    };
5460
5461    /**
5462     *  @desc Go to next slide
5463     *  @param {Boolean} fromTouch - true if slide function called via touch event
5464     */
5465    Plugin.prototype.goToNextSlide = function(fromTouch) {
5466        var _this = this;
5467        if (!_this.lgBusy) {
5468            if ((_this.index + 1) < _this.$slide.length) {
5469                _this.index++;
5470                _this.$el.trigger('onBeforeNextSlide.lg', [_this.index]);
5471                _this.slide(_this.index, fromTouch, false);
5472            } else {
5473                if (_this.s.loop) {
5474                    _this.index = 0;
5475                    _this.$el.trigger('onBeforeNextSlide.lg', [_this.index]);
5476                    _this.slide(_this.index, fromTouch, false);
5477                } else if (_this.s.slideEndAnimatoin) {
5478                    _this.$outer.addClass('lg-right-end');
5479                    setTimeout(function() {
5480                        _this.$outer.removeClass('lg-right-end');
5481                    }, 400);
5482                }
5483            }
5484        }
5485    };
5486
5487    /**
5488     *  @desc Go to previous slide
5489     *  @param {Boolean} fromTouch - true if slide function called via touch event
5490     */
5491    Plugin.prototype.goToPrevSlide = function(fromTouch) {
5492        var _this = this;
5493        if (!_this.lgBusy) {
5494            if (_this.index > 0) {
5495                _this.index--;
5496                _this.$el.trigger('onBeforePrevSlide.lg', [_this.index, fromTouch]);
5497                _this.slide(_this.index, fromTouch, false);
5498            } else {
5499                if (_this.s.loop) {
5500                    _this.index = _this.$items.length - 1;
5501                    _this.$el.trigger('onBeforePrevSlide.lg', [_this.index, fromTouch]);
5502                    _this.slide(_this.index, fromTouch, false);
5503                } else if (_this.s.slideEndAnimatoin) {
5504                    _this.$outer.addClass('lg-left-end');
5505                    setTimeout(function() {
5506                        _this.$outer.removeClass('lg-left-end');
5507                    }, 400);
5508                }
5509            }
5510        }
5511    };
5512
5513    Plugin.prototype.keyPress = function() {
5514        var _this = this;
5515        if (this.$items.length > 1) {
5516            $(window).on('keyup.lg', function(e) {
5517                if (_this.$items.length > 1) {
5518                    if (e.keyCode === 37) {
5519                        e.preventDefault();
5520                        _this.goToPrevSlide();
5521                    }
5522
5523                    if (e.keyCode === 39) {
5524                        e.preventDefault();
5525                        _this.goToNextSlide();
5526                    }
5527                }
5528            });
5529        }
5530
5531        $(window).on('keydown.lg', function(e) {
5532            if (_this.s.escKey === true && e.keyCode === 27) {
5533                e.preventDefault();
5534                if (!_this.$outer.hasClass('lg-thumb-open')) {
5535                    _this.destroy();
5536                } else {
5537                    _this.$outer.removeClass('lg-thumb-open');
5538                }
5539            }
5540        });
5541    };
5542
5543    Plugin.prototype.arrow = function() {
5544        var _this = this;
5545        this.$outer.find('.lg-prev').on('click.lg', function() {
5546            _this.goToPrevSlide();
5547        });
5548
5549        this.$outer.find('.lg-next').on('click.lg', function() {
5550            _this.goToNextSlide();
5551        });
5552    };
5553
5554    Plugin.prototype.arrowDisable = function(index) {
5555
5556        // Disable arrows if s.hideControlOnEnd is true
5557        if (!this.s.loop && this.s.hideControlOnEnd) {
5558            if ((index + 1) < this.$slide.length) {
5559                this.$outer.find('.lg-next').removeAttr('disabled').removeClass('disabled');
5560            } else {
5561                this.$outer.find('.lg-next').attr('disabled', 'disabled').addClass('disabled');
5562            }
5563
5564            if (index > 0) {
5565                this.$outer.find('.lg-prev').removeAttr('disabled').removeClass('disabled');
5566            } else {
5567                this.$outer.find('.lg-prev').attr('disabled', 'disabled').addClass('disabled');
5568            }
5569        }
5570    };
5571
5572    Plugin.prototype.setTranslate = function($el, xValue, yValue) {
5573        // jQuery supports Automatic CSS prefixing since jQuery 1.8.0
5574        if (this.s.useLeft) {
5575            $el.css('left', xValue);
5576        } else {
5577            $el.css({
5578                transform: 'translate3d(' + (xValue) + 'px, ' + yValue + 'px, 0px)'
5579            });
5580        }
5581    };
5582
5583    Plugin.prototype.touchMove = function(startCoords, endCoords) {
5584
5585        var distance = endCoords - startCoords;
5586
5587        if (Math.abs(distance) > 15) {
5588            // reset opacity and transition duration
5589            this.$outer.addClass('lg-dragging');
5590
5591            // move current slide
5592            this.setTranslate(this.$slide.eq(this.index), distance, 0);
5593
5594            // move next and prev slide with current slide
5595            this.setTranslate($('.lg-prev-slide'), -this.$slide.eq(this.index).width() + distance, 0);
5596            this.setTranslate($('.lg-next-slide'), this.$slide.eq(this.index).width() + distance, 0);
5597        }
5598    };
5599
5600    Plugin.prototype.touchEnd = function(distance) {
5601        var _this = this;
5602
5603        // keep slide animation for any mode while dragg/swipe
5604        if (_this.s.mode !== 'lg-slide') {
5605            _this.$outer.addClass('lg-slide');
5606        }
5607
5608        this.$slide.not('.lg-current, .lg-prev-slide, .lg-next-slide').css('opacity', '0');
5609
5610        // set transition duration
5611        setTimeout(function() {
5612            _this.$outer.removeClass('lg-dragging');
5613            if ((distance < 0) && (Math.abs(distance) > _this.s.swipeThreshold)) {
5614                _this.goToNextSlide(true);
5615            } else if ((distance > 0) && (Math.abs(distance) > _this.s.swipeThreshold)) {
5616                _this.goToPrevSlide(true);
5617            } else if (Math.abs(distance) < 5) {
5618
5619                // Trigger click if distance is less than 5 pix
5620                _this.$el.trigger('onSlideClick.lg');
5621            }
5622
5623            _this.$slide.removeAttr('style');
5624        });
5625
5626        // remove slide class once drag/swipe is completed if mode is not slide
5627        setTimeout(function() {
5628            if (!_this.$outer.hasClass('lg-dragging') && _this.s.mode !== 'lg-slide') {
5629                _this.$outer.removeClass('lg-slide');
5630            }
5631        }, _this.s.speed + 100);
5632
5633    };
5634
5635    Plugin.prototype.enableSwipe = function() {
5636        var _this = this;
5637        var startCoords = 0;
5638        var endCoords = 0;
5639        var isMoved = false;
5640
5641        if (_this.s.enableSwipe && _this.isTouch && _this.doCss()) {
5642
5643            _this.$slide.on('touchstart.lg', function(e) {
5644                if (!_this.$outer.hasClass('lg-zoomed') && !_this.lgBusy) {
5645                    e.preventDefault();
5646                    _this.manageSwipeClass();
5647                    startCoords = e.originalEvent.targetTouches[0].pageX;
5648                }
5649            });
5650
5651            _this.$slide.on('touchmove.lg', function(e) {
5652                if (!_this.$outer.hasClass('lg-zoomed')) {
5653                    e.preventDefault();
5654                    endCoords = e.originalEvent.targetTouches[0].pageX;
5655                    _this.touchMove(startCoords, endCoords);
5656                    isMoved = true;
5657                }
5658            });
5659
5660            _this.$slide.on('touchend.lg', function() {
5661                if (!_this.$outer.hasClass('lg-zoomed')) {
5662                    if (isMoved) {
5663                        isMoved = false;
5664                        _this.touchEnd(endCoords - startCoords);
5665                    } else {
5666                        _this.$el.trigger('onSlideClick.lg');
5667                    }
5668                }
5669            });
5670        }
5671
5672    };
5673
5674    Plugin.prototype.enableDrag = function() {
5675        var _this = this;
5676        var startCoords = 0;
5677        var endCoords = 0;
5678        var isDraging = false;
5679        var isMoved = false;
5680        if (_this.s.enableDrag && !_this.isTouch && _this.doCss()) {
5681            _this.$slide.on('mousedown.lg', function(e) {
5682                // execute only on .lg-object
5683                if (!_this.$outer.hasClass('lg-zoomed')) {
5684                    if ($(e.target).hasClass('lg-object') || $(e.target).hasClass('lg-video-play')) {
5685                        e.preventDefault();
5686
5687                        if (!_this.lgBusy) {
5688                            _this.manageSwipeClass();
5689                            startCoords = e.pageX;
5690                            isDraging = true;
5691
5692                            // ** Fix for webkit cursor issue https://code.google.com/p/chromium/issues/detail?id=26723
5693                            _this.$outer.scrollLeft += 1;
5694                            _this.$outer.scrollLeft -= 1;
5695
5696                            // *
5697
5698                            _this.$outer.removeClass('lg-grab').addClass('lg-grabbing');
5699
5700                            _this.$el.trigger('onDragstart.lg');
5701                        }
5702
5703                    }
5704                }
5705            });
5706
5707            $(window).on('mousemove.lg', function(e) {
5708                if (isDraging) {
5709                    isMoved = true;
5710                    endCoords = e.pageX;
5711                    _this.touchMove(startCoords, endCoords);
5712                    _this.$el.trigger('onDragmove.lg');
5713                }
5714            });
5715
5716            $(window).on('mouseup.lg', function(e) {
5717                if (isMoved) {
5718                    isMoved = false;
5719                    _this.touchEnd(endCoords - startCoords);
5720                    _this.$el.trigger('onDragend.lg');
5721                } else if ($(e.target).hasClass('lg-object') || $(e.target).hasClass('lg-video-play')) {
5722                    _this.$el.trigger('onSlideClick.lg');
5723                }
5724
5725                // Prevent execution on click
5726                if (isDraging) {
5727                    isDraging = false;
5728                    _this.$outer.removeClass('lg-grabbing').addClass('lg-grab');
5729                }
5730            });
5731
5732        }
5733    };
5734
5735    Plugin.prototype.manageSwipeClass = function() {
5736        var touchNext = this.index + 1;
5737        var touchPrev = this.index - 1;
5738        var length = this.$slide.length;
5739        if (this.s.loop) {
5740            if (this.index === 0) {
5741                touchPrev = length - 1;
5742            } else if (this.index === length - 1) {
5743                touchNext = 0;
5744            }
5745        }
5746
5747        this.$slide.removeClass('lg-next-slide lg-prev-slide');
5748        if (touchPrev > -1) {
5749            this.$slide.eq(touchPrev).addClass('lg-prev-slide');
5750        }
5751
5752        this.$slide.eq(touchNext).addClass('lg-next-slide');
5753    };
5754
5755    Plugin.prototype.mousewheel = function() {
5756        var _this = this;
5757        _this.$outer.on('mousewheel.lg', function(e) {
5758
5759            if (!e.deltaY) {
5760                return;
5761            }
5762
5763            if (e.deltaY > 0) {
5764                _this.goToPrevSlide();
5765            } else {
5766                _this.goToNextSlide();
5767            }
5768
5769            e.preventDefault();
5770        });
5771
5772    };
5773
5774    Plugin.prototype.closeGallery = function() {
5775
5776        var _this = this;
5777        var mousedown = false;
5778        this.$outer.find('.lg-close').on('click.lg', function() {
5779            _this.destroy();
5780        });
5781
5782        if (_this.s.closable) {
5783
5784            // If you drag the slide and release outside gallery gets close on chrome
5785            // for preventing this check mousedown and mouseup happened on .lg-item or lg-outer
5786            _this.$outer.on('mousedown.lg', function(e) {
5787
5788                if ($(e.target).is('.lg-outer') || $(e.target).is('.lg-item ') || $(e.target).is('.lg-img-wrap')) {
5789                    mousedown = true;
5790                } else {
5791                    mousedown = false;
5792                }
5793
5794            });
5795
5796            _this.$outer.on('mouseup.lg', function(e) {
5797
5798                if ($(e.target).is('.lg-outer') || $(e.target).is('.lg-item ') || $(e.target).is('.lg-img-wrap') && mousedown) {
5799                    if (!_this.$outer.hasClass('lg-dragging')) {
5800                        _this.destroy();
5801                    }
5802                }
5803
5804            });
5805
5806        }
5807
5808    };
5809
5810    Plugin.prototype.destroy = function(d) {
5811
5812        var _this = this;
5813
5814        if (!d) {
5815            _this.$el.trigger('onBeforeClose.lg');
5816        }
5817
5818        $(window).scrollTop(_this.prevScrollTop);
5819
5820        /**
5821         * if d is false or undefined destroy will only close the gallery
5822         * plugins instance remains with the element
5823         *
5824         * if d is true destroy will completely remove the plugin
5825         */
5826
5827        if (d) {
5828            if (!_this.s.dynamic) {
5829                // only when not using dynamic mode is $items a jquery collection
5830                this.$items.off('click.lg click.lgcustom');
5831            }
5832
5833            $.removeData(_this.el, 'lightGallery');
5834        }
5835
5836        // Unbind all events added by lightGallery
5837        this.$el.off('.lg.tm');
5838
5839        // Distroy all lightGallery modules
5840        $.each($.fn.lightGallery.modules, function(key) {
5841            if (_this.modules[key]) {
5842                _this.modules[key].destroy();
5843            }
5844        });
5845
5846        this.lGalleryOn = false;
5847
5848        clearTimeout(_this.hideBartimeout);
5849        this.hideBartimeout = false;
5850        $(window).off('.lg');
5851        $('body').removeClass('lg-on lg-from-hash');
5852
5853        if (_this.$outer) {
5854            _this.$outer.removeClass('lg-visible');
5855        }
5856
5857        $('.lg-backdrop').removeClass('in');
5858
5859        setTimeout(function() {
5860            if (_this.$outer) {
5861                _this.$outer.remove();
5862            }
5863
5864            $('.lg-backdrop').remove();
5865
5866            if (!d) {
5867                _this.$el.trigger('onCloseAfter.lg');
5868            }
5869
5870        }, _this.s.backdropDuration + 50);
5871    };
5872
5873    $.fn.lightGallery = function(options) {
5874        return this.each(function() {
5875            if (!$.data(this, 'lightGallery')) {
5876                $.data(this, 'lightGallery', new Plugin(this, options));
5877            } else {
5878                try {
5879                    $(this).data('lightGallery').init();
5880                } catch (err) {
5881                    console.error('lightGallery has not initiated properly');
5882                }
5883            }
5884        });
5885    };
5886
5887    $.fn.lightGallery.modules = {};
5888
5889})(jQuery, window, document);
5890
5891
5892
5893
5894
5895
5896
5897(function($, window, document, undefined) {
5898
5899    'use strict';
5900
5901    var defaults = {
5902        thumbnail: true,
5903
5904        animateThumb: true,
5905        currentPagerPosition: 'middle',
5906
5907        thumbWidth: 100,
5908        thumbContHeight: 100,
5909        thumbMargin: 5,
5910
5911        exThumbImage: false,
5912        showThumbByDefault: true,
5913        toogleThumb: true,
5914        pullCaptionUp: true,
5915
5916        enableThumbDrag: true,
5917        enableThumbSwipe: true,
5918        swipeThreshold: 50,
5919
vendor: 10,592 bytes, lines 5920-6212
5920        loadYoutubeThumbnail: true,
5921        youtubeThumbSize: 1,
5922
5923        loadVimeoThumbnail: true,
5924        vimeoThumbSize: 'thumbnail_small',
5925
5926        loadDailymotionThumbnail: true
5927    };
5928
5929    var Thumbnail = function(element) {
5930
5931        // get lightGallery core plugin data
5932        this.core = $(element).data('lightGallery');
5933
5934        // extend module default settings with lightGallery core settings
5935        this.core.s = $.extend({}, defaults, this.core.s);
5936
5937        this.$el = $(element);
5938        this.$thumbOuter = null;
5939        this.thumbOuterWidth = 0;
5940        this.thumbTotalWidth = (this.core.$items.length * (this.core.s.thumbWidth + this.core.s.thumbMargin));
5941        this.thumbIndex = this.core.index;
5942
5943        // Thumbnail animation value
5944        this.left = 0;
5945
5946        this.init();
5947
5948        return this;
5949    };
5950
5951    Thumbnail.prototype.init = function() {
5952        var _this = this;
5953        if (this.core.s.thumbnail && this.core.$items.length > 1) {
5954            if (this.core.s.showThumbByDefault) {
5955                setTimeout(function(){
5956                    _this.core.$outer.addClass('lg-thumb-open');
5957                }, 700);
5958            }
5959
5960            if (this.core.s.pullCaptionUp) {
5961                this.core.$outer.addClass('lg-pull-caption-up');
5962            }
5963
5964            this.build();
5965            if (this.core.s.animateThumb) {
5966                if (this.core.s.enableThumbDrag && !this.core.isTouch && this.core.doCss()) {
5967                    this.enableThumbDrag();
5968                }
5969
5970                if (this.core.s.enableThumbSwipe && this.core.isTouch && this.core.doCss()) {
5971                    this.enableThumbSwipe();
5972                }
5973
5974                this.thumbClickable = false;
5975            } else {
5976                this.thumbClickable = true;
5977            }
5978
5979            this.toogle();
5980            this.thumbkeyPress();
5981        }
5982    };
5983
5984    Thumbnail.prototype.build = function() {
5985        var _this = this;
5986        var thumbList = '';
5987        var vimeoErrorThumbSize = '';
5988        var $thumb;
5989        var html = '<div class="lg-thumb-outer">' +
5990            '<div class="lg-thumb group">' +
5991            '</div>' +
5992            '</div>';
5993
5994        switch (this.core.s.vimeoThumbSize) {
5995            case 'thumbnail_large':
5996                vimeoErrorThumbSize = '640';
5997                break;
5998            case 'thumbnail_medium':
5999                vimeoErrorThumbSize = '200x150';
6000                break;
6001            case 'thumbnail_small':
6002                vimeoErrorThumbSize = '100x75';
6003        }
6004
6005        _this.core.$outer.addClass('lg-has-thumb');
6006
6007        _this.core.$outer.find('.lg').append(html);
6008
6009        _this.$thumbOuter = _this.core.$outer.find('.lg-thumb-outer');
6010        _this.thumbOuterWidth = _this.$thumbOuter.width();
6011
6012        if (_this.core.s.animateThumb) {
6013            _this.core.$outer.find('.lg-thumb').css({
6014                width: _this.thumbTotalWidth + 'px',
6015                position: 'relative'
6016            });
6017        }
6018
6019        if (this.core.s.animateThumb) {
6020            _this.$thumbOuter.css('height', _this.core.s.thumbContHeight + 'px');
6021        }
6022
6023        function getThumb(src, thumb, index) {
6024            var isVideo = _this.core.isVideo(src, index) || {};
6025            var thumbImg;
6026            var vimeoId = '';
6027
6028            if (isVideo.youtube || isVideo.vimeo || isVideo.dailymotion) {
6029                if (isVideo.youtube) {
6030                    if (_this.core.s.loadYoutubeThumbnail) {
6031                        thumbImg = '//img.youtube.com/vi/' + isVideo.youtube[1] + '/' + _this.core.s.youtubeThumbSize + '.jpg';
6032                    } else {
6033                        thumbImg = thumb;
6034                    }
6035                } else if (isVideo.vimeo) {
6036                    if (_this.core.s.loadVimeoThumbnail) {
6037                        thumbImg = '//i.vimeocdn.com/video/error_' + vimeoErrorThumbSize + '.jpg';
6038                        vimeoId = isVideo.vimeo[1];
6039                    } else {
6040                        thumbImg = thumb;
6041                    }
6042                } else if (isVideo.dailymotion) {
6043                    if (_this.core.s.loadDailymotionThumbnail) {
6044                        thumbImg = '//www.dailymotion.com/thumbnail/video/' + isVideo.dailymotion[1];
6045                    } else {
6046                        thumbImg = thumb;
6047                    }
6048                }
6049            } else {
6050                thumbImg = thumb;
6051            }
6052
6053            thumbList += '<div data-vimeo-id="' + vimeoId + '" class="lg-thumb-item" style="width:' + _this.core.s.thumbWidth + 'px; margin-right: ' + _this.core.s.thumbMargin + 'px"><img src="' + thumbImg + '" /></div>';
6054            vimeoId = '';
6055        }
6056
6057        if (_this.core.s.dynamic) {
6058            for (var i = 0; i < _this.core.s.dynamicEl.length; i++) {
6059                getThumb(_this.core.s.dynamicEl[i].src, _this.core.s.dynamicEl[i].thumb, i);
6060            }
6061        } else {
6062            _this.core.$items.each(function(i) {
6063
6064                if (!_this.core.s.exThumbImage) {
6065                    getThumb($(this).attr('href') || $(this).attr('data-src'), $(this).find('img').attr('src'), i);
6066                } else {
6067                    getThumb($(this).attr('href') || $(this).attr('data-src'), $(this).attr(_this.core.s.exThumbImage), i);
6068                }
6069
6070            });
6071        }
6072
6073        _this.core.$outer.find('.lg-thumb').html(thumbList);
6074
6075        $thumb = _this.core.$outer.find('.lg-thumb-item');
6076
6077        // Load vimeo thumbnails
6078        $thumb.each(function() {
6079            var $this = $(this);
6080            var vimeoVideoId = $this.attr('data-vimeo-id');
6081
6082            if (vimeoVideoId) {
6083                $.getJSON('//www.vimeo.com/api/v2/video/' + vimeoVideoId + '.json?callback=?', {
6084                    format: 'json'
6085                }, function(data) {
6086                    $this.find('img').attr('src', data[0][_this.core.s.vimeoThumbSize]);
6087                });
6088            }
6089        });
6090
6091        // manage active class for thumbnail
6092        $thumb.eq(_this.core.index).addClass('active');
6093        _this.core.$el.on('onBeforeSlide.lg.tm', function() {
6094            $thumb.removeClass('active');
6095            $thumb.eq(_this.core.index).addClass('active');
6096        });
6097
6098        $thumb.on('click.lg touchend.lg', function() {
6099            var _$this = $(this);
6100            setTimeout(function() {
6101
6102                // In IE9 and bellow touch does not support
6103                // Go to slide if browser does not support css transitions
6104                if ((_this.thumbClickable && !_this.core.lgBusy) || !_this.core.doCss()) {
6105                    _this.core.index = _$this.index();
6106                    _this.core.slide(_this.core.index, false, true);
6107                }
6108            }, 50);
6109        });
6110
6111        _this.core.$el.on('onBeforeSlide.lg.tm', function() {
6112            _this.animateThumb(_this.core.index);
6113        });
6114
6115        $(window).on('resize.lg.thumb orientationchange.lg.thumb', function() {
6116            setTimeout(function() {
6117                _this.animateThumb(_this.core.index);
6118                _this.thumbOuterWidth = _this.$thumbOuter.width();
6119            }, 200);
6120        });
6121
6122    };
6123
6124    Thumbnail.prototype.setTranslate = function(value) {
6125        // jQuery supports Automatic CSS prefixing since jQuery 1.8.0
6126        this.core.$outer.find('.lg-thumb').css({
6127            transform: 'translate3d(-' + (value) + 'px, 0px, 0px)'
6128        });
6129    };
6130
6131    Thumbnail.prototype.animateThumb = function(index) {
6132        var $thumb = this.core.$outer.find('.lg-thumb');
6133        if (this.core.s.animateThumb) {
6134            var position;
6135            switch (this.core.s.currentPagerPosition) {
6136                case 'left':
6137                    position = 0;
6138                    break;
6139                case 'middle':
6140                    position = (this.thumbOuterWidth / 2) - (this.core.s.thumbWidth / 2);
6141                    break;
6142                case 'right':
6143                    position = this.thumbOuterWidth - this.core.s.thumbWidth;
6144            }
6145            this.left = ((this.core.s.thumbWidth + this.core.s.thumbMargin) * index - 1) - position;
6146            if (this.left > (this.thumbTotalWidth - this.thumbOuterWidth)) {
6147                this.left = this.thumbTotalWidth - this.thumbOuterWidth;
6148            }
6149
6150            if (this.left < 0) {
6151                this.left = 0;
6152            }
6153
6154            if (this.core.lGalleryOn) {
6155                if (!$thumb.hasClass('on')) {
6156                    this.core.$outer.find('.lg-thumb').css('transition-duration', this.core.s.speed + 'ms');
6157                }
6158
6159                if (!this.core.doCss()) {
6160                    $thumb.animate({
6161                        left: -this.left + 'px'
6162                    }, this.core.s.speed);
6163                }
6164            } else {
6165                if (!this.core.doCss()) {
6166                    $thumb.css('left', -this.left + 'px');
6167                }
6168            }
6169
6170            this.setTranslate(this.left);
6171
6172        }
6173    };
6174
6175    // Enable thumbnail dragging and swiping
6176    Thumbnail.prototype.enableThumbDrag = function() {
6177
6178        var _this = this;
6179        var startCoords = 0;
6180        var endCoords = 0;
6181        var isDraging = false;
6182        var isMoved = false;
6183        var tempLeft = 0;
6184
6185        _this.$thumbOuter.addClass('lg-grab');
6186
6187        _this.core.$outer.find('.lg-thumb').on('mousedown.lg.thumb', function(e) {
6188            if (_this.thumbTotalWidth > _this.thumbOuterWidth) {
6189                // execute only on .lg-object
6190                e.preventDefault();
6191                startCoords = e.pageX;
6192                isDraging = true;
6193
6194                // ** Fix for webkit cursor issue https://code.google.com/p/chromium/issues/detail?id=26723
6195                _this.core.$outer.scrollLeft += 1;
6196                _this.core.$outer.scrollLeft -= 1;
6197
6198                // *
6199                _this.thumbClickable = false;
6200                _this.$thumbOuter.removeClass('lg-grab').addClass('lg-grabbing');
6201            }
6202        });
6203
6204        $(window).on('mousemove.lg.thumb', function(e) {
6205            if (isDraging) {
6206                tempLeft = _this.left;
6207                isMoved = true;
6208                endCoords = e.pageX;
6209
6210                _this.$thumbOuter.addClass('lg-dragging');
6211
6212                tempLeft = tempLeft - (endCoords - startCoords);
6213
6214                if (tempLeft > (_this.thumbTotalWidth - _this.thumbOuterWidth)) {
6215                    tempLeft = _this.thumbTotalWidth - _this.thumbOuterWidth;
6216                }
6217
6218                if (tempLeft < 0) {
6219                    tempLeft = 0;
6220                }
6221
6222                // move current slide
6223                _this.setTranslate(tempLeft);
6224
6225            }
6226        });
6227
6228        $(window).on('mouseup.lg.thumb', function() {
6229            if (isMoved) {
6230                isMoved = false;
6231                _this.$thumbOuter.removeClass('lg-dragging');
6232
6233                _this.left = tempLeft;
6234
6235                if (Math.abs(endCoords - startCoords) < _this.core.s.swipeThreshold) {
6236                    _this.thumbClickable = true;
6237                }
6238
6239            } else {
6240                _this.thumbClickable = true;
6241            }
6242
6243            if (isDraging) {
6244                isDraging = false;
6245                _this.$thumbOuter.removeClass('lg-grabbing').addClass('lg-grab');
6246            }
6247        });
6248
6249    };
6250
6251    Thumbnail.prototype.enableThumbSwipe = function() {
6252        var _this = this;
6253        var startCoords = 0;
6254        var endCoords = 0;
6255        var isMoved = false;
6256        var tempLeft = 0;
6257
6258        _this.core.$outer.find('.lg-thumb').on('touchstart.lg', function(e) {
6259            if (_this.thumbTotalWidth > _this.thumbOuterWidth) {
6260                e.preventDefault();
6261                startCoords = e.originalEvent.targetTouches[0].pageX;
6262                _this.thumbClickable = false;
6263            }
6264        });
6265
6266        _this.core.$outer.find('.lg-thumb').on('touchmove.lg', function(e) {
6267            if (_this.thumbTotalWidth > _this.thumbOuterWidth) {
6268                e.preventDefault();
6269                endCoords = e.originalEvent.targetTouches[0].pageX;
6270                isMoved = true;
6271
6272                _this.$thumbOuter.addClass('lg-dragging');
6273
6274                tempLeft = _this.left;
6275
6276                tempLeft = tempLeft - (endCoords - startCoords);
6277
6278                if (tempLeft > (_this.thumbTotalWidth - _this.thumbOuterWidth)) {
6279                    tempLeft = _this.thumbTotalWidth - _this.thumbOuterWidth;
6280                }
6281
6282                if (tempLeft < 0) {
6283                    tempLeft = 0;
6284                }
6285
6286                // move current slide
6287                _this.setTranslate(tempLeft);
6288
6289            }
6290        });
6291
6292        _this.core.$outer.find('.lg-thumb').on('touchend.lg', function() {
6293            if (_this.thumbTotalWidth > _this.thumbOuterWidth) {
6294
6295                if (isMoved) {
6296                    isMoved = false;
6297                    _this.$thumbOuter.removeClass('lg-dragging');
6298                    if (Math.abs(endCoords - startCoords) < _this.core.s.swipeThreshold) {
6299                        _this.thumbClickable = true;
6300                    }
6301
6302                    _this.left = tempLeft;
6303                } else {
6304                    _this.thumbClickable = true;
6305                }
6306            } else {
6307                _this.thumbClickable = true;
6308            }
6309        });
6310
6311    };
6312
6313    Thumbnail.prototype.toogle = function() {
6314        var _this = this;
6315        if (_this.core.s.toogleThumb) {
6316            _this.core.$outer.addClass('lg-can-toggle');
6317            _this.$thumbOuter.append('<span class="lg-toogle-thumb lg-icon"></span>');
6318            _this.core.$outer.find('.lg-toogle-thumb').on('click.lg', function() {
6319                _this.core.$outer.toggleClass('lg-thumb-open');
6320            });
6321        }
6322    };
6323
6324    Thumbnail.prototype.thumbkeyPress = function() {
6325        var _this = this;
6326        $(window).on('keydown.lg.thumb', function(e) {
6327            if (e.keyCode === 38) {
6328                e.preventDefault();
6329                _this.core.$outer.addClass('lg-thumb-open');
6330            } else if (e.keyCode === 40) {
6331                e.preventDefault();
6332                _this.core.$outer.removeClass('lg-thumb-open');
6333            }
6334        });
6335    };
6336
6337    Thumbnail.prototype.destroy = function() {
6338        if (this.core.s.thumbnail && this.core.$items.length > 1) {
6339            $(window).off('resize.lg.thumb orientationchange.lg.thumb keydown.lg.thumb');
6340            this.$thumbOuter.remove();
6341            this.core.$outer.removeClass('lg-has-thumb');
6342        }
6343    };
6344
6345    $.fn.lightGallery.modules.Thumbnail = Thumbnail;
6346
6347})(jQuery, window, document);
6348
6349
6350
6351
6352
6353
6354
6355
6356
6357
6358(function($, window, document, undefined) {
6359
6360    'use strict';
6361
6362    var defaults = {
6363        fullScreen: true
6364    };
6365
6366    var Fullscreen = function(element) {
6367
6368        // get lightGallery core plugin data
6369        this.core = $(element).data('lightGallery');
6370
6371        this.$el = $(element);
6372
6373        // extend module defalut settings with lightGallery core settings
6374        this.core.s = $.extend({}, defaults, this.core.s);
6375
6376        this.init();
6377
6378        return this;
6379    };
6380
6381    Fullscreen.prototype.init = function() {
6382        var fullScreen = '';
6383        if (this.core.s.fullScreen) {
6384
6385            // check for fullscreen browser support
6386            if (!document.fullscreenEnabled && !document.webkitFullscreenEnabled &&
6387                !document.mozFullScreenEnabled && !document.msFullscreenEnabled) {
6388                return;
6389            } else {
6390                fullScreen = '<span class="lg-fullscreen lg-icon"></span>';
6391                this.core.$outer.find('.lg-toolbar').append(fullScreen);
6392                this.fullScreen();
6393            }
6394        }
6395    };
6396
6397    Fullscreen.prototype.requestFullscreen = function() {
6398        var el = document.documentElement;
6399        if (el.requestFullscreen) {
6400            el.requestFullscreen();
6401        } else if (el.msRequestFullscreen) {
6402            el.msRequestFullscreen();
6403        } else if (el.mozRequestFullScreen) {
6404            el.mozRequestFullScreen();
6405        } else if (el.webkitRequestFullscreen) {
6406            el.webkitRequestFullscreen();
6407        }
6408    };
6409
6410    Fullscreen.prototype.exitFullscreen = function() {
6411        if (document.exitFullscreen) {
6412            document.exitFullscreen();
6413        } else if (document.msExitFullscreen) {
6414            document.msExitFullscreen();
6415        } else if (document.mozCancelFullScreen) {
6416            document.mozCancelFullScreen();
6417        } else if (document.webkitExitFullscreen) {
6418            document.webkitExitFullscreen();
6419        }
6420    };
6421
6422    // https://developer.mozilla.org/en-US/docs/Web/Guide/API/DOM/Using_full_screen_mode
6423    Fullscreen.prototype.fullScreen = function() {
6424        var _this = this;
6425
6426        $(document).on('fullscreenchange.lg webkitfullscreenchange.lg mozfullscreenchange.lg MSFullscreenChange.lg', function() {
6427            _this.core.$outer.toggleClass('lg-fullscreen-on');
6428        });
6429
6430        this.core.$outer.find('.lg-fullscreen').on('click.lg', function() {
6431            if (!document.fullscreenElement &&
6432                !document.mozFullScreenElement && !document.webkitFullscreenElement && !document.msFullscreenElement) {
6433                _this.requestFullscreen();
6434            } else {
6435                _this.exitFullscreen();
6436            }
6437        });
6438
6439    };
6440
6441    Fullscreen.prototype.destroy = function() {
6442
6443        // exit from fullscreen if activated
6444        this.exitFullscreen();
6445
6446        $(document).off('fullscreenchange.lg webkitfullscreenchange.lg mozfullscreenchange.lg MSFullscreenChange.lg');
6447    };
6448
6449    $.fn.lightGallery.modules.fullscreen = Fullscreen;
6450
6451})(jQuery, window, document);
6452
6453
6454
6455
6456
6457
6458
6459
6460
6461
6462
6463/**
6464 * Autoplay Plugin
6465 * @version 1.2.0
6466 * @author Sachin N - @sachinchoolur
6467 * @license MIT License (MIT)
6468 */
6469
6470(function($, window, document, undefined) {
6471
6472    'use strict';
6473
6474    var defaults = {
6475        autoplay: false,
6476        pause: 5000,
6477        progressBar: true,
6478        fourceAutoplay: false,
6479        autoplayControls: true,
6480        appendAutoplayControlsTo: '.lg-toolbar'
6481    };
6482
6483    /**
6484     * Creates the autoplay plugin.
6485     * @param {object} element - lightGallery element
6486     */
6487    var Autoplay = function(element) {
6488
6489        this.core = $(element).data('lightGallery');
6490
6491        this.$el = $(element);
6492
6493        // Execute only if items are above 1
6494        if (this.core.$items.length < 2) {
6495            return false;
6496        }
6497
6498        this.core.s = $.extend({}, defaults, this.core.s);
6499        this.interval = false;
6500
6501        // Identify if slide happened from autoplay
6502        this.fromAuto = true;
6503
6504        // Identify if autoplay canceled from touch/drag
6505        this.canceledOnTouch = false;
6506
6507        // save fourceautoplay value
6508        this.fourceAutoplayTemp = this.core.s.fourceAutoplay;
6509
6510        // do not allow progress bar if browser does not support css3 transitions
6511        if (!this.core.doCss()) {
6512            this.core.s.progressBar = false;
6513        }
6514
6515        this.init();
6516
6517        return this;
6518    };
6519
6520    Autoplay.prototype.init = function() {
6521        var _this = this;
6522
6523        // append autoplay controls
6524        if (_this.core.s.autoplayControls) {
6525            _this.controls();
6526        }
6527
6528        // Create progress bar
6529        if (_this.core.s.progressBar) {
6530            _this.core.$outer.find('.lg').append('<div class="lg-progress-bar"><div class="lg-progress"></div></div>');
6531        }
6532
6533        // set progress
6534        _this.progress();
6535
6536        // Start autoplay
6537        if (_this.core.s.autoplay) {
6538            _this.startlAuto();
6539        }
6540
6541        // cancel interval on touchstart and dragstart
6542        _this.$el.on('onDragstart.lg.tm touchstart.lg.tm', function() {
6543            if (_this.interval) {
6544                _this.cancelAuto();
6545                _this.canceledOnTouch = true;
6546            }
6547        });
6548
6549        // restore autoplay if autoplay canceled from touchstart / dragstart
6550        _this.$el.on('onDragend.lg.tm touchend.lg.tm onSlideClick.lg.tm', function() {
6551            if (!_this.interval && _this.canceledOnTouch) {
6552                _this.startlAuto();
6553                _this.canceledOnTouch = false;
6554            }
6555        });
6556
6557    };
6558
6559    Autoplay.prototype.progress = function() {
6560
6561        var _this = this;
6562        var _$progressBar;
6563        var _$progress;
6564
6565        _this.$el.on('onBeforeSlide.lg.tm', function() {
6566
6567            // start progress bar animation
6568            if (_this.core.s.progressBar && _this.fromAuto) {
6569                _$progressBar = _this.core.$outer.find('.lg-progress-bar');
6570                _$progress = _this.core.$outer.find('.lg-progress');
6571                if (_this.interval) {
6572                    _$progress.removeAttr('style');
6573                    _$progressBar.removeClass('lg-start');
6574                    setTimeout(function() {
6575                        _$progress.css('transition', 'width ' + (_this.core.s.speed + _this.core.s.pause) + 'ms ease 0s');
6576                        _$progressBar.addClass('lg-start');
6577                    }, 20);
6578                }
6579            }
6580
6581            // Remove setinterval if slide is triggered manually and fourceautoplay is false
6582            if (!_this.fromAuto && !_this.core.s.fourceAutoplay) {
6583                _this.cancelAuto();
6584            }
6585
6586            _this.fromAuto = false;
6587
6588        });
6589    };
6590
6591    // Manage autoplay via play/stop buttons
6592    Autoplay.prototype.controls = function() {
6593        var _this = this;
6594        var _html = '<span class="lg-autoplay-button lg-icon"></span>';
6595
6596        // Append autoplay controls
6597        $(this.core.s.appendAutoplayControlsTo).append(_html);
6598
6599        _this.core.$outer.find('.lg-autoplay-button').on('click.lg', function() {
6600            if ($(_this.core.$outer).hasClass('lg-show-autoplay')) {
6601                _this.cancelAuto();
6602                _this.core.s.fourceAutoplay = false;
6603            } else {
6604                if (!_this.interval) {
6605                    _this.startlAuto();
6606                    _this.core.s.fourceAutoplay = _this.fourceAutoplayTemp;
6607                }
6608            }
6609        });
6610    };
6611
6612    // Autostart gallery
6613    Autoplay.prototype.startlAuto = function() {
6614        var _this = this;
6615
6616        _this.core.$outer.find('.lg-progress').css('transition', 'width ' + (_this.core.s.speed + _this.core.s.pause) + 'ms ease 0s');
6617        _this.core.$outer.addClass('lg-show-autoplay');
6618        _this.core.$outer.find('.lg-progress-bar').addClass('lg-start');
6619
6620        _this.interval = setInterval(function() {
6621            if (_this.core.index + 1 < _this.core.$items.length) {
6622                _this.core.index = _this.core.index;
6623            } else {
6624                _this.core.index = -1;
6625            }
6626
6627            _this.core.index++;
6628            _this.fromAuto = true;
6629            _this.core.slide(_this.core.index, false, false);
6630        }, _this.core.s.speed + _this.core.s.pause);
6631    };
6632
6633    // cancel Autostart
6634    Autoplay.prototype.cancelAuto = function() {
6635        clearInterval(this.interval);
6636        this.interval = false;
6637        this.core.$outer.find('.lg-progress').removeAttr('style');
6638        this.core.$outer.removeClass('lg-show-autoplay');
6639        this.core.$outer.find('.lg-progress-bar').removeClass('lg-start');
6640    };
6641
6642    Autoplay.prototype.destroy = function() {
6643
6644        this.cancelAuto();
6645        this.core.$outer.find('.lg-progress-bar').remove();
6646    };
6647
6648    $.fn.lightGallery.modules.autoplay = Autoplay;
6649
6650})(jQuery, window, document);
6651
6652
6653
6654
6655
6656
6657
6658
6659
6660
6661(function($, window, document, undefined) {
6662
6663    'use strict';
6664
6665    var defaults = {
6666        scale: 1,
6667        zoom: true,
6668        actualSize: true,
6669        enableZoomAfter: 300
6670    };
6671
6672    var Zoom = function(element) {
6673
6674        this.core = $(element).data('lightGallery');
6675
6676        this.core.s = $.extend({}, defaults, this.core.s);
6677
6678        if (this.core.s.zoom && this.core.doCss()) {
6679            this.init();
6680
6681            // Store the zoomable timeout value just to clear it while closing
6682            this.zoomabletimeout = false;
6683
6684            // Set the initial value center
6685            this.pageX = $(window).width() / 2;
6686            this.pageY = ($(window).height() / 2) + $(window).scrollTop();
6687        }
6688
6689        return this;
6690    };
6691
6692    Zoom.prototype.init = function() {
6693
6694        var _this = this;
6695        var zoomIcons = '<span id="lg-zoom-in" class="lg-icon"></span><span id="lg-zoom-out" class="lg-icon"></span>';
6696
6697        if (_this.core.s.actualSize) {
6698            zoomIcons += '<span id="lg-actual-size" class="lg-icon"></span>';
6699        }
6700
6701        this.core.$outer.find('.lg-toolbar').append(zoomIcons);
vendor: 16,384 bytes, lines 6702-7182
6702
6703        // Add zoomable class
6704        _this.core.$el.on('onSlideItemLoad.lg.tm.zoom', function(event, index, delay) {
6705
6706            // delay will be 0 except first time
6707            var _speed = _this.core.s.enableZoomAfter + delay;
6708
6709            // set _speed value 0 if gallery opened from direct url and if it is first slide
6710            if ($('body').hasClass('lg-from-hash') && delay) {
6711
6712                // will execute only once
6713                _speed = 0;
6714            } else {
6715
6716                // Remove lg-from-hash to enable starting animation.
6717                $('body').removeClass('lg-from-hash');
6718            }
6719
6720            _this.zoomabletimeout = setTimeout(function() {
6721                _this.core.$slide.eq(index).addClass('lg-zoomable');
6722            }, _speed + 30);
6723        });
6724
6725        var scale = 1;
6726        /**
6727         * @desc Image zoom
6728         * Translate the wrap and scale the image to get better user experience
6729         *
6730         * @param {String} scaleVal - Zoom decrement/increment value
6731         */
6732        var zoom = function(scaleVal) {
6733
6734            var $image = _this.core.$outer.find('.lg-current .lg-image');
6735            var _x;
6736            var _y;
6737
6738            // Find offset manually to avoid issue after zoom
6739            var offsetX = ($(window).width() - $image.width()) / 2;
6740            var offsetY = (($(window).height() - $image.height()) / 2) + $(window).scrollTop();
6741
6742            _x = _this.pageX - offsetX;
6743            _y = _this.pageY - offsetY;
6744
6745            var x = (scaleVal - 1) * (_x);
6746            var y = (scaleVal - 1) * (_y);
6747
6748            $image.css('transform', 'scale3d(' + scaleVal + ', ' + scaleVal + ', 1)').attr('data-scale', scaleVal);
6749
6750            $image.parent().css({
6751                left: -x + 'px',
6752                top: -y + 'px'
6753            }).attr('data-x', x).attr('data-y', y);
6754        };
6755
6756        var callScale = function() {
6757            if (scale > 1) {
6758                _this.core.$outer.addClass('lg-zoomed');
6759            } else {
6760                _this.resetZoom();
6761            }
6762
6763            if (scale < 1) {
6764                scale = 1;
6765            }
6766
6767            zoom(scale);
6768        };
6769
6770        var actualSize = function(event, $image, index, fromIcon) {
6771            var w = $image.width();
6772            var nw;
6773            if (_this.core.s.dynamic) {
6774                nw = _this.core.s.dynamicEl[index].width || $image[0].naturalWidth || w;
6775            } else {
6776                nw = _this.core.$items.eq(index).attr('data-width') || $image[0].naturalWidth || w;
6777            }
6778
6779            var _scale;
6780
6781            if (_this.core.$outer.hasClass('lg-zoomed')) {
6782                scale = 1;
6783            } else {
6784                if (nw > w) {
6785                    _scale = nw / w;
6786                    scale = _scale || 2;
6787                }
6788            }
6789
6790            if (fromIcon) {
6791                _this.pageX = $(window).width() / 2;
6792                _this.pageY = ($(window).height() / 2) + $(window).scrollTop();
6793            } else {
6794                _this.pageX = event.pageX || event.originalEvent.targetTouches[0].pageX;
6795                _this.pageY = event.pageY || event.originalEvent.targetTouches[0].pageY;
6796            }
6797
6798            callScale();
6799            setTimeout(function() {
6800                _this.core.$outer.removeClass('lg-grabbing').addClass('lg-grab');
6801            }, 10);
6802        };
6803
6804        var tapped = false;
6805
6806        // event triggered after appending slide content
6807        _this.core.$el.on('onAferAppendSlide.lg.tm.zoom', function(event, index) {
6808
6809            // Get the current element
6810            var $image = _this.core.$slide.eq(index).find('.lg-image');
6811
6812            $image.on('dblclick', function(event) {
6813                actualSize(event, $image, index);
6814            });
6815
6816            $image.on('touchstart', function(event) {
6817                if (!tapped) {
6818                    tapped = setTimeout(function() {
6819                        tapped = null;
6820                    }, 300);
6821                } else {
6822                    clearTimeout(tapped);
6823                    tapped = null;
6824                    actualSize(event, $image, index);
6825                }
6826
6827                event.preventDefault();
6828            });
6829
6830        });
6831
6832        // Update zoom on resize and orientationchange
6833        $(window).on('resize.lg.zoom scroll.lg.zoom orientationchange.lg.zoom', function() {
6834            _this.pageX = $(window).width() / 2;
6835            _this.pageY = ($(window).height() / 2) + $(window).scrollTop();
6836            zoom(scale);
6837        });
6838
6839        $('#lg-zoom-out').on('click.lg', function() {
6840            if (_this.core.$outer.find('.lg-current .lg-image').length) {
6841                scale -= _this.core.s.scale;
6842                callScale();
6843            }
6844        });
6845
6846        $('#lg-zoom-in').on('click.lg', function() {
6847            if (_this.core.$outer.find('.lg-current .lg-image').length) {
6848                scale += _this.core.s.scale;
6849                callScale();
6850            }
6851        });
6852
6853        $('#lg-actual-size').on('click.lg', function(event) {
6854            actualSize(event, _this.core.$slide.eq(_this.core.index).find('.lg-image'), _this.core.index, true);
6855        });
6856
6857        // Reset zoom on slide change
6858        _this.core.$el.on('onBeforeSlide.lg.tm', function() {
6859            scale = 1;
6860            _this.resetZoom();
6861        });
6862
6863        // Drag option after zoom
6864        if (!_this.core.isTouch) {
6865            _this.zoomDrag();
6866        }
6867
6868        if (_this.core.isTouch) {
6869            _this.zoomSwipe();
6870        }
6871
6872    };
6873
6874    // Reset zoom effect
6875    Zoom.prototype.resetZoom = function() {
6876        this.core.$outer.removeClass('lg-zoomed');
6877        this.core.$slide.find('.lg-img-wrap').removeAttr('style data-x data-y');
6878        this.core.$slide.find('.lg-image').removeAttr('style data-scale');
6879
6880        // Reset pagx pagy values to center
6881        this.pageX = $(window).width() / 2;
6882        this.pageY = ($(window).height() / 2) + $(window).scrollTop();
6883    };
6884
6885    Zoom.prototype.zoomSwipe = function() {
6886        var _this = this;
6887        var startCoords = {};
6888        var endCoords = {};
6889        var isMoved = false;
6890
6891        // Allow x direction drag
6892        var allowX = false;
6893
6894        // Allow Y direction drag
6895        var allowY = false;
6896
6897        _this.core.$slide.on('touchstart.lg', function(e) {
6898
6899            if (_this.core.$outer.hasClass('lg-zoomed')) {
6900                var $image = _this.core.$slide.eq(_this.core.index).find('.lg-object');
6901
6902                allowY = $image.outerHeight() * $image.attr('data-scale') > _this.core.$outer.find('.lg').height();
6903                allowX = $image.outerWidth() * $image.attr('data-scale') > _this.core.$outer.find('.lg').width();
6904                if ((allowX || allowY)) {
6905                    e.preventDefault();
6906                    startCoords = {
6907                        x: e.originalEvent.targetTouches[0].pageX,
6908                        y: e.originalEvent.targetTouches[0].pageY
6909                    };
6910                }
6911            }
6912
6913        });
6914
6915        _this.core.$slide.on('touchmove.lg', function(e) {
6916
6917            if (_this.core.$outer.hasClass('lg-zoomed')) {
6918
6919                var _$el = _this.core.$slide.eq(_this.core.index).find('.lg-img-wrap');
6920                var distanceX;
6921                var distanceY;
6922
6923                e.preventDefault();
6924                isMoved = true;
6925
6926                endCoords = {
6927                    x: e.originalEvent.targetTouches[0].pageX,
6928                    y: e.originalEvent.targetTouches[0].pageY
6929                };
6930
6931                // reset opacity and transition duration
6932                _this.core.$outer.addClass('lg-zoom-dragging');
6933
6934                if (allowY) {
6935                    distanceY = (-Math.abs(_$el.attr('data-y'))) + (endCoords.y - startCoords.y);
6936                } else {
6937                    distanceY = -Math.abs(_$el.attr('data-y'));
6938                }
6939
6940                if (allowX) {
6941                    distanceX = (-Math.abs(_$el.attr('data-x'))) + (endCoords.x - startCoords.x);
6942                } else {
6943                    distanceX = -Math.abs(_$el.attr('data-x'));
6944                }
6945
6946                if ((Math.abs(endCoords.x - startCoords.x) > 15) || (Math.abs(endCoords.y - startCoords.y) > 15)) {
6947                    _$el.css({
6948                        left: distanceX + 'px',
6949                        top: distanceY + 'px'
6950                    });
6951                }
6952
6953            }
6954
6955        });
6956
6957        _this.core.$slide.on('touchend.lg', function() {
6958            if (_this.core.$outer.hasClass('lg-zoomed')) {
6959                if (isMoved) {
6960                    isMoved = false;
6961                    _this.core.$outer.removeClass('lg-zoom-dragging');
6962                    _this.touchendZoom(startCoords, endCoords, allowX, allowY);
6963
6964                }
6965            }
6966        });
6967
6968    };
6969
6970    Zoom.prototype.zoomDrag = function() {
6971
6972        var _this = this;
6973        var startCoords = {};
6974        var endCoords = {};
6975        var isDraging = false;
6976        var isMoved = false;
6977
6978        // Allow x direction drag
6979        var allowX = false;
6980
6981        // Allow Y direction drag
6982        var allowY = false;
6983
6984        _this.core.$slide.on('mousedown.lg.zoom', function(e) {
6985
6986            // execute only on .lg-object
6987            var $image = _this.core.$slide.eq(_this.core.index).find('.lg-object');
6988
6989            allowY = $image.outerHeight() * $image.attr('data-scale') > _this.core.$outer.find('.lg').height();
6990            allowX = $image.outerWidth() * $image.attr('data-scale') > _this.core.$outer.find('.lg').width();
6991
6992            if (_this.core.$outer.hasClass('lg-zoomed')) {
6993                if ($(e.target).hasClass('lg-object') && (allowX || allowY)) {
6994                    e.preventDefault();
6995                    startCoords = {
6996                        x: e.pageX,
6997                        y: e.pageY
6998                    };
6999
7000                    isDraging = true;
7001
7002                    // ** Fix for webkit cursor issue https://code.google.com/p/chromium/issues/detail?id=26723
7003                    _this.core.$outer.scrollLeft += 1;
7004                    _this.core.$outer.scrollLeft -= 1;
7005
7006                    _this.core.$outer.removeClass('lg-grab').addClass('lg-grabbing');
7007                }
7008            }
7009        });
7010
7011        $(window).on('mousemove.lg.zoom', function(e) {
7012            if (isDraging) {
7013                var _$el = _this.core.$slide.eq(_this.core.index).find('.lg-img-wrap');
7014                var distanceX;
7015                var distanceY;
7016
7017                isMoved = true;
7018                endCoords = {
7019                    x: e.pageX,
7020                    y: e.pageY
7021                };
7022
7023                // reset opacity and transition duration
7024                _this.core.$outer.addClass('lg-zoom-dragging');
7025
7026                if (allowY) {
7027                    distanceY = (-Math.abs(_$el.attr('data-y'))) + (endCoords.y - startCoords.y);
7028                } else {
7029                    distanceY = -Math.abs(_$el.attr('data-y'));
7030                }
7031
7032                if (allowX) {
7033                    distanceX = (-Math.abs(_$el.attr('data-x'))) + (endCoords.x - startCoords.x);
7034                } else {
7035                    distanceX = -Math.abs(_$el.attr('data-x'));
7036                }
7037
7038                _$el.css({
7039                    left: distanceX + 'px',
7040                    top: distanceY + 'px'
7041                });
7042            }
7043        });
7044
7045        $(window).on('mouseup.lg.zoom', function(e) {
7046
7047            if (isDraging) {
7048                isDraging = false;
7049                _this.core.$outer.removeClass('lg-zoom-dragging');
7050
7051                // Fix for chrome mouse move on click
7052                if (isMoved && ((startCoords.x !== endCoords.x) || (startCoords.y !== endCoords.y))) {
7053                    endCoords = {
7054                        x: e.pageX,
7055                        y: e.pageY
7056                    };
7057                    _this.touchendZoom(startCoords, endCoords, allowX, allowY);
7058
7059                }
7060
7061                isMoved = false;
7062            }
7063
7064            _this.core.$outer.removeClass('lg-grabbing').addClass('lg-grab');
7065
7066        });
7067    };
7068
7069    Zoom.prototype.touchendZoom = function(startCoords, endCoords, allowX, allowY) {
7070
7071        var _this = this;
7072        var _$el = _this.core.$slide.eq(_this.core.index).find('.lg-img-wrap');
7073        var $image = _this.core.$slide.eq(_this.core.index).find('.lg-object');
7074        var distanceX = (-Math.abs(_$el.attr('data-x'))) + (endCoords.x - startCoords.x);
7075        var distanceY = (-Math.abs(_$el.attr('data-y'))) + (endCoords.y - startCoords.y);
7076        var minY = (_this.core.$outer.find('.lg').height() - $image.outerHeight()) / 2;
7077        var maxY = Math.abs(($image.outerHeight() * Math.abs($image.attr('data-scale'))) - _this.core.$outer.find('.lg').height() + minY);
7078        var minX = (_this.core.$outer.find('.lg').width() - $image.outerWidth()) / 2;
7079        var maxX = Math.abs(($image.outerWidth() * Math.abs($image.attr('data-scale'))) - _this.core.$outer.find('.lg').width() + minX);
7080
7081        if ((Math.abs(endCoords.x - startCoords.x) > 15) || (Math.abs(endCoords.y - startCoords.y) > 15)) {
7082            if (allowY) {
7083                if (distanceY <= -maxY) {
7084                    distanceY = -maxY;
7085                } else if (distanceY >= -minY) {
7086                    distanceY = -minY;
7087                }
7088            }
7089
7090            if (allowX) {
7091                if (distanceX <= -maxX) {
7092                    distanceX = -maxX;
7093                } else if (distanceX >= -minX) {
7094                    distanceX = -minX;
7095                }
7096            }
7097
7098            if (allowY) {
7099                _$el.attr('data-y', Math.abs(distanceY));
7100            } else {
7101                distanceY = -Math.abs(_$el.attr('data-y'));
7102            }
7103
7104            if (allowX) {
7105                _$el.attr('data-x', Math.abs(distanceX));
7106            } else {
7107                distanceX = -Math.abs(_$el.attr('data-x'));
7108            }
7109
7110            _$el.css({
7111                left: distanceX + 'px',
7112                top: distanceY + 'px'
7113            });
7114
7115        }
7116    };
7117
7118    Zoom.prototype.destroy = function() {
7119
7120        var _this = this;
7121
7122        // Unbind all events added by lightGallery zoom plugin
7123        _this.core.$el.off('.lg.zoom');
7124        $(window).off('.lg.zoom');
7125        _this.core.$slide.off('.lg.zoom');
7126        _this.core.$el.off('.lg.tm.zoom');
7127        _this.resetZoom();
7128        clearTimeout(_this.zoomabletimeout);
7129        _this.zoomabletimeout = false;
7130    };
7131
7132    $.fn.lightGallery.modules.zoom = Zoom;
7133
7134})(jQuery, window, document);
7135
7136
7137
7138
7139
7140
7141
7142
7143
7144(function($, window, document, undefined) {
7145
7146    'use strict';
7147
7148    var defaults = {
7149        pager: false
7150    };
7151
7152    var Pager = function(element) {
7153
7154        this.core = $(element).data('lightGallery');
7155
7156        this.$el = $(element);
7157        this.core.s = $.extend({}, defaults, this.core.s);
7158        if (this.core.s.pager && this.core.$items.length > 1) {
7159            this.init();
7160        }
7161
7162        return this;
7163    };
7164
7165    Pager.prototype.init = function() {
7166        var _this = this;
7167        var pagerList = '';
7168        var $pagerCont;
7169        var $pagerOuter;
7170        var timeout;
7171
7172        _this.core.$outer.find('.lg').append('<div class="lg-pager-outer"></div>');
7173
7174        if (_this.core.s.dynamic) {
7175            for (var i = 0; i < _this.core.s.dynamicEl.length; i++) {
7176                pagerList += '<span class="lg-pager-cont"> <span class="lg-pager"></span><div class="lg-pager-thumb-cont"><span class="lg-caret"></span> <img src="' + _this.core.s.dynamicEl[i].thumb + '" /></div></span>';
7177            }
7178        } else {
7179            _this.core.$items.each(function() {
7180
7181                if (!_this.core.s.exThumbImage) {
7182                    pagerList += '<span class="lg-pager-cont"> <span class="lg-pager"></span><div class="lg-pager-thumb-cont"><span class="lg-caret"></span> <img src="' + $(this).find('img')
vendor: 1,451 bytes, lines 7182-7225
7182.attr('src') + '" /></div></span>';
7183                } else {
7184                    pagerList += '<span class="lg-pager-cont"> <span class="lg-pager"></span><div class="lg-pager-thumb-cont"><span class="lg-caret"></span> <img src="' + $(this).attr(_this.core.s.exThumbImage) + '" /></div></span>';
7185                }
7186
7187            });
7188        }
7189
7190        $pagerOuter = _this.core.$outer.find('.lg-pager-outer');
7191
7192        $pagerOuter.html(pagerList);
7193
7194        $pagerCont = _this.core.$outer.find('.lg-pager-cont');
7195        $pagerCont.on('click.lg touchend.lg', function() {
7196            var _$this = $(this);
7197            _this.core.index = _$this.index();
7198            _this.core.slide(_this.core.index, false, false);
7199        });
7200
7201        $pagerOuter.on('mouseover.lg', function() {
7202            clearTimeout(timeout);
7203            $pagerOuter.addClass('lg-pager-hover');
7204        });
7205
7206        $pagerOuter.on('mouseout.lg', function() {
7207            timeout = setTimeout(function() {
7208                $pagerOuter.removeClass('lg-pager-hover');
7209            });
7210        });
7211
7212        _this.core.$el.on('onBeforeSlide.lg.tm', function(e, prevIndex, index) {
7213            $pagerCont.removeClass('lg-pager-active');
7214            $pagerCont.eq(index).addClass('lg-pager-active');
7215        });
7216
7217    };
7218
7219    Pager.prototype.destroy = function() {
7220
7221    };
7222
7223    $.fn.lightGallery.modules.pager = Pager;
7224
7225})(jQuery, window, document);

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