PageSourceSearch

https://bps.gub.uy/bps/home2021/js/scripts.js?v=3

js bps.gub.uy collected 2026-10-03 19:47:32 UTC 101,077 bytes, 3,090 lines download raw bytes

vendor: 16,932 bytes, lines 1-562
1/* ========================================================================
2 * Bootstrap: collapse.js v3.3.6
3 * http://getbootstrap.com/javascript/#collapse
4 * ========================================================================
5 * Copyright 2011-2015 Twitter, Inc.
6 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
7 * ======================================================================== */
8
9
10+function ($) {
11  'use strict';
12
13  // COLLAPSE PUBLIC CLASS DEFINITION
14  // ================================
15
16  var Collapse = function (element, options) {
17    this.$element      = $(element)
18    this.options       = $.extend({}, Collapse.DEFAULTS, options)
19    this.$trigger      = $('[data-toggle="collapse"][href="#' + element.id + '"],' +
20                           '[data-toggle="collapse"][data-target="#' + element.id + '"]')
21    this.transitioning = null
22
23    if (this.options.parent) {
24      this.$parent = this.getParent()
25    } else {
26      this.addAriaAndCollapsedClass(this.$element, this.$trigger)
27    }
28
29    if (this.options.toggle) this.toggle()
30  }
31
32  Collapse.VERSION  = '3.3.6'
33
34  Collapse.TRANSITION_DURATION = 350
35
36  Collapse.DEFAULTS = {
37    toggle: true
38  }
39
40  Collapse.prototype.dimension = function () {
41    var hasWidth = this.$element.hasClass('width')
42    return hasWidth ? 'width' : 'height'
43  }
44
45  Collapse.prototype.show = function () {
46    if (this.transitioning || this.$element.hasClass('in')) return
47
48    var activesData
49    var actives = this.$parent && this.$parent.children('.panel').children('.in, .collapsing')
50
51    if (actives && actives.length) {
52      activesData = actives.data('bs.collapse')
53      if (activesData && activesData.transitioning) return
54    }
55
56    var startEvent = $.Event('show.bs.collapse')
57    this.$element.trigger(startEvent)
58    if (startEvent.isDefaultPrevented()) return
59
60    if (actives && actives.length) {
61      Plugin.call(actives, 'hide')
62      activesData || actives.data('bs.collapse', null)
63    }
64
65    var dimension = this.dimension()
66
67    this.$element
68      .removeClass('collapse')
69      .addClass('collapsing')[dimension](0)
70      .attr('aria-expanded', true)
71
72    this.$trigger
73      .removeClass('collapsed')
74      .attr('aria-expanded', true)
75
76    this.transitioning = 1
77
78    var complete = function () {
79      this.$element
80        .removeClass('collapsing')
81        .addClass('collapse in')[dimension]('')
82      this.transitioning = 0
83      this.$element
84        .trigger('shown.bs.collapse')
85    }
86
87    if (!$.support.transition) return complete.call(this)
88
89    var scrollSize = $.camelCase(['scroll', dimension].join('-'))
90
91    this.$element
92      .one('bsTransitionEnd', $.proxy(complete, this))
93      .emulateTransitionEnd(Collapse.TRANSITION_DURATION)[dimension](this.$element[0][scrollSize])
94  }
95
96  Collapse.prototype.hide = function () {
97    if (this.transitioning || !this.$element.hasClass('in')) return
98
99    var startEvent = $.Event('hide.bs.collapse')
100    this.$element.trigger(startEvent)
101    if (startEvent.isDefaultPrevented()) return
102
103    var dimension = this.dimension()
104
105    this.$element[dimension](this.$element[dimension]())[0].offsetHeight
106
107    this.$element
108      .addClass('collapsing')
109      .removeClass('collapse in')
110      .attr('aria-expanded', false)
111
112    this.$trigger
113      .addClass('collapsed')
114      .attr('aria-expanded', false)
115
116    this.transitioning = 1
117
118    var complete = function () {
119      this.transitioning = 0
120      this.$element
121        .removeClass('collapsing')
122        .addClass('collapse')
123        .trigger('hidden.bs.collapse')
124    }
125
126    if (!$.support.transition) return complete.call(this)
127
128    this.$element
129      [dimension](0)
130      .one('bsTransitionEnd', $.proxy(complete, this))
131      .emulateTransitionEnd(Collapse.TRANSITION_DURATION)
132  }
133
134  Collapse.prototype.toggle = function () {
135    this[this.$element.hasClass('in') ? 'hide' : 'show']()
136  }
137
138  Collapse.prototype.getParent = function () {
139    return $(this.options.parent)
140      .find('[data-toggle="collapse"][data-parent="' + this.options.parent + '"]')
141      .each($.proxy(function (i, element) {
142        var $element = $(element)
143        this.addAriaAndCollapsedClass(getTargetFromTrigger($element), $element)
144      }, this))
145      .end()
146  }
147
148  Collapse.prototype.addAriaAndCollapsedClass = function ($element, $trigger) {
149    var isOpen = $element.hasClass('in')
150
151    $element.attr('aria-expanded', isOpen)
152    $trigger
153      .toggleClass('collapsed', !isOpen)
154      .attr('aria-expanded', isOpen)
155  }
156
157  function getTargetFromTrigger($trigger) {
158    var href
159    var target = $trigger.attr('data-target')
160      || (href = $trigger.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') // strip for ie7
161
162    return $(target)
163  }
164
165
166  // COLLAPSE PLUGIN DEFINITION
167  // ==========================
168
169  function Plugin(option) {
170    return this.each(function () {
171      var $this   = $(this)
172      var data    = $this.data('bs.collapse')
173      var options = $.extend({}, Collapse.DEFAULTS, $this.data(), typeof option == 'object' && option)
174
175      if (!data && options.toggle && /show|hide/.test(option)) options.toggle = false
176      if (!data) $this.data('bs.collapse', (data = new Collapse(this, options)))
177      if (typeof option == 'string') data[option]()
178    })
179  }
180
181  var old = $.fn.collapse
182
183  $.fn.collapse             = Plugin
184  $.fn.collapse.Constructor = Collapse
185
186
187  // COLLAPSE NO CONFLICT
188  // ====================
189
190  $.fn.collapse.noConflict = function () {
191    $.fn.collapse = old
192    return this
193  }
194
195
196  // COLLAPSE DATA-API
197  // =================
198
199  $(document).on('click.bs.collapse.data-api', '[data-toggle="collapse"]', function (e) {
200    var $this   = $(this)
201
202    if (!$this.attr('data-target')) e.preventDefault()
203
204    var $target = getTargetFromTrigger($this)
205    var data    = $target.data('bs.collapse')
206    var option  = data ? 'toggle' : $this.data()
207
208    Plugin.call($target, option)
209  })
210
211}(jQuery);
212
213/* ========================================================================
214 * Bootstrap: modal.js v3.3.6
215 * http://getbootstrap.com/javascript/#modals
216 * ========================================================================
217 * Copyright 2011-2015 Twitter, Inc.
218 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
219 * ======================================================================== */
220
221
222+function ($) {
223  'use strict';
224
225  // MODAL CLASS DEFINITION
226  // ======================
227
228  var Modal = function (element, options) {
229    this.options             = options
230    this.$body               = $(document.body)
231    this.$element            = $(element)
232    this.$dialog             = this.$element.find('.modal-dialog')
233    this.$backdrop           = null
234    this.isShown             = null
235    this.originalBodyPad     = null
236    this.scrollbarWidth      = 0
237    this.ignoreBackdropClick = false
238
239    if (this.options.remote) {
240      this.$element
241        .find('.modal-content')
242        .load(this.options.remote, $.proxy(function () {
243          this.$element.trigger('loaded.bs.modal')
244        }, this))
245    }
246  }
247
248  Modal.VERSION  = '3.3.6'
249
250  Modal.TRANSITION_DURATION = 300
251  Modal.BACKDROP_TRANSITION_DURATION = 150
252
253  Modal.DEFAULTS = {
254    backdrop: true,
255    keyboard: true,
256    show: true
257  }
258
259  Modal.prototype.toggle = function (_relatedTarget) {
260    return this.isShown ? this.hide() : this.show(_relatedTarget)
261  }
262
263  Modal.prototype.show = function (_relatedTarget) {
264    var that = this
265    var e    = $.Event('show.bs.modal', { relatedTarget: _relatedTarget })
266
267    this.$element.trigger(e)
268
269    if (this.isShown || e.isDefaultPrevented()) return
270
271    this.isShown = true
272
273    this.checkScrollbar()
274    this.setScrollbar()
275    this.$body.addClass('modal-open')
276
277    this.escape()
278    this.resize()
279
280    this.$element.on('click.dismiss.bs.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this))
281
282    this.$dialog.on('mousedown.dismiss.bs.modal', function () {
283      that.$element.one('mouseup.dismiss.bs.modal', function (e) {
284        if ($(e.target).is(that.$element)) that.ignoreBackdropClick = true
285      })
286    })
287
288    this.backdrop(function () {
289      var transition = $.support.transition && that.$element.hasClass('fade')
290
291      if (!that.$element.parent().length) {
292        that.$element.appendTo(that.$body) // don't move modals dom position
293      }
294
295      that.$element
296        .show()
297        .scrollTop(0)
298
299      that.adjustDialog()
300
301      if (transition) {
302        that.$element[0].offsetWidth // force reflow
303      }
304
305      that.$element.addClass('in')
306
307      that.enforceFocus()
308
309      var e = $.Event('shown.bs.modal', { relatedTarget: _relatedTarget })
310
311      transition ?
312        that.$dialog // wait for modal to slide in
313          .one('bsTransitionEnd', function () {
314            that.$element.trigger('focus').trigger(e)
315          })
316          .emulateTransitionEnd(Modal.TRANSITION_DURATION) :
317        that.$element.trigger('focus').trigger(e)
318    })
319  }
320
321  Modal.prototype.hide = function (e) {
322    if (e) e.preventDefault()
323
324    e = $.Event('hide.bs.modal')
325
326    this.$element.trigger(e)
327
328    if (!this.isShown || e.isDefaultPrevented()) return
329
330    this.isShown = false
331
332    this.escape()
333    this.resize()
334
335    $(document).off('focusin.bs.modal')
336
337    this.$element
338      .removeClass('in')
339      .off('click.dismiss.bs.modal')
340      .off('mouseup.dismiss.bs.modal')
341
342    this.$dialog.off('mousedown.dismiss.bs.modal')
343
344    $.support.transition && this.$element.hasClass('fade') ?
345      this.$element
346        .one('bsTransitionEnd', $.proxy(this.hideModal, this))
347        .emulateTransitionEnd(Modal.TRANSITION_DURATION) :
348      this.hideModal()
349  }
350
351  Modal.prototype.enforceFocus = function () {
352    $(document)
353      .off('focusin.bs.modal') // guard against infinite focus loop
354      .on('focusin.bs.modal', $.proxy(function (e) {
355        if (this.$element[0] !== e.target && !this.$element.has(e.target).length) {
356          this.$element.trigger('focus')
357        }
358      }, this))
359  }
360
361  Modal.prototype.escape = function () {
362    if (this.isShown && this.options.keyboard) {
363      this.$element.on('keydown.dismiss.bs.modal', $.proxy(function (e) {
364        e.which == 27 && this.hide()
365      }, this))
366    } else if (!this.isShown) {
367      this.$element.off('keydown.dismiss.bs.modal')
368    }
369  }
370
371  Modal.prototype.resize = function () {
372    if (this.isShown) {
373      $(window).on('resize.bs.modal', $.proxy(this.handleUpdate, this))
374    } else {
375      $(window).off('resize.bs.modal')
376    }
377  }
378
379  Modal.prototype.hideModal = function () {
380    var that = this
381    this.$element.hide()
382    this.backdrop(function () {
383      that.$body.removeClass('modal-open')
384      that.resetAdjustments()
385      that.resetScrollbar()
386      that.$element.trigger('hidden.bs.modal')
387    })
388  }
389
390  Modal.prototype.removeBackdrop = function () {
391    this.$backdrop && this.$backdrop.remove()
392    this.$backdrop = null
393  }
394
395  Modal.prototype.backdrop = function (callback) {
396    var that = this
397    var animate = this.$element.hasClass('fade') ? 'fade' : ''
398
399    if (this.isShown && this.options.backdrop) {
400      var doAnimate = $.support.transition && animate
401
402      this.$backdrop = $(document.createElement('div'))
403        .addClass('modal-backdrop ' + animate)
404        .appendTo(this.$body)
405
406      this.$element.on('click.dismiss.bs.modal', $.proxy(function (e) {
407        if (this.ignoreBackdropClick) {
408          this.ignoreBackdropClick = false
409          return
410        }
411        if (e.target !== e.currentTarget) return
412        this.options.backdrop == 'static'
413          ? this.$element[0].focus()
414          : this.hide()
415      }, this))
416
417      if (doAnimate) this.$backdrop[0].offsetWidth // force reflow
418
419      this.$backdrop.addClass('in')
420
421      if (!callback) return
422
423      doAnimate ?
424        this.$backdrop
425          .one('bsTransitionEnd', callback)
426          .emulateTransitionEnd(Modal.BACKDROP_TRANSITION_DURATION) :
427        callback()
428
429    } else if (!this.isShown && this.$backdrop) {
430      this.$backdrop.removeClass('in')
431
432      var callbackRemove = function () {
433        that.removeBackdrop()
434        callback && callback()
435      }
436      $.support.transition && this.$element.hasClass('fade') ?
437        this.$backdrop
438          .one('bsTransitionEnd', callbackRemove)
439          .emulateTransitionEnd(Modal.BACKDROP_TRANSITION_DURATION) :
440        callbackRemove()
441
442    } else if (callback) {
443      callback()
444    }
445  }
446
447  // these following methods are used to handle overflowing modals
448
449  Modal.prototype.handleUpdate = function () {
450    this.adjustDialog()
451  }
452
453  Modal.prototype.adjustDialog = function () {
454    var modalIsOverflowing = this.$element[0].scrollHeight > document.documentElement.clientHeight
455
456    this.$element.css({
457      paddingLeft:  !this.bodyIsOverflowing && modalIsOverflowing ? this.scrollbarWidth : '',
458      paddingRight: this.bodyIsOverflowing && !modalIsOverflowing ? this.scrollbarWidth : ''
459    })
460  }
461
462  Modal.prototype.resetAdjustments = function () {
463    this.$element.css({
464      paddingLeft: '',
465      paddingRight: ''
466    })
467  }
468
469  Modal.prototype.checkScrollbar = function () {
470    var fullWindowWidth = window.innerWidth
471    if (!fullWindowWidth) { // workaround for missing window.innerWidth in IE8
472      var documentElementRect = document.documentElement.getBoundingClientRect()
473      fullWindowWidth = documentElementRect.right - Math.abs(documentElementRect.left)
474    }
475    this.bodyIsOverflowing = document.body.clientWidth < fullWindowWidth
476    this.scrollbarWidth = this.measureScrollbar()
477  }
478
479  Modal.prototype.setScrollbar = function () {
480    var bodyPad = parseInt((this.$body.css('padding-right') || 0), 10)
481    this.originalBodyPad = document.body.style.paddingRight || ''
482    if (this.bodyIsOverflowing) this.$body.css('padding-right', bodyPad + this.scrollbarWidth)
483  }
484
485  Modal.prototype.resetScrollbar = function () {
486    this.$body.css('padding-right', this.originalBodyPad)
487  }
488
489  Modal.prototype.measureScrollbar = function () { // thx walsh
490    var scrollDiv = document.createElement('div')
491    scrollDiv.className = 'modal-scrollbar-measure'
492    this.$body.append(scrollDiv)
493    var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth
494    this.$body[0].removeChild(scrollDiv)
495    return scrollbarWidth
496  }
497
498
499  // MODAL PLUGIN DEFINITION
500  // =======================
501
502  function Plugin(option, _relatedTarget) {
503    return this.each(function () {
504      var $this   = $(this)
505      var data    = $this.data('bs.modal')
506      var options = $.extend({}, Modal.DEFAULTS, $this.data(), typeof option == 'object' && option)
507
508      if (!data) $this.data('bs.modal', (data = new Modal(this, options)))
509      if (typeof option == 'string') data[option](_relatedTarget)
510      else if (options.show) data.show(_relatedTarget)
511    })
512  }
513
514  var old = $.fn.modal
515
516  $.fn.modal             = Plugin
517  $.fn.modal.Constructor = Modal
518
519
520  // MODAL NO CONFLICT
521  // =================
522
523  $.fn.modal.noConflict = function () {
524    $.fn.modal = old
525    return this
526  }
527
528
529  // MODAL DATA-API
530  // ==============
531
532  $(document).on('click.bs.modal.data-api', '[data-toggle="modal"]', function (e) {
533    var $this   = $(this)
534    var href    = $this.attr('href')
535    var $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) // strip for ie7
536    var option  = $target.data('bs.modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data())
537
538    if ($this.is('a')) e.preventDefault()
539
540    $target.one('show.bs.modal', function (showEvent) {
541      if (showEvent.isDefaultPrevented()) return // only register focus restorer if modal will actually get shown
542      $target.one('hidden.bs.modal', function () {
543        $this.is(':visible') && $this.trigger('focus')
544      })
545    })
546    Plugin.call($target, option, this)
547  })
548
549}(jQuery);
550
551/* ========================================================================
552 * Bootstrap: transition.js v3.3.6
553 * http://getbootstrap.com/javascript/#transitions
554 * ========================================================================
555 * Copyright 2011-2015 Twitter, Inc.
556 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
557 * ======================================================================== */
558
559
560+function ($) {
561  'use strict';
562
563  // CSS TRANSITION SUPPORT (Shoutout: http://www.modernizr.com/)
564  // ============================================================
565
566  function transitionEnd() {
567    var el = document.createElement('bootstrap')
568
569    var transEndEventNames = {
570      WebkitTransition : 'webkitTransitionEnd',
571      MozTransition    : 'transitionend',
572      OTransition      : 'oTransitionEnd otransitionend',
573      transition       : 'transitionend'
574    }
575
576    for (var name in transEndEventNames) {
577      if (el.style[name] !== undefined) {
578        return { end: transEndEventNames[name] }
579      }
580    }
581
582    return false // explicit for ie8 (  ._.)
583  }
584
585  // http://blog.alexmaccaw.com/css-transitions
586  $.fn.emulateTransitionEnd = function (duration) {
587    var called = false
588    var $el = this
589    $(this).one('bsTransitionEnd', function () { called = true })
590    var callback = function () { if (!called) $($el).trigger($.support.transition.end) }
591    setTimeout(callback, duration)
592    return this
593  }
594
595  $(function () {
596    $.support.transition = transitionEnd()
597
598    if (!$.support.transition) return
599
600    $.event.special.bsTransitionEnd = {
601      bindType: $.support.transition.end,
602      delegateType: $.support.transition.end,
603      handle: function (e) {
604        if ($(e.target).is(this)) return e.handleObj.handler.apply(this, arguments)
605      }
606    }
607  })
608
609}(jQuery);
610
611/*
612 *  jQuery OwlCarousel v1.3.3
613 *
614 *  Copyright (c) 2013 Bartosz Wojciechowski
615 *  http://www.owlgraphic.com/owlcarousel/
616 *
617 *  Licensed under MIT
618 *
619 */
620
621/*JS Lint helpers: */
622/*global dragMove: false, dragEnd: false, $, jQuery, alert, window, document */
623/*jslint nomen: true, continue:true */
624
625if (typeof Object.create !== "function") {
626    Object.create = function (obj) {
627        function F() {}
628        F.prototype = obj;
629        return new F();
630    };
631}
632(function ($, window, document) {
633
634    var Carousel = {
635        init : function (options, el) {
636            var base = this;
637
638            base.$elem = $(el);
639            base.options = $.extend({}, $.fn.owlCarousel.options, base.$elem.data(), options);
640
641            base.userOptions = options;
642            base.loadContent();
643        },
644
645        loadContent : function () {
646            var base = this, url;
647
648            function getData(data) {
649                var i, content = "";
650                if (typeof base.options.jsonSuccess === "function") {
651                    base.options.jsonSuccess.apply(this, [data]);
652                } else {
653                    for (i in data.owl) {
654                        if (data.owl.hasOwnProperty(i)) {
655                            content += data.owl[i].item;
656                        }
657                    }
658                    base.$elem.html(content);
659                }
660                base.logIn();
661            }
662
663            if (typeof base.options.beforeInit === "function") {
664                base.options.beforeInit.apply(this, [base.$elem]);
665            }
666
667            if (typeof base.options.jsonPath === "string") {
668                url = base.options.jsonPath;
669                $.getJSON(url, getData);
670            } else {
671                base.logIn();
672            }
673        },
674
675        logIn : function () {
676            var base = this;
677
678            base.$elem.data("owl-originalStyles", base.$elem.attr("style"));
679            base.$elem.data("owl-originalClasses", base.$elem.attr("class"));
680
681            base.$elem.css({opacity: 0});
682            base.orignalItems = base.options.items;
683            base.checkBrowser();
684            base.wrapperWidth = 0;
685            base.checkVisible = null;
686            base.setVars();
687        },
688
689        setVars : function () {
690            var base = this;
691            if (base.$elem.children().length === 0) {return false; }
692            base.baseClass();
693            base.eventTypes();
694            base.$userItems = base.$elem.children();
695            base.itemsAmount = base.$userItems.length;
696            base.wrapItems();
697            base.$owlItems = base.$elem.find(".owl-item");
698            base.$owlWrapper = base.$elem.find(".owl-wrapper");
699            base.playDirection = "next";
700            base.prevItem = 0;
701            base.prevArr = [0];
702            base.currentItem = 0;
703            base.customEvents();
704            base.onStartup();
705        },
706
707        onStartup : function () {
708            var base = this;
709            base.updateItems();
710            base.calculateAll();
711            base.buildControls();
712            base.updateControls();
713            base.response();
714            base.moveEvents();
715            base.stopOnHover();
716            base.owlStatus();
717
718            if (base.options.transitionStyle !== false) {
719                base.transitionTypes(base.options.transitionStyle);
720            }
721            if (base.options.autoPlay === true) {
722                base.options.autoPlay = 5000;
723            }
724            base.play();
725
726            base.$elem.find(".owl-wrapper").css("display", "block");
727
728            if (!base.$elem.is(":visible")) {
729                base.watchVisibility();
730            } else {
731                base.$elem.css("opacity", 1);
732            }
733            base.onstartup = false;
734            base.eachMoveUpdate();
735            if (typeof base.options.afterInit === "function") {
736                base.options.afterInit.apply(this, [base.$elem]);
737            }
738        },
739
740        eachMoveUpdate : function () {
741            var base = this;
742
743            if (base.options.lazyLoad === true) {
744                base.lazyLoad();
745            }
746            if (base.options.autoHeight === true) {
747                base.autoHeight();
748            }
749            base.onVisibleItems();
750
751            if (typeof base.options.afterAction === "function") {
752                base.options.afterAction.apply(this, [base.$elem]);
753            }
754        },
755
756        updateVars : function () {
757            var base = this;
758            if (typeof base.options.beforeUpdate === "function") {
759                base.options.beforeUpdate.apply(this, [base.$elem]);
760            }
761            base.watchVisibility();
762            base.updateItems();
763            base.calculateAll();
764            base.updatePosition();
765            base.updateControls();
766            base.eachMoveUpdate();
767            if (typeof base.options.afterUpdate === "function") {
768                base.options.afterUpdate.apply(this, [base.$elem]);
769            }
770        },
771
772        reload : function () {
773            var base = this;
774            window.setTimeout(function () {
775                base.updateVars();
776            }, 0);
777        },
778
779        watchVisibility : function () {
780            var base = this;
781
782            if (base.$elem.is(":visible") === false) {
783                base.$elem.css({opacity: 0});
784                window.clearInterval(base.autoPlayInterval);
785                window.clearInterval(base.checkVisible);
786            } else {
787                return false;
788            }
789            base.checkVisible = window.setInterval(function () {
790                if (base.$elem.is(":visible")) {
791                    base.reload();
792                    base.$elem.animate({opacity: 1}, 200);
793                    window.clearInterval(base.checkVisible);
794                }
795            }, 500);
796        },
797
798        wrapItems : function () {
799            var base = this;
800            base.$userItems.wrapAll("<div class=\"owl-wrapper\">").wrap("<div class=\"owl-item\"></div>");
801            base.$elem.find(".owl-wrapper").wrap("<div class=\"owl-wrapper-outer\">");
802            base.wrapperOuter = base.$elem.find(".owl-wrapper-outer");
803            base.$elem.css("display", "block");
804        },
805
806        baseClass : function () {
807            var base = this,
808                hasBaseClass = base.$elem.hasClass(base.options.baseClass),
809                hasThemeClass = base.$elem.hasClass(base.options.theme);
810
811            if (!hasBaseClass) {
812                base.$elem.addClass(base.options.baseClass);
813            }
814
815            if (!hasThemeClass) {
816                base.$elem.addClass(base.options.theme);
817            }
818        },
819
820        updateItems : function () {
821            var base = this, width, i;
822
823            if (base.options.responsive === false) {
824                return false;
825            }
826            if (base.options.singleItem === true) {
827                base.options.items = base.orignalItems = 1;
828                base.options.itemsCustom = false;
829                base.options.itemsDesktop = false;
830                base.options.itemsDesktopSmall = false;
831                base.options.itemsTablet = false;
832                base.options.itemsTabletSmall = false;
833                base.options.itemsMobile = false;
834                return false;
835            }
836
837            width = $(base.options.responsiveBaseWidth).width();
838
839            if (width > (base.options.itemsDesktop[0] || base.orignalItems)) {
840                base.options.items = base.orignalItems;
841            }
842            if (base.options.itemsCustom !== false) {
843                //Reorder array by screen size
844                base.options.itemsCustom.sort(function (a, b) {return a[0] - b[0]; });
845
846                for (i = 0; i < base.options.itemsCustom.length; i += 1) {
847                    if (base.options.itemsCustom[i][0] <= width) {
848                        base.options.items = base.options.itemsCustom[i][1];
849                    }
850                }
851
852            } else {
853
854                if (width <= base.options.itemsDesktop[0] && base.options.itemsDesktop !== false) {
855                    base.options.items = base.options.itemsDesktop[1];
856                }
857
858                if (width <= base.options.itemsDesktopSmall[0] && base.options.itemsDesktopSmall !== false) {
859                    base.options.items = base.options.itemsDesktopSmall[1];
860                }
861
862                if (width <= base.options.itemsTablet[0] && base.options.itemsTablet !== false) {
863                    base.options.items = base.options.itemsTablet[1];
864                }
865
866                if (width <= base.options.itemsTabletSmall[0] && base.options.itemsTabletSmall !== false) {
867                    base.options.items = base.options.itemsTabletSmall[1];
868                }
869
870                if (width <= base.options.itemsMobile[0] && base.options.itemsMobile !== false) {
871                    base.options.items = base.options.itemsMobile[1];
872                }
873            }
874
875            //if number of items is less than declared
876            if (base.options.items > base.itemsAmount && base.options.itemsScaleUp === true) {
877                base.options.items = base.itemsAmount;
878            }
879        },
880
881        response : function () {
882            var base = this,
883                smallDelay,
884                lastWindowWidth;
885
886            if (base.options.responsive !== true) {
887                return false;
888            }
889            lastWindowWidth = $(window).width();
890
891            base.resizer = function () {
892                if ($(window).width() !== lastWindowWidth) {
893                    if (base.options.autoPlay !== false) {
894                        window.clearInterval(base.autoPlayInterval);
895                    }
896                    window.clearTimeout(smallDelay);
897                    smallDelay = window.setTimeout(function () {
898                        lastWindowWidth = $(window).width();
899                        base.updateVars();
900                    }, base.options.responsiveRefreshRate);
901                }
902            };
903            $(window).resize(base.resizer);
904        },
905
906        updatePosition : function () {
907            var base = this;
908            base.jumpTo(base.currentItem);
909            if (base.options.autoPlay !== false) {
910                base.checkAp();
911            }
912        },
913
914        appendItemsSizes : function () {
915            var base = this,
916                roundPages = 0,
917                lastItem = base.itemsAmount - base.options.items;
918
919            base.$owlItems.each(function (index) {
920                var $this = $(this);
921                $this
922                    .css({"width": base.itemWidth})
923                    .data("owl-item", Number(index));
924
925                if (index % base.options.items === 0 || index === lastItem) {
926                    if (!(index > lastItem)) {
927                        roundPages += 1;
928                    }
929                }
930                $this.data("owl-roundPages", roundPages);
931            });
932        },
933
934        appendWrapperSizes : function () {
935            var base = this,
936                width = base.$owlItems.length * base.itemWidth;
937
938            base.$owlWrapper.css({
939                "width": width * 2,
940                "left": 0
941            });
942            base.appendItemsSizes();
943        },
944
945        calculateAll : function () {
946            var base = this;
947            base.calculateWidth();
948            base.appendWrapperSizes();
949            base.loops();
950            base.max();
951        },
952
953        calculateWidth : function () {
954            var base = this;
955            base.itemWidth = Math.round(base.$elem.width() / base.options.items);
956        },
957
958        max : function () {
959            var base = this,
960                maximum = ((base.itemsAmount * base.itemWidth) - base.options.items * base.itemWidth) * -1;
961            if (base.options.items > base.itemsAmount) {
962                base.maximumItem = 0;
963                maximum = 0;
964                base.maximumPixels = 0;
965            } else {
966                base.maximumItem = base.itemsAmount - base.options.items;
967                base.maximumPixels = maximum;
968            }
969            return maximum;
970        },
971
972        min : function () {
973            return 0;
974        },
975
976        loops : function () {
977            var base = this,
978                prev = 0,
979                elWidth = 0,
980                i,
981                item,
982                roundPageNum;
983
984            base.positionsInArray = [0];
985            base.pagesInArray = [];
986
987            for (i = 0; i < base.itemsAmount; i += 1) {
988                elWidth += base.itemWidth;
989                base.positionsInArray.push(-elWidth);
990
991                if (base.options.scrollPerPage === true) {
992                    item = $(base.$owlItems[i]);
993                    roundPageNum = item.data("owl-roundPages");
994                    if (roundPageNum !== prev) {
995                        base.pagesInArray[prev] = base.positionsInArray[i];
996                        prev = roundPageNum;
997                    }
998                }
999            }
1000        },
1001
1002        buildControls : function () {
1003            var base = this;
1004            if (base.options.navigation === true || base.options.pagination === true) {
1005              base.owlControls = $("<div class=\"owl-controls\"/>").toggleClass("clickable", !base.browser.isTouch).appendTo(base.$elem);						
1006            }
1007            if (base.options.pagination === true) {
1008                base.buildPagination();
1009            }
1010            if (base.options.navigation === true) {
1011                base.buildButtons();
1012            }
1013        },
1014
1015        buildButtons : function () {
1016            var base = this,
1017                buttonsWrapper = $("<div class=\"owl-buttons\"/>");
1018            base.owlControls.append(buttonsWrapper);
1019
1020            base.buttonPrev = $("<div/>", {
1021                "class" : "owl-prev",
1022                "html" : base.options.navigationText[0] || ""
1023            });
1024
1025            base.buttonNext = $("<div/>", {
1026                "class" : "owl-next",
1027                "html" : base.options.navigationText[1] || ""
1028            });
1029
1030            buttonsWrapper
1031                .append(base.buttonPrev)
1032                .append(base.buttonNext);
1033
1034            buttonsWrapper.on("touchstart.owlControls mousedown.owlControls", "div[class^=\"owl\"]", function (event) {
1035                event.preventDefault();
1036            });
1037
1038            buttonsWrapper.on("touchend.owlControls mouseup.owlControls", "div[class^=\"owl\"]", function (event) {
1039                event.preventDefault();
1040                if ($(this).hasClass("owl-next")) {
1041                    base.next();
1042                } else {
1043                    base.prev();
1044                }
1045            });
1046        },
1047
1048        buildPagination : function () {
1049            var base = this;
1050
1051            base.paginationWrapper = $("<div class=\"owl-pagination\"/>");
1052            base.owlControls.append(base.paginationWrapper);
1053
1054            base.paginationWrapper.on("touchend.owlControls mouseup.owlControls", ".owl-page", function (event) {
1055                event.preventDefault();
1056                if (Number($(this).data("owl-page")) !== base.currentItem) {
1057                    base.goTo(Number($(this).data("owl-page")), true);
1058                }
1059            });
1060        },
1061
1062        updatePagination : function () {
1063            var base = this,
1064                counter,
1065                lastPage,
1066                lastItem,
1067                i,
1068                paginationButton,
1069                paginationButtonInner;
1070
1071            if (base.options.pagination === false) {
1072                return false;
1073            }
1074
1075            base.paginationWrapper.html("");
1076
1077            counter = 0;
1078            lastPage = base.itemsAmount - base.itemsAmount % base.options.items;
1079
1080            for (i = 0; i < base.itemsAmount; i += 1) {
1081                if (i % base.options.items === 0) {
1082                    counter += 1;
1083                    if (lastPage === i) {
1084                        lastItem = base.itemsAmount - base.options.items;
1085                    }
1086                    paginationButton = $("<div/>", {
1087                        "class" : "owl-page"
1088                    });
1089                    paginationButtonInner = $("<span></span>", {
1090                        "text": base.options.paginationNumbers === true ? counter : "",
1091                        "class": base.options.paginationNumbers === true ? "owl-numbers" : ""
1092                    });
1093                    paginationButton.append(paginationButtonInner);
1094
1095                    paginationButton.data("owl-page", lastPage === i ? lastItem : i);
1096                    paginationButton.data("owl-roundPages", counter);
1097
1098                    base.paginationWrapper.append(paginationButton);
1099                }
1100            }
1101            base.checkPagination();
1102        },
1103        checkPagination : function () {
1104            var base = this;
1105            if (base.options.pagination === false) {
1106                return false;
1107            }
1108            base.paginationWrapper.find(".owl-page").each(function () {
1109                if ($(this).data("owl-roundPages") === $(base.$owlItems[base.currentItem]).data("owl-roundPages")) {
1110                    base.paginationWrapper
1111                        .find(".owl-page")
1112                        .removeClass("active");
1113                    $(this).addClass("active");
1114                }
1115            });
1116        },
1117
1118        checkNavigation : function () {
1119            var base = this;
1120
1121            if (base.options.navigation === false) {
1122                return false;
1123            }
1124            if (base.options.rewindNav === false) {
1125                if (base.currentItem === 0 && base.maximumItem === 0) {
1126                    base.buttonPrev.addClass("disabled");
1127                    base.buttonNext.addClass("disabled");
1128                } else if (base.currentItem === 0 && base.maximumItem !== 0) {
1129                    base.buttonPrev.addClass("disabled");
1130                    base.buttonNext.removeClass("disabled");
1131                } else if (base.currentItem === base.maximumItem) {
1132                    base.buttonPrev.removeClass("disabled");
1133                    base.buttonNext.addClass("disabled");
1134                } else if (base.currentItem !== 0 && base.currentItem !== base.maximumItem) {
1135                    base.buttonPrev.removeClass("disabled");
1136                    base.buttonNext.removeClass("disabled");
1137                }
1138            }
1139        },
1140
1141        updateControls : function () {
1142            var base = this;
1143            base.updatePagination();
1144            base.checkNavigation();
1145            if (base.owlControls) {
1146                if (base.options.items >= base.itemsAmount) {
1147                    base.owlControls.hide();
1148                } else {
1149                    base.owlControls.show();
1150                }
1151            }
1152        },
1153
1154        destroyControls : function () {
1155            var base = this;
1156            if (base.owlControls) {
1157                base.owlControls.remove();
1158            }
1159        },
1160
1161        next : function (speed) {
1162            var base = this;
1163
1164            if (base.isTransition) {
1165                return false;
1166            }
1167
1168            base.currentItem += base.options.scrollPerPage === true ? base.options.items : 1;
1169            if (base.currentItem > base.maximumItem + (base.options.scrollPerPage === true ? (base.options.items - 1) : 0)) {
1170                if (base.options.rewindNav === true) {
1171                    base.currentItem = 0;
1172                    speed = "rewind";
1173                } else {
1174                    base.currentItem = base.maximumItem;
1175                    return false;
1176                }
1177            }
1178            base.goTo(base.currentItem, speed);
1179        },
1180
1181        prev : function (speed) {
1182            var base = this;
1183
1184            if (base.isTransition) {
1185                return false;
1186            }
1187
1188            if (base.options.scrollPerPage === true && base.currentItem > 0 && base.currentItem < base.options.items) {
1189                base.currentItem = 0;
1190            } else {
1191                base.currentItem -= base.options.scrollPerPage === true ? base.options.items : 1;
1192            }
1193            if (base.currentItem < 0) {
1194                if (base.options.rewindNav === true) {
1195                    base.currentItem = base.maximumItem;
1196                    speed = "rewind";
1197                } else {
1198                    base.currentItem = 0;
1199                    return false;
1200                }
1201            }
1202            base.goTo(base.currentItem, speed);
1203        },
1204
1205        goTo : function (position, speed, drag) {
1206            var base = this,
1207                goToPixel;
1208
1209            if (base.isTransition) {
1210                return false;
1211            }
1212            if (typeof base.options.beforeMove === "function") {
1213                base.options.beforeMove.apply(this, [base.$elem]);
1214            }
1215            if (position >= base.maximumItem) {
1216                position = base.maximumItem;
1217            } else if (position <= 0) {
1218                position = 0;
1219            }
1220
1221            base.currentItem = base.owl.currentItem = position;
1222            if (base.options.transitionStyle !== false && drag !== "drag" && base.options.items === 1 && base.browser.support3d === true) {
1223                base.swapSpeed(0);
1224                if (base.browser.support3d === true) {
1225                    base.transition3d(base.positionsInArray[position]);
1226                } else {
1227                    base.css2slide(base.positionsInArray[position], 1);
1228                }
1229                base.afterGo();
1230                base.singleItemTransition();
1231                return false;
1232            }
1233            goToPixel = base.positionsInArray[position];
1234
1235            if (base.browser.support3d === true) {
1236                base.isCss3Finish = false;
1237
1238                if (speed === true) {
1239                    base.swapSpeed("paginationSpeed");
1240                    window.setTimeout(function () {
1241                        base.isCss3Finish = true;
1242                    }, base.options.paginationSpeed);
1243
1244                } else if (speed === "rewind") {
1245                    base.swapSpeed(base.options.rewindSpeed);
1246                    window.setTimeout(function () {
1247                        base.isCss3Finish = true;
1248                    }, base.options.rewindSpeed);
1249
1250                } else {
1251                    base.swapSpeed("slideSpeed");
1252                    window.setTimeout(function () {
1253                        base.isCss3Finish = true;
1254                    }, base.options.slideSpeed);
1255                }
1256                base.transition3d(goToPixel);
1257            } else {
1258                if (speed === true) {
1259                    base.css2slide(goToPixel, base.options.paginationSpeed);
1260                } else if (speed === "rewind") {
1261                    base.css2slide(goToPixel, base.options.rewindSpeed);
1262                } else {
1263                    base.css2slide(goToPixel, base.options.slideSpeed);
1264                }
1265            }
1266            base.afterGo();
1267        },
1268
1269        jumpTo : function (position) {
1270            var base = this;
1271            if (typeof base.options.beforeMove === "function") {
1272                base.options.beforeMove.apply(this, [base.$elem]);
1273            }
1274            if (position >= base.maximumItem || position === -1) {
1275                position = base.maximumItem;
1276            } else if (position <= 0) {
1277                position = 0;
1278            }
1279            base.swapSpeed(0);
1280            if (base.browser.support3d === true) {
1281                base.transition3d(base.positionsInArray[position]);
1282            } else {
1283                base.css2slide(base.positionsInArray[position], 1);
1284            }
1285            base.currentItem = base.owl.currentItem = position;
1286            base.afterGo();
1287        },
1288
1289        afterGo : function () {
1290            var base = this;
1291
1292            base.prevArr.push(base.currentItem);
1293            base.prevItem = base.owl.prevItem = base.prevArr[base.prevArr.length - 2];
1294            base.prevArr.shift(0);
1295
1296            if (base.prevItem !== base.currentItem) {
1297                base.checkPagination();
1298                base.checkNavigation();
1299                base.eachMoveUpdate();
1300
1301                if (base.options.autoPlay !== false) {
1302                    base.checkAp();
1303                }
1304            }
1305            if (typeof base.options.afterMove === "function" && base.prevItem !== base.currentItem) {
1306                base.options.afterMove.apply(this, [base.$elem]);
1307            }
1308        },
1309
1310        stop : function () {
1311            var base = this;
1312            base.apStatus = "stop";
1313            window.clearInterval(base.autoPlayInterval);
1314        },
1315
1316        checkAp : function () {
1317            var base = this;
1318            if (base.apStatus !== "stop") {
1319                base.play();
1320            }
1321        },
1322
1323        play : function () {
1324            var base = this;
1325            base.apStatus = "play";
1326            if (base.options.autoPlay === false) {
1327                return false;
1328            }
1329            window.clearInterval(base.autoPlayInterval);
1330            base.autoPlayInterval = window.setInterval(function () {
1331                base.next(true);
1332            }, base.options.autoPlay);
1333        },
1334
1335        swapSpeed : function (action) {
1336            var base = this;
1337            if (action === "slideSpeed") {
1338                base.$owlWrapper.css(base.addCssSpeed(base.options.slideSpeed));
1339            } else if (action === "paginationSpeed") {
1340                base.$owlWrapper.css(base.addCssSpeed(base.options.paginationSpeed));
1341            } else if (typeof action !== "string") {
1342                base.$owlWrapper.css(base.addCssSpeed(action));
1343            }
1344        },
1345
1346        addCssSpeed : function (speed) {
1347            return {
1348                "-webkit-transition": "all " + speed + "ms ease",
1349                "-moz-transition": "all " + speed + "ms ease",
1350                "-o-transition": "all " + speed + "ms ease",
1351                "transition": "all " + speed + "ms ease"
1352            };
1353        },
1354
1355        removeTransition : function () {
1356            return {
1357                "-webkit-transition": "",
1358                "-moz-transition": "",
1359                "-o-transition": "",
1360                "transition": ""
1361            };
1362        },
1363
1364        doTranslate : function (pixels) {
1365            return {
1366                "-webkit-transform": "translate3d(" + pixels + "px, 0px, 0px)",
1367                "-moz-transform": "translate3d(" + pixels + "px, 0px, 0px)",
1368                "-o-transform": "translate3d(" + pixels + "px, 0px, 0px)",
1369                "-ms-transform": "translate3d(" + pixels + "px, 0px, 0px)",
1370                "transform": "translate3d(" + pixels + "px, 0px,0px)"
1371            };
1372        },
1373
1374        transition3d : function (value) {
1375            var base = this;
1376            base.$owlWrapper.css(base.doTranslate(value));
1377        },
1378
1379        css2move : function (value) {
1380            var base = this;
1381            base.$owlWrapper.css({"left" : value});
1382        },
1383
1384        css2slide : function (value, speed) {
1385            var base = this;
1386
1387            base.isCssFinish = false;
1388            base.$owlWrapper.stop(true, true).animate({
1389                "left" : value
1390            }, {
1391                duration : speed || base.options.slideSpeed,
1392                complete : function () {
1393                    base.isCssFinish = true;
1394                }
1395            });
1396        },
1397
1398        checkBrowser : function () {
1399            var base = this,
1400                translate3D = "translate3d(0px, 0px, 0px)",
1401                tempElem = document.createElement("div"),
1402                regex,
1403                asSupport,
1404                support3d,
1405                isTouch;
1406
1407            tempElem.style.cssText = "  -moz-transform:" + translate3D +
1408                                  "; -ms-transform:"     + translate3D +
1409                                  "; -o-transform:"      + translate3D +
1410                                  "; -webkit-transform:" + translate3D +
1411                                  "; transform:"         + translate3D;
1412            regex = /translate3d\(0px, 0px, 0px\)/g;
1413            asSupport = tempElem.style.cssText.match(regex);
1414            support3d = (asSupport !== null && asSupport.length === 1);
1415
1416            isTouch = "ontouchstart" in window || window.navigator.msMaxTouchPoints;
1417
1418            base.browser = {
1419                "support3d" : support3d,
1420                "isTouch" : isTouch
1421            };
1422        },
1423
1424        moveEvents : function () {
1425            var base = this;
1426            if (base.options.mouseDrag !== false || base.options.touchDrag !== false) {
1427                base.gestures();
1428                base.disabledEvents();
1429            }
1430        },
1431
1432        eventTypes : function () {
1433            var base = this,
1434                types = ["s", "e", "x"];
1435
1436            base.ev_types = {};
1437
1438            if (base.options.mouseDrag === true && base.options.touchDrag === true) {
1439                types = [
1440                    "touchstart.owl mousedown.owl",
1441                    "touchmove.owl mousemove.owl",
1442                    "touchend.owl touchcancel.owl mouseup.owl"
1443                ];
1444            } else if (base.options.mouseDrag === false && base.options.touchDrag === true) {
1445                types = [
1446                    "touchstart.owl",
1447                    "touchmove.owl",
1448                    "touchend.owl touchcancel.owl"
1449                ];
1450            } else if (base.options.mouseDrag === true && base.options.touchDrag === false) {
1451                types = [
1452                    "mousedown.owl",
1453                    "mousemove.owl",
1454                    "mouseup.owl"
1455                ];
1456            }
1457
1458            base.ev_types.start = types[0];
1459            base.ev_types.move = types[1];
1460            base.ev_types.end = types[2];
1461        },
1462
1463        disabledEvents :  function () {
1464            var base = this;
1465            base.$elem.on("dragstart.owl", function (event) { event.preventDefault(); });
1466            base.$elem.on("mousedown.disableTextSelect", function (e) {
1467                return $(e.target).is('input, textarea, select, option');
1468            });
1469        },
1470
1471        gestures : function () {
1472            /*jslint unparam: true*/
1473            var base = this,
1474                locals = {
1475                    offsetX : 0,
1476                    offsetY : 0,
1477                    baseElWidth : 0,
1478                    relativePos : 0,
1479                    position: null,
1480                    minSwipe : null,
1481                    maxSwipe: null,
1482                    sliding : null,
1483                    dargging: null,
1484                    targetElement : null
1485                };
1486
1487            base.isCssFinish = true;
1488
1489            function getTouches(event) {
1490                if (event.touches !== undefined) {
1491                    return {
1492                        x : event.touches[0].pageX,
1493                        y : event.touches[0].pageY
1494                    };
1495                }
1496
1497                if (event.touches === undefined) {
1498                    if (event.pageX !== undefined) {
1499                        return {
1500                            x : event.pageX,
1501                            y : event.pageY
1502                        };
1503                    }
1504                    if (event.pageX === undefined) {
1505                        return {
1506                            x : event.clientX,
1507                            y : event.clientY
1508                        };
1509                    }
1510                }
1511            }
1512
1513            function swapEvents(type) {
1514                if (type === "on") {
1515                    $(document).on(base.ev_types.move, dragMove);
1516                    $(document).on(base.ev_types.end, dragEnd);
1517                } else if (type === "off") {
1518                    $(document).off(base.ev_types.move);
1519                    $(document).off(base.ev_types.end);
1520                }
1521            }
1522
1523            function dragStart(event) {
1524                var ev = event.originalEvent || event || window.event,
1525                    position;
1526
1527                if (ev.which === 3) {
1528                    return false;
1529                }
1530                if (base.itemsAmount <= base.options.items) {
1531                    return;
1532                }
1533                if (base.isCssFinish === false && !base.options.dragBeforeAnimFinish) {
1534                    return false;
1535                }
1536                if (base.isCss3Finish === false && !base.options.dragBeforeAnimFinish) {
1537                    return false;
1538                }
1539
1540                if (base.options.autoPlay !== false) {
1541                    window.clearInterval(base.autoPlayInterval);
1542                }
1543
1544                if (base.browser.isTouch !== true && !base.$owlWrapper.hasClass("grabbing")) {
1545                    base.$owlWrapper.addClass("grabbing");
1546                }
1547
1548                base.newPosX = 0;
1549                base.newRelativeX = 0;
1550
1551                $(this).css(base.removeTransition());
1552
1553                position = $(this).position();
1554                locals.relativePos = position.left;
1555
1556                locals.offsetX = getTouches(ev).x - position.left;
1557                locals.offsetY = getTouches(ev).y - position.top;
1558
1559                swapEvents("on");
1560
1561                locals.sliding = false;
1562                locals.targetElement = ev.target || ev.srcElement;
1563            }
1564
1565            function dragMove(event) {
1566                var ev = event.originalEvent || event || window.event,
1567                    minSwipe,
1568                    maxSwipe;
1569
1570                base.newPosX = getTouches(ev).x - locals.offsetX;
1571                base.newPosY = getTouches(ev).y - locals.offsetY;
1572                base.newRelativeX = base.newPosX - locals.relativePos;
1573
1574                if (typeof base.options.startDragging === "function" && locals.dragging !== true && base.newRelativeX !== 0) {
1575                    locals.dragging = true;
1576                    base.options.startDragging.apply(base, [base.$elem]);
1577                }
1578
1579                if ((base.newRelativeX > 8 || base.newRelativeX < -8) && (base.browser.isTouch === true)) {
1580                    if (ev.preventDefault !== undefined) {
1581                        ev.preventDefault();
1582                    } else {
1583                        ev.returnValue = false;
1584                    }
1585                    locals.sliding = true;
1586                }
1587
1588                if ((base.newPosY > 10 || base.newPosY < -10) && locals.sliding === false) {
1589                    $(document).off("touchmove.owl");
1590                }
1591
1592                minSwipe = function () {
1593                    return base.newRelativeX / 5;
1594                };
1595
1596                maxSwipe = function () {
1597                    return base.maximumPixels + base.newRelativeX / 5;
1598                };
1599
1600                base.newPosX = Math.max(Math.min(base.newPosX, minSwipe()), maxSwipe());
1601                if (base.browser.support3d === true) {
1602                    base.transition3d(base.newPosX);
1603                } else {
1604                    base.css2move(base.newPosX);
1605                }
1606            }
1607
1608            function dragEnd(event) {
1609                var ev = event.originalEvent || event || window.event,
1610                    newPosition,
1611                    handlers,
1612                    owlStopEvent;
1613
1614                ev.target = ev.target || ev.srcElement;
1615
1616                locals.dragging = false;
1617
1618                if (base.browser.isTouch !== true) {
1619                    base.$owlWrapper.removeClass("grabbing");
1620                }
1621
1622                if (base.newRelativeX < 0) {
1623                    base.dragDirection = base.owl.dragDirection = "left";
1624                } else {
1625                    base.dragDirection = base.owl.dragDirection = "right";
1626                }
1627
1628                if (base.newRelativeX !== 0) {
1629                    newPosition = base.getNewPosition();
1630                    base.goTo(newPosition, false, "drag");
1631                    if (locals.targetElement === ev.target && base.browser.isTouch !== true) {
1632                        $(ev.target).on("click.disable", function (ev) {
1633                            ev.stopImmediatePropagation();
1634                            ev.stopPropagation();
1635                            ev.preventDefault();
1636                            $(ev.target).off("click.disable");
1637                        });
1638                        handlers = $._data(ev.target, "events").click;
1639                        owlStopEvent = handlers.pop();
1640                        handlers.splice(0, 0, owlStopEvent);
1641                    }
1642                }
1643                swapEvents("off");
1644            }
1645            base.$elem.on(base.ev_types.start, ".owl-wrapper", dragStart);
1646        },
1647
1648        getNewPosition : function () {
1649            var base = this,
1650                newPosition = base.closestItem();
1651
1652            if (newPosition > base.maximumItem) {
1653                base.currentItem = base.maximumItem;
1654                newPosition  = base.maximumItem;
1655            } else if (base.newPosX >= 0) {
1656                newPosition = 0;
1657                base.currentItem = 0;
1658            }
1659            return newPosition;
1660        },
1661        closestItem : function () {
1662            var base = this,
1663                array = base.options.scrollPerPage === true ? base.pagesInArray : base.positionsInArray,
1664                goal = base.newPosX,
1665                closest = null;
1666
1667            $.each(array, function (i, v) {
1668                if (goal - (base.itemWidth / 20) > array[i + 1] && goal - (base.itemWidth / 20) < v && base.moveDirection() === "left") {
1669                    closest = v;
1670                    if (base.options.scrollPerPage === true) {
1671                        base.currentItem = $.inArray(closest, base.positionsInArray);
1672                    } else {
1673                        base.currentItem = i;
1674                    }
1675                } else if (goal + (base.itemWidth / 20) < v && goal + (base.itemWidth / 20) > (array[i + 1] || array[i] - base.itemWidth) && base.moveDirection() === "right") {
1676                    if (base.options.scrollPerPage === true) {
1677                        closest = array[i + 1] || array[array.length - 1];
1678                        base.currentItem = $.inArray(closest, base.positionsInArray);
1679                    } else {
1680                        closest = array[i + 1];
1681                        base.currentItem = i + 1;
1682                    }
1683                }
1684            });
1685            return base.currentItem;
1686        },
1687
1688        moveDirection : function () {
1689            var base = this,
1690                direction;
1691            if (base.newRelativeX < 0) {
1692                direction = "right";
1693                base.playDirection = "next";
1694            } else {
1695                direction = "left";
1696                base.playDirection = "prev";
1697            }
1698            return direction;
1699        },
1700
1701        customEvents : function () {
1702            /*jslint unparam: true*/
1703            var base = this;
1704            base.$elem.on("owl.next", function () {
1705                base.next();
1706            });
1707            base.$elem.on("owl.prev", function () {
1708                base.prev();
1709            });
1710            base.$elem.on("owl.play", function (event, speed) {
1711                base.options.autoPlay = speed;
1712                base.play();
1713                base.hoverStatus = "play";
1714            });
1715            base.$elem.on("owl.stop", function () {
1716                base.stop();
1717                base.hoverStatus = "stop";
1718            });
1719            base.$elem.on("owl.goTo", function (event, item) {
1720                base.goTo(item);
1721            });
1722            base.$elem.on("owl.jumpTo", function (event, item) {
1723                base.jumpTo(item);
1724            });
1725        },
1726
1727        stopOnHover : function () {
1728            var base = this;
1729            if (base.options.stopOnHover === true && base.browser.isTouch !== true && base.options.autoPlay !== false) {
1730                base.$elem.on("mouseover", function () {
1731                    base.stop();
1732                });
1733                base.$elem.on("mouseout", function () {
1734                    if (base.hoverStatus !== "stop") {
1735                        base.play();
1736                    }
1737                });
1738            }
1739        },
1740
1741        lazyLoad : function () {
1742            var base = this,
1743                i,
1744                $item,
1745                itemNumber,
1746                $lazyImg,
1747                follow;
1748
1749            if (base.options.lazyLoad === false) {
1750                return false;
1751            }
1752            for (i = 0; i < base.itemsAmount; i += 1) {
1753                $item = $(base.$owlItems[i]);
1754
1755                if ($item.data("owl-loaded") === "loaded") {
1756                    continue;
1757                }
1758
1759                itemNumber = $item.data("owl-item");
1760                $lazyImg = $item.find(".lazyOwl");
1761
1762                if (typeof $lazyImg.data("src") !== "string") {
1763                    $item.data("owl-loaded", "loaded");
1764                    continue;
1765                }
1766                if ($item.data("owl-loaded") === undefined) {
1767                    $lazyImg.hide();
1768                    $item.addClass("loading").data("owl-loaded", "checked");
1769                }
1770                if (base.options.lazyFollow === true) {
1771                    follow = itemNumber >= base.currentItem;
1772                } else {
1773                    follow = true;
1774                }
1775                if (follow && itemNumber < base.currentItem + base.options.items && $lazyImg.length) {
1776                    base.lazyPreload($item, $lazyImg);
1777                }
1778            }
1779        },
1780
1781        lazyPreload : function ($item, $lazyImg) {
1782            var base = this,
1783                iterations = 0,
1784                isBackgroundImg;
1785
1786            if ($lazyImg.prop("tagName") === "DIV") {
1787                $lazyImg.css("background-image", "url(" + $lazyImg.data("src") + ")");
1788                isBackgroundImg = true;
1789            } else {
1790                $lazyImg[0].src = $lazyImg.data("src");
1791            }
1792
1793            function showImage() {
1794                $item.data("owl-loaded", "loaded").removeClass("loading");
1795                $lazyImg.removeAttr("data-src");
1796                if (base.options.lazyEffect === "fade") {
1797                    $lazyImg.fadeIn(400);
1798                } else {
1799                    $lazyImg.show();
1800                }
1801                if (typeof base.options.afterLazyLoad === "function") {
1802                    base.options.afterLazyLoad.apply(this, [base.$elem]);
1803                }
1804            }
1805
1806            function checkLazyImage() {
1807                iterations += 1;
1808                if (base.completeImg($lazyImg.get(0)) || isBackgroundImg === true) {
1809                    showImage();
1810                } else if (iterations <= 100) {//if image loads in less than 10 seconds
1811                    window.setTimeout(checkLazyImage, 100);
1812                } else {
1813                    showImage();
1814                }
1815            }
1816
1817            checkLazyImage();
1818        },
1819
1820        autoHeight : function () {
1821            var base = this,
1822                $currentimg = $(base.$owlItems[base.currentItem]).find("img"),
1823                iterations;
1824
1825            function addHeight() {
1826                var $currentItem = $(base.$owlItems[base.currentItem]).height();
1827                base.wrapperOuter.css("height", $currentItem + "px");
1828                if (!base.wrapperOuter.hasClass("autoHeight")) {
1829                    window.setTimeout(function () {
1830                        base.wrapperOuter.addClass("autoHeight");
1831                    }, 0);
1832                }
1833            }
1834
1835            function checkImage() {
1836                iterations += 1;
1837                if (base.completeImg($currentimg.get(0))) {
1838                    addHeight();
1839                } else if (iterations <= 100) { //if image loads in less than 10 seconds
1840                    window.setTimeout(checkImage, 100);
1841                } else {
1842                    base.wrapperOuter.css("height", ""); //Else remove height attribute
1843                }
1844            }
1845
1846            if ($currentimg.get(0) !== undefined) {
1847                iterations = 0;
1848                checkImage();
1849            } else {
1850                addHeight();
1851            }
1852        },
1853
1854        completeImg : function (img) {
1855            var naturalWidthType;
1856
1857            if (!img.complete) {
1858                return false;
1859            }
1860            naturalWidthType = typeof img.naturalWidth;
1861            if (naturalWidthType !== "undefined" && img.naturalWidth === 0) {
1862                return false;
1863            }
1864            return true;
1865        },
1866
1867        onVisibleItems : function () {
1868            var base = this,
1869                i;
1870
1871            if (base.options.addClassActive === true) {
1872                base.$owlItems.removeClass("active");
1873            }
1874            base.visibleItems = [];
1875            for (i = base.currentItem; i < base.currentItem + base.options.items; i += 1) {
1876                base.visibleItems.push(i);
1877
1878                if (base.options.addClassActive === true) {
1879                    $(base.$owlItems[i]).addClass("active");
1880                }
1881            }
1882            base.owl.visibleItems = base.visibleItems;
1883        },
1884
1885        transitionTypes : function (className) {
1886            var base = this;
1887            //Currently available: "fade", "backSlide", "goDown", "fadeUp"
1888            base.outClass = "owl-" + className + "-out";
1889            base.inClass = "owl-" + className + "-in";
1890        },
1891
1892        singleItemTransition : function () {
1893            var base = this,
1894                outClass = base.outClass,
1895                inClass = base.inClass,
1896                $currentItem = base.$owlItems.eq(base.currentItem),
1897                $prevItem = base.$owlItems.eq(base.prevItem),
1898                prevPos = Math.abs(base.positionsInArray[base.currentItem]) + base.positionsInArray[base.prevItem],
1899                origin = Math.abs(base.positionsInArray[base.currentItem]) + base.itemWidth / 2,
1900                animEnd = 'webkitAnimationEnd oAnimationEnd MSAnimationEnd animationend';
1901
1902            base.isTransition = true;
1903
1904            base.$owlWrapper
1905                .addClass('owl-origin')
1906                .css({
1907                    "-webkit-transform-origin" : origin + "px",
1908                    "-moz-perspective-origin" : origin + "px",
1909                    "perspective-origin" : origin + "px"
1910                });
1911            function transStyles(prevPos) {
1912                return {
1913                    "position" : "relative",
1914                    "left" : prevPos + "px"
1915                };
1916            }
1917
1918            $prevItem
1919                .css(transStyles(prevPos, 10))
1920                .addClass(outClass)
1921                .on(animEnd, function () {
1922                    base.endPrev = true;
1923                    $prevItem.off(animEnd);
1924                    base.clearTransStyle($prevItem, outClass);
1925                });
1926
1927            $currentItem
1928                .addClass(inClass)
1929                .on(animEnd, function () {
1930                    base.endCurrent = true;
1931                    $currentItem.off(animEnd);
1932                    base.clearTransStyle($currentItem, inClass);
1933                });
1934        },
1935
1936        clearTransStyle : function (item, classToRemove) {
1937            var base = this;
1938            item.css({
1939                "position" : "",
1940                "left" : ""
1941            }).removeClass(classToRemove);
1942
1943            if (base.endPrev && base.endCurrent) {
1944                base.$owlWrapper.removeClass('owl-origin');
1945                base.endPrev = false;
1946                base.endCurrent = false;
1947                base.isTransition = false;
1948            }
1949        },
1950
1951        owlStatus : function () {
1952            var base = this;
1953            base.owl = {
1954                "userOptions"   : base.userOptions,
1955                "baseElement"   : base.$elem,
1956                "userItems"     : base.$userItems,
1957                "owlItems"      : base.$owlItems,
1958                "currentItem"   : base.currentItem,
1959                "prevItem"      : base.prevItem,
1960                "visibleItems"  : base.visibleItems,
1961                "isTouch"       : base.browser.isTouch,
1962                "browser"       : base.browser,
1963                "dragDirection" : base.dragDirection
1964            };
1965        },
1966
1967        clearEvents : function () {
1968            var base = this;
1969            base.$elem.off(".owl owl mousedown.disableTextSelect");
1970            $(document).off(".owl owl");
1971            $(window).off("resize", base.resizer);
1972        },
1973
1974        unWrap : function () {
1975            var base = this;
1976            if (base.$elem.children().length !== 0) {
1977                base.$owlWrapper.unwrap();
1978                base.$userItems.unwrap().unwrap();
1979                if (base.owlControls) {
1980                    base.owlControls.remove();
1981                }
1982            }
1983            base.clearEvents();
1984            base.$elem
1985                .attr("style", base.$elem.data("owl-originalStyles") || "")
1986                .attr("class", base.$elem.data("owl-originalClasses"));
1987        },
1988
1989        destroy : function () {
1990            var base = this;
1991            base.stop();
1992            window.clearInterval(base.checkVisible);
1993            base.unWrap();
1994            base.$elem.removeData();
1995        },
1996
1997        reinit : function (newOptions) {
1998            var base = this,
1999                options = $.extend({}, base.userOptions, newOptions);
2000            base.unWrap();
2001            base.init(options, base.$elem);
2002        },
2003
2004        addItem : function (htmlString, targetPosition) {
2005            var base = this,
2006                position;
2007
2008            if (!htmlString) {return false; }
2009
2010            if (base.$elem.children().length === 0) {
2011                base.$elem.append(htmlString);
2012                base.setVars();
2013                return false;
2014            }
2015            base.unWrap();
2016            if (targetPosition === undefined || targetPosition === -1) {
2017                position = -1;
2018            } else {
2019                position = targetPosition;
2020            }
2021            if (position >= base.$userItems.length || position === -1) {
2022                base.$userItems.eq(-1).after(htmlString);
2023            } else {
2024                base.$userItems.eq(position).before(htmlString);
2025            }
2026
2027            base.setVars();
2028        },
2029
2030        removeItem : function (targetPosition) {
2031            var base = this,
2032                position;
2033
2034            if (base.$elem.children().length === 0) {
2035                return false;
2036            }
2037            if (targetPosition === undefined || targetPosition === -1) {
2038                position = -1;
2039            } else {
2040                position = targetPosition;
2041            }
2042
2043            base.unWrap();
2044            base.$userItems.eq(position).remove();
2045            base.setVars();
2046        }
2047
2048    };
2049
2050    $.fn.owlCarousel = function (options) {
2051        return this.each(function () {
2052            if ($(this).data("owl-init") === true) {
2053                return false;
2054            }
2055            $(this).data("owl-init", true);
2056            var carousel = Object.create(Carousel);
2057            carousel.init(options, this);
2058            $.data(this, "owlCarousel", carousel);
2059        });
2060    };
2061
2062    $.fn.owlCarousel.options = {
2063
2064        items : 5,
2065        itemsCustom : false,
2066        itemsDesktop : [1199, 4],
2067        itemsDesktopSmall : [979, 3],
2068        itemsTablet : [768, 2],
2069        itemsTabletSmall : false,
2070        itemsMobile : [479, 1],
2071        singleItem : false,
2072        itemsScaleUp : false,
2073
2074        slideSpeed : 200,
2075        paginationSpeed : 800,
2076        rewindSpeed : 1000,
2077
2078        autoPlay : false,
2079        stopOnHover : false,
2080
2081        navigation : false,
2082        navigationText : ["Prev", "Next"],
2083        rewindNav : true,
2084        scrollPerPage : false,
2085
2086        pagination : true,
2087        paginationNumbers : false,
2088
2089        responsive : true,
2090        responsiveRefreshRate : 200,
2091        responsiveBaseWidth : window,
2092
2093        baseClass : "owl-carousel",
2094        theme : "owl-theme",
2095
2096        lazyLoad : false,
2097        lazyFollow : true,
2098        lazyEffect : "fade",
2099
2100        autoHeight : false,
2101
2102        jsonPath : false,
2103        jsonSuccess : false,
2104
2105        dragBeforeAnimFinish : true,
2106        mouseDrag : true,
2107        touchDrag : true,
2108
2109        addClassActive : false,
2110        transitionStyle : false,
2111
2112        beforeUpdate : false,
2113        afterUpdate : false,
2114        beforeInit : false,
2115        afterInit : false,
2116        beforeMove : false,
2117        afterMove : false,
2118        afterAction : false,
2119        startDragging : false,
2120        afterLazyLoad: false
2121    };
2122}(jQuery, window, document));
2123
2124/*! ResponsiveSlides.js v1.54
2125 * http://responsiveslides.com
2126 * http://viljamis.com
2127 *
2128 * Copyright (c) 2011-2012 @viljamis
2129 * Available under the MIT license
2130 */
2131
2132/*jslint browser: true, sloppy: true, vars: true, plusplus: true, indent: 2 */
2133
2134(function ($, window, i) {
2135  $.fn.responsiveSlides = function (options) {
2136
2137    // Default settings
2138    var settings = $.extend({
2139      "auto": true,             // Boolean: Animate automatically, true or false
2140      "speed": 500,             // Integer: Speed of the transition, in milliseconds
2141      "timeout": 1000,          // Integer: Time between slide transitions, in milliseconds
2142      "pager": false,           // Boolean: Show pager, true or false
2143      "nav": false,             // Boolean: Show navigation, true or false
2144      "random": false,          // Boolean: Randomize the order of the slides, true or false
2145      "pause": false,           // Boolean: Pause on hover, true or false
2146      "pauseControls": true,    // Boolean: Pause when hovering controls, true or false
2147      "prevText": "Anterior",   // String: Text for the "previous" button
2148      "nextText": "Siguiente",  // String: Text for the "next" button
2149      "maxwidth": "",           // Integer: Max-width of the slideshow, in pixels
2150      "navContainer": "",       // Selector: Where auto generated controls should be appended to, default is after the <ul>
2151      "manualControls": "",     // Selector: Declare custom pager navigation
2152      "namespace": "rslides",   // String: change the default namespace used
2153      "before": $.noop,         // Function: Before callback
2154      "after": $.noop           // Function: After callback
2155    }, options);
2156
2157    return this.each(function () {
2158
2159      // Index for namespacing
2160      i++;
2161
2162      var $this = $(this),
2163
2164        // Local variables
2165        vendor,
2166        selectTab,
2167        startCycle,
2168        restartCycle,
2169        rotate,
2170        $tabs,
2171
2172        // Helpers
2173        index = 0,
2174        $slide = $this.children(),
2175        length = $slide.length,
2176        fadeTime = parseFloat(settings.speed),
2177        waitTime = parseFloat(settings.timeout),
2178        maxw = parseFloat(settings.maxwidth),
2179
2180        // Namespacing
2181        namespace = settings.namespace,
2182        namespaceIdx = namespace + i,
2183
2184        // Classes
2185        navClass = namespace + "_nav " + namespaceIdx + "_nav",
2186        activeClass = namespace + "_here",
2187        visibleClass = namespaceIdx + "_on",
2188        slideClassPrefix = namespaceIdx + "_s",
2189
2190        // Pager
2191        $pager = $("<ul class='" + namespace + "_tabs " + namespaceIdx + "_tabs' />"),
2192
2193        // Styles for visible and hidden slides
2194        visible = {"float": "left", "position": "relative", "opacity": 1, "zIndex": 2},
2195        hidden = {"float": "none", "position": "absolute", "opacity": 0, "zIndex": 1},
2196
2197        // Detect transition support
2198        supportsTransitions = (function () {
2199          var docBody = document.body || document.documentElement;
2200          var styles = docBody.style;
2201          var prop = "transition";
2202          if (typeof styles[prop] === "string") {
2203            return true;
2204          }
2205          // Tests for vendor specific prop
2206          vendor = ["Moz", "Webkit", "Khtml", "O", "ms"];
2207          prop = prop.charAt(0).toUpperCase() + prop.substr(1);
2208          var i;
2209          for (i = 0; i < vendor.length; i++) {
2210            if (typeof styles[vendor[i] + prop] === "string") {
2211              return true;
2212            }
2213          }
2214          return false;
2215        })(),
2216
2217        // Fading animation
2218        slideTo = function (idx) {
2219          settings.before(idx);
2220          // If CSS3 transitions are supported
2221          if (supportsTransitions) {
2222            $slide
2223              .removeClass(visibleClass)
2224              .css(hidden)
2225              .eq(idx)
2226              .addClass(visibleClass)
2227              .css(visible);
2228            index = idx;
2229            setTimeout(function () {
2230              settings.after(idx);
2231            }, fadeTime);
2232          // If not, use jQuery fallback
2233          } else {
2234            $slide
2235              .stop()
2236              .fadeOut(fadeTime, function () {
2237                $(this)
2238                  .removeClass(visibleClass)
2239                  .css(hidden)
2240                  .css("opacity", 1);
2241              })
2242              .eq(idx)
2243              .fadeIn(fadeTime, function () {
2244                $(this)
2245                  .addClass(visibleClass)
2246                  .css(visible);
2247                settings.after(idx);
2248                index = idx;
2249              });
2250          }
2251        };
2252
2253      // Random order
2254      if (settings.random) {
2255        $slide.sort(function () {
2256          return (Math.round(Math.random()) - 0.5);
2257        });
2258        $this
2259          .empty()
2260          .append($slide);
2261      }
2262
2263      // Add ID's to each slide
2264      $slide.each(function (i) {
2265        this.id = slideClassPrefix + i;
2266      });
2267
2268      // Add max-width and classes
2269      $this.addClass(namespace + " " + namespaceIdx);
2270      if (options && options.maxwidth) {
2271        $this.css("max-width", maxw);
2272      }
2273
2274      // Hide all slides, then show first one
2275      $slide
2276        .hide()
2277        .css(hidden)
2278        .eq(0)
2279        .addClass(visibleClass)
2280        .css(visible)
2281        .show();
2282
2283      // CSS transitions
2284      if (supportsTransitions) {
2285        $slide
2286          .show()
2287          .css({
2288            // -ms prefix isn't needed as IE10 uses prefix free version
2289            "-webkit-transition": "opacity " + fadeTime + "ms ease-in-out",
2290            "-moz-transition": "opacity " + fadeTime + "ms ease-in-out",
2291            "-o-transition": "opacity " + fadeTime + "ms ease-in-out",
2292            "transition": "opacity " + fadeTime + "ms ease-in-out"
2293          });
2294      }
2295
2296      // Only run if there's more than one slide
2297      if ($slide.length > 1) {
2298
2299        // Make sure the timeout is at least 100ms longer than the fade
2300        if (waitTime < fadeTime + 100) {
2301          return;
2302        }
2303
2304        // Pager
2305        if (settings.pager && !settings.manualControls) {
2306          var tabMarkup = [];
2307          $slide.each(function (i) {
2308            var n = i + 1;
2309            tabMarkup +=
2310              "<li>" +
2311              "<a href='#' class='" + slideClassPrefix + n + "'>" + n + "</a>" +
2312              "</li>";
2313          });
2314          $pager.append(tabMarkup);
2315
2316          // Inject pager
2317          if (options.navContainer) {
2318            $(settings.navContainer).append($pager);
2319          } else {
2320            $this.after($pager);
2321          }
2322        }
2323
2324        // Manual pager controls
2325        if (settings.manualControls) {
2326          $pager = $(settings.manualControls);
2327          $pager.addClass(namespace + "_tabs " + namespaceIdx + "_tabs");
2328        }
2329
2330        // Add pager slide class prefixes
2331        if (settings.pager || settings.manualControls) {
2332          $pager.find('li').each(function (i) {
2333            $(this).addClass(slideClassPrefix + (i + 1));
2334          });
2335        }
2336
2337        // If we have a pager, we need to set up the selectTab function
2338        if (settings.pager || settings.manualControls) {
2339          $tabs = $pager.find('a');
2340
2341          // Select pager item
2342          selectTab = function (idx) {
2343            $tabs
2344              .closest("li")
2345              .removeClass(activeClass)
2346              .eq(idx)
2347              .addClass(activeClass);
2348          };
2349        }
2350
2351        // Auto cycle
2352        if (settings.auto) {
2353
2354          startCycle = function () {
2355            rotate = setInterval(function () {
2356
2357              // Clear the event queue
2358              $slide.stop(true, true);
2359
2360              var idx = index + 1 < length ? index + 1 : 0;
2361
2362              // Remove active state and set new if pager is set
2363              if (settings.pager || settings.manualControls) {
2364                selectTab(idx);
2365              }
2366
2367              slideTo(idx);
2368            }, waitTime);
2369          };
2370
2371          // Init cycle
2372          startCycle();
2373        }
2374
2375        // Restarting cycle
2376        restartCycle = function () {
2377          if (settings.auto) {
2378            // Stop
2379            clearInterval(rotate);
2380            // Restart
2381            startCycle();
2382          }
2383        };
2384
2385        // Pause on hover
2386        if (settings.pause) {
2387          $this.hover(function () {
2388            clearInterval(rotate);
2389          }, function () {
2390            restartCycle();
2391          });
2392        }
2393
2394
2395        // Pager click event handler
2396        if (settings.pager || settings.manualControls) {
2397          $tabs.bind("click", function (e) {
2398            e.preventDefault();
2399
2400            if (!settings.pauseControls) {
2401              restartCycle();
2402            }
2403
2404            // Get index of clicked tab
2405            var idx = $tabs.index(this);
2406
2407            // Break if element is already active or currently animated
2408            if (index === idx || $("." + visibleClass).queue('fx').length) {
2409              return;
2410            }
2411
2412            // Remove active state from old tab and set new one
2413            selectTab(idx);
2414
2415            // Do the animation
2416            slideTo(idx);
2417          })
2418            .eq(0)
2419            .closest("li")
2420            .addClass(activeClass);
2421
2422          // Pause when hovering pager
2423          if (settings.pauseControls) {
2424            $tabs.hover(function () {
2425              clearInterval(rotate);
2426            }, function () {
2427              restartCycle();
2428            });
2429          }
2430        }
2431
2432        // Navigation
2433        if (settings.nav) {
2434          var navMarkup =
2435            "<a href='#' class='" + navClass + " prev'>" + settings.prevText + "</a>" +
2436            "<a href='#' class='" + navClass + " next'>" + settings.nextText + "</a>";
2437
2438          // Inject navigation
2439          if (options.navContainer) {
2440            $(settings.navContainer).append(navMarkup);
2441          } else {
2442            $this.after(navMarkup);
2443          }
2444
2445          var $trigger = $("." + namespaceIdx + "_nav"),
2446            $prev = $trigger.filter(".prev");
2447          
2448          // Manejador de eventos focus
2449          $trigger.on("focus", function () {
2450            $(this).css({"outline": "2px solid orange", "background-color": "#ffeab2"}); 
2451          });
2452
2453          $trigger.on("blur", function () {
2454            $(this).css({"outline": "none", "background-color": "transparent"});
2455          });
2456
2457          // Click event handler
2458          $trigger.bind("click", function (e) {
2459            e.preventDefault();
2460
2461            var $visibleClass = $("." + visibleClass);
2462
2463            // Prevent clicking if currently animated
2464            if ($visibleClass.queue('fx').length) {
2465              return;
2466            }
2467
2468            //  Adds active class during slide animation
2469            //  $(this)
2470            //    .addClass(namespace + "_active")
2471            //    .delay(fadeTime)
2472            //    .queue(function (next) {
2473            //      $(this).removeClass(namespace + "_active");
2474            //      next();
2475            //  });
2476
2477            // Determine where to slide
2478            var idx = $slide.index($visibleClass),
2479              prevIdx = idx - 1,
2480              nextIdx = idx + 1 < length ? index + 1 : 0;
2481
2482            // Go to slide
2483            slideTo($(this)[0] === $prev[0] ? prevIdx : nextIdx);
2484            if (settings.pager || settings.manualControls) {
2485              selectTab($(this)[0] === $prev[0] ? prevIdx : nextIdx);
2486            }
2487
2488            if (!settings.pauseControls) {
2489              restartCycle();
2490            }
2491          });
2492
2493//		  $trigger.bind("focus", function (e) {
2494//
2495//			alert("focus");
2496//			$tabs.css("opacity","1.0");
2497//			clearInterval(rotate);
2498//			restartCycle();
2499//		});
2500
2501          // Pause when hovering navigation
2502          if (settings.pauseControls) {
2503            $trigger.hover(function () {
2504              clearInterval(rotate);
2505            }, function () {
2506              restartCycle();
2507            });
2508          }
2509        }
2510
2511      }
2512
2513      // Max-width fallback
2514      if (typeof document.body.style.maxWidth === "undefined" && options.maxwidth) {
2515        var widthSupport = function () {
2516          $this.css("width", "100%");
2517          if ($this.width() > maxw) {
2518            $this.css("width", maxw);
2519          }
2520        };
2521
2522        // Init fallback
2523        widthSupport();
2524        $(window).bind("resize", function () {
2525          widthSupport();
2526        });
2527      }
2528
2529    });
2530
2531  };
2532})(jQuery, this, 0);
2533
2534
2535// SLIDER
2536//------------------
2537$(function () {
2538  // Slideshow 1
2539  $("#slider1").responsiveSlides({
2540    auto: true,
2541    pager: true,
2542    nav: true,
2543    pause: true,
2544    pauseControls: true,
2545    speed: 800,
2546    timeout: 5000,
2547    maxwidth: 800,
2548    namespace: "centered-btns"
2549  });
2550	
2551  // Slideshow 2
2552  $("#slider-home-sm").responsiveSlides({
2553    auto: true,
2554    pager: true,
2555    nav: true,
2556    pause: true,
2557    pauseControls: true,
2558    speed: 800,
2559    timeout: 5000,
2560    maxwidth: 860,
2561	navContainer: "#slider-control-sm", 
2562    namespace: "centered-btns"
2563  });
2564  
2565  // Slideshow 2
2566  $("#slider-home-md").responsiveSlides({
2567    auto: true,
2568    pager: true,
2569    nav: true,
2570    pause: true,
2571    pauseControls: true,
2572    speed: 800,
2573    timeout: 5000,
2574    maxwidth: 1200,
2575	navContainer: "#slider-control-md", 
2576    namespace: "centered-btns"
2577  });
2578  
2579  // Slideshow 2
2580  $("#slider-home-xl").responsiveSlides({
2581    auto: true,
2582    pager: true,
2583    nav: true,
2584    pause: true,
2585    pauseControls: true,
2586    speed: 800,
2587    timeout: 5000,
2588    maxwidth: 1600,
2589	navContainer: "#slider-control-xl", 
2590    namespace: "centered-btns"
2591  });
2592
2593});
2594
2595function whichImageLoad() {
2596  var chica = 480;
2597  var mediana = 800; //768
2598  var root = (typeof exports === 'undefined' ? window : exports);
2599  var mediaQuery = '(-webkit-min-device-pixel-ratio: 2), (min--moz-device-pixel-ratio: 2), (-o-min-device-pixel-ratio: 2/1), (min-device-pixel-ratio: 2), (min-resolution: 192dpi), (min-resolution: 2dppx)';
2600  var isRetina = false;
2601  var result = "1";
2602
2603  if (root.devicePixelRatio >= 2) {
2604    isRetina = true;
2605  }
2606
2607  if (root.matchMedia && root.matchMedia(mediaQuery).matches) {
2608    isRetina = true;
2609  }
2610
2611  var windWidtht = $(window).width();
2612
2613
2614  if (isRetina) {
2615    if (windWidtht > mediana) {
2616      // grande retina
2617      result = "1";
2618    } else if (windWidtht <= mediana && windWidtht > chica) {
2619      // mediano retina
2620      result = "2";
2621    } else {
2622      // chico retina
2623      result = "3";
2624    }
2625
2626  } else {
2627    if (windWidtht > mediana) {
2628      // grande retina
2629      result = "4";
2630    } else if (windWidtht <= mediana && windWidtht > chica) {
2631      // mediano retina
2632      result = "5";
2633    } else {
2634      // chico retina
2635      result = "6";
2636    }
2637  }
2638
2639  return result;
2640};
2641
2642/**
2643 * functions.js
2644 * Contiene funciones genericas
2645 */
2646
2647// Reemplaza clase 'no-js' del tag <html> por la clase 'js' (sin utilizar jQuery)
2648var htmlTag = document.getElementsByTagName('html')[0];
2649htmlTag.className = htmlTag.className.replace(/\bno-js\b/, '') + 'js';
2650
2651// Add Class (sin jQuery)
2652function addClass(el, className) {
2653    if (el.classList)
2654        el.classList.add(className);
2655    else
2656        el.className += ' ' + className;
2657}
2658
2659// Detectar Touch devices
2660function is_touch_device() {
2661    return 'ontouchstart' in window // para casi todos
2662        || 'onmsgesturechange' in window; // para ie10
2663}
2664
2665// Agregar clases dependiendo si es Touch o no
2666if (is_touch_device()) {
2667    addClass(htmlTag, 'touch');
2668} else {
2669    addClass(htmlTag, 'no-touch');
2670}
2671
2672// jQuery Function to toggle Attributes
2673// Usage: $(this).toggleAttr('aria-expanded', 'true', 'false');
2674$.fn.toggleAttr = function(attr, attr1, attr2) {
2675  return this.each(function() {
2676    var self = $(this);
2677    if (self.attr(attr) == attr1)
2678      self.attr(attr, attr2);
2679    else
2680      self.attr(attr, attr1);
2681  });
2682};
2683
2684// Prevenir click en anclas vacías (jQuery)
2685$('a[href="#"]').click(function(event){
2686  event.preventDefault();
2687});
2688
2689$(document).ready(function () {
2690
2691  // Abrir subitems del menu lateral
2692	var cabezalMenu = $(".cat-menu-local");
2693	cabezalMenu.click(function() {
2694        var flechas = $(".cat-menu-local").find("#icon-flecha");
2695		if (window.matchMedia("(max-width: 980px)").matches){
2696		  $(".menu-local>ul").slideToggle(100,'linear');
2697		  $(".menu-local>ul").toggleClass('hidden-md-down');
2698		  var attr = flechas.attr('style');
2699		  if (typeof attr !== typeof undefined && attr !== false){
2700			  flechas.removeAttr('style');
2701		  } else {
2702			  flechas.css('transform', 'rotate(-90deg)');
2703		  }
2704		}
2705	  });
2706
2707  // Keyboard accessible dropdown menus
2708  $("#menu").accessibleDropDown();
2709  $(".temas-destacados").accessibleDropDown();
2710
2711  // Abrir menu
2712  $( ".btn-menu" )
2713   .off('click')
2714   .on('click',function() {
2715    if ( $( ".btn-buscar" ).hasClass('btn-buscar-open') ) {
2716      $(".btn-buscar").removeClass('btn-buscar-open');
2717      $( ".search" ).removeClass('search-show');
2718    }
2719    $( ".nav-bar" ).toggleClass('nav-bar-show');
2720    $(this).toggleClass('btn-menu-open');
2721    $('body').toggleClass('no-scroll');
2722  });
2723
2724  // Abrir buscador
2725  $( ".btn-buscar" ).click(function() {
2726    if ( $( ".btn-menu" ).hasClass('btn-menu-open') ) {
2727      $(".btn-menu").removeClass('btn-menu-open');
2728      $( ".nav-bar" ).removeClass('nav-bar-show');
2729      $('body').toggleClass('no-scroll');
2730    }
2731    $( ".search" ).toggleClass('search-show');
2732    $(this).toggleClass('btn-buscar-open');
2733    $( ".search-input" ).focus();
2734  });
2735
2736  // Abrir subitems del menu
2737  $("nav .item").click(function() {
2738    //$("nav .item").removeClass('item-open');
2739    $( this ).toggleClass('item-open');
2740  });
2741
2742  // Abrir y Cerrar desplegable facetas en touch
2743  $elements = $("div.desplegable-faceta-home");
2744   $elements.click(function() {
2745   $elements.not(this).removeClass('open-faceta').addClass('close-temas');
2746   $(".temas-destacados").removeClass('open-temas').addClass('close-temas');   // esto es para cerrar los temas también
2747   $( this ).toggleClass('open-faceta');
2748  });
2749
2750  // Abrir y Cerrar desplegable temas en touch
2751  $(".temas-destacados").click(function() {
2752   $( this ).toggleClass('open-temas');
2753   $("div.desplegable-faceta-home").removeClass('open-faceta').addClass('close-temas'); // esto es para cerrar una faceta que pueda estar abierta
2754  });
2755
2756  // Inicia Tabla Responsive
2757  var anchoPantalla = $(window).width();
2758  if(anchoPantalla < 980){
2759    insertDataTitle();
2760  }
2761
2762  // Inicia Carousel
2763  $("#owl-demo").owlCarousel({
2764    navigation: true, // Show next and prev buttons
2765    slideSpeed: 300,
2766    paginationSpeed: 400,
2767    singleItem: true,
2768    navigationText: ["<span class=\"icon-flecha-slider-ant\">", "<span class=\"icon-flecha-slider-sig\">"],
2769    autoHeight: true
2770  });  
2771  
2772  // Inicia Carousel
2773  $("#galeria-rotativa").owlCarousel({
2774    navigation: true, // Show next and prev buttons
2775    slideSpeed: 300,
2776    paginationSpeed: 400,
2777    singleItem: true,
2778    navigationText: ["<span class=\"icon-flecha-slider-ant\">", "<span class=\"icon-flecha-slider-sig\">"],
2779    autoHeight: true
2780  });
2781
2782  $("#rotativo-novedades").owlCarousel({
2783    navigation: true, // Show next and prev buttons
2784    slideSpeed: 300,
2785    paginationSpeed: 400,
2786    singleItem: true,
2787    navigationText: ["<span class=\"icon-flecha-slider-ant\">", "<span class=\"icon-flecha-slider-sig\">"],
2788    autoHeight: true
2789  });
2790  
2791  /* VERIFICAR */
2792  $("#fondo-rotativo").owlCarousel({
2793    autoplay: 1000,
2794		stopOnHover: false,
2795		navigation: true, // Show next and prev buttons
2796    slideSpeed: 300,
2797    paginationSpeed: 400,
2798    singleItem: true,
2799    navigationText: ["<span class=\"icon-flecha-slider-ant\">", "<span class=\"icon-flecha-slider-sig\">"],
2800    autoHeight: true
2801  });
2802
2803});
2804
2805// Plugin Accesible Drop Down
2806// https://uablogs.missouri.edu/interface/2011/08/keyboard-accessible/
2807$.fn.accessibleDropDown = function () {
2808  var el = $(this);
2809
2810  var className = el.attr('class');
2811
2812  // Dropdowns facetas
2813  if (className == 'faceta temas-destacados') {
2814    $("a", el).focus(function () {
2815      $(".temas-destacados").addClass("hover");
2816    }).blur(function () {
2817      $(".temas-destacados").removeClass("hover");
2818    });
2819
2820  // Menu principal
2821  } else {
2822    $("li", el).mouseover(function () {
2823      $(this).addClass("hover");
2824      $(this).find('.submenu').toggleAttr('aria-hidden', 'true', 'false');
2825    }).mouseout(function () {
2826      $(this).removeClass("hover");
2827      $(this).find('.submenu').toggleAttr('aria-hidden', 'true', 'false');
2828    });
2829
2830    $(".item > a").focus(function () {
2831      $(this).next('.submenu').toggleAttr('aria-hidden', 'true', 'false');
2832    }).blur(function () {
2833      $(this).next('.submenu').toggleAttr('aria-hidden', 'true', 'false');
2834    });
2835
2836    $("a", el).focus(function () {
2837      $(this).parents("li").addClass("hover");
2838      $(this).closest('.submenu').toggleAttr('aria-hidden', 'true', 'false');
2839    }).blur(function () {
2840      $(this).parents("li").removeClass("hover");
2841      $(this).closest('.submenu').toggleAttr('aria-hidden', 'true', 'false');
2842    });
2843  }
2844};
2845
2846
2847// Solucionar problema de foco al saltar al contenido
2848// https://www.nczonline.net/blog/2013/01/15/fixing-skip-to-content-links/
2849( function() {
2850	var is_webkit = navigator.userAgent.toLowerCase().indexOf( 'webkit' ) > -1,
2851	    is_opera  = navigator.userAgent.toLowerCase().indexOf( 'opera' )  > -1,
2852	    is_ie     = navigator.userAgent.toLowerCase().indexOf( 'msie' )   > -1;
2853
2854	if ( ( is_webkit || is_opera || is_ie ) && document.getElementById && window.addEventListener ) {
2855		window.addEventListener( 'hashchange', function() {
2856			var id = location.hash.substring( 1 ),
2857				element;
2858
2859			if ( ! ( /^[A-z0-9_-]+$/.test( id ) ) ) {
2860				return;
2861			}
2862
2863			element = document.getElementById( id );
2864
2865			if ( element ) {
2866				if ( ! ( /^(?:a|select|input|button|textarea)$/i.test( element.tagName ) ) ) {
2867					element.tabIndex = -1;
2868				}
2869
2870				element.focus();
2871			}
2872		}, false );
2873	}
2874})();
2875
2876
2877/**
2878 * Abrir Navegación Local en MD
2879 */
2880//$('.menuLista .collapsed').click(function () {
2881$('.menu-local .cat-menu-local').click(function () {
2882  $(this).toggleClass('menu-local-active');
2883  $(this).next('#menu-local').toggleClass('menu-local-open');
2884});
2885
2886
2887/* Titulos de las tablas (ready y resize) */
2888var setContent = false;
2889
2890function insertDataTitle(){
2891	if(!setContent){
2892		$('table td').each(function() {
2893			if($(this).attr( "data-title" )){
2894				var dataTitle = $(this).attr( "data-title" );
2895				$(this).prepend( '<span class="content-before">' + dataTitle + '</span>' );
2896			}
2897		});
2898
2899		setContent = true;
2900	}
2901}
2902
2903function deleteDataTitle(){
2904	$('table td').each(function() {
2905		if($(this).attr( "data-title" )){
2906			$('.content-before').remove();
2907		}
2908	});
2909
2910	setContent = false;
2911}
2912
2913$(window).resize(function() {
2914	anchoPantalla = $(window).width();
2915
2916	if(anchoPantalla <= 980){
2917  	insertDataTitle();
2918	}
2919	if((anchoPantalla > 980) & (setContent)){
2920		deleteDataTitle();
2921	}
2922});
2923
2924
2925/* Agrandar y achicar el texto (formato documento) */
2926var fontSize = 1,
2927    factor = 0.1;
2928
2929$('#aumentar').on('click', function() {
2930  fontSize = fontSize + factor;
2931  $('.formato-wrap').css( {"font-size": fontSize + 'em'});
2932});
2933
2934$('#disminuir').on('click', function() {
2935  fontSize = fontSize - factor;
2936  $('.formato-wrap').css( {"font-size": fontSize + 'em'});
2937});
2938
2939
2940//definir idServicio para iframe aliss
2941
2942function actualizarAsistente(codAsistente) {
2943    var iframeAliss = document.getElementById('iframe_aliss');
2944    if (iframeAliss != null) {
2945        try {
2946            var json = JSON.parse(codAsistente);
2947            var src = "";
2948            var srcTmp = iframeAliss.src.split("&");
2949            srcTmp.forEach(function (item) {
2950                if (item.includes("codAsistente")) {
2951                    item = item.split("=")[0] + "=" + json.codAsistente;
2952                }
2953                if (item.includes("idServicio")){
2954                	item = item.split("=")[0] + "=" + json.codAsistente;
2955                }
2956                if (item.includes("open")) {
2957                    item = item.split("=")[0] + "=" + json.open;
2958                }
2959                if (item !== "") {
2960                    src += item + "&";
2961                }
2962            });
2963            if (json.open && !src.includes("open")) {
2964                src += "open=" + json.open;
2965            }
2966            resetMessageChannel(channel_Servicio);
2967            channel_Servicio = undefined;
2968            iframeAliss.src = src;
2969            console.log("actualizarAsistente: " + iframeAliss.src);
2970            return "Asistente actualizado";
2971        } catch (e) {
2972            console.error("no es json válido " + e);
2973            return false;
2974        }
2975    } else {
2976        console.error("iframeAliss es null");
2977    }
2978}
2979
2980function abrirAsistente() {
2981    console.log("ejecutando abrir asistente");
2982    document.querySelector('.aliss-click').style.display = 'none';
2983    var codigo = window.codAsistente || window.ALISS_ARBOL_GENERICO;
2984
2985    if (codigo) {
2986        actualizarAsistente(
2987          '{"codAsistente":"' + codigo + '","open":"true"}'
2988        );
2989    }
2990}
2991
2992//Message channel Aliss
2993
2994var channel_Servicio;
2995var DesplegarAliss = 'desplegar-aliss';
2996var HeightServiceMg = 'height-service';
2997var HeightService;
2998
2999//Carga iframe Aliss y ejecuta el resize
3000
3001$(function(){
3002	document.getElementById('iframe_aliss')
3003		.addEventListener('load', function(){
3004			onLoad_Servicio(document.getElementById('iframe_aliss'))
3005		});
3006});
3007
3008
3009function onLoad_Servicio(iframeApp) {
3010	if (typeof channel_Servicio == "undefined") {
3011		channel_Servicio = new MessageChannel();
3012		console.log("onLoad_Servicio -> new MessageChannel")
3013		abrirCanal_Servicio(channel_Servicio, iframeApp);
3014	}
3015}
3016
3017function abrirCanal_Servicio(channel_Servicio, iframeApp) {
3018	console.log("abrirCanal_Servicio");
3019	//esta función está en el script del iframe (servicio)
3020	// asignarComunicacionServicio();
3021	resetMessageChannel(channel_Servicio);
3022	// Listen for messages on port1
3023	channel_Servicio.port1.onmessage = onMessage_Servicio;
3024	// Transfer port2 to the iframe
3025	iframeApp.contentWindow.postMessage('Hola desde el portal', iframeApp.src, [channel_Servicio.port2]);
3026}
3027
3028function enviarMsg_Servicio(msg, iframeApp) {
3029	iframeApp.contentWindow.postMessage(msg, iframeApp.src);
3030}
3031
3032// Handle messages received on port1
3033function onMessage_Servicio(e) {
3034	//detectar cierre de aliss
3035    if (e.data.mensaje == 'cierre-alise') {
3036        document.querySelector('.aliss-click').style.display = 'block';
3037
3038        if (window.location.pathname.includes('/trabajo_domestico')) {
3039            $('#aliss').hide();
3040        }        
3041        return;
3042    }
3043	
3044	//desplegar aliss
3045	if (e.data == DesplegarAliss || e.data.mensaje == DesplegarAliss) {
3046		enviarMensaje_Aliss(e.data);
3047	}
3048	//resize
3049	//se espera { mensaje: "height-service", obj: "100px" }
3050	else if (e.data.mensaje == HeightServiceMg) {
3051		//se valida que manden resize
3052		if (e.data.obj) {
3053			//también se valida que el height recibido sea distinto al actual
3054			if (HeightService != e.data.obj) {
3055				HeightService = e.data.obj;
3056				resizeFrameMessageChannel();
3057			}
3058		}
3059	}
3060}
3061
3062function resetMessageChannel(channel) {
3063	if (channel) {
3064		if (channel.port1) resetPort(channel.port1);
3065		if (channel.port2) resetPort(channel.port2);
3066	}
3067	channel = new MessageChannel();
3068}
3069
3070function resetPort(port) {
3071	port.onmessage = null;
3072	port = null;
3073}
3074
3075
3076function resizeFrameMessageChannel() {
3077	// No hay valor asignado por el servicio
3078	if (!HeightService) return;
3079	var frame = document.getElementById('iframe_aliss');
3080	
3081	if (!frame) return;
3082	
3083	try {
3084		frame.style.height = HeightService;
3085		frame.contentWindow.document.documentElement.style.height = HeightService;
3086	} catch (error) {
3087		console.error(error);
3088	}
3089}
3090

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.