/* Minification failed. Returning unminified contents.
(13151,40-41): run-time error JS1014: Invalid character: `
(13151,41-42): run-time error JS1195: Expected expression: <
(13151,259-260): run-time error JS1195: Expected expression: <
(13151,317-318): run-time error JS1014: Invalid character: `
(13155,13-14): run-time error JS1002: Syntax error: }
(13156,25-26): run-time error JS1004: Expected ';': {
(13157,82-83): run-time error JS1014: Invalid character: `
(13157,83-84): run-time error JS1195: Expected expression: <
(13157,93-97): run-time error JS1197: Too many errors. The file might not be a JavaScript file: "rb"
 */
// Avoid `console` errors in browsers that lack a console.
(function () {
    var method;
    var noop = function () { };
    var methods = [
        'assert', 'clear', 'count', 'debug', 'dir', 'dirxml', 'error',
        'exception', 'group', 'groupCollapsed', 'groupEnd', 'info', 'log',
        'markTimeline', 'profile', 'profileEnd', 'table', 'time', 'timeEnd',
        'timeStamp', 'trace', 'warn'
    ];
    var length = methods.length;
    var console = (window.console = window.console || {});

    while (length--) {
        method = methods[length];

        // Only stub undefined methods.
        if (!console[method]) {
            console[method] = noop;
        }
    }
}());

/*!
 * jQuery Cookie Plugin v1.4.1
 * https://github.com/carhartl/jquery-cookie
 *
 * Copyright 2013 Klaus Hartl
 * Released under the MIT license
 */
(function (e) { if (typeof define === "function" && define.amd) { define(["jquery"], e) } else if (typeof exports === "object") { e(require("jquery")) } else { e(jQuery) } })(function (e) { function n(e) { return u.raw ? e : encodeURIComponent(e) } function r(e) { return u.raw ? e : decodeURIComponent(e) } function i(e) { return n(u.json ? JSON.stringify(e) : String(e)) } function s(e) { if (e.indexOf('"') === 0) { e = e.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, "\\") } try { e = decodeURIComponent(e.replace(t, " ")); return u.json ? JSON.parse(e) : e } catch (n) { } } function o(t, n) { var r = u.raw ? t : s(t); return e.isFunction(n) ? n(r) : r } var t = /\+/g; var u = e.cookie = function (t, s, a) { if (s !== undefined && !e.isFunction(s)) { a = e.extend({}, u.defaults, a); if (typeof a.expires === "number") { var f = a.expires, l = a.expires = new Date; l.setTime(+l + f * 864e5) } return document.cookie = [n(t), "=", i(s), a.expires ? "; expires=" + a.expires.toUTCString() : "", a.path ? "; path=" + a.path : "", a.domain ? "; domain=" + a.domain : "", a.secure ? "; secure" : ""].join("") } var c = t ? undefined : {}; var h = document.cookie ? document.cookie.split("; ") : []; for (var p = 0, d = h.length; p < d; p++) { var v = h[p].split("="); var m = r(v.shift()); var g = v.join("="); if (t && t === m) { c = o(g, s); break } if (!t && (g = o(g)) !== undefined) { c[m] = g } } return c }; u.defaults = {}; e.removeCookie = function (t, n) { if (e.cookie(t) === undefined) { return false } e.cookie(t, "", e.extend({}, n, { expires: -1 })); return !e.cookie(t) } });

// Slidebars 0.9.4 - http://plugins.adchsm.me/slidebars/ Written by Adam Smith - http://www.adchsm.me/ Released under MIT License - http://plugins.adchsm.me/slidebars/license.txt
//(function (a) { a.slidebars = function (b) { var x = a.extend({ siteClose: true, disableOver: false, hideControlClasses: false }, b); var v = document.createElement("div").style, t = false, k = false; if (v.MozTransition === "" || v.WebkitTransition === "" || v.OTransition === "" || v.transition === "") { t = true } if (v.MozTransform === "" || v.WebkitTransform === "" || v.OTransform === "" || v.transform === "") { k = true } var s = navigator.userAgent, y = false, c = false; if (/Android/.test(s)) { y = s.substr(s.indexOf("Android") + 8, 3) } else { if (/(iPhone|iPod|iPad)/.test(s)) { c = s.substr(s.indexOf("OS ") + 3, 3).replace("_", ".") } } if (y && y < 3 || c && c < 5) { a("html").addClass("sb-static") } if (!a("#sb-site").length) { a("body").children().wrapAll('<div id="sb-site" />') } var q = a("#sb-site"); if (!q.parent().is("body")) { q.appendTo("body") } if (a(".sb-left").length) { var e = a(".sb-left"), g = false; e.addClass("sb-slidebar"); if (!e.parent().is("body")) { e.appendTo("body") } } if (a(".sb-right").length) { var h = a(".sb-right"), j = false; h.addClass("sb-slidebar"); if (!h.parent().is("body")) { h.appendTo("body") } } var r = false, z = a(window).width(), w = a(".sb-toggle-left, .sb-toggle-right, .sb-open-left, .sb-open-right, .sb-close"), m = a(".sb-slide"); function o() { if (!x.disableOver || (typeof x.disableOver === "number" && x.disableOver >= z)) { r = true; a("html").addClass("sb-init"); if (x.hideControlClasses) { w.removeClass("sb-hide") } } else { if (typeof x.disableOver === "number" && x.disableOver < z) { r = false; a("html").removeClass("sb-init"); if (x.hideControlClasses) { w.addClass("sb-hide") } if (g || j) { l() } } } } o(); function f() { q.css("minHeight", ""); q.css("minHeight", a("body").height() + "px"); if (e && (e.hasClass("sb-style-push") || e.hasClass("sb-style-overlay"))) { e.css("marginLeft", "-" + e.css("width")) } if (h && (h.hasClass("sb-style-push") || h.hasClass("sb-style-overlay"))) { h.css("marginRight", "-" + h.css("width")) } if (e && e.hasClass("sb-width-custom")) { e.css("width", e.attr("data-sb-width")) } if (h && h.hasClass("sb-width-custom")) { h.css("width", h.attr("data-sb-width")) } } f(); a(window).resize(function () { var A = a(window).width(); if (z !== A) { z = A; o(); f(); if (g) { i("left") } if (j) { i("right") } } }); var u; if (t && k) { u = "translate"; if (y && y < 4.4) { u = "side" } } else { u = "jQuery" } function d(B, E, D) { var A; if (B.hasClass("sb-style-push")) { A = q.add(B).add(m) } else { if (B.hasClass("sb-style-overlay")) { A = B } else { A = q.add(m) } } if (u === "translate") { A.css("transform", "translate(" + E + ")") } else { if (u === "side") { if (E[0] === "-") { E = E.substr(1) } A.css(D, E); setTimeout(function () { if (E === "0px") { A.removeAttr("style"); f() } }, 400) } else { if (u === "jQuery") { if (E[0] === "-") { E = E.substr(1) } var C = {}; C[D] = E; A.stop().animate(C, 400); setTimeout(function () { if (E === "0px") { A.removeAttr("style"); f() } }, 400) } } } } function i(A) { if (A === "left" && e && j || A === "right" && h && g) { l(); setTimeout(B, 400) } else { B() } function B() { if (r && A === "left" && e) { a("html").addClass("sb-active sb-active-left"); e.addClass("sb-active"); d(e, e.css("width"), "left"); setTimeout(function () { g = true }, 400) } else { if (r && A === "right" && h) { a("html").addClass("sb-active sb-active-right"); h.addClass("sb-active"); d(h, "-" + h.css("width"), "right"); setTimeout(function () { j = true }, 400) } } } } function l(A) { if (g || j) { if (g) { d(e, "0px", "left"); g = false } if (j) { d(h, "0px", "right"); j = false } setTimeout(function () { a("html").removeClass("sb-active sb-active-left sb-active-right"); if (e) { e.removeClass("sb-active") } if (h) { h.removeClass("sb-active") } if (A) { window.location = A } }, 400) } } function n(A) { if (A === "left" && e) { if (!g) { i("left") } else { l() } } if (A === "right" && h) { if (!j) { i("right") } else { l() } } } this.open = i; this.close = l; this.toggle = n; this.init = function () { return r }; this.active = function (A) { if (A === "left" && e) { return g } if (A === "right" && h) { return j } }; function p(B, A) { B.stopPropagation(); B.preventDefault(); if (B.type === "touchend") { A.off("click") } } a(".sb-toggle-left").on("touchend click", function (A) { p(A, a(this)); n("left") }); a(".sb-toggle-right").on("touchend click", function (A) { p(A, a(this)); n("right") }); a(".sb-open-left").on("touchend click", function (A) { p(A, a(this)); i("left") }); a(".sb-open-right").on("touchend click", function (A) { p(A, a(this)); i("right") }); a(".sb-close").on("touchend click", function (A) { p(A, a(this)); l() }); a(".sb-slidebar a").not(".sb-disable-close").on("click", function (A) { p(A, a(this)); l(a(this).attr("href")) }); q.on("touchend click", function (A) { if (x.siteClose && (g || j)) { p(A, a(this)); l() } }) } })(jQuery);
// Slidebars 0.10.2 (http://plugins.adchsm.me/slidebars/) written by Adam Smith (http://www.adchsm.me/) released under MIT License (http://plugins.adchsm.me/slidebars/license.txt)
!function (t) { t.slidebars = function (s) { function e() { !c.disableOver || "number" == typeof c.disableOver && c.disableOver >= T ? (y = !0, t("html").addClass("sb-init"), c.hideControlClasses && k.removeClass("sb-hide"), i()) : "number" == typeof c.disableOver && c.disableOver < T && (y = !1, t("html").removeClass("sb-init"), c.hideControlClasses && k.addClass("sb-hide"), g.css("minHeight", ""), (C || w) && a()) } function i() { g.css("minHeight", ""), g.css("minHeight", t("html").height() + "px"), m && m.hasClass("sb-width-custom") && m.css("width", m.attr("data-sb-width")), p && p.hasClass("sb-width-custom") && p.css("width", p.attr("data-sb-width")), m && (m.hasClass("sb-style-push") || m.hasClass("sb-style-overlay")) && m.css("marginLeft", "-" + m.css("width")), p && (p.hasClass("sb-style-push") || p.hasClass("sb-style-overlay")) && p.css("marginRight", "-" + p.css("width")), c.scrollLock && t("html").addClass("sb-scroll-lock") } function n(t, s, e) { var n; if (n = t.hasClass("sb-style-push") ? g.add(t).add(O) : t.hasClass("sb-style-overlay") ? t : g.add(O), "translate" === x) n.css("transform", "translate(" + s + ")"); else if ("side" === x) "-" === s[0] && (s = s.substr(1)), "0px" !== s && n.css(e, "0px"), setTimeout(function () { n.css(e, s) }, 1); else if ("jQuery" === x) { "-" === s[0] && (s = s.substr(1)); var o = {}; o[e] = s, n.stop().animate(o, 400) } setTimeout(function () { "0px" === s && (n.removeAttr("style"), i()) }, 400) } function o(s) { function e() { y && "left" === s && m ? (t("html").addClass("sb-active sb-active-left"), m.addClass("sb-active"), n(m, m.css("width"), "left"), setTimeout(function () { C = !0 }, 400)) : y && "right" === s && p && (t("html").addClass("sb-active sb-active-right"), p.addClass("sb-active"), n(p, "-" + p.css("width"), "right"), setTimeout(function () { w = !0 }, 400)) } "left" === s && m && w || "right" === s && p && C ? (a(), setTimeout(e, 400)) : e() } function a(s) { (C || w) && (C && (n(m, "0px", "left"), C = !1), w && (n(p, "0px", "right"), w = !1), setTimeout(function () { t("html").removeClass("sb-active sb-active-left sb-active-right"), m && m.removeClass("sb-active"), p && p.removeClass("sb-active"), "undefined" != typeof s && (window.location = s) }, 400)) } function l(t) { "left" === t && m && (C ? a() : o("left")), "right" === t && p && (w ? a() : o("right")) } function r(t, s) { t.stopPropagation(), t.preventDefault(), "touchend" === t.type && s.off("click") } var c = t.extend({ siteClose: !0, scrollLock: !1, disableOver: !1, hideControlClasses: !1 }, s), h = document.createElement("div").style, d = !1, f = !1; ("" === h.MozTransition || "" === h.WebkitTransition || "" === h.OTransition || "" === h.transition) && (d = !0), ("" === h.MozTransform || "" === h.WebkitTransform || "" === h.OTransform || "" === h.transform) && (f = !0); var u = navigator.userAgent, b = !1, v = !1; /Android/.test(u) ? b = u.substr(u.indexOf("Android") + 8, 3) : /(iPhone|iPod|iPad)/.test(u) && (v = u.substr(u.indexOf("OS ") + 3, 3).replace("_", ".")), (b && 3 > b || v && 5 > v) && t("html").addClass("sb-static"); var g = t("#sb-site, .sb-site-container"); if (t(".sb-left").length) var m = t(".sb-left"), C = !1; if (t(".sb-right").length) var p = t(".sb-right"), w = !1; var y = !1, T = t(window).width(), k = t(".sb-toggle-left, .sb-toggle-right, .sb-open-left, .sb-open-right, .sb-close"), O = t(".sb-slide"); e(), t(window).resize(function () { var s = t(window).width(); T !== s && (T = s, e(), C && o("left"), w && o("right")) }); var x; d && f ? (x = "translate", b && 4.4 > b && (x = "side")) : x = "jQuery", this.slidebars = { open: o, close: a, toggle: l, init: function () { return y }, active: function (t) { return "left" === t && m ? C : "right" === t && p ? w : void 0 }, destroy: function (t) { "left" === t && m && (C && a(), setTimeout(function () { m.remove(), m = !1 }, 400)), "right" === t && p && (w && a(), setTimeout(function () { p.remove(), p = !1 }, 400)) } }, t(".sb-toggle-left").on("touchend click", function (s) { r(s, t(this)), l("left") }), t(".sb-toggle-right").on("touchend click", function (s) { r(s, t(this)), l("right") }), t(".sb-open-left").on("touchend click", function (s) { r(s, t(this)), o("left") }), t(".sb-open-right").on("touchend click", function (s) { r(s, t(this)), o("right") }), t(".sb-close").on("touchend click", function (s) { if (t(this).is("a") || t(this).children().is("a")) { if ("click" === s.type) { s.preventDefault(); var e = t(this).is("a") ? t(this).attr("href") : t(this).find("a").attr("href"); a(e) } } else r(s, t(this)), a() }), g.on("touchend click", function (s) { c.siteClose && (C || w) && (r(s, t(this)), a()) }) } }(jQuery);


/*! TinySort 1.5.6
* Copyright (c) 2008-2013 Ron Valstar http://tinysort.sjeiti.com/
* License:
*     MIT: http://www.opensource.org/licenses/mit-license.php
*     GPL: http://www.gnu.org/licenses/gpl.html
*/
!function (a, b) { "use strict"; function c(a) { return a && a.toLowerCase ? a.toLowerCase() : a } function d(a, b) { for (var c = 0, d = a.length; d > c; c++) if (a[c] == b) return !e; return e } var e = !1, f = null, g = parseFloat, h = Math.min, i = /(-?\d+\.?\d*)$/g, j = /(\d+\.?\d*)$/g, k = [], l = [], m = function (a) { return "string" == typeof a }, n = function (a, b) { for (var c, d = a.length, e = d; e--;) c = d - e - 1, b(a[c], c) }, o = Array.prototype.indexOf || function (a) { var b = this.length, c = Number(arguments[1]) || 0; for (c = 0 > c ? Math.ceil(c) : Math.floor(c), 0 > c && (c += b); b > c; c++) if (c in this && this[c] === a) return c; return -1 }; a.tinysort = { id: "TinySort", version: "1.5.6", copyright: "Copyright (c) 2008-2013 Ron Valstar", uri: "http://tinysort.sjeiti.com/", licensed: { MIT: "http://www.opensource.org/licenses/mit-license.php", GPL: "http://www.gnu.org/licenses/gpl.html" }, plugin: function () { var a = function (a, b) { k.push(a), l.push(b) }; return a.indexOf = o, a }(), defaults: { order: "asc", attr: f, data: f, useVal: e, place: "start", returns: e, cases: e, forceStrings: e, ignoreDashes: e, sortFunction: f } }, a.fn.extend({ tinysort: function () { var p, q, r, s, t = this, u = [], v = [], w = [], x = [], y = 0, z = [], A = [], B = function (a) { n(k, function (b) { b.call(b, a) }) }, C = function (a, b) { return "string" == typeof b && (a.cases || (b = c(b)), b = b.replace(/^\s*(.*?)\s*$/i, "$1")), b }, D = function (a, b) { var c = 0; for (0 !== y && (y = 0); 0 === c && s > y;) { var d = x[y], f = d.oSettings, h = f.ignoreDashes ? j : i; if (B(f), f.sortFunction) c = f.sortFunction(a, b); else if ("rand" == f.order) c = Math.random() < .5 ? 1 : -1; else { var k = e, o = C(f, a.s[y]), p = C(f, b.s[y]); if (!f.forceStrings) { var q = m(o) ? o && o.match(h) : e, r = m(p) ? p && p.match(h) : e; if (q && r) { var t = o.substr(0, o.length - q[0].length), u = p.substr(0, p.length - r[0].length); t == u && (k = !e, o = g(q[0]), p = g(r[0])) } } c = d.iAsc * (p > o ? -1 : o > p ? 1 : 0) } n(l, function (a) { c = a.call(a, k, o, p, c) }), 0 === c && y++ } return c }; for (p = 0, r = arguments.length; r > p; p++) { var E = arguments[p]; m(E) ? z.push(E) - 1 > A.length && (A.length = z.length - 1) : A.push(E) > z.length && (z.length = A.length) } for (z.length > A.length && (A.length = z.length), s = z.length, 0 === s && (s = z.length = 1, A.push({})), p = 0, r = s; r > p; p++) { var F = z[p], G = a.extend({}, a.tinysort.defaults, A[p]), H = !(!F || "" === F), I = H && ":" === F[0]; x.push({ sFind: F, oSettings: G, bFind: H, bAttr: !(G.attr === f || "" === G.attr), bData: G.data !== f, bFilter: I, $Filter: I ? t.filter(F) : t, fnSort: G.sortFunction, iAsc: "asc" == G.order ? 1 : -1 }) } return t.each(function (c, d) { var e, f = a(d), g = f.parent().get(0), h = []; for (q = 0; s > q; q++) { var i = x[q], j = i.bFind ? i.bFilter ? i.$Filter.filter(d) : f.find(i.sFind) : f; h.push(i.bData ? j.data(i.oSettings.data) : i.bAttr ? j.attr(i.oSettings.attr) : i.oSettings.useVal ? j.val() : j.text()), e === b && (e = j) } var k = o.call(w, g); 0 > k && (k = w.push(g) - 1, v[k] = { s: [], n: [] }), e.length > 0 ? v[k].s.push({ s: h, e: f, n: c }) : v[k].n.push({ e: f, n: c }) }), n(v, function (a) { a.s.sort(D) }), n(v, function (a) { var b = a.s, c = a.n, f = b.length, g = c.length, i = f + g, j = [], k = i, l = [0, 0]; switch (G.place) { case "first": n(b, function (a) { k = h(k, a.n) }); break; case "org": n(b, function (a) { j.push(a.n) }); break; case "end": k = g; break; default: k = 0 } for (p = 0; i > p; p++) { var m = d(j, p) ? !e : p >= k && k + f > p, o = m ? 0 : 1, q = (m ? b : c)[l[o]].e; q.parent().append(q), (m || !G.returns) && u.push(q.get(0)), l[o]++ } }), t.length = 0, Array.prototype.push.apply(t, u), t } }), a.fn.TinySort = a.fn.Tinysort = a.fn.tsort = a.fn.tinysort }(jQuery);

/*
* touchSwipe - jQuery Plugin
* https://github.com/mattbryson/TouchSwipe-Jquery-Plugin
* http://labs.skinkers.com/touchSwipe/
* http://plugins.jquery.com/project/touchSwipe
*
* Copyright (c) 2010 Matt Bryson (www.skinkers.com)
* Dual licensed under the MIT or GPL Version 2 licenses.
*
* $version: 1.6.5
*/
(function (a) { if (typeof define === "function" && define.amd && define.amd.jQuery) { define(["jquery"], a) } else { a(jQuery) } }(function (e) { var o = "left", n = "right", d = "up", v = "down", c = "in", w = "out", l = "none", r = "auto", k = "swipe", s = "pinch", x = "tap", i = "doubletap", b = "longtap", A = "horizontal", t = "vertical", h = "all", q = 10, f = "start", j = "move", g = "end", p = "cancel", a = "ontouchstart" in window, y = "TouchSwipe"; var m = { fingers: 1, threshold: 75, cancelThreshold: null, pinchThreshold: 20, maxTimeThreshold: null, fingerReleaseThreshold: 250, longTapThreshold: 500, doubleTapThreshold: 200, swipe: null, swipeLeft: null, swipeRight: null, swipeUp: null, swipeDown: null, swipeStatus: null, pinchIn: null, pinchOut: null, pinchStatus: null, click: null, tap: null, doubleTap: null, longTap: null, triggerOnTouchEnd: true, triggerOnTouchLeave: false, allowPageScroll: "auto", fallbackToMouseEvents: true, excludedElements: "label, button, input, select, textarea, .noSwipe" }; e.fn.swipe = function (D) { var C = e(this), B = C.data(y); if (B && typeof D === "string") { if (B[D]) { return B[D].apply(this, Array.prototype.slice.call(arguments, 1)) } else { e.error("Method " + D + " does not exist on jQuery.swipe") } } else { if (!B && (typeof D === "object" || !D)) { return u.apply(this, arguments) } } return C }; e.fn.swipe.defaults = m; e.fn.swipe.phases = { PHASE_START: f, PHASE_MOVE: j, PHASE_END: g, PHASE_CANCEL: p }; e.fn.swipe.directions = { LEFT: o, RIGHT: n, UP: d, DOWN: v, IN: c, OUT: w }; e.fn.swipe.pageScroll = { NONE: l, HORIZONTAL: A, VERTICAL: t, AUTO: r }; e.fn.swipe.fingers = { ONE: 1, TWO: 2, THREE: 3, ALL: h }; function u(B) { if (B && (B.allowPageScroll === undefined && (B.swipe !== undefined || B.swipeStatus !== undefined))) { B.allowPageScroll = l } if (B.click !== undefined && B.tap === undefined) { B.tap = B.click } if (!B) { B = {} } B = e.extend({}, e.fn.swipe.defaults, B); return this.each(function () { var D = e(this); var C = D.data(y); if (!C) { C = new z(this, B); D.data(y, C) } }) } function z(a0, aq) { var av = (a || !aq.fallbackToMouseEvents), G = av ? "touchstart" : "mousedown", au = av ? "touchmove" : "mousemove", R = av ? "touchend" : "mouseup", P = av ? null : "mouseleave", az = "touchcancel"; var ac = 0, aL = null, Y = 0, aX = 0, aV = 0, D = 1, am = 0, aF = 0, J = null; var aN = e(a0); var W = "start"; var T = 0; var aM = null; var Q = 0, aY = 0, a1 = 0, aa = 0, K = 0; var aS = null; try { aN.bind(G, aJ); aN.bind(az, a5) } catch (ag) { e.error("events not supported " + G + "," + az + " on jQuery.swipe") } this.enable = function () { aN.bind(G, aJ); aN.bind(az, a5); return aN }; this.disable = function () { aG(); return aN }; this.destroy = function () { aG(); aN.data(y, null); return aN }; this.option = function (a8, a7) { if (aq[a8] !== undefined) { if (a7 === undefined) { return aq[a8] } else { aq[a8] = a7 } } else { e.error("Option " + a8 + " does not exist on jQuery.swipe.options") } return null }; function aJ(a9) { if (ax()) { return } if (e(a9.target).closest(aq.excludedElements, aN).length > 0) { return } var ba = a9.originalEvent ? a9.originalEvent : a9; var a8, a7 = a ? ba.touches[0] : ba; W = f; if (a) { T = ba.touches.length } else { a9.preventDefault() } ac = 0; aL = null; aF = null; Y = 0; aX = 0; aV = 0; D = 1; am = 0; aM = af(); J = X(); O(); if (!a || (T === aq.fingers || aq.fingers === h) || aT()) { ae(0, a7); Q = ao(); if (T == 2) { ae(1, ba.touches[1]); aX = aV = ap(aM[0].start, aM[1].start) } if (aq.swipeStatus || aq.pinchStatus) { a8 = L(ba, W) } } else { a8 = false } if (a8 === false) { W = p; L(ba, W); return a8 } else { ak(true) } return null } function aZ(ba) { var bd = ba.originalEvent ? ba.originalEvent : ba; if (W === g || W === p || ai()) { return } var a9, a8 = a ? bd.touches[0] : bd; var bb = aD(a8); aY = ao(); if (a) { T = bd.touches.length } W = j; if (T == 2) { if (aX == 0) { ae(1, bd.touches[1]); aX = aV = ap(aM[0].start, aM[1].start) } else { aD(bd.touches[1]); aV = ap(aM[0].end, aM[1].end); aF = an(aM[0].end, aM[1].end) } D = a3(aX, aV); am = Math.abs(aX - aV) } if ((T === aq.fingers || aq.fingers === h) || !a || aT()) { aL = aH(bb.start, bb.end); ah(ba, aL); ac = aO(bb.start, bb.end); Y = aI(); aE(aL, ac); if (aq.swipeStatus || aq.pinchStatus) { a9 = L(bd, W) } if (!aq.triggerOnTouchEnd || aq.triggerOnTouchLeave) { var a7 = true; if (aq.triggerOnTouchLeave) { var bc = aU(this); a7 = B(bb.end, bc) } if (!aq.triggerOnTouchEnd && a7) { W = ay(j) } else { if (aq.triggerOnTouchLeave && !a7) { W = ay(g) } } if (W == p || W == g) { L(bd, W) } } } else { W = p; L(bd, W) } if (a9 === false) { W = p; L(bd, W) } } function I(a7) { var a8 = a7.originalEvent; if (a) { if (a8.touches.length > 0) { C(); return true } } if (ai()) { T = aa } a7.preventDefault(); aY = ao(); Y = aI(); if (a6()) { W = p; L(a8, W) } else { if (aq.triggerOnTouchEnd || (aq.triggerOnTouchEnd == false && W === j)) { W = g; L(a8, W) } else { if (!aq.triggerOnTouchEnd && a2()) { W = g; aB(a8, W, x) } else { if (W === j) { W = p; L(a8, W) } } } } ak(false); return null } function a5() { T = 0; aY = 0; Q = 0; aX = 0; aV = 0; D = 1; O(); ak(false) } function H(a7) { var a8 = a7.originalEvent; if (aq.triggerOnTouchLeave) { W = ay(g); L(a8, W) } } function aG() { aN.unbind(G, aJ); aN.unbind(az, a5); aN.unbind(au, aZ); aN.unbind(R, I); if (P) { aN.unbind(P, H) } ak(false) } function ay(bb) { var ba = bb; var a9 = aw(); var a8 = aj(); var a7 = a6(); if (!a9 || a7) { ba = p } else { if (a8 && bb == j && (!aq.triggerOnTouchEnd || aq.triggerOnTouchLeave)) { ba = g } else { if (!a8 && bb == g && aq.triggerOnTouchLeave) { ba = p } } } return ba } function L(a9, a7) { var a8 = undefined; if (F() || S()) { a8 = aB(a9, a7, k) } else { if ((M() || aT()) && a8 !== false) { a8 = aB(a9, a7, s) } } if (aC() && a8 !== false) { a8 = aB(a9, a7, i) } else { if (al() && a8 !== false) { a8 = aB(a9, a7, b) } else { if (ad() && a8 !== false) { a8 = aB(a9, a7, x) } } } if (a7 === p) { a5(a9) } if (a7 === g) { if (a) { if (a9.touches.length == 0) { a5(a9) } } else { a5(a9) } } return a8 } function aB(ba, a7, a9) { var a8 = undefined; if (a9 == k) { aN.trigger("swipeStatus", [a7, aL || null, ac || 0, Y || 0, T]); if (aq.swipeStatus) { a8 = aq.swipeStatus.call(aN, ba, a7, aL || null, ac || 0, Y || 0, T); if (a8 === false) { return false } } if (a7 == g && aR()) { aN.trigger("swipe", [aL, ac, Y, T]); if (aq.swipe) { a8 = aq.swipe.call(aN, ba, aL, ac, Y, T); if (a8 === false) { return false } } switch (aL) { case o: aN.trigger("swipeLeft", [aL, ac, Y, T]); if (aq.swipeLeft) { a8 = aq.swipeLeft.call(aN, ba, aL, ac, Y, T) } break; case n: aN.trigger("swipeRight", [aL, ac, Y, T]); if (aq.swipeRight) { a8 = aq.swipeRight.call(aN, ba, aL, ac, Y, T) } break; case d: aN.trigger("swipeUp", [aL, ac, Y, T]); if (aq.swipeUp) { a8 = aq.swipeUp.call(aN, ba, aL, ac, Y, T) } break; case v: aN.trigger("swipeDown", [aL, ac, Y, T]); if (aq.swipeDown) { a8 = aq.swipeDown.call(aN, ba, aL, ac, Y, T) } break } } } if (a9 == s) { aN.trigger("pinchStatus", [a7, aF || null, am || 0, Y || 0, T, D]); if (aq.pinchStatus) { a8 = aq.pinchStatus.call(aN, ba, a7, aF || null, am || 0, Y || 0, T, D); if (a8 === false) { return false } } if (a7 == g && a4()) { switch (aF) { case c: aN.trigger("pinchIn", [aF || null, am || 0, Y || 0, T, D]); if (aq.pinchIn) { a8 = aq.pinchIn.call(aN, ba, aF || null, am || 0, Y || 0, T, D) } break; case w: aN.trigger("pinchOut", [aF || null, am || 0, Y || 0, T, D]); if (aq.pinchOut) { a8 = aq.pinchOut.call(aN, ba, aF || null, am || 0, Y || 0, T, D) } break } } } if (a9 == x) { if (a7 === p || a7 === g) { clearTimeout(aS); if (V() && !E()) { K = ao(); aS = setTimeout(e.proxy(function () { K = null; aN.trigger("tap", [ba.target]); if (aq.tap) { a8 = aq.tap.call(aN, ba, ba.target) } }, this), aq.doubleTapThreshold) } else { K = null; aN.trigger("tap", [ba.target]); if (aq.tap) { a8 = aq.tap.call(aN, ba, ba.target) } } } } else { if (a9 == i) { if (a7 === p || a7 === g) { clearTimeout(aS); K = null; aN.trigger("doubletap", [ba.target]); if (aq.doubleTap) { a8 = aq.doubleTap.call(aN, ba, ba.target) } } } else { if (a9 == b) { if (a7 === p || a7 === g) { clearTimeout(aS); K = null; aN.trigger("longtap", [ba.target]); if (aq.longTap) { a8 = aq.longTap.call(aN, ba, ba.target) } } } } } return a8 } function aj() { var a7 = true; if (aq.threshold !== null) { a7 = ac >= aq.threshold } return a7 } function a6() { var a7 = false; if (aq.cancelThreshold !== null && aL !== null) { a7 = (aP(aL) - ac) >= aq.cancelThreshold } return a7 } function ab() { if (aq.pinchThreshold !== null) { return am >= aq.pinchThreshold } return true } function aw() { var a7; if (aq.maxTimeThreshold) { if (Y >= aq.maxTimeThreshold) { a7 = false } else { a7 = true } } else { a7 = true } return a7 } function ah(a7, a8) { if (aq.allowPageScroll === l || aT()) { a7.preventDefault() } else { var a9 = aq.allowPageScroll === r; switch (a8) { case o: if ((aq.swipeLeft && a9) || (!a9 && aq.allowPageScroll != A)) { a7.preventDefault() } break; case n: if ((aq.swipeRight && a9) || (!a9 && aq.allowPageScroll != A)) { a7.preventDefault() } break; case d: if ((aq.swipeUp && a9) || (!a9 && aq.allowPageScroll != t)) { a7.preventDefault() } break; case v: if ((aq.swipeDown && a9) || (!a9 && aq.allowPageScroll != t)) { a7.preventDefault() } break } } } function a4() { var a8 = aK(); var a7 = U(); var a9 = ab(); return a8 && a7 && a9 } function aT() { return !!(aq.pinchStatus || aq.pinchIn || aq.pinchOut) } function M() { return !!(a4() && aT()) } function aR() { var ba = aw(); var bc = aj(); var a9 = aK(); var a7 = U(); var a8 = a6(); var bb = !a8 && a7 && a9 && bc && ba; return bb } function S() { return !!(aq.swipe || aq.swipeStatus || aq.swipeLeft || aq.swipeRight || aq.swipeUp || aq.swipeDown) } function F() { return !!(aR() && S()) } function aK() { return ((T === aq.fingers || aq.fingers === h) || !a) } function U() { return aM[0].end.x !== 0 } function a2() { return !!(aq.tap) } function V() { return !!(aq.doubleTap) } function aQ() { return !!(aq.longTap) } function N() { if (K == null) { return false } var a7 = ao(); return (V() && ((a7 - K) <= aq.doubleTapThreshold)) } function E() { return N() } function at() { return ((T === 1 || !a) && (isNaN(ac) || ac === 0)) } function aW() { return ((Y > aq.longTapThreshold) && (ac < q)) } function ad() { return !!(at() && a2()) } function aC() { return !!(N() && V()) } function al() { return !!(aW() && aQ()) } function C() { a1 = ao(); aa = event.touches.length + 1 } function O() { a1 = 0; aa = 0 } function ai() { var a7 = false; if (a1) { var a8 = ao() - a1; if (a8 <= aq.fingerReleaseThreshold) { a7 = true } } return a7 } function ax() { return !!(aN.data(y + "_intouch") === true) } function ak(a7) { if (a7 === true) { aN.bind(au, aZ); aN.bind(R, I); if (P) { aN.bind(P, H) } } else { aN.unbind(au, aZ, false); aN.unbind(R, I, false); if (P) { aN.unbind(P, H, false) } } aN.data(y + "_intouch", a7 === true) } function ae(a8, a7) { var a9 = a7.identifier !== undefined ? a7.identifier : 0; aM[a8].identifier = a9; aM[a8].start.x = aM[a8].end.x = a7.pageX || a7.clientX; aM[a8].start.y = aM[a8].end.y = a7.pageY || a7.clientY; return aM[a8] } function aD(a7) { var a9 = a7.identifier !== undefined ? a7.identifier : 0; var a8 = Z(a9); a8.end.x = a7.pageX || a7.clientX; a8.end.y = a7.pageY || a7.clientY; return a8 } function Z(a8) { for (var a7 = 0; a7 < aM.length; a7++) { if (aM[a7].identifier == a8) { return aM[a7] } } } function af() { var a7 = []; for (var a8 = 0; a8 <= 5; a8++) { a7.push({ start: { x: 0, y: 0 }, end: { x: 0, y: 0 }, identifier: 0 }) } return a7 } function aE(a7, a8) { a8 = Math.max(a8, aP(a7)); J[a7].distance = a8 } function aP(a7) { if (J[a7]) { return J[a7].distance } return undefined } function X() { var a7 = {}; a7[o] = ar(o); a7[n] = ar(n); a7[d] = ar(d); a7[v] = ar(v); return a7 } function ar(a7) { return { direction: a7, distance: 0 } } function aI() { return aY - Q } function ap(ba, a9) { var a8 = Math.abs(ba.x - a9.x); var a7 = Math.abs(ba.y - a9.y); return Math.round(Math.sqrt(a8 * a8 + a7 * a7)) } function a3(a7, a8) { var a9 = (a8 / a7) * 1; return a9.toFixed(2) } function an() { if (D < 1) { return w } else { return c } } function aO(a8, a7) { return Math.round(Math.sqrt(Math.pow(a7.x - a8.x, 2) + Math.pow(a7.y - a8.y, 2))) } function aA(ba, a8) { var a7 = ba.x - a8.x; var bc = a8.y - ba.y; var a9 = Math.atan2(bc, a7); var bb = Math.round(a9 * 180 / Math.PI); if (bb < 0) { bb = 360 - Math.abs(bb) } return bb } function aH(a8, a7) { var a9 = aA(a8, a7); if ((a9 <= 45) && (a9 >= 0)) { return o } else { if ((a9 <= 360) && (a9 >= 315)) { return o } else { if ((a9 >= 135) && (a9 <= 225)) { return n } else { if ((a9 > 45) && (a9 < 135)) { return v } else { return d } } } } } function ao() { var a7 = new Date(); return a7.getTime() } function aU(a7) { a7 = e(a7); var a9 = a7.offset(); var a8 = { left: a9.left, right: a9.left + a7.outerWidth(), top: a9.top, bottom: a9.top + a7.outerHeight() }; return a8 } function B(a7, a8) { return (a7.x > a8.left && a7.x < a8.right && a7.y > a8.top && a7.y < a8.bottom) } } }));

/*
 *	jQuery carouFredSel 6.2.1
 *	Demo's and documentation:
 *	caroufredsel.dev7studios.com
 *
 *	Copyright (c) 2013 Fred Heusschen
 *	www.frebsite.nl
 *
 *	Dual licensed under the MIT and GPL licenses.
 *	http://en.wikipedia.org/wiki/MIT_License
 *	http://en.wikipedia.org/wiki/GNU_General_Public_License
 */
(function ($) {
    function sc_setScroll(a, b, c) { return "transition" == c.transition && "swing" == b && (b = "ease"), { anims: [], duration: a, orgDuration: a, easing: b, startTime: getTime() } } function sc_startScroll(a, b) { for (var c = 0, d = a.anims.length; d > c; c++) { var e = a.anims[c]; e && e[0][b.transition](e[1], a.duration, a.easing, e[2]) } } function sc_stopScroll(a, b) { is_boolean(b) || (b = !0), is_object(a.pre) && sc_stopScroll(a.pre, b); for (var c = 0, d = a.anims.length; d > c; c++) { var e = a.anims[c]; e[0].stop(!0), b && (e[0].css(e[1]), is_function(e[2]) && e[2]()) } is_object(a.post) && sc_stopScroll(a.post, b) } function sc_afterScroll(a, b, c) { switch (b && b.remove(), c.fx) { case "fade": case "crossfade": case "cover-fade": case "uncover-fade": a.css("opacity", 1), a.css("filter", "") } } function sc_fireCallbacks(a, b, c, d, e) { if (b[c] && b[c].call(a, d), e[c].length) for (var f = 0, g = e[c].length; g > f; f++)e[c][f].call(a, d); return [] } function sc_fireQueue(a, b, c) { return b.length && (a.trigger(cf_e(b[0][0], c), b[0][1]), b.shift()), b } function sc_hideHiddenItems(a) { a.each(function () { var a = $(this); a.data("_cfs_isHidden", a.is(":hidden")).hide() }) } function sc_showHiddenItems(a) { a && a.each(function () { var a = $(this); a.data("_cfs_isHidden") || a.show() }) } function sc_clearTimers(a) { return a.auto && clearTimeout(a.auto), a.progress && clearInterval(a.progress), a } function sc_mapCallbackArguments(a, b, c, d, e, f, g) { return { width: g.width, height: g.height, items: { old: a, skipped: b, visible: c }, scroll: { items: d, direction: e, duration: f } } } function sc_getDuration(a, b, c, d) { var e = a.duration; return "none" == a.fx ? 0 : ("auto" == e ? e = b.scroll.duration / b.scroll.items * c : 10 > e && (e = d / e), 1 > e ? 0 : ("fade" == a.fx && (e /= 2), Math.round(e))) } function nv_showNavi(a, b, c) { var d = is_number(a.items.minimum) ? a.items.minimum : a.items.visible + 1; if ("show" == b || "hide" == b) var e = b; else if (d > b) { debug(c, "Not enough items (" + b + " total, " + d + " needed): Hiding navigation."); var e = "hide" } else var e = "show"; var f = "show" == e ? "removeClass" : "addClass", g = cf_c("hidden", c); a.auto.button && a.auto.button[e]()[f](g), a.prev.button && a.prev.button[e]()[f](g), a.next.button && a.next.button[e]()[f](g), a.pagination.container && a.pagination.container[e]()[f](g) } function nv_enableNavi(a, b, c) { if (!a.circular && !a.infinite) { var d = "removeClass" == b || "addClass" == b ? b : !1, e = cf_c("disabled", c); if (a.auto.button && d && a.auto.button[d](e), a.prev.button) { var f = d || 0 == b ? "addClass" : "removeClass"; a.prev.button[f](e) } if (a.next.button) { var f = d || b == a.items.visible ? "addClass" : "removeClass"; a.next.button[f](e) } } } function go_getObject(a, b) { return is_function(b) ? b = b.call(a) : is_undefined(b) && (b = {}), b } function go_getItemsObject(a, b) { return b = go_getObject(a, b), is_number(b) ? b = { visible: b } : "variable" == b ? b = { visible: b, width: b, height: b } : is_object(b) || (b = {}), b } function go_getScrollObject(a, b) { return b = go_getObject(a, b), is_number(b) ? b = 50 >= b ? { items: b } : { duration: b } : is_string(b) ? b = { easing: b } : is_object(b) || (b = {}), b } function go_getNaviObject(a, b) { if (b = go_getObject(a, b), is_string(b)) { var c = cf_getKeyCode(b); b = -1 == c ? $(b) : c } return b } function go_getAutoObject(a, b) { return b = go_getNaviObject(a, b), is_jquery(b) ? b = { button: b } : is_boolean(b) ? b = { play: b } : is_number(b) && (b = { timeoutDuration: b }), b.progress && (is_string(b.progress) || is_jquery(b.progress)) && (b.progress = { bar: b.progress }), b } function go_complementAutoObject(a, b) { return is_function(b.button) && (b.button = b.button.call(a)), is_string(b.button) && (b.button = $(b.button)), is_boolean(b.play) || (b.play = !0), is_number(b.delay) || (b.delay = 0), is_undefined(b.pauseOnEvent) && (b.pauseOnEvent = !0), is_boolean(b.pauseOnResize) || (b.pauseOnResize = !0), is_number(b.timeoutDuration) || (b.timeoutDuration = 10 > b.duration ? 2500 : 5 * b.duration), b.progress && (is_function(b.progress.bar) && (b.progress.bar = b.progress.bar.call(a)), is_string(b.progress.bar) && (b.progress.bar = $(b.progress.bar)), b.progress.bar ? (is_function(b.progress.updater) || (b.progress.updater = $.fn.carouFredSel.progressbarUpdater), is_number(b.progress.interval) || (b.progress.interval = 50)) : b.progress = !1), b } function go_getPrevNextObject(a, b) { return b = go_getNaviObject(a, b), is_jquery(b) ? b = { button: b } : is_number(b) && (b = { key: b }), b } function go_complementPrevNextObject(a, b) { return is_function(b.button) && (b.button = b.button.call(a)), is_string(b.button) && (b.button = $(b.button)), is_string(b.key) && (b.key = cf_getKeyCode(b.key)), b } function go_getPaginationObject(a, b) { return b = go_getNaviObject(a, b), is_jquery(b) ? b = { container: b } : is_boolean(b) && (b = { keys: b }), b } function go_complementPaginationObject(a, b) { return is_function(b.container) && (b.container = b.container.call(a)), is_string(b.container) && (b.container = $(b.container)), is_number(b.items) || (b.items = !1), is_boolean(b.keys) || (b.keys = !1), is_function(b.anchorBuilder) || is_false(b.anchorBuilder) || (b.anchorBuilder = $.fn.carouFredSel.pageAnchorBuilder), is_number(b.deviation) || (b.deviation = 0), b } function go_getSwipeObject(a, b) { return is_function(b) && (b = b.call(a)), is_undefined(b) && (b = { onTouch: !1 }), is_true(b) ? b = { onTouch: b } : is_number(b) && (b = { items: b }), b } function go_complementSwipeObject(a, b) { return is_boolean(b.onTouch) || (b.onTouch = !0), is_boolean(b.onMouse) || (b.onMouse = !1), is_object(b.options) || (b.options = {}), is_boolean(b.options.triggerOnTouchEnd) || (b.options.triggerOnTouchEnd = !1), b } function go_getMousewheelObject(a, b) { return is_function(b) && (b = b.call(a)), is_true(b) ? b = {} : is_number(b) ? b = { items: b } : is_undefined(b) && (b = !1), b } function go_complementMousewheelObject(a, b) { return b } function gn_getItemIndex(a, b, c, d, e) { if (is_string(a) && (a = $(a, e)), is_object(a) && (a = $(a, e)), is_jquery(a) ? (a = e.children().index(a), is_boolean(c) || (c = !1)) : is_boolean(c) || (c = !0), is_number(a) || (a = 0), is_number(b) || (b = 0), c && (a += d.first), a += b, d.total > 0) { for (; a >= d.total;)a -= d.total; for (; 0 > a;)a += d.total } return a } function gn_getVisibleItemsPrev(a, b, c) { for (var d = 0, e = 0, f = c; f >= 0; f--) { var g = a.eq(f); if (d += g.is(":visible") ? g[b.d.outerWidth](!0) : 0, d > b.maxDimension) return e; 0 == f && (f = a.length), e++ } } function gn_getVisibleItemsPrevFilter(a, b, c) { return gn_getItemsPrevFilter(a, b.items.filter, b.items.visibleConf.org, c) } function gn_getScrollItemsPrevFilter(a, b, c, d) { return gn_getItemsPrevFilter(a, b.items.filter, d, c) } function gn_getItemsPrevFilter(a, b, c, d) { for (var e = 0, f = 0, g = d, h = a.length; g >= 0; g--) { if (f++ , f == h) return f; var i = a.eq(g); if (i.is(b) && (e++ , e == c)) return f; 0 == g && (g = h) } } function gn_getVisibleOrg(a, b) { return b.items.visibleConf.org || a.children().slice(0, b.items.visible).filter(b.items.filter).length } function gn_getVisibleItemsNext(a, b, c) { for (var d = 0, e = 0, f = c, g = a.length - 1; g >= f; f++) { var h = a.eq(f); if (d += h.is(":visible") ? h[b.d.outerWidth](!0) : 0, d > b.maxDimension) return e; if (e++ , e == g + 1) return e; f == g && (f = -1) } } function gn_getVisibleItemsNextTestCircular(a, b, c, d) { var e = gn_getVisibleItemsNext(a, b, c); return b.circular || c + e > d && (e = d - c), e } function gn_getVisibleItemsNextFilter(a, b, c) { return gn_getItemsNextFilter(a, b.items.filter, b.items.visibleConf.org, c, b.circular) } function gn_getScrollItemsNextFilter(a, b, c, d) { return gn_getItemsNextFilter(a, b.items.filter, d + 1, c, b.circular) - 1 } function gn_getItemsNextFilter(a, b, c, d) { for (var f = 0, g = 0, h = d, i = a.length - 1; i >= h; h++) { if (g++ , g >= i) return g; var j = a.eq(h); if (j.is(b) && (f++ , f == c)) return g; h == i && (h = -1) } } function gi_getCurrentItems(a, b) { return a.slice(0, b.items.visible) } function gi_getOldItemsPrev(a, b, c) { return a.slice(c, b.items.visibleConf.old + c) } function gi_getNewItemsPrev(a, b) { return a.slice(0, b.items.visible) } function gi_getOldItemsNext(a, b) { return a.slice(0, b.items.visibleConf.old) } function gi_getNewItemsNext(a, b, c) { return a.slice(c, b.items.visible + c) } function sz_storeMargin(a, b, c) { b.usePadding && (is_string(c) || (c = "_cfs_origCssMargin"), a.each(function () { var a = $(this), d = parseInt(a.css(b.d.marginRight), 10); is_number(d) || (d = 0), a.data(c, d) })) } function sz_resetMargin(a, b, c) { if (b.usePadding) { var d = is_boolean(c) ? c : !1; is_number(c) || (c = 0), sz_storeMargin(a, b, "_cfs_tempCssMargin"), a.each(function () { var a = $(this); a.css(b.d.marginRight, d ? a.data("_cfs_tempCssMargin") : c + a.data("_cfs_origCssMargin")) }) } } function sz_storeOrigCss(a) { a.each(function () { var a = $(this); a.data("_cfs_origCss", a.attr("style") || "") }) } function sz_restoreOrigCss(a) { a.each(function () { var a = $(this); a.attr("style", a.data("_cfs_origCss") || "") }) } function sz_setResponsiveSizes(a, b) { var d = (a.items.visible, a.items[a.d.width]), e = a[a.d.height], f = is_percentage(e); b.each(function () { var b = $(this), c = d - ms_getPaddingBorderMargin(b, a, "Width"); b[a.d.width](c), f && b[a.d.height](ms_getPercentage(c, e)) }) } function sz_setSizes(a, b) { var c = a.parent(), d = a.children(), e = gi_getCurrentItems(d, b), f = cf_mapWrapperSizes(ms_getSizes(e, b, !0), b, !1); if (c.css(f), b.usePadding) { var g = b.padding, h = g[b.d[1]]; b.align && 0 > h && (h = 0); var i = e.last(); i.css(b.d.marginRight, i.data("_cfs_origCssMargin") + h), a.css(b.d.top, g[b.d[0]]), a.css(b.d.left, g[b.d[3]]) } return a.css(b.d.width, f[b.d.width] + 2 * ms_getTotalSize(d, b, "width")), a.css(b.d.height, ms_getLargestSize(d, b, "height")), f } function ms_getSizes(a, b, c) { return [ms_getTotalSize(a, b, "width", c), ms_getLargestSize(a, b, "height", c)] } function ms_getLargestSize(a, b, c, d) { return is_boolean(d) || (d = !1), is_number(b[b.d[c]]) && d ? b[b.d[c]] : is_number(b.items[b.d[c]]) ? b.items[b.d[c]] : (c = c.toLowerCase().indexOf("width") > -1 ? "outerWidth" : "outerHeight", ms_getTrueLargestSize(a, b, c)) } function ms_getTrueLargestSize(a, b, c) { for (var d = 0, e = 0, f = a.length; f > e; e++) { var g = a.eq(e), h = g.is(":visible") ? g[b.d[c]](!0) : 0; h > d && (d = h) } return d } function ms_getTotalSize(a, b, c, d) { if (is_boolean(d) || (d = !1), is_number(b[b.d[c]]) && d) return b[b.d[c]]; if (is_number(b.items[b.d[c]])) return b.items[b.d[c]] * a.length; for (var e = c.toLowerCase().indexOf("width") > -1 ? "outerWidth" : "outerHeight", f = 0, g = 0, h = a.length; h > g; g++) { var i = a.eq(g); f += i.is(":visible") ? i[b.d[e]](!0) : 0 } return f } function ms_getParentSize(a, b, c) { var d = a.is(":visible"); d && a.hide(); var e = a.parent()[b.d[c]](); return d && a.show(), e } function ms_getMaxDimension(a, b) { return is_number(a[a.d.width]) ? a[a.d.width] : b } function ms_hasVariableSizes(a, b, c) { for (var d = !1, e = !1, f = 0, g = a.length; g > f; f++) { var h = a.eq(f), i = h.is(":visible") ? h[b.d[c]](!0) : 0; d === !1 ? d = i : d != i && (e = !0), 0 == d && (e = !0) } return e } function ms_getPaddingBorderMargin(a, b, c) { return a[b.d["outer" + c]](!0) - a[b.d[c.toLowerCase()]]() } function ms_getPercentage(a, b) { if (is_percentage(b)) { if (b = parseInt(b.slice(0, -1), 10), !is_number(b)) return a; a *= b / 100 } return a } function cf_e(a, b, c, d, e) { return is_boolean(c) || (c = !0), is_boolean(d) || (d = !0), is_boolean(e) || (e = !1), c && (a = b.events.prefix + a), d && (a = a + "." + b.events.namespace), d && e && (a += b.serialNumber), a } function cf_c(a, b) { return is_string(b.classnames[a]) ? b.classnames[a] : a } function cf_mapWrapperSizes(a, b, c) { is_boolean(c) || (c = !0); var d = b.usePadding && c ? b.padding : [0, 0, 0, 0], e = {}; return e[b.d.width] = a[0] + d[1] + d[3], e[b.d.height] = a[1] + d[0] + d[2], e } function cf_sortParams(a, b) { for (var c = [], d = 0, e = a.length; e > d; d++)for (var f = 0, g = b.length; g > f; f++)if (b[f].indexOf(typeof a[d]) > -1 && is_undefined(c[f])) { c[f] = a[d]; break } return c } function cf_getPadding(a) { if (is_undefined(a)) return [0, 0, 0, 0]; if (is_number(a)) return [a, a, a, a]; if (is_string(a) && (a = a.split("px").join("").split("em").join("").split(" ")), !is_array(a)) return [0, 0, 0, 0]; for (var b = 0; 4 > b; b++)a[b] = parseInt(a[b], 10); switch (a.length) { case 0: return [0, 0, 0, 0]; case 1: return [a[0], a[0], a[0], a[0]]; case 2: return [a[0], a[1], a[0], a[1]]; case 3: return [a[0], a[1], a[2], a[1]]; default: return [a[0], a[1], a[2], a[3]] } } function cf_getAlignPadding(a, b) { var c = is_number(b[b.d.width]) ? Math.ceil(b[b.d.width] - ms_getTotalSize(a, b, "width")) : 0; switch (b.align) { case "left": return [0, c]; case "right": return [c, 0]; case "center": default: return [Math.ceil(c / 2), Math.floor(c / 2)] } } function cf_getDimensions(a) { for (var b = [["width", "innerWidth", "outerWidth", "height", "innerHeight", "outerHeight", "left", "top", "marginRight", 0, 1, 2, 3], ["height", "innerHeight", "outerHeight", "width", "innerWidth", "outerWidth", "top", "left", "marginBottom", 3, 2, 1, 0]], c = b[0].length, d = "right" == a.direction || "left" == a.direction ? 0 : 1, e = {}, f = 0; c > f; f++)e[b[0][f]] = b[d][f]; return e } function cf_getAdjust(a, b, c, d) { var e = a; if (is_function(c)) e = c.call(d, e); else if (is_string(c)) { var f = c.split("+"), g = c.split("-"); if (g.length > f.length) var h = !0, i = g[0], j = g[1]; else var h = !1, i = f[0], j = f[1]; switch (i) { case "even": e = 1 == a % 2 ? a - 1 : a; break; case "odd": e = 0 == a % 2 ? a - 1 : a; break; default: e = a }j = parseInt(j, 10), is_number(j) && (h && (j = -j), e += j) } return (!is_number(e) || 1 > e) && (e = 1), e } function cf_getItemsAdjust(a, b, c, d) { return cf_getItemAdjustMinMax(cf_getAdjust(a, b, c, d), b.items.visibleConf) } function cf_getItemAdjustMinMax(a, b) { return is_number(b.min) && b.min > a && (a = b.min), is_number(b.max) && a > b.max && (a = b.max), 1 > a && (a = 1), a } function cf_getSynchArr(a) { is_array(a) || (a = [[a]]), is_array(a[0]) || (a = [a]); for (var b = 0, c = a.length; c > b; b++)is_string(a[b][0]) && (a[b][0] = $(a[b][0])), is_boolean(a[b][1]) || (a[b][1] = !0), is_boolean(a[b][2]) || (a[b][2] = !0), is_number(a[b][3]) || (a[b][3] = 0); return a } function cf_getKeyCode(a) { return "right" == a ? 39 : "left" == a ? 37 : "up" == a ? 38 : "down" == a ? 40 : -1 } function cf_setCookie(a, b, c) { if (a) { var d = b.triggerHandler(cf_e("currentPosition", c)); $.fn.carouFredSel.cookie.set(a, d) } } function cf_getCookie(a) { var b = $.fn.carouFredSel.cookie.get(a); return "" == b ? 0 : b } function in_mapCss(a, b) { for (var c = {}, d = 0, e = b.length; e > d; d++)c[b[d]] = a.css(b[d]); return c } function in_complementItems(a, b, c, d) { return is_object(a.visibleConf) || (a.visibleConf = {}), is_object(a.sizesConf) || (a.sizesConf = {}), 0 == a.start && is_number(d) && (a.start = d), is_object(a.visible) ? (a.visibleConf.min = a.visible.min, a.visibleConf.max = a.visible.max, a.visible = !1) : is_string(a.visible) ? ("variable" == a.visible ? a.visibleConf.variable = !0 : a.visibleConf.adjust = a.visible, a.visible = !1) : is_function(a.visible) && (a.visibleConf.adjust = a.visible, a.visible = !1), is_string(a.filter) || (a.filter = c.filter(":hidden").length > 0 ? ":visible" : "*"), a[b.d.width] || (b.responsive ? (debug(!0, "Set a " + b.d.width + " for the items!"), a[b.d.width] = ms_getTrueLargestSize(c, b, "outerWidth")) : a[b.d.width] = ms_hasVariableSizes(c, b, "outerWidth") ? "variable" : c[b.d.outerWidth](!0)), a[b.d.height] || (a[b.d.height] = ms_hasVariableSizes(c, b, "outerHeight") ? "variable" : c[b.d.outerHeight](!0)), a.sizesConf.width = a.width, a.sizesConf.height = a.height, a } function in_complementVisibleItems(a, b) { return "variable" == a.items[a.d.width] && (a.items.visibleConf.variable = !0), a.items.visibleConf.variable || (is_number(a[a.d.width]) ? a.items.visible = Math.floor(a[a.d.width] / a.items[a.d.width]) : (a.items.visible = Math.floor(b / a.items[a.d.width]), a[a.d.width] = a.items.visible * a.items[a.d.width], a.items.visibleConf.adjust || (a.align = !1)), ("Infinity" == a.items.visible || 1 > a.items.visible) && (debug(!0, 'Not a valid number of visible items: Set to "variable".'), a.items.visibleConf.variable = !0)), a } function in_complementPrimarySize(a, b, c) { return "auto" == a && (a = ms_getTrueLargestSize(c, b, "outerWidth")), a } function in_complementSecondarySize(a, b, c) { return "auto" == a && (a = ms_getTrueLargestSize(c, b, "outerHeight")), a || (a = b.items[b.d.height]), a } function in_getAlignPadding(a, b) { var c = cf_getAlignPadding(gi_getCurrentItems(b, a), a); return a.padding[a.d[1]] = c[1], a.padding[a.d[3]] = c[0], a } function in_getResponsiveValues(a, b) { var d = cf_getItemAdjustMinMax(Math.ceil(a[a.d.width] / a.items[a.d.width]), a.items.visibleConf); d > b.length && (d = b.length); var e = Math.floor(a[a.d.width] / d); return a.items.visible = d, a.items[a.d.width] = e, a[a.d.width] = d * e, a } function bt_pauseOnHoverConfig(a) { if (is_string(a)) var b = a.indexOf("immediate") > -1 ? !0 : !1, c = a.indexOf("resume") > -1 ? !0 : !1; else var b = c = !1; return [b, c] } function bt_mousesheelNumber(a) { return is_number(a) ? a : null } function is_null(a) { return null === a } function is_undefined(a) { return is_null(a) || a === void 0 || "" === a || "undefined" === a } function is_array(a) { return a instanceof Array } function is_jquery(a) { return a instanceof jQuery } function is_object(a) { return (a instanceof Object || "object" == typeof a) && !is_null(a) && !is_jquery(a) && !is_array(a) && !is_function(a) } function is_number(a) { return (a instanceof Number || "number" == typeof a) && !isNaN(a) } function is_string(a) { return (a instanceof String || "string" == typeof a) && !is_undefined(a) && !is_true(a) && !is_false(a) } function is_function(a) { return a instanceof Function || "function" == typeof a } function is_boolean(a) { return a instanceof Boolean || "boolean" == typeof a || is_true(a) || is_false(a) } function is_true(a) { return a === !0 || "true" === a } function is_false(a) { return a === !1 || "false" === a } function is_percentage(a) { return is_string(a) && "%" == a.slice(-1) } function getTime() { return (new Date).getTime() } function deprecated(a, b) { debug(!0, a + " is DEPRECATED, support for it will be removed. Use " + b + " instead.") } function debug(a, b) { if (!is_undefined(window.console) && !is_undefined(window.console.log)) { if (is_object(a)) { var c = " (" + a.selector + ")"; a = a.debug } else var c = ""; if (!a) return !1; b = is_string(b) ? "carouFredSel" + c + ": " + b : ["carouFredSel" + c + ":", b], window.console.log(b) } return !1 } $.fn.carouFredSel || ($.fn.caroufredsel = $.fn.carouFredSel = function (options, configs) {
        if (0 == this.length) return debug(!0, 'No element found for "' + this.selector + '".'), this; if (this.length > 1) return this.each(function () { $(this).carouFredSel(options, configs) }); var $cfs = this, $tt0 = this[0], starting_position = !1; $cfs.data("_cfs_isCarousel") && (starting_position = $cfs.triggerHandler("_cfs_triggerEvent", "currentPosition"), $cfs.trigger("_cfs_triggerEvent", ["destroy", !0])); var FN = {}; FN._init = function (a, b, c) { a = go_getObject($tt0, a), a.items = go_getItemsObject($tt0, a.items), a.scroll = go_getScrollObject($tt0, a.scroll), a.auto = go_getAutoObject($tt0, a.auto), a.prev = go_getPrevNextObject($tt0, a.prev), a.next = go_getPrevNextObject($tt0, a.next), a.pagination = go_getPaginationObject($tt0, a.pagination), a.swipe = go_getSwipeObject($tt0, a.swipe), a.mousewheel = go_getMousewheelObject($tt0, a.mousewheel), b && (opts_orig = $.extend(!0, {}, $.fn.carouFredSel.defaults, a)), opts = $.extend(!0, {}, $.fn.carouFredSel.defaults, a), opts.d = cf_getDimensions(opts), crsl.direction = "up" == opts.direction || "left" == opts.direction ? "next" : "prev"; var d = $cfs.children(), e = ms_getParentSize($wrp, opts, "width"); if (is_true(opts.cookie) && (opts.cookie = "caroufredsel_cookie_" + conf.serialNumber), opts.maxDimension = ms_getMaxDimension(opts, e), opts.items = in_complementItems(opts.items, opts, d, c), opts[opts.d.width] = in_complementPrimarySize(opts[opts.d.width], opts, d), opts[opts.d.height] = in_complementSecondarySize(opts[opts.d.height], opts, d), opts.responsive && (is_percentage(opts[opts.d.width]) || (opts[opts.d.width] = "100%")), is_percentage(opts[opts.d.width]) && (crsl.upDateOnWindowResize = !0, crsl.primarySizePercentage = opts[opts.d.width], opts[opts.d.width] = ms_getPercentage(e, crsl.primarySizePercentage), opts.items.visible || (opts.items.visibleConf.variable = !0)), opts.responsive ? (opts.usePadding = !1, opts.padding = [0, 0, 0, 0], opts.align = !1, opts.items.visibleConf.variable = !1) : (opts.items.visible || (opts = in_complementVisibleItems(opts, e)), opts[opts.d.width] || (!opts.items.visibleConf.variable && is_number(opts.items[opts.d.width]) && "*" == opts.items.filter ? (opts[opts.d.width] = opts.items.visible * opts.items[opts.d.width], opts.align = !1) : opts[opts.d.width] = "variable"), is_undefined(opts.align) && (opts.align = is_number(opts[opts.d.width]) ? "center" : !1), opts.items.visibleConf.variable && (opts.items.visible = gn_getVisibleItemsNext(d, opts, 0))), "*" == opts.items.filter || opts.items.visibleConf.variable || (opts.items.visibleConf.org = opts.items.visible, opts.items.visible = gn_getVisibleItemsNextFilter(d, opts, 0)), opts.items.visible = cf_getItemsAdjust(opts.items.visible, opts, opts.items.visibleConf.adjust, $tt0), opts.items.visibleConf.old = opts.items.visible, opts.responsive) opts.items.visibleConf.min || (opts.items.visibleConf.min = opts.items.visible), opts.items.visibleConf.max || (opts.items.visibleConf.max = opts.items.visible), opts = in_getResponsiveValues(opts, d, e); else switch (opts.padding = cf_getPadding(opts.padding), "top" == opts.align ? opts.align = "left" : "bottom" == opts.align && (opts.align = "right"), opts.align) { case "center": case "left": case "right": "variable" != opts[opts.d.width] && (opts = in_getAlignPadding(opts, d), opts.usePadding = !0); break; default: opts.align = !1, opts.usePadding = 0 == opts.padding[0] && 0 == opts.padding[1] && 0 == opts.padding[2] && 0 == opts.padding[3] ? !1 : !0 }is_number(opts.scroll.duration) || (opts.scroll.duration = 500), is_undefined(opts.scroll.items) && (opts.scroll.items = opts.responsive || opts.items.visibleConf.variable || "*" != opts.items.filter ? "visible" : opts.items.visible), opts.auto = $.extend(!0, {}, opts.scroll, opts.auto), opts.prev = $.extend(!0, {}, opts.scroll, opts.prev), opts.next = $.extend(!0, {}, opts.scroll, opts.next), opts.pagination = $.extend(!0, {}, opts.scroll, opts.pagination), opts.auto = go_complementAutoObject($tt0, opts.auto), opts.prev = go_complementPrevNextObject($tt0, opts.prev), opts.next = go_complementPrevNextObject($tt0, opts.next), opts.pagination = go_complementPaginationObject($tt0, opts.pagination), opts.swipe = go_complementSwipeObject($tt0, opts.swipe), opts.mousewheel = go_complementMousewheelObject($tt0, opts.mousewheel), opts.synchronise && (opts.synchronise = cf_getSynchArr(opts.synchronise)), opts.auto.onPauseStart && (opts.auto.onTimeoutStart = opts.auto.onPauseStart, deprecated("auto.onPauseStart", "auto.onTimeoutStart")), opts.auto.onPausePause && (opts.auto.onTimeoutPause = opts.auto.onPausePause, deprecated("auto.onPausePause", "auto.onTimeoutPause")), opts.auto.onPauseEnd && (opts.auto.onTimeoutEnd = opts.auto.onPauseEnd, deprecated("auto.onPauseEnd", "auto.onTimeoutEnd")), opts.auto.pauseDuration && (opts.auto.timeoutDuration = opts.auto.pauseDuration, deprecated("auto.pauseDuration", "auto.timeoutDuration")) }, FN._build = function () { $cfs.data("_cfs_isCarousel", !0); var a = $cfs.children(), b = in_mapCss($cfs, ["textAlign", "float", "position", "top", "right", "bottom", "left", "zIndex", "width", "height", "marginTop", "marginRight", "marginBottom", "marginLeft"]), c = "relative"; switch (b.position) { case "absolute": case "fixed": c = b.position }"parent" == conf.wrapper ? sz_storeOrigCss($wrp) : $wrp.css(b), $wrp.css({ overflow: "hidden", position: c }), sz_storeOrigCss($cfs), $cfs.data("_cfs_origCssZindex", b.zIndex), $cfs.css({ textAlign: "left", "float": "none", position: "absolute", top: 0, right: "auto", bottom: "auto", left: 0, marginTop: 0, marginRight: 0, marginBottom: 0, marginLeft: 0 }), sz_storeMargin(a, opts), sz_storeOrigCss(a), opts.responsive && sz_setResponsiveSizes(opts, a) }, FN._bind_events = function () {
            FN._unbind_events(), $cfs.bind(cf_e("stop", conf), function (a, b) { return a.stopPropagation(), crsl.isStopped || opts.auto.button && opts.auto.button.addClass(cf_c("stopped", conf)), crsl.isStopped = !0, opts.auto.play && (opts.auto.play = !1, $cfs.trigger(cf_e("pause", conf), b)), !0 }), $cfs.bind(cf_e("finish", conf), function (a) { return a.stopPropagation(), crsl.isScrolling && sc_stopScroll(scrl), !0 }), $cfs.bind(cf_e("pause", conf), function (a, b, c) { if (a.stopPropagation(), tmrs = sc_clearTimers(tmrs), b && crsl.isScrolling) { scrl.isStopped = !0; var d = getTime() - scrl.startTime; scrl.duration -= d, scrl.pre && (scrl.pre.duration -= d), scrl.post && (scrl.post.duration -= d), sc_stopScroll(scrl, !1) } if (crsl.isPaused || crsl.isScrolling || c && (tmrs.timePassed += getTime() - tmrs.startTime), crsl.isPaused || opts.auto.button && opts.auto.button.addClass(cf_c("paused", conf)), crsl.isPaused = !0, opts.auto.onTimeoutPause) { var e = opts.auto.timeoutDuration - tmrs.timePassed, f = 100 - Math.ceil(100 * e / opts.auto.timeoutDuration); opts.auto.onTimeoutPause.call($tt0, f, e) } return !0 }), $cfs.bind(cf_e("play", conf), function (a, b, c, d) { a.stopPropagation(), tmrs = sc_clearTimers(tmrs); var e = [b, c, d], f = ["string", "number", "boolean"], g = cf_sortParams(e, f); if (b = g[0], c = g[1], d = g[2], "prev" != b && "next" != b && (b = crsl.direction), is_number(c) || (c = 0), is_boolean(d) || (d = !1), d && (crsl.isStopped = !1, opts.auto.play = !0), !opts.auto.play) return a.stopImmediatePropagation(), debug(conf, "Carousel stopped: Not scrolling."); crsl.isPaused && opts.auto.button && (opts.auto.button.removeClass(cf_c("stopped", conf)), opts.auto.button.removeClass(cf_c("paused", conf))), crsl.isPaused = !1, tmrs.startTime = getTime(); var h = opts.auto.timeoutDuration + c; return dur2 = h - tmrs.timePassed, perc = 100 - Math.ceil(100 * dur2 / h), opts.auto.progress && (tmrs.progress = setInterval(function () { var a = getTime() - tmrs.startTime + tmrs.timePassed, b = Math.ceil(100 * a / h); opts.auto.progress.updater.call(opts.auto.progress.bar[0], b) }, opts.auto.progress.interval)), tmrs.auto = setTimeout(function () { opts.auto.progress && opts.auto.progress.updater.call(opts.auto.progress.bar[0], 100), opts.auto.onTimeoutEnd && opts.auto.onTimeoutEnd.call($tt0, perc, dur2), crsl.isScrolling ? $cfs.trigger(cf_e("play", conf), b) : $cfs.trigger(cf_e(b, conf), opts.auto) }, dur2), opts.auto.onTimeoutStart && opts.auto.onTimeoutStart.call($tt0, perc, dur2), !0 }), $cfs.bind(cf_e("resume", conf), function (a) { return a.stopPropagation(), scrl.isStopped ? (scrl.isStopped = !1, crsl.isPaused = !1, crsl.isScrolling = !0, scrl.startTime = getTime(), sc_startScroll(scrl, conf)) : $cfs.trigger(cf_e("play", conf)), !0 }), $cfs.bind(cf_e("prev", conf) + " " + cf_e("next", conf), function (a, b, c, d, e) { if (a.stopPropagation(), crsl.isStopped || $cfs.is(":hidden")) return a.stopImmediatePropagation(), debug(conf, "Carousel stopped or hidden: Not scrolling."); var f = is_number(opts.items.minimum) ? opts.items.minimum : opts.items.visible + 1; if (f > itms.total) return a.stopImmediatePropagation(), debug(conf, "Not enough items (" + itms.total + " total, " + f + " needed): Not scrolling."); var g = [b, c, d, e], h = ["object", "number/string", "function", "boolean"], i = cf_sortParams(g, h); b = i[0], c = i[1], d = i[2], e = i[3]; var j = a.type.slice(conf.events.prefix.length); if (is_object(b) || (b = {}), is_function(d) && (b.onAfter = d), is_boolean(e) && (b.queue = e), b = $.extend(!0, {}, opts[j], b), b.conditions && !b.conditions.call($tt0, j)) return a.stopImmediatePropagation(), debug(conf, 'Callback "conditions" returned false.'); if (!is_number(c)) { if ("*" != opts.items.filter) c = "visible"; else for (var k = [c, b.items, opts[j].items], i = 0, l = k.length; l > i; i++)if (is_number(k[i]) || "page" == k[i] || "visible" == k[i]) { c = k[i]; break } switch (c) { case "page": return a.stopImmediatePropagation(), $cfs.triggerHandler(cf_e(j + "Page", conf), [b, d]); case "visible": opts.items.visibleConf.variable || "*" != opts.items.filter || (c = opts.items.visible) } } if (scrl.isStopped) return $cfs.trigger(cf_e("resume", conf)), $cfs.trigger(cf_e("queue", conf), [j, [b, c, d]]), a.stopImmediatePropagation(), debug(conf, "Carousel resumed scrolling."); if (b.duration > 0 && crsl.isScrolling) return b.queue && ("last" == b.queue && (queu = []), ("first" != b.queue || 0 == queu.length) && $cfs.trigger(cf_e("queue", conf), [j, [b, c, d]])), a.stopImmediatePropagation(), debug(conf, "Carousel currently scrolling."); if (tmrs.timePassed = 0, $cfs.trigger(cf_e("slide_" + j, conf), [b, c]), opts.synchronise) for (var m = opts.synchronise, n = [b, c], o = 0, l = m.length; l > o; o++) { var p = j; m[o][2] || (p = "prev" == p ? "next" : "prev"), m[o][1] || (n[0] = m[o][0].triggerHandler("_cfs_triggerEvent", ["configuration", p])), n[1] = c + m[o][3], m[o][0].trigger("_cfs_triggerEvent", ["slide_" + p, n]) } return !0 }), $cfs.bind(cf_e("slide_prev", conf), function (a, b, c) {
                a.stopPropagation(); var d = $cfs.children(); if (!opts.circular && 0 == itms.first) return opts.infinite && $cfs.trigger(cf_e("next", conf), itms.total - 1), a.stopImmediatePropagation(); if (sz_resetMargin(d, opts), !is_number(c)) { if (opts.items.visibleConf.variable) c = gn_getVisibleItemsPrev(d, opts, itms.total - 1); else if ("*" != opts.items.filter) { var e = is_number(b.items) ? b.items : gn_getVisibleOrg($cfs, opts); c = gn_getScrollItemsPrevFilter(d, opts, itms.total - 1, e) } else c = opts.items.visible; c = cf_getAdjust(c, opts, b.items, $tt0) } if (opts.circular || itms.total - c < itms.first && (c = itms.total - itms.first), opts.items.visibleConf.old = opts.items.visible, opts.items.visibleConf.variable) { var f = cf_getItemsAdjust(gn_getVisibleItemsNext(d, opts, itms.total - c), opts, opts.items.visibleConf.adjust, $tt0); f >= opts.items.visible + c && itms.total > c && (c++ , f = cf_getItemsAdjust(gn_getVisibleItemsNext(d, opts, itms.total - c), opts, opts.items.visibleConf.adjust, $tt0)), opts.items.visible = f } else if ("*" != opts.items.filter) { var f = gn_getVisibleItemsNextFilter(d, opts, itms.total - c); opts.items.visible = cf_getItemsAdjust(f, opts, opts.items.visibleConf.adjust, $tt0) } if (sz_resetMargin(d, opts, !0), 0 == c) return a.stopImmediatePropagation(), debug(conf, "0 items to scroll: Not scrolling."); for (debug(conf, "Scrolling " + c + " items backward."), itms.first += c; itms.first >= itms.total;)itms.first -= itms.total; opts.circular || (0 == itms.first && b.onEnd && b.onEnd.call($tt0, "prev"), opts.infinite || nv_enableNavi(opts, itms.first, conf)), $cfs.children().slice(itms.total - c, itms.total).prependTo($cfs), itms.total < opts.items.visible + c && $cfs.children().slice(0, opts.items.visible + c - itms.total).clone(!0).appendTo($cfs); var d = $cfs.children(), g = gi_getOldItemsPrev(d, opts, c), h = gi_getNewItemsPrev(d, opts), i = d.eq(c - 1), j = g.last(), k = h.last(); sz_resetMargin(d, opts); var l = 0, m = 0; if (opts.align) { var n = cf_getAlignPadding(h, opts); l = n[0], m = n[1] } var o = 0 > l ? opts.padding[opts.d[3]] : 0, p = !1, q = $(); if (c > opts.items.visible && (q = d.slice(opts.items.visibleConf.old, c), "directscroll" == b.fx)) { var r = opts.items[opts.d.width]; p = q, i = k, sc_hideHiddenItems(p), opts.items[opts.d.width] = "variable" } var s = !1, t = ms_getTotalSize(d.slice(0, c), opts, "width"), u = cf_mapWrapperSizes(ms_getSizes(h, opts, !0), opts, !opts.usePadding), v = 0, w = {}, x = {}, y = {}, z = {}, A = {}, B = {}, C = {}, D = sc_getDuration(b, opts, c, t); switch (b.fx) { case "cover": case "cover-fade": v = ms_getTotalSize(d.slice(0, opts.items.visible), opts, "width") }p && (opts.items[opts.d.width] = r), sz_resetMargin(d, opts, !0), m >= 0 && sz_resetMargin(j, opts, opts.padding[opts.d[1]]), l >= 0 && sz_resetMargin(i, opts, opts.padding[opts.d[3]]), opts.align && (opts.padding[opts.d[1]] = m, opts.padding[opts.d[3]] = l), B[opts.d.left] = -(t - o), C[opts.d.left] = -(v - o), x[opts.d.left] = u[opts.d.width]; var E = function () { }, F = function () { }, G = function () { }, H = function () { }, I = function () { }, J = function () { }, K = function () { }, L = function () { }, M = function () { }, N = function () { }, O = function () { }; switch (b.fx) { case "crossfade": case "cover": case "cover-fade": case "uncover": case "uncover-fade": s = $cfs.clone(!0).appendTo($wrp) }switch (b.fx) { case "crossfade": case "uncover": case "uncover-fade": s.children().slice(0, c).remove(), s.children().slice(opts.items.visibleConf.old).remove(); break; case "cover": case "cover-fade": s.children().slice(opts.items.visible).remove(), s.css(C) }if ($cfs.css(B), scrl = sc_setScroll(D, b.easing, conf), w[opts.d.left] = opts.usePadding ? opts.padding[opts.d[3]] : 0, ("variable" == opts[opts.d.width] || "variable" == opts[opts.d.height]) && (E = function () { $wrp.css(u) }, F = function () { scrl.anims.push([$wrp, u]) }), opts.usePadding) { switch (k.not(i).length && (y[opts.d.marginRight] = i.data("_cfs_origCssMargin"), 0 > l ? i.css(y) : (K = function () { i.css(y) }, L = function () { scrl.anims.push([i, y]) })), b.fx) { case "cover": case "cover-fade": s.children().eq(c - 1).css(y) }k.not(j).length && (z[opts.d.marginRight] = j.data("_cfs_origCssMargin"), G = function () { j.css(z) }, H = function () { scrl.anims.push([j, z]) }), m >= 0 && (A[opts.d.marginRight] = k.data("_cfs_origCssMargin") + opts.padding[opts.d[1]], I = function () { k.css(A) }, J = function () { scrl.anims.push([k, A]) }) } O = function () { $cfs.css(w) }; var P = opts.items.visible + c - itms.total; N = function () { if (P > 0 && ($cfs.children().slice(itms.total).remove(), g = $($cfs.children().slice(itms.total - (opts.items.visible - P)).get().concat($cfs.children().slice(0, P).get()))), sc_showHiddenItems(p), opts.usePadding) { var a = $cfs.children().eq(opts.items.visible + c - 1); a.css(opts.d.marginRight, a.data("_cfs_origCssMargin")) } }; var Q = sc_mapCallbackArguments(g, q, h, c, "prev", D, u); switch (M = function () { sc_afterScroll($cfs, s, b), crsl.isScrolling = !1, clbk.onAfter = sc_fireCallbacks($tt0, b, "onAfter", Q, clbk), queu = sc_fireQueue($cfs, queu, conf), crsl.isPaused || $cfs.trigger(cf_e("play", conf)) }, crsl.isScrolling = !0, tmrs = sc_clearTimers(tmrs), clbk.onBefore = sc_fireCallbacks($tt0, b, "onBefore", Q, clbk), b.fx) { case "none": $cfs.css(w), E(), G(), I(), K(), O(), N(), M(); break; case "fade": scrl.anims.push([$cfs, { opacity: 0 }, function () { E(), G(), I(), K(), O(), N(), scrl = sc_setScroll(D, b.easing, conf), scrl.anims.push([$cfs, { opacity: 1 }, M]), sc_startScroll(scrl, conf) }]); break; case "crossfade": $cfs.css({ opacity: 0 }), scrl.anims.push([s, { opacity: 0 }]), scrl.anims.push([$cfs, { opacity: 1 }, M]), F(), G(), I(), K(), O(), N(); break; case "cover": scrl.anims.push([s, w, function () { G(), I(), K(), O(), N(), M() }]), F(); break; case "cover-fade": scrl.anims.push([$cfs, { opacity: 0 }]), scrl.anims.push([s, w, function () { G(), I(), K(), O(), N(), M() }]), F(); break; case "uncover": scrl.anims.push([s, x, M]), F(), G(), I(), K(), O(), N(); break; case "uncover-fade": $cfs.css({ opacity: 0 }), scrl.anims.push([$cfs, { opacity: 1 }]), scrl.anims.push([s, x, M]), F(), G(), I(), K(), O(), N(); break; default: scrl.anims.push([$cfs, w, function () { N(), M() }]), F(), H(), J(), L() }return sc_startScroll(scrl, conf), cf_setCookie(opts.cookie, $cfs, conf), $cfs.trigger(cf_e("updatePageStatus", conf), [!1, u]), !0
            }), $cfs.bind(cf_e("slide_next", conf), function (a, b, c) { a.stopPropagation(); var d = $cfs.children(); if (!opts.circular && itms.first == opts.items.visible) return opts.infinite && $cfs.trigger(cf_e("prev", conf), itms.total - 1), a.stopImmediatePropagation(); if (sz_resetMargin(d, opts), !is_number(c)) { if ("*" != opts.items.filter) { var e = is_number(b.items) ? b.items : gn_getVisibleOrg($cfs, opts); c = gn_getScrollItemsNextFilter(d, opts, 0, e) } else c = opts.items.visible; c = cf_getAdjust(c, opts, b.items, $tt0) } var f = 0 == itms.first ? itms.total : itms.first; if (!opts.circular) { if (opts.items.visibleConf.variable) var g = gn_getVisibleItemsNext(d, opts, c), e = gn_getVisibleItemsPrev(d, opts, f - 1); else var g = opts.items.visible, e = opts.items.visible; c + g > f && (c = f - e) } if (opts.items.visibleConf.old = opts.items.visible, opts.items.visibleConf.variable) { for (var g = cf_getItemsAdjust(gn_getVisibleItemsNextTestCircular(d, opts, c, f), opts, opts.items.visibleConf.adjust, $tt0); opts.items.visible - c >= g && itms.total > c;)c++ , g = cf_getItemsAdjust(gn_getVisibleItemsNextTestCircular(d, opts, c, f), opts, opts.items.visibleConf.adjust, $tt0); opts.items.visible = g } else if ("*" != opts.items.filter) { var g = gn_getVisibleItemsNextFilter(d, opts, c); opts.items.visible = cf_getItemsAdjust(g, opts, opts.items.visibleConf.adjust, $tt0) } if (sz_resetMargin(d, opts, !0), 0 == c) return a.stopImmediatePropagation(), debug(conf, "0 items to scroll: Not scrolling."); for (debug(conf, "Scrolling " + c + " items forward."), itms.first -= c; 0 > itms.first;)itms.first += itms.total; opts.circular || (itms.first == opts.items.visible && b.onEnd && b.onEnd.call($tt0, "next"), opts.infinite || nv_enableNavi(opts, itms.first, conf)), itms.total < opts.items.visible + c && $cfs.children().slice(0, opts.items.visible + c - itms.total).clone(!0).appendTo($cfs); var d = $cfs.children(), h = gi_getOldItemsNext(d, opts), i = gi_getNewItemsNext(d, opts, c), j = d.eq(c - 1), k = h.last(), l = i.last(); sz_resetMargin(d, opts); var m = 0, n = 0; if (opts.align) { var o = cf_getAlignPadding(i, opts); m = o[0], n = o[1] } var p = !1, q = $(); if (c > opts.items.visibleConf.old && (q = d.slice(opts.items.visibleConf.old, c), "directscroll" == b.fx)) { var r = opts.items[opts.d.width]; p = q, j = k, sc_hideHiddenItems(p), opts.items[opts.d.width] = "variable" } var s = !1, t = ms_getTotalSize(d.slice(0, c), opts, "width"), u = cf_mapWrapperSizes(ms_getSizes(i, opts, !0), opts, !opts.usePadding), v = 0, w = {}, x = {}, y = {}, z = {}, A = {}, B = sc_getDuration(b, opts, c, t); switch (b.fx) { case "uncover": case "uncover-fade": v = ms_getTotalSize(d.slice(0, opts.items.visibleConf.old), opts, "width") }p && (opts.items[opts.d.width] = r), opts.align && 0 > opts.padding[opts.d[1]] && (opts.padding[opts.d[1]] = 0), sz_resetMargin(d, opts, !0), sz_resetMargin(k, opts, opts.padding[opts.d[1]]), opts.align && (opts.padding[opts.d[1]] = n, opts.padding[opts.d[3]] = m), A[opts.d.left] = opts.usePadding ? opts.padding[opts.d[3]] : 0; var C = function () { }, D = function () { }, E = function () { }, F = function () { }, G = function () { }, H = function () { }, I = function () { }, J = function () { }, K = function () { }; switch (b.fx) { case "crossfade": case "cover": case "cover-fade": case "uncover": case "uncover-fade": s = $cfs.clone(!0).appendTo($wrp), s.children().slice(opts.items.visibleConf.old).remove() }switch (b.fx) { case "crossfade": case "cover": case "cover-fade": $cfs.css("zIndex", 1), s.css("zIndex", 0) }if (scrl = sc_setScroll(B, b.easing, conf), w[opts.d.left] = -t, x[opts.d.left] = -v, 0 > m && (w[opts.d.left] += m), ("variable" == opts[opts.d.width] || "variable" == opts[opts.d.height]) && (C = function () { $wrp.css(u) }, D = function () { scrl.anims.push([$wrp, u]) }), opts.usePadding) { var L = l.data("_cfs_origCssMargin"); n >= 0 && (L += opts.padding[opts.d[1]]), l.css(opts.d.marginRight, L), j.not(k).length && (z[opts.d.marginRight] = k.data("_cfs_origCssMargin")), E = function () { k.css(z) }, F = function () { scrl.anims.push([k, z]) }; var M = j.data("_cfs_origCssMargin"); m > 0 && (M += opts.padding[opts.d[3]]), y[opts.d.marginRight] = M, G = function () { j.css(y) }, H = function () { scrl.anims.push([j, y]) } } K = function () { $cfs.css(A) }; var N = opts.items.visible + c - itms.total; J = function () { N > 0 && $cfs.children().slice(itms.total).remove(); var a = $cfs.children().slice(0, c).appendTo($cfs).last(); if (N > 0 && (i = gi_getCurrentItems(d, opts)), sc_showHiddenItems(p), opts.usePadding) { if (itms.total < opts.items.visible + c) { var b = $cfs.children().eq(opts.items.visible - 1); b.css(opts.d.marginRight, b.data("_cfs_origCssMargin") + opts.padding[opts.d[1]]) } a.css(opts.d.marginRight, a.data("_cfs_origCssMargin")) } }; var O = sc_mapCallbackArguments(h, q, i, c, "next", B, u); switch (I = function () { $cfs.css("zIndex", $cfs.data("_cfs_origCssZindex")), sc_afterScroll($cfs, s, b), crsl.isScrolling = !1, clbk.onAfter = sc_fireCallbacks($tt0, b, "onAfter", O, clbk), queu = sc_fireQueue($cfs, queu, conf), crsl.isPaused || $cfs.trigger(cf_e("play", conf)) }, crsl.isScrolling = !0, tmrs = sc_clearTimers(tmrs), clbk.onBefore = sc_fireCallbacks($tt0, b, "onBefore", O, clbk), b.fx) { case "none": $cfs.css(w), C(), E(), G(), K(), J(), I(); break; case "fade": scrl.anims.push([$cfs, { opacity: 0 }, function () { C(), E(), G(), K(), J(), scrl = sc_setScroll(B, b.easing, conf), scrl.anims.push([$cfs, { opacity: 1 }, I]), sc_startScroll(scrl, conf) }]); break; case "crossfade": $cfs.css({ opacity: 0 }), scrl.anims.push([s, { opacity: 0 }]), scrl.anims.push([$cfs, { opacity: 1 }, I]), D(), E(), G(), K(), J(); break; case "cover": $cfs.css(opts.d.left, $wrp[opts.d.width]()), scrl.anims.push([$cfs, A, I]), D(), E(), G(), J(); break; case "cover-fade": $cfs.css(opts.d.left, $wrp[opts.d.width]()), scrl.anims.push([s, { opacity: 0 }]), scrl.anims.push([$cfs, A, I]), D(), E(), G(), J(); break; case "uncover": scrl.anims.push([s, x, I]), D(), E(), G(), K(), J(); break; case "uncover-fade": $cfs.css({ opacity: 0 }), scrl.anims.push([$cfs, { opacity: 1 }]), scrl.anims.push([s, x, I]), D(), E(), G(), K(), J(); break; default: scrl.anims.push([$cfs, w, function () { K(), J(), I() }]), D(), F(), H() }return sc_startScroll(scrl, conf), cf_setCookie(opts.cookie, $cfs, conf), $cfs.trigger(cf_e("updatePageStatus", conf), [!1, u]), !0 }), $cfs.bind(cf_e("slideTo", conf), function (a, b, c, d, e, f, g) { a.stopPropagation(); var h = [b, c, d, e, f, g], i = ["string/number/object", "number", "boolean", "object", "string", "function"], j = cf_sortParams(h, i); return e = j[3], f = j[4], g = j[5], b = gn_getItemIndex(j[0], j[1], j[2], itms, $cfs), 0 == b ? !1 : (is_object(e) || (e = !1), "prev" != f && "next" != f && (f = opts.circular ? itms.total / 2 >= b ? "next" : "prev" : 0 == itms.first || itms.first > b ? "next" : "prev"), "prev" == f && (b = itms.total - b), $cfs.trigger(cf_e(f, conf), [e, b, g]), !0) }), $cfs.bind(cf_e("prevPage", conf), function (a, b, c) { a.stopPropagation(); var d = $cfs.triggerHandler(cf_e("currentPage", conf)); return $cfs.triggerHandler(cf_e("slideToPage", conf), [d - 1, b, "prev", c]) }), $cfs.bind(cf_e("nextPage", conf), function (a, b, c) { a.stopPropagation(); var d = $cfs.triggerHandler(cf_e("currentPage", conf)); return $cfs.triggerHandler(cf_e("slideToPage", conf), [d + 1, b, "next", c]) }), $cfs.bind(cf_e("slideToPage", conf), function (a, b, c, d, e) { a.stopPropagation(), is_number(b) || (b = $cfs.triggerHandler(cf_e("currentPage", conf))); var f = opts.pagination.items || opts.items.visible, g = Math.ceil(itms.total / f) - 1; return 0 > b && (b = g), b > g && (b = 0), $cfs.triggerHandler(cf_e("slideTo", conf), [b * f, 0, !0, c, d, e]) }), $cfs.bind(cf_e("jumpToStart", conf), function (a, b) { if (a.stopPropagation(), b = b ? gn_getItemIndex(b, 0, !0, itms, $cfs) : 0, b += itms.first, 0 != b) { if (itms.total > 0) for (; b > itms.total;)b -= itms.total; $cfs.prepend($cfs.children().slice(b, itms.total)) } return !0 }), $cfs.bind(cf_e("synchronise", conf), function (a, b) { if (a.stopPropagation(), b) b = cf_getSynchArr(b); else { if (!opts.synchronise) return debug(conf, "No carousel to synchronise."); b = opts.synchronise } for (var c = $cfs.triggerHandler(cf_e("currentPosition", conf)), d = !0, e = 0, f = b.length; f > e; e++)b[e][0].triggerHandler(cf_e("slideTo", conf), [c, b[e][3], !0]) || (d = !1); return d }), $cfs.bind(cf_e("queue", conf), function (a, b, c) { return a.stopPropagation(), is_function(b) ? b.call($tt0, queu) : is_array(b) ? queu = b : is_undefined(b) || queu.push([b, c]), queu }), $cfs.bind(cf_e("insertItem", conf), function (a, b, c, d, e) { a.stopPropagation(); var f = [b, c, d, e], g = ["string/object", "string/number/object", "boolean", "number"], h = cf_sortParams(f, g); if (b = h[0], c = h[1], d = h[2], e = h[3], is_object(b) && !is_jquery(b) ? b = $(b) : is_string(b) && (b = $(b)), !is_jquery(b) || 0 == b.length) return debug(conf, "Not a valid object."); is_undefined(c) && (c = "end"), sz_storeMargin(b, opts), sz_storeOrigCss(b); var i = c, j = "before"; "end" == c ? d ? (0 == itms.first ? (c = itms.total - 1, j = "after") : (c = itms.first, itms.first += b.length), 0 > c && (c = 0)) : (c = itms.total - 1, j = "after") : c = gn_getItemIndex(c, e, d, itms, $cfs); var k = $cfs.children().eq(c); return k.length ? k[j](b) : (debug(conf, "Correct insert-position not found! Appending item to the end."), $cfs.append(b)), "end" == i || d || itms.first > c && (itms.first += b.length), itms.total = $cfs.children().length, itms.first >= itms.total && (itms.first -= itms.total), $cfs.trigger(cf_e("updateSizes", conf)), $cfs.trigger(cf_e("linkAnchors", conf)), !0 }), $cfs.bind(cf_e("removeItem", conf), function (a, b, c, d) { a.stopPropagation(); var e = [b, c, d], f = ["string/number/object", "boolean", "number"], g = cf_sortParams(e, f); if (b = g[0], c = g[1], d = g[2], b instanceof $ && b.length > 1) return i = $(), b.each(function () { var e = $cfs.trigger(cf_e("removeItem", conf), [$(this), c, d]); e && (i = i.add(e)) }), i; if (is_undefined(b) || "end" == b) i = $cfs.children().last(); else { b = gn_getItemIndex(b, d, c, itms, $cfs); var i = $cfs.children().eq(b); i.length && itms.first > b && (itms.first -= i.length) } return i && i.length && (i.detach(), itms.total = $cfs.children().length, $cfs.trigger(cf_e("updateSizes", conf))), i }), $cfs.bind(cf_e("onBefore", conf) + " " + cf_e("onAfter", conf), function (a, b) { a.stopPropagation(); var c = a.type.slice(conf.events.prefix.length); return is_array(b) && (clbk[c] = b), is_function(b) && clbk[c].push(b), clbk[c] }), $cfs.bind(cf_e("currentPosition", conf), function (a, b) { if (a.stopPropagation(), 0 == itms.first) var c = 0; else var c = itms.total - itms.first; return is_function(b) && b.call($tt0, c), c }), $cfs.bind(cf_e("currentPage", conf), function (a, b) { a.stopPropagation(); var e, c = opts.pagination.items || opts.items.visible, d = Math.ceil(itms.total / c - 1); return e = 0 == itms.first ? 0 : itms.first < itms.total % c ? 0 : itms.first != c || opts.circular ? Math.round((itms.total - itms.first) / c) : d, 0 > e && (e = 0), e > d && (e = d), is_function(b) && b.call($tt0, e), e }), $cfs.bind(cf_e("currentVisible", conf), function (a, b) { a.stopPropagation(); var c = gi_getCurrentItems($cfs.children(), opts); return is_function(b) && b.call($tt0, c), c }), $cfs.bind(cf_e("slice", conf), function (a, b, c, d) { if (a.stopPropagation(), 0 == itms.total) return !1; var e = [b, c, d], f = ["number", "number", "function"], g = cf_sortParams(e, f); if (b = is_number(g[0]) ? g[0] : 0, c = is_number(g[1]) ? g[1] : itms.total, d = g[2], b += itms.first, c += itms.first, items.total > 0) { for (; b > itms.total;)b -= itms.total; for (; c > itms.total;)c -= itms.total; for (; 0 > b;)b += itms.total; for (; 0 > c;)c += itms.total } var i, h = $cfs.children(); return i = c > b ? h.slice(b, c) : $(h.slice(b, itms.total).get().concat(h.slice(0, c).get())), is_function(d) && d.call($tt0, i), i }), $cfs.bind(cf_e("isPaused", conf) + " " + cf_e("isStopped", conf) + " " + cf_e("isScrolling", conf), function (a, b) { a.stopPropagation(); var c = a.type.slice(conf.events.prefix.length), d = crsl[c]; return is_function(b) && b.call($tt0, d), d }), $cfs.bind(cf_e("configuration", conf), function (e, a, b, c) { e.stopPropagation(); var reInit = !1; if (is_function(a)) a.call($tt0, opts); else if (is_object(a)) opts_orig = $.extend(!0, {}, opts_orig, a), b !== !1 ? reInit = !0 : opts = $.extend(!0, {}, opts, a); else if (!is_undefined(a)) if (is_function(b)) { var val = eval("opts." + a); is_undefined(val) && (val = ""), b.call($tt0, val) } else { if (is_undefined(b)) return eval("opts." + a); "boolean" != typeof c && (c = !0), eval("opts_orig." + a + " = b"), c !== !1 ? reInit = !0 : eval("opts." + a + " = b") } if (reInit) { sz_resetMargin($cfs.children(), opts), FN._init(opts_orig), FN._bind_buttons(); var sz = sz_setSizes($cfs, opts); $cfs.trigger(cf_e("updatePageStatus", conf), [!0, sz]) } return opts }), $cfs.bind(cf_e("linkAnchors", conf), function (a, b, c) { return a.stopPropagation(), is_undefined(b) ? b = $("body") : is_string(b) && (b = $(b)), is_jquery(b) && 0 != b.length ? (is_string(c) || (c = "a.caroufredsel"), b.find(c).each(function () { var a = this.hash || ""; a.length > 0 && -1 != $cfs.children().index($(a)) && $(this).unbind("click").click(function (b) { b.preventDefault(), $cfs.trigger(cf_e("slideTo", conf), a) }) }), !0) : debug(conf, "Not a valid object.") }), $cfs.bind(cf_e("updatePageStatus", conf), function (a, b) { if (a.stopPropagation(), opts.pagination.container) { var d = opts.pagination.items || opts.items.visible, e = Math.ceil(itms.total / d); b && (opts.pagination.anchorBuilder && (opts.pagination.container.children().remove(), opts.pagination.container.each(function () { for (var a = 0; e > a; a++) { var b = $cfs.children().eq(gn_getItemIndex(a * d, 0, !0, itms, $cfs)); $(this).append(opts.pagination.anchorBuilder.call(b[0], a + 1)) } })), opts.pagination.container.each(function () { $(this).children().unbind(opts.pagination.event).each(function (a) { $(this).bind(opts.pagination.event, function (b) { b.preventDefault(), $cfs.trigger(cf_e("slideTo", conf), [a * d, -opts.pagination.deviation, !0, opts.pagination]) }) }) })); var f = $cfs.triggerHandler(cf_e("currentPage", conf)) + opts.pagination.deviation; return f >= e && (f = 0), 0 > f && (f = e - 1), opts.pagination.container.each(function () { $(this).children().removeClass(cf_c("selected", conf)).eq(f).addClass(cf_c("selected", conf)) }), !0 } }), $cfs.bind(cf_e("updateSizes", conf), function () { var b = opts.items.visible, c = $cfs.children(), d = ms_getParentSize($wrp, opts, "width"); if (itms.total = c.length, crsl.primarySizePercentage ? (opts.maxDimension = d, opts[opts.d.width] = ms_getPercentage(d, crsl.primarySizePercentage)) : opts.maxDimension = ms_getMaxDimension(opts, d), opts.responsive ? (opts.items.width = opts.items.sizesConf.width, opts.items.height = opts.items.sizesConf.height, opts = in_getResponsiveValues(opts, c, d), b = opts.items.visible, sz_setResponsiveSizes(opts, c)) : opts.items.visibleConf.variable ? b = gn_getVisibleItemsNext(c, opts, 0) : "*" != opts.items.filter && (b = gn_getVisibleItemsNextFilter(c, opts, 0)), !opts.circular && 0 != itms.first && b > itms.first) { if (opts.items.visibleConf.variable) var e = gn_getVisibleItemsPrev(c, opts, itms.first) - itms.first; else if ("*" != opts.items.filter) var e = gn_getVisibleItemsPrevFilter(c, opts, itms.first) - itms.first; else var e = opts.items.visible - itms.first; debug(conf, "Preventing non-circular: sliding " + e + " items backward."), $cfs.trigger(cf_e("prev", conf), e) } opts.items.visible = cf_getItemsAdjust(b, opts, opts.items.visibleConf.adjust, $tt0), opts.items.visibleConf.old = opts.items.visible, opts = in_getAlignPadding(opts, c); var f = sz_setSizes($cfs, opts); return $cfs.trigger(cf_e("updatePageStatus", conf), [!0, f]), nv_showNavi(opts, itms.total, conf), nv_enableNavi(opts, itms.first, conf), f }), $cfs.bind(cf_e("destroy", conf), function (a, b) { return a.stopPropagation(), tmrs = sc_clearTimers(tmrs), $cfs.data("_cfs_isCarousel", !1), $cfs.trigger(cf_e("finish", conf)), b && $cfs.trigger(cf_e("jumpToStart", conf)), sz_restoreOrigCss($cfs.children()), sz_restoreOrigCss($cfs), FN._unbind_events(), FN._unbind_buttons(), "parent" == conf.wrapper ? sz_restoreOrigCss($wrp) : $wrp.replaceWith($cfs), !0 }), $cfs.bind(cf_e("debug", conf), function () { return debug(conf, "Carousel width: " + opts.width), debug(conf, "Carousel height: " + opts.height), debug(conf, "Item widths: " + opts.items.width), debug(conf, "Item heights: " + opts.items.height), debug(conf, "Number of items visible: " + opts.items.visible), opts.auto.play && debug(conf, "Number of items scrolled automatically: " + opts.auto.items), opts.prev.button && debug(conf, "Number of items scrolled backward: " + opts.prev.items), opts.next.button && debug(conf, "Number of items scrolled forward: " + opts.next.items), conf.debug }), $cfs.bind("_cfs_triggerEvent", function (a, b, c) { return a.stopPropagation(), $cfs.triggerHandler(cf_e(b, conf), c) })
        }, FN._unbind_events = function () { $cfs.unbind(cf_e("", conf)), $cfs.unbind(cf_e("", conf, !1)), $cfs.unbind("_cfs_triggerEvent") }, FN._bind_buttons = function () { if (FN._unbind_buttons(), nv_showNavi(opts, itms.total, conf), nv_enableNavi(opts, itms.first, conf), opts.auto.pauseOnHover) { var a = bt_pauseOnHoverConfig(opts.auto.pauseOnHover); $wrp.bind(cf_e("mouseenter", conf, !1), function () { $cfs.trigger(cf_e("pause", conf), a) }).bind(cf_e("mouseleave", conf, !1), function () { $cfs.trigger(cf_e("resume", conf)) }) } if (opts.auto.button && opts.auto.button.bind(cf_e(opts.auto.event, conf, !1), function (a) { a.preventDefault(); var b = !1, c = null; crsl.isPaused ? b = "play" : opts.auto.pauseOnEvent && (b = "pause", c = bt_pauseOnHoverConfig(opts.auto.pauseOnEvent)), b && $cfs.trigger(cf_e(b, conf), c) }), opts.prev.button && (opts.prev.button.bind(cf_e(opts.prev.event, conf, !1), function (a) { a.preventDefault(), $cfs.trigger(cf_e("prev", conf)) }), opts.prev.pauseOnHover)) { var a = bt_pauseOnHoverConfig(opts.prev.pauseOnHover); opts.prev.button.bind(cf_e("mouseenter", conf, !1), function () { $cfs.trigger(cf_e("pause", conf), a) }).bind(cf_e("mouseleave", conf, !1), function () { $cfs.trigger(cf_e("resume", conf)) }) } if (opts.next.button && (opts.next.button.bind(cf_e(opts.next.event, conf, !1), function (a) { a.preventDefault(), $cfs.trigger(cf_e("next", conf)) }), opts.next.pauseOnHover)) { var a = bt_pauseOnHoverConfig(opts.next.pauseOnHover); opts.next.button.bind(cf_e("mouseenter", conf, !1), function () { $cfs.trigger(cf_e("pause", conf), a) }).bind(cf_e("mouseleave", conf, !1), function () { $cfs.trigger(cf_e("resume", conf)) }) } if (opts.pagination.container && opts.pagination.pauseOnHover) { var a = bt_pauseOnHoverConfig(opts.pagination.pauseOnHover); opts.pagination.container.bind(cf_e("mouseenter", conf, !1), function () { $cfs.trigger(cf_e("pause", conf), a) }).bind(cf_e("mouseleave", conf, !1), function () { $cfs.trigger(cf_e("resume", conf)) }) } if ((opts.prev.key || opts.next.key) && $(document).bind(cf_e("keyup", conf, !1, !0, !0), function (a) { var b = a.keyCode; b == opts.next.key && (a.preventDefault(), $cfs.trigger(cf_e("next", conf))), b == opts.prev.key && (a.preventDefault(), $cfs.trigger(cf_e("prev", conf))) }), opts.pagination.keys && $(document).bind(cf_e("keyup", conf, !1, !0, !0), function (a) { var b = a.keyCode; b >= 49 && 58 > b && (b = (b - 49) * opts.items.visible, itms.total >= b && (a.preventDefault(), $cfs.trigger(cf_e("slideTo", conf), [b, 0, !0, opts.pagination]))) }), $.fn.swipe) { var b = "ontouchstart" in window; if (b && opts.swipe.onTouch || !b && opts.swipe.onMouse) { var c = $.extend(!0, {}, opts.prev, opts.swipe), d = $.extend(!0, {}, opts.next, opts.swipe), e = function () { $cfs.trigger(cf_e("prev", conf), [c]) }, f = function () { $cfs.trigger(cf_e("next", conf), [d]) }; switch (opts.direction) { case "up": case "down": opts.swipe.options.swipeUp = f, opts.swipe.options.swipeDown = e; break; default: opts.swipe.options.swipeLeft = f, opts.swipe.options.swipeRight = e }crsl.swipe && $cfs.swipe("destroy"), $wrp.swipe(opts.swipe.options), $wrp.css("cursor", "move"), crsl.swipe = !0 } } if ($.fn.mousewheel && opts.mousewheel) { var g = $.extend(!0, {}, opts.prev, opts.mousewheel), h = $.extend(!0, {}, opts.next, opts.mousewheel); crsl.mousewheel && $wrp.unbind(cf_e("mousewheel", conf, !1)), $wrp.bind(cf_e("mousewheel", conf, !1), function (a, b) { a.preventDefault(), b > 0 ? $cfs.trigger(cf_e("prev", conf), [g]) : $cfs.trigger(cf_e("next", conf), [h]) }), crsl.mousewheel = !0 } if (opts.auto.play && $cfs.trigger(cf_e("play", conf), opts.auto.delay), crsl.upDateOnWindowResize) { var i = function () { $cfs.trigger(cf_e("finish", conf)), opts.auto.pauseOnResize && !crsl.isPaused && $cfs.trigger(cf_e("play", conf)), sz_resetMargin($cfs.children(), opts), $cfs.trigger(cf_e("updateSizes", conf)) }, j = $(window), k = null; if ($.debounce && "debounce" == conf.onWindowResize) k = $.debounce(200, i); else if ($.throttle && "throttle" == conf.onWindowResize) k = $.throttle(300, i); else { var l = 0, m = 0; k = function () { var a = j.width(), b = j.height(); (a != l || b != m) && (i(), l = a, m = b) } } j.bind(cf_e("resize", conf, !1, !0, !0), k) } }, FN._unbind_buttons = function () { var b = (cf_e("", conf), cf_e("", conf, !1)); ns3 = cf_e("", conf, !1, !0, !0), $(document).unbind(ns3), $(window).unbind(ns3), $wrp.unbind(b), opts.auto.button && opts.auto.button.unbind(b), opts.prev.button && opts.prev.button.unbind(b), opts.next.button && opts.next.button.unbind(b), opts.pagination.container && (opts.pagination.container.unbind(b), opts.pagination.anchorBuilder && opts.pagination.container.children().remove()), crsl.swipe && ($cfs.swipe("destroy"), $wrp.css("cursor", "default"), crsl.swipe = !1), crsl.mousewheel && (crsl.mousewheel = !1), nv_showNavi(opts, "hide", conf), nv_enableNavi(opts, "removeClass", conf) }, is_boolean(configs) && (configs = { debug: configs }); var crsl = { direction: "next", isPaused: !0, isScrolling: !1, isStopped: !1, mousewheel: !1, swipe: !1 }, itms = { total: $cfs.children().length, first: 0 }, tmrs = { auto: null, progress: null, startTime: getTime(), timePassed: 0 }, scrl = { isStopped: !1, duration: 0, startTime: 0, easing: "", anims: [] }, clbk = { onBefore: [], onAfter: [] }, queu = [], conf = $.extend(!0, {}, $.fn.carouFredSel.configs, configs), opts = {}, opts_orig = $.extend(!0, {}, options), $wrp = "parent" == conf.wrapper ? $cfs.parent() : $cfs.wrap("<" + conf.wrapper.element + ' class="' + conf.wrapper.classname + '" />').parent(); if (conf.selector = $cfs.selector, conf.serialNumber = $.fn.carouFredSel.serialNumber++ , conf.transition = conf.transition && $.fn.transition ? "transition" : "animate", FN._init(opts_orig, !0, starting_position), FN._build(), FN._bind_events(), FN._bind_buttons(), is_array(opts.items.start)) var start_arr = opts.items.start; else { var start_arr = []; 0 != opts.items.start && start_arr.push(opts.items.start) } if (opts.cookie && start_arr.unshift(parseInt(cf_getCookie(opts.cookie), 10)), start_arr.length > 0) for (var a = 0, l = start_arr.length; l > a; a++) { var s = start_arr[a]; if (0 != s) { if (s === !0) { if (s = window.location.hash, 1 > s.length) continue } else "random" === s && (s = Math.floor(Math.random() * itms.total)); if ($cfs.triggerHandler(cf_e("slideTo", conf), [s, 0, !0, { fx: "none" }])) break } } var siz = sz_setSizes($cfs, opts), itm = gi_getCurrentItems($cfs.children(), opts); return opts.onCreate && opts.onCreate.call($tt0, { width: siz.width, height: siz.height, items: itm }), $cfs.trigger(cf_e("updatePageStatus", conf), [!0, siz]), $cfs.trigger(cf_e("linkAnchors", conf)), conf.debug && $cfs.trigger(cf_e("debug", conf)), $cfs
    }, $.fn.carouFredSel.serialNumber = 1, $.fn.carouFredSel.defaults = { synchronise: !1, infinite: !0, circular: !0, responsive: !1, direction: "left", items: { start: 0 }, scroll: { easing: "swing", duration: 500, pauseOnHover: !1, event: "click", queue: !1 } }, $.fn.carouFredSel.configs = { debug: !1, transition: !1, onWindowResize: "throttle", events: { prefix: "", namespace: "cfs" }, wrapper: { element: "div", classname: "caroufredsel_wrapper" }, classnames: {} }, $.fn.carouFredSel.pageAnchorBuilder = function (a) { return '<a href="#"><span>' + a + "</span></a>" }, $.fn.carouFredSel.progressbarUpdater = function (a) { $(this).css("width", a + "%") }, $.fn.carouFredSel.cookie = { get: function (a) { a += "="; for (var b = document.cookie.split(";"), c = 0, d = b.length; d > c; c++) { for (var e = b[c]; " " == e.charAt(0);)e = e.slice(1); if (0 == e.indexOf(a)) return e.slice(a.length) } return 0 }, set: function (a, b, c) { var d = ""; if (c) { var e = new Date; e.setTime(e.getTime() + 1e3 * 60 * 60 * 24 * c), d = "; expires=" + e.toGMTString() } document.cookie = a + "=" + b + d + "; path=/" }, remove: function (a) { $.fn.carouFredSel.cookie.set(a, "", -1) } }, $.extend($.easing, { quadratic: function (a) { var b = a * a; return a * (-b * a + 4 * b - 6 * a + 4) }, cubic: function (a) { return a * (4 * a * a - 9 * a + 6) }, elastic: function (a) { var b = a * a; return a * (33 * b * b - 106 * b * a + 126 * b - 67 * a + 15) } }))
})(jQuery);

/*! iScroll v5.1.1 ~ (c) 2008-2014 Matteo Spinelli ~ http://cubiq.org/license */
//(function(e,t,n){function s(e,n){this.wrapper=typeof e=="string"?t.querySelector(e):e;this.scroller=this.wrapper.children[0];this.scrollerStyle=this.scroller.style;this.options={resizeScrollbars:true,mouseWheelSpeed:20,snapThreshold:.334,startX:0,startY:0,scrollY:true,directionLockThreshold:5,momentum:true,bounce:true,bounceTime:600,bounceEasing:"",preventDefault:true,preventDefaultException:{tagName:/^(INPUT|TEXTAREA|BUTTON|SELECT)$/},HWCompositing:true,useTransition:true,useTransform:true};for(var r in n){this.options[r]=n[r]}this.translateZ=this.options.HWCompositing&&i.hasPerspective?" translateZ(0)":"";this.options.useTransition=i.hasTransition&&this.options.useTransition;this.options.useTransform=i.hasTransform&&this.options.useTransform;this.options.eventPassthrough=this.options.eventPassthrough===true?"vertical":this.options.eventPassthrough;this.options.preventDefault=!this.options.eventPassthrough&&this.options.preventDefault;this.options.scrollY=this.options.eventPassthrough=="vertical"?false:this.options.scrollY;this.options.scrollX=this.options.eventPassthrough=="horizontal"?false:this.options.scrollX;this.options.freeScroll=this.options.freeScroll&&!this.options.eventPassthrough;this.options.directionLockThreshold=this.options.eventPassthrough?0:this.options.directionLockThreshold;this.options.bounceEasing=typeof this.options.bounceEasing=="string"?i.ease[this.options.bounceEasing]||i.ease.circular:this.options.bounceEasing;this.options.resizePolling=this.options.resizePolling===undefined?60:this.options.resizePolling;if(this.options.tap===true){this.options.tap="tap"}if(this.options.shrinkScrollbars=="scale"){this.options.useTransition=false}this.options.invertWheelDirection=this.options.invertWheelDirection?-1:1;this.x=0;this.y=0;this.directionX=0;this.directionY=0;this._events={};this._init();this.refresh();this.scrollTo(this.options.startX,this.options.startY);this.enable()}function o(e,n,r){var i=t.createElement("div"),s=t.createElement("div");if(r===true){i.style.cssText="position:absolute;z-index:9999";s.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;position:absolute;background:rgba(0,0,0,0.5);border:1px solid rgba(255,255,255,0.9);border-radius:3px"}s.className="iScrollIndicator";if(e=="h"){if(r===true){i.style.cssText+=";height:7px;left:2px;right:2px;bottom:0";s.style.height="100%"}i.className="iScrollHorizontalScrollbar"}else{if(r===true){i.style.cssText+=";width:7px;bottom:2px;top:2px;right:1px";s.style.width="100%"}i.className="iScrollVerticalScrollbar"}i.style.cssText+=";overflow:hidden";if(!n){i.style.pointerEvents="none"}i.appendChild(s);return i}function u(n,r){this.wrapper=typeof r.el=="string"?t.querySelector(r.el):r.el;this.wrapperStyle=this.wrapper.style;this.indicator=this.wrapper.children[0];this.indicatorStyle=this.indicator.style;this.scroller=n;this.options={listenX:true,listenY:true,interactive:false,resize:true,defaultScrollbars:false,shrink:false,fade:false,speedRatioX:0,speedRatioY:0};for(var s in r){this.options[s]=r[s]}this.sizeRatioX=1;this.sizeRatioY=1;this.maxPosX=0;this.maxPosY=0;if(this.options.interactive){if(!this.options.disableTouch){i.addEvent(this.indicator,"touchstart",this);i.addEvent(e,"touchend",this)}if(!this.options.disablePointer){i.addEvent(this.indicator,"MSPointerDown",this);i.addEvent(e,"MSPointerUp",this)}if(!this.options.disableMouse){i.addEvent(this.indicator,"mousedown",this);i.addEvent(e,"mouseup",this)}}if(this.options.fade){this.wrapperStyle[i.style.transform]=this.scroller.translateZ;this.wrapperStyle[i.style.transitionDuration]=i.isBadAndroid?"0.001s":"0ms";this.wrapperStyle.opacity="0"}}var r=e.requestAnimationFrame||e.webkitRequestAnimationFrame||e.mozRequestAnimationFrame||e.oRequestAnimationFrame||e.msRequestAnimationFrame||function(t){e.setTimeout(t,1e3/60)};var i=function(){function o(e){if(s===false)return false;if(s==="")return e;return s+e.charAt(0).toUpperCase()+e.substr(1)}var r={};var i=t.createElement("div").style;var s=function(){var e=["t","webkitT","MozT","msT","OT"],t,n=0,r=e.length;for(;n<r;n++){t=e[n]+"ransform";if(t in i)return e[n].substr(0,e[n].length-1)}return false}();r.getTime=Date.now||function(){return(new Date).getTime()};r.extend=function(e,t){for(var n in t){e[n]=t[n]}};r.addEvent=function(e,t,n,r){e.addEventListener(t,n,!!r)};r.removeEvent=function(e,t,n,r){e.removeEventListener(t,n,!!r)};r.momentum=function(e,t,r,i,s,o){var u=e-t,a=n.abs(u)/r,f,l;o=o===undefined?6e-4:o;f=e+a*a/(2*o)*(u<0?-1:1);l=a/o;if(f<i){f=s?i-s/2.5*(a/8):i;u=n.abs(f-e);l=u/a}else if(f>0){f=s?s/2.5*(a/8):0;u=n.abs(e)+f;l=u/a}return{destination:n.round(f),duration:l}};var u=o("transform");r.extend(r,{hasTransform:u!==false,hasPerspective:o("perspective")in i,hasTouch:"ontouchstart"in e,hasPointer:navigator.msPointerEnabled,hasTransition:o("transition")in i});r.isBadAndroid=/Android /.test(e.navigator.appVersion)&&!/Chrome\/\d/.test(e.navigator.appVersion);r.extend(r.style={},{transform:u,transitionTimingFunction:o("transitionTimingFunction"),transitionDuration:o("transitionDuration"),transitionDelay:o("transitionDelay"),transformOrigin:o("transformOrigin")});r.hasClass=function(e,t){var n=new RegExp("(^|\\s)"+t+"(\\s|$)");return n.test(e.className)};r.addClass=function(e,t){if(r.hasClass(e,t)){return}var n=e.className.split(" ");n.push(t);e.className=n.join(" ")};r.removeClass=function(e,t){if(!r.hasClass(e,t)){return}var n=new RegExp("(^|\\s)"+t+"(\\s|$)","g");e.className=e.className.replace(n," ")};r.offset=function(e){var t=-e.offsetLeft,n=-e.offsetTop;while(e=e.offsetParent){t-=e.offsetLeft;n-=e.offsetTop}return{left:t,top:n}};r.preventDefaultException=function(e,t){for(var n in t){if(t[n].test(e[n])){return true}}return false};r.extend(r.eventType={},{touchstart:1,touchmove:1,touchend:1,mousedown:2,mousemove:2,mouseup:2,MSPointerDown:3,MSPointerMove:3,MSPointerUp:3});r.extend(r.ease={},{quadratic:{style:"cubic-bezier(0.25, 0.46, 0.45, 0.94)",fn:function(e){return e*(2-e)}},circular:{style:"cubic-bezier(0.1, 0.57, 0.1, 1)",fn:function(e){return n.sqrt(1- --e*e)}},back:{style:"cubic-bezier(0.175, 0.885, 0.32, 1.275)",fn:function(e){var t=4;return(e=e-1)*e*((t+1)*e+t)+1}},bounce:{style:"",fn:function(e){if((e/=1)<1/2.75){return 7.5625*e*e}else if(e<2/2.75){return 7.5625*(e-=1.5/2.75)*e+.75}else if(e<2.5/2.75){return 7.5625*(e-=2.25/2.75)*e+.9375}else{return 7.5625*(e-=2.625/2.75)*e+.984375}}},elastic:{style:"",fn:function(e){var t=.22,r=.4;if(e===0){return 0}if(e==1){return 1}return r*n.pow(2,-10*e)*n.sin((e-t/4)*2*n.PI/t)+1}}});r.tap=function(e,n){var r=t.createEvent("Event");r.initEvent(n,true,true);r.pageX=e.pageX;r.pageY=e.pageY;e.target.dispatchEvent(r)};r.click=function(e){var n=e.target,r;if(!/(SELECT|INPUT|TEXTAREA)/i.test(n.tagName)){r=t.createEvent("MouseEvents");r.initMouseEvent("click",true,true,e.view,1,n.screenX,n.screenY,n.clientX,n.clientY,e.ctrlKey,e.altKey,e.shiftKey,e.metaKey,0,null);r._constructed=true;n.dispatchEvent(r)}};return r}();s.prototype={version:"5.1.1",_init:function(){this._initEvents();if(this.options.scrollbars||this.options.indicators){this._initIndicators()}if(this.options.mouseWheel){this._initWheel()}if(this.options.snap){this._initSnap()}if(this.options.keyBindings){this._initKeys()}},destroy:function(){this._initEvents(true);this._execEvent("destroy")},_transitionEnd:function(e){if(e.target!=this.scroller||!this.isInTransition){return}this._transitionTime();if(!this.resetPosition(this.options.bounceTime)){this.isInTransition=false;this._execEvent("scrollEnd")}},_start:function(e){if(i.eventType[e.type]!=1){if(e.button!==0){return}}if(!this.enabled||this.initiated&&i.eventType[e.type]!==this.initiated){return}if(this.options.preventDefault&&!i.isBadAndroid&&!i.preventDefaultException(e.target,this.options.preventDefaultException)){e.preventDefault()}var t=e.touches?e.touches[0]:e,r;this.initiated=i.eventType[e.type];this.moved=false;this.distX=0;this.distY=0;this.directionX=0;this.directionY=0;this.directionLocked=0;this._transitionTime();this.startTime=i.getTime();if(this.options.useTransition&&this.isInTransition){this.isInTransition=false;r=this.getComputedPosition();this._translate(n.round(r.x),n.round(r.y));this._execEvent("scrollEnd")}else if(!this.options.useTransition&&this.isAnimating){this.isAnimating=false;this._execEvent("scrollEnd")}this.startX=this.x;this.startY=this.y;this.absStartX=this.x;this.absStartY=this.y;this.pointX=t.pageX;this.pointY=t.pageY;this._execEvent("beforeScrollStart")},_move:function(e){if(!this.enabled||i.eventType[e.type]!==this.initiated){return}if(this.options.preventDefault){e.preventDefault()}var t=e.touches?e.touches[0]:e,r=t.pageX-this.pointX,s=t.pageY-this.pointY,o=i.getTime(),u,a,f,l;this.pointX=t.pageX;this.pointY=t.pageY;this.distX+=r;this.distY+=s;f=n.abs(this.distX);l=n.abs(this.distY);if(o-this.endTime>300&&f<10&&l<10){return}if(!this.directionLocked&&!this.options.freeScroll){if(f>l+this.options.directionLockThreshold){this.directionLocked="h"}else if(l>=f+this.options.directionLockThreshold){this.directionLocked="v"}else{this.directionLocked="n"}}if(this.directionLocked=="h"){if(this.options.eventPassthrough=="vertical"){e.preventDefault()}else if(this.options.eventPassthrough=="horizontal"){this.initiated=false;return}s=0}else if(this.directionLocked=="v"){if(this.options.eventPassthrough=="horizontal"){e.preventDefault()}else if(this.options.eventPassthrough=="vertical"){this.initiated=false;return}r=0}r=this.hasHorizontalScroll?r:0;s=this.hasVerticalScroll?s:0;u=this.x+r;a=this.y+s;if(u>0||u<this.maxScrollX){u=this.options.bounce?this.x+r/3:u>0?0:this.maxScrollX}if(a>0||a<this.maxScrollY){a=this.options.bounce?this.y+s/3:a>0?0:this.maxScrollY}this.directionX=r>0?-1:r<0?1:0;this.directionY=s>0?-1:s<0?1:0;if(!this.moved){this._execEvent("scrollStart")}this.moved=true;this._translate(u,a);if(o-this.startTime>300){this.startTime=o;this.startX=this.x;this.startY=this.y}},_end:function(e){if(!this.enabled||i.eventType[e.type]!==this.initiated){return}if(this.options.preventDefault&&!i.preventDefaultException(e.target,this.options.preventDefaultException)){e.preventDefault()}var t=e.changedTouches?e.changedTouches[0]:e,r,s,o=i.getTime()-this.startTime,u=n.round(this.x),a=n.round(this.y),f=n.abs(u-this.startX),l=n.abs(a-this.startY),c=0,h="";this.isInTransition=0;this.initiated=0;this.endTime=i.getTime();if(this.resetPosition(this.options.bounceTime)){return}this.scrollTo(u,a);if(!this.moved){if(this.options.tap){i.tap(e,this.options.tap)}if(this.options.click){i.click(e)}this._execEvent("scrollCancel");return}if(this._events.flick&&o<200&&f<100&&l<100){this._execEvent("flick");return}if(this.options.momentum&&o<300){r=this.hasHorizontalScroll?i.momentum(this.x,this.startX,o,this.maxScrollX,this.options.bounce?this.wrapperWidth:0,this.options.deceleration):{destination:u,duration:0};s=this.hasVerticalScroll?i.momentum(this.y,this.startY,o,this.maxScrollY,this.options.bounce?this.wrapperHeight:0,this.options.deceleration):{destination:a,duration:0};u=r.destination;a=s.destination;c=n.max(r.duration,s.duration);this.isInTransition=1}if(this.options.snap){var p=this._nearestSnap(u,a);this.currentPage=p;c=this.options.snapSpeed||n.max(n.max(n.min(n.abs(u-p.x),1e3),n.min(n.abs(a-p.y),1e3)),300);u=p.x;a=p.y;this.directionX=0;this.directionY=0;h=this.options.bounceEasing}if(u!=this.x||a!=this.y){if(u>0||u<this.maxScrollX||a>0||a<this.maxScrollY){h=i.ease.quadratic}this.scrollTo(u,a,c,h);return}this._execEvent("scrollEnd")},_resize:function(){var e=this;clearTimeout(this.resizeTimeout);this.resizeTimeout=setTimeout(function(){e.refresh()},this.options.resizePolling)},resetPosition:function(e){var t=this.x,n=this.y;e=e||0;if(!this.hasHorizontalScroll||this.x>0){t=0}else if(this.x<this.maxScrollX){t=this.maxScrollX}if(!this.hasVerticalScroll||this.y>0){n=0}else if(this.y<this.maxScrollY){n=this.maxScrollY}if(t==this.x&&n==this.y){return false}this.scrollTo(t,n,e,this.options.bounceEasing);return true},disable:function(){this.enabled=false},enable:function(){this.enabled=true},refresh:function(){var e=this.wrapper.offsetHeight;this.wrapperWidth=this.wrapper.clientWidth;this.wrapperHeight=this.wrapper.clientHeight;this.scrollerWidth=this.scroller.offsetWidth;this.scrollerHeight=this.scroller.offsetHeight;this.maxScrollX=this.wrapperWidth-this.scrollerWidth;this.maxScrollY=this.wrapperHeight-this.scrollerHeight;this.hasHorizontalScroll=this.options.scrollX&&this.maxScrollX<0;this.hasVerticalScroll=this.options.scrollY&&this.maxScrollY<0;if(!this.hasHorizontalScroll){this.maxScrollX=0;this.scrollerWidth=this.wrapperWidth}if(!this.hasVerticalScroll){this.maxScrollY=0;this.scrollerHeight=this.wrapperHeight}this.endTime=0;this.directionX=0;this.directionY=0;this.wrapperOffset=i.offset(this.wrapper);this._execEvent("refresh");this.resetPosition()},on:function(e,t){if(!this._events[e]){this._events[e]=[]}this._events[e].push(t)},off:function(e,t){if(!this._events[e]){return}var n=this._events[e].indexOf(t);if(n>-1){this._events[e].splice(n,1)}},_execEvent:function(e){if(!this._events[e]){return}var t=0,n=this._events[e].length;if(!n){return}for(;t<n;t++){this._events[e][t].apply(this,[].slice.call(arguments,1))}},scrollBy:function(e,t,n,r){e=this.x+e;t=this.y+t;n=n||0;this.scrollTo(e,t,n,r)},scrollTo:function(e,t,n,r){r=r||i.ease.circular;this.isInTransition=this.options.useTransition&&n>0;if(!n||this.options.useTransition&&r.style){this._transitionTimingFunction(r.style);this._transitionTime(n);this._translate(e,t)}else{this._animate(e,t,n,r.fn)}},scrollToElement:function(e,t,r,s,o){e=e.nodeType?e:this.scroller.querySelector(e);if(!e){return}var u=i.offset(e);u.left-=this.wrapperOffset.left;u.top-=this.wrapperOffset.top;if(r===true){r=n.round(e.offsetWidth/2-this.wrapper.offsetWidth/2)}if(s===true){s=n.round(e.offsetHeight/2-this.wrapper.offsetHeight/2)}u.left-=r||0;u.top-=s||0;u.left=u.left>0?0:u.left<this.maxScrollX?this.maxScrollX:u.left;u.top=u.top>0?0:u.top<this.maxScrollY?this.maxScrollY:u.top;t=t===undefined||t===null||t==="auto"?n.max(n.abs(this.x-u.left),n.abs(this.y-u.top)):t;this.scrollTo(u.left,u.top,t,o)},_transitionTime:function(e){e=e||0;this.scrollerStyle[i.style.transitionDuration]=e+"ms";if(!e&&i.isBadAndroid){this.scrollerStyle[i.style.transitionDuration]="0.001s"}if(this.indicators){for(var t=this.indicators.length;t--;){this.indicators[t].transitionTime(e)}}},_transitionTimingFunction:function(e){this.scrollerStyle[i.style.transitionTimingFunction]=e;if(this.indicators){for(var t=this.indicators.length;t--;){this.indicators[t].transitionTimingFunction(e)}}},_translate:function(e,t){if(this.options.useTransform){this.scrollerStyle[i.style.transform]="translate("+e+"px,"+t+"px)"+this.translateZ}else{e=n.round(e);t=n.round(t);this.scrollerStyle.left=e+"px";this.scrollerStyle.top=t+"px"}this.x=e;this.y=t;if(this.indicators){for(var r=this.indicators.length;r--;){this.indicators[r].updatePosition()}}},_initEvents:function(t){var n=t?i.removeEvent:i.addEvent,r=this.options.bindToWrapper?this.wrapper:e;n(e,"orientationchange",this);n(e,"resize",this);if(this.options.click){n(this.wrapper,"click",this,true)}if(!this.options.disableMouse){n(this.wrapper,"mousedown",this);n(r,"mousemove",this);n(r,"mousecancel",this);n(r,"mouseup",this)}if(i.hasPointer&&!this.options.disablePointer){n(this.wrapper,"MSPointerDown",this);n(r,"MSPointerMove",this);n(r,"MSPointerCancel",this);n(r,"MSPointerUp",this)}if(i.hasTouch&&!this.options.disableTouch){n(this.wrapper,"touchstart",this);n(r,"touchmove",this);n(r,"touchcancel",this);n(r,"touchend",this)}n(this.scroller,"transitionend",this);n(this.scroller,"webkitTransitionEnd",this);n(this.scroller,"oTransitionEnd",this);n(this.scroller,"MSTransitionEnd",this)},getComputedPosition:function(){var t=e.getComputedStyle(this.scroller,null),n,r;if(this.options.useTransform){t=t[i.style.transform].split(")")[0].split(", ");n=+(t[12]||t[4]);r=+(t[13]||t[5])}else{n=+t.left.replace(/[^-\d.]/g,"");r=+t.top.replace(/[^-\d.]/g,"")}return{x:n,y:r}},_initIndicators:function(){function a(e){for(var t=i.indicators.length;t--;){e.call(i.indicators[t])}}var e=this.options.interactiveScrollbars,t=typeof this.options.scrollbars!="string",n=[],r;var i=this;this.indicators=[];if(this.options.scrollbars){if(this.options.scrollY){r={el:o("v",e,this.options.scrollbars),interactive:e,defaultScrollbars:true,customStyle:t,resize:this.options.resizeScrollbars,shrink:this.options.shrinkScrollbars,fade:this.options.fadeScrollbars,listenX:false};this.wrapper.appendChild(r.el);n.push(r)}if(this.options.scrollX){r={el:o("h",e,this.options.scrollbars),interactive:e,defaultScrollbars:true,customStyle:t,resize:this.options.resizeScrollbars,shrink:this.options.shrinkScrollbars,fade:this.options.fadeScrollbars,listenY:false};this.wrapper.appendChild(r.el);n.push(r)}}if(this.options.indicators){n=n.concat(this.options.indicators)}for(var s=n.length;s--;){this.indicators.push(new u(this,n[s]))}if(this.options.fadeScrollbars){this.on("scrollEnd",function(){a(function(){this.fade()})});this.on("scrollCancel",function(){a(function(){this.fade()})});this.on("scrollStart",function(){a(function(){this.fade(1)})});this.on("beforeScrollStart",function(){a(function(){this.fade(1,true)})})}this.on("refresh",function(){a(function(){this.refresh()})});this.on("destroy",function(){a(function(){this.destroy()});delete this.indicators})},_initWheel:function(){i.addEvent(this.wrapper,"wheel",this);i.addEvent(this.wrapper,"mousewheel",this);i.addEvent(this.wrapper,"DOMMouseScroll",this);this.on("destroy",function(){i.removeEvent(this.wrapper,"wheel",this);i.removeEvent(this.wrapper,"mousewheel",this);i.removeEvent(this.wrapper,"DOMMouseScroll",this)})},_wheel:function(e){if(!this.enabled){return}e.preventDefault();e.stopPropagation();var t,r,i,s,o=this;if(this.wheelTimeout===undefined){o._execEvent("scrollStart")}clearTimeout(this.wheelTimeout);this.wheelTimeout=setTimeout(function(){o._execEvent("scrollEnd");o.wheelTimeout=undefined},400);if("deltaX"in e){t=-e.deltaX;r=-e.deltaY}else if("wheelDeltaX"in e){t=e.wheelDeltaX/120*this.options.mouseWheelSpeed;r=e.wheelDeltaY/120*this.options.mouseWheelSpeed}else if("wheelDelta"in e){t=r=e.wheelDelta/120*this.options.mouseWheelSpeed}else if("detail"in e){t=r=-e.detail/3*this.options.mouseWheelSpeed}else{return}t*=this.options.invertWheelDirection;r*=this.options.invertWheelDirection;if(!this.hasVerticalScroll){t=r;r=0}if(this.options.snap){i=this.currentPage.pageX;s=this.currentPage.pageY;if(t>0){i--}else if(t<0){i++}if(r>0){s--}else if(r<0){s++}this.goToPage(i,s);return}i=this.x+n.round(this.hasHorizontalScroll?t:0);s=this.y+n.round(this.hasVerticalScroll?r:0);if(i>0){i=0}else if(i<this.maxScrollX){i=this.maxScrollX}if(s>0){s=0}else if(s<this.maxScrollY){s=this.maxScrollY}this.scrollTo(i,s,0)},_initSnap:function(){this.currentPage={};if(typeof this.options.snap=="string"){this.options.snap=this.scroller.querySelectorAll(this.options.snap)}this.on("refresh",function(){var e=0,t,r=0,i,s,o,u=0,a,f=this.options.snapStepX||this.wrapperWidth,l=this.options.snapStepY||this.wrapperHeight,c;this.pages=[];if(!this.wrapperWidth||!this.wrapperHeight||!this.scrollerWidth||!this.scrollerHeight){return}if(this.options.snap===true){s=n.round(f/2);o=n.round(l/2);while(u>-this.scrollerWidth){this.pages[e]=[];t=0;a=0;while(a>-this.scrollerHeight){this.pages[e][t]={x:n.max(u,this.maxScrollX),y:n.max(a,this.maxScrollY),width:f,height:l,cx:u-s,cy:a-o};a-=l;t++}u-=f;e++}}else{c=this.options.snap;t=c.length;i=-1;for(;e<t;e++){if(e===0||c[e].offsetLeft<=c[e-1].offsetLeft){r=0;i++}if(!this.pages[r]){this.pages[r]=[]}u=n.max(-c[e].offsetLeft,this.maxScrollX);a=n.max(-c[e].offsetTop,this.maxScrollY);s=u-n.round(c[e].offsetWidth/2);o=a-n.round(c[e].offsetHeight/2);this.pages[r][i]={x:u,y:a,width:c[e].offsetWidth,height:c[e].offsetHeight,cx:s,cy:o};if(u>this.maxScrollX){r++}}}this.goToPage(this.currentPage.pageX||0,this.currentPage.pageY||0,0);if(this.options.snapThreshold%1===0){this.snapThresholdX=this.options.snapThreshold;this.snapThresholdY=this.options.snapThreshold}else{this.snapThresholdX=n.round(this.pages[this.currentPage.pageX][this.currentPage.pageY].width*this.options.snapThreshold);this.snapThresholdY=n.round(this.pages[this.currentPage.pageX][this.currentPage.pageY].height*this.options.snapThreshold)}});this.on("flick",function(){var e=this.options.snapSpeed||n.max(n.max(n.min(n.abs(this.x-this.startX),1e3),n.min(n.abs(this.y-this.startY),1e3)),300);this.goToPage(this.currentPage.pageX+this.directionX,this.currentPage.pageY+this.directionY,e)})},_nearestSnap:function(e,t){if(!this.pages.length){return{x:0,y:0,pageX:0,pageY:0}}var r=0,i=this.pages.length,s=0;if(n.abs(e-this.absStartX)<this.snapThresholdX&&n.abs(t-this.absStartY)<this.snapThresholdY){return this.currentPage}if(e>0){e=0}else if(e<this.maxScrollX){e=this.maxScrollX}if(t>0){t=0}else if(t<this.maxScrollY){t=this.maxScrollY}for(;r<i;r++){if(e>=this.pages[r][0].cx){e=this.pages[r][0].x;break}}i=this.pages[r].length;for(;s<i;s++){if(t>=this.pages[0][s].cy){t=this.pages[0][s].y;break}}if(r==this.currentPage.pageX){r+=this.directionX;if(r<0){r=0}else if(r>=this.pages.length){r=this.pages.length-1}e=this.pages[r][0].x}if(s==this.currentPage.pageY){s+=this.directionY;if(s<0){s=0}else if(s>=this.pages[0].length){s=this.pages[0].length-1}t=this.pages[0][s].y}return{x:e,y:t,pageX:r,pageY:s}},goToPage:function(e,t,r,i){i=i||this.options.bounceEasing;if(e>=this.pages.length){e=this.pages.length-1}else if(e<0){e=0}if(t>=this.pages[e].length){t=this.pages[e].length-1}else if(t<0){t=0}var s=this.pages[e][t].x,o=this.pages[e][t].y;r=r===undefined?this.options.snapSpeed||n.max(n.max(n.min(n.abs(s-this.x),1e3),n.min(n.abs(o-this.y),1e3)),300):r;this.currentPage={x:s,y:o,pageX:e,pageY:t};this.scrollTo(s,o,r,i)},next:function(e,t){var n=this.currentPage.pageX,r=this.currentPage.pageY;n++;if(n>=this.pages.length&&this.hasVerticalScroll){n=0;r++}this.goToPage(n,r,e,t)},prev:function(e,t){var n=this.currentPage.pageX,r=this.currentPage.pageY;n--;if(n<0&&this.hasVerticalScroll){n=0;r--}this.goToPage(n,r,e,t)},_initKeys:function(t){var n={pageUp:33,pageDown:34,end:35,home:36,left:37,up:38,right:39,down:40};var r;if(typeof this.options.keyBindings=="object"){for(r in this.options.keyBindings){if(typeof this.options.keyBindings[r]=="string"){this.options.keyBindings[r]=this.options.keyBindings[r].toUpperCase().charCodeAt(0)}}}else{this.options.keyBindings={}}for(r in n){this.options.keyBindings[r]=this.options.keyBindings[r]||n[r]}i.addEvent(e,"keydown",this);this.on("destroy",function(){i.removeEvent(e,"keydown",this)})},_key:function(e){if(!this.enabled){return}var t=this.options.snap,r=t?this.currentPage.pageX:this.x,s=t?this.currentPage.pageY:this.y,o=i.getTime(),u=this.keyTime||0,a=.25,f;if(this.options.useTransition&&this.isInTransition){f=this.getComputedPosition();this._translate(n.round(f.x),n.round(f.y));this.isInTransition=false}this.keyAcceleration=o-u<200?n.min(this.keyAcceleration+a,50):0;switch(e.keyCode){case this.options.keyBindings.pageUp:if(this.hasHorizontalScroll&&!this.hasVerticalScroll){r+=t?1:this.wrapperWidth}else{s+=t?1:this.wrapperHeight}break;case this.options.keyBindings.pageDown:if(this.hasHorizontalScroll&&!this.hasVerticalScroll){r-=t?1:this.wrapperWidth}else{s-=t?1:this.wrapperHeight}break;case this.options.keyBindings.end:r=t?this.pages.length-1:this.maxScrollX;s=t?this.pages[0].length-1:this.maxScrollY;break;case this.options.keyBindings.home:r=0;s=0;break;case this.options.keyBindings.left:r+=t?-1:5+this.keyAcceleration>>0;break;case this.options.keyBindings.up:s+=t?1:5+this.keyAcceleration>>0;break;case this.options.keyBindings.right:r-=t?-1:5+this.keyAcceleration>>0;break;case this.options.keyBindings.down:s-=t?1:5+this.keyAcceleration>>0;break;default:return}if(t){this.goToPage(r,s);return}if(r>0){r=0;this.keyAcceleration=0}else if(r<this.maxScrollX){r=this.maxScrollX;this.keyAcceleration=0}if(s>0){s=0;this.keyAcceleration=0}else if(s<this.maxScrollY){s=this.maxScrollY;this.keyAcceleration=0}this.scrollTo(r,s,0);this.keyTime=o},_animate:function(e,t,n,s){function c(){var h=i.getTime(),p,d,v;if(h>=l){o.isAnimating=false;o._translate(e,t);if(!o.resetPosition(o.options.bounceTime)){o._execEvent("scrollEnd")}return}h=(h-f)/n;v=s(h);p=(e-u)*v+u;d=(t-a)*v+a;o._translate(p,d);if(o.isAnimating){r(c)}}var o=this,u=this.x,a=this.y,f=i.getTime(),l=f+n;this.isAnimating=true;c()},handleEvent:function(e){switch(e.type){case"touchstart":case"MSPointerDown":case"mousedown":this._start(e);break;case"touchmove":case"MSPointerMove":case"mousemove":this._move(e);break;case"touchend":case"MSPointerUp":case"mouseup":case"touchcancel":case"MSPointerCancel":case"mousecancel":this._end(e);break;case"orientationchange":case"resize":this._resize();break;case"transitionend":case"webkitTransitionEnd":case"oTransitionEnd":case"MSTransitionEnd":this._transitionEnd(e);break;case"wheel":case"DOMMouseScroll":case"mousewheel":this._wheel(e);break;case"keydown":this._key(e);break;case"click":if(!e._constructed){e.preventDefault();e.stopPropagation()}break}}};u.prototype={handleEvent:function(e){switch(e.type){case"touchstart":case"MSPointerDown":case"mousedown":this._start(e);break;case"touchmove":case"MSPointerMove":case"mousemove":this._move(e);break;case"touchend":case"MSPointerUp":case"mouseup":case"touchcancel":case"MSPointerCancel":case"mousecancel":this._end(e);break}},destroy:function(){if(this.options.interactive){i.removeEvent(this.indicator,"touchstart",this);i.removeEvent(this.indicator,"MSPointerDown",this);i.removeEvent(this.indicator,"mousedown",this);i.removeEvent(e,"touchmove",this);i.removeEvent(e,"MSPointerMove",this);i.removeEvent(e,"mousemove",this);i.removeEvent(e,"touchend",this);i.removeEvent(e,"MSPointerUp",this);i.removeEvent(e,"mouseup",this)}if(this.options.defaultScrollbars){this.wrapper.parentNode.removeChild(this.wrapper)}},_start:function(t){var n=t.touches?t.touches[0]:t;t.preventDefault();t.stopPropagation();this.transitionTime();this.initiated=true;this.moved=false;this.lastPointX=n.pageX;this.lastPointY=n.pageY;this.startTime=i.getTime();if(!this.options.disableTouch){i.addEvent(e,"touchmove",this)}if(!this.options.disablePointer){i.addEvent(e,"MSPointerMove",this)}if(!this.options.disableMouse){i.addEvent(e,"mousemove",this)}this.scroller._execEvent("beforeScrollStart")},_move:function(e){var t=e.touches?e.touches[0]:e,n,r,s,o,u=i.getTime();if(!this.moved){this.scroller._execEvent("scrollStart")}this.moved=true;n=t.pageX-this.lastPointX;this.lastPointX=t.pageX;r=t.pageY-this.lastPointY;this.lastPointY=t.pageY;s=this.x+n;o=this.y+r;this._pos(s,o);e.preventDefault();e.stopPropagation()},_end:function(t){if(!this.initiated){return}this.initiated=false;t.preventDefault();t.stopPropagation();i.removeEvent(e,"touchmove",this);i.removeEvent(e,"MSPointerMove",this);i.removeEvent(e,"mousemove",this);if(this.scroller.options.snap){var r=this.scroller._nearestSnap(this.scroller.x,this.scroller.y);var s=this.options.snapSpeed||n.max(n.max(n.min(n.abs(this.scroller.x-r.x),1e3),n.min(n.abs(this.scroller.y-r.y),1e3)),300);if(this.scroller.x!=r.x||this.scroller.y!=r.y){this.scroller.directionX=0;this.scroller.directionY=0;this.scroller.currentPage=r;this.scroller.scrollTo(r.x,r.y,s,this.scroller.options.bounceEasing)}}if(this.moved){this.scroller._execEvent("scrollEnd")}},transitionTime:function(e){e=e||0;this.indicatorStyle[i.style.transitionDuration]=e+"ms";if(!e&&i.isBadAndroid){this.indicatorStyle[i.style.transitionDuration]="0.001s"}},transitionTimingFunction:function(e){this.indicatorStyle[i.style.transitionTimingFunction]=e},refresh:function(){this.transitionTime();if(this.options.listenX&&!this.options.listenY){this.indicatorStyle.display=this.scroller.hasHorizontalScroll?"block":"none"}else if(this.options.listenY&&!this.options.listenX){this.indicatorStyle.display=this.scroller.hasVerticalScroll?"block":"none"}else{this.indicatorStyle.display=this.scroller.hasHorizontalScroll||this.scroller.hasVerticalScroll?"block":"none"}if(this.scroller.hasHorizontalScroll&&this.scroller.hasVerticalScroll){i.addClass(this.wrapper,"iScrollBothScrollbars");i.removeClass(this.wrapper,"iScrollLoneScrollbar");if(this.options.defaultScrollbars&&this.options.customStyle){if(this.options.listenX){this.wrapper.style.right="8px"}else{this.wrapper.style.bottom="8px"}}}else{i.removeClass(this.wrapper,"iScrollBothScrollbars");i.addClass(this.wrapper,"iScrollLoneScrollbar");if(this.options.defaultScrollbars&&this.options.customStyle){if(this.options.listenX){this.wrapper.style.right="2px"}else{this.wrapper.style.bottom="2px"}}}var e=this.wrapper.offsetHeight;if(this.options.listenX){this.wrapperWidth=this.wrapper.clientWidth;if(this.options.resize){this.indicatorWidth=n.max(n.round(this.wrapperWidth*this.wrapperWidth/(this.scroller.scrollerWidth||this.wrapperWidth||1)),8);this.indicatorStyle.width=this.indicatorWidth+"px"}else{this.indicatorWidth=this.indicator.clientWidth}this.maxPosX=this.wrapperWidth-this.indicatorWidth;if(this.options.shrink=="clip"){this.minBoundaryX=-this.indicatorWidth+8;this.maxBoundaryX=this.wrapperWidth-8}else{this.minBoundaryX=0;this.maxBoundaryX=this.maxPosX}this.sizeRatioX=this.options.speedRatioX||this.scroller.maxScrollX&&this.maxPosX/this.scroller.maxScrollX}if(this.options.listenY){this.wrapperHeight=this.wrapper.clientHeight;if(this.options.resize){this.indicatorHeight=n.max(n.round(this.wrapperHeight*this.wrapperHeight/(this.scroller.scrollerHeight||this.wrapperHeight||1)),8);this.indicatorStyle.height=this.indicatorHeight+"px"}else{this.indicatorHeight=this.indicator.clientHeight}this.maxPosY=this.wrapperHeight-this.indicatorHeight;if(this.options.shrink=="clip"){this.minBoundaryY=-this.indicatorHeight+8;this.maxBoundaryY=this.wrapperHeight-8}else{this.minBoundaryY=0;this.maxBoundaryY=this.maxPosY}this.maxPosY=this.wrapperHeight-this.indicatorHeight;this.sizeRatioY=this.options.speedRatioY||this.scroller.maxScrollY&&this.maxPosY/this.scroller.maxScrollY}this.updatePosition()},updatePosition:function(){var e=this.options.listenX&&n.round(this.sizeRatioX*this.scroller.x)||0,t=this.options.listenY&&n.round(this.sizeRatioY*this.scroller.y)||0;if(!this.options.ignoreBoundaries){if(e<this.minBoundaryX){if(this.options.shrink=="scale"){this.width=n.max(this.indicatorWidth+e,8);this.indicatorStyle.width=this.width+"px"}e=this.minBoundaryX}else if(e>this.maxBoundaryX){if(this.options.shrink=="scale"){this.width=n.max(this.indicatorWidth-(e-this.maxPosX),8);this.indicatorStyle.width=this.width+"px";e=this.maxPosX+this.indicatorWidth-this.width}else{e=this.maxBoundaryX}}else if(this.options.shrink=="scale"&&this.width!=this.indicatorWidth){this.width=this.indicatorWidth;this.indicatorStyle.width=this.width+"px"}if(t<this.minBoundaryY){if(this.options.shrink=="scale"){this.height=n.max(this.indicatorHeight+t*3,8);this.indicatorStyle.height=this.height+"px"}t=this.minBoundaryY}else if(t>this.maxBoundaryY){if(this.options.shrink=="scale"){this.height=n.max(this.indicatorHeight-(t-this.maxPosY)*3,8);this.indicatorStyle.height=this.height+"px";t=this.maxPosY+this.indicatorHeight-this.height}else{t=this.maxBoundaryY}}else if(this.options.shrink=="scale"&&this.height!=this.indicatorHeight){this.height=this.indicatorHeight;this.indicatorStyle.height=this.height+"px"}}this.x=e;this.y=t;if(this.scroller.options.useTransform){this.indicatorStyle[i.style.transform]="translate("+e+"px,"+t+"px)"+this.scroller.translateZ}else{this.indicatorStyle.left=e+"px";this.indicatorStyle.top=t+"px"}},_pos:function(e,t){if(e<0){e=0}else if(e>this.maxPosX){e=this.maxPosX}if(t<0){t=0}else if(t>this.maxPosY){t=this.maxPosY}e=this.options.listenX?n.round(e/this.sizeRatioX):this.scroller.x;t=this.options.listenY?n.round(t/this.sizeRatioY):this.scroller.y;this.scroller.scrollTo(e,t)},fade:function(e,t){if(t&&!this.visible){return}clearTimeout(this.fadeTimeout);this.fadeTimeout=null;var n=e?250:500,r=e?0:300;e=e?"1":"0";this.wrapperStyle[i.style.transitionDuration]=n+"ms";this.fadeTimeout=setTimeout(function(e){this.wrapperStyle.opacity=e;this.visible=+e}.bind(this,e),r)}};s.utils=i;if(typeof module!="undefined"&&module.exports){module.exports=s}else{e.IScroll=s}})(window,document,Math)

// maphilight
(function (G) { var B, J, C, K, N, M, I, E, H, A, L; J = !!document.createElement("canvas").getContext; B = (function () { var P = document.createElement("div"); P.innerHTML = '<v:shape id="vml_flag1" adj="1" />'; var O = P.firstChild; O.style.behavior = "url(#default#VML)"; return O ? typeof O.adj == "object" : true })(); if (!(J || B)) { G.fn.maphilight = function () { return this }; return } if (J) { E = function (O) { return Math.max(0, Math.min(parseInt(O, 16), 255)) }; H = function (O, P) { return "rgba(" + E(O.substr(0, 2)) + "," + E(O.substr(2, 2)) + "," + E(O.substr(4, 2)) + "," + P + ")" }; C = function (O) { var P = G('<canvas style="width:' + O.width + "px;height:" + O.height + 'px;"></canvas>').get(0); P.getContext("2d").clearRect(0, 0, P.width, P.height); return P }; var F = function (Q, O, R, P, S) { P = P || 0; S = S || 0; Q.beginPath(); if (O == "rect") { Q.rect(R[0] + P, R[1] + S, R[2] - R[0], R[3] - R[1]) } else { if (O == "poly") { Q.moveTo(R[0] + P, R[1] + S); for (i = 2; i < R.length; i += 2) { Q.lineTo(R[i] + P, R[i + 1] + S) } } else { if (O == "circ") { Q.arc(R[0] + P, R[1] + S, R[2], 0, Math.PI * 2, false) } } } Q.closePath() }; K = function (Q, T, U, X, O) { var S, P = Q.getContext("2d"); if (X.shadow) { P.save(); if (X.shadowPosition == "inside") { F(P, T, U); P.clip() } var R = Q.width * 100; var W = Q.height * 100; F(P, T, U, R, W); P.shadowOffsetX = X.shadowX - R; P.shadowOffsetY = X.shadowY - W; P.shadowBlur = X.shadowRadius; P.shadowColor = H(X.shadowColor, X.shadowOpacity); var V = X.shadowFrom; if (!V) { if (X.shadowPosition == "outside") { V = "fill" } else { V = "stroke" } } if (V == "stroke") { P.strokeStyle = "rgba(0,0,0,1)"; P.stroke() } else { if (V == "fill") { P.fillStyle = "rgba(0,0,0,1)"; P.fill() } } P.restore(); if (X.shadowPosition == "outside") { P.save(); F(P, T, U); P.globalCompositeOperation = "destination-out"; P.fillStyle = "rgba(0,0,0,1);"; P.fill(); P.restore() } } P.save(); F(P, T, U); if (X.fill) { P.fillStyle = H(X.fillColor, X.fillOpacity); P.fill() } if (X.stroke) { P.strokeStyle = H(X.strokeColor, X.strokeOpacity); P.lineWidth = X.strokeWidth; P.stroke() } P.restore(); if (X.fade) { G(Q).css("opacity", 0).animate({ opacity: 1 }, 100) } }; N = function (O) { O.getContext("2d").clearRect(0, 0, O.width, O.height) } } else { C = function (O) { return G('<var style="zoom:1;overflow:hidden;display:block;width:' + O.width + "px;height:" + O.height + 'px;"></var>').get(0) }; K = function (P, T, U, X, O) { var V, W, R, S; for (var Q in U) { U[Q] = parseInt(U[Q], 10) } V = '<v:fill color="#' + X.fillColor + '" opacity="' + (X.fill ? X.fillOpacity : 0) + '" />'; W = (X.stroke ? 'strokeweight="' + X.strokeWidth + '" stroked="t" strokecolor="#' + X.strokeColor + '"' : 'stroked="f"'); R = '<v:stroke opacity="' + X.strokeOpacity + '"/>'; if (T == "rect") { S = G('<v:rect name="' + O + '" filled="t" ' + W + ' style="zoom:1;margin:0;padding:0;display:block;position:absolute;left:' + U[0] + "px;top:" + U[1] + "px;width:" + (U[2] - U[0]) + "px;height:" + (U[3] - U[1]) + 'px;"></v:rect>') } else { if (T == "poly") { S = G('<v:shape name="' + O + '" filled="t" ' + W + ' coordorigin="0,0" coordsize="' + P.width + "," + P.height + '" path="m ' + U[0] + "," + U[1] + " l " + U.join(",") + ' x e" style="zoom:1;margin:0;padding:0;display:block;position:absolute;top:0px;left:0px;width:' + P.width + "px;height:" + P.height + 'px;"></v:shape>') } else { if (T == "circ") { S = G('<v:oval name="' + O + '" filled="t" ' + W + ' style="zoom:1;margin:0;padding:0;display:block;position:absolute;left:' + (U[0] - U[2]) + "px;top:" + (U[1] - U[2]) + "px;width:" + (U[2] * 2) + "px;height:" + (U[2] * 2) + 'px;"></v:oval>') } } } S.get(0).innerHTML = V + R; G(P).append(S) }; N = function (P) { var O = G("<div>" + P.innerHTML + "</div>"); O.children("[name=highlighted]").remove(); P.innerHTML = O.html() } } M = function (P) { var O, Q = P.getAttribute("coords").split(","); for (O = 0; O < Q.length; O++) { Q[O] = parseFloat(Q[O]) } return [P.getAttribute("shape").toLowerCase().substr(0, 4), Q] }; L = function (Q, P) { var O = G(Q); return G.extend({}, P, G.metadata ? O.metadata() : false, O.data("maphilight")) }; A = function (O) { if (!O.complete) { return false } if (typeof O.naturalWidth != "undefined" && O.naturalWidth === 0) { return false } return true }; I = { position: "absolute", left: 0, top: 0, padding: 0, border: 0 }; var D = false; G.fn.maphilight = function (O) { O = G.extend({}, G.fn.maphilight.defaults, O); if (!J && !D) { G(window).ready(function () { document.namespaces.add("v", "urn:schemas-microsoft-com:vml"); var Q = document.createStyleSheet(); var P = ["shape", "rect", "oval", "circ", "fill", "stroke", "imagedata", "group", "textbox"]; G.each(P, function () { Q.addRule("v\\:" + this, "behavior: url(#default#VML); antialias:true") }) }); D = true } return this.each(function () { var U, R, Y, Q, T, V, X, S, W; U = G(this); if (!A(this)) { return window.setTimeout(function () { U.maphilight(O) }, 200) } Y = G.extend({}, O, G.metadata ? U.metadata() : false, U.data("maphilight")); W = U.get(0).getAttribute("usemap"); if (!W) { return } Q = G('map[name="' + W.substr(1) + '"]'); if (!(U.is('img,input[type="image"]') && W && Q.size() > 0)) { return } if (U.hasClass("maphilighted")) { var P = U.parent(); U.insertBefore(P); P.remove(); G(Q).unbind(".maphilight").find("area[coords]").unbind(".maphilight") } R = G("<div></div>").css({ display: "block", background: 'url("' + this.src + '")', position: "relative", padding: 0, width: this.width, height: this.height }); if (Y.wrapClass) { if (Y.wrapClass === true) { R.addClass(G(this).attr("class")) } else { R.addClass(Y.wrapClass) } } U.before(R).css("opacity", 0).css(I).remove(); if (B) { U.css("filter", "Alpha(opacity=0)") } R.append(U); T = C(this); G(T).css(I); T.height = this.height; T.width = this.width; X = function (c) { var a, b; b = L(this, Y); if (!b.neverOn && !b.alwaysOn) { a = M(this); K(T, a[0], a[1], b, "highlighted"); if (b.groupBy) { var Z; if (/^[a-zA-Z][\-a-zA-Z]+$/.test(b.groupBy)) { Z = Q.find("area[" + b.groupBy + '="' + G(this).attr(b.groupBy) + '"]') } else { Z = Q.find(b.groupBy) } var d = this; Z.each(function () { if (this != d) { var f = L(this, Y); if (!f.neverOn && !f.alwaysOn) { var e = M(this); K(T, e[0], e[1], f, "highlighted") } } }) } if (!J) { G(T).append("<v:rect></v:rect>") } } }; G(Q).bind("alwaysOn.maphilight", function () { if (V) { N(V) } if (!J) { G(T).empty() } G(Q).find("area[coords]").each(function () { var Z, a; a = L(this, Y); if (a.alwaysOn) { if (!V && J) { V = C(U[0]); G(V).css(I); V.width = U[0].width; V.height = U[0].height; U.before(V) } a.fade = a.alwaysOnFade; Z = M(this); if (J) { K(V, Z[0], Z[1], a, "") } else { K(T, Z[0], Z[1], a, "") } } }) }); G(Q).trigger("alwaysOn.maphilight").find("area[coords]").bind("mouseover.maphilight", X).bind("mouseout.maphilight", function (Z) { N(T) }); U.before(T); U.addClass("maphilighted") }) }; G.fn.maphilight.defaults = { fill: true, fillColor: "000000", fillOpacity: 0.2, stroke: true, strokeColor: "ff0000", strokeOpacity: 1, strokeWidth: 1, fade: true, alwaysOn: false, neverOn: false, groupBy: false, wrapClass: true, shadow: false, shadowX: 0, shadowY: 0, shadowRadius: 6, shadowColor: "000000", shadowOpacity: 0.8, shadowPosition: "outside", shadowFrom: false } })(jQuery);






/* QRCode */
var QRCode; !function () { function a(a) { this.mode = c.MODE_8BIT_BYTE, this.data = a, this.parsedData = []; for (var b = [], d = 0, e = this.data.length; e > d; d++) { var f = this.data.charCodeAt(d); f > 65536 ? (b[0] = 240 | (1835008 & f) >>> 18, b[1] = 128 | (258048 & f) >>> 12, b[2] = 128 | (4032 & f) >>> 6, b[3] = 128 | 63 & f) : f > 2048 ? (b[0] = 224 | (61440 & f) >>> 12, b[1] = 128 | (4032 & f) >>> 6, b[2] = 128 | 63 & f) : f > 128 ? (b[0] = 192 | (1984 & f) >>> 6, b[1] = 128 | 63 & f) : b[0] = f, this.parsedData = this.parsedData.concat(b) } this.parsedData.length != this.data.length && (this.parsedData.unshift(191), this.parsedData.unshift(187), this.parsedData.unshift(239)) } function b(a, b) { this.typeNumber = a, this.errorCorrectLevel = b, this.modules = null, this.moduleCount = 0, this.dataCache = null, this.dataList = [] } function i(a, b) { if (void 0 == a.length) throw new Error(a.length + "/" + b); for (var c = 0; c < a.length && 0 == a[c];) c++; this.num = new Array(a.length - c + b); for (var d = 0; d < a.length - c; d++) this.num[d] = a[d + c] } function j(a, b) { this.totalCount = a, this.dataCount = b } function k() { this.buffer = [], this.length = 0 } function m() { return "undefined" != typeof CanvasRenderingContext2D } function n() { var a = !1, b = navigator.userAgent; return /android/i.test(b) && (a = !0, aMat = b.toString().match(/android ([0-9]\.[0-9])/i), aMat && aMat[1] && (a = parseFloat(aMat[1]))), a } function r(a, b) { for (var c = 1, e = s(a), f = 0, g = l.length; g >= f; f++) { var h = 0; switch (b) { case d.L: h = l[f][0]; break; case d.M: h = l[f][1]; break; case d.Q: h = l[f][2]; break; case d.H: h = l[f][3] } if (h >= e) break; c++ } if (c > l.length) throw new Error("Too long data"); return c } function s(a) { var b = encodeURI(a).toString().replace(/\%[0-9a-fA-F]{2}/g, "a"); return b.length + (b.length != a ? 3 : 0) } a.prototype = { getLength: function () { return this.parsedData.length }, write: function (a) { for (var b = 0, c = this.parsedData.length; c > b; b++) a.put(this.parsedData[b], 8) } }, b.prototype = { addData: function (b) { var c = new a(b); this.dataList.push(c), this.dataCache = null }, isDark: function (a, b) { if (0 > a || this.moduleCount <= a || 0 > b || this.moduleCount <= b) throw new Error(a + "," + b); return this.modules[a][b] }, getModuleCount: function () { return this.moduleCount }, make: function () { this.makeImpl(!1, this.getBestMaskPattern()) }, makeImpl: function (a, c) { this.moduleCount = 4 * this.typeNumber + 17, this.modules = new Array(this.moduleCount); for (var d = 0; d < this.moduleCount; d++) { this.modules[d] = new Array(this.moduleCount); for (var e = 0; e < this.moduleCount; e++) this.modules[d][e] = null } this.setupPositionProbePattern(0, 0), this.setupPositionProbePattern(this.moduleCount - 7, 0), this.setupPositionProbePattern(0, this.moduleCount - 7), this.setupPositionAdjustPattern(), this.setupTimingPattern(), this.setupTypeInfo(a, c), this.typeNumber >= 7 && this.setupTypeNumber(a), null == this.dataCache && (this.dataCache = b.createData(this.typeNumber, this.errorCorrectLevel, this.dataList)), this.mapData(this.dataCache, c) }, setupPositionProbePattern: function (a, b) { for (var c = -1; 7 >= c; c++) if (!(-1 >= a + c || this.moduleCount <= a + c)) for (var d = -1; 7 >= d; d++) -1 >= b + d || this.moduleCount <= b + d || (this.modules[a + c][b + d] = c >= 0 && 6 >= c && (0 == d || 6 == d) || d >= 0 && 6 >= d && (0 == c || 6 == c) || c >= 2 && 4 >= c && d >= 2 && 4 >= d ? !0 : !1) }, getBestMaskPattern: function () { for (var a = 0, b = 0, c = 0; 8 > c; c++) { this.makeImpl(!0, c); var d = f.getLostPoint(this); (0 == c || a > d) && (a = d, b = c) } return b }, createMovieClip: function (a, b, c) { var d = a.createEmptyMovieClip(b, c), e = 1; this.make(); for (var f = 0; f < this.modules.length; f++) for (var g = f * e, h = 0; h < this.modules[f].length; h++) { var i = h * e, j = this.modules[f][h]; j && (d.beginFill(0, 100), d.moveTo(i, g), d.lineTo(i + e, g), d.lineTo(i + e, g + e), d.lineTo(i, g + e), d.endFill()) } return d }, setupTimingPattern: function () { for (var a = 8; a < this.moduleCount - 8; a++) null == this.modules[a][6] && (this.modules[a][6] = 0 == a % 2); for (var b = 8; b < this.moduleCount - 8; b++) null == this.modules[6][b] && (this.modules[6][b] = 0 == b % 2) }, setupPositionAdjustPattern: function () { for (var a = f.getPatternPosition(this.typeNumber), b = 0; b < a.length; b++) for (var c = 0; c < a.length; c++) { var d = a[b], e = a[c]; if (null == this.modules[d][e]) for (var g = -2; 2 >= g; g++) for (var h = -2; 2 >= h; h++) this.modules[d + g][e + h] = -2 == g || 2 == g || -2 == h || 2 == h || 0 == g && 0 == h ? !0 : !1 } }, setupTypeNumber: function (a) { for (var b = f.getBCHTypeNumber(this.typeNumber), c = 0; 18 > c; c++) { var d = !a && 1 == (1 & b >> c); this.modules[Math.floor(c / 3)][c % 3 + this.moduleCount - 8 - 3] = d } for (var c = 0; 18 > c; c++) { var d = !a && 1 == (1 & b >> c); this.modules[c % 3 + this.moduleCount - 8 - 3][Math.floor(c / 3)] = d } }, setupTypeInfo: function (a, b) { for (var c = this.errorCorrectLevel << 3 | b, d = f.getBCHTypeInfo(c), e = 0; 15 > e; e++) { var g = !a && 1 == (1 & d >> e); 6 > e ? this.modules[e][8] = g : 8 > e ? this.modules[e + 1][8] = g : this.modules[this.moduleCount - 15 + e][8] = g } for (var e = 0; 15 > e; e++) { var g = !a && 1 == (1 & d >> e); 8 > e ? this.modules[8][this.moduleCount - e - 1] = g : 9 > e ? this.modules[8][15 - e - 1 + 1] = g : this.modules[8][15 - e - 1] = g } this.modules[this.moduleCount - 8][8] = !a }, mapData: function (a, b) { for (var c = -1, d = this.moduleCount - 1, e = 7, g = 0, h = this.moduleCount - 1; h > 0; h -= 2) for (6 == h && h--; ;) { for (var i = 0; 2 > i; i++) if (null == this.modules[d][h - i]) { var j = !1; g < a.length && (j = 1 == (1 & a[g] >>> e)); var k = f.getMask(b, d, h - i); k && (j = !j), this.modules[d][h - i] = j, e-- , -1 == e && (g++ , e = 7) } if (d += c, 0 > d || this.moduleCount <= d) { d -= c, c = -c; break } } } }, b.PAD0 = 236, b.PAD1 = 17, b.createData = function (a, c, d) { for (var e = j.getRSBlocks(a, c), g = new k, h = 0; h < d.length; h++) { var i = d[h]; g.put(i.mode, 4), g.put(i.getLength(), f.getLengthInBits(i.mode, a)), i.write(g) } for (var l = 0, h = 0; h < e.length; h++) l += e[h].dataCount; if (g.getLengthInBits() > 8 * l) throw new Error("code length overflow. (" + g.getLengthInBits() + ">" + 8 * l + ")"); for (g.getLengthInBits() + 4 <= 8 * l && g.put(0, 4); 0 != g.getLengthInBits() % 8;) g.putBit(!1); for (; ;) { if (g.getLengthInBits() >= 8 * l) break; if (g.put(b.PAD0, 8), g.getLengthInBits() >= 8 * l) break; g.put(b.PAD1, 8) } return b.createBytes(g, e) }, b.createBytes = function (a, b) { for (var c = 0, d = 0, e = 0, g = new Array(b.length), h = new Array(b.length), j = 0; j < b.length; j++) { var k = b[j].dataCount, l = b[j].totalCount - k; d = Math.max(d, k), e = Math.max(e, l), g[j] = new Array(k); for (var m = 0; m < g[j].length; m++) g[j][m] = 255 & a.buffer[m + c]; c += k; var n = f.getErrorCorrectPolynomial(l), o = new i(g[j], n.getLength() - 1), p = o.mod(n); h[j] = new Array(n.getLength() - 1); for (var m = 0; m < h[j].length; m++) { var q = m + p.getLength() - h[j].length; h[j][m] = q >= 0 ? p.get(q) : 0 } } for (var r = 0, m = 0; m < b.length; m++) r += b[m].totalCount; for (var s = new Array(r), t = 0, m = 0; d > m; m++) for (var j = 0; j < b.length; j++) m < g[j].length && (s[t++] = g[j][m]); for (var m = 0; e > m; m++) for (var j = 0; j < b.length; j++) m < h[j].length && (s[t++] = h[j][m]); return s }; for (var c = { MODE_NUMBER: 1, MODE_ALPHA_NUM: 2, MODE_8BIT_BYTE: 4, MODE_KANJI: 8 }, d = { L: 1, M: 0, Q: 3, H: 2 }, e = { PATTERN000: 0, PATTERN001: 1, PATTERN010: 2, PATTERN011: 3, PATTERN100: 4, PATTERN101: 5, PATTERN110: 6, PATTERN111: 7 }, f = { PATTERN_POSITION_TABLE: [[], [6, 18], [6, 22], [6, 26], [6, 30], [6, 34], [6, 22, 38], [6, 24, 42], [6, 26, 46], [6, 28, 50], [6, 30, 54], [6, 32, 58], [6, 34, 62], [6, 26, 46, 66], [6, 26, 48, 70], [6, 26, 50, 74], [6, 30, 54, 78], [6, 30, 56, 82], [6, 30, 58, 86], [6, 34, 62, 90], [6, 28, 50, 72, 94], [6, 26, 50, 74, 98], [6, 30, 54, 78, 102], [6, 28, 54, 80, 106], [6, 32, 58, 84, 110], [6, 30, 58, 86, 114], [6, 34, 62, 90, 118], [6, 26, 50, 74, 98, 122], [6, 30, 54, 78, 102, 126], [6, 26, 52, 78, 104, 130], [6, 30, 56, 82, 108, 134], [6, 34, 60, 86, 112, 138], [6, 30, 58, 86, 114, 142], [6, 34, 62, 90, 118, 146], [6, 30, 54, 78, 102, 126, 150], [6, 24, 50, 76, 102, 128, 154], [6, 28, 54, 80, 106, 132, 158], [6, 32, 58, 84, 110, 136, 162], [6, 26, 54, 82, 110, 138, 166], [6, 30, 58, 86, 114, 142, 170]], G15: 1335, G18: 7973, G15_MASK: 21522, getBCHTypeInfo: function (a) { for (var b = a << 10; f.getBCHDigit(b) - f.getBCHDigit(f.G15) >= 0;) b ^= f.G15 << f.getBCHDigit(b) - f.getBCHDigit(f.G15); return (a << 10 | b) ^ f.G15_MASK }, getBCHTypeNumber: function (a) { for (var b = a << 12; f.getBCHDigit(b) - f.getBCHDigit(f.G18) >= 0;) b ^= f.G18 << f.getBCHDigit(b) - f.getBCHDigit(f.G18); return a << 12 | b }, getBCHDigit: function (a) { for (var b = 0; 0 != a;) b++ , a >>>= 1; return b }, getPatternPosition: function (a) { return f.PATTERN_POSITION_TABLE[a - 1] }, getMask: function (a, b, c) { switch (a) { case e.PATTERN000: return 0 == (b + c) % 2; case e.PATTERN001: return 0 == b % 2; case e.PATTERN010: return 0 == c % 3; case e.PATTERN011: return 0 == (b + c) % 3; case e.PATTERN100: return 0 == (Math.floor(b / 2) + Math.floor(c / 3)) % 2; case e.PATTERN101: return 0 == b * c % 2 + b * c % 3; case e.PATTERN110: return 0 == (b * c % 2 + b * c % 3) % 2; case e.PATTERN111: return 0 == (b * c % 3 + (b + c) % 2) % 2; default: throw new Error("bad maskPattern:" + a) } }, getErrorCorrectPolynomial: function (a) { for (var b = new i([1], 0), c = 0; a > c; c++) b = b.multiply(new i([1, g.gexp(c)], 0)); return b }, getLengthInBits: function (a, b) { if (b >= 1 && 10 > b) switch (a) { case c.MODE_NUMBER: return 10; case c.MODE_ALPHA_NUM: return 9; case c.MODE_8BIT_BYTE: return 8; case c.MODE_KANJI: return 8; default: throw new Error("mode:" + a) } else if (27 > b) switch (a) { case c.MODE_NUMBER: return 12; case c.MODE_ALPHA_NUM: return 11; case c.MODE_8BIT_BYTE: return 16; case c.MODE_KANJI: return 10; default: throw new Error("mode:" + a) } else { if (!(41 > b)) throw new Error("type:" + b); switch (a) { case c.MODE_NUMBER: return 14; case c.MODE_ALPHA_NUM: return 13; case c.MODE_8BIT_BYTE: return 16; case c.MODE_KANJI: return 12; default: throw new Error("mode:" + a) } } }, getLostPoint: function (a) { for (var b = a.getModuleCount(), c = 0, d = 0; b > d; d++) for (var e = 0; b > e; e++) { for (var f = 0, g = a.isDark(d, e), h = -1; 1 >= h; h++) if (!(0 > d + h || d + h >= b)) for (var i = -1; 1 >= i; i++) 0 > e + i || e + i >= b || (0 != h || 0 != i) && g == a.isDark(d + h, e + i) && f++; f > 5 && (c += 3 + f - 5) } for (var d = 0; b - 1 > d; d++) for (var e = 0; b - 1 > e; e++) { var j = 0; a.isDark(d, e) && j++ , a.isDark(d + 1, e) && j++ , a.isDark(d, e + 1) && j++ , a.isDark(d + 1, e + 1) && j++ , (0 == j || 4 == j) && (c += 3) } for (var d = 0; b > d; d++) for (var e = 0; b - 6 > e; e++) a.isDark(d, e) && !a.isDark(d, e + 1) && a.isDark(d, e + 2) && a.isDark(d, e + 3) && a.isDark(d, e + 4) && !a.isDark(d, e + 5) && a.isDark(d, e + 6) && (c += 40); for (var e = 0; b > e; e++) for (var d = 0; b - 6 > d; d++) a.isDark(d, e) && !a.isDark(d + 1, e) && a.isDark(d + 2, e) && a.isDark(d + 3, e) && a.isDark(d + 4, e) && !a.isDark(d + 5, e) && a.isDark(d + 6, e) && (c += 40); for (var k = 0, e = 0; b > e; e++) for (var d = 0; b > d; d++) a.isDark(d, e) && k++; var l = Math.abs(100 * k / b / b - 50) / 5; return c += 10 * l } }, g = { glog: function (a) { if (1 > a) throw new Error("glog(" + a + ")"); return g.LOG_TABLE[a] }, gexp: function (a) { for (; 0 > a;) a += 255; for (; a >= 256;) a -= 255; return g.EXP_TABLE[a] }, EXP_TABLE: new Array(256), LOG_TABLE: new Array(256) }, h = 0; 8 > h; h++) g.EXP_TABLE[h] = 1 << h; for (var h = 8; 256 > h; h++) g.EXP_TABLE[h] = g.EXP_TABLE[h - 4] ^ g.EXP_TABLE[h - 5] ^ g.EXP_TABLE[h - 6] ^ g.EXP_TABLE[h - 8]; for (var h = 0; 255 > h; h++) g.LOG_TABLE[g.EXP_TABLE[h]] = h; i.prototype = { get: function (a) { return this.num[a] }, getLength: function () { return this.num.length }, multiply: function (a) { for (var b = new Array(this.getLength() + a.getLength() - 1), c = 0; c < this.getLength(); c++) for (var d = 0; d < a.getLength(); d++) b[c + d] ^= g.gexp(g.glog(this.get(c)) + g.glog(a.get(d))); return new i(b, 0) }, mod: function (a) { if (this.getLength() - a.getLength() < 0) return this; for (var b = g.glog(this.get(0)) - g.glog(a.get(0)), c = new Array(this.getLength()), d = 0; d < this.getLength(); d++) c[d] = this.get(d); for (var d = 0; d < a.getLength(); d++) c[d] ^= g.gexp(g.glog(a.get(d)) + b); return new i(c, 0).mod(a) } }, j.RS_BLOCK_TABLE = [[1, 26, 19], [1, 26, 16], [1, 26, 13], [1, 26, 9], [1, 44, 34], [1, 44, 28], [1, 44, 22], [1, 44, 16], [1, 70, 55], [1, 70, 44], [2, 35, 17], [2, 35, 13], [1, 100, 80], [2, 50, 32], [2, 50, 24], [4, 25, 9], [1, 134, 108], [2, 67, 43], [2, 33, 15, 2, 34, 16], [2, 33, 11, 2, 34, 12], [2, 86, 68], [4, 43, 27], [4, 43, 19], [4, 43, 15], [2, 98, 78], [4, 49, 31], [2, 32, 14, 4, 33, 15], [4, 39, 13, 1, 40, 14], [2, 121, 97], [2, 60, 38, 2, 61, 39], [4, 40, 18, 2, 41, 19], [4, 40, 14, 2, 41, 15], [2, 146, 116], [3, 58, 36, 2, 59, 37], [4, 36, 16, 4, 37, 17], [4, 36, 12, 4, 37, 13], [2, 86, 68, 2, 87, 69], [4, 69, 43, 1, 70, 44], [6, 43, 19, 2, 44, 20], [6, 43, 15, 2, 44, 16], [4, 101, 81], [1, 80, 50, 4, 81, 51], [4, 50, 22, 4, 51, 23], [3, 36, 12, 8, 37, 13], [2, 116, 92, 2, 117, 93], [6, 58, 36, 2, 59, 37], [4, 46, 20, 6, 47, 21], [7, 42, 14, 4, 43, 15], [4, 133, 107], [8, 59, 37, 1, 60, 38], [8, 44, 20, 4, 45, 21], [12, 33, 11, 4, 34, 12], [3, 145, 115, 1, 146, 116], [4, 64, 40, 5, 65, 41], [11, 36, 16, 5, 37, 17], [11, 36, 12, 5, 37, 13], [5, 109, 87, 1, 110, 88], [5, 65, 41, 5, 66, 42], [5, 54, 24, 7, 55, 25], [11, 36, 12], [5, 122, 98, 1, 123, 99], [7, 73, 45, 3, 74, 46], [15, 43, 19, 2, 44, 20], [3, 45, 15, 13, 46, 16], [1, 135, 107, 5, 136, 108], [10, 74, 46, 1, 75, 47], [1, 50, 22, 15, 51, 23], [2, 42, 14, 17, 43, 15], [5, 150, 120, 1, 151, 121], [9, 69, 43, 4, 70, 44], [17, 50, 22, 1, 51, 23], [2, 42, 14, 19, 43, 15], [3, 141, 113, 4, 142, 114], [3, 70, 44, 11, 71, 45], [17, 47, 21, 4, 48, 22], [9, 39, 13, 16, 40, 14], [3, 135, 107, 5, 136, 108], [3, 67, 41, 13, 68, 42], [15, 54, 24, 5, 55, 25], [15, 43, 15, 10, 44, 16], [4, 144, 116, 4, 145, 117], [17, 68, 42], [17, 50, 22, 6, 51, 23], [19, 46, 16, 6, 47, 17], [2, 139, 111, 7, 140, 112], [17, 74, 46], [7, 54, 24, 16, 55, 25], [34, 37, 13], [4, 151, 121, 5, 152, 122], [4, 75, 47, 14, 76, 48], [11, 54, 24, 14, 55, 25], [16, 45, 15, 14, 46, 16], [6, 147, 117, 4, 148, 118], [6, 73, 45, 14, 74, 46], [11, 54, 24, 16, 55, 25], [30, 46, 16, 2, 47, 17], [8, 132, 106, 4, 133, 107], [8, 75, 47, 13, 76, 48], [7, 54, 24, 22, 55, 25], [22, 45, 15, 13, 46, 16], [10, 142, 114, 2, 143, 115], [19, 74, 46, 4, 75, 47], [28, 50, 22, 6, 51, 23], [33, 46, 16, 4, 47, 17], [8, 152, 122, 4, 153, 123], [22, 73, 45, 3, 74, 46], [8, 53, 23, 26, 54, 24], [12, 45, 15, 28, 46, 16], [3, 147, 117, 10, 148, 118], [3, 73, 45, 23, 74, 46], [4, 54, 24, 31, 55, 25], [11, 45, 15, 31, 46, 16], [7, 146, 116, 7, 147, 117], [21, 73, 45, 7, 74, 46], [1, 53, 23, 37, 54, 24], [19, 45, 15, 26, 46, 16], [5, 145, 115, 10, 146, 116], [19, 75, 47, 10, 76, 48], [15, 54, 24, 25, 55, 25], [23, 45, 15, 25, 46, 16], [13, 145, 115, 3, 146, 116], [2, 74, 46, 29, 75, 47], [42, 54, 24, 1, 55, 25], [23, 45, 15, 28, 46, 16], [17, 145, 115], [10, 74, 46, 23, 75, 47], [10, 54, 24, 35, 55, 25], [19, 45, 15, 35, 46, 16], [17, 145, 115, 1, 146, 116], [14, 74, 46, 21, 75, 47], [29, 54, 24, 19, 55, 25], [11, 45, 15, 46, 46, 16], [13, 145, 115, 6, 146, 116], [14, 74, 46, 23, 75, 47], [44, 54, 24, 7, 55, 25], [59, 46, 16, 1, 47, 17], [12, 151, 121, 7, 152, 122], [12, 75, 47, 26, 76, 48], [39, 54, 24, 14, 55, 25], [22, 45, 15, 41, 46, 16], [6, 151, 121, 14, 152, 122], [6, 75, 47, 34, 76, 48], [46, 54, 24, 10, 55, 25], [2, 45, 15, 64, 46, 16], [17, 152, 122, 4, 153, 123], [29, 74, 46, 14, 75, 47], [49, 54, 24, 10, 55, 25], [24, 45, 15, 46, 46, 16], [4, 152, 122, 18, 153, 123], [13, 74, 46, 32, 75, 47], [48, 54, 24, 14, 55, 25], [42, 45, 15, 32, 46, 16], [20, 147, 117, 4, 148, 118], [40, 75, 47, 7, 76, 48], [43, 54, 24, 22, 55, 25], [10, 45, 15, 67, 46, 16], [19, 148, 118, 6, 149, 119], [18, 75, 47, 31, 76, 48], [34, 54, 24, 34, 55, 25], [20, 45, 15, 61, 46, 16]], j.getRSBlocks = function (a, b) { var c = j.getRsBlockTable(a, b); if (void 0 == c) throw new Error("bad rs block @ typeNumber:" + a + "/errorCorrectLevel:" + b); for (var d = c.length / 3, e = [], f = 0; d > f; f++) for (var g = c[3 * f + 0], h = c[3 * f + 1], i = c[3 * f + 2], k = 0; g > k; k++) e.push(new j(h, i)); return e }, j.getRsBlockTable = function (a, b) { switch (b) { case d.L: return j.RS_BLOCK_TABLE[4 * (a - 1) + 0]; case d.M: return j.RS_BLOCK_TABLE[4 * (a - 1) + 1]; case d.Q: return j.RS_BLOCK_TABLE[4 * (a - 1) + 2]; case d.H: return j.RS_BLOCK_TABLE[4 * (a - 1) + 3]; default: return void 0 } }, k.prototype = { get: function (a) { var b = Math.floor(a / 8); return 1 == (1 & this.buffer[b] >>> 7 - a % 8) }, put: function (a, b) { for (var c = 0; b > c; c++) this.putBit(1 == (1 & a >>> b - c - 1)) }, getLengthInBits: function () { return this.length }, putBit: function (a) { var b = Math.floor(this.length / 8); this.buffer.length <= b && this.buffer.push(0), a && (this.buffer[b] |= 128 >>> this.length % 8), this.length++ } }; var l = [[17, 14, 11, 7], [32, 26, 20, 14], [53, 42, 32, 24], [78, 62, 46, 34], [106, 84, 60, 44], [134, 106, 74, 58], [154, 122, 86, 64], [192, 152, 108, 84], [230, 180, 130, 98], [271, 213, 151, 119], [321, 251, 177, 137], [367, 287, 203, 155], [425, 331, 241, 177], [458, 362, 258, 194], [520, 412, 292, 220], [586, 450, 322, 250], [644, 504, 364, 280], [718, 560, 394, 310], [792, 624, 442, 338], [858, 666, 482, 382], [929, 711, 509, 403], [1003, 779, 565, 439], [1091, 857, 611, 461], [1171, 911, 661, 511], [1273, 997, 715, 535], [1367, 1059, 751, 593], [1465, 1125, 805, 625], [1528, 1190, 868, 658], [1628, 1264, 908, 698], [1732, 1370, 982, 742], [1840, 1452, 1030, 790], [1952, 1538, 1112, 842], [2068, 1628, 1168, 898], [2188, 1722, 1228, 958], [2303, 1809, 1283, 983], [2431, 1911, 1351, 1051], [2563, 1989, 1423, 1093], [2699, 2099, 1499, 1139], [2809, 2213, 1579, 1219], [2953, 2331, 1663, 1273]], o = function () { var a = function (a, b) { this._el = a, this._htOption = b }; return a.prototype.draw = function (a) { function g(a, b) { var c = document.createElementNS("http://www.w3.org/2000/svg", a); for (var d in b) b.hasOwnProperty(d) && c.setAttribute(d, b[d]); return c } var b = this._htOption, c = this._el, d = a.getModuleCount(); Math.floor(b.width / d), Math.floor(b.height / d), this.clear(); var h = g("svg", { viewBox: "0 0 " + String(d) + " " + String(d), width: "100%", height: "100%", fill: b.colorLight }); h.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:xlink", "http://www.w3.org/1999/xlink"), c.appendChild(h), h.appendChild(g("rect", { fill: b.colorDark, width: "1", height: "1", id: "template" })); for (var i = 0; d > i; i++) for (var j = 0; d > j; j++) if (a.isDark(i, j)) { var k = g("use", { x: String(i), y: String(j) }); k.setAttributeNS("http://www.w3.org/1999/xlink", "href", "#template"), h.appendChild(k) } }, a.prototype.clear = function () { for (; this._el.hasChildNodes();) this._el.removeChild(this._el.lastChild) }, a }(), p = "svg" === document.documentElement.tagName.toLowerCase(), q = p ? o : m() ? function () { function a() { this._elImage.src = this._elCanvas.toDataURL("image/png"), this._elImage.style.display = "block", this._elCanvas.style.display = "none" } function d(a, b) { var c = this; if (c._fFail = b, c._fSuccess = a, null === c._bSupportDataURI) { var d = document.createElement("img"), e = function () { c._bSupportDataURI = !1, c._fFail && _fFail.call(c) }, f = function () { c._bSupportDataURI = !0, c._fSuccess && c._fSuccess.call(c) }; return d.onabort = e, d.onerror = e, d.onload = f, d.src = "data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==", void 0 } c._bSupportDataURI === !0 && c._fSuccess ? c._fSuccess.call(c) : c._bSupportDataURI === !1 && c._fFail && c._fFail.call(c) } if (this._android && this._android <= 2.1) { var b = 1 / window.devicePixelRatio, c = CanvasRenderingContext2D.prototype.drawImage; CanvasRenderingContext2D.prototype.drawImage = function (a, d, e, f, g, h, i, j) { if ("nodeName" in a && /img/i.test(a.nodeName)) for (var l = arguments.length - 1; l >= 1; l--) arguments[l] = arguments[l] * b; else "undefined" == typeof j && (arguments[1] *= b, arguments[2] *= b, arguments[3] *= b, arguments[4] *= b); c.apply(this, arguments) } } var e = function (a, b) { this._bIsPainted = !1, this._android = n(), this._htOption = b, this._elCanvas = document.createElement("canvas"), this._elCanvas.width = b.width, this._elCanvas.height = b.height, a.appendChild(this._elCanvas), this._el = a, this._oContext = this._elCanvas.getContext("2d"), this._bIsPainted = !1, this._elImage = document.createElement("img"), this._elImage.style.display = "none", this._el.appendChild(this._elImage), this._bSupportDataURI = null }; return e.prototype.draw = function (a) { var b = this._elImage, c = this._oContext, d = this._htOption, e = a.getModuleCount(), f = d.width / e, g = d.height / e, h = Math.round(f), i = Math.round(g); b.style.display = "none", this.clear(); for (var j = 0; e > j; j++) for (var k = 0; e > k; k++) { var l = a.isDark(j, k), m = k * f, n = j * g; c.strokeStyle = l ? d.colorDark : d.colorLight, c.lineWidth = 1, c.fillStyle = l ? d.colorDark : d.colorLight, c.fillRect(m, n, f, g), c.strokeRect(Math.floor(m) + .5, Math.floor(n) + .5, h, i), c.strokeRect(Math.ceil(m) - .5, Math.ceil(n) - .5, h, i) } this._bIsPainted = !0 }, e.prototype.makeImage = function () { this._bIsPainted && d.call(this, a) }, e.prototype.isPainted = function () { return this._bIsPainted }, e.prototype.clear = function () { this._oContext.clearRect(0, 0, this._elCanvas.width, this._elCanvas.height), this._bIsPainted = !1 }, e.prototype.round = function (a) { return a ? Math.floor(1e3 * a) / 1e3 : a }, e }() : function () { var a = function (a, b) { this._el = a, this._htOption = b }; return a.prototype.draw = function (a) { for (var b = this._htOption, c = this._el, d = a.getModuleCount(), e = Math.floor(b.width / d), f = Math.floor(b.height / d), g = ['<table style="border:0;border-collapse:collapse;">'], h = 0; d > h; h++) { g.push("<tr>"); for (var i = 0; d > i; i++) g.push('<td style="border:0;border-collapse:collapse;padding:0;margin:0;width:' + e + "px;height:" + f + "px;background-color:" + (a.isDark(h, i) ? b.colorDark : b.colorLight) + ';"></td>'); g.push("</tr>") } g.push("</table>"), c.innerHTML = g.join(""); var j = c.childNodes[0], k = (b.width - j.offsetWidth) / 2, l = (b.height - j.offsetHeight) / 2; k > 0 && l > 0 && (j.style.margin = l + "px " + k + "px") }, a.prototype.clear = function () { this._el.innerHTML = "" }, a }(); QRCode = function (a, b) { if (this._htOption = { width: 256, height: 256, typeNumber: 4, colorDark: "#000000", colorLight: "#ffffff", correctLevel: d.H }, "string" == typeof b && (b = { text: b }), b) for (var c in b) this._htOption[c] = b[c]; "string" == typeof a && (a = document.getElementById(a)), this._android = n(), this._el = a, this._oQRCode = null, this._oDrawing = new q(this._el, this._htOption), this._htOption.text && this.makeCode(this._htOption.text) }, QRCode.prototype.makeCode = function (a) { this._oQRCode = new b(r(a, this._htOption.correctLevel), this._htOption.correctLevel), this._oQRCode.addData(a), this._oQRCode.make(), this._el.title = a, this._oDrawing.draw(this._oQRCode), this.makeImage() }, QRCode.prototype.makeImage = function () { "function" == typeof this._oDrawing.makeImage && (!this._android || this._android >= 3) && this._oDrawing.makeImage() }, QRCode.prototype.clear = function () { this._oDrawing.clear() }, QRCode.CorrectLevel = d }();


/* Smart Resize */
(function ($, sr) {

    // debouncing function from John Hann
    // http://unscriptable.com/index.php/2009/03/20/debouncing-javascript-methods/
    var debounce = function (func, threshold, execAsap) {
        var timeout;

        return function debounced() {
            var obj = this, args = arguments;
            function delayed() {
                if (!execAsap)
                    func.apply(obj, args);
                timeout = null;
            };

            if (timeout)
                clearTimeout(timeout);
            else if (execAsap)
                func.apply(obj, args);

            timeout = setTimeout(delayed, threshold || 100);
        };
    }
    // smartresize 
    jQuery.fn[sr] = function (fn) { return fn ? this.bind('resize', debounce(fn)) : this.trigger(sr); };

})(jQuery, 'smartresize');


// Validators

function NIF_CIFValidator() { if (country == "PT") { return true; }; this.NIF_Letters = "TRWAGMYFPDXBNJZSQVHLCKET"; this.NIF_regExp = "^\\d{8}[a-zA-Z]{1}$"; this.CIF_regExp = "^[a-zA-Z]{1}\\d{7}[a-jA-J0-9]{1}$"; this.checkAll = function (e) { if (this.checkCIF(e)) { return true } else if (this.checkTR(e)) { return true } else if (this.checkNIF(e)) { return true } else { return false } }; this.checkNIF = function (e) { if (e.length != 8 && e.length != 9) return false; if (e.length == 8) e = "0" + e; var t = new RegExp(this.NIF_regExp); if (!e.match(t)) return false; var n = e.charAt(e.length - 1); var r = e.substring(0, e.length - 1); var i = this.NIF_Letters.charAt(r % 23); return i == n.toUpperCase() }; this.checkTR = function (e) { if (e.length != 10 && e.length != 9) return false; if (e.charAt(0).toUpperCase() != "X" && e.charAt(0).toUpperCase() != "Y" && e.charAt(0).toUpperCase() != "Z") return false; var t = "0"; if (e.charAt(0).toUpperCase() == "Y") t = "1"; if (e.length == 9) { return this.checkNIF(t + e.substring(1, e.length)) } else { return this.checkNIF(e.substring(1, e.length)) } }; this.checkCIF = function (e) { var t = new Array(0, 2, 4, 6, 8, 1, 3, 5, 7, 9); var n = e.toUpperCase(); var r = 0; var s; var o; var u = new RegExp(this.CIF_regExp); if (!n.match(u)) return false; if (!/^[ABCDEFGHKLMNPQS]/.test(n)) return false; for (i = 2; i <= 6; i += 2) { r = r + t[parseInt(e.substr(i - 1, 1))]; r = r + parseInt(e.substr(i, 1)) } r = r + t[parseInt(e.substr(7, 1))]; r = 10 - r % 10; if (r == 10) r = 0; o = e.toUpperCase().charAt(8); return o == r || r == 1 && o == "A" || r == 2 && o == "B" || r == 3 && o == "C" || r == 4 && o == "D" || r == 5 && o == "E" || r == 6 && o == "F" || r == 7 && o == "G" || r == 8 && o == "H" || r == 9 && o == "I" || r == 0 && o == "J" } };

function _validateEmail(email) {
    if (email == "") {
        return false;
    }
    var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
    return emailReg.test(email);
}

function isNumber(n) {
    return !isNaN(parseFloat(n)) && isFinite(n);
}

function hasNumber(sText) {
    var reNumber = /\d+/;
    return reNumber.test(sText);
}

function _validaFecha(sText) {
    var reDate = /(?:0[1-9]|[12][0-9]|3[01])\/(?:0[1-9]|1[0-2])\/(?:19|20\d{2})/;
    return reDate.test(sText);
}

function _checkObligatorios(_obligatorios) {
    $.each(_obligatorios, function (i, item) {
        var valor = "";
        if ($("#" + item).hasClass("select-group")) {
            valor = $("#" + item).attr("data-value");
        } else {
            valor = $("#" + item).val();
        }
        if (!(valor != "")) {
            return false;
        }
    });
    return true;
}

function _validaPass(pswd) {
    if (_fbid && _fbat) {
        return "OK";
    }
    if (pswd.length < 10) {
        return "Password";
        
    }
    
    var _mayus = 0, _minus = 0, _num = 0, _specialchar = 0;
    for (var i = 0; i < pswd.length; i++) {
        //mayus
        if (pswd[i].match(/^[A-Z]*$/)) {
            _mayus = 1;
        }
        //minus
        if (pswd[i].match(/^[a-z]*$/)) {
            _minus = 1;
        }
        //number
        if (pswd[i].match(/^[0-9]*$/)) {
            _num = 1;
        }
        //special
        if (/[!@#$%^&*\-\(\){}_+.¨¬=º<>~ª,;¿?¡:\[\]]/.test(pswd[i])) {
            _specialchar = 1;
        }
    }

    if (_mayus == 0 || _minus == 0 || _num == 0 || _specialchar == 0) {
        return "Password";
    }




    return "OK";
}

function rangoEdad(fecha, edadmin, edadmax) {
    if (typeof (edadmin) == "undefined") {
        edadmin = 14;
    }
    if (typeof (edadmax) == "undefined") {
        edadmax = 100;
    }
    var f = fecha.split("/");
    try {
        var fechafinal = new Date(f[2], f[1] - 1, f[0]);

        var maxfecha = new Date();
        var minfecha = new Date();
        maxfecha.setFullYear(maxfecha.getUTCFullYear() - edadmax);
        minfecha.setFullYear(minfecha.getUTCFullYear() - edadmin);

        if (fechafinal < maxfecha) {
            return 2;
        }
        if (fechafinal > minfecha) {
            return 3;
        }
        return 1;
    } catch (e) {
        return 0;
    }
}

function _fecha(entrada, formatoentrada, formatosalida) {
    var ddin = entrada.substr(formatoentrada.indexOf("dd"), 2);
    var mmin = entrada.substr(formatoentrada.indexOf("mm"), 2);
    var aaaain = entrada.substr(formatoentrada.indexOf("aaaa"), 4);
    return formatosalida.replace("dd", ddin).replace("mm", mmin).replace("aaaa", aaaain);
}






/*!
* jquery.inputmask.min.js
* http://github.com/RobinHerbots/jquery.inputmask
* Copyright (c) 2010 - 2015 Robin Herbots
* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
* Version: 3.1.62-7
*/
!function (a) { "function" == typeof define && define.amd ? define(["jquery"], a) : a(jQuery) }(function (a) {
    function b(a) { var b = document.createElement("input"), c = "on" + a, d = c in b; return d || (b.setAttribute(c, "return;"), d = "function" == typeof b[c]), b = null, d } function c(a) { var b = "text" == a || "tel" == a; if (!b) { var c = document.createElement("input"); c.setAttribute("type", a), b = "text" === c.type, c = null } return b } function d(b, c, e) { var f = e.aliases[b]; return f ? (f.alias && d(f.alias, void 0, e), a.extend(!0, e, f), a.extend(!0, e, c), !0) : !1 } function e(b, c) { function d(c) { function d(a, b, c, d) { this.matches = [], this.isGroup = a || !1, this.isOptional = b || !1, this.isQuantifier = c || !1, this.isAlternator = d || !1, this.quantifier = { min: 1, max: 1 } } function e(c, d, e) { var f = b.definitions[d], g = 0 == c.matches.length; if (e = void 0 != e ? e : c.matches.length, f && !m) { f.placeholder = a.isFunction(f.placeholder) ? f.placeholder.call(this, b) : f.placeholder; for (var h = f.prevalidator, i = h ? h.length : 0, j = 1; j < f.cardinality; j++) { var k = i >= j ? h[j - 1] : [], l = k.validator, n = k.cardinality; c.matches.splice(e++, 0, { fn: l ? "string" == typeof l ? new RegExp(l) : new function () { this.test = l } : new RegExp("."), cardinality: n ? n : 1, optionality: c.isOptional, newBlockMarker: g, casing: f.casing, def: f.definitionSymbol || d, placeholder: f.placeholder, mask: d }) } c.matches.splice(e++, 0, { fn: f.validator ? "string" == typeof f.validator ? new RegExp(f.validator) : new function () { this.test = f.validator } : new RegExp("."), cardinality: f.cardinality, optionality: c.isOptional, newBlockMarker: g, casing: f.casing, def: f.definitionSymbol || d, placeholder: f.placeholder, mask: d }) } else c.matches.splice(e++, 0, { fn: null, cardinality: 0, optionality: c.isOptional, newBlockMarker: g, casing: null, def: d, placeholder: void 0, mask: d }), m = !1 } for (var f, g, h, i, j, k, l = /(?:[?*+]|\{[0-9\+\*]+(?:,[0-9\+\*]*)?\})\??|[^.?*+^${[]()|\\]+|./g, m = !1, n = new d, o = [], p = []; f = l.exec(c);)switch (g = f[0], g.charAt(0)) { case b.optionalmarker.end: case b.groupmarker.end: if (h = o.pop(), o.length > 0) { if (i = o[o.length - 1], i.matches.push(h), i.isAlternator) { j = o.pop(); for (var q = 0; q < j.matches.length; q++)j.matches[q].isGroup = !1; o.length > 0 ? (i = o[o.length - 1], i.matches.push(j)) : n.matches.push(j) } } else n.matches.push(h); break; case b.optionalmarker.start: o.push(new d(!1, !0)); break; case b.groupmarker.start: o.push(new d(!0)); break; case b.quantifiermarker.start: var r = new d(!1, !1, !0); g = g.replace(/[{}]/g, ""); var s = g.split(","), t = isNaN(s[0]) ? s[0] : parseInt(s[0]), u = 1 == s.length ? t : isNaN(s[1]) ? s[1] : parseInt(s[1]); if (("*" == u || "+" == u) && (t = "*" == u ? 0 : 1), r.quantifier = { min: t, max: u }, o.length > 0) { var v = o[o.length - 1].matches; if (f = v.pop(), !f.isGroup) { var w = new d(!0); w.matches.push(f), f = w } v.push(f), v.push(r) } else { if (f = n.matches.pop(), !f.isGroup) { var w = new d(!0); w.matches.push(f), f = w } n.matches.push(f), n.matches.push(r) } break; case b.escapeChar: m = !0; break; case b.alternatormarker: o.length > 0 ? (i = o[o.length - 1], k = i.matches.pop()) : k = n.matches.pop(), k.isAlternator ? o.push(k) : (j = new d(!1, !1, !1, !0), j.matches.push(k), o.push(j)); break; default: if (o.length > 0) { if (i = o[o.length - 1], i.matches.length > 0 && (k = i.matches[i.matches.length - 1], k.isGroup && (k.isGroup = !1, e(k, b.groupmarker.start, 0), e(k, b.groupmarker.end))), e(i, g), i.isAlternator) { j = o.pop(); for (var q = 0; q < j.matches.length; q++)j.matches[q].isGroup = !1; o.length > 0 ? (i = o[o.length - 1], i.matches.push(j)) : n.matches.push(j) } } else n.matches.length > 0 && (k = n.matches[n.matches.length - 1], k.isGroup && (k.isGroup = !1, e(k, b.groupmarker.start, 0), e(k, b.groupmarker.end))), e(n, g) }return n.matches.length > 0 && (k = n.matches[n.matches.length - 1], k.isGroup && (k.isGroup = !1, e(k, b.groupmarker.start, 0), e(k, b.groupmarker.end)), p.push(n)), p } function e(e, f) { if (void 0 == e || "" == e) return void 0; if (1 == e.length && 0 == b.greedy && 0 != b.repeat && (b.placeholder = ""), b.repeat > 0 || "*" == b.repeat || "+" == b.repeat) { var g = "*" == b.repeat ? 0 : "+" == b.repeat ? 1 : b.repeat; e = b.groupmarker.start + e + b.groupmarker.end + b.quantifiermarker.start + g + "," + b.repeat + b.quantifiermarker.end } var h; return void 0 == a.inputmask.masksCache[e] || c === !0 ? (h = { mask: e, maskToken: d(e), validPositions: {}, _buffer: void 0, buffer: void 0, tests: {}, metadata: f }, c !== !0 && (a.inputmask.masksCache[e] = h)) : h = a.extend(!0, {}, a.inputmask.masksCache[e]), h } function f(a) { if (a = a.toString(), b.numericInput) { a = a.split("").reverse(); for (var c = 0; c < a.length; c++)a[c] == b.optionalmarker.start ? a[c] = b.optionalmarker.end : a[c] == b.optionalmarker.end ? a[c] = b.optionalmarker.start : a[c] == b.groupmarker.start ? a[c] = b.groupmarker.end : a[c] == b.groupmarker.end && (a[c] = b.groupmarker.start); a = a.join("") } return a } var g = void 0; if (a.isFunction(b.mask) && (b.mask = b.mask.call(this, b)), a.isArray(b.mask)) { if (b.mask.length > 1) { b.keepStatic = void 0 == b.keepStatic ? !0 : b.keepStatic; var h = "("; return a.each(b.mask, function (b, c) { h.length > 1 && (h += ")|("), h += f(void 0 == c.mask || a.isFunction(c.mask) ? c : c.mask) }), h += ")", e(h, b.mask) } b.mask = b.mask.pop() } return b.mask && (g = void 0 == b.mask.mask || a.isFunction(b.mask.mask) ? e(f(b.mask), b.mask) : e(f(b.mask.mask), b.mask)), g } function f(d, e, f) {
        function g(a, b, c) { b = b || 0; var d, e, f, g = [], h = 0; do { if (a === !0 && l().validPositions[h]) { var i = l().validPositions[h]; e = i.match, d = i.locator.slice(), g.push(c === !0 ? i.input : G(h, e)) } else f = q(h, d, h - 1), e = f.match, d = f.locator.slice(), g.push(G(h, e)); h++ } while ((void 0 == db || db > h - 1) && null != e.fn || null == e.fn && "" != e.def || b >= h); return g.pop(), g } function l() { return e } function m(a) { var b = l(); b.buffer = void 0, b.tests = {}, a !== !0 && (b._buffer = void 0, b.validPositions = {}, b.p = 0) } function n(a) { var b = l(), c = -1, d = b.validPositions; void 0 == a && (a = -1); var e = c, f = c; for (var g in d) { var h = parseInt(g); d[h] && null != d[h].match.fn && (a >= h && (e = h), h >= a && (f = h)) } return c = -1 != e && a - e > 1 || a > f ? e : f } function o(b, c, d) { if (f.insertMode && void 0 != l().validPositions[b] && void 0 == d) { var e, g = a.extend(!0, {}, l().validPositions), h = n(); for (e = b; h >= e; e++)delete l().validPositions[e]; l().validPositions[b] = c; var i, j = !0; for (e = b; h >= e; e++) { var k = g[e]; if (void 0 != k) { var m = l().validPositions; i = !f.keepStatic && m[e] && (void 0 != m[e + 1] && t(e + 1, m[e].locator.slice(), e).length > 1 || void 0 != m[e].alternation) ? e + 1 : C(e), j = s(i, k.match.def) ? j && z(i, k.input, !0, !0) !== !1 : null == k.match.fn } if (!j) break } if (!j) return l().validPositions = a.extend(!0, {}, g), !1 } else l().validPositions[b] = c; return !0 } function p(a, b, c, d) { var e, g = a; l().p = a, void 0 != l().validPositions[a] && l().validPositions[a].input == f.radixPoint && (b++ , g++); for (e = g; b > e; e++)void 0 != l().validPositions[e] && (c === !0 || 0 != f.canClearPosition(l(), e, n(), d, f)) && delete l().validPositions[e]; for (m(!0), e = g + 1; e <= n();) { for (; void 0 != l().validPositions[g];)g++; var h = l().validPositions[g]; g > e && (e = g + 1); var i = l().validPositions[e]; void 0 != i && void 0 == h ? (s(g, i.match.def) && z(g, i.input, !0) !== !1 && (delete l().validPositions[e], e++), g++) : e++ } var j = n(), k = B(); for (j >= a && void 0 != l().validPositions[j] && l().validPositions[j].input == f.radixPoint && delete l().validPositions[j], e = j + 1; k >= e; e++)l().validPositions[e] && delete l().validPositions[e]; m(!0) } function q(a, b, c) { var d = l().validPositions[a]; if (void 0 == d) for (var e = t(a, b, c), g = n(), h = l().validPositions[g] || t(0)[0], i = void 0 != h.alternation ? h.locator[h.alternation].split(",") : [], j = 0; j < e.length && (d = e[j], !(d.match && (f.greedy && d.match.optionalQuantifier !== !0 || (d.match.optionality === !1 || d.match.newBlockMarker === !1) && d.match.optionalQuantifier !== !0) && (void 0 == h.alternation || void 0 != d.locator[h.alternation] && y(d.locator[h.alternation].toString().split(","), i)))); j++); return d } function r(a) { return l().validPositions[a] ? l().validPositions[a].match : t(a)[0].match } function s(a, b) { for (var c = !1, d = t(a), e = 0; e < d.length; e++)if (d[e].match && d[e].match.def == b) { c = !0; break } return c } function t(b, c, d) { function e(c, d, f, h) { function k(f, h, n) { if (g > 1e4) return alert("jquery.inputmask: There is probably an error in your mask definition or in the code. Create an issue on github with an example of the mask you are using. " + l().mask), !0; if (g == b && void 0 == f.matches) return i.push({ match: f, locator: h.reverse() }), !0; if (void 0 != f.matches) { if (f.isGroup && n !== !0) { if (f = k(c.matches[m + 1], h)) return !0 } else if (f.isOptional) { var o = f; if (f = e(f, d, h, n)) { var p = i[i.length - 1].match, q = 0 == a.inArray(p, o.matches); q && (j = !0), g = b } } else if (f.isAlternator) { var r, s = f, t = [], u = i.slice(), v = h.length, w = d.length > 0 ? d.shift() : -1; if (-1 == w || "string" == typeof w) { var x, y = g, z = d.slice(); "string" == typeof w && (x = w.split(",")); for (var A = 0; A < s.matches.length; A++) { i = [], f = k(s.matches[A], [A].concat(h), n) || f, r = i.slice(), g = y, i = []; for (var B = 0; B < z.length; B++)d[B] = z[B]; for (var C = 0; C < r.length; C++)for (var D = r[C], E = 0; E < t.length; E++) { var F = t[E]; if (D.match.mask == F.match.mask && ("string" != typeof w || -1 != a.inArray(D.locator[v].toString(), x))) { r.splice(C, 1), F.locator[v] = F.locator[v] + "," + D.locator[v], F.alternation = v; break } } t = t.concat(r) } "string" == typeof w && (t = a.map(t, function (b, c) { if (isFinite(c)) { var d, e = b.locator[v].toString().split(","); b.locator[v] = void 0, b.alternation = void 0; for (var f = 0; f < e.length; f++)d = -1 != a.inArray(e[f], x), d && (void 0 != b.locator[v] ? (b.locator[v] += ",", b.alternation = v, b.locator[v] += e[f]) : b.locator[v] = parseInt(e[f])); if (void 0 != b.locator[v]) return b } })), i = u.concat(t), j = !0 } else f = k(s.matches[w], [w].concat(h), n); if (f) return !0 } else if (f.isQuantifier && n !== !0) for (var G = f, H = d.length > 0 && n !== !0 ? d.shift() : 0; H < (isNaN(G.quantifier.max) ? H + 1 : G.quantifier.max) && b >= g; H++) { var I = c.matches[a.inArray(G, c.matches) - 1]; if (f = k(I, [H].concat(h), !0)) { var p = i[i.length - 1].match; p.optionalQuantifier = H > G.quantifier.min - 1; var q = 0 == a.inArray(p, I.matches); if (q) { if (H > G.quantifier.min - 1) { j = !0, g = b; break } return !0 } return !0 } } else if (f = e(f, d, h, n)) return !0 } else g++ } for (var m = d.length > 0 ? d.shift() : 0; m < c.matches.length; m++)if (c.matches[m].isQuantifier !== !0) { var n = k(c.matches[m], [m].concat(f), h); if (n && g == b) return n; if (g > b) break } } var f = l().maskToken, g = c ? d : 0, h = c || [0], i = [], j = !1; if (void 0 == c) { for (var k, m = b - 1; void 0 == (k = l().validPositions[m]) && m > -1;)m--; if (void 0 != k && m > -1) g = m, h = k.locator.slice(); else { for (m = b - 1; void 0 == (k = l().tests[m]) && m > -1;)m--; void 0 != k && m > -1 && (g = m, h = k[0].locator.slice()) } } for (var n = h.shift(); n < f.length; n++) { var o = e(f[n], h, [n]); if (o && g == b || g > b) break } return (0 == i.length || j) && i.push({ match: { fn: null, cardinality: 0, optionality: !0, casing: null, def: "" }, locator: [] }), l().tests[b] = a.extend(!0, [], i), l().tests[b] } function u() { return void 0 == l()._buffer && (l()._buffer = g(!1, 1)), l()._buffer } function v() { return void 0 == l().buffer && (l().buffer = g(!0, n(), !0)), l().buffer } function w(a, b, c) { if (c = c || v().slice(), a === !0) m(), a = 0, b = c.length; else for (var d = a; b > d; d++)delete l().validPositions[d], delete l().tests[d]; for (var d = a; b > d; d++)c[d] != f.skipOptionalPartCharacter && z(d, c[d], !0, !0) } function x(a, b) { switch (b.casing) { case "upper": a = a.toUpperCase(); break; case "lower": a = a.toLowerCase() }return a } function y(b, c) { for (var d = f.greedy ? c : c.slice(0, 1), e = !1, g = 0; g < b.length; g++)if (-1 != a.inArray(b[g], d)) { e = !0; break } return e } function z(b, c, d, e) { function g(b, c, d, e) { var g = !1; return a.each(t(b), function (h, i) { for (var j = i.match, k = c ? 1 : 0, q = "", r = (v(), j.cardinality); r > k; r--)q += E(b - (r - 1)); if (c && (q += c), g = null != j.fn ? j.fn.test(q, l(), b, d, f) : c != j.def && c != f.skipOptionalPartCharacter || "" == j.def ? !1 : { c: j.def, pos: b }, g !== !1) { var s = void 0 != g.c ? g.c : c; s = s == f.skipOptionalPartCharacter && null === j.fn ? j.def : s; var t = b, u = v(); if (void 0 != g.remove && (a.isArray(g.remove) || (g.remove = [g.remove]), a.each(g.remove.sort(function (a, b) { return b - a }), function (a, b) { p(b, b + 1, !0) })), void 0 != g.insert && (a.isArray(g.insert) || (g.insert = [g.insert]), a.each(g.insert.sort(function (a, b) { return a - b }), function (a, b) { z(b.pos, b.c, !0) })), g.refreshFromBuffer) { var y = g.refreshFromBuffer; if (d = !0, w(y === !0 ? y : y.start, y.end, u), void 0 == g.pos && void 0 == g.c) return g.pos = n(), !1; if (t = void 0 != g.pos ? g.pos : b, t != b) return g = a.extend(g, z(t, s, !0)), !1 } else if (g !== !0 && void 0 != g.pos && g.pos != b && (t = g.pos, w(b, t), t != b)) return g = a.extend(g, z(t, s, !0)), !1; return 1 != g && void 0 == g.pos && void 0 == g.c ? !1 : (h > 0 && m(!0), o(t, a.extend({}, i, { input: x(s, j) }), e) || (g = !1), !1) } }), g } function h(b, c, d, e) { var g, h, i = a.extend(!0, {}, l().validPositions); for (g = n(); g >= 0; g--)if (l().validPositions[g] && void 0 != l().validPositions[g].alternation) { h = l().validPositions[g].alternation; break } if (void 0 != h) for (var j in l().validPositions) if (parseInt(j) > parseInt(g) && void 0 === l().validPositions[j].alternation) { for (var k = l().validPositions[j], o = k.locator[h], p = l().validPositions[g].locator[h].split(","), q = 0; q < p.length; q++)if (o < p[q]) { for (var r, s, t = j - 1; t >= 0; t--)if (r = l().validPositions[t], void 0 != r) { s = r.locator[h], r.locator[h] = p[q]; break } if (o != r.locator[h]) { for (var u = v().slice(), w = j; w < n() + 1; w++)delete l().validPositions[w], delete l().tests[w]; m(!0), f.keepStatic = !f.keepStatic; for (var w = j; w < u.length; w++)u[w] != f.skipOptionalPartCharacter && z(n() + 1, u[w], !1, !0); r.locator[h] = s; var x = z(b, c, d, e); if (f.keepStatic = !f.keepStatic, x) return x; m(), l().validPositions = a.extend(!0, {}, i) } } break } return !1 } function i(b, c) { for (var d = l().validPositions[c], e = d.locator, f = e.length, g = b; c > g; g++)if (!A(g)) { var h = t(g), i = h[0], j = -1; a.each(h, function (a, b) { for (var c = 0; f > c; c++)b.locator[c] && y(b.locator[c].toString().split(","), e[c].toString().split(",")) && c > j && (j = c, i = b) }), o(g, a.extend({}, i, { input: i.match.def }), !0) } } d = d === !0; for (var j = v(), k = b - 1; k > -1 && !l().validPositions[k]; k--); for (k++; b > k; k++)void 0 == l().validPositions[k] && ((!A(k) || j[k] != G(k)) && t(k).length > 1 || j[k] == f.radixPoint || "0" == j[k] && a.inArray(f.radixPoint, j) < k) && g(k, j[k], !0); var q = b, r = !1, s = a.extend(!0, {}, l().validPositions); if (q < B() && (r = g(q, c, d, e), !d && r === !1)) { var u = l().validPositions[q]; if (!u || null != u.match.fn || u.match.def != c && c != f.skipOptionalPartCharacter) { if ((f.insertMode || void 0 == l().validPositions[C(q)]) && !A(q)) for (var D = q + 1, F = C(q); F >= D; D++)if (r = g(D, c, d, e), r !== !1) { i(q, D), q = D; break } } else r = { caret: C(q) } } if (r === !1 && f.keepStatic && O(j) && (r = h(b, c, d, e)), r === !0 && (r = { pos: q }), a.isFunction(f.postValidation) && 0 != r && !d) { m(!0); var H = f.postValidation(v(), f); if (!H) return m(!0), l().validPositions = a.extend(!0, {}, s), !1 } return r } function A(a) { var b = r(a); return null != b.fn ? b.fn : !1 } function B() { var a; db = cb.prop("maxLength"), -1 == db && (db = void 0); var b, c = n(), d = l().validPositions[c], e = void 0 != d ? d.locator.slice() : void 0; for (b = c + 1; void 0 == d || null != d.match.fn || null == d.match.fn && "" != d.match.def; b++)d = q(b, e, b - 1), e = d.locator.slice(); return a = b, void 0 == db || db > a ? a : db } function C(a) { var b = B(); if (a >= b) return b; for (var c = a; ++c < b && !A(c) && (f.nojumps !== !0 || f.nojumpsThreshold > c);); return c } function D(a) { var b = a; if (0 >= b) return 0; for (; --b > 0 && !A(b);); return b } function E(a) { return void 0 == l().validPositions[a] ? G(a) : l().validPositions[a].input } function F(b, c, d, e, g) { if (e && a.isFunction(f.onBeforeWrite)) { var h = f.onBeforeWrite.call(b, e, c, d, f); if (h) { if (h.refreshFromBuffer) { var i = h.refreshFromBuffer; w(i === !0 ? i : i.start, i.end, h.buffer), m(!0), c = v() } d = h.caret || d } } b._valueSet(c.join("")), void 0 != d && L(b, d), g === !0 && (gb = !0, a(b).trigger("input")) } function G(a, b) { return b = b || r(a), void 0 != b.placeholder ? b.placeholder : null == b.fn ? b.def : f.placeholder.charAt(a % f.placeholder.length) } function H(b, c, d, e) { function f() { var a = !1, b = u().slice(i, C(i)).join("").indexOf(h); if (-1 != b && !A(i)) { a = !0; for (var c = u().slice(i, i + b), d = 0; d < c.length; d++)if (" " != c[d]) { a = !1; break } } return a } var g = void 0 != e ? e.slice() : b._valueGet().split(""), h = "", i = 0; m(), l().p = C(-1), c && b._valueSet(""); var j = u().slice(0, C(-1)).join(""), k = g.join("").match(new RegExp(I(j), "g")); k && k.length > 0 && (g.splice(0, k.length * j.length), i = C(i)), a.each(g, function (c, e) { var g = a.Event("keypress"); g.which = e.charCodeAt(0), h += e; var j = n(), k = l().validPositions[j], m = q(j + 1, k ? k.locator.slice() : void 0, j); if (!f() || d) { var o = d ? c : null == m.match.fn && m.match.optionality && j + 1 < l().p ? j + 1 : l().p; U.call(b, g, !0, !1, d, o), i = o + 1, h = "" } else U.call(b, g, !0, !1, !0, j + 1) }), c && F(b, v(), a(b).is(":focus") ? C(n(0)) : void 0, a.Event("checkval")) } function I(b) { return a.inputmask.escapeRegex(b) } function J(b) { if (b.data("_inputmask") && !b.hasClass("hasDatepicker")) { var c = [], d = l().validPositions; for (var e in d) d[e].match && null != d[e].match.fn && c.push(d[e].input); var g = (eb ? c.reverse() : c).join(""), h = (eb ? v().slice().reverse() : v()).join(""); return a.isFunction(f.onUnMask) && (g = f.onUnMask.call(b, h, g, f) || g), g } return b[0]._valueGet() } function K(a) { if (eb && "number" == typeof a && (!f.greedy || "" != f.placeholder)) { var b = v().length; a = b - a } return a } function L(b, c, d) { var e, g = b.jquery && b.length > 0 ? b[0] : b; if ("number" != typeof c) return g.setSelectionRange ? (c = g.selectionStart, d = g.selectionEnd) : document.selection && document.selection.createRange && (e = document.selection.createRange(), c = 0 - e.duplicate().moveStart("character", -1e5), d = c + e.text.length), { begin: K(c), end: K(d) }; if (c = K(c), d = K(d), d = "number" == typeof d ? d : c, a(g).is(":visible")) { var h = a(g).css("font-size").replace("px", "") * d; g.scrollLeft = h > g.scrollWidth ? h : 0, i || 0 != f.insertMode || c != d || d++ , g.setSelectionRange ? (g.selectionStart = c, g.selectionEnd = d) : g.createTextRange && (e = g.createTextRange(), e.collapse(!0), e.moveEnd("character", d), e.moveStart("character", c), e.select()) } } function M(b) { var c, d, e = v(), f = e.length, g = n(), h = {}, i = l().validPositions[g], j = void 0 != i ? i.locator.slice() : void 0; for (c = g + 1; c < e.length; c++)d = q(c, j, c - 1), j = d.locator.slice(), h[c] = a.extend(!0, {}, d); var k = i && void 0 != i.alternation ? i.locator[i.alternation].split(",") : []; for (c = f - 1; c > g && (d = h[c].match, (d.optionality || d.optionalQuantifier || i && void 0 != i.alternation && void 0 != h[c].locator[i.alternation] && -1 != a.inArray(h[c].locator[i.alternation].toString(), k)) && e[c] == G(c, d)); c--)f--; return b ? { l: f, def: h[f] ? h[f].match : void 0 } : f } function N(a) { for (var b = M(), c = a.length - 1; c > b && !A(c); c--); return a.splice(b, c + 1 - b), a } function O(b) { if (a.isFunction(f.isComplete)) return f.isComplete.call(cb, b, f); if ("*" == f.repeat) return void 0; { var c = !1, d = M(!0), e = D(d.l); n() } if (void 0 == d.def || d.def.newBlockMarker || d.def.optionality || d.def.optionalQuantifier) { c = !0; for (var g = 0; e >= g; g++) { var h = A(g), i = r(g); if (h && void 0 == l().validPositions[g] && i.optionality !== !0 && i.optionalQuantifier !== !0 || !h && b[g] != G(g)) { c = !1; break } } } return c } function P(a, b) { return eb ? a - b > 1 || a - b == 1 && f.insertMode : b - a > 1 || b - a == 1 && f.insertMode } function Q(b) { var c = a._data(b).events; a.each(c, function (b, c) { a.each(c, function (a, b) { if ("inputmask" == b.namespace && "setvalue" != b.type) { var c = b.handler; b.handler = function (a) { if (!this.disabled && (!this.readOnly || "keydown" == a.type && a.ctrlKey && 67 == a.keyCode)) { switch (a.type) { case "input": if (gb === !0) return gb = !1, a.preventDefault(); break; case "keydown": fb = !1; break; case "keypress": if (fb === !0) return a.preventDefault(); fb = !0; break; case "compositionstart": break; case "compositionupdate": gb = !0; break; case "compositionend": }return c.apply(this, arguments) } a.preventDefault() } } }) }) } function R(b) {
            function c(b) { if (void 0 == a.valHooks[b] || 1 != a.valHooks[b].inputmaskpatch) { var c = a.valHooks[b] && a.valHooks[b].get ? a.valHooks[b].get : function (a) { return a.value }, d = a.valHooks[b] && a.valHooks[b].set ? a.valHooks[b].set : function (a, b) { return a.value = b, a }; a.valHooks[b] = { get: function (b) { var d = a(b); if (d.data("_inputmask")) { if (d.data("_inputmask").opts.autoUnmask) return d.inputmask("unmaskedvalue"); var e = c(b), f = d.data("_inputmask"), g = f.maskset, h = g._buffer; return h = h ? h.join("") : "", e != h ? e : "" } return c(b) }, set: function (b, c) { var e, f = a(b), g = f.data("_inputmask"); return g ? (e = d(b, a.isFunction(g.opts.onBeforeMask) ? g.opts.onBeforeMask.call(nb, c, g.opts) || c : c), f.triggerHandler("setvalue.inputmask")) : e = d(b, c), e }, inputmaskpatch: !0 } } } function d() { var b = a(this), c = a(this).data("_inputmask"); return c ? c.opts.autoUnmask ? b.inputmask("unmaskedvalue") : h.call(this) != u().join("") ? h.call(this) : "" : h.call(this) } function e(b) { var c = a(this).data("_inputmask"); c ? (i.call(this, a.isFunction(c.opts.onBeforeMask) ? c.opts.onBeforeMask.call(nb, b, c.opts) || b : b), a(this).triggerHandler("setvalue.inputmask")) : i.call(this, b) } function g(b) {
                a(b).bind("mouseenter.inputmask", function () { var b = a(this), c = this, d = c._valueGet(); "" != d && d != v().join("") && (this._valueSet(a.isFunction(f.onBeforeMask) ? f.onBeforeMask.call(nb, d, f) || d : d), b.triggerHandler("setvalue.inputmask")) });//!! the bound handlers are executed in the order they where bound
                var c = a._data(b).events, d = c.mouseover; if (d) { for (var e = d[d.length - 1], g = d.length - 1; g > 0; g--)d[g] = d[g - 1]; d[0] = e }
            } var h, i; if (!b._valueGet) { if (Object.getOwnPropertyDescriptor) { Object.getOwnPropertyDescriptor(b, "value") } document.__lookupGetter__ && b.__lookupGetter__("value") ? (h = b.__lookupGetter__("value"), i = b.__lookupSetter__("value"), b.__defineGetter__("value", d), b.__defineSetter__("value", e)) : (h = function () { return b.value }, i = function (a) { b.value = a }, c(b.type), g(b)), b._valueGet = function (a) { return eb && a !== !0 ? h.call(this).split("").reverse().join("") : h.call(this) }, b._valueSet = function (a) { i.call(this, eb ? a.split("").reverse().join("") : a) } }
        } function S(b, c, d, e) { function g() { if (f.keepStatic) { m(!0); var c, d = []; for (c = n(); c >= 0; c--)if (l().validPositions[c]) { if (void 0 != l().validPositions[c].alternation) break; d.push(l().validPositions[c].input), delete l().validPositions[c] } if (c > 0) for (; d.length > 0;) { l().p = C(n()); var e = a.Event("keypress"); e.which = d.pop().charCodeAt(0), U.call(b, e, !0, !1, !1, l().p) } } } if ((f.numericInput || eb) && (c == a.inputmask.keyCode.BACKSPACE ? c = a.inputmask.keyCode.DELETE : c == a.inputmask.keyCode.DELETE && (c = a.inputmask.keyCode.BACKSPACE), eb)) { var h = d.end; d.end = d.begin, d.begin = h } if (c == a.inputmask.keyCode.BACKSPACE && (d.end - d.begin < 1 || 0 == f.insertMode) ? d.begin = D(d.begin) : c == a.inputmask.keyCode.DELETE && d.begin == d.end && (d.end = A(d.end) ? d.end + 1 : C(d.end) + 1), p(d.begin, d.end, !1, e), e !== !0) { g(); var i = n(d.begin); i < d.begin ? (-1 == i && m(), l().p = C(i)) : l().p = d.begin } } function T(c) { var d = this, e = a(d), g = c.keyCode, i = L(d); g == a.inputmask.keyCode.BACKSPACE || g == a.inputmask.keyCode.DELETE || h && 127 == g || c.ctrlKey && 88 == g && !b("cut") ? (c.preventDefault(), 88 == g && (_ = v().join("")), S(d, g, i), F(d, v(), l().p, c, _ != v().join("")), d._valueGet() == u().join("") ? e.trigger("cleared") : O(v()) === !0 && e.trigger("complete"), f.showTooltip && e.prop("title", l().mask)) : g == a.inputmask.keyCode.END || g == a.inputmask.keyCode.PAGE_DOWN ? setTimeout(function () { var a = C(n()); f.insertMode || a != B() || c.shiftKey || a-- , L(d, c.shiftKey ? i.begin : a, a) }, 0) : g == a.inputmask.keyCode.HOME && !c.shiftKey || g == a.inputmask.keyCode.PAGE_UP ? L(d, 0, c.shiftKey ? i.begin : 0) : (f.undoOnEscape && g == a.inputmask.keyCode.ESCAPE || 90 == g && c.ctrlKey) && c.altKey !== !0 ? (H(d, !0, !1, _.split("")), e.click()) : g != a.inputmask.keyCode.INSERT || c.shiftKey || c.ctrlKey ? 0 != f.insertMode || c.shiftKey || (g == a.inputmask.keyCode.RIGHT ? setTimeout(function () { var a = L(d); L(d, a.begin) }, 0) : g == a.inputmask.keyCode.LEFT && setTimeout(function () { var a = L(d); L(d, eb ? a.begin + 1 : a.begin - 1) }, 0)) : (f.insertMode = !f.insertMode, L(d, f.insertMode || i.begin != B() ? i.begin : i.begin - 1)), f.onKeyDown.call(this, c, v(), L(d).begin, f), hb = -1 != a.inArray(g, f.ignorables) } function U(b, c, d, e, g) { var h = this, i = a(h), j = b.which || b.charCode || b.keyCode; if (!(c === !0 || b.ctrlKey && b.altKey) && (b.ctrlKey || b.metaKey || hb)) return !0; if (j) { 46 == j && 0 == b.shiftKey && "," == f.radixPoint && (j = 44); var k, n = c ? { begin: g, end: g } : L(h), p = String.fromCharCode(j), q = P(n.begin, n.end); q && (l().undoPositions = a.extend(!0, {}, l().validPositions), S(h, a.inputmask.keyCode.DELETE, n, !0), n.begin = l().p, f.insertMode || (f.insertMode = !f.insertMode, o(n.begin, e), f.insertMode = !f.insertMode), q = !f.multi), l().writeOutBuffer = !0; var r = eb && !q ? n.end : n.begin, s = z(r, p, e); if (s !== !1) { if (s !== !0 && (r = void 0 != s.pos ? s.pos : r, p = void 0 != s.c ? s.c : p), m(!0), void 0 != s.caret) k = s.caret; else { var u = l().validPositions; k = !f.keepStatic && (void 0 != u[r + 1] && t(r + 1, u[r].locator.slice(), r).length > 1 || void 0 != u[r].alternation) ? r + 1 : C(r) } l().p = k } if (d !== !1) { var x = this; if (setTimeout(function () { f.onKeyValidation.call(x, s, f) }, 0), l().writeOutBuffer && s !== !1) { var y = v(); F(h, y, c ? void 0 : f.numericInput ? D(k) : k, b, c !== !0), c !== !0 && setTimeout(function () { O(y) === !0 && i.trigger("complete") }, 0) } else q && (l().buffer = void 0, l().validPositions = l().undoPositions) } else q && (l().buffer = void 0, l().validPositions = l().undoPositions); if (f.showTooltip && i.prop("title", l().mask), c && a.isFunction(f.onBeforeWrite)) { var A = f.onBeforeWrite.call(this, b, v(), k, f); if (A && A.refreshFromBuffer) { var B = A.refreshFromBuffer; w(B === !0 ? B : B.start, B.end, A.buffer), m(!0), A.caret && (l().p = A.caret) } } b.preventDefault() } } function V(b) { var c = this, d = a(c), e = c._valueGet(!0), g = L(c); if ("propertychange" == b.type && c._valueGet().length <= B()) return !0; if ("paste" == b.type) { var h = e.substr(0, g.begin), i = e.substr(g.end, e.length); h == u().slice(0, g.begin).join("") && (h = ""), i == u().slice(g.end).join("") && (i = ""), window.clipboardData && window.clipboardData.getData ? e = h + window.clipboardData.getData("Text") + i : b.originalEvent && b.originalEvent.clipboardData && b.originalEvent.clipboardData.getData && (e = h + b.originalEvent.clipboardData.getData("text/plain") + i) } var j = e; if (a.isFunction(f.onBeforePaste)) { if (j = f.onBeforePaste.call(c, e, f), j === !1) return b.preventDefault(), !1; j || (j = e) } return H(c, !0, !1, eb ? j.split("").reverse() : j.split("")), d.click(), O(v()) === !0 && d.trigger("complete"), !1 } function W(b) { var c = this; H(c, !0, !1), O(v()) === !0 && a(c).trigger("complete"), b.preventDefault() } function X(a) { var b = this; _ = v().join(""), ("" == bb || 0 != a.originalEvent.data.indexOf(bb)) && (ab = L(b)) } function Y(b) { var c = this, d = ab || L(c); 0 == b.originalEvent.data.indexOf(bb) && (m(), d = { begin: 0, end: 0 }); var e = b.originalEvent.data; L(c, d.begin, d.end); for (var g = 0; g < e.length; g++) { var h = a.Event("keypress"); h.which = e.charCodeAt(g), fb = !1, hb = !1, U.call(c, h) } setTimeout(function () { var a = l().p; F(c, v(), f.numericInput ? D(a) : a) }, 0), bb = b.originalEvent.data } function Z() { } function $(b) { if (cb = a(b), cb.is(":input") && c(cb.attr("type"))) { if (cb.data("_inputmask", { maskset: e, opts: f, isRTL: !1 }), f.showTooltip && cb.prop("title", l().mask), ("rtl" == b.dir || f.rightAlign) && cb.css("text-align", "right"), "rtl" == b.dir || f.numericInput) { b.dir = "ltr", cb.removeAttr("dir"); var d = cb.data("_inputmask"); d.isRTL = !0, cb.data("_inputmask", d), eb = !0 } cb.unbind(".inputmask"), cb.closest("form").bind("submit", function () { _ != v().join("") && cb.change(), cb[0]._valueGet && cb[0]._valueGet() == u().join("") && cb[0]._valueSet(""), f.removeMaskOnSubmit && cb.inputmask("remove") }).bind("reset", function () { setTimeout(function () { cb.triggerHandler("setvalue.inputmask") }, 0) }), cb.bind("mouseenter.inputmask", function () { var b = a(this), c = this; !b.is(":focus") && f.showMaskOnHover && c._valueGet() != v().join("") && F(c, v()) }).bind("blur.inputmask", function (b) { var c = a(this), d = this; if (c.data("_inputmask")) { var e = d._valueGet(), g = v().slice(); ib = !0, _ != g.join("") && setTimeout(function () { c.change(), _ = g.join("") }, 0), "" != e && (f.clearMaskOnLostFocus && (e == u().join("") ? g = [] : N(g)), O(g) === !1 && (c.trigger("incomplete"), f.clearIncomplete && (m(), g = f.clearMaskOnLostFocus ? [] : u().slice())), F(d, g, void 0, b)) } }).bind("focus.inputmask", function () { var b = (a(this), this), c = b._valueGet(); f.showMaskOnFocus && (!f.showMaskOnHover || f.showMaskOnHover && "" == c) && b._valueGet() != v().join("") && F(b, v(), C(n())), _ = v().join("") }).bind("mouseleave.inputmask", function () { var b = a(this), c = this; if (f.clearMaskOnLostFocus) { var d = v().slice(), e = c._valueGet(); b.is(":focus") || e == b.attr("placeholder") || "" == e || (e == u().join("") ? d = [] : N(d), F(c, d)) } }).bind("click.inputmask", function () { var b = a(this), c = this; if (b.is(":focus")) { var d = L(c); if (d.begin == d.end) if (f.radixFocus && "" != f.radixPoint && -1 != a.inArray(f.radixPoint, v()) && (ib || v().join("") == u().join(""))) L(c, a.inArray(f.radixPoint, v())), ib = !1; else { var e = eb ? K(d.begin) : d.begin, g = C(n(e)); g > e ? L(c, A(e) ? e : C(e)) : L(c, g) } } }).bind("dblclick.inputmask", function () { var a = this; setTimeout(function () { L(a, 0, C(n())) }, 0) }).bind(k + ".inputmask dragdrop.inputmask drop.inputmask", V).bind("setvalue.inputmask", function () { var a = this; H(a, !0, !1), _ = v().join(""), (f.clearMaskOnLostFocus || f.clearIncomplete) && a._valueGet() == u().join("") && a._valueSet("") }).bind("cut.inputmask", function (b) { gb = !0; var c = this, d = a(c), e = L(c); S(c, a.inputmask.keyCode.DELETE, e), F(c, v(), l().p, b, _ != v().join("")), c._valueGet() == u().join("") && d.trigger("cleared"), f.showTooltip && d.prop("title", l().mask) }).bind("complete.inputmask", f.oncomplete).bind("incomplete.inputmask", f.onincomplete).bind("cleared.inputmask", f.oncleared), cb.bind("keydown.inputmask", T).bind("keypress.inputmask", U), j || cb.bind("compositionstart.inputmask", X).bind("compositionupdate.inputmask", Y).bind("compositionend.inputmask", Z), "paste" === k && cb.bind("input.inputmask", W), R(b); var g = a.isFunction(f.onBeforeMask) ? f.onBeforeMask.call(b, b._valueGet(), f) || b._valueGet() : b._valueGet(); H(b, !0, !1, g.split("")); var h = v().slice(); _ = h.join(""); var i; try { i = document.activeElement } catch (o) { } O(h) === !1 && f.clearIncomplete && m(), f.clearMaskOnLostFocus && (h.join("") == u().join("") ? h = [] : N(h)), F(b, h), i === b && L(b, C(n())), Q(b) } } var _, ab, bb, cb, db, eb = !1, fb = !1, gb = !1, hb = !1, ib = !0; if (void 0 != d) switch (d.action) { case "isComplete": return cb = a(d.el), e = cb.data("_inputmask").maskset, f = cb.data("_inputmask").opts, O(d.buffer); case "unmaskedvalue": return cb = d.$input, e = cb.data("_inputmask").maskset, f = cb.data("_inputmask").opts, eb = d.$input.data("_inputmask").isRTL, J(d.$input); case "mask": _ = v().join(""), $(d.el); break; case "format": cb = a({}), cb.data("_inputmask", { maskset: e, opts: f, isRTL: f.numericInput }), f.numericInput && (eb = !0); var jb = (a.isFunction(f.onBeforeMask) ? f.onBeforeMask.call(cb, d.value, f) || d.value : d.value).split(""); return H(cb, !1, !1, eb ? jb.reverse() : jb), a.isFunction(f.onBeforeWrite) && f.onBeforeWrite.call(this, void 0, v(), 0, f), d.metadata ? { value: eb ? v().slice().reverse().join("") : v().join(""), metadata: cb.inputmask("getmetadata") } : eb ? v().slice().reverse().join("") : v().join(""); case "isValid": cb = a({}), cb.data("_inputmask", { maskset: e, opts: f, isRTL: f.numericInput }), f.numericInput && (eb = !0); var jb = d.value.split(""); H(cb, !1, !0, eb ? jb.reverse() : jb); for (var kb = v(), lb = M(), mb = kb.length - 1; mb > lb && !A(mb); mb--); return kb.splice(lb, mb + 1 - lb), O(kb) && d.value == kb.join(""); case "getemptymask": return cb = a(d.el), e = cb.data("_inputmask").maskset, f = cb.data("_inputmask").opts, u(); case "remove": var nb = d.el; cb = a(nb), e = cb.data("_inputmask").maskset, f = cb.data("_inputmask").opts, nb._valueSet(J(cb)), cb.unbind(".inputmask"), cb.removeData("_inputmask"); var ob; Object.getOwnPropertyDescriptor && (ob = Object.getOwnPropertyDescriptor(nb, "value")), ob && ob.get ? nb._valueGet && Object.defineProperty(nb, "value", { get: nb._valueGet, set: nb._valueSet }) : document.__lookupGetter__ && nb.__lookupGetter__("value") && nb._valueGet && (nb.__defineGetter__("value", nb._valueGet), nb.__defineSetter__("value", nb._valueSet)); try { delete nb._valueGet, delete nb._valueSet } catch (pb) { nb._valueGet = void 0, nb._valueSet = void 0 } break; case "getmetadata": if (cb = a(d.el), e = cb.data("_inputmask").maskset, f = cb.data("_inputmask").opts, a.isArray(e.metadata)) { for (var qb, rb = n(), sb = rb; sb >= 0; sb--)if (l().validPositions[sb] && void 0 != l().validPositions[sb].alternation) { qb = l().validPositions[sb].alternation; break } return void 0 != qb ? e.metadata[l().validPositions[rb].locator[qb]] : e.metadata[0] } return e.metadata }
    } if (void 0 === a.fn.inputmask) { var g = navigator.userAgent, h = null !== g.match(new RegExp("iphone", "i")), i = (null !== g.match(new RegExp("android.*safari.*", "i")), null !== g.match(new RegExp("android.*chrome.*", "i"))), j = null !== g.match(new RegExp("android.*firefox.*", "i")), k = (/Kindle/i.test(g) || /Silk/i.test(g) || /KFTT/i.test(g) || /KFOT/i.test(g) || /KFJWA/i.test(g) || /KFJWI/i.test(g) || /KFSOWI/i.test(g) || /KFTHWA/i.test(g) || /KFTHWI/i.test(g) || /KFAPWA/i.test(g) || /KFAPWI/i.test(g), b("paste") ? "paste" : b("input") ? "input" : "propertychange"); a.inputmask = { defaults: { placeholder: "_", optionalmarker: { start: "[", end: "]" }, quantifiermarker: { start: "{", end: "}" }, groupmarker: { start: "(", end: ")" }, alternatormarker: "|", escapeChar: "\\", mask: null, oncomplete: a.noop, onincomplete: a.noop, oncleared: a.noop, repeat: 0, greedy: !0, autoUnmask: !1, removeMaskOnSubmit: !1, clearMaskOnLostFocus: !0, insertMode: !0, clearIncomplete: !1, aliases: {}, alias: null, onKeyDown: a.noop, onBeforeMask: void 0, onBeforePaste: void 0, onBeforeWrite: void 0, onUnMask: void 0, showMaskOnFocus: !0, showMaskOnHover: !0, onKeyValidation: a.noop, skipOptionalPartCharacter: " ", showTooltip: !1, numericInput: !1, rightAlign: !1, undoOnEscape: !0, radixPoint: "", radixFocus: !1, nojumps: !1, nojumpsThreshold: 0, keepStatic: void 0, definitions: { 9: { validator: "[0-9]", cardinality: 1, definitionSymbol: "*" }, a: { validator: "[A-Za-z\u0410-\u044f\u0401\u0451\xc0-\xff\xb5]", cardinality: 1, definitionSymbol: "*" }, "*": { validator: "[0-9A-Za-z\u0410-\u044f\u0401\u0451\xc0-\xff\xb5]", cardinality: 1 } }, ignorables: [8, 9, 13, 19, 27, 33, 34, 35, 36, 37, 38, 39, 40, 45, 46, 93, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123], isComplete: void 0, canClearPosition: a.noop, postValidation: void 0 }, keyCode: { ALT: 18, BACKSPACE: 8, CAPS_LOCK: 20, COMMA: 188, COMMAND: 91, COMMAND_LEFT: 91, COMMAND_RIGHT: 93, CONTROL: 17, DELETE: 46, DOWN: 40, END: 35, ENTER: 13, ESCAPE: 27, HOME: 36, INSERT: 45, LEFT: 37, MENU: 93, NUMPAD_ADD: 107, NUMPAD_DECIMAL: 110, NUMPAD_DIVIDE: 111, NUMPAD_ENTER: 108, NUMPAD_MULTIPLY: 106, NUMPAD_SUBTRACT: 109, PAGE_DOWN: 34, PAGE_UP: 33, PERIOD: 190, RIGHT: 39, SHIFT: 16, SPACE: 32, TAB: 9, UP: 38, WINDOWS: 91 }, masksCache: {}, escapeRegex: function (a) { var b = ["/", ".", "*", "+", "?", "|", "(", ")", "[", "]", "{", "}", "\\", "$", "^"]; return a.replace(new RegExp("(\\" + b.join("|\\") + ")", "gim"), "\\$1") }, format: function (b, c, g) { var h = a.extend(!0, {}, a.inputmask.defaults, c); return d(h.alias, c, h), f({ action: "format", value: b, metadata: g }, e(h, c && void 0 !== c.definitions), h) }, isValid: function (b, c) { var g = a.extend(!0, {}, a.inputmask.defaults, c); return d(g.alias, c, g), f({ action: "isValid", value: b }, e(g, c && void 0 !== c.definitions), g) } }, a.fn.inputmask = function (b, c) { function g(b, c, e) { var f = a(b); f.data("inputmask-alias") && d(f.data("inputmask-alias"), a.extend(!0, {}, c), c); for (var g in c) { var h = f.data("inputmask-" + g.toLowerCase()); void 0 != h && ("mask" == g && 0 == h.indexOf("[") ? (c[g] = h.replace(/[\s[\]]/g, "").split("','"), c[g][0] = c[g][0].replace("'", ""), c[g][c[g].length - 1] = c[g][c[g].length - 1].replace("'", "")) : c[g] = "boolean" == typeof h ? h : h.toString(), e && (e[g] = c[g])) } return c } var h, i = a.extend(!0, {}, a.inputmask.defaults, c); if ("string" == typeof b) switch (b) { case "mask": return d(i.alias, c, i), this.each(function () { return g(this, i), h = e(i, c && void 0 !== c.definitions), void 0 == h ? this : void f({ action: "mask", el: this }, h, i) }); case "unmaskedvalue": var j = a(this); return j.data("_inputmask") ? f({ action: "unmaskedvalue", $input: j }) : j.val(); case "remove": return this.each(function () { var b = a(this); b.data("_inputmask") && f({ action: "remove", el: this }) }); case "getemptymask": return this.data("_inputmask") ? f({ action: "getemptymask", el: this }) : ""; case "hasMaskedValue": return this.data("_inputmask") ? !this.data("_inputmask").opts.autoUnmask : !1; case "isComplete": return this.data("_inputmask") ? f({ action: "isComplete", buffer: this[0]._valueGet().split(""), el: this }) : !0; case "getmetadata": return this.data("_inputmask") ? f({ action: "getmetadata", el: this }) : void 0; default: return d(i.alias, c, i), d(b, c, i) || (i.mask = b), this.each(function () { return g(this, i), h = e(i, c && void 0 !== c.definitions), void 0 == h ? this : void f({ action: "mask", el: this }, h, i) }) } else { if ("object" == typeof b) return i = a.extend(!0, {}, a.inputmask.defaults, b), d(i.alias, b, i), this.each(function () { return g(this, i), h = e(i, b && void 0 !== b.definitions), void 0 == h ? this : void f({ action: "mask", el: this }, h, i) }); if (void 0 == b) return this.each(function () { var b = a(this).attr("data-inputmask"); if (b && "" != b) try { b = b.replace(new RegExp("'", "g"), '"'); var e = a.parseJSON("{" + b + "}"); a.extend(!0, e, c), i = a.extend(!0, {}, a.inputmask.defaults, e), i = g(this, i), d(i.alias, e, i), i.alias = void 0, a(this).inputmask("mask", i) } catch (f) { } if (a(this).attr("data-inputmask-mask") || a(this).attr("data-inputmask-alias")) { i = a.extend(!0, {}, a.inputmask.defaults, {}); var h = {}; i = g(this, i, h), d(i.alias, h, i), i.alias = void 0, a(this).inputmask("mask", i) } }) } } } return a.fn.inputmask
});

/*!
* jquery.inputmask.date.extensions.min.js
* http://github.com/RobinHerbots/jquery.inputmask
* Copyright (c) 2010 - 2015 Robin Herbots
* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
* Version: 3.1.62-7
*/
!function (a) { "function" == typeof define && define.amd ? define(["jquery", "./jquery.inputmask"], a) : a(jQuery) }(function (a) { return a.extend(a.inputmask.defaults.definitions, { h: { validator: "[01][0-9]|2[0-3]", cardinality: 2, prevalidator: [{ validator: "[0-2]", cardinality: 1 }] }, s: { validator: "[0-5][0-9]", cardinality: 2, prevalidator: [{ validator: "[0-5]", cardinality: 1 }] }, d: { validator: "0[1-9]|[12][0-9]|3[01]", cardinality: 2, prevalidator: [{ validator: "[0-3]", cardinality: 1 }] }, m: { validator: "0[1-9]|1[012]", cardinality: 2, prevalidator: [{ validator: "[01]", cardinality: 1 }] }, y: { validator: "(19|20)\\d{2}", cardinality: 4, prevalidator: [{ validator: "[12]", cardinality: 1 }, { validator: "(19|20)", cardinality: 2 }, { validator: "(19|20)\\d", cardinality: 3 }] } }), a.extend(a.inputmask.defaults.aliases, { "dd/mm/yyyy": { mask: "1/2/y", placeholder: "dd/mm/yyyy", regex: { val1pre: new RegExp("[0-3]"), val1: new RegExp("0[1-9]|[12][0-9]|3[01]"), val2pre: function (b) { var c = a.inputmask.escapeRegex.call(this, b); return new RegExp("((0[1-9]|[12][0-9]|3[01])" + c + "[01])") }, val2: function (b) { var c = a.inputmask.escapeRegex.call(this, b); return new RegExp("((0[1-9]|[12][0-9])" + c + "(0[1-9]|1[012]))|(30" + c + "(0[13-9]|1[012]))|(31" + c + "(0[13578]|1[02]))") } }, leapday: "29/02/", separator: "/", yearrange: { minyear: 1900, maxyear: 2099 }, isInYearRange: function (a, b, c) { if (isNaN(a)) return !1; var d = parseInt(a.concat(b.toString().slice(a.length))), e = parseInt(a.concat(c.toString().slice(a.length))); return (isNaN(d) ? !1 : d >= b && c >= d) || (isNaN(e) ? !1 : e >= b && c >= e) }, determinebaseyear: function (a, b, c) { var d = (new Date).getFullYear(); if (a > d) return a; if (d > b) { for (var e = b.toString().slice(0, 2), f = b.toString().slice(2, 4); e + c > b;)e--; var g = e + f; return a > g ? a : g } return d }, onKeyDown: function (b) { var c = a(this); if (b.ctrlKey && b.keyCode == a.inputmask.keyCode.RIGHT) { var d = new Date; c.val(d.getDate().toString() + (d.getMonth() + 1).toString() + d.getFullYear().toString()), c.triggerHandler("setvalue.inputmask") } }, getFrontValue: function (a, b, c) { for (var d = 0, e = 0, f = 0; f < a.length && "2" != a.charAt(f); f++) { var g = c.definitions[a.charAt(f)]; g ? (d += e, e = g.cardinality) : e++ } return b.join("").substr(d, e) }, definitions: { 1: { validator: function (a, b, c, d, e) { var f = e.regex.val1.test(a); return d || f || a.charAt(1) != e.separator && -1 == "-./".indexOf(a.charAt(1)) || !(f = e.regex.val1.test("0" + a.charAt(0))) ? f : (b.buffer[c - 1] = "0", { refreshFromBuffer: { start: c - 1, end: c }, pos: c, c: a.charAt(0) }) }, cardinality: 2, prevalidator: [{ validator: function (a, b, c, d, e) { var f = a; isNaN(b.buffer[c + 1]) || (f += b.buffer[c + 1]); var g = 1 == f.length ? e.regex.val1pre.test(f) : e.regex.val1.test(f); if (!d && !g) { if (g = e.regex.val1.test(a + "0")) return b.buffer[c] = a, b.buffer[++c] = "0", { pos: c, c: "0" }; if (g = e.regex.val1.test("0" + a)) return b.buffer[c] = "0", c++ , { pos: c } } return g }, cardinality: 1 }] }, 2: { validator: function (a, b, c, d, e) { var f = e.getFrontValue(b.mask, b.buffer, e); -1 != f.indexOf(e.placeholder[0]) && (f = "01" + e.separator); var g = e.regex.val2(e.separator).test(f + a); if (!d && !g && (a.charAt(1) == e.separator || -1 != "-./".indexOf(a.charAt(1))) && (g = e.regex.val2(e.separator).test(f + "0" + a.charAt(0)))) return b.buffer[c - 1] = "0", { refreshFromBuffer: { start: c - 1, end: c }, pos: c, c: a.charAt(0) }; if (e.mask.indexOf("2") == e.mask.length - 1 && g) { var h = b.buffer.join("").substr(4, 4) + a; if (h != e.leapday) return !0; var i = parseInt(b.buffer.join("").substr(0, 4), 10); return i % 4 === 0 ? i % 100 === 0 ? i % 400 === 0 ? !0 : !1 : !0 : !1 } return g }, cardinality: 2, prevalidator: [{ validator: function (a, b, c, d, e) { isNaN(b.buffer[c + 1]) || (a += b.buffer[c + 1]); var f = e.getFrontValue(b.mask, b.buffer, e); -1 != f.indexOf(e.placeholder[0]) && (f = "01" + e.separator); var g = 1 == a.length ? e.regex.val2pre(e.separator).test(f + a) : e.regex.val2(e.separator).test(f + a); return d || g || !(g = e.regex.val2(e.separator).test(f + "0" + a)) ? g : (b.buffer[c] = "0", c++ , { pos: c }) }, cardinality: 1 }] }, y: { validator: function (a, b, c, d, e) { if (e.isInYearRange(a, e.yearrange.minyear, e.yearrange.maxyear)) { var f = b.buffer.join("").substr(0, 6); if (f != e.leapday) return !0; var g = parseInt(a, 10); return g % 4 === 0 ? g % 100 === 0 ? g % 400 === 0 ? !0 : !1 : !0 : !1 } return !1 }, cardinality: 4, prevalidator: [{ validator: function (a, b, c, d, e) { var f = e.isInYearRange(a, e.yearrange.minyear, e.yearrange.maxyear); if (!d && !f) { var g = e.determinebaseyear(e.yearrange.minyear, e.yearrange.maxyear, a + "0").toString().slice(0, 1); if (f = e.isInYearRange(g + a, e.yearrange.minyear, e.yearrange.maxyear)) return b.buffer[c++] = g.charAt(0), { pos: c }; if (g = e.determinebaseyear(e.yearrange.minyear, e.yearrange.maxyear, a + "0").toString().slice(0, 2), f = e.isInYearRange(g + a, e.yearrange.minyear, e.yearrange.maxyear)) return b.buffer[c++] = g.charAt(0), b.buffer[c++] = g.charAt(1), { pos: c } } return f }, cardinality: 1 }, { validator: function (a, b, c, d, e) { var f = e.isInYearRange(a, e.yearrange.minyear, e.yearrange.maxyear); if (!d && !f) { var g = e.determinebaseyear(e.yearrange.minyear, e.yearrange.maxyear, a).toString().slice(0, 2); if (f = e.isInYearRange(a[0] + g[1] + a[1], e.yearrange.minyear, e.yearrange.maxyear)) return b.buffer[c++] = g.charAt(1), { pos: c }; if (g = e.determinebaseyear(e.yearrange.minyear, e.yearrange.maxyear, a).toString().slice(0, 2), e.isInYearRange(g + a, e.yearrange.minyear, e.yearrange.maxyear)) { var h = b.buffer.join("").substr(0, 6); if (h != e.leapday) f = !0; else { var i = parseInt(a, 10); f = i % 4 === 0 ? i % 100 === 0 ? i % 400 === 0 ? !0 : !1 : !0 : !1 } } else f = !1; if (f) return b.buffer[c - 1] = g.charAt(0), b.buffer[c++] = g.charAt(1), b.buffer[c++] = a.charAt(0), { refreshFromBuffer: { start: c - 3, end: c }, pos: c } } return f }, cardinality: 2 }, { validator: function (a, b, c, d, e) { return e.isInYearRange(a, e.yearrange.minyear, e.yearrange.maxyear) }, cardinality: 3 }] } }, insertMode: !1, autoUnmask: !1 }, "mm/dd/yyyy": { placeholder: "mm/dd/yyyy", alias: "dd/mm/yyyy", regex: { val2pre: function (b) { var c = a.inputmask.escapeRegex.call(this, b); return new RegExp("((0[13-9]|1[012])" + c + "[0-3])|(02" + c + "[0-2])") }, val2: function (b) { var c = a.inputmask.escapeRegex.call(this, b); return new RegExp("((0[1-9]|1[012])" + c + "(0[1-9]|[12][0-9]))|((0[13-9]|1[012])" + c + "30)|((0[13578]|1[02])" + c + "31)") }, val1pre: new RegExp("[01]"), val1: new RegExp("0[1-9]|1[012]") }, leapday: "02/29/", onKeyDown: function (b) { var c = a(this); if (b.ctrlKey && b.keyCode == a.inputmask.keyCode.RIGHT) { var d = new Date; c.val((d.getMonth() + 1).toString() + d.getDate().toString() + d.getFullYear().toString()), c.triggerHandler("setvalue.inputmask") } } }, "yyyy/mm/dd": { mask: "y/1/2", placeholder: "yyyy/mm/dd", alias: "mm/dd/yyyy", leapday: "/02/29", onKeyDown: function (b) { var c = a(this); if (b.ctrlKey && b.keyCode == a.inputmask.keyCode.RIGHT) { var d = new Date; c.val(d.getFullYear().toString() + (d.getMonth() + 1).toString() + d.getDate().toString()), c.triggerHandler("setvalue.inputmask") } } }, "dd.mm.yyyy": { mask: "1.2.y", placeholder: "dd.mm.yyyy", leapday: "29.02.", separator: ".", alias: "dd/mm/yyyy" }, "dd-mm-yyyy": { mask: "1-2-y", placeholder: "dd-mm-yyyy", leapday: "29-02-", separator: "-", alias: "dd/mm/yyyy" }, "mm.dd.yyyy": { mask: "1.2.y", placeholder: "mm.dd.yyyy", leapday: "02.29.", separator: ".", alias: "mm/dd/yyyy" }, "mm-dd-yyyy": { mask: "1-2-y", placeholder: "mm-dd-yyyy", leapday: "02-29-", separator: "-", alias: "mm/dd/yyyy" }, "yyyy.mm.dd": { mask: "y.1.2", placeholder: "yyyy.mm.dd", leapday: ".02.29", separator: ".", alias: "yyyy/mm/dd" }, "yyyy-mm-dd": { mask: "y-1-2", placeholder: "yyyy-mm-dd", leapday: "-02-29", separator: "-", alias: "yyyy/mm/dd" }, datetime: { mask: "1/2/y h:s", placeholder: "dd/mm/yyyy hh:mm", alias: "dd/mm/yyyy", regex: { hrspre: new RegExp("[012]"), hrs24: new RegExp("2[0-4]|1[3-9]"), hrs: new RegExp("[01][0-9]|2[0-4]"), ampm: new RegExp("^[a|p|A|P][m|M]"), mspre: new RegExp("[0-5]"), ms: new RegExp("[0-5][0-9]") }, timeseparator: ":", hourFormat: "24", definitions: { h: { validator: function (a, b, c, d, e) { if ("24" == e.hourFormat && 24 == parseInt(a, 10)) return b.buffer[c - 1] = "0", b.buffer[c] = "0", { refreshFromBuffer: { start: c - 1, end: c }, c: "0" }; var f = e.regex.hrs.test(a); if (!d && !f && (a.charAt(1) == e.timeseparator || -1 != "-.:".indexOf(a.charAt(1))) && (f = e.regex.hrs.test("0" + a.charAt(0)))) return b.buffer[c - 1] = "0", b.buffer[c] = a.charAt(0), c++ , { refreshFromBuffer: { start: c - 2, end: c }, pos: c, c: e.timeseparator }; if (f && "24" !== e.hourFormat && e.regex.hrs24.test(a)) { var g = parseInt(a, 10); return 24 == g ? (b.buffer[c + 5] = "a", b.buffer[c + 6] = "m") : (b.buffer[c + 5] = "p", b.buffer[c + 6] = "m"), g -= 12, 10 > g ? (b.buffer[c] = g.toString(), b.buffer[c - 1] = "0") : (b.buffer[c] = g.toString().charAt(1), b.buffer[c - 1] = g.toString().charAt(0)), { refreshFromBuffer: { start: c - 1, end: c + 6 }, c: b.buffer[c] } } return f }, cardinality: 2, prevalidator: [{ validator: function (a, b, c, d, e) { var f = e.regex.hrspre.test(a); return d || f || !(f = e.regex.hrs.test("0" + a)) ? f : (b.buffer[c] = "0", c++ , { pos: c }) }, cardinality: 1 }] }, s: { validator: "[0-5][0-9]", cardinality: 2, prevalidator: [{ validator: function (a, b, c, d, e) { var f = e.regex.mspre.test(a); return d || f || !(f = e.regex.ms.test("0" + a)) ? f : (b.buffer[c] = "0", c++ , { pos: c }) }, cardinality: 1 }] }, t: { validator: function (a, b, c, d, e) { return e.regex.ampm.test(a + "m") }, casing: "lower", cardinality: 1 } }, insertMode: !1, autoUnmask: !1 }, datetime12: { mask: "1/2/y h:s t\\m", placeholder: "dd/mm/yyyy hh:mm xm", alias: "datetime", hourFormat: "12" }, "hh:mm t": { mask: "h:s t\\m", placeholder: "hh:mm xm", alias: "datetime", hourFormat: "12" }, "h:s t": { mask: "h:s t\\m", placeholder: "hh:mm xm", alias: "datetime", hourFormat: "12" }, "hh:mm:ss": { mask: "h:s:s", placeholder: "hh:mm:ss", alias: "datetime", autoUnmask: !1 }, "hh:mm": { mask: "h:s", placeholder: "hh:mm", alias: "datetime", autoUnmask: !1 }, date: { alias: "dd/mm/yyyy" }, "mm/yyyy": { mask: "1/y", placeholder: "mm/yyyy", leapday: "donotuse", separator: "/", alias: "mm/dd/yyyy" } }), a.fn.inputmask });




/*! jQuery UI - v1.11.3 - 2015-03-01
* http://jqueryui.com
* Includes: core.js, datepicker.js
* Copyright 2015 jQuery Foundation and other contributors; Licensed MIT */

(function (e) { "function" == typeof define && define.amd ? define(["jquery"], e) : e(jQuery) })(function (e) {
    function t(t, s) { var a, n, r, o = t.nodeName.toLowerCase(); return "area" === o ? (a = t.parentNode, n = a.name, t.href && n && "map" === a.nodeName.toLowerCase() ? (r = e("img[usemap='#" + n + "']")[0], !!r && i(r)) : !1) : (/^(input|select|textarea|button|object)$/.test(o) ? !t.disabled : "a" === o ? t.href || s : s) && i(t) } function i(t) { return e.expr.filters.visible(t) && !e(t).parents().addBack().filter(function () { return "hidden" === e.css(this, "visibility") }).length } function s(e) { for (var t, i; e.length && e[0] !== document;) { if (t = e.css("position"), ("absolute" === t || "relative" === t || "fixed" === t) && (i = parseInt(e.css("zIndex"), 10), !isNaN(i) && 0 !== i)) return i; e = e.parent() } return 0 } function a() { this._curInst = null, this._keyEvent = !1, this._disabledInputs = [], this._datepickerShowing = !1, this._inDialog = !1, this._mainDivId = "ui-datepicker-div", this._inlineClass = "ui-datepicker-inline", this._appendClass = "ui-datepicker-append", this._triggerClass = "ui-datepicker-trigger", this._dialogClass = "ui-datepicker-dialog", this._disableClass = "ui-datepicker-disabled", this._unselectableClass = "ui-datepicker-unselectable", this._currentClass = "ui-datepicker-current-day", this._dayOverClass = "ui-datepicker-days-cell-over", this.regional = [], this.regional[""] = { closeText: "Done", prevText: "Prev", nextText: "Next", currentText: "Today", monthNames: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], monthNamesShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], dayNames: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], dayNamesShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], dayNamesMin: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], weekHeader: "Wk", dateFormat: "mm/dd/yy", firstDay: 0, isRTL: !1, showMonthAfterYear: !1, yearSuffix: "" }, this._defaults = { showOn: "focus", showAnim: "fadeIn", showOptions: {}, defaultDate: null, appendText: "", buttonText: "...", buttonImage: "", buttonImageOnly: !1, hideIfNoPrevNext: !1, navigationAsDateFormat: !1, gotoCurrent: !1, changeMonth: !1, changeYear: !1, yearRange: "c-10:c+10", showOtherMonths: !1, selectOtherMonths: !1, showWeek: !1, calculateWeek: this.iso8601Week, shortYearCutoff: "+10", minDate: null, maxDate: null, duration: "fast", beforeShowDay: null, beforeShow: null, onSelect: null, onChangeMonthYear: null, onClose: null, numberOfMonths: 1, showCurrentAtPos: 0, stepMonths: 1, stepBigMonths: 12, altField: "", altFormat: "", constrainInput: !0, showButtonPanel: !1, autoSize: !1, disabled: !1 }, e.extend(this._defaults, this.regional[""]), this.regional.en = e.extend(!0, {}, this.regional[""]), this.regional["en-US"] = e.extend(!0, {}, this.regional.en), this.dpDiv = n(e("<div id='" + this._mainDivId + "' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>")) } function n(t) { var i = "button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a"; return t.delegate(i, "mouseout", function () { e(this).removeClass("ui-state-hover"), -1 !== this.className.indexOf("ui-datepicker-prev") && e(this).removeClass("ui-datepicker-prev-hover"), -1 !== this.className.indexOf("ui-datepicker-next") && e(this).removeClass("ui-datepicker-next-hover") }).delegate(i, "mouseover", r) } function r() { e.datepicker._isDisabledDatepicker(h.inline ? h.dpDiv.parent()[0] : h.input[0]) || (e(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover"), e(this).addClass("ui-state-hover"), -1 !== this.className.indexOf("ui-datepicker-prev") && e(this).addClass("ui-datepicker-prev-hover"), -1 !== this.className.indexOf("ui-datepicker-next") && e(this).addClass("ui-datepicker-next-hover")) } function o(t, i) { e.extend(t, i); for (var s in i) null == i[s] && (t[s] = i[s]); return t } e.ui = e.ui || {}, e.extend(e.ui, { version: "1.11.3", keyCode: { BACKSPACE: 8, COMMA: 188, DELETE: 46, DOWN: 40, END: 35, ENTER: 13, ESCAPE: 27, HOME: 36, LEFT: 37, PAGE_DOWN: 34, PAGE_UP: 33, PERIOD: 190, RIGHT: 39, SPACE: 32, TAB: 9, UP: 38 } }), e.fn.extend({ scrollParent: function (t) { var i = this.css("position"), s = "absolute" === i, a = t ? /(auto|scroll|hidden)/ : /(auto|scroll)/, n = this.parents().filter(function () { var t = e(this); return s && "static" === t.css("position") ? !1 : a.test(t.css("overflow") + t.css("overflow-y") + t.css("overflow-x")) }).eq(0); return "fixed" !== i && n.length ? n : e(this[0].ownerDocument || document) }, uniqueId: function () { var e = 0; return function () { return this.each(function () { this.id || (this.id = "ui-id-" + ++e) }) } }(), removeUniqueId: function () { return this.each(function () { /^ui-id-\d+$/.test(this.id) && e(this).removeAttr("id") }) } }), e.extend(e.expr[":"], { data: e.expr.createPseudo ? e.expr.createPseudo(function (t) { return function (i) { return !!e.data(i, t) } }) : function (t, i, s) { return !!e.data(t, s[3]) }, focusable: function (i) { return t(i, !isNaN(e.attr(i, "tabindex"))) }, tabbable: function (i) { var s = e.attr(i, "tabindex"), a = isNaN(s); return (a || s >= 0) && t(i, !a) } }), e("<a>").outerWidth(1).jquery || e.each(["Width", "Height"], function (t, i) { function s(t, i, s, n) { return e.each(a, function () { i -= parseFloat(e.css(t, "padding" + this)) || 0, s && (i -= parseFloat(e.css(t, "border" + this + "Width")) || 0), n && (i -= parseFloat(e.css(t, "margin" + this)) || 0) }), i } var a = "Width" === i ? ["Left", "Right"] : ["Top", "Bottom"], n = i.toLowerCase(), r = { innerWidth: e.fn.innerWidth, innerHeight: e.fn.innerHeight, outerWidth: e.fn.outerWidth, outerHeight: e.fn.outerHeight }; e.fn["inner" + i] = function (t) { return void 0 === t ? r["inner" + i].call(this) : this.each(function () { e(this).css(n, s(this, t) + "px") }) }, e.fn["outer" + i] = function (t, a) { return "number" != typeof t ? r["outer" + i].call(this, t) : this.each(function () { e(this).css(n, s(this, t, !0, a) + "px") }) } }), e.fn.addBack || (e.fn.addBack = function (e) { return this.add(null == e ? this.prevObject : this.prevObject.filter(e)) }), e("<a>").data("a-b", "a").removeData("a-b").data("a-b") && (e.fn.removeData = function (t) { return function (i) { return arguments.length ? t.call(this, e.camelCase(i)) : t.call(this) } }(e.fn.removeData)), e.ui.ie = !!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase()), e.fn.extend({ focus: function (t) { return function (i, s) { return "number" == typeof i ? this.each(function () { var t = this; setTimeout(function () { e(t).focus(), s && s.call(t) }, i) }) : t.apply(this, arguments) } }(e.fn.focus), disableSelection: function () { var e = "onselectstart" in document.createElement("div") ? "selectstart" : "mousedown"; return function () { return this.bind(e + ".ui-disableSelection", function (e) { e.preventDefault() }) } }(), enableSelection: function () { return this.unbind(".ui-disableSelection") }, zIndex: function (t) { if (void 0 !== t) return this.css("zIndex", t); if (this.length) for (var i, s, a = e(this[0]); a.length && a[0] !== document;) { if (i = a.css("position"), ("absolute" === i || "relative" === i || "fixed" === i) && (s = parseInt(a.css("zIndex"), 10), !isNaN(s) && 0 !== s)) return s; a = a.parent() } return 0 } }), e.ui.plugin = { add: function (t, i, s) { var a, n = e.ui[t].prototype; for (a in s) n.plugins[a] = n.plugins[a] || [], n.plugins[a].push([i, s[a]]) }, call: function (e, t, i, s) { var a, n = e.plugins[t]; if (n && (s || e.element[0].parentNode && 11 !== e.element[0].parentNode.nodeType)) for (a = 0; n.length > a; a++)e.options[n[a][0]] && n[a][1].apply(e.element, i) } }, e.extend(e.ui, { datepicker: { version: "1.11.3" } }); var h; e.extend(a.prototype, {
        markerClassName: "hasDatepicker", maxRows: 4, _widgetDatepicker: function () { return this.dpDiv }, setDefaults: function (e) { return o(this._defaults, e || {}), this }, _attachDatepicker: function (t, i) { var s, a, n; s = t.nodeName.toLowerCase(), a = "div" === s || "span" === s, t.id || (this.uuid += 1, t.id = "dp" + this.uuid), n = this._newInst(e(t), a), n.settings = e.extend({}, i || {}), "input" === s ? this._connectDatepicker(t, n) : a && this._inlineDatepicker(t, n) }, _newInst: function (t, i) { var s = t[0].id.replace(/([^A-Za-z0-9_\-])/g, "\\\\$1"); return { id: s, input: t, selectedDay: 0, selectedMonth: 0, selectedYear: 0, drawMonth: 0, drawYear: 0, inline: i, dpDiv: i ? n(e("<div class='" + this._inlineClass + " ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>")) : this.dpDiv } }, _connectDatepicker: function (t, i) { var s = e(t); i.append = e([]), i.trigger = e([]), s.hasClass(this.markerClassName) || (this._attachments(s, i), s.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).keyup(this._doKeyUp), this._autoSize(i), e.data(t, "datepicker", i), i.settings.disabled && this._disableDatepicker(t)) }, _attachments: function (t, i) { var s, a, n, r = this._get(i, "appendText"), o = this._get(i, "isRTL"); i.append && i.append.remove(), r && (i.append = e("<span class='" + this._appendClass + "'>" + r + "</span>"), t[o ? "before" : "after"](i.append)), t.unbind("focus", this._showDatepicker), i.trigger && i.trigger.remove(), s = this._get(i, "showOn"), ("focus" === s || "both" === s) && t.focus(this._showDatepicker), ("button" === s || "both" === s) && (a = this._get(i, "buttonText"), n = this._get(i, "buttonImage"), i.trigger = e(this._get(i, "buttonImageOnly") ? e("<img/>").addClass(this._triggerClass).attr({ src: n, alt: a, title: a }) : e("<button type='button'></button>").addClass(this._triggerClass).html(n ? e("<img/>").attr({ src: n, alt: a, title: a }) : a)), t[o ? "before" : "after"](i.trigger), i.trigger.click(function () { return e.datepicker._datepickerShowing && e.datepicker._lastInput === t[0] ? e.datepicker._hideDatepicker() : e.datepicker._datepickerShowing && e.datepicker._lastInput !== t[0] ? (e.datepicker._hideDatepicker(), e.datepicker._showDatepicker(t[0])) : e.datepicker._showDatepicker(t[0]), !1 })) }, _autoSize: function (e) { if (this._get(e, "autoSize") && !e.inline) { var t, i, s, a, n = new Date(2009, 11, 20), r = this._get(e, "dateFormat"); r.match(/[DM]/) && (t = function (e) { for (i = 0, s = 0, a = 0; e.length > a; a++)e[a].length > i && (i = e[a].length, s = a); return s }, n.setMonth(t(this._get(e, r.match(/MM/) ? "monthNames" : "monthNamesShort"))), n.setDate(t(this._get(e, r.match(/DD/) ? "dayNames" : "dayNamesShort")) + 20 - n.getDay())), e.input.attr("size", this._formatDate(e, n).length) } }, _inlineDatepicker: function (t, i) { var s = e(t); s.hasClass(this.markerClassName) || (s.addClass(this.markerClassName).append(i.dpDiv), e.data(t, "datepicker", i), this._setDate(i, this._getDefaultDate(i), !0), this._updateDatepicker(i), this._updateAlternate(i), i.settings.disabled && this._disableDatepicker(t), i.dpDiv.css("display", "block")) }, _dialogDatepicker: function (t, i, s, a, n) { var r, h, l, u, d, c = this._dialogInst; return c || (this.uuid += 1, r = "dp" + this.uuid, this._dialogInput = e("<input type='text' id='" + r + "' style='position: absolute; top: -100px; width: 0px;'/>"), this._dialogInput.keydown(this._doKeyDown), e("body").append(this._dialogInput), c = this._dialogInst = this._newInst(this._dialogInput, !1), c.settings = {}, e.data(this._dialogInput[0], "datepicker", c)), o(c.settings, a || {}), i = i && i.constructor === Date ? this._formatDate(c, i) : i, this._dialogInput.val(i), this._pos = n ? n.length ? n : [n.pageX, n.pageY] : null, this._pos || (h = document.documentElement.clientWidth, l = document.documentElement.clientHeight, u = document.documentElement.scrollLeft || document.body.scrollLeft, d = document.documentElement.scrollTop || document.body.scrollTop, this._pos = [h / 2 - 100 + u, l / 2 - 150 + d]), this._dialogInput.css("left", this._pos[0] + 20 + "px").css("top", this._pos[1] + "px"), c.settings.onSelect = s, this._inDialog = !0, this.dpDiv.addClass(this._dialogClass), this._showDatepicker(this._dialogInput[0]), e.blockUI && e.blockUI(this.dpDiv), e.data(this._dialogInput[0], "datepicker", c), this }, _destroyDatepicker: function (t) { var i, s = e(t), a = e.data(t, "datepicker"); s.hasClass(this.markerClassName) && (i = t.nodeName.toLowerCase(), e.removeData(t, "datepicker"), "input" === i ? (a.append.remove(), a.trigger.remove(), s.removeClass(this.markerClassName).unbind("focus", this._showDatepicker).unbind("keydown", this._doKeyDown).unbind("keypress", this._doKeyPress).unbind("keyup", this._doKeyUp)) : ("div" === i || "span" === i) && s.removeClass(this.markerClassName).empty(), h === a && (h = null)) }, _enableDatepicker: function (t) { var i, s, a = e(t), n = e.data(t, "datepicker"); a.hasClass(this.markerClassName) && (i = t.nodeName.toLowerCase(), "input" === i ? (t.disabled = !1, n.trigger.filter("button").each(function () { this.disabled = !1 }).end().filter("img").css({ opacity: "1.0", cursor: "" })) : ("div" === i || "span" === i) && (s = a.children("." + this._inlineClass), s.children().removeClass("ui-state-disabled"), s.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled", !1)), this._disabledInputs = e.map(this._disabledInputs, function (e) { return e === t ? null : e })) }, _disableDatepicker: function (t) { var i, s, a = e(t), n = e.data(t, "datepicker"); a.hasClass(this.markerClassName) && (i = t.nodeName.toLowerCase(), "input" === i ? (t.disabled = !0, n.trigger.filter("button").each(function () { this.disabled = !0 }).end().filter("img").css({ opacity: "0.5", cursor: "default" })) : ("div" === i || "span" === i) && (s = a.children("." + this._inlineClass), s.children().addClass("ui-state-disabled"), s.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled", !0)), this._disabledInputs = e.map(this._disabledInputs, function (e) { return e === t ? null : e }), this._disabledInputs[this._disabledInputs.length] = t) }, _isDisabledDatepicker: function (e) { if (!e) return !1; for (var t = 0; this._disabledInputs.length > t; t++)if (this._disabledInputs[t] === e) return !0; return !1 }, _getInst: function (t) { try { return e.data(t, "datepicker") } catch (i) { throw "Missing instance data for this datepicker" } }, _optionDatepicker: function (t, i, s) { var a, n, r, h, l = this._getInst(t); return 2 === arguments.length && "string" == typeof i ? "defaults" === i ? e.extend({}, e.datepicker._defaults) : l ? "all" === i ? e.extend({}, l.settings) : this._get(l, i) : null : (a = i || {}, "string" == typeof i && (a = {}, a[i] = s), l && (this._curInst === l && this._hideDatepicker(), n = this._getDateDatepicker(t, !0), r = this._getMinMaxDate(l, "min"), h = this._getMinMaxDate(l, "max"), o(l.settings, a), null !== r && void 0 !== a.dateFormat && void 0 === a.minDate && (l.settings.minDate = this._formatDate(l, r)), null !== h && void 0 !== a.dateFormat && void 0 === a.maxDate && (l.settings.maxDate = this._formatDate(l, h)), "disabled" in a && (a.disabled ? this._disableDatepicker(t) : this._enableDatepicker(t)), this._attachments(e(t), l), this._autoSize(l), this._setDate(l, n), this._updateAlternate(l), this._updateDatepicker(l)), void 0) }, _changeDatepicker: function (e, t, i) { this._optionDatepicker(e, t, i) }, _refreshDatepicker: function (e) { var t = this._getInst(e); t && this._updateDatepicker(t) }, _setDateDatepicker: function (e, t) { var i = this._getInst(e); i && (this._setDate(i, t), this._updateDatepicker(i), this._updateAlternate(i)) }, _getDateDatepicker: function (e, t) { var i = this._getInst(e); return i && !i.inline && this._setDateFromField(i, t), i ? this._getDate(i) : null }, _doKeyDown: function (t) { var i, s, a, n = e.datepicker._getInst(t.target), r = !0, o = n.dpDiv.is(".ui-datepicker-rtl"); if (n._keyEvent = !0, e.datepicker._datepickerShowing) switch (t.keyCode) { case 9: e.datepicker._hideDatepicker(), r = !1; break; case 13: return a = e("td." + e.datepicker._dayOverClass + ":not(." + e.datepicker._currentClass + ")", n.dpDiv), a[0] && e.datepicker._selectDay(t.target, n.selectedMonth, n.selectedYear, a[0]), i = e.datepicker._get(n, "onSelect"), i ? (s = e.datepicker._formatDate(n), i.apply(n.input ? n.input[0] : null, [s, n])) : e.datepicker._hideDatepicker(), !1; case 27: e.datepicker._hideDatepicker(); break; case 33: e.datepicker._adjustDate(t.target, t.ctrlKey ? -e.datepicker._get(n, "stepBigMonths") : -e.datepicker._get(n, "stepMonths"), "M"); break; case 34: e.datepicker._adjustDate(t.target, t.ctrlKey ? +e.datepicker._get(n, "stepBigMonths") : +e.datepicker._get(n, "stepMonths"), "M"); break; case 35: (t.ctrlKey || t.metaKey) && e.datepicker._clearDate(t.target), r = t.ctrlKey || t.metaKey; break; case 36: (t.ctrlKey || t.metaKey) && e.datepicker._gotoToday(t.target), r = t.ctrlKey || t.metaKey; break; case 37: (t.ctrlKey || t.metaKey) && e.datepicker._adjustDate(t.target, o ? 1 : -1, "D"), r = t.ctrlKey || t.metaKey, t.originalEvent.altKey && e.datepicker._adjustDate(t.target, t.ctrlKey ? -e.datepicker._get(n, "stepBigMonths") : -e.datepicker._get(n, "stepMonths"), "M"); break; case 38: (t.ctrlKey || t.metaKey) && e.datepicker._adjustDate(t.target, -7, "D"), r = t.ctrlKey || t.metaKey; break; case 39: (t.ctrlKey || t.metaKey) && e.datepicker._adjustDate(t.target, o ? -1 : 1, "D"), r = t.ctrlKey || t.metaKey, t.originalEvent.altKey && e.datepicker._adjustDate(t.target, t.ctrlKey ? +e.datepicker._get(n, "stepBigMonths") : +e.datepicker._get(n, "stepMonths"), "M"); break; case 40: (t.ctrlKey || t.metaKey) && e.datepicker._adjustDate(t.target, 7, "D"), r = t.ctrlKey || t.metaKey; break; default: r = !1 } else 36 === t.keyCode && t.ctrlKey ? e.datepicker._showDatepicker(this) : r = !1; r && (t.preventDefault(), t.stopPropagation()) }, _doKeyPress: function (t) { var i, s, a = e.datepicker._getInst(t.target); return e.datepicker._get(a, "constrainInput") ? (i = e.datepicker._possibleChars(e.datepicker._get(a, "dateFormat")), s = String.fromCharCode(null == t.charCode ? t.keyCode : t.charCode), t.ctrlKey || t.metaKey || " " > s || !i || i.indexOf(s) > -1) : void 0 }, _doKeyUp: function (t) { var i, s = e.datepicker._getInst(t.target); if (s.input.val() !== s.lastVal) try { i = e.datepicker.parseDate(e.datepicker._get(s, "dateFormat"), s.input ? s.input.val() : null, e.datepicker._getFormatConfig(s)), i && (e.datepicker._setDateFromField(s), e.datepicker._updateAlternate(s), e.datepicker._updateDatepicker(s)) } catch (a) { } return !0 }, _showDatepicker: function (t) { if (t = t.target || t, "input" !== t.nodeName.toLowerCase() && (t = e("input", t.parentNode)[0]), !e.datepicker._isDisabledDatepicker(t) && e.datepicker._lastInput !== t) { var i, a, n, r, h, l, u; i = e.datepicker._getInst(t), e.datepicker._curInst && e.datepicker._curInst !== i && (e.datepicker._curInst.dpDiv.stop(!0, !0), i && e.datepicker._datepickerShowing && e.datepicker._hideDatepicker(e.datepicker._curInst.input[0])), a = e.datepicker._get(i, "beforeShow"), n = a ? a.apply(t, [t, i]) : {}, n !== !1 && (o(i.settings, n), i.lastVal = null, e.datepicker._lastInput = t, e.datepicker._setDateFromField(i), e.datepicker._inDialog && (t.value = ""), e.datepicker._pos || (e.datepicker._pos = e.datepicker._findPos(t), e.datepicker._pos[1] += t.offsetHeight), r = !1, e(t).parents().each(function () { return r |= "fixed" === e(this).css("position"), !r }), h = { left: e.datepicker._pos[0], top: e.datepicker._pos[1] }, e.datepicker._pos = null, i.dpDiv.empty(), i.dpDiv.css({ position: "absolute", display: "block", top: "-1000px" }), e.datepicker._updateDatepicker(i), h = e.datepicker._checkOffset(i, h, r), i.dpDiv.css({ position: e.datepicker._inDialog && e.blockUI ? "static" : r ? "fixed" : "absolute", display: "none", left: h.left + "px", top: h.top + "px" }), i.inline || (l = e.datepicker._get(i, "showAnim"), u = e.datepicker._get(i, "duration"), i.dpDiv.css("z-index", s(e(t)) + 1), e.datepicker._datepickerShowing = !0, e.effects && e.effects.effect[l] ? i.dpDiv.show(l, e.datepicker._get(i, "showOptions"), u) : i.dpDiv[l || "show"](l ? u : null), e.datepicker._shouldFocusInput(i) && i.input.focus(), e.datepicker._curInst = i)) } }, _updateDatepicker: function (t) { this.maxRows = 4, h = t, t.dpDiv.empty().append(this._generateHTML(t)), this._attachHandlers(t); var i, s = this._getNumberOfMonths(t), a = s[1], n = 17, o = t.dpDiv.find("." + this._dayOverClass + " a"); o.length > 0 && r.apply(o.get(0)), t.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width(""), a > 1 && t.dpDiv.addClass("ui-datepicker-multi-" + a).css("width", n * a + "em"), t.dpDiv[(1 !== s[0] || 1 !== s[1] ? "add" : "remove") + "Class"]("ui-datepicker-multi"), t.dpDiv[(this._get(t, "isRTL") ? "add" : "remove") + "Class"]("ui-datepicker-rtl"), t === e.datepicker._curInst && e.datepicker._datepickerShowing && e.datepicker._shouldFocusInput(t) && t.input.focus(), t.yearshtml && (i = t.yearshtml, setTimeout(function () { i === t.yearshtml && t.yearshtml && t.dpDiv.find("select.ui-datepicker-year:first").replaceWith(t.yearshtml), i = t.yearshtml = null }, 0)) }, _shouldFocusInput: function (e) { return e.input && e.input.is(":visible") && !e.input.is(":disabled") && !e.input.is(":focus") }, _checkOffset: function (t, i, s) { var a = t.dpDiv.outerWidth(), n = t.dpDiv.outerHeight(), r = t.input ? t.input.outerWidth() : 0, o = t.input ? t.input.outerHeight() : 0, h = document.documentElement.clientWidth + (s ? 0 : e(document).scrollLeft()), l = document.documentElement.clientHeight + (s ? 0 : e(document).scrollTop()); return i.left -= this._get(t, "isRTL") ? a - r : 0, i.left -= s && i.left === t.input.offset().left ? e(document).scrollLeft() : 0, i.top -= s && i.top === t.input.offset().top + o ? e(document).scrollTop() : 0, i.left -= Math.min(i.left, i.left + a > h && h > a ? Math.abs(i.left + a - h) : 0), i.top -= Math.min(i.top, i.top + n > l && l > n ? Math.abs(n + o) : 0), i }, _findPos: function (t) { for (var i, s = this._getInst(t), a = this._get(s, "isRTL"); t && ("hidden" === t.type || 1 !== t.nodeType || e.expr.filters.hidden(t));)t = t[a ? "previousSibling" : "nextSibling"]; return i = e(t).offset(), [i.left, i.top] }, _hideDatepicker: function (t) { var i, s, a, n, r = this._curInst; !r || t && r !== e.data(t, "datepicker") || this._datepickerShowing && (i = this._get(r, "showAnim"), s = this._get(r, "duration"), a = function () { e.datepicker._tidyDialog(r) }, e.effects && (e.effects.effect[i] || e.effects[i]) ? r.dpDiv.hide(i, e.datepicker._get(r, "showOptions"), s, a) : r.dpDiv["slideDown" === i ? "slideUp" : "fadeIn" === i ? "fadeOut" : "hide"](i ? s : null, a), i || a(), this._datepickerShowing = !1, n = this._get(r, "onClose"), n && n.apply(r.input ? r.input[0] : null, [r.input ? r.input.val() : "", r]), this._lastInput = null, this._inDialog && (this._dialogInput.css({ position: "absolute", left: "0", top: "-100px" }), e.blockUI && (e.unblockUI(), e("body").append(this.dpDiv))), this._inDialog = !1) }, _tidyDialog: function (e) { e.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar") }, _checkExternalClick: function (t) { if (e.datepicker._curInst) { var i = e(t.target), s = e.datepicker._getInst(i[0]); (i[0].id !== e.datepicker._mainDivId && 0 === i.parents("#" + e.datepicker._mainDivId).length && !i.hasClass(e.datepicker.markerClassName) && !i.closest("." + e.datepicker._triggerClass).length && e.datepicker._datepickerShowing && (!e.datepicker._inDialog || !e.blockUI) || i.hasClass(e.datepicker.markerClassName) && e.datepicker._curInst !== s) && e.datepicker._hideDatepicker() } }, _adjustDate: function (t, i, s) { var a = e(t), n = this._getInst(a[0]); this._isDisabledDatepicker(a[0]) || (this._adjustInstDate(n, i + ("M" === s ? this._get(n, "showCurrentAtPos") : 0), s), this._updateDatepicker(n)) }, _gotoToday: function (t) { var i, s = e(t), a = this._getInst(s[0]); this._get(a, "gotoCurrent") && a.currentDay ? (a.selectedDay = a.currentDay, a.drawMonth = a.selectedMonth = a.currentMonth, a.drawYear = a.selectedYear = a.currentYear) : (i = new Date, a.selectedDay = i.getDate(), a.drawMonth = a.selectedMonth = i.getMonth(), a.drawYear = a.selectedYear = i.getFullYear()), this._notifyChange(a), this._adjustDate(s) }, _selectMonthYear: function (t, i, s) { var a = e(t), n = this._getInst(a[0]); n["selected" + ("M" === s ? "Month" : "Year")] = n["draw" + ("M" === s ? "Month" : "Year")] = parseInt(i.options[i.selectedIndex].value, 10), this._notifyChange(n), this._adjustDate(a) }, _selectDay: function (t, i, s, a) { var n, r = e(t); e(a).hasClass(this._unselectableClass) || this._isDisabledDatepicker(r[0]) || (n = this._getInst(r[0]), n.selectedDay = n.currentDay = e("a", a).html(), n.selectedMonth = n.currentMonth = i, n.selectedYear = n.currentYear = s, this._selectDate(t, this._formatDate(n, n.currentDay, n.currentMonth, n.currentYear))) }, _clearDate: function (t) { var i = e(t); this._selectDate(i, "") }, _selectDate: function (t, i) { var s, a = e(t), n = this._getInst(a[0]); i = null != i ? i : this._formatDate(n), n.input && n.input.val(i), this._updateAlternate(n), s = this._get(n, "onSelect"), s ? s.apply(n.input ? n.input[0] : null, [i, n]) : n.input && n.input.trigger("change"), n.inline ? this._updateDatepicker(n) : (this._hideDatepicker(), this._lastInput = n.input[0], "object" != typeof n.input[0] && n.input.focus(), this._lastInput = null) }, _updateAlternate: function (t) { var i, s, a, n = this._get(t, "altField"); n && (i = this._get(t, "altFormat") || this._get(t, "dateFormat"), s = this._getDate(t), a = this.formatDate(i, s, this._getFormatConfig(t)), e(n).each(function () { e(this).val(a) })) }, noWeekends: function (e) { var t = e.getDay(); return [t > 0 && 6 > t, ""] }, iso8601Week: function (e) { var t, i = new Date(e.getTime()); return i.setDate(i.getDate() + 4 - (i.getDay() || 7)), t = i.getTime(), i.setMonth(0), i.setDate(1), Math.floor(Math.round((t - i) / 864e5) / 7) + 1 }, parseDate: function (t, i, s) { if (null == t || null == i) throw "Invalid arguments"; if (i = "object" == typeof i ? "" + i : i + "", "" === i) return null; var a, n, r, o, h = 0, l = (s ? s.shortYearCutoff : null) || this._defaults.shortYearCutoff, u = "string" != typeof l ? l : (new Date).getFullYear() % 100 + parseInt(l, 10), d = (s ? s.dayNamesShort : null) || this._defaults.dayNamesShort, c = (s ? s.dayNames : null) || this._defaults.dayNames, p = (s ? s.monthNamesShort : null) || this._defaults.monthNamesShort, f = (s ? s.monthNames : null) || this._defaults.monthNames, m = -1, g = -1, v = -1, y = -1, b = !1, _ = function (e) { var i = t.length > a + 1 && t.charAt(a + 1) === e; return i && a++ , i }, x = function (e) { var t = _(e), s = "@" === e ? 14 : "!" === e ? 20 : "y" === e && t ? 4 : "o" === e ? 3 : 2, a = "y" === e ? s : 1, n = RegExp("^\\d{" + a + "," + s + "}"), r = i.substring(h).match(n); if (!r) throw "Missing number at position " + h; return h += r[0].length, parseInt(r[0], 10) }, w = function (t, s, a) { var n = -1, r = e.map(_(t) ? a : s, function (e, t) { return [[t, e]] }).sort(function (e, t) { return -(e[1].length - t[1].length) }); if (e.each(r, function (e, t) { var s = t[1]; return i.substr(h, s.length).toLowerCase() === s.toLowerCase() ? (n = t[0], h += s.length, !1) : void 0 }), -1 !== n) return n + 1; throw "Unknown name at position " + h }, k = function () { if (i.charAt(h) !== t.charAt(a)) throw "Unexpected literal at position " + h; h++ }; for (a = 0; t.length > a; a++)if (b) "'" !== t.charAt(a) || _("'") ? k() : b = !1; else switch (t.charAt(a)) { case "d": v = x("d"); break; case "D": w("D", d, c); break; case "o": y = x("o"); break; case "m": g = x("m"); break; case "M": g = w("M", p, f); break; case "y": m = x("y"); break; case "@": o = new Date(x("@")), m = o.getFullYear(), g = o.getMonth() + 1, v = o.getDate(); break; case "!": o = new Date((x("!") - this._ticksTo1970) / 1e4), m = o.getFullYear(), g = o.getMonth() + 1, v = o.getDate(); break; case "'": _("'") ? k() : b = !0; break; default: k() }if (i.length > h && (r = i.substr(h), !/^\s+/.test(r))) throw "Extra/unparsed characters found in date: " + r; if (-1 === m ? m = (new Date).getFullYear() : 100 > m && (m += (new Date).getFullYear() - (new Date).getFullYear() % 100 + (u >= m ? 0 : -100)), y > -1) for (g = 1, v = y; ;) { if (n = this._getDaysInMonth(m, g - 1), n >= v) break; g++ , v -= n } if (o = this._daylightSavingAdjust(new Date(m, g - 1, v)), o.getFullYear() !== m || o.getMonth() + 1 !== g || o.getDate() !== v) throw "Invalid date"; return o }, ATOM: "yy-mm-dd", COOKIE: "D, dd M yy", ISO_8601: "yy-mm-dd", RFC_822: "D, d M y", RFC_850: "DD, dd-M-y", RFC_1036: "D, d M y", RFC_1123: "D, d M yy", RFC_2822: "D, d M yy", RSS: "D, d M y", TICKS: "!", TIMESTAMP: "@", W3C: "yy-mm-dd", _ticksTo1970: 1e7 * 60 * 60 * 24 * (718685 + Math.floor(492.5) - Math.floor(19.7) + Math.floor(4.925)), formatDate: function (e, t, i) { if (!t) return ""; var s, a = (i ? i.dayNamesShort : null) || this._defaults.dayNamesShort, n = (i ? i.dayNames : null) || this._defaults.dayNames, r = (i ? i.monthNamesShort : null) || this._defaults.monthNamesShort, o = (i ? i.monthNames : null) || this._defaults.monthNames, h = function (t) { var i = e.length > s + 1 && e.charAt(s + 1) === t; return i && s++ , i }, l = function (e, t, i) { var s = "" + t; if (h(e)) for (; i > s.length;)s = "0" + s; return s }, u = function (e, t, i, s) { return h(e) ? s[t] : i[t] }, d = "", c = !1; if (t) for (s = 0; e.length > s; s++)if (c) "'" !== e.charAt(s) || h("'") ? d += e.charAt(s) : c = !1; else switch (e.charAt(s)) { case "d": d += l("d", t.getDate(), 2); break; case "D": d += u("D", t.getDay(), a, n); break; case "o": d += l("o", Math.round((new Date(t.getFullYear(), t.getMonth(), t.getDate()).getTime() - new Date(t.getFullYear(), 0, 0).getTime()) / 864e5), 3); break; case "m": d += l("m", t.getMonth() + 1, 2); break; case "M": d += u("M", t.getMonth(), r, o); break; case "y": d += h("y") ? t.getFullYear() : (10 > t.getYear() % 100 ? "0" : "") + t.getYear() % 100; break; case "@": d += t.getTime(); break; case "!": d += 1e4 * t.getTime() + this._ticksTo1970; break; case "'": h("'") ? d += "'" : c = !0; break; default: d += e.charAt(s) }return d }, _possibleChars: function (e) { var t, i = "", s = !1, a = function (i) { var s = e.length > t + 1 && e.charAt(t + 1) === i; return s && t++ , s }; for (t = 0; e.length > t; t++)if (s) "'" !== e.charAt(t) || a("'") ? i += e.charAt(t) : s = !1; else switch (e.charAt(t)) { case "d": case "m": case "y": case "@": i += "0123456789"; break; case "D": case "M": return null; case "'": a("'") ? i += "'" : s = !0; break; default: i += e.charAt(t) }return i }, _get: function (e, t) { return void 0 !== e.settings[t] ? e.settings[t] : this._defaults[t] }, _setDateFromField: function (e, t) { if (e.input.val() !== e.lastVal) { var i = this._get(e, "dateFormat"), s = e.lastVal = e.input ? e.input.val() : null, a = this._getDefaultDate(e), n = a, r = this._getFormatConfig(e); try { n = this.parseDate(i, s, r) || a } catch (o) { s = t ? "" : s } e.selectedDay = n.getDate(), e.drawMonth = e.selectedMonth = n.getMonth(), e.drawYear = e.selectedYear = n.getFullYear(), e.currentDay = s ? n.getDate() : 0, e.currentMonth = s ? n.getMonth() : 0, e.currentYear = s ? n.getFullYear() : 0, this._adjustInstDate(e) } }, _getDefaultDate: function (e) { return this._restrictMinMax(e, this._determineDate(e, this._get(e, "defaultDate"), new Date)) }, _determineDate: function (t, i, s) { var a = function (e) { var t = new Date; return t.setDate(t.getDate() + e), t }, n = function (i) { try { return e.datepicker.parseDate(e.datepicker._get(t, "dateFormat"), i, e.datepicker._getFormatConfig(t)) } catch (s) { } for (var a = (i.toLowerCase().match(/^c/) ? e.datepicker._getDate(t) : null) || new Date, n = a.getFullYear(), r = a.getMonth(), o = a.getDate(), h = /([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g, l = h.exec(i); l;) { switch (l[2] || "d") { case "d": case "D": o += parseInt(l[1], 10); break; case "w": case "W": o += 7 * parseInt(l[1], 10); break; case "m": case "M": r += parseInt(l[1], 10), o = Math.min(o, e.datepicker._getDaysInMonth(n, r)); break; case "y": case "Y": n += parseInt(l[1], 10), o = Math.min(o, e.datepicker._getDaysInMonth(n, r)) }l = h.exec(i) } return new Date(n, r, o) }, r = null == i || "" === i ? s : "string" == typeof i ? n(i) : "number" == typeof i ? isNaN(i) ? s : a(i) : new Date(i.getTime()); return r = r && "Invalid Date" == "" + r ? s : r, r && (r.setHours(0), r.setMinutes(0), r.setSeconds(0), r.setMilliseconds(0)), this._daylightSavingAdjust(r) }, _daylightSavingAdjust: function (e) { return e ? (e.setHours(e.getHours() > 12 ? e.getHours() + 2 : 0), e) : null }, _setDate: function (e, t, i) { var s = !t, a = e.selectedMonth, n = e.selectedYear, r = this._restrictMinMax(e, this._determineDate(e, t, new Date)); e.selectedDay = e.currentDay = r.getDate(), e.drawMonth = e.selectedMonth = e.currentMonth = r.getMonth(), e.drawYear = e.selectedYear = e.currentYear = r.getFullYear(), a === e.selectedMonth && n === e.selectedYear || i || this._notifyChange(e), this._adjustInstDate(e), e.input && e.input.val(s ? "" : this._formatDate(e)) }, _getDate: function (e) { var t = !e.currentYear || e.input && "" === e.input.val() ? null : this._daylightSavingAdjust(new Date(e.currentYear, e.currentMonth, e.currentDay)); return t }, _attachHandlers: function (t) { var i = this._get(t, "stepMonths"), s = "#" + t.id.replace(/\\\\/g, "\\"); t.dpDiv.find("[data-handler]").map(function () { var t = { prev: function () { e.datepicker._adjustDate(s, -i, "M") }, next: function () { e.datepicker._adjustDate(s, +i, "M") }, hide: function () { e.datepicker._hideDatepicker() }, today: function () { e.datepicker._gotoToday(s) }, selectDay: function () { return e.datepicker._selectDay(s, +this.getAttribute("data-month"), +this.getAttribute("data-year"), this), !1 }, selectMonth: function () { return e.datepicker._selectMonthYear(s, this, "M"), !1 }, selectYear: function () { return e.datepicker._selectMonthYear(s, this, "Y"), !1 } }; e(this).bind(this.getAttribute("data-event"), t[this.getAttribute("data-handler")]) }) }, _generateHTML: function (e) {
            var t, i, s, a, n, r, o, h, l, u, d, c, p, f, m, g, v, y, b, _, x, w, k, T, D, S, M, N, C, A, P, I, z, H, F, E, j, O, W, L = new Date, R = this._daylightSavingAdjust(new Date(L.getFullYear(), L.getMonth(), L.getDate())), Y = this._get(e, "isRTL"), J = this._get(e, "showButtonPanel"), B = this._get(e, "hideIfNoPrevNext"), K = this._get(e, "navigationAsDateFormat"), V = this._getNumberOfMonths(e), U = this._get(e, "showCurrentAtPos"), q = this._get(e, "stepMonths"), Q = 1 !== V[0] || 1 !== V[1], G = this._daylightSavingAdjust(e.currentDay ? new Date(e.currentYear, e.currentMonth, e.currentDay) : new Date(9999, 9, 9)), $ = this._getMinMaxDate(e, "min"), X = this._getMinMaxDate(e, "max"), Z = e.drawMonth - U, et = e.drawYear; if (0 > Z && (Z += 12, et--), X) for (t = this._daylightSavingAdjust(new Date(X.getFullYear(), X.getMonth() - V[0] * V[1] + 1, X.getDate())), t = $ && $ > t ? $ : t; this._daylightSavingAdjust(new Date(et, Z, 1)) > t;)Z-- , 0 > Z && (Z = 11, et--); for (e.drawMonth = Z, e.drawYear = et, i = this._get(e, "prevText"), i = K ? this.formatDate(i, this._daylightSavingAdjust(new Date(et, Z - q, 1)), this._getFormatConfig(e)) : i, s = this._canAdjustMonth(e, -1, et, Z) ? "<a class='ui-datepicker-prev ui-corner-all' data-handler='prev' data-event='click' title='" + i + "'><span class='ui-icon ui-icon-circle-triangle-" + (Y ? "e" : "w") + "'>" + i + "</span></a>" : B ? "" : "<a class='ui-datepicker-prev ui-corner-all ui-state-disabled' title='" + i + "'><span class='ui-icon ui-icon-circle-triangle-" + (Y ? "e" : "w") + "'>" + i + "</span></a>", a = this._get(e, "nextText"), a = K ? this.formatDate(a, this._daylightSavingAdjust(new Date(et, Z + q, 1)), this._getFormatConfig(e)) : a, n = this._canAdjustMonth(e, 1, et, Z) ? "<a class='ui-datepicker-next ui-corner-all' data-handler='next' data-event='click' title='" + a + "'><span class='ui-icon ui-icon-circle-triangle-" + (Y ? "w" : "e") + "'>" + a + "</span></a>" : B ? "" : "<a class='ui-datepicker-next ui-corner-all ui-state-disabled' title='" + a + "'><span class='ui-icon ui-icon-circle-triangle-" + (Y ? "w" : "e") + "'>" + a + "</span></a>", r = this._get(e, "currentText"), o = this._get(e, "gotoCurrent") && e.currentDay ? G : R, r = K ? this.formatDate(r, o, this._getFormatConfig(e)) : r, h = e.inline ? "" : "<button type='button' class='ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all' data-handler='hide' data-event='click'>" + this._get(e, "closeText") + "</button>", l = J ? "<div class='ui-datepicker-buttonpane ui-widget-content'>" + (Y ? h : "") + (this._isInRange(e, o) ? "<button type='button' class='ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all' data-handler='today' data-event='click'>" + r + "</button>" : "") + (Y ? "" : h) + "</div>" : "", u = parseInt(this._get(e, "firstDay"), 10), u = isNaN(u) ? 0 : u, d = this._get(e, "showWeek"), c = this._get(e, "dayNames"), p = this._get(e, "dayNamesMin"), f = this._get(e, "monthNames"), m = this._get(e, "monthNamesShort"), g = this._get(e, "beforeShowDay"), v = this._get(e, "showOtherMonths"), y = this._get(e, "selectOtherMonths"), b = this._getDefaultDate(e), _ = "", w = 0; V[0] > w; w++) {
                for (k = "", this.maxRows = 4, T = 0; V[1] > T; T++) {
                    if (D = this._daylightSavingAdjust(new Date(et, Z, e.selectedDay)), S = " ui-corner-all", M = "", Q) {
                        if (M += "<div class='ui-datepicker-group", V[1] > 1) switch (T) {
                            case 0: M += " ui-datepicker-group-first", S = " ui-corner-" + (Y ? "right" : "left");
                                break; case V[1] - 1: M += " ui-datepicker-group-last", S = " ui-corner-" + (Y ? "left" : "right"); break; default: M += " ui-datepicker-group-middle", S = ""
                        }M += "'>"
                    } for (M += "<div class='ui-datepicker-header ui-widget-header ui-helper-clearfix" + S + "'>" + (/all|left/.test(S) && 0 === w ? Y ? n : s : "") + (/all|right/.test(S) && 0 === w ? Y ? s : n : "") + this._generateMonthYearHeader(e, Z, et, $, X, w > 0 || T > 0, f, m) + "</div><table class='ui-datepicker-calendar'><thead>" + "<tr>", N = d ? "<th class='ui-datepicker-week-col'>" + this._get(e, "weekHeader") + "</th>" : "", x = 0; 7 > x; x++)C = (x + u) % 7, N += "<th scope='col'" + ((x + u + 6) % 7 >= 5 ? " class='ui-datepicker-week-end'" : "") + ">" + "<span title='" + c[C] + "'>" + p[C] + "</span></th>"; for (M += N + "</tr></thead><tbody>", A = this._getDaysInMonth(et, Z), et === e.selectedYear && Z === e.selectedMonth && (e.selectedDay = Math.min(e.selectedDay, A)), P = (this._getFirstDayOfMonth(et, Z) - u + 7) % 7, I = Math.ceil((P + A) / 7), z = Q ? this.maxRows > I ? this.maxRows : I : I, this.maxRows = z, H = this._daylightSavingAdjust(new Date(et, Z, 1 - P)), F = 0; z > F; F++) { for (M += "<tr>", E = d ? "<td class='ui-datepicker-week-col'>" + this._get(e, "calculateWeek")(H) + "</td>" : "", x = 0; 7 > x; x++)j = g ? g.apply(e.input ? e.input[0] : null, [H]) : [!0, ""], O = H.getMonth() !== Z, W = O && !y || !j[0] || $ && $ > H || X && H > X, E += "<td class='" + ((x + u + 6) % 7 >= 5 ? " ui-datepicker-week-end" : "") + (O ? " ui-datepicker-other-month" : "") + (H.getTime() === D.getTime() && Z === e.selectedMonth && e._keyEvent || b.getTime() === H.getTime() && b.getTime() === D.getTime() ? " " + this._dayOverClass : "") + (W ? " " + this._unselectableClass + " ui-state-disabled" : "") + (O && !v ? "" : " " + j[1] + (H.getTime() === G.getTime() ? " " + this._currentClass : "") + (H.getTime() === R.getTime() ? " ui-datepicker-today" : "")) + "'" + (O && !v || !j[2] ? "" : " title='" + j[2].replace(/'/g, "&#39;") + "'") + (W ? "" : " data-handler='selectDay' data-event='click' data-month='" + H.getMonth() + "' data-year='" + H.getFullYear() + "'") + ">" + (O && !v ? "&#xa0;" : W ? "<span class='ui-state-default'>" + H.getDate() + "</span>" : "<a class='ui-state-default" + (H.getTime() === R.getTime() ? " ui-state-highlight" : "") + (H.getTime() === G.getTime() ? " ui-state-active" : "") + (O ? " ui-priority-secondary" : "") + "' href='#'>" + H.getDate() + "</a>") + "</td>", H.setDate(H.getDate() + 1), H = this._daylightSavingAdjust(H); M += E + "</tr>" } Z++ , Z > 11 && (Z = 0, et++), M += "</tbody></table>" + (Q ? "</div>" + (V[0] > 0 && T === V[1] - 1 ? "<div class='ui-datepicker-row-break'></div>" : "") : ""), k += M
                } _ += k
            } return _ += l, e._keyEvent = !1, _
        }, _generateMonthYearHeader: function (e, t, i, s, a, n, r, o) { var h, l, u, d, c, p, f, m, g = this._get(e, "changeMonth"), v = this._get(e, "changeYear"), y = this._get(e, "showMonthAfterYear"), b = "<div class='ui-datepicker-title'>", _ = ""; if (n || !g) _ += "<span class='ui-datepicker-month'>" + r[t] + "</span>"; else { for (h = s && s.getFullYear() === i, l = a && a.getFullYear() === i, _ += "<select class='ui-datepicker-month' data-handler='selectMonth' data-event='change'>", u = 0; 12 > u; u++)(!h || u >= s.getMonth()) && (!l || a.getMonth() >= u) && (_ += "<option value='" + u + "'" + (u === t ? " selected='selected'" : "") + ">" + o[u] + "</option>"); _ += "</select>" } if (y || (b += _ + (!n && g && v ? "" : "&#xa0;")), !e.yearshtml) if (e.yearshtml = "", n || !v) b += "<span class='ui-datepicker-year'>" + i + "</span>"; else { for (d = this._get(e, "yearRange").split(":"), c = (new Date).getFullYear(), p = function (e) { var t = e.match(/c[+\-].*/) ? i + parseInt(e.substring(1), 10) : e.match(/[+\-].*/) ? c + parseInt(e, 10) : parseInt(e, 10); return isNaN(t) ? c : t }, f = p(d[0]), m = Math.max(f, p(d[1] || "")), f = s ? Math.max(f, s.getFullYear()) : f, m = a ? Math.min(m, a.getFullYear()) : m, e.yearshtml += "<select class='ui-datepicker-year' data-handler='selectYear' data-event='change'>"; m >= f; f++)e.yearshtml += "<option value='" + f + "'" + (f === i ? " selected='selected'" : "") + ">" + f + "</option>"; e.yearshtml += "</select>", b += e.yearshtml, e.yearshtml = null } return b += this._get(e, "yearSuffix"), y && (b += (!n && g && v ? "" : "&#xa0;") + _), b += "</div>" }, _adjustInstDate: function (e, t, i) { var s = e.drawYear + ("Y" === i ? t : 0), a = e.drawMonth + ("M" === i ? t : 0), n = Math.min(e.selectedDay, this._getDaysInMonth(s, a)) + ("D" === i ? t : 0), r = this._restrictMinMax(e, this._daylightSavingAdjust(new Date(s, a, n))); e.selectedDay = r.getDate(), e.drawMonth = e.selectedMonth = r.getMonth(), e.drawYear = e.selectedYear = r.getFullYear(), ("M" === i || "Y" === i) && this._notifyChange(e) }, _restrictMinMax: function (e, t) { var i = this._getMinMaxDate(e, "min"), s = this._getMinMaxDate(e, "max"), a = i && i > t ? i : t; return s && a > s ? s : a }, _notifyChange: function (e) { var t = this._get(e, "onChangeMonthYear"); t && t.apply(e.input ? e.input[0] : null, [e.selectedYear, e.selectedMonth + 1, e]) }, _getNumberOfMonths: function (e) { var t = this._get(e, "numberOfMonths"); return null == t ? [1, 1] : "number" == typeof t ? [1, t] : t }, _getMinMaxDate: function (e, t) { return this._determineDate(e, this._get(e, t + "Date"), null) }, _getDaysInMonth: function (e, t) { return 32 - this._daylightSavingAdjust(new Date(e, t, 32)).getDate() }, _getFirstDayOfMonth: function (e, t) { return new Date(e, t, 1).getDay() }, _canAdjustMonth: function (e, t, i, s) { var a = this._getNumberOfMonths(e), n = this._daylightSavingAdjust(new Date(i, s + (0 > t ? t : a[0] * a[1]), 1)); return 0 > t && n.setDate(this._getDaysInMonth(n.getFullYear(), n.getMonth())), this._isInRange(e, n) }, _isInRange: function (e, t) { var i, s, a = this._getMinMaxDate(e, "min"), n = this._getMinMaxDate(e, "max"), r = null, o = null, h = this._get(e, "yearRange"); return h && (i = h.split(":"), s = (new Date).getFullYear(), r = parseInt(i[0], 10), o = parseInt(i[1], 10), i[0].match(/[+\-].*/) && (r += s), i[1].match(/[+\-].*/) && (o += s)), (!a || t.getTime() >= a.getTime()) && (!n || t.getTime() <= n.getTime()) && (!r || t.getFullYear() >= r) && (!o || o >= t.getFullYear()) }, _getFormatConfig: function (e) { var t = this._get(e, "shortYearCutoff"); return t = "string" != typeof t ? t : (new Date).getFullYear() % 100 + parseInt(t, 10), { shortYearCutoff: t, dayNamesShort: this._get(e, "dayNamesShort"), dayNames: this._get(e, "dayNames"), monthNamesShort: this._get(e, "monthNamesShort"), monthNames: this._get(e, "monthNames") } }, _formatDate: function (e, t, i, s) { t || (e.currentDay = e.selectedDay, e.currentMonth = e.selectedMonth, e.currentYear = e.selectedYear); var a = t ? "object" == typeof t ? t : this._daylightSavingAdjust(new Date(s, i, t)) : this._daylightSavingAdjust(new Date(e.currentYear, e.currentMonth, e.currentDay)); return this.formatDate(this._get(e, "dateFormat"), a, this._getFormatConfig(e)) }
    }), e.fn.datepicker = function (t) { if (!this.length) return this; e.datepicker.initialized || (e(document).mousedown(e.datepicker._checkExternalClick), e.datepicker.initialized = !0), 0 === e("#" + e.datepicker._mainDivId).length && e("body").append(e.datepicker.dpDiv); var i = Array.prototype.slice.call(arguments, 1); return "string" != typeof t || "isDisabled" !== t && "getDate" !== t && "widget" !== t ? "option" === t && 2 === arguments.length && "string" == typeof arguments[1] ? e.datepicker["_" + t + "Datepicker"].apply(e.datepicker, [this[0]].concat(i)) : this.each(function () { "string" == typeof t ? e.datepicker["_" + t + "Datepicker"].apply(e.datepicker, [this].concat(i)) : e.datepicker._attachDatepicker(this, t) }) : e.datepicker["_" + t + "Datepicker"].apply(e.datepicker, [this[0]].concat(i)) }, e.datepicker = new a, e.datepicker.initialized = !1, e.datepicker.uuid = (new Date).getTime(), e.datepicker.version = "1.11.3", e.datepicker
});





$.datepicker.regional['es'] = {
    closeText: 'Cerrar',
    prevText: '<Ant',
    nextText: 'Sig>',
    currentText: 'Hoy',
    monthNames: ['Enero', 'Febrero', 'Marzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre'],
    monthNamesShort: ['Ene', 'Feb', 'Mar', 'Abr', 'May', 'Jun', 'Jul', 'Ago', 'Sep', 'Oct', 'Nov', 'Dic'],
    dayNames: ['Domingo', 'Lunes', 'Martes', 'Mi&eacute;rcoles', 'Jueves', 'Viernes', 'S&aacute;bado'],
    dayNamesShort: ['Dom', 'Lun', 'Mar', 'Mi&eacute;', 'Juv', 'Vie', 'S&aacute;b'],
    dayNamesMin: ['Do', 'Lu', 'Ma', 'Mi', 'Ju', 'Vi', 'S&aacute;'],
    weekHeader: 'Sm',
    dateFormat: 'dd/mm/yy',
    firstDay: 1,
    isRTL: false,
    showMonthAfterYear: false,
    yearSuffix: ''
};
$.datepicker.setDefaults($.datepicker.regional['es']);




// Internos
(function ($) {
    var methods = {
        init: function (options) {
            var that = this;
            this.click(function (e) {
                if ($(e.target).is("li") && that.hasClass("open")) {
                    if ($(e.target).find("a").length) {
                        window.location.hash = $(e.target).find("a").attr("href");
                    }
                    that.find("li").removeClass("selected");
                    that.attr("data-value", (typeof ($(e.target).attr("data-value")) == "undefined") ? "" : $(e.target).attr("data-value"));
                    $(e.target).addClass("selected");
                    that.trigger("changed");

                }
                if ($(e.target).is("a") && that.hasClass("open")) {
                    if (that.parent().hasClass("nolink")) {
                        e.preventDefault();
                    }
                    that.find("li").removeClass("selected");
                    that.attr("data-value", (typeof ($(e.target).closest("li").attr("data-value")) == "undefined") ? "" : $(e.target).closest("li").attr("data-value"));
                    $(e.target).closest("li").addClass("selected");
                    that.trigger("changed");
                }
                if (!$(e.target).is("a") && !$(e.target).is("span")) {
                    if (!(that).hasClass("open")) {
                        (that).addClass("locked");
                        (that).addClass("open");
                        (that).parent().addClass("icoclose");
                        (that).find("li").slideDown();
                        setTimeout(function () {
                            (function (_e) {
                                _e.removeClass("locked");
                            })(that);
                        }, 50);
                    }
                }
            });

            $(document).click(function (event) {
                if ((!$(event.target).closest(that.attr("id")).length) && !that.hasClass("locked")) {
                    if (that.hasClass("open")) {
                        that.find("li:not([class*=selected])").slideUp();
                        that.removeClass("open");
                        that.parent().removeClass("icoclose");
                    }
                }



                if ($(event.target).is("a") && !that.hasClass("open") && (typeof (window.location.hash) != "undefined") && that.find(event.target).length) {
                    that.find("li").removeClass("selected");
                    that.attr("data-value", (typeof ($(event.target).closest("li").attr("data-value")) == "undefined") ? "" : $(event.target).closest("li").attr("data-value"));
                    $(event.target).closest("li").addClass("selected");
                    that.trigger("changed");
                }
            });

            return this;
        },
        reset: function () {
            var that = this;
            that.find("li").removeClass("selected");
            that.attr("data-value", (typeof (that.find("li").first().attr("data-value")) == "undefined") ? "" : that.find("li").first().attr("data-value"));
            that.find("li").first().addClass("selected");
            that.find("li:not([class*=selected])").hide();
            that.trigger("changed");
            return this;
        },
        /*firstSelected: function() {
            var that = this;
            that.find("li").removeClass("selected");
            that.find("li").first().removeClass("selected");
        }*/
    };
    $.fn.customselect = function (methodOrOptions) {
        if (methods[methodOrOptions]) {
            return methods[methodOrOptions].apply(this, Array.prototype.slice.call(arguments, 1));
        } else if (typeof methodOrOptions === 'object' || !methodOrOptions) {
            return methods.init.apply(this, arguments);
        }

    };
}(jQuery));


/**
 * jQuery.marquee - scrolling text like old marquee element
 * @author Aamir Afridi - aamirafridi(at)gmail(dot)com / http://aamirafridi.com/jquery/jquery-marquee-plugin
 */
; (function (e) { e.fn.marquee = function (t) { return this.each(function () { var n = e.extend({}, e.fn.marquee.defaults, t), r = e(this), i, s, o, u, a, f = 3, l = "animation-play-state", c = false, h = function (e, t, n) { var r = ["webkit", "moz", "MS", "o", ""]; for (var i = 0; i < r.length; i++) { if (!r[i]) t = t.toLowerCase(); e.addEventListener(r[i] + t, n, false) } }, p = function (e) { var t = []; for (var n in e) { if (e.hasOwnProperty(n)) { t.push(n + ":" + e[n]) } } t.push(); return "{" + t.join(",") + "}" }, d = function () { r.timer = setTimeout(M, n.delayBeforeStart) }, v = { pause: function () { if (c && n.allowCss3Support) { i.css(l, "paused") } else { if (e.fn.pause) { i.pause() } } r.data("runningStatus", "paused"); r.trigger("paused") }, resume: function () { if (c && n.allowCss3Support) { i.css(l, "running") } else { if (e.fn.resume) { i.resume() } } r.data("runningStatus", "resumed"); r.trigger("resumed") }, toggle: function () { v[r.data("runningStatus") == "resumed" ? "pause" : "resume"]() }, destroy: function () { clearTimeout(r.timer); r.find("*").andSelf().unbind(); r.html(r.find(".js-marquee:first").html()) } }; if (typeof t === "string") { if (e.isFunction(v[t])) { if (!i) { i = r.find(".js-marquee-wrapper") } if (r.data("css3AnimationIsSupported") === true) { c = true } v[t]() } return } var m = {}, g; e.each(n, function (e, t) { g = r.attr("data-" + e); if (typeof g !== "undefined") { switch (g) { case "true": g = true; break; case "false": g = false; break } n[e] = g } }); n.duration = n.speed || n.duration; u = n.direction == "up" || n.direction == "down"; n.gap = n.duplicated ? parseInt(n.gap) : 0; r.wrapInner('<div class="js-marquee"></div>'); var y = r.find(".js-marquee").css({ "margin-right": n.gap, "float": "left" }); if (n.duplicated) { y.clone(true).appendTo(r) } r.wrapInner('<div style="width:100000px" class="js-marquee-wrapper"></div>'); i = r.find(".js-marquee-wrapper"); if (u) { var b = r.height(); i.removeAttr("style"); r.height(b); r.find(".js-marquee").css({ "float": "none", "margin-bottom": n.gap, "margin-right": 0 }); if (n.duplicated) r.find(".js-marquee:last").css({ "margin-bottom": 0 }); var w = r.find(".js-marquee:first").height() + n.gap; n.duration = (parseInt(w, 10) + parseInt(b, 10)) / parseInt(b, 10) * n.duration } else { a = r.find(".js-marquee:first").width() + n.gap; s = r.width(); n.duration = (parseInt(a, 10) + parseInt(s, 10)) / parseInt(s, 10) * n.duration } if (n.duplicated) { n.duration = n.duration / 2 } if (n.allowCss3Support) { var E = document.body || document.createElement("div"), S = "marqueeAnimation-" + Math.floor(Math.random() * 1e7), x = "Webkit Moz O ms Khtml".split(" "), T = "animation", N = "", C = ""; if (E.style.animation) { C = "@keyframes " + S + " "; c = true } if (c === false) { for (var k = 0; k < x.length; k++) { if (E.style[x[k] + "AnimationName"] !== undefined) { var L = "-" + x[k].toLowerCase() + "-"; T = L + T; l = L + l; C = "@" + L + "keyframes " + S + " "; c = true; break } } } if (c) { N = S + " " + n.duration / 1e3 + "s " + n.delayBeforeStart / 1e3 + "s infinite " + n.css3easing; r.data("css3AnimationIsSupported", true) } } var A = function () { i.css("margin-top", n.direction == "up" ? b + "px" : "-" + w + "px") }, O = function () { i.css("margin-left", n.direction == "left" ? s + "px" : "-" + a + "px") }; if (n.duplicated) { if (u) { i.css("margin-top", n.direction == "up" ? b : "-" + (w * 2 - n.gap) + "px") } else { i.css("margin-left", n.direction == "left" ? s + "px" : "-" + (a * 2 - n.gap) + "px") } f = 1 } else { if (u) { A() } else { O() } } var M = function () { if (n.duplicated) { if (f === 1) { n._originalDuration = n.duration; if (u) { n.duration = n.direction == "up" ? n.duration + b / (w / n.duration) : n.duration * 2 } else { n.duration = n.direction == "left" ? n.duration + s / (a / n.duration) : n.duration * 2 } if (N) { N = S + " " + n.duration / 1e3 + "s " + n.delayBeforeStart / 1e3 + "s " + n.css3easing } f++ } else if (f === 2) { n.duration = n._originalDuration; if (N) { S = S + "0"; C = e.trim(C) + "0 "; N = S + " " + n.duration / 1e3 + "s 0s infinite " + n.css3easing } f++ } } if (u) { if (n.duplicated) { if (f > 2) { i.css("margin-top", n.direction == "up" ? 0 : "-" + w + "px") } o = { "margin-top": n.direction == "up" ? "-" + w + "px" : 0 } } else { A(); o = { "margin-top": n.direction == "up" ? "-" + i.height() + "px" : b + "px" } } } else { if (n.duplicated) { if (f > 2) { i.css("margin-left", n.direction == "left" ? 0 : "-" + a + "px") } o = { "margin-left": n.direction == "left" ? "-" + a + "px" : 0 } } else { O(); o = { "margin-left": n.direction == "left" ? "-" + a + "px" : s + "px" } } } r.trigger("beforeStarting"); if (c) { i.css(T, N); var t = C + " { 100%  " + p(o) + "}", l = e("style"); if (l.length !== 0) { l.filter(":last").append(t) } else { e("head").append("<style>" + t + "</style>") } h(i[0], "AnimationIteration", function () { r.trigger("finished") }); h(i[0], "AnimationEnd", function () { M(); r.trigger("finished") }) } else { i.animate(o, n.duration, n.easing, function () { r.trigger("finished"); if (n.pauseOnCycle) { d() } else { M() } }) } r.data("runningStatus", "resumed") }; r.bind("pause", v.pause); r.bind("resume", v.resume); if (n.pauseOnHover) { r.bind("mouseenter mouseleave", v.toggle) } if (c && n.allowCss3Support) { M() } else { d() } }) }; e.fn.marquee.defaults = { allowCss3Support: true, css3easing: "linear", easing: "linear", delayBeforeStart: 1e3, direction: "left", duplicated: false, duration: 5e3, gap: 20, pauseOnCycle: false, pauseOnHover: false } })(jQuery);



/* CONTADOR CUENTA ATRAS ESTRENOS */
/*! flipclock 2015-01-19 */
var Base = function () { }; Base.extend = function (a, b) { "use strict"; var c = Base.prototype.extend; Base._prototyping = !0; var d = new this; c.call(d, a), d.base = function () { }, delete Base._prototyping; var e = d.constructor, f = d.constructor = function () { if (!Base._prototyping) if (this._constructing || this.constructor == f) this._constructing = !0, e.apply(this, arguments), delete this._constructing; else if (null !== arguments[0]) return (arguments[0].extend || c).call(arguments[0], d) }; return f.ancestor = this, f.extend = this.extend, f.forEach = this.forEach, f.implement = this.implement, f.prototype = d, f.toString = this.toString, f.valueOf = function (a) { return "object" == a ? f : e.valueOf() }, c.call(f, b), "function" == typeof f.init && f.init(), f }, Base.prototype = { extend: function (a, b) { if (arguments.length > 1) { var c = this[a]; if (c && "function" == typeof b && (!c.valueOf || c.valueOf() != b.valueOf()) && /\bbase\b/.test(b)) { var d = b.valueOf(); b = function () { var a = this.base || Base.prototype.base; this.base = c; var b = d.apply(this, arguments); return this.base = a, b }, b.valueOf = function (a) { return "object" == a ? b : d }, b.toString = Base.toString } this[a] = b } else if (a) { var e = Base.prototype.extend; Base._prototyping || "function" == typeof this || (e = this.extend || e); for (var f = { toSource: null }, g = ["constructor", "toString", "valueOf"], h = Base._prototyping ? 0 : 1; i = g[h++];) a[i] != f[i] && e.call(this, i, a[i]); for (var i in a) f[i] || e.call(this, i, a[i]) } return this } }, Base = Base.extend({ constructor: function () { this.extend(arguments[0]) } }, { ancestor: Object, version: "1.1", forEach: function (a, b, c) { for (var d in a) void 0 === this.prototype[d] && b.call(c, a[d], d, a) }, implement: function () { for (var a = 0; a < arguments.length; a++) "function" == typeof arguments[a] ? arguments[a](this.prototype) : this.prototype.extend(arguments[a]); return this }, toString: function () { return String(this.valueOf()) } }); var FlipClock; !function (a) { "use strict"; FlipClock = function (a, b, c) { return b instanceof Object && b instanceof Date == !1 && (c = b, b = 0), new FlipClock.Factory(a, b, c) }, FlipClock.Lang = {}, FlipClock.Base = Base.extend({ buildDate: "2014-12-12", version: "0.7.7", constructor: function (b, c) { "object" != typeof b && (b = {}), "object" != typeof c && (c = {}), this.setOptions(a.extend(!0, {}, b, c)) }, callback: function (a) { if ("function" == typeof a) { for (var b = [], c = 1; c <= arguments.length; c++) arguments[c] && b.push(arguments[c]); a.apply(this, b) } }, log: function (a) { window.console && console.log && console.log(a) }, getOption: function (a) { return this[a] ? this[a] : !1 }, getOptions: function () { return this }, setOption: function (a, b) { this[a] = b }, setOptions: function (a) { for (var b in a) "undefined" != typeof a[b] && this.setOption(b, a[b]) } }) }(jQuery), function (a) { "use strict"; FlipClock.Face = FlipClock.Base.extend({ autoStart: !0, dividers: [], factory: !1, lists: [], constructor: function (a, b) { this.dividers = [], this.lists = [], this.base(b), this.factory = a }, build: function () { this.autoStart && this.start() }, createDivider: function (b, c, d) { "boolean" != typeof c && c || (d = c, c = b); var e = ['<span class="' + this.factory.classes.dot + ' top"></span>', '<span class="' + this.factory.classes.dot + ' bottom"></span>'].join(""); d && (e = ""), b = this.factory.localize(b); var f = ['<span class="' + this.factory.classes.divider + " " + (c ? c : "").toLowerCase() + '">', '<span class="' + this.factory.classes.label + '">' + (b ? b : "") + "</span>", e, "</span>"], g = a(f.join("")); return this.dividers.push(g), g }, createList: function (a, b) { "object" == typeof a && (b = a, a = 0); var c = new FlipClock.List(this.factory, a, b); return this.lists.push(c), c }, reset: function () { this.factory.time = new FlipClock.Time(this.factory, this.factory.original ? Math.round(this.factory.original) : 0, { minimumDigits: this.factory.minimumDigits }), this.flip(this.factory.original, !1) }, appendDigitToClock: function (a) { a.$el.append(!1) }, addDigit: function (a) { var b = this.createList(a, { classes: { active: this.factory.classes.active, before: this.factory.classes.before, flip: this.factory.classes.flip } }); this.appendDigitToClock(b) }, start: function () { }, stop: function () { }, autoIncrement: function () { this.factory.countdown ? this.decrement() : this.increment() }, increment: function () { this.factory.time.addSecond() }, decrement: function () { 0 == this.factory.time.getTimeSeconds() ? this.factory.stop() : this.factory.time.subSecond() }, flip: function (b, c) { var d = this; a.each(b, function (a, b) { var e = d.lists[a]; e ? (c || b == e.digit || e.play(), e.select(b)) : d.addDigit(b) }) } }) }(jQuery), function (a) { "use strict"; FlipClock.Factory = FlipClock.Base.extend({ animationRate: 1e3, autoStart: !0, callbacks: { destroy: !1, create: !1, init: !1, interval: !1, start: !1, stop: !1, reset: !1 }, classes: { active: "flip-clock-active", before: "flip-clock-before", divider: "flip-clock-divider", dot: "flip-clock-dot", label: "flip-clock-label", flip: "flip", play: "play", wrapper: "flip-clock-wrapper" }, clockFace: "HourlyCounter", countdown: !1, defaultClockFace: "HourlyCounter", defaultLanguage: "english", $el: !1, face: !0, lang: !1, language: "english", minimumDigits: 0, original: !1, running: !1, time: !1, timer: !1, $wrapper: !1, constructor: function (b, c, d) { d || (d = {}), this.lists = [], this.running = !1, this.base(d), this.$el = a(b).addClass(this.classes.wrapper), this.$wrapper = this.$el, this.original = c instanceof Date ? c : c ? Math.round(c) : 0, this.time = new FlipClock.Time(this, this.original, { minimumDigits: this.minimumDigits, animationRate: this.animationRate }), this.timer = new FlipClock.Timer(this, d), this.loadLanguage(this.language), this.loadClockFace(this.clockFace, d), this.autoStart && this.start() }, loadClockFace: function (a, b) { var c, d = "Face", e = !1; return a = a.ucfirst() + d, this.face.stop && (this.stop(), e = !0), this.$el.html(""), this.time.minimumDigits = this.minimumDigits, c = FlipClock[a] ? new FlipClock[a](this, b) : new FlipClock[this.defaultClockFace + d](this, b), c.build(), this.face = c, e && this.start(), this.face }, loadLanguage: function (a) { var b; return b = FlipClock.Lang[a.ucfirst()] ? FlipClock.Lang[a.ucfirst()] : FlipClock.Lang[a] ? FlipClock.Lang[a] : FlipClock.Lang[this.defaultLanguage], this.lang = b }, localize: function (a, b) { var c = this.lang; if (!a) return null; var d = a.toLowerCase(); return "object" == typeof b && (c = b), c && c[d] ? c[d] : a }, start: function (a) { var b = this; b.running || b.countdown && !(b.countdown && b.time.time > 0) ? b.log("Trying to start timer when countdown already at 0") : (b.face.start(b.time), b.timer.start(function () { b.flip(), "function" == typeof a && a() })) }, stop: function (a) { this.face.stop(), this.timer.stop(a); for (var b in this.lists) this.lists.hasOwnProperty(b) && this.lists[b].stop() }, reset: function (a) { this.timer.reset(a), this.face.reset() }, setTime: function (a) { this.time.time = a, this.flip(!0) }, getTime: function () { return this.time }, setCountdown: function (a) { var b = this.running; this.countdown = a ? !0 : !1, b && (this.stop(), this.start()) }, flip: function (a) { this.face.flip(!1, a) } }) }(jQuery), function (a) { "use strict"; FlipClock.List = FlipClock.Base.extend({ digit: 0, classes: { active: "flip-clock-active", before: "flip-clock-before", flip: "flip" }, factory: !1, $el: !1, $obj: !1, items: [], lastDigit: 0, constructor: function (a, b) { this.factory = a, this.digit = b, this.lastDigit = b, this.$el = this.createList(), this.$obj = this.$el, b > 0 && this.select(b), this.factory.$el.append(this.$el) }, select: function (a) { if ("undefined" == typeof a ? a = this.digit : this.digit = a, this.digit != this.lastDigit) { var b = this.$el.find("." + this.classes.before).removeClass(this.classes.before); this.$el.find("." + this.classes.active).removeClass(this.classes.active).addClass(this.classes.before), this.appendListItem(this.classes.active, this.digit), b.remove(), this.lastDigit = this.digit } }, play: function () { this.$el.addClass(this.factory.classes.play) }, stop: function () { var a = this; setTimeout(function () { a.$el.removeClass(a.factory.classes.play) }, this.factory.timer.interval) }, createListItem: function (a, b) { return ['<li class="' + (a ? a : "") + '">', '<a href="#">', '<div class="up">', '<div class="shadow"></div>', '<div class="inn">' + (b ? b : "") + "</div>", "</div>", '<div class="down">', '<div class="shadow"></div>', '<div class="inn">' + (b ? b : "") + "</div>", "</div>", "</a>", "</li>"].join("") }, appendListItem: function (a, b) { var c = this.createListItem(a, b); this.$el.append(c) }, createList: function () { var b = this.getPrevDigit() ? this.getPrevDigit() : this.digit, c = a(['<ul class="' + this.classes.flip + " " + (this.factory.running ? this.factory.classes.play : "") + '">', this.createListItem(this.classes.before, b), this.createListItem(this.classes.active, this.digit), "</ul>"].join("")); return c }, getNextDigit: function () { return 9 == this.digit ? 0 : this.digit + 1 }, getPrevDigit: function () { return 0 == this.digit ? 9 : this.digit - 1 } }) }(jQuery), function (a) { "use strict"; String.prototype.ucfirst = function () { return this.substr(0, 1).toUpperCase() + this.substr(1) }, a.fn.FlipClock = function (b, c) { return new FlipClock(a(this), b, c) }, a.fn.flipClock = function (b, c) { return a.fn.FlipClock(b, c) } }(jQuery), function (a) { "use strict"; FlipClock.Time = FlipClock.Base.extend({ time: 0, factory: !1, minimumDigits: 0, constructor: function (a, b, c) { "object" != typeof c && (c = {}), c.minimumDigits || (c.minimumDigits = a.minimumDigits), this.base(c), this.factory = a, b && (this.time = b) }, convertDigitsToArray: function (a) { var b = []; a = a.toString(); for (var c = 0; c < a.length; c++) a[c].match(/^\d*$/g) && b.push(a[c]); return b }, digit: function (a) { var b = this.toString(), c = b.length; return b[c - a] ? b[c - a] : !1 }, digitize: function (b) { var c = []; if (a.each(b, function (a, b) { b = b.toString(), 1 == b.length && (b = "0" + b); for (var d = 0; d < b.length; d++) c.push(b.charAt(d)) }), c.length > this.minimumDigits && (this.minimumDigits = c.length), this.minimumDigits > c.length) for (var d = c.length; d < this.minimumDigits; d++) c.unshift("0"); return c }, getDateObject: function () { return this.time instanceof Date ? this.time : new Date((new Date).getTime() + 1e3 * this.getTimeSeconds()) }, getDayCounter: function (a) { var b = [this.getDays(), this.getHours(!0), this.getMinutes(!0)]; return a && b.push(this.getSeconds(!0)), this.digitize(b) }, getDays: function (a) { var b = this.getTimeSeconds() / 60 / 60 / 24; return a && (b %= 7), Math.floor(b) }, getHourCounter: function () { var a = this.digitize([this.getHours(), this.getMinutes(!0), this.getSeconds(!0)]); return a }, getHourly: function () { return this.getHourCounter() }, getHours: function (a) { var b = this.getTimeSeconds() / 60 / 60; return a && (b %= 24), Math.floor(b) }, getMilitaryTime: function (a, b) { "undefined" == typeof b && (b = !0), a || (a = this.getDateObject()); var c = [a.getHours(), a.getMinutes()]; return b === !0 && c.push(a.getSeconds()), this.digitize(c) }, getMinutes: function (a) { var b = this.getTimeSeconds() / 60; return a && (b %= 60), Math.floor(b) }, getMinuteCounter: function () { var a = this.digitize([this.getMinutes(), this.getSeconds(!0)]); return a }, getTimeSeconds: function (a) { return a || (a = new Date), this.time instanceof Date ? this.factory.countdown ? Math.max(this.time.getTime() / 1e3 - a.getTime() / 1e3, 0) : a.getTime() / 1e3 - this.time.getTime() / 1e3 : this.time }, getTime: function (a, b) { "undefined" == typeof b && (b = !0), a || (a = this.getDateObject()), console.log(a); var c = a.getHours(), d = [c > 12 ? c - 12 : 0 === c ? 12 : c, a.getMinutes()]; return b === !0 && d.push(a.getSeconds()), this.digitize(d) }, getSeconds: function (a) { var b = this.getTimeSeconds(); return a && (60 == b ? b = 0 : b %= 60), Math.ceil(b) }, getWeeks: function (a) { var b = this.getTimeSeconds() / 60 / 60 / 24 / 7; return a && (b %= 52), Math.floor(b) }, removeLeadingZeros: function (b, c) { var d = 0, e = []; return a.each(c, function (a) { b > a ? d += parseInt(c[a], 10) : e.push(c[a]) }), 0 === d ? e : c }, addSeconds: function (a) { this.time instanceof Date ? this.time.setSeconds(this.time.getSeconds() + a) : this.time += a }, addSecond: function () { this.addSeconds(1) }, subSeconds: function (a) { this.time instanceof Date ? this.time.setSeconds(this.time.getSeconds() - a) : this.time -= a }, subSecond: function () { this.subSeconds(1) }, toString: function () { return this.getTimeSeconds().toString() } }) }(jQuery), function () { "use strict"; FlipClock.Timer = FlipClock.Base.extend({ callbacks: { destroy: !1, create: !1, init: !1, interval: !1, start: !1, stop: !1, reset: !1 }, count: 0, factory: !1, interval: 1e3, animationRate: 1e3, constructor: function (a, b) { this.base(b), this.factory = a, this.callback(this.callbacks.init), this.callback(this.callbacks.create) }, getElapsed: function () { return this.count * this.interval }, getElapsedTime: function () { return new Date(this.time + this.getElapsed()) }, reset: function (a) { clearInterval(this.timer), this.count = 0, this._setInterval(a), this.callback(this.callbacks.reset) }, start: function (a) { this.factory.running = !0, this._createTimer(a), this.callback(this.callbacks.start) }, stop: function (a) { this.factory.running = !1, this._clearInterval(a), this.callback(this.callbacks.stop), this.callback(a) }, _clearInterval: function () { clearInterval(this.timer) }, _createTimer: function (a) { this._setInterval(a) }, _destroyTimer: function (a) { this._clearInterval(), this.timer = !1, this.callback(a), this.callback(this.callbacks.destroy) }, _interval: function (a) { this.callback(this.callbacks.interval), this.callback(a), this.count++ }, _setInterval: function (a) { var b = this; b._interval(a), b.timer = setInterval(function () { b._interval(a) }, this.interval) } }) }(jQuery), function (a) { FlipClock.TwentyFourHourClockFace = FlipClock.Face.extend({ constructor: function (a, b) { this.base(a, b) }, build: function (b) { var c = this, d = this.factory.$el.find("ul"); this.factory.time.time || (this.factory.original = new Date, this.factory.time = new FlipClock.Time(this.factory, this.factory.original)); var b = b ? b : this.factory.time.getMilitaryTime(!1, this.showSeconds); b.length > d.length && a.each(b, function (a, b) { c.createList(b) }), this.createDivider(), this.createDivider(), a(this.dividers[0]).insertBefore(this.lists[this.lists.length - 2].$el), a(this.dividers[1]).insertBefore(this.lists[this.lists.length - 4].$el), this.base() }, flip: function (a, b) { this.autoIncrement(), a = a ? a : this.factory.time.getMilitaryTime(!1, this.showSeconds), this.base(a, b) } }) }(jQuery), function (a) { FlipClock.CounterFace = FlipClock.Face.extend({ shouldAutoIncrement: !1, constructor: function (a, b) { "object" != typeof b && (b = {}), a.autoStart = b.autoStart ? !0 : !1, b.autoStart && (this.shouldAutoIncrement = !0), a.increment = function () { a.countdown = !1, a.setTime(a.getTime().getTimeSeconds() + 1) }, a.decrement = function () { a.countdown = !0; var b = a.getTime().getTimeSeconds(); b > 0 && a.setTime(b - 1) }, a.setValue = function (b) { a.setTime(b) }, a.setCounter = function (b) { a.setTime(b) }, this.base(a, b) }, build: function () { var b = this, c = this.factory.$el.find("ul"), d = this.factory.getTime().digitize([this.factory.getTime().time]); d.length > c.length && a.each(d, function (a, c) { var d = b.createList(c); d.select(c) }), a.each(this.lists, function (a, b) { b.play() }), this.base() }, flip: function (a, b) { this.shouldAutoIncrement && this.autoIncrement(), a || (a = this.factory.getTime().digitize([this.factory.getTime().time])), this.base(a, b) }, reset: function () { this.factory.time = new FlipClock.Time(this.factory, this.factory.original ? Math.round(this.factory.original) : 0), this.flip() } }) }(jQuery), function (a) { FlipClock.DailyCounterFace = FlipClock.Face.extend({ showSeconds: !0, constructor: function (a, b) { this.base(a, b) }, build: function (b) { var c = this, d = this.factory.$el.find("ul"), e = 0; b = b ? b : this.factory.time.getDayCounter(this.showSeconds), b.length > d.length && a.each(b, function (a, b) { c.createList(b) }), this.showSeconds ? a(this.createDivider("Seconds")).insertBefore(this.lists[this.lists.length - 2].$el) : e = 2, a(this.createDivider("Minutes")).insertBefore(this.lists[this.lists.length - 4 + e].$el), a(this.createDivider("Hours")).insertBefore(this.lists[this.lists.length - 6 + e].$el), a(this.createDivider("Days", !0)).insertBefore(this.lists[0].$el), this.base() }, flip: function (a, b) { a || (a = this.factory.time.getDayCounter(this.showSeconds)), this.autoIncrement(), this.base(a, b) } }) }(jQuery), function (a) { FlipClock.HourlyCounterFace = FlipClock.Face.extend({ constructor: function (a, b) { this.base(a, b) }, build: function (b, c) { var d = this, e = this.factory.$el.find("ul"); c = c ? c : this.factory.time.getHourCounter(), c.length > e.length && a.each(c, function (a, b) { d.createList(b) }), a(this.createDivider("Seconds")).insertBefore(this.lists[this.lists.length - 2].$el), a(this.createDivider("Minutes")).insertBefore(this.lists[this.lists.length - 4].$el), b || a(this.createDivider("Hours", !0)).insertBefore(this.lists[0].$el), this.base() }, flip: function (a, b) { a || (a = this.factory.time.getHourCounter()), this.autoIncrement(), this.base(a, b) }, appendDigitToClock: function (a) { this.base(a), this.dividers[0].insertAfter(this.dividers[0].next()) } }) }(jQuery), function () { FlipClock.MinuteCounterFace = FlipClock.HourlyCounterFace.extend({ clearExcessDigits: !1, constructor: function (a, b) { this.base(a, b) }, build: function () { this.base(!0, this.factory.time.getMinuteCounter()) }, flip: function (a, b) { a || (a = this.factory.time.getMinuteCounter()), this.base(a, b) } }) }(jQuery), function (a) { FlipClock.TwelveHourClockFace = FlipClock.TwentyFourHourClockFace.extend({ meridium: !1, meridiumText: "AM", build: function () { var b = this.factory.time.getTime(!1, this.showSeconds); this.base(b), this.meridiumText = this.getMeridium(), this.meridium = a(['<ul class="flip-clock-meridium">', "<li>", '<a href="#">' + this.meridiumText + "</a>", "</li>", "</ul>"].join("")), this.meridium.insertAfter(this.lists[this.lists.length - 1].$el) }, flip: function (a, b) { this.meridiumText != this.getMeridium() && (this.meridiumText = this.getMeridium(), this.meridium.find("a").html(this.meridiumText)), this.base(this.factory.time.getTime(!1, this.showSeconds), b) }, getMeridium: function () { return (new Date).getHours() >= 12 ? "PM" : "AM" }, isPM: function () { return "PM" == this.getMeridium() ? !0 : !1 }, isAM: function () { return "AM" == this.getMeridium() ? !0 : !1 } }) }(jQuery), function () { FlipClock.Lang.Arabic = { years: "سنوات", months: "شهور", days: "أيام", hours: "ساعات", minutes: "دقائق", seconds: "ثواني" }, FlipClock.Lang.ar = FlipClock.Lang.Arabic, FlipClock.Lang["ar-ar"] = FlipClock.Lang.Arabic, FlipClock.Lang.arabic = FlipClock.Lang.Arabic }(jQuery), function () { FlipClock.Lang.Danish = { years: "År", months: "Måneder", days: "Dage", hours: "Timer", minutes: "Minutter", seconds: "Sekunder" }, FlipClock.Lang.da = FlipClock.Lang.Danish, FlipClock.Lang["da-dk"] = FlipClock.Lang.Danish, FlipClock.Lang.danish = FlipClock.Lang.Danish }(jQuery), function () { FlipClock.Lang.German = { years: "Jahre", months: "Monate", days: "Tage", hours: "Stunden", minutes: "Minuten", seconds: "Sekunden" }, FlipClock.Lang.de = FlipClock.Lang.German, FlipClock.Lang["de-de"] = FlipClock.Lang.German, FlipClock.Lang.german = FlipClock.Lang.German }(jQuery), function () { FlipClock.Lang.English = { years: "Years", months: "Months", days: "Days", hours: "Hours", minutes: "Minutes", seconds: "Seconds" }, FlipClock.Lang.en = FlipClock.Lang.English, FlipClock.Lang["en-us"] = FlipClock.Lang.English, FlipClock.Lang.english = FlipClock.Lang.English }(jQuery), function () { FlipClock.Lang.Spanish = { years: "A&#241;os", months: "Meses", days: "D&#205;as", hours: "Horas", minutes: "Minutos", seconds: "Segundo" }, FlipClock.Lang.es = FlipClock.Lang.Spanish, FlipClock.Lang["es-es"] = FlipClock.Lang.Spanish, FlipClock.Lang.spanish = FlipClock.Lang.Spanish }(jQuery), function () { FlipClock.Lang.Finnish = { years: "Vuotta", months: "Kuukautta", days: "Päivää", hours: "Tuntia", minutes: "Minuuttia", seconds: "Sekuntia" }, FlipClock.Lang.fi = FlipClock.Lang.Finnish, FlipClock.Lang["fi-fi"] = FlipClock.Lang.Finnish, FlipClock.Lang.finnish = FlipClock.Lang.Finnish }(jQuery), function () { FlipClock.Lang.French = { years: "Ans", months: "Mois", days: "Jours", hours: "Heures", minutes: "Minutes", seconds: "Secondes" }, FlipClock.Lang.fr = FlipClock.Lang.French, FlipClock.Lang["fr-ca"] = FlipClock.Lang.French, FlipClock.Lang.french = FlipClock.Lang.French }(jQuery), function () { FlipClock.Lang.Italian = { years: "Anni", months: "Mesi", days: "Giorni", hours: "Ore", minutes: "Minuti", seconds: "Secondi" }, FlipClock.Lang.it = FlipClock.Lang.Italian, FlipClock.Lang["it-it"] = FlipClock.Lang.Italian, FlipClock.Lang.italian = FlipClock.Lang.Italian }(jQuery), function () { FlipClock.Lang.Latvian = { years: "Gadi", months: "Mēneši", days: "Dienas", hours: "Stundas", minutes: "Minūtes", seconds: "Sekundes" }, FlipClock.Lang.lv = FlipClock.Lang.Latvian, FlipClock.Lang["lv-lv"] = FlipClock.Lang.Latvian, FlipClock.Lang.latvian = FlipClock.Lang.Latvian }(jQuery), function () { FlipClock.Lang.Dutch = { years: "Jaren", months: "Maanden", days: "Dagen", hours: "Uren", minutes: "Minuten", seconds: "Seconden" }, FlipClock.Lang.nl = FlipClock.Lang.Dutch, FlipClock.Lang["nl-be"] = FlipClock.Lang.Dutch, FlipClock.Lang.dutch = FlipClock.Lang.Dutch }(jQuery), function () { FlipClock.Lang.Norwegian = { years: "År", months: "Måneder", days: "Dager", hours: "Timer", minutes: "Minutter", seconds: "Sekunder" }, FlipClock.Lang.no = FlipClock.Lang.Norwegian, FlipClock.Lang.nb = FlipClock.Lang.Norwegian, FlipClock.Lang["no-nb"] = FlipClock.Lang.Norwegian, FlipClock.Lang.norwegian = FlipClock.Lang.Norwegian }(jQuery), function () { FlipClock.Lang.Portuguese = { years: "Anos", months: "Meses", days: "Dias", hours: "Horas", minutes: "Minutos", seconds: "Segundos" }, FlipClock.Lang.pt = FlipClock.Lang.Portuguese, FlipClock.Lang["pt-br"] = FlipClock.Lang.Portuguese, FlipClock.Lang.portuguese = FlipClock.Lang.Portuguese }(jQuery), function () { FlipClock.Lang.Russian = { years: "лет", months: "месяцев", days: "дней", hours: "часов", minutes: "минут", seconds: "секунд" }, FlipClock.Lang.ru = FlipClock.Lang.Russian, FlipClock.Lang["ru-ru"] = FlipClock.Lang.Russian, FlipClock.Lang.russian = FlipClock.Lang.Russian }(jQuery), function () { FlipClock.Lang.Swedish = { years: "År", months: "Månader", days: "Dagar", hours: "Timmar", minutes: "Minuter", seconds: "Sekunder" }, FlipClock.Lang.sv = FlipClock.Lang.Swedish, FlipClock.Lang["sv-se"] = FlipClock.Lang.Swedish, FlipClock.Lang.swedish = FlipClock.Lang.Swedish }(jQuery), function () { FlipClock.Lang.Chinese = { years: "年", months: "月", days: "日", hours: "时", minutes: "分", seconds: "秒" }, FlipClock.Lang.zh = FlipClock.Lang.Chinese, FlipClock.Lang["zh-cn"] = FlipClock.Lang.Chinese, FlipClock.Lang.chinese = FlipClock.Lang.Chinese }(jQuery);


/* qTip2 v2.2.1 | Plugins: tips modal viewport svg imagemap ie6 | Styles: core basic css3 | qtip2.com | Licensed MIT | Sat Sep 06 2014 23:12:07 */

!function (a, b, c) {
    !function (a) { "use strict"; "function" == typeof define && define.amd ? define(["jquery"], a) : jQuery && !jQuery.fn.qtip && a(jQuery) }(function (d) {
        "use strict"; function e(a, b, c, e) { this.id = c, this.target = a, this.tooltip = F, this.elements = { target: a }, this._id = S + "-" + c, this.timers = { img: {} }, this.options = b, this.plugins = {}, this.cache = { event: {}, target: d(), disabled: E, attr: e, onTooltip: E, lastClass: "" }, this.rendered = this.destroyed = this.disabled = this.waiting = this.hiddenDuringWait = this.positioning = this.triggering = E } function f(a) { return a === F || "object" !== d.type(a) } function g(a) { return !(d.isFunction(a) || a && a.attr || a.length || "object" === d.type(a) && (a.jquery || a.then)) } function h(a) { var b, c, e, h; return f(a) ? E : (f(a.metadata) && (a.metadata = { type: a.metadata }), "content" in a && (b = a.content, f(b) || b.jquery || b.done ? b = a.content = { text: c = g(b) ? E : b } : c = b.text, "ajax" in b && (e = b.ajax, h = e && e.once !== E, delete b.ajax, b.text = function (a, b) { var f = c || d(this).attr(b.options.content.attr) || "Loading...", g = d.ajax(d.extend({}, e, { context: b })).then(e.success, F, e.error).then(function (a) { return a && h && b.set("content.text", a), a }, function (a, c, d) { b.destroyed || 0 === a.status || b.set("content.text", c + ": " + d) }); return h ? f : (b.set("content.text", f), g) }), "title" in b && (d.isPlainObject(b.title) && (b.button = b.title.button, b.title = b.title.text), g(b.title || E) && (b.title = E))), "position" in a && f(a.position) && (a.position = { my: a.position, at: a.position }), "show" in a && f(a.show) && (a.show = a.show.jquery ? { target: a.show } : a.show === D ? { ready: D } : { event: a.show }), "hide" in a && f(a.hide) && (a.hide = a.hide.jquery ? { target: a.hide } : { event: a.hide }), "style" in a && f(a.style) && (a.style = { classes: a.style }), d.each(R, function () { this.sanitize && this.sanitize(a) }), a) } function i(a, b) { for (var c, d = 0, e = a, f = b.split("."); e = e[f[d++]];)d < f.length && (c = e); return [c || a, f.pop()] } function j(a, b) { var c, d, e; for (c in this.checks) for (d in this.checks[c]) (e = new RegExp(d, "i").exec(a)) && (b.push(e), ("builtin" === c || this.plugins[c]) && this.checks[c][d].apply(this.plugins[c] || this, b)) } function k(a) { return V.concat("").join(a ? "-" + a + " " : " ") } function l(a, b) { return b > 0 ? setTimeout(d.proxy(a, this), b) : void a.call(this) } function m(a) { this.tooltip.hasClass(ab) || (clearTimeout(this.timers.show), clearTimeout(this.timers.hide), this.timers.show = l.call(this, function () { this.toggle(D, a) }, this.options.show.delay)) } function n(a) { if (!this.tooltip.hasClass(ab) && !this.destroyed) { var b = d(a.relatedTarget), c = b.closest(W)[0] === this.tooltip[0], e = b[0] === this.options.show.target[0]; if (clearTimeout(this.timers.show), clearTimeout(this.timers.hide), this !== b[0] && "mouse" === this.options.position.target && c || this.options.hide.fixed && /mouse(out|leave|move)/.test(a.type) && (c || e)) try { a.preventDefault(), a.stopImmediatePropagation() } catch (f) { } else this.timers.hide = l.call(this, function () { this.toggle(E, a) }, this.options.hide.delay, this) } } function o(a) { !this.tooltip.hasClass(ab) && this.options.hide.inactive && (clearTimeout(this.timers.inactive), this.timers.inactive = l.call(this, function () { this.hide(a) }, this.options.hide.inactive)) } function p(a) { this.rendered && this.tooltip[0].offsetWidth > 0 && this.reposition(a) } function q(a, c, e) { d(b.body).delegate(a, (c.split ? c : c.join("." + S + " ")) + "." + S, function () { var a = y.api[d.attr(this, U)]; a && !a.disabled && e.apply(a, arguments) }) } function r(a, c, f) { var g, i, j, k, l, m = d(b.body), n = a[0] === b ? m : a, o = a.metadata ? a.metadata(f.metadata) : F, p = "html5" === f.metadata.type && o ? o[f.metadata.name] : F, q = a.data(f.metadata.name || "qtipopts"); try { q = "string" == typeof q ? d.parseJSON(q) : q } catch (r) { } if (k = d.extend(D, {}, y.defaults, f, "object" == typeof q ? h(q) : F, h(p || o)), i = k.position, k.id = c, "boolean" == typeof k.content.text) { if (j = a.attr(k.content.attr), k.content.attr === E || !j) return E; k.content.text = j } if (i.container.length || (i.container = m), i.target === E && (i.target = n), k.show.target === E && (k.show.target = n), k.show.solo === D && (k.show.solo = i.container.closest("body")), k.hide.target === E && (k.hide.target = n), k.position.viewport === D && (k.position.viewport = i.container), i.container = i.container.eq(0), i.at = new A(i.at, D), i.my = new A(i.my), a.data(S)) if (k.overwrite) a.qtip("destroy", !0); else if (k.overwrite === E) return E; return a.attr(T, c), k.suppress && (l = a.attr("title")) && a.removeAttr("title").attr(cb, l).attr("title", ""), g = new e(a, k, c, !!j), a.data(S, g), g } function s(a) { return a.charAt(0).toUpperCase() + a.slice(1) } function t(a, b) { var d, e, f = b.charAt(0).toUpperCase() + b.slice(1), g = (b + " " + rb.join(f + " ") + f).split(" "), h = 0; if (qb[b]) return a.css(qb[b]); for (; d = g[h++];)if ((e = a.css(d)) !== c) return qb[b] = d, e } function u(a, b) { return Math.ceil(parseFloat(t(a, b))) } function v(a, b) { this._ns = "tip", this.options = b, this.offset = b.offset, this.size = [b.width, b.height], this.init(this.qtip = a) } function w(a, b) { this.options = b, this._ns = "-modal", this.init(this.qtip = a) } function x(a) { this._ns = "ie6", this.init(this.qtip = a) } var y, z, A, B, C, D = !0, E = !1, F = null, G = "x", H = "y", I = "width", J = "height", K = "top", L = "left", M = "bottom", N = "right", O = "center", P = "flipinvert", Q = "shift", R = {}, S = "qtip", T = "data-hasqtip", U = "data-qtip-id", V = ["ui-widget", "ui-tooltip"], W = "." + S, X = "click dblclick mousedown mouseup mousemove mouseleave mouseenter".split(" "), Y = S + "-fixed", Z = S + "-default", $ = S + "-focus", _ = S + "-hover", ab = S + "-disabled", bb = "_replacedByqTip", cb = "oldtitle", db = { ie: function () { for (var a = 4, c = b.createElement("div"); (c.innerHTML = "<!--[if gt IE " + a + "]><i></i><![endif]-->") && c.getElementsByTagName("i")[0]; a += 1); return a > 4 ? a : 0 / 0 }(), iOS: parseFloat(("" + (/CPU.*OS ([0-9_]{1,5})|(CPU like).*AppleWebKit.*Mobile/i.exec(navigator.userAgent) || [0, ""])[1]).replace("undefined", "3_2").replace("_", ".").replace("_", "")) || E }; z = e.prototype, z._when = function (a) { return d.when.apply(d, a) }, z.render = function (a) { if (this.rendered || this.destroyed) return this; var b, c = this, e = this.options, f = this.cache, g = this.elements, h = e.content.text, i = e.content.title, j = e.content.button, k = e.position, l = ("." + this._id + " ", []); return d.attr(this.target[0], "aria-describedby", this._id), f.posClass = this._createPosClass((this.position = { my: k.my, at: k.at }).my), this.tooltip = g.tooltip = b = d("<div/>", { id: this._id, "class": [S, Z, e.style.classes, f.posClass].join(" "), width: e.style.width || "", height: e.style.height || "", tracking: "mouse" === k.target && k.adjust.mouse, role: "alert", "aria-live": "polite", "aria-atomic": E, "aria-describedby": this._id + "-content", "aria-hidden": D }).toggleClass(ab, this.disabled).attr(U, this.id).data(S, this).appendTo(k.container).append(g.content = d("<div />", { "class": S + "-content", id: this._id + "-content", "aria-atomic": D })), this.rendered = -1, this.positioning = D, i && (this._createTitle(), d.isFunction(i) || l.push(this._updateTitle(i, E))), j && this._createButton(), d.isFunction(h) || l.push(this._updateContent(h, E)), this.rendered = D, this._setWidget(), d.each(R, function (a) { var b; "render" === this.initialize && (b = this(c)) && (c.plugins[a] = b) }), this._unassignEvents(), this._assignEvents(), this._when(l).then(function () { c._trigger("render"), c.positioning = E, c.hiddenDuringWait || !e.show.ready && !a || c.toggle(D, f.event, E), c.hiddenDuringWait = E }), y.api[this.id] = this, this }, z.destroy = function (a) { function b() { if (!this.destroyed) { this.destroyed = D; var a, b = this.target, c = b.attr(cb); this.rendered && this.tooltip.stop(1, 0).find("*").remove().end().remove(), d.each(this.plugins, function () { this.destroy && this.destroy() }); for (a in this.timers) clearTimeout(this.timers[a]); b.removeData(S).removeAttr(U).removeAttr(T).removeAttr("aria-describedby"), this.options.suppress && c && b.attr("title", c).removeAttr(cb), this._unassignEvents(), this.options = this.elements = this.cache = this.timers = this.plugins = this.mouse = F, delete y.api[this.id] } } return this.destroyed ? this.target : (a === D && "hide" !== this.triggering || !this.rendered ? b.call(this) : (this.tooltip.one("tooltiphidden", d.proxy(b, this)), !this.triggering && this.hide()), this.target) }, B = z.checks = { builtin: { "^id$": function (a, b, c, e) { var f = c === D ? y.nextid : c, g = S + "-" + f; f !== E && f.length > 0 && !d("#" + g).length ? (this._id = g, this.rendered && (this.tooltip[0].id = this._id, this.elements.content[0].id = this._id + "-content", this.elements.title[0].id = this._id + "-title")) : a[b] = e }, "^prerender": function (a, b, c) { c && !this.rendered && this.render(this.options.show.ready) }, "^content.text$": function (a, b, c) { this._updateContent(c) }, "^content.attr$": function (a, b, c, d) { this.options.content.text === this.target.attr(d) && this._updateContent(this.target.attr(c)) }, "^content.title$": function (a, b, c) { return c ? (c && !this.elements.title && this._createTitle(), void this._updateTitle(c)) : this._removeTitle() }, "^content.button$": function (a, b, c) { this._updateButton(c) }, "^content.title.(text|button)$": function (a, b, c) { this.set("content." + b, c) }, "^position.(my|at)$": function (a, b, c) { "string" == typeof c && (this.position[b] = a[b] = new A(c, "at" === b)) }, "^position.container$": function (a, b, c) { this.rendered && this.tooltip.appendTo(c) }, "^show.ready$": function (a, b, c) { c && (!this.rendered && this.render(D) || this.toggle(D)) }, "^style.classes$": function (a, b, c, d) { this.rendered && this.tooltip.removeClass(d).addClass(c) }, "^style.(width|height)": function (a, b, c) { this.rendered && this.tooltip.css(b, c) }, "^style.widget|content.title": function () { this.rendered && this._setWidget() }, "^style.def": function (a, b, c) { this.rendered && this.tooltip.toggleClass(Z, !!c) }, "^events.(render|show|move|hide|focus|blur)$": function (a, b, c) { this.rendered && this.tooltip[(d.isFunction(c) ? "" : "un") + "bind"]("tooltip" + b, c) }, "^(show|hide|position).(event|target|fixed|inactive|leave|distance|viewport|adjust)": function () { if (this.rendered) { var a = this.options.position; this.tooltip.attr("tracking", "mouse" === a.target && a.adjust.mouse), this._unassignEvents(), this._assignEvents() } } } }, z.get = function (a) { if (this.destroyed) return this; var b = i(this.options, a.toLowerCase()), c = b[0][b[1]]; return c.precedance ? c.string() : c }; var eb = /^position\.(my|at|adjust|target|container|viewport)|style|content|show\.ready/i, fb = /^prerender|show\.ready/i; z.set = function (a, b) { if (this.destroyed) return this; { var c, e = this.rendered, f = E, g = this.options; this.checks } return "string" == typeof a ? (c = a, a = {}, a[c] = b) : a = d.extend({}, a), d.each(a, function (b, c) { if (e && fb.test(b)) return void delete a[b]; var h, j = i(g, b.toLowerCase()); h = j[0][j[1]], j[0][j[1]] = c && c.nodeType ? d(c) : c, f = eb.test(b) || f, a[b] = [j[0], j[1], c, h] }), h(g), this.positioning = D, d.each(a, d.proxy(j, this)), this.positioning = E, this.rendered && this.tooltip[0].offsetWidth > 0 && f && this.reposition("mouse" === g.position.target ? F : this.cache.event), this }, z._update = function (a, b) { var c = this, e = this.cache; return this.rendered && a ? (d.isFunction(a) && (a = a.call(this.elements.target, e.event, this) || ""), d.isFunction(a.then) ? (e.waiting = D, a.then(function (a) { return e.waiting = E, c._update(a, b) }, F, function (a) { return c._update(a, b) })) : a === E || !a && "" !== a ? E : (a.jquery && a.length > 0 ? b.empty().append(a.css({ display: "block", visibility: "visible" })) : b.html(a), this._waitForContent(b).then(function (a) { c.rendered && c.tooltip[0].offsetWidth > 0 && c.reposition(e.event, !a.length) }))) : E }, z._waitForContent = function (a) { var b = this.cache; return b.waiting = D, (d.fn.imagesLoaded ? a.imagesLoaded() : d.Deferred().resolve([])).done(function () { b.waiting = E }).promise() }, z._updateContent = function (a, b) { this._update(a, this.elements.content, b) }, z._updateTitle = function (a, b) { this._update(a, this.elements.title, b) === E && this._removeTitle(E) }, z._createTitle = function () { var a = this.elements, b = this._id + "-title"; a.titlebar && this._removeTitle(), a.titlebar = d("<div />", { "class": S + "-titlebar " + (this.options.style.widget ? k("header") : "") }).append(a.title = d("<div />", { id: b, "class": S + "-title", "aria-atomic": D })).insertBefore(a.content).delegate(".qtip-close", "mousedown keydown mouseup keyup mouseout", function (a) { d(this).toggleClass("ui-state-active ui-state-focus", "down" === a.type.substr(-4)) }).delegate(".qtip-close", "mouseover mouseout", function (a) { d(this).toggleClass("ui-state-hover", "mouseover" === a.type) }), this.options.content.button && this._createButton() }, z._removeTitle = function (a) { var b = this.elements; b.title && (b.titlebar.remove(), b.titlebar = b.title = b.button = F, a !== E && this.reposition()) }, z._createPosClass = function (a) { return S + "-pos-" + (a || this.options.position.my).abbrev() }, z.reposition = function (c, e) { if (!this.rendered || this.positioning || this.destroyed) return this; this.positioning = D; var f, g, h, i, j = this.cache, k = this.tooltip, l = this.options.position, m = l.target, n = l.my, o = l.at, p = l.viewport, q = l.container, r = l.adjust, s = r.method.split(" "), t = k.outerWidth(E), u = k.outerHeight(E), v = 0, w = 0, x = k.css("position"), y = { left: 0, top: 0 }, z = k[0].offsetWidth > 0, A = c && "scroll" === c.type, B = d(a), C = q[0].ownerDocument, F = this.mouse; if (d.isArray(m) && 2 === m.length) o = { x: L, y: K }, y = { left: m[0], top: m[1] }; else if ("mouse" === m) o = { x: L, y: K }, (!r.mouse || this.options.hide.distance) && j.origin && j.origin.pageX ? c = j.origin : !c || c && ("resize" === c.type || "scroll" === c.type) ? c = j.event : F && F.pageX && (c = F), "static" !== x && (y = q.offset()), C.body.offsetWidth !== (a.innerWidth || C.documentElement.clientWidth) && (g = d(b.body).offset()), y = { left: c.pageX - y.left + (g && g.left || 0), top: c.pageY - y.top + (g && g.top || 0) }, r.mouse && A && F && (y.left -= (F.scrollX || 0) - B.scrollLeft(), y.top -= (F.scrollY || 0) - B.scrollTop()); else { if ("event" === m ? c && c.target && "scroll" !== c.type && "resize" !== c.type ? j.target = d(c.target) : c.target || (j.target = this.elements.target) : "event" !== m && (j.target = d(m.jquery ? m : this.elements.target)), m = j.target, m = d(m).eq(0), 0 === m.length) return this; m[0] === b || m[0] === a ? (v = db.iOS ? a.innerWidth : m.width(), w = db.iOS ? a.innerHeight : m.height(), m[0] === a && (y = { top: (p || m).scrollTop(), left: (p || m).scrollLeft() })) : R.imagemap && m.is("area") ? f = R.imagemap(this, m, o, R.viewport ? s : E) : R.svg && m && m[0].ownerSVGElement ? f = R.svg(this, m, o, R.viewport ? s : E) : (v = m.outerWidth(E), w = m.outerHeight(E), y = m.offset()), f && (v = f.width, w = f.height, g = f.offset, y = f.position), y = this.reposition.offset(m, y, q), (db.iOS > 3.1 && db.iOS < 4.1 || db.iOS >= 4.3 && db.iOS < 4.33 || !db.iOS && "fixed" === x) && (y.left -= B.scrollLeft(), y.top -= B.scrollTop()), (!f || f && f.adjustable !== E) && (y.left += o.x === N ? v : o.x === O ? v / 2 : 0, y.top += o.y === M ? w : o.y === O ? w / 2 : 0) } return y.left += r.x + (n.x === N ? -t : n.x === O ? -t / 2 : 0), y.top += r.y + (n.y === M ? -u : n.y === O ? -u / 2 : 0), R.viewport ? (h = y.adjusted = R.viewport(this, y, l, v, w, t, u), g && h.left && (y.left += g.left), g && h.top && (y.top += g.top), h.my && (this.position.my = h.my)) : y.adjusted = { left: 0, top: 0 }, j.posClass !== (i = this._createPosClass(this.position.my)) && k.removeClass(j.posClass).addClass(j.posClass = i), this._trigger("move", [y, p.elem || p], c) ? (delete y.adjusted, e === E || !z || isNaN(y.left) || isNaN(y.top) || "mouse" === m || !d.isFunction(l.effect) ? k.css(y) : d.isFunction(l.effect) && (l.effect.call(k, this, d.extend({}, y)), k.queue(function (a) { d(this).css({ opacity: "", height: "" }), db.ie && this.style.removeAttribute("filter"), a() })), this.positioning = E, this) : this }, z.reposition.offset = function (a, c, e) { function f(a, b) { c.left += b * a.scrollLeft(), c.top += b * a.scrollTop() } if (!e[0]) return c; var g, h, i, j, k = d(a[0].ownerDocument), l = !!db.ie && "CSS1Compat" !== b.compatMode, m = e[0]; do "static" !== (h = d.css(m, "position")) && ("fixed" === h ? (i = m.getBoundingClientRect(), f(k, -1)) : (i = d(m).position(), i.left += parseFloat(d.css(m, "borderLeftWidth")) || 0, i.top += parseFloat(d.css(m, "borderTopWidth")) || 0), c.left -= i.left + (parseFloat(d.css(m, "marginLeft")) || 0), c.top -= i.top + (parseFloat(d.css(m, "marginTop")) || 0), g || "hidden" === (j = d.css(m, "overflow")) || "visible" === j || (g = d(m))); while (m = m.offsetParent); return g && (g[0] !== k[0] || l) && f(g, 1), c }; var gb = (A = z.reposition.Corner = function (a, b) { a = ("" + a).replace(/([A-Z])/, " $1").replace(/middle/gi, O).toLowerCase(), this.x = (a.match(/left|right/i) || a.match(/center/) || ["inherit"])[0].toLowerCase(), this.y = (a.match(/top|bottom|center/i) || ["inherit"])[0].toLowerCase(), this.forceY = !!b; var c = a.charAt(0); this.precedance = "t" === c || "b" === c ? H : G }).prototype; gb.invert = function (a, b) { this[a] = this[a] === L ? N : this[a] === N ? L : b || this[a] }, gb.string = function (a) { var b = this.x, c = this.y, d = b !== c ? "center" === b || "center" !== c && (this.precedance === H || this.forceY) ? [c, b] : [b, c] : [b]; return a !== !1 ? d.join(" ") : d }, gb.abbrev = function () { var a = this.string(!1); return a[0].charAt(0) + (a[1] && a[1].charAt(0) || "") }, gb.clone = function () { return new A(this.string(), this.forceY) }, z.toggle = function (a, c) { var e = this.cache, f = this.options, g = this.tooltip; if (c) { if (/over|enter/.test(c.type) && e.event && /out|leave/.test(e.event.type) && f.show.target.add(c.target).length === f.show.target.length && g.has(c.relatedTarget).length) return this; e.event = d.event.fix(c) } if (this.waiting && !a && (this.hiddenDuringWait = D), !this.rendered) return a ? this.render(1) : this; if (this.destroyed || this.disabled) return this; var h, i, j, k = a ? "show" : "hide", l = this.options[k], m = (this.options[a ? "hide" : "show"], this.options.position), n = this.options.content, o = this.tooltip.css("width"), p = this.tooltip.is(":visible"), q = a || 1 === l.target.length, r = !c || l.target.length < 2 || e.target[0] === c.target; return (typeof a).search("boolean|number") && (a = !p), h = !g.is(":animated") && p === a && r, i = h ? F : !!this._trigger(k, [90]), this.destroyed ? this : (i !== E && a && this.focus(c), !i || h ? this : (d.attr(g[0], "aria-hidden", !a), a ? (this.mouse && (e.origin = d.event.fix(this.mouse)), d.isFunction(n.text) && this._updateContent(n.text, E), d.isFunction(n.title) && this._updateTitle(n.title, E), !C && "mouse" === m.target && m.adjust.mouse && (d(b).bind("mousemove." + S, this._storeMouse), C = D), o || g.css("width", g.outerWidth(E)), this.reposition(c, arguments[2]), o || g.css("width", ""), l.solo && ("string" == typeof l.solo ? d(l.solo) : d(W, l.solo)).not(g).not(l.target).qtip("hide", d.Event("tooltipsolo"))) : (clearTimeout(this.timers.show), delete e.origin, C && !d(W + '[tracking="true"]:visible', l.solo).not(g).length && (d(b).unbind("mousemove." + S), C = E), this.blur(c)), j = d.proxy(function () { a ? (db.ie && g[0].style.removeAttribute("filter"), g.css("overflow", ""), "string" == typeof l.autofocus && d(this.options.show.autofocus, g).focus(), this.options.show.target.trigger("qtip-" + this.id + "-inactive")) : g.css({ display: "", visibility: "", opacity: "", left: "", top: "" }), this._trigger(a ? "visible" : "hidden") }, this), l.effect === E || q === E ? (g[k](), j()) : d.isFunction(l.effect) ? (g.stop(1, 1), l.effect.call(g, this), g.queue("fx", function (a) { j(), a() })) : g.fadeTo(90, a ? 1 : 0, j), a && l.target.trigger("qtip-" + this.id + "-inactive"), this)) }, z.show = function (a) { return this.toggle(D, a) }, z.hide = function (a) { return this.toggle(E, a) }, z.focus = function (a) { if (!this.rendered || this.destroyed) return this; var b = d(W), c = this.tooltip, e = parseInt(c[0].style.zIndex, 10), f = y.zindex + b.length; return c.hasClass($) || this._trigger("focus", [f], a) && (e !== f && (b.each(function () { this.style.zIndex > e && (this.style.zIndex = this.style.zIndex - 1) }), b.filter("." + $).qtip("blur", a)), c.addClass($)[0].style.zIndex = f), this }, z.blur = function (a) { return !this.rendered || this.destroyed ? this : (this.tooltip.removeClass($), this._trigger("blur", [this.tooltip.css("zIndex")], a), this) }, z.disable = function (a) { return this.destroyed ? this : ("toggle" === a ? a = !(this.rendered ? this.tooltip.hasClass(ab) : this.disabled) : "boolean" != typeof a && (a = D), this.rendered && this.tooltip.toggleClass(ab, a).attr("aria-disabled", a), this.disabled = !!a, this) }, z.enable = function () { return this.disable(E) }, z._createButton = function () { var a = this, b = this.elements, c = b.tooltip, e = this.options.content.button, f = "string" == typeof e, g = f ? e : "Close tooltip"; b.button && b.button.remove(), b.button = e.jquery ? e : d("<a />", { "class": "qtip-close " + (this.options.style.widget ? "" : S + "-icon"), title: g, "aria-label": g }).prepend(d("<span />", { "class": "ui-icon ui-icon-close", html: "&times;" })), b.button.appendTo(b.titlebar || c).attr("role", "button").click(function (b) { return c.hasClass(ab) || a.hide(b), E }) }, z._updateButton = function (a) { if (!this.rendered) return E; var b = this.elements.button; a ? this._createButton() : b.remove() }, z._setWidget = function () { var a = this.options.style.widget, b = this.elements, c = b.tooltip, d = c.hasClass(ab); c.removeClass(ab), ab = a ? "ui-state-disabled" : "qtip-disabled", c.toggleClass(ab, d), c.toggleClass("ui-helper-reset " + k(), a).toggleClass(Z, this.options.style.def && !a), b.content && b.content.toggleClass(k("content"), a), b.titlebar && b.titlebar.toggleClass(k("header"), a), b.button && b.button.toggleClass(S + "-icon", !a) }, z._storeMouse = function (a) { return (this.mouse = d.event.fix(a)).type = "mousemove", this }, z._bind = function (a, b, c, e, f) { if (a && c && b.length) { var g = "." + this._id + (e ? "-" + e : ""); return d(a).bind((b.split ? b : b.join(g + " ")) + g, d.proxy(c, f || this)), this } }, z._unbind = function (a, b) { return a && d(a).unbind("." + this._id + (b ? "-" + b : "")), this }, z._trigger = function (a, b, c) { var e = d.Event("tooltip" + a); return e.originalEvent = c && d.extend({}, c) || this.cache.event || F, this.triggering = a, this.tooltip.trigger(e, [this].concat(b || [])), this.triggering = E, !e.isDefaultPrevented() }, z._bindEvents = function (a, b, c, e, f, g) { var h = c.filter(e).add(e.filter(c)), i = []; h.length && (d.each(b, function (b, c) { var e = d.inArray(c, a); e > -1 && i.push(a.splice(e, 1)[0]) }), i.length && (this._bind(h, i, function (a) { var b = this.rendered ? this.tooltip[0].offsetWidth > 0 : !1; (b ? g : f).call(this, a) }), c = c.not(h), e = e.not(h))), this._bind(c, a, f), this._bind(e, b, g) }, z._assignInitialEvents = function (a) { function b(a) { return this.disabled || this.destroyed ? E : (this.cache.event = a && d.event.fix(a), this.cache.target = a && d(a.target), clearTimeout(this.timers.show), void (this.timers.show = l.call(this, function () { this.render("object" == typeof a || c.show.ready) }, c.prerender ? 0 : c.show.delay))) } var c = this.options, e = c.show.target, f = c.hide.target, g = c.show.event ? d.trim("" + c.show.event).split(" ") : [], h = c.hide.event ? d.trim("" + c.hide.event).split(" ") : []; this._bind(this.elements.target, ["remove", "removeqtip"], function () { this.destroy(!0) }, "destroy"), /mouse(over|enter)/i.test(c.show.event) && !/mouse(out|leave)/i.test(c.hide.event) && h.push("mouseleave"), this._bind(e, "mousemove", function (a) { this._storeMouse(a), this.cache.onTarget = D }), this._bindEvents(g, h, e, f, b, function () { return this.timers ? void clearTimeout(this.timers.show) : E }), (c.show.ready || c.prerender) && b.call(this, a) }, z._assignEvents = function () { var c = this, e = this.options, f = e.position, g = this.tooltip, h = e.show.target, i = e.hide.target, j = f.container, k = f.viewport, l = d(b), q = (d(b.body), d(a)), r = e.show.event ? d.trim("" + e.show.event).split(" ") : [], s = e.hide.event ? d.trim("" + e.hide.event).split(" ") : []; d.each(e.events, function (a, b) { c._bind(g, "toggle" === a ? ["tooltipshow", "tooltiphide"] : ["tooltip" + a], b, null, g) }), /mouse(out|leave)/i.test(e.hide.event) && "window" === e.hide.leave && this._bind(l, ["mouseout", "blur"], function (a) { /select|option/.test(a.target.nodeName) || a.relatedTarget || this.hide(a) }), e.hide.fixed ? i = i.add(g.addClass(Y)) : /mouse(over|enter)/i.test(e.show.event) && this._bind(i, "mouseleave", function () { clearTimeout(this.timers.show) }), ("" + e.hide.event).indexOf("unfocus") > -1 && this._bind(j.closest("html"), ["mousedown", "touchstart"], function (a) { var b = d(a.target), c = this.rendered && !this.tooltip.hasClass(ab) && this.tooltip[0].offsetWidth > 0, e = b.parents(W).filter(this.tooltip[0]).length > 0; b[0] === this.target[0] || b[0] === this.tooltip[0] || e || this.target.has(b[0]).length || !c || this.hide(a) }), "number" == typeof e.hide.inactive && (this._bind(h, "qtip-" + this.id + "-inactive", o, "inactive"), this._bind(i.add(g), y.inactiveEvents, o)), this._bindEvents(r, s, h, i, m, n), this._bind(h.add(g), "mousemove", function (a) { if ("number" == typeof e.hide.distance) { var b = this.cache.origin || {}, c = this.options.hide.distance, d = Math.abs; (d(a.pageX - b.pageX) >= c || d(a.pageY - b.pageY) >= c) && this.hide(a) } this._storeMouse(a) }), "mouse" === f.target && f.adjust.mouse && (e.hide.event && this._bind(h, ["mouseenter", "mouseleave"], function (a) { return this.cache ? void (this.cache.onTarget = "mouseenter" === a.type) : E }), this._bind(l, "mousemove", function (a) { this.rendered && this.cache.onTarget && !this.tooltip.hasClass(ab) && this.tooltip[0].offsetWidth > 0 && this.reposition(a) })), (f.adjust.resize || k.length) && this._bind(d.event.special.resize ? k : q, "resize", p), f.adjust.scroll && this._bind(q.add(f.container), "scroll", p) }, z._unassignEvents = function () { var c = this.options, e = c.show.target, f = c.hide.target, g = d.grep([this.elements.target[0], this.rendered && this.tooltip[0], c.position.container[0], c.position.viewport[0], c.position.container.closest("html")[0], a, b], function (a) { return "object" == typeof a }); e && e.toArray && (g = g.concat(e.toArray())), f && f.toArray && (g = g.concat(f.toArray())), this._unbind(g)._unbind(g, "destroy")._unbind(g, "inactive") }, d(function () { q(W, ["mouseenter", "mouseleave"], function (a) { var b = "mouseenter" === a.type, c = d(a.currentTarget), e = d(a.relatedTarget || a.target), f = this.options; b ? (this.focus(a), c.hasClass(Y) && !c.hasClass(ab) && clearTimeout(this.timers.hide)) : "mouse" === f.position.target && f.position.adjust.mouse && f.hide.event && f.show.target && !e.closest(f.show.target[0]).length && this.hide(a), c.toggleClass(_, b) }), q("[" + U + "]", X, o) }), y = d.fn.qtip = function (a, b, e) { var f = ("" + a).toLowerCase(), g = F, i = d.makeArray(arguments).slice(1), j = i[i.length - 1], k = this[0] ? d.data(this[0], S) : F; return !arguments.length && k || "api" === f ? k : "string" == typeof a ? (this.each(function () { var a = d.data(this, S); if (!a) return D; if (j && j.timeStamp && (a.cache.event = j), !b || "option" !== f && "options" !== f) a[f] && a[f].apply(a, i); else { if (e === c && !d.isPlainObject(b)) return g = a.get(b), E; a.set(b, e) } }), g !== F ? g : this) : "object" != typeof a && arguments.length ? void 0 : (k = h(d.extend(D, {}, a)), this.each(function (a) { var b, c; return c = d.isArray(k.id) ? k.id[a] : k.id, c = !c || c === E || c.length < 1 || y.api[c] ? y.nextid++ : c, b = r(d(this), c, k), b === E ? D : (y.api[c] = b, d.each(R, function () { "initialize" === this.initialize && this(b) }), void b._assignInitialEvents(j)) })) }, d.qtip = e, y.api = {}, d.each({ attr: function (a, b) { if (this.length) { var c = this[0], e = "title", f = d.data(c, "qtip"); if (a === e && f && "object" == typeof f && f.options.suppress) return arguments.length < 2 ? d.attr(c, cb) : (f && f.options.content.attr === e && f.cache.attr && f.set("content.text", b), this.attr(cb, b)) } return d.fn["attr" + bb].apply(this, arguments) }, clone: function (a) { var b = (d([]), d.fn["clone" + bb].apply(this, arguments)); return a || b.filter("[" + cb + "]").attr("title", function () { return d.attr(this, cb) }).removeAttr(cb), b } }, function (a, b) { if (!b || d.fn[a + bb]) return D; var c = d.fn[a + bb] = d.fn[a]; d.fn[a] = function () { return b.apply(this, arguments) || c.apply(this, arguments) } }), d.ui || (d["cleanData" + bb] = d.cleanData, d.cleanData = function (a) { for (var b, c = 0; (b = d(a[c])).length; c++)if (b.attr(T)) try { b.triggerHandler("removeqtip") } catch (e) { } d["cleanData" + bb].apply(this, arguments) }), y.version = "2.2.1", y.nextid = 0, y.inactiveEvents = X, y.zindex = 15e3, y.defaults = { prerender: E, id: E, overwrite: D, suppress: D, content: { text: D, attr: "title", title: E, button: E }, position: { my: "top left", at: "bottom right", target: E, container: E, viewport: E, adjust: { x: 0, y: 0, mouse: D, scroll: D, resize: D, method: "flipinvert flipinvert" }, effect: function (a, b) { d(this).animate(b, { duration: 200, queue: E }) } }, show: { target: E, event: "mouseenter", effect: D, delay: 90, solo: E, ready: E, autofocus: E }, hide: { target: E, event: "mouseleave", effect: D, delay: 0, fixed: E, inactive: E, leave: "window", distance: E }, style: { classes: "", widget: E, width: E, height: E, def: D }, events: { render: F, move: F, show: F, hide: F, toggle: F, visible: F, hidden: F, focus: F, blur: F } }; var hb, ib = "margin", jb = "border", kb = "color", lb = "background-color", mb = "transparent", nb = " !important", ob = !!b.createElement("canvas").getContext, pb = /rgba?\(0, 0, 0(, 0)?\)|transparent|#123456/i, qb = {}, rb = ["Webkit", "O", "Moz", "ms"]; if (ob) var sb = a.devicePixelRatio || 1, tb = function () { var a = b.createElement("canvas").getContext("2d"); return a.backingStorePixelRatio || a.webkitBackingStorePixelRatio || a.mozBackingStorePixelRatio || a.msBackingStorePixelRatio || a.oBackingStorePixelRatio || 1 }(), ub = sb / tb; else var vb = function (a, b, c) { return "<qtipvml:" + a + ' xmlns="urn:schemas-microsoft.com:vml" class="qtip-vml" ' + (b || "") + ' style="behavior: url(#default#VML); ' + (c || "") + '" />' }; d.extend(v.prototype, {
            init: function (a) { var b, c; c = this.element = a.elements.tip = d("<div />", { "class": S + "-tip" }).prependTo(a.tooltip), ob ? (b = d("<canvas />").appendTo(this.element)[0].getContext("2d"), b.lineJoin = "miter", b.miterLimit = 1e5, b.save()) : (b = vb("shape", 'coordorigin="0,0"', "position:absolute;"), this.element.html(b + b), a._bind(d("*", c).add(c), ["click", "mousedown"], function (a) { a.stopPropagation() }, this._ns)), a._bind(a.tooltip, "tooltipmove", this.reposition, this._ns, this), this.create() }, _swapDimensions: function () { this.size[0] = this.options.height, this.size[1] = this.options.width }, _resetDimensions: function () { this.size[0] = this.options.width, this.size[1] = this.options.height }, _useTitle: function (a) { var b = this.qtip.elements.titlebar; return b && (a.y === K || a.y === O && this.element.position().top + this.size[1] / 2 + this.options.offset < b.outerHeight(D)) }, _parseCorner: function (a) { var b = this.qtip.options.position.my; return a === E || b === E ? a = E : a === D ? a = new A(b.string()) : a.string || (a = new A(a), a.fixed = D), a }, _parseWidth: function (a, b, c) { var d = this.qtip.elements, e = jb + s(b) + "Width"; return (c ? u(c, e) : u(d.content, e) || u(this._useTitle(a) && d.titlebar || d.content, e) || u(d.tooltip, e)) || 0 }, _parseRadius: function (a) { var b = this.qtip.elements, c = jb + s(a.y) + s(a.x) + "Radius"; return db.ie < 9 ? 0 : u(this._useTitle(a) && b.titlebar || b.content, c) || u(b.tooltip, c) || 0 }, _invalidColour: function (a, b, c) { var d = a.css(b); return !d || c && d === a.css(c) || pb.test(d) ? E : d }, _parseColours: function (a) { var b = this.qtip.elements, c = this.element.css("cssText", ""), e = jb + s(a[a.precedance]) + s(kb), f = this._useTitle(a) && b.titlebar || b.content, g = this._invalidColour, h = []; return h[0] = g(c, lb) || g(f, lb) || g(b.content, lb) || g(b.tooltip, lb) || c.css(lb), h[1] = g(c, e, kb) || g(f, e, kb) || g(b.content, e, kb) || g(b.tooltip, e, kb) || b.tooltip.css(e), d("*", c).add(c).css("cssText", lb + ":" + mb + nb + ";" + jb + ":0" + nb + ";"), h }, _calculateSize: function (a) { var b, c, d, e = a.precedance === H, f = this.options.width, g = this.options.height, h = "c" === a.abbrev(), i = (e ? f : g) * (h ? .5 : 1), j = Math.pow, k = Math.round, l = Math.sqrt(j(i, 2) + j(g, 2)), m = [this.border / i * l, this.border / g * l]; return m[2] = Math.sqrt(j(m[0], 2) - j(this.border, 2)), m[3] = Math.sqrt(j(m[1], 2) - j(this.border, 2)), b = l + m[2] + m[3] + (h ? 0 : m[0]), c = b / l, d = [k(c * f), k(c * g)], e ? d : d.reverse() }, _calculateTip: function (a, b, c) { c = c || 1, b = b || this.size; var d = b[0] * c, e = b[1] * c, f = Math.ceil(d / 2), g = Math.ceil(e / 2), h = { br: [0, 0, d, e, d, 0], bl: [0, 0, d, 0, 0, e], tr: [0, e, d, 0, d, e], tl: [0, 0, 0, e, d, e], tc: [0, e, f, 0, d, e], bc: [0, 0, d, 0, f, e], rc: [0, 0, d, g, 0, e], lc: [d, 0, d, e, 0, g] }; return h.lt = h.br, h.rt = h.bl, h.lb = h.tr, h.rb = h.tl, h[a.abbrev()] }, _drawCoords: function (a, b) { a.beginPath(), a.moveTo(b[0], b[1]), a.lineTo(b[2], b[3]), a.lineTo(b[4], b[5]), a.closePath() }, create: function () { var a = this.corner = (ob || db.ie) && this._parseCorner(this.options.corner); return (this.enabled = !!this.corner && "c" !== this.corner.abbrev()) && (this.qtip.cache.corner = a.clone(), this.update()), this.element.toggle(this.enabled), this.corner }, update: function (b, c) { if (!this.enabled) return this; var e, f, g, h, i, j, k, l, m = this.qtip.elements, n = this.element, o = n.children(), p = this.options, q = this.size, r = p.mimic, s = Math.round; b || (b = this.qtip.cache.corner || this.corner), r === E ? r = b : (r = new A(r), r.precedance = b.precedance, "inherit" === r.x ? r.x = b.x : "inherit" === r.y ? r.y = b.y : r.x === r.y && (r[b.precedance] = b[b.precedance])), f = r.precedance, b.precedance === G ? this._swapDimensions() : this._resetDimensions(), e = this.color = this._parseColours(b), e[1] !== mb ? (l = this.border = this._parseWidth(b, b[b.precedance]), p.border && 1 > l && !pb.test(e[1]) && (e[0] = e[1]), this.border = l = p.border !== D ? p.border : l) : this.border = l = 0, k = this.size = this._calculateSize(b), n.css({ width: k[0], height: k[1], lineHeight: k[1] + "px" }), j = b.precedance === H ? [s(r.x === L ? l : r.x === N ? k[0] - q[0] - l : (k[0] - q[0]) / 2), s(r.y === K ? k[1] - q[1] : 0)] : [s(r.x === L ? k[0] - q[0] : 0), s(r.y === K ? l : r.y === M ? k[1] - q[1] - l : (k[1] - q[1]) / 2)], ob ? (g = o[0].getContext("2d"), g.restore(), g.save(), g.clearRect(0, 0, 6e3, 6e3), h = this._calculateTip(r, q, ub), i = this._calculateTip(r, this.size, ub), o.attr(I, k[0] * ub).attr(J, k[1] * ub), o.css(I, k[0]).css(J, k[1]), this._drawCoords(g, i), g.fillStyle = e[1], g.fill(), g.translate(j[0] * ub, j[1] * ub), this._drawCoords(g, h), g.fillStyle = e[0], g.fill()) : (h = this._calculateTip(r), h = "m" + h[0] + "," + h[1] + " l" + h[2] + "," + h[3] + " " + h[4] + "," + h[5] + " xe", j[2] = l && /^(r|b)/i.test(b.string()) ? 8 === db.ie ? 2 : 1 : 0, o.css({ coordsize: k[0] + l + " " + (k[1] + l), antialias: "" + (r.string().indexOf(O) > -1), left: j[0] - j[2] * Number(f === G), top: j[1] - j[2] * Number(f === H), width: k[0] + l, height: k[1] + l }).each(function (a) { var b = d(this); b[b.prop ? "prop" : "attr"]({ coordsize: k[0] + l + " " + (k[1] + l), path: h, fillcolor: e[0], filled: !!a, stroked: !a }).toggle(!(!l && !a)), !a && b.html(vb("stroke", 'weight="' + 2 * l + 'px" color="' + e[1] + '" miterlimit="1000" joinstyle="miter"')) })), a.opera && setTimeout(function () { m.tip.css({ display: "inline-block", visibility: "visible" }) }, 1), c !== E && this.calculate(b, k) }, calculate: function (a, b) {
                if (!this.enabled) return E; var c, e, f = this, g = this.qtip.elements, h = this.element, i = this.options.offset, j = (g.tooltip.hasClass("ui-widget"), {}); return a = a || this.corner, c = a.precedance, b = b || this._calculateSize(a), e = [a.x, a.y], c === G && e.reverse(), d.each(e, function (d, e) {
                    var h, k, l;
                    e === O ? (h = c === H ? L : K, j[h] = "50%", j[ib + "-" + h] = -Math.round(b[c === H ? 0 : 1] / 2) + i) : (h = f._parseWidth(a, e, g.tooltip), k = f._parseWidth(a, e, g.content), l = f._parseRadius(a), j[e] = Math.max(-f.border, d ? k : i + (l > h ? l : -h)))
                }), j[a[c]] -= b[c === G ? 0 : 1], h.css({ margin: "", top: "", bottom: "", left: "", right: "" }).css(j), j
            }, reposition: function (a, b, d) { function e(a, b, c, d, e) { a === Q && j.precedance === b && k[d] && j[c] !== O ? j.precedance = j.precedance === G ? H : G : a !== Q && k[d] && (j[b] = j[b] === O ? k[d] > 0 ? d : e : j[b] === d ? e : d) } function f(a, b, e) { j[a] === O ? p[ib + "-" + b] = o[a] = g[ib + "-" + b] - k[b] : (h = g[e] !== c ? [k[b], -g[b]] : [-k[b], g[b]], (o[a] = Math.max(h[0], h[1])) > h[0] && (d[b] -= k[b], o[b] = E), p[g[e] !== c ? e : b] = o[a]) } if (this.enabled) { var g, h, i = b.cache, j = this.corner.clone(), k = d.adjusted, l = b.options.position.adjust.method.split(" "), m = l[0], n = l[1] || l[0], o = { left: E, top: E, x: 0, y: 0 }, p = {}; this.corner.fixed !== D && (e(m, G, H, L, N), e(n, H, G, K, M), (j.string() !== i.corner.string() || i.cornerTop !== k.top || i.cornerLeft !== k.left) && this.update(j, E)), g = this.calculate(j), g.right !== c && (g.left = -g.right), g.bottom !== c && (g.top = -g.bottom), g.user = this.offset, (o.left = m === Q && !!k.left) && f(G, L, N), (o.top = n === Q && !!k.top) && f(H, K, M), this.element.css(p).toggle(!(o.x && o.y || j.x === O && o.y || j.y === O && o.x)), d.left -= g.left.charAt ? g.user : m !== Q || o.top || !o.left && !o.top ? g.left + this.border : 0, d.top -= g.top.charAt ? g.user : n !== Q || o.left || !o.left && !o.top ? g.top + this.border : 0, i.cornerLeft = k.left, i.cornerTop = k.top, i.corner = j.clone() } }, destroy: function () { this.qtip._unbind(this.qtip.tooltip, this._ns), this.qtip.elements.tip && this.qtip.elements.tip.find("*").remove().end().remove() }
        }), hb = R.tip = function (a) { return new v(a, a.options.style.tip) }, hb.initialize = "render", hb.sanitize = function (a) { if (a.style && "tip" in a.style) { var b = a.style.tip; "object" != typeof b && (b = a.style.tip = { corner: b }), /string|boolean/i.test(typeof b.corner) || (b.corner = D) } }, B.tip = { "^position.my|style.tip.(corner|mimic|border)$": function () { this.create(), this.qtip.reposition() }, "^style.tip.(height|width)$": function (a) { this.size = [a.width, a.height], this.update(), this.qtip.reposition() }, "^content.title|style.(classes|widget)$": function () { this.update() } }, d.extend(D, y.defaults, { style: { tip: { corner: D, mimic: E, width: 6, height: 6, border: D, offset: 0 } } }); var wb, xb, yb = "qtip-modal", zb = "." + yb; xb = function () { function a(a) { if (d.expr[":"].focusable) return d.expr[":"].focusable; var b, c, e, f = !isNaN(d.attr(a, "tabindex")), g = a.nodeName && a.nodeName.toLowerCase(); return "area" === g ? (b = a.parentNode, c = b.name, a.href && c && "map" === b.nodeName.toLowerCase() ? (e = d("img[usemap=#" + c + "]")[0], !!e && e.is(":visible")) : !1) : /input|select|textarea|button|object/.test(g) ? !a.disabled : "a" === g ? a.href || f : f } function c(a) { k.length < 1 && a.length ? a.not("body").blur() : k.first().focus() } function e(a) { if (i.is(":visible")) { var b, e = d(a.target), h = f.tooltip, j = e.closest(W); b = j.length < 1 ? E : parseInt(j[0].style.zIndex, 10) > parseInt(h[0].style.zIndex, 10), b || e.closest(W)[0] === h[0] || c(e), g = a.target === k[k.length - 1] } } var f, g, h, i, j = this, k = {}; d.extend(j, { init: function () { return i = j.elem = d("<div />", { id: "qtip-overlay", html: "<div></div>", mousedown: function () { return E } }).hide(), d(b.body).bind("focusin" + zb, e), d(b).bind("keydown" + zb, function (a) { f && f.options.show.modal.escape && 27 === a.keyCode && f.hide(a) }), i.bind("click" + zb, function (a) { f && f.options.show.modal.blur && f.hide(a) }), j }, update: function (b) { f = b, k = b.options.show.modal.stealfocus !== E ? b.tooltip.find("*").filter(function () { return a(this) }) : [] }, toggle: function (a, e, g) { var k = (d(b.body), a.tooltip), l = a.options.show.modal, m = l.effect, n = e ? "show" : "hide", o = i.is(":visible"), p = d(zb).filter(":visible:not(:animated)").not(k); return j.update(a), e && l.stealfocus !== E && c(d(":focus")), i.toggleClass("blurs", l.blur), e && i.appendTo(b.body), i.is(":animated") && o === e && h !== E || !e && p.length ? j : (i.stop(D, E), d.isFunction(m) ? m.call(i, e) : m === E ? i[n]() : i.fadeTo(parseInt(g, 10) || 90, e ? 1 : 0, function () { e || i.hide() }), e || i.queue(function (a) { i.css({ left: "", top: "" }), d(zb).length || i.detach(), a() }), h = e, f.destroyed && (f = F), j) } }), j.init() }, xb = new xb, d.extend(w.prototype, { init: function (a) { var b = a.tooltip; return this.options.on ? (a.elements.overlay = xb.elem, b.addClass(yb).css("z-index", y.modal_zindex + d(zb).length), a._bind(b, ["tooltipshow", "tooltiphide"], function (a, c, e) { var f = a.originalEvent; if (a.target === b[0]) if (f && "tooltiphide" === a.type && /mouse(leave|enter)/.test(f.type) && d(f.relatedTarget).closest(xb.elem[0]).length) try { a.preventDefault() } catch (g) { } else (!f || f && "tooltipsolo" !== f.type) && this.toggle(a, "tooltipshow" === a.type, e) }, this._ns, this), a._bind(b, "tooltipfocus", function (a, c) { if (!a.isDefaultPrevented() && a.target === b[0]) { var e = d(zb), f = y.modal_zindex + e.length, g = parseInt(b[0].style.zIndex, 10); xb.elem[0].style.zIndex = f - 1, e.each(function () { this.style.zIndex > g && (this.style.zIndex -= 1) }), e.filter("." + $).qtip("blur", a.originalEvent), b.addClass($)[0].style.zIndex = f, xb.update(c); try { a.preventDefault() } catch (h) { } } }, this._ns, this), void a._bind(b, "tooltiphide", function (a) { a.target === b[0] && d(zb).filter(":visible").not(b).last().qtip("focus", a) }, this._ns, this)) : this }, toggle: function (a, b, c) { return a && a.isDefaultPrevented() ? this : void xb.toggle(this.qtip, !!b, c) }, destroy: function () { this.qtip.tooltip.removeClass(yb), this.qtip._unbind(this.qtip.tooltip, this._ns), xb.toggle(this.qtip, E), delete this.qtip.elements.overlay } }), wb = R.modal = function (a) { return new w(a, a.options.show.modal) }, wb.sanitize = function (a) { a.show && ("object" != typeof a.show.modal ? a.show.modal = { on: !!a.show.modal } : "undefined" == typeof a.show.modal.on && (a.show.modal.on = D)) }, y.modal_zindex = y.zindex - 200, wb.initialize = "render", B.modal = { "^show.modal.(on|blur)$": function () { this.destroy(), this.init(), this.qtip.elems.overlay.toggle(this.qtip.tooltip[0].offsetWidth > 0) } }, d.extend(D, y.defaults, { show: { modal: { on: E, effect: D, blur: D, stealfocus: D, escape: D } } }), R.viewport = function (c, d, e, f, g, h, i) { function j(a, b, c, e, f, g, h, i, j) { var k = d[f], s = u[a], t = v[a], w = c === Q, x = s === f ? j : s === g ? -j : -j / 2, y = t === f ? i : t === g ? -i : -i / 2, z = q[f] + r[f] - (n ? 0 : m[f]), A = z - k, B = k + j - (h === I ? o : p) - z, C = x - (u.precedance === a || s === u[b] ? y : 0) - (t === O ? i / 2 : 0); return w ? (C = (s === f ? 1 : -1) * x, d[f] += A > 0 ? A : B > 0 ? -B : 0, d[f] = Math.max(-m[f] + r[f], k - C, Math.min(Math.max(-m[f] + r[f] + (h === I ? o : p), k + C), d[f], "center" === s ? k - x : 1e9))) : (e *= c === P ? 2 : 0, A > 0 && (s !== f || B > 0) ? (d[f] -= C + e, l.invert(a, f)) : B > 0 && (s !== g || A > 0) && (d[f] -= (s === O ? -C : C) + e, l.invert(a, g)), d[f] < q && -d[f] > B && (d[f] = k, l = u.clone())), d[f] - k } var k, l, m, n, o, p, q, r, s = e.target, t = c.elements.tooltip, u = e.my, v = e.at, w = e.adjust, x = w.method.split(" "), y = x[0], z = x[1] || x[0], A = e.viewport, B = e.container, C = (c.cache, { left: 0, top: 0 }); return A.jquery && s[0] !== a && s[0] !== b.body && "none" !== w.method ? (m = B.offset() || C, n = "static" === B.css("position"), k = "fixed" === t.css("position"), o = A[0] === a ? A.width() : A.outerWidth(E), p = A[0] === a ? A.height() : A.outerHeight(E), q = { left: k ? 0 : A.scrollLeft(), top: k ? 0 : A.scrollTop() }, r = A.offset() || C, ("shift" !== y || "shift" !== z) && (l = u.clone()), C = { left: "none" !== y ? j(G, H, y, w.x, L, N, I, f, h) : 0, top: "none" !== z ? j(H, G, z, w.y, K, M, J, g, i) : 0, my: l }) : C }, R.polys = { polygon: function (a, b) { var c, d, e, f = { width: 0, height: 0, position: { top: 1e10, right: 0, bottom: 0, left: 1e10 }, adjustable: E }, g = 0, h = [], i = 1, j = 1, k = 0, l = 0; for (g = a.length; g--;)c = [parseInt(a[--g], 10), parseInt(a[g + 1], 10)], c[0] > f.position.right && (f.position.right = c[0]), c[0] < f.position.left && (f.position.left = c[0]), c[1] > f.position.bottom && (f.position.bottom = c[1]), c[1] < f.position.top && (f.position.top = c[1]), h.push(c); if (d = f.width = Math.abs(f.position.right - f.position.left), e = f.height = Math.abs(f.position.bottom - f.position.top), "c" === b.abbrev()) f.position = { left: f.position.left + f.width / 2, top: f.position.top + f.height / 2 }; else { for (; d > 0 && e > 0 && i > 0 && j > 0;)for (d = Math.floor(d / 2), e = Math.floor(e / 2), b.x === L ? i = d : b.x === N ? i = f.width - d : i += Math.floor(d / 2), b.y === K ? j = e : b.y === M ? j = f.height - e : j += Math.floor(e / 2), g = h.length; g-- && !(h.length < 2);)k = h[g][0] - f.position.left, l = h[g][1] - f.position.top, (b.x === L && k >= i || b.x === N && i >= k || b.x === O && (i > k || k > f.width - i) || b.y === K && l >= j || b.y === M && j >= l || b.y === O && (j > l || l > f.height - j)) && h.splice(g, 1); f.position = { left: h[0][0], top: h[0][1] } } return f }, rect: function (a, b, c, d) { return { width: Math.abs(c - a), height: Math.abs(d - b), position: { left: Math.min(a, c), top: Math.min(b, d) } } }, _angles: { tc: 1.5, tr: 7 / 4, tl: 5 / 4, bc: .5, br: .25, bl: .75, rc: 2, lc: 1, c: 0 }, ellipse: function (a, b, c, d, e) { var f = R.polys._angles[e.abbrev()], g = 0 === f ? 0 : c * Math.cos(f * Math.PI), h = d * Math.sin(f * Math.PI); return { width: 2 * c - Math.abs(g), height: 2 * d - Math.abs(h), position: { left: a + g, top: b + h }, adjustable: E } }, circle: function (a, b, c, d) { return R.polys.ellipse(a, b, c, c, d) } }, R.svg = function (a, c, e) { for (var f, g, h, i, j, k, l, m, n, o = (d(b), c[0]), p = d(o.ownerSVGElement), q = o.ownerDocument, r = (parseInt(c.css("stroke-width"), 10) || 0) / 2; !o.getBBox;)o = o.parentNode; if (!o.getBBox || !o.parentNode) return E; switch (o.nodeName) { case "ellipse": case "circle": m = R.polys.ellipse(o.cx.baseVal.value, o.cy.baseVal.value, (o.rx || o.r).baseVal.value + r, (o.ry || o.r).baseVal.value + r, e); break; case "line": case "polygon": case "polyline": for (l = o.points || [{ x: o.x1.baseVal.value, y: o.y1.baseVal.value }, { x: o.x2.baseVal.value, y: o.y2.baseVal.value }], m = [], k = -1, i = l.numberOfItems || l.length; ++k < i;)j = l.getItem ? l.getItem(k) : l[k], m.push.apply(m, [j.x, j.y]); m = R.polys.polygon(m, e); break; default: m = o.getBBox(), m = { width: m.width, height: m.height, position: { left: m.x, top: m.y } } }return n = m.position, p = p[0], p.createSVGPoint && (g = o.getScreenCTM(), l = p.createSVGPoint(), l.x = n.left, l.y = n.top, h = l.matrixTransform(g), n.left = h.x, n.top = h.y), q !== b && "mouse" !== a.position.target && (f = d((q.defaultView || q.parentWindow).frameElement).offset(), f && (n.left += f.left, n.top += f.top)), q = d(q), n.left += q.scrollLeft(), n.top += q.scrollTop(), m }, R.imagemap = function (a, b, c) { b.jquery || (b = d(b)); var e, f, g, h, i, j = (b.attr("shape") || "rect").toLowerCase().replace("poly", "polygon"), k = d('img[usemap="#' + b.parent("map").attr("name") + '"]'), l = d.trim(b.attr("coords")), m = l.replace(/,$/, "").split(","); if (!k.length) return E; if ("polygon" === j) h = R.polys.polygon(m, c); else { if (!R.polys[j]) return E; for (g = -1, i = m.length, f = []; ++g < i;)f.push(parseInt(m[g], 10)); h = R.polys[j].apply(this, f.concat(c)) } return e = k.offset(), e.left += Math.ceil((k.outerWidth(E) - k.width()) / 2), e.top += Math.ceil((k.outerHeight(E) - k.height()) / 2), h.position.left += e.left, h.position.top += e.top, h }; var Ab, Bb = '<iframe class="qtip-bgiframe" frameborder="0" tabindex="-1" src="javascript:\'\';"  style="display:block; position:absolute; z-index:-1; filter:alpha(opacity=0); -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";"></iframe>'; d.extend(x.prototype, { _scroll: function () { var b = this.qtip.elements.overlay; b && (b[0].style.top = d(a).scrollTop() + "px") }, init: function (c) { var e = c.tooltip; d("select, object").length < 1 && (this.bgiframe = c.elements.bgiframe = d(Bb).appendTo(e), c._bind(e, "tooltipmove", this.adjustBGIFrame, this._ns, this)), this.redrawContainer = d("<div/>", { id: S + "-rcontainer" }).appendTo(b.body), c.elements.overlay && c.elements.overlay.addClass("qtipmodal-ie6fix") && (c._bind(a, ["scroll", "resize"], this._scroll, this._ns, this), c._bind(e, ["tooltipshow"], this._scroll, this._ns, this)), this.redraw() }, adjustBGIFrame: function () { var a, b, c = this.qtip.tooltip, d = { height: c.outerHeight(E), width: c.outerWidth(E) }, e = this.qtip.plugins.tip, f = this.qtip.elements.tip; b = parseInt(c.css("borderLeftWidth"), 10) || 0, b = { left: -b, top: -b }, e && f && (a = "x" === e.corner.precedance ? [I, L] : [J, K], b[a[1]] -= f[a[0]]()), this.bgiframe.css(b).css(d) }, redraw: function () { if (this.qtip.rendered < 1 || this.drawing) return this; var a, b, c, d, e = this.qtip.tooltip, f = this.qtip.options.style, g = this.qtip.options.position.container; return this.qtip.drawing = 1, f.height && e.css(J, f.height), f.width ? e.css(I, f.width) : (e.css(I, "").appendTo(this.redrawContainer), b = e.width(), 1 > b % 2 && (b += 1), c = e.css("maxWidth") || "", d = e.css("minWidth") || "", a = (c + d).indexOf("%") > -1 ? g.width() / 100 : 0, c = (c.indexOf("%") > -1 ? a : 1) * parseInt(c, 10) || b, d = (d.indexOf("%") > -1 ? a : 1) * parseInt(d, 10) || 0, b = c + d ? Math.min(Math.max(b, d), c) : b, e.css(I, Math.round(b)).appendTo(g)), this.drawing = 0, this }, destroy: function () { this.bgiframe && this.bgiframe.remove(), this.qtip._unbind([a, this.qtip.tooltip], this._ns) } }), Ab = R.ie6 = function (a) { return 6 === db.ie ? new x(a) : E }, Ab.initialize = "render", B.ie6 = { "^content|style$": function () { this.redraw() } }
    })
}(window, document);
//# sourceMappingURL=jquery.qtip.min.js.map

function getUrlVars(url) {
    var vars = [], hash;
    var hashes = url.slice(url.indexOf('?') + 1).split('&');
    for (var i = 0; i < hashes.length; i++) {
        hash = hashes[i].split('=');
        vars.push(hash[0]);
        vars[hash[0]] = hash[1];
    }
    return vars;
}

/**
 * @license
 * Video.js 5.11.6 <http://videojs.com/>
 * Copyright Brightcove, Inc. <https://www.brightcove.com/>
 * Available under Apache License Version 2.0
 * <https://github.com/videojs/video.js/blob/master/LICENSE>
 *
 * Includes vtt.js <https://github.com/mozilla/vtt.js>
 * Available under Apache License Version 2.0
 * <https://github.com/mozilla/vtt.js/blob/master/LICENSE>
 */
!function (a) { if ("object" == typeof exports && "undefined" != typeof module) module.exports = a(); else if ("function" == typeof define && define.amd) define([], a); else { var b; b = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof self ? self : this, b.videojs = a() } }(function () {
    var a; return function b(a, c, d) { function e(g, h) { if (!c[g]) { if (!a[g]) { var i = "function" == typeof require && require; if (!h && i) return i(g, !0); if (f) return f(g, !0); var j = new Error("Cannot find module '" + g + "'"); throw j.code = "MODULE_NOT_FOUND", j } var k = c[g] = { exports: {} }; a[g][0].call(k.exports, function (b) { var c = a[g][1][b]; return e(c ? c : b) }, k, k.exports, b, a, c, d) } return c[g].exports } for (var f = "function" == typeof require && require, g = 0; g < d.length; g++)e(d[g]); return e }({
        1: [function (a, b) { (function (c) { var d = "undefined" != typeof c ? c : "undefined" != typeof window ? window : {}, e = a("min-document"); if ("undefined" != typeof document) b.exports = document; else { var f = d["__GLOBAL_DOCUMENT_CACHE@4"]; f || (f = d["__GLOBAL_DOCUMENT_CACHE@4"] = e), b.exports = f } }).call(this, "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {}) }, { "min-document": 3 }], 2: [function (a, b) { (function (a) { b.exports = "undefined" != typeof window ? window : "undefined" != typeof a ? a : "undefined" != typeof self ? self : {} }).call(this, "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {}) }, {}], 3: [function () { }, {}], 4: [function (a, b) { var c = a("../internal/getNative"), d = c(Date, "now"), e = d || function () { return (new Date).getTime() }; b.exports = e }, { "../internal/getNative": 20 }], 5: [function (a, b) { function c(a, b, c) { function h() { r && clearTimeout(r), n && clearTimeout(n), t = 0, n = r = s = void 0 } function i(b, c) { c && clearTimeout(c), n = r = s = void 0, b && (t = e(), o = a.apply(q, m), r || n || (m = q = void 0)) } function j() { var a = b - (e() - p); 0 >= a || a > b ? i(s, n) : r = setTimeout(j, a) } function k() { i(v, r) } function l() { if (m = arguments, p = e(), q = this, s = v && (r || !w), u === !1) var c = w && !r; else { n || w || (t = p); var d = u - (p - t), f = 0 >= d || d > u; f ? (n && (n = clearTimeout(n)), t = p, o = a.apply(q, m)) : n || (n = setTimeout(k, d)) } return f && r ? r = clearTimeout(r) : r || b === u || (r = setTimeout(j, b)), c && (f = !0, o = a.apply(q, m)), !f || r || n || (m = q = void 0), o } var m, n, o, p, q, r, s, t = 0, u = !1, v = !0; if ("function" != typeof a) throw new TypeError(f); if (b = 0 > b ? 0 : +b || 0, c === !0) { var w = !0; v = !1 } else d(c) && (w = !!c.leading, u = "maxWait" in c && g(+c.maxWait || 0, b), v = "trailing" in c ? !!c.trailing : v); return l.cancel = h, l } var d = a("../lang/isObject"), e = a("../date/now"), f = "Expected a function", g = Math.max; b.exports = c }, { "../date/now": 4, "../lang/isObject": 33 }], 6: [function (a, b) { function c(a, b) { if ("function" != typeof a) throw new TypeError(d); return b = e(void 0 === b ? a.length - 1 : +b || 0, 0), function () { for (var c = arguments, d = -1, f = e(c.length - b, 0), g = Array(f); ++d < f;)g[d] = c[b + d]; switch (b) { case 0: return a.call(this, g); case 1: return a.call(this, c[0], g); case 2: return a.call(this, c[0], c[1], g) }var h = Array(b + 1); for (d = -1; ++d < b;)h[d] = c[d]; return h[b] = g, a.apply(this, h) } } var d = "Expected a function", e = Math.max; b.exports = c }, {}], 7: [function (a, b) { function c(a, b, c) { var g = !0, h = !0; if ("function" != typeof a) throw new TypeError(f); return c === !1 ? g = !1 : e(c) && (g = "leading" in c ? !!c.leading : g, h = "trailing" in c ? !!c.trailing : h), d(a, b, { leading: g, maxWait: +b, trailing: h }) } var d = a("./debounce"), e = a("../lang/isObject"), f = "Expected a function"; b.exports = c }, { "../lang/isObject": 33, "./debounce": 5 }], 8: [function (a, b) { function c(a, b) { var c = -1, d = a.length; for (b || (b = Array(d)); ++c < d;)b[c] = a[c]; return b } b.exports = c }, {}], 9: [function (a, b) { function c(a, b) { for (var c = -1, d = a.length; ++c < d && b(a[c], c, a) !== !1;); return a } b.exports = c }, {}], 10: [function (a, b) { function c(a, b, c) { c || (c = {}); for (var d = -1, e = b.length; ++d < e;) { var f = b[d]; c[f] = a[f] } return c } b.exports = c }, {}], 11: [function (a, b) { var c = a("./createBaseFor"), d = c(); b.exports = d }, { "./createBaseFor": 18 }], 12: [function (a, b) { function c(a, b) { return d(a, b, e) } var d = a("./baseFor"), e = a("../object/keysIn"); b.exports = c }, { "../object/keysIn": 39, "./baseFor": 11 }], 13: [function (a, b) { function c(a, b, l, m, n) { if (!h(a)) return a; var o = g(b) && (f(b) || j(b)), p = o ? void 0 : k(b); return d(p || b, function (d, f) { if (p && (f = d, d = b[f]), i(d)) m || (m = []), n || (n = []), e(a, b, f, c, l, m, n); else { var g = a[f], h = l ? l(g, d, f, a, b) : void 0, j = void 0 === h; j && (h = d), void 0 === h && (!o || f in a) || !j && (h === h ? h === g : g !== g) || (a[f] = h) } }), a } var d = a("./arrayEach"), e = a("./baseMergeDeep"), f = a("../lang/isArray"), g = a("./isArrayLike"), h = a("../lang/isObject"), i = a("./isObjectLike"), j = a("../lang/isTypedArray"), k = a("../object/keys"); b.exports = c }, { "../lang/isArray": 30, "../lang/isObject": 33, "../lang/isTypedArray": 36, "../object/keys": 38, "./arrayEach": 9, "./baseMergeDeep": 14, "./isArrayLike": 21, "./isObjectLike": 26 }], 14: [function (a, b) { function c(a, b, c, k, l, m, n) { for (var o = m.length, p = b[c]; o--;)if (m[o] == p) return void (a[c] = n[o]); var q = a[c], r = l ? l(q, p, c, a, b) : void 0, s = void 0 === r; s && (r = p, g(p) && (f(p) || i(p)) ? r = f(q) ? q : g(q) ? d(q) : [] : h(p) || e(p) ? r = e(q) ? j(q) : h(q) ? q : {} : s = !1), m.push(p), n.push(r), s ? a[c] = k(r, p, l, m, n) : (r === r ? r !== q : q === q) && (a[c] = r) } var d = a("./arrayCopy"), e = a("../lang/isArguments"), f = a("../lang/isArray"), g = a("./isArrayLike"), h = a("../lang/isPlainObject"), i = a("../lang/isTypedArray"), j = a("../lang/toPlainObject"); b.exports = c }, { "../lang/isArguments": 29, "../lang/isArray": 30, "../lang/isPlainObject": 34, "../lang/isTypedArray": 36, "../lang/toPlainObject": 37, "./arrayCopy": 8, "./isArrayLike": 21 }], 15: [function (a, b) { function c(a) { return function (b) { return null == b ? void 0 : d(b)[a] } } var d = a("./toObject"); b.exports = c }, { "./toObject": 28 }], 16: [function (a, b) { function c(a, b, c) { if ("function" != typeof a) return d; if (void 0 === b) return a; switch (c) { case 1: return function (c) { return a.call(b, c) }; case 3: return function (c, d, e) { return a.call(b, c, d, e) }; case 4: return function (c, d, e, f) { return a.call(b, c, d, e, f) }; case 5: return function (c, d, e, f, g) { return a.call(b, c, d, e, f, g) } }return function () { return a.apply(b, arguments) } } var d = a("../utility/identity"); b.exports = c }, { "../utility/identity": 42 }], 17: [function (a, b) { function c(a) { return f(function (b, c) { var f = -1, g = null == b ? 0 : c.length, h = g > 2 ? c[g - 2] : void 0, i = g > 2 ? c[2] : void 0, j = g > 1 ? c[g - 1] : void 0; for ("function" == typeof h ? (h = d(h, j, 5), g -= 2) : (h = "function" == typeof j ? j : void 0, g -= h ? 1 : 0), i && e(c[0], c[1], i) && (h = 3 > g ? void 0 : h, g = 1); ++f < g;) { var k = c[f]; k && a(b, k, h) } return b }) } var d = a("./bindCallback"), e = a("./isIterateeCall"), f = a("../function/restParam"); b.exports = c }, { "../function/restParam": 6, "./bindCallback": 16, "./isIterateeCall": 24 }], 18: [function (a, b) { function c(a) { return function (b, c, e) { for (var f = d(b), g = e(b), h = g.length, i = a ? h : -1; a ? i-- : ++i < h;) { var j = g[i]; if (c(f[j], j, f) === !1) break } return b } } var d = a("./toObject"); b.exports = c }, { "./toObject": 28 }], 19: [function (a, b) { var c = a("./baseProperty"), d = c("length"); b.exports = d }, { "./baseProperty": 15 }], 20: [function (a, b) { function c(a, b) { var c = null == a ? void 0 : a[b]; return d(c) ? c : void 0 } var d = a("../lang/isNative"); b.exports = c }, { "../lang/isNative": 32 }], 21: [function (a, b) { function c(a) { return null != a && e(d(a)) } var d = a("./getLength"), e = a("./isLength"); b.exports = c }, { "./getLength": 19, "./isLength": 25 }], 22: [function (a, b) { var c = function () { try { Object({ toString: 0 } + "") } catch (a) { return function () { return !1 } } return function (a) { return "function" != typeof a.toString && "string" == typeof (a + "") } }(); b.exports = c }, {}], 23: [function (a, b) { function c(a, b) { return a = "number" == typeof a || d.test(a) ? +a : -1, b = null == b ? e : b, a > -1 && a % 1 == 0 && b > a } var d = /^\d+$/, e = 9007199254740991; b.exports = c }, {}], 24: [function (a, b) { function c(a, b, c) { if (!f(c)) return !1; var g = typeof b; if ("number" == g ? d(c) && e(b, c.length) : "string" == g && b in c) { var h = c[b]; return a === a ? a === h : h !== h } return !1 } var d = a("./isArrayLike"), e = a("./isIndex"), f = a("../lang/isObject"); b.exports = c }, { "../lang/isObject": 33, "./isArrayLike": 21, "./isIndex": 23 }], 25: [function (a, b) { function c(a) { return "number" == typeof a && a > -1 && a % 1 == 0 && d >= a } var d = 9007199254740991; b.exports = c }, {}], 26: [function (a, b) { function c(a) { return !!a && "object" == typeof a } b.exports = c }, {}], 27: [function (a, b) { function c(a) { for (var b = i(a), c = b.length, j = c && a.length, l = !!j && g(j) && (e(a) || d(a) || h(a)), m = -1, n = []; ++m < c;) { var o = b[m]; (l && f(o, j) || k.call(a, o)) && n.push(o) } return n } var d = a("../lang/isArguments"), e = a("../lang/isArray"), f = a("./isIndex"), g = a("./isLength"), h = a("../lang/isString"), i = a("../object/keysIn"), j = Object.prototype, k = j.hasOwnProperty; b.exports = c }, { "../lang/isArguments": 29, "../lang/isArray": 30, "../lang/isString": 35, "../object/keysIn": 39, "./isIndex": 23, "./isLength": 25 }], 28: [function (a, b) { function c(a) { if (f.unindexedChars && e(a)) { for (var b = -1, c = a.length, g = Object(a); ++b < c;)g[b] = a.charAt(b); return g } return d(a) ? a : Object(a) } var d = a("../lang/isObject"), e = a("../lang/isString"), f = a("../support"); b.exports = c }, { "../lang/isObject": 33, "../lang/isString": 35, "../support": 41 }], 29: [function (a, b) { function c(a) { return e(a) && d(a) && g.call(a, "callee") && !h.call(a, "callee") } var d = a("../internal/isArrayLike"), e = a("../internal/isObjectLike"), f = Object.prototype, g = f.hasOwnProperty, h = f.propertyIsEnumerable; b.exports = c }, { "../internal/isArrayLike": 21, "../internal/isObjectLike": 26 }], 30: [function (a, b) { var c = a("../internal/getNative"), d = a("../internal/isLength"), e = a("../internal/isObjectLike"), f = "[object Array]", g = Object.prototype, h = g.toString, i = c(Array, "isArray"), j = i || function (a) { return e(a) && d(a.length) && h.call(a) == f }; b.exports = j }, { "../internal/getNative": 20, "../internal/isLength": 25, "../internal/isObjectLike": 26 }], 31: [function (a, b) { function c(a) { return d(a) && g.call(a) == e } var d = a("./isObject"), e = "[object Function]", f = Object.prototype, g = f.toString; b.exports = c }, { "./isObject": 33 }], 32: [function (a, b) { function c(a) { return null == a ? !1 : d(a) ? k.test(i.call(a)) : f(a) && (e(a) ? k : g).test(a) } var d = a("./isFunction"), e = a("../internal/isHostObject"), f = a("../internal/isObjectLike"), g = /^\[object .+?Constructor\]$/, h = Object.prototype, i = Function.prototype.toString, j = h.hasOwnProperty, k = RegExp("^" + i.call(j).replace(/[\\^$.*+?()[\]{}|]/g, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"); b.exports = c }, { "../internal/isHostObject": 22, "../internal/isObjectLike": 26, "./isFunction": 31 }], 33: [function (a, b) { function c(a) { var b = typeof a; return !!a && ("object" == b || "function" == b) } b.exports = c }, {}], 34: [function (a, b) { function c(a) { var b; if (!g(a) || l.call(a) != i || f(a) || e(a) || !k.call(a, "constructor") && (b = a.constructor, "function" == typeof b && !(b instanceof b))) return !1; var c; return h.ownLast ? (d(a, function (a, b, d) { return c = k.call(d, b), !1 }), c !== !1) : (d(a, function (a, b) { c = b }), void 0 === c || k.call(a, c)) } var d = a("../internal/baseForIn"), e = a("./isArguments"), f = a("../internal/isHostObject"), g = a("../internal/isObjectLike"), h = a("../support"), i = "[object Object]", j = Object.prototype, k = j.hasOwnProperty, l = j.toString; b.exports = c }, { "../internal/baseForIn": 12, "../internal/isHostObject": 22, "../internal/isObjectLike": 26, "../support": 41, "./isArguments": 29 }], 35: [function (a, b) { function c(a) { return "string" == typeof a || d(a) && g.call(a) == e } var d = a("../internal/isObjectLike"), e = "[object String]", f = Object.prototype, g = f.toString; b.exports = c }, { "../internal/isObjectLike": 26 }], 36: [function (a, b) { function c(a) { return e(a) && d(a.length) && !!C[E.call(a)] } var d = a("../internal/isLength"), e = a("../internal/isObjectLike"), f = "[object Arguments]", g = "[object Array]", h = "[object Boolean]", i = "[object Date]", j = "[object Error]", k = "[object Function]", l = "[object Map]", m = "[object Number]", n = "[object Object]", o = "[object RegExp]", p = "[object Set]", q = "[object String]", r = "[object WeakMap]", s = "[object ArrayBuffer]", t = "[object Float32Array]", u = "[object Float64Array]", v = "[object Int8Array]", w = "[object Int16Array]", x = "[object Int32Array]", y = "[object Uint8Array]", z = "[object Uint8ClampedArray]", A = "[object Uint16Array]", B = "[object Uint32Array]", C = {}; C[t] = C[u] = C[v] = C[w] = C[x] = C[y] = C[z] = C[A] = C[B] = !0, C[f] = C[g] = C[s] = C[h] = C[i] = C[j] = C[k] = C[l] = C[m] = C[n] = C[o] = C[p] = C[q] = C[r] = !1; var D = Object.prototype, E = D.toString; b.exports = c }, { "../internal/isLength": 25, "../internal/isObjectLike": 26 }], 37: [function (a, b) { function c(a) { return d(a, e(a)) } var d = a("../internal/baseCopy"), e = a("../object/keysIn"); b.exports = c }, { "../internal/baseCopy": 10, "../object/keysIn": 39 }], 38: [function (a, b) { var c = a("../internal/getNative"), d = a("../internal/isArrayLike"), e = a("../lang/isObject"), f = a("../internal/shimKeys"), g = a("../support"), h = c(Object, "keys"), i = h ? function (a) { var b = null == a ? void 0 : a.constructor; return "function" == typeof b && b.prototype === a || ("function" == typeof a ? g.enumPrototypes : d(a)) ? f(a) : e(a) ? h(a) : [] } : f; b.exports = i }, { "../internal/getNative": 20, "../internal/isArrayLike": 21, "../internal/shimKeys": 27, "../lang/isObject": 33, "../support": 41 }], 39: [function (a, b) { function c(a) { if (null == a) return []; j(a) || (a = Object(a)); var b = a.length; b = b && i(b) && (f(a) || e(a) || k(a)) && b || 0; for (var c = a.constructor, d = -1, m = g(c) && c.prototype || x, n = m === a, o = Array(b), q = b > 0, r = l.enumErrorProps && (a === w || a instanceof Error), t = l.enumPrototypes && g(a); ++d < b;)o[d] = d + ""; for (var C in a) t && "prototype" == C || r && ("message" == C || "name" == C) || q && h(C, b) || "constructor" == C && (n || !z.call(a, C)) || o.push(C); if (l.nonEnumShadows && a !== x) { var D = a === y ? u : a === w ? p : A.call(a), E = B[D] || B[s]; for (D == s && (m = x), b = v.length; b--;) { C = v[b]; var F = E[C]; n && F || (F ? !z.call(a, C) : a[C] === m[C]) || o.push(C) } } return o } var d = a("../internal/arrayEach"), e = a("../lang/isArguments"), f = a("../lang/isArray"), g = a("../lang/isFunction"), h = a("../internal/isIndex"), i = a("../internal/isLength"), j = a("../lang/isObject"), k = a("../lang/isString"), l = a("../support"), m = "[object Array]", n = "[object Boolean]", o = "[object Date]", p = "[object Error]", q = "[object Function]", r = "[object Number]", s = "[object Object]", t = "[object RegExp]", u = "[object String]", v = ["constructor", "hasOwnProperty", "isPrototypeOf", "propertyIsEnumerable", "toLocaleString", "toString", "valueOf"], w = Error.prototype, x = Object.prototype, y = String.prototype, z = x.hasOwnProperty, A = x.toString, B = {}; B[m] = B[o] = B[r] = { constructor: !0, toLocaleString: !0, toString: !0, valueOf: !0 }, B[n] = B[u] = { constructor: !0, toString: !0, valueOf: !0 }, B[p] = B[q] = B[t] = { constructor: !0, toString: !0 }, B[s] = { constructor: !0 }, d(v, function (a) { for (var b in B) if (z.call(B, b)) { var c = B[b]; c[a] = z.call(c, a) } }), b.exports = c }, { "../internal/arrayEach": 9, "../internal/isIndex": 23, "../internal/isLength": 25, "../lang/isArguments": 29, "../lang/isArray": 30, "../lang/isFunction": 31, "../lang/isObject": 33, "../lang/isString": 35, "../support": 41 }], 40: [function (a, b) { var c = a("../internal/baseMerge"), d = a("../internal/createAssigner"), e = d(c); b.exports = e }, { "../internal/baseMerge": 13, "../internal/createAssigner": 17 }], 41: [function (a, b) { var c = Array.prototype, d = Error.prototype, e = Object.prototype, f = e.propertyIsEnumerable, g = c.splice, h = {}; !function (a) { var b = function () { this.x = a }, c = { 0: a, length: a }, e = []; b.prototype = { valueOf: a, y: a }; for (var i in new b) e.push(i); h.enumErrorProps = f.call(d, "message") || f.call(d, "name"), h.enumPrototypes = f.call(b, "prototype"), h.nonEnumShadows = !/valueOf/.test(e), h.ownLast = "x" != e[0], h.spliceObjects = (g.call(c, 0, 1), !c[0]), h.unindexedChars = "x"[0] + Object("x")[0] != "xx" }(1, 0), b.exports = h }, {}], 42: [function (a, b) { function c(a) { return a } b.exports = c }, {}], 43: [function (a, b) { "use strict"; var c = a("object-keys"); b.exports = function () { if ("function" != typeof Symbol || "function" != typeof Object.getOwnPropertySymbols) return !1; if ("symbol" == typeof Symbol.iterator) return !0; var a = {}, b = Symbol("test"); if ("string" == typeof b) return !1; var d = 42; a[b] = d; for (b in a) return !1; if (0 !== c(a).length) return !1; if ("function" == typeof Object.keys && 0 !== Object.keys(a).length) return !1; if ("function" == typeof Object.getOwnPropertyNames && 0 !== Object.getOwnPropertyNames(a).length) return !1; var e = Object.getOwnPropertySymbols(a); if (1 !== e.length || e[0] !== b) return !1; if (!Object.prototype.propertyIsEnumerable.call(a, b)) return !1; if ("function" == typeof Object.getOwnPropertyDescriptor) { var f = Object.getOwnPropertyDescriptor(a, b); if (f.value !== d || f.enumerable !== !0) return !1 } return !0 } }, { "object-keys": 50 }], 44: [function (a, b) { "use strict"; var c = a("object-keys"), d = a("function-bind"), e = function (a) { return "undefined" != typeof a && null !== a }, f = a("./hasSymbols")(), g = Object, h = d.call(Function.call, Array.prototype.push), i = d.call(Function.call, Object.prototype.propertyIsEnumerable); b.exports = function (a) { if (!e(a)) throw new TypeError("target must be an object"); var b, d, j, k, l, m, n, o = g(a); for (b = 1; b < arguments.length; ++b) { if (d = g(arguments[b]), k = c(d), f && Object.getOwnPropertySymbols) for (l = Object.getOwnPropertySymbols(d), j = 0; j < l.length; ++j)n = l[j], i(d, n) && h(k, n); for (j = 0; j < k.length; ++j)n = k[j], m = d[n], i(d, n) && (o[n] = m) } return o } }, { "./hasSymbols": 43, "function-bind": 49, "object-keys": 50 }], 45: [function (a, b) { "use strict"; var c = a("define-properties"), d = a("./implementation"), e = a("./polyfill"), f = a("./shim"); c(d, { implementation: d, getPolyfill: e, shim: f }), b.exports = d }, { "./implementation": 44, "./polyfill": 52, "./shim": 53, "define-properties": 46 }], 46: [function (a, b) { "use strict"; var c = a("object-keys"), d = a("foreach"), e = "function" == typeof Symbol && "symbol" == typeof Symbol(), f = Object.prototype.toString, g = function (a) { return "function" == typeof a && "[object Function]" === f.call(a) }, h = function () { var a = {}; try { Object.defineProperty(a, "x", { enumerable: !1, value: a }); for (var b in a) return !1; return a.x === a } catch (c) { return !1 } }, i = Object.defineProperty && h(), j = function (a, b, c, d) { (!(b in a) || g(d) && d()) && (i ? Object.defineProperty(a, b, { configurable: !0, enumerable: !1, value: c, writable: !0 }) : a[b] = c) }, k = function (a, b) { var f = arguments.length > 2 ? arguments[2] : {}, g = c(b); e && (g = g.concat(Object.getOwnPropertySymbols(b))), d(g, function (c) { j(a, c, b[c], f[c]) }) }; k.supportsDescriptors = !!i, b.exports = k }, { foreach: 47, "object-keys": 50 }], 47: [function (a, b) { var c = Object.prototype.hasOwnProperty, d = Object.prototype.toString; b.exports = function (a, b, e) { if ("[object Function]" !== d.call(b)) throw new TypeError("iterator must be a function"); var f = a.length; if (f === +f) for (var g = 0; f > g; g++)b.call(e, a[g], g, a); else for (var h in a) c.call(a, h) && b.call(e, a[h], h, a) } }, {}], 48: [function (a, b) { var c = "Function.prototype.bind called on incompatible ", d = Array.prototype.slice, e = Object.prototype.toString, f = "[object Function]"; b.exports = function (a) { var b = this; if ("function" != typeof b || e.call(b) !== f) throw new TypeError(c + b); for (var g, h = d.call(arguments, 1), i = function () { if (this instanceof g) { var c = b.apply(this, h.concat(d.call(arguments))); return Object(c) === c ? c : this } return b.apply(a, h.concat(d.call(arguments))) }, j = Math.max(0, b.length - h.length), k = [], l = 0; j > l; l++)k.push("$" + l); if (g = Function("binder", "return function (" + k.join(",") + "){ return binder.apply(this,arguments); }")(i), b.prototype) { var m = function () { }; m.prototype = b.prototype, g.prototype = new m, m.prototype = null } return g } }, {}], 49: [function (a, b) { var c = a("./implementation"); b.exports = Function.prototype.bind || c }, { "./implementation": 48 }], 50: [function (a, b) { "use strict"; var c = Object.prototype.hasOwnProperty, d = Object.prototype.toString, e = Array.prototype.slice, f = a("./isArguments"), g = Object.prototype.propertyIsEnumerable, h = !g.call({ toString: null }, "toString"), i = g.call(function () { }, "prototype"), j = ["toString", "toLocaleString", "valueOf", "hasOwnProperty", "isPrototypeOf", "propertyIsEnumerable", "constructor"], k = function (a) { var b = a.constructor; return b && b.prototype === a }, l = { $console: !0, $external: !0, $frame: !0, $frameElement: !0, $frames: !0, $innerHeight: !0, $innerWidth: !0, $outerHeight: !0, $outerWidth: !0, $pageXOffset: !0, $pageYOffset: !0, $parent: !0, $scrollLeft: !0, $scrollTop: !0, $scrollX: !0, $scrollY: !0, $self: !0, $webkitIndexedDB: !0, $webkitStorageInfo: !0, $window: !0 }, m = function () { if ("undefined" == typeof window) return !1; for (var a in window) try { if (!l["$" + a] && c.call(window, a) && null !== window[a] && "object" == typeof window[a]) try { k(window[a]) } catch (b) { return !0 } } catch (b) { return !0 } return !1 }(), n = function (a) { if ("undefined" == typeof window || !m) return k(a); try { return k(a) } catch (b) { return !1 } }, o = function (a) { var b = null !== a && "object" == typeof a, e = "[object Function]" === d.call(a), g = f(a), k = b && "[object String]" === d.call(a), l = []; if (!b && !e && !g) throw new TypeError("Object.keys called on a non-object"); var m = i && e; if (k && a.length > 0 && !c.call(a, 0)) for (var o = 0; o < a.length; ++o)l.push(String(o)); if (g && a.length > 0) for (var p = 0; p < a.length; ++p)l.push(String(p)); else for (var q in a) m && "prototype" === q || !c.call(a, q) || l.push(String(q)); if (h) for (var r = n(a), s = 0; s < j.length; ++s)r && "constructor" === j[s] || !c.call(a, j[s]) || l.push(j[s]); return l }; o.shim = function () { if (Object.keys) { var a = function () { return 2 === (Object.keys(arguments) || "").length }(1, 2); if (!a) { var b = Object.keys; Object.keys = function (a) { return b(f(a) ? e.call(a) : a) } } } else Object.keys = o; return Object.keys || o }, b.exports = o }, { "./isArguments": 51 }], 51: [function (a, b) { "use strict"; var c = Object.prototype.toString; b.exports = function (a) { var b = c.call(a), d = "[object Arguments]" === b; return d || (d = "[object Array]" !== b && null !== a && "object" == typeof a && "number" == typeof a.length && a.length >= 0 && "[object Function]" === c.call(a.callee)), d } }, {}], 52: [function (a, b) { "use strict"; var c = a("./implementation"), d = function () { if (!Object.assign) return !1; for (var a = "abcdefghijklmnopqrst", b = a.split(""), c = {}, d = 0; d < b.length; ++d)c[b[d]] = b[d]; var e = Object.assign({}, c), f = ""; for (var g in e) f += g; return a !== f }, e = function () { if (!Object.assign || !Object.preventExtensions) return !1; var a = Object.preventExtensions({ 1: 2 }); try { Object.assign(a, "xy") } catch (b) { return "y" === a[1] } }; b.exports = function () { return Object.assign ? d() ? c : e() ? c : Object.assign : c } }, { "./implementation": 44 }], 53: [function (a, b) { "use strict"; var c = a("define-properties"), d = a("./polyfill"); b.exports = function () { var a = d(); return c(Object, { assign: a }, { assign: function () { return Object.assign !== a } }), a } }, { "./polyfill": 52, "define-properties": 46 }], 54: [function (a, b) { function c(a, b) { var c, d = null; try { c = JSON.parse(a, b) } catch (e) { d = e } return [d, c] } b.exports = c }, {}], 55: [function (a, b) { function c(a) { return a.replace(/\n\r?\s*/g, "") } b.exports = function (a) { for (var b = "", d = 0; d < arguments.length; d++)b += c(a[d]) + (arguments[d + 1] || ""); return b } }, {}], 56: [function (a, b) { "use strict"; function c(a, b) { for (var c = 0; c < a.length; c++)b(a[c]) } function d(a) { for (var b in a) if (a.hasOwnProperty(b)) return !1; return !0 } function e(a, b, c) { var d = a; return k(b) ? (c = b, "string" == typeof a && (d = { uri: a })) : d = m(b, { uri: a }), d.callback = c, d } function f(a, b, c) { return b = e(a, b, c), g(b) } function g(a) { function b() { 4 === k.readyState && g() } function c() { var a = void 0; if (k.response ? a = k.response : "text" !== k.responseType && k.responseType || (a = k.responseText || k.responseXML), u) try { a = JSON.parse(a) } catch (b) { } return a } function e(a) { clearTimeout(o), a instanceof Error || (a = new Error("" + (a || "Unknown XMLHttpRequest Error"))), a.statusCode = 0, h(a, i) } function g() { if (!n) { var b; clearTimeout(o), b = a.useXDR && void 0 === k.status ? 200 : 1223 === k.status ? 204 : k.status; var d = i, e = null; 0 !== b ? (d = { body: c(), statusCode: b, method: q, headers: {}, url: p, rawRequest: k }, k.getAllResponseHeaders && (d.headers = l(k.getAllResponseHeaders()))) : e = new Error("Internal XMLHttpRequest Error"), h(e, d, d.body) } } var h = a.callback; if ("undefined" == typeof h) throw new Error("callback argument missing"); h = j(h); var i = { body: void 0, headers: {}, statusCode: 0, method: q, url: p, rawRequest: k }, k = a.xhr || null; k || (k = a.cors || a.useXDR ? new f.XDomainRequest : new f.XMLHttpRequest); var m, n, o, p = k.url = a.uri || a.url, q = k.method = a.method || "GET", r = a.body || a.data || null, s = k.headers = a.headers || {}, t = !!a.sync, u = !1; if ("json" in a && (u = !0, s.accept || s.Accept || (s.Accept = "application/json"), "GET" !== q && "HEAD" !== q && (s["content-type"] || s["Content-Type"] || (s["Content-Type"] = "application/json"), r = JSON.stringify(a.json))), k.onreadystatechange = b, k.onload = g, k.onerror = e, k.onprogress = function () { }, k.ontimeout = e, k.open(q, p, !t, a.username, a.password), t || (k.withCredentials = !!a.withCredentials), !t && a.timeout > 0 && (o = setTimeout(function () { n = !0, k.abort("timeout"); var a = new Error("XMLHttpRequest timeout"); a.code = "ETIMEDOUT", e(a) }, a.timeout)), k.setRequestHeader) for (m in s) s.hasOwnProperty(m) && k.setRequestHeader(m, s[m]); else if (a.headers && !d(a.headers)) throw new Error("Headers cannot be set on an XDomainRequest object"); return "responseType" in a && (k.responseType = a.responseType), "beforeSend" in a && "function" == typeof a.beforeSend && a.beforeSend(k), k.send(r), k } function h() { } var i = a("global/window"), j = a("once"), k = a("is-function"), l = a("parse-headers"), m = a("xtend"); b.exports = f, f.XMLHttpRequest = i.XMLHttpRequest || h, f.XDomainRequest = "withCredentials" in new f.XMLHttpRequest ? f.XMLHttpRequest : i.XDomainRequest, c(["get", "put", "post", "patch", "head", "delete"], function (a) { f["delete" === a ? "del" : a] = function (b, c, d) { return c = e(b, c, d), c.method = a.toUpperCase(), g(c) } }) }, { "global/window": 2, "is-function": 57, once: 58, "parse-headers": 61, xtend: 62 }], 57: [function (a, b) { function c(a) { var b = d.call(a); return "[object Function]" === b || "function" == typeof a && "[object RegExp]" !== b || "undefined" != typeof window && (a === window.setTimeout || a === window.alert || a === window.confirm || a === window.prompt) } b.exports = c; var d = Object.prototype.toString }, {}], 58: [function (a, b) { function c(a) { var b = !1; return function () { return b ? void 0 : (b = !0, a.apply(this, arguments)) } } b.exports = c, c.proto = c(function () { Object.defineProperty(Function.prototype, "once", { value: function () { return c(this) }, configurable: !0 }) }) }, {}], 59: [function (a, b) { function c(a, b, c) { if (!g(b)) throw new TypeError("iterator must be a function"); arguments.length < 3 && (c = this), "[object Array]" === h.call(a) ? d(a, b, c) : "string" == typeof a ? e(a, b, c) : f(a, b, c) } function d(a, b, c) { for (var d = 0, e = a.length; e > d; d++)i.call(a, d) && b.call(c, a[d], d, a) } function e(a, b, c) { for (var d = 0, e = a.length; e > d; d++)b.call(c, a.charAt(d), d, a) } function f(a, b, c) { for (var d in a) i.call(a, d) && b.call(c, a[d], d, a) } var g = a("is-function"); b.exports = c; var h = Object.prototype.toString, i = Object.prototype.hasOwnProperty }, { "is-function": 57 }], 60: [function (a, b, c) { function d(a) { return a.replace(/^\s*|\s*$/g, "") } c = b.exports = d, c.left = function (a) { return a.replace(/^\s*/, "") }, c.right = function (a) { return a.replace(/\s*$/, "") } }, {}], 61: [function (a, b) { var c = a("trim"), d = a("for-each"), e = function (a) { return "[object Array]" === Object.prototype.toString.call(a) }; b.exports = function (a) { if (!a) return {}; var b = {}; return d(c(a).split("\n"), function (a) { var d = a.indexOf(":"), f = c(a.slice(0, d)).toLowerCase(), g = c(a.slice(d + 1)); "undefined" == typeof b[f] ? b[f] = g : e(b[f]) ? b[f].push(g) : b[f] = [b[f], g] }), b } }, { "for-each": 59, trim: 60 }], 62: [function (a, b) { function c() { for (var a = {}, b = 0; b < arguments.length; b++) { var c = arguments[b]; for (var e in c) d.call(c, e) && (a[e] = c[e]) } return a } b.exports = c; var d = Object.prototype.hasOwnProperty }, {}], 63: [function (a, b, c) { "use strict"; function d(a) { return a && a.__esModule ? a : { "default": a } } function e(a, b) { if (!(a instanceof b)) throw new TypeError("Cannot call a class as a function") } function f(a, b) { if ("function" != typeof b && null !== b) throw new TypeError("Super expression must either be null or a function, not " + typeof b); a.prototype = Object.create(b && b.prototype, { constructor: { value: a, enumerable: !1, writable: !0, configurable: !0 } }), b && (Object.setPrototypeOf ? Object.setPrototypeOf(a, b) : a.__proto__ = b) } c.__esModule = !0; var g = a("./button.js"), h = d(g), i = a("./component.js"), j = d(i), k = function (a) { function b(c, d) { e(this, b), a.call(this, c, d) } return f(b, a), b.prototype.buildCSSClass = function () { return "vjs-big-play-button" }, b.prototype.handleClick = function () { this.player_.play() }, b }(h["default"]); k.prototype.controlText_ = "Play Video", j["default"].registerComponent("BigPlayButton", k), c["default"] = k, b.exports = c["default"] }, { "./button.js": 64, "./component.js": 67 }], 64: [function (a, b, c) { "use strict"; function d(a) { if (a && a.__esModule) return a; var b = {}; if (null != a) for (var c in a) Object.prototype.hasOwnProperty.call(a, c) && (b[c] = a[c]); return b["default"] = a, b } function e(a) { return a && a.__esModule ? a : { "default": a } } function f(a, b) { if (!(a instanceof b)) throw new TypeError("Cannot call a class as a function") } function g(a, b) { if ("function" != typeof b && null !== b) throw new TypeError("Super expression must either be null or a function, not " + typeof b); a.prototype = Object.create(b && b.prototype, { constructor: { value: a, enumerable: !1, writable: !0, configurable: !0 } }), b && (Object.setPrototypeOf ? Object.setPrototypeOf(a, b) : a.__proto__ = b) } c.__esModule = !0; var h = a("./clickable-component.js"), i = e(h), j = a("./component"), k = e(j), l = a("./utils/events.js"), m = (d(l), a("./utils/fn.js")), n = (d(m), a("./utils/log.js")), o = e(n), p = a("global/document"), q = (e(p), a("object.assign")), r = e(q), s = function (a) { function b(c, d) { f(this, b), a.call(this, c, d) } return g(b, a), b.prototype.createEl = function () { var a = arguments.length <= 0 || void 0 === arguments[0] ? "button" : arguments[0], b = arguments.length <= 1 || void 0 === arguments[1] ? {} : arguments[1], c = arguments.length <= 2 || void 0 === arguments[2] ? {} : arguments[2]; b = r["default"]({ className: this.buildCSSClass() }, b), "button" !== a && (o["default"].warn("Creating a Button with an HTML element of " + a + " is deprecated; use ClickableComponent instead."), b = r["default"]({ tabIndex: 0 }, b), c = r["default"]({ role: "button" }, c)), c = r["default"]({ type: "button", "aria-live": "polite" }, c); var d = k["default"].prototype.createEl.call(this, a, b, c); return this.createControlTextEl(d), d }, b.prototype.addChild = function (a) { var b = arguments.length <= 1 || void 0 === arguments[1] ? {} : arguments[1], c = this.constructor.name; return o["default"].warn("Adding an actionable (user controllable) child to a Button (" + c + ") is not supported; use a ClickableComponent instead."), k["default"].prototype.addChild.call(this, a, b) }, b.prototype.handleKeyPress = function (b) { 32 === b.which || 13 === b.which || a.prototype.handleKeyPress.call(this, b) }, b }(i["default"]); k["default"].registerComponent("Button", s), c["default"] = s, b.exports = c["default"] }, { "./clickable-component.js": 65, "./component": 67, "./utils/events.js": 143, "./utils/fn.js": 144, "./utils/log.js": 147, "global/document": 1, "object.assign": 45 }], 65: [function (a, b, c) {
            "use strict"; function d(a) { if (a && a.__esModule) return a; var b = {}; if (null != a) for (var c in a) Object.prototype.hasOwnProperty.call(a, c) && (b[c] = a[c]); return b["default"] = a, b } function e(a) { return a && a.__esModule ? a : { "default": a } } function f(a, b) { if (!(a instanceof b)) throw new TypeError("Cannot call a class as a function") } function g(a, b) { if ("function" != typeof b && null !== b) throw new TypeError("Super expression must either be null or a function, not " + typeof b); a.prototype = Object.create(b && b.prototype, { constructor: { value: a, enumerable: !1, writable: !0, configurable: !0 } }), b && (Object.setPrototypeOf ? Object.setPrototypeOf(a, b) : a.__proto__ = b) } c.__esModule = !0; var h = a("./component"), i = e(h), j = a("./utils/dom.js"), k = d(j), l = a("./utils/events.js"), m = d(l), n = a("./utils/fn.js"), o = d(n), p = a("./utils/log.js"), q = e(p), r = a("global/document"), s = e(r), t = a("object.assign"), u = e(t), v = function (a) {
                function b(c, d) { f(this, b), a.call(this, c, d), this.emitTapEvents(), this.on("tap", this.handleClick), this.on("click", this.handleClick), this.on("focus", this.handleFocus), this.on("blur", this.handleBlur) } return g(b, a), b.prototype.createEl = function () { var b = arguments.length <= 0 || void 0 === arguments[0] ? "div" : arguments[0], c = arguments.length <= 1 || void 0 === arguments[1] ? {} : arguments[1], d = arguments.length <= 2 || void 0 === arguments[2] ? {} : arguments[2]; c = u["default"]({ className: this.buildCSSClass(), tabIndex: 0 }, c), "button" === b && q["default"].error("Creating a ClickableComponent with an HTML element of " + b + " is not supported; use a Button instead."), d = u["default"]({ role: "button", "aria-live": "polite" }, d); var e = a.prototype.createEl.call(this, b, c, d); return this.createControlTextEl(e), e }, b.prototype.createControlTextEl = function (a) { return this.controlTextEl_ = k.createEl("span", { className: "vjs-control-text" }), a && a.appendChild(this.controlTextEl_), this.controlText(this.controlText_, a), this.controlTextEl_ }, b.prototype.controlText = function (a) { var b = arguments.length <= 1 || void 0 === arguments[1] ? this.el() : arguments[1]; if (!a) return this.controlText_ || "Need Text"; var c = this.localize(a); return this.controlText_ = a, this.controlTextEl_.innerHTML = c, b.setAttribute("title", c), this }, b.prototype.buildCSSClass = function () { return "vjs-control vjs-button " + a.prototype.buildCSSClass.call(this) }, b.prototype.addChild = function (b) { var c = arguments.length <= 1 || void 0 === arguments[1] ? {} : arguments[1]; return a.prototype.addChild.call(this, b, c) }, b.prototype.enable = function () { return this.removeClass("vjs-disabled"), this.el_.setAttribute("aria-disabled", "false"), this }, b.prototype.disable = function () { return this.addClass("vjs-disabled"), this.el_.setAttribute("aria-disabled", "true"), this }, b.prototype.handleClick = function () { }, b.prototype.handleFocus = function () { m.on(s["default"], "keydown", o.bind(this, this.handleKeyPress)) }, b.prototype.handleKeyPress = function (b) {
                32 === b.which || 13 === b.which ? (b.preventDefault(), this.handleClick(b)) : a.prototype.handleKeyPress && a.prototype.handleKeyPress.call(this, b);

                }, b.prototype.handleBlur = function () { m.off(s["default"], "keydown", o.bind(this, this.handleKeyPress)) }, b
            }(i["default"]); i["default"].registerComponent("ClickableComponent", v), c["default"] = v, b.exports = c["default"]
        }, { "./component": 67, "./utils/dom.js": 142, "./utils/events.js": 143, "./utils/fn.js": 144, "./utils/log.js": 147, "global/document": 1, "object.assign": 45 }], 66: [function (a, b, c) { "use strict"; function d(a) { return a && a.__esModule ? a : { "default": a } } function e(a, b) { if (!(a instanceof b)) throw new TypeError("Cannot call a class as a function") } function f(a, b) { if ("function" != typeof b && null !== b) throw new TypeError("Super expression must either be null or a function, not " + typeof b); a.prototype = Object.create(b && b.prototype, { constructor: { value: a, enumerable: !1, writable: !0, configurable: !0 } }), b && (Object.setPrototypeOf ? Object.setPrototypeOf(a, b) : a.__proto__ = b) } c.__esModule = !0; var g = a("./button"), h = d(g), i = a("./component"), j = d(i), k = function (a) { function b(c, d) { e(this, b), a.call(this, c, d), this.controlText(d && d.controlText || this.localize("Close")) } return f(b, a), b.prototype.buildCSSClass = function () { return "vjs-close-button " + a.prototype.buildCSSClass.call(this) }, b.prototype.handleClick = function () { this.trigger({ type: "close", bubbles: !1 }) }, b }(h["default"]); j["default"].registerComponent("CloseButton", k), c["default"] = k, b.exports = c["default"] }, { "./button": 64, "./component": 67 }], 67: [function (a, b, c) { "use strict"; function d(a) { if (a && a.__esModule) return a; var b = {}; if (null != a) for (var c in a) Object.prototype.hasOwnProperty.call(a, c) && (b[c] = a[c]); return b["default"] = a, b } function e(a) { return a && a.__esModule ? a : { "default": a } } function f(a, b) { if (!(a instanceof b)) throw new TypeError("Cannot call a class as a function") } c.__esModule = !0; var g = a("global/window"), h = e(g), i = a("./utils/dom.js"), j = d(i), k = a("./utils/fn.js"), l = d(k), m = a("./utils/guid.js"), n = d(m), o = a("./utils/events.js"), p = d(o), q = a("./utils/log.js"), r = e(q), s = a("./utils/to-title-case.js"), t = e(s), u = a("./utils/merge-options.js"), v = e(u), w = function () { function a(b, c, d) { if (f(this, a), this.player_ = !b && this.play ? b = this : b, this.options_ = v["default"]({}, this.options_), c = this.options_ = v["default"](this.options_, c), this.id_ = c.id || c.el && c.el.id, !this.id_) { var e = b && b.id && b.id() || "no_player"; this.id_ = e + "_component_" + n.newGUID() } this.name_ = c.name || null, c.el ? this.el_ = c.el : c.createEl !== !1 && (this.el_ = this.createEl()), this.children_ = [], this.childIndex_ = {}, this.childNameIndex_ = {}, c.initChildren !== !1 && this.initChildren(), this.ready(d), c.reportTouchActivity !== !1 && this.enableTouchActivity() } return a.prototype.dispose = function () { if (this.trigger({ type: "dispose", bubbles: !1 }), this.children_) for (var a = this.children_.length - 1; a >= 0; a--)this.children_[a].dispose && this.children_[a].dispose(); this.children_ = null, this.childIndex_ = null, this.childNameIndex_ = null, this.off(), this.el_.parentNode && this.el_.parentNode.removeChild(this.el_), j.removeElData(this.el_), this.el_ = null }, a.prototype.player = function () { return this.player_ }, a.prototype.options = function (a) { return r["default"].warn("this.options() has been deprecated and will be moved to the constructor in 6.0"), a ? (this.options_ = v["default"](this.options_, a), this.options_) : this.options_ }, a.prototype.el = function () { return this.el_ }, a.prototype.createEl = function (a, b, c) { return j.createEl(a, b, c) }, a.prototype.localize = function (a) { var b = this.player_.language && this.player_.language(), c = this.player_.languages && this.player_.languages(); if (!b || !c) return a; var d = c[b]; if (d && d[a]) return d[a]; var e = b.split("-")[0], f = c[e]; return f && f[a] ? f[a] : a }, a.prototype.contentEl = function () { return this.contentEl_ || this.el_ }, a.prototype.id = function () { return this.id_ }, a.prototype.name = function () { return this.name_ }, a.prototype.children = function () { return this.children_ }, a.prototype.getChildById = function (a) { return this.childIndex_[a] }, a.prototype.getChild = function (a) { return this.childNameIndex_[a] }, a.prototype.addChild = function (b) { var c = arguments.length <= 1 || void 0 === arguments[1] ? {} : arguments[1], d = arguments.length <= 2 || void 0 === arguments[2] ? this.children_.length : arguments[2], e = void 0, f = void 0; if ("string" == typeof b) { f = b, c || (c = {}), c === !0 && (r["default"].warn("Initializing a child component with `true` is deprecated. Children should be defined in an array when possible, but if necessary use an object instead of `true`."), c = {}); var g = c.componentClass || t["default"](f); c.name = f; var h = a.getComponent(g); if (!h) throw new Error("Component " + g + " does not exist"); if ("function" != typeof h) return null; e = new h(this.player_ || this, c) } else e = b; if (this.children_.splice(d, 0, e), "function" == typeof e.id && (this.childIndex_[e.id()] = e), f = f || e.name && e.name(), f && (this.childNameIndex_[f] = e), "function" == typeof e.el && e.el()) { var i = this.contentEl().children, j = i[d] || null; this.contentEl().insertBefore(e.el(), j) } return e }, a.prototype.removeChild = function (a) { if ("string" == typeof a && (a = this.getChild(a)), a && this.children_) { for (var b = !1, c = this.children_.length - 1; c >= 0; c--)if (this.children_[c] === a) { b = !0, this.children_.splice(c, 1); break } if (b) { this.childIndex_[a.id()] = null, this.childNameIndex_[a.name()] = null; var d = a.el(); d && d.parentNode === this.contentEl() && this.contentEl().removeChild(a.el()) } } }, a.prototype.initChildren = function () { var b = this, c = this.options_.children; c && !function () { var d = b.options_, e = function (a) { var c = a.name, e = a.opts; if (void 0 !== d[c] && (e = d[c]), e !== !1) { e === !0 && (e = {}), e.playerOptions = b.options_.playerOptions; var f = b.addChild(c, e); f && (b[c] = f) } }, f = void 0, g = a.getComponent("Tech"); f = Array.isArray(c) ? c : Object.keys(c), f.concat(Object.keys(b.options_).filter(function (a) { return !f.some(function (b) { return "string" == typeof b ? a === b : a === b.name }) })).map(function (a) { var d = void 0, e = void 0; return "string" == typeof a ? (d = a, e = c[d] || b.options_[d] || {}) : (d = a.name, e = a), { name: d, opts: e } }).filter(function (b) { var c = a.getComponent(b.opts.componentClass || t["default"](b.name)); return c && !g.isTech(c) }).forEach(e) }() }, a.prototype.buildCSSClass = function () { return "" }, a.prototype.on = function (a, b, c) { var d = this; return "string" == typeof a || Array.isArray(a) ? p.on(this.el_, a, l.bind(this, b)) : !function () { var e = a, f = b, g = l.bind(d, c), h = function () { return d.off(e, f, g) }; h.guid = g.guid, d.on("dispose", h); var i = function () { return d.off("dispose", h) }; i.guid = g.guid, a.nodeName ? (p.on(e, f, g), p.on(e, "dispose", i)) : "function" == typeof a.on && (e.on(f, g), e.on("dispose", i)) }(), this }, a.prototype.off = function (a, b, c) { if (!a || "string" == typeof a || Array.isArray(a)) p.off(this.el_, a, b); else { var d = a, e = b, f = l.bind(this, c); this.off("dispose", f), a.nodeName ? (p.off(d, e, f), p.off(d, "dispose", f)) : (d.off(e, f), d.off("dispose", f)) } return this }, a.prototype.one = function (a, b, c) { var d = this, e = arguments; return "string" == typeof a || Array.isArray(a) ? p.one(this.el_, a, l.bind(this, b)) : !function () { var f = a, g = b, h = l.bind(d, c), i = function j() { d.off(f, g, j), h.apply(null, e) }; i.guid = h.guid, d.on(f, g, i) }(), this }, a.prototype.trigger = function (a, b) { return p.trigger(this.el_, a, b), this }, a.prototype.ready = function (a) { var b = arguments.length <= 1 || void 0 === arguments[1] ? !1 : arguments[1]; return a && (this.isReady_ ? b ? a.call(this) : this.setTimeout(a, 1) : (this.readyQueue_ = this.readyQueue_ || [], this.readyQueue_.push(a))), this }, a.prototype.triggerReady = function () { this.isReady_ = !0, this.setTimeout(function () { var a = this.readyQueue_; this.readyQueue_ = [], a && a.length > 0 && a.forEach(function (a) { a.call(this) }, this), this.trigger("ready") }, 1) }, a.prototype.$ = function (a, b) { return j.$(a, b || this.contentEl()) }, a.prototype.$$ = function (a, b) { return j.$$(a, b || this.contentEl()) }, a.prototype.hasClass = function (a) { return j.hasElClass(this.el_, a) }, a.prototype.addClass = function (a) { return j.addElClass(this.el_, a), this }, a.prototype.removeClass = function (a) { return j.removeElClass(this.el_, a), this }, a.prototype.toggleClass = function (a, b) { return j.toggleElClass(this.el_, a, b), this }, a.prototype.show = function () { return this.removeClass("vjs-hidden"), this }, a.prototype.hide = function () { return this.addClass("vjs-hidden"), this }, a.prototype.lockShowing = function () { return this.addClass("vjs-lock-showing"), this }, a.prototype.unlockShowing = function () { return this.removeClass("vjs-lock-showing"), this }, a.prototype.width = function (a, b) { return this.dimension("width", a, b) }, a.prototype.height = function (a, b) { return this.dimension("height", a, b) }, a.prototype.dimensions = function (a, b) { return this.width(a, !0).height(b) }, a.prototype.dimension = function (a, b, c) { if (void 0 !== b) return (null === b || b !== b) && (b = 0), this.el_.style[a] = -1 !== ("" + b).indexOf("%") || -1 !== ("" + b).indexOf("px") ? b : "auto" === b ? "" : b + "px", c || this.trigger("resize"), this; if (!this.el_) return 0; var d = this.el_.style[a], e = d.indexOf("px"); return -1 !== e ? parseInt(d.slice(0, e), 10) : parseInt(this.el_["offset" + t["default"](a)], 10) }, a.prototype.currentDimension = function (a) { var b = 0; if ("width" !== a && "height" !== a) throw new Error("currentDimension only accepts width or height value"); if ("function" == typeof h["default"].getComputedStyle) { var c = h["default"].getComputedStyle(this.el_); b = c.getPropertyValue(a) || c[a] } else if (this.el_.currentStyle) { var d = "offset" + t["default"](a); b = this.el_[d] } return b = parseFloat(b) }, a.prototype.currentDimensions = function () { return { width: this.currentDimension("width"), height: this.currentDimension("height") } }, a.prototype.currentWidth = function () { return this.currentDimension("width") }, a.prototype.currentHeight = function () { return this.currentDimension("height") }, a.prototype.emitTapEvents = function () { var a = 0, b = null, c = 10, d = 200, e = void 0; this.on("touchstart", function (c) { 1 === c.touches.length && (b = { pageX: c.touches[0].pageX, pageY: c.touches[0].pageY }, a = (new Date).getTime(), e = !0) }), this.on("touchmove", function (a) { if (a.touches.length > 1) e = !1; else if (b) { var d = a.touches[0].pageX - b.pageX, f = a.touches[0].pageY - b.pageY, g = Math.sqrt(d * d + f * f); g > c && (e = !1) } }); var f = function () { e = !1 }; this.on("touchleave", f), this.on("touchcancel", f), this.on("touchend", function (c) { if (b = null, e === !0) { var f = (new Date).getTime() - a; d > f && (c.preventDefault(), this.trigger("tap")) } }) }, a.prototype.enableTouchActivity = function () { if (this.player() && this.player().reportUserActivity) { var a = l.bind(this.player(), this.player().reportUserActivity), b = void 0; this.on("touchstart", function () { a(), this.clearInterval(b), b = this.setInterval(a, 250) }); var c = function () { a(), this.clearInterval(b) }; this.on("touchmove", a), this.on("touchend", c), this.on("touchcancel", c) } }, a.prototype.setTimeout = function (a, b) { a = l.bind(this, a); var c = h["default"].setTimeout(a, b), d = function () { this.clearTimeout(c) }; return d.guid = "vjs-timeout-" + c, this.on("dispose", d), c }, a.prototype.clearTimeout = function (a) { h["default"].clearTimeout(a); var b = function () { }; return b.guid = "vjs-timeout-" + a, this.off("dispose", b), a }, a.prototype.setInterval = function (a, b) { a = l.bind(this, a); var c = h["default"].setInterval(a, b), d = function () { this.clearInterval(c) }; return d.guid = "vjs-interval-" + c, this.on("dispose", d), c }, a.prototype.clearInterval = function (a) { h["default"].clearInterval(a); var b = function () { }; return b.guid = "vjs-interval-" + a, this.off("dispose", b), a }, a.registerComponent = function (b, c) { return a.components_ || (a.components_ = {}), a.components_[b] = c, c }, a.getComponent = function (b) { return a.components_ && a.components_[b] ? a.components_[b] : h["default"] && h["default"].videojs && h["default"].videojs[b] ? (r["default"].warn("The " + b + " component was added to the videojs object when it should be registered using videojs.registerComponent(name, component)"), h["default"].videojs[b]) : void 0 }, a.extend = function (b) { b = b || {}, r["default"].warn("Component.extend({}) has been deprecated, use videojs.extend(Component, {}) instead"); var c = b.init || b.init || this.prototype.init || this.prototype.init || function () { }, d = function () { c.apply(this, arguments) }; d.prototype = Object.create(this.prototype), d.prototype.constructor = d, d.extend = a.extend; for (var e in b) b.hasOwnProperty(e) && (d.prototype[e] = b[e]); return d }, a }(); w.registerComponent("Component", w), c["default"] = w, b.exports = c["default"] }, { "./utils/dom.js": 142, "./utils/events.js": 143, "./utils/fn.js": 144, "./utils/guid.js": 146, "./utils/log.js": 147, "./utils/merge-options.js": 148, "./utils/to-title-case.js": 151, "global/window": 2 }], 68: [function (a, b, c) { "use strict"; function d(a) { if (a && a.__esModule) return a; var b = {}; if (null != a) for (var c in a) Object.prototype.hasOwnProperty.call(a, c) && (b[c] = a[c]); return b["default"] = a, b } function e(a) { return a && a.__esModule ? a : { "default": a } } function f(a, b) { if (!(a instanceof b)) throw new TypeError("Cannot call a class as a function") } function g(a, b) { if ("function" != typeof b && null !== b) throw new TypeError("Super expression must either be null or a function, not " + typeof b); a.prototype = Object.create(b && b.prototype, { constructor: { value: a, enumerable: !1, writable: !0, configurable: !0 } }), b && (Object.setPrototypeOf ? Object.setPrototypeOf(a, b) : a.__proto__ = b) } c.__esModule = !0; var h = a("../track-button.js"), i = e(h), j = a("../../component.js"), k = e(j), l = a("../../utils/fn.js"), m = (d(l), a("./audio-track-menu-item.js")), n = e(m), o = function (a) { function b(c) { var d = arguments.length <= 1 || void 0 === arguments[1] ? {} : arguments[1]; f(this, b), d.tracks = c.audioTracks && c.audioTracks(), a.call(this, c, d), this.el_.setAttribute("aria-label", "Audio Menu") } return g(b, a), b.prototype.buildCSSClass = function () { return "vjs-audio-button " + a.prototype.buildCSSClass.call(this) }, b.prototype.createItems = function () { var a = arguments.length <= 0 || void 0 === arguments[0] ? [] : arguments[0], b = this.player_.audioTracks && this.player_.audioTracks(); if (!b) return a; for (var c = 0; c < b.length; c++) { var d = b[c]; a.push(new n["default"](this.player_, { selectable: !0, track: d })) } return a }, b }(i["default"]); o.prototype.controlText_ = "Audio Track", k["default"].registerComponent("AudioTrackButton", o), c["default"] = o, b.exports = c["default"] }, { "../../component.js": 67, "../../utils/fn.js": 144, "../track-button.js": 98, "./audio-track-menu-item.js": 69 }], 69: [function (a, b, c) { "use strict"; function d(a) { if (a && a.__esModule) return a; var b = {}; if (null != a) for (var c in a) Object.prototype.hasOwnProperty.call(a, c) && (b[c] = a[c]); return b["default"] = a, b } function e(a) { return a && a.__esModule ? a : { "default": a } } function f(a, b) { if (!(a instanceof b)) throw new TypeError("Cannot call a class as a function") } function g(a, b) { if ("function" != typeof b && null !== b) throw new TypeError("Super expression must either be null or a function, not " + typeof b); a.prototype = Object.create(b && b.prototype, { constructor: { value: a, enumerable: !1, writable: !0, configurable: !0 } }), b && (Object.setPrototypeOf ? Object.setPrototypeOf(a, b) : a.__proto__ = b) } c.__esModule = !0; var h = a("../../menu/menu-item.js"), i = e(h), j = a("../../component.js"), k = e(j), l = a("../../utils/fn.js"), m = d(l), n = function (a) { function b(c, d) { var e = this; f(this, b); var g = d.track, h = c.audioTracks(); d.label = g.label || g.language || "Unknown", d.selected = g.enabled, a.call(this, c, d), this.track = g, h && !function () { var a = m.bind(e, e.handleTracksChange); h.addEventListener("change", a), e.on("dispose", function () { h.removeEventListener("change", a) }) }() } return g(b, a), b.prototype.handleClick = function (b) { var c = this.player_.audioTracks(); if (a.prototype.handleClick.call(this, b), c) for (var d = 0; d < c.length; d++) { var e = c[d]; e.enabled = e === this.track } }, b.prototype.handleTracksChange = function () { this.selected(this.track.enabled) }, b }(i["default"]); k["default"].registerComponent("AudioTrackMenuItem", n), c["default"] = n, b.exports = c["default"] }, { "../../component.js": 67, "../../menu/menu-item.js": 110, "../../utils/fn.js": 144 }], 70: [function (a, b, c) { "use strict"; function d(a) { return a && a.__esModule ? a : { "default": a } } function e(a, b) { if (!(a instanceof b)) throw new TypeError("Cannot call a class as a function") } function f(a, b) { if ("function" != typeof b && null !== b) throw new TypeError("Super expression must either be null or a function, not " + typeof b); a.prototype = Object.create(b && b.prototype, { constructor: { value: a, enumerable: !1, writable: !0, configurable: !0 } }), b && (Object.setPrototypeOf ? Object.setPrototypeOf(a, b) : a.__proto__ = b) } c.__esModule = !0; var g = a("../component.js"), h = d(g), i = a("./play-toggle.js"), j = (d(i), a("./time-controls/current-time-display.js")), k = (d(j), a("./time-controls/duration-display.js")), l = (d(k), a("./time-controls/time-divider.js")), m = (d(l), a("./time-controls/remaining-time-display.js")), n = (d(m), a("./live-display.js")), o = (d(n), a("./progress-control/progress-control.js")), p = (d(o), a("./fullscreen-toggle.js")), q = (d(p), a("./volume-control/volume-control.js")), r = (d(q), a("./volume-menu-button.js")), s = (d(r), a("./mute-toggle.js")), t = (d(s), a("./text-track-controls/chapters-button.js")), u = (d(t), a("./text-track-controls/descriptions-button.js")), v = (d(u), a("./text-track-controls/subtitles-button.js")), w = (d(v), a("./text-track-controls/captions-button.js")), x = (d(w), a("./audio-track-controls/audio-track-button.js")), y = (d(x), a("./playback-rate-menu/playback-rate-menu-button.js")), z = (d(y), a("./spacer-controls/custom-control-spacer.js")), A = (d(z), function (a) { function b() { e(this, b), a.apply(this, arguments) } return f(b, a), b.prototype.createEl = function () { return a.prototype.createEl.call(this, "div", { className: "vjs-control-bar", dir: "ltr" }, { role: "group" }) }, b }(h["default"])); A.prototype.options_ = { children: ["playToggle", "volumeMenuButton", "currentTimeDisplay", "timeDivider", "durationDisplay", "progressControl", "liveDisplay", "remainingTimeDisplay", "customControlSpacer", "playbackRateMenuButton", "chaptersButton", "descriptionsButton", "subtitlesButton", "captionsButton", "audioTrackButton", "fullscreenToggle"] }, h["default"].registerComponent("ControlBar", A), c["default"] = A, b.exports = c["default"] }, { "../component.js": 67, "./audio-track-controls/audio-track-button.js": 68, "./fullscreen-toggle.js": 71, "./live-display.js": 72, "./mute-toggle.js": 73, "./play-toggle.js": 74, "./playback-rate-menu/playback-rate-menu-button.js": 75, "./progress-control/progress-control.js": 80, "./spacer-controls/custom-control-spacer.js": 83, "./text-track-controls/captions-button.js": 86, "./text-track-controls/chapters-button.js": 87, "./text-track-controls/descriptions-button.js": 89, "./text-track-controls/subtitles-button.js": 91, "./time-controls/current-time-display.js": 94, "./time-controls/duration-display.js": 95, "./time-controls/remaining-time-display.js": 96, "./time-controls/time-divider.js": 97, "./volume-control/volume-control.js": 100, "./volume-menu-button.js": 102 }], 71: [function (a, b, c) { "use strict"; function d(a) { return a && a.__esModule ? a : { "default": a } } function e(a, b) { if (!(a instanceof b)) throw new TypeError("Cannot call a class as a function") } function f(a, b) { if ("function" != typeof b && null !== b) throw new TypeError("Super expression must either be null or a function, not " + typeof b); a.prototype = Object.create(b && b.prototype, { constructor: { value: a, enumerable: !1, writable: !0, configurable: !0 } }), b && (Object.setPrototypeOf ? Object.setPrototypeOf(a, b) : a.__proto__ = b) } c.__esModule = !0; var g = a("../button.js"), h = d(g), i = a("../component.js"), j = d(i), k = function (a) { function b(c, d) { e(this, b), a.call(this, c, d), this.on(c, "fullscreenchange", this.handleFullscreenChange) } return f(b, a), b.prototype.buildCSSClass = function () { return "vjs-fullscreen-control " + a.prototype.buildCSSClass.call(this) }, b.prototype.handleFullscreenChange = function () { this.controlText(this.player_.isFullscreen() ? "Non-Fullscreen" : "Fullscreen") }, b.prototype.handleClick = function () { this.player_.isFullscreen() ? this.player_.exitFullscreen() : this.player_.requestFullscreen() }, b }(h["default"]); k.prototype.controlText_ = "Fullscreen", j["default"].registerComponent("FullscreenToggle", k), c["default"] = k, b.exports = c["default"] }, { "../button.js": 64, "../component.js": 67 }], 72: [function (a, b, c) { "use strict"; function d(a) { if (a && a.__esModule) return a; var b = {}; if (null != a) for (var c in a) Object.prototype.hasOwnProperty.call(a, c) && (b[c] = a[c]); return b["default"] = a, b } function e(a) { return a && a.__esModule ? a : { "default": a } } function f(a, b) { if (!(a instanceof b)) throw new TypeError("Cannot call a class as a function") } function g(a, b) { if ("function" != typeof b && null !== b) throw new TypeError("Super expression must either be null or a function, not " + typeof b); a.prototype = Object.create(b && b.prototype, { constructor: { value: a, enumerable: !1, writable: !0, configurable: !0 } }), b && (Object.setPrototypeOf ? Object.setPrototypeOf(a, b) : a.__proto__ = b) } c.__esModule = !0; var h = a("../component"), i = e(h), j = a("../utils/dom.js"), k = d(j), l = function (a) { function b(c, d) { f(this, b), a.call(this, c, d), this.updateShowing(), this.on(this.player(), "durationchange", this.updateShowing) } return g(b, a), b.prototype.createEl = function () { var b = a.prototype.createEl.call(this, "div", { className: "vjs-live-control vjs-control" }); return this.contentEl_ = k.createEl("div", { className: "vjs-live-display", innerHTML: '<span class="vjs-control-text">' + this.localize("Stream Type") + "</span>" + this.localize("LIVE") }, { "aria-live": "off" }), b.appendChild(this.contentEl_), b }, b.prototype.updateShowing = function () { this.player().duration() === 1 / 0 ? this.show() : this.hide() }, b }(i["default"]); i["default"].registerComponent("LiveDisplay", l), c["default"] = l, b.exports = c["default"] }, { "../component": 67, "../utils/dom.js": 142 }], 73: [function (a, b, c) { "use strict"; function d(a) { if (a && a.__esModule) return a; var b = {}; if (null != a) for (var c in a) Object.prototype.hasOwnProperty.call(a, c) && (b[c] = a[c]); return b["default"] = a, b } function e(a) { return a && a.__esModule ? a : { "default": a } } function f(a, b) { if (!(a instanceof b)) throw new TypeError("Cannot call a class as a function") } function g(a, b) { if ("function" != typeof b && null !== b) throw new TypeError("Super expression must either be null or a function, not " + typeof b); a.prototype = Object.create(b && b.prototype, { constructor: { value: a, enumerable: !1, writable: !0, configurable: !0 } }), b && (Object.setPrototypeOf ? Object.setPrototypeOf(a, b) : a.__proto__ = b) } c.__esModule = !0; var h = a("../button"), i = e(h), j = a("../component"), k = e(j), l = a("../utils/dom.js"), m = d(l), n = function (a) { function b(c, d) { f(this, b), a.call(this, c, d), this.on(c, "volumechange", this.update), c.tech_ && c.tech_.featuresVolumeControl === !1 && this.addClass("vjs-hidden"), this.on(c, "loadstart", function () { this.update(), c.tech_.featuresVolumeControl === !1 ? this.addClass("vjs-hidden") : this.removeClass("vjs-hidden") }) } return g(b, a), b.prototype.buildCSSClass = function () { return "vjs-mute-control " + a.prototype.buildCSSClass.call(this) }, b.prototype.handleClick = function () { this.player_.muted(this.player_.muted() ? !1 : !0) }, b.prototype.update = function () { var a = this.player_.volume(), b = 3; 0 === a || this.player_.muted() ? b = 0 : .33 > a ? b = 1 : .67 > a && (b = 2); var c = this.player_.muted() ? "Unmute" : "Mute"; this.controlText() !== c && this.controlText(c); for (var d = 0; 4 > d; d++)m.removeElClass(this.el_, "vjs-vol-" + d); m.addElClass(this.el_, "vjs-vol-" + b) }, b }(i["default"]); n.prototype.controlText_ = "Mute", k["default"].registerComponent("MuteToggle", n), c["default"] = n, b.exports = c["default"] }, { "../button": 64, "../component": 67, "../utils/dom.js": 142 }], 74: [function (a, b, c) { "use strict"; function d(a) { return a && a.__esModule ? a : { "default": a } } function e(a, b) { if (!(a instanceof b)) throw new TypeError("Cannot call a class as a function") } function f(a, b) { if ("function" != typeof b && null !== b) throw new TypeError("Super expression must either be null or a function, not " + typeof b); a.prototype = Object.create(b && b.prototype, { constructor: { value: a, enumerable: !1, writable: !0, configurable: !0 } }), b && (Object.setPrototypeOf ? Object.setPrototypeOf(a, b) : a.__proto__ = b) } c.__esModule = !0; var g = a("../button.js"), h = d(g), i = a("../component.js"), j = d(i), k = function (a) { function b(c, d) { e(this, b), a.call(this, c, d), this.on(c, "play", this.handlePlay), this.on(c, "pause", this.handlePause) } return f(b, a), b.prototype.buildCSSClass = function () { return "vjs-play-control " + a.prototype.buildCSSClass.call(this) }, b.prototype.handleClick = function () { this.player_.paused() ? this.player_.play() : this.player_.pause() }, b.prototype.handlePlay = function () { this.removeClass("vjs-paused"), this.addClass("vjs-playing"), this.controlText("Pause") }, b.prototype.handlePause = function () { this.removeClass("vjs-playing"), this.addClass("vjs-paused"), this.controlText("Play") }, b }(h["default"]); k.prototype.controlText_ = "Play", j["default"].registerComponent("PlayToggle", k), c["default"] = k, b.exports = c["default"] }, { "../button.js": 64, "../component.js": 67 }], 75: [function (a, b, c) { "use strict"; function d(a) { if (a && a.__esModule) return a; var b = {}; if (null != a) for (var c in a) Object.prototype.hasOwnProperty.call(a, c) && (b[c] = a[c]); return b["default"] = a, b } function e(a) { return a && a.__esModule ? a : { "default": a } } function f(a, b) { if (!(a instanceof b)) throw new TypeError("Cannot call a class as a function") } function g(a, b) { if ("function" != typeof b && null !== b) throw new TypeError("Super expression must either be null or a function, not " + typeof b); a.prototype = Object.create(b && b.prototype, { constructor: { value: a, enumerable: !1, writable: !0, configurable: !0 } }), b && (Object.setPrototypeOf ? Object.setPrototypeOf(a, b) : a.__proto__ = b) } c.__esModule = !0; var h = a("../../menu/menu-button.js"), i = e(h), j = a("../../menu/menu.js"), k = e(j), l = a("./playback-rate-menu-item.js"), m = e(l), n = a("../../component.js"), o = e(n), p = a("../../utils/dom.js"), q = d(p), r = function (a) { function b(c, d) { f(this, b), a.call(this, c, d), this.updateVisibility(), this.updateLabel(), this.on(c, "loadstart", this.updateVisibility), this.on(c, "ratechange", this.updateLabel) } return g(b, a), b.prototype.createEl = function () { var b = a.prototype.createEl.call(this); return this.labelEl_ = q.createEl("div", { className: "vjs-playback-rate-value", innerHTML: 1 }), b.appendChild(this.labelEl_), b }, b.prototype.buildCSSClass = function () { return "vjs-playback-rate " + a.prototype.buildCSSClass.call(this) }, b.prototype.createMenu = function () { var a = new k["default"](this.player()), b = this.playbackRates(); if (b) for (var c = b.length - 1; c >= 0; c--)a.addChild(new m["default"](this.player(), { rate: b[c] + "x" })); return a }, b.prototype.updateARIAAttributes = function () { this.el().setAttribute("aria-valuenow", this.player().playbackRate()) }, b.prototype.handleClick = function () { for (var a = this.player().playbackRate(), b = this.playbackRates(), c = b[0], d = 0; d < b.length; d++)if (b[d] > a) { c = b[d]; break } this.player().playbackRate(c) }, b.prototype.playbackRates = function () { return this.options_.playbackRates || this.options_.playerOptions && this.options_.playerOptions.playbackRates }, b.prototype.playbackRateSupported = function () { return this.player().tech_ && this.player().tech_.featuresPlaybackRate && this.playbackRates() && this.playbackRates().length > 0 }, b.prototype.updateVisibility = function () { this.playbackRateSupported() ? this.removeClass("vjs-hidden") : this.addClass("vjs-hidden") }, b.prototype.updateLabel = function () { this.playbackRateSupported() && (this.labelEl_.innerHTML = this.player().playbackRate() + "x") }, b }(i["default"]); r.prototype.controlText_ = "Playback Rate", o["default"].registerComponent("PlaybackRateMenuButton", r), c["default"] = r, b.exports = c["default"] }, { "../../component.js": 67, "../../menu/menu-button.js": 109, "../../menu/menu.js": 111, "../../utils/dom.js": 142, "./playback-rate-menu-item.js": 76 }], 76: [function (a, b, c) { "use strict"; function d(a) { return a && a.__esModule ? a : { "default": a } } function e(a, b) { if (!(a instanceof b)) throw new TypeError("Cannot call a class as a function") } function f(a, b) { if ("function" != typeof b && null !== b) throw new TypeError("Super expression must either be null or a function, not " + typeof b); a.prototype = Object.create(b && b.prototype, { constructor: { value: a, enumerable: !1, writable: !0, configurable: !0 } }), b && (Object.setPrototypeOf ? Object.setPrototypeOf(a, b) : a.__proto__ = b) } c.__esModule = !0; var g = a("../../menu/menu-item.js"), h = d(g), i = a("../../component.js"), j = d(i), k = function (a) { function b(c, d) { e(this, b); var f = d.rate, g = parseFloat(f, 10); d.label = f, d.selected = 1 === g, a.call(this, c, d), this.label = f, this.rate = g, this.on(c, "ratechange", this.update) } return f(b, a), b.prototype.handleClick = function () { a.prototype.handleClick.call(this), this.player().playbackRate(this.rate) }, b.prototype.update = function () { this.selected(this.player().playbackRate() === this.rate) }, b }(h["default"]); k.prototype.contentElType = "button", j["default"].registerComponent("PlaybackRateMenuItem", k), c["default"] = k, b.exports = c["default"] }, { "../../component.js": 67, "../../menu/menu-item.js": 110 }], 77: [function (a, b, c) { "use strict"; function d(a) { if (a && a.__esModule) return a; var b = {}; if (null != a) for (var c in a) Object.prototype.hasOwnProperty.call(a, c) && (b[c] = a[c]); return b["default"] = a, b } function e(a) { return a && a.__esModule ? a : { "default": a } } function f(a, b) { if (!(a instanceof b)) throw new TypeError("Cannot call a class as a function") } function g(a, b) { if ("function" != typeof b && null !== b) throw new TypeError("Super expression must either be null or a function, not " + typeof b); a.prototype = Object.create(b && b.prototype, { constructor: { value: a, enumerable: !1, writable: !0, configurable: !0 } }), b && (Object.setPrototypeOf ? Object.setPrototypeOf(a, b) : a.__proto__ = b) } c.__esModule = !0; var h = a("../../component.js"), i = e(h), j = a("../../utils/dom.js"), k = d(j), l = function (a) { function b(c, d) { f(this, b), a.call(this, c, d), this.on(c, "progress", this.update) } return g(b, a), b.prototype.createEl = function () { return a.prototype.createEl.call(this, "div", { className: "vjs-load-progress", innerHTML: '<span class="vjs-control-text"><span>' + this.localize("Loaded") + "</span>: 0%</span>" }) }, b.prototype.update = function () { var a = this.player_.buffered(), b = this.player_.duration(), c = this.player_.bufferedEnd(), d = this.el_.children, e = function (a, b) { var c = a / b || 0; return 100 * (c >= 1 ? 1 : c) + "%" }; this.el_.style.width = e(c, b); for (var f = 0; f < a.length; f++) { var g = a.start(f), h = a.end(f), i = d[f]; i || (i = this.el_.appendChild(k.createEl())), i.style.left = e(g, c), i.style.width = e(h - g, c) } for (var f = d.length; f > a.length; f--)this.el_.removeChild(d[f - 1]) }, b }(i["default"]); i["default"].registerComponent("LoadProgressBar", l), c["default"] = l, b.exports = c["default"] }, { "../../component.js": 67, "../../utils/dom.js": 142 }], 78: [function (a, b, c) { "use strict"; function d(a) { if (a && a.__esModule) return a; var b = {}; if (null != a) for (var c in a) Object.prototype.hasOwnProperty.call(a, c) && (b[c] = a[c]); return b["default"] = a, b } function e(a) { return a && a.__esModule ? a : { "default": a } } function f(a, b) { if (!(a instanceof b)) throw new TypeError("Cannot call a class as a function") } function g(a, b) { if ("function" != typeof b && null !== b) throw new TypeError("Super expression must either be null or a function, not " + typeof b); a.prototype = Object.create(b && b.prototype, { constructor: { value: a, enumerable: !1, writable: !0, configurable: !0 } }), b && (Object.setPrototypeOf ? Object.setPrototypeOf(a, b) : a.__proto__ = b) } c.__esModule = !0; var h = a("global/window"), i = e(h), j = a("../../component.js"), k = e(j), l = a("../../utils/dom.js"), m = d(l), n = a("../../utils/fn.js"), o = d(n), p = a("../../utils/format-time.js"), q = e(p), r = a("lodash-compat/function/throttle"), s = e(r), t = function (a) { function b(c, d) { var e = this; f(this, b), a.call(this, c, d), d.playerOptions && d.playerOptions.controlBar && d.playerOptions.controlBar.progressControl && d.playerOptions.controlBar.progressControl.keepTooltipsInside && (this.keepTooltipsInside = d.playerOptions.controlBar.progressControl.keepTooltipsInside), this.keepTooltipsInside && (this.tooltip = m.createEl("div", { className: "vjs-time-tooltip" }), this.el().appendChild(this.tooltip), this.addClass("vjs-keep-tooltips-inside")), this.update(0, 0), c.on("ready", function () { e.on(c.controlBar.progressControl.el(), "mousemove", s["default"](o.bind(e, e.handleMouseMove), 25)) }) } return g(b, a), b.prototype.createEl = function () { return a.prototype.createEl.call(this, "div", { className: "vjs-mouse-display" }) }, b.prototype.handleMouseMove = function (a) { var b = this.player_.duration(), c = this.calculateDistance(a) * b, d = a.pageX - m.findElPosition(this.el().parentNode).left; this.update(c, d) }, b.prototype.update = function (a, b) { var c = q["default"](a, this.player_.duration()); if (this.el().style.left = b + "px", this.el().setAttribute("data-current-time", c), this.keepTooltipsInside) { var d = this.clampPosition_(b), e = b - d + 1, f = parseFloat(i["default"].getComputedStyle(this.tooltip).width), g = f / 2; this.tooltip.innerHTML = c, this.tooltip.style.right = "-" + (g - e) + "px" } }, b.prototype.calculateDistance = function (a) { return m.getPointerPosition(this.el().parentNode, a).x }, b.prototype.clampPosition_ = function (a) { if (!this.keepTooltipsInside) return a; var b = parseFloat(i["default"].getComputedStyle(this.player().el()).width), c = parseFloat(i["default"].getComputedStyle(this.tooltip).width), d = c / 2, e = a; return d > a ? e = Math.ceil(d) : a > b - d && (e = Math.floor(b - d)), e }, b }(k["default"]); k["default"].registerComponent("MouseTimeDisplay", t), c["default"] = t, b.exports = c["default"] }, {
            "../../component.js": 67, "../../utils/dom.js": 142, "../../utils/fn.js": 144, "../../utils/format-time.js": 145,
            "global/window": 2, "lodash-compat/function/throttle": 7
        }], 79: [function (a, b, c) { "use strict"; function d(a) { if (a && a.__esModule) return a; var b = {}; if (null != a) for (var c in a) Object.prototype.hasOwnProperty.call(a, c) && (b[c] = a[c]); return b["default"] = a, b } function e(a) { return a && a.__esModule ? a : { "default": a } } function f(a, b) { if (!(a instanceof b)) throw new TypeError("Cannot call a class as a function") } function g(a, b) { if ("function" != typeof b && null !== b) throw new TypeError("Super expression must either be null or a function, not " + typeof b); a.prototype = Object.create(b && b.prototype, { constructor: { value: a, enumerable: !1, writable: !0, configurable: !0 } }), b && (Object.setPrototypeOf ? Object.setPrototypeOf(a, b) : a.__proto__ = b) } c.__esModule = !0; var h = a("../../component.js"), i = e(h), j = a("../../utils/fn.js"), k = d(j), l = a("../../utils/dom.js"), m = (d(l), a("../../utils/format-time.js")), n = e(m), o = function (a) { function b(c, d) { f(this, b), a.call(this, c, d), this.updateDataAttr(), this.on(c, "timeupdate", this.updateDataAttr), c.ready(k.bind(this, this.updateDataAttr)), d.playerOptions && d.playerOptions.controlBar && d.playerOptions.controlBar.progressControl && d.playerOptions.controlBar.progressControl.keepTooltipsInside && (this.keepTooltipsInside = d.playerOptions.controlBar.progressControl.keepTooltipsInside), this.keepTooltipsInside && this.addClass("vjs-keep-tooltips-inside") } return g(b, a), b.prototype.createEl = function () { return a.prototype.createEl.call(this, "div", { className: "vjs-play-progress vjs-slider-bar", innerHTML: '<span class="vjs-control-text"><span>' + this.localize("Progress") + "</span>: 0%</span>" }) }, b.prototype.updateDataAttr = function () { var a = this.player_.scrubbing() ? this.player_.getCache().currentTime : this.player_.currentTime(); this.el_.setAttribute("data-current-time", n["default"](a, this.player_.duration())) }, b }(i["default"]); i["default"].registerComponent("PlayProgressBar", o), c["default"] = o, b.exports = c["default"] }, { "../../component.js": 67, "../../utils/dom.js": 142, "../../utils/fn.js": 144, "../../utils/format-time.js": 145 }], 80: [function (a, b, c) { "use strict"; function d(a) { return a && a.__esModule ? a : { "default": a } } function e(a, b) { if (!(a instanceof b)) throw new TypeError("Cannot call a class as a function") } function f(a, b) { if ("function" != typeof b && null !== b) throw new TypeError("Super expression must either be null or a function, not " + typeof b); a.prototype = Object.create(b && b.prototype, { constructor: { value: a, enumerable: !1, writable: !0, configurable: !0 } }), b && (Object.setPrototypeOf ? Object.setPrototypeOf(a, b) : a.__proto__ = b) } c.__esModule = !0; var g = a("../../component.js"), h = d(g), i = a("./seek-bar.js"), j = (d(i), a("./mouse-time-display.js")), k = (d(j), function (a) { function b() { e(this, b), a.apply(this, arguments) } return f(b, a), b.prototype.createEl = function () { return a.prototype.createEl.call(this, "div", { className: "vjs-progress-control vjs-control" }) }, b }(h["default"])); k.prototype.options_ = { children: ["seekBar"] }, h["default"].registerComponent("ProgressControl", k), c["default"] = k, b.exports = c["default"] }, { "../../component.js": 67, "./mouse-time-display.js": 78, "./seek-bar.js": 81 }], 81: [function (a, b, c) { "use strict"; function d(a) { if (a && a.__esModule) return a; var b = {}; if (null != a) for (var c in a) Object.prototype.hasOwnProperty.call(a, c) && (b[c] = a[c]); return b["default"] = a, b } function e(a) { return a && a.__esModule ? a : { "default": a } } function f(a, b) { if (!(a instanceof b)) throw new TypeError("Cannot call a class as a function") } function g(a, b) { if ("function" != typeof b && null !== b) throw new TypeError("Super expression must either be null or a function, not " + typeof b); a.prototype = Object.create(b && b.prototype, { constructor: { value: a, enumerable: !1, writable: !0, configurable: !0 } }), b && (Object.setPrototypeOf ? Object.setPrototypeOf(a, b) : a.__proto__ = b) } c.__esModule = !0; var h = a("global/window"), i = e(h), j = a("../../slider/slider.js"), k = e(j), l = a("../../component.js"), m = e(l), n = a("./load-progress-bar.js"), o = (e(n), a("./play-progress-bar.js")), p = (e(o), a("./tooltip-progress-bar.js")), q = (e(p), a("../../utils/fn.js")), r = d(q), s = a("../../utils/format-time.js"), t = e(s), u = a("object.assign"), v = (e(u), function (a) { function b(c, d) { f(this, b), a.call(this, c, d), this.on(c, "timeupdate", this.updateProgress), this.on(c, "ended", this.updateProgress), c.ready(r.bind(this, this.updateProgress)), d.playerOptions && d.playerOptions.controlBar && d.playerOptions.controlBar.progressControl && d.playerOptions.controlBar.progressControl.keepTooltipsInside && (this.keepTooltipsInside = d.playerOptions.controlBar.progressControl.keepTooltipsInside), this.keepTooltipsInside && (this.tooltipProgressBar = this.addChild("TooltipProgressBar")) } return g(b, a), b.prototype.createEl = function () { return a.prototype.createEl.call(this, "div", { className: "vjs-progress-holder" }, { "aria-label": "progress bar" }) }, b.prototype.updateProgress = function () { if (this.updateAriaAttributes(this.el_), this.keepTooltipsInside) { this.updateAriaAttributes(this.tooltipProgressBar.el_), this.tooltipProgressBar.el_.style.width = this.bar.el_.style.width; var a = parseFloat(i["default"].getComputedStyle(this.player().el()).width), b = parseFloat(i["default"].getComputedStyle(this.tooltipProgressBar.tooltip).width), c = this.tooltipProgressBar.el().style; c.maxWidth = Math.floor(a - b / 2) + "px", c.minWidth = Math.ceil(b / 2) + "px", c.right = "-" + b / 2 + "px" } }, b.prototype.updateAriaAttributes = function (a) { var b = this.player_.scrubbing() ? this.player_.getCache().currentTime : this.player_.currentTime(); a.setAttribute("aria-valuenow", (100 * this.getPercent()).toFixed(2)), a.setAttribute("aria-valuetext", t["default"](b, this.player_.duration())) }, b.prototype.getPercent = function () { var a = this.player_.currentTime() / this.player_.duration(); return a >= 1 ? 1 : a }, b.prototype.handleMouseDown = function (b) { a.prototype.handleMouseDown.call(this, b), this.player_.scrubbing(!0), this.videoWasPlaying = !this.player_.paused(), this.player_.pause() }, b.prototype.handleMouseMove = function (a) { var b = this.calculateDistance(a) * this.player_.duration(); b === this.player_.duration() && (b -= .1), this.player_.currentTime(b) }, b.prototype.handleMouseUp = function (b) { a.prototype.handleMouseUp.call(this, b), this.player_.scrubbing(!1), this.videoWasPlaying && this.player_.play() }, b.prototype.stepForward = function () { this.player_.currentTime(this.player_.currentTime() + 5) }, b.prototype.stepBack = function () { this.player_.currentTime(this.player_.currentTime() - 5) }, b }(k["default"])); v.prototype.options_ = { children: ["loadProgressBar", "mouseTimeDisplay", "playProgressBar"], barName: "playProgressBar" }, v.prototype.playerEvent = "timeupdate", m["default"].registerComponent("SeekBar", v), c["default"] = v, b.exports = c["default"] }, { "../../component.js": 67, "../../slider/slider.js": 119, "../../utils/fn.js": 144, "../../utils/format-time.js": 145, "./load-progress-bar.js": 77, "./play-progress-bar.js": 79, "./tooltip-progress-bar.js": 82, "global/window": 2, "object.assign": 45 }], 82: [function (a, b, c) { "use strict"; function d(a) { if (a && a.__esModule) return a; var b = {}; if (null != a) for (var c in a) Object.prototype.hasOwnProperty.call(a, c) && (b[c] = a[c]); return b["default"] = a, b } function e(a) { return a && a.__esModule ? a : { "default": a } } function f(a, b) { if (!(a instanceof b)) throw new TypeError("Cannot call a class as a function") } function g(a, b) { if ("function" != typeof b && null !== b) throw new TypeError("Super expression must either be null or a function, not " + typeof b); a.prototype = Object.create(b && b.prototype, { constructor: { value: a, enumerable: !1, writable: !0, configurable: !0 } }), b && (Object.setPrototypeOf ? Object.setPrototypeOf(a, b) : a.__proto__ = b) } c.__esModule = !0; var h = a("../../component.js"), i = e(h), j = a("../../utils/fn.js"), k = d(j), l = a("../../utils/dom.js"), m = (d(l), a("../../utils/format-time.js")), n = e(m), o = function (a) { function b(c, d) { f(this, b), a.call(this, c, d), this.updateDataAttr(), this.on(c, "timeupdate", this.updateDataAttr), c.ready(k.bind(this, this.updateDataAttr)) } return g(b, a), b.prototype.createEl = function () { var b = a.prototype.createEl.call(this, "div", { className: "vjs-tooltip-progress-bar vjs-slider-bar", innerHTML: '<div class="vjs-time-tooltip"></div>\n        <span class="vjs-control-text"><span>' + this.localize("Progress") + "</span>: 0%</span>" }); return this.tooltip = b.querySelector(".vjs-time-tooltip"), b }, b.prototype.updateDataAttr = function () { var a = this.player_.scrubbing() ? this.player_.getCache().currentTime : this.player_.currentTime(), b = n["default"](a, this.player_.duration()); this.el_.setAttribute("data-current-time", b), this.tooltip.innerHTML = b }, b }(i["default"]); i["default"].registerComponent("TooltipProgressBar", o), c["default"] = o, b.exports = c["default"] }, { "../../component.js": 67, "../../utils/dom.js": 142, "../../utils/fn.js": 144, "../../utils/format-time.js": 145 }], 83: [function (a, b, c) { "use strict"; function d(a) { return a && a.__esModule ? a : { "default": a } } function e(a, b) { if (!(a instanceof b)) throw new TypeError("Cannot call a class as a function") } function f(a, b) { if ("function" != typeof b && null !== b) throw new TypeError("Super expression must either be null or a function, not " + typeof b); a.prototype = Object.create(b && b.prototype, { constructor: { value: a, enumerable: !1, writable: !0, configurable: !0 } }), b && (Object.setPrototypeOf ? Object.setPrototypeOf(a, b) : a.__proto__ = b) } c.__esModule = !0; var g = a("./spacer.js"), h = d(g), i = a("../../component.js"), j = d(i), k = function (a) { function b() { e(this, b), a.apply(this, arguments) } return f(b, a), b.prototype.buildCSSClass = function () { return "vjs-custom-control-spacer " + a.prototype.buildCSSClass.call(this) }, b.prototype.createEl = function () { var b = a.prototype.createEl.call(this, { className: this.buildCSSClass() }); return b.innerHTML = "&nbsp;", b }, b }(h["default"]); j["default"].registerComponent("CustomControlSpacer", k), c["default"] = k, b.exports = c["default"] }, { "../../component.js": 67, "./spacer.js": 84 }], 84: [function (a, b, c) { "use strict"; function d(a) { return a && a.__esModule ? a : { "default": a } } function e(a, b) { if (!(a instanceof b)) throw new TypeError("Cannot call a class as a function") } function f(a, b) { if ("function" != typeof b && null !== b) throw new TypeError("Super expression must either be null or a function, not " + typeof b); a.prototype = Object.create(b && b.prototype, { constructor: { value: a, enumerable: !1, writable: !0, configurable: !0 } }), b && (Object.setPrototypeOf ? Object.setPrototypeOf(a, b) : a.__proto__ = b) } c.__esModule = !0; var g = a("../../component.js"), h = d(g), i = function (a) { function b() { e(this, b), a.apply(this, arguments) } return f(b, a), b.prototype.buildCSSClass = function () { return "vjs-spacer " + a.prototype.buildCSSClass.call(this) }, b.prototype.createEl = function () { return a.prototype.createEl.call(this, "div", { className: this.buildCSSClass() }) }, b }(h["default"]); h["default"].registerComponent("Spacer", i), c["default"] = i, b.exports = c["default"] }, { "../../component.js": 67 }], 85: [function (a, b, c) { "use strict"; function d(a) { return a && a.__esModule ? a : { "default": a } } function e(a, b) { if (!(a instanceof b)) throw new TypeError("Cannot call a class as a function") } function f(a, b) { if ("function" != typeof b && null !== b) throw new TypeError("Super expression must either be null or a function, not " + typeof b); a.prototype = Object.create(b && b.prototype, { constructor: { value: a, enumerable: !1, writable: !0, configurable: !0 } }), b && (Object.setPrototypeOf ? Object.setPrototypeOf(a, b) : a.__proto__ = b) } c.__esModule = !0; var g = a("./text-track-menu-item.js"), h = d(g), i = a("../../component.js"), j = d(i), k = function (a) { function b(c, d) { e(this, b), d.track = { kind: d.kind, player: c, label: d.kind + " settings", selectable: !1, "default": !1, mode: "disabled" }, d.selectable = !1, a.call(this, c, d), this.addClass("vjs-texttrack-settings"), this.controlText(", opens " + d.kind + " settings dialog") } return f(b, a), b.prototype.handleClick = function () { this.player().getChild("textTrackSettings").show(), this.player().getChild("textTrackSettings").el_.focus() }, b }(h["default"]); j["default"].registerComponent("CaptionSettingsMenuItem", k), c["default"] = k, b.exports = c["default"] }, { "../../component.js": 67, "./text-track-menu-item.js": 93 }], 86: [function (a, b, c) { "use strict"; function d(a) { return a && a.__esModule ? a : { "default": a } } function e(a, b) { if (!(a instanceof b)) throw new TypeError("Cannot call a class as a function") } function f(a, b) { if ("function" != typeof b && null !== b) throw new TypeError("Super expression must either be null or a function, not " + typeof b); a.prototype = Object.create(b && b.prototype, { constructor: { value: a, enumerable: !1, writable: !0, configurable: !0 } }), b && (Object.setPrototypeOf ? Object.setPrototypeOf(a, b) : a.__proto__ = b) } c.__esModule = !0; var g = a("./text-track-button.js"), h = d(g), i = a("../../component.js"), j = d(i), k = a("./caption-settings-menu-item.js"), l = d(k), m = function (a) { function b(c, d, f) { e(this, b), a.call(this, c, d, f), this.el_.setAttribute("aria-label", "Captions Menu") } return f(b, a), b.prototype.buildCSSClass = function () { return "vjs-captions-button " + a.prototype.buildCSSClass.call(this) }, b.prototype.update = function () { var b = 2; a.prototype.update.call(this), this.player().tech_ && this.player().tech_.featuresNativeTextTracks && (b = 1), this.items && this.items.length > b ? this.show() : this.hide() }, b.prototype.createItems = function () { var b = []; return this.player().tech_ && this.player().tech_.featuresNativeTextTracks || b.push(new l["default"](this.player_, { kind: this.kind_ })), a.prototype.createItems.call(this, b) }, b }(h["default"]); m.prototype.kind_ = "captions", m.prototype.controlText_ = "Captions", j["default"].registerComponent("CaptionsButton", m), c["default"] = m, b.exports = c["default"] }, { "../../component.js": 67, "./caption-settings-menu-item.js": 85, "./text-track-button.js": 92 }], 87: [function (a, b, c) { "use strict"; function d(a) { if (a && a.__esModule) return a; var b = {}; if (null != a) for (var c in a) Object.prototype.hasOwnProperty.call(a, c) && (b[c] = a[c]); return b["default"] = a, b } function e(a) { return a && a.__esModule ? a : { "default": a } } function f(a, b) { if (!(a instanceof b)) throw new TypeError("Cannot call a class as a function") } function g(a, b) { if ("function" != typeof b && null !== b) throw new TypeError("Super expression must either be null or a function, not " + typeof b); a.prototype = Object.create(b && b.prototype, { constructor: { value: a, enumerable: !1, writable: !0, configurable: !0 } }), b && (Object.setPrototypeOf ? Object.setPrototypeOf(a, b) : a.__proto__ = b) } c.__esModule = !0; var h = a("./text-track-button.js"), i = e(h), j = a("../../component.js"), k = e(j), l = a("./text-track-menu-item.js"), m = e(l), n = a("./chapters-track-menu-item.js"), o = e(n), p = a("../../menu/menu.js"), q = e(p), r = a("../../utils/dom.js"), s = d(r), t = a("../../utils/fn.js"), u = (d(t), a("../../utils/to-title-case.js")), v = e(u), w = a("global/window"), x = (e(w), function (a) { function b(c, d, e) { f(this, b), a.call(this, c, d, e), this.el_.setAttribute("aria-label", "Chapters Menu") } return g(b, a), b.prototype.buildCSSClass = function () { return "vjs-chapters-button " + a.prototype.buildCSSClass.call(this) }, b.prototype.createItems = function () { var a = [], b = this.player_.textTracks(); if (!b) return a; for (var c = 0; c < b.length; c++) { var d = b[c]; d.kind === this.kind_ && a.push(new m["default"](this.player_, { track: d })) } return a }, b.prototype.createMenu = function () { for (var a = this, b = this.player_.textTracks() || [], c = void 0, d = this.items || [], e = b.length - 1; e >= 0; e--) { var f = b[e]; if (f.kind === this.kind_) { c = f; break } } var g = this.menu; if (void 0 === g) { g = new q["default"](this.player_); var h = s.createEl("li", { className: "vjs-menu-title", innerHTML: v["default"](this.kind_), tabIndex: -1 }); g.children_.unshift(h), s.insertElFirst(h, g.contentEl()) } else d.forEach(function (a) { return g.removeChild(a) }), d = []; if (c && null == c.cues) { c.mode = "hidden"; var i = this.player_.remoteTextTrackEls().getTrackElementByTrack_(c); i && i.addEventListener("load", function () { return a.update() }) } if (c && c.cues && c.cues.length > 0) for (var j = c.cues, k = void 0, e = 0, l = j.length; l > e; e++) { k = j[e]; var m = new o["default"](this.player_, { track: c, cue: k }); d.push(m), g.addChild(m) } return d.length > 0 && this.show(), this.items = d, g }, b }(i["default"])); x.prototype.kind_ = "chapters", x.prototype.controlText_ = "Chapters", k["default"].registerComponent("ChaptersButton", x), c["default"] = x, b.exports = c["default"] }, { "../../component.js": 67, "../../menu/menu.js": 111, "../../utils/dom.js": 142, "../../utils/fn.js": 144, "../../utils/to-title-case.js": 151, "./chapters-track-menu-item.js": 88, "./text-track-button.js": 92, "./text-track-menu-item.js": 93, "global/window": 2 }], 88: [function (a, b, c) { "use strict"; function d(a) { if (a && a.__esModule) return a; var b = {}; if (null != a) for (var c in a) Object.prototype.hasOwnProperty.call(a, c) && (b[c] = a[c]); return b["default"] = a, b } function e(a) { return a && a.__esModule ? a : { "default": a } } function f(a, b) { if (!(a instanceof b)) throw new TypeError("Cannot call a class as a function") } function g(a, b) { if ("function" != typeof b && null !== b) throw new TypeError("Super expression must either be null or a function, not " + typeof b); a.prototype = Object.create(b && b.prototype, { constructor: { value: a, enumerable: !1, writable: !0, configurable: !0 } }), b && (Object.setPrototypeOf ? Object.setPrototypeOf(a, b) : a.__proto__ = b) } c.__esModule = !0; var h = a("../../menu/menu-item.js"), i = e(h), j = a("../../component.js"), k = e(j), l = a("../../utils/fn.js"), m = d(l), n = function (a) { function b(c, d) { f(this, b); var e = d.track, g = d.cue, h = c.currentTime(); d.label = g.text, d.selected = g.startTime <= h && h < g.endTime, a.call(this, c, d), this.track = e, this.cue = g, e.addEventListener("cuechange", m.bind(this, this.update)) } return g(b, a), b.prototype.handleClick = function () { a.prototype.handleClick.call(this), this.player_.currentTime(this.cue.startTime), this.update(this.cue.startTime) }, b.prototype.update = function () { var a = this.cue, b = this.player_.currentTime(); this.selected(a.startTime <= b && b < a.endTime) }, b }(i["default"]); k["default"].registerComponent("ChaptersTrackMenuItem", n), c["default"] = n, b.exports = c["default"] }, { "../../component.js": 67, "../../menu/menu-item.js": 110, "../../utils/fn.js": 144 }], 89: [function (a, b, c) { "use strict"; function d(a) { if (a && a.__esModule) return a; var b = {}; if (null != a) for (var c in a) Object.prototype.hasOwnProperty.call(a, c) && (b[c] = a[c]); return b["default"] = a, b } function e(a) { return a && a.__esModule ? a : { "default": a } } function f(a, b) { if (!(a instanceof b)) throw new TypeError("Cannot call a class as a function") } function g(a, b) { if ("function" != typeof b && null !== b) throw new TypeError("Super expression must either be null or a function, not " + typeof b); a.prototype = Object.create(b && b.prototype, { constructor: { value: a, enumerable: !1, writable: !0, configurable: !0 } }), b && (Object.setPrototypeOf ? Object.setPrototypeOf(a, b) : a.__proto__ = b) } c.__esModule = !0; var h = a("./text-track-button.js"), i = e(h), j = a("../../component.js"), k = e(j), l = a("../../utils/fn.js"), m = d(l), n = function (a) { function b(c, d, e) { var g = this; f(this, b), a.call(this, c, d, e), this.el_.setAttribute("aria-label", "Descriptions Menu"); var h = c.textTracks(); h && !function () { var a = m.bind(g, g.handleTracksChange); h.addEventListener("change", a), g.on("dispose", function () { h.removeEventListener("change", a) }) }() } return g(b, a), b.prototype.handleTracksChange = function () { for (var a = this.player().textTracks(), b = !1, c = 0, d = a.length; d > c; c++) { var e = a[c]; if (e.kind !== this.kind_ && "showing" === e.mode) { b = !0; break } } b ? this.disable() : this.enable() }, b.prototype.buildCSSClass = function () { return "vjs-descriptions-button " + a.prototype.buildCSSClass.call(this) }, b }(i["default"]); n.prototype.kind_ = "descriptions", n.prototype.controlText_ = "Descriptions", k["default"].registerComponent("DescriptionsButton", n), c["default"] = n, b.exports = c["default"] }, { "../../component.js": 67, "../../utils/fn.js": 144, "./text-track-button.js": 92 }], 90: [function (a, b, c) { "use strict"; function d(a) { return a && a.__esModule ? a : { "default": a } } function e(a, b) { if (!(a instanceof b)) throw new TypeError("Cannot call a class as a function") } function f(a, b) { if ("function" != typeof b && null !== b) throw new TypeError("Super expression must either be null or a function, not " + typeof b); a.prototype = Object.create(b && b.prototype, { constructor: { value: a, enumerable: !1, writable: !0, configurable: !0 } }), b && (Object.setPrototypeOf ? Object.setPrototypeOf(a, b) : a.__proto__ = b) } c.__esModule = !0; var g = a("./text-track-menu-item.js"), h = d(g), i = a("../../component.js"), j = d(i), k = function (a) { function b(c, d) { e(this, b), d.track = { kind: d.kind, player: c, label: d.kind + " off", "default": !1, mode: "disabled" }, d.selectable = !0, a.call(this, c, d), this.selected(!0) } return f(b, a), b.prototype.handleTracksChange = function () { for (var a = this.player().textTracks(), b = !0, c = 0, d = a.length; d > c; c++) { var e = a[c]; if (e.kind === this.track.kind && "showing" === e.mode) { b = !1; break } } this.selected(b) }, b }(h["default"]); j["default"].registerComponent("OffTextTrackMenuItem", k), c["default"] = k, b.exports = c["default"] }, { "../../component.js": 67, "./text-track-menu-item.js": 93 }], 91: [function (a, b, c) { "use strict"; function d(a) { return a && a.__esModule ? a : { "default": a } } function e(a, b) { if (!(a instanceof b)) throw new TypeError("Cannot call a class as a function") } function f(a, b) { if ("function" != typeof b && null !== b) throw new TypeError("Super expression must either be null or a function, not " + typeof b); a.prototype = Object.create(b && b.prototype, { constructor: { value: a, enumerable: !1, writable: !0, configurable: !0 } }), b && (Object.setPrototypeOf ? Object.setPrototypeOf(a, b) : a.__proto__ = b) } c.__esModule = !0; var g = a("./text-track-button.js"), h = d(g), i = a("../../component.js"), j = d(i), k = function (a) { function b(c, d, f) { e(this, b), a.call(this, c, d, f), this.el_.setAttribute("aria-label", "Subtitles Menu") } return f(b, a), b.prototype.buildCSSClass = function () { return "vjs-subtitles-button " + a.prototype.buildCSSClass.call(this) }, b }(h["default"]); k.prototype.kind_ = "subtitles", k.prototype.controlText_ = "Subtitles", j["default"].registerComponent("SubtitlesButton", k), c["default"] = k, b.exports = c["default"] }, { "../../component.js": 67, "./text-track-button.js": 92 }], 92: [function (a, b, c) { "use strict"; function d(a) { if (a && a.__esModule) return a; var b = {}; if (null != a) for (var c in a) Object.prototype.hasOwnProperty.call(a, c) && (b[c] = a[c]); return b["default"] = a, b } function e(a) { return a && a.__esModule ? a : { "default": a } } function f(a, b) { if (!(a instanceof b)) throw new TypeError("Cannot call a class as a function") } function g(a, b) { if ("function" != typeof b && null !== b) throw new TypeError("Super expression must either be null or a function, not " + typeof b); a.prototype = Object.create(b && b.prototype, { constructor: { value: a, enumerable: !1, writable: !0, configurable: !0 } }), b && (Object.setPrototypeOf ? Object.setPrototypeOf(a, b) : a.__proto__ = b) } c.__esModule = !0; var h = a("../track-button.js"), i = e(h), j = a("../../component.js"), k = e(j), l = a("../../utils/fn.js"), m = (d(l), a("./text-track-menu-item.js")), n = e(m), o = a("./off-text-track-menu-item.js"), p = e(o), q = function (a) { function b(c) { var d = arguments.length <= 1 || void 0 === arguments[1] ? {} : arguments[1]; f(this, b), d.tracks = c.textTracks(), a.call(this, c, d) } return g(b, a), b.prototype.createItems = function () { var a = arguments.length <= 0 || void 0 === arguments[0] ? [] : arguments[0]; a.push(new p["default"](this.player_, { kind: this.kind_ })); var b = this.player_.textTracks(); if (!b) return a; for (var c = 0; c < b.length; c++) { var d = b[c]; d.kind === this.kind_ && a.push(new n["default"](this.player_, { selectable: !0, track: d })) } return a }, b }(i["default"]); k["default"].registerComponent("TextTrackButton", q), c["default"] = q, b.exports = c["default"] }, { "../../component.js": 67, "../../utils/fn.js": 144, "../track-button.js": 98, "./off-text-track-menu-item.js": 90, "./text-track-menu-item.js": 93 }], 93: [function (a, b, c) { "use strict"; function d(a) { if (a && a.__esModule) return a; var b = {}; if (null != a) for (var c in a) Object.prototype.hasOwnProperty.call(a, c) && (b[c] = a[c]); return b["default"] = a, b } function e(a) { return a && a.__esModule ? a : { "default": a } } function f(a, b) { if (!(a instanceof b)) throw new TypeError("Cannot call a class as a function") } function g(a, b) { if ("function" != typeof b && null !== b) throw new TypeError("Super expression must either be null or a function, not " + typeof b); a.prototype = Object.create(b && b.prototype, { constructor: { value: a, enumerable: !1, writable: !0, configurable: !0 } }), b && (Object.setPrototypeOf ? Object.setPrototypeOf(a, b) : a.__proto__ = b) } c.__esModule = !0; var h = a("../../menu/menu-item.js"), i = e(h), j = a("../../component.js"), k = e(j), l = a("../../utils/fn.js"), m = d(l), n = a("global/window"), o = e(n), p = a("global/document"), q = e(p), r = function (a) { function b(c, d) { var e = this; f(this, b); var g = d.track, h = c.textTracks(); d.label = g.label || g.language || "Unknown", d.selected = g["default"] || "showing" === g.mode, a.call(this, c, d), this.track = g, h && !function () { var a = m.bind(e, e.handleTracksChange); h.addEventListener("change", a), e.on("dispose", function () { h.removeEventListener("change", a) }) }(), h && void 0 === h.onchange && !function () { var a = void 0; e.on(["tap", "click"], function () { if ("object" != typeof o["default"].Event) try { a = new o["default"].Event("change") } catch (b) { } a || (a = q["default"].createEvent("Event"), a.initEvent("change", !0, !0)), h.dispatchEvent(a) }) }() } return g(b, a), b.prototype.handleClick = function (b) { var c = this.track.kind, d = this.player_.textTracks(); if (a.prototype.handleClick.call(this, b), d) for (var e = 0; e < d.length; e++) { var f = d[e]; f.kind === c && (f.mode = f === this.track ? "showing" : "disabled") } }, b.prototype.handleTracksChange = function () { this.selected("showing" === this.track.mode) }, b }(i["default"]); k["default"].registerComponent("TextTrackMenuItem", r), c["default"] = r, b.exports = c["default"] }, { "../../component.js": 67, "../../menu/menu-item.js": 110, "../../utils/fn.js": 144, "global/document": 1, "global/window": 2 }], 94: [function (a, b, c) { "use strict"; function d(a) { if (a && a.__esModule) return a; var b = {}; if (null != a) for (var c in a) Object.prototype.hasOwnProperty.call(a, c) && (b[c] = a[c]); return b["default"] = a, b } function e(a) { return a && a.__esModule ? a : { "default": a } } function f(a, b) { if (!(a instanceof b)) throw new TypeError("Cannot call a class as a function") } function g(a, b) { if ("function" != typeof b && null !== b) throw new TypeError("Super expression must either be null or a function, not " + typeof b); a.prototype = Object.create(b && b.prototype, { constructor: { value: a, enumerable: !1, writable: !0, configurable: !0 } }), b && (Object.setPrototypeOf ? Object.setPrototypeOf(a, b) : a.__proto__ = b) } c.__esModule = !0; var h = a("../../component.js"), i = e(h), j = a("../../utils/dom.js"), k = d(j), l = a("../../utils/format-time.js"), m = e(l), n = function (a) { function b(c, d) { f(this, b), a.call(this, c, d), this.on(c, "timeupdate", this.updateContent) } return g(b, a), b.prototype.createEl = function () { var b = a.prototype.createEl.call(this, "div", { className: "vjs-current-time vjs-time-control vjs-control" }); return this.contentEl_ = k.createEl("div", { className: "vjs-current-time-display", innerHTML: '<span class="vjs-control-text">Current Time </span>0:00' }, { "aria-live": "off" }), b.appendChild(this.contentEl_), b }, b.prototype.updateContent = function () { var a = this.player_.scrubbing() ? this.player_.getCache().currentTime : this.player_.currentTime(), b = this.localize("Current Time"), c = m["default"](a, this.player_.duration()); c !== this.formattedTime_ && (this.formattedTime_ = c, this.contentEl_.innerHTML = '<span class="vjs-control-text">' + b + "</span> " + c) }, b }(i["default"]); i["default"].registerComponent("CurrentTimeDisplay", n), c["default"] = n, b.exports = c["default"] }, { "../../component.js": 67, "../../utils/dom.js": 142, "../../utils/format-time.js": 145 }], 95: [function (a, b, c) { "use strict"; function d(a) { if (a && a.__esModule) return a; var b = {}; if (null != a) for (var c in a) Object.prototype.hasOwnProperty.call(a, c) && (b[c] = a[c]); return b["default"] = a, b } function e(a) { return a && a.__esModule ? a : { "default": a } } function f(a, b) { if (!(a instanceof b)) throw new TypeError("Cannot call a class as a function") } function g(a, b) { if ("function" != typeof b && null !== b) throw new TypeError("Super expression must either be null or a function, not " + typeof b); a.prototype = Object.create(b && b.prototype, { constructor: { value: a, enumerable: !1, writable: !0, configurable: !0 } }), b && (Object.setPrototypeOf ? Object.setPrototypeOf(a, b) : a.__proto__ = b) } c.__esModule = !0; var h = a("../../component.js"), i = e(h), j = a("../../utils/dom.js"), k = d(j), l = a("../../utils/format-time.js"), m = e(l), n = function (a) { function b(c, d) { f(this, b), a.call(this, c, d), this.on(c, "durationchange", this.updateContent) } return g(b, a), b.prototype.createEl = function () { var b = a.prototype.createEl.call(this, "div", { className: "vjs-duration vjs-time-control vjs-control" }); return this.contentEl_ = k.createEl("div", { className: "vjs-duration-display", innerHTML: '<span class="vjs-control-text">' + this.localize("Duration Time") + "</span> 0:00" }, { "aria-live": "off" }), b.appendChild(this.contentEl_), b }, b.prototype.updateContent = function () { var a = this.player_.duration(); if (a && this.duration_ !== a) { this.duration_ = a; var b = this.localize("Duration Time"), c = m["default"](a); this.contentEl_.innerHTML = '<span class="vjs-control-text">' + b + "</span> " + c } }, b }(i["default"]); i["default"].registerComponent("DurationDisplay", n), c["default"] = n, b.exports = c["default"] }, { "../../component.js": 67, "../../utils/dom.js": 142, "../../utils/format-time.js": 145 }], 96: [function (a, b, c) { "use strict"; function d(a) { if (a && a.__esModule) return a; var b = {}; if (null != a) for (var c in a) Object.prototype.hasOwnProperty.call(a, c) && (b[c] = a[c]); return b["default"] = a, b } function e(a) { return a && a.__esModule ? a : { "default": a } } function f(a, b) { if (!(a instanceof b)) throw new TypeError("Cannot call a class as a function") } function g(a, b) { if ("function" != typeof b && null !== b) throw new TypeError("Super expression must either be null or a function, not " + typeof b); a.prototype = Object.create(b && b.prototype, { constructor: { value: a, enumerable: !1, writable: !0, configurable: !0 } }), b && (Object.setPrototypeOf ? Object.setPrototypeOf(a, b) : a.__proto__ = b) } c.__esModule = !0; var h = a("../../component.js"), i = e(h), j = a("../../utils/dom.js"), k = d(j), l = a("../../utils/format-time.js"), m = e(l), n = function (a) { function b(c, d) { f(this, b), a.call(this, c, d), this.on(c, "timeupdate", this.updateContent), this.on(c, "durationchange", this.updateContent) } return g(b, a), b.prototype.createEl = function () { var b = a.prototype.createEl.call(this, "div", { className: "vjs-remaining-time vjs-time-control vjs-control" }); return this.contentEl_ = k.createEl("div", { className: "vjs-remaining-time-display", innerHTML: '<span class="vjs-control-text">' + this.localize("Remaining Time") + "</span> -0:00" }, { "aria-live": "off" }), b.appendChild(this.contentEl_), b }, b.prototype.updateContent = function () { if (this.player_.duration()) { var a = this.localize("Remaining Time"), b = m["default"](this.player_.remainingTime()); b !== this.formattedTime_ && (this.formattedTime_ = b, this.contentEl_.innerHTML = '<span class="vjs-control-text">' + a + "</span> -" + b) } }, b }(i["default"]); i["default"].registerComponent("RemainingTimeDisplay", n), c["default"] = n, b.exports = c["default"] }, { "../../component.js": 67, "../../utils/dom.js": 142, "../../utils/format-time.js": 145 }], 97: [function (a, b, c) { "use strict"; function d(a) { return a && a.__esModule ? a : { "default": a } } function e(a, b) { if (!(a instanceof b)) throw new TypeError("Cannot call a class as a function") } function f(a, b) { if ("function" != typeof b && null !== b) throw new TypeError("Super expression must either be null or a function, not " + typeof b); a.prototype = Object.create(b && b.prototype, { constructor: { value: a, enumerable: !1, writable: !0, configurable: !0 } }), b && (Object.setPrototypeOf ? Object.setPrototypeOf(a, b) : a.__proto__ = b) } c.__esModule = !0; var g = a("../../component.js"), h = d(g), i = function (a) { function b() { e(this, b), a.apply(this, arguments) } return f(b, a), b.prototype.createEl = function () { return a.prototype.createEl.call(this, "div", { className: "vjs-time-control vjs-time-divider", innerHTML: "<div><span>/</span></div>" }) }, b }(h["default"]); h["default"].registerComponent("TimeDivider", i), c["default"] = i, b.exports = c["default"] }, { "../../component.js": 67 }], 98: [function (a, b, c) {
            "use strict"; function d(a) { if (a && a.__esModule) return a; var b = {}; if (null != a) for (var c in a) Object.prototype.hasOwnProperty.call(a, c) && (b[c] = a[c]); return b["default"] = a, b } function e(a) { return a && a.__esModule ? a : { "default": a } } function f(a, b) { if (!(a instanceof b)) throw new TypeError("Cannot call a class as a function") } function g(a, b) { if ("function" != typeof b && null !== b) throw new TypeError("Super expression must either be null or a function, not " + typeof b); a.prototype = Object.create(b && b.prototype, { constructor: { value: a, enumerable: !1, writable: !0, configurable: !0 } }), b && (Object.setPrototypeOf ? Object.setPrototypeOf(a, b) : a.__proto__ = b) } c.__esModule = !0; var h = a("../menu/menu-button.js"), i = e(h), j = a("../component.js"), k = e(j), l = a("../utils/fn.js"), m = d(l), n = function (a) {
                function b(c, d) {
                    f(this, b); var e = d.tracks; if (a.call(this, c, d), this.items.length <= 1 && this.hide(), e) {
                        var g = m.bind(this, this.update); e.addEventListener("removetrack", g), e.addEventListener("addtrack", g), this.player_.on("dispose", function () {
                            e.removeEventListener("removetrack", g), e.removeEventListener("addtrack", g)
                        })
                    }
                } return g(b, a), b
            }(i["default"]); k["default"].registerComponent("TrackButton", n), c["default"] = n, b.exports = c["default"]
        }, { "../component.js": 67, "../menu/menu-button.js": 109, "../utils/fn.js": 144 }], 99: [function (a, b, c) { "use strict"; function d(a) { if (a && a.__esModule) return a; var b = {}; if (null != a) for (var c in a) Object.prototype.hasOwnProperty.call(a, c) && (b[c] = a[c]); return b["default"] = a, b } function e(a) { return a && a.__esModule ? a : { "default": a } } function f(a, b) { if (!(a instanceof b)) throw new TypeError("Cannot call a class as a function") } function g(a, b) { if ("function" != typeof b && null !== b) throw new TypeError("Super expression must either be null or a function, not " + typeof b); a.prototype = Object.create(b && b.prototype, { constructor: { value: a, enumerable: !1, writable: !0, configurable: !0 } }), b && (Object.setPrototypeOf ? Object.setPrototypeOf(a, b) : a.__proto__ = b) } c.__esModule = !0; var h = a("../../slider/slider.js"), i = e(h), j = a("../../component.js"), k = e(j), l = a("../../utils/fn.js"), m = d(l), n = a("./volume-level.js"), o = (e(n), function (a) { function b(c, d) { f(this, b), a.call(this, c, d), this.on(c, "volumechange", this.updateARIAAttributes), c.ready(m.bind(this, this.updateARIAAttributes)) } return g(b, a), b.prototype.createEl = function () { return a.prototype.createEl.call(this, "div", { className: "vjs-volume-bar vjs-slider-bar" }, { "aria-label": "volume level" }) }, b.prototype.handleMouseMove = function (a) { this.checkMuted(), this.player_.volume(this.calculateDistance(a)) }, b.prototype.checkMuted = function () { this.player_.muted() && this.player_.muted(!1) }, b.prototype.getPercent = function () { return this.player_.muted() ? 0 : this.player_.volume() }, b.prototype.stepForward = function () { this.checkMuted(), this.player_.volume(this.player_.volume() + .1) }, b.prototype.stepBack = function () { this.checkMuted(), this.player_.volume(this.player_.volume() - .1) }, b.prototype.updateARIAAttributes = function () { var a = (100 * this.player_.volume()).toFixed(2); this.el_.setAttribute("aria-valuenow", a), this.el_.setAttribute("aria-valuetext", a + "%") }, b }(i["default"])); o.prototype.options_ = { children: ["volumeLevel"], barName: "volumeLevel" }, o.prototype.playerEvent = "volumechange", k["default"].registerComponent("VolumeBar", o), c["default"] = o, b.exports = c["default"] }, { "../../component.js": 67, "../../slider/slider.js": 119, "../../utils/fn.js": 144, "./volume-level.js": 101 }], 100: [function (a, b, c) { "use strict"; function d(a) { return a && a.__esModule ? a : { "default": a } } function e(a, b) { if (!(a instanceof b)) throw new TypeError("Cannot call a class as a function") } function f(a, b) { if ("function" != typeof b && null !== b) throw new TypeError("Super expression must either be null or a function, not " + typeof b); a.prototype = Object.create(b && b.prototype, { constructor: { value: a, enumerable: !1, writable: !0, configurable: !0 } }), b && (Object.setPrototypeOf ? Object.setPrototypeOf(a, b) : a.__proto__ = b) } c.__esModule = !0; var g = a("../../component.js"), h = d(g), i = a("./volume-bar.js"), j = (d(i), function (a) { function b(c, d) { e(this, b), a.call(this, c, d), c.tech_ && c.tech_.featuresVolumeControl === !1 && this.addClass("vjs-hidden"), this.on(c, "loadstart", function () { c.tech_.featuresVolumeControl === !1 ? this.addClass("vjs-hidden") : this.removeClass("vjs-hidden") }) } return f(b, a), b.prototype.createEl = function () { return a.prototype.createEl.call(this, "div", { className: "vjs-volume-control vjs-control" }) }, b }(h["default"])); j.prototype.options_ = { children: ["volumeBar"] }, h["default"].registerComponent("VolumeControl", j), c["default"] = j, b.exports = c["default"] }, { "../../component.js": 67, "./volume-bar.js": 99 }], 101: [function (a, b, c) { "use strict"; function d(a) { return a && a.__esModule ? a : { "default": a } } function e(a, b) { if (!(a instanceof b)) throw new TypeError("Cannot call a class as a function") } function f(a, b) { if ("function" != typeof b && null !== b) throw new TypeError("Super expression must either be null or a function, not " + typeof b); a.prototype = Object.create(b && b.prototype, { constructor: { value: a, enumerable: !1, writable: !0, configurable: !0 } }), b && (Object.setPrototypeOf ? Object.setPrototypeOf(a, b) : a.__proto__ = b) } c.__esModule = !0; var g = a("../../component.js"), h = d(g), i = function (a) { function b() { e(this, b), a.apply(this, arguments) } return f(b, a), b.prototype.createEl = function () { return a.prototype.createEl.call(this, "div", { className: "vjs-volume-level", innerHTML: '<span class="vjs-control-text"></span>' }) }, b }(h["default"]); h["default"].registerComponent("VolumeLevel", i), c["default"] = i, b.exports = c["default"] }, { "../../component.js": 67 }], 102: [function (a, b, c) { "use strict"; function d(a) { return a && a.__esModule ? a : { "default": a } } function e(a) { if (a && a.__esModule) return a; var b = {}; if (null != a) for (var c in a) Object.prototype.hasOwnProperty.call(a, c) && (b[c] = a[c]); return b["default"] = a, b } function f(a, b) { if (!(a instanceof b)) throw new TypeError("Cannot call a class as a function") } function g(a, b) { if ("function" != typeof b && null !== b) throw new TypeError("Super expression must either be null or a function, not " + typeof b); a.prototype = Object.create(b && b.prototype, { constructor: { value: a, enumerable: !1, writable: !0, configurable: !0 } }), b && (Object.setPrototypeOf ? Object.setPrototypeOf(a, b) : a.__proto__ = b) } c.__esModule = !0; var h = a("../utils/fn.js"), i = e(h), j = a("../component.js"), k = d(j), l = a("../popup/popup.js"), m = d(l), n = a("../popup/popup-button.js"), o = d(n), p = a("./mute-toggle.js"), q = d(p), r = a("./volume-control/volume-bar.js"), s = d(r), t = function (a) { function b(c) { function d() { c.tech_ && c.tech_.featuresVolumeControl === !1 ? this.addClass("vjs-hidden") : this.removeClass("vjs-hidden") } var e = arguments.length <= 1 || void 0 === arguments[1] ? {} : arguments[1]; f(this, b), void 0 === e.inline && (e.inline = !0), void 0 === e.vertical && (e.vertical = e.inline ? !1 : !0), e.volumeBar = e.volumeBar || {}, e.volumeBar.vertical = !!e.vertical, a.call(this, c, e), this.on(c, "volumechange", this.volumeUpdate), this.on(c, "loadstart", this.volumeUpdate), d.call(this), this.on(c, "loadstart", d), this.on(this.volumeBar, ["slideractive", "focus"], function () { this.addClass("vjs-slider-active") }), this.on(this.volumeBar, ["sliderinactive", "blur"], function () { this.removeClass("vjs-slider-active") }), this.on(this.volumeBar, ["focus"], function () { this.addClass("vjs-lock-showing") }), this.on(this.volumeBar, ["blur"], function () { this.removeClass("vjs-lock-showing") }) } return g(b, a), b.prototype.buildCSSClass = function () { var b = ""; return b = this.options_.vertical ? "vjs-volume-menu-button-vertical" : "vjs-volume-menu-button-horizontal", "vjs-volume-menu-button " + a.prototype.buildCSSClass.call(this) + " " + b }, b.prototype.createPopup = function () { var a = new m["default"](this.player_, { contentElType: "div" }), b = new s["default"](this.player_, this.options_.volumeBar); return a.addChild(b), this.menuContent = a, this.volumeBar = b, this.attachVolumeBarEvents(), a }, b.prototype.handleClick = function () { q["default"].prototype.handleClick.call(this), a.prototype.handleClick.call(this) }, b.prototype.attachVolumeBarEvents = function () { this.menuContent.on(["mousedown", "touchdown"], i.bind(this, this.handleMouseDown)) }, b.prototype.handleMouseDown = function () { this.on(["mousemove", "touchmove"], i.bind(this.volumeBar, this.volumeBar.handleMouseMove)), this.on(this.el_.ownerDocument, ["mouseup", "touchend"], this.handleMouseUp) }, b.prototype.handleMouseUp = function () { this.off(["mousemove", "touchmove"], i.bind(this.volumeBar, this.volumeBar.handleMouseMove)) }, b }(o["default"]); t.prototype.volumeUpdate = q["default"].prototype.update, t.prototype.controlText_ = "Mute", k["default"].registerComponent("VolumeMenuButton", t), c["default"] = t, b.exports = c["default"] }, { "../component.js": 67, "../popup/popup-button.js": 115, "../popup/popup.js": 116, "../utils/fn.js": 144, "./mute-toggle.js": 73, "./volume-control/volume-bar.js": 99 }], 103: [function (a, b, c) { "use strict"; function d(a) { if (a && a.__esModule) return a; var b = {}; if (null != a) for (var c in a) Object.prototype.hasOwnProperty.call(a, c) && (b[c] = a[c]); return b["default"] = a, b } function e(a) { return a && a.__esModule ? a : { "default": a } } function f(a, b) { if (!(a instanceof b)) throw new TypeError("Cannot call a class as a function") } function g(a, b) { if ("function" != typeof b && null !== b) throw new TypeError("Super expression must either be null or a function, not " + typeof b); a.prototype = Object.create(b && b.prototype, { constructor: { value: a, enumerable: !1, writable: !0, configurable: !0 } }), b && (Object.setPrototypeOf ? Object.setPrototypeOf(a, b) : a.__proto__ = b) } c.__esModule = !0; var h = a("./component"), i = e(h), j = a("./modal-dialog"), k = e(j), l = a("./utils/dom"), m = (d(l), a("./utils/merge-options")), n = e(m), o = function (a) { function b(c, d) { f(this, b), a.call(this, c, d), this.on(c, "error", this.open) } return g(b, a), b.prototype.buildCSSClass = function () { return "vjs-error-display " + a.prototype.buildCSSClass.call(this) }, b.prototype.content = function () { var a = this.player().error(); return a ? this.localize(a.message) : "" }, b }(k["default"]); o.prototype.options_ = n["default"](k["default"].prototype.options_, { fillAlways: !0, temporary: !1, uncloseable: !0 }), i["default"].registerComponent("ErrorDisplay", o), c["default"] = o, b.exports = c["default"] }, { "./component": 67, "./modal-dialog": 112, "./utils/dom": 142, "./utils/merge-options": 148 }], 104: [function (a, b, c) { "use strict"; function d(a) { if (a && a.__esModule) return a; var b = {}; if (null != a) for (var c in a) Object.prototype.hasOwnProperty.call(a, c) && (b[c] = a[c]); return b["default"] = a, b } c.__esModule = !0; var e = a("./utils/events.js"), f = d(e), g = function () { }; g.prototype.allowedEvents_ = {}, g.prototype.on = function (a, b) { var c = this.addEventListener; this.addEventListener = function () { }, f.on(this, a, b), this.addEventListener = c }, g.prototype.addEventListener = g.prototype.on, g.prototype.off = function (a, b) { f.off(this, a, b) }, g.prototype.removeEventListener = g.prototype.off, g.prototype.one = function (a, b) { var c = this.addEventListener; this.addEventListener = function () { }, f.one(this, a, b), this.addEventListener = c }, g.prototype.trigger = function (a) { var b = a.type || a; "string" == typeof a && (a = { type: b }), a = f.fixEvent(a), this.allowedEvents_[b] && this["on" + b] && this["on" + b](a), f.trigger(this, a) }, g.prototype.dispatchEvent = g.prototype.trigger, c["default"] = g, b.exports = c["default"] }, { "./utils/events.js": 143 }], 105: [function (a, b, c) { "use strict"; function d(a) { return a && a.__esModule ? a : { "default": a } } c.__esModule = !0; var e = a("./utils/log"), f = d(e), g = function (a, b) { if ("function" != typeof b && null !== b) throw new TypeError("Super expression must either be null or a function, not " + typeof b); a.prototype = Object.create(b && b.prototype, { constructor: { value: a, enumerable: !1, writable: !0, configurable: !0 } }), b && (a.super_ = b) }, h = function (a) { var b = arguments.length <= 1 || void 0 === arguments[1] ? {} : arguments[1], c = function () { a.apply(this, arguments) }, d = {}; "object" == typeof b ? ("function" == typeof b.init && (f["default"].warn("Constructor logic via init() is deprecated; please use constructor() instead."), b.constructor = b.init), b.constructor !== Object.prototype.constructor && (c = b.constructor), d = b) : "function" == typeof b && (c = b), g(c, a); for (var e in d) d.hasOwnProperty(e) && (c.prototype[e] = d[e]); return c }; c["default"] = h, b.exports = c["default"] }, { "./utils/log": 147 }], 106: [function (a, b, c) { "use strict"; function d(a) { return a && a.__esModule ? a : { "default": a } } c.__esModule = !0; for (var e = a("global/document"), f = d(e), g = {}, h = [["requestFullscreen", "exitFullscreen", "fullscreenElement", "fullscreenEnabled", "fullscreenchange", "fullscreenerror"], ["webkitRequestFullscreen", "webkitExitFullscreen", "webkitFullscreenElement", "webkitFullscreenEnabled", "webkitfullscreenchange", "webkitfullscreenerror"], ["webkitRequestFullScreen", "webkitCancelFullScreen", "webkitCurrentFullScreenElement", "webkitCancelFullScreen", "webkitfullscreenchange", "webkitfullscreenerror"], ["mozRequestFullScreen", "mozCancelFullScreen", "mozFullScreenElement", "mozFullScreenEnabled", "mozfullscreenchange", "mozfullscreenerror"], ["msRequestFullscreen", "msExitFullscreen", "msFullscreenElement", "msFullscreenEnabled", "MSFullscreenChange", "MSFullscreenError"]], i = h[0], j = void 0, k = 0; k < h.length; k++)if (h[k][1] in f["default"]) { j = h[k]; break } if (j) for (var k = 0; k < j.length; k++)g[i[k]] = j[k]; c["default"] = g, b.exports = c["default"] }, { "global/document": 1 }], 107: [function (a, b, c) { "use strict"; function d(a) { return a && a.__esModule ? a : { "default": a } } function e(a, b) { if (!(a instanceof b)) throw new TypeError("Cannot call a class as a function") } function f(a, b) { if ("function" != typeof b && null !== b) throw new TypeError("Super expression must either be null or a function, not " + typeof b); a.prototype = Object.create(b && b.prototype, { constructor: { value: a, enumerable: !1, writable: !0, configurable: !0 } }), b && (Object.setPrototypeOf ? Object.setPrototypeOf(a, b) : a.__proto__ = b) } c.__esModule = !0; var g = a("./component"), h = d(g), i = function (a) { function b() { e(this, b), a.apply(this, arguments) } return f(b, a), b.prototype.createEl = function () { return a.prototype.createEl.call(this, "div", { className: "vjs-loading-spinner", dir: "ltr" }) }, b }(h["default"]); h["default"].registerComponent("LoadingSpinner", i), c["default"] = i, b.exports = c["default"] }, { "./component": 67 }], 108: [function (a, b, c) { "use strict"; function d(a) { return a && a.__esModule ? a : { "default": a } } function e(a) { return a instanceof e ? a : ("number" == typeof a ? this.code = a : "string" == typeof a ? this.message = a : "object" == typeof a && ("number" == typeof a.code && (this.code = a.code), g["default"](this, a)), void (this.message || (this.message = e.defaultMessages[this.code] || ""))) } c.__esModule = !0; var f = a("object.assign"), g = d(f); e.prototype.code = 0, e.prototype.message = "", e.prototype.status = null, e.errorTypes = ["MEDIA_ERR_CUSTOM", "MEDIA_ERR_ABORTED", "MEDIA_ERR_NETWORK", "MEDIA_ERR_DECODE", "MEDIA_ERR_SRC_NOT_SUPPORTED", "MEDIA_ERR_ENCRYPTED"], e.defaultMessages = { 1: "You aborted the media playback", 2: "A network error caused the media download to fail part-way.", 3: "The media playback was aborted due to a corruption problem or because the media used features your browser did not support.", 4: "The media could not be loaded, either because the server or network failed or because the format is not supported.", 5: "The media is encrypted and we do not have the keys to decrypt it." }; for (var h = 0; h < e.errorTypes.length; h++)e[e.errorTypes[h]] = h, e.prototype[e.errorTypes[h]] = h; c["default"] = e, b.exports = c["default"] }, { "object.assign": 45 }], 109: [function (a, b, c) { "use strict"; function d(a) { if (a && a.__esModule) return a; var b = {}; if (null != a) for (var c in a) Object.prototype.hasOwnProperty.call(a, c) && (b[c] = a[c]); return b["default"] = a, b } function e(a) { return a && a.__esModule ? a : { "default": a } } function f(a, b) { if (!(a instanceof b)) throw new TypeError("Cannot call a class as a function") } function g(a, b) { if ("function" != typeof b && null !== b) throw new TypeError("Super expression must either be null or a function, not " + typeof b); a.prototype = Object.create(b && b.prototype, { constructor: { value: a, enumerable: !1, writable: !0, configurable: !0 } }), b && (Object.setPrototypeOf ? Object.setPrototypeOf(a, b) : a.__proto__ = b) } c.__esModule = !0; var h = a("../clickable-component.js"), i = e(h), j = a("../component.js"), k = e(j), l = a("./menu.js"), m = e(l), n = a("../utils/dom.js"), o = d(n), p = a("../utils/fn.js"), q = d(p), r = a("../utils/to-title-case.js"), s = e(r), t = function (a) { function b(c) { var d = arguments.length <= 1 || void 0 === arguments[1] ? {} : arguments[1]; f(this, b), a.call(this, c, d), this.update(), this.enabled_ = !0, this.el_.setAttribute("aria-haspopup", "true"), this.el_.setAttribute("role", "menuitem"), this.on("keydown", this.handleSubmenuKeyPress) } return g(b, a), b.prototype.update = function () { var a = this.createMenu(); this.menu && this.removeChild(this.menu), this.menu = a, this.addChild(a), this.buttonPressed_ = !1, this.el_.setAttribute("aria-expanded", "false"), this.items && 0 === this.items.length ? this.hide() : this.items && this.items.length > 1 && this.show() }, b.prototype.createMenu = function () { var a = new m["default"](this.player_); if (this.options_.title) { var b = o.createEl("li", { className: "vjs-menu-title", innerHTML: s["default"](this.options_.title), tabIndex: -1 }); a.children_.unshift(b), o.insertElFirst(b, a.contentEl()) } if (this.items = this.createItems(), this.items) for (var c = 0; c < this.items.length; c++)a.addItem(this.items[c]); return a }, b.prototype.createItems = function () { }, b.prototype.createEl = function () { return a.prototype.createEl.call(this, "div", { className: this.buildCSSClass() }) }, b.prototype.buildCSSClass = function () { var b = "vjs-menu-button"; return b += this.options_.inline === !0 ? "-inline" : "-popup", "vjs-menu-button " + b + " " + a.prototype.buildCSSClass.call(this) }, b.prototype.handleClick = function () { this.one(this.menu.contentEl(), "mouseleave", q.bind(this, function () { this.unpressButton(), this.el_.blur() })), this.buttonPressed_ ? this.unpressButton() : this.pressButton() }, b.prototype.handleKeyPress = function (b) { 27 === b.which || 9 === b.which ? (this.buttonPressed_ && this.unpressButton(), 9 !== b.which && b.preventDefault()) : 38 === b.which || 40 === b.which ? this.buttonPressed_ || (this.pressButton(), b.preventDefault()) : a.prototype.handleKeyPress.call(this, b) }, b.prototype.handleSubmenuKeyPress = function (a) { (27 === a.which || 9 === a.which) && (this.buttonPressed_ && this.unpressButton(), 9 !== a.which && a.preventDefault()) }, b.prototype.pressButton = function () { this.enabled_ && (this.buttonPressed_ = !0, this.menu.lockShowing(), this.el_.setAttribute("aria-expanded", "true"), this.menu.focus()) }, b.prototype.unpressButton = function () { this.enabled_ && (this.buttonPressed_ = !1, this.menu.unlockShowing(), this.el_.setAttribute("aria-expanded", "false"), this.el_.focus()) }, b.prototype.disable = function () { return this.buttonPressed_ = !1, this.menu.unlockShowing(), this.el_.setAttribute("aria-expanded", "false"), this.enabled_ = !1, a.prototype.disable.call(this) }, b.prototype.enable = function () { return this.enabled_ = !0, a.prototype.enable.call(this) }, b }(i["default"]); k["default"].registerComponent("MenuButton", t), c["default"] = t, b.exports = c["default"] }, { "../clickable-component.js": 65, "../component.js": 67, "../utils/dom.js": 142, "../utils/fn.js": 144, "../utils/to-title-case.js": 151, "./menu.js": 111 }], 110: [function (a, b, c) { "use strict"; function d(a) { return a && a.__esModule ? a : { "default": a } } function e(a, b) { if (!(a instanceof b)) throw new TypeError("Cannot call a class as a function") } function f(a, b) { if ("function" != typeof b && null !== b) throw new TypeError("Super expression must either be null or a function, not " + typeof b); a.prototype = Object.create(b && b.prototype, { constructor: { value: a, enumerable: !1, writable: !0, configurable: !0 } }), b && (Object.setPrototypeOf ? Object.setPrototypeOf(a, b) : a.__proto__ = b) } c.__esModule = !0; var g = a("../clickable-component.js"), h = d(g), i = a("../component.js"), j = d(i), k = a("object.assign"), l = d(k), m = function (a) { function b(c, d) { e(this, b), a.call(this, c, d), this.selectable = d.selectable, this.selected(d.selected), this.selectable ? this.el_.setAttribute("role", "menuitemcheckbox") : this.el_.setAttribute("role", "menuitem") } return f(b, a), b.prototype.createEl = function (b, c, d) { return a.prototype.createEl.call(this, "li", l["default"]({ className: "vjs-menu-item", innerHTML: this.localize(this.options_.label), tabIndex: -1 }, c), d) }, b.prototype.handleClick = function () { this.selected(!0) }, b.prototype.selected = function (a) { this.selectable && (a ? (this.addClass("vjs-selected"), this.el_.setAttribute("aria-checked", "true"), this.controlText(", selected")) : (this.removeClass("vjs-selected"), this.el_.setAttribute("aria-checked", "false"), this.controlText(" "))) }, b }(h["default"]); j["default"].registerComponent("MenuItem", m), c["default"] = m, b.exports = c["default"] }, { "../clickable-component.js": 65, "../component.js": 67, "object.assign": 45 }], 111: [function (a, b, c) { "use strict"; function d(a) { if (a && a.__esModule) return a; var b = {}; if (null != a) for (var c in a) Object.prototype.hasOwnProperty.call(a, c) && (b[c] = a[c]); return b["default"] = a, b } function e(a) { return a && a.__esModule ? a : { "default": a } } function f(a, b) { if (!(a instanceof b)) throw new TypeError("Cannot call a class as a function") } function g(a, b) { if ("function" != typeof b && null !== b) throw new TypeError("Super expression must either be null or a function, not " + typeof b); a.prototype = Object.create(b && b.prototype, { constructor: { value: a, enumerable: !1, writable: !0, configurable: !0 } }), b && (Object.setPrototypeOf ? Object.setPrototypeOf(a, b) : a.__proto__ = b) } c.__esModule = !0; var h = a("../component.js"), i = e(h), j = a("../utils/dom.js"), k = d(j), l = a("../utils/fn.js"), m = d(l), n = a("../utils/events.js"), o = d(n), p = function (a) { function b(c, d) { f(this, b), a.call(this, c, d), this.focusedChild_ = -1, this.on("keydown", this.handleKeyPress) } return g(b, a), b.prototype.addItem = function (a) { this.addChild(a), a.on("click", m.bind(this, function () { this.unlockShowing() })) }, b.prototype.createEl = function () { var b = this.options_.contentElType || "ul"; this.contentEl_ = k.createEl(b, { className: "vjs-menu-content" }), this.contentEl_.setAttribute("role", "menu"); var c = a.prototype.createEl.call(this, "div", { append: this.contentEl_, className: "vjs-menu" }); return c.setAttribute("role", "presentation"), c.appendChild(this.contentEl_), o.on(c, "click", function (a) { a.preventDefault(), a.stopImmediatePropagation() }), c }, b.prototype.handleKeyPress = function (a) { 37 === a.which || 40 === a.which ? (a.preventDefault(), this.stepForward()) : (38 === a.which || 39 === a.which) && (a.preventDefault(), this.stepBack()) }, b.prototype.stepForward = function () { var a = 0; void 0 !== this.focusedChild_ && (a = this.focusedChild_ + 1), this.focus(a) }, b.prototype.stepBack = function () { var a = 0; void 0 !== this.focusedChild_ && (a = this.focusedChild_ - 1), this.focus(a) }, b.prototype.focus = function () { var a = arguments.length <= 0 || void 0 === arguments[0] ? 0 : arguments[0], b = this.children().slice(), c = b.length && b[0].className && /vjs-menu-title/.test(b[0].className); c && b.shift(), b.length > 0 && (0 > a ? a = 0 : a >= b.length && (a = b.length - 1), this.focusedChild_ = a, b[a].el_.focus()) }, b }(i["default"]); i["default"].registerComponent("Menu", p), c["default"] = p, b.exports = c["default"] }, { "../component.js": 67, "../utils/dom.js": 142, "../utils/events.js": 143, "../utils/fn.js": 144 }], 112: [function (a, b, c) { "use strict"; function d(a) { return a && a.__esModule ? a : { "default": a } } function e(a) { if (a && a.__esModule) return a; var b = {}; if (null != a) for (var c in a) Object.prototype.hasOwnProperty.call(a, c) && (b[c] = a[c]); return b["default"] = a, b } function f(a, b) { if (!(a instanceof b)) throw new TypeError("Cannot call a class as a function") } function g(a, b) { if ("function" != typeof b && null !== b) throw new TypeError("Super expression must either be null or a function, not " + typeof b); a.prototype = Object.create(b && b.prototype, { constructor: { value: a, enumerable: !1, writable: !0, configurable: !0 } }), b && (Object.setPrototypeOf ? Object.setPrototypeOf(a, b) : a.__proto__ = b) } c.__esModule = !0; var h = a("./utils/dom"), i = e(h), j = a("./utils/fn"), k = e(j), l = a("./utils/log"), m = (d(l), a("./component")), n = d(m), o = a("./close-button"), p = (d(o), "vjs-modal-dialog"), q = 27, r = function (a) { function b(c, d) { f(this, b), a.call(this, c, d), this.opened_ = this.hasBeenOpened_ = this.hasBeenFilled_ = !1, this.closeable(!this.options_.uncloseable), this.content(this.options_.content), this.contentEl_ = i.createEl("div", { className: p + "-content" }, { role: "document" }), this.descEl_ = i.createEl("p", { className: p + "-description vjs-offscreen", id: this.el().getAttribute("aria-describedby") }), i.textContent(this.descEl_, this.description()), this.el_.appendChild(this.descEl_), this.el_.appendChild(this.contentEl_) } return g(b, a), b.prototype.createEl = function () { return a.prototype.createEl.call(this, "div", { className: this.buildCSSClass(), tabIndex: -1 }, { "aria-describedby": this.id() + "_description", "aria-hidden": "true", "aria-label": this.label(), role: "dialog" }) }, b.prototype.buildCSSClass = function () { return p + " vjs-hidden " + a.prototype.buildCSSClass.call(this) }, b.prototype.handleKeyPress = function (a) { a.which === q && this.closeable() && this.close() }, b.prototype.label = function () { return this.options_.label || this.localize("Modal Window") }, b.prototype.description = function () { var a = this.options_.description || this.localize("This is a modal window."); return this.closeable() && (a += " " + this.localize("This modal can be closed by pressing the Escape key or activating the close button.")), a }, b.prototype.open = function () { if (!this.opened_) { var a = this.player(); this.trigger("beforemodalopen"), this.opened_ = !0, (this.options_.fillAlways || !this.hasBeenOpened_ && !this.hasBeenFilled_) && this.fill(), this.wasPlaying_ = !a.paused(), this.wasPlaying_ && a.pause(), this.closeable() && this.on(this.el_.ownerDocument, "keydown", k.bind(this, this.handleKeyPress)), a.controls(!1), this.show(), this.el().setAttribute("aria-hidden", "false"), this.trigger("modalopen"), this.hasBeenOpened_ = !0 } return this }, b.prototype.opened = function (a) { return "boolean" == typeof a && this[a ? "open" : "close"](), this.opened_ }, b.prototype.close = function () { if (this.opened_) { var a = this.player(); this.trigger("beforemodalclose"), this.opened_ = !1, this.wasPlaying_ && a.play(), this.closeable() && this.off(this.el_.ownerDocument, "keydown", k.bind(this, this.handleKeyPress)), a.controls(!0), this.hide(), this.el().setAttribute("aria-hidden", "true"), this.trigger("modalclose"), this.options_.temporary && this.dispose() } return this }, b.prototype.closeable = function c(a) { if ("boolean" == typeof a) { var c = this.closeable_ = !!a, b = this.getChild("closeButton"); if (c && !b) { var d = this.contentEl_; this.contentEl_ = this.el_, b = this.addChild("closeButton", { controlText: "Close Modal Dialog" }), this.contentEl_ = d, this.on(b, "close", this.close) } !c && b && (this.off(b, "close", this.close), this.removeChild(b), b.dispose()) } return this.closeable_ }, b.prototype.fill = function () { return this.fillWith(this.content()) }, b.prototype.fillWith = function (a) { var b = this.contentEl(), c = b.parentNode, d = b.nextSibling; return this.trigger("beforemodalfill"), this.hasBeenFilled_ = !0, c.removeChild(b), this.empty(), i.insertContent(b, a), this.trigger("modalfill"), d ? c.insertBefore(b, d) : c.appendChild(b), this }, b.prototype.empty = function () { return this.trigger("beforemodalempty"), i.emptyEl(this.contentEl()), this.trigger("modalempty"), this }, b.prototype.content = function (a) { return "undefined" != typeof a && (this.content_ = a), this.content_ }, b }(n["default"]); r.prototype.options_ = { temporary: !0 }, n["default"].registerComponent("ModalDialog", r), c["default"] = r, b.exports = c["default"] }, { "./close-button": 66, "./component": 67, "./utils/dom": 142, "./utils/fn": 144, "./utils/log": 147 }], 113: [function (a, b, c) {
            "use strict"; function d(a) { if (a && a.__esModule) return a; var b = {}; if (null != a) for (var c in a) Object.prototype.hasOwnProperty.call(a, c) && (b[c] = a[c]); return b["default"] = a, b } function e(a) { return a && a.__esModule ? a : { "default": a } } function f(a, b) { if (!(a instanceof b)) throw new TypeError("Cannot call a class as a function") } function g(a, b) { if ("function" != typeof b && null !== b) throw new TypeError("Super expression must either be null or a function, not " + typeof b); a.prototype = Object.create(b && b.prototype, { constructor: { value: a, enumerable: !1, writable: !0, configurable: !0 } }), b && (Object.setPrototypeOf ? Object.setPrototypeOf(a, b) : a.__proto__ = b) } c.__esModule = !0; var h = a("./component.js"), i = e(h), j = a("global/document"), k = e(j), l = a("global/window"), m = e(l), n = a("./utils/events.js"), o = d(n), p = a("./utils/dom.js"), q = d(p), r = a("./utils/fn.js"), s = d(r), t = a("./utils/guid.js"), u = d(t), v = a("./utils/browser.js"), w = d(v), x = a("./utils/log.js"), y = e(x), z = a("./utils/to-title-case.js"), A = e(z), B = a("./utils/time-ranges.js"), C = a("./utils/buffer.js"), D = a("./utils/stylesheet.js"), E = d(D), F = a("./fullscreen-api.js"), G = e(F), H = a("./media-error.js"), I = e(H), J = a("safe-json-parse/tuple"), K = e(J), L = a("object.assign"), M = e(L), N = a("./utils/merge-options.js"), O = e(N), P = a("./tracks/text-track-list-converter.js"), Q = e(P), R = a("./tracks/audio-track-list.js"), S = e(R), T = a("./tracks/video-track-list.js"), U = e(T), V = a("./tech/loader.js"), W = (e(V), a("./poster-image.js")), X = (e(W), a("./tracks/text-track-display.js")), Y = (e(X), a("./loading-spinner.js")), Z = (e(Y), a("./big-play-button.js")), $ = (e(Z), a("./control-bar/control-bar.js")), _ = (e($), a("./error-display.js")), aa = (e(_), a("./tracks/text-track-settings.js")), ba = (e(aa), a("./modal-dialog")), ca = e(ba), da = a("./tech/tech.js"), ea = e(da), fa = a("./tech/html5.js"), ga = (e(fa), function (a) {
                function b(c, d, e) { var g = this; if (f(this, b), c.id = c.id || "vjs_video_" + u.newGUID(), d = M["default"](b.getTagSettings(c), d), d.initChildren = !1, d.createEl = !1, d.reportTouchActivity = !1, !d.language) if ("function" == typeof c.closest) { var h = c.closest("[lang]"); h && (d.language = h.getAttribute("lang")) } else for (var i = c; i && 1 === i.nodeType;) { if (q.getElAttributes(i).hasOwnProperty("lang")) { d.language = i.getAttribute("lang"); break } i = i.parentNode } if (a.call(this, null, d, e), !this.options_ || !this.options_.techOrder || !this.options_.techOrder.length) throw new Error("No techOrder specified. Did you overwrite videojs.options instead of just changing the properties you want to override?"); this.tag = c, this.tagAttributes = c && q.getElAttributes(c), this.language(this.options_.language), d.languages ? !function () { var a = {}; Object.getOwnPropertyNames(d.languages).forEach(function (b) { a[b.toLowerCase()] = d.languages[b] }), g.languages_ = a }() : this.languages_ = b.prototype.options_.languages, this.cache_ = {}, this.poster_ = d.poster || "", this.controls_ = !!d.controls, c.controls = !1, this.scrubbing_ = !1, this.el_ = this.createEl(); var j = O["default"](this.options_); d.plugins && !function () { var a = d.plugins; Object.getOwnPropertyNames(a).forEach(function (b) { "function" == typeof this[b] ? this[b](a[b]) : y["default"].error("Unable to find plugin:", b) }, g) }(), this.options_.playerOptions = j, this.initChildren(), this.isAudio("audio" === c.nodeName.toLowerCase()), this.addClass(this.controls() ? "vjs-controls-enabled" : "vjs-controls-disabled"), this.el_.setAttribute("role", "region"), this.isAudio() ? this.el_.setAttribute("aria-label", "audio player") : this.el_.setAttribute("aria-label", "video player"), this.isAudio() && this.addClass("vjs-audio"), this.flexNotSupported_() && this.addClass("vjs-no-flex"), w.IS_IOS || this.addClass("vjs-workinghover"), b.players[this.id_] = this, this.userActive(!0), this.reportUserActivity(), this.listenForUserActivity_(), this.on("fullscreenchange", this.handleFullscreenChange_), this.on("stageclick", this.handleStageClick_) } return g(b, a), b.prototype.dispose = function () { this.trigger("dispose"), this.off("dispose"), this.styleEl_ && this.styleEl_.parentNode && this.styleEl_.parentNode.removeChild(this.styleEl_), b.players[this.id_] = null, this.tag && this.tag.player && (this.tag.player = null), this.el_ && this.el_.player && (this.el_.player = null), this.tech_ && this.tech_.dispose(), a.prototype.dispose.call(this) }, b.prototype.createEl = function () { var b = this.el_ = a.prototype.createEl.call(this, "div"), c = this.tag; c.removeAttribute("width"), c.removeAttribute("height"); var d = q.getElAttributes(c); if (Object.getOwnPropertyNames(d).forEach(function (a) { "class" === a ? b.className = d[a] : b.setAttribute(a, d[a]) }), c.playerId = c.id, c.id += "_html5_api", c.className = "vjs-tech", c.player = b.player = this, this.addClass("vjs-paused"), m["default"].VIDEOJS_NO_DYNAMIC_STYLE !== !0) { this.styleEl_ = E.createStyleElement("vjs-styles-dimensions"); var e = q.$(".vjs-styles-defaults"), f = q.$("head"); f.insertBefore(this.styleEl_, e ? e.nextSibling : f.firstChild) } this.width(this.options_.width), this.height(this.options_.height), this.fluid(this.options_.fluid), this.aspectRatio(this.options_.aspectRatio); for (var g = c.getElementsByTagName("a"), h = 0; h < g.length; h++) { var i = g.item(h); q.addElClass(i, "vjs-hidden"), i.setAttribute("hidden", "hidden") } return c.initNetworkState_ = c.networkState, c.parentNode && c.parentNode.insertBefore(b, c), q.insertElFirst(c, b), this.children_.unshift(c), this.el_ = b, b }, b.prototype.width = function (a) { return this.dimension("width", a) }, b.prototype.height = function (a) { return this.dimension("height", a) }, b.prototype.dimension = function (a, b) { var c = a + "_"; if (void 0 === b) return this[c] || 0; if ("" === b) this[c] = void 0; else { var d = parseFloat(b); if (isNaN(d)) return y["default"].error('Improper value "' + b + '" supplied for for ' + a), this; this[c] = d } return this.updateStyleEl_(), this }, b.prototype.fluid = function (a) { return void 0 === a ? !!this.fluid_ : (this.fluid_ = !!a, void (a ? this.addClass("vjs-fluid") : this.removeClass("vjs-fluid"))) }, b.prototype.aspectRatio = function (a) { if (void 0 === a) return this.aspectRatio_; if (!/^\d+\:\d+$/.test(a)) throw new Error("Improper value supplied for aspect ratio. The format should be width:height, for example 16:9."); this.aspectRatio_ = a, this.fluid(!0), this.updateStyleEl_() }, b.prototype.updateStyleEl_ = function () {
                    if (m["default"].VIDEOJS_NO_DYNAMIC_STYLE === !0) { var a = "number" == typeof this.width_ ? this.width_ : this.options_.width, b = "number" == typeof this.height_ ? this.height_ : this.options_.height, c = this.tech_ && this.tech_.el(); return void (c && (a >= 0 && (c.width = a), b >= 0 && (c.height = b))) } var d = void 0, e = void 0, f = void 0, g = void 0; f = void 0 !== this.aspectRatio_ && "auto" !== this.aspectRatio_ ? this.aspectRatio_ : this.videoWidth() ? this.videoWidth() + ":" + this.videoHeight() : "16:9";

                    var h = f.split(":"), i = h[1] / h[0]; d = void 0 !== this.width_ ? this.width_ : void 0 !== this.height_ ? this.height_ / i : this.videoWidth() || 300, e = void 0 !== this.height_ ? this.height_ : d * i, g = /^[^a-zA-Z]/.test(this.id()) ? "dimensions-" + this.id() : this.id() + "-dimensions", this.addClass(g), E.setTextContent(this.styleEl_, "\n      ." + g + " {\n        width: " + d + "px;\n        height: " + e + "px;\n      }\n\n      ." + g + ".vjs-fluid {\n        padding-top: " + 100 * i + "%;\n      }\n    ")
                }, b.prototype.loadTech_ = function (a, b) { this.tech_ && this.unloadTech_(), "Html5" !== a && this.tag && (ea["default"].getTech("Html5").disposeMediaElement(this.tag), this.tag.player = null, this.tag = null), this.techName_ = a, this.isReady_ = !1; var c = M["default"]({ nativeControlsForTouch: this.options_.nativeControlsForTouch, source: b, playerId: this.id(), techId: this.id() + "_" + a + "_api", videoTracks: this.videoTracks_, textTracks: this.textTracks_, audioTracks: this.audioTracks_, autoplay: this.options_.autoplay, preload: this.options_.preload, loop: this.options_.loop, muted: this.options_.muted, poster: this.poster(), language: this.language(), "vtt.js": this.options_["vtt.js"] }, this.options_[a.toLowerCase()]); this.tag && (c.tag = this.tag), b && (this.currentType_ = b.type, b.src === this.cache_.src && this.cache_.currentTime > 0 && (c.startTime = this.cache_.currentTime), this.cache_.src = b.src); var d = ea["default"].getTech(a); d || (d = i["default"].getComponent(a)), this.tech_ = new d(c), this.tech_.ready(s.bind(this, this.handleTechReady_), !0), Q["default"].jsonToTextTracks(this.textTracksJson_ || [], this.tech_), this.on(this.tech_, "loadstart", this.handleTechLoadStart_), this.on(this.tech_, "waiting", this.handleTechWaiting_), this.on(this.tech_, "canplay", this.handleTechCanPlay_), this.on(this.tech_, "canplaythrough", this.handleTechCanPlayThrough_), this.on(this.tech_, "playing", this.handleTechPlaying_), this.on(this.tech_, "ended", this.handleTechEnded_), this.on(this.tech_, "seeking", this.handleTechSeeking_), this.on(this.tech_, "seeked", this.handleTechSeeked_), this.on(this.tech_, "play", this.handleTechPlay_), this.on(this.tech_, "firstplay", this.handleTechFirstPlay_), this.on(this.tech_, "pause", this.handleTechPause_), this.on(this.tech_, "progress", this.handleTechProgress_), this.on(this.tech_, "durationchange", this.handleTechDurationChange_), this.on(this.tech_, "fullscreenchange", this.handleTechFullscreenChange_), this.on(this.tech_, "error", this.handleTechError_), this.on(this.tech_, "suspend", this.handleTechSuspend_), this.on(this.tech_, "abort", this.handleTechAbort_), this.on(this.tech_, "emptied", this.handleTechEmptied_), this.on(this.tech_, "stalled", this.handleTechStalled_), this.on(this.tech_, "loadedmetadata", this.handleTechLoadedMetaData_), this.on(this.tech_, "loadeddata", this.handleTechLoadedData_), this.on(this.tech_, "timeupdate", this.handleTechTimeUpdate_), this.on(this.tech_, "ratechange", this.handleTechRateChange_), this.on(this.tech_, "volumechange", this.handleTechVolumeChange_), this.on(this.tech_, "texttrackchange", this.handleTechTextTrackChange_), this.on(this.tech_, "loadedmetadata", this.updateStyleEl_), this.on(this.tech_, "posterchange", this.handleTechPosterChange_), this.on(this.tech_, "textdata", this.handleTechTextData_), this.usingNativeControls(this.techGet_("controls")), this.controls() && !this.usingNativeControls() && this.addTechControlsListeners_(), this.tech_.el().parentNode === this.el() || "Html5" === a && this.tag || q.insertElFirst(this.tech_.el(), this.el()), this.tag && (this.tag.player = null, this.tag = null) }, b.prototype.unloadTech_ = function () { this.videoTracks_ = this.videoTracks(), this.textTracks_ = this.textTracks(), this.audioTracks_ = this.audioTracks(), this.textTracksJson_ = Q["default"].textTracksToJson(this.tech_), this.isReady_ = !1, this.tech_.dispose(), this.tech_ = !1 }, b.prototype.tech = function (a) { if (a && a.IWillNotUseThisInPlugins) return this.tech_; var b = "\n      Please make sure that you are not using this inside of a plugin.\n      To disable this alert and error, please pass in an object with\n      `IWillNotUseThisInPlugins` to the `tech` method. See\n      https://github.com/videojs/video.js/issues/2617 for more info.\n    "; throw m["default"].alert(b), new Error(b) }, b.prototype.addTechControlsListeners_ = function () { this.removeTechControlsListeners_(), this.on(this.tech_, "mousedown", this.handleTechClick_), this.on(this.tech_, "touchstart", this.handleTechTouchStart_), this.on(this.tech_, "touchmove", this.handleTechTouchMove_), this.on(this.tech_, "touchend", this.handleTechTouchEnd_), this.on(this.tech_, "tap", this.handleTechTap_) }, b.prototype.removeTechControlsListeners_ = function () { this.off(this.tech_, "tap", this.handleTechTap_), this.off(this.tech_, "touchstart", this.handleTechTouchStart_), this.off(this.tech_, "touchmove", this.handleTechTouchMove_), this.off(this.tech_, "touchend", this.handleTechTouchEnd_), this.off(this.tech_, "mousedown", this.handleTechClick_) }, b.prototype.handleTechReady_ = function () { if (this.triggerReady(), this.cache_.volume && this.techCall_("setVolume", this.cache_.volume), this.handleTechPosterChange_(), this.handleTechDurationChange_(), (this.src() || this.currentSrc()) && this.tag && this.options_.autoplay && this.paused()) { try { delete this.tag.poster } catch (a) { y["default"]("deleting tag.poster throws in some browsers", a) } this.play() } }, b.prototype.handleTechLoadStart_ = function () { this.removeClass("vjs-ended"), this.error(null), this.paused() ? (this.hasStarted(!1), this.trigger("loadstart")) : (this.trigger("loadstart"), this.trigger("firstplay")) }, b.prototype.hasStarted = function (a) { return void 0 !== a ? (this.hasStarted_ !== a && (this.hasStarted_ = a, a ? (this.addClass("vjs-has-started"), this.trigger("firstplay")) : this.removeClass("vjs-has-started")), this) : !!this.hasStarted_ }, b.prototype.handleTechPlay_ = function () { this.removeClass("vjs-ended"), this.removeClass("vjs-paused"), this.addClass("vjs-playing"), this.hasStarted(!0), this.trigger("play") }, b.prototype.handleTechWaiting_ = function () { var a = this; this.addClass("vjs-waiting"), this.trigger("waiting"), this.one("timeupdate", function () { return a.removeClass("vjs-waiting") }) }, b.prototype.handleTechCanPlay_ = function () { this.removeClass("vjs-waiting"), this.trigger("canplay") }, b.prototype.handleTechCanPlayThrough_ = function () { this.removeClass("vjs-waiting"), this.trigger("canplaythrough") }, b.prototype.handleTechPlaying_ = function () { this.removeClass("vjs-waiting"), this.trigger("playing") }, b.prototype.handleTechSeeking_ = function () { this.addClass("vjs-seeking"), this.trigger("seeking") }, b.prototype.handleTechSeeked_ = function () { this.removeClass("vjs-seeking"), this.trigger("seeked") }, b.prototype.handleTechFirstPlay_ = function () { this.options_.starttime && this.currentTime(this.options_.starttime), this.addClass("vjs-has-started"), this.trigger("firstplay") }, b.prototype.handleTechPause_ = function () { this.removeClass("vjs-playing"), this.addClass("vjs-paused"), this.trigger("pause") }, b.prototype.handleTechProgress_ = function () { this.trigger("progress") }, b.prototype.handleTechEnded_ = function () { this.addClass("vjs-ended"), this.options_.loop ? (this.currentTime(0), this.play()) : this.paused() || this.pause(), this.trigger("ended") }, b.prototype.handleTechDurationChange_ = function () { this.duration(this.techGet_("duration")) }, b.prototype.handleTechClick_ = function (a) { 0 === a.button && this.controls() && (this.paused() ? this.play() : this.pause()) }, b.prototype.handleTechTap_ = function () { this.userActive(!this.userActive()) }, b.prototype.handleTechTouchStart_ = function () { this.userWasActive = this.userActive() }, b.prototype.handleTechTouchMove_ = function () { this.userWasActive && this.reportUserActivity() }, b.prototype.handleTechTouchEnd_ = function (a) { a.preventDefault() }, b.prototype.handleFullscreenChange_ = function () { this.isFullscreen() ? this.addClass("vjs-fullscreen") : this.removeClass("vjs-fullscreen") }, b.prototype.handleStageClick_ = function () { this.reportUserActivity() }, b.prototype.handleTechFullscreenChange_ = function (a, b) { b && this.isFullscreen(b.isFullscreen), this.trigger("fullscreenchange") }, b.prototype.handleTechError_ = function () { var a = this.tech_.error(); this.error(a) }, b.prototype.handleTechSuspend_ = function () { this.trigger("suspend") }, b.prototype.handleTechAbort_ = function () { this.trigger("abort") }, b.prototype.handleTechEmptied_ = function () { this.trigger("emptied") }, b.prototype.handleTechStalled_ = function () { this.trigger("stalled") }, b.prototype.handleTechLoadedMetaData_ = function () { this.trigger("loadedmetadata") }, b.prototype.handleTechTextData_ = function () { var a = null; arguments.length > 1 && (a = arguments[1]), this.trigger("textdata", a) }, b.prototype.handleTechLoadedData_ = function () { this.trigger("loadeddata") }, b.prototype.handleTechTimeUpdate_ = function () { this.trigger("timeupdate") }, b.prototype.handleTechRateChange_ = function () { this.trigger("ratechange") }, b.prototype.handleTechVolumeChange_ = function () { this.trigger("volumechange") }, b.prototype.handleTechTextTrackChange_ = function () { this.trigger("texttrackchange") }, b.prototype.getCache = function () { return this.cache_ }, b.prototype.techCall_ = function (a, b) { if (this.tech_ && !this.tech_.isReady_) this.tech_.ready(function () { this[a](b) }, !0); else try { this.tech_ && this.tech_[a](b) } catch (c) { throw y["default"](c), c } }, b.prototype.techGet_ = function (a) { if (this.tech_ && this.tech_.isReady_) try { return this.tech_[a]() } catch (b) { throw void 0 === this.tech_[a] ? y["default"]("Video.js: " + a + " method not defined for " + this.techName_ + " playback technology.", b) : "TypeError" === b.name ? (y["default"]("Video.js: " + a + " unavailable on " + this.techName_ + " playback technology element.", b), this.tech_.isReady_ = !1) : y["default"](b), b } }, b.prototype.play = function () { return this.src() || this.currentSrc() ? this.techCall_("play") : this.tech_.one("loadstart", function () { this.play() }), this }, b.prototype.pause = function () { return this.techCall_("pause"), this }, b.prototype.paused = function () { return this.techGet_("paused") === !1 ? !1 : !0 }, b.prototype.scrubbing = function (a) { return void 0 !== a ? (this.scrubbing_ = !!a, a ? this.addClass("vjs-scrubbing") : this.removeClass("vjs-scrubbing"), this) : this.scrubbing_ }, b.prototype.currentTime = function (a) { return void 0 !== a ? (this.techCall_("setCurrentTime", a), this) : this.cache_.currentTime = this.techGet_("currentTime") || 0 }, b.prototype.duration = function (a) { return void 0 === a ? this.cache_.duration || 0 : (a = parseFloat(a) || 0, 0 > a && (a = 1 / 0), a !== this.cache_.duration && (this.cache_.duration = a, a === 1 / 0 ? this.addClass("vjs-live") : this.removeClass("vjs-live"), this.trigger("durationchange")), this) }, b.prototype.remainingTime = function () { return this.duration() - this.currentTime() }, b.prototype.buffered = function c() { var c = this.techGet_("buffered"); return c && c.length || (c = B.createTimeRange(0, 0)), c }, b.prototype.bufferedPercent = function () { return C.bufferedPercent(this.buffered(), this.duration()) }, b.prototype.bufferedEnd = function () { var a = this.buffered(), b = this.duration(), c = a.end(a.length - 1); return c > b && (c = b), c }, b.prototype.volume = function (a) { var b = void 0; return void 0 !== a ? (b = Math.max(0, Math.min(1, parseFloat(a))), this.cache_.volume = b, this.techCall_("setVolume", b), this) : (b = parseFloat(this.techGet_("volume")), isNaN(b) ? 1 : b) }, b.prototype.muted = function (a) { return void 0 !== a ? (this.techCall_("setMuted", a), this) : this.techGet_("muted") || !1 }, b.prototype.supportsFullScreen = function () { return this.techGet_("supportsFullScreen") || !1 }, b.prototype.isFullscreen = function (a) { return void 0 !== a ? (this.isFullscreen_ = !!a, this) : !!this.isFullscreen_ }, b.prototype.requestFullscreen = function () { var a = G["default"]; return this.isFullscreen(!0), a.requestFullscreen ? (o.on(k["default"], a.fullscreenchange, s.bind(this, function b() { this.isFullscreen(k["default"][a.fullscreenElement]), this.isFullscreen() === !1 && o.off(k["default"], a.fullscreenchange, b), this.trigger("fullscreenchange") })), this.el_[a.requestFullscreen]()) : this.tech_.supportsFullScreen() ? this.techCall_("enterFullScreen") : (this.enterFullWindow(), this.trigger("fullscreenchange")), this }, b.prototype.exitFullscreen = function () { var a = G["default"]; return this.isFullscreen(!1), a.requestFullscreen ? k["default"][a.exitFullscreen]() : this.tech_.supportsFullScreen() ? this.techCall_("exitFullScreen") : (this.exitFullWindow(), this.trigger("fullscreenchange")), this }, b.prototype.enterFullWindow = function () { this.isFullWindow = !0, this.docOrigOverflow = k["default"].documentElement.style.overflow, o.on(k["default"], "keydown", s.bind(this, this.fullWindowOnEscKey)), k["default"].documentElement.style.overflow = "hidden", q.addElClass(k["default"].body, "vjs-full-window"), this.trigger("enterFullWindow") }, b.prototype.fullWindowOnEscKey = function (a) { 27 === a.keyCode && (this.isFullscreen() === !0 ? this.exitFullscreen() : this.exitFullWindow()) }, b.prototype.exitFullWindow = function () { this.isFullWindow = !1, o.off(k["default"], "keydown", this.fullWindowOnEscKey), k["default"].documentElement.style.overflow = this.docOrigOverflow, q.removeElClass(k["default"].body, "vjs-full-window"), this.trigger("exitFullWindow") }, b.prototype.canPlayType = function (a) { for (var b = void 0, c = 0, d = this.options_.techOrder; c < d.length; c++) { var e = A["default"](d[c]), f = ea["default"].getTech(e); if (f || (f = i["default"].getComponent(e)), f) { if (f.isSupported() && (b = f.canPlayType(a))) return b } else y["default"].error('The "' + e + '" tech is undefined. Skipped browser support check for that tech.') } return "" }, b.prototype.selectSource = function (a) { var b = this, c = this.options_.techOrder.map(A["default"]).map(function (a) { return [a, ea["default"].getTech(a) || i["default"].getComponent(a)] }).filter(function (a) { var b = a[0], c = a[1]; return c ? c.isSupported() : (y["default"].error('The "' + b + '" tech is undefined. Skipped browser support check for that tech.'), !1) }), d = function (a, b, c) { var d = void 0; return a.some(function (a) { return b.some(function (b) { return d = c(a, b), d ? !0 : void 0 }) }), d }, e = void 0, f = function (a) { return function (b, c) { return a(c, b) } }, g = function (a, c) { var d = a[0], e = a[1]; return e.canPlaySource(c, b.options_[d.toLowerCase()]) ? { source: c, tech: d } : void 0 }; return e = this.options_.sourceOrder ? d(a, c, f(g)) : d(c, a, g), e || !1 }, b.prototype.src = function (a) { if (void 0 === a) return this.techGet_("src"); var b = ea["default"].getTech(this.techName_); return b || (b = i["default"].getComponent(this.techName_)), Array.isArray(a) ? this.sourceList_(a) : "string" == typeof a ? this.src({ src: a }) : a instanceof Object && (a.type && !b.canPlaySource(a, this.options_[this.techName_.toLowerCase()]) ? this.sourceList_([a]) : (this.cache_.src = a.src, this.currentType_ = a.type || "", this.ready(function () { b.prototype.hasOwnProperty("setSource") ? this.techCall_("setSource", a) : this.techCall_("src", a.src), "auto" === this.options_.preload && this.load(), this.options_.autoplay && this.play() }, !0))), this }, b.prototype.sourceList_ = function (a) { var b = this.selectSource(a); b ? b.tech === this.techName_ ? this.src(b.source) : this.loadTech_(b.tech, b.source) : (this.setTimeout(function () { this.error({ code: 4, message: this.localize(this.options_.notSupportedMessage) }) }, 0), this.triggerReady()) }, b.prototype.load = function () { return this.techCall_("load"), this }, b.prototype.reset = function () { return this.loadTech_(A["default"](this.options_.techOrder[0]), null), this.techCall_("reset"), this }, b.prototype.currentSrc = function () { return this.techGet_("currentSrc") || this.cache_.src || "" }, b.prototype.currentType = function () { return this.currentType_ || "" }, b.prototype.preload = function (a) { return void 0 !== a ? (this.techCall_("setPreload", a), this.options_.preload = a, this) : this.techGet_("preload") }, b.prototype.autoplay = function (a) { return void 0 !== a ? (this.techCall_("setAutoplay", a), this.options_.autoplay = a, this) : this.techGet_("autoplay", a) }, b.prototype.loop = function (a) { return void 0 !== a ? (this.techCall_("setLoop", a), this.options_.loop = a, this) : this.techGet_("loop") }, b.prototype.poster = function (a) { return void 0 === a ? this.poster_ : (a || (a = ""), this.poster_ = a, this.techCall_("setPoster", a), this.trigger("posterchange"), this) }, b.prototype.handleTechPosterChange_ = function () { !this.poster_ && this.tech_ && this.tech_.poster && (this.poster_ = this.tech_.poster() || "", this.trigger("posterchange")) }, b.prototype.controls = function (a) { return void 0 !== a ? (a = !!a, this.controls_ !== a && (this.controls_ = a, this.usingNativeControls() && this.techCall_("setControls", a), a ? (this.removeClass("vjs-controls-disabled"), this.addClass("vjs-controls-enabled"), this.trigger("controlsenabled"), this.usingNativeControls() || this.addTechControlsListeners_()) : (this.removeClass("vjs-controls-enabled"), this.addClass("vjs-controls-disabled"), this.trigger("controlsdisabled"), this.usingNativeControls() || this.removeTechControlsListeners_())), this) : !!this.controls_ }, b.prototype.usingNativeControls = function (a) { return void 0 !== a ? (a = !!a, this.usingNativeControls_ !== a && (this.usingNativeControls_ = a, a ? (this.addClass("vjs-using-native-controls"), this.trigger("usingnativecontrols")) : (this.removeClass("vjs-using-native-controls"), this.trigger("usingcustomcontrols"))), this) : !!this.usingNativeControls_ }, b.prototype.error = function (a) { return void 0 === a ? this.error_ || null : null === a ? (this.error_ = a, this.removeClass("vjs-error"), this.errorDisplay && this.errorDisplay.close(), this) : (this.error_ = new I["default"](a), this.addClass("vjs-error"), y["default"].error("(CODE:" + this.error_.code + " " + I["default"].errorTypes[this.error_.code] + ")", this.error_.message, this.error_), this.trigger("error"), this) }, b.prototype.ended = function () { return this.techGet_("ended") }, b.prototype.seeking = function () { return this.techGet_("seeking") }, b.prototype.seekable = function () { return this.techGet_("seekable") }, b.prototype.reportUserActivity = function () { this.userActivity_ = !0 }, b.prototype.userActive = function (a) { return void 0 !== a ? (a = !!a, a !== this.userActive_ && (this.userActive_ = a, a ? (this.userActivity_ = !0, this.removeClass("vjs-user-inactive"), this.addClass("vjs-user-active"), this.trigger("useractive")) : (this.userActivity_ = !1, this.tech_ && this.tech_.one("mousemove", function (a) { a.stopPropagation(), a.preventDefault() }), this.removeClass("vjs-user-active"), this.addClass("vjs-user-inactive"), this.trigger("userinactive"))), this) : this.userActive_ }, b.prototype.listenForUserActivity_ = function () { var a = void 0, b = void 0, c = void 0, d = s.bind(this, this.reportUserActivity), e = function (a) { (a.screenX !== b || a.screenY !== c) && (b = a.screenX, c = a.screenY, d()) }, f = function () { d(), this.clearInterval(a), a = this.setInterval(d, 250) }, g = function () { d(), this.clearInterval(a) }; this.on("mousedown", f), this.on("mousemove", e), this.on("mouseup", g), this.on("keydown", d), this.on("keyup", d); { var h = void 0; this.setInterval(function () { if (this.userActivity_) { this.userActivity_ = !1, this.userActive(!0), this.clearTimeout(h); var a = this.options_.inactivityTimeout; a > 0 && (h = this.setTimeout(function () { this.userActivity_ || this.userActive(!1) }, a)) } }, 250) } }, b.prototype.playbackRate = function (a) { return void 0 !== a ? (this.techCall_("setPlaybackRate", a), this) : this.tech_ && this.tech_.featuresPlaybackRate ? this.techGet_("playbackRate") : 1 }, b.prototype.isAudio = function (a) { return void 0 !== a ? (this.isAudio_ = !!a, this) : !!this.isAudio_ }, b.prototype.networkState = function () { return this.techGet_("networkState") }, b.prototype.readyState = function () { return this.techGet_("readyState") }, b.prototype.videoTracks = function () { return this.tech_ ? this.tech_.videoTracks() : (this.videoTracks_ = this.videoTracks_ || new U["default"], this.videoTracks_) }, b.prototype.audioTracks = function () { return this.tech_ ? this.tech_.audioTracks() : (this.audioTracks_ = this.audioTracks_ || new S["default"], this.audioTracks_) }, b.prototype.textTracks = function () { return this.tech_ && this.tech_.textTracks() }, b.prototype.remoteTextTracks = function () { return this.tech_ && this.tech_.remoteTextTracks() }, b.prototype.remoteTextTrackEls = function () { return this.tech_ && this.tech_.remoteTextTrackEls() }, b.prototype.addTextTrack = function (a, b, c) { return this.tech_ && this.tech_.addTextTrack(a, b, c) }, b.prototype.addRemoteTextTrack = function (a) { return this.tech_ && this.tech_.addRemoteTextTrack(a) }, b.prototype.removeRemoteTextTrack = function () { var a = arguments.length <= 0 || void 0 === arguments[0] ? {} : arguments[0], b = a.track, c = void 0 === b ? arguments[0] : b; this.tech_ && this.tech_.removeRemoteTextTrack(c) }, b.prototype.videoWidth = function () { return this.tech_ && this.tech_.videoWidth && this.tech_.videoWidth() || 0 }, b.prototype.videoHeight = function () { return this.tech_ && this.tech_.videoHeight && this.tech_.videoHeight() || 0 }, b.prototype.language = function (a) { return void 0 === a ? this.language_ : (this.language_ = ("" + a).toLowerCase(), this) }, b.prototype.languages = function () { return O["default"](b.prototype.options_.languages, this.languages_) }, b.prototype.toJSON = function () { var a = O["default"](this.options_), b = a.tracks; a.tracks = []; for (var c = 0; c < b.length; c++) { var d = b[c]; d = O["default"](d), d.player = void 0, a.tracks[c] = d } return a }, b.prototype.createModal = function (a, b) { var c = this; b = b || {}, b.content = a || ""; var d = new ca["default"](c, b); return c.addChild(d), d.on("dispose", function () { c.removeChild(d) }), d.open() }, b.getTagSettings = function (a) { var b = { sources: [], tracks: [] }, c = q.getElAttributes(a), d = c["data-setup"]; if (null !== d) { var e = K["default"](d || "{}"), f = e[0], g = e[1]; f && y["default"].error(f), M["default"](c, g) } if (M["default"](b, c), a.hasChildNodes()) for (var h = a.childNodes, i = 0, j = h.length; j > i; i++) { var k = h[i], l = k.nodeName.toLowerCase(); "source" === l ? b.sources.push(q.getElAttributes(k)) : "track" === l && b.tracks.push(q.getElAttributes(k)) } return b }, b
            }(i["default"])); ga.players = {}; var ha = m["default"].navigator; ga.prototype.options_ = { techOrder: ["html5", "flash"], html5: {}, flash: {}, defaultVolume: 0, inactivityTimeout: 2e3, playbackRates: [], children: ["mediaLoader", "posterImage", "textTrackDisplay", "loadingSpinner", "bigPlayButton", "controlBar", "errorDisplay", "textTrackSettings"], language: ha.languages && ha.languages[0] || ha.userLanguage || ha.language || "en", languages: {}, notSupportedMessage: "No compatible source was found for this media." }, ga.prototype.handleTechLoadStart_, ga.prototype.handleLoadedMetaData_, ga.prototype.handleTextData_, ga.prototype.handleLoadedData_, ga.prototype.handleUserActive_, ga.prototype.handleUserInactive_, ga.prototype.handleTimeUpdate_, ga.prototype.handleTechEnded_, ga.prototype.handleVolumeChange_, ga.prototype.handleError_, ga.prototype.flexNotSupported_ = function () { var a = k["default"].createElement("i"); return !("flexBasis" in a.style || "webkitFlexBasis" in a.style || "mozFlexBasis" in a.style || "msFlexBasis" in a.style || "msFlexOrder" in a.style) }, i["default"].registerComponent("Player", ga), c["default"] = ga, b.exports = c["default"]
        }, { "./big-play-button.js": 63, "./component.js": 67, "./control-bar/control-bar.js": 70, "./error-display.js": 103, "./fullscreen-api.js": 106, "./loading-spinner.js": 107, "./media-error.js": 108, "./modal-dialog": 112, "./poster-image.js": 117, "./tech/html5.js": 122, "./tech/loader.js": 123, "./tech/tech.js": 124, "./tracks/audio-track-list.js": 125, "./tracks/text-track-display.js": 130, "./tracks/text-track-list-converter.js": 131, "./tracks/text-track-settings.js": 133, "./tracks/video-track-list.js": 138, "./utils/browser.js": 140, "./utils/buffer.js": 141, "./utils/dom.js": 142, "./utils/events.js": 143, "./utils/fn.js": 144, "./utils/guid.js": 146, "./utils/log.js": 147, "./utils/merge-options.js": 148, "./utils/stylesheet.js": 149, "./utils/time-ranges.js": 150, "./utils/to-title-case.js": 151, "global/document": 1, "global/window": 2, "object.assign": 45, "safe-json-parse/tuple": 54 }], 114: [function (a, b, c) { "use strict"; function d(a) { return a && a.__esModule ? a : { "default": a } } c.__esModule = !0; var e = a("./player.js"), f = d(e), g = function (a, b) { f["default"].prototype[a] = b }; c["default"] = g, b.exports = c["default"] }, { "./player.js": 113 }], 115: [function (a, b, c) { "use strict"; function d(a) { if (a && a.__esModule) return a; var b = {}; if (null != a) for (var c in a) Object.prototype.hasOwnProperty.call(a, c) && (b[c] = a[c]); return b["default"] = a, b } function e(a) { return a && a.__esModule ? a : { "default": a } } function f(a, b) { if (!(a instanceof b)) throw new TypeError("Cannot call a class as a function") } function g(a, b) { if ("function" != typeof b && null !== b) throw new TypeError("Super expression must either be null or a function, not " + typeof b); a.prototype = Object.create(b && b.prototype, { constructor: { value: a, enumerable: !1, writable: !0, configurable: !0 } }), b && (Object.setPrototypeOf ? Object.setPrototypeOf(a, b) : a.__proto__ = b) } c.__esModule = !0; var h = a("../clickable-component.js"), i = e(h), j = a("../component.js"), k = e(j), l = a("./popup.js"), m = (e(l), a("../utils/dom.js")), n = (d(m), a("../utils/fn.js")), o = (d(n), a("../utils/to-title-case.js")), p = (e(o), function (a) { function b(c) { var d = arguments.length <= 1 || void 0 === arguments[1] ? {} : arguments[1]; f(this, b), a.call(this, c, d), this.update() } return g(b, a), b.prototype.update = function () { var a = this.createPopup(); this.popup && this.removeChild(this.popup), this.popup = a, this.addChild(a), this.items && 0 === this.items.length ? this.hide() : this.items && this.items.length > 1 && this.show() }, b.prototype.createPopup = function () { }, b.prototype.createEl = function () { return a.prototype.createEl.call(this, "div", { className: this.buildCSSClass() }) }, b.prototype.buildCSSClass = function () { var b = "vjs-menu-button"; return b += this.options_.inline === !0 ? "-inline" : "-popup", "vjs-menu-button " + b + " " + a.prototype.buildCSSClass.call(this) }, b }(i["default"])); k["default"].registerComponent("PopupButton", p), c["default"] = p, b.exports = c["default"] }, { "../clickable-component.js": 65, "../component.js": 67, "../utils/dom.js": 142, "../utils/fn.js": 144, "../utils/to-title-case.js": 151, "./popup.js": 116 }], 116: [function (a, b, c) { "use strict"; function d(a) { if (a && a.__esModule) return a; var b = {}; if (null != a) for (var c in a) Object.prototype.hasOwnProperty.call(a, c) && (b[c] = a[c]); return b["default"] = a, b } function e(a) { return a && a.__esModule ? a : { "default": a } } function f(a, b) { if (!(a instanceof b)) throw new TypeError("Cannot call a class as a function") } function g(a, b) { if ("function" != typeof b && null !== b) throw new TypeError("Super expression must either be null or a function, not " + typeof b); a.prototype = Object.create(b && b.prototype, { constructor: { value: a, enumerable: !1, writable: !0, configurable: !0 } }), b && (Object.setPrototypeOf ? Object.setPrototypeOf(a, b) : a.__proto__ = b) } c.__esModule = !0; var h = a("../component.js"), i = e(h), j = a("../utils/dom.js"), k = d(j), l = a("../utils/fn.js"), m = d(l), n = a("../utils/events.js"), o = d(n), p = function (a) { function b() { f(this, b), a.apply(this, arguments) } return g(b, a), b.prototype.addItem = function (a) { this.addChild(a), a.on("click", m.bind(this, function () { this.unlockShowing() })) }, b.prototype.createEl = function () { var b = this.options_.contentElType || "ul"; this.contentEl_ = k.createEl(b, { className: "vjs-menu-content" }); var c = a.prototype.createEl.call(this, "div", { append: this.contentEl_, className: "vjs-menu" }); return c.appendChild(this.contentEl_), o.on(c, "click", function (a) { a.preventDefault(), a.stopImmediatePropagation() }), c }, b }(i["default"]); i["default"].registerComponent("Popup", p), c["default"] = p, b.exports = c["default"] }, { "../component.js": 67, "../utils/dom.js": 142, "../utils/events.js": 143, "../utils/fn.js": 144 }], 117: [function (a, b, c) { "use strict"; function d(a) { if (a && a.__esModule) return a; var b = {}; if (null != a) for (var c in a) Object.prototype.hasOwnProperty.call(a, c) && (b[c] = a[c]); return b["default"] = a, b } function e(a) { return a && a.__esModule ? a : { "default": a } } function f(a, b) { if (!(a instanceof b)) throw new TypeError("Cannot call a class as a function") } function g(a, b) { if ("function" != typeof b && null !== b) throw new TypeError("Super expression must either be null or a function, not " + typeof b); a.prototype = Object.create(b && b.prototype, { constructor: { value: a, enumerable: !1, writable: !0, configurable: !0 } }), b && (Object.setPrototypeOf ? Object.setPrototypeOf(a, b) : a.__proto__ = b) } c.__esModule = !0; var h = a("./clickable-component.js"), i = e(h), j = a("./component.js"), k = e(j), l = a("./utils/fn.js"), m = d(l), n = a("./utils/dom.js"), o = d(n), p = a("./utils/browser.js"), q = d(p), r = function (a) { function b(c, d) { f(this, b), a.call(this, c, d), this.update(), c.on("posterchange", m.bind(this, this.update)) } return g(b, a), b.prototype.dispose = function () { this.player().off("posterchange", this.update), a.prototype.dispose.call(this) }, b.prototype.createEl = function () { var a = o.createEl("div", { className: "vjs-poster", tabIndex: -1 }); return q.BACKGROUND_SIZE_SUPPORTED || (this.fallbackImg_ = o.createEl("img"), a.appendChild(this.fallbackImg_)), a }, b.prototype.update = function () { var a = this.player().poster(); this.setSrc(a), a ? this.show() : this.hide() }, b.prototype.setSrc = function (a) { if (this.fallbackImg_) this.fallbackImg_.src = a; else { var b = ""; a && (b = 'url("' + a + '")'), this.el_.style.backgroundImage = b } }, b.prototype.handleClick = function () { this.player_.paused() ? this.player_.play() : this.player_.pause() }, b }(i["default"]); k["default"].registerComponent("PosterImage", r), c["default"] = r, b.exports = c["default"] }, { "./clickable-component.js": 65, "./component.js": 67, "./utils/browser.js": 140, "./utils/dom.js": 142, "./utils/fn.js": 144 }], 118: [function (a, b, c) { "use strict"; function d(a) { return a && a.__esModule ? a : { "default": a } } function e(a) { if (a && a.__esModule) return a; var b = {}; if (null != a) for (var c in a) Object.prototype.hasOwnProperty.call(a, c) && (b[c] = a[c]); return b["default"] = a, b } c.__esModule = !0; var f = a("./utils/events.js"), g = e(f), h = a("global/document"), i = d(h), j = a("global/window"), k = d(j), l = !1, m = void 0, n = function () { var a = i["default"].getElementsByTagName("video"), b = i["default"].getElementsByTagName("audio"), c = []; if (a && a.length > 0) for (var d = 0, e = a.length; e > d; d++)c.push(a[d]); if (b && b.length > 0) for (var d = 0, e = b.length; e > d; d++)c.push(b[d]); if (c && c.length > 0) for (var d = 0, e = c.length; e > d; d++) { var f = c[d]; if (!f || !f.getAttribute) { o(1); break } if (void 0 === f.player) { var g = f.getAttribute("data-setup"); if (null !== g) { m(f) } } } else l || o(1) }, o = function (a, b) { b && (m = b), setTimeout(n, a) }; "complete" === i["default"].readyState ? l = !0 : g.one(k["default"], "load", function () { l = !0 }); var p = function () { return l }; c.autoSetup = n, c.autoSetupTimeout = o, c.hasLoaded = p }, { "./utils/events.js": 143, "global/document": 1, "global/window": 2 }], 119: [function (a, b, c) {
            "use strict"; function d(a) { if (a && a.__esModule) return a; var b = {}; if (null != a) for (var c in a) Object.prototype.hasOwnProperty.call(a, c) && (b[c] = a[c]); return b["default"] = a, b } function e(a) { return a && a.__esModule ? a : { "default": a } } function f(a, b) { if (!(a instanceof b)) throw new TypeError("Cannot call a class as a function") } function g(a, b) { if ("function" != typeof b && null !== b) throw new TypeError("Super expression must either be null or a function, not " + typeof b); a.prototype = Object.create(b && b.prototype, { constructor: { value: a, enumerable: !1, writable: !0, configurable: !0 } }), b && (Object.setPrototypeOf ? Object.setPrototypeOf(a, b) : a.__proto__ = b) } c.__esModule = !0; var h = a("../component.js"), i = e(h), j = a("../utils/dom.js"), k = d(j), l = a("object.assign"), m = e(l), n = function (a) {
                function b(c, d) { f(this, b), a.call(this, c, d), this.bar = this.getChild(this.options_.barName), this.vertical(!!this.options_.vertical), this.on("mousedown", this.handleMouseDown), this.on("touchstart", this.handleMouseDown), this.on("focus", this.handleFocus), this.on("blur", this.handleBlur), this.on("click", this.handleClick), this.on(c, "controlsvisible", this.update), this.on(c, this.playerEvent, this.update) } return g(b, a), b.prototype.createEl = function (b) { var c = arguments.length <= 1 || void 0 === arguments[1] ? {} : arguments[1], d = arguments.length <= 2 || void 0 === arguments[2] ? {} : arguments[2]; return c.className = c.className + " vjs-slider", c = m["default"]({ tabIndex: 0 }, c), d = m["default"]({ role: "slider", "aria-valuenow": 0, "aria-valuemin": 0, "aria-valuemax": 100, tabIndex: 0 }, d), a.prototype.createEl.call(this, b, c, d) }, b.prototype.handleMouseDown = function (a) { var b = this.bar.el_.ownerDocument; a.preventDefault(), k.blockTextSelection(), this.addClass("vjs-sliding"), this.trigger("slideractive"), this.on(b, "mousemove", this.handleMouseMove), this.on(b, "mouseup", this.handleMouseUp), this.on(b, "touchmove", this.handleMouseMove), this.on(b, "touchend", this.handleMouseUp), this.handleMouseMove(a) }, b.prototype.handleMouseMove = function () { }, b.prototype.handleMouseUp = function () { var a = this.bar.el_.ownerDocument; k.unblockTextSelection(), this.removeClass("vjs-sliding"), this.trigger("sliderinactive"), this.off(a, "mousemove", this.handleMouseMove), this.off(a, "mouseup", this.handleMouseUp), this.off(a, "touchmove", this.handleMouseMove), this.off(a, "touchend", this.handleMouseUp), this.update() }, b.prototype.update = function () { if (this.el_) { var a = this.getPercent(), b = this.bar; if (b) { ("number" != typeof a || a !== a || 0 > a || a === 1 / 0) && (a = 0); var c = (100 * a).toFixed(2) + "%"; this.vertical() ? b.el().style.height = c : b.el().style.width = c } } }, b.prototype.calculateDistance = function (a) { var b = k.getPointerPosition(this.el_, a); return this.vertical() ? b.y : b.x }, b.prototype.handleFocus = function () {
                    this.on(this.bar.el_.ownerDocument, "keydown", this.handleKeyPress);

                }, b.prototype.handleKeyPress = function (a) { 37 === a.which || 40 === a.which ? (a.preventDefault(), this.stepBack()) : (38 === a.which || 39 === a.which) && (a.preventDefault(), this.stepForward()) }, b.prototype.handleBlur = function () { this.off(this.bar.el_.ownerDocument, "keydown", this.handleKeyPress) }, b.prototype.handleClick = function (a) { a.stopImmediatePropagation(), a.preventDefault() }, b.prototype.vertical = function (a) { return void 0 === a ? this.vertical_ || !1 : (this.vertical_ = !!a, this.addClass(this.vertical_ ? "vjs-slider-vertical" : "vjs-slider-horizontal"), this) }, b
            }(i["default"]); i["default"].registerComponent("Slider", n), c["default"] = n, b.exports = c["default"]
        }, { "../component.js": 67, "../utils/dom.js": 142, "object.assign": 45 }], 120: [function (a, b, c) { "use strict"; function d(a) { return a.streamingFormats = { "rtmp/mp4": "MP4", "rtmp/flv": "FLV" }, a.streamFromParts = function (a, b) { return a + "&" + b }, a.streamToParts = function (a) { var b = { connection: "", stream: "" }; if (!a) return b; var c = a.search(/&(?!\w+=)/), d = void 0; return -1 !== c ? d = c + 1 : (c = d = a.lastIndexOf("/") + 1, 0 === c && (c = d = a.length)), b.connection = a.substring(0, c), b.stream = a.substring(d, a.length), b }, a.isStreamingType = function (b) { return b in a.streamingFormats }, a.RTMP_RE = /^rtmp[set]?:\/\//i, a.isStreamingSrc = function (b) { return a.RTMP_RE.test(b) }, a.rtmpSourceHandler = {}, a.rtmpSourceHandler.canPlayType = function (b) { return a.isStreamingType(b) ? "maybe" : "" }, a.rtmpSourceHandler.canHandleSource = function (b) { var c = a.rtmpSourceHandler.canPlayType(b.type); return c ? c : a.isStreamingSrc(b.src) ? "maybe" : "" }, a.rtmpSourceHandler.handleSource = function (b, c) { var d = a.streamToParts(b.src); c.setRtmpConnection(d.connection), c.setRtmpStream(d.stream) }, a.registerSourceHandler(a.rtmpSourceHandler), a } c.__esModule = !0, c["default"] = d, b.exports = c["default"] }, {}], 121: [function (a, b, c) { "use strict"; function d(a) { if (a && a.__esModule) return a; var b = {}; if (null != a) for (var c in a) Object.prototype.hasOwnProperty.call(a, c) && (b[c] = a[c]); return b["default"] = a, b } function e(a) { return a && a.__esModule ? a : { "default": a } } function f(a, b) { if (!(a instanceof b)) throw new TypeError("Cannot call a class as a function") } function g(a, b) { if ("function" != typeof b && null !== b) throw new TypeError("Super expression must either be null or a function, not " + typeof b); a.prototype = Object.create(b && b.prototype, { constructor: { value: a, enumerable: !1, writable: !0, configurable: !0 } }), b && (Object.setPrototypeOf ? Object.setPrototypeOf(a, b) : a.__proto__ = b) } function h(a) { var b = a.charAt(0).toUpperCase() + a.slice(1); A["set" + b] = function (b) { return this.el_.vjs_setProperty(a, b) } } function i(a) { A[a] = function () { return this.el_.vjs_getProperty(a) } } c.__esModule = !0; for (var j = a("./tech"), k = e(j), l = a("../utils/dom.js"), m = d(l), n = a("../utils/url.js"), o = d(n), p = a("../utils/time-ranges.js"), q = a("./flash-rtmp"), r = e(q), s = a("../component"), t = e(s), u = a("global/window"), v = e(u), w = a("object.assign"), x = e(w), y = v["default"].navigator, z = function (a) { function b(c, d) { f(this, b), a.call(this, c, d), c.source && this.ready(function () { this.setSource(c.source) }, !0), c.startTime && this.ready(function () { this.load(), this.play(), this.currentTime(c.startTime) }, !0), v["default"].videojs = v["default"].videojs || {}, v["default"].videojs.Flash = v["default"].videojs.Flash || {}, v["default"].videojs.Flash.onReady = b.onReady, v["default"].videojs.Flash.onEvent = b.onEvent, v["default"].videojs.Flash.onError = b.onError, this.on("seeked", function () { this.lastSeekTarget_ = void 0 }) } return g(b, a), b.prototype.createEl = function () { var a = this.options_; a.swf || (a.swf = "//vjs.zencdn.net/swf/5.1.0/video-js.swf"); var c = a.techId, d = x["default"]({ readyFunction: "videojs.Flash.onReady", eventProxyFunction: "videojs.Flash.onEvent", errorEventProxyFunction: "videojs.Flash.onError", autoplay: a.autoplay, preload: a.preload, loop: a.loop, muted: a.muted }, a.flashVars), e = x["default"]({ wmode: "opaque", bgcolor: "#000000" }, a.params), f = x["default"]({ id: c, name: c, "class": "vjs-tech" }, a.attributes); return this.el_ = b.embed(a.swf, d, e, f), this.el_.tech = this, this.el_ }, b.prototype.play = function () { this.ended() && this.setCurrentTime(0), this.el_.vjs_play() }, b.prototype.pause = function () { this.el_.vjs_pause() }, b.prototype.src = function (a) { return void 0 === a ? this.currentSrc() : this.setSrc(a) }, b.prototype.setSrc = function (a) { if (a = o.getAbsoluteURL(a), this.el_.vjs_src(a), this.autoplay()) { var b = this; this.setTimeout(function () { b.play() }, 0) } }, b.prototype.seeking = function () { return void 0 !== this.lastSeekTarget_ }, b.prototype.setCurrentTime = function (b) { var c = this.seekable(); c.length && (b = b > c.start(0) ? b : c.start(0), b = b < c.end(c.length - 1) ? b : c.end(c.length - 1), this.lastSeekTarget_ = b, this.trigger("seeking"), this.el_.vjs_setProperty("currentTime", b), a.prototype.setCurrentTime.call(this)) }, b.prototype.currentTime = function () { return this.seeking() ? this.lastSeekTarget_ || 0 : this.el_.vjs_getProperty("currentTime") }, b.prototype.currentSrc = function () { return this.currentSource_ ? this.currentSource_.src : this.el_.vjs_getProperty("currentSrc") }, b.prototype.duration = function c() { if (0 === this.readyState()) return 0 / 0; var c = this.el_.vjs_getProperty("duration"); return c >= 0 ? c : 1 / 0 }, b.prototype.load = function () { this.el_.vjs_load() }, b.prototype.poster = function () { this.el_.vjs_getProperty("poster") }, b.prototype.setPoster = function () { }, b.prototype.seekable = function () { var a = this.duration(); return 0 === a ? p.createTimeRange() : p.createTimeRange(0, a) }, b.prototype.buffered = function () { var a = this.el_.vjs_getProperty("buffered"); return 0 === a.length ? p.createTimeRange() : p.createTimeRange(a[0][0], a[0][1]) }, b.prototype.supportsFullScreen = function () { return !1 }, b.prototype.enterFullScreen = function () { return !1 }, b }(k["default"]), A = z.prototype, B = "rtmpConnection,rtmpStream,preload,defaultPlaybackRate,playbackRate,autoplay,loop,mediaGroup,controller,controls,volume,muted,defaultMuted".split(","), C = "networkState,readyState,initialTime,startOffsetTime,paused,ended,videoWidth,videoHeight".split(","), D = 0; D < B.length; D++)i(B[D]), h(B[D]); for (var D = 0; D < C.length; D++)i(C[D]); z.isSupported = function () { return z.version()[0] >= 10 }, k["default"].withSourceHandlers(z), z.nativeSourceHandler = {}, z.nativeSourceHandler.canPlayType = function (a) { return a in z.formats ? "maybe" : "" }, z.nativeSourceHandler.canHandleSource = function (a) { function b(a) { var b = o.getFileExtension(a); return b ? "video/" + b : "" } var c; return c = a.type ? a.type.replace(/;.*/, "").toLowerCase() : b(a.src), z.nativeSourceHandler.canPlayType(c) }, z.nativeSourceHandler.handleSource = function (a, b) { b.setSrc(a.src) }, z.nativeSourceHandler.dispose = function () { }, z.registerSourceHandler(z.nativeSourceHandler), z.formats = { "video/flv": "FLV", "video/x-flv": "FLV", "video/mp4": "MP4", "video/m4v": "MP4" }, z.onReady = function (a) { var b = m.getEl(a), c = b && b.tech; c && c.el() && z.checkReady(c) }, z.checkReady = function (a) { a.el() && (a.el().vjs_getProperty ? a.triggerReady() : this.setTimeout(function () { z.checkReady(a) }, 50)) }, z.onEvent = function (a, b) { var c = m.getEl(a).tech; c.trigger(b, Array.prototype.slice.call(arguments, 2)) }, z.onError = function (a, b) { var c = m.getEl(a).tech; return "srcnotfound" === b ? c.error(4) : void c.error("FLASH: " + b) }, z.version = function () { var a = "0,0,0"; try { a = new v["default"].ActiveXObject("ShockwaveFlash.ShockwaveFlash").GetVariable("$version").replace(/\D+/g, ",").match(/^,?(.+),?$/)[1] } catch (b) { try { y.mimeTypes["application/x-shockwave-flash"].enabledPlugin && (a = (y.plugins["Shockwave Flash 2.0"] || y.plugins["Shockwave Flash"]).description.replace(/\D+/g, ",").match(/^,?(.+),?$/)[1]) } catch (c) { } } return a.split(",") }, z.embed = function (a, b, c, d) { var e = z.getEmbedCode(a, b, c, d), f = m.createEl("div", { innerHTML: e }).childNodes[0]; return f }, z.getEmbedCode = function (a, b, c, d) { var e = '<object type="application/x-shockwave-flash" ', f = "", g = "", h = ""; return b && Object.getOwnPropertyNames(b).forEach(function (a) { f += a + "=" + b[a] + "&amp;" }), c = x["default"]({ movie: a, flashvars: f, allowScriptAccess: "always", allowNetworking: "all" }, c), Object.getOwnPropertyNames(c).forEach(function (a) { g += '<param name="' + a + '" value="' + c[a] + '" />' }), d = x["default"]({ data: a, width: "100%", height: "100%" }, d), Object.getOwnPropertyNames(d).forEach(function (a) { h += a + '="' + d[a] + '" ' }), "" + e + h + ">" + g + "</object>" }, r["default"](z), t["default"].registerComponent("Flash", z), k["default"].registerTech("Flash", z), c["default"] = z, b.exports = c["default"] }, { "../component": 67, "../utils/dom.js": 142, "../utils/time-ranges.js": 150, "../utils/url.js": 152, "./flash-rtmp": 120, "./tech": 124, "global/window": 2, "object.assign": 45 }], 122: [function (a, b, c) { "use strict"; function d(a) { if (a && a.__esModule) return a; var b = {}; if (null != a) for (var c in a) Object.prototype.hasOwnProperty.call(a, c) && (b[c] = a[c]); return b["default"] = a, b } function e(a) { return a && a.__esModule ? a : { "default": a } } function f(a, b) { if (!(a instanceof b)) throw new TypeError("Cannot call a class as a function") } function g(a, b) { if ("function" != typeof b && null !== b) throw new TypeError("Super expression must either be null or a function, not " + typeof b); a.prototype = Object.create(b && b.prototype, { constructor: { value: a, enumerable: !1, writable: !0, configurable: !0 } }), b && (Object.setPrototypeOf ? Object.setPrototypeOf(a, b) : a.__proto__ = b) } function h(a, b) { return a.raw = b, a } c.__esModule = !0; var i = h(["Text Tracks are being loaded from another origin but the crossorigin attribute isn't used. \n            This may prevent text tracks from loading."], ["Text Tracks are being loaded from another origin but the crossorigin attribute isn't used. \n            This may prevent text tracks from loading."]), j = a("./tech.js"), k = e(j), l = a("../component"), m = e(l), n = a("../utils/dom.js"), o = d(n), p = a("../utils/url.js"), q = d(p), r = a("../utils/fn.js"), s = d(r), t = a("../utils/log.js"), u = e(t), v = a("tsml"), w = e(v), x = a("../../../src/js/tracks/text-track.js"), y = (e(x), a("../utils/browser.js")), z = d(y), A = a("global/document"), B = e(A), C = a("global/window"), D = e(C), E = a("object.assign"), F = e(E), G = a("../utils/merge-options.js"), H = e(G), I = a("../utils/to-title-case.js"), J = e(I), K = function (a) { function b(c, d) { var e = this; f(this, b), a.call(this, c, d); var g = c.source, h = !1; if (g && (this.el_.currentSrc !== g.src || c.tag && 3 === c.tag.initNetworkState_) ? this.setSource(g) : this.handleLateInit_(this.el_), this.el_.hasChildNodes()) { for (var j = this.el_.childNodes, k = j.length, l = []; k--;) { var m = j[k], n = m.nodeName.toLowerCase(); "track" === n && (this.featuresNativeTextTracks ? (this.remoteTextTrackEls().addTrackElement_(m), this.remoteTextTracks().addTrack_(m.track), h || this.el_.hasAttribute("crossorigin") || !q.isCrossOrigin(m.src) || (h = !0)) : l.push(m)) } for (var o = 0; o < l.length; o++)this.el_.removeChild(l[o]) } var p = ["audio", "video"]; p.forEach(function (a) { var b = J["default"](a); if (e["featuresNative" + b + "Tracks"]) { var c = e.el()[a + "Tracks"]; c && c.addEventListener && (c.addEventListener("change", s.bind(e, e["handle" + b + "TrackChange_"])), c.addEventListener("addtrack", s.bind(e, e["handle" + b + "TrackAdd_"])), c.addEventListener("removetrack", s.bind(e, e["handle" + b + "TrackRemove_"])), e.on("loadstart", e["removeOld" + b + "Tracks_"])) } }), this.featuresNativeTextTracks && (h && u["default"].warn(w["default"](i)), this.handleTextTrackChange_ = s.bind(this, this.handleTextTrackChange), this.handleTextTrackAdd_ = s.bind(this, this.handleTextTrackAdd), this.handleTextTrackRemove_ = s.bind(this, this.handleTextTrackRemove), this.proxyNativeTextTracks_()), (z.TOUCH_ENABLED || z.IS_IPHONE || z.IS_NATIVE_ANDROID) && c.nativeControlsForTouch === !0 && this.setControls(!0), this.triggerReady() } return g(b, a), b.prototype.dispose = function () { var c = this;["audio", "video", "text"].forEach(function (a) { var b = J["default"](a), d = c.el_[a + "Tracks"]; d && d.removeEventListener && (d.removeEventListener("change", c["handle" + b + "TrackChange_"]), d.removeEventListener("addtrack", c["handle" + b + "TrackAdd_"]), d.removeEventListener("removetrack", c["handle" + b + "TrackRemove_"])), d && c.off("loadstart", c["removeOld" + b + "Tracks_"]) }), b.disposeMediaElement(this.el_), a.prototype.dispose.call(this) }, b.prototype.createEl = function () { var a = this.options_.tag; if (!a || this.movingMediaElementInDOM === !1) if (a) { var c = a.cloneNode(!0); a.parentNode.insertBefore(c, a), b.disposeMediaElement(a), a = c } else { a = B["default"].createElement("video"); var d = this.options_.tag && o.getElAttributes(this.options_.tag), e = H["default"]({}, d); z.TOUCH_ENABLED && this.options_.nativeControlsForTouch === !0 || delete e.controls, o.setElAttributes(a, F["default"](e, { id: this.options_.techId, "class": "vjs-tech" })) } for (var f = ["autoplay", "preload", "loop", "muted"], g = f.length - 1; g >= 0; g--) { var h = f[g], i = {}; "undefined" != typeof this.options_[h] && (i[h] = this.options_[h]), o.setElAttributes(a, i) } return a }, b.prototype.handleLateInit_ = function (a) { var b = this; if (0 !== a.networkState && 3 !== a.networkState) { if (0 === a.readyState) { var c = function () { var a = !1, c = function () { a = !0 }; b.on("loadstart", c); var d = function () { a || this.trigger("loadstart") }; return b.on("loadedmetadata", d), b.ready(function () { this.off("loadstart", c), this.off("loadedmetadata", d), a || this.trigger("loadstart") }), { v: void 0 } }(); if ("object" == typeof c) return c.v } var d = ["loadstart"]; d.push("loadedmetadata"), a.readyState >= 2 && d.push("loadeddata"), a.readyState >= 3 && d.push("canplay"), a.readyState >= 4 && d.push("canplaythrough"), this.ready(function () { d.forEach(function (a) { this.trigger(a) }, this) }) } }, b.prototype.proxyNativeTextTracks_ = function () { var a = this.el().textTracks; if (a) { for (var b = 0; b < a.length; b++)this.textTracks().addTrack_(a[b]); a.addEventListener && (a.addEventListener("change", this.handleTextTrackChange_), a.addEventListener("addtrack", this.handleTextTrackAdd_), a.addEventListener("removetrack", this.handleTextTrackRemove_)), this.on("loadstart", this.removeOldTextTracks_) } }, b.prototype.handleTextTrackChange = function () { var a = this.textTracks(); this.textTracks().trigger({ type: "change", target: a, currentTarget: a, srcElement: a }) }, b.prototype.handleTextTrackAdd = function (a) { this.textTracks().addTrack_(a.track) }, b.prototype.handleTextTrackRemove = function (a) { this.textTracks().removeTrack_(a.track) }, b.prototype.handleVideoTrackChange_ = function () { var a = this.videoTracks(); this.videoTracks().trigger({ type: "change", target: a, currentTarget: a, srcElement: a }) }, b.prototype.handleVideoTrackAdd_ = function (a) { this.videoTracks().addTrack_(a.track) }, b.prototype.handleVideoTrackRemove_ = function (a) { this.videoTracks().removeTrack_(a.track) }, b.prototype.handleAudioTrackChange_ = function () { var a = this.audioTracks(); this.audioTracks().trigger({ type: "change", target: a, currentTarget: a, srcElement: a }) }, b.prototype.handleAudioTrackAdd_ = function (a) { this.audioTracks().addTrack_(a.track) }, b.prototype.handleAudioTrackRemove_ = function (a) { this.audioTracks().removeTrack_(a.track) }, b.prototype.removeOldTracks_ = function (a, b) { var c = []; if (b) { for (var d = 0; d < a.length; d++) { for (var e = a[d], f = !1, g = 0; g < b.length; g++)if (b[g] === e) { f = !0; break } f || c.push(e) } for (var d = 0; d < c.length; d++) { var h = c[d]; a.removeTrack_(h) } } }, b.prototype.removeOldTextTracks_ = function () { var a = this.textTracks(), b = this.el().textTracks; this.removeOldTracks_(a, b) }, b.prototype.removeOldAudioTracks_ = function () { var a = this.audioTracks(), b = this.el().audioTracks; this.removeOldTracks_(a, b) }, b.prototype.removeOldVideoTracks_ = function () { var a = this.videoTracks(), b = this.el().videoTracks; this.removeOldTracks_(a, b) }, b.prototype.play = function () { var a = this.el_.play(); void 0 !== a && "function" == typeof a.then && a.then(null, function () { }) }, b.prototype.pause = function () { this.el_.pause() }, b.prototype.paused = function () { return this.el_.paused }, b.prototype.currentTime = function () { return this.el_.currentTime }, b.prototype.setCurrentTime = function (a) { try { this.el_.currentTime = a } catch (b) { u["default"](b, "Video is not ready. (Video.js)") } }, b.prototype.duration = function () { return this.el_.duration || 0 }, b.prototype.buffered = function () { return this.el_.buffered }, b.prototype.volume = function () { return this.el_.volume }, b.prototype.setVolume = function (a) { this.el_.volume = a }, b.prototype.muted = function () { return this.el_.muted }, b.prototype.setMuted = function (a) { this.el_.muted = a }, b.prototype.width = function () { return this.el_.offsetWidth }, b.prototype.height = function () { return this.el_.offsetHeight }, b.prototype.supportsFullScreen = function () { if ("function" == typeof this.el_.webkitEnterFullScreen) { var a = D["default"].navigator.userAgent; if (/Android/.test(a) || !/Chrome|Mac OS X 10.5/.test(a)) return !0 } return !1 }, b.prototype.enterFullScreen = function () { var a = this.el_; "webkitDisplayingFullscreen" in a && this.one("webkitbeginfullscreen", function () { this.one("webkitendfullscreen", function () { this.trigger("fullscreenchange", { isFullscreen: !1 }) }), this.trigger("fullscreenchange", { isFullscreen: !0 }) }), a.paused && a.networkState <= a.HAVE_METADATA ? (this.el_.play(), this.setTimeout(function () { a.pause(), a.webkitEnterFullScreen() }, 0)) : a.webkitEnterFullScreen() }, b.prototype.exitFullScreen = function () { this.el_.webkitExitFullScreen() }, b.prototype.src = function (a) { return void 0 === a ? this.el_.src : void this.setSrc(a) }, b.prototype.setSrc = function (a) { this.el_.src = a }, b.prototype.load = function () { this.el_.load() }, b.prototype.reset = function () { b.resetMediaElement(this.el_) }, b.prototype.currentSrc = function () { return this.currentSource_ ? this.currentSource_.src : this.el_.currentSrc }, b.prototype.poster = function () { return this.el_.poster }, b.prototype.setPoster = function (a) { this.el_.poster = a }, b.prototype.preload = function () { return this.el_.preload }, b.prototype.setPreload = function (a) { this.el_.preload = a }, b.prototype.autoplay = function () { return this.el_.autoplay }, b.prototype.setAutoplay = function (a) { this.el_.autoplay = a }, b.prototype.controls = function () { return this.el_.controls }, b.prototype.setControls = function (a) { this.el_.controls = !!a }, b.prototype.loop = function () { return this.el_.loop }, b.prototype.setLoop = function (a) { this.el_.loop = a }, b.prototype.error = function () { return this.el_.error }, b.prototype.seeking = function () { return this.el_.seeking }, b.prototype.seekable = function () { return this.el_.seekable }, b.prototype.ended = function () { return this.el_.ended }, b.prototype.defaultMuted = function () { return this.el_.defaultMuted }, b.prototype.playbackRate = function () { return this.el_.playbackRate }, b.prototype.played = function () { return this.el_.played }, b.prototype.setPlaybackRate = function (a) { this.el_.playbackRate = a }, b.prototype.networkState = function () { return this.el_.networkState }, b.prototype.readyState = function () { return this.el_.readyState }, b.prototype.videoWidth = function () { return this.el_.videoWidth }, b.prototype.videoHeight = function () { return this.el_.videoHeight }, b.prototype.textTracks = function () { return a.prototype.textTracks.call(this) }, b.prototype.addTextTrack = function (b, c, d) { return this.featuresNativeTextTracks ? this.el_.addTextTrack(b, c, d) : a.prototype.addTextTrack.call(this, b, c, d) }, b.prototype.addRemoteTextTrack = function () { var b = arguments.length <= 0 || void 0 === arguments[0] ? {} : arguments[0]; if (!this.featuresNativeTextTracks) return a.prototype.addRemoteTextTrack.call(this, b); var c = B["default"].createElement("track"); return b.kind && (c.kind = b.kind), b.label && (c.label = b.label), (b.language || b.srclang) && (c.srclang = b.language || b.srclang), b["default"] && (c["default"] = b["default"]), b.id && (c.id = b.id), b.src && (c.src = b.src), this.el().appendChild(c), this.remoteTextTrackEls().addTrackElement_(c), this.remoteTextTracks().addTrack_(c.track), c }, b.prototype.removeRemoteTextTrack = function (b) { if (!this.featuresNativeTextTracks) return a.prototype.removeRemoteTextTrack.call(this, b); var c = void 0, d = void 0, e = this.remoteTextTrackEls().getTrackElementByTrack_(b); for (this.remoteTextTrackEls().removeTrackElement_(e), this.remoteTextTracks().removeTrack_(b), c = this.$$("track"), d = c.length; d--;)(b === c[d] || b === c[d].track) && this.el().removeChild(c[d]) }, b }(k["default"]); K.TEST_VID = B["default"].createElement("video"); var L = B["default"].createElement("track"); L.kind = "captions", L.srclang = "en", L.label = "English", K.TEST_VID.appendChild(L), K.isSupported = function () { try { K.TEST_VID.volume = .5 } catch (a) { return !1 } return !!K.TEST_VID.canPlayType }, k["default"].withSourceHandlers(K), K.nativeSourceHandler = {}, K.nativeSourceHandler.canPlayType = function (a) { try { return K.TEST_VID.canPlayType(a) } catch (b) { return "" } }, K.nativeSourceHandler.canHandleSource = function (a) { var b; return a.type ? K.nativeSourceHandler.canPlayType(a.type) : a.src ? (b = q.getFileExtension(a.src), K.nativeSourceHandler.canPlayType("video/" + b)) : "" }, K.nativeSourceHandler.handleSource = function (a, b) { b.setSrc(a.src) }, K.nativeSourceHandler.dispose = function () { }, K.registerSourceHandler(K.nativeSourceHandler), K.canControlVolume = function () { try { var a = K.TEST_VID.volume; return K.TEST_VID.volume = a / 2 + .1, a !== K.TEST_VID.volume } catch (b) { return !1 } }, K.canControlPlaybackRate = function () { if (z.IS_ANDROID && z.IS_CHROME) return !1; try { var a = K.TEST_VID.playbackRate; return K.TEST_VID.playbackRate = a / 2 + .1, a !== K.TEST_VID.playbackRate } catch (b) { return !1 } }, K.supportsNativeTextTracks = function () { var a; return a = !!K.TEST_VID.textTracks, a && K.TEST_VID.textTracks.length > 0 && (a = "number" != typeof K.TEST_VID.textTracks[0].mode), a && z.IS_FIREFOX && (a = !1), !a || "onremovetrack" in K.TEST_VID.textTracks || (a = !1), a }, K.supportsNativeVideoTracks = function () { var a = !!K.TEST_VID.videoTracks; return a }, K.supportsNativeAudioTracks = function () { var a = !!K.TEST_VID.audioTracks; return a }, K.Events = ["loadstart", "suspend", "abort", "error", "emptied", "stalled", "loadedmetadata", "loadeddata", "canplay", "canplaythrough", "playing", "waiting", "seeking", "seeked", "ended", "durationchange", "timeupdate", "progress", "play", "pause", "ratechange", "volumechange"], K.prototype.featuresVolumeControl = K.canControlVolume(), K.prototype.featuresPlaybackRate = K.canControlPlaybackRate(), K.prototype.movingMediaElementInDOM = !z.IS_IOS, K.prototype.featuresFullscreenResize = !0, K.prototype.featuresProgressEvents = !0, K.prototype.featuresNativeTextTracks = K.supportsNativeTextTracks(), K.prototype.featuresNativeVideoTracks = K.supportsNativeVideoTracks(), K.prototype.featuresNativeAudioTracks = K.supportsNativeAudioTracks(); var M = void 0, N = /^application\/(?:x-|vnd\.apple\.)mpegurl/i, O = /^video\/mp4/i; K.patchCanPlayType = function () { z.ANDROID_VERSION >= 4 && (M || (M = K.TEST_VID.constructor.prototype.canPlayType), K.TEST_VID.constructor.prototype.canPlayType = function (a) { return a && N.test(a) ? "maybe" : M.call(this, a) }), z.IS_OLD_ANDROID && (M || (M = K.TEST_VID.constructor.prototype.canPlayType), K.TEST_VID.constructor.prototype.canPlayType = function (a) { return a && O.test(a) ? "maybe" : M.call(this, a) }) }, K.unpatchCanPlayType = function () { var a = K.TEST_VID.constructor.prototype.canPlayType; return K.TEST_VID.constructor.prototype.canPlayType = M, M = null, a }, K.patchCanPlayType(), K.disposeMediaElement = function (a) { if (a) { for (a.parentNode && a.parentNode.removeChild(a); a.hasChildNodes();)a.removeChild(a.firstChild); a.removeAttribute("src"), "function" == typeof a.load && !function () { try { a.load() } catch (b) { } }() } }, K.resetMediaElement = function (a) { if (a) { for (var b = a.querySelectorAll("source"), c = b.length; c--;)a.removeChild(b[c]); a.removeAttribute("src"), "function" == typeof a.load && !function () { try { a.load() } catch (b) { } }() } }, m["default"].registerComponent("Html5", K), k["default"].registerTech("Html5", K), c["default"] = K, b.exports = c["default"] }, { "../../../src/js/tracks/text-track.js": 134, "../component": 67, "../utils/browser.js": 140, "../utils/dom.js": 142, "../utils/fn.js": 144, "../utils/log.js": 147, "../utils/merge-options.js": 148, "../utils/to-title-case.js": 151, "../utils/url.js": 152, "./tech.js": 124, "global/document": 1, "global/window": 2, "object.assign": 45, tsml: 55 }], 123: [function (a, b, c) { "use strict"; function d(a) { return a && a.__esModule ? a : { "default": a } } function e(a, b) { if (!(a instanceof b)) throw new TypeError("Cannot call a class as a function") } function f(a, b) { if ("function" != typeof b && null !== b) throw new TypeError("Super expression must either be null or a function, not " + typeof b); a.prototype = Object.create(b && b.prototype, { constructor: { value: a, enumerable: !1, writable: !0, configurable: !0 } }), b && (Object.setPrototypeOf ? Object.setPrototypeOf(a, b) : a.__proto__ = b) } c.__esModule = !0; var g = a("../component.js"), h = d(g), i = a("./tech.js"), j = d(i), k = a("global/window"), l = (d(k), a("../utils/to-title-case.js")), m = d(l), n = function (a) { function b(c, d, f) { if (e(this, b), a.call(this, c, d, f), d.playerOptions.sources && 0 !== d.playerOptions.sources.length) c.src(d.playerOptions.sources); else for (var g = 0, i = d.playerOptions.techOrder; g < i.length; g++) { var k = m["default"](i[g]), l = j["default"].getTech(k); if (k || (l = h["default"].getComponent(k)), l && l.isSupported()) { c.loadTech_(k); break } } } return f(b, a), b }(h["default"]); h["default"].registerComponent("MediaLoader", n), c["default"] = n, b.exports = c["default"] }, { "../component.js": 67, "../utils/to-title-case.js": 151, "./tech.js": 124, "global/window": 2 }], 124: [function (a, b, c) {
            "use strict"; function d(a) { if (a && a.__esModule) return a; var b = {}; if (null != a) for (var c in a) Object.prototype.hasOwnProperty.call(a, c) && (b[c] = a[c]); return b["default"] = a, b } function e(a) { return a && a.__esModule ? a : { "default": a } } function f(a, b) { if (!(a instanceof b)) throw new TypeError("Cannot call a class as a function") } function g(a, b) { if ("function" != typeof b && null !== b) throw new TypeError("Super expression must either be null or a function, not " + typeof b); a.prototype = Object.create(b && b.prototype, { constructor: { value: a, enumerable: !1, writable: !0, configurable: !0 } }), b && (Object.setPrototypeOf ? Object.setPrototypeOf(a, b) : a.__proto__ = b) } c.__esModule = !0; var h = a("../component"), i = e(h), j = a("../tracks/html-track-element"), k = e(j), l = a("../tracks/html-track-element-list"), m = e(l), n = a("../utils/merge-options.js"), o = e(n), p = a("../tracks/text-track"), q = e(p), r = a("../tracks/text-track-list"), s = e(r), t = a("../tracks/video-track"), u = (e(t), a("../tracks/video-track-list")), v = e(u), w = a("../tracks/audio-track-list"), x = e(w), y = a("../tracks/audio-track"), z = (e(y), a("../utils/fn.js")), A = d(z), B = a("../utils/log.js"), C = e(B), D = a("../utils/time-ranges.js"), E = a("../utils/buffer.js"), F = a("../media-error.js"), G = e(F), H = a("global/window"), I = e(H), J = a("global/document"), K = e(J), L = function (a) {
                function b() { var c = arguments.length <= 0 || void 0 === arguments[0] ? {} : arguments[0], d = arguments.length <= 1 || void 0 === arguments[1] ? function () { } : arguments[1]; f(this, b), c.reportTouchActivity = !1, a.call(this, null, c, d), this.hasStarted_ = !1, this.on("playing", function () { this.hasStarted_ = !0 }), this.on("loadstart", function () { this.hasStarted_ = !1 }), this.textTracks_ = c.textTracks, this.videoTracks_ = c.videoTracks, this.audioTracks_ = c.audioTracks, this.featuresProgressEvents || this.manualProgressOn(), this.featuresTimeupdateEvents || this.manualTimeUpdatesOn(), (c.nativeCaptions === !1 || c.nativeTextTracks === !1) && (this.featuresNativeTextTracks = !1), this.featuresNativeTextTracks || this.on("ready", this.emulateTextTracks), this.initTextTrackListeners(), this.initTrackListeners(), this.emitTapEvents() }/*! Time Tracking -------------------------------------------------------------- */
                return g(b, a), b.prototype.manualProgressOn = function () { this.on("durationchange", this.onDurationChange), this.manualProgress = !0, this.one("ready", this.trackProgress) }, b.prototype.manualProgressOff = function () { this.manualProgress = !1, this.stopTrackingProgress(), this.off("durationchange", this.onDurationChange) }, b.prototype.trackProgress = function () { this.stopTrackingProgress(), this.progressInterval = this.setInterval(A.bind(this, function () { var a = this.bufferedPercent(); this.bufferedPercent_ !== a && this.trigger("progress"), this.bufferedPercent_ = a, 1 === a && this.stopTrackingProgress() }), 500) }, b.prototype.onDurationChange = function () { this.duration_ = this.duration() }, b.prototype.buffered = function () { return D.createTimeRange(0, 0) }, b.prototype.bufferedPercent = function () { return E.bufferedPercent(this.buffered(), this.duration_) }, b.prototype.stopTrackingProgress = function () { this.clearInterval(this.progressInterval) }, b.prototype.manualTimeUpdatesOn = function () { this.manualTimeUpdates = !0, this.on("play", this.trackCurrentTime), this.on("pause", this.stopTrackingCurrentTime) }, b.prototype.manualTimeUpdatesOff = function () { this.manualTimeUpdates = !1, this.stopTrackingCurrentTime(), this.off("play", this.trackCurrentTime), this.off("pause", this.stopTrackingCurrentTime) }, b.prototype.trackCurrentTime = function () { this.currentTimeInterval && this.stopTrackingCurrentTime(), this.currentTimeInterval = this.setInterval(function () { this.trigger({ type: "timeupdate", target: this, manuallyTriggered: !0 }) }, 250) }, b.prototype.stopTrackingCurrentTime = function () { this.clearInterval(this.currentTimeInterval), this.trigger({ type: "timeupdate", target: this, manuallyTriggered: !0 }) }, b.prototype.dispose = function () { this.clearTracks(["audio", "video", "text"]), this.manualProgress && this.manualProgressOff(), this.manualTimeUpdates && this.manualTimeUpdatesOff(), a.prototype.dispose.call(this) }, b.prototype.clearTracks = function (a) { var b = this; a = [].concat(a), a.forEach(function (a) { for (var c = b[a + "Tracks"]() || [], d = c.length; d--;) { var e = c[d]; "text" === a && b.removeRemoteTextTrack(e), c.removeTrack_(e) } }) }, b.prototype.reset = function () { }, b.prototype.error = function (a) { return void 0 !== a && (this.error_ = new G["default"](a), this.trigger("error")), this.error_ }, b.prototype.played = function () { return this.hasStarted_ ? D.createTimeRange(0, 0) : D.createTimeRange() }, b.prototype.setCurrentTime = function () { this.manualTimeUpdates && this.trigger({ type: "timeupdate", target: this, manuallyTriggered: !0 }) }, b.prototype.initTextTrackListeners = function () { var a = A.bind(this, function () { this.trigger("texttrackchange") }), b = this.textTracks(); b && (b.addEventListener("removetrack", a), b.addEventListener("addtrack", a), this.on("dispose", A.bind(this, function () { b.removeEventListener("removetrack", a), b.removeEventListener("addtrack", a) }))) }, b.prototype.initTrackListeners = function () { var a = this, b = ["video", "audio"]; b.forEach(function (b) { var c = function () { a.trigger(b + "trackchange") }, d = a[b + "Tracks"](); d.addEventListener("removetrack", c), d.addEventListener("addtrack", c), a.on("dispose", function () { d.removeEventListener("removetrack", c), d.removeEventListener("addtrack", c) }) }) }, b.prototype.emulateTextTracks = function () { var a = this, b = this.textTracks(); if (b) { I["default"].WebVTT || null == this.el().parentNode || !function () { var b = K["default"].createElement("script"); b.src = a.options_["vtt.js"] || "https://cdn.rawgit.com/gkatsev/vtt.js/vjs-v0.12.1/dist/vtt.min.js", b.onload = function () { a.trigger("vttjsloaded") }, b.onerror = function () { a.trigger("vttjserror") }, a.on("dispose", function () { b.onload = null, b.onerror = null }), I["default"].WebVTT = !0, a.el().parentNode.appendChild(b) }(); var c = function () { return a.trigger("texttrackchange") }, d = function () { c(); for (var a = 0; a < b.length; a++) { var d = b[a]; d.removeEventListener("cuechange", c), "showing" === d.mode && d.addEventListener("cuechange", c) } }; d(), b.addEventListener("change", d), this.on("dispose", function () { b.removeEventListener("change", d) }) } }, b.prototype.videoTracks = function () { return this.videoTracks_ = this.videoTracks_ || new v["default"], this.videoTracks_ }, b.prototype.audioTracks = function () { return this.audioTracks_ = this.audioTracks_ || new x["default"], this.audioTracks_ }, b.prototype.textTracks = function () { return this.textTracks_ = this.textTracks_ || new s["default"], this.textTracks_ }, b.prototype.remoteTextTracks = function () { return this.remoteTextTracks_ = this.remoteTextTracks_ || new s["default"], this.remoteTextTracks_ }, b.prototype.remoteTextTrackEls = function () { return this.remoteTextTrackEls_ = this.remoteTextTrackEls_ || new m["default"], this.remoteTextTrackEls_ }, b.prototype.addTextTrack = function (a, b, c) { if (!a) throw new Error("TextTrack kind is required but was not provided"); return M(this, a, b, c) }, b.prototype.addRemoteTextTrack = function (a) { var b = o["default"](a, { tech: this }), c = new k["default"](b); return this.remoteTextTrackEls().addTrackElement_(c), this.remoteTextTracks().addTrack_(c.track), this.textTracks().addTrack_(c.track), c }, b.prototype.removeRemoteTextTrack = function (a) { this.textTracks().removeTrack_(a); var b = this.remoteTextTrackEls().getTrackElementByTrack_(a); this.remoteTextTrackEls().removeTrackElement_(b), this.remoteTextTracks().removeTrack_(a) }, b.prototype.setPoster = function () { }, b.prototype.canPlayType = function () { return "" }, b.isTech = function (a) { return a.prototype instanceof b || a instanceof b || a === b }, b.registerTech = function (a, c) { if (b.techs_ || (b.techs_ = {}), !b.isTech(c)) throw new Error("Tech " + a + " must be a Tech"); return b.techs_[a] = c, c }, b.getTech = function (a) { return b.techs_ && b.techs_[a] ? b.techs_[a] : I["default"] && I["default"].videojs && I["default"].videojs[a] ? (C["default"].warn("The " + a + " tech was added to the videojs object when it should be registered using videojs.registerTech(name, tech)"), I["default"].videojs[a]) : void 0 }, b
            }(i["default"]); L.prototype.textTracks_, L.prototype.audioTracks_, L.prototype.videoTracks_; var M = function (a, b, c, d) { var e = arguments.length <= 4 || void 0 === arguments[4] ? {} : arguments[4], f = a.textTracks(); e.kind = b, c && (e.label = c), d && (e.language = d), e.tech = a; var g = new q["default"](e); return f.addTrack_(g), g }; L.prototype.featuresVolumeControl = !0, L.prototype.featuresFullscreenResize = !1, L.prototype.featuresPlaybackRate = !1, L.prototype.featuresProgressEvents = !1, L.prototype.featuresTimeupdateEvents = !1, L.prototype.featuresNativeTextTracks = !1, L.withSourceHandlers = function (a) { a.registerSourceHandler = function (b, c) { var d = a.sourceHandlers; d || (d = a.sourceHandlers = []), void 0 === c && (c = d.length), d.splice(c, 0, b) }, a.canPlayType = function (b) { for (var c = a.sourceHandlers || [], d = void 0, e = 0; e < c.length; e++)if (d = c[e].canPlayType(b)) return d; return "" }, a.selectSourceHandler = function (b, c) { for (var d = a.sourceHandlers || [], e = void 0, f = 0; f < d.length; f++)if (e = d[f].canHandleSource(b, c)) return d[f]; return null }, a.canPlaySource = function (b, c) { var d = a.selectSourceHandler(b, c); return d ? d.canHandleSource(b, c) : "" }; var b = ["seekable", "duration"]; b.forEach(function (a) { var b = this[a]; "function" == typeof b && (this[a] = function () { return this.sourceHandler_ && this.sourceHandler_[a] ? this.sourceHandler_[a].apply(this.sourceHandler_, arguments) : b.apply(this, arguments) }) }, a.prototype), a.prototype.setSource = function (b) { var c = a.selectSourceHandler(b, this.options_); return c || (a.nativeSourceHandler ? c = a.nativeSourceHandler : C["default"].error("No source hander found for the current source.")), this.disposeSourceHandler(), this.off("dispose", this.disposeSourceHandler), this.currentSource_ && (this.clearTracks(["audio", "video"]), this.currentSource_ = null), c !== a.nativeSourceHandler && (this.currentSource_ = b, this.off(this.el_, "loadstart", a.prototype.firstLoadStartListener_), this.off(this.el_, "loadstart", a.prototype.successiveLoadStartListener_), this.one(this.el_, "loadstart", a.prototype.firstLoadStartListener_)), this.sourceHandler_ = c.handleSource(b, this, this.options_), this.on("dispose", this.disposeSourceHandler), this }, a.prototype.firstLoadStartListener_ = function () { this.one(this.el_, "loadstart", a.prototype.successiveLoadStartListener_) }, a.prototype.successiveLoadStartListener_ = function () { this.currentSource_ = null, this.disposeSourceHandler(), this.one(this.el_, "loadstart", a.prototype.successiveLoadStartListener_) }, a.prototype.disposeSourceHandler = function () { this.sourceHandler_ && this.sourceHandler_.dispose && (this.off(this.el_, "loadstart", a.prototype.firstLoadStartListener_), this.off(this.el_, "loadstart", a.prototype.successiveLoadStartListener_), this.sourceHandler_.dispose(), this.sourceHandler_ = null) } }, i["default"].registerComponent("Tech", L), i["default"].registerComponent("MediaTechController", L), L.registerTech("Tech", L), c["default"] = L, b.exports = c["default"]
        }, { "../component": 67, "../media-error.js": 108, "../tracks/audio-track": 126, "../tracks/audio-track-list": 125, "../tracks/html-track-element": 128, "../tracks/html-track-element-list": 127, "../tracks/text-track": 134, "../tracks/text-track-list": 132, "../tracks/video-track": 139, "../tracks/video-track-list": 138, "../utils/buffer.js": 141, "../utils/fn.js": 144, "../utils/log.js": 147, "../utils/merge-options.js": 148, "../utils/time-ranges.js": 150, "global/document": 1, "global/window": 2 }], 125: [function (a, b, c) { "use strict"; function d(a) { if (a && a.__esModule) return a; var b = {}; if (null != a) for (var c in a) Object.prototype.hasOwnProperty.call(a, c) && (b[c] = a[c]); return b["default"] = a, b } function e(a) { return a && a.__esModule ? a : { "default": a } } function f(a, b) { if (!(a instanceof b)) throw new TypeError("Cannot call a class as a function") } function g(a, b) { if ("function" != typeof b && null !== b) throw new TypeError("Super expression must either be null or a function, not " + typeof b); a.prototype = Object.create(b && b.prototype, { constructor: { value: a, enumerable: !1, writable: !0, configurable: !0 } }), b && (Object.setPrototypeOf ? Object.setPrototypeOf(a, b) : a.__proto__ = b) } c.__esModule = !0; var h = a("./track-list"), i = e(h), j = a("../utils/browser.js"), k = d(j), l = a("global/document"), m = e(l), n = function (a, b) { for (var c = 0; c < a.length; c++)b.id !== a[c].id && (a[c].enabled = !1) }, o = function (a) { function b() { var c = arguments.length <= 0 || void 0 === arguments[0] ? [] : arguments[0]; f(this, b); for (var d = void 0, e = c.length - 1; e >= 0; e--)if (c[e].enabled) { n(c, c[e]); break } if (k.IS_IE8) { d = m["default"].createElement("custom"); for (var g in i["default"].prototype) "constructor" !== g && (d[g] = i["default"].prototype[g]); for (var g in b.prototype) "constructor" !== g && (d[g] = b.prototype[g]) } return d = a.call(this, c, d), d.changing_ = !1, d } return g(b, a), b.prototype.addTrack_ = function (b) { var c = this; b.enabled && n(this, b), a.prototype.addTrack_.call(this, b), b.addEventListener && b.addEventListener("enabledchange", function () { c.changing_ || (c.changing_ = !0, n(c, b), c.changing_ = !1, c.trigger("change")) }) }, b.prototype.addTrack = function (a) { this.addTrack_(a) }, b.prototype.removeTrack = function (b) { a.prototype.removeTrack_.call(this, b) }, b }(i["default"]); c["default"] = o, b.exports = c["default"] }, { "../utils/browser.js": 140, "./track-list": 136, "global/document": 1 }], 126: [function (a, b, c) { "use strict"; function d(a) { if (a && a.__esModule) return a; var b = {}; if (null != a) for (var c in a) Object.prototype.hasOwnProperty.call(a, c) && (b[c] = a[c]); return b["default"] = a, b } function e(a) { return a && a.__esModule ? a : { "default": a } } function f(a, b) { if (!(a instanceof b)) throw new TypeError("Cannot call a class as a function") } function g(a, b) { if ("function" != typeof b && null !== b) throw new TypeError("Super expression must either be null or a function, not " + typeof b); a.prototype = Object.create(b && b.prototype, { constructor: { value: a, enumerable: !1, writable: !0, configurable: !0 } }), b && (Object.setPrototypeOf ? Object.setPrototypeOf(a, b) : a.__proto__ = b) } c.__esModule = !0; var h = a("./track-enums"), i = a("./track"), j = e(i), k = a("../utils/merge-options"), l = e(k), m = a("../utils/browser.js"), n = d(m), o = function (a) { function b() { var c = arguments.length <= 0 || void 0 === arguments[0] ? {} : arguments[0]; f(this, b); var d = l["default"](c, { kind: h.AudioTrackKind[c.kind] || "" }), e = a.call(this, d), g = !1; if (n.IS_IE8) for (var i in b.prototype) "constructor" !== i && (e[i] = b.prototype[i]); return Object.defineProperty(e, "enabled", { get: function () { return g }, set: function (a) { "boolean" == typeof a && a !== g && (g = a, this.trigger("enabledchange")) } }), d.enabled && (e.enabled = d.enabled), e.loaded_ = !0, e } return g(b, a), b }(j["default"]); c["default"] = o, b.exports = c["default"] }, { "../utils/browser.js": 140, "../utils/merge-options": 148, "./track": 137, "./track-enums": 135 }], 127: [function (a, b, c) { "use strict"; function d(a) { return a && a.__esModule ? a : { "default": a } } function e(a) { if (a && a.__esModule) return a; var b = {}; if (null != a) for (var c in a) Object.prototype.hasOwnProperty.call(a, c) && (b[c] = a[c]); return b["default"] = a, b } function f(a, b) { if (!(a instanceof b)) throw new TypeError("Cannot call a class as a function") } c.__esModule = !0; var g = a("../utils/browser.js"), h = e(g), i = a("global/document"), j = d(i), k = function () { function a() { var b = arguments.length <= 0 || void 0 === arguments[0] ? [] : arguments[0]; f(this, a); var c = this; if (h.IS_IE8) { c = j["default"].createElement("custom"); for (var d in a.prototype) "constructor" !== d && (c[d] = a.prototype[d]) } c.trackElements_ = [], Object.defineProperty(c, "length", { get: function () { return this.trackElements_.length } }); for (var e = 0, g = b.length; g > e; e++)c.addTrackElement_(b[e]); return h.IS_IE8 ? c : void 0 } return a.prototype.addTrackElement_ = function (a) { this.trackElements_.push(a) }, a.prototype.getTrackElementByTrack_ = function (a) { for (var b = void 0, c = 0, d = this.trackElements_.length; d > c; c++)if (a === this.trackElements_[c].track) { b = this.trackElements_[c]; break } return b }, a.prototype.removeTrackElement_ = function (a) { for (var b = 0, c = this.trackElements_.length; c > b; b++)if (a === this.trackElements_[b]) { this.trackElements_.splice(b, 1); break } }, a }(); c["default"] = k, b.exports = c["default"] }, { "../utils/browser.js": 140, "global/document": 1 }], 128: [function (a, b, c) { "use strict"; function d(a) { return a && a.__esModule ? a : { "default": a } } function e(a) { if (a && a.__esModule) return a; var b = {}; if (null != a) for (var c in a) Object.prototype.hasOwnProperty.call(a, c) && (b[c] = a[c]); return b["default"] = a, b } function f(a, b) { if (!(a instanceof b)) throw new TypeError("Cannot call a class as a function") } function g(a, b) { if ("function" != typeof b && null !== b) throw new TypeError("Super expression must either be null or a function, not " + typeof b); a.prototype = Object.create(b && b.prototype, { constructor: { value: a, enumerable: !1, writable: !0, configurable: !0 } }), b && (Object.setPrototypeOf ? Object.setPrototypeOf(a, b) : a.__proto__ = b) } c.__esModule = !0; var h = a("../utils/browser.js"), i = e(h), j = a("global/document"), k = d(j), l = a("../event-target"), m = d(l), n = a("../tracks/text-track"), o = d(n), p = 0, q = 1, r = 2, s = 3, t = function (a) { function b() { var c = arguments.length <= 0 || void 0 === arguments[0] ? {} : arguments[0]; f(this, b), a.call(this); var d = void 0, e = this; if (i.IS_IE8) { e = k["default"].createElement("custom"); for (var g in b.prototype) "constructor" !== g && (e[g] = b.prototype[g]) } var h = new o["default"](c); return e.kind = h.kind, e.src = h.src, e.srclang = h.language, e.label = h.label, e["default"] = h["default"], Object.defineProperty(e, "readyState", { get: function () { return d } }), Object.defineProperty(e, "track", { get: function () { return h } }), d = p, h.addEventListener("loadeddata", function () { d = r, e.trigger({ type: "load", target: e }) }), i.IS_IE8 ? e : void 0 } return g(b, a), b }(m["default"]); t.prototype.allowedEvents_ = { load: "load" }, t.NONE = p, t.LOADING = q, t.LOADED = r, t.ERROR = s, c["default"] = t, b.exports = c["default"] }, { "../event-target": 104, "../tracks/text-track": 134, "../utils/browser.js": 140, "global/document": 1 }], 129: [function (a, b, c) { "use strict"; function d(a) { return a && a.__esModule ? a : { "default": a } } function e(a) { if (a && a.__esModule) return a; var b = {}; if (null != a) for (var c in a) Object.prototype.hasOwnProperty.call(a, c) && (b[c] = a[c]); return b["default"] = a, b } function f(a, b) { if (!(a instanceof b)) throw new TypeError("Cannot call a class as a function") } c.__esModule = !0; var g = a("../utils/browser.js"), h = e(g), i = a("global/document"), j = d(i), k = function () { function a(b) { f(this, a); var c = this; if (h.IS_IE8) { c = j["default"].createElement("custom"); for (var d in a.prototype) "constructor" !== d && (c[d] = a.prototype[d]) } return a.prototype.setCues_.call(c, b), Object.defineProperty(c, "length", { get: function () { return this.length_ } }), h.IS_IE8 ? c : void 0 } return a.prototype.setCues_ = function (a) { var b = this.length || 0, c = 0, d = a.length; this.cues_ = a, this.length_ = a.length; var e = function (a) { "" + a in this || Object.defineProperty(this, "" + a, { get: function () { return this.cues_[a] } }) }; if (d > b) for (c = b; d > c; c++)e.call(this, c) }, a.prototype.getCueById = function (a) { for (var b = null, c = 0, d = this.length; d > c; c++) { var e = this[c]; if (e.id === a) { b = e; break } } return b }, a }(); c["default"] = k, b.exports = c["default"] }, { "../utils/browser.js": 140, "global/document": 1 }], 130: [function (a, b, c) { "use strict"; function d(a) { if (a && a.__esModule) return a; var b = {}; if (null != a) for (var c in a) Object.prototype.hasOwnProperty.call(a, c) && (b[c] = a[c]); return b["default"] = a, b } function e(a) { return a && a.__esModule ? a : { "default": a } } function f(a, b) { if (!(a instanceof b)) throw new TypeError("Cannot call a class as a function") } function g(a, b) { if ("function" != typeof b && null !== b) throw new TypeError("Super expression must either be null or a function, not " + typeof b); a.prototype = Object.create(b && b.prototype, { constructor: { value: a, enumerable: !1, writable: !0, configurable: !0 } }), b && (Object.setPrototypeOf ? Object.setPrototypeOf(a, b) : a.__proto__ = b) } function h(a, b) { return "rgba(" + parseInt(a[1] + a[1], 16) + "," + parseInt(a[2] + a[2], 16) + "," + parseInt(a[3] + a[3], 16) + "," + b + ")" } function i(a, b, c) { try { a.style[b] = c } catch (d) { } } c.__esModule = !0; var j = a("../component"), k = e(j), l = a("../menu/menu.js"), m = (e(l), a("../menu/menu-item.js")), n = (e(m), a("../menu/menu-button.js")), o = (e(n), a("../utils/fn.js")), p = d(o), q = a("global/document"), r = (e(q), a("global/window")), s = e(r), t = "#222", u = "#ccc", v = { monospace: "monospace", sansSerif: "sans-serif", serif: "serif", monospaceSansSerif: '"Andale Mono", "Lucida Console", monospace', monospaceSerif: '"Courier New", monospace', proportionalSansSerif: "sans-serif", proportionalSerif: "serif", casual: '"Comic Sans MS", Impact, fantasy', script: '"Monotype Corsiva", cursive', smallcaps: '"Andale Mono", "Lucida Console", monospace, sans-serif' }, w = function (a) { function b(c, d, e) { f(this, b), a.call(this, c, d, e), c.on("loadstart", p.bind(this, this.toggleDisplay)), c.on("texttrackchange", p.bind(this, this.updateDisplay)), c.ready(p.bind(this, function () { if (c.tech_ && c.tech_.featuresNativeTextTracks) return void this.hide(); c.on("fullscreenchange", p.bind(this, this.updateDisplay)); for (var a = this.options_.playerOptions.tracks || [], b = 0; b < a.length; b++) { var d = a[b]; this.player_.addRemoteTextTrack(d) } var e = { captions: 1, subtitles: 1 }, f = this.player_.textTracks(), g = void 0, h = void 0; if (f) { for (var b = 0; b < f.length; b++) { var d = f[b]; d["default"] && ("descriptions" !== d.kind || g ? d.kind in e && !h && (h = d) : g = d) } h ? h.mode = "showing" : g && (g.mode = "showing") } })) } return g(b, a), b.prototype.toggleDisplay = function () { this.player_.tech_ && this.player_.tech_.featuresNativeTextTracks ? this.hide() : this.show() }, b.prototype.createEl = function () { return a.prototype.createEl.call(this, "div", { className: "vjs-text-track-display" }, { "aria-live": "assertive", "aria-atomic": "true" }) }, b.prototype.clearDisplay = function () { "function" == typeof s["default"].WebVTT && s["default"].WebVTT.processCues(s["default"], [], this.el_) }, b.prototype.updateDisplay = function () { var a = this.player_.textTracks(); if (this.clearDisplay(), a) { for (var b = null, c = null, d = a.length; d--;) { var e = a[d]; "showing" === e.mode && ("descriptions" === e.kind ? b = e : c = e) } c ? this.updateForTrack(c) : b && this.updateForTrack(b) } }, b.prototype.updateForTrack = function (a) { if ("function" == typeof s["default"].WebVTT && a.activeCues) { for (var b = this.player_.textTrackSettings.getValues(), c = [], d = 0; d < a.activeCues.length; d++)c.push(a.activeCues[d]); s["default"].WebVTT.processCues(s["default"], c, this.el_); for (var e = c.length; e--;) { var f = c[e]; if (f) { var g = f.displayState; if (b.color && (g.firstChild.style.color = b.color), b.textOpacity && i(g.firstChild, "color", h(b.color || "#fff", b.textOpacity)), b.backgroundColor && (g.firstChild.style.backgroundColor = b.backgroundColor), b.backgroundOpacity && i(g.firstChild, "backgroundColor", h(b.backgroundColor || "#000", b.backgroundOpacity)), b.windowColor && (b.windowOpacity ? i(g, "backgroundColor", h(b.windowColor, b.windowOpacity)) : g.style.backgroundColor = b.windowColor), b.edgeStyle && ("dropshadow" === b.edgeStyle ? g.firstChild.style.textShadow = "2px 2px 3px " + t + ", 2px 2px 4px " + t + ", 2px 2px 5px " + t : "raised" === b.edgeStyle ? g.firstChild.style.textShadow = "1px 1px " + t + ", 2px 2px " + t + ", 3px 3px " + t : "depressed" === b.edgeStyle ? g.firstChild.style.textShadow = "1px 1px " + u + ", 0 1px " + u + ", -1px -1px " + t + ", 0 -1px " + t : "uniform" === b.edgeStyle && (g.firstChild.style.textShadow = "0 0 4px " + t + ", 0 0 4px " + t + ", 0 0 4px " + t + ", 0 0 4px " + t)), b.fontPercent && 1 !== b.fontPercent) { var j = s["default"].parseFloat(g.style.fontSize); g.style.fontSize = j * b.fontPercent + "px", g.style.height = "auto", g.style.top = "auto", g.style.bottom = "2px" } b.fontFamily && "default" !== b.fontFamily && ("small-caps" === b.fontFamily ? g.firstChild.style.fontVariant = "small-caps" : g.firstChild.style.fontFamily = v[b.fontFamily]) } } } }, b }(k["default"]); k["default"].registerComponent("TextTrackDisplay", w), c["default"] = w, b.exports = c["default"] }, { "../component": 67, "../menu/menu-button.js": 109, "../menu/menu-item.js": 110, "../menu/menu.js": 111, "../utils/fn.js": 144, "global/document": 1, "global/window": 2 }], 131: [function (a, b, c) { "use strict"; c.__esModule = !0; var d = function (a) { var b = ["kind", "label", "language", "id", "inBandMetadataTrackDispatchType", "mode", "src"].reduce(function (b, c) { return a[c] && (b[c] = a[c]), b }, { cues: a.cues && Array.prototype.map.call(a.cues, function (a) { return { startTime: a.startTime, endTime: a.endTime, text: a.text, id: a.id } }) }); return b }, e = function (a) { var b = a.$$("track"), c = Array.prototype.map.call(b, function (a) { return a.track }), e = Array.prototype.map.call(b, function (a) { var b = d(a.track); return a.src && (b.src = a.src), b }); return e.concat(Array.prototype.filter.call(a.textTracks(), function (a) { return -1 === c.indexOf(a) }).map(d)) }, f = function (a, b) { return a.forEach(function (a) { var c = b.addRemoteTextTrack(a).track; !a.src && a.cues && a.cues.forEach(function (a) { return c.addCue(a) }) }), b.textTracks() }; c["default"] = { textTracksToJson: e, jsonToTextTracks: f, trackToJson_: d }, b.exports = c["default"] }, {}], 132: [function (a, b, c) { "use strict"; function d(a) { if (a && a.__esModule) return a; var b = {}; if (null != a) for (var c in a) Object.prototype.hasOwnProperty.call(a, c) && (b[c] = a[c]); return b["default"] = a, b } function e(a) { return a && a.__esModule ? a : { "default": a } } function f(a, b) { if (!(a instanceof b)) throw new TypeError("Cannot call a class as a function") } function g(a, b) { if ("function" != typeof b && null !== b) throw new TypeError("Super expression must either be null or a function, not " + typeof b); a.prototype = Object.create(b && b.prototype, { constructor: { value: a, enumerable: !1, writable: !0, configurable: !0 } }), b && (Object.setPrototypeOf ? Object.setPrototypeOf(a, b) : a.__proto__ = b) } c.__esModule = !0; var h = a("./track-list"), i = e(h), j = a("../utils/fn.js"), k = d(j), l = a("../utils/browser.js"), m = d(l), n = a("global/document"), o = e(n), p = function (a) { function b() { var c = arguments.length <= 0 || void 0 === arguments[0] ? [] : arguments[0]; f(this, b); var d = void 0; if (m.IS_IE8) { d = o["default"].createElement("custom"); for (var e in i["default"].prototype) "constructor" !== e && (d[e] = i["default"].prototype[e]); for (var e in b.prototype) "constructor" !== e && (d[e] = b.prototype[e]) } return d = a.call(this, c, d) } return g(b, a), b.prototype.addTrack_ = function (b) { a.prototype.addTrack_.call(this, b), b.addEventListener("modechange", k.bind(this, function () { this.trigger("change") })) }, b.prototype.removeTrack_ = function (a) { for (var b = void 0, c = 0, d = this.length; d > c; c++)if (this[c] === a) { b = this[c], b.off && b.off(), this.tracks_.splice(c, 1); break } b && this.trigger({ track: b, type: "removetrack" }) }, b.prototype.getTrackById = function (a) { for (var b = null, c = 0, d = this.length; d > c; c++) { var e = this[c]; if (e.id === a) { b = e; break } } return b }, b }(i["default"]); c["default"] = p, b.exports = c["default"] }, { "../utils/browser.js": 140, "../utils/fn.js": 144, "./track-list": 136, "global/document": 1 }], 133: [function (a, b, c) {
            "use strict"; function d(a) { if (a && a.__esModule) return a; var b = {}; if (null != a) for (var c in a) Object.prototype.hasOwnProperty.call(a, c) && (b[c] = a[c]); return b["default"] = a, b } function e(a) { return a && a.__esModule ? a : { "default": a } } function f(a, b) { if (!(a instanceof b)) throw new TypeError("Cannot call a class as a function") } function g(a, b) { if ("function" != typeof b && null !== b) throw new TypeError("Super expression must either be null or a function, not " + typeof b); a.prototype = Object.create(b && b.prototype, { constructor: { value: a, enumerable: !1, writable: !0, configurable: !0 } }), b && (Object.setPrototypeOf ? Object.setPrototypeOf(a, b) : a.__proto__ = b) } function h(a) { var b = void 0; return a.selectedOptions ? b = a.selectedOptions[0] : a.options && (b = a.options[a.options.selectedIndex]), b.value } function i(a, b) { if (b) { var c = void 0; for (c = 0; c < a.options.length; c++) { var d = a.options[c]; if (d.value === b) break } a.selectedIndex = c } } function j(a, b, c) { var d = '\n    <div role="document">\n      <div role="heading" aria-level="1" id="' + b + '" class="vjs-control-text">Captions Settings Dialog</div>\n      <div id="' + c + '" class="vjs-control-text">Beginning of dialog window. Escape will cancel and close the window.</div>\n      <div class="vjs-tracksettings">\n        <div class="vjs-tracksettings-colors">\n          <fieldset class="vjs-fg-color vjs-tracksetting">\n            <legend>Text</legend>\n            <label class="vjs-label" for="captions-foreground-color-' + a + '">Color</label>\n            <select id="captions-foreground-color-' + a + '">\n              <option value="#FFF" selected>White</option>\n              <option value="#000">Black</option>\n              <option value="#F00">Red</option>\n              <option value="#0F0">Green</option>\n              <option value="#00F">Blue</option>\n              <option value="#FF0">Yellow</option>\n              <option value="#F0F">Magenta</option>\n              <option value="#0FF">Cyan</option>\n            </select>\n            <span class="vjs-text-opacity vjs-opacity">\n              <label class="vjs-label" for="captions-foreground-opacity-' + a + '">Transparency</label>\n              <select id="captions-foreground-opacity-' + a + '">\n                <option value="1" selected>Opaque</option>\n                <option value="0.5">Semi-Opaque</option>\n              </select>\n            </span>\n          </fieldset>\n          <fieldset class="vjs-bg-color vjs-tracksetting">\n            <legend>Background</legend>\n            <label class="vjs-label" for="captions-background-color-' + a + '">Color</label>\n            <select id="captions-background-color-' + a + '">\n              <option value="#000" selected>Black</option>\n              <option value="#FFF">White</option>\n              <option value="#F00">Red</option>\n              <option value="#0F0">Green</option>\n              <option value="#00F">Blue</option>\n              <option value="#FF0">Yellow</option>\n              <option value="#F0F">Magenta</option>\n              <option value="#0FF">Cyan</option>\n            </select>\n            <span class="vjs-bg-opacity vjs-opacity">\n              <label class="vjs-label" for="captions-background-opacity-' + a + '">Transparency</label>\n              <select id="captions-background-opacity-' + a + '">\n                <option value="1" selected>Opaque</option>\n                <option value="0.5">Semi-Transparent</option>\n                <option value="0">Transparent</option>\n              </select>\n            </span>\n          </fieldset>\n          <fieldset class="window-color vjs-tracksetting">\n            <legend>Window</legend>\n            <label class="vjs-label" for="captions-window-color-' + a + '">Color</label>\n            <select id="captions-window-color-' + a + '">\n              <option value="#000" selected>Black</option>\n              <option value="#FFF">White</option>\n              <option value="#F00">Red</option>\n              <option value="#0F0">Green</option>\n              <option value="#00F">Blue</option>\n              <option value="#FF0">Yellow</option>\n              <option value="#F0F">Magenta</option>\n              <option value="#0FF">Cyan</option>\n            </select>\n            <span class="vjs-window-opacity vjs-opacity">\n              <label class="vjs-label" for="captions-window-opacity-' + a + '">Transparency</label>\n              <select id="captions-window-opacity-' + a + '">\n                <option value="0" selected>Transparent</option>\n                <option value="0.5">Semi-Transparent</option>\n                <option value="1">Opaque</option>\n              </select>\n            </span>\n          </fieldset>\n        </div> <!-- vjs-tracksettings-colors -->\n        <div class="vjs-tracksettings-font">\n          <div class="vjs-font-percent vjs-tracksetting">\n            <label class="vjs-label" for="captions-font-size-' + a + '">Font Size</label>\n            <select id="captions-font-size-' + a + '">\n              <option value="0.50">50%</option>\n              <option value="0.75">75%</option>\n              <option value="1.00" selected>100%</option>\n              <option value="1.25">125%</option>\n              <option value="1.50">150%</option>\n              <option value="1.75">175%</option>\n              <option value="2.00">200%</option>\n              <option value="3.00">300%</option>\n              <option value="4.00">400%</option>\n            </select>\n          </div>\n          <div class="vjs-edge-style vjs-tracksetting">\n            <label class="vjs-label" for="captions-edge-style-' + a + '">Text Edge Style</label>\n            <select id="captions-edge-style-' + a + '">\n              <option value="none" selected>None</option>\n              <option value="raised">Raised</option>\n              <option value="depressed">Depressed</option>\n              <option value="uniform">Uniform</option>\n              <option value="dropshadow">Dropshadow</option>\n            </select>\n          </div>\n          <div class="vjs-font-family vjs-tracksetting">\n            <label class="vjs-label" for="captions-font-family-' + a + '">Font Family</label>\n            <select id="captions-font-family-' + a + '">\n              <option value="proportionalSansSerif" selected>Proportional Sans-Serif</option>\n              <option value="monospaceSansSerif">Monospace Sans-Serif</option>\n              <option value="proportionalSerif">Proportional Serif</option>\n              <option value="monospaceSerif">Monospace Serif</option>\n              <option value="casual">Casual</option>\n              <option value="script">Script</option>\n              <option value="small-caps">Small Caps</option>\n            </select>\n          </div>\n        </div> <!-- vjs-tracksettings-font -->\n        <div class="vjs-tracksettings-controls">\n          <button class="vjs-default-button">Defaults</button>\n          <button class="vjs-done-button">Done</button>\n        </div>\n      </div> <!-- vjs-tracksettings -->\n    </div> <!--  role="document" -->'; return d } c.__esModule = !0; var k = a("../component"), l = e(k), m = a("../utils/events.js"), n = d(m), o = a("../utils/fn.js"), p = d(o), q = a("../utils/log.js"), r = e(q), s = a("safe-json-parse/tuple"), t = e(s), u = a("global/window"), v = e(u), w = function (a) {
                function b(c, d) {
                f(this, b), a.call(this, c, d), this.hide(), void 0 === d.persistTextTrackSettings && (this.options_.persistTextTrackSettings = this.options_.playerOptions.persistTextTrackSettings), n.on(this.$(".vjs-done-button"), "click", p.bind(this, function () { this.saveSettings(), this.hide() })), n.on(this.$(".vjs-default-button"), "click", p.bind(this, function () { this.$(".vjs-fg-color > select").selectedIndex = 0, this.$(".vjs-bg-color > select").selectedIndex = 0, this.$(".window-color > select").selectedIndex = 0, this.$(".vjs-text-opacity > select").selectedIndex = 0, this.$(".vjs-bg-opacity > select").selectedIndex = 0, this.$(".vjs-window-opacity > select").selectedIndex = 0, this.$(".vjs-edge-style select").selectedIndex = 0, this.$(".vjs-font-family select").selectedIndex = 0, this.$(".vjs-font-percent select").selectedIndex = 2, this.updateDisplay() })), n.on(this.$(".vjs-fg-color > select"), "change", p.bind(this, this.updateDisplay)), n.on(this.$(".vjs-bg-color > select"), "change", p.bind(this, this.updateDisplay)), n.on(this.$(".window-color > select"), "change", p.bind(this, this.updateDisplay)), n.on(this.$(".vjs-text-opacity > select"), "change", p.bind(this, this.updateDisplay)),
                    n.on(this.$(".vjs-bg-opacity > select"), "change", p.bind(this, this.updateDisplay)), n.on(this.$(".vjs-window-opacity > select"), "change", p.bind(this, this.updateDisplay)), n.on(this.$(".vjs-font-percent select"), "change", p.bind(this, this.updateDisplay)), n.on(this.$(".vjs-edge-style select"), "change", p.bind(this, this.updateDisplay)), n.on(this.$(".vjs-font-family select"), "change", p.bind(this, this.updateDisplay)), this.options_.persistTextTrackSettings && this.restoreSettings()
                } return g(b, a), b.prototype.createEl = function () { var b = this.id_, c = "TTsettingsDialogLabel-" + b, d = "TTsettingsDialogDescription-" + b; return a.prototype.createEl.call(this, "div", { className: "vjs-caption-settings vjs-modal-overlay", innerHTML: j(b, c, d), tabIndex: -1 }, { role: "dialog", "aria-labelledby": c, "aria-describedby": d }) }, b.prototype.getValues = function () { var a = h(this.$(".vjs-edge-style select")), b = h(this.$(".vjs-font-family select")), c = h(this.$(".vjs-fg-color > select")), d = h(this.$(".vjs-text-opacity > select")), e = h(this.$(".vjs-bg-color > select")), f = h(this.$(".vjs-bg-opacity > select")), g = h(this.$(".window-color > select")), i = h(this.$(".vjs-window-opacity > select")), j = v["default"].parseFloat(h(this.$(".vjs-font-percent > select"))), k = { backgroundOpacity: f, textOpacity: d, windowOpacity: i, edgeStyle: a, fontFamily: b, color: c, backgroundColor: e, windowColor: g, fontPercent: j }; for (var l in k) ("" === k[l] || "none" === k[l] || "fontPercent" === l && 1 === k[l]) && delete k[l]; return k }, b.prototype.setValues = function (a) { i(this.$(".vjs-edge-style select"), a.edgeStyle), i(this.$(".vjs-font-family select"), a.fontFamily), i(this.$(".vjs-fg-color > select"), a.color), i(this.$(".vjs-text-opacity > select"), a.textOpacity), i(this.$(".vjs-bg-color > select"), a.backgroundColor), i(this.$(".vjs-bg-opacity > select"), a.backgroundOpacity), i(this.$(".window-color > select"), a.windowColor), i(this.$(".vjs-window-opacity > select"), a.windowOpacity); var b = a.fontPercent; b && (b = b.toFixed(2)), i(this.$(".vjs-font-percent > select"), b) }, b.prototype.restoreSettings = function () { var a = void 0, b = void 0; try { var c = t["default"](v["default"].localStorage.getItem("vjs-text-track-settings")); a = c[0], b = c[1], a && r["default"].error(a) } catch (d) { r["default"].warn(d) } b && this.setValues(b) }, b.prototype.saveSettings = function () { if (this.options_.persistTextTrackSettings) { var a = this.getValues(); try { Object.getOwnPropertyNames(a).length > 0 ? v["default"].localStorage.setItem("vjs-text-track-settings", JSON.stringify(a)) : v["default"].localStorage.removeItem("vjs-text-track-settings") } catch (b) { r["default"].warn(b) } } }, b.prototype.updateDisplay = function () { var a = this.player_.getChild("textTrackDisplay"); a && a.updateDisplay() }, b
            }(l["default"]); l["default"].registerComponent("TextTrackSettings", w), c["default"] = w, b.exports = c["default"]
        }, { "../component": 67, "../utils/events.js": 143, "../utils/fn.js": 144, "../utils/log.js": 147, "global/window": 2, "safe-json-parse/tuple": 54 }], 134: [function (a, b, c) { "use strict"; function d(a) { if (a && a.__esModule) return a; var b = {}; if (null != a) for (var c in a) Object.prototype.hasOwnProperty.call(a, c) && (b[c] = a[c]); return b["default"] = a, b } function e(a) { return a && a.__esModule ? a : { "default": a } } function f(a, b) { if (!(a instanceof b)) throw new TypeError("Cannot call a class as a function") } function g(a, b) { if ("function" != typeof b && null !== b) throw new TypeError("Super expression must either be null or a function, not " + typeof b); a.prototype = Object.create(b && b.prototype, { constructor: { value: a, enumerable: !1, writable: !0, configurable: !0 } }), b && (Object.setPrototypeOf ? Object.setPrototypeOf(a, b) : a.__proto__ = b) } c.__esModule = !0; var h = a("./text-track-cue-list"), i = e(h), j = a("../utils/fn.js"), k = d(j), l = a("./track-enums"), m = a("../utils/log.js"), n = e(m), o = a("global/document"), p = (e(o), a("global/window")), q = e(p), r = a("./track.js"), s = e(r), t = a("../utils/url.js"), u = a("xhr"), v = e(u), w = a("../utils/merge-options"), x = e(w), y = a("../utils/browser.js"), z = d(y), A = function (a, b) { var c = new q["default"].WebVTT.Parser(q["default"], q["default"].vttjs, q["default"].WebVTT.StringDecoder()), d = []; c.oncue = function (a) { b.addCue(a) }, c.onparsingerror = function (a) { d.push(a) }, c.onflush = function () { b.trigger({ type: "loadeddata", target: b }) }, c.parse(a), d.length > 0 && (console.groupCollapsed, d.forEach(function (a) { return n["default"].error(a) }), console.groupEnd), c.flush() }, B = function (a, b) { var c = { uri: a }, d = t.isCrossOrigin(a); d && (c.cors = d), v["default"](c, k.bind(this, function (a, c, d) { return a ? n["default"].error(a, c) : (b.loaded_ = !0, void ("function" != typeof q["default"].WebVTT ? b.tech_ && !function () { var a = function () { return A(d, b) }; b.tech_.on("vttjsloaded", a), b.tech_.on("vttjserror", function () { n["default"].error("vttjs failed to load, stopping trying to process " + b.src), b.tech_.off("vttjsloaded", a) }) }() : A(d, b))) })) }, C = function (a) { function b() { var c = arguments.length <= 0 || void 0 === arguments[0] ? {} : arguments[0]; if (f(this, b), !c.tech) throw new Error("A tech was not provided."); var d = x["default"](c, { kind: l.TextTrackKind[c.kind] || "subtitles", language: c.language || c.srclang || "" }), e = l.TextTrackMode[d.mode] || "disabled", g = d["default"]; ("metadata" === d.kind || "chapters" === d.kind) && (e = "hidden"); var h = a.call(this, d); if (h.tech_ = d.tech, z.IS_IE8) for (var j in b.prototype) "constructor" !== j && (h[j] = b.prototype[j]); h.cues_ = [], h.activeCues_ = []; var m = new i["default"](h.cues_), n = new i["default"](h.activeCues_), o = !1, p = k.bind(h, function () { this.activeCues, o && (this.trigger("cuechange"), o = !1) }); return "disabled" !== e && h.tech_.on("timeupdate", p), Object.defineProperty(h, "default", { get: function () { return g }, set: function () { } }), Object.defineProperty(h, "mode", { get: function () { return e }, set: function (a) { l.TextTrackMode[a] && (e = a, "showing" === e && this.tech_.on("timeupdate", p), this.trigger("modechange")) } }), Object.defineProperty(h, "cues", { get: function () { return this.loaded_ ? m : null }, set: function () { } }), Object.defineProperty(h, "activeCues", { get: function () { if (!this.loaded_) return null; if (0 === this.cues.length) return n; for (var a = this.tech_.currentTime(), b = [], c = 0, d = this.cues.length; d > c; c++) { var e = this.cues[c]; e.startTime <= a && e.endTime >= a ? b.push(e) : e.startTime === e.endTime && e.startTime <= a && e.startTime + .5 >= a && b.push(e) } if (o = !1, b.length !== this.activeCues_.length) o = !0; else for (var c = 0; c < b.length; c++)-1 === this.activeCues_.indexOf(b[c]) && (o = !0); return this.activeCues_ = b, n.setCues_(this.activeCues_), n }, set: function () { } }), d.src ? (h.src = d.src, B(d.src, h)) : h.loaded_ = !0, h } return g(b, a), b.prototype.addCue = function (a) { var b = this.tech_.textTracks(); if (b) for (var c = 0; c < b.length; c++)b[c] !== this && b[c].removeCue(a); this.cues_.push(a), this.cues.setCues_(this.cues_) }, b.prototype.removeCue = function (a) { for (var b = !1, c = 0, d = this.cues_.length; d > c; c++) { var e = this.cues_[c]; e === a && (this.cues_.splice(c, 1), b = !0) } b && this.cues.setCues_(this.cues_) }, b }(s["default"]); C.prototype.allowedEvents_ = { cuechange: "cuechange" }, c["default"] = C, b.exports = c["default"] }, { "../utils/browser.js": 140, "../utils/fn.js": 144, "../utils/log.js": 147, "../utils/merge-options": 148, "../utils/url.js": 152, "./text-track-cue-list": 129, "./track-enums": 135, "./track.js": 137, "global/document": 1, "global/window": 2, xhr: 56 }], 135: [function (a, b, c) { "use strict"; c.__esModule = !0; var d = { alternative: "alternative", captions: "captions", main: "main", sign: "sign", subtitles: "subtitles", commentary: "commentary" }, e = { alternative: "alternative", descriptions: "descriptions", main: "main", "main-desc": "main-desc", translation: "translation", commentary: "commentary" }, f = { subtitles: "subtitles", captions: "captions", descriptions: "descriptions", chapters: "chapters", metadata: "metadata" }, g = { disabled: "disabled", hidden: "hidden", showing: "showing" }; c["default"] = { VideoTrackKind: d, AudioTrackKind: e, TextTrackKind: f, TextTrackMode: g }, b.exports = c["default"] }, {}], 136: [function (a, b, c) { "use strict"; function d(a) { if (a && a.__esModule) return a; var b = {}; if (null != a) for (var c in a) Object.prototype.hasOwnProperty.call(a, c) && (b[c] = a[c]); return b["default"] = a, b } function e(a) { return a && a.__esModule ? a : { "default": a } } function f(a, b) { if (!(a instanceof b)) throw new TypeError("Cannot call a class as a function") } function g(a, b) { if ("function" != typeof b && null !== b) throw new TypeError("Super expression must either be null or a function, not " + typeof b); a.prototype = Object.create(b && b.prototype, { constructor: { value: a, enumerable: !1, writable: !0, configurable: !0 } }), b && (Object.setPrototypeOf ? Object.setPrototypeOf(a, b) : a.__proto__ = b) } c.__esModule = !0; var h = a("../event-target"), i = e(h), j = a("../utils/fn.js"), k = (d(j), a("../utils/browser.js")), l = d(k), m = a("global/document"), n = e(m), o = function (a) { function b() { var c = arguments.length <= 0 || void 0 === arguments[0] ? [] : arguments[0], d = arguments.length <= 1 || void 0 === arguments[1] ? null : arguments[1]; if (f(this, b), a.call(this), !d && (d = this, l.IS_IE8)) { d = n["default"].createElement("custom"); for (var e in b.prototype) "constructor" !== e && (d[e] = b.prototype[e]) } d.tracks_ = [], Object.defineProperty(d, "length", { get: function () { return this.tracks_.length } }); for (var g = 0; g < c.length; g++)d.addTrack_(c[g]); return d } return g(b, a), b.prototype.addTrack_ = function (a) { var b = this.tracks_.length; "" + b in this || Object.defineProperty(this, b, { get: function () { return this.tracks_[b] } }), -1 === this.tracks_.indexOf(a) && (this.tracks_.push(a), this.trigger({ track: a, type: "addtrack" })) }, b.prototype.removeTrack_ = function (a) { for (var b = void 0, c = 0, d = this.length; d > c; c++)if (this[c] === a) { b = this[c], b.off && b.off(), this.tracks_.splice(c, 1); break } b && this.trigger({ track: b, type: "removetrack" }) }, b.prototype.getTrackById = function (a) { for (var b = null, c = 0, d = this.length; d > c; c++) { var e = this[c]; if (e.id === a) { b = e; break } } return b }, b }(i["default"]); o.prototype.allowedEvents_ = { change: "change", addtrack: "addtrack", removetrack: "removetrack" }; for (var p in o.prototype.allowedEvents_) o.prototype["on" + p] = null; c["default"] = o, b.exports = c["default"] }, { "../event-target": 104, "../utils/browser.js": 140, "../utils/fn.js": 144, "global/document": 1 }], 137: [function (a, b, c) { "use strict"; function d(a) { return a && a.__esModule ? a : { "default": a } } function e(a) { if (a && a.__esModule) return a; var b = {}; if (null != a) for (var c in a) Object.prototype.hasOwnProperty.call(a, c) && (b[c] = a[c]); return b["default"] = a, b } function f(a, b) { if (!(a instanceof b)) throw new TypeError("Cannot call a class as a function") } function g(a, b) { if ("function" != typeof b && null !== b) throw new TypeError("Super expression must either be null or a function, not " + typeof b); a.prototype = Object.create(b && b.prototype, { constructor: { value: a, enumerable: !1, writable: !0, configurable: !0 } }), b && (Object.setPrototypeOf ? Object.setPrototypeOf(a, b) : a.__proto__ = b) } c.__esModule = !0; var h = a("../utils/browser.js"), i = e(h), j = a("global/document"), k = d(j), l = a("../utils/guid.js"), m = e(l), n = a("../event-target"), o = d(n), p = function (a) { function b() { var c = arguments.length <= 0 || void 0 === arguments[0] ? {} : arguments[0]; f(this, b), a.call(this); var d = this; if (i.IS_IE8) { d = k["default"].createElement("custom"); for (var e in b.prototype) "constructor" !== e && (d[e] = b.prototype[e]) } var g = { id: c.id || "vjs_track_" + m.newGUID(), kind: c.kind || "", label: c.label || "", language: c.language || "" }, h = function (a) { Object.defineProperty(d, a, { get: function () { return g[a] }, set: function () { } }) }; for (var j in g) h(j); return d } return g(b, a), b }(o["default"]); c["default"] = p, b.exports = c["default"] }, { "../event-target": 104, "../utils/browser.js": 140, "../utils/guid.js": 146, "global/document": 1 }], 138: [function (a, b, c) { "use strict"; function d(a) { if (a && a.__esModule) return a; var b = {}; if (null != a) for (var c in a) Object.prototype.hasOwnProperty.call(a, c) && (b[c] = a[c]); return b["default"] = a, b } function e(a) { return a && a.__esModule ? a : { "default": a } } function f(a, b) { if (!(a instanceof b)) throw new TypeError("Cannot call a class as a function") } function g(a, b) { if ("function" != typeof b && null !== b) throw new TypeError("Super expression must either be null or a function, not " + typeof b); a.prototype = Object.create(b && b.prototype, { constructor: { value: a, enumerable: !1, writable: !0, configurable: !0 } }), b && (Object.setPrototypeOf ? Object.setPrototypeOf(a, b) : a.__proto__ = b) } c.__esModule = !0; var h = a("./track-list"), i = e(h), j = a("../utils/browser.js"), k = d(j), l = a("global/document"), m = e(l), n = function (a, b) { for (var c = 0; c < a.length; c++)b.id !== a[c].id && (a[c].selected = !1) }, o = function (a) { function b() { var c = arguments.length <= 0 || void 0 === arguments[0] ? [] : arguments[0]; f(this, b); for (var d = void 0, e = c.length - 1; e >= 0; e--)if (c[e].selected) { n(c, c[e]); break } if (k.IS_IE8) { d = m["default"].createElement("custom"); for (var g in i["default"].prototype) "constructor" !== g && (d[g] = i["default"].prototype[g]); for (var g in b.prototype) "constructor" !== g && (d[g] = b.prototype[g]) } return d = a.call(this, c, d), d.changing_ = !1, Object.defineProperty(d, "selectedIndex", { get: function () { for (var a = 0; a < this.length; a++)if (this[a].selected) return a; return -1 }, set: function () { } }), d } return g(b, a), b.prototype.addTrack_ = function (b) { var c = this; b.selected && n(this, b), a.prototype.addTrack_.call(this, b), b.addEventListener && b.addEventListener("selectedchange", function () { c.changing_ || (c.changing_ = !0, n(c, b), c.changing_ = !1, c.trigger("change")) }) }, b.prototype.addTrack = function (a) { this.addTrack_(a) }, b.prototype.removeTrack = function (b) { a.prototype.removeTrack_.call(this, b) }, b }(i["default"]); c["default"] = o, b.exports = c["default"] }, { "../utils/browser.js": 140, "./track-list": 136, "global/document": 1 }], 139: [function (a, b, c) { "use strict"; function d(a) { if (a && a.__esModule) return a; var b = {}; if (null != a) for (var c in a) Object.prototype.hasOwnProperty.call(a, c) && (b[c] = a[c]); return b["default"] = a, b } function e(a) { return a && a.__esModule ? a : { "default": a } } function f(a, b) { if (!(a instanceof b)) throw new TypeError("Cannot call a class as a function") } function g(a, b) { if ("function" != typeof b && null !== b) throw new TypeError("Super expression must either be null or a function, not " + typeof b); a.prototype = Object.create(b && b.prototype, { constructor: { value: a, enumerable: !1, writable: !0, configurable: !0 } }), b && (Object.setPrototypeOf ? Object.setPrototypeOf(a, b) : a.__proto__ = b) } c.__esModule = !0; var h = a("./track-enums"), i = a("./track"), j = e(i), k = a("../utils/merge-options"), l = e(k), m = a("../utils/browser.js"), n = d(m), o = function (a) { function b() { var c = arguments.length <= 0 || void 0 === arguments[0] ? {} : arguments[0]; f(this, b); var d = l["default"](c, { kind: h.VideoTrackKind[c.kind] || "" }), e = a.call(this, d), g = !1; if (n.IS_IE8) for (var i in b.prototype) "constructor" !== i && (e[i] = b.prototype[i]); return Object.defineProperty(e, "selected", { get: function () { return g }, set: function (a) { "boolean" == typeof a && a !== g && (g = a, this.trigger("selectedchange")) } }), d.selected && (e.selected = d.selected), e } return g(b, a), b }(j["default"]); c["default"] = o, b.exports = c["default"] }, { "../utils/browser.js": 140, "../utils/merge-options": 148, "./track": 137, "./track-enums": 135 }], 140: [function (a, b, c) { "use strict"; function d(a) { return a && a.__esModule ? a : { "default": a } } c.__esModule = !0; var e = a("global/document"), f = d(e), g = a("global/window"), h = d(g), i = h["default"].navigator.userAgent, j = /AppleWebKit\/([\d.]+)/i.exec(i), k = j ? parseFloat(j.pop()) : null, l = /iPad/i.test(i); c.IS_IPAD = l; var m = /iPhone/i.test(i) && !l; c.IS_IPHONE = m; var n = /iPod/i.test(i); c.IS_IPOD = n; var o = m || l || n; c.IS_IOS = o; var p = function () { var a = i.match(/OS (\d+)_/i); return a && a[1] ? a[1] : void 0 }(); c.IOS_VERSION = p; var q = /Android/i.test(i); c.IS_ANDROID = q; var r = function () { var a, b, c = i.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i); return c ? (a = c[1] && parseFloat(c[1]), b = c[2] && parseFloat(c[2]), a && b ? parseFloat(c[1] + "." + c[2]) : a ? a : null) : null }(); c.ANDROID_VERSION = r; var s = q && /webkit/i.test(i) && 2.3 > r; c.IS_OLD_ANDROID = s; var t = q && 5 > r && 537 > k; c.IS_NATIVE_ANDROID = t; var u = /Firefox/i.test(i); c.IS_FIREFOX = u; var v = /Edge/i.test(i); c.IS_EDGE = v; var w = !v && /Chrome/i.test(i); c.IS_CHROME = w; var x = /MSIE\s8\.0/.test(i); c.IS_IE8 = x; var y = function (a) { return a && parseFloat(a[1]) }(/MSIE\s(\d+)\.\d/.exec(i)); c.IE_VERSION = y; var z = !!("ontouchstart" in h["default"] || h["default"].DocumentTouch && f["default"] instanceof h["default"].DocumentTouch); c.TOUCH_ENABLED = z; var A = "backgroundSize" in f["default"].createElement("video").style; c.BACKGROUND_SIZE_SUPPORTED = A }, { "global/document": 1, "global/window": 2 }], 141: [function (a, b, c) { "use strict"; function d(a, b) { var c, d, f = 0; if (!b) return 0; a && a.length || (a = e.createTimeRange(0, 0)); for (var g = 0; g < a.length; g++)c = a.start(g), d = a.end(g), d > b && (d = b), f += d - c; return f / b } c.__esModule = !0, c.bufferedPercent = d; var e = a("./time-ranges.js") }, { "./time-ranges.js": 150 }], 142: [function (a, b, c) { "use strict"; function d(a) { if (a && a.__esModule) return a; var b = {}; if (null != a) for (var c in a) Object.prototype.hasOwnProperty.call(a, c) && (b[c] = a[c]); return b["default"] = a, b } function e(a) { return a && a.__esModule ? a : { "default": a } } function f(a, b) { return a.raw = b, a } function g(a) { return "string" == typeof a && /\S/.test(a) } function h(a) { if (/\s/.test(a)) throw new Error("class has illegal whitespace characters") } function i(a) { return new RegExp("(^|\\s)" + a + "($|\\s)") } function j(a) { return function (b, c) { return g(b) ? (g(c) && (c = J["default"].querySelector(c)), (B(c) ? c : J["default"])[a](b)) : J["default"][a](null) } } function k(a) { return 0 === a.indexOf("#") && (a = a.slice(1)), J["default"].getElementById(a) } function l() { var a = arguments.length <= 0 || void 0 === arguments[0] ? "div" : arguments[0], b = arguments.length <= 1 || void 0 === arguments[1] ? {} : arguments[1], c = arguments.length <= 2 || void 0 === arguments[2] ? {} : arguments[2], d = J["default"].createElement(a); return Object.getOwnPropertyNames(b).forEach(function (a) { var c = b[a]; -1 !== a.indexOf("aria-") || "role" === a || "type" === a ? (P["default"].warn(R["default"](H, a, c)), d.setAttribute(a, c)) : d[a] = c }), Object.getOwnPropertyNames(c).forEach(function (a) { c[a]; d.setAttribute(a, c[a]) }), d } function m(a, b) { "undefined" == typeof a.textContent ? a.innerText = b : a.textContent = b } function n(a, b) { b.firstChild ? b.insertBefore(a, b.firstChild) : b.appendChild(a) } function o(a) { var b = a[T]; return b || (b = a[T] = N.newGUID()), S[b] || (S[b] = {}), S[b] } function p(a) { var b = a[T]; return b ? !!Object.getOwnPropertyNames(S[b]).length : !1 } function q(a) { var b = a[T]; if (b) { delete S[b]; try { delete a[T] } catch (c) { a.removeAttribute ? a.removeAttribute(T) : a[T] = null } } } function r(a, b) { return a.classList ? a.classList.contains(b) : (h(b), i(b).test(a.className)) } function s(a, b) { return a.classList ? a.classList.add(b) : r(a, b) || (a.className = (a.className + " " + b).trim()), a } function t(a, b) { return a.classList ? a.classList.remove(b) : (h(b), a.className = a.className.split(/\s+/).filter(function (a) { return a !== b }).join(" ")), a } function u(a, b, c) { var d = r(a, b); return "function" == typeof c && (c = c(a, b)), "boolean" != typeof c && (c = !d), c !== d ? (c ? s(a, b) : t(a, b), a) : void 0 } function v(a, b) { Object.getOwnPropertyNames(b).forEach(function (c) { var d = b[c]; null === d || "undefined" == typeof d || d === !1 ? a.removeAttribute(c) : a.setAttribute(c, d === !0 ? "" : d) }) } function w(a) { var b, c, d, e, f; if (b = {}, c = ",autoplay,controls,loop,muted,default,", a && a.attributes && a.attributes.length > 0) { d = a.attributes; for (var g = d.length - 1; g >= 0; g--)e = d[g].name, f = d[g].value, ("boolean" == typeof a[e] || -1 !== c.indexOf("," + e + ",")) && (f = null !== f ? !0 : !1), b[e] = f } return b } function x() { J["default"].body.focus(), J["default"].onselectstart = function () { return !1 } } function y() { J["default"].onselectstart = function () { return !0 } } function z(a) { var b = void 0; if (a.getBoundingClientRect && a.parentNode && (b = a.getBoundingClientRect()), !b) return { left: 0, top: 0 }; var c = J["default"].documentElement, d = J["default"].body, e = c.clientLeft || d.clientLeft || 0, f = L["default"].pageXOffset || d.scrollLeft, g = b.left + f - e, h = c.clientTop || d.clientTop || 0, i = L["default"].pageYOffset || d.scrollTop, j = b.top + i - h; return { left: Math.round(g), top: Math.round(j) } } function A(a, b) { var c = {}, d = z(a), e = a.offsetWidth, f = a.offsetHeight, g = d.top, h = d.left, i = b.pageY, j = b.pageX; return b.changedTouches && (j = b.changedTouches[0].pageX, i = b.changedTouches[0].pageY), c.y = Math.max(0, Math.min(1, (g - i + f) / f)), c.x = Math.max(0, Math.min(1, (j - h) / e)), c } function B(a) { return !!a && "object" == typeof a && 1 === a.nodeType } function C(a) { return !!a && "object" == typeof a && 3 === a.nodeType } function D(a) { for (; a.firstChild;)a.removeChild(a.firstChild); return a } function E(a) { return "function" == typeof a && (a = a()), (Array.isArray(a) ? a : [a]).map(function (a) { return "function" == typeof a && (a = a()), B(a) || C(a) ? a : "string" == typeof a && /\S/.test(a) ? J["default"].createTextNode(a) : void 0 }).filter(function (a) { return a }) } function F(a, b) { return E(b).forEach(function (b) { return a.appendChild(b) }), a } function G(a, b) { return F(D(a), b) } c.__esModule = !0, c.getEl = k, c.createEl = l, c.textContent = m, c.insertElFirst = n, c.getElData = o, c.hasElData = p, c.removeElData = q, c.hasElClass = r, c.addElClass = s, c.removeElClass = t, c.toggleElClass = u, c.setElAttributes = v, c.getElAttributes = w, c.blockTextSelection = x, c.unblockTextSelection = y, c.findElPosition = z, c.getPointerPosition = A, c.isEl = B, c.isTextNode = C, c.emptyEl = D, c.normalizeContent = E, c.appendContent = F, c.insertContent = G; var H = f(["Setting attributes in the second argument of createEl()\n                has been deprecated. Use the third argument instead.\n                createEl(type, properties, attributes). Attempting to set ", " to ", "."], ["Setting attributes in the second argument of createEl()\n                has been deprecated. Use the third argument instead.\n                createEl(type, properties, attributes). Attempting to set ", " to ", "."]), I = a("global/document"), J = e(I), K = a("global/window"), L = e(K), M = a("./guid.js"), N = d(M), O = a("./log.js"), P = e(O), Q = a("tsml"), R = e(Q), S = {}, T = "vdata" + (new Date).getTime(), U = j("querySelector"); c.$ = U; var V = j("querySelectorAll"); c.$$ = V }, { "./guid.js": 146, "./log.js": 147, "global/document": 1, "global/window": 2, tsml: 55 }], 143: [function (a, b, c) { "use strict"; function d(a) { return a && a.__esModule ? a : { "default": a } } function e(a) { if (a && a.__esModule) return a; var b = {}; if (null != a) for (var c in a) Object.prototype.hasOwnProperty.call(a, c) && (b[c] = a[c]); return b["default"] = a, b } function f(a, b, c) { if (Array.isArray(b)) return l(f, a, b, c); var d = n.getElData(a); d.handlers || (d.handlers = {}), d.handlers[b] || (d.handlers[b] = []), c.guid || (c.guid = p.newGUID()), d.handlers[b].push(c), d.dispatcher || (d.disabled = !1, d.dispatcher = function (b, c) { if (!d.disabled) { b = j(b); var e = d.handlers[b.type]; if (e) for (var f = e.slice(0), g = 0, h = f.length; h > g && !b.isImmediatePropagationStopped(); g++)try { f[g].call(a, b, c) } catch (i) { r["default"].error(i) } } }), 1 === d.handlers[b].length && (a.addEventListener ? a.addEventListener(b, d.dispatcher, !1) : a.attachEvent && a.attachEvent("on" + b, d.dispatcher)) } function g(a, b, c) { if (n.hasElData(a)) { var d = n.getElData(a); if (d.handlers) { if (Array.isArray(b)) return l(g, a, b, c); var e = function (b) { d.handlers[b] = [], k(a, b) }; if (b) { var f = d.handlers[b]; if (f) { if (!c) return void e(b); if (c.guid) for (var h = 0; h < f.length; h++)f[h].guid === c.guid && f.splice(h--, 1); k(a, b) } } else for (var i in d.handlers) e(i) } } } function h(a, b, c) { var d = n.hasElData(a) ? n.getElData(a) : {}, e = a.parentNode || a.ownerDocument; if ("string" == typeof b && (b = { type: b, target: a }), b = j(b), d.dispatcher && d.dispatcher.call(a, b, c), e && !b.isPropagationStopped() && b.bubbles === !0) h.call(null, e, b, c); else if (!e && !b.defaultPrevented) { var f = n.getElData(b.target); b.target[b.type] && (f.disabled = !0, "function" == typeof b.target[b.type] && b.target[b.type](), f.disabled = !1) } return !b.defaultPrevented } function i(a, b, c) { if (Array.isArray(b)) return l(i, a, b, c); var d = function e() { g(a, b, e), c.apply(this, arguments) }; d.guid = c.guid = c.guid || p.newGUID(), f(a, b, d) } function j(a) { function b() { return !0 } function c() { return !1 } if (!a || !a.isPropagationStopped) { var d = a || t["default"].event; a = {}; for (var e in d) "layerX" !== e && "layerY" !== e && "keyLocation" !== e && "webkitMovementX" !== e && "webkitMovementY" !== e && ("returnValue" === e && d.preventDefault || (a[e] = d[e])); if (a.target || (a.target = a.srcElement || v["default"]), a.relatedTarget || (a.relatedTarget = a.fromElement === a.target ? a.toElement : a.fromElement), a.preventDefault = function () { d.preventDefault && d.preventDefault(), a.returnValue = !1, d.returnValue = !1, a.defaultPrevented = !0 }, a.defaultPrevented = !1, a.stopPropagation = function () { d.stopPropagation && d.stopPropagation(), a.cancelBubble = !0, d.cancelBubble = !0, a.isPropagationStopped = b }, a.isPropagationStopped = c, a.stopImmediatePropagation = function () { d.stopImmediatePropagation && d.stopImmediatePropagation(), a.isImmediatePropagationStopped = b, a.stopPropagation() }, a.isImmediatePropagationStopped = c, null != a.clientX) { var f = v["default"].documentElement, g = v["default"].body; a.pageX = a.clientX + (f && f.scrollLeft || g && g.scrollLeft || 0) - (f && f.clientLeft || g && g.clientLeft || 0), a.pageY = a.clientY + (f && f.scrollTop || g && g.scrollTop || 0) - (f && f.clientTop || g && g.clientTop || 0) } a.which = a.charCode || a.keyCode, null != a.button && (a.button = 1 & a.button ? 0 : 4 & a.button ? 1 : 2 & a.button ? 2 : 0) } return a } function k(a, b) { var c = n.getElData(a); 0 === c.handlers[b].length && (delete c.handlers[b], a.removeEventListener ? a.removeEventListener(b, c.dispatcher, !1) : a.detachEvent && a.detachEvent("on" + b, c.dispatcher)), Object.getOwnPropertyNames(c.handlers).length <= 0 && (delete c.handlers, delete c.dispatcher, delete c.disabled), 0 === Object.getOwnPropertyNames(c).length && n.removeElData(a) } function l(a, b, c, d) { c.forEach(function (c) { a(b, c, d) }) } c.__esModule = !0, c.on = f, c.off = g, c.trigger = h, c.one = i, c.fixEvent = j; var m = a("./dom.js"), n = e(m), o = a("./guid.js"), p = e(o), q = a("./log.js"), r = d(q), s = a("global/window"), t = d(s), u = a("global/document"), v = d(u) }, { "./dom.js": 142, "./guid.js": 146, "./log.js": 147, "global/document": 1, "global/window": 2 }], 144: [function (a, b, c) { "use strict"; c.__esModule = !0; var d = a("./guid.js"), e = function (a, b, c) { b.guid || (b.guid = d.newGUID()); var e = function () { return b.apply(a, arguments) }; return e.guid = c ? c + "_" + b.guid : b.guid, e }; c.bind = e }, { "./guid.js": 146 }], 145: [function (a, b, c) { "use strict"; function d(a) { var b = arguments.length <= 1 || void 0 === arguments[1] ? a : arguments[1]; return function () { a = 0 > a ? 0 : a; var c = Math.floor(a % 60), d = Math.floor(a / 60 % 60), e = Math.floor(a / 3600), f = Math.floor(b / 60 % 60), g = Math.floor(b / 3600); return (isNaN(a) || a === 1 / 0) && (e = d = c = "-"), e = e > 0 || g > 0 ? e + ":" : "", d = ((e || f >= 10) && 10 > d ? "0" + d : d) + ":", c = 10 > c ? "0" + c : c, e + d + c }() } c.__esModule = !0, c["default"] = d, b.exports = c["default"] }, {}], 146: [function (a, b, c) { "use strict"; function d() { return e++ } c.__esModule = !0, c.newGUID = d; var e = 1 }, {}], 147: [function (a, b, c) { "use strict"; function d(a) { return a && a.__esModule ? a : { "default": a } } function e() { for (var a = arguments.length, b = Array(a), c = 0; a > c; c++)b[c] = arguments[c]; i("log", b) } c.__esModule = !0; var f = a("global/window"), g = d(f), h = a("./browser"), i = function (a, b) { var c = arguments.length <= 2 || void 0 === arguments[2] ? !!h.IE_VERSION && h.IE_VERSION < 11 : arguments[2], d = g["default"].console, f = d && d[a] || function () { }; "log" !== a && b.unshift(a.toUpperCase() + ":"), e.history.push(b), b.unshift("VIDEOJS:"), c && (b = b.map(function (a) { if (a && "object" == typeof a || Array.isArray(a)) try { return JSON.stringify(a) } catch (b) { } return String(a) }).join(" ")), f.apply ? f[Array.isArray(b) ? "apply" : "call"](d, b) : f(b) }; c.logByType = i, e.history = [], e.error = function () { for (var a = arguments.length, b = Array(a), c = 0; a > c; c++)b[c] = arguments[c]; return i("error", b) }, e.warn = function () { for (var a = arguments.length, b = Array(a), c = 0; a > c; c++)b[c] = arguments[c]; return i("warn", b) }, c["default"] = e }, { "./browser": 140, "global/window": 2 }], 148: [function (a, b, c) { "use strict"; function d(a) { return a && a.__esModule ? a : { "default": a } } function e(a) { return !!a && "object" == typeof a && "[object Object]" === a.toString() && a.constructor === Object } function f() { var a = Array.prototype.slice.call(arguments); return a.unshift({}), a.push(i), h["default"].apply(null, a), a[0] } c.__esModule = !0, c["default"] = f; var g = a("lodash-compat/object/merge"), h = d(g), i = function (a, b) { return e(b) ? e(a) ? void 0 : f(b) : b }; b.exports = c["default"] }, { "lodash-compat/object/merge": 40 }], 149: [function (a, b, c) { "use strict"; function d(a) { return a && a.__esModule ? a : { "default": a } } c.__esModule = !0; var e = a("global/document"), f = d(e), g = function (a) { var b = f["default"].createElement("style"); return b.className = a, b }; c.createStyleElement = g; var h = function (a, b) { a.styleSheet ? a.styleSheet.cssText = b : a.textContent = b }; c.setTextContent = h }, { "global/document": 1 }], 150: [function (a, b, c) { "use strict"; function d(a) { return a && a.__esModule ? a : { "default": a } } function e(a, b) { return Array.isArray(a) ? f(a) : void 0 === a || void 0 === b ? f() : f([[a, b]]) } function f(a) { return void 0 === a || 0 === a.length ? { length: 0, start: function () { throw new Error("This TimeRanges object is empty") }, end: function () { throw new Error("This TimeRanges object is empty") } } : { length: a.length, start: g.bind(null, "start", 0, a), end: g.bind(null, "end", 1, a) } } function g(a, b, c, d) { return void 0 === d && (j["default"].warn("DEPRECATED: Function '" + a + "' on 'TimeRanges' called without an index argument."), d = 0), h(a, d, c.length - 1), c[d][b] } function h(a, b, c) { if (0 > b || b > c) throw new Error("Failed to execute '" + a + "' on 'TimeRanges': The index provided (" + b + ") is greater than or equal to the maximum bound (" + c + ").") } c.__esModule = !0, c.createTimeRanges = e; var i = a("./log.js"), j = d(i); c.createTimeRange = e }, { "./log.js": 147 }], 151: [function (a, b, c) { "use strict"; function d(a) { return a.charAt(0).toUpperCase() + a.slice(1) } c.__esModule = !0, c["default"] = d, b.exports = c["default"] }, {}], 152: [function (a, b, c) { "use strict"; function d(a) { return a && a.__esModule ? a : { "default": a } } c.__esModule = !0; var e = a("global/document"), f = d(e), g = a("global/window"), h = d(g), i = function (a) { var b = ["protocol", "hostname", "port", "pathname", "search", "hash", "host"], c = f["default"].createElement("a"); c.href = a; var d = "" === c.host && "file:" !== c.protocol, e = void 0; d && (e = f["default"].createElement("div"), e.innerHTML = '<a href="' + a + '"></a>', c = e.firstChild, e.setAttribute("style", "display:none; position:absolute;"), f["default"].body.appendChild(e)); for (var g = {}, h = 0; h < b.length; h++)g[b[h]] = c[b[h]]; return "http:" === g.protocol && (g.host = g.host.replace(/:80$/, "")), "https:" === g.protocol && (g.host = g.host.replace(/:443$/, "")), d && f["default"].body.removeChild(e), g }; c.parseUrl = i; var j = function (a) { if (!a.match(/^https?:\/\//)) { var b = f["default"].createElement("div"); b.innerHTML = '<a href="' + a + '">x</a>', a = b.firstChild.href } return a }; c.getAbsoluteURL = j; var k = function (a) { if ("string" == typeof a) { var b = /^(\/?)([\s\S]*?)((?:\.{1,2}|[^\/]+?)(\.([^\.\/\?]+)))(?:[\/]*|[\?].*)$/i, c = b.exec(a); if (c) return c.pop().toLowerCase() } return "" }; c.getFileExtension = k; var l = function (a) { var b = h["default"].location, c = i(a), d = ":" === c.protocol ? b.protocol : c.protocol, e = d + c.host !== b.protocol + b.host; return e }; c.isCrossOrigin = l }, { "global/document": 1, "global/window": 2 }], 153: [function (b, c, d) {
            "use strict"; function e(a) { if (a && a.__esModule) return a; var b = {}; if (null != a) for (var c in a) Object.prototype.hasOwnProperty.call(a, c) && (b[c] = a[c]); return b["default"] = a, b } function f(a) { return a && a.__esModule ? a : { "default": a } } function g(a, b, c) { var d = void 0; if ("string" == typeof a) { if (0 === a.indexOf("#") && (a = a.slice(1)), g.getPlayers()[a]) return b && N["default"].warn('Player "' + a + '" is already initialised. Options will not be applied.'), c && g.getPlayers()[a].ready(c), g.getPlayers()[a]; d = P.getEl(a) } else d = a; if (!d || !d.nodeName) throw new TypeError("The element or ID supplied is not valid. (videojs)"); return d.player || w["default"].players[d.playerId] || new w["default"](d, b, c) } d.__esModule = !0; { var h = b("global/window"), i = f(h), j = b("global/document"), k = f(j), l = b("./setup"), m = e(l), n = b("./utils/stylesheet.js"), o = e(n), p = b("./component"), q = f(p), r = b("./event-target"), s = f(r), t = b("./utils/events.js"), u = e(t), v = b("./player"), w = f(v), x = b("./plugins.js"), y = f(x), z = b("../../src/js/utils/merge-options.js"), A = f(z), B = b("./utils/fn.js"), C = e(B), D = b("./tracks/text-track.js"), E = f(D), F = b("./tracks/audio-track.js"), G = f(F), H = b("./tracks/video-track.js"), I = f(H), J = b("./utils/time-ranges.js"), K = b("./utils/format-time.js"), L = f(K), M = b("./utils/log.js"), N = f(M), O = b("./utils/dom.js"), P = e(O), Q = b("./utils/browser.js"), R = e(Q), S = b("./utils/url.js"), T = e(S), U = b("./extend.js"), V = f(U), W = b("lodash-compat/object/merge"), X = f(W), Y = b("xhr"), Z = f(Y), $ = b("./tech/tech.js"), _ = f($), aa = b("./tech/html5.js"), ba = (f(aa), b("./tech/flash.js")); f(ba) } if ("undefined" == typeof HTMLVideoElement && (k["default"].createElement("video"), k["default"].createElement("audio"), k["default"].createElement("track")), i["default"].VIDEOJS_NO_DYNAMIC_STYLE !== !0) { var ca = P.$(".vjs-styles-defaults"); if (!ca) { ca = o.createStyleElement("vjs-styles-defaults"); var da = P.$("head"); da.insertBefore(ca, da.firstChild), o.setTextContent(ca, "\n      .video-js {\n        width: 300px;\n        height: 150px;\n      }\n\n      .vjs-fluid {\n        padding-top: 56.25%\n      }\n    ") } } m.autoSetupTimeout(1, g), g.VERSION = "5.11.6", g.options = w["default"].prototype.options_, g.getPlayers = function () { return w["default"].players }, g.players = w["default"].players, g.getComponent = q["default"].getComponent,
                g.registerComponent = function (a, b) { _["default"].isTech(b) && N["default"].warn("The " + a + " tech was registered as a component. It should instead be registered using videojs.registerTech(name, tech)"), q["default"].registerComponent.call(q["default"], a, b) }, g.getTech = _["default"].getTech, g.registerTech = _["default"].registerTech, g.browser = R, g.TOUCH_ENABLED = R.TOUCH_ENABLED, g.extend = V["default"], g.mergeOptions = A["default"], g.bind = C.bind, g.plugin = y["default"], g.addLanguage = function (a, b) { var c; return a = ("" + a).toLowerCase(), X["default"](g.options.languages, (c = {}, c[a] = b, c))[a] }, g.log = N["default"], g.createTimeRange = g.createTimeRanges = J.createTimeRanges, g.formatTime = L["default"], g.parseUrl = T.parseUrl, g.isCrossOrigin = T.isCrossOrigin, g.EventTarget = s["default"], g.on = u.on, g.one = u.one, g.off = u.off, g.trigger = u.trigger, g.xhr = Z["default"], g.TextTrack = E["default"], g.AudioTrack = G["default"], g.VideoTrack = I["default"], g.isEl = P.isEl, g.isTextNode = P.isTextNode, g.createEl = P.createEl, g.hasClass = P.hasElClass, g.addClass = P.addElClass, g.removeClass = P.removeElClass, g.toggleClass = P.toggleElClass, g.setAttributes = P.setElAttributes, g.getAttributes = P.getElAttributes, g.emptyEl = P.emptyEl, g.appendContent = P.appendContent, g.insertContent = P.insertContent, "function" == typeof a && a.amd ? a("videojs", [], function () { return g }) : "object" == typeof d && "object" == typeof c && (c.exports = g), d["default"] = g, c.exports = d["default"]
        }, { "../../src/js/utils/merge-options.js": 148, "./component": 67, "./event-target": 104, "./extend.js": 105, "./player": 113, "./plugins.js": 114, "./setup": 118, "./tech/flash.js": 121, "./tech/html5.js": 122, "./tech/tech.js": 124, "./tracks/audio-track.js": 126, "./tracks/text-track.js": 134, "./tracks/video-track.js": 139, "./utils/browser.js": 140, "./utils/dom.js": 142, "./utils/events.js": 143, "./utils/fn.js": 144, "./utils/format-time.js": 145, "./utils/log.js": 147, "./utils/stylesheet.js": 149, "./utils/time-ranges.js": 150, "./utils/url.js": 152, "global/document": 1, "global/window": 2, "lodash-compat/object/merge": 40, xhr: 56 }]
    }, {}, [153])(153)
}), function (a) { var b = a.vttjs = {}, c = b.VTTCue, d = b.VTTRegion, e = a.VTTCue, f = a.VTTRegion; b.shim = function () { b.VTTCue = c, b.VTTRegion = d }, b.restore = function () { b.VTTCue = e, b.VTTRegion = f } }(this), function (a, b) { function c(a) { if ("string" != typeof a) return !1; var b = h[a.toLowerCase()]; return b ? a.toLowerCase() : !1 } function d(a) { if ("string" != typeof a) return !1; var b = i[a.toLowerCase()]; return b ? a.toLowerCase() : !1 } function e(a) { for (var b = 1; b < arguments.length; b++) { var c = arguments[b]; for (var d in c) a[d] = c[d] } return a } function f(a, b, f) { var h = this, i = /MSIE\s8\.0/.test(navigator.userAgent), j = {}; i ? h = document.createElement("custom") : j.enumerable = !0, h.hasBeenReset = !1; var k = "", l = !1, m = a, n = b, o = f, p = null, q = "", r = !0, s = "auto", t = "start", u = 50, v = "middle", w = 50, x = "middle"; return Object.defineProperty(h, "id", e({}, j, { get: function () { return k }, set: function (a) { k = "" + a } })), Object.defineProperty(h, "pauseOnExit", e({}, j, { get: function () { return l }, set: function (a) { l = !!a } })), Object.defineProperty(h, "startTime", e({}, j, { get: function () { return m }, set: function (a) { if ("number" != typeof a) throw new TypeError("Start time must be set to a number."); m = a, this.hasBeenReset = !0 } })), Object.defineProperty(h, "endTime", e({}, j, { get: function () { return n }, set: function (a) { if ("number" != typeof a) throw new TypeError("End time must be set to a number."); n = a, this.hasBeenReset = !0 } })), Object.defineProperty(h, "text", e({}, j, { get: function () { return o }, set: function (a) { o = "" + a, this.hasBeenReset = !0 } })), Object.defineProperty(h, "region", e({}, j, { get: function () { return p }, set: function (a) { p = a, this.hasBeenReset = !0 } })), Object.defineProperty(h, "vertical", e({}, j, { get: function () { return q }, set: function (a) { var b = c(a); if (b === !1) throw new SyntaxError("An invalid or illegal string was specified."); q = b, this.hasBeenReset = !0 } })), Object.defineProperty(h, "snapToLines", e({}, j, { get: function () { return r }, set: function (a) { r = !!a, this.hasBeenReset = !0 } })), Object.defineProperty(h, "line", e({}, j, { get: function () { return s }, set: function (a) { if ("number" != typeof a && a !== g) throw new SyntaxError("An invalid number or illegal string was specified."); s = a, this.hasBeenReset = !0 } })), Object.defineProperty(h, "lineAlign", e({}, j, { get: function () { return t }, set: function (a) { var b = d(a); if (!b) throw new SyntaxError("An invalid or illegal string was specified."); t = b, this.hasBeenReset = !0 } })), Object.defineProperty(h, "position", e({}, j, { get: function () { return u }, set: function (a) { if (0 > a || a > 100) throw new Error("Position must be between 0 and 100."); u = a, this.hasBeenReset = !0 } })), Object.defineProperty(h, "positionAlign", e({}, j, { get: function () { return v }, set: function (a) { var b = d(a); if (!b) throw new SyntaxError("An invalid or illegal string was specified."); v = b, this.hasBeenReset = !0 } })), Object.defineProperty(h, "size", e({}, j, { get: function () { return w }, set: function (a) { if (0 > a || a > 100) throw new Error("Size must be between 0 and 100."); w = a, this.hasBeenReset = !0 } })), Object.defineProperty(h, "align", e({}, j, { get: function () { return x }, set: function (a) { var b = d(a); if (!b) throw new SyntaxError("An invalid or illegal string was specified."); x = b, this.hasBeenReset = !0 } })), h.displayState = void 0, i ? h : void 0 } var g = "auto", h = { "": !0, lr: !0, rl: !0 }, i = { start: !0, middle: !0, end: !0, left: !0, right: !0 }; f.prototype.getCueAsHTML = function () { return WebVTT.convertCueToDOMTree(window, this.text) }, a.VTTCue = a.VTTCue || f, b.VTTCue = f }(this, this.vttjs || {}), function (a, b) { function c(a) { if ("string" != typeof a) return !1; var b = f[a.toLowerCase()]; return b ? a.toLowerCase() : !1 } function d(a) { return "number" == typeof a && a >= 0 && 100 >= a } function e() { var a = 100, b = 3, e = 0, f = 100, g = 0, h = 100, i = ""; Object.defineProperties(this, { width: { enumerable: !0, get: function () { return a }, set: function (b) { if (!d(b)) throw new Error("Width must be between 0 and 100."); a = b } }, lines: { enumerable: !0, get: function () { return b }, set: function (a) { if ("number" != typeof a) throw new TypeError("Lines must be set to a number."); b = a } }, regionAnchorY: { enumerable: !0, get: function () { return f }, set: function (a) { if (!d(a)) throw new Error("RegionAnchorX must be between 0 and 100."); f = a } }, regionAnchorX: { enumerable: !0, get: function () { return e }, set: function (a) { if (!d(a)) throw new Error("RegionAnchorY must be between 0 and 100."); e = a } }, viewportAnchorY: { enumerable: !0, get: function () { return h }, set: function (a) { if (!d(a)) throw new Error("ViewportAnchorY must be between 0 and 100."); h = a } }, viewportAnchorX: { enumerable: !0, get: function () { return g }, set: function (a) { if (!d(a)) throw new Error("ViewportAnchorX must be between 0 and 100."); g = a } }, scroll: { enumerable: !0, get: function () { return i }, set: function (a) { var b = c(a); if (b === !1) throw new SyntaxError("An invalid or illegal string was specified."); i = b } } }) } var f = { "": !0, up: !0 }; a.VTTRegion = a.VTTRegion || e, b.VTTRegion = e }(this, this.vttjs || {}), function (a) { function b(a, b) { this.name = "ParsingError", this.code = a.code, this.message = b || a.message } function c(a) { function b(a, b, c, d) { return 3600 * (0 | a) + 60 * (0 | b) + (0 | c) + (0 | d) / 1e3 } var c = a.match(/^(\d+):(\d{2})(:\d{2})?\.(\d{3})/); return c ? c[3] ? b(c[1], c[2], c[3].replace(":", ""), c[4]) : c[1] > 59 ? b(c[1], c[2], 0, c[4]) : b(0, c[1], c[2], c[4]) : null } function d() { this.values = o(null) } function e(a, b, c, d) { var e = d ? a.split(d) : [a]; for (var f in e) if ("string" == typeof e[f]) { var g = e[f].split(c); if (2 === g.length) { var h = g[0], i = g[1]; b(h, i) } } } function f(a, f, g) { function h() { var d = c(a); if (null === d) throw new b(b.Errors.BadTimeStamp, "Malformed timestamp: " + k); return a = a.replace(/^[^\sa-zA-Z-]+/, ""), d } function i(a, b) { var c = new d; e(a, function (a, b) { switch (a) { case "region": for (var d = g.length - 1; d >= 0; d--)if (g[d].id === b) { c.set(a, g[d].region); break } break; case "vertical": c.alt(a, b, ["rl", "lr"]); break; case "line": var e = b.split(","), f = e[0]; c.integer(a, f), c.percent(a, f) ? c.set("snapToLines", !1) : null, c.alt(a, f, ["auto"]), 2 === e.length && c.alt("lineAlign", e[1], ["start", "middle", "end"]); break; case "position": e = b.split(","), c.percent(a, e[0]), 2 === e.length && c.alt("positionAlign", e[1], ["start", "middle", "end"]); break; case "size": c.percent(a, b); break; case "align": c.alt(a, b, ["start", "middle", "end", "left", "right"]) } }, /:/, /\s/), b.region = c.get("region", null), b.vertical = c.get("vertical", ""), b.line = c.get("line", "auto"), b.lineAlign = c.get("lineAlign", "start"), b.snapToLines = c.get("snapToLines", !0), b.size = c.get("size", 100), b.align = c.get("align", "middle"), b.position = c.get("position", { start: 0, left: 0, middle: 50, end: 100, right: 100 }, b.align), b.positionAlign = c.get("positionAlign", { start: "start", left: "start", middle: "middle", end: "end", right: "end" }, b.align) } function j() { a = a.replace(/^\s+/, "") } var k = a; if (j(), f.startTime = h(), j(), "-->" !== a.substr(0, 3)) throw new b(b.Errors.BadTimeStamp, "Malformed time stamp (time stamps must be separated by '-->'): " + k); a = a.substr(3), j(), f.endTime = h(), j(), i(a, f) } function g(a, b) { function d() { function a(a) { return b = b.substr(a.length), a } if (!b) return null; var c = b.match(/^([^<]*)(<[^>]+>?)?/); return a(c[1] ? c[1] : c[2]) } function e(a) { return p[a] } function f(a) { for (; o = a.match(/&(amp|lt|gt|lrm|rlm|nbsp);/);)a = a.replace(o[0], e); return a } function g(a, b) { return !s[b.localName] || s[b.localName] === a.localName } function h(b, c) { var d = q[b]; if (!d) return null; var e = a.document.createElement(d); e.localName = d; var f = r[b]; return f && c && (e[f] = c.trim()), e } for (var i, j = a.document.createElement("div"), k = j, l = []; null !== (i = d());)if ("<" !== i[0]) k.appendChild(a.document.createTextNode(f(i))); else { if ("/" === i[1]) { l.length && l[l.length - 1] === i.substr(2).replace(">", "") && (l.pop(), k = k.parentNode); continue } var m, n = c(i.substr(1, i.length - 2)); if (n) { m = a.document.createProcessingInstruction("timestamp", n), k.appendChild(m); continue } var o = i.match(/^<([^.\s\/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/); if (!o) continue; if (m = h(o[1], o[3]), !m) continue; if (!g(k, m)) continue; o[2] && (m.className = o[2].substr(1).replace(".", " ")), l.push(o[1]), k.appendChild(m), k = m } return j } function h(a) { function b(a, b) { for (var c = b.childNodes.length - 1; c >= 0; c--)a.push(b.childNodes[c]) } function c(a) { if (!a || !a.length) return null; var d = a.pop(), e = d.textContent || d.innerText; if (e) { var f = e.match(/^.*(\n|\r)/); return f ? (a.length = 0, f[0]) : e } return "ruby" === d.tagName ? c(a) : d.childNodes ? (b(a, d), c(a)) : void 0 } var d, e = [], f = ""; if (!a || !a.childNodes) return "ltr"; for (b(e, a); f = c(e);)for (var g = 0; g < f.length; g++) { d = f.charCodeAt(g); for (var h = 0; h < t.length; h++)if (t[h] === d) return "rtl" } return "ltr" } function i(a) { if ("number" == typeof a.line && (a.snapToLines || a.line >= 0 && a.line <= 100)) return a.line; if (!a.track || !a.track.textTrackList || !a.track.textTrackList.mediaElement) return -1; for (var b = a.track, c = b.textTrackList, d = 0, e = 0; e < c.length && c[e] !== b; e++)"showing" === c[e].mode && d++; return -1 * ++d } function j() { } function k(a, b, c) { var d = /MSIE\s8\.0/.test(navigator.userAgent), e = "rgba(255, 255, 255, 1)", f = "rgba(0, 0, 0, 0.8)"; d && (e = "rgb(255, 255, 255)", f = "rgb(0, 0, 0)"), j.call(this), this.cue = b, this.cueDiv = g(a, b.text); var i = { color: e, backgroundColor: f, position: "relative", left: 0, right: 0, top: 0, bottom: 0, display: "inline" }; d || (i.writingMode = "" === b.vertical ? "horizontal-tb" : "lr" === b.vertical ? "vertical-lr" : "vertical-rl", i.unicodeBidi = "plaintext"), this.applyStyles(i, this.cueDiv), this.div = a.document.createElement("div"), i = { textAlign: "middle" === b.align ? "center" : b.align, font: c.font, whiteSpace: "pre-line", position: "absolute" }, d || (i.direction = h(this.cueDiv), i.writingMode = "" === b.vertical ? "horizontal-tb" : "lr" === b.vertical ? "vertical-lr" : "vertical-rl".stylesunicodeBidi = "plaintext"), this.applyStyles(i), this.div.appendChild(this.cueDiv); var k = 0; switch (b.positionAlign) { case "start": k = b.position; break; case "middle": k = b.position - b.size / 2; break; case "end": k = b.position - b.size }this.applyStyles("" === b.vertical ? { left: this.formatStyle(k, "%"), width: this.formatStyle(b.size, "%") } : { top: this.formatStyle(k, "%"), height: this.formatStyle(b.size, "%") }), this.move = function (a) { this.applyStyles({ top: this.formatStyle(a.top, "px"), bottom: this.formatStyle(a.bottom, "px"), left: this.formatStyle(a.left, "px"), right: this.formatStyle(a.right, "px"), height: this.formatStyle(a.height, "px"), width: this.formatStyle(a.width, "px") }) } } function l(a) { var b, c, d, e, f = /MSIE\s8\.0/.test(navigator.userAgent); if (a.div) { c = a.div.offsetHeight, d = a.div.offsetWidth, e = a.div.offsetTop; var g = (g = a.div.childNodes) && (g = g[0]) && g.getClientRects && g.getClientRects(); a = a.div.getBoundingClientRect(), b = g ? Math.max(g[0] && g[0].height || 0, a.height / g.length) : 0 } this.left = a.left, this.right = a.right, this.top = a.top || e, this.height = a.height || c, this.bottom = a.bottom || e + (a.height || c), this.width = a.width || d, this.lineHeight = void 0 !== b ? b : a.lineHeight, f && !this.lineHeight && (this.lineHeight = 13) } function m(a, b, c, d) { function e(a, b) { for (var e, f = new l(a), g = 1, h = 0; h < b.length; h++) { for (; a.overlapsOppositeAxis(c, b[h]) || a.within(c) && a.overlapsAny(d);)a.move(b[h]); if (a.within(c)) return a; var i = a.intersectPercentage(c); g > i && (e = new l(a), g = i), a = new l(f) } return e || f } var f = new l(b), g = b.cue, h = i(g), j = []; if (g.snapToLines) { var k; switch (g.vertical) { case "": j = ["+y", "-y"], k = "height"; break; case "rl": j = ["+x", "-x"], k = "width"; break; case "lr": j = ["-x", "+x"], k = "width" }var m = f.lineHeight, n = m * Math.round(h), o = c[k] + m, p = j[0]; Math.abs(n) > o && (n = 0 > n ? -1 : 1, n *= Math.ceil(o / m) * m), 0 > h && (n += "" === g.vertical ? c.height : c.width, j = j.reverse()), f.move(p, n) } else { var q = f.lineHeight / c.height * 100; switch (g.lineAlign) { case "middle": h -= q / 2; break; case "end": h -= q }switch (g.vertical) { case "": b.applyStyles({ top: b.formatStyle(h, "%") }); break; case "rl": b.applyStyles({ left: b.formatStyle(h, "%") }); break; case "lr": b.applyStyles({ right: b.formatStyle(h, "%") }) }j = ["+y", "-x", "+x", "-y"], f = new l(b) } var r = e(f, j); b.move(r.toCSSCompatValues(c)) } function n() { } var o = Object.create || function () { function a() { } return function (b) { if (1 !== arguments.length) throw new Error("Object.create shim only accepts one parameter."); return a.prototype = b, new a } }(); b.prototype = o(Error.prototype), b.prototype.constructor = b, b.Errors = { BadSignature: { code: 0, message: "Malformed WebVTT signature." }, BadTimeStamp: { code: 1, message: "Malformed time stamp." } }, d.prototype = { set: function (a, b) { this.get(a) || "" === b || (this.values[a] = b) }, get: function (a, b, c) { return c ? this.has(a) ? this.values[a] : b[c] : this.has(a) ? this.values[a] : b }, has: function (a) { return a in this.values }, alt: function (a, b, c) { for (var d = 0; d < c.length; ++d)if (b === c[d]) { this.set(a, b); break } }, integer: function (a, b) { /^-?\d+$/.test(b) && this.set(a, parseInt(b, 10)) }, percent: function (a, b) { var c; return (c = b.match(/^([\d]{1,3})(\.[\d]*)?%$/)) && (b = parseFloat(b), b >= 0 && 100 >= b) ? (this.set(a, b), !0) : !1 } }; var p = { "&amp;": "&", "&lt;": "<", "&gt;": ">", "&lrm;": "‎", "&rlm;": "‏", "&nbsp;": " " }, q = { c: "span", i: "i", b: "b", u: "u", ruby: "ruby", rt: "rt", v: "span", lang: "span" }, r = { v: "title", lang: "lang" }, s = { rt: "ruby" }, t = [1470, 1472, 1475, 1478, 1488, 1489, 1490, 1491, 1492, 1493, 1494, 1495, 1496, 1497, 1498, 1499, 1500, 1501, 1502, 1503, 1504, 1505, 1506, 1507, 1508, 1509, 1510, 1511, 1512, 1513, 1514, 1520, 1521, 1522, 1523, 1524, 1544, 1547, 1549, 1563, 1566, 1567, 1568, 1569, 1570, 1571, 1572, 1573, 1574, 1575, 1576, 1577, 1578, 1579, 1580, 1581, 1582, 1583, 1584, 1585, 1586, 1587, 1588, 1589, 1590, 1591, 1592, 1593, 1594, 1595, 1596, 1597, 1598, 1599, 1600, 1601, 1602, 1603, 1604, 1605, 1606, 1607, 1608, 1609, 1610, 1645, 1646, 1647, 1649, 1650, 1651, 1652, 1653, 1654, 1655, 1656, 1657, 1658, 1659, 1660, 1661, 1662, 1663, 1664, 1665, 1666, 1667, 1668, 1669, 1670, 1671, 1672, 1673, 1674, 1675, 1676, 1677, 1678, 1679, 1680, 1681, 1682, 1683, 1684, 1685, 1686, 1687, 1688, 1689, 1690, 1691, 1692, 1693, 1694, 1695, 1696, 1697, 1698, 1699, 1700, 1701, 1702, 1703, 1704, 1705, 1706, 1707, 1708, 1709, 1710, 1711, 1712, 1713, 1714, 1715, 1716, 1717, 1718, 1719, 1720, 1721, 1722, 1723, 1724, 1725, 1726, 1727, 1728, 1729, 1730, 1731, 1732, 1733, 1734, 1735, 1736, 1737, 1738, 1739, 1740, 1741, 1742, 1743, 1744, 1745, 1746, 1747, 1748, 1749, 1765, 1766, 1774, 1775, 1786, 1787, 1788, 1789, 1790, 1791, 1792, 1793, 1794, 1795, 1796, 1797, 1798, 1799, 1800, 1801, 1802, 1803, 1804, 1805, 1807, 1808, 1810, 1811, 1812, 1813, 1814, 1815, 1816, 1817, 1818, 1819, 1820, 1821, 1822, 1823, 1824, 1825, 1826, 1827, 1828, 1829, 1830, 1831, 1832, 1833, 1834, 1835, 1836, 1837, 1838, 1839, 1869, 1870, 1871, 1872, 1873, 1874, 1875, 1876, 1877, 1878, 1879, 1880, 1881, 1882, 1883, 1884, 1885, 1886, 1887, 1888, 1889, 1890, 1891, 1892, 1893, 1894, 1895, 1896, 1897, 1898, 1899, 1900, 1901, 1902, 1903, 1904, 1905, 1906, 1907, 1908, 1909, 1910, 1911, 1912, 1913, 1914, 1915, 1916, 1917, 1918, 1919, 1920, 1921, 1922, 1923, 1924, 1925, 1926, 1927, 1928, 1929, 1930, 1931, 1932, 1933, 1934, 1935, 1936, 1937, 1938, 1939, 1940, 1941, 1942, 1943, 1944, 1945, 1946, 1947, 1948, 1949, 1950, 1951, 1952, 1953, 1954, 1955, 1956, 1957, 1969, 1984, 1985, 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2e3, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024, 2025, 2026, 2036, 2037, 2042, 2048, 2049, 2050, 2051, 2052, 2053, 2054, 2055, 2056, 2057, 2058, 2059, 2060, 2061, 2062, 2063, 2064, 2065, 2066, 2067, 2068, 2069, 2074, 2084, 2088, 2096, 2097, 2098, 2099, 2100, 2101, 2102, 2103, 2104, 2105, 2106, 2107, 2108, 2109, 2110, 2112, 2113, 2114, 2115, 2116, 2117, 2118, 2119, 2120, 2121, 2122, 2123, 2124, 2125, 2126, 2127, 2128, 2129, 2130, 2131, 2132, 2133, 2134, 2135, 2136, 2142, 2208, 2210, 2211, 2212, 2213, 2214, 2215, 2216, 2217, 2218, 2219, 2220, 8207, 64285, 64287, 64288, 64289, 64290, 64291, 64292, 64293, 64294, 64295, 64296, 64298, 64299, 64300, 64301, 64302, 64303, 64304, 64305, 64306, 64307, 64308, 64309, 64310, 64312, 64313, 64314, 64315, 64316, 64318, 64320, 64321, 64323, 64324, 64326, 64327, 64328, 64329, 64330, 64331, 64332, 64333, 64334, 64335, 64336, 64337, 64338, 64339, 64340, 64341, 64342, 64343, 64344, 64345, 64346, 64347, 64348, 64349, 64350, 64351, 64352, 64353, 64354, 64355, 64356, 64357, 64358, 64359, 64360, 64361, 64362, 64363, 64364, 64365, 64366, 64367, 64368, 64369, 64370, 64371, 64372, 64373, 64374, 64375, 64376, 64377, 64378, 64379, 64380, 64381, 64382, 64383, 64384, 64385, 64386, 64387, 64388, 64389, 64390, 64391, 64392, 64393, 64394, 64395, 64396, 64397, 64398, 64399, 64400, 64401, 64402, 64403, 64404, 64405, 64406, 64407, 64408, 64409, 64410, 64411, 64412, 64413, 64414, 64415, 64416, 64417, 64418, 64419, 64420, 64421, 64422, 64423, 64424, 64425, 64426, 64427, 64428, 64429, 64430, 64431, 64432, 64433, 64434, 64435, 64436, 64437, 64438, 64439, 64440, 64441, 64442, 64443, 64444, 64445, 64446, 64447, 64448, 64449, 64467, 64468, 64469, 64470, 64471, 64472, 64473, 64474, 64475, 64476, 64477, 64478, 64479, 64480, 64481, 64482, 64483, 64484, 64485, 64486, 64487, 64488, 64489, 64490, 64491, 64492, 64493, 64494, 64495, 64496, 64497, 64498, 64499, 64500, 64501, 64502, 64503, 64504, 64505, 64506, 64507, 64508, 64509, 64510, 64511, 64512, 64513, 64514, 64515, 64516, 64517, 64518, 64519, 64520, 64521, 64522, 64523, 64524, 64525, 64526, 64527, 64528, 64529, 64530, 64531, 64532, 64533, 64534, 64535, 64536, 64537, 64538, 64539, 64540, 64541, 64542, 64543, 64544, 64545, 64546, 64547, 64548, 64549, 64550, 64551, 64552, 64553, 64554, 64555, 64556, 64557, 64558, 64559, 64560, 64561, 64562, 64563, 64564, 64565, 64566, 64567, 64568, 64569, 64570, 64571, 64572, 64573, 64574, 64575, 64576, 64577, 64578, 64579, 64580, 64581, 64582, 64583, 64584, 64585, 64586, 64587, 64588, 64589, 64590, 64591, 64592, 64593, 64594, 64595, 64596, 64597, 64598, 64599, 64600, 64601, 64602, 64603, 64604, 64605, 64606, 64607, 64608, 64609, 64610, 64611, 64612, 64613, 64614, 64615, 64616, 64617, 64618, 64619, 64620, 64621, 64622, 64623, 64624, 64625, 64626, 64627, 64628, 64629, 64630, 64631, 64632, 64633, 64634, 64635, 64636, 64637, 64638, 64639, 64640, 64641, 64642, 64643, 64644, 64645, 64646, 64647, 64648, 64649, 64650, 64651, 64652, 64653, 64654, 64655, 64656, 64657, 64658, 64659, 64660, 64661, 64662, 64663, 64664, 64665, 64666, 64667, 64668, 64669, 64670, 64671, 64672, 64673, 64674, 64675, 64676, 64677, 64678, 64679, 64680, 64681, 64682, 64683, 64684, 64685, 64686, 64687, 64688, 64689, 64690, 64691, 64692, 64693, 64694, 64695, 64696, 64697, 64698, 64699, 64700, 64701, 64702, 64703, 64704, 64705, 64706, 64707, 64708, 64709, 64710, 64711, 64712, 64713, 64714, 64715, 64716, 64717, 64718, 64719, 64720, 64721, 64722, 64723, 64724, 64725, 64726, 64727, 64728, 64729, 64730, 64731, 64732, 64733, 64734, 64735, 64736, 64737, 64738, 64739, 64740, 64741, 64742, 64743, 64744, 64745, 64746, 64747, 64748, 64749, 64750, 64751, 64752, 64753, 64754, 64755, 64756, 64757, 64758, 64759, 64760, 64761, 64762, 64763, 64764, 64765, 64766, 64767, 64768, 64769, 64770, 64771, 64772, 64773, 64774, 64775, 64776, 64777, 64778, 64779, 64780, 64781, 64782, 64783, 64784, 64785, 64786, 64787, 64788, 64789, 64790, 64791, 64792, 64793, 64794, 64795, 64796, 64797, 64798, 64799, 64800, 64801, 64802, 64803, 64804, 64805, 64806, 64807, 64808, 64809, 64810, 64811, 64812, 64813, 64814, 64815, 64816, 64817, 64818, 64819, 64820, 64821, 64822, 64823, 64824, 64825, 64826, 64827, 64828, 64829, 64848, 64849, 64850, 64851, 64852, 64853, 64854, 64855, 64856, 64857, 64858, 64859, 64860, 64861, 64862, 64863, 64864, 64865, 64866, 64867, 64868, 64869, 64870, 64871, 64872, 64873, 64874, 64875, 64876, 64877, 64878, 64879, 64880, 64881, 64882, 64883, 64884, 64885, 64886, 64887, 64888, 64889, 64890, 64891, 64892, 64893, 64894, 64895, 64896, 64897, 64898, 64899, 64900, 64901, 64902, 64903, 64904, 64905, 64906, 64907, 64908, 64909, 64910, 64911, 64914, 64915, 64916, 64917, 64918, 64919, 64920, 64921, 64922, 64923, 64924, 64925, 64926, 64927, 64928, 64929, 64930, 64931, 64932, 64933, 64934, 64935, 64936, 64937, 64938, 64939, 64940, 64941, 64942, 64943, 64944, 64945, 64946, 64947, 64948, 64949, 64950, 64951, 64952, 64953, 64954, 64955, 64956, 64957, 64958, 64959, 64960, 64961, 64962, 64963, 64964, 64965, 64966, 64967, 65008, 65009, 65010, 65011, 65012, 65013, 65014, 65015, 65016, 65017, 65018, 65019, 65020, 65136, 65137, 65138, 65139, 65140, 65142, 65143, 65144, 65145, 65146, 65147, 65148, 65149, 65150, 65151, 65152, 65153, 65154, 65155, 65156, 65157, 65158, 65159, 65160, 65161, 65162, 65163, 65164, 65165, 65166, 65167, 65168, 65169, 65170, 65171, 65172, 65173, 65174, 65175, 65176, 65177, 65178, 65179, 65180, 65181, 65182, 65183, 65184, 65185, 65186, 65187, 65188, 65189, 65190, 65191, 65192, 65193, 65194, 65195, 65196, 65197, 65198, 65199, 65200, 65201, 65202, 65203, 65204, 65205, 65206, 65207, 65208, 65209, 65210, 65211, 65212, 65213, 65214, 65215, 65216, 65217, 65218, 65219, 65220, 65221, 65222, 65223, 65224, 65225, 65226, 65227, 65228, 65229, 65230, 65231, 65232, 65233, 65234, 65235, 65236, 65237, 65238, 65239, 65240, 65241, 65242, 65243, 65244, 65245, 65246, 65247, 65248, 65249, 65250, 65251, 65252, 65253, 65254, 65255, 65256, 65257, 65258, 65259, 65260, 65261, 65262, 65263, 65264, 65265, 65266, 65267, 65268, 65269, 65270, 65271, 65272, 65273, 65274, 65275, 65276, 67584, 67585, 67586, 67587, 67588, 67589, 67592, 67594, 67595, 67596, 67597, 67598, 67599, 67600, 67601, 67602, 67603, 67604, 67605, 67606, 67607, 67608, 67609, 67610, 67611, 67612, 67613, 67614, 67615, 67616, 67617, 67618, 67619, 67620, 67621, 67622, 67623, 67624, 67625, 67626, 67627, 67628, 67629, 67630, 67631, 67632, 67633, 67634, 67635, 67636, 67637, 67639, 67640, 67644, 67647, 67648, 67649, 67650, 67651, 67652, 67653, 67654, 67655, 67656, 67657, 67658, 67659, 67660, 67661, 67662, 67663, 67664, 67665, 67666, 67667, 67668, 67669, 67671, 67672, 67673, 67674, 67675, 67676, 67677, 67678, 67679, 67840, 67841, 67842, 67843, 67844, 67845, 67846, 67847, 67848, 67849, 67850, 67851, 67852, 67853, 67854, 67855, 67856, 67857, 67858, 67859, 67860, 67861, 67862, 67863, 67864, 67865, 67866, 67867, 67872, 67873, 67874, 67875, 67876, 67877, 67878, 67879, 67880, 67881, 67882, 67883, 67884, 67885, 67886, 67887, 67888, 67889, 67890, 67891, 67892, 67893, 67894, 67895, 67896, 67897, 67903, 67968, 67969, 67970, 67971, 67972, 67973, 67974, 67975, 67976, 67977, 67978, 67979, 67980, 67981, 67982, 67983, 67984, 67985, 67986, 67987, 67988, 67989, 67990, 67991, 67992, 67993, 67994, 67995, 67996, 67997, 67998, 67999, 68e3, 68001, 68002, 68003, 68004, 68005, 68006, 68007, 68008, 68009, 68010, 68011, 68012, 68013, 68014, 68015, 68016, 68017, 68018, 68019, 68020, 68021, 68022, 68023, 68030, 68031, 68096, 68112, 68113, 68114, 68115, 68117, 68118, 68119, 68121, 68122, 68123, 68124, 68125, 68126, 68127, 68128, 68129, 68130, 68131, 68132, 68133, 68134, 68135, 68136, 68137, 68138, 68139, 68140, 68141, 68142, 68143, 68144, 68145, 68146, 68147, 68160, 68161, 68162, 68163, 68164, 68165, 68166, 68167, 68176, 68177, 68178, 68179, 68180, 68181, 68182, 68183, 68184, 68192, 68193, 68194, 68195, 68196, 68197, 68198, 68199, 68200, 68201, 68202, 68203, 68204, 68205, 68206, 68207, 68208, 68209, 68210, 68211, 68212, 68213, 68214, 68215, 68216, 68217, 68218, 68219, 68220, 68221, 68222, 68223, 68352, 68353, 68354, 68355, 68356, 68357, 68358, 68359, 68360, 68361, 68362, 68363, 68364, 68365, 68366, 68367, 68368, 68369, 68370, 68371, 68372, 68373, 68374, 68375, 68376, 68377, 68378, 68379, 68380, 68381, 68382, 68383, 68384, 68385, 68386, 68387, 68388, 68389, 68390, 68391, 68392, 68393, 68394, 68395, 68396, 68397, 68398, 68399, 68400, 68401, 68402, 68403, 68404, 68405, 68416, 68417, 68418, 68419, 68420, 68421, 68422, 68423, 68424, 68425, 68426, 68427, 68428, 68429, 68430, 68431, 68432, 68433, 68434, 68435, 68436, 68437, 68440, 68441, 68442, 68443, 68444, 68445, 68446, 68447, 68448, 68449, 68450, 68451, 68452, 68453, 68454, 68455, 68456, 68457, 68458, 68459, 68460, 68461, 68462, 68463, 68464, 68465, 68466, 68472, 68473, 68474, 68475, 68476, 68477, 68478, 68479, 68608, 68609, 68610, 68611, 68612, 68613, 68614, 68615, 68616, 68617, 68618, 68619, 68620, 68621, 68622, 68623, 68624, 68625, 68626, 68627, 68628, 68629, 68630, 68631, 68632, 68633, 68634, 68635, 68636, 68637, 68638, 68639, 68640, 68641, 68642, 68643, 68644, 68645, 68646, 68647, 68648, 68649, 68650, 68651, 68652, 68653, 68654, 68655, 68656, 68657, 68658, 68659, 68660, 68661, 68662, 68663, 68664, 68665, 68666, 68667, 68668, 68669, 68670, 68671, 68672, 68673, 68674, 68675, 68676, 68677, 68678, 68679, 68680, 126464, 126465, 126466, 126467, 126469, 126470, 126471, 126472, 126473, 126474, 126475, 126476, 126477, 126478, 126479, 126480, 126481, 126482, 126483, 126484, 126485, 126486, 126487, 126488, 126489, 126490, 126491, 126492, 126493, 126494, 126495, 126497, 126498, 126500, 126503, 126505, 126506, 126507, 126508, 126509, 126510, 126511, 126512, 126513, 126514, 126516, 126517, 126518, 126519, 126521, 126523, 126530, 126535, 126537, 126539, 126541, 126542, 126543, 126545, 126546, 126548, 126551, 126553, 126555, 126557, 126559, 126561, 126562, 126564, 126567, 126568, 126569, 126570, 126572, 126573, 126574, 126575, 126576, 126577, 126578, 126580, 126581, 126582, 126583, 126585, 126586, 126587, 126588, 126590, 126592, 126593, 126594, 126595, 126596, 126597, 126598, 126599, 126600, 126601, 126603, 126604, 126605, 126606, 126607, 126608, 126609, 126610, 126611, 126612, 126613, 126614, 126615, 126616, 126617, 126618, 126619, 126625, 126626, 126627, 126629, 126630, 126631, 126632, 126633, 126635, 126636, 126637, 126638, 126639, 126640, 126641, 126642, 126643, 126644, 126645, 126646, 126647, 126648, 126649, 126650, 126651, 1114109]; j.prototype.applyStyles = function (a, b) { b = b || this.div; for (var c in a) a.hasOwnProperty(c) && (b.style[c] = a[c]) }, j.prototype.formatStyle = function (a, b) { return 0 === a ? 0 : a + b }, k.prototype = o(j.prototype), k.prototype.constructor = k, l.prototype.move = function (a, b) { switch (b = void 0 !== b ? b : this.lineHeight, a) { case "+x": this.left += b, this.right += b; break; case "-x": this.left -= b, this.right -= b; break; case "+y": this.top += b, this.bottom += b; break; case "-y": this.top -= b, this.bottom -= b } }, l.prototype.overlaps = function (a) { return this.left < a.right && this.right > a.left && this.top < a.bottom && this.bottom > a.top }, l.prototype.overlapsAny = function (a) { for (var b = 0; b < a.length; b++)if (this.overlaps(a[b])) return !0; return !1 }, l.prototype.within = function (a) { return this.top >= a.top && this.bottom <= a.bottom && this.left >= a.left && this.right <= a.right }, l.prototype.overlapsOppositeAxis = function (a, b) { switch (b) { case "+x": return this.left < a.left; case "-x": return this.right > a.right; case "+y": return this.top < a.top; case "-y": return this.bottom > a.bottom } }, l.prototype.intersectPercentage = function (a) { var b = Math.max(0, Math.min(this.right, a.right) - Math.max(this.left, a.left)), c = Math.max(0, Math.min(this.bottom, a.bottom) - Math.max(this.top, a.top)), d = b * c; return d / (this.height * this.width) }, l.prototype.toCSSCompatValues = function (a) { return { top: this.top - a.top, bottom: a.bottom - this.bottom, left: this.left - a.left, right: a.right - this.right, height: this.height, width: this.width } }, l.getSimpleBoxPosition = function (a) { var b = a.div ? a.div.offsetHeight : a.tagName ? a.offsetHeight : 0, c = a.div ? a.div.offsetWidth : a.tagName ? a.offsetWidth : 0, d = a.div ? a.div.offsetTop : a.tagName ? a.offsetTop : 0; a = a.div ? a.div.getBoundingClientRect() : a.tagName ? a.getBoundingClientRect() : a; var e = { left: a.left, right: a.right, top: a.top || d, height: a.height || b, bottom: a.bottom || d + (a.height || b), width: a.width || c }; return e }, n.StringDecoder = function () { return { decode: function (a) { if (!a) return ""; if ("string" != typeof a) throw new Error("Error - expected string data."); return decodeURIComponent(encodeURIComponent(a)) } } }, n.convertCueToDOMTree = function (a, b) { return a && b ? g(a, b) : null }; var u = .05, v = "sans-serif", w = "1.5%"; n.processCues = function (a, b, c) { function d(a) { for (var b = 0; b < a.length; b++)if (a[b].hasBeenReset || !a[b].displayState) return !0; return !1 } if (!a || !b || !c) return null; for (; c.firstChild;)c.removeChild(c.firstChild); var e = a.document.createElement("div"); if (e.style.position = "absolute", e.style.left = "0", e.style.right = "0", e.style.top = "0", e.style.bottom = "0", e.style.margin = w, c.appendChild(e), d(b)) { var f = [], g = l.getSimpleBoxPosition(e), h = Math.round(g.height * u * 100) / 100, i = { font: h + "px " + v }; !function () { for (var c, d, h = 0; h < b.length; h++)d = b[h], c = new k(a, d, i), e.appendChild(c.div), m(a, c, g, f), d.displayState = c.div, f.push(l.getSimpleBoxPosition(c)) }() } else for (var j = 0; j < b.length; j++)e.appendChild(b[j].displayState) }, n.Parser = function (a, b, c) { c || (c = b, b = {}), b || (b = {}), this.window = a, this.vttjs = b, this.state = "INITIAL", this.buffer = "", this.decoder = c || new TextDecoder("utf8"), this.regionList = [] }, n.Parser.prototype = { reportOrThrowError: function (a) { if (!(a instanceof b)) throw a; this.onparsingerror && this.onparsingerror(a) }, parse: function (a) { function c() { for (var a = i.buffer, b = 0; b < a.length && "\r" !== a[b] && "\n" !== a[b];)++b; var c = a.substr(0, b); return "\r" === a[b] && ++b, "\n" === a[b] && ++b, i.buffer = a.substr(b), c } function g(a) { var b = new d; if (e(a, function (a, c) { switch (a) { case "id": b.set(a, c); break; case "width": b.percent(a, c); break; case "lines": b.integer(a, c); break; case "regionanchor": case "viewportanchor": var e = c.split(","); if (2 !== e.length) break; var f = new d; if (f.percent("x", e[0]), f.percent("y", e[1]), !f.has("x") || !f.has("y")) break; b.set(a + "X", f.get("x")), b.set(a + "Y", f.get("y")); break; case "scroll": b.alt(a, c, ["up"]) } }, /=/, /\s/), b.has("id")) { var c = new (i.vttjs.VTTRegion || i.window.VTTRegion); c.width = b.get("width", 100), c.lines = b.get("lines", 3), c.regionAnchorX = b.get("regionanchorX", 0), c.regionAnchorY = b.get("regionanchorY", 100), c.viewportAnchorX = b.get("viewportanchorX", 0), c.viewportAnchorY = b.get("viewportanchorY", 100), c.scroll = b.get("scroll", ""), i.onregion && i.onregion(c), i.regionList.push({ id: b.get("id"), region: c }) } } function h(a) { e(a, function (a, b) { switch (a) { case "Region": g(b) } }, /:/) } var i = this; a && (i.buffer += i.decoder.decode(a, { stream: !0 })); try { var j; if ("INITIAL" === i.state) { if (!/\r\n|\n/.test(i.buffer)) return this; j = c(); var k = j.match(/^WEBVTT([ \t].*)?$/); if (!k || !k[0]) throw new b(b.Errors.BadSignature); i.state = "HEADER" } for (var l = !1; i.buffer;) { if (!/\r\n|\n/.test(i.buffer)) return this; switch (l ? l = !1 : j = c(), i.state) { case "HEADER": /:/.test(j) ? h(j) : j || (i.state = "ID"); continue; case "NOTE": j || (i.state = "ID"); continue; case "ID": if (/^NOTE($|[ \t])/.test(j)) { i.state = "NOTE"; break } if (!j) continue; if (i.cue = new (i.vttjs.VTTCue || i.window.VTTCue)(0, 0, ""), i.state = "CUE", -1 === j.indexOf("-->")) { i.cue.id = j; continue } case "CUE": try { f(j, i.cue, i.regionList) } catch (m) { i.reportOrThrowError(m), i.cue = null, i.state = "BADCUE"; continue } i.state = "CUETEXT"; continue; case "CUETEXT": var n = -1 !== j.indexOf("-->"); if (!j || n && (l = !0)) { i.oncue && i.oncue(i.cue), i.cue = null, i.state = "ID"; continue } i.cue.text && (i.cue.text += "\n"), i.cue.text += j; continue; case "BADCUE": j || (i.state = "ID"); continue } } } catch (m) { i.reportOrThrowError(m), "CUETEXT" === i.state && i.cue && i.oncue && i.oncue(i.cue), i.cue = null, i.state = "INITIAL" === i.state ? "BADWEBVTT" : "BADCUE" } return this }, flush: function () { var a = this; try { if (a.buffer += a.decoder.decode(), (a.cue || "HEADER" === a.state) && (a.buffer += "\n\n", a.parse()), "INITIAL" === a.state) throw new b(b.Errors.BadSignature) } catch (c) { a.reportOrThrowError(c) } return a.onflush && a.onflush(), this } }, a.WebVTT = n }(this, this.vttjs || {});
//# sourceMappingURL=video.min.js.map
!function () { !function (a) { var b = a && a.videojs; if (b) { b.CDN_VERSION = "5.11.6"; var c = "https:" === a.location.protocol ? "https://" : "http://"; b.options.flash.swf = c + "vjs.zencdn.net/swf/5.1.0/video-js.swf" } }(window), function (a, b, c, d, e, f, g) { b && b.HELP_IMPROVE_VIDEOJS !== !1 && (e.random() > .01 || (f = b.location, g = b.videojs || {}, a.src = "//www.google-analytics.com/__utm.gif?utmwv=5.4.2&utmac=UA-16505296-3&utmn=1&utmhn=" + d(f.hostname) + "&utmsr=" + b.screen.availWidth + "x" + b.screen.availHeight + "&utmul=" + (c.language || c.userLanguage || "").toLowerCase() + "&utmr=" + d(f.href) + "&utmp=" + d(f.hostname + f.pathname) + "&utmcc=__utma%3D1." + e.floor(1e10 * e.random()) + ".1.1.1.1%3B&utme=8(vjsv*cdnv)9(" + g.VERSION + "*" + g.CDN_VERSION + ")")) }(new Image, window, navigator, encodeURIComponent, Math) }();

!function (a, b) { "undefined" == typeof a.HTMLVideoElement && (b.createElement("video"), b.createElement("audio"), b.createElement("track")), function (a, b) { "use strict"; "function" == typeof define && define.amd ? define(b) : "object" == typeof exports ? module.exports = b() : a.returnExports = b() }(this, function () { var b, c = Array, d = c.prototype, e = Object, f = e.prototype, g = Function.prototype, h = String, i = h.prototype, j = Number, k = j.prototype, l = d.slice, m = d.splice, n = d.push, o = d.unshift, p = d.concat, q = g.call, r = g.apply, s = Math.max, t = Math.min, u = f.toString, v = "function" == typeof Symbol && "symbol" == typeof Symbol.toStringTag, w = Function.prototype.toString, x = function (a) { try { return w.call(a), !0 } catch (b) { return !1 } }, y = "[object Function]", z = "[object GeneratorFunction]"; b = function (a) { if ("function" != typeof a) return !1; if (v) return x(a); var b = u.call(a); return b === y || b === z }; var A, B = RegExp.prototype.exec, C = function (a) { try { return B.call(a), !0 } catch (b) { return !1 } }, D = "[object RegExp]"; A = function (a) { return "object" != typeof a ? !1 : v ? C(a) : u.call(a) === D }; var E, F = String.prototype.valueOf, G = function (a) { try { return F.call(a), !0 } catch (b) { return !1 } }, H = "[object String]"; E = function (a) { return "string" == typeof a ? !0 : "object" != typeof a ? !1 : v ? G(a) : u.call(a) === H }; var I = e.defineProperty && function () { try { var a = {}; e.defineProperty(a, "x", { enumerable: !1, value: a }); for (var b in a) return !1; return a.x === a } catch (c) { return !1 } }(), J = function (a) { var b; return b = I ? function (a, b, c, d) { !d && b in a || e.defineProperty(a, b, { configurable: !0, enumerable: !1, writable: !0, value: c }) } : function (a, b, c, d) { !d && b in a || (a[b] = c) }, function (c, d, e) { for (var f in d) a.call(d, f) && b(c, f, d[f], e) } }(f.hasOwnProperty), K = function (a) { var b = typeof a; return null === a || "object" !== b && "function" !== b }, L = j.isNaN || function (a) { return a !== a }, M = { ToInteger: function (a) { var b = +a; return L(b) ? b = 0 : 0 !== b && b !== 1 / 0 && b !== -(1 / 0) && (b = (b > 0 || -1) * Math.floor(Math.abs(b))), b }, ToPrimitive: function (a) { var c, d, e; if (K(a)) return a; if (d = a.valueOf, b(d) && (c = d.call(a), K(c))) return c; if (e = a.toString, b(e) && (c = e.call(a), K(c))) return c; throw new TypeError }, ToObject: function (a) { if (null == a) throw new TypeError("can't convert " + a + " to object"); return e(a) }, ToUint32: function (a) { return a >>> 0 } }, N = function () { }; J(g, { bind: function (a) { var c = this; if (!b(c)) throw new TypeError("Function.prototype.bind called on incompatible " + c); for (var d, f = l.call(arguments, 1), g = function () { if (this instanceof d) { var b = c.apply(this, p.call(f, l.call(arguments))); return e(b) === b ? b : this } return c.apply(a, p.call(f, l.call(arguments))) }, h = s(0, c.length - f.length), i = [], j = 0; h > j; j++) n.call(i, "$" + j); return d = Function("binder", "return function (" + i.join(",") + "){ return binder.apply(this, arguments); }")(g), c.prototype && (N.prototype = c.prototype, d.prototype = new N, N.prototype = null), d } }); var O = q.bind(f.hasOwnProperty), P = q.bind(f.toString), Q = q.bind(l), R = r.bind(l), S = q.bind(i.slice), T = q.bind(i.split), U = q.bind(i.indexOf), V = q.bind(n), W = q.bind(f.propertyIsEnumerable), X = q.bind(d.sort), Y = c.isArray || function (a) { return "[object Array]" === P(a) }, Z = 1 !== [].unshift(0); J(d, { unshift: function () { return o.apply(this, arguments), this.length } }, Z), J(c, { isArray: Y }); var $ = e("a"), _ = "a" !== $[0] || !(0 in $), aa = function (a) { var b = !0, c = !0, d = !1; if (a) try { a.call("foo", function (a, c, d) { "object" != typeof d && (b = !1) }), a.call([1], function () { "use strict"; c = "string" == typeof this }, "x") } catch (e) { d = !0 } return !!a && !d && b && c }; J(d, { forEach: function (a) { var c, d = M.ToObject(this), e = _ && E(this) ? T(this, "") : d, f = -1, g = M.ToUint32(e.length); if (arguments.length > 1 && (c = arguments[1]), !b(a)) throw new TypeError("Array.prototype.forEach callback must be a function"); for (; ++f < g;) f in e && ("undefined" == typeof c ? a(e[f], f, d) : a.call(c, e[f], f, d)) } }, !aa(d.forEach)), J(d, { map: function (a) { var d, e = M.ToObject(this), f = _ && E(this) ? T(this, "") : e, g = M.ToUint32(f.length), h = c(g); if (arguments.length > 1 && (d = arguments[1]), !b(a)) throw new TypeError("Array.prototype.map callback must be a function"); for (var i = 0; g > i; i++) i in f && ("undefined" == typeof d ? h[i] = a(f[i], i, e) : h[i] = a.call(d, f[i], i, e)); return h } }, !aa(d.map)), J(d, { filter: function (a) { var c, d, e = M.ToObject(this), f = _ && E(this) ? T(this, "") : e, g = M.ToUint32(f.length), h = []; if (arguments.length > 1 && (d = arguments[1]), !b(a)) throw new TypeError("Array.prototype.filter callback must be a function"); for (var i = 0; g > i; i++) i in f && (c = f[i], ("undefined" == typeof d ? a(c, i, e) : a.call(d, c, i, e)) && V(h, c)); return h } }, !aa(d.filter)), J(d, { every: function (a) { var c, d = M.ToObject(this), e = _ && E(this) ? T(this, "") : d, f = M.ToUint32(e.length); if (arguments.length > 1 && (c = arguments[1]), !b(a)) throw new TypeError("Array.prototype.every callback must be a function"); for (var g = 0; f > g; g++) if (g in e && !("undefined" == typeof c ? a(e[g], g, d) : a.call(c, e[g], g, d))) return !1; return !0 } }, !aa(d.every)), J(d, { some: function (a) { var c, d = M.ToObject(this), e = _ && E(this) ? T(this, "") : d, f = M.ToUint32(e.length); if (arguments.length > 1 && (c = arguments[1]), !b(a)) throw new TypeError("Array.prototype.some callback must be a function"); for (var g = 0; f > g; g++) if (g in e && ("undefined" == typeof c ? a(e[g], g, d) : a.call(c, e[g], g, d))) return !0; return !1 } }, !aa(d.some)); var ba = !1; d.reduce && (ba = "object" == typeof d.reduce.call("es5", function (a, b, c, d) { return d })), J(d, { reduce: function (a) { var c = M.ToObject(this), d = _ && E(this) ? T(this, "") : c, e = M.ToUint32(d.length); if (!b(a)) throw new TypeError("Array.prototype.reduce callback must be a function"); if (0 === e && 1 === arguments.length) throw new TypeError("reduce of empty array with no initial value"); var f, g = 0; if (arguments.length >= 2) f = arguments[1]; else for (; ;) { if (g in d) { f = d[g++]; break } if (++g >= e) throw new TypeError("reduce of empty array with no initial value") } for (; e > g; g++) g in d && (f = a(f, d[g], g, c)); return f } }, !ba); var ca = !1; d.reduceRight && (ca = "object" == typeof d.reduceRight.call("es5", function (a, b, c, d) { return d })), J(d, { reduceRight: function (a) { var c = M.ToObject(this), d = _ && E(this) ? T(this, "") : c, e = M.ToUint32(d.length); if (!b(a)) throw new TypeError("Array.prototype.reduceRight callback must be a function"); if (0 === e && 1 === arguments.length) throw new TypeError("reduceRight of empty array with no initial value"); var f, g = e - 1; if (arguments.length >= 2) f = arguments[1]; else for (; ;) { if (g in d) { f = d[g--]; break } if (--g < 0) throw new TypeError("reduceRight of empty array with no initial value") } if (0 > g) return f; do g in d && (f = a(f, d[g], g, c)); while (g--); return f } }, !ca); var da = d.indexOf && -1 !== [0, 1].indexOf(1, 2); J(d, { indexOf: function (a) { var b = _ && E(this) ? T(this, "") : M.ToObject(this), c = M.ToUint32(b.length); if (0 === c) return -1; var d = 0; for (arguments.length > 1 && (d = M.ToInteger(arguments[1])), d = d >= 0 ? d : s(0, c + d); c > d; d++) if (d in b && b[d] === a) return d; return -1 } }, da); var ea = d.lastIndexOf && -1 !== [0, 1].lastIndexOf(0, -3); J(d, { lastIndexOf: function (a) { var b = _ && E(this) ? T(this, "") : M.ToObject(this), c = M.ToUint32(b.length); if (0 === c) return -1; var d = c - 1; for (arguments.length > 1 && (d = t(d, M.ToInteger(arguments[1]))), d = d >= 0 ? d : c - Math.abs(d); d >= 0; d--) if (d in b && a === b[d]) return d; return -1 } }, ea); var fa = function () { var a = [1, 2], b = a.splice(); return 2 === a.length && Y(b) && 0 === b.length }(); J(d, { splice: function (a, b) { return 0 === arguments.length ? [] : m.apply(this, arguments) } }, !fa); var ga = function () { var a = {}; return d.splice.call(a, 0, 0, 1), 1 === a.length }(); J(d, { splice: function (a, b) { if (0 === arguments.length) return []; var c = arguments; return this.length = s(M.ToInteger(this.length), 0), arguments.length > 0 && "number" != typeof b && (c = Q(arguments), c.length < 2 ? V(c, this.length - a) : c[1] = M.ToInteger(b)), m.apply(this, c) } }, !ga); var ha = function () { var a = new c(1e5); return a[8] = "x", a.splice(1, 1), 7 === a.indexOf("x") }(), ia = function () { var a = 256, b = []; return b[a] = "a", b.splice(a + 1, 0, "b"), "a" === b[a] }(); J(d, { splice: function (a, b) { for (var c, d = M.ToObject(this), e = [], f = M.ToUint32(d.length), g = M.ToInteger(a), i = 0 > g ? s(f + g, 0) : t(g, f), j = t(s(M.ToInteger(b), 0), f - i), k = 0; j > k;) c = h(i + k), O(d, c) && (e[k] = d[c]), k += 1; var l, m = Q(arguments, 2), n = m.length; if (j > n) { for (k = i; f - j > k;) c = h(k + j), l = h(k + n), O(d, c) ? d[l] = d[c] : delete d[l], k += 1; for (k = f; k > f - j + n;) delete d[k - 1], k -= 1 } else if (n > j) for (k = f - j; k > i;) c = h(k + j - 1), l = h(k + n - 1), O(d, c) ? d[l] = d[c] : delete d[l], k -= 1; k = i; for (var o = 0; o < m.length; ++o) d[k] = m[o], k += 1; return d.length = f - j + n, e } }, !ha || !ia); var ja, ka = d.join; try { ja = "1,2,3" !== Array.prototype.join.call("123", ",") } catch (la) { ja = !0 } ja && J(d, { join: function (a) { var b = "undefined" == typeof a ? "," : a; return ka.call(E(this) ? T(this, "") : this, b) } }, ja); var ma = "1,2" !== [1, 2].join(void 0); ma && J(d, { join: function (a) { var b = "undefined" == typeof a ? "," : a; return ka.call(this, b) } }, ma); var na = function (a) { for (var b = M.ToObject(this), c = M.ToUint32(b.length), d = 0; d < arguments.length;) b[c + d] = arguments[d], d += 1; return b.length = c + d, c + d }, oa = function () { var a = {}, b = Array.prototype.push.call(a, void 0); return 1 !== b || 1 !== a.length || "undefined" != typeof a[0] || !O(a, 0) }(); J(d, { push: function (a) { return Y(this) ? n.apply(this, arguments) : na.apply(this, arguments) } }, oa); var pa = function () { var a = [], b = a.push(void 0); return 1 !== b || 1 !== a.length || "undefined" != typeof a[0] || !O(a, 0) }(); J(d, { push: na }, pa), J(d, { slice: function (a, b) { var c = E(this) ? T(this, "") : this; return R(c, arguments) } }, _); var qa = function () { try { return [1, 2].sort(null), [1, 2].sort({}), !0 } catch (a) { } return !1 }(), ra = function () { try { return [1, 2].sort(/a/), !1 } catch (a) { } return !0 }(), sa = function () { try { return [1, 2].sort(void 0), !0 } catch (a) { } return !1 }(); J(d, { sort: function (a) { if ("undefined" == typeof a) return X(this); if (!b(a)) throw new TypeError("Array.prototype.sort callback must be a function"); return X(this, a) } }, qa || !sa || !ra); var ta = !{ toString: null }.propertyIsEnumerable("toString"), ua = function () { }.propertyIsEnumerable("prototype"), va = !O("x", "0"), wa = function (a) { var b = a.constructor; return b && b.prototype === a }, xa = { $window: !0, $console: !0, $parent: !0, $self: !0, $frame: !0, $frames: !0, $frameElement: !0, $webkitIndexedDB: !0, $webkitStorageInfo: !0, $external: !0 }, ya = function () { if ("undefined" == typeof a) return !1; for (var b in a) try { !xa["$" + b] && O(a, b) && null !== a[b] && "object" == typeof a[b] && wa(a[b]) } catch (c) { return !0 } return !1 }(), za = function (b) { if ("undefined" == typeof a || !ya) return wa(b); try { return wa(b) } catch (c) { return !1 } }, Aa = ["toString", "toLocaleString", "valueOf", "hasOwnProperty", "isPrototypeOf", "propertyIsEnumerable", "constructor"], Ba = Aa.length, Ca = function (a) { return "[object Arguments]" === P(a) }, Da = function (a) { return null !== a && "object" == typeof a && "number" == typeof a.length && a.length >= 0 && !Y(a) && b(a.callee) }, Ea = Ca(arguments) ? Ca : Da; J(e, { keys: function (a) { var c = b(a), d = Ea(a), e = null !== a && "object" == typeof a, f = e && E(a); if (!e && !c && !d) throw new TypeError("Object.keys called on a non-object"); var g = [], i = ua && c; if (f && va || d) for (var j = 0; j < a.length; ++j) V(g, h(j)); if (!d) for (var k in a) i && "prototype" === k || !O(a, k) || V(g, h(k)); if (ta) for (var l = za(a), m = 0; Ba > m; m++) { var n = Aa[m]; l && "constructor" === n || !O(a, n) || V(g, n) } return g } }); var Fa = e.keys && function () { return 2 === e.keys(arguments).length }(1, 2), Ga = e.keys && function () { var a = e.keys(arguments); return 1 !== arguments.length || 1 !== a.length || 1 !== a[0] }(1), Ha = e.keys; J(e, { keys: function (a) { return Ha(Ea(a) ? Q(a) : a) } }, !Fa || Ga); var Ia, Ja, Ka = 0 !== new Date(-0xc782b5b342b24).getUTCMonth(), La = new Date(-0x55d318d56a724), Ma = new Date(14496624e5), Na = "Mon, 01 Jan -45875 11:59:59 GMT" !== La.toUTCString(), Oa = La.getTimezoneOffset(); -720 > Oa ? (Ia = "Tue Jan 02 -45875" !== La.toDateString(), Ja = !/^Thu Dec 10 2015 \d\d:\d\d:\d\d GMT[-\+]\d\d\d\d(?: |$)/.test(Ma.toString())) : (Ia = "Mon Jan 01 -45875" !== La.toDateString(), Ja = !/^Wed Dec 09 2015 \d\d:\d\d:\d\d GMT[-\+]\d\d\d\d(?: |$)/.test(Ma.toString())); var Pa = q.bind(Date.prototype.getFullYear), Qa = q.bind(Date.prototype.getMonth), Ra = q.bind(Date.prototype.getDate), Sa = q.bind(Date.prototype.getUTCFullYear), Ta = q.bind(Date.prototype.getUTCMonth), Ua = q.bind(Date.prototype.getUTCDate), Va = q.bind(Date.prototype.getUTCDay), Wa = q.bind(Date.prototype.getUTCHours), Xa = q.bind(Date.prototype.getUTCMinutes), Ya = q.bind(Date.prototype.getUTCSeconds), Za = q.bind(Date.prototype.getUTCMilliseconds), $a = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri"], _a = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], ab = function (a, b) { return Ra(new Date(b, a, 0)) }; J(Date.prototype, { getFullYear: function () { if (!(this && this instanceof Date)) throw new TypeError("this is not a Date object."); var a = Pa(this); return 0 > a && Qa(this) > 11 ? a + 1 : a }, getMonth: function () { if (!(this && this instanceof Date)) throw new TypeError("this is not a Date object."); var a = Pa(this), b = Qa(this); return 0 > a && b > 11 ? 0 : b }, getDate: function () { if (!(this && this instanceof Date)) throw new TypeError("this is not a Date object."); var a = Pa(this), b = Qa(this), c = Ra(this); if (0 > a && b > 11) { if (12 === b) return c; var d = ab(0, a + 1); return d - c + 1 } return c }, getUTCFullYear: function () { if (!(this && this instanceof Date)) throw new TypeError("this is not a Date object."); var a = Sa(this); return 0 > a && Ta(this) > 11 ? a + 1 : a }, getUTCMonth: function () { if (!(this && this instanceof Date)) throw new TypeError("this is not a Date object."); var a = Sa(this), b = Ta(this); return 0 > a && b > 11 ? 0 : b }, getUTCDate: function () { if (!(this && this instanceof Date)) throw new TypeError("this is not a Date object."); var a = Sa(this), b = Ta(this), c = Ua(this); if (0 > a && b > 11) { if (12 === b) return c; var d = ab(0, a + 1); return d - c + 1 } return c } }, Ka), J(Date.prototype, { toUTCString: function () { if (!(this && this instanceof Date)) throw new TypeError("this is not a Date object."); var a = Va(this), b = Ua(this), c = Ta(this), d = Sa(this), e = Wa(this), f = Xa(this), g = Ya(this); return $a[a] + ", " + (10 > b ? "0" + b : b) + " " + _a[c] + " " + d + " " + (10 > e ? "0" + e : e) + ":" + (10 > f ? "0" + f : f) + ":" + (10 > g ? "0" + g : g) + " GMT" } }, Ka || Na), J(Date.prototype, { toDateString: function () { if (!(this && this instanceof Date)) throw new TypeError("this is not a Date object."); var a = this.getDay(), b = this.getDate(), c = this.getMonth(), d = this.getFullYear(); return $a[a] + " " + _a[c] + " " + (10 > b ? "0" + b : b) + " " + d } }, Ka || Ia), (Ka || Ja) && (Date.prototype.toString = function () { if (!(this && this instanceof Date)) throw new TypeError("this is not a Date object."); var a = this.getDay(), b = this.getDate(), c = this.getMonth(), d = this.getFullYear(), e = this.getHours(), f = this.getMinutes(), g = this.getSeconds(), h = this.getTimezoneOffset(), i = Math.floor(Math.abs(h) / 60), j = Math.floor(Math.abs(h) % 60); return $a[a] + " " + _a[c] + " " + (10 > b ? "0" + b : b) + " " + d + " " + (10 > e ? "0" + e : e) + ":" + (10 > f ? "0" + f : f) + ":" + (10 > g ? "0" + g : g) + " GMT" + (h > 0 ? "-" : "+") + (10 > i ? "0" + i : i) + (10 > j ? "0" + j : j) }, I && e.defineProperty(Date.prototype, "toString", { configurable: !0, enumerable: !1, writable: !0 })); var bb = -621987552e5, cb = "-000001", db = Date.prototype.toISOString && -1 === new Date(bb).toISOString().indexOf(cb), eb = Date.prototype.toISOString && "1969-12-31T23:59:59.999Z" !== new Date(-1).toISOString(); J(Date.prototype, { toISOString: function () { if (!isFinite(this)) throw new RangeError("Date.prototype.toISOString called on non-finite value."); var a = Sa(this), b = Ta(this); a += Math.floor(b / 12), b = (b % 12 + 12) % 12; var c = [b + 1, Ua(this), Wa(this), Xa(this), Ya(this)]; a = (0 > a ? "-" : a > 9999 ? "+" : "") + S("00000" + Math.abs(a), a >= 0 && 9999 >= a ? -4 : -6); for (var d = 0; d < c.length; ++d) c[d] = S("00" + c[d], -2); return a + "-" + Q(c, 0, 2).join("-") + "T" + Q(c, 2).join(":") + "." + S("000" + Za(this), -3) + "Z" } }, db || eb); var fb = function () { try { return Date.prototype.toJSON && null === new Date(NaN).toJSON() && -1 !== new Date(bb).toJSON().indexOf(cb) && Date.prototype.toJSON.call({ toISOString: function () { return !0 } }) } catch (a) { return !1 } }(); fb || (Date.prototype.toJSON = function (a) { var c = e(this), d = M.ToPrimitive(c); if ("number" == typeof d && !isFinite(d)) return null; var f = c.toISOString; if (!b(f)) throw new TypeError("toISOString property is not callable"); return f.call(c) }); var gb = 1e15 === Date.parse("+033658-09-27T01:46:40.000Z"), hb = !isNaN(Date.parse("2012-04-04T24:00:00.500Z")) || !isNaN(Date.parse("2012-11-31T23:59:59.000Z")) || !isNaN(Date.parse("2012-12-31T23:59:60.000Z")), ib = isNaN(Date.parse("2000-01-01T00:00:00.000Z")); if (ib || hb || !gb) { var jb = Math.pow(2, 31) - 1, kb = L(new Date(1970, 0, 1, 0, 0, 0, jb + 1).getTime()); Date = function (a) { var b = function (c, d, e, f, g, i, j) { var k, l = arguments.length; if (this instanceof a) { var m = i, n = j; if (kb && l >= 7 && j > jb) { var o = Math.floor(j / jb) * jb, p = Math.floor(o / 1e3); m += p, n -= 1e3 * p } k = 1 === l && h(c) === c ? new a(b.parse(c)) : l >= 7 ? new a(c, d, e, f, g, m, n) : l >= 6 ? new a(c, d, e, f, g, m) : l >= 5 ? new a(c, d, e, f, g) : l >= 4 ? new a(c, d, e, f) : l >= 3 ? new a(c, d, e) : l >= 2 ? new a(c, d) : l >= 1 ? new a(c) : new a } else k = a.apply(this, arguments); return K(k) || J(k, { constructor: b }, !0), k }, c = new RegExp("^(\\d{4}|[+-]\\d{6})(?:-(\\d{2})(?:-(\\d{2})(?:T(\\d{2}):(\\d{2})(?::(\\d{2})(?:(\\.\\d{1,}))?)?(Z|(?:([-+])(\\d{2}):(\\d{2})))?)?)?)?$"), d = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365], e = function (a, b) { var c = b > 1 ? 1 : 0; return d[b] + Math.floor((a - 1969 + c) / 4) - Math.floor((a - 1901 + c) / 100) + Math.floor((a - 1601 + c) / 400) + 365 * (a - 1970) }, f = function (b) { var c = 0, d = b; if (kb && d > jb) { var e = Math.floor(d / jb) * jb, f = Math.floor(e / 1e3); c += f, d -= 1e3 * f } return j(new a(1970, 0, 1, 0, 0, c, d)) }; for (var g in a) O(a, g) && (b[g] = a[g]); J(b, { now: a.now, UTC: a.UTC }, !0), b.prototype = a.prototype, J(b.prototype, { constructor: b }, !0); var i = function (b) { var d = c.exec(b); if (d) { var g, h = j(d[1]), i = j(d[2] || 1) - 1, k = j(d[3] || 1) - 1, l = j(d[4] || 0), m = j(d[5] || 0), n = j(d[6] || 0), o = Math.floor(1e3 * j(d[7] || 0)), p = Boolean(d[4] && !d[8]), q = "-" === d[9] ? 1 : -1, r = j(d[10] || 0), s = j(d[11] || 0), t = m > 0 || n > 0 || o > 0; return (t ? 24 : 25) > l && 60 > m && 60 > n && 1e3 > o && i > -1 && 12 > i && 24 > r && 60 > s && k > -1 && k < e(h, i + 1) - e(h, i) && (g = 60 * (24 * (e(h, i) + k) + l + r * q), g = 1e3 * (60 * (g + m + s * q) + n) + o, p && (g = f(g)), g >= -864e13 && 864e13 >= g) ? g : NaN } return a.parse.apply(this, arguments) }; return J(b, { parse: i }), b }(Date) } Date.now || (Date.now = function () { return (new Date).getTime() }); var lb = k.toFixed && ("0.000" !== 8e-5.toFixed(3) || "1" !== .9.toFixed(0) || "1.25" !== 1.255.toFixed(2) || "1000000000000000128" !== 0xde0b6b3a7640080.toFixed(0)), mb = { base: 1e7, size: 6, data: [0, 0, 0, 0, 0, 0], multiply: function (a, b) { for (var c = -1, d = b; ++c < mb.size;) d += a * mb.data[c], mb.data[c] = d % mb.base, d = Math.floor(d / mb.base) }, divide: function (a) { for (var b = mb.size, c = 0; --b >= 0;) c += mb.data[b], mb.data[b] = Math.floor(c / a), c = c % a * mb.base }, numToString: function () { for (var a = mb.size, b = ""; --a >= 0;) if ("" !== b || 0 === a || 0 !== mb.data[a]) { var c = h(mb.data[a]); "" === b ? b = c : b += S("0000000", 0, 7 - c.length) + c } return b }, pow: function Gb(a, b, c) { return 0 === b ? c : b % 2 === 1 ? Gb(a, b - 1, c * a) : Gb(a * a, b / 2, c) }, log: function (a) { for (var b = 0, c = a; c >= 4096;) b += 12, c /= 4096; for (; c >= 2;) b += 1, c /= 2; return b } }, nb = function (a) { var b, c, d, e, f, g, i, k; if (b = j(a), b = L(b) ? 0 : Math.floor(b), 0 > b || b > 20) throw new RangeError("Number.toFixed called with invalid number of decimals"); if (c = j(this), L(c)) return "NaN"; if (-1e21 >= c || c >= 1e21) return h(c); if (d = "", 0 > c && (d = "-", c = -c), e = "0", c > 1e-21) if (f = mb.log(c * mb.pow(2, 69, 1)) - 69, g = 0 > f ? c * mb.pow(2, -f, 1) : c / mb.pow(2, f, 1), g *= 4503599627370496, f = 52 - f, f > 0) { for (mb.multiply(0, g), i = b; i >= 7;) mb.multiply(1e7, 0), i -= 7; for (mb.multiply(mb.pow(10, i, 1), 0), i = f - 1; i >= 23;) mb.divide(1 << 23), i -= 23; mb.divide(1 << i), mb.multiply(1, 1), mb.divide(2), e = mb.numToString() } else mb.multiply(0, g), mb.multiply(1 << -f, 0), e = mb.numToString() + S("0.00000000000000000000", 2, 2 + b); return b > 0 ? (k = e.length, e = b >= k ? d + S("0.0000000000000000000", 0, b - k + 2) + e : d + S(e, 0, k - b) + "." + S(e, k - b)) : e = d + e, e }; J(k, { toFixed: nb }, lb); var ob = function () { try { return "1" === 1..toPrecision(void 0) } catch (a) { return !0 } }(), pb = k.toPrecision; J(k, { toPrecision: function (a) { return "undefined" == typeof a ? pb.call(this) : pb.call(this, a) } }, ob), 2 !== "ab".split(/(?:ab)*/).length || 4 !== ".".split(/(.?)(.?)/).length || "t" === "tesst".split(/(s)*/)[1] || 4 !== "test".split(/(?:)/, -1).length || "".split(/.?/).length || ".".split(/()()/).length > 1 ? !function () { var a = "undefined" == typeof /()??/.exec("")[1], b = Math.pow(2, 32) - 1; i.split = function (c, d) { var e = String(this); if ("undefined" == typeof c && 0 === d) return []; if (!A(c)) return T(this, c, d); var f, g, h, i, j = [], k = (c.ignoreCase ? "i" : "") + (c.multiline ? "m" : "") + (c.unicode ? "u" : "") + (c.sticky ? "y" : ""), l = 0, m = new RegExp(c.source, k + "g"); a || (f = new RegExp("^" + m.source + "$(?!\\s)", k)); var o = "undefined" == typeof d ? b : M.ToUint32(d); for (g = m.exec(e); g && (h = g.index + g[0].length, !(h > l && (V(j, S(e, l, g.index)), !a && g.length > 1 && g[0].replace(f, function () { for (var a = 1; a < arguments.length - 2; a++) "undefined" == typeof arguments[a] && (g[a] = void 0) }), g.length > 1 && g.index < e.length && n.apply(j, Q(g, 1)), i = g[0].length, l = h, j.length >= o)));) m.lastIndex === g.index && m.lastIndex++ , g = m.exec(e); return l === e.length ? (i || !m.test("")) && V(j, "") : V(j, S(e, l)), j.length > o ? S(j, 0, o) : j } }() : "0".split(void 0, 0).length && (i.split = function (a, b) { return "undefined" == typeof a && 0 === b ? [] : T(this, a, b) }); var qb = i.replace, rb = function () { var a = []; return "x".replace(/x(.)?/g, function (b, c) { V(a, c) }), 1 === a.length && "undefined" == typeof a[0] }(); rb || (i.replace = function (a, c) { var d = b(c), e = A(a) && /\)[*?]/.test(a.source); if (d && e) { var f = function (b) { var d = arguments.length, e = a.lastIndex; a.lastIndex = 0; var f = a.exec(b) || []; return a.lastIndex = e, V(f, arguments[d - 2], arguments[d - 1]), c.apply(this, f) }; return qb.call(this, a, f) } return qb.call(this, a, c) }); var sb = i.substr, tb = "".substr && "b" !== "0b".substr(-1); J(i, { substr: function (a, b) { var c = a; return 0 > a && (c = s(this.length + a, 0)), sb.call(this, c, b) } }, tb); var ub = "	\n\f\r   ᠎             　\u2028\u2029\ufeff", vb = "​", wb = "[" + ub + "]", xb = new RegExp("^" + wb + wb + "*"), yb = new RegExp(wb + wb + "*$"), zb = i.trim && (ub.trim() || !vb.trim()); J(i, { trim: function () { if ("undefined" == typeof this || null === this) throw new TypeError("can't convert " + this + " to object"); return h(this).replace(xb, "").replace(yb, "") } }, zb); var Ab = q.bind(String.prototype.trim), Bb = i.lastIndexOf && -1 !== "abcあい".lastIndexOf("あい", 2); J(i, { lastIndexOf: function (a) { if ("undefined" == typeof this || null === this) throw new TypeError("can't convert " + this + " to object"); for (var b = h(this), c = h(a), d = arguments.length > 1 ? j(arguments[1]) : NaN, e = L(d) ? 1 / 0 : M.ToInteger(d), f = t(s(e, 0), b.length), g = c.length, i = f + g; i > 0;) { i = s(0, i - g); var k = U(S(b, i, f + g), c); if (-1 !== k) return i + k } return -1 } }, Bb); var Cb = i.lastIndexOf; if (J(i, { lastIndexOf: function (a) { return Cb.apply(this, arguments) } }, 1 !== i.lastIndexOf.length), (8 !== parseInt(ub + "08") || 22 !== parseInt(ub + "0x16")) && (parseInt = function (a) { var b = /^[\-+]?0[xX]/; return function (c, d) { var e = Ab(c), f = j(d) || (b.test(e) ? 16 : 10); return a(e, f) } }(parseInt)), 1 / parseFloat("-0") !== -(1 / 0) && (parseFloat = function (a) { return function (b) { var c = Ab(b), d = a(c); return 0 === d && "-" === S(c, 0, 1) ? -0 : d } }(parseFloat)), "RangeError: test" !== String(new RangeError("test"))) { var Db = function () { if ("undefined" == typeof this || null === this) throw new TypeError("can't convert " + this + " to object"); var a = this.name; "undefined" == typeof a ? a = "Error" : "string" != typeof a && (a = h(a)); var b = this.message; return "undefined" == typeof b ? b = "" : "string" != typeof b && (b = h(b)), a ? b ? a + ": " + b : a : b }; Error.prototype.toString = Db } if (I) { var Eb = function (a, b) { if (W(a, b)) { var c = Object.getOwnPropertyDescriptor(a, b); c.enumerable = !1, Object.defineProperty(a, b, c) } }; Eb(Error.prototype, "message"), "" !== Error.prototype.message && (Error.prototype.message = ""), Eb(Error.prototype, "name") } if ("/a/gim" !== String(/a/gim)) { var Fb = function () { var a = "/" + this.source + "/"; return this.global && (a += "g"), this.ignoreCase && (a += "i"), this.multiline && (a += "m"), a }; RegExp.prototype.toString = Fb } }), function (a, b) { "use strict"; "function" == typeof define && define.amd ? define(b) : "object" == typeof exports ? module.exports = b() : a.returnExports = b() }(this, function () { var a, c, d, e, f = Function.call, g = Object.prototype, h = f.bind(g.hasOwnProperty), i = f.bind(g.propertyIsEnumerable), j = f.bind(g.toString), k = h(g, "__defineGetter__"); k && (a = f.bind(g.__defineGetter__), c = f.bind(g.__defineSetter__), d = f.bind(g.__lookupGetter__), e = f.bind(g.__lookupSetter__)), Object.getPrototypeOf || (Object.getPrototypeOf = function (a) { var b = a.__proto__; return b || null === b ? b : "[object Function]" === j(a.constructor) ? a.constructor.prototype : a instanceof Object ? g : null }); var l = function (a) { try { return a.sentinel = 0, 0 === Object.getOwnPropertyDescriptor(a, "sentinel").value } catch (b) { return !1 } }; if (Object.defineProperty) { var m = l({}), n = "undefined" == typeof b || l(b.createElement("div")); if (!n || !m) var o = Object.getOwnPropertyDescriptor } if (!Object.getOwnPropertyDescriptor || o) { var p = "Object.getOwnPropertyDescriptor called on a non-object: "; Object.getOwnPropertyDescriptor = function (a, b) { if ("object" != typeof a && "function" != typeof a || null === a) throw new TypeError(p + a); if (o) try { return o.call(Object, a, b) } catch (c) { } var f; if (!h(a, b)) return f; if (f = { enumerable: i(a, b), configurable: !0 }, k) { var j = a.__proto__, l = a !== g; l && (a.__proto__ = g); var m = d(a, b), n = e(a, b); if (l && (a.__proto__ = j), m || n) return m && (f.get = m), n && (f.set = n), f } return f.value = a[b], f.writable = !0, f } } if (Object.getOwnPropertyNames || (Object.getOwnPropertyNames = function (a) { return Object.keys(a) }), !Object.create) { var q, r = !({ __proto__: null } instanceof Object), s = function () { if (!b.domain) return !1; try { return !!new ActiveXObject("htmlfile") } catch (a) { return !1 } }, t = function () { var a, b; return b = new ActiveXObject("htmlfile"), b.write("<script></script>"), b.close(), a = b.parentWindow.Object.prototype, b = null, a }, u = function () { var a, c = b.createElement("iframe"), d = b.body || b.documentElement; return c.style.display = "none", d.appendChild(c), c.src = "javascript:", a = c.contentWindow.Object.prototype, d.removeChild(c), c = null, a }; q = r || "undefined" == typeof b ? function () { return { __proto__: null } } : function () { var a = s() ? t() : u(); delete a.constructor, delete a.hasOwnProperty, delete a.propertyIsEnumerable, delete a.isPrototypeOf, delete a.toLocaleString, delete a.toString, delete a.valueOf; var b = function () { }; return b.prototype = a, q = function () { return new b }, new b }, Object.create = function (a, b) { var c, d = function () { }; if (null === a) c = q(); else { if ("object" != typeof a && "function" != typeof a) throw new TypeError("Object prototype may only be an Object or null"); d.prototype = a, c = new d, c.__proto__ = a } return void 0 !== b && Object.defineProperties(c, b), c } } var v = function (a) { try { return Object.defineProperty(a, "sentinel", {}), "sentinel" in a } catch (b) { return !1 } }; if (Object.defineProperty) { var w = v({}), x = "undefined" == typeof b || v(b.createElement("div")); if (!w || !x) var y = Object.defineProperty, z = Object.defineProperties } if (!Object.defineProperty || y) { var A = "Property description must be an object: ", B = "Object.defineProperty called on non-object: ", C = "getters & setters can not be defined on this javascript engine"; Object.defineProperty = function (b, f, h) { if ("object" != typeof b && "function" != typeof b || null === b) throw new TypeError(B + b); if ("object" != typeof h && "function" != typeof h || null === h) throw new TypeError(A + h); if (y) try { return y.call(Object, b, f, h) } catch (i) { } if ("value" in h) if (k && (d(b, f) || e(b, f))) { var j = b.__proto__; b.__proto__ = g, delete b[f], b[f] = h.value, b.__proto__ = j } else b[f] = h.value; else { if (!k && ("get" in h || "set" in h)) throw new TypeError(C); "get" in h && a(b, f, h.get), "set" in h && c(b, f, h.set) } return b } } (!Object.defineProperties || z) && (Object.defineProperties = function (a, b) { if (z) try { return z.call(Object, a, b) } catch (c) { } return Object.keys(b).forEach(function (c) { "__proto__" !== c && Object.defineProperty(a, c, b[c]) }), a }), Object.seal || (Object.seal = function (a) { if (Object(a) !== a) throw new TypeError("Object.seal can only be called on Objects."); return a }), Object.freeze || (Object.freeze = function (a) { if (Object(a) !== a) throw new TypeError("Object.freeze can only be called on Objects."); return a }); try { Object.freeze(function () { }) } catch (D) { Object.freeze = function (a) { return function (b) { return "function" == typeof b ? b : a(b) } }(Object.freeze) } Object.preventExtensions || (Object.preventExtensions = function (a) { if (Object(a) !== a) throw new TypeError("Object.preventExtensions can only be called on Objects."); return a }), Object.isSealed || (Object.isSealed = function (a) { if (Object(a) !== a) throw new TypeError("Object.isSealed can only be called on Objects."); return !1 }), Object.isFrozen || (Object.isFrozen = function (a) { if (Object(a) !== a) throw new TypeError("Object.isFrozen can only be called on Objects."); return !1 }), Object.isExtensible || (Object.isExtensible = function (a) { if (Object(a) !== a) throw new TypeError("Object.isExtensible can only be called on Objects."); for (var b = ""; h(a, b);) b += "?"; a[b] = !0; var c = h(a, b); return delete a[b], c }) }) }(window, document);

(function (root, factory) { if (typeof exports === "object" && typeof module !== "undefined") { module.exports = factory(require("video.js")) } else if (typeof define === "function" && define.amd) { define(["videojs"], function (videojs) { return root.Youtube = factory(videojs) }) } else { root.Youtube = factory(root.videojs) } })(this, function (videojs) { "use strict"; var Tech = videojs.getComponent("Tech"); var Youtube = videojs.extend(Tech, { constructor: function (options, ready) { Tech.call(this, options, ready); this.setPoster(options.poster); this.setSrc(this.options_.source, true); setTimeout(function () { this.el_.parentNode.className += " vjs-youtube"; if (_isOnMobile) { this.el_.parentNode.className += " vjs-youtube-mobile" } if (Youtube.isApiReady) { this.initYTPlayer() } else { Youtube.apiReadyQueue.push(this) } }.bind(this)) }, dispose: function () { if (this.ytPlayer) { this.ytPlayer.stopVideo(); this.ytPlayer.destroy() } else { var index = Youtube.apiReadyQueue.indexOf(this); if (index !== -1) { Youtube.apiReadyQueue.splice(index, 1) } } this.ytPlayer = null; this.el_.parentNode.className = this.el_.parentNode.className.replace(" vjs-youtube", "").replace(" vjs-youtube-mobile", ""); this.el_.remove(); Tech.prototype.dispose.call(this) }, createEl: function () { var div = document.createElement("div"); div.setAttribute("id", this.options_.techId); div.setAttribute("style", "width:100%;height:100%;top:0;left:0;position:absolute"); div.setAttribute("class", "vjs-tech"); var divWrapper = document.createElement("div"); divWrapper.appendChild(div); if (!_isOnMobile && !this.options_.ytControls) { var divBlocker = document.createElement("div"); divBlocker.setAttribute("class", "vjs-iframe-blocker"); divBlocker.setAttribute("style", "position:absolute;top:0;left:0;width:100%;height:100%"); divBlocker.onclick = function () { this.pause() }.bind(this); divWrapper.appendChild(divBlocker) } return divWrapper }, initYTPlayer: function () { var playerVars = { controls: 0, modestbranding: 1, rel: 0, showinfo: 0, loop: this.options_.loop ? 1 : 0 }; if (typeof this.options_.autohide !== "undefined") { playerVars.autohide = this.options_.autohide } if (typeof this.options_["cc_load_policy"] !== "undefined") { playerVars["cc_load_policy"] = this.options_["cc_load_policy"] } if (typeof this.options_.ytControls !== "undefined") { playerVars.controls = this.options_.ytControls } if (typeof this.options_.disablekb !== "undefined") { playerVars.disablekb = this.options_.disablekb } if (typeof this.options_.end !== "undefined") { playerVars.end = this.options_.end } if (typeof this.options_.color !== "undefined") { playerVars.color = this.options_.color } if (!playerVars.controls) { playerVars.fs = 0 } else if (typeof this.options_.fs !== "undefined") { playerVars.fs = this.options_.fs } if (typeof this.options_.end !== "undefined") { playerVars.end = this.options_.end } if (typeof this.options_.hl !== "undefined") { playerVars.hl = this.options_.hl } else if (typeof this.options_.language !== "undefined") { playerVars.hl = this.options_.language.substr(0, 2) } if (typeof this.options_["iv_load_policy"] !== "undefined") { playerVars["iv_load_policy"] = this.options_["iv_load_policy"] } if (typeof this.options_.list !== "undefined") { playerVars.list = this.options_.list } else if (this.url && typeof this.url.listId !== "undefined") { playerVars.list = this.url.listId } if (typeof this.options_.listType !== "undefined") { playerVars.listType = this.options_.listType } if (typeof this.options_.modestbranding !== "undefined") { playerVars.modestbranding = this.options_.modestbranding } if (typeof this.options_.playlist !== "undefined") { playerVars.playlist = this.options_.playlist } if (typeof this.options_.playsinline !== "undefined") { playerVars.playsinline = this.options_.playsinline } if (typeof this.options_.rel !== "undefined") { playerVars.rel = this.options_.rel } if (typeof this.options_.showinfo !== "undefined") { playerVars.showinfo = this.options_.showinfo } if (typeof this.options_.start !== "undefined") { playerVars.start = this.options_.start } if (typeof this.options_.theme !== "undefined") { playerVars.theme = this.options_.theme } this.activeVideoId = this.url ? this.url.videoId : null; this.activeList = playerVars.list; this.ytPlayer = new YT.Player(this.options_.techId, { videoId: this.activeVideoId, playerVars: playerVars, events: { onReady: this.onPlayerReady.bind(this), onPlaybackQualityChange: this.onPlayerPlaybackQualityChange.bind(this), onStateChange: this.onPlayerStateChange.bind(this), onError: this.onPlayerError.bind(this) } }) }, onPlayerReady: function () { this.playerReady_ = true; this.triggerReady(); if (this.playOnReady) { this.play() } else if (this.cueOnReady) { this.ytPlayer.cueVideoById(this.url.videoId); this.activeVideoId = this.url.videoId } }, onPlayerPlaybackQualityChange: function () { }, onPlayerStateChange: function (e) { var state = e.data; if (state === this.lastState || this.errorNumber) { return } this.lastState = state; switch (state) { case -1: this.trigger("loadstart"); this.trigger("loadedmetadata"); this.trigger("durationchange"); break; case YT.PlayerState.ENDED: this.trigger("ended"); break; case YT.PlayerState.PLAYING: this.trigger("timeupdate"); this.trigger("durationchange"); this.trigger("playing"); this.trigger("play"); if (this.isSeeking) { this.onSeeked() } break; case YT.PlayerState.PAUSED: this.trigger("canplay"); if (this.isSeeking) { this.onSeeked() } else { this.trigger("pause") } break; case YT.PlayerState.BUFFERING: this.player_.trigger("timeupdate"); this.player_.trigger("waiting"); break } }, onPlayerError: function (e) { this.errorNumber = e.data; this.trigger("error"); this.ytPlayer.stopVideo() }, error: function () { switch (this.errorNumber) { case 5: return { code: "Error while trying to play the video" }; case 2: case 100: return { code: "Unable to find the video" }; case 101: case 150: return { code: "Playback on other Websites has been disabled by the video owner." } } return { code: "YouTube unknown error (" + this.errorNumber + ")" } }, src: function (src) { if (src) { this.setSrc({ src: src }) } return this.source }, poster: function () { if (_isOnMobile) { return null } return this.poster_ }, setPoster: function (poster) { this.poster_ = poster }, setSrc: function (source) { if (!source || !source.src) { return } delete this.errorNumber; this.source = source; this.url = Youtube.parseUrl(source.src); if (!this.options_.poster) { if (this.url.videoId) { this.poster_ = "https://img.youtube.com/vi/" + this.url.videoId + "/0.jpg"; this.trigger("posterchange"); this.checkHighResPoster() } } if (this.options_.autoplay && !_isOnMobile) { if (this.isReady_) { this.play() } else { this.playOnReady = true } } else if (this.activeVideoId !== this.url.videoId) { if (this.isReady_) { this.ytPlayer.cueVideoById(this.url.videoId); this.activeVideoId = this.url.videoId } else { this.cueOnReady = true } } }, autoplay: function () { return this.options_.autoplay }, setAutoplay: function (val) { this.options_.autoplay = val }, loop: function () { return this.options_.loop }, setLoop: function (val) { this.options_.loop = val }, play: function () { if (!this.url || !this.url.videoId) { return } this.wasPausedBeforeSeek = false; if (this.isReady_) { if (this.url.listId) { if (this.activeList === this.url.listId) { this.ytPlayer.playVideo() } else { this.ytPlayer.loadPlaylist(this.url.listId); this.activeList = this.url.listId } } if (this.activeVideoId === this.url.videoId) { this.ytPlayer.playVideo() } else { this.ytPlayer.loadVideoById(this.url.videoId); this.activeVideoId = this.url.videoId } } else { this.trigger("waiting"); this.playOnReady = true } }, pause: function () { if (this.ytPlayer) { this.ytPlayer.pauseVideo() } }, paused: function () { return this.ytPlayer ? this.lastState !== YT.PlayerState.PLAYING && this.lastState !== YT.PlayerState.BUFFERING : true }, currentTime: function () { return this.ytPlayer ? this.ytPlayer.getCurrentTime() : 0 }, setCurrentTime: function (seconds) { if (this.lastState === YT.PlayerState.PAUSED) { this.timeBeforeSeek = this.currentTime() } if (!this.isSeeking) { this.wasPausedBeforeSeek = this.paused() } this.ytPlayer.seekTo(seconds, true); this.trigger("timeupdate"); this.trigger("seeking"); this.isSeeking = true; if (this.lastState === YT.PlayerState.PAUSED && this.timeBeforeSeek !== seconds) { clearInterval(this.checkSeekedInPauseInterval); this.checkSeekedInPauseInterval = setInterval(function () { if (this.lastState !== YT.PlayerState.PAUSED || !this.isSeeking) { clearInterval(this.checkSeekedInPauseInterval) } else if (this.currentTime() !== this.timeBeforeSeek) { this.trigger("timeupdate"); this.onSeeked() } }.bind(this), 250) } }, seeking: function () { return this.isSeeking }, seekable: function () { if (!this.ytPlayer || !this.ytPlayer.getVideoLoadedFraction) { return { length: 0, start: function () { throw new Error("This TimeRanges object is empty") }, end: function () { throw new Error("This TimeRanges object is empty") } } } var end = this.ytPlayer.getDuration(); return { length: this.ytPlayer.getDuration(), start: function () { return 0 }, end: function () { return end } } }, onSeeked: function () { clearInterval(this.checkSeekedInPauseInterval); this.isSeeking = false; if (this.wasPausedBeforeSeek) { this.pause() } this.trigger("seeked") }, playbackRate: function () { return this.ytPlayer ? this.ytPlayer.getPlaybackRate() : 1 }, setPlaybackRate: function (suggestedRate) { if (!this.ytPlayer) { return } this.ytPlayer.setPlaybackRate(suggestedRate); this.trigger("ratechange") }, duration: function () { return this.ytPlayer ? this.ytPlayer.getDuration() : 0 }, currentSrc: function () { return this.source && this.source.src }, ended: function () { return this.ytPlayer ? this.lastState === YT.PlayerState.ENDED : false }, volume: function () { return this.ytPlayer ? this.ytPlayer.getVolume() / 100 : 1 }, setVolume: function (percentAsDecimal) { if (!this.ytPlayer) { return } this.ytPlayer.setVolume(percentAsDecimal * 100); this.setTimeout(function () { this.trigger("volumechange") }, 50) }, muted: function () { return this.ytPlayer ? this.ytPlayer.isMuted() : false }, setMuted: function (mute) { if (!this.ytPlayer) { return } else { this.muted(true) } if (mute) { this.ytPlayer.mute() } else { this.ytPlayer.unMute() } this.setTimeout(function () { this.trigger("volumechange") }, 50) }, buffered: function () { if (!this.ytPlayer || !this.ytPlayer.getVideoLoadedFraction) { return { length: 0, start: function () { throw new Error("This TimeRanges object is empty") }, end: function () { throw new Error("This TimeRanges object is empty") } } } var end = this.ytPlayer.getVideoLoadedFraction() * this.ytPlayer.getDuration(); return { length: this.ytPlayer.getDuration(), start: function () { return 0 }, end: function () { return end } } }, preload: function () { }, load: function () { }, reset: function () { }, supportsFullScreen: function () { return true }, checkHighResPoster: function () { var uri = "https://img.youtube.com/vi/" + this.url.videoId + "/maxresdefault.jpg"; try { var image = new Image; image.onload = function () { if ("naturalHeight" in image) { if (image.naturalHeight <= 90 || image.naturalWidth <= 120) { return } } else if (image.height <= 90 || image.width <= 120) { return } this.poster_ = uri; this.trigger("posterchange") }.bind(this); image.onerror = function () { }; image.src = uri } catch (e) { } } }); Youtube.isSupported = function () { return true }; Youtube.canPlaySource = function (e) { return Youtube.canPlayType(e.type) }; Youtube.canPlayType = function (e) { return e === "video/youtube" }; var _isOnMobile = videojs.browser.IS_IOS || useNativeControlsOnAndroid(); Youtube.parseUrl = function (url) { var result = { videoId: null }; var regex = /^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=)([^#\&\?]*).*/; var match = url.match(regex); if (match && match[2].length === 11) { result.videoId = match[2] } var regPlaylist = /[?&]list=([^#\&\?]+)/; match = url.match(regPlaylist); if (match && match[1]) { result.listId = match[1] } return result }; function apiLoaded() { YT.ready(function () { Youtube.isApiReady = true; for (var i = 0; i < Youtube.apiReadyQueue.length; ++i) { Youtube.apiReadyQueue[i].initYTPlayer() } }) } function loadScript(src, callback) { var loaded = false; var tag = document.createElement("script"); var firstScriptTag = document.getElementsByTagName("script")[0]; firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); tag.onload = function () { if (!loaded) { loaded = true; callback() } }; tag.onreadystatechange = function () { if (!loaded && (this.readyState === "complete" || this.readyState === "loaded")) { loaded = true; callback() } }; tag.src = src } function injectCss() { var css = ".vjs-youtube .vjs-iframe-blocker { display: none; }" + ".vjs-youtube.vjs-user-inactive .vjs-iframe-blocker { display: block; }" + ".vjs-youtube .vjs-poster { background-size: cover; }" + ".vjs-youtube-mobile .vjs-big-play-button { display: none; }"; var head = document.head || document.getElementsByTagName("head")[0]; var style = document.createElement("style"); style.type = "text/css"; if (style.styleSheet) { style.styleSheet.cssText = css } else { style.appendChild(document.createTextNode(css)) } head.appendChild(style) } function useNativeControlsOnAndroid() { var stockRegex = window.navigator.userAgent.match(/applewebkit\/(\d*).*Version\/(\d*.\d*)/i); return videojs.browser.IS_ANDROID && videojs.browser.ANDROID_VERSION < 5 && stockRegex && stockRegex[2] > 0 } Youtube.apiReadyQueue = []; loadScript("https://www.youtube.com/iframe_api", apiLoaded); injectCss(); if (typeof videojs.registerTech !== "undefined") { videojs.registerTech("Youtube", Youtube) } else { videojs.registerComponent("Youtube", Youtube) } });

/**
 * Copyright 2014 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * IMA SDK integration plugin for Video.js. For more information see
 * https://www.github.com/googleads/videojs-ima
 */

(function (vjs) {
    'use strict';
    var extend = function (obj) {
        var arg;
        var index;
        var key;
        for (index = 1; index < arguments.length; index++) {
            arg = arguments[index];
            for (key in arg) {
                if (arg.hasOwnProperty(key)) {
                    obj[key] = arg[key];
                }
            }
        }
        return obj;
    };

    var ima_defaults = {
        debug: false,
        timeout: 5000,
        prerollTimeout: 100,
        adLabel: 'Advertisement',
        showControlsForJSAds: true
    };

    var init = function (options, readyCallback) {
        if (typeof (google.ima) != "undefined") {
            this.ima = new ImaPlugin(this, options, readyCallback);
        }
    };

    var ImaPlugin = function (player, options, readyCallback) {
        this.player = player;

        /**
         * Assigns the unique id and class names to the given element as well as the style class
         * @param element
         * @param controlName
         * @private
         */
        var assignControlAttributes_ = function (element, controlName) {
            element.id = this.controlPrefix + controlName;
            element.className = this.controlPrefix + controlName + ' ' + controlName;
        }.bind(this);

        /**
         * Returns a regular expression to test a string for the given className
         * @param className
         * @returns {RegExp}
         * @private
         */
        var getClassRegexp_ = function (className) {
            return new RegExp('\\b' + className + '\\b', 'gi');
        };

        /**
         * Adds a class to the given element if it doesn't already have the class
         * @param element
         * @param classToAdd
         * @private
         */
        var addClass_ = function (element, classToAdd) {
            if (getClassRegexp_(classToAdd).test(element.className)) {
                return element;
            }

            return element.className = element.className.trim() + ' ' + classToAdd;
        };

        /**
         * Removes a class from the given element if it has the given class
         * @param element
         * @param classToRemove
         * @private
         */
        var removeClass_ = function (element, classToRemove) {
            var classRegexp = getClassRegexp_(classToRemove);

            if (!classRegexp.test(element.className)) {
                return element;
            }

            return element.className = element.className.trim().replace(classRegexp, '');
        };

        /**
         * Creates the ad container passed to the IMA SDK.
         * @private
         */
        var createAdContainer_ = function () {
            // The adContainerDiv is the DOM of the element that will house
            // the ads and ad controls.
            this.vjsControls = this.player.getChild('controlBar');
            this.adContainerDiv =
                this.vjsControls.el().parentNode.appendChild(
                    document.createElement('div'));
            assignControlAttributes_(this.adContainerDiv, 'ima-ad-container');
            this.adContainerDiv.style.position = "absolute";
            this.adContainerDiv.style.zIndex = 1111;
            this.adContainerDiv.addEventListener(
                'mouseenter',
                showAdControls_,
                false);
            this.adContainerDiv.addEventListener(
                'mouseleave',
                hideAdControls_,
                false);
            createControls_();
            this.adDisplayContainer =
                new google.ima.AdDisplayContainer(this.adContainerDiv, this.contentPlayer);
        }.bind(this);

        /**
         * Creates the controls for the ad.
         * @private
         */
        var createControls_ = function () {
            this.controlsDiv = document.createElement('div');
            assignControlAttributes_(this.controlsDiv, 'ima-controls-div');
            this.controlsDiv.style.width = '100%';
            this.countdownDiv = document.createElement('div');
            assignControlAttributes_(this.countdownDiv, 'ima-countdown-div');
            this.countdownDiv.innerHTML = this.settings.adLabel;
            this.countdownDiv.style.display = this.showCountdown ? 'block' : 'none';
            this.seekBarDiv = document.createElement('div');
            assignControlAttributes_(this.seekBarDiv, 'ima-seek-bar-div');
            this.seekBarDiv.style.width = '100%';
            this.progressDiv = document.createElement('div');
            assignControlAttributes_(this.progressDiv, 'ima-progress-div');
            this.playPauseDiv = document.createElement('div');
            assignControlAttributes_(this.playPauseDiv, 'ima-play-pause-div');
            addClass_(this.playPauseDiv, 'ima-playing');
            this.playPauseDiv.addEventListener(
                'click',
                onAdPlayPauseClick_,
                false);
            this.muteDiv = document.createElement('div');
            assignControlAttributes_(this.muteDiv, 'ima-mute-div');
            addClass_(this.muteDiv, 'ima-non-muted');
            this.muteDiv.addEventListener(
                'click',
                onAdMuteClick_,
                false);
            this.sliderDiv = document.createElement('div');
            assignControlAttributes_(this.sliderDiv, 'ima-slider-div');
            this.sliderDiv.addEventListener(
                'mousedown',
                onAdVolumeSliderMouseDown_,
                false);
            this.sliderLevelDiv = document.createElement('div');
            assignControlAttributes_(this.sliderLevelDiv, 'ima-slider-level-div');
            this.fullscreenDiv = document.createElement('div');
            assignControlAttributes_(this.fullscreenDiv, 'ima-fullscreen-div');
            addClass_(this.fullscreenDiv, 'ima-non-fullscreen');
            this.fullscreenDiv.addEventListener(
                'click',
                onAdFullscreenClick_,
                false);
            this.adContainerDiv.appendChild(this.controlsDiv);
            this.controlsDiv.appendChild(this.countdownDiv);
            this.controlsDiv.appendChild(this.seekBarDiv);
            this.controlsDiv.appendChild(this.playPauseDiv);
            this.controlsDiv.appendChild(this.muteDiv);
            this.controlsDiv.appendChild(this.sliderDiv);
            this.controlsDiv.appendChild(this.fullscreenDiv);
            this.seekBarDiv.appendChild(this.progressDiv);
            this.sliderDiv.appendChild(this.sliderLevelDiv);
        }.bind(this);

        /**
         * Initializes the AdDisplayContainer. On mobile, this must be done as a
         * result of user action.
         */
        this.initializeAdDisplayContainer = function () {
            this.adDisplayContainerInitialized = true;
            this.adDisplayContainer.initialize();
        }.bind(this);

        /**
         * Creates the AdsRequest and request ads through the AdsLoader.
         */
        this.requestAds = function () {
            if (!this.adDisplayContainerInitialized) {
                this.adDisplayContainer.initialize();
            }
            var adsRequest = new google.ima.AdsRequest();
            if (this.settings.adTagUrl) {
                adsRequest.adTagUrl = this.settings.adTagUrl;
            } else {
                adsRequest.adsResponse = this.settings.adsResponse;
            }
            if (this.settings.forceNonLinearFullSlot) {
                adsRequest.forceNonLinearFullSlot = true;
            }

            adsRequest.linearAdSlotWidth = this.getPlayerWidth();
            adsRequest.linearAdSlotHeight = this.getPlayerHeight();
            adsRequest.nonLinearAdSlotWidth =
                this.settings.nonLinearWidth || this.getPlayerWidth();
            adsRequest.nonLinearAdSlotHeight =
                this.settings.nonLinearHeight || (this.getPlayerHeight() / 3);

            this.adsLoader.requestAds(adsRequest);
        }.bind(this);

        /**
         * Listener for the ADS_MANAGER_LOADED event. Creates the AdsManager,
         * sets up event listeners, and triggers the 'adsready' event for
         * videojs-ads-contrib.
         * @private
         */
        var onAdsManagerLoaded_ = function (adsManagerLoadedEvent) {
            this.adsManager = adsManagerLoadedEvent.getAdsManager(
                this.contentPlayheadTracker, this.adsRenderingSettings);

            this.adsManager.addEventListener(
                google.ima.AdErrorEvent.Type.AD_ERROR,
                onAdError_);
            this.adsManager.addEventListener(
                google.ima.AdEvent.Type.AD_BREAK_READY,
                onAdBreakReady_);
            this.adsManager.addEventListener(
                google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED,
                this.onContentPauseRequested_);
            this.adsManager.addEventListener(
                google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED,
                this.onContentResumeRequested_);
            this.adsManager.addEventListener(
                google.ima.AdEvent.Type.ALL_ADS_COMPLETED,
                onAllAdsCompleted_);

            this.adsManager.addEventListener(
                google.ima.AdEvent.Type.LOADED,
                onAdLoaded_);
            this.adsManager.addEventListener(
                google.ima.AdEvent.Type.STARTED,
                onAdStarted_);
            this.adsManager.addEventListener(
                google.ima.AdEvent.Type.CLICK,
                onAdPlayPauseClick_);
            this.adsManager.addEventListener(
                google.ima.AdEvent.Type.COMPLETE,
                this.onAdComplete_);
            this.adsManager.addEventListener(
                google.ima.AdEvent.Type.SKIPPED,
                this.onAdComplete_);

            if (!this.autoPlayAdBreaks) {
                try {
                    var initWidth = this.getPlayerWidth();
                    var initHeight = this.getPlayerHeight();
                    this.adsManagerDimensions.width = initWidth;
                    this.adsManagerDimensions.height = initHeight;
                    this.adsManager.init(
                        initWidth,
                        initHeight,
                        google.ima.ViewMode.NORMAL);
                    this.adsManager.setVolume(this.player.muted() ? 0 : this.player.volume());
                } catch (adError) {
                    onAdError_(adError);
                }
            }

            this.player.trigger('adsready');
        }.bind(this);

        /**
         * DEPRECATED: Use startFromReadyCallback
         * Start ad playback, or content video playback in the absence of a
         * pre-roll.
         */
        this.start = function () {
            window.console.log(
                'WARNING: player.ima.start is deprecated. Use ' +
                'player.ima.startFromReadyCallback instead.');
        };

        /**
         * Start ad playback, or content video playback in the absence of a
         * pre-roll. **NOTE**: This method only needs to be called if you provide
         * your own readyCallback as the second parameter to player.ima(). If you
         * only provide options and do not provide your own readyCallback,
         * **DO NOT** call this method. If you do provide your own readyCallback,
         * you should call this method in the last line of that callback. For more
         * info, see this method's usage in our advanced and playlist examples.
         */
        this.startFromReadyCallback = function () {
            if (this.autoPlayAdBreaks) {
                try {
                    this.adsManager.init(
                        this.getPlayerWidth(),
                        this.getPlayerHeight(),
                        google.ima.ViewMode.NORMAL);
                    this.adsManager.setVolume(this.player.muted() ? 0 : this.player.volume());
                    this.adsManager.start();
                } catch (adError) {
                    this.onAdError_(adError);
                }
            }
        }.bind(this);

        /**
         * Listener for errors fired by the AdsLoader.
         * @param {google.ima.AdErrorEvent} event The error event thrown by the
         *     AdsLoader. See
         *     https://developers.google.com/interactive-media-ads/docs/sdks/html5/v3/apis#ima.AdError.Type
         * @private
         */
        var onAdsLoaderError_ = function (event) {
            window.console.log('AdsLoader error: ' + event.getError());
            this.adContainerDiv.style.display = 'none';
            if (this.adsManager) {
                this.adsManager.destroy();
            }
            this.player.trigger({ type: 'adserror', data: { AdError: event.getError(), AdErrorEvent: event } });
        }.bind(this);

        /**
         * Listener for errors thrown by the AdsManager.
         * @param {google.ima.AdErrorEvent} adErrorEvent The error event thrown by
         *     the AdsManager.
         * @private
         */
        var onAdError_ = function (adErrorEvent) {
            window.console.log('Ad error: ' + adErrorEvent.getError());
            this.vjsControls.show();
            this.adsManager.destroy();
            this.adContainerDiv.style.display = 'none';
            this.player.trigger({ type: 'adserror', data: { AdError: adErrorEvent.getError(), AdErrorEvent: adErrorEvent } });
        }.bind(this);

        /**
         * Listener for AD_BREAK_READY. Passes event on to publisher's listener.
         * @param {google.ima.AdEvent} adEvent AdEvent thrown by the AdsManager.
         * @private
         */
        var onAdBreakReady_ = function (adEvent) {
            this.adBreakReadyListener(adEvent);
        }.bind(this);

        /**
         * Called by publishers in manual ad break playback mode to start an ad
         * break.
         */
        this.playAdBreak = function () {
            if (!this.autoPlayAdBreaks) {
                this.adsManager.start();
            }
        }.bind(this);

        /**
         * Pauses the content video and displays the ad container so ads can play.
         * @param {google.ima.AdEvent} adEvent The AdEvent thrown by the AdsManager.
         * @private
         */
        this.onContentPauseRequested_ = function (adEvent) {
            this.adsActive = true;
            this.adPlaying = true;
            this.player.off('ended', this.localContentEndedListener);
            if (adEvent.getAd().getAdPodInfo().getPodIndex() != -1) {
                // Skip this call for post-roll ads
                this.player.ads.startLinearAdMode();
            }
            this.adContainerDiv.style.display = 'block';

            var contentType = adEvent.getAd().getContentType();
            if ((contentType === 'application/javascript') && !this.settings.showControlsForJSAds) {
                this.controlsDiv.style.display = 'none';
            } else {
                this.controlsDiv.style.display = 'block';
            }

            this.vjsControls.hide();
            this.player.pause();
        }.bind(this);

        /**
         * Resumes content video and hides the ad container.
         * @param {google.ima.AdEvent} adEvent The AdEvent thrown by the AdsManager.
         * @private
         */
        this.onContentResumeRequested_ = function (adEvent) {
            this.adsActive = false;
            this.adPlaying = false;
            this.player.on('ended', this.localContentEndedListener);
            if (this.currentAd == null || // hide for post-roll only playlist
                this.currentAd.isLinear()) { // don't hide for non-linear ads
                this.adContainerDiv.style.display = 'none';
            }
            this.vjsControls.show();
            if (!this.currentAd) {
                // Something went wrong playing the ad
                this.player.ads.endLinearAdMode();
            } else if (!this.contentComplete &&
                // Don't exit linear mode after post-roll or content will auto-replay
                this.currentAd.getAdPodInfo().getPodIndex() != -1) {
                this.player.ads.endLinearAdMode();
            }
            this.countdownDiv.innerHTML = '';
        }.bind(this);

        /**
         * Records that ads have completed and calls contentAndAdsEndedListeners
         * if content is also complete.
         * @param {google.ima.AdEvent} adEvent The AdEvent thrown by the AdsManager.
         * @private
         */
        var onAllAdsCompleted_ = function (adEvent) {
            this.allAdsCompleted = true;
            if (this.contentComplete == true) {
                for (var index in this.contentAndAdsEndedListeners) {
                    this.contentAndAdsEndedListeners[index]();
                }
            }
        }.bind(this);

        /**
         * Starts the content video when a non-linear ad is loaded.
         * @param {google.ima.AdEvent} adEvent The AdEvent thrown by the AdsManager.
         * @private
         */
        var onAdLoaded_ = function (adEvent) {
            if (!adEvent.getAd().isLinear()) {
                this.player.play();
            }
        }.bind(this);

        /**
         * Starts the interval timer to check the current ad time when an ad starts
         * playing.
         * @param {google.ima.AdEvent} adEvent The AdEvent thrown by the AdsManager.
         * @private
         */
        var onAdStarted_ = function (adEvent) {
            this.currentAd = adEvent.getAd();
            if (this.currentAd.isLinear()) {
                this.adTrackingTimer = setInterval(
                    onAdPlayheadTrackerInterval_, 250);
                // Don't bump container when controls are shown
                removeClass_(this.adContainerDiv, 'bumpable-ima-ad-container');
            } else {
                // Bump container when controls are shown
                addClass_(this.adContainerDiv, 'bumpable-ima-ad-container');
            }
        }.bind(this);

        /**
         * Clears the interval timer for current ad time when an ad completes.
         * @param {google.ima.AdEvent} adEvent The AdEvent thrown by the AdsManager.
         * @private
         */
        this.onAdComplete_ = function (adEvent) {
            if (this.currentAd.isLinear()) {
                clearInterval(this.adTrackingTimer);
            }
        }.bind(this);

        /**
         * Gets the current time and duration of the ad and calls the method to
         * update the ad UI.
         * @private
         */
        var onAdPlayheadTrackerInterval_ = function () {
            var remainingTime = this.adsManager.getRemainingTime();
            var duration = this.currentAd.getDuration();
            var currentTime = duration - remainingTime;
            currentTime = currentTime > 0 ? currentTime : 0;
            var isPod = false;
            var totalAds = 0;
            var adPosition;
            if (this.currentAd.getAdPodInfo()) {
                isPod = true;
                adPosition = this.currentAd.getAdPodInfo().getAdPosition();
                totalAds = this.currentAd.getAdPodInfo().getTotalAds();
            }

            // Update countdown timer data
            var remainingMinutes = Math.floor(remainingTime / 60);
            var remainingSeconds = Math.floor(remainingTime % 60);
            if (remainingSeconds.toString().length < 2) {
                remainingSeconds = '0' + remainingSeconds;
            }
            var podCount = ': ';
            if (isPod && (totalAds > 1)) {
                podCount = ' (' + adPosition + ' of ' + totalAds + '): ';
            }
            this.countdownDiv.innerHTML =
                this.settings.adLabel + podCount +
                remainingMinutes + ':' + remainingSeconds;

            // Update UI
            var playProgressRatio = currentTime / duration;
            var playProgressPercent = playProgressRatio * 100;
            this.progressDiv.style.width = playProgressPercent + '%';
        }.bind(this);

        this.getPlayerWidth = function () {
            var retVal = parseInt(getComputedStyle(this.player.el()).width, 10) ||
                this.player.width();
            return retVal;
        }.bind(this);

        this.getPlayerHeight = function () {
            var retVal = parseInt(getComputedStyle(this.player.el()).height, 10) ||
                this.player.height();
            return retVal;
        }.bind(this);

        /**
         * Hides the ad controls on mouseout.
         * @private
         */
        var hideAdControls_ = function () {
            this.controlsDiv.style.height = '14px';
            this.playPauseDiv.style.display = 'none';
            this.muteDiv.style.display = 'none';
            this.sliderDiv.style.display = 'none';
            this.fullscreenDiv.style.display = 'none';
        }.bind(this);

        /**
         * Shows ad controls on mouseover.
         * @private
         */
        var showAdControls_ = function () {
            this.controlsDiv.style.height = '37px';
            this.playPauseDiv.style.display = 'block';
            this.muteDiv.style.display = 'block';
            this.sliderDiv.style.display = 'block';
            this.fullscreenDiv.style.display = 'block';
        }.bind(this);

        /**
         * Listener for clicks on the play/pause button during ad playback.
         * @private
         */
        var onAdPlayPauseClick_ = function () {
            if (this.adPlaying) {
                addClass_(this.playPauseDiv, 'ima-paused');
                removeClass_(this.playPauseDiv, 'ima-playing');
                this.adsManager.pause();
                this.adPlaying = false;
            } else {
                addClass_(this.playPauseDiv, 'ima-playing');
                removeClass_(this.playPauseDiv, 'ima-paused');
                this.adsManager.resume();
                this.adPlaying = true;
            }
        }.bind(this);

        /**
         * Listener for clicks on the mute button during ad playback.
         * @private
         */
        var onAdMuteClick_ = function () {
            if (this.adMuted) {
                addClass_(this.muteDiv, 'ima-non-muted');
                removeClass_(this.muteDiv, 'ima-muted');
                this.adsManager.setVolume(1);
                // Bubble down to content player
                this.player.muted(false);
                this.adMuted = false;
                this.sliderLevelDiv.style.width = this.player.volume() * 100 + "%";
            } else {
                addClass_(this.muteDiv, 'ima-muted');
                removeClass_(this.muteDiv, 'ima-non-muted');
                this.adsManager.setVolume(0);
                // Bubble down to content player
                this.player.muted(true);
                this.adMuted = true;
                this.sliderLevelDiv.style.width = "0%";
            }
        }.bind(this);

        /* Listener for mouse down events during ad playback. Used for volume.
         * @private
         */
        var onAdVolumeSliderMouseDown_ = function () {
            document.addEventListener('mouseup', onMouseUp_, false);
            document.addEventListener('mousemove', onMouseMove_, false);
        };

        /* Mouse movement listener used for volume slider.
         * @private
         */
        var onMouseMove_ = function (event) {
            setVolumeSlider_(event);
        };

        /* Mouse release listener used for volume slider.
         * @private
         */
        var onMouseUp_ = function (event) {
            setVolumeSlider_(event);
            document.removeEventListener('mousemove', onMouseMove_);
            document.removeEventListener('mouseup', onMouseUp_);
        };

        /* Utility function to set volume and associated UI
         * @private
         */
        var setVolumeSlider_ = function (event) {
            var percent =
                (event.clientX - this.sliderDiv.getBoundingClientRect().left) /
                this.sliderDiv.offsetWidth;
            percent *= 100;
            //Bounds value 0-100 if mouse is outside slider region.
            percent = Math.min(Math.max(percent, 0), 100);
            this.sliderLevelDiv.style.width = percent + "%";
            this.player.volume(percent / 100); //0-1
            this.adsManager.setVolume(percent / 100);
            if (this.player.volume() == 0) {
                addClass_(this.muteDiv, 'ima-muted');
                removeClass_(this.muteDiv, 'ima-non-muted');
                this.player.muted(true);
                this.adMuted = true;
            }
            else {
                addClass_(this.muteDiv, 'ima-non-muted');
                removeClass_(this.muteDiv, 'ima-muted');
                this.player.muted(false);
                this.adMuted = false;
            }
        }.bind(this);

        /**
         * Listener for clicks on the fullscreen button during ad playback.
         * @private
         */
        var onAdFullscreenClick_ = function () {
            if (this.player.isFullscreen()) {
                this.player.exitFullscreen();
            } else {
                this.player.requestFullscreen();
            }
        }.bind(this);

        /**
         * Listens for the video.js player to change its fullscreen status. This
         * keeps the fullscreen-ness of the AdContainer in sync with the player.
         * @private
         */
        var onFullscreenChange_ = function () {
            if (this.player.isFullscreen()) {
                addClass_(this.fullscreenDiv, 'ima-fullscreen');
                removeClass_(this.fullscreenDiv, 'ima-non-fullscreen');
                if (this.adsManager) {
                    this.adsManager.resize(
                        window.screen.width,
                        window.screen.height,
                        google.ima.ViewMode.FULLSCREEN);
                }
            } else {
                addClass_(this.fullscreenDiv, 'ima-non-fullscreen');
                removeClass_(this.fullscreenDiv, 'ima-fullscreen');
                if (this.adsManager) {
                    this.adsManager.resize(
                        this.getPlayerWidth(),
                        this.getPlayerHeight(),
                        google.ima.ViewMode.NORMAL);
                }
            }
        }.bind(this);

        /**
         * Listens for the video.js player to change its volume. This keeps the ad
         * volume in sync with the content volume if the volume of the player is
         * changed while content is playing
         * @private
         */
        var onVolumeChange_ = function () {
            var newVolume = this.player.muted() ? 0 : this.player.volume();
            if (this.adsManager) {
                this.adsManager.setVolume(newVolume);
            }
            // Update UI
            if (this.newVolume == 0) {
                this.adMuted = true;
                addClass_(this.muteDiv, 'ima-muted');
                removeClass_(this.muteDiv, 'ima-non-muted');
                this.sliderLevelDiv.style.width = '0%';
            } else {
                this.adMuted = false;
                addClass_(this.muteDiv, 'ima-non-muted');
                removeClass_(this.muteDiv, 'ima-muted');
                this.sliderLevelDiv.style.width = newVolume * 100 + '%';
            }
        }.bind(this);

        /**
         * Seeks content to 00:00:00. This is used as an event handler for the
         * loadedmetadata event, since seeking is not possible until that event has
         * fired.
         * @private
         */
        var seekContentToZero_ = function () {
            this.player.off('loadedmetadata', seekContentToZero_);
            this.player.currentTime(0);
        }.bind(this);

        /**
         * Seeks content to 00:00:00 and starts playback. This is used as an event
         * handler for the loadedmetadata event, since seeking is not possible until
         * that event has fired.
         * @private
         */
        var playContentFromZero_ = function () {
            this.player.off('loadedmetadata', playContentFromZero_);
            this.player.currentTime(0);
            this.player.play();
        }.bind(this);

        /**
         * Destroys the AdsManager, sets it to null, and calls contentComplete to
         * reset correlators. Once this is done it requests ads again to keep the
         * inventory available.
         * @private
         */
        var resetIMA_ = function () {
            this.adsActive = false;
            this.adPlaying = false;
            this.player.on('ended', this.localContentEndedListener);
            if (this.currentAd && this.currentAd.isLinear()) {
                this.adContainerDiv.style.display = 'none';
            }
            this.vjsControls.show();
            this.player.ads.endLinearAdMode();
            if (this.adTrackingTimer) {
                // If this is called while an ad is playing, stop trying to get that
                // ad's current time.
                clearInterval(this.adTrackingTimer);
            }
            if (this.adsManager) {
                this.adsManager.destroy();
                this.adsManager = null;
            }
            if (this.adsLoader && !this.contentComplete) {
                this.adsLoader.contentComplete();
            }
            this.contentComplete = false;
            this.allAdsCompleted = false;
        }.bind(this);

        /**
         * Ads an EventListener to the AdsManager. For a list of available events,
         * see
         * https://developers.google.com/interactive-media-ads/docs/sdks/html5/v3/apis#ima.AdEvent.Type
         * @param {google.ima.AdEvent.Type} event The AdEvent.Type for which to listen.
         * @param {function} callback The method to call when the event is fired.
         */
        this.addEventListener = function (event, callback) {
            if (this.adsManager) {
                this.adsManager.addEventListener(event, callback);
            }
        }.bind(this);

        /**
         * Returns the instance of the AdsManager.
         * @return {google.ima.AdsManager} The AdsManager being used by the plugin.
         */
        this.getAdsManager = function () {
            return this.adsManager;
        }.bind(this);

        /**
         * DEPRECATED: Use setContentWithAdTag.
         * Sets the content of the video player. You should use this method instead
         * of setting the content src directly to ensure the proper ad tag is
         * requested when the video content is loaded.
         * @param {?string} contentSrc The URI for the content to be played. Leave
         *     blank to use the existing content.
         * @param {?string} adTag The ad tag to be requested when the content loads.
         *     Leave blank to use the existing ad tag.
         * @param {?boolean} playOnLoad True to play the content once it has loaded,
         *     false to only load the content but not start playback.
         */
        this.setContent = function (contentSrc, adTag, playOnLoad) {
            window.console.log(
                'WARNING: player.ima.setContent is deprecated. Use ' +
                'player.ima.setContentWithAdTag instead.');
            this.setContentWithAdTag(contentSrc, adTag, playOnLoad);
        }.bind(this);

        /**
         * Sets the content of the video player. You should use this method instead
         * of setting the content src directly to ensure the proper ad tag is
         * requested when the video content is loaded.
         * @param {?string} contentSrc The URI for the content to be played. Leave
         *     blank to use the existing content.
         * @param {?string} adTag The ad tag to be requested when the content loads.
         *     Leave blank to use the existing ad tag.
         * @param {?boolean} playOnLoad True to play the content once it has loaded,
         *     false to only load the content but not start playback.
         */
        this.setContentWithAdTag = function (contentSrc, adTag, playOnLoad) {
            resetIMA_();
            this.settings.adTagUrl = adTag ? adTag : this.settings.adTagUrl;
            changeSource_(contentSrc, playOnLoad);
        }.bind(this);

        /**
         * Sets the content of the video player. You should use this method instead
         * of setting the content src directly to ensure the proper ads response is
         * used when the video content is loaded.
         * @param {?string} contentSrc The URI for the content to be played. Leave
         *     blank to use the existing content.
         * @param {?string} adsResponse The ads response to be requested when the
         *     content loads. Leave blank to use the existing ads response.
         * @param {?boolean} playOnLoad True to play the content once it has loaded,
         *     false to only load the content but not start playback.
         */
        this.setContentWithAdsResponse = function (contentSrc, adsResponse, playOnLoad) {
            resetIMA_();
            this.settings.adsResponse = adsResponse ? adsResponse : this.settings.adsResponse;
            changeSource_(contentSrc, playOnLoad);
        }.bind(this);

        /**
         * Changes the player source.
         * @param {?string} contentSrc The URI for the content to be played. Leave
         *     blank to use the existing content.
         * @param {?boolean} playOnLoad True to play the content once it has loaded,
         *     false to only load the content but not start playback.
         * @private
         */
        var changeSource_ = function (contentSrc, playOnLoad) {
            // Only try to pause the player when initialised with a source already
            if (!!this.player.currentSrc()) {
                this.player.currentTime(0);
                this.player.pause();
            }
            if (contentSrc) {
                this.player.src(contentSrc);
            }
            if (playOnLoad) {
                this.player.on('loadedmetadata', playContentFromZero_);
            } else {
                this.player.on('loadedmetadata', seekContentToZero_);
            }
        }.bind(this);

        /**
         * Adds a listener for the 'ended' event of the video player. This should be
         * used instead of setting an 'ended' listener directly to ensure that the
         * ima can do proper cleanup of the SDK before other event listeners
         * are called.
         * @param {function} listener The listener to be called when content completes.
         */
        this.addContentEndedListener = function (listener) {
            this.contentEndedListeners.push(listener);
        }.bind(this);

        /**
         * Adds a listener that will be called when content and all ads have
         * finished playing.
         * @param {function} listener The listener to be called when content and ads complete.
         */
        this.addContentAndAdsEndedListener = function (listener) {
            this.contentAndAdsEndedListeners.push(listener);
        }.bind(this);

        /**
         * Sets the listener to be called to trigger manual ad break playback.
         * @param {function} listener The listener to be called to trigger manual ad break playback.
         */
        this.setAdBreakReadyListener = function (listener) {
            this.adBreakReadyListener = listener;
        }.bind(this);

        /**
         * Pauses the ad.
         */
        this.pauseAd = function () {
            if (this.adsActive && this.adPlaying) {
                addClass_(this.playPauseDiv, 'ima-paused');
                removeClass_(this.playPauseDiv, 'ima-playing');
                this.adsManager.pause();
                this.adPlaying = false;
            }
        }.bind(this);

        /**
         * Resumes the ad.
         */
        this.resumeAd = function () {
            if (this.adsActive && !this.adPlaying) {
                addClass_(this.playPauseDiv, 'ima-playing');
                removeClass_(this.playPauseDiv, 'ima-paused');
                this.adsManager.resume();
                this.adPlaying = true;
            }
        }.bind(this);

        /**
         * Set up intervals to check for seeking and update current video time.
         * @private
         */
        var setUpPlayerIntervals_ = function () {
            this.updateTimeIntervalHandle =
                setInterval(updateCurrentTime_, this.seekCheckInterval);
            this.seekCheckIntervalHandle =
                setInterval(checkForSeeking_, this.seekCheckInterval);
            this.resizeCheckIntervalHandle =
                setInterval(checkForResize_, this.resizeCheckInterval);
        }.bind(this);

        /**
         * Updates the current time of the video
         * @private
         */
        var updateCurrentTime_ = function () {
            if (!this.contentPlayheadTracker.seeking) {
                this.contentPlayheadTracker.currentTime = this.player.currentTime();
            }
        }.bind(this);

        /**
         * Detects when the user is seeking through a video.
         * This is used to prevent mid-rolls from playing while a user is seeking.
         *
         * There *is* a seeking property of the HTML5 video element, but it's not
         * properly implemented on all platforms (e.g. mobile safari), so we have to
         * check ourselves to be sure.
         *
         * @private
         */
        var checkForSeeking_ = function () {
            var tempCurrentTime = this.player.currentTime();
            var diff = (tempCurrentTime - this.contentPlayheadTracker.previousTime) * 1000;
            if (Math.abs(diff) > this.seekCheckInterval + this.seekThreshold) {
                this.contentPlayheadTracker.seeking = true;
            } else {
                this.contentPlayheadTracker.seeking = false;
            }
            this.contentPlayheadTracker.previousTime = this.player.currentTime();
        }.bind(this);

        /**
         * Detects when the player is resized (for fluid support) and resizes the
         * ads manager to match.
         *
         * @private
         */
        var checkForResize_ = function () {
            var currentWidth = this.getPlayerWidth();
            var currentHeight = this.getPlayerHeight();

            if (this.adsManager && (currentWidth != this.adsManagerDimensions.width ||
                currentHeight != this.adsManagerDimensions.height)) {
                this.adsManagerDimensions.width = currentWidth;
                this.adsManagerDimensions.height = currentHeight;
                this.adsManager.resize(currentWidth, currentHeight, google.ima.ViewMode.NORMAL);
            }
        }.bind(this);

        /**
         * Changes the flag to show or hide the ad countdown timer.
         *
         * @param {boolean} showCountdownIn Show or hide the countdown timer.
         */
        this.setShowCountdown = function (showCountdownIn) {
            this.showCountdown = showCountdownIn;
            this.countdownDiv.style.display = this.showCountdown ? 'block' : 'none';
        }.bind(this);

        /**
         * Current plugin version.
         */
        this.VERSION = '0.2.0';

        /**
         * Stores user-provided settings.
         */
        this.settings;

        /**
         * Used to prefix videojs ima
         */
        this.controlPrefix;

        /**
         * Video element playing content.
         */
        this.contentPlayer;

        /**
         * Boolean flag to show or hide the ad countdown timer.
         */
        this.showCountdown;

        /**
         * Boolena flag to enable manual ad break playback.
         */
        this.autoPlayAdBreaks;

        /**
         * Video.js control bar.
         */
        this.vjsControls;

        /**
         * Div used as an ad container.
         */
        this.adContainerDiv;

        /**
         * Div used to display ad controls.
         */
        this.controlsDiv;

        /**
         * Div used to display ad countdown timer.
         */
        this.countdownDiv;

        /**
         * Div used to display add seek bar.
         */
        this.seekBarDiv;

        /**
         * Div used to display ad progress (in seek bar).
         */
        this.progressDiv;

        /**
         * Div used to display ad play/pause button.
         */
        this.playPauseDiv;

        /**
         * Div used to display ad mute button.
         */
        this.muteDiv;

        /**
         * Div used by the volume slider.
         */
        this.sliderDiv;

        /**
         * Volume slider level visuals
         */
        this.sliderLevelDiv;

        /**
         * Div used to display ad fullscreen button.
         */
        this.fullscreenDiv;

        /**
         * IMA SDK AdDisplayContainer.
         */
        this.adDisplayContainer;

        /**
         * True if the AdDisplayContainer has been initialized. False otherwise.
         */
        this.adDisplayContainerInitialized = false;

        /**
         * IMA SDK AdsLoader
         */
        this.adsLoader;

        /**
         * IMA SDK AdsManager
         */
        this.adsManager;

        /**
         * IMA SDK AdsRenderingSettings.
         */
        this.adsRenderingSettings = null;

        /**
         * Ad tag URL. Should return VAST, VMAP, or ad rules.
         */
        this.adTagUrl;

        /**
         * VAST, VMAP, or ad rules response. Used in lieu of fetching a response
         * from an ad tag URL.
         */
        this.adsResponse;

        /**
         * Current IMA SDK Ad.
         */
        this.currentAd;

        /**
         * Timer used to track content progress.
         */
        this.contentTrackingTimer;

        /**
         * Timer used to track ad progress.
         */
        this.adTrackingTimer;

        /**
         * True if ads are currently displayed, false otherwise.
         * True regardless of ad pause state if an ad is currently being displayed.
         */
        this.adsActive = false;

        /**
         * True if ad is currently playing, false if ad is paused or ads are not
         * currently displayed.
         */
        this.adPlaying = false;

        /**
         * True if the ad is muted, false otherwise.
         */
        this.adMuted = false;

        /**
         * True if our content video has completed, false otherwise.
         */
        this.contentComplete = false;

        /**
         * True if ALL_ADS_COMPLETED has fired, false until then.
         */
        this.allAdsCompleted = false;

        /**
         * Handle to interval that repeatedly updates current time.
         */
        this.updateTimeIntervalHandle;

        /**
         * Handle to interval that repeatedly checks for seeking.
         */
        this.seekCheckIntervalHandle;

        /**
         * Interval (ms) on which to check if the user is seeking through the
         * content.
         */
        this.seekCheckInterval = 1000;

        /**
         * Handle to interval that repeatedly checks for player resize.
         */
        this.resizeCheckIntervalHandle;

        /**
         * Interval (ms) to check for player resize for fluid support.
         */
        this.resizeCheckInterval = 250;

        /**
         * Threshold by which to judge user seeking. We check every 1000 ms to see
         * if the user is seeking. In order for us to decide that they are *not*
         * seeking, the content video playhead must only change by 900-1100 ms
         * between checks. Any greater change and we assume the user is seeking
         * through the video.
         */
        this.seekThreshold = 100;

        /**
         * Stores data for the content playhead tracker.
         */
        this.contentPlayheadTracker = {
            currentTime: 0,
            previousTime: 0,
            seeking: false,
            duration: 0
        };

        /**
         * Stores data for the ad playhead tracker.
         */
        this.adPlayheadTracker = {
            currentTime: 0,
            duration: 0,
            isPod: false,
            adPosition: 0,
            totalAds: 0
        };

        /**
         * Stores the dimensions for the ads manager.
         */
        this.adsManagerDimensions = {
            width: 0,
            height: 0
        };

        /**
         * Content ended listeners passed by the publisher to the plugin. Publishers
         * should allow the plugin to handle content ended to ensure proper support
         * of custom ad playback.
         */
        this.contentEndedListeners = [];

        /**
         * Content and ads ended listeners passed by the publisher to the plugin.
         * These will be called when the plugin detects that content *and all
         * ads* have completed. This differs from the contentEndedListeners in that
         * contentEndedListeners will fire between content ending and a post-roll
         * playing, whereas the contentAndAdsEndedListeners will fire after the
         * post-roll completes.
         */
        this.contentAndAdsEndedListeners = [];

        /**
         * Listener to be called to trigger manual ad break playback.
         */
        this.adBreakReadyListener = undefined;

        /**
         * Local content ended listener for contentComplete.
         */
        this.localContentEndedListener = function () {
            if (this.adsLoader && !this.contentComplete) {
                this.adsLoader.contentComplete();
                this.contentComplete = true;
            }
            for (var index in this.contentEndedListeners) {
                this.contentEndedListeners[index]();
            }
            if (this.allAdsCompleted) {
                for (var index in this.contentAndAdsEndedListeners) {
                    this.contentAndAdsEndedListeners[index]();
                }
            }
            clearInterval(this.updateTimeIntervalHandle);
            clearInterval(this.seekCheckIntervalHandle);
            clearInterval(this.resizeCheckIntervalHandle);
            if (this.player.el()) {
                this.player.one('play', setUpPlayerIntervals_);
            }
        }.bind(this);

        this.playerDisposedListener = function () {
            this.contentEndedListeners, this.contentAndAdsEndedListeners = [], [];
            this.contentComplete = true;
            this.player.off('ended', this.localContentEndedListener);
            var intervalsToClear = [this.updateTimeIntervalHandle, this.seekCheckIntervalHandle,
            this.adTrackingTimer, this.resizeCheckIntervalHandle];
            for (var index in intervalsToClear) {
                var interval = intervalsToClear[index];
                if (interval) {
                    clearInterval(interval);
                }
            }
            if (this.adsManager) {
                this.adsManager.destroy();
                this.adsManager = null;
            }
        }.bind(this);

        this.settings = extend({}, ima_defaults, options || {});

        // Currently this isn't used but I can see it being needed in the future, so
        // to avoid implementation problems with later updates I'm requiring it.
        if (!this.settings['id']) {
            window.console.log('Error: must provide id of video.js div');
            return;
        }

        this.controlPrefix = (this.settings.id + '_') || '';

        this.contentPlayer = document.getElementById(this.settings['id'] + '_html5_api');
        // Default showing countdown timer to true.
        this.showCountdown = true;
        if (this.settings['showCountdown'] == false) {
            this.showCountdown = false;
        }

        this.autoPlayAdBreaks = true;
        if (this.settings['autoPlayAdBreaks'] == false) {
            this.autoPlayAdBreaks = false;
        }

        player.one('play', setUpPlayerIntervals_);

        player.on('ended', this.localContentEndedListener);
        player.on('dispose', this.playerDisposedListener);

        var contrib_ads_defaults = {
            debug: this.settings.debug,
            timeout: this.settings.timeout,
            prerollTimeout: this.settings.prerollTimeout
        };

        var ads_plugin_settings =
            extend({}, contrib_ads_defaults, options['contribAdsSettings'] || {});

        player.ads(ads_plugin_settings);

        this.adsRenderingSettings = new google.ima.AdsRenderingSettings();
        this.adsRenderingSettings.restoreCustomPlaybackStateOnAdBreakComplete = true;
        if (this.settings['adsRenderingSettings']) {
            for (var setting in this.settings['adsRenderingSettings']) {
                this.adsRenderingSettings[setting] =
                    this.settings['adsRenderingSettings'][setting];
            }
        }

        if (this.settings['locale']) {
            google.ima.settings.setLocale(this.settings['locale']);
        }

        createAdContainer_();
        this.adsLoader = new google.ima.AdsLoader(this.adDisplayContainer);

        this.adsLoader.getSettings().setVpaidMode(
            google.ima.ImaSdkSettings.VpaidMode.ENABLED);
        if (this.settings.vpaidAllowed == false) {
            this.adsLoader.getSettings().setVpaidMode(
                google.ima.ImaSdkSettings.VpaidMode.DISABLED);
        }
        if (this.settings.vpaidMode) {
            this.adsLoader.getSettings().setVpaidMode(this.settings.vpaidMode);
        }

        if (this.settings.locale) {
            this.adsLoader.getSettings().setLocale(this.settings.locale);
        }

        if (this.settings.numRedirects) {
            this.adsLoader.getSettings().setNumRedirects(this.settings.numRedirects);
        }

        this.adsLoader.getSettings().setPlayerType('videojs-ima');
        this.adsLoader.getSettings().setPlayerVersion(this.VERSION);
        this.adsLoader.getSettings().setAutoPlayAdBreaks(this.autoPlayAdBreaks);

        this.adsLoader.addEventListener(
            google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,
            onAdsManagerLoaded_,
            false);
        this.adsLoader.addEventListener(
            google.ima.AdErrorEvent.Type.AD_ERROR,
            onAdsLoaderError_,
            false);

        if (!readyCallback) {
            readyCallback = this.startFromReadyCallback;
        }
        player.on('readyforpreroll', readyCallback);
        player.ready(function () {
            player.on('fullscreenchange', onFullscreenChange_);
            player.on('volumechange', onVolumeChange_);
        });
    };

    vjs.plugin('ima', init);
}(window.videojs));


/**
 * Basic Ad support plugin for video.js.
 *
 * Common code to support ad integrations.
 */
(function (window, videojs, undefined) {
    'use strict';

    var

        VIDEO_EVENTS = videojs.getComponent('Html5').Events,

        /**
         * Pause the player so that ads can play, then play again when ads are done.
         * This makes sure the player is paused during ad loading.
         *
         * The timeout is necessary because pausing a video element while processing a `play`
         * event on iOS can cause the video element to continuously toggle between playing and
         * paused states.
         *
         * @param {object} player The video player
         */
        cancelContentPlay = function (player) {
            if (player.ads.cancelPlayTimeout) {
                // another cancellation is already in flight, so do nothing
                return;
            }

            // Avoid content flash on non-iPad iOS
            if (videojs.browser.IS_IOS) {

                var width = player.currentWidth ? player.currentWidth() : player.width();
                var height = player.currentHeight ? player.currentHeight() : player.height();

                // A placeholder black box will be shown in the document while the player is hidden.
                var placeholder = document.createElement('div');
                placeholder.style.width = width + 'px';
                placeholder.style.height = height + 'px';
                placeholder.style.background = 'black';
                player.el_.parentNode.insertBefore(placeholder, player.el_);

                // Hide the player. While in full-screen video playback mode on iOS, this
                // makes the player show a black screen instead of content flash.
                player.el_.style.display = 'none';

                // Unhide the player and remove the placeholder once we're ready to move on.
                player.one(['adplaying', 'adtimeout', 'adserror', 'adscanceled', 'adskip',
                    'contentplayback'], function () {
                        player.el_.style.display = 'block';
                        placeholder.remove();
                    });
            }

            player.ads.cancelPlayTimeout = window.setTimeout(function () {
                // deregister the cancel timeout so subsequent cancels are scheduled
                player.ads.cancelPlayTimeout = null;

                // pause playback so ads can be handled.
                if (!player.paused()) {
                    player.pause();
                }

                // add a contentplayback handler to resume playback when ads finish.
                player.one('contentplayback', function () {
                    if (player.paused()) {
                        player.play();
                    }
                });
            }, 1);
        },

        /**
         * Returns an object that captures the portions of player state relevant to
         * video playback. The result of this function can be passed to
         * restorePlayerSnapshot with a player to return the player to the state it
         * was in when this function was invoked.
         * @param {object} player The videojs player object
         */
        getPlayerSnapshot = function (player) {

            var currentTime;

            if (videojs.browser.IS_IOS && player.ads.isLive(player)) {
                // Record how far behind live we are
                if (player.seekable().length > 0) {
                    currentTime = player.currentTime() - player.seekable().end(0);
                } else {
                    currentTime = player.currentTime();
                }
            } else {
                currentTime = player.currentTime();
            }

            var
                tech = player.$('.vjs-tech'),
                tracks = player.remoteTextTracks ? player.remoteTextTracks() : [],
                track,
                i,
                suppressedTracks = [],
                snapshot = {
                    ended: player.ended(),
                    currentSrc: player.currentSrc(),
                    src: player.src(),
                    currentTime: currentTime,
                    type: player.currentType()
                };

            if (tech) {
                snapshot.nativePoster = tech.poster;
                snapshot.style = tech.getAttribute('style');
            }

            i = tracks.length;
            while (i--) {
                track = tracks[i];
                suppressedTracks.push({
                    track: track,
                    mode: track.mode
                });
                track.mode = 'disabled';
            }
            snapshot.suppressedTracks = suppressedTracks;

            return snapshot;
        },

        /**
         * Attempts to modify the specified player so that its state is equivalent to
         * the state of the snapshot.
         * @param {object} snapshot - the player state to apply
         */
        restorePlayerSnapshot = function (player, snapshot) {
            if (player.ads.disableNextSnapshotRestore === true) {
                player.ads.disableNextSnapshotRestore = false;
                return;
            }
            var
                // the playback tech
                tech = player.$('.vjs-tech'),

                // the number of remaining attempts to restore the snapshot
                attempts = 20,

                suppressedTracks = snapshot.suppressedTracks,
                trackSnapshot,
                restoreTracks = function () {
                    var i = suppressedTracks.length;
                    while (i--) {
                        trackSnapshot = suppressedTracks[i];
                        trackSnapshot.track.mode = trackSnapshot.mode;
                    }
                },

                // finish restoring the playback state
                resume = function () {
                    var currentTime;

                    if (videojs.browser.IS_IOS && player.ads.isLive(player)) {
                        if (snapshot.currentTime < 0) {
                            // Playback was behind real time, so seek backwards to match
                            if (player.seekable().length > 0) {
                                currentTime = player.seekable().end(0) + snapshot.currentTime;
                            } else {
                                currentTime = player.currentTime();
                            }
                            player.currentTime(currentTime);
                        }
                    } else {
                        player.currentTime(snapshot.ended ? player.duration() : snapshot.currentTime);
                    }

                    // Resume playback if this wasn't a postroll
                    if (!snapshot.ended) {
                        player.play();
                    }
                },

                // determine if the video element has loaded enough of the snapshot source
                // to be ready to apply the rest of the state
                tryToResume = function () {

                    // tryToResume can either have been called through the `contentcanplay`
                    // event or fired through setTimeout.
                    // When tryToResume is called, we should make sure to clear out the other
                    // way it could've been called by removing the listener and clearing out
                    // the timeout.
                    player.off('contentcanplay', tryToResume);
                    if (player.ads.tryToResumeTimeout_) {
                        player.clearTimeout(player.ads.tryToResumeTimeout_);
                        player.ads.tryToResumeTimeout_ = null;
                    }

                    // Tech may have changed depending on the differences in sources of the
                    // original video and that of the ad
                    tech = player.el().querySelector('.vjs-tech');

                    if (tech.readyState > 1) {
                        // some browsers and media aren't "seekable".
                        // readyState greater than 1 allows for seeking without exceptions
                        return resume();
                    }

                    if (tech.seekable === undefined) {
                        // if the tech doesn't expose the seekable time ranges, try to
                        // resume playback immediately
                        return resume();
                    }

                    if (tech.seekable.length > 0) {
                        // if some period of the video is seekable, resume playback
                        return resume();
                    }

                    // delay a bit and then check again unless we're out of attempts
                    if (attempts--) {
                        window.setTimeout(tryToResume, 50);
                    } else {
                        (function () {
                            try {
                                resume();
                            } catch (e) {
                                videojs.log.warn('Failed to resume the content after an advertisement', e);
                            }
                        })();
                    }
                };

            if (snapshot.nativePoster) {
                tech.poster = snapshot.nativePoster;
            }

            if ('style' in snapshot) {
                // overwrite all css style properties to restore state precisely
                tech.setAttribute('style', snapshot.style || '');
            }

            // Determine whether the player needs to be restored to its state
            // before ad playback began. With a custom ad display or burned-in
            // ads, the content player state hasn't been modified and so no
            // restoration is required

            if (player.ads.videoElementRecycled()) {
                // on ios7, fiddling with textTracks too early will cause safari to crash
                player.one('contentloadedmetadata', restoreTracks);

                // if the src changed for ad playback, reset it
                player.src({ src: snapshot.currentSrc, type: snapshot.type });
                // safari requires a call to `load` to pick up a changed source
                player.load();
                // and then resume from the snapshots time once the original src has loaded
                // in some browsers (firefox) `canplay` may not fire correctly.
                // Reace the `canplay` event with a timeout.
                player.one('contentcanplay', tryToResume);
                player.ads.tryToResumeTimeout_ = player.setTimeout(tryToResume, 2000);
            } else if (!player.ended() || !snapshot.ended) {
                // if we didn't change the src, just restore the tracks
                restoreTracks();
                // the src didn't change and this wasn't a postroll
                // just resume playback at the current time.
                player.play();
            }
        },

        /**
         * Remove the poster attribute from the video element tech, if present. When
         * reusing a video element for multiple videos, the poster image will briefly
         * reappear while the new source loads. Removing the attribute ahead of time
         * prevents the poster from showing up between videos.
         * @param {object} player The videojs player object
         */
        removeNativePoster = function (player) {
            var tech = player.$('.vjs-tech');
            if (tech) {
                tech.removeAttribute('poster');
            }
        },

        // ---------------------------------------------------------------------------
        // Ad Framework
        // ---------------------------------------------------------------------------

        // default framework settings
        defaults = {
            // maximum amount of time in ms to wait to receive `adsready` from the ad
            // implementation after play has been requested. Ad implementations are
            // expected to load any dynamic libraries and make any requests to determine
            // ad policies for a video during this time.
            timeout: 5000,

            // maximum amount of time in ms to wait for the ad implementation to start
            // linear ad mode after `readyforpreroll` has fired. This is in addition to
            // the standard timeout.
            prerollTimeout: 100,

            // maximum amount of time in ms to wait for the ad implementation to start
            // linear ad mode after `contentended` has fired.
            postrollTimeout: 100,

            // when truthy, instructs the plugin to output additional information about
            // plugin state to the video.js log. On most devices, the video.js log is
            // the same as the developer console.
            debug: false,

            // set this to true when using ads that are part of the content video
            stitchedAds: false
        },

        adFramework = function (options) {
            var player = this;
            var settings = videojs.mergeOptions(defaults, options);
            var fsmHandler;

            // prefix all video element events during ad playback
            // if the video element emits ad-related events directly,
            // plugins that aren't ad-aware will break. prefixing allows
            // plugins that wish to handle ad events to do so while
            // avoiding the complexity for common usage
            (function () {
                var videoEvents = VIDEO_EVENTS.concat([
                    'firstplay',
                    'loadedalldata'
                ]);

                var returnTrue = function () { return true; };

                var triggerEvent = function (type, event) {
                    // pretend we called stopImmediatePropagation because we want the native
                    // element events to continue propagating
                    event.isImmediatePropagationStopped = returnTrue;
                    event.cancelBubble = true;
                    event.isPropagationStopped = returnTrue;
                    player.trigger({
                        type: type + event.type,
                        state: player.ads.state,
                        originalEvent: event
                    });
                };

                player.on(videoEvents, function redispatch(event) {
                    if (player.ads.state === 'ad-playback') {
                        if (player.ads.videoElementRecycled() || player.ads.stitchedAds()) {
                            triggerEvent('ad', event);
                        }
                    } else if (player.ads.state === 'content-playback' && event.type === 'ended') {
                        triggerEvent('content', event);
                    } else if (player.ads.state === 'content-resuming') {
                        if (player.ads.snapshot) {
                            // the video element was recycled for ad playback
                            if (player.currentSrc() !== player.ads.snapshot.currentSrc) {
                                if (event.type === 'loadstart') {
                                    return;
                                }
                                return triggerEvent('content', event);

                                // we ended playing postrolls and the video itself
                                // the content src is back in place
                            } else if (player.ads.snapshot.ended) {
                                if ((event.type === 'pause' ||
                                    event.type === 'ended')) {
                                    // after loading a video, the natural state is to not be started
                                    // in this case, it actually has, so, we do it manually
                                    player.addClass('vjs-has-started');
                                    // let `pause` and `ended` events through, naturally
                                    return;
                                }
                                // prefix all other events in content-resuming with `content`
                                return triggerEvent('content', event);
                            }
                        }
                        if (event.type !== 'playing') {
                            triggerEvent('content', event);
                        }
                    }
                });
            })();

            // We now auto-play when an ad gets loaded if we're playing ads in the same video element as the content.
            // The problem is that in IE11, we cannot play in addurationchange but in iOS8, we cannot play from adcanplay.
            // This will allow ad-integrations from needing to do this themselves.
            player.on(['addurationchange', 'adcanplay'], function () {
                if (player.currentSrc() === player.ads.snapshot.currentSrc) {
                    return;
                }

                player.play();
            });

            player.on('nopreroll', function () {
                player.ads.nopreroll_ = true;
            });

            player.on('nopostroll', function () {
                player.ads.nopostroll_ = true;
            });

            // replace the ad initializer with the ad namespace
            player.ads = {
                state: 'content-set',
                disableNextSnapshotRestore: false,

                // Call this when an ad response has been received and there are
                // linear ads ready to be played.
                startLinearAdMode: function () {
                    if (player.ads.state === 'preroll?' ||
                        player.ads.state === 'content-playback' ||
                        player.ads.state === 'postroll?') {
                        player.trigger('adstart');
                    }
                },

                // Call this when a linear ad pod has finished playing.
                endLinearAdMode: function () {
                    if (player.ads.state === 'ad-playback') {
                        player.trigger('adend');
                        // In the case of an empty ad response, we want to make sure that
                        // the vjs-ad-loading class is always removed. We could probably check for
                        // duration on adPlayer for an empty ad but we remove it here just to make sure
                        player.removeClass('vjs-ad-loading');
                    }
                },

                // Call this when an ad response has been received but there are no
                // linear ads to be played (i.e. no ads available, or overlays).
                // This has no effect if we are already in a linear ad mode.  Always
                // use endLinearAdMode() to exit from linear ad-playback state.
                skipLinearAdMode: function () {
                    if (player.ads.state !== 'ad-playback') {
                        player.trigger('adskip');
                    }
                },

                stitchedAds: function (arg) {
                    if (arg !== undefined) {
                        this._stitchedAds = !!arg;
                    }
                    return this._stitchedAds;
                },

                // Returns whether the video element has been modified since the
                // snapshot was taken.
                // We test both src and currentSrc because changing the src attribute to a URL that
                // AdBlocker is intercepting doesn't update currentSrc.
                videoElementRecycled: function () {
                    var srcChanged;
                    var currentSrcChanged;

                    if (!this.snapshot) {
                        return false;
                    }

                    srcChanged = player.src() !== this.snapshot.src;
                    currentSrcChanged = player.currentSrc() !== this.snapshot.currentSrc;

                    return srcChanged || currentSrcChanged;
                },

                // Returns a boolean indicating if given player is in live mode.
                // Can be replaced when this is fixed: https://github.com/videojs/video.js/issues/3262
                isLive: function (player) {
                    if (player.duration() === Infinity) {
                        return true;
                    } else if (videojs.browser.IOS_VERSION === "8" && player.duration() === 0) {
                        return true;
                    }
                    return false;
                },

                // Return true if content playback should mute and continue during ad breaks.
                // This is only done during live streams on platforms where it's supported.
                // This improves speed and accuracy when returning from an ad break.
                shouldPlayContentBehindAd: function (player) {
                    return !videojs.browser.IS_IOS &&
                        !videojs.browser.IS_ANDROID &&
                        player.duration() === Infinity;
                }

            };

            player.ads.stitchedAds(settings.stitchedAds);

            fsmHandler = function (event) {
                // Ad Playback State Machine
                var fsm = {
                    'content-set': {
                        events: {
                            'adscanceled': function () {
                                this.state = 'content-playback';
                            },
                            'adsready': function () {
                                this.state = 'ads-ready';
                            },
                            'play': function () {
                                this.state = 'ads-ready?';
                                cancelContentPlay(player);
                                // remove the poster so it doesn't flash between videos
                                removeNativePoster(player);
                            },
                            'adserror': function () {
                                this.state = 'content-playback';
                            },
                            'adskip': function () {
                                this.state = 'content-playback';
                            }
                        }
                    },
                    'ads-ready': {
                        events: {
                            'play': function () {
                                this.state = 'preroll?';
                                cancelContentPlay(player);
                            },
                            'adskip': function () {
                                this.state = 'content-playback';
                            },
                            'adserror': function () {
                                this.state = 'content-playback';
                            }
                        }
                    },
                    'preroll?': {
                        enter: function () {
                            if (player.ads.nopreroll_) {
                                // This will start the ads manager in case there are later ads
                                player.trigger('readyforpreroll');

                                // If we don't wait a tick, entering content-playback will cancel
                                // cancelPlayTimeout, causing the video to not pause for the ad
                                window.setTimeout(function () {
                                    // Don't wait for a preroll
                                    player.trigger('nopreroll');
                                }, 1);
                            } else {
                                // change class to show that we're waiting on ads
                                player.addClass('vjs-ad-loading');
                                // schedule an adtimeout event to fire if we waited too long
                                player.ads.adTimeoutTimeout = window.setTimeout(function () {
                                    player.trigger('adtimeout');
                                }, settings.prerollTimeout);
                                // signal to ad plugin that it's their opportunity to play a preroll
                                player.trigger('readyforpreroll');
                            }
                        },
                        leave: function () {
                            window.clearTimeout(player.ads.adTimeoutTimeout);
                            player.removeClass('vjs-ad-loading');
                        },
                        events: {
                            'play': function () {
                                cancelContentPlay(player);
                            },
                            'adstart': function () {
                                this.state = 'ad-playback';
                            },
                            'adskip': function () {
                                this.state = 'content-playback';
                            },
                            'adtimeout': function () {
                                this.state = 'content-playback';
                            },
                            'adserror': function () {
                                this.state = 'content-playback';
                            },
                            'nopreroll': function () {
                                this.state = 'content-playback';
                            }
                        }
                    },
                    'ads-ready?': {
                        enter: function () {
                            player.addClass('vjs-ad-loading');
                            player.ads.adTimeoutTimeout = window.setTimeout(function () {
                                player.trigger('adtimeout');
                            }, settings.timeout);
                        },
                        leave: function () {
                            window.clearTimeout(player.ads.adTimeoutTimeout);
                            player.removeClass('vjs-ad-loading');
                        },
                        events: {
                            'play': function () {
                                cancelContentPlay(player);
                            },
                            'adscanceled': function () {
                                this.state = 'content-playback';
                            },
                            'adsready': function () {
                                this.state = 'preroll?';
                            },
                            'adskip': function () {
                                this.state = 'content-playback';
                            },
                            'adtimeout': function () {
                                this.state = 'content-playback';
                            },
                            'adserror': function () {
                                this.state = 'content-playback';
                            }
                        }
                    },
                    'ad-playback': {
                        enter: function () {
                            // capture current player state snapshot (playing, currentTime, src)
                            if (!player.ads.shouldPlayContentBehindAd(player)) {
                                this.snapshot = getPlayerSnapshot(player);
                            }

                            // Mute the player behind the ad
                            if (player.ads.shouldPlayContentBehindAd(player)) {
                                this.preAdVolume_ = player.volume();
                                player.volume(0);
                            }

                            // add css to the element to indicate and ad is playing.
                            player.addClass('vjs-ad-playing');

                            // remove the poster so it doesn't flash between ads
                            removeNativePoster(player);

                            // We no longer need to supress play events once an ad is playing.
                            // Clear it if we were.
                            if (player.ads.cancelPlayTimeout) {
                                // If we don't wait a tick, we could cancel the pause for cancelContentPlay,
                                // resulting in content playback behind the ad
                                window.setTimeout(function () {
                                    window.clearTimeout(player.ads.cancelPlayTimeout);
                                    player.ads.cancelPlayTimeout = null;
                                }, 1);
                            }
                        },
                        leave: function () {
                            player.removeClass('vjs-ad-playing');
                            if (!player.ads.shouldPlayContentBehindAd(player)) {
                                restorePlayerSnapshot(player, this.snapshot);
                            }

                            // Reset the volume to pre-ad levels
                            if (player.ads.shouldPlayContentBehindAd(player)) {
                                player.volume(this.preAdVolume_);
                            }

                        },
                        events: {
                            'adend': function () {
                                this.state = 'content-resuming';
                            },
                            'adserror': function () {
                                this.state = 'content-resuming';
                                //trigger 'adend' to notify that we are exiting 'ad-playback'
                                player.trigger('adend');
                            }
                        }
                    },
                    'content-resuming': {
                        enter: function () {
                            if (this.snapshot && this.snapshot.ended) {
                                window.clearTimeout(player.ads._fireEndedTimeout);
                                // in some cases, ads are played in a swf or another video element
                                // so we do not get an ended event in this state automatically.
                                // If we don't get an ended event we can use, we need to trigger
                                // one ourselves or else we won't actually ever end the current video.
                                player.ads._fireEndedTimeout = window.setTimeout(function () {
                                    player.trigger('ended');
                                }, 1000);
                            }
                        },
                        leave: function () {
                            window.clearTimeout(player.ads._fireEndedTimeout);
                        },
                        events: {
                            'contentupdate': function () {
                                this.state = 'content-set';
                            },
                            contentresumed: function () {
                                this.state = 'content-playback';
                            },
                            'playing': function () {
                                this.state = 'content-playback';
                            },
                            'ended': function () {
                                this.state = 'content-playback';
                            }
                        }
                    },
                    'postroll?': {
                        enter: function () {
                            this.snapshot = getPlayerSnapshot(player);
                            if (player.ads.nopostroll_) {
                                window.setTimeout(function () {
                                    // content-resuming happens after the timeout for backward-compatibility
                                    // with plugins that relied on a postrollTimeout before nopostroll was
                                    // implemented
                                    player.ads.state = 'content-resuming';
                                    player.trigger('ended');
                                }, 1);
                            } else {
                                player.addClass('vjs-ad-loading');

                                player.ads.adTimeoutTimeout = window.setTimeout(function () {
                                    player.trigger('adtimeout');
                                }, settings.postrollTimeout);
                            }
                        },
                        leave: function () {
                            window.clearTimeout(player.ads.adTimeoutTimeout);
                            player.removeClass('vjs-ad-loading');
                        },
                        events: {
                            'adstart': function () {
                                this.state = 'ad-playback';
                            },
                            'adskip': function () {
                                this.state = 'content-resuming';
                                window.setTimeout(function () {
                                    player.trigger('ended');
                                }, 1);
                            },
                            'adtimeout': function () {
                                this.state = 'content-resuming';
                                window.setTimeout(function () {
                                    player.trigger('ended');
                                }, 1);
                            },
                            'adserror': function () {
                                this.state = 'content-resuming';
                                window.setTimeout(function () {
                                    player.trigger('ended');
                                }, 1);
                            },
                            'contentupdate': function () {
                                this.state = 'ads-ready?';
                            }
                        }
                    },
                    'content-playback': {
                        enter: function () {
                            // make sure that any cancelPlayTimeout is cleared
                            if (player.ads.cancelPlayTimeout) {
                                window.clearTimeout(player.ads.cancelPlayTimeout);
                                player.ads.cancelPlayTimeout = null;
                            }
                            // this will cause content to start if a user initiated
                            // 'play' event was canceled earlier.
                            player.trigger({
                                type: 'contentplayback',
                                triggerevent: player.ads.triggerevent
                            });
                        },
                        events: {
                            // in the case of a timeout, adsready might come in late.
                            'adsready': function () {
                                player.trigger('readyforpreroll');
                            },
                            'adstart': function () {
                                this.state = 'ad-playback';
                            },
                            'contentupdate': function () {
                                if (player.paused()) {
                                    this.state = 'content-set';
                                } else {
                                    this.state = 'ads-ready?';
                                }
                                // When a new source is loaded into the player, we should remove the snapshot
                                // to avoid confusing player state with the new content's state
                                // i.e When new content is set, the player should fire the ended event
                                if (this.snapshot && this.snapshot.ended) {
                                    this.snapshot = null;
                                }
                            },
                            'contentended': function () {
                                if (player.ads.snapshot && player.ads.snapshot.ended) {
                                    // player has already been here. content has really ended. good-bye
                                    return;
                                }
                                this.state = 'postroll?';
                            },
                            'play': function () {
                                if (player.currentSrc() !== player.ads.contentSrc) {
                                    cancelContentPlay(player);
                                }
                            }
                        }
                    }
                };

                (function (state) {
                    var noop = function () { };

                    // process the current event with a noop default handler
                    ((fsm[state].events || {})[event.type] || noop).apply(player.ads);

                    // check whether the state has changed
                    if (state !== player.ads.state) {

                        // record the event that caused the state transition
                        player.ads.triggerevent = event.type;

                        // execute leave/enter callbacks if present
                        (fsm[state].leave || noop).apply(player.ads);
                        (fsm[player.ads.state].enter || noop).apply(player.ads);

                        // output debug logging
                        if (settings.debug) {
                            videojs.log('ads', player.ads.triggerevent + ' triggered: ' + state + ' -> ' + player.ads.state);
                        }
                    }

                })(player.ads.state);

            };

            // register for the events we're interested in
            player.on(VIDEO_EVENTS.concat([
                // events emitted by ad plugin
                'adtimeout',
                'contentupdate',
                'contentplaying',
                'contentended',
                'contentresumed',

                // events emitted by third party ad implementors
                'adsready',
                'adserror',
                'adscanceled',
                'adstart',  // startLinearAdMode()
                'adend',    // endLinearAdMode()
                'adskip',   // skipLinearAdMode()
                'nopreroll'
            ]), fsmHandler);

            // keep track of the current content source
            // if you want to change the src of the video without triggering
            // the ad workflow to restart, you can update this variable before
            // modifying the player's source
            player.ads.contentSrc = player.currentSrc();

            // implement 'contentupdate' event.
            (function () {
                var
                    // check if a new src has been set, if so, trigger contentupdate
                    checkSrc = function () {
                        var src;
                        if (player.ads.state !== 'ad-playback') {
                            src = player.currentSrc();
                            if (src !== player.ads.contentSrc) {
                                player.trigger({
                                    type: 'contentupdate',
                                    oldValue: player.ads.contentSrc,
                                    newValue: src
                                });
                                player.ads.contentSrc = src;
                            }
                        }
                    };
                // loadstart reliably indicates a new src has been set
                player.on('loadstart', checkSrc);
                // check immediately in case we missed the loadstart
                window.setTimeout(checkSrc, 1);
            })();

            // kick off the fsm
            if (!player.paused()) {
                // simulate a play event if we're autoplaying
                fsmHandler({ type: 'play' });
            }

        };

    // register the ad plugin framework
    videojs.plugin('ads', adFramework);

})(window, videojs);



(function ($) {
    $.fn.radioBox = function (options) {
        //VARS & DEFAULT VALUE
        var settings = $.extend({
            arrowBackground: "#556b2f",
            position: "right",
            name: "radioBox",
            aditionalClasses: "",
            indexSelected: '0',
            defaultText: 'Select...',
            required: 'false',
            disabled: 'false',
            hiddenSelectedOption: 'false'
        }, options);

        var index = 0;
        $(this).each(function () {
            var that = $(this);
            var list = that.find("ul");
            var tmp = 0;
            var html = "";




            //RENDER RADIOBOX
            html += " <div class='radiobox rb_" + settings.position + " " + settings.aditionalClasses + "'>" + "\n";
            html += "   <div class='rb_icon' style='background-color:" + settings.arrowBackground + "'></div>" + "\n";
            html += "   <div class='rb_label'></div>" + "\n";
            html += "   <ul>" + "\n";
            html += "     <li data-id='0' class='rb_default'><p>" + settings.defaultText + "</p></li>";
            list.find("li").each(function () {
                html += "     <li data-id='" + (tmp + 1) + "' class='" + $(this).attr("class") + "'><label>" + "\n";
                html += "       <input type='radio' name='" + settings.name + "-" + index + "' value='" + $(this).attr("data-value") + "'/>" + "\n";
                html += "       <p>" + $(this).text() + "</p>" + "\n";
                html += "     </label></li>" + "\n";
                tmp++;
            });
            html += "   </ul>" + "\n";
            html += "   <input type=\"hidden\" name=\"" + settings.name + "\" />";
            html += " </div>" + "\n";

            //BORRAR UL Y RENDERIZAR HTML
            list.remove();
            that.html(html);

            //RADIOBOX DISABLED
            if (settings.disabled == 'true') {
                that.find(".radiobox").addClass("rb_disabled");
            }
            //REQUIRED
            if (settings.required == 'true') {
                that.find(".rb_default").addClass("rb_disabled");
                that.find("input").prop('required', true);
            }
            //SELECT INITIAL OPTION
            //OVERRIDE settings.indexSelected BY HTML ATTRIBUTE data-selectedvalue
            if ((typeof (that.attr("data-selectedvalue")) != "undefined") && (that.attr("data-selectedvalue") != "")) {
                var originalSetting = settings.indexSelected;
                settings.indexSelected = that.find("li input[value='" + that.attr("data-selectedvalue") + "']").parents("li").attr("data-id");
                settings.indexSelected = typeof (settings.indexSelected) == "undefined" ? originalSetting : settings.indexSelected;
                that.addClass("rb_checked");
            }
            that.find("li[data-id=" + settings.indexSelected + "]").addClass("rb_selected");
            that.find(".rb_label").text(that.find(".rb_selected p").text());
            if (settings.indexSelected != 0) {
                that.find(".rb_selected").find("input").attr('checked', true);
                that.find("input[name=" + settings.name + "]").val(that.find("li[data-id=" + settings.indexSelected + "] input").val()); //.trigger("change");
            }
            if (settings.hiddenSelectedOption == "true") {
                that.find(".rb_selected").addClass("rb_hidden");
            }
            //OPEN / CLOSE RADIOBOX
            that.find(".rb_label, .rb_icon").on("touch click", function () {
                if (!that.find(".radiobox").hasClass("rb_disabled")) {
                    if (that.find(".radiobox").hasClass("rb_open")) {
                        that.find(".radiobox").removeClass("rb_open");
                    } else {
                        $(".radiobox").removeClass("rb_open");
                        that.find(".radiobox").addClass("rb_open");
                    }
                }
            });
            //CLICK IN OPTION
            that.find("li").on("touch click", function () {
                var index = $(this).attr("data-id");
                that.removeClass("rb_checked");
                if (index != 0 || (index == 0 && settings.required == 'false')) {
                    that.find("li").removeClass("rb_selected rb_hidden");
                    that.find("li").find("input").attr('checked', false);
                    that.find("li[data-id=" + index + "]").addClass("rb_selected");
                    that.find(".rb_label").text("").text(that.find(".rb_selected p").text());
                    if (index != 0) {
                        that.addClass("rb_checked");
                        that.find("input[name=" + settings.name + "]").val(that.find("li[data-id=" + index + "] input").val()).trigger("change");
                    }
                    if (settings.indexSelected != 0) {
                        that.find(".rb_selected").find("input").attr('checked', true);
                    }
                    if (settings.hiddenSelectedOption == "true") {
                        that.find(".rb_selected").addClass("rb_hidden");
                    }
                    that.find(".radiobox").removeClass("rb_open");
                }
            });

            index++;
        });


    };
}(jQuery));


/**
 * jQuery Geocoding and Places Autocomplete Plugin - V 1.7.0
 *
 * @author Martin Kleppe <kleppe@ubilabs.net>, 2016
 * @author Ubilabs http://ubilabs.net, 2016
 * @license MIT License <http://www.opensource.org/licenses/mit-license.php>
 */
(function ($, window, document, undefined) { var defaults = { bounds: true, country: null, map: false, details: false, detailsAttribute: "name", detailsScope: null, autoselect: true, location: false, mapOptions: { zoom: 14, scrollwheel: false, mapTypeId: "roadmap" }, markerOptions: { draggable: false }, maxZoom: 16, types: ["geocode"], blur: false, geocodeAfterResult: false, restoreValueAfterBlur: false }; var componentTypes = ("street_address route intersection political " + "country administrative_area_level_1 administrative_area_level_2 " + "administrative_area_level_3 colloquial_area locality sublocality " + "neighborhood premise subpremise postal_code natural_feature airport " + "park point_of_interest post_box street_number floor room " + "lat lng viewport location " + "formatted_address location_type bounds").split(" "); var placesDetails = ("id place_id url website vicinity reference name rating " + "international_phone_number icon formatted_phone_number").split(" "); function GeoComplete(input, options) { this.options = $.extend(true, {}, defaults, options); if (options && options.types) { this.options.types = options.types } this.input = input; this.$input = $(input); this._defaults = defaults; this._name = "geocomplete"; this.init() } $.extend(GeoComplete.prototype, { init: function () { this.initMap(); this.initMarker(); this.initGeocoder(); this.initDetails(); this.initLocation() }, initMap: function () { if (!this.options.map) { return } if (typeof this.options.map.setCenter == "function") { this.map = this.options.map; return } this.map = new google.maps.Map($(this.options.map)[0], this.options.mapOptions); google.maps.event.addListener(this.map, "click", $.proxy(this.mapClicked, this)); google.maps.event.addListener(this.map, "dragend", $.proxy(this.mapDragged, this)); google.maps.event.addListener(this.map, "idle", $.proxy(this.mapIdle, this)); google.maps.event.addListener(this.map, "zoom_changed", $.proxy(this.mapZoomed, this)) }, initMarker: function () { if (!this.map) { return } var options = $.extend(this.options.markerOptions, { map: this.map }); if (options.disabled) { return } this.marker = new google.maps.Marker(options); google.maps.event.addListener(this.marker, "dragend", $.proxy(this.markerDragged, this)) }, initGeocoder: function () { var selected = false; var options = { types: this.options.types, bounds: this.options.bounds === true ? null : this.options.bounds, componentRestrictions: this.options.componentRestrictions }; if (this.options.country) { options.componentRestrictions = { country: this.options.country } } this.autocomplete = new google.maps.places.Autocomplete(this.input, options); this.geocoder = new google.maps.Geocoder; if (this.map && this.options.bounds === true) { this.autocomplete.bindTo("bounds", this.map) } google.maps.event.addListener(this.autocomplete, "place_changed", $.proxy(this.placeChanged, this)); this.$input.on("keypress." + this._name, function (event) { if (event.keyCode === 13) { return false } }); if (this.options.geocodeAfterResult === true) { this.$input.bind("keypress." + this._name, $.proxy(function () { if (event.keyCode != 9 && this.selected === true) { this.selected = false } }, this)) } this.$input.bind("geocode." + this._name, $.proxy(function () { this.find() }, this)); this.$input.bind("geocode:result." + this._name, $.proxy(function () { this.lastInputVal = this.$input.val() }, this)); if (this.options.blur === true) { this.$input.on("blur." + this._name, $.proxy(function () { if (this.options.geocodeAfterResult === true && this.selected === true) { return } if (this.options.restoreValueAfterBlur === true && this.selected === true) { setTimeout($.proxy(this.restoreLastValue, this), 0) } else { this.find() } }, this)) } }, initDetails: function () { if (!this.options.details) { return } if (this.options.detailsScope) { var $details = $(this.input).parents(this.options.detailsScope).find(this.options.details) } else { var $details = $(this.options.details) } var attribute = this.options.detailsAttribute, details = {}; function setDetail(value) { details[value] = $details.find("[" + attribute + "=" + value + "]") } $.each(componentTypes, function (index, key) { setDetail(key); setDetail(key + "_short") }); $.each(placesDetails, function (index, key) { setDetail(key) }); this.$details = $details; this.details = details }, initLocation: function () { var location = this.options.location, latLng; if (!location) { return } if (typeof location == "string") { this.find(location); return } if (location instanceof Array) { latLng = new google.maps.LatLng(location[0], location[1]) } if (location instanceof google.maps.LatLng) { latLng = location } if (latLng) { if (this.map) { this.map.setCenter(latLng) } if (this.marker) { this.marker.setPosition(latLng) } } }, destroy: function () { if (this.map) { google.maps.event.clearInstanceListeners(this.map); google.maps.event.clearInstanceListeners(this.marker) } this.autocomplete.unbindAll(); google.maps.event.clearInstanceListeners(this.autocomplete); google.maps.event.clearInstanceListeners(this.input); this.$input.removeData(); this.$input.off(this._name); this.$input.unbind("." + this._name) }, find: function (address) { this.geocode({ address: address || this.$input.val() }) }, geocode: function (request) { if (!request.address) { return } if (this.options.bounds && !request.bounds) { if (this.options.bounds === true) { request.bounds = this.map && this.map.getBounds() } else { request.bounds = this.options.bounds } } if (this.options.country) { request.region = this.options.country } this.geocoder.geocode(request, $.proxy(this.handleGeocode, this)) }, selectFirstResult: function () { var selected = ""; if ($(".pac-item-selected")[0]) { selected = "-selected" } var $span1 = $(".pac-container:visible .pac-item" + selected + ":first span:nth-child(2)").text(); var $span2 = $(".pac-container:visible .pac-item" + selected + ":first span:nth-child(3)").text(); var firstResult = $span1; if ($span2) { firstResult += " - " + $span2 } this.$input.val(firstResult); return firstResult }, restoreLastValue: function () { if (this.lastInputVal) { this.$input.val(this.lastInputVal) } }, handleGeocode: function (results, status) { if (status === google.maps.GeocoderStatus.OK) { var result = results[0]; this.$input.val(result.formatted_address); this.update(result); if (results.length > 1) { this.trigger("geocode:multiple", results) } } else { this.trigger("geocode:error", status) } }, trigger: function (event, argument) { this.$input.trigger(event, [argument]) }, center: function (geometry) { if (geometry.viewport) { this.map.fitBounds(geometry.viewport); if (this.map.getZoom() > this.options.maxZoom) { this.map.setZoom(this.options.maxZoom) } } else { this.map.setZoom(this.options.maxZoom); this.map.setCenter(geometry.location) } if (this.marker) { this.marker.setPosition(geometry.location); this.marker.setAnimation(this.options.markerOptions.animation) } }, update: function (result) { if (this.map) { this.center(result.geometry) } if (this.$details) { this.fillDetails(result) } this.trigger("geocode:result", result) }, fillDetails: function (result) { var data = {}, geometry = result.geometry, viewport = geometry.viewport, bounds = geometry.bounds; $.each(result.address_components, function (index, object) { var name = object.types[0]; $.each(object.types, function (index, name) { data[name] = object.long_name; data[name + "_short"] = object.short_name }) }); $.each(placesDetails, function (index, key) { data[key] = result[key] }); $.extend(data, { formatted_address: result.formatted_address, location_type: geometry.location_type || "PLACES", viewport: viewport, bounds: bounds, location: geometry.location, lat: geometry.location.lat(), lng: geometry.location.lng() }); $.each(this.details, $.proxy(function (key, $detail) { var value = data[key]; this.setDetail($detail, value) }, this)); this.data = data }, setDetail: function ($element, value) { if (value === undefined) { value = "" } else if (typeof value.toUrlValue == "function") { value = value.toUrlValue() } if ($element.is(":input")) { $element.val(value) } else { $element.text(value) } }, markerDragged: function (event) { this.trigger("geocode:dragged", event.latLng) }, mapClicked: function (event) { this.trigger("geocode:click", event.latLng) }, mapDragged: function (event) { this.trigger("geocode:mapdragged", this.map.getCenter()) }, mapIdle: function (event) { this.trigger("geocode:idle", this.map.getCenter()) }, mapZoomed: function (event) { this.trigger("geocode:zoom", this.map.getZoom()) }, resetMarker: function () { this.marker.setPosition(this.data.location); this.setDetail(this.details.lat, this.data.location.lat()); this.setDetail(this.details.lng, this.data.location.lng()) }, placeChanged: function () { var place = this.autocomplete.getPlace(); this.selected = true; if (!place.geometry) { if (this.options.autoselect) { var autoSelection = this.selectFirstResult(); this.find(autoSelection) } } else { this.update(place) } } }); $.fn.geocomplete = function (options) { var attribute = "plugin_geocomplete"; if (typeof options == "string") { var instance = $(this).data(attribute) || $(this).geocomplete().data(attribute), prop = instance[options]; if (typeof prop == "function") { prop.apply(instance, Array.prototype.slice.call(arguments, 1)); return $(this) } else { if (arguments.length == 2) { prop = arguments[1] } return prop } } else { return this.each(function () { var instance = $.data(this, attribute); if (!instance) { instance = new GeoComplete(this, options); $.data(this, attribute, instance) } }) } } })(jQuery, window, document);



/**
 * Time-To jQuery plug-in
 * Show countdown timer or realtime clock
 *
 * @author Alexey Teterin <altmoc@gmail.com>
 * @version 1.2.1
 * @license MIT http://opensource.org/licenses/MIT
 * @date 2017-07-31
 */
!function (t) { "function" == typeof define && define.amd ? define(["jquery"], t) : "object" == typeof exports ? module.exports = t(require("jquery")) : t(jQuery) }(function (t) { function i(i, a) { var o, l, d, r, c, u, h, p, f, m = this.data(), y = this.find("ul"), g = !1; if (m.vals && 0 !== y.length) { for (i || (i = m.seconds), m.intervalId && (g = !0, clearTimeout(m.intervalId)), o = Math.floor(i / s), l = o * s, d = Math.floor((i - l) / n), l += d * n, r = Math.floor((i - l) / 60), l += 60 * r, c = i - l, u = (o < 100 ? "0" + (o < 10 ? "0" : "") : "") + o + (d < 10 ? "0" : "") + d + (r < 10 ? "0" : "") + r + (c < 10 ? "0" : "") + c, h = m.vals.length - 1, p = u.length - 1; h >= 0; h -= 1, p -= 1)f = parseInt(u.substr(p, 1), 10), m.vals[h] = f, y.eq(h).children().html(f); (g || a) && (m.ttStartTime = t.now(), m.intervalId = setTimeout(e.bind(this), 1e3), this.data("intervalId", m.intervalId)) } } function e(i) { var s, n, a, o, l, d, r, c = this, u = this.find("ul"), h = this.data(); return h.vals && 0 !== u.length ? ("undefined" == typeof i && (i = h.iSec), s = h.tickCount + 1, this.data("tickCount", s), n = h.vals[i], a = u.eq(i), o = a.children(), l = h.countdown ? -1 : 1, o.eq(1).html(n), n += l, "function" == typeof this.data("step") && this.data("tickCount") % this.data("stepCount") === 0 && this.data("step")(), i === h.iSec && (d = h.tickTimeout, r = t.now() - h.ttStartTime, h.sec += l, d += Math.abs(h.seconds - h.sec) * d - r, h.intervalId = setTimeout(e.bind(this), d)), n < 0 || n > h.limits[i] ? (n < 0 ? (n = h.limits[i], i === h.iHour && h.displayDays > 0 && 0 === h.vals[i - 1] && (n = 3)) : n = 0, i > 0 && e.call(this, i - 1)) : !h.countdown && i === h.iHour && h.displayDays > 0 && 2 === h.vals[i - 1] && 3 === h.vals[i] && (n = 0, e.call(this, i - 1)), o.eq(0).html(n), t.support.transition ? (a.addClass("transition"), a.css({ top: 0 }), setTimeout(function () { a.removeClass("transition"), o.eq(1).html(n), a.css({ top: "-" + h.height + "px" }), l > 0 || i !== h.iSec || (h.sec === h.countdownAlertLimit && u.parent().addClass("timeTo-alert"), 0 === h.sec && (u.parent().removeClass("timeTo-alert"), h.intervalId && (clearTimeout(h.intervalId), c.data("intervalId", null)), "function" == typeof h.callback && h.callback())) }, 410)) : a.stop().animate({ top: 0 }, 400, i !== h.iSec ? null : function () { o.eq(1).html(n), a.css({ top: "-" + h.height + "px" }), l > 0 || i !== h.iSec || (h.sec === h.countdownAlertLimit ? u.parent().addClass("timeTo-alert") : 0 === h.sec && (u.parent().removeClass("timeTo-alert"), h.intervalId && (clearTimeout(h.intervalId), c.data("intervalId", null)), "function" == typeof h.callback && h.callback())) }), void (h.vals[i] = n)) : (h.intervalId && (clearTimeout(h.intervalId), this.data("intervalId", null)), void (h.callback && h.callback())) } var s = 86400, n = 3600, a = { callback: null, step: null, stepCount: 1, captionSize: 0, countdown: !0, countdownAlertLimit: 10, displayCaptions: !1, displayDays: 0, displayHours: !0, fontFamily: "Verdana, sans-serif", fontSize: 0, lang: "en", languages: {}, seconds: 0, start: !0, theme: "white", width: 25, height: 30, gap: 11, vals: [0, 0, 0, 0, 0, 0, 0, 0, 0], limits: [9, 9, 9, 2, 9, 5, 9, 5, 9], iSec: 8, iHour: 4, tickTimeout: 1e3, intervalId: null, tickCount: 0 }, o = { start: function (s) { var n; s && (i.call(this, s), n = setTimeout(e.bind(this), 1e3), this.data("ttStartTime", t.now()), this.data("intervalId", n)) }, stop: function () { var t = this.data(); return t.intervalId && (clearTimeout(t.intervalId), this.data("intervalId", null)), t }, reset: function (t) { var e = o.stop.call(this), s = "undefined" == typeof t ? e.seconds : t; this.find("div").css({ backgroundPosition: "left center" }), this.find("ul").parent().removeClass("timeTo-alert"), i.call(this, s, !0) } }, l = { en: { days: "days", hours: "hours", min: "minutes", sec: "seconds" }, ru: { days: "дней", hours: "часов", min: "минут", sec: "секунд" }, ua: { days: "днiв", hours: "годин", min: "хвилин", sec: "секунд" }, de: { days: "Tag", hours: "Uhr", min: "Minuten", sec: "Secunden" }, fr: { days: "jours", hours: "heures", min: "minutes", sec: "secondes" }, sp: { days: "días", hours: "horas", min: "minutos", sec: "segundos" }, it: { days: "giorni", hours: "ore", min: "minuti", sec: "secondi" }, nl: { days: "dagen", hours: "uren", min: "minuten", sec: "seconden" }, no: { days: "dager", hours: "timer", min: "minutter", sec: "sekunder" }, pt: { days: "dias", hours: "horas", min: "minutos", sec: "segundos" }, tr: { days: "gün", hours: "saat", min: "dakika", sec: "saniye" } }; return "undefined" == typeof t.support.transition && (t.support.transition = function () { var t = document.body || document.documentElement, i = t.style, e = void 0 !== i.transition || void 0 !== i.WebkitTransition || void 0 !== i.MozTransition || void 0 !== i.MsTransition || void 0 !== i.OTransition; return e }()), t.fn.timeTo = function () { var e, d, r, c, u, h, p, f, m, y, g = {}, v = t.now(); for (e = 0; e < arguments.length; e += 1)d = arguments[e], 0 === e && "string" == typeof d ? c = d : "object" == typeof d ? "function" == typeof d.getTime ? g.timeTo = d : g = t.extend(g, d) : "function" == typeof d ? g.callback = d : (r = parseInt(d, 10), isNaN(r) || (g.seconds = r)); if (g.timeTo) g.timeTo.getTime ? u = g.timeTo.getTime() : "number" == typeof g.timeTo && (u = g.timeTo), u > v ? g.seconds = Math.floor((u - v) / 1e3) : g.seconds = 0; else if (g.time || !g.seconds) if (u = g.time, u || (u = new Date), "object" == typeof u && u.getTime) g.seconds = u.getHours() * n + 60 * u.getMinutes() + u.getSeconds(), g.countdown = !1; else if ("string" == typeof u) { for (p = u.split(":"), f = 0, m = 1; p.length;)y = p.pop(), f += y * m, m *= 60; g.seconds = f, g.countdown = !1 } return g.countdown !== !1 && g.seconds > s && "undefined" == typeof g.displayDays ? (h = Math.floor(g.seconds / s), g.displayDays = h < 10 && 1 || h < 100 && 2 || 3) : g.displayDays === !0 ? g.displayDays = 3 : g.displayDays && (g.displayDays = g.displayDays > 0 ? Math.floor(g.displayDays) : 3), this.each(function () { var e, s, n, d, r, u, h, p, f, m, y, v, T, w, I, S, x, b, k, M, C, D, z = t(this), H = z.data(); if (H.intervalId && (clearInterval(H.intervalId), H.intervalId = null), H.vals) "reset" !== c && t.extend(H, g); else { if (s = H.opt ? H.options : g, e = Object.keys(a).reduce(function (t, i) { return Array.isArray(a[i]) ? t[i] = a[i].slice(0) : t[i] = a[i], t }, {}), H = t.extend(e, s), H.options = s, H.height = Math.round(100 * H.fontSize / 93) || H.height, H.width = Math.round(.8 * H.fontSize + .13 * H.height) || H.width, H.displayHours = !(!H.displayDays && !H.displayHours), d = { fontFamily: H.fontFamily }, H.fontSize > 0 && (d.fontSize = H.fontSize + "px"), r = H.languages[H.lang] || l[H.lang], z.addClass("timeTo").addClass("timeTo-" + H.theme).css(d), u = Math.round(H.height / 10), h = '<ul style="left:' + u + "px; top:-" + H.height + 'px"><li>0</li><li>0</li></ul></div>', p = H.fontSize ? ' style="width:' + H.width + "px; height:" + H.height + 'px;"' : ' style=""', f = '<div class="first"' + p + ">" + h, m = "<div" + p + ">" + h, y = "<span>:</span>", v = Math.round(2 * H.width + 3), T = H.captionSize || H.fontSize && Math.round(.43 * H.fontSize), w = T ? "font-size:" + T + "px;" : "", I = T ? ' style="' + w + '"' : "", S = (H.displayCaptions ? (H.displayHours ? '<figure style="max-width:' + v + 'px">$1<figcaption' + I + ">" + r.hours + "</figcaption></figure>" + y : "") + '<figure style="max-width:' + v + 'px">$1<figcaption' + I + ">" + r.min + "</figcaption></figure>" + y + '<figure style="max-width:' + v + 'px">$1<figcaption' + I + ">" + r.sec + "</figcaption></figure>" : (H.displayHours ? "$1" + y : "") + "$1" + y + "$1").replace(/\$1/g, f + m), H.displayDays > 0) { for (x = .4 * H.fontSize || a.gap, b = f, n = H.displayDays - 1; n > 0; n -= 1)b += 1 === n ? m.replace('">', "margin-right:" + Math.round(x) + 'px">') : m; S = (H.displayCaptions ? '<figure style="width:' + Math.round(H.width * H.displayDays + x + 4) + 'px">$1<figcaption style="' + w + "padding-right:" + Math.round(x) + 'px">' + r.days + "</figcaption></figure>" : "$1").replace(/\$1/, b) + S } z.html(S) } if (k = z.find("div"), k.length < H.vals.length) { for (M = H.vals.length - k.length, C = H.vals, D = H.limits, H.vals = [], H.limits = [], n = 0; n < k.length; n += 1)H.vals[n] = C[M + n], H.limits[n] = D[M + n]; H.iSec = H.vals.length - 1, H.iHour = H.vals.length - 5 } H.sec = H.seconds, z.data(H), c && o[c] ? o[c].call(z, H.seconds) : H.start ? o.start.call(z, H.seconds) : i.call(z, H.seconds) }) }, t });




/**
            * Owl Carousel v2.2.1
            * Copyright 2013-2017 David Deutsch
            * Licensed under  ()
            */
!function (a, b, c, d) { function e(b, c) { this.settings = null, this.options = a.extend({}, e.Defaults, c), this.$element = a(b), this._handlers = {}, this._plugins = {}, this._supress = {}, this._current = null, this._speed = null, this._coordinates = [], this._breakpoint = null, this._width = null, this._items = [], this._clones = [], this._mergers = [], this._widths = [], this._invalidated = {}, this._pipe = [], this._drag = { time: null, target: null, pointer: null, stage: { start: null, current: null }, direction: null }, this._states = { current: {}, tags: { initializing: ["busy"], animating: ["busy"], dragging: ["interacting"] } }, a.each(["onResize", "onThrottledResize"], a.proxy(function (b, c) { this._handlers[c] = a.proxy(this[c], this) }, this)), a.each(e.Plugins, a.proxy(function (a, b) { this._plugins[a.charAt(0).toLowerCase() + a.slice(1)] = new b(this) }, this)), a.each(e.Workers, a.proxy(function (b, c) { this._pipe.push({ filter: c.filter, run: a.proxy(c.run, this) }) }, this)), this.setup(), this.initialize() } e.Defaults = { items: 3, loop: !1, center: !1, rewind: !1, mouseDrag: !0, touchDrag: !0, pullDrag: !0, freeDrag: !1, margin: 0, stagePadding: 0, merge: !1, mergeFit: !0, autoWidth: !1, startPosition: 0, rtl: !1, smartSpeed: 250, fluidSpeed: !1, dragEndSpeed: !1, responsive: {}, responsiveRefreshRate: 200, responsiveBaseElement: b, fallbackEasing: "swing", info: !1, nestedItemSelector: !1, itemElement: "div", stageElement: "div", refreshClass: "owl-refresh", loadedClass: "owl-loaded", loadingClass: "owl-loading", rtlClass: "owl-rtl", responsiveClass: "owl-responsive", dragClass: "owl-drag", itemClass: "owl-item", stageClass: "owl-stage", stageOuterClass: "owl-stage-outer", grabClass: "owl-grab" }, e.Width = { Default: "default", Inner: "inner", Outer: "outer" }, e.Type = { Event: "event", State: "state" }, e.Plugins = {}, e.Workers = [{ filter: ["width", "settings"], run: function () { this._width = this.$element.width() } }, { filter: ["width", "items", "settings"], run: function (a) { a.current = this._items && this._items[this.relative(this._current)] } }, { filter: ["items", "settings"], run: function () { this.$stage.children(".cloned").remove() } }, { filter: ["width", "items", "settings"], run: function (a) { var b = this.settings.margin || "", c = !this.settings.autoWidth, d = this.settings.rtl, e = { width: "auto", "margin-left": d ? b : "", "margin-right": d ? "" : b }; !c && this.$stage.children().css(e), a.css = e } }, { filter: ["width", "items", "settings"], run: function (a) { var b = (this.width() / this.settings.items).toFixed(3) - this.settings.margin, c = null, d = this._items.length, e = !this.settings.autoWidth, f = []; for (a.items = { merge: !1, width: b }; d--;)c = this._mergers[d], c = this.settings.mergeFit && Math.min(c, this.settings.items) || c, a.items.merge = c > 1 || a.items.merge, f[d] = e ? b * c : this._items[d].width(); this._widths = f } }, { filter: ["items", "settings"], run: function () { var b = [], c = this._items, d = this.settings, e = Math.max(2 * d.items, 4), f = 2 * Math.ceil(c.length / 2), g = d.loop && c.length ? d.rewind ? e : Math.max(e, f) : 0, h = "", i = ""; for (g /= 2; g--;)b.push(this.normalize(b.length / 2, !0)), h += c[b[b.length - 1]][0].outerHTML, b.push(this.normalize(c.length - 1 - (b.length - 1) / 2, !0)), i = c[b[b.length - 1]][0].outerHTML + i; this._clones = b, a(h).addClass("cloned").appendTo(this.$stage), a(i).addClass("cloned").prependTo(this.$stage) } }, { filter: ["width", "items", "settings"], run: function () { for (var a = this.settings.rtl ? 1 : - 1, b = this._clones.length + this._items.length, c = - 1, d = 0, e = 0, f = []; ++c < b;)d = f[c - 1] || 0, e = this._widths[this.relative(c)] + this.settings.margin, f.push(d + e * a); this._coordinates = f } }, { filter: ["width", "items", "settings"], run: function () { var a = this.settings.stagePadding, b = this._coordinates, c = { width: Math.ceil(Math.abs(b[b.length - 1])) + 2 * a, "padding-left": a || "", "padding-right": a || "" }; this.$stage.css(c) } }, { filter: ["width", "items", "settings"], run: function (a) { var b = this._coordinates.length, c = !this.settings.autoWidth, d = this.$stage.children(); if (c && a.items.merge) for (; b--;)a.css.width = this._widths[this.relative(b)], d.eq(b).css(a.css); else c && (a.css.width = a.items.width, d.css(a.css)) } }, { filter: ["items"], run: function () { this._coordinates.length < 1 && this.$stage.removeAttr("style") } }, { filter: ["width", "items", "settings"], run: function (a) { a.current = a.current ? this.$stage.children().index(a.current) : 0, a.current = Math.max(this.minimum(), Math.min(this.maximum(), a.current)), this.reset(a.current) } }, { filter: ["position"], run: function () { this.animate(this.coordinates(this._current)) } }, { filter: ["width", "position", "items", "settings"], run: function () { var a, b, c, d, e = this.settings.rtl ? 1 : - 1, f = 2 * this.settings.stagePadding, g = this.coordinates(this.current()) + f, h = g + this.width() * e, i = []; for (c = 0, d = this._coordinates.length; c < d; c++)a = this._coordinates[c - 1] || 0, b = Math.abs(this._coordinates[c]) + f * e, (this.op(a, "<=", g) && this.op(a, ">", h) || this.op(b, "<", g) && this.op(b, ">", h)) && i.push(c); this.$stage.children(".active").removeClass("active"), this.$stage.children(":eq(" + i.join("), :eq(") + ")").addClass("active"), this.settings.center && (this.$stage.children(".center").removeClass("center"), this.$stage.children().eq(this.current()).addClass("center")) } }], e.prototype.initialize = function () { if (this.enter("initializing"), this.trigger("initialize"), this.$element.toggleClass(this.settings.rtlClass, this.settings.rtl), this.settings.autoWidth && !this.is("pre-loading")) { var b, c, e; b = this.$element.find("img"), c = this.settings.nestedItemSelector ? "." + this.settings.nestedItemSelector : d, e = this.$element.children(c).width(), b.length && e <= 0 && this.preloadAutoWidthImages(b) } this.$element.addClass(this.options.loadingClass), this.$stage = a("<" + this.settings.stageElement + ' class="' + this.settings.stageClass + '"/>').wrap('<div class="' + this.settings.stageOuterClass + '"/>'), this.$element.append(this.$stage.parent()), this.replace(this.$element.children().not(this.$stage.parent())), this.$element.is(":visible") ? this.refresh() : this.invalidate("width"), this.$element.removeClass(this.options.loadingClass).addClass(this.options.loadedClass), this.registerEventHandlers(), this.leave("initializing"), this.trigger("initialized") }, e.prototype.setup = function () { var b = this.viewport(), c = this.options.responsive, d = - 1, e = null; c ? (a.each(c, function (a) { a <= b && a > d && (d = Number(a)) }), e = a.extend({}, this.options, c[d]), "function" == typeof e.stagePadding && (e.stagePadding = e.stagePadding()), delete e.responsive, e.responsiveClass && this.$element.attr("class", this.$element.attr("class").replace(new RegExp("(" + this.options.responsiveClass + "-)\\S+\\s", "g"), "$1" + d))) : e = a.extend({}, this.options), this.trigger("change", { property: { name: "settings", value: e } }), this._breakpoint = d, this.settings = e, this.invalidate("settings"), this.trigger("changed", { property: { name: "settings", value: this.settings } }) }, e.prototype.optionsLogic = function () { this.settings.autoWidth && (this.settings.stagePadding = !1, this.settings.merge = !1) }, e.prototype.prepare = function (b) { var c = this.trigger("prepare", { content: b }); return c.data || (c.data = a("<" + this.settings.itemElement + "/>").addClass(this.options.itemClass).append(b)), this.trigger("prepared", { content: c.data }), c.data }, e.prototype.update = function () { for (var b = 0, c = this._pipe.length, d = a.proxy(function (a) { return this[a] }, this._invalidated), e = {}; b < c;)(this._invalidated.all || a.grep(this._pipe[b].filter, d).length > 0) && this._pipe[b].run(e), b++; this._invalidated = {}, !this.is("valid") && this.enter("valid") }, e.prototype.width = function (a) { switch (a = a || e.Width.Default) { case e.Width.Inner: case e.Width.Outer: return this._width; default: return this._width - 2 * this.settings.stagePadding + this.settings.margin } }, e.prototype.refresh = function () { this.enter("refreshing"), this.trigger("refresh"), this.setup(), this.optionsLogic(), this.$element.addClass(this.options.refreshClass), this.update(), this.$element.removeClass(this.options.refreshClass), this.leave("refreshing"), this.trigger("refreshed") }, e.prototype.onThrottledResize = function () { b.clearTimeout(this.resizeTimer), this.resizeTimer = b.setTimeout(this._handlers.onResize, this.settings.responsiveRefreshRate) }, e.prototype.onResize = function () { return !!this._items.length && (this._width !== this.$element.width() && (!!this.$element.is(":visible") && (this.enter("resizing"), this.trigger("resize").isDefaultPrevented() ? (this.leave("resizing"), !1) : (this.invalidate("width"), this.refresh(), this.leave("resizing"), void this.trigger("resized"))))) }, e.prototype.registerEventHandlers = function () { a.support.transition && this.$stage.on(a.support.transition.end + ".owl.core", a.proxy(this.onTransitionEnd, this)), this.settings.responsive !== !1 && this.on(b, "resize", this._handlers.onThrottledResize), this.settings.mouseDrag && (this.$element.addClass(this.options.dragClass), this.$stage.on("mousedown.owl.core", a.proxy(this.onDragStart, this)), this.$stage.on("dragstart.owl.core selectstart.owl.core", function () { return !1 })), this.settings.touchDrag && (this.$stage.on("touchstart.owl.core", a.proxy(this.onDragStart, this)), this.$stage.on("touchcancel.owl.core", a.proxy(this.onDragEnd, this))) }, e.prototype.onDragStart = function (b) { var d = null; 3 !== b.which && (a.support.transform ? (d = this.$stage.css("transform").replace(/.*\(|\)| /g, "").split(","), d = { x: d[16 === d.length ? 12 : 4], y: d[16 === d.length ? 13 : 5] }) : (d = this.$stage.position(), d = { x: this.settings.rtl ? d.left + this.$stage.width() - this.width() + this.settings.margin : d.left, y: d.top }), this.is("animating") && (a.support.transform ? this.animate(d.x) : this.$stage.stop(), this.invalidate("position")), this.$element.toggleClass(this.options.grabClass, "mousedown" === b.type), this.speed(0), this._drag.time = (new Date).getTime(), this._drag.target = a(b.target), this._drag.stage.start = d, this._drag.stage.current = d, this._drag.pointer = this.pointer(b), a(c).on("mouseup.owl.core touchend.owl.core", a.proxy(this.onDragEnd, this)), a(c).one("mousemove.owl.core touchmove.owl.core", a.proxy(function (b) { var d = this.difference(this._drag.pointer, this.pointer(b)); a(c).on("mousemove.owl.core touchmove.owl.core", a.proxy(this.onDragMove, this)), Math.abs(d.x) < Math.abs(d.y) && this.is("valid") || (b.preventDefault(), this.enter("dragging"), this.trigger("drag")) }, this))) }, e.prototype.onDragMove = function (a) { var b = null, c = null, d = null, e = this.difference(this._drag.pointer, this.pointer(a)), f = this.difference(this._drag.stage.start, e); this.is("dragging") && (a.preventDefault(), this.settings.loop ? (b = this.coordinates(this.minimum()), c = this.coordinates(this.maximum() + 1) - b, f.x = ((f.x - b) % c + c) % c + b) : (b = this.settings.rtl ? this.coordinates(this.maximum()) : this.coordinates(this.minimum()), c = this.settings.rtl ? this.coordinates(this.minimum()) : this.coordinates(this.maximum()), d = this.settings.pullDrag ? - 1 * e.x / 5 : 0, f.x = Math.max(Math.min(f.x, b + d), c + d)), this._drag.stage.current = f, this.animate(f.x)) }, e.prototype.onDragEnd = function (b) { var d = this.difference(this._drag.pointer, this.pointer(b)), e = this._drag.stage.current, f = d.x > 0 ^ this.settings.rtl ? "left" : "right"; a(c).off(".owl.core"), this.$element.removeClass(this.options.grabClass), (0 !== d.x && this.is("dragging") || !this.is("valid")) && (this.speed(this.settings.dragEndSpeed || this.settings.smartSpeed), this.current(this.closest(e.x, 0 !== d.x ? f : this._drag.direction)), this.invalidate("position"), this.update(), this._drag.direction = f, (Math.abs(d.x) > 3 || (new Date).getTime() - this._drag.time > 300) && this._drag.target.one("click.owl.core", function () { return !1 })), this.is("dragging") && (this.leave("dragging"), this.trigger("dragged")) }, e.prototype.closest = function (b, c) { var d = - 1, e = 30, f = this.width(), g = this.coordinates(); return this.settings.freeDrag || a.each(g, a.proxy(function (a, h) { return "left" === c && b > h - e && b < h + e ? d = a : "right" === c && b > h - f - e && b < h - f + e ? d = a + 1 : this.op(b, "<", h) && this.op(b, ">", g[a + 1] || h - f) && (d = "left" === c ? a + 1 : a), d === - 1 }, this)), this.settings.loop || (this.op(b, ">", g[this.minimum()]) ? d = b = this.minimum() : this.op(b, "<", g[this.maximum()]) && (d = b = this.maximum())), d }, e.prototype.animate = function (b) { var c = this.speed() > 0; this.is("animating") && this.onTransitionEnd(), c && (this.enter("animating"), this.trigger("translate")), a.support.transform3d && a.support.transition ? this.$stage.css({ transform: "translate3d(" + b + "px,0px,0px)", transition: this.speed() / 1e3 + "s" }) : c ? this.$stage.animate({ left: b + "px" }, this.speed(), this.settings.fallbackEasing, a.proxy(this.onTransitionEnd, this)) : this.$stage.css({ left: b + "px" }) }, e.prototype.is = function (a) { return this._states.current[a] && this._states.current[a] > 0 }, e.prototype.current = function (a) { if (a === d) return this._current; if (0 === this._items.length) return d; if (a = this.normalize(a), this._current !== a) { var b = this.trigger("change", { property: { name: "position", value: a } }); b.data !== d && (a = this.normalize(b.data)), this._current = a, this.invalidate("position"), this.trigger("changed", { property: { name: "position", value: this._current } }) } return this._current }, e.prototype.invalidate = function (b) { return "string" === a.type(b) && (this._invalidated[b] = !0, this.is("valid") && this.leave("valid")), a.map(this._invalidated, function (a, b) { return b }) }, e.prototype.reset = function (a) { a = this.normalize(a), a !== d && (this._speed = 0, this._current = a, this.suppress(["translate", "translated"]), this.animate(this.coordinates(a)), this.release(["translate", "translated"])) }, e.prototype.normalize = function (a, b) { var c = this._items.length, e = b ? 0 : this._clones.length; return !this.isNumeric(a) || c < 1 ? a = d : (a < 0 || a >= c + e) && (a = ((a - e / 2) % c + c) % c + e / 2), a }, e.prototype.relative = function (a) { return a -= this._clones.length / 2, this.normalize(a, !0) }, e.prototype.maximum = function (a) { var b, c, d, e = this.settings, f = this._coordinates.length; if (e.loop) f = this._clones.length / 2 + this._items.length - 1; else if (e.autoWidth || e.merge) { for (b = this._items.length, c = this._items[--b].width(), d = this.$element.width(); b-- && (c += this._items[b].width() + this.settings.margin, !(c > d));); f = b + 1 } else f = e.center ? this._items.length - 1 : this._items.length - e.items; return a && (f -= this._clones.length / 2), Math.max(f, 0) }, e.prototype.minimum = function (a) { return a ? 0 : this._clones.length / 2 }, e.prototype.items = function (a) { return a === d ? this._items.slice() : (a = this.normalize(a, !0), this._items[a]) }, e.prototype.mergers = function (a) { return a === d ? this._mergers.slice() : (a = this.normalize(a, !0), this._mergers[a]) }, e.prototype.clones = function (b) { var c = this._clones.length / 2, e = c + this._items.length, f = function (a) { return a % 2 === 0 ? e + a / 2 : c - (a + 1) / 2 }; return b === d ? a.map(this._clones, function (a, b) { return f(b) }) : a.map(this._clones, function (a, c) { return a === b ? f(c) : null }) }, e.prototype.speed = function (a) { return a !== d && (this._speed = a), this._speed }, e.prototype.coordinates = function (b) { var c, e = 1, f = b - 1; return b === d ? a.map(this._coordinates, a.proxy(function (a, b) { return this.coordinates(b) }, this)) : (this.settings.center ? (this.settings.rtl && (e = - 1, f = b + 1), c = this._coordinates[b], c += (this.width() - c + (this._coordinates[f] || 0)) / 2 * e) : c = this._coordinates[f] || 0, c = Math.ceil(c)) }, e.prototype.duration = function (a, b, c) { return 0 === c ? 0 : Math.min(Math.max(Math.abs(b - a), 1), 6) * Math.abs(c || this.settings.smartSpeed) }, e.prototype.to = function (a, b) { var c = this.current(), d = null, e = a - this.relative(c), f = (e > 0) - (e < 0), g = this._items.length, h = this.minimum(), i = this.maximum(); this.settings.loop ? (!this.settings.rewind && Math.abs(e) > g / 2 && (e += f * - 1 * g), a = c + e, d = ((a - h) % g + g) % g + h, d !== a && d - e <= i && d - e > 0 && (c = d - e, a = d, this.reset(c))) : this.settings.rewind ? (i += 1, a = (a % i + i) % i) : a = Math.max(h, Math.min(i, a)), this.speed(this.duration(c, a, b)), this.current(a), this.$element.is(":visible") && this.update() }, e.prototype.next = function (a) { a = a || !1, this.to(this.relative(this.current()) + 1, a) }, e.prototype.prev = function (a) { a = a || !1, this.to(this.relative(this.current()) - 1, a) }, e.prototype.onTransitionEnd = function (a) { if (a !== d && (a.stopPropagation(), (a.target || a.srcElement || a.originalTarget) !== this.$stage.get(0))) return !1; this.leave("animating"), this.trigger("translated") }, e.prototype.viewport = function () { var d; return this.options.responsiveBaseElement !== b ? d = a(this.options.responsiveBaseElement).width() : b.innerWidth ? d = b.innerWidth : c.documentElement && c.documentElement.clientWidth ? d = c.documentElement.clientWidth : console.warn("Can not detect viewport width."), d }, e.prototype.replace = function (b) { this.$stage.empty(), this._items = [], b && (b = b instanceof jQuery ? b : a(b)), this.settings.nestedItemSelector && (b = b.find("." + this.settings.nestedItemSelector)), b.filter(function () { return 1 === this.nodeType }).each(a.proxy(function (a, b) { b = this.prepare(b), this.$stage.append(b), this._items.push(b), this._mergers.push(1 * b.find("[data-merge]").addBack("[data-merge]").attr("data-merge") || 1) }, this)), this.reset(this.isNumeric(this.settings.startPosition) ? this.settings.startPosition : 0), this.invalidate("items") }, e.prototype.add = function (b, c) { var e = this.relative(this._current); c = c === d ? this._items.length : this.normalize(c, !0), b = b instanceof jQuery ? b : a(b), this.trigger("add", { content: b, position: c }), b = this.prepare(b), 0 === this._items.length || c === this._items.length ? (0 === this._items.length && this.$stage.append(b), 0 !== this._items.length && this._items[c - 1].after(b), this._items.push(b), this._mergers.push(1 * b.find("[data-merge]").addBack("[data-merge]").attr("data-merge") || 1)) : (this._items[c].before(b), this._items.splice(c, 0, b), this._mergers.splice(c, 0, 1 * b.find("[data-merge]").addBack("[data-merge]").attr("data-merge") || 1)), this._items[e] && this.reset(this._items[e].index()), this.invalidate("items"), this.trigger("added", { content: b, position: c }) }, e.prototype.remove = function (a) { a = this.normalize(a, !0), a !== d && (this.trigger("remove", { content: this._items[a], position: a }), this._items[a].remove(), this._items.splice(a, 1), this._mergers.splice(a, 1), this.invalidate("items"), this.trigger("removed", { content: null, position: a })) }, e.prototype.preloadAutoWidthImages = function (b) { b.each(a.proxy(function (b, c) { this.enter("pre-loading"), c = a(c), a(new Image).one("load", a.proxy(function (a) { c.attr("src", a.target.src), c.css("opacity", 1), this.leave("pre-loading"), !this.is("pre-loading") && !this.is("initializing") && this.refresh() }, this)).attr("src", c.attr("src") || c.attr("data-src") || c.attr("data-src-retina")) }, this)) }, e.prototype.destroy = function () { this.$element.off(".owl.core"), this.$stage.off(".owl.core"), a(c).off(".owl.core"), this.settings.responsive !== !1 && (b.clearTimeout(this.resizeTimer), this.off(b, "resize", this._handlers.onThrottledResize)); for (var d in this._plugins) this._plugins[d].destroy(); this.$stage.children(".cloned").remove(), this.$stage.unwrap(), this.$stage.children().contents().unwrap(), this.$stage.children().unwrap(), this.$element.removeClass(this.options.refreshClass).removeClass(this.options.loadingClass).removeClass(this.options.loadedClass).removeClass(this.options.rtlClass).removeClass(this.options.dragClass).removeClass(this.options.grabClass).attr("class", this.$element.attr("class").replace(new RegExp(this.options.responsiveClass + "-\\S+\\s", "g"), "")).removeData("owl.carousel") }, e.prototype.op = function (a, b, c) { var d = this.settings.rtl; switch (b) { case "<": return d ? a > c : a < c; case ">": return d ? a < c : a > c; case ">=": return d ? a <= c : a >= c; case "<=": return d ? a >= c : a <= c } }, e.prototype.on = function (a, b, c, d) { a.addEventListener ? a.addEventListener(b, c, d) : a.attachEvent && a.attachEvent("on" + b, c) }, e.prototype.off = function (a, b, c, d) { a.removeEventListener ? a.removeEventListener(b, c, d) : a.detachEvent && a.detachEvent("on" + b, c) }, e.prototype.trigger = function (b, c, d, f, g) { var h = { item: { count: this._items.length, index: this.current() } }, i = a.camelCase(a.grep(["on", b, d], function (a) { return a }).join("-").toLowerCase()), j = a.Event([b, "owl", d || "carousel"].join(".").toLowerCase(), a.extend({ relatedTarget: this }, h, c)); return this._supress[b] || (a.each(this._plugins, function (a, b) { b.onTrigger && b.onTrigger(j) }), this.register({ type: e.Type.Event, name: b }), this.$element.trigger(j), this.settings && "function" == typeof this.settings[i] && this.settings[i].call(this, j)), j }, e.prototype.enter = function (b) { a.each([b].concat(this._states.tags[b] || []), a.proxy(function (a, b) { this._states.current[b] === d && (this._states.current[b] = 0), this._states.current[b]++ }, this)) }, e.prototype.leave = function (b) { a.each([b].concat(this._states.tags[b] || []), a.proxy(function (a, b) { this._states.current[b]-- }, this)) }, e.prototype.register = function (b) { if (b.type === e.Type.Event) { if (a.event.special[b.name] || (a.event.special[b.name] = {}), !a.event.special[b.name].owl) { var c = a.event.special[b.name]._default; a.event.special[b.name]._default = function (a) { return !c || !c.apply || a.namespace && a.namespace.indexOf("owl") !== - 1 ? a.namespace && a.namespace.indexOf("owl") > - 1 : c.apply(this, arguments) }, a.event.special[b.name].owl = !0 } } else b.type === e.Type.State && (this._states.tags[b.name] ? this._states.tags[b.name] = this._states.tags[b.name].concat(b.tags) : this._states.tags[b.name] = b.tags, this._states.tags[b.name] = a.grep(this._states.tags[b.name], a.proxy(function (c, d) { return a.inArray(c, this._states.tags[b.name]) === d }, this))) }, e.prototype.suppress = function (b) { a.each(b, a.proxy(function (a, b) { this._supress[b] = !0 }, this)) }, e.prototype.release = function (b) { a.each(b, a.proxy(function (a, b) { delete this._supress[b] }, this)) }, e.prototype.pointer = function (a) { var c = { x: null, y: null }; return a = a.originalEvent || a || b.event, a = a.touches && a.touches.length ? a.touches[0] : a.changedTouches && a.changedTouches.length ? a.changedTouches[0] : a, a.pageX ? (c.x = a.pageX, c.y = a.pageY) : (c.x = a.clientX, c.y = a.clientY), c }, e.prototype.isNumeric = function (a) { return !isNaN(parseFloat(a)) }, e.prototype.difference = function (a, b) { return { x: a.x - b.x, y: a.y - b.y } }, a.fn.owlCarousel = function (b) { var c = Array.prototype.slice.call(arguments, 1); return this.each(function () { var d = a(this), f = d.data("owl.carousel"); f || (f = new e(this, "object" == typeof b && b), d.data("owl.carousel", f), a.each(["next", "prev", "to", "destroy", "refresh", "replace", "add", "remove"], function (b, c) { f.register({ type: e.Type.Event, name: c }), f.$element.on(c + ".owl.carousel.core", a.proxy(function (a) { a.namespace && a.relatedTarget !== this && (this.suppress([c]), f[c].apply(this, [].slice.call(arguments, 1)), this.release([c])) }, f)) })), "string" == typeof b && "_" !== b.charAt(0) && f[b].apply(f, c) }) }, a.fn.owlCarousel.Constructor = e }(window.Zepto || window.jQuery, window, document), function (a, b, c, d) { var e = function (b) { this._core = b, this._interval = null, this._visible = null, this._handlers = { "initialized.owl.carousel": a.proxy(function (a) { a.namespace && this._core.settings.autoRefresh && this.watch() }, this) }, this._core.options = a.extend({}, e.Defaults, this._core.options), this._core.$element.on(this._handlers) }; e.Defaults = { autoRefresh: !0, autoRefreshInterval: 500 }, e.prototype.watch = function () { this._interval || (this._visible = this._core.$element.is(":visible"), this._interval = b.setInterval(a.proxy(this.refresh, this), this._core.settings.autoRefreshInterval)) }, e.prototype.refresh = function () { this._core.$element.is(":visible") !== this._visible && (this._visible = !this._visible, this._core.$element.toggleClass("owl-hidden", !this._visible), this._visible && this._core.invalidate("width") && this._core.refresh()) }, e.prototype.destroy = function () { var a, c; b.clearInterval(this._interval); for (a in this._handlers) this._core.$element.off(a, this._handlers[a]); for (c in Object.getOwnPropertyNames(this)) "function" != typeof this[c] && (this[c] = null) }, a.fn.owlCarousel.Constructor.Plugins.AutoRefresh = e }(window.Zepto || window.jQuery, window, document), function (a, b, c, d) { var e = function (b) { this._core = b, this._loaded = [], this._handlers = { "initialized.owl.carousel change.owl.carousel resized.owl.carousel": a.proxy(function (b) { if (b.namespace && this._core.settings && this._core.settings.lazyLoad && (b.property && "position" == b.property.name || "initialized" == b.type)) for (var c = this._core.settings, e = c.center && Math.ceil(c.items / 2) || c.items, f = c.center && e * - 1 || 0, g = (b.property && b.property.value !== d ? b.property.value : this._core.current()) + f, h = this._core.clones().length, i = a.proxy(function (a, b) { this.load(b) }, this); f++ < e;)this.load(h / 2 + this._core.relative(g)), h && a.each(this._core.clones(this._core.relative(g)), i), g++ }, this) }, this._core.options = a.extend({}, e.Defaults, this._core.options), this._core.$element.on(this._handlers) }; e.Defaults = { lazyLoad: !1 }, e.prototype.load = function (c) { var d = this._core.$stage.children().eq(c), e = d && d.find(".owl-lazy"); !e || a.inArray(d.get(0), this._loaded) > - 1 || (e.each(a.proxy(function (c, d) { var e, f = a(d), g = b.devicePixelRatio > 1 && f.attr("data-src-retina") || f.attr("data-src"); this._core.trigger("load", { element: f, url: g }, "lazy"), f.is("img") ? f.one("load.owl.lazy", a.proxy(function () { f.css("opacity", 1), this._core.trigger("loaded", { element: f, url: g }, "lazy") }, this)).attr("src", g) : (e = new Image, e.onload = a.proxy(function () { f.css({ "background-image": 'url("' + g + '")', opacity: "1" }), this._core.trigger("loaded", { element: f, url: g }, "lazy") }, this), e.src = g) }, this)), this._loaded.push(d.get(0))) }, e.prototype.destroy = function () { var a, b; for (a in this.handlers) this._core.$element.off(a, this.handlers[a]); for (b in Object.getOwnPropertyNames(this)) "function" != typeof this[b] && (this[b] = null) }, a.fn.owlCarousel.Constructor.Plugins.Lazy = e }(window.Zepto || window.jQuery, window, document), function (a, b, c, d) { var e = function (b) { this._core = b, this._handlers = { "initialized.owl.carousel refreshed.owl.carousel": a.proxy(function (a) { a.namespace && this._core.settings.autoHeight && this.update() }, this), "changed.owl.carousel": a.proxy(function (a) { a.namespace && this._core.settings.autoHeight && "position" == a.property.name && this.update() }, this), "loaded.owl.lazy": a.proxy(function (a) { a.namespace && this._core.settings.autoHeight && a.element.closest("." + this._core.settings.itemClass).index() === this._core.current() && this.update() }, this) }, this._core.options = a.extend({}, e.Defaults, this._core.options), this._core.$element.on(this._handlers) }; e.Defaults = { autoHeight: !1, autoHeightClass: "owl-height" }, e.prototype.update = function () { var b = this._core._current, c = b + this._core.settings.items, d = this._core.$stage.children().toArray().slice(b, c), e = [], f = 0; a.each(d, function (b, c) { e.push(a(c).height()) }), f = Math.max.apply(null, e), this._core.$stage.parent().height(f).addClass(this._core.settings.autoHeightClass) }, e.prototype.destroy = function () { var a, b; for (a in this._handlers) this._core.$element.off(a, this._handlers[a]); for (b in Object.getOwnPropertyNames(this)) "function" != typeof this[b] && (this[b] = null) }, a.fn.owlCarousel.Constructor.Plugins.AutoHeight = e }(window.Zepto || window.jQuery, window, document), function (a, b, c, d) { var e = function (b) { this._core = b, this._videos = {}, this._playing = null, this._handlers = { "initialized.owl.carousel": a.proxy(function (a) { a.namespace && this._core.register({ type: "state", name: "playing", tags: ["interacting"] }) }, this), "resize.owl.carousel": a.proxy(function (a) { a.namespace && this._core.settings.video && this.isInFullScreen() && a.preventDefault() }, this), "refreshed.owl.carousel": a.proxy(function (a) { a.namespace && this._core.is("resizing") && this._core.$stage.find(".cloned .owl-video-frame").remove() }, this), "changed.owl.carousel": a.proxy(function (a) { a.namespace && "position" === a.property.name && this._playing && this.stop() }, this), "prepared.owl.carousel": a.proxy(function (b) { if (b.namespace) { var c = a(b.content).find(".owl-video"); c.length && (c.css("display", "none"), this.fetch(c, a(b.content))) } }, this) }, this._core.options = a.extend({}, e.Defaults, this._core.options), this._core.$element.on(this._handlers), this._core.$element.on("click.owl.video", ".owl-video-play-icon", a.proxy(function (a) { this.play(a) }, this)) }; e.Defaults = { video: !1, videoHeight: !1, videoWidth: !1 }, e.prototype.fetch = function (a, b) { var c = function () { return a.attr("data-vimeo-id") ? "vimeo" : a.attr("data-vzaar-id") ? "vzaar" : "youtube" }(), d = a.attr("data-vimeo-id") || a.attr("data-youtube-id") || a.attr("data-vzaar-id"), e = a.attr("data-width") || this._core.settings.videoWidth, f = a.attr("data-height") || this._core.settings.videoHeight, g = a.attr("href"); if (!g) throw new Error("Missing video URL."); if (d = g.match(/(http:|https:|)\/\/(player.|www.|app.)?(vimeo\.com|youtu(be\.com|\.be|be\.googleapis\.com)|vzaar\.com)\/(video\/|videos\/|embed\/|channels\/.+\/|groups\/.+\/|watch\?v=|v\/)?([A-Za-z0-9._%-]*)(\&\S+)?/), d[3].indexOf("youtu") > -1) c = "youtube"; else if (d[3].indexOf("vimeo") > -1) c = "vimeo"; else { if (!(d[3].indexOf("vzaar") > - 1)) throw new Error("Video URL not supported."); c = "vzaar" } d = d[6], this._videos[g] = { type: c, id: d, width: e, height: f }, b.attr("data-video", g), this.thumbnail(a, this._videos[g]) }, e.prototype.thumbnail = function (b, c) { var d, e, f, g = c.width && c.height ? 'style="width:' + c.width + "px;height:" + c.height + 'px;"' : "", h = b.find("img"), i = "src", j = "", k = this._core.settings, l = function (a) { e = '<div class="owl-video-play-icon"></div>', d = k.lazyLoad ? '<div class="owl-video-tn ' + j + '" ' + i + '="' + a + '"></div>' : '<div class="owl-video-tn" style="opacity:1;background-image:url(' + a + ')"></div>', b.after(d), b.after(e) }; if (b.wrap('<div class="owl-video-wrapper"' + g + "></div>"), this._core.settings.lazyLoad && (i = "data-src", j = "owl-lazy"), h.length) return l(h.attr(i)), h.remove(), !1; "youtube" === c.type ? (f = "//img.youtube.com/vi/" + c.id + "/hqdefault.jpg", l(f)) : "vimeo" === c.type ? a.ajax({ type: "GET", url: "//vimeo.com/api/v2/video/" + c.id + ".json", jsonp: "callback", dataType: "jsonp", success: function (a) { f = a[0].thumbnail_large, l(f) } }) : "vzaar" === c.type && a.ajax({ type: "GET", url: "//vzaar.com/api/videos/" + c.id + ".json", jsonp: "callback", dataType: "jsonp", success: function (a) { f = a.framegrab_url, l(f) } }) }, e.prototype.stop = function () { this._core.trigger("stop", null, "video"), this._playing.find(".owl-video-frame").remove(), this._playing.removeClass("owl-video-playing"), this._playing = null, this._core.leave("playing"), this._core.trigger("stopped", null, "video") }, e.prototype.play = function (b) { var c, d = a(b.target), e = d.closest("." + this._core.settings.itemClass), f = this._videos[e.attr("data-video")], g = f.width || "100%", h = f.height || this._core.$stage.height(); this._playing || (this._core.enter("playing"), this._core.trigger("play", null, "video"), e = this._core.items(this._core.relative(e.index())), this._core.reset(e.index()), "youtube" === f.type ? c = '<iframe width="' + g + '" height="' + h + '" src="//www.youtube.com/embed/' + f.id + "?autoplay=1&rel=0&v=" + f.id + '" frameborder="0" allowfullscreen></iframe>' : "vimeo" === f.type ? c = '<iframe src="//player.vimeo.com/video/' + f.id + '?autoplay=1" width="' + g + '" height="' + h + '" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>' : "vzaar" === f.type && (c = '<iframe frameborder="0"height="' + h + '"width="' + g + '" allowfullscreen mozallowfullscreen webkitAllowFullScreen src="//view.vzaar.com/' + f.id + '/player?autoplay=true"></iframe>'), a('<div class="owl-video-frame">' + c + "</div>").insertAfter(e.find(".owl-video")), this._playing = e.addClass("owl-video-playing")) }, e.prototype.isInFullScreen = function () { var b = c.fullscreenElement || c.mozFullScreenElement || c.webkitFullscreenElement; return b && a(b).parent().hasClass("owl-video-frame") }, e.prototype.destroy = function () { var a, b; this._core.$element.off("click.owl.video"); for (a in this._handlers) this._core.$element.off(a, this._handlers[a]); for (b in Object.getOwnPropertyNames(this)) "function" != typeof this[b] && (this[b] = null) }, a.fn.owlCarousel.Constructor.Plugins.Video = e }(window.Zepto || window.jQuery, window, document), function (a, b, c, d) {
    var e = function (b) { this.core = b, this.core.options = a.extend({}, e.Defaults, this.core.options), this.swapping = !0, this.previous = d, this.next = d, this.handlers = { "change.owl.carousel": a.proxy(function (a) { a.namespace && "position" == a.property.name && (this.previous = this.core.current(), this.next = a.property.value) }, this), "drag.owl.carousel dragged.owl.carousel translated.owl.carousel": a.proxy(function (a) { a.namespace && (this.swapping = "translated" == a.type) }, this), "translate.owl.carousel": a.proxy(function (a) { a.namespace && this.swapping && (this.core.options.animateOut || this.core.options.animateIn) && this.swap() }, this) }, this.core.$element.on(this.handlers) }; e.Defaults = { animateOut: !1, animateIn: !1 }, e.prototype.swap = function () { if (1 === this.core.settings.items && a.support.animation && a.support.transition) { this.core.speed(0); var b, c = a.proxy(this.clear, this), d = this.core.$stage.children().eq(this.previous), e = this.core.$stage.children().eq(this.next), f = this.core.settings.animateIn, g = this.core.settings.animateOut; this.core.current() !== this.previous && (g && (b = this.core.coordinates(this.previous) - this.core.coordinates(this.next), d.one(a.support.animation.end, c).css({ left: b + "px" }).addClass("animated owl-animated-out").addClass(g)), f && e.one(a.support.animation.end, c).addClass("animated owl-animated-in").addClass(f)) } }, e.prototype.clear = function (b) { a(b.target).css({ left: "" }).removeClass("animated owl-animated-out owl-animated-in").removeClass(this.core.settings.animateIn).removeClass(this.core.settings.animateOut), this.core.onTransitionEnd() }, e.prototype.destroy = function () { var a, b; for (a in this.handlers) this.core.$element.off(a, this.handlers[a]); for (b in Object.getOwnPropertyNames(this)) "function" != typeof this[b] && (this[b] = null) },
        a.fn.owlCarousel.Constructor.Plugins.Animate = e
}(window.Zepto || window.jQuery, window, document), function (a, b, c, d) { var e = function (b) { this._core = b, this._timeout = null, this._paused = !1, this._handlers = { "changed.owl.carousel": a.proxy(function (a) { a.namespace && "settings" === a.property.name ? this._core.settings.autoplay ? this.play() : this.stop() : a.namespace && "position" === a.property.name && this._core.settings.autoplay && this._setAutoPlayInterval() }, this), "initialized.owl.carousel": a.proxy(function (a) { a.namespace && this._core.settings.autoplay && this.play() }, this), "play.owl.autoplay": a.proxy(function (a, b, c) { a.namespace && this.play(b, c) }, this), "stop.owl.autoplay": a.proxy(function (a) { a.namespace && this.stop() }, this), "mouseover.owl.autoplay": a.proxy(function () { this._core.settings.autoplayHoverPause && this._core.is("rotating") && this.pause() }, this), "mouseleave.owl.autoplay": a.proxy(function () { this._core.settings.autoplayHoverPause && this._core.is("rotating") && this.play() }, this), "touchstart.owl.core": a.proxy(function () { this._core.settings.autoplayHoverPause && this._core.is("rotating") && this.pause() }, this), "touchend.owl.core": a.proxy(function () { this._core.settings.autoplayHoverPause && this.play() }, this) }, this._core.$element.on(this._handlers), this._core.options = a.extend({}, e.Defaults, this._core.options) }; e.Defaults = { autoplay: !1, autoplayTimeout: 5e3, autoplayHoverPause: !1, autoplaySpeed: !1 }, e.prototype.play = function (a, b) { this._paused = !1, this._core.is("rotating") || (this._core.enter("rotating"), this._setAutoPlayInterval()) }, e.prototype._getNextTimeout = function (d, e) { return this._timeout && b.clearTimeout(this._timeout), b.setTimeout(a.proxy(function () { this._paused || this._core.is("busy") || this._core.is("interacting") || c.hidden || this._core.next(e || this._core.settings.autoplaySpeed) }, this), d || this._core.settings.autoplayTimeout) }, e.prototype._setAutoPlayInterval = function () { this._timeout = this._getNextTimeout() }, e.prototype.stop = function () { this._core.is("rotating") && (b.clearTimeout(this._timeout), this._core.leave("rotating")) }, e.prototype.pause = function () { this._core.is("rotating") && (this._paused = !0) }, e.prototype.destroy = function () { var a, b; this.stop(); for (a in this._handlers) this._core.$element.off(a, this._handlers[a]); for (b in Object.getOwnPropertyNames(this)) "function" != typeof this[b] && (this[b] = null) }, a.fn.owlCarousel.Constructor.Plugins.autoplay = e }(window.Zepto || window.jQuery, window, document), function (a, b, c, d) { "use strict"; var e = function (b) { this._core = b, this._initialized = !1, this._pages = [], this._controls = {}, this._templates = [], this.$element = this._core.$element, this._overrides = { next: this._core.next, prev: this._core.prev, to: this._core.to }, this._handlers = { "prepared.owl.carousel": a.proxy(function (b) { b.namespace && this._core.settings.dotsData && this._templates.push('<div class="' + this._core.settings.dotClass + '">' + a(b.content).find("[data-dot]").addBack("[data-dot]").attr("data-dot") + "</div>") }, this), "added.owl.carousel": a.proxy(function (a) { a.namespace && this._core.settings.dotsData && this._templates.splice(a.position, 0, this._templates.pop()) }, this), "remove.owl.carousel": a.proxy(function (a) { a.namespace && this._core.settings.dotsData && this._templates.splice(a.position, 1) }, this), "changed.owl.carousel": a.proxy(function (a) { a.namespace && "position" == a.property.name && this.draw() }, this), "initialized.owl.carousel": a.proxy(function (a) { a.namespace && !this._initialized && (this._core.trigger("initialize", null, "navigation"), this.initialize(), this.update(), this.draw(), this._initialized = !0, this._core.trigger("initialized", null, "navigation")) }, this), "refreshed.owl.carousel": a.proxy(function (a) { a.namespace && this._initialized && (this._core.trigger("refresh", null, "navigation"), this.update(), this.draw(), this._core.trigger("refreshed", null, "navigation")) }, this) }, this._core.options = a.extend({}, e.Defaults, this._core.options), this.$element.on(this._handlers) }; e.Defaults = { nav: !1, navText: ["prev", "next"], navSpeed: !1, navElement: "div", navContainer: !1, navContainerClass: "owl-nav", navClass: ["owl-prev", "owl-next"], slideBy: 1, dotClass: "owl-dot", dotsClass: "owl-dots", dots: !0, dotsEach: !1, dotsData: !1, dotsSpeed: !1, dotsContainer: !1 }, e.prototype.initialize = function () { var b, c = this._core.settings; this._controls.$relative = (c.navContainer ? a(c.navContainer) : a("<div>").addClass(c.navContainerClass).appendTo(this.$element)).addClass("disabled"), this._controls.$previous = a("<" + c.navElement + ">").addClass(c.navClass[0]).html(c.navText[0]).prependTo(this._controls.$relative).on("click", a.proxy(function (a) { this.prev(c.navSpeed) }, this)), this._controls.$next = a("<" + c.navElement + ">").addClass(c.navClass[1]).html(c.navText[1]).appendTo(this._controls.$relative).on("click", a.proxy(function (a) { this.next(c.navSpeed) }, this)), c.dotsData || (this._templates = [a("<div>").addClass(c.dotClass).append(a("<span>")).prop("outerHTML")]), this._controls.$absolute = (c.dotsContainer ? a(c.dotsContainer) : a("<div>").addClass(c.dotsClass).appendTo(this.$element)).addClass("disabled"), this._controls.$absolute.on("click", "div", a.proxy(function (b) { var d = a(b.target).parent().is(this._controls.$absolute) ? a(b.target).index() : a(b.target).parent().index(); b.preventDefault(), this.to(d, c.dotsSpeed) }, this)); for (b in this._overrides) this._core[b] = a.proxy(this[b], this) }, e.prototype.destroy = function () { var a, b, c, d; for (a in this._handlers) this.$element.off(a, this._handlers[a]); for (b in this._controls) this._controls[b].remove(); for (d in this.overides) this._core[d] = this._overrides[d]; for (c in Object.getOwnPropertyNames(this)) "function" != typeof this[c] && (this[c] = null) }, e.prototype.update = function () { var a, b, c, d = this._core.clones().length / 2, e = d + this._core.items().length, f = this._core.maximum(!0), g = this._core.settings, h = g.center || g.autoWidth || g.dotsData ? 1 : g.dotsEach || g.items; if ("page" !== g.slideBy && (g.slideBy = Math.min(g.slideBy, g.items)), g.dots || "page" == g.slideBy) for (this._pages = [], a = d, b = 0, c = 0; a < e; a++) { if (b >= h || 0 === b) { if (this._pages.push({ start: Math.min(f, a - d), end: a - d + h - 1 }), Math.min(f, a - d) === f) break; b = 0, ++c } b += this._core.mergers(this._core.relative(a)) } }, e.prototype.draw = function () { var b, c = this._core.settings, d = this._core.items().length <= c.items, e = this._core.relative(this._core.current()), f = c.loop || c.rewind; this._controls.$relative.toggleClass("disabled", !c.nav || d), c.nav && (this._controls.$previous.toggleClass("disabled", !f && e <= this._core.minimum(!0)), this._controls.$next.toggleClass("disabled", !f && e >= this._core.maximum(!0))), this._controls.$absolute.toggleClass("disabled", !c.dots || d), c.dots && (b = this._pages.length - this._controls.$absolute.children().length, c.dotsData && 0 !== b ? this._controls.$absolute.html(this._templates.join("")) : b > 0 ? this._controls.$absolute.append(new Array(b + 1).join(this._templates[0])) : b < 0 && this._controls.$absolute.children().slice(b).remove(), this._controls.$absolute.find(".active").removeClass("active"), this._controls.$absolute.children().eq(a.inArray(this.current(), this._pages)).addClass("active")) }, e.prototype.onTrigger = function (b) { var c = this._core.settings; b.page = { index: a.inArray(this.current(), this._pages), count: this._pages.length, size: c && (c.center || c.autoWidth || c.dotsData ? 1 : c.dotsEach || c.items) } }, e.prototype.current = function () { var b = this._core.relative(this._core.current()); return a.grep(this._pages, a.proxy(function (a, c) { return a.start <= b && a.end >= b }, this)).pop() }, e.prototype.getPosition = function (b) { var c, d, e = this._core.settings; return "page" == e.slideBy ? (c = a.inArray(this.current(), this._pages), d = this._pages.length, b ? ++c : --c, c = this._pages[(c % d + d) % d].start) : (c = this._core.relative(this._core.current()), d = this._core.items().length, b ? c += e.slideBy : c -= e.slideBy), c }, e.prototype.next = function (b) { a.proxy(this._overrides.to, this._core)(this.getPosition(!0), b) }, e.prototype.prev = function (b) { a.proxy(this._overrides.to, this._core)(this.getPosition(!1), b) }, e.prototype.to = function (b, c, d) { var e; !d && this._pages.length ? (e = this._pages.length, a.proxy(this._overrides.to, this._core)(this._pages[(b % e + e) % e].start, c)) : a.proxy(this._overrides.to, this._core)(b, c) }, a.fn.owlCarousel.Constructor.Plugins.Navigation = e }(window.Zepto || window.jQuery, window, document), function (a, b, c, d) { "use strict"; var e = function (c) { this._core = c, this._hashes = {}, this.$element = this._core.$element, this._handlers = { "initialized.owl.carousel": a.proxy(function (c) { c.namespace && "URLHash" === this._core.settings.startPosition && a(b).trigger("hashchange.owl.navigation") }, this), "prepared.owl.carousel": a.proxy(function (b) { if (b.namespace) { var c = a(b.content).find("[data-hash]").addBack("[data-hash]").attr("data-hash"); if (!c) return; this._hashes[c] = b.content } }, this), "changed.owl.carousel": a.proxy(function (c) { if (c.namespace && "position" === c.property.name) { var d = this._core.items(this._core.relative(this._core.current())), e = a.map(this._hashes, function (a, b) { return a === d ? b : null }).join(); if (!e || b.location.hash.slice(1) === e) return; b.location.hash = e } }, this) }, this._core.options = a.extend({}, e.Defaults, this._core.options), this.$element.on(this._handlers), a(b).on("hashchange.owl.navigation", a.proxy(function (a) { var c = b.location.hash.substring(1), e = this._core.$stage.children(), f = this._hashes[c] && e.index(this._hashes[c]); f !== d && f !== this._core.current() && this._core.to(this._core.relative(f), !1, !0) }, this)) }; e.Defaults = { URLhashListener: !1 }, e.prototype.destroy = function () { var c, d; a(b).off("hashchange.owl.navigation"); for (c in this._handlers) this._core.$element.off(c, this._handlers[c]); for (d in Object.getOwnPropertyNames(this)) "function" != typeof this[d] && (this[d] = null) }, a.fn.owlCarousel.Constructor.Plugins.Hash = e }(window.Zepto || window.jQuery, window, document), function (a, b, c, d) { function e(b, c) { var e = !1, f = b.charAt(0).toUpperCase() + b.slice(1); return a.each((b + " " + h.join(f + " ") + f).split(" "), function (a, b) { if (g[b] !== d) return e = !c || b, !1 }), e } function f(a) { return e(a, !0) } var g = a("<support>").get(0).style, h = "Webkit Moz O ms".split(" "), i = { transition: { end: { WebkitTransition: "webkitTransitionEnd", MozTransition: "transitionend", OTransition: "oTransitionEnd", transition: "transitionend" } }, animation: { end: { WebkitAnimation: "webkitAnimationEnd", MozAnimation: "animationend", OAnimation: "oAnimationEnd", animation: "animationend" } } }, j = { csstransforms: function () { return !!e("transform") }, csstransforms3d: function () { return !!e("perspective") }, csstransitions: function () { return !!e("transition") }, cssanimations: function () { return !!e("animation") } }; j.csstransitions() && (a.support.transition = new String(f("transition")), a.support.transition.end = i.transition.end[a.support.transition]), j.cssanimations() && (a.support.animation = new String(f("animation")), a.support.animation.end = i.animation.end[a.support.animation]), j.csstransforms() && (a.support.transform = new String(f("transform")), a.support.transform3d = j.csstransforms3d()) }(window.Zepto || window.jQuery, window, document);



!function (t) { if ("object" == typeof exports && "undefined" != typeof module) module.exports = t(); else if ("function" == typeof define && define.amd) define([], t); else { ("undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof self ? self : this).Parallax = t() } }(function () { return function t(e, i, n) { function o(r, a) { if (!i[r]) { if (!e[r]) { var l = "function" == typeof require && require; if (!a && l) return l(r, !0); if (s) return s(r, !0); var h = new Error("Cannot find module '" + r + "'"); throw h.code = "MODULE_NOT_FOUND", h } var u = i[r] = { exports: {} }; e[r][0].call(u.exports, function (t) { var i = e[r][1][t]; return o(i || t) }, u, u.exports, t, e, i, n) } return i[r].exports } for (var s = "function" == typeof require && require, r = 0; r < n.length; r++)o(n[r]); return o }({ 1: [function (t, e, i) { "use strict"; function n(t) { if (null === t || void 0 === t) throw new TypeError("Object.assign cannot be called with null or undefined"); return Object(t) } var o = Object.getOwnPropertySymbols, s = Object.prototype.hasOwnProperty, r = Object.prototype.propertyIsEnumerable; e.exports = function () { try { if (!Object.assign) return !1; var t = new String("abc"); if (t[5] = "de", "5" === Object.getOwnPropertyNames(t)[0]) return !1; for (var e = {}, i = 0; i < 10; i++)e["_" + String.fromCharCode(i)] = i; if ("0123456789" !== Object.getOwnPropertyNames(e).map(function (t) { return e[t] }).join("")) return !1; var n = {}; return "abcdefghijklmnopqrst".split("").forEach(function (t) { n[t] = t }), "abcdefghijklmnopqrst" === Object.keys(Object.assign({}, n)).join("") } catch (t) { return !1 } }() ? Object.assign : function (t, e) { for (var i, a, l = n(t), h = 1; h < arguments.length; h++) { i = Object(arguments[h]); for (var u in i) s.call(i, u) && (l[u] = i[u]); if (o) { a = o(i); for (var c = 0; c < a.length; c++)r.call(i, a[c]) && (l[a[c]] = i[a[c]]) } } return l } }, {}], 2: [function (t, e, i) { (function (t) { (function () { var i, n, o, s, r, a; "undefined" != typeof performance && null !== performance && performance.now ? e.exports = function () { return performance.now() } : void 0 !== t && null !== t && t.hrtime ? (e.exports = function () { return (i() - r) / 1e6 }, n = t.hrtime, s = (i = function () { var t; return 1e9 * (t = n())[0] + t[1] })(), a = 1e9 * t.uptime(), r = s - a) : Date.now ? (e.exports = function () { return Date.now() - o }, o = Date.now()) : (e.exports = function () { return (new Date).getTime() - o }, o = (new Date).getTime()) }).call(this) }).call(this, t("_process")) }, { _process: 3 }], 3: [function (t, e, i) { function n() { throw new Error("setTimeout has not been defined") } function o() { throw new Error("clearTimeout has not been defined") } function s(t) { if (c === setTimeout) return setTimeout(t, 0); if ((c === n || !c) && setTimeout) return c = setTimeout, setTimeout(t, 0); try { return c(t, 0) } catch (e) { try { return c.call(null, t, 0) } catch (e) { return c.call(this, t, 0) } } } function r(t) { if (d === clearTimeout) return clearTimeout(t); if ((d === o || !d) && clearTimeout) return d = clearTimeout, clearTimeout(t); try { return d(t) } catch (e) { try { return d.call(null, t) } catch (e) { return d.call(this, t) } } } function a() { v && p && (v = !1, p.length ? f = p.concat(f) : y = -1, f.length && l()) } function l() { if (!v) { var t = s(a); v = !0; for (var e = f.length; e;) { for (p = f, f = []; ++y < e;)p && p[y].run(); y = -1, e = f.length } p = null, v = !1, r(t) } } function h(t, e) { this.fun = t, this.array = e } function u() { } var c, d, m = e.exports = {}; !function () { try { c = "function" == typeof setTimeout ? setTimeout : n } catch (t) { c = n } try { d = "function" == typeof clearTimeout ? clearTimeout : o } catch (t) { d = o } }(); var p, f = [], v = !1, y = -1; m.nextTick = function (t) { var e = new Array(arguments.length - 1); if (arguments.length > 1) for (var i = 1; i < arguments.length; i++)e[i - 1] = arguments[i]; f.push(new h(t, e)), 1 !== f.length || v || s(l) }, h.prototype.run = function () { this.fun.apply(null, this.array) }, m.title = "browser", m.browser = !0, m.env = {}, m.argv = [], m.version = "", m.versions = {}, m.on = u, m.addListener = u, m.once = u, m.off = u, m.removeListener = u, m.removeAllListeners = u, m.emit = u, m.prependListener = u, m.prependOnceListener = u, m.listeners = function (t) { return [] }, m.binding = function (t) { throw new Error("process.binding is not supported") }, m.cwd = function () { return "/" }, m.chdir = function (t) { throw new Error("process.chdir is not supported") }, m.umask = function () { return 0 } }, {}], 4: [function (t, e, i) { (function (i) { for (var n = t("performance-now"), o = "undefined" == typeof window ? i : window, s = ["moz", "webkit"], r = "AnimationFrame", a = o["request" + r], l = o["cancel" + r] || o["cancelRequest" + r], h = 0; !a && h < s.length; h++)a = o[s[h] + "Request" + r], l = o[s[h] + "Cancel" + r] || o[s[h] + "CancelRequest" + r]; if (!a || !l) { var u = 0, c = 0, d = []; a = function (t) { if (0 === d.length) { var e = n(), i = Math.max(0, 1e3 / 60 - (e - u)); u = i + e, setTimeout(function () { var t = d.slice(0); d.length = 0; for (var e = 0; e < t.length; e++)if (!t[e].cancelled) try { t[e].callback(u) } catch (t) { setTimeout(function () { throw t }, 0) } }, Math.round(i)) } return d.push({ handle: ++c, callback: t, cancelled: !1 }), c }, l = function (t) { for (var e = 0; e < d.length; e++)d[e].handle === t && (d[e].cancelled = !0) } } e.exports = function (t) { return a.call(o, t) }, e.exports.cancel = function () { l.apply(o, arguments) }, e.exports.polyfill = function () { o.requestAnimationFrame = a, o.cancelAnimationFrame = l } }).call(this, "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {}) }, { "performance-now": 2 }], 5: [function (t, e, i) { "use strict"; function n(t, e) { if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function") } var o = function () { function t(t, e) { for (var i = 0; i < e.length; i++) { var n = e[i]; n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(t, n.key, n) } } return function (e, i, n) { return i && t(e.prototype, i), n && t(e, n), e } }(), s = t("raf"), r = t("object-assign"), a = { propertyCache: {}, vendors: [null, ["-webkit-", "webkit"], ["-moz-", "Moz"], ["-o-", "O"], ["-ms-", "ms"]], clamp: function (t, e, i) { return e < i ? t < e ? e : t > i ? i : t : t < i ? i : t > e ? e : t }, data: function (t, e) { return a.deserialize(t.getAttribute("data-" + e)) }, deserialize: function (t) { return "true" === t || "false" !== t && ("null" === t ? null : !isNaN(parseFloat(t)) && isFinite(t) ? parseFloat(t) : t) }, camelCase: function (t) { return t.replace(/-+(.)?/g, function (t, e) { return e ? e.toUpperCase() : "" }) }, accelerate: function (t) { a.css(t, "transform", "translate3d(0,0,0) rotate(0.0001deg)"), a.css(t, "transform-style", "preserve-3d"), a.css(t, "backface-visibility", "hidden") }, transformSupport: function (t) { for (var e = document.createElement("div"), i = !1, n = null, o = !1, s = null, r = null, l = 0, h = a.vendors.length; l < h; l++)if (null !== a.vendors[l] ? (s = a.vendors[l][0] + "transform", r = a.vendors[l][1] + "Transform") : (s = "transform", r = "transform"), void 0 !== e.style[r]) { i = !0; break } switch (t) { case "2D": o = i; break; case "3D": if (i) { var u = document.body || document.createElement("body"), c = document.documentElement, d = c.style.overflow, m = !1; document.body || (m = !0, c.style.overflow = "hidden", c.appendChild(u), u.style.overflow = "hidden", u.style.background = ""), u.appendChild(e), e.style[r] = "translate3d(1px,1px,1px)", o = void 0 !== (n = window.getComputedStyle(e).getPropertyValue(s)) && n.length > 0 && "none" !== n, c.style.overflow = d, u.removeChild(e), m && (u.removeAttribute("style"), u.parentNode.removeChild(u)) } }return o }, css: function (t, e, i) { var n = a.propertyCache[e]; if (!n) for (var o = 0, s = a.vendors.length; o < s; o++)if (n = null !== a.vendors[o] ? a.camelCase(a.vendors[o][1] + "-" + e) : e, void 0 !== t.style[n]) { a.propertyCache[e] = n; break } t.style[n] = i } }, l = { relativeInput: !1, clipRelativeInput: !1, inputElement: null, hoverOnly: !1, calibrationThreshold: 100, calibrationDelay: 500, supportDelay: 500, calibrateX: !1, calibrateY: !0, invertX: !0, invertY: !0, limitX: !1, limitY: !1, scalarX: 10, scalarY: 10, frictionX: .1, frictionY: .1, originX: .5, originY: .5, pointerEvents: !1, precision: 1, onReady: null, selector: null }, h = function () { function t(e, i) { n(this, t), this.element = e; var o = { calibrateX: a.data(this.element, "calibrate-x"), calibrateY: a.data(this.element, "calibrate-y"), invertX: a.data(this.element, "invert-x"), invertY: a.data(this.element, "invert-y"), limitX: a.data(this.element, "limit-x"), limitY: a.data(this.element, "limit-y"), scalarX: a.data(this.element, "scalar-x"), scalarY: a.data(this.element, "scalar-y"), frictionX: a.data(this.element, "friction-x"), frictionY: a.data(this.element, "friction-y"), originX: a.data(this.element, "origin-x"), originY: a.data(this.element, "origin-y"), pointerEvents: a.data(this.element, "pointer-events"), precision: a.data(this.element, "precision"), relativeInput: a.data(this.element, "relative-input"), clipRelativeInput: a.data(this.element, "clip-relative-input"), hoverOnly: a.data(this.element, "hover-only"), inputElement: document.querySelector(a.data(this.element, "input-element")), selector: a.data(this.element, "selector") }; for (var s in o) null === o[s] && delete o[s]; r(this, l, o, i), this.inputElement || (this.inputElement = this.element), this.calibrationTimer = null, this.calibrationFlag = !0, this.enabled = !1, this.depthsX = [], this.depthsY = [], this.raf = null, this.bounds = null, this.elementPositionX = 0, this.elementPositionY = 0, this.elementWidth = 0, this.elementHeight = 0, this.elementCenterX = 0, this.elementCenterY = 0, this.elementRangeX = 0, this.elementRangeY = 0, this.calibrationX = 0, this.calibrationY = 0, this.inputX = 0, this.inputY = 0, this.motionX = 0, this.motionY = 0, this.velocityX = 0, this.velocityY = 0, this.onMouseMove = this.onMouseMove.bind(this), this.onDeviceOrientation = this.onDeviceOrientation.bind(this), this.onDeviceMotion = this.onDeviceMotion.bind(this), this.onOrientationTimer = this.onOrientationTimer.bind(this), this.onMotionTimer = this.onMotionTimer.bind(this), this.onCalibrationTimer = this.onCalibrationTimer.bind(this), this.onAnimationFrame = this.onAnimationFrame.bind(this), this.onWindowResize = this.onWindowResize.bind(this), this.windowWidth = null, this.windowHeight = null, this.windowCenterX = null, this.windowCenterY = null, this.windowRadiusX = null, this.windowRadiusY = null, this.portrait = !1, this.desktop = !navigator.userAgent.match(/(iPhone|iPod|iPad|Android|BlackBerry|BB10|mobi|tablet|opera mini|nexus 7)/i), this.motionSupport = !!window.DeviceMotionEvent && !this.desktop, this.orientationSupport = !!window.DeviceOrientationEvent && !this.desktop, this.orientationStatus = 0, this.motionStatus = 0, this.initialise() } return o(t, [{ key: "initialise", value: function () { void 0 === this.transform2DSupport && (this.transform2DSupport = a.transformSupport("2D"), this.transform3DSupport = a.transformSupport("3D")), this.transform3DSupport && a.accelerate(this.element), "static" === window.getComputedStyle(this.element).getPropertyValue("position") && (this.element.style.position = "relative"), this.pointerEvents || (this.element.style.pointerEvents = "none"), this.updateLayers(), this.updateDimensions(), this.enable(), this.queueCalibration(this.calibrationDelay) } }, { key: "doReadyCallback", value: function () { this.onReady && this.onReady() } }, { key: "updateLayers", value: function () { this.selector ? this.layers = this.element.querySelectorAll(this.selector) : this.layers = this.element.children, this.layers.length || console.warn("ParallaxJS: Your scene does not have any layers."), this.depthsX = [], this.depthsY = []; for (var t = 0; t < this.layers.length; t++) { var e = this.layers[t]; this.transform3DSupport && a.accelerate(e), e.style.position = t ? "absolute" : "relative", e.style.display = "block", e.style.left = 0, e.style.top = 0; var i = a.data(e, "depth") || 0; this.depthsX.push(a.data(e, "depth-x") || i), this.depthsY.push(a.data(e, "depth-y") || i) } } }, { key: "updateDimensions", value: function () { this.windowWidth = window.innerWidth, this.windowHeight = window.innerHeight, this.windowCenterX = this.windowWidth * this.originX, this.windowCenterY = this.windowHeight * this.originY, this.windowRadiusX = Math.max(this.windowCenterX, this.windowWidth - this.windowCenterX), this.windowRadiusY = Math.max(this.windowCenterY, this.windowHeight - this.windowCenterY) } }, { key: "updateBounds", value: function () { this.bounds = this.inputElement.getBoundingClientRect(), this.elementPositionX = this.bounds.left, this.elementPositionY = this.bounds.top, this.elementWidth = this.bounds.width, this.elementHeight = this.bounds.height, this.elementCenterX = this.elementWidth * this.originX, this.elementCenterY = this.elementHeight * this.originY, this.elementRangeX = Math.max(this.elementCenterX, this.elementWidth - this.elementCenterX), this.elementRangeY = Math.max(this.elementCenterY, this.elementHeight - this.elementCenterY) } }, { key: "queueCalibration", value: function (t) { clearTimeout(this.calibrationTimer), this.calibrationTimer = setTimeout(this.onCalibrationTimer, t) } }, { key: "enable", value: function () { this.enabled || (this.enabled = !0, this.orientationSupport ? (this.portrait = !1, window.addEventListener("deviceorientation", this.onDeviceOrientation), this.detectionTimer = setTimeout(this.onOrientationTimer, this.supportDelay)) : this.motionSupport ? (this.portrait = !1, window.addEventListener("devicemotion", this.onDeviceMotion), this.detectionTimer = setTimeout(this.onMotionTimer, this.supportDelay)) : (this.calibrationX = 0, this.calibrationY = 0, this.portrait = !1, window.addEventListener("mousemove", this.onMouseMove), this.doReadyCallback()), window.addEventListener("resize", this.onWindowResize), this.raf = s(this.onAnimationFrame)) } }, { key: "disable", value: function () { this.enabled && (this.enabled = !1, this.orientationSupport ? window.removeEventListener("deviceorientation", this.onDeviceOrientation) : this.motionSupport ? window.removeEventListener("devicemotion", this.onDeviceMotion) : window.removeEventListener("mousemove", this.onMouseMove), window.removeEventListener("resize", this.onWindowResize), s.cancel(this.raf)) } }, { key: "calibrate", value: function (t, e) { this.calibrateX = void 0 === t ? this.calibrateX : t, this.calibrateY = void 0 === e ? this.calibrateY : e } }, { key: "invert", value: function (t, e) { this.invertX = void 0 === t ? this.invertX : t, this.invertY = void 0 === e ? this.invertY : e } }, { key: "friction", value: function (t, e) { this.frictionX = void 0 === t ? this.frictionX : t, this.frictionY = void 0 === e ? this.frictionY : e } }, { key: "scalar", value: function (t, e) { this.scalarX = void 0 === t ? this.scalarX : t, this.scalarY = void 0 === e ? this.scalarY : e } }, { key: "limit", value: function (t, e) { this.limitX = void 0 === t ? this.limitX : t, this.limitY = void 0 === e ? this.limitY : e } }, { key: "origin", value: function (t, e) { this.originX = void 0 === t ? this.originX : t, this.originY = void 0 === e ? this.originY : e } }, { key: "setInputElement", value: function (t) { this.inputElement = t, this.updateDimensions() } }, { key: "setPosition", value: function (t, e, i) { e = e.toFixed(this.precision) + "px", i = i.toFixed(this.precision) + "px", this.transform3DSupport ? a.css(t, "transform", "translate3d(" + e + "," + i + ",0)") : this.transform2DSupport ? a.css(t, "transform", "translate(" + e + "," + i + ")") : (t.style.left = e, t.style.top = i) } }, { key: "onOrientationTimer", value: function () { this.orientationSupport && 0 === this.orientationStatus ? (this.disable(), this.orientationSupport = !1, this.enable()) : this.doReadyCallback() } }, { key: "onMotionTimer", value: function () { this.motionSupport && 0 === this.motionStatus ? (this.disable(), this.motionSupport = !1, this.enable()) : this.doReadyCallback() } }, { key: "onCalibrationTimer", value: function () { this.calibrationFlag = !0 } }, { key: "onWindowResize", value: function () { this.updateDimensions() } }, { key: "onAnimationFrame", value: function () { this.updateBounds(); var t = this.inputX - this.calibrationX, e = this.inputY - this.calibrationY; (Math.abs(t) > this.calibrationThreshold || Math.abs(e) > this.calibrationThreshold) && this.queueCalibration(0), this.portrait ? (this.motionX = this.calibrateX ? e : this.inputY, this.motionY = this.calibrateY ? t : this.inputX) : (this.motionX = this.calibrateX ? t : this.inputX, this.motionY = this.calibrateY ? e : this.inputY), this.motionX *= this.elementWidth * (this.scalarX / 100), this.motionY *= this.elementHeight * (this.scalarY / 100), isNaN(parseFloat(this.limitX)) || (this.motionX = a.clamp(this.motionX, -this.limitX, this.limitX)), isNaN(parseFloat(this.limitY)) || (this.motionY = a.clamp(this.motionY, -this.limitY, this.limitY)), this.velocityX += (this.motionX - this.velocityX) * this.frictionX, this.velocityY += (this.motionY - this.velocityY) * this.frictionY; for (var i = 0; i < this.layers.length; i++) { var n = this.layers[i], o = this.depthsX[i], r = this.depthsY[i], l = this.velocityX * (o * (this.invertX ? -1 : 1)), h = this.velocityY * (r * (this.invertY ? -1 : 1)); this.setPosition(n, l, h) } this.raf = s(this.onAnimationFrame) } }, { key: "rotate", value: function (t, e) { var i = (t || 0) / 30, n = (e || 0) / 30, o = this.windowHeight > this.windowWidth; this.portrait !== o && (this.portrait = o, this.calibrationFlag = !0), this.calibrationFlag && (this.calibrationFlag = !1, this.calibrationX = i, this.calibrationY = n), this.inputX = i, this.inputY = n } }, { key: "onDeviceOrientation", value: function (t) { var e = t.beta, i = t.gamma; null !== e && null !== i && (this.orientationStatus = 1, this.rotate(e, i)) } }, { key: "onDeviceMotion", value: function (t) { var e = t.rotationRate.beta, i = t.rotationRate.gamma; null !== e && null !== i && (this.motionStatus = 1, this.rotate(e, i)) } }, { key: "onMouseMove", value: function (t) { var e = t.clientX, i = t.clientY; if (this.hoverOnly && (e < this.elementPositionX || e > this.elementPositionX + this.elementWidth || i < this.elementPositionY || i > this.elementPositionY + this.elementHeight)) return this.inputX = 0, void (this.inputY = 0); this.relativeInput ? (this.clipRelativeInput && (e = Math.max(e, this.elementPositionX), e = Math.min(e, this.elementPositionX + this.elementWidth), i = Math.max(i, this.elementPositionY), i = Math.min(i, this.elementPositionY + this.elementHeight)), this.elementRangeX && this.elementRangeY && (this.inputX = (e - this.elementPositionX - this.elementCenterX) / this.elementRangeX, this.inputY = (i - this.elementPositionY - this.elementCenterY) / this.elementRangeY)) : this.windowRadiusX && this.windowRadiusY && (this.inputX = (e - this.windowCenterX) / this.windowRadiusX, this.inputY = (i - this.windowCenterY) / this.windowRadiusY) } }, { key: "destroy", value: function () { this.disable(), clearTimeout(this.calibrationTimer), clearTimeout(this.detectionTimer), this.element.removeAttribute("style"); for (var t = 0; t < this.layers.length; t++)this.layers[t].removeAttribute("style"); delete this.element, delete this.layers } }, { key: "version", value: function () { return "3.1.0" } }]), t }(); e.exports = h }, { "object-assign": 1, raf: 4 }] }, {}, [5])(5) });
//# sourceMappingURL=parallax.min.js.map


!function (t, i) { "function" == typeof define && define.amd ? define(["jquery"], i) : "object" == typeof module && "object" == typeof module.exports ? module.exports = i(require("jquery")) : i(t.jQuery) }(this, function (t) { "use strict"; function i(t, i) { return typeof t === i } function e(t, i) { return !!~("" + t).indexOf(i) } function s(t, i) { for (var s in t) { var o = t[s]; if (!e(o, "-") && void 0 !== p[o]) return "pfx" == i ? o : !0 } return !1 } function o(t, e, s) { for (var o in t) { var n = e[t[o]]; if (void 0 !== n) return s === !1 ? t[o] : i(n, "function") ? n.bind(s || e) : n } return !1 } function n(t, e, n) { var r = t.charAt(0).toUpperCase() + t.slice(1), h = (t + " " + H.join(r + " ") + r).split(" "); return i(e, "string") || i(e, "undefined") ? s(h, e) : (h = (t + " " + w.join(r + " ") + r).split(" "), o(h, e, n)) } var r, h, l = { image: null, imageAttribute: "image", holderClass: "imageHolder", imgClass: "img-holder-img", container: t("body"), windowObject: t(window), speed: .2, coverRatio: .75, holderMinHeight: 200, holderMaxHeight: null, extraHeight: 0, mediaWidth: 1600, mediaHeight: 900, parallax: !0, touch: !1 }, a = "imageScroll", d = "plugin_" + a, c = function (t, i) { return function () { return t.apply(i, arguments) } }, g = {}, m = document.documentElement, f = "imageScrollModernizr", u = document.createElement(f), p = u.style, v = "Webkit Moz O ms", H = v.split(" "), w = v.toLowerCase().split(" "), b = {}, y = 0, x = "", $ = function (t, i, e, s) { var o, n, r, h, l = document.createElement("div"), a = document.body, d = a || document.createElement("body"); if (parseInt(e, 10)) for (; e--;)r = document.createElement("div"), r.id = s ? s[e] : f + (e + 1), l.appendChild(r); return o = ["&#173;", '<style id="s', f, '">', t, "</style>"].join(""), l.id = f, (a ? l : d).innerHTML += o, d.appendChild(l), a || (d.style.background = "", d.style.overflow = "hidden", h = m.style.overflow, m.style.overflow = "hidden", m.appendChild(d)), n = i(l, t), a ? l.parentNode.removeChild(l) : (d.parentNode.removeChild(d), m.style.overflow = h), !!n }; return b.csstransforms = function () { return !!n("transform") }, b.csstransforms3d = function () { var t = !!n("perspective"); return t && "webkitPerspective" in m.style && $("@media (transform-3d),(-webkit-transform-3d){#imageScrollModernizr{left:9px;position:absolute;height:3px;}}", function (i) { t = 9 === i.offsetLeft && 3 === i.offsetHeight }), t }, g.prefixed = function (t, i, e) { return i ? n(t, i, e) : n(t, "pfx") }, window.requestAnimationFrame = g.prefixed("requestAnimationFrame", window) || function (t) { var i = (new Date).getTime(), e = Math.max(0, 16 - (i - y)), s = window.setTimeout(function () { t(i + e) }, e); return y = i + e, s }, b.csstransforms3d() ? x = "csstransforms3d" : b.csstransforms() && (x = "csstransforms"), "" !== x && (h = g.prefixed("transform")), r = function (i, e) { this.$imageHolder = t(i), this.settings = t.extend({}, l, e), this.image = this.$imageHolder.data(this.settings.imageAttribute) || this.settings.image, this.mediaWidth = this.$imageHolder.data("width") || this.settings.mediaWidth, this.mediaHeight = this.$imageHolder.data("height") || this.settings.mediaHeight, this.coverRatio = this.$imageHolder.data("cover-ratio") || this.settings.coverRatio, this.holderMinHeight = this.$imageHolder.data("min-height") || this.settings.holderMinHeight, this.holderMaxHeight = this.$imageHolder.data("max-height") || this.settings.holderMaxHeight, this.extraHeight = this.$imageHolder.data("extra-height") || this.settings.extraHeight, this.ticking = !1, this.refresh = c(this.refresh, this), this._onScroll = c(this._onScroll, this), this._defaults = l, this._name = a, this.init() }, t.extend(r.prototype, { constructor: r, init: function () { if (!this.image) throw new Error("You need to provide either a data-img attr or an image option"); this.$scrollingElement = t("<img/>", { src: this.image }).addClass(this.settings.imgClass), this.settings.touch === !0 ? this.$scrollingElement.css({ maxWidth: "100%" }).prependTo(this.$imageHolder) : this.settings.parallax === !0 ? (this.$scrollerHolder = t("<div/>", { html: this.$imageHolder.html() }).css({ top: 0, visibility: "hidden", position: "fixed", overflow: "hidden" }).addClass(this.settings.holderClass).prependTo(this.settings.container), this.$imageHolder.css("visibility", "hidden").empty(), this.$scrollingElement.css({ position: "absolute", top: 0, left: 0, visibility: "hidden", maxWidth: "none" }).prependTo(this.$scrollerHolder)) : (this.$scrollerHolder = this.$imageHolder.css({ overflow: "hidden" }), this.$scrollingElement.css({ position: "relative", overflow: "hidden" }).prependTo(this.$imageHolder)), this.settings.touch === !1 && (this._bindEvents(), this.refresh()) }, _adjustImgHolderHeights: function () { var t, i, e, s, o, n, r, h, l, a = this.settings.windowObject.height(), d = this.settings.windowObject.width() - this.settings.container.offset().left, c = this.coverRatio * a; c = null === this.holderMaxHeight || this.holderMaxHeight > c ? Math.floor(c) : this.holderMaxHeight, c = this.holderMinHeight < c ? Math.floor(c) : this.holderMinHeight, c += this.extraHeight, h = Math.floor(a - (a - c) * this.settings.speed), n = Math.round(this.mediaWidth * (h / this.mediaHeight)), n >= d ? r = h : (n = d, r = Math.round(this.mediaHeight * (n / this.mediaWidth))), l = h - c, o = a + c, s = 2 * a * (1 - this.settings.speed) - l, t = -(l / 2 + (r - h) / 2), i = Math.round((n - d) * -.5), e = t - s / 2, this.$scrollingElement.css({ height: r, width: n }), this.$imageHolder.height(c), this.$scrollerHolder.css({ height: c, width: n }), this.scrollingState = { winHeight: a, fromY: e, imgTopPos: t, imgLeftPos: i, imgHolderHeight: c, imgScrollingDistance: s, travelDistance: o, holderDistanceFromTop: this.$imageHolder.offset().top - this.settings.windowObject.scrollTop() } }, _bindEvents: function () { this.settings.windowObject.on("resize", this.refresh), this.settings.parallax === !0 && this.settings.windowObject.on("scroll", this._onScroll) }, _unBindEvents: function () { this.settings.windowObject.off("resize", this.refresh), this.settings.parallax === !0 && this.settings.windowObject.off("scroll", this._onScroll) }, _onScroll: function () { this.scrollingState.holderDistanceFromTop = this.$imageHolder.offset().top - this.settings.windowObject.scrollTop(), this._requestTick() }, _requestTick: function () { var t = this; this.ticking || (this.ticking = !0, requestAnimationFrame(function () { t._updatePositions() })) }, _updatePositions: function () { if (this.scrollingState.holderDistanceFromTop <= this.scrollingState.winHeight && this.scrollingState.holderDistanceFromTop >= -this.scrollingState.imgHolderHeight) { var t = this.scrollingState.holderDistanceFromTop + this.scrollingState.imgHolderHeight, i = t / this.scrollingState.travelDistance, e = Math.round(this.scrollingState.fromY + this.scrollingState.imgScrollingDistance * (1 - i)), s = this.settings.container.offset().left; this.$scrollerHolder.css(this._getCSSObject({ transform: h, left: s, x: Math.ceil(this.scrollingState.imgLeftPos) + ("" === x && s > 0 ? s : 0), y: Math.round(this.scrollingState.holderDistanceFromTop), visibility: "visible" })), this.$scrollingElement.css(this._getCSSObject({ transform: h, x: 0, y: e, visibility: "visible" })) } else this.$scrollerHolder.css({ visibility: "hidden" }), this.$scrollingElement.css({ visibility: "hidden" }); this.ticking = !1 }, _updateFallbackPositions: function () { this.$scrollerHolder.css({ width: "100%" }), this.$scrollingElement.css({ top: this.scrollingState.imgTopPos, left: this.scrollingState.imgLeftPos }) }, _getCSSObject: function (t) { return "csstransforms3d" === x ? t.transform = "translate3d(" + t.x + "px, " + t.y + "px, 0)" : "csstransforms" === x ? t.transform = "translate(" + t.x + "px, " + t.y + "px)" : (t.top = t.y, t.left = t.x), delete t.x, delete t.y, t }, enable: function () { this.settings.touch === !1 && (this._bindEvents(), this.refresh()) }, disable: function () { this.settings.touch === !1 && this._unBindEvents() }, refresh: function () { this.settings.touch === !1 && (this._adjustImgHolderHeights(), this.settings.parallax === !0 ? this._requestTick() : this._updateFallbackPositions()) }, destroy: function () { this.settings.touch === !1 && this._unBindEvents(), this.settings.touch === !0 ? (this.$imageHolder.removeAttr("style"), this.$scrollingElement.remove()) : this.settings.parallax === !0 ? (this.$scrollerHolder.find("." + this.settings.imgClass).remove(), this.$imageHolder.css({ visibility: "visible", height: "auto" }).html(this.$scrollerHolder.html()), this.$scrollerHolder.remove()) : (this.$imageHolder.css({ overflow: "auto" }).removeAttr("style"), this.$scrollingElement.remove()), this.$imageHolder.removeData() } }), t.fn[a] = function (i) { return void 0 === i || "object" == typeof i ? this.each(function () { t.data(this, d) || t.data(this, d, new r(this, i)) }) : "string" == typeof i && "_" !== i[0] && "init" !== i ? this.each(function () { var e = t.data(this, d); e instanceof r && "function" == typeof e[i] && e[i].apply(e, Array.prototype.slice.call(arguments, 1)) }) : void 0 }, t.fn[a].defaults = r.defaults = l, t.fn[a].Plugin = r, r });

;
var swiped = false;
var toggleLoginMenu = 0;
var UserInfo;
var sala_sofas = [];
var recaptchaContactos = null, recaptchaColegios = null, recaptchaSorteos = null;
viewportfix();

$(window).resize(function () {
    detectaresolucion();
});

$(document).ready(function () {
    generalInit();
    switch ($("body").attr("id")) {
        case "cartelera_pelicula":
            initCartelera(); break;
        case "ficha_pelicula":
            initPelicula(); break;
        case "ficha_eventos":
            initPelicula(); break;
        case "ficha_cine":
            initCine(); break;
        case "promos":
            initPromos(); break;
        case "promos_landing":
            initPromosLanding(); break;
        case "mapa":
            initMapaCines(); break;
        case "proximos_estrenos":
            initProxEstreno(); break;
        case "home":
            initHome(); break;
        case "trailers_cartelera":
            initTrailers("cartelera"); break;
        case "trailers_estrenos":
            initTrailers("estrenos"); break;
        case "eventos":
            initEventos(); break;
        case "cinesacard":
            initCinesacard();
            break;
        case "cc_form":
            initccform(); break;
        case "cc_form_activar":
            initccform_activar(); break;
        case "cc_micuenta":
            initmicuenta(); break;
        case "trabajaconnosotros":
            initTrabajaconnosotros(); break;
        case "clientes":
            initContacta(); break;
        case "isens":
            initIsens(); break;
        case "imax":
            initImax(); break;
        case "screenX":
            initScreenX(); break;
        case "luxe":
            initLuxe(); break;
        case "ciclos":
            initCiclos(); break;
        case "infantil":
            initInfantil(); break;
        case "colegios":
            initColegios(); break;
        case "cc_form_finpedir":
            initCCBienvenido(); break;
        case "cinesacheck":
            initCinesacheck(); break;
        case "semueve":
            initSemueve(); break;
        case "recuperarmail":
            initUURecupera(); break;
        case "ma_resumen":
            initUUResumen(); break;
        case "ganaentradas":
            initPreestrenos(); break;
        case "games":
            initGames(); break;
        case "GoldenQ":
            initGoldenQ(); break;
        case "dolby":
            initDolby(); break;
        case "lordbobina":
            initLordBobina(); break;
        case "kingsman":
            initkingsman(); break;
        case "alta_ccard":
            initAltaCCard();
            break;
        case "faq":
            initFaq();
            break;
        case "apps": initApps(); break;
        case "comingsoon": initComingSoon(); break;
        case "oscars": initOscars(); break;
        case "empleados": initEmpleados(); break;
        case "elladodelafuerza": initElladodelafuerza(); break;
        case "faqsreapertura": initFaqsReapertura(); break;
        case "sorteos": initSorteos(); break;
    }
    hashclick();
    //uaEvent = function(a="",b="",c=""){
    //    alert(a+" " +b+ " " +c);
    //}
    resize();
    initCinesRedirect();
});

function hasConsent(consentType) {
    if (typeof (OnetrustActiveGroups) != "undefined") {
        var flag = true;
        $.each(consentType, function () {
            switch (String(this)) {
                case "Performance":
                    if (!/,C0002,/.test(OnetrustActiveGroups)) {
                        flag = false;
                    }
                    break;
                case "Functional":
                    if (!/,C0003,/.test(OnetrustActiveGroups)) {
                        flag = false;
                    }
                    break;
                case "Social Media":
                    if (!/,C0005,/.test(OnetrustActiveGroups)) {
                        flag = false;
                    }
                    break;
                case "Targeting":
                    if (!/,C0004,/.test(OnetrustActiveGroups)) {
                        flag = false;
                    }
                    break;
                default:
                    flag = false;
            }
        });
        return flag;
    } else {
        return false;
    }
}

function initFaqsReapertura() {
    $(".fr-content h2").parent().addClass("fr-close");
    $(".fr-desplegable h3").parent().addClass("fr-close");

    $(".fr-content h2").on("touch click", function () {
        $(this).parent().toggleClass("fr-close");
    });
    $(".fr-desplegable h3").on("touch click", function () {
        $(this).parent().toggleClass("fr-close");
    });
}

function initFaq() {
    $(".user_container h3, .ccard_container h3").on("touch click", function () {
        var that = $(this).parent();
        that.toggleClass("open");
        that.find(".pregunta").removeClass("open");
    });

    $("#faq .pregunta").on("touch click", function () {
        $(this).toggleClass("open");
    });
}

function initAltaCCard() {
    $(".landing_btn").click(function (e) {
        e.preventDefault();
        if ($(this).hasClass("reg_btn")) {
            return false;
        }
        if (Object.keys(objUser).length) {
            if (userIsCinesaCard()) {
                customalert(localization.yadisponesdecc);
                return false;
            }
        }
        if ($("#cinefavorito_header").hasClass("logged")) {
            //rellenaDatosCC("alta");
            //popupShow("pop_registro_3_alta", true);
            $("a.link-ccard").click();
        } else {
            popupShow("pop_login_ccard_alta", true);
        }
    });

    var premios = {};
    if (country.toLowerCase() == "es") {
        premios =
            {
                "Bar": [
                    {
                        "Detail": "Palomitas 45 gr",
                        "Points": "60",
                        "img": "BAR-28.png"
                    },
                    {
                        "Detail": "-50% Menú Cinesacard. Palomitas medianas + refresco de 0,5l",
                        "Points": "60",
                        "img": "BAR-27.png"
                    },
                    {
                        "Detail": "Agua",
                        "Points": "80",
                        "img": "BAR-30.png" //No encaja
                    },
                    {
                        "Detail": "Refresco 0,5l",
                        "Points": "100",
                        "img": "BAR-29.png"
                    },
                    {
                        "Detail": "Menú Cinesacard. Palomitas medianas + refresco de 0,5l",
                        "Points": "180",
                        "img": "BAR-26.png"
                    }
                ],
                "Descuentos": [
                    {
                        "Detail": "Entrada a precio de día del espectador*",
                        "Points": "60",
                        "img": "LUNES-JUEVES-18.png"
                    }
                ],
                "Entradas": [
                    {
                        "Detail": "1 Entrada*",
                        "Points": "220",
                        "img": "DIAS-LABORABLES-10.png"
                    },
                    {
                        "Detail": "1 Entrada 3D*",
                        "Points": "300",
                        "img": "DIAS-LABORABLES-13.png"
                    },
                    {
                        "Detail": "1 Entrada IMAX o ISENS*",
                        "Points": "260",
                        "img": "DIAS-LABORABLES-12.png"
                    },
                    {
                        "Detail": "1 Entrada 3D IMAX o ISENS*",
                        "Points": "340",
                        "img": "DIAS-LABORABLES-11.png"
                    },
                    {
                        "Detail": "1 Entrada",
                        "Points": "340",
                        "img": "FIN-SEMANA-02.png"
                    },
                    {
                        "Detail": "1 Entrada 3D",
                        "Points": "440",
                        "img": "FIN-SEMANA-05.png"
                    },
                    {
                        "Detail": "1 Entrada IMAX o ISENS",
                        "Points": "400",
                        "img": "FIN-SEMANA-04.png"
                    },
                    {
                        "Detail": "1 Entrada 3D IMAX o ISENS",
                        "Points": "480",
                        "img": "FIN-SEMANA-03.png"
                    }
                ],
                "Entradas + Bar": [
                    {
                        "Detail": "1 Entrada + Menú Cinesacard*",
                        "Points": "360",
                        "img": "LUNES-JUEVES-25.png"
                    },
                    {
                        "Detail": "1 Entrada 3D + Menú Cinesacard*",
                        "Points": "440",
                        "img": "LUNES-JUEVES-22.png"
                    },
                    {
                        "Detail": "1 Entrada IMAX o ISENS + Menú Cinesacard*",
                        "Points": "400",
                        "img": "LUNES-JUEVES-23.png"
                    },
                    {
                        "Detail": "1 Entrada 3D IMAX o ISENS + Menú Cinesacard*",
                        "Points": "500",
                        "img": "LUNES-JUEVES-24.png"
                    },
                    {
                        "Detail": "1 Entrada + Menú Cinesacard",
                        "Points": "420",
                        "img": "FIN-SEMANA-09.png"
                    },
                    {
                        "Detail": "1 Entrada 3D + Menú Cinesacard",
                        "Points": "520",
                        "img": "FIN-SEMANA-06.png"
                    },
                    {
                        "Detail": "1 Entrada IMAX o ISENS + Menú Cinesacard",
                        "Points": "480",
                        "img": "FIN-SEMANA-07.png"
                    },
                    {
                        "Detail": "1 Entrada 3D IMAX o ISENS + Menú Cinesacard",
                        "Points": "560",
                        "img": "FIN-SEMANA-08.png"
                    }
                ]
            }
    }
    if (country.toLowerCase() == "pt") {
        premios =
            {
                "Bar": [
                    {
                        "Detail": "Pipocas 45g",
                        "Points": "60",
                        "img": "BAR-28.png"
                    },
                    {
                        "Detail": "50%dto.Menu Uci Card. Pipocas médias + refresco 50cl",
                        "Points": "60",
                        "img": "BAR-27.png"
                    },
                    {
                        "Detail": "Água",
                        "Points": "80",
                        "img": "BAR-30.png" //No encaja
                    },
                    {
                        "Detail": "Refresco 0,5l",
                        "Points": "100",
                        "img": "BAR-29.png"
                    },
                    {
                        "Detail": "Menu UCI Card. Pipocas médias + refresco 0,5l",
                        "Points": "180",
                        "img": "BAR-26.png"
                    }
                ],
                "Descontos": [
                    {
                        "Detail": "Bilhete a preço de dia do espectador*",
                        "Points": "60",
                        "img": "DIAS-LABORABLES-10.png"
                    }
                ],
                "Bilhetes": [
                    {
                        "Detail": "1 Bilhete*",
                        "Points": "220",
                        "img": "DIAS-LABORABLES-10.png"
                    },
                    {
                        "Detail": "1 Bilhete 3D*",
                        "Points": "300",
                        "img": "DIAS-LABORABLES-13.png"
                    },
                    {
                        "Detail": "1 Bilhete",
                        "Points": "340",
                        "img": "FIN-SEMANA-02.png"
                    },
                    {
                        "Detail": "1 Bilhete 3D",
                        "Points": "440",
                        "img": "FIN-SEMANA-05.png"
                    }
                ],
                "Entradas + Bar": [
                    {
                        "Detail": "1 Bilhete + Menu UCI Card*",
                        "Points": "360",
                        "img": "DIAS-LABORABLES-17.png"
                    },
                    {
                        "Detail": "1 Bilhete 3D + Menu UCI Card*",
                        "Points": "440",
                        "img": "DIAS-LABORABLES-14.png"
                    },
                    {
                        "Detail": "1 Bilhete + Menu UCI Card",
                        "Points": "420",
                        "img": "FIN-SEMANA-09.png"
                    },
                    {
                        "Detail": "1 Bilhete 3D + Menu UCI Card",
                        "Points": "520",
                        "img": "FIN-SEMANA-06.png"
                    }
                ]
            }
    }
    var premiosHTML = "<ul>";
    $.each(premios, function (k, v) {
        //var isFirst = true;
        $.each(v, function () {
            var i = this;
            premiosHTML += '<li class="gift">';
            //premiosHTML += '		<div class="gift_titulo"><span class='+(isFirst?"":'"hidden"')+'>'+ k +'</span></div>';
            premiosHTML += '		<div class="gift_titulo"><span>' + k + '</span></div>';
            premiosHTML += '        <div class="gift_img" style="background-image: url(\'/Content/img/premios/' + i.img + '\');"></div>';
            premiosHTML += '		<div class="gift_rollhover"><span>' + i.Detail + '</span></div>';
            premiosHTML += '		<div class="gift_puntos">' + i.Points + ' ' + localization.puntos + '</div > ';
            premiosHTML += '</li>';
            //isFirst = false;
        });
    });
    premiosHTML += '</ul>';
    $("#g_container").html(premiosHTML);

    $("#btn_g_container").click(function (e) {
        e.preventDefault();
        $("#g_container").addClass("open");
        $("#btn_g_container").addClass("hidden");
    });
    $("#btn_landing_promos").click(function (e) {
        e.preventDefault();
        $("#landing_promos").addClass("open");
        $("#btn_landing_promos").addClass("hidden");
    });
    fixPremios();


    $("#alta_ccard .premiosContainer > a").click(function (e) {
        e.preventDefault();
        $(this).addClass("hidden");
        $("#alta_ccard .premiosContainer").removeClass("hidden");
    });

}

function initLordBobina() {
    $("#lordbobina_form").submit(function () {
        if ($("#lb_privacidad").is(":checked")) {
            if ($("#lordbobina_form input[name=lb_nombre]").val() && $("#lordbobina_form input[name=lb_apellido]").val() && $("#lordbobina_form input[name=lb_email]").val()) {
                var nombrecompleto = ($("#lordbobina_form input[name=lb_nombre]").val() + " " + $("#lordbobina_form input[name=lb_apellido]").val() + " " + $("#lordbobina_form input[name=lb_sapellido]").val()).trim();
                document.location = "http://cinesa.emsecure.net/optiext/optiextension.dll?ID=PbkPncATsRO2cgfTNMIB46VdGeQ0suZ5rlfxCrEBRvwffGq5yjKVjS_TFWUsU3GzeNwSsfg8zw4GhU38ny" + "&NAME=" + encodeURIComponent(nombrecompleto) + "&MAIL=" + $("#lordbobina_form input[name=lb_email]").val();
            } else {
                customalert("Els camps amb * són obligatoris");
            }
        } else {
            customalert("Has d'acceptar la politica de privadesa per continuar");
        }
        return false;
    });
}

function initDolby() {
    $("#trailerhome").addClass("hidden");
    $(".dolby_carrousel .play").click(function (e) {
        e.preventDefault();
        $("#trailerhome").removeClass("hidden");
        var trailer = $(this).attr("data-playlist");
        trailerHome(trailer);
    });

    $('.dolby_carrousel ul').carouFredSel({
        prev: '.img_left',
        next: '.img_right',
        auto: {
            timeoutDuration: 5000,
            pauseOnHover: "immediate"
        },
        responsive: true,
        scroll: {
            items: 1
        },
        pagination: ".radios",
        swipe: {
            onMouse: true,
            onTouch: true
        }
    });

    $("#trailerhome").on("click", ".fp-close", function (e) {
        //$("#trailerhome").flowplayer().stop();
        //$("#trailerhome").flowplayer().unload();
        videojs("trailerhome_video").dispose();
        $('.video_wrapper').html('');
        $("#trailerhome").addClass("closed"); //.hide();
        //$("#trailerhome>div").not('[class^="fp"]').remove();
        $('#carousel').trigger("play", true);
        $("#trailerhome").addClass("hidden");
    });

    $("#trailerhome").height($(".dolby_carrousel").height());
    
}

function initPreestrenos() {

    var isFB = "0";
    var URL = window.location.toString().toUpperCase();
    if (URL.indexOf("-FB") != -1) {
        isFB = "1";
    }

    //TEMPORAL
    //isFB = "1";

    $("#ganaentradas .frm1 input").change(function () {
        if (!$(this).parents("li").hasClass("disabled")) {
            $.post("/Preestrenos/CineSelected/" + $("#prestrenoid").val(), { cine: $(this).val() }, function (result) {
                $("#response_nombre").html(result.nombre);
                $("#response_dia").html(result.dia);
                $("#response_hora").html(result.hora);
                $("#cineselected").val(result.cine);
                $(".gana1 .frm2").removeClass("hidden");
                /*$(".ganaentradas .frm1").removeClass("activo").addClass("inactivo");*/
            });
        }
    });

    $("#ganaentradas form.gana1").submit(function () {
        if (($("#Email").val() != "") &&
            ($("#DNI").val() != "") &&
            ($("#Nombre").val() != "") &&
            ($("#Apellidos").val() != "")) {
            var USER_EMAIL = $(".frm2 input[name=email_entrada]").val();
            var ID_SELLIGENT_INPUT = "Imr09QFgkiYlSD3kOdStIcZUsKOvTe_Yz9hKBEAGr7QyjuYIqRURDP0eqGRrnTkkqYhWVyO_EW_IIk";
            var u = '/Preestrenos/checkSelligentUser/?e=' + USER_EMAIL + '&u=' + ID_SELLIGENT_INPUT + '&f=' + isFB;
            $.get(u, function (data) {
                if (data.indexOf("__OK__") > -1) {
                    $.post("/Preestrenos/Submit/" + $("#prestrenoid").val(), {
                        Email: $(".frm2 input[name=email_entrada]").val(), DNI: $(".frm2 input[name=dni_entrada]").val(),
                        Nombre: $(".frm2 input[name=nombre_entrada]").val(), Apellidos: $(".frm2 input[name=apellidos_entrada]").val(),
                        CC: $(".frm2 input[name=cinesacard_entrada]").val(), cineselected: $("#cineselected").val()
                    }, function (result) {
                        $("#ganaentradas .frm2 input").attr("disabled", "disabled");
                        if (result.error) {
                            if (result.error == 1) {
                                $("#ganaentradas .frm3").removeClass("hidden");
                                $(".ge_nok").removeClass("hidden");
                            } else {
                                customalert(result.mensaje);
                                $("#ganaentradas .frm2 input").removeAttr("disabled");
                            }
                        }
                        if (result.codigo) {
                            $("#ganaentradas .frm3").removeClass("hidden").addClass("activo");
                            $(".ge_ok").removeClass("hidden");
                            $(".frm3 form").attr("action", "/Preestrenos/Imprimir/" + $("#prestrenoid").val());
                            $("#codigo_entrada").val(result.codigo);
                            $('html, body').animate({
                                scrollTop: $(".frm3").offset().top
                            }, 700);
                        }
                    });
                } else {
                    customalert("Debes introducir el email al cual se te envió la invitación");
                }
            });
        } else {
            customalert(localization.camposconasteriscos);
        }
        return false;
    });
}

function initUUResumen() {
    getConsents("cambiodatos", "misdatos");
    if ($("#haspass").val() == "N") {
        $(".cambiopass").addClass("hidden");
    }

    $(".vfb_info").click(function () {
        if ($(this).hasClass("open")) {
            $(this).removeClass("open");
        } else {
            $(this).addClass("open");
        }
    });

    $("#fbsetpass").change(function () {
        //$("#r-fbsetpass").removeClass("pop_ok");
        $("#r-fbsetpass").removeClass("pop_bad");
        $(this).removeClass("pop_ok");
        $(this).removeClass("pop_bad");
        $(".pop_error[data-errorfor=fbsetpass]").html("");
        $(".pop_password .pop_btn").attr("disabled", "disabled");
        if (_validaPass($(this).val()) == "OK") {
            $(this).addClass("pop_ok");
            if ($("#r-fbsetpass").val() == "") {
                return;
            }
            if (($("#r-fbsetpass").val() != "") && ($("#fbsetpass").val() != $("#r-fbsetpass").val())) {
                $("#r-fbsetpass").addClass("pop_bad");
                $(".pop_error[data-errorfor=fbsetpass]").html(localization.contrasenascoincidir);
            } else {
                $(".pop_error[data-errorfor=fbsetpass]").html("");
                $(".pop_password .pop_btn").removeAttr("disabled");
            }
        } else {
            $(this).addClass("pop_bad");
        }
    });

    $("#r-fbsetpass").change(function () {
        //$("#fbsetpass").removeClass("pop_ok");
        $("#fbsetpass").removeClass("pop_bad");
        $(this).removeClass("pop_ok");
        $(this).removeClass("pop_bad");
        $(".pop_error[data-errorfor=fbsetpass]").html("");
        $(".pop_password .pop_btn").attr("disabled", "disabled");
        if (_validaPass($(this).val()) == "OK") {
            $(this).addClass("pop_ok");
            if ($("#fbsetpass").val() == "") {
                return;
            }
            if (($("#fbsetpass").val() != "") && ($("#fbsetpass").val() != $("#r-fbsetpass").val())) {
                $("#fbsetpass").addClass("pop_bad");
                $(".pop_error[data-errorfor=fbsetpass]").html(localization.contrasenascoincidir);
            } else {
                $(".pop_error[data-errorfor=fbsetpass]").html("");
                $(".pop_password .pop_btn").removeAttr("disabled");
            }
        } else {
            $(this).addClass("pop_bad");
        }
    });

    $(".pop_password form").submit(function () {
        $.post("/CinesaUser/FBUnlink", { id: $("#fbunlinkid").val(), pass: $("#fbsetpass").val() }, function (data) {
            $(".vinculo_fb>p").html(localization.novinculadofbhtml);
            $(".tucuenta .foto img").removeClass("hidden");
            $(".tucuenta .foto").css("background-image", "none");
            $(".cambiopass").removeClass("hidden");
            $("#haspass").val("Y");
            $(".pop_mask").addClass("hidden");
            $(".pop_password").addClass("hidden");
        });
        return false;
    });

    $("#enlazarloginfb").change(function () {
        if ($(this).is(":checked")) {
            FB.login(function (response) {
                if (response.authResponse) {
                    _fbat = response.authResponse.accessToken;
                    _fbid = response.authResponse.userID;
                    getfbdata(_fbat, function (fbdata) {
                        $.post("/CinesaUser/FBLink", { at: _fbat, id: _fbid }, function (data) {
                            if (data.UserSetSocialNetworkInformationResponse.returnCode == 0 || data.UserSetSocialNetworkInformationResponse.returnCode == "0") {
                                var enlacefb = "http://www.facebook.com/" + _fbid;
                                $(".vinculo_fb>p").html(localization.vinculado + " <a target=\"_blank\" href=\"" + enlacefb + "\">" + enlacefb + "</a>");
                                $("#fbunlinkid").val(_fbid);
                                $(".tucuenta .foto").css("background-image", "url(http://graph.facebook.com/" + _fbid + "/picture?type=large)");
                                $(".tucuenta .foto img").addClass("hidden");
                            } else {
                                customalert(data.UserMergeCCResponse.returnDescription);
                            }
                        });
                    });
                }
            }, { scope: 'email' });
        } else {
            if ($("#haspass").val() == "Y") {
                $.post("/CinesaUser/FBUnlink", { id: $("#fbunlinkid").val() }, function (data) {
                    $(".vinculo_fb>p").html(localization.novinculadofbhtml);
                    $(".tucuenta .foto img").removeClass("hidden");
                    $(".tucuenta .foto").css("background-image", "none");
                });
            } else {
                $(".pop_mask").removeClass("hidden");
                $(".pop_password").removeClass("hidden");
            }
        }
    });
    $("#recibirnews").change(function () {
        if ($(this).is(":checked")) {
            $(".newsletter").addClass("hidden");
            $.post("/CinesaUser/AcceptCom");
            if (hasConsent(["Performance"])) {
                ga('send', 'event', 'CinesaUser', 'Acepta Comunicaciones', 'OK');
            }
        }
    });
    if ($("#qrncinesacard").length > 0) {
        var qrcode = new QRCode("qrncinesacard", {
            text: $(".ncinesacard").text(),
            width: 110,
            height: 110,
            colorDark: "#000000",
            colorLight: "#ffffff",
            correctLevel: QRCode.CorrectLevel.H
        });
        $("#qrncinesacard img").unwrap();
        setTimeout(function () {
            $(".micinesacard .ma_row img").removeAttr("style");
            $(".micinesacard.noactivada .code img").removeAttr("style");
        }, 100);
    }


    $("#fromfecha").datepicker({
        onClose: function (selectedDate) {
            $("#tofecha").datepicker("option", "minDate", selectedDate);
        }
    }).inputmask("dd/mm/yyyy", { "placeholder": "DD/MM/AAAA", yearrange: { minyear: 2010, maxyear: (new Date().getFullYear()) } });
    $("#tofecha").datepicker({
        onClose: function (selectedDate) {
            $("#fromfecha").datepicker("option", "maxDate", selectedDate);
        }
    }).inputmask("dd/mm/yyyy", { "placeholder": "DD/MM/AAAA", yearrange: { minyear: 2010, maxyear: (new Date().getFullYear()) } });

    // FAQ
    $(".ma_ccard article.puntos .div-1 ul").hide();
    $("#ma_resumen article.faq .div-3 ul").hide();

    $(".ma_ccard article.puntos .btn_faq").on("touch click", function () {
        if (!$(this).hasClass("open")) {
            $(".ma_ccard article.puntos .div-1 ul").show();
            $(this).addClass("open");
            $(this).text(localization.cerrartablapuntosmayus);
        } else {
            $(".ma_ccard article.puntos .div-1 ul").hide();
            $(this).removeClass("open");
            $(this).text(localization.vertablapuntosmayus);
        }
    });

    $("#ma_resumen article.preguntas .btn_faq").on("touch click", function () {
        if (!$(this).hasClass("open")) {
            $("#ma_resumen article.preguntas .div-3 ul").show();
            $(this).addClass("open");
            $(this).text(localization.cerrarfaqsmayus);
        } else {
            $("#ma_resumen article.preguntas .div-3 ul").hide();
            $(this).removeClass("open");
            $(this).text(localization.verfaqsmayus);
        }
    });

    $(".respuesta").addClass("hidden");

    $("li.pregunta").click(function () {
        var pregunta;
        pregunta = $(this).attr("data-id");
        if ($("li.respuesta[data-id=" + pregunta + "]").hasClass("hidden")) {
            $("li.respuesta[data-id=" + pregunta + "]").removeClass("hidden");
            $("li.pregunta[data-id=" + pregunta + "] span.mas").addClass("menos");
            $("li.pregunta[data-id=" + pregunta + "] span").removeClass("mas");
        } else {
            $("li.respuesta[data-id=" + pregunta + "]").addClass("hidden");
            $("li.pregunta[data-id=" + pregunta + "] span.menos").addClass("mas");
            $("li.pregunta[data-id=" + pregunta + "] span").removeClass("menos");
        }
    });

    $(".ma_container.ma_new_ccard form").submit(function () {
        var ccCard = $("#ccnumber_enlazar").val();
        var ccDocumentType = $("#documentType_enlazar input[name=documentType]").val();
        var ccDocumentNumber = $("#documentNumber_enlazar").val();


        $.post("/CinesaUser/UserMergeCC", { ccCard: ccCard, ccDocumentType: ccDocumentType, ccDocumentNumber: ccDocumentNumber }, function (data) {
            if (data.UserMergeCCResponse.returnCode == 0 || data.UserMergeCCResponse.returnCode == "0") {
                $(".micinesacard").addClass("hidden");
                $(".micinesacard.asociada").removeClass("hidden");
                $("b.ccnumber").html(data.UserMergeCCResponse.ccCard);
                if (hasConsent(["Performance"])) {
                    ga('send', 'event', 'CinesaUser', 'Registro', 'CC Enlazada');
                }
                location.reload();
            } else {
                customalert(data.UserMergeCCResponse.returnDescription);
            }
        });
        return false;
    });

    $(".ma_ccard .rangofechas form").submit(function () {
        var DateFrom = $("#fromfecha").val();
        var DateTo = $("#tofecha").val();
        if (_validaFecha(DateFrom) && _validaFecha(DateTo)) {
            $.post("/CinesaUser/UserGetCCMovements", { DateFrom: DateFrom, DateTo: DateTo }, function (data) {
                if (data.UserGetPurchaseInformationResponse.returnCode == 0 || data.UserGetPurchaseInformationResponse.returnCode == "0") {
                    if (data.UserGetPurchaseInformationResponse.userMovements.ccMovements != null && data.UserGetPurchaseInformationResponse.userMovements.ccMovements != "") {
                        var htmloutput = "<tr><th>" + localization.sesionmayus + "</th><th>" + localization.cinemayus + "</th><th>" + localization.peliculamayus + "</th><th>" + localization.puntosmayus + "</th></tr>";
                        if (typeof (data.UserGetPurchaseInformationResponse.userMovements.ccMovements.ccMovement.date) != "undefined") {
                            htmloutput += "<tr><td>" + data.UserGetPurchaseInformationResponse.userMovements.ccMovements.ccMovement.date.substring(0, 10) + "</td><td>" + data.UserGetPurchaseInformationResponse.userMovements.ccMovements.ccMovement.site + "</td><td>" + data.UserGetPurchaseInformationResponse.userMovements.ccMovements.ccMovement.giftDesc + "</td><td>" + data.UserGetPurchaseInformationResponse.userMovements.ccMovements.ccMovement.points + "</td></tr>";
                        } else {
                            $.each(data.UserGetPurchaseInformationResponse.userMovements.ccMovements.ccMovement, function (k, v) {
                                htmloutput += "<tr><td>" + v.date.substring(0, 10) + "</td><td>" + v.site + "</td><td>" + v.giftDesc + "</td><td>" + v.points + "</td></tr>";
                            });
                        }
                        $(".movimientos table").html(htmloutput);
                    } else {
                        customalert(localization.nomovimientosfecha);
                    }
                } else {
                    customalert(data.UserGetPurchaseInformationResponse.returnDescription);
                }
            });
        } else {
            customalert(localization.formatofechaincorrecto);
        }
        return false;
    });

    $(".resendbienvenido").click(function (e) {
        e.preventDefault();
        $(this).addClass("hidden");
        $(this).parents(".noconfirm").addClass("hidden");
        $(this).parents(".validar_correo").addClass("hidden");
        $.post("/CinesaUser/BienvenidoResend", function () {
            customalert(localization.tehemosenviadoemailconfirmacion);
        });
    });

    // MIGRACIÓN
    if ($("#ma_resumen #documentType_enlazar").length) {
        $("#documentType_enlazar").radioBox({
            name: "documentType",
            arrowBackground: "#FFFFFF",
            position: "left",
            defaultText: localization.selecciona,
            aditionalClasses: 'rb2'
        });
    }

    //MODIFICAR USUARIO O PASS
    //NEW
    $(".b_change_mail").click(function () {
        $(".input_new_email").removeClass("hidden");
        $(".b_change_mail").addClass("hidden");
        $("#inp_01").removeAttr("disabled");
        $(".r_cambios[data-for=user]").removeClass("hidden");
    });

    $(".b_change_pass").click(function () {
        $(".input_new_pass").removeClass("hidden");
        $(".b_change_pass").addClass("hidden");
        $("#inp_03").removeAttr("disabled");
        $(".r_cambios[data-for=pass]").removeClass("hidden");
    });

    //OLD
    $(".ma_datos .micinesacard .btn_edit").click(function (e) {
        $(this).addClass("hidden");
        switch ($(this).attr("data-for")) {
            case "user":
                $(".ma_datos .micinesacard .validar_correo").addClass("hidden");
                $("#inp_02").parent().removeClass("hidden");
                $(".r_cambios[data-for=user]").removeClass("hidden");
                $("#inp_01").removeAttr("disabled");
                break;
            case "pass":
                $("#inp_04").parent().removeClass("hidden");
                $("#inp_05").parent().removeClass("hidden");
                $(this).parents(".row").find(".sub_row").removeClass("hidden");
                $(".r_cambios[data-for=pass]").removeClass("hidden");
                $("#inp_03").removeAttr("disabled");
                break;
        }
    });

    $(".ma_datos form.cambiousuario").submit(function () {
        if ($("#inp_02").val() != "") {
            if ($("#inp_02").val() != $("#inp_01").val()) {
                customalert("El usuario debe coincidir");
            } else {
                if (_validateEmail($("#inp_02").val())) {
                    $.post("/CinesaUser/SetEmail", { Email: $("#inp_02").val() }, function (data2) {
                        if (data2.UserSetEmailResponse.returnCode == "0" || data2.UserSetEmailResponse.returnCode == 0) {
                            customalert(localization.tusdatosmodificadoscorrectamente);
                            $(".ma_datos .micinesacard .validar_correo").removeClass("hidden");
                            $("#inp_02").parent().addClass("hidden");
                            $(".r_cambios[data-for=user]").addClass("hidden");
                            $(".ma_datos .micinesacard .btn_edit[data-for=user]").removeClass("hidden");
                        } else {
                            if (typeof (data2.UserSetEmailResponse.returnDescription) != "undefined") {
                                customalert(data2.UserSetEmailResponse.returnDescription);
                            } else {
                                customalert(localization.enestosmomentosincidencias);
                            }
                        }
                    });
                } else {
                    customalert(localization.emailnovalido);
                }
            }
        }
        return false;
    });

    fixanims();

    /* NEW UU */

    if ($("#ma_resumen.ma_datos").length) {
        actualizaProgressBarMD();
    };

    $("#inp_15").radioBox({
        name: "inp_15",
        arrowBackground: "#FFFFFF",
        position: "left",
        defaultText: localization.selecciona,
        aditionalClasses: 'rb2'
    });

    $("#gender_actualizacion").radioBox({
        name: "gender",
        arrowBackground: "#FFFFFF",
        position: "left",
        defaultText: localization.selecciona,
        aditionalClasses: 'rb2'
    });
    $("#region_actualizacion").radioBox({
        name: "provincia",
        arrowBackground: "#FFFFFF",
        position: "left",
        defaultText: localization.selecciona,
        aditionalClasses: 'rb2'
    });

    if ($("#documentType_actualizacion ul li").length > 1) {
        $("#documentType_actualizacion").radioBox({
            name: "documentType",
            arrowBackground: "#FFFFFF",
            position: "left",
            defaultText: localization.selecciona,
            aditionalClasses: 'rb2'
        });
    }

    if ($("#aaaa_actualizacion ul li").length > 1) {
        $("#dd_actualizacion").radioBox({
            name: "dd",
            arrowBackground: "#FFFFFF",
            position: "left",
            defaultText: localization.dia,
            aditionalClasses: 'rb2'
        });

        $("#mm_actualizacion").radioBox({
            name: "mm",
            arrowBackground: "#FFFFFF",
            position: "left",
            defaultText: localization.mes,
            aditionalClasses: 'rb2'
        });

        $("#aaaa_actualizacion").radioBox({
            name: "aaaa",
            arrowBackground: "#FFFFFF",
            position: "left",
            defaultText: localization.anyo,
            aditionalClasses: 'rb2'
        });
    }

    /*       */

    $(".ma_datos form.cambiopass").submit(function () {
        if ($("#inp_03").val() != "" && $("#inp_04").val() != "" && $("#inp_05").val() != "") {
            if ($("#inp_04").val() != $("#inp_05").val()) {
                customalert(localization.contrasenascoincidir);
            } else {
                if (_validaPass($("#inp_05").val()) == "OK") {
                    $.post("/CinesaUser/SetPass", { OldPassword: $("#inp_03").val(), NewPassword: $("#inp_05").val() }, function (data2) {
                        if (data2.UserSetPasswordResponse.returnCode == "0" || data2.UserSetPasswordResponse.returnCode == 0) {
                            customalert(localization.tusdatosmodificadoscorrectamente);
                            $("#inp_04").parent().addClass("hidden");
                            $("#inp_05").parent().addClass("hidden");
                            $(this).parents(".row").find(".sub_row").addClass("hidden");
                            $(".r_cambios[data-for=pass]").addClass("hidden");
                            $(".ma_datos .micinesacard .btn_edit[data-for=pass]").removeClass("hidden");
                        } else {
                            if (typeof (data2.UserSetPasswordResponse.returnDescription) != "undefined") {
                                customalert(data2.UserSetPasswordResponse.returnDescription);
                            } else {
                                customalert(localization.enestosmomentosincidencias);
                            }
                        }
                    });
                } else {
                    customalert(_validaPass($("#inp_05").val()));
                }
            }
        } else {
            customalert(localization.porfavorrellenatodo);
        }
        return false;
    });

    //

    $(".ma_datos form.cambiodatos").submit(function () {
        //validaciones
        var send = true;
        var msg = "";

        if ($(".ma_datos form input[name=provincia]").val().length == 0) {
            send = false;
            msg += "\n" + localization.provincia;
        }
        //tipo doc
        if (($(".ma_datos form.cambiodatos input[name=documentType]").length && $(".ma_datos form.cambiodatos input[name=documentType]").val() == "")) {
            send = false;
            msg += "\n" + localization.tipodedoc;
        }

        //ndoc
        if ($(".ma_datos form.cambiodatos input[name=documentNumber]").val() == "") {
            send = false;
            msg += "\n" + localization.numerodedoc;
        }

        if ((($(".ma_datos form.cambiodatos input[name=documentType]").val() == "D") || ($(".ma_datos form.cambiodatos input[name=documentType]").val() == "DNI"))) {
            var validaNIF_CIF = new NIF_CIFValidator();
            if (!validaNIF_CIF.checkAll($(".ma_datos form.cambiodatos input[name=documentNumber]").val())) {
                send = false;
                msg += "\nDNI incorrecto";
            }
        }
        //genero
        if ($(".ma_datos form.cambiodatos input[name=gender]").val().length == 0) {
            send = false;
            msg += "\n" + localization.genero;
        }
        //nombre
        if ($("#inp_08").val() == "") {
            send = false;
            msg += "\n" + localization.nombre;
        }
        //apellido
        if ($("#inp_09").val() == "") {
            send = false;
            errmsg += "\n" + localization.primerapellido;
        }

        //BDay
        if ($(".ma_datos form.cambiodatos input[name=dd]").length && (($(".ma_datos form.cambiodatos input[name=dd]").val() + "/" + $(".ma_datos form.cambiodatos input[name=mm]").val() + "/" + $(".ma_datos form.cambiodatos input[name=aaaa]").val()).length < 10)) {
            send = false;
            msg += "\n" + localization.tucumple;
        }

        //Ciudad
        if ($("#inp_12").val() == "") {
            send = false;
            msg += "\n" + localization.ciudad;
        }

        //Direccion
        if ($("#inp_11").val() == "") {
            send = false;
            msg += "\n" + localization.direccion;
        }

        //cp
        if ($("#inp_13").val() == "") {
            send = false;
            msg += "\n" + localization.codigopostal;
        }
        else {
            if (country == "ES") {
                var pattern = new RegExp(/^([1-9]{2}|[0-9][1-9]|[1-9][0-9])[0-9]{3}$/);
                if (!pattern.test($("#inp_13").val())) {
                    msg += "\nCódigo Postal";
                }
            }
        }

        //movil
        if ($("#inp_14").val() == "") {
            send = false;
            msg += "\n" + localization.movil;
        }
        else {
            if (country == "ES") {
                var pattern = new RegExp(/^[\d]{3}[-]*([\d]{2}[-]*){2}[\d]{2}$/);
                if (!pattern.test($("#inp_14").val())) {
                    msg += "\nMovil";
                }
            }
        }

        $.post("/CinesaUser/SetConsents", { Consents: JSON.stringify(prepareConsents(".sectionprivacidad ")) }, function (data) {
        });

        if (send) {
            //
            var objEnvio = new Object();
            var UserInformation = new Object;
            //var User = new Object;
            objEnvio.Gender = $(".ma_datos form input[name=gender]").val();
            objEnvio.Name = $("#inp_08").val();
            objEnvio.FirstSurname = $("#inp_09").val();
            if ($("#inp_10").val() != "") {
                objEnvio.SecondSurname = $("#inp_10").val();
            }
            if ($(".ma_datos form.cambiodatos input[name=dd]").length > 0) {
                objEnvio.BirthDate = $(".ma_datos form.cambiodatos input[name=dd]").val() + "/" + $(".ma_datos form.cambiodatos input[name=mm]").val() + "/" + $(".ma_datos form.cambiodatos input[name=aaaa]").val();
            } else {
                objEnvio.BirthDate = $("#dd_actualizacion li").attr("data-value") + "/" + $("#mm_actualizacion li").attr("data-value") + "/" + $("#aaaa_actualizacion li").attr("data-value");
            }
            objEnvio.Mobile = $("#inp_14").val();
            if (objEnvio.Mobile.length < 9) {
                customalert(localization.porfavornumeromovilcorrecto);
                return false;
            }
            else {
                var pattern = new RegExp(/^[\d]{3}[-]*([\d]{2}[-]*){2}[\d]{2}$/);
                if (!pattern.test(objEnvio.Mobile)) {
                    errormsg += localization.porfavornumeromovilcorrecto;
                }
            }
            objEnvio.DocumentType = $(".ma_datos form.cambiodatos input[name=documentType]").val() || $("#documentType_actualizacion li").attr("data-value");
            switch (objEnvio.DocumentType) {
                case "BI":
                    objEnvio.DocumentType = "B";
                    break;
                case "DNI":
                    objEnvio.DocumentType = "D";
                    break;
                case localization.tarjetaresidencia:
                    objEnvio.DocumentType = "T";
                    break;
                case localization.pasaporte:
                    objEnvio.DocumentType = "P";
                    break;
            }
            objEnvio.DocumentNumber = $(".ma_datos form.cambiodatos input[name=documentNumber]").val();
            objEnvio.Address = $("#inp_11").val();
            objEnvio.Location = $("#inp_12").val();
            objEnvio.PostalCode = $("#inp_13").val();
            objEnvio.Region = $(".ma_datos form input[name=provincia]").val();
            //objEnvio.Profession = $(".ma_datos form input[name=profesion]:checked").val();
            //objEnvio.CivilStatus = $(".ma_datos form input[name=civilstatus]:checked").val();
            if ($("input[name=inp_15]").val() != "") {
                objEnvio.KidsNumber = $("input[name=inp_15]").val();
            }
            //objEnvio.ReceiveComunications = $("#recibirnews").is(":checked") ? "Y" : "N";


            //objEnvio.X = null; //$("#lat").val();
            //objEnvio.Y = null; //$("#lng").val();
            //User.User = objEnvio;
            UserInformation.UserInformation = objEnvio;
            $.post("/CinesaUser/UserSetInformation", { UserInformation: JSON.stringify(UserInformation) }, function (data) {

                if (data.UserSetPersonalInformationResponse.returnCode == "0" || data.UserSetPersonalInformationResponse.returnCode == 0) {

                    customalert(localization.tusdatosmodificadoscorrectamente);

                } else {
                    if (typeof (data.UserSetPersonalInformationResponse.returnDescription) != "undefined") {
                        customalert(data.UserSetPersonalInformationResponse.returnDescription);
                    } else {
                        customalert(localization.enestosmomentosincidencias);
                    }
                }
            });
        } else {
            customalert(localization.porfavorrevisadatos + ":" + msg);
        }
        return false;
    });

    /*Load content from Selligent - My preferences*/
    if ($("body").hasClass("ma_datos")) {
        var container = $("#PreferenceContainer");
        var url = '/CinesaUser/getPreferences';

        $.get(url, function (data) {
            if (data.indexOf("__NOK__") > -1) {
                console.log("[Error al recuperar las preferencias]");
            } else {
                console.log("[Preferencias: OK]");
                container.append(data.split('__CONTENT__')[1])
            }
        });


    }

    $("aside .golden").click(function () {
        initGQ();
    });

    //Entradas
    $("body.ma_entradas .pag ul li a").click(function (e) {
        e.preventDefault();
        var pag = $(this).attr("data-href");
        $.post("/CinesaUser/EntradasPurchaseInformation", { pag: pag }, function (data) {
            var output = "";
            var maxpages = $(".misentradas .pag li a").not(".arrow").last().attr("data-href");
            $(".misentradas .pag li").removeClass("selected");
            $(".misentradas .pag li a[data-href=" + pag + "]").not(".arrow").parent().addClass("selected");
            $(".misentradas .pag li a.arrow").removeClass("hidden");
            $(".misentradas .pag li a.arrow").first().attr("data-href", pag - 1);
            $(".misentradas .pag li a.arrow").last().attr("data-href", pag + 1);
            if (pag == "1") {
                $(".misentradas .pag li a.arrow").first().addClass("hidden");
            }
            if (pag == maxpages) {
                $(".misentradas .pag li a.arrow").last().addClass("hidden");
            }
            $(".misentradas tr").not(".purchaseinfohead").remove();
            // render
            if (typeof (data.UserGetPurchaseInformationResponse.userInformation.purchaseMovements.purchaseMovement.saleCab) == "undefined") {
                $.each(data.UserGetPurchaseInformationResponse.userInformation.purchaseMovements.purchaseMovement, function (k, purchaseMovement) {
                    output += '<tr><td><p>' + purchaseMovement.saleCab.sesionDate.substring(0, 10) + '</p><p>' + purchaseMovement.saleCab.sesionDate.substring(11, 16) + 'h</p></td>';
                    output += '<td><p>' + purchaseMovement.saleCab.siteDescrip + '</p></td><td><p>' + purchaseMovement.saleCab.filmDesc + '</p></td>';
                    output += '<td>';
                    if (typeof (purchaseMovement.saleDet.det.units) == "undefined") {
                        $.each(purchaseMovement.saleDet.det, function (l, det) {
                            output += '<p>' + det.units + ' x ' + det.descrip + ' (' + det.descrip2 + ')</p>';
                        });
                    } else {
                        output += '<p>' + purchaseMovement.saleDet.det.units + ' x ' + purchaseMovement.saleDet.det.descrip + ' (' + purchaseMovement.saleDet.det.descrip2 + ')</p>';
                    }
                    output += '</td>';
                    output += '<td><p>' + purchaseMovement.saleCab.totalAmount + '€</p></td>';
                    output += '<td><p>' + ((purchaseMovement.saleCab.channel == null) ? "" : purchaseMovement.saleCab.channel) + '</p></td>';
                    output += '<td><a href="' + urlBase + '/cinesa.ashx?pid=' + ((purchaseMovement.saleCab.UuTransId == null) ? "" : purchaseMovement.saleCab.UuTransId) + '" class="table_btn" target="_blank">DESCARGAR ENTRADAS</a></td></tr>';
                });
            } else {
                var purchaseMovement = data.UserGetPurchaseInformationResponse.userInformation.purchaseMovements.purchaseMovement;
                output += '<tr><td><p>' + purchaseMovement.saleCab.sesionDate.substring(0, 10) + '</p><p>' + purchaseMovement.saleCab.sesionDate.substring(11) + 'h</p></td>';
                output += '<td><p>' + purchaseMovement.saleCab.siteDescrip + '</p></td><td><p>' + purchaseMovement.saleCab.filmDesc + '</p></td>';
                output += '<td>';
                if (typeof (purchaseMovement.saleDet.det.units) == "undefined") {
                    $.each(purchaseMovement.saleDet.det, function (l, det) {
                        output += '<p>' + det.units + ' x ' + det.descrip + ' (' + det.descrip2 + ')</p>';
                    });
                } else {
                    output += '<p>' + purchaseMovement.saleDet.det.units + ' x ' + purchaseMovement.saleDet.det.descrip + ' (' + purchaseMovement.saleDet.det.descrip2 + ')</p>';
                }
                output += '</td>';
                output += '<td><p>' + purchaseMovement.saleCab.totalAmount + '€</p></td>';
                output += '<td><p>' + ((purchaseMovement.saleCab.channel == null) ? "" : purchaseMovement.saleCab.channel) + '</p></td>';
                output += '<td><a href="' + urlBase + '/cinesa.ashx?pid=' + ((purchaseMovement.saleCab.UuTransId == null) ? "" : purchaseMovement.saleCab.UuTransId) + '" class="table_btn" target="_blank">DESCARGAR ENTRADAS</a></td></tr>';
            }

            // -- render
            $(".misentradas table").append(output);
        });
    });

    //GQ
    if ($(".pop_golden").length > 0) {
        $(".pop_golden.ccard .golden_btn,.pop_golden.no-ccard .golden_btn").click(function () {
            $(".pop_golden.ccard").addClass("hidden");
            $(".pop_golden.no-ccard").addClass("hidden");
            $(".pop_golden.golden-form").removeClass("hidden");
        });
        if (typeof (gq_user) != "undefined") {
            if (gq_user.Edad > 65) {
                $(".pop_golden.golden-form input[name=campo_1][value=6]").prop("checked", true);
            } else if (gq_user.Edad > 55) {
                $(".pop_golden.golden-form input[name=campo_1][value=5]").prop("checked", true);
            } else if (gq_user.Edad > 45) {
                $(".pop_golden.golden-form input[name=campo_1][value=4]").prop("checked", true);
            } else if (gq_user.Edad > 35) {
                $(".pop_golden.golden-form input[name=campo_1][value=3]").prop("checked", true);
            } else if (gq_user.Edad > 18) {
                $(".pop_golden.golden-form input[name=campo_1][value=2]").prop("checked", true);
            } else if (gq_user.Edad > 0) {
                $(".pop_golden.golden-form input[name=campo_1][value=1]").prop("checked", true);
            }
            if (gq_user.Edad > 0) {
                nextQuestion(1);
            }

            if (gq_user.Hijos) {
                $(".pop_golden.golden-form input[name=campo_2][value=1]").prop("checked", true);
                nextQuestion(2);
            }
        }
        $(".pop_golden.golden-form button").click(function (e) {
            e.preventDefault();
            nextQuestion($(this).parents(".row").attr("data-question"));
        });
        $(".pop_golden .close").click(function () {
            closeGQ();
        });
    }
}

function initGoldenQ() {
    if ($(".pop_golden").length > 0) {
        $(".pop_golden.ccard .golden_btn,.pop_golden.no-ccard .golden_btn").click(function () {
            $(".pop_golden.ccard").addClass("hidden");
            $(".pop_golden.no-ccard").addClass("hidden");
            $(".pop_golden.golden-form").removeClass("hidden");
        });
        if (typeof (gq_user) != "undefined") {
            if (gq_user.Edad > 65) {
                $(".pop_golden.golden-form input[name=campo_1][value=6]").prop("checked", true);
            } else if (gq_user.Edad > 55) {
                $(".pop_golden.golden-form input[name=campo_1][value=5]").prop("checked", true);
            } else if (gq_user.Edad > 45) {
                $(".pop_golden.golden-form input[name=campo_1][value=4]").prop("checked", true);
            } else if (gq_user.Edad > 35) {
                $(".pop_golden.golden-form input[name=campo_1][value=3]").prop("checked", true);
            } else if (gq_user.Edad > 18) {
                $(".pop_golden.golden-form input[name=campo_1][value=2]").prop("checked", true);
            } else if (gq_user.Edad > 0) {
                $(".pop_golden.golden-form input[name=campo_1][value=1]").prop("checked", true);
            }
            if (gq_user.Edad > 0) {
                nextQuestion(1);
            }

            if (gq_user.Hijos) {
                $(".pop_golden.golden-form input[name=campo_2][value=1]").prop("checked", true);
                nextQuestion(2);
            }
        }
        $(".pop_golden.golden-form button").click(function (e) {
            e.preventDefault();
            nextQuestion($(this).parents(".row").attr("data-question"));
        });
        $(".pop_golden .close").click(function () {
            closeGQ();
        });

    }
    initGQ();
}

function initGQ() {
    $(".golden_mask").removeClass("hidden");
    $(".pop_golden.ccard").removeClass("hidden");
    $(".pop_golden.no-ccard").removeClass("hidden");
}

function closeGQ() {
    $(".golden_mask").addClass("hidden");
    $(".pop_golden").addClass("hidden");
    if ($("body").attr("id") == "GoldenQ") {
        document.location = "/";
    }
}

function nextQuestion(currentQuestion) {
    if ($(".pop_golden.golden-form input[name=campo_" + currentQuestion + "]:checked").length > 0) {
        //
    } else {
        customalert("No has rellenado la respuesta");
        return false;
    }
    var _nextQuestion;
    switch (currentQuestion) {
        case "2":
            if ($(".pop_golden.golden-form input[name=campo_2]:checked").val() == 1) {
                _nextQuestion = 3;
            } else {
                _nextQuestion = 4;
            }
            break;
        case "10":
            sendQuestions();
            return;
            break;
        default:
            _nextQuestion = (parseInt(currentQuestion) + 1);
    }
    if ($(".pop_golden.golden-form input[name=campo_" + currentQuestion + "]:checked").length > 0) {
        $(".pop_golden.golden-form .row[data-question=" + currentQuestion + "]").addClass("hidden");
        $(".pop_golden.golden-form .row[data-question=" + _nextQuestion + "]").removeClass("hidden");
    } else {
        customalert("No has rellenado la respuesta");
    }
}

function sendQuestions() {
    var surveyAnswers = new Object();
    var surveyAnswer = new Object();
    var answers = new Array();
    $.each($(".pop_golden.golden-form .row[data-question]"), function () {
        var _currentQuestion = $(this).attr("data-question");
        if ($(".pop_golden.golden-form input[name=campo_" + _currentQuestion + "]:checked").length > 0) {
            var _surveyAnswer = $(".pop_golden.golden-form input[name=campo_" + _currentQuestion + "]:checked").val();
            answers.push({ surveyQuestionId: _currentQuestion, surveyAnswer: _surveyAnswer });
        }
    });
    surveyAnswer.surveyAnswer = answers;
    surveyAnswers.surveyAnswers = surveyAnswer;
    $.post("/CinesaUser/Golden", { Answers: JSON.stringify(surveyAnswers) }, function (data) {
        if (data.UU_UserSetSurveyAnswersResponse.returnCode == "0" || data.UU_UserSetSurveyAnswersResponse.returnCode == 0) {
            $(".pop_golden.golden-form").addClass("hidden");
            $(".pop_golden.golden-final_form").removeClass("hidden");
            $("aside .golden").addClass("hidden");
            if ($("body").attr("id") == "GoldenQ") {
                var userid = $("#gqiduser").val();
                var useremail = $("#gqemail").val();
                document.location = ("http://cinesa.emsecure.net/optiext/optiextension.dll?ID=Ji6VzOBYaAS4as4EREC5Xj2wPaLpLB04PV%2ByR6fO00JjopVVFhkuJvG7IjigUXQSTDUa_0pudQJJJz" + "&USER_ID=" + userid + "&MAIL=" + useremail);
            }
        } else {
            customalert(data.UU_UserSetSurveyAnswersResponse.returnDescription);
        }
    });
}

function initUURecupera() {
    if ($("section.cinesauser").length > 0) {
        $(".frm1.introducir form").submit(function () {
            $.post("/CinesaUser/RecuperarSend/", { Email: $(".frm1 input[name=Email]").val() }, function (data) {
                if (data == "OK") {
                    $(".frm1").addClass("hidden");
                    $(".conf").removeClass("hidden");
                    if (GTMEnabled) {
                        uaEvent('login module', 'password recovery');
                    }
                } else {
                    customalert(data);
                }
            });
            return false;
        });

        $(".frm1.establecer form").submit(function () {
            $(".frm1.establecer form input").removeClass("pop_bad").removeClass("pop_ok");
            if (($(".frm1.establecer form input[name=password]").val() != "") && ($(".frm1.establecer form input[name=newpassword]").val() != "") && ($(".frm1.establecer form input[name=password]").val() == $(".frm1.establecer form input[name=newpassword]").val())) {
                if (_validaPass($(".frm1 input[name=newpassword]").val()) == "OK") {
                    $.post("/CinesaUser/SetPass/", { NewPassword: $(".frm1 input[name=newpassword]").val() }, function (data) {
                        if (data.UserSetPasswordResponse.returnCode == "0" || data.UserSetPasswordResponse.returnCode == 0) {
                            $(".frm1").addClass("hidden");
                            $(".conf").removeClass("hidden");
                        } else {
                            if (typeof (data.UserSetPasswordResponse.returnDescription) != "undefined") {
                                customalert(data.UserSetPasswordResponse.returnDescription);
                            } else {
                                customalert(localization.enestosmomentosincidencias);
                            }
                        }
                    });
                } else {
                    $(".frm1.establecer form input").addClass("pop_bad");
                }

            } else {
                $(".frm1.establecer form input[name=newpassword]").addClass("pop_bad");
            }

            return false;
        });
    }
}

function initSemueve() {
    $("span.partner-nombre").click(function () {
        $(this).siblings("div.partner-info").toggleClass("hidden");
        $(this).siblings("span.partner-nombre").toggleClass("open");
        $(this).toggleClass("open");
    });
}

function initCinesacheck() {
    $(".respuesta").addClass("hidden");

    $("li.pregunta").click(function () {
        var pregunta;
        pregunta = $(this).attr("data-id");
        if ($("li.respuesta[data-id=" + pregunta + "]").hasClass("hidden")) {
            $("li.respuesta[data-id=" + pregunta + "]").removeClass("hidden");
            $("li.pregunta[data-id=" + pregunta + "] span.mas").addClass("menos");
            $("li.pregunta[data-id=" + pregunta + "] span").removeClass("mas");
        } else {
            $("li.respuesta[data-id=" + pregunta + "]").addClass("hidden");
            $("li.pregunta[data-id=" + pregunta + "] span.menos").addClass("mas");
            $("li.pregunta[data-id=" + pregunta + "] span").removeClass("menos");
        }
    });

    if ($(".ch-1").length > 0) {
        $("article").addClass("hidden");
        $(".ch-1").removeClass("hidden");


        $(".ch-1 .ch_btn").click(function (e) {
            $(".ch-1").addClass("hidden");
            $(".ch-menu").removeClass("hidden");
            $(".ch-2").removeClass("hidden");
            $(".ch-menu li[data-id='1']").addClass("selected");
        });

        /*$(".ch-1 .ch_btn").click(function () {
            $(".ch-1").addClass("hidden");
            $(".ch-menu").removeClass("hidden");
            $(".ch-2").removeClass("hidden");
        });*/

        $(".ch-2 .ch_btn").click(function () {
            // TODO: VALIDA
            $(".formerror").addClass("hidden");
            var valida = true;
            $('form .ch-2 input:visible[required="required"]').each(function () {
                if ((typeof (this.validity) != "undefined") && !this.validity.valid) {
                    // break
                    valida = false;
                    /*customalert($(this).attr("data-errormsg"));*/
                    $(this).next(".formerror").text($(this).attr("data-errormsg"));
                    $(this).next(".formerror").removeClass("hidden");
                    $(this).focus();
                    return false;
                }
            });
            if (valida) {
                if (!$("body").hasClass("pt")) {
                    var validaNIF_CIF = new NIF_CIFValidator();
                    if (!validaNIF_CIF.checkAll($(".ch-2 input[name=_dni]").val())) {
                        valida = false;
                        /*customalert($(".ch-2 input[name=_dni]").attr("data-errormsg"));*/
                        $(".ch-2 input[name=_dni]").next(".formerror").text($(".ch-2 input[name=_dni]").attr("data-errormsg"));
                        $(".ch-2 input[name=_dni]").next(".formerror").removeClass("hidden");
                        $(".ch-2 input[name=_dni]").focus();
                    }
                }
            }
            if (valida) {
                $(".ch-2").addClass("hidden");
                $(".ch-menu li[data-id='1']").removeClass("selected");
                $(".ch-menu li[data-id='2']").addClass("selected");
                $(".ch-3").removeClass("hidden");
            }
        });

        $(".ch-3 .ch_btn").click(function () {
            if ($(this).hasClass("atras")) {
                $(".ch-3").addClass("hidden");
                $(".ch-menu li[data-id='2']").removeClass("selected");
                $(".ch-menu li[data-id='1']").addClass("selected");
                $(".ch-2").removeClass("hidden");
                return false;
            }
            // TODO: VALIDA
            $(".formerror").addClass("hidden");
            var valida = true;
            $('form .ch-3 input:visible[required="required"]').each(function () {
                if ((typeof (this.validity) != "undefined") && !this.validity.valid) {
                    // break
                    valida = false;
                    /*customalert($(this).attr("data-errormsg"));*/
                    $(this).next(".formerror").text($(this).attr("data-errormsg"));
                    $(this).next(".formerror").removeClass("hidden");
                    $(this).focus();
                    return false;
                }
                if (!_validateEmail($(this).val())) {
                    valida = false;
                    /*customalert($(this).attr("data-errormsg"));*/
                    $(this).next(".formerror").text($(this).attr("data-errormsg"));
                    $(this).next(".formerror").removeClass("hidden");
                    $(this).focus();
                    return false;
                }
            });

            if (valida) {
                if ($(".ch-3 input[name=_email]").val() != $(".ch-3 input[name=_email_conf]").val()) {
                    valida = false;
                    /*customalert($(".ch-3 input[name=_email_conf]").attr("data-errormsg"));*/
                    $(".ch-3 input[name=_email_conf]").next(".formerror").text($(".ch-3 input[name=_email_conf]").attr("data-errormsg"));
                    $(".ch-3 input[name=_email_conf]").next(".formerror").removeClass("hidden");
                    $(".ch-3 input[name=_email_conf]").focus();
                }
            }

            if (valida) {
                $(".ch-3").addClass("hidden");
                $(".ch-menu li[data-id='2']").removeClass("selected");
                $(".ch-menu li[data-id='3']").addClass("selected");
                $(".ch-4").removeClass("hidden");
                $('html, body').animate({
                    scrollTop: $(".ch-4").offset().top
                }, 100);
            }

        });
    }


    $(".dudas").click(function (e) {
        e.preventDefault();
        $("section.mainsect").addClass("hidden");
        //$("article").addClass("hidden");
        $(".respuesta").addClass("hidden");
        $(".ch-8").removeClass("hidden");
    });

    $(".ch-8 .chclose").click(function (e) {
        $(".ch-8").addClass("hidden");
        $("section.mainsect").removeClass("hidden");
    });


    $(".ch-8 a").click(function (e) {
        if (!(($(this).find(".chclose").length > 0) || ($(this).hasClass("destacado") > 0))) {
            //e.preventDefault();
            $(".ch-menu").removeClass("hidden");
            $(".ch-menu li").removeClass("selected");
            $(".ch-8").addClass("hidden");
            $(".ch-6").removeClass("hidden");
        }
    });

    $(".ch-4 .ch_btn").attr("disabled", "disabled");
    $("input[name='codi_09']").change(function () {
        $(".formerror").addClass("hidden");
        if ($("input[name='codi_09']").val().length > 0) {
            $(".ch-4 .ch_btn").removeAttr("disabled");
        } else {
            $("input[name='codi_09']").next(".formerror").text($("input[name='codi_09']").attr("data-errormsg"));
            $("input[name='codi_09']").next(".formerror").removeClass("hidden");
            $(".ch-4 .ch_btn").attr("disabled", "disabled");
        }
    });

    //control campos vacios form recuperación
    $(".ch-6 .ch_btn").attr("disabled", "disabled");
    $(".ch-6 input.text").change(function () {
        var ch6vacios = 0;
        $(".ch-6 input.text").each(function () {
            if ($(this).val().length <= 0) {
                ch6vacios = ch6vacios + 1;
            }
        });
        if (ch6vacios == 0) {
            $(".ch-6 .ch_btn").removeAttr("disabled");
        } else {
            $(".ch-6 .ch_btn").attr("disabled", "disabled");
        }
    });



    if ($("#smsErrorTit").html() == localization.textoseguridadincorrecto) {
        $(".ch-1").addClass("hidden");
        $(".ch-4").removeClass("hidden");
    }
    if ($("#smsErrorLit").html() == "Error.") {
        $(".ch-1").addClass("hidden");
        $(".ch-4").removeClass("hidden");
    }
    if ($("#smsErrorLit").html() == localization.codigopromocaducado) {
        $(".ch-1").addClass("hidden");
        $(".ch-4").removeClass("hidden");
    }
    $(".ch-menu").removeClass("hidden");
}

function initCCBienvenido() {
    if ($("body").hasClass("n_cc")) {
        $(".inf .cc_btn.print").click(function (e) {
            e.preventDefault();
            window.print();
        });
    } else {
        $(".inf .frm_btn").click(function (e) {
            e.preventDefault();
            window.print();
        });
    }
}

function initColegios() {
    $("#selecciona_cine").radioBox({
        name: "selecciona_cine",
        arrowBackground: "#FFFFFF",
        position: "left",
        defaultText: "Selecciona tu cine",
        aditionalClasses: 'rb2'
    });
    $("#colegios_dia").radioBox({
        name: "colegios_dia",
        arrowBackground: "#FFFFFF",
        position: "left",
        defaultText: "Día",
        aditionalClasses: 'rb2'
    });
    $("#colegios_mes").radioBox({
        name: "colegios_mes",
        arrowBackground: "#FFFFFF",
        position: "left",
        defaultText: "Mes",
        aditionalClasses: 'rb2'
    });
    $("#colegios_ano").radioBox({
        name: "colegios_ano",
        arrowBackground: "#FFFFFF",
        position: "left",
        defaultText: "Año",
        aditionalClasses: 'rb2'
    });

    $("#tipo_pase").radioBox({
        name: "tipo_pase",
        arrowBackground: "#FFFFFF",
        position: "left",
        defaultText: "Tipo de pase",
        aditionalClasses: 'rb2'
    });
    $("#titulo_pelicula").radioBox({
        name: "titulo_pelicula",
        arrowBackground: "#FFFFFF",
        position: "left",
        defaultText: "Título de la película a visionar",
        aditionalClasses: 'rb2'
    });
    $("#version_pelicula").radioBox({
        name: "version_pelicula",
        arrowBackground: "#FFFFFF",
        position: "left",
        defaultText: "Versión de la película",
        aditionalClasses: 'rb2'
    });

    /* TIPO CONSULTA */
    $("#frmcolegios input[name=tipo_consulta]").click(function () {
        validateTipoConsulta();
    });

    /* TIPO CONSULTA */
    $("#frmcolegios input[name=politica]").click(function () {
        validatePolitica();
    });

    /* Nombre Colegio */
    $("#frmcolegios input[name=nombre_colegio]").change(function () {
        validateNombreColegio();
    });
    /* Nombre Responsable */
    $("#frmcolegios input[name=apellido_responsable]").change(function () {
        validateApellidoResponsable();
    });
    /* Apellido Responsable */
    $("#frmcolegios input[name=nombre_responsable]").change(function () {
        validateNombreResponsable();
    });
    /* Movil */
    $("#frmcolegios input[name=movil]").change(function () {
        validateMovil();
    });
    /* Email */
    $("#frmcolegios input[name=email]").change(function () {
        validateEmail();
    });
    /* Población */
    $("#frmcolegios input[name=poblacion]").change(function () {
        validatePoblacion();
    });

    /* SUBMIT BUTTON */
    $("#frmcolegios input[type=submit]").click(function (e) {
        e.preventDefault();

        //captcha control
        $.post("/CinesaUser/calculaCaptcha", { response: grecaptcha.getResponse(recaptchaColegios) }, function (result) {
            if (result == "true") {
                //form submit

                validateTipoConsulta();
                validatePolitica();
                validateNombreColegio();
                validateApellidoResponsable();
                validateNombreResponsable();
                validateMovil();
                validateEmail();
                validatePoblacion();

                if (validateTipoConsulta() && validatePolitica() && validateNombreColegio() && validateApellidoResponsable() && validateNombreResponsable() && validateMovil() && validateEmail() && validatePoblacion()) {
                    $.post("/Forms/Colegios", {
                        tipo_consulta: $("#frmcolegios input[name=tipo_consulta]:checked").val(),
                        nombreCentro: $("#frmcolegios input[name=nombre_colegio]").val(),
                        appellidoResponsable: $("#frmcolegios input[name=apellido_responsable]").val(),
                        nombreResponsable: $("#frmcolegios input[name=nombre_responsable]").val(),
                        movil: $("#frmcolegios input[name=movil]").val(),
                        email: $("#frmcolegios input[name=email]").val(),
                        numeroAlumnos: $("#frmcolegios input[name=alumnos]").val(),
                        poblacion: $("#frmcolegios input[name=poblacion]").val(),
                        cine: $("#selecciona_cine .rb_label").text(),
                        fechaDia: $("#colegios_dia .rb_label").text(),
                        fechaMes: $("#colegios_mes .rb_label").text(),
                        fechaAno: $("#colegios_ano .rb_label").text(),
                        fechaHora: $("#frmcolegios input[name=colegios_hora]").val(),
                        tipoPase: $("#tipo_pase .rb_label").text(),
                        tituloPelicula: $("#titulo_pelicula .rb_label").text(),
                        versionPelicula: $("#version_pelicula .rb_label").text(),
                        servicios1: $("#servicios-1").is(":checked"),
                        servicios2: $("#servicios-2").is(":checked"),
                        servicios3: $("#servicios-3").is(":checked"),
                        comentarios: $("#frmcolegios textarea[name=comentarios]").val(),
                        politica: $("#frmcolegios input[name=politica]:checked").val()
                    }, function (data) {
                        customalert('<h2 style="color: #00bcd1;font-size: 32px;">¡Gracias!</h2><p>Contactaremos contigo lo antes posible para responder a tu solicitud.</p>');
                    });
                } else {
                    customalert("Por favor, rellena todos los campos obligatorios.")
                }

                grecaptcha.reset(recaptchaColegios);
            } else {
                customalert("Por favor, por motivos de seguridad, recuerda marcar la opción 'No soy un robot'.")
                grecaptcha.reset(recaptchaColegios);
            }
        });


        
    })
}
/* COLEGIOS VALIDATION START */
function validateTipoConsulta() {//Tipo Consulta
    var tipo_consulta = $("#frmcolegios input[name=tipo_consulta]:checked").val();
    if (tipo_consulta !== undefined) {
        $("#frmcolegios input[name=tipo_consulta]").parent().parent().parent().removeClass("error");
        return true;
    } else {
        $("#frmcolegios input[name=tipo_consulta]").parent().parent().parent().addClass("error");
        return false;
    }
}
function validatePolitica() {//Politica
    var politica = $("#frmcolegios input[name=politica]:checked").val();
    if (politica !== undefined) {
        $("#frmcolegios input[name=politica]").parent().parent().parent().removeClass("error");
        return true;
    } else {
        $("#frmcolegios input[name=politica]").parent().parent().parent().addClass("error");
        return false;
    }
}

function validateNombreColegio() {//Nombre Colegio
    var nombre_colegio = $("#frmcolegios input[name=nombre_colegio]").val();
    if (nombre_colegio !== undefined && nombre_colegio.length > 0) {
        $("#frmcolegios input[name=nombre_colegio]").parent().removeClass("error");
        return true;
    } else {
        $("#frmcolegios input[name=nombre_colegio]").parent().addClass("error");
        return false;
    }
}

function validateNombreResponsable() {//Nombre responsable
    var nombre_responsable = $("#frmcolegios input[name=nombre_responsable]").val();
    if (nombre_responsable !== undefined && nombre_responsable.length > 0) {
        $("#frmcolegios input[name=nombre_responsable]").parent().removeClass("error");
        return true;
    } else {
        $("#frmcolegios input[name=nombre_responsable]").parent().addClass("error");
        return false;
    }
}

function validateApellidoResponsable() {//Apellido responsable
    var apellido_responsable = $("#frmcolegios input[name=apellido_responsable]").val();
    if (apellido_responsable !== undefined && apellido_responsable.length > 0) {
        $("#frmcolegios input[name=apellido_responsable]").parent().removeClass("error");
        return true;
    } else {
        $("#frmcolegios input[name=apellido_responsable]").parent().addClass("error");
        return false;
    }
}

function validateMovil() {//Movil
    var movil = $("#frmcolegios input[name=movil]").val();
    if (movil !== undefined && movil.length > 0) {
        $("#frmcolegios input[name=movil]").parent().removeClass("error");
        return true;
    } else {
        $("#frmcolegios input[name=movil]").parent().addClass("error");
        return false;
    }
}

function validateEmail() {//Email
    var email = $("#frmcolegios input[name=email]").val();
    if (email !== undefined && email.length > 0) {
        $("#frmcolegios input[name=email]").parent().removeClass("error");
        return true;
    } else {
        $("#frmcolegios input[name=email]").parent().addClass("error");
        return false;
    }
}

function validatePoblacion() {//poblacion
    var poblacion = $("#frmcolegios input[name=poblacion]").val();
    if (poblacion !== undefined && poblacion.length > 0) {
        $("#frmcolegios input[name=poblacion]").parent().removeClass("error");
        return true;
    } else {
        $("#frmcolegios input[name=poblacion]").parent().addClass("error");
        return false;
    }
}

/*COLEGIOS VALIDATIONS END*/

function initCiclos() {
    setTimeout(function () {
        $(".ciclo .carteles-carrusel").each(function () {
            var that = this;
            $(this).find('ul').carouFredSel({
                prev: {
                    button: function () {
                        return $(that).find(".img_left");
                    }
                },
                next: {
                    button: function () {
                        return $(that).find(".img_right");
                    }
                },
                align: "left",
                auto: false,
                width: '100%',
                scroll: 1,
                circular: false,
                infinite: false,
                /*items: {
                    width: 130
                },*/
                /*swipe: {
                    onMouse: true,
                    onTouch: true
                }*/
            });
        });
    }, 1000);
}

function initInfantil() {
    $("#banner_seccion>ul").carouFredSel({
        prev: '.img_left',
        next: '.img_right',
        responsive: true,
        auto: {
            timeoutDuration: 5000,
            pauseOnHover: "immediate"
        },
        items: {
            visible: 1,
            width: 1216,
            height: "18%"
        },
        pagination: ".radios",
        align: "center",
        swipe: {
            onMouse: true,
            onTouch: true
        }
    });
}

function initIsens() {
    setupSelect();
    if (!$("#select li.selected").length) {
        $("#select li:first").addClass("selected");
    };
}

function initImax() {
    setupSelect();
    if (!$("#select li.selected").length) {
        $("#select li:first").addClass("selected");
    };
    if (hasConsent(["Performance"])) {
        ga('create', 'UA-33911646-37', 'auto', { 'name': 'b' });
        ga('b.send', 'pageview');
    }
}

function initScreenX() {
    setupSelect();
    if (!$("#select li.selected").length) {
        $("#select li:first").addClass("selected");
    };
    if (hasConsent(["Performance"])) {
        ga('create', 'UA-33911646-37', 'auto', { 'name': 'b' });
        ga('b.send', 'pageview');
    }

}

function loginheader() {
    $("#header .cc_login").submit(function (e) {
        e.preventDefault();

        /* comprobar captcha */
        $.post("/CinesaUser/calculaCaptcha", { response: grecaptcha.getResponse(poploginrecaptcha) }, function (result) {
            if (result == "true") {
                //login
                loginCinesaUser($("#login-email").val(), $("#login-contasena").val(), false, function () {

                    //abrir welcome popin
                    console.log("------------------------------------------------- LOGIN")
                    var n = JSON.parse(UserInfo.UserInformation).UserGetPersonalInformationResponse.userInformation.User.name
                    $("#popup-welcome-title").html($("#popup-welcome-title").html().replace("{{name}}", n));
                    popupShow("popup_welcome", true);

                    grecaptcha.reset(poploginrecaptcha);
                    updateHeader();
                });
            } else {
                customalert("Por favor, por motivos de seguridad, recuerda marcar la opción 'No soy un robot'.")
                grecaptcha.reset(poploginrecaptcha);
            }
        });
        
    });

    $(".cerrarSesion").click(function (e) {
        e.preventDefault();
        logoutCinesaUser();
    });

    updateHeader();




    $("#cinefavorito_header .user_img").click(function (e) {
        e.preventDefault();
        if (resolucion <= 640) {
            if ($("#cinefavorito_header").hasClass("logged")) {
                $(".new_logout").removeClass("hidden");
                if (toggleLoginMenu != 0) {
                    clearTimeout(toggleLoginMenu);
                    toggleLoginMenu = 0;

                    
                }
                toggleLoginMenu = setTimeout(function () {
                    $(".new_logout").addClass("hidden");
                }, 5000);
            } else {
                $("header #cinefavorito_header .new_login").removeClass("hidden");
                $("header #cinefavorito_header>a.log_link").addClass("is-active");
            }
        }
    });

    $(".login_close").click(function (e) {
        $("header #cinefavorito_header .new_login").addClass("hidden");
        $("header #cinefavorito_header>a.log_link").removeClass("is-active");
    });

    /*
    $(".logout").click(function (e) {
        e.preventDefault();
        if (($("body").attr("id") == "ma_resumen") || $("body").hasClass("n_cc")) {
            logoutCinesaUser();
        } else {
            logoutCinesacard();
            document.location = "/CinesaCard/Logout";
        }
    });

    if ($.cookie("cclogged") == "ok") {
        $("#cinefavorito_header").addClass("logged");
    }
    if (typeof ($.cookie("uulogged")) != "undefined") {
        $("#cinefavorito_header").addClass("logged");
        $("#cinefavorito_header .logged_msg").html("HOLA " + $.cookie("uulogged").toUpperCase());
        $.post("/CinesaUser/GetLogin?nocache=" + new Date().getTime(), function (data) {
            objUser.UserLoginResponse = data;
        });
    }
    $("#cinefavorito_header").removeClass("hidden");
    $(".cc_cuenta").click(function (event) {
        if (!($("#cinefavorito_header").hasClass("logged"))) {
            event.preventDefault();
            if ($(this).hasClass("open")) {
                $(this).removeClass("open");
                $(".disp_login").removeClass("open");
            } else {
                $(this).addClass("open");
                $(".disp_login").addClass("open");
            }
        }
    });
    $(".close_login").click(function () {
        if ($(".cc_cuenta").hasClass("open")) {
            $(".cc_cuenta").removeClass("open");
            $(".disp_login").removeClass("open");
        } else {
            $(".cc_cuenta").addClass("open");
            $(".disp_login").addClass("open");
        }
    });
    $(".disp_login form").submit(function () {
        if ($("body").hasClass("n_cc")) {
            loginCinesaUser($(".disp_login form input[name=cc_email]").val(), $(".disp_login form input[name=cc_pass]").val());
        } else {
            loginCinesacard($(".disp_login form input[name=cc_email]").val(), $(".disp_login form input[name=cc_pass]").val());
        }
        return false;
    });

    $(".m_login form").submit(function () {
        if ($("body").hasClass("n_cc")) {
            loginCinesaUser($(".m_login form input[type=email]").val(), $(".m_login form input[type=password]").val());
        } else {
            loginCinesacard($(".m_login form input[type=email]").val(), $(".m_login form input[type=password]").val());
        }
        //loginCinesaUser($(".m_login form input[type=email]").val(), $(".m_login form input[type=password]").val());
        return false;
    });

    // UU
    if ($("body").hasClass("n_cc")) {
        $(".disp_login a.btn").click(function (e) {
            e.preventDefault();
            $(".pop_mask").removeClass("hidden");
            $(".pop_registro_1").removeClass("hidden");
            $(".pop_registro_2 form")[0].reset();
            radiobox_reset(".pop_registro_2 input[name=dd]", "dd");
            radiobox_reset(".pop_registro_2 input[name=mm]", "mm");
            radiobox_reset(".pop_registro_2 input[name=aaaa]", "aaaa");
            radiobox_reset(".pop_registro_2 input[name=genero]");
            $(this).parents(".radiobox").find(".rb_selected input").remove();
            $(".pop_error[data-errorfor=user]").html("");
            $(".pop_error[data-errorfor=pass]").html("");
            $("#user").removeClass("pop_ok").removeClass("pop_bad");
            $("#r-user").removeClass("pop_ok").removeClass("pop_bad");
            $("#pass").removeClass("pop_ok").removeClass("pop_bad");
            $("#r-pass").removeClass("pop_ok").removeClass("pop_bad");
            return false;
        });
        $(".m_login a.reg_btn").click(function (e) {
            e.preventDefault();
            popupClose();
            popupShow("pop_registro_2",true);
            //$(".pop_registro_1").removeClass("hidden");
            //$(".pop_registro_2 form")[0].reset();
            //radiobox_reset(".pop_registro_2 input[name=dd]", "dd");
            //radiobox_reset(".pop_registro_2 input[name=mm]", "mm");
            //radiobox_reset(".pop_registro_2 input[name=aaaa]", "aaaa");
            //radiobox_reset(".pop_registro_2 input[name=genero]");
            //$(".pop_error[data-errorfor=user]").html("");
            //$(".pop_error[data-errorfor=pass]").html("");
            //$("#user").removeClass("pop_ok").removeClass("pop_bad");
            //$("#r-user").removeClass("pop_ok").removeClass("pop_bad");
            //$("#pass").removeClass("pop_ok").removeClass("pop_bad");
            //$("#r-pass").removeClass("pop_ok").removeClass("pop_bad");
            $(".sb-active .close_menu_left.sb-close").click();
            return false;
        });
    }*/
}

function updateHeader() {
    if (typeof ($.cookie("uulogged")) != "undefined") {
        $("#cinefavorito_header").addClass("logged");
        $("#cinefavorito_header .new_login").addClass("hidden");
        //$(".nameLogged").html(localization.hola + " " + $.cookie("uulogged"));
        $.post("/CinesaUser/GetLogin?nocache=" + new Date().getTime(), function (data) {
            objUser.UserLoginResponse = data;



            if (data != "") {
                if (userIsCinesaCard()) {//if (objUser.UserLoginResponse.UserInformation.UserInformation.ccCard != "" || (objUser.UserLoginResponse.UserInformation.UserInformation.isCinesaCardUser == "Y")) {
                    $("#menu_web2 a.cinesacard ~ ul li:eq(1)").addClass("hidden");
                    $("#menu_web2 a.cinesacard ~ ul li:eq(2)").addClass("hidden");
                }
            } else {
                $.removeCookie("uulogged", { domain: ".cinesa.es", path: '/' });
                $("#cinefavorito_header").removeClass("logged");
                $("header #cinefavorito_header a.user_img > div").removeClass("fb").removeAttr("style");
            }
        });
        if (typeof ($.cookie("uufb")) != "undefined") {
            $("header #cinefavorito_header.logged a.user_img > div").addClass("fb").css("background-image", "url(https://graph.facebook.com/" + $.cookie("uufb") + "/picture)");
        }
    }
}

function initTrabajaconnosotros() {
    $("#comboPoblaciones").customselect();
    $("#comboProvincias").customselect();
    $("#comboPaises").customselect();
    $("#comboCines").customselect();

    /*$(".frm1 label span").click(function () {
        if (!$("#check").is(':checked')) {
            $(".frm1 .btn_siguiente").removeClass("hidden");
        } else {
            $(".frm1 .btn_siguiente").addClass("hidden");
        }
    });

    $(".frm1 .btn_siguiente").click(function () {
        $(".frm1").addClass("hidden");
        $(".frm2").removeClass("hidden");
    });*/

    $(".frm1 label span").click(function () {
        if (!$("#check").is(':checked')) {
            $(".frm1").addClass("hidden");
            $(".frm2").removeClass("hidden");
        }
    });

    $("#comboPoblaciones").on("changed", function (_e) {
        $.getJSON("/Home/comboCines/" + $(this).attr("data-value"), function (result) {
            var output = "<li data-value=\"-1\" class=\"selected\">Cine Solicitado</li>";
            output += "<li data-value=\"0\">Oficinas Centrales</li>";
            $.each(result, function (i, item) {
                output += "<li data-value=\"" + item.Value + "\">" + item.Text + "</li>";
            });
            $("#comboCines").html(output);
        });
    });

    $("#form_trabaja").submit(function () {
        var camposObligatorios = new Array("Nombre", "Apellidos", "Direccion", "Localidad", "CP", "Nacionalidad", "Telefono1", "Email", "DNI", "Presentacion", "comboCines");
        if (_checkObligatorios(camposObligatorios)) {
            $("#PoblacionString").val($("#comboPoblaciones li.selected").text());
            $("#CineString").val($("#comboCines li.selected").text());
            $("#CineID").val($("#comboCines").attr("data-value"));
            $("#ProvinciaString").val($("#comboProvincias li.selected").text());
            $("#PaisString").val($("#comboPaises li.selected").text());
            return true;
        } else {
            customalert(localization.porfavoraseguratedatos);
        }
        return false;
    });

}

function initContacta() {
    var arrayCampos = new Array();
    $("#motivo").customselect();
    $("#detalles").customselect();
    $("#cine").customselect();
    $("#cine").customselect("reset");
    $("#pelicula").customselect();
    $("#pelicula").customselect("reset");

    $("#cine a,#pelicula a").click(function (e) {
        e.preventDefault();
    });
    var motivoOut = "<li data-value=\"-1\" class=\"selected\">" + localization.selecciona + "</li>";
    //for (var i = 0; i < arrayForm.length; i++) {
    $.each(arrayForm, function (_i, _v) {
        motivoOut += "<li data-value='" + _i + "'>" + _v.motivo + "</li>";
    });
    $("#motivo").html(motivoOut);
    $("#motivo").on("changed", function (_e) {
        arrayCampos = new Array();
        var output = "<li data-value=\"-1\" class=\"selected\">" + localization.selecciona + "</li>";
        $.each(arrayForm[$(this).attr("data-value")].detalles, function (_i, _v) {
            output += "<li data-value='" + _i + "'>" + _v.detalle + "</li>";
        });
        $("#detalles").html(output);
        $(".frm2").removeClass("inactivo").addClass("activo");
        $(".frm3").removeClass("activo").addClass("inactivo");
        $(".frm3 input,.frm3 label,.frm3 textarea,.frm3 .cc_select").hide();
        $("#canned_response").hide();
        $(".row_captcha_contacto").hide();
        $("#btn_send").hide();
    });

    $("#detalles").on("changed", function (_e) {
        arrayCampos = new Array();
        var hascampos = false;
        $(".frm3 input,.frm3 label,.frm3 textarea,.frm3 .cc_select").hide();
        if ([$(this).attr("data-value")] > -1) {
            if (arrayForm[$("#motivo").attr("data-value")].detalles[$(this).attr("data-value")].campos) {
                $.each(arrayForm[$("#motivo").attr("data-value")].detalles[$(this).attr("data-value")].campos, function (_i, _v) {
                    if ($("#" + _v.campo).hasClass("select-group")) {
                        $("#" + _v.campo).parent().removeAttr("style");
                    } else {
                        $("#" + _v.campo).removeAttr("style");
                    }
                    arrayCampos[_i] = _v.campo;
                    $(".row_captcha_contacto").show();
                    $("#btn_send").show();
                    $("#canned_response").hide();
                    hascampos = true;
                });
            }
            if (arrayForm[$("#motivo").attr("data-value")].detalles[$(this).attr("data-value")].canned) {
                $("#canned_response").html(arrayForm[$("#motivo").attr("data-value")].detalles[$(this).attr("data-value")].canned);
                $("#canned_response").show();
                if (!hascampos) {
                    $(".row_captcha_contacto").hide();
                    $("#btn_send").hide();
                }
            }
            //$("#como_ayudarte").addClass("selected");
            $(".frm3").removeClass("inactivo").addClass("activo");
        }
    });

    $("#frmcontacto").submit(function () {

        //catcha control
        $.post("/CinesaUser/calculaCaptcha", { response: grecaptcha.getResponse(recaptchaContactos) }, function (result) {
            if (result == "true") {
                //form submit

                if (_checkObligatorios(arrayCampos)) {
                    var objEnvio = new Object();
                    var enviar = true;
                    $.each(arrayCampos, function (i, item) {
                        var valor;
                        var nombre;
                        if ($("#" + item).hasClass("select-group")) {

                            valor = $("#" + item + " li.selected").text();
                            nombre = item;
                        } else {
                            valor = $("#" + item).val();
                            nombre = $("#" + item).attr("placeholder");
                        }
                        objEnvio[item] = valor;
                        objEnvio[item + "_txt"] = nombre; //$("label[for=" + item + "]").text();

                        switch (item) {
                            case "email":
                                _validateEmail(objEnvio[item]) ? enviar = true : enviar = false;
                                break;
                            case "email_viejo":
                                _validateEmail(objEnvio[item]) ? enviar = true : enviar = false;
                                break;
                            case "email_nuevo":
                                _validateEmail(objEnvio[item]) ? enviar = true : enviar = false;
                                break;
                            case "cod_tarjeta":
                                isNumber(objEnvio[item]) ? enviar = true : enviar = false;
                                break;
                            case "telefono":
                                isNumber(objEnvio[item]) ? enviar = true : enviar = false;
                                break;
                        }
                    });
                    if (enviar) {
                        objEnvio["motivo_id"] = $("#motivo").attr("data-value");
                        objEnvio["motivo_txt"] = $("#motivo li.selected").text();
                        objEnvio["detalles_id"] = $("#detalles").attr("data-value");
                        objEnvio["detalles_txt"] = $("#detalles li.selected").text();
                        $.post("/Forms/Contacto/?nocache=" + new Date().getTime(), objEnvio);
                    } else {
                        customalert(localization.porfavordatosvalidos);
                    }
                } else {
                    customalert(localization.porfavorrellenatodo);
                }




                grecaptcha.reset(recaptchaContactos);
            } else {
                customalert("Por favor, por motivos de seguridad, recuerda marcar la opción 'No soy un robot'.")
                grecaptcha.reset(recaptchaContactos);
            }
        });



        
        return false;
    });
}

function contactoEnviado(mensaje) {
    $("#canned_response").html(mensaje);
    $(".frm3 .row").hide();
    $("#canned_response").show();
}

function initmicuenta() {
    $(".frm").addClass("hidden");
    $(".puntos").addClass("hidden");
    $(".faq").addClass("hidden");
    $(".listapromos").addClass("hidden");
    $(".infocc").addClass("hidden");
    /*$("article.menu>ul").carouFredSel({
        auto: false,
        circular: false,
        infinite:false,
        scroll: {
            items: 1
        },
        swipe: {
            onMouse: true,
            onTouch: true
        }
    });*/
    $(".menu li").click(function () {
        /*var section = ($(this).html());

        $(this).parent().find("li").removeClass("activo");
        $(this).addClass("activo");

        $(".caducan").addClass("hidden");
        $(".movimientos").addClass("hidden");
        $(".frm").addClass("hidden");
        $(".puntos").addClass("hidden");
        $(".faq").addClass("hidden");
        $(".listapromos").addClass("hidden");
        $(".infocc").addClass("hidden");

        switch (section) {
            case "MOVIMIENTOS":
                $(".caducan").removeClass("hidden");
                $(".movimientos").removeClass("hidden");
                break;
            case "MIS DATOS":
                $(".frm").removeClass("hidden");
                break;
            case "TABLA DE PUNTOS":
                $(".puntos").removeClass("hidden");
                $(".infocc").removeClass("hidden");
                break;
            case "AYUDA":
                $(".faq").removeClass("hidden");
                break;
            case "PROMOS":
                $(".listapromos").removeClass("hidden");
                break;
        }*/
        var seccion;
        if ($(this).hasClass("selected") || $(this).hasClass("a_ico")) {
            if ($(".menu ul").hasClass("open")) {
                $(".menu ul").removeClass("open");
            } else {
                $(".menu ul").addClass("open");
            }
        } else {
            seccion = $(this).attr("data-id");
            $(".menu ul").removeClass("open");
            $(".menu li").removeClass("selected");
            $(this).addClass("selected");
            $("article[data-id]").addClass("hidden");
            $("article[data-id=" + seccion + "]").removeClass("hidden");
        }
    });


    $(".respuesta").addClass("hidden");

    $("li.pregunta").click(function () {
        var pregunta;
        pregunta = $(this).attr("data-id");
        if ($("li.respuesta[data-id=" + pregunta + "]").hasClass("hidden")) {
            $("li.respuesta[data-id=" + pregunta + "]").removeClass("hidden");
            $("li.pregunta[data-id=" + pregunta + "] span.mas").addClass("menos");
            $("li.pregunta[data-id=" + pregunta + "] span").removeClass("mas");
        } else {
            $("li.respuesta[data-id=" + pregunta + "]").addClass("hidden");
            $("li.pregunta[data-id=" + pregunta + "] span.menos").addClass("mas");
            $("li.pregunta[data-id=" + pregunta + "] span").removeClass("menos");
        }
    });

    $.post("/CinesaCard/_Movimientos", function (data) {
        var output = "";
        var fechaInicio = (data.movimientos.length > 0) ? data.movimientos[data.movimientos.length - 1].Movement.Date : data.strFechaInicio;
        var fechaFin = (data.movimientos.length > 0) ? data.movimientos[0].Movement.Date : data.strFechaFin;
        $("#strFechaFin").val(fechaFin);
        $("#strFechaInicio").val(fechaInicio);
        $.each(data.movimientos, function (i, v) {
            var m = v.Movement;
            output += '<div class="row"><div class="col1">' + m.Date + '</div><div class="col2">' + m.SiteDesc + '</div><div class="col3">' + m.GiftDesc + '</div><div class="col4">' + m.Points + '</div></div>';
        });
        $("#movimientoscontainer").html(output);
    });

    $("#mostrarmovimientos").click(function () {
        $.post("/CinesaCard/_Movimientos", { opcion: "fech", FechaInicio: $("#strFechaInicio").val(), FechaFin: $("#strFechaFin").val() }, function (data) {
            var output = "";
            $.each(data.movimientos, function (i, v) {
                var m = v.Movement;
                output += '<div class="row"><div class="col1">' + m.Date + '</div><div class="col2">' + m.SiteDesc + '</div><div class="col3">' + m.GiftDesc + '</div><div class="col4">' + m.Points + '</div></div>';
            });
            $("#movimientoscontainer").html(output);
        });
    });

    //$("#tipodocumento").customselect();
    $("#sexo").customselect();
    $("#provincia").customselect();
    //$("#dia").customselect();
    //$("#mes").customselect();
    //$("#ano").customselect();
    $("#profesion").customselect();
    $("#estado").customselect();

    $("#modificar").submit(function () {
        var Name = $("input[name=Name]").val();
        var FirstSurname = $("input[name=FirstSurname]").val();
        var SecondSurname = $("input[name=SecondSurname]").val();
        var Address = $("input[name=Address]").val();
        var Location = $("input[name=Location]").val();
        var ddProvincia = $("#provincia li.selected").attr("data-value");
        var ZipCode = $("input[name=ZipCode]").val();
        var Telephone = $("input[name=Telephone]").val();
        var Mobile = $("input[name=Mobile]").val();
        var BirthDate = $("#dia li.selected").text() + "/" + $("#mes li.selected").text() + "/" + $("#ano li.selected").text();// $("input[name=BirthDate]").val();
        var ddProfesion = $("#profesion li.selected").attr("data-value");
        var EstatusCivil = $("#estado li.selected").attr("data-value");
        var SonsNumber = $("input[name=SonsNumber]").val();
        var Email = $("input[name=Email]").val();
        var Sexo = $("#sexo li.selected").attr("data-value");
        $.post("/CinesaCard/_ModificarDatosUpdate", { Name: Name, FirstSurname: FirstSurname, SecondSurname: SecondSurname, Address: Address, Location: Location, ddProvincia: ddProvincia, ZipCode: ZipCode, Telephone: Telephone, Mobile: Mobile, Sexo: Sexo, BirthDate: BirthDate, ddProfesion: ddProfesion, EstatusCivil: EstatusCivil, SonsNumber: SonsNumber, Email: Email }, function (data) {
            customalert(data);
        });
        return false;
    });

}

function initccform() {
    if ($("body").hasClass("n_cc")) {
        var logged = $("#cinefavorito_header").hasClass("logged");

        $("#formstart .cc_btn.log").click(function () {
            $("#formlogin").removeClass("hidden");
            $("#formstart").addClass("hidden");
        });

        $("#formlogin .cc_btn").click(function () {
            loginCinesaUser($("#formlogin input[name=loginuser]").val(), $("#formlogin input[name=loginpass]").val(), true);
        });

        $("#formstart .cc_btn.reg").click(function () {
            $("#formalta").removeClass("hidden");
            $("#formstart").addClass("hidden");
        });

        $("#formalta input[name=useralta]").change(function () {
            $("#formalta input[name=useralta]").removeClass("pop_ok").removeClass("pop_bad");
            $(".pop_error[data-errorfor=useralta]").html("");
            
        });

        $("#formalta input[name=ruseralta]").change(function () {
            $("#formalta input[name=ruseralta]").removeClass("pop_ok").removeClass("pop_bad");
            $(".pop_error[data-errorfor=useralta]").html("");
            if ($("#formalta input[name=useralta]").val() == $("#formalta input[name=ruseralta]").val()) {
                $("#formalta input[name=ruseralta]").addClass("pop_ok");
            } else {
                $("#formalta input[name=ruseralta]").addClass("pop_bad");
                $(".pop_error[data-errorfor=useralta]").html("El usuario debe coincidir");
            }
        });

        $("#formalta input[name=passalta]").change(function () {
            var res = _validaPass($("#formalta input[name=passalta]").val());
            $("#formalta input[name=passalta]").removeClass("pop_ok").removeClass("pop_bad");
            $(".pop_error[data-errorfor=passalta]").html("");
            if (res != "OK") {
                $("#formalta input[name=passalta]").addClass("pop_bad");
                $(".pop_error[data-errorfor=passalta]").html(res);
            } else {
                $("#formalta input[name=passalta]").addClass("pop_ok");
            }
            if ($("#formalta input[name=rpassalta]").val().length > 0) {
                $("#formalta input[name=rpassalta]").change();
            }
        });

        $("#formalta input[name=rpassalta]").change(function () {
            $("#formalta input[name=rpassalta]").removeClass("pop_ok").removeClass("pop_bad");
            $(".pop_error[data-errorfor=passalta]").html("");
            if ($("#formalta input[name=passalta]").val() == $("#formalta input[name=rpassalta]").val()) {
                $("#formalta input[name=rpassalta]").addClass("pop_ok");
            } else {
                $("#formalta input[name=rpassalta]").addClass("pop_bad");
                $(".pop_error[data-errorfor=passalta]").html(localization.contrasenascoincidir);
            }
        });

        $("#formalta .cc_btn").click(function () {
            var send = true;
            var errmsg = "";
            $(".pop_error[data-errorfor=useralta]").html("");
            $(".pop_error[data-errorfor=passalta]").html("");
            $("#formalta input[name=useralta]").removeClass("pop_ok").removeClass("pop_bad");
            $("#formalta input[name=ruseralta]").removeClass("pop_ok").removeClass("pop_bad");
            $("#formalta input[name=passalta]").removeClass("pop_ok").removeClass("pop_bad");
            $("#formalta input[name=rpassalta]").removeClass("pop_ok").removeClass("pop_bad");
            //User
            if (!_validateEmail($("#formalta input[name=useralta]").val())) {
                send = false;
                $("#formalta input[name=useralta]").addClass("pop_bad");
                errmsg += "\nNombre de usuario";
            }

            if (!(($("#formalta input[name=useralta]").val()) == $("#formalta input[name=ruseralta]").val())) {
                send = false;
                $("#formalta input[name=ruseralta]").addClass("pop_bad");
                $(".pop_error[data-errorfor=useralta]").html("El usuario debe coincidir");
                errmsg += "\nNombre de usuario debe coincidir";
            }

            //Pass
            var res = _validaPass($("#formalta input[name=passalta]").val());
            if (res != "OK") {
                send = false;
                $(".pop_error[data-errorfor=passalta]").html(res);
                errmsg += "\nPassword";
            }

            if (!($("#formalta input[name=passalta]").val() == $("#formalta input[name=rpassalta]").val())) {
                send = false;
                $("#formalta input[name=rpassalta]").addClass("pop_bad");
                $(".pop_error[data-errorfor=passalta]").html(localization.contrasenascoincidir);
                errmsg += "\nPasswords deben coincidir";
            }

            if (send) {
                
            } else {
                errmsg = localization.porfavorrevisadatos + ":" + errmsg;
                customalert(errmsg);
            }
            return false;
        });

        $(".frm2 input").change(function () {
            var send = true;
            if (!$(".frm2 input[name=documentType][disabled]").length) {
                if (!$(".frm2 input[name=documentType]:checked").length) {
                    //console.log("documentType");
                    send = false;
                } else {
                    if (($(".frm2 input[name=documentNumber]").val() != "") && ($(".frm2 input[name=documentType]:checked").val() == "D")) {
                        var validaNIF_CIF = new NIF_CIFValidator();
                        if (!validaNIF_CIF.checkAll($(".frm2 input[name=documentNumber]").val())) {
                            send = false;
                            customalert(localization.dniincorrecto);
                        }
                    }
                }
            }
            if (!$(".frm2 input[name=aaaa]").hasClass("box_inactivo")) {
                if (!$(".frm2 input[name=dd]:checked").length) {
                    //console.log("dd");
                    send = false;
                }
                if (!$(".frm2 input[name=mm]:checked").length) {
                    //console.log("mm");
                    send = false;
                }
                if (!$(".frm2 input[name=aaaa]:checked").length) {
                    //console.log("aaaa");
                    send = false;
                }
                if ($(".frm2 input[name=dd]:checked").length && $(".frm2 input[name=mm]:checked").length && $(".frm2 input[name=aaaa]:checked").length) {
                    var resultado = rangoEdad($(".frm2 input[name=dd]:checked").val() + "/" + $(".frm2 input[name=mm]:checked").val() + "/" + $(".frm2 input[name=aaaa]:checked").val(), 14, 100);
                    if (resultado != 1) {
                        send = false;
                        customalert(localization.necesitasmayor14alta);
                    }
                }
            }
            if (!$(".frm2 input[name=gender]:checked").length) {
                //console.log("gender");
                send = false;
            }
            if ($(".frm2 input[name=documentNumber]").val() == "") {
                //console.log("documentNumber");
                send = false;
            }
            if ($(".frm2 input[name=name]").val() == "") {
                //console.log("name");
                send = false;
            }
            if ($(".frm2 input[name=firstsurname]").val() == "") {
                //console.log("firstsurname");
                send = false;
            }
            /*if ($(".frm2 input[name=secondsurname]").val() == "") {
                //console.log("secondsurname");
                send = false;
            }*/
            if (send) {
                $(".frm2").removeClass("activo").addClass("inactivo");
                $(".frm3").addClass("activo").removeClass("hidden");
                $(".frm3 .row").removeClass("hidden");
                $(".frm3 .cc_btn").removeClass("hidden");
                $(".frm3 input[name=mobile]").change();
            } else {
                $(".frm3 .cc_btn").attr("disabled", "disabled");
            }
        });

        $(".frm3 input").change(function () {
            //console.log("Entro");
            var send = true;
            if (!$(".frm3 input[name=provincia]:checked").length) {
                send = false;
            }
            if ($(".frm3 input[name=address]").val() == "") {
                send = false;
            }
            if ($(".frm3 input[name=location]").val() == "") {
                send = false;
            }
            if ($(".frm3 input[name=postalcode]").val() == "") {
                send = false;
            }
            else {
                var cp = $('.frm3 input[name=postalcode]').val();
                var pattern = new RegExp(/^([1-9]{2}|[0-9][1-9]|[1-9][0-9])[0-9]{3}$/);
                if (!pattern.test(cp)) {
                    errormsg += "- Código Postal incorrecto\n";
                }
            }

            if ($(".frm3 input[name=mobile]").val() == "") {
                send = false;
            }
            else {
                var pattern = new RegExp(/^[\d]{3}[-]*([\d]{2}[-]*){2}[\d]{2}$/);
                if (!pattern.test($(".frm3 input[name=mobile]").val())) {
                    errormsg += "- Teléfono incorrecto\n";
                }
            }

            if (!$(".frm3 input[name=privacidad]").is(":checked")) {
                send = false;
            }


            if (send) {
                //$(".frm3").removeClass("activo").addClass("inactivo");
                $(".frm3 .cc_btn").removeAttr("disabled");
            } else {
                $(".frm3 .cc_btn").attr("disabled", "disabled");
            }
        });

        // Alta User + CC a la vez
        $(".frm3 .cc_btn").click(function (e) {
            e.preventDefault();
            var isNewUser = !$("#cinefavorito_header").hasClass("logged");
            var objEnvio = new Object();
            var UserInformation = new Object;
            if (isNewUser) {
                objEnvio.Email = $("#formalta input[name=useralta]").val();
                objEnvio.Password = $("#formalta input[name=passalta]").val();
            } else {
                objEnvio.Email = $("#formlogin input[name=loginuser]").val();
            }
            objEnvio.Gender = $(".frm2 input[name=gender]:checked").val();
            objEnvio.Name = $(".frm2 input[name=name]").val();
            objEnvio.FirstSurname = $(".frm2 input[name=firstsurname]").val();
            if ($(".frm2 input[name=secondsurname]").val() != "") {
                objEnvio.SecondSurname = $(".frm2 input[name=secondsurname]").val();
            }
            objEnvio.BirthDate = ($(".frm2 input[name=dd]:checked").val() || $(".frm2 input[name=dd]").val()) + "/" + ($(".frm2 input[name=mm]:checked").val() || $(".frm2 input[name=mm]").val()) + "/" + ($(".frm2 input[name=aaaa]:checked").val() || $(".frm2 input[name=aaaa]").val());
            objEnvio.Mobile = $(".frm3 input[name=mobile]").val();
            if (objEnvio.Mobile.length < 9) {
                customalert(localization.porfavornumeromovilcorrecto);
                return false;
            }
            if (!$(".frm2 input[name=documentType][disabled]").length) {
                objEnvio.DocumentType = $(".frm2 input[name=documentType]:checked").val();
            } else {
                switch ($(".frm2 input[name=documentType]").val()) {
                    case "DNI":
                        objEnvio.DocumentType = "D";
                        break;
                    case "Pasaporte":
                        objEnvio.DocumentType = "P";
                        break;
                    case "Tarjeta de Residencia":
                        objEnvio.DocumentType = "T";
                        break;
                }
                //objEnvio.DocumentType = $(".frm2 input[name=documentType]").val();
            }
            objEnvio.DocumentNumber = $(".frm2 input[name=documentNumber]").val();
            objEnvio.Address = $(".frm3 input[name=address]").val();
            objEnvio.Location = $(".frm3 input[name=location]").val();
            objEnvio.PostalCode = $(".frm3 input[name=postalcode]").val();
            objEnvio.Region = $(".frm3 input[name=provincia]:checked").val();
            /*objEnvio.X = $("#formalta input[name=passalta]").val();
            objEnvio.Y = $("#formalta input[name=passalta]").val();*/
            objEnvio.Profession = $(".frm3 input[name=profesion]:checked").val();
            objEnvio.CivilStatus = $(".frm3 input[name=civilstatus]:checked").val();
            if ($(".frm3 input[name=kidsnumber]").val() != "") {
                objEnvio.KidsNumber = $(".frm3 input[name=kidsnumber]").val();
            }
            objEnvio.ReceiveComunications = $(".frm3 input[name=comm]").is(":checked") ? "N" : "Y";
            objEnvio.ReceiveComunications_cinesacard = $(".frm3 input[name=comm]").is(":checked") ? "N" : "Y";
            if ($(".frm3 input[name=x]").length > 0) {
                objEnvio.x = $(".frm3 input[name=x]").val();
                objEnvio.y = $(".frm3 input[name=y]").val();
            }
            UserInformation.UserInformation = objEnvio;
            isNewUser = (isNewUser ? "Y" : "N");
            if (!$("#formalta .pop_bad").length) {
                $(".frm3 .cc_btn").addClass("hidden");
                $.post("/CinesaUser/CCAltaForm", { UserInformation: JSON.stringify(UserInformation), NU: isNewUser, Email: objEnvio.Email, fbid: _fbid, fbat: _fbat }, function (data) {
                    if (isNewUser == "Y") {
                        if (data.NewCinesacard_NewUserResponse.returnCode == "0" || data.NewCinesacard_NewUserResponse.returnCode == 0) {
                            $(".graciasbienvenido .mail").html(objEnvio.Email);
                            $(".regform").addClass("hidden");
                            $(".graciasbienvenido").removeClass("hidden");
                            if (hasConsent(["Performance"])) {
                                ga('send', 'event', 'CinesaUser', 'Registro', 'CinesaUser+CC');
                                wa.bt_queue.push
                                    ({
                                        //"customIdentifier": "xxx",
                                        "tags": [
                                            { tag: "ALTA", value: "CinesaUseryCC_Finalizado" }
                                        ],
                                        "async": true,
                                        "isTargeting": true,
                                        "isEvent": false
                                    });
                            }
                        } else {
                            if (typeof (data.NewCinesacard_NewUserResponse.returnDescription) != "undefined") {
                                customalert(data.NewCinesacard_NewUserResponse.returnDescription);
                            } else {
                                customalert(localization.enestosmomentosincidencias);
                            }
                        }
                    } else {
                        if (data.NewCinesacard_CinesaUserResponse.returnCode == "0" || data.NewCinesacard_CinesaUserResponse.returnCode == 0) {
                            $(".graciasbienvenido .mail").html(objEnvio.Email);
                            $(".regform").addClass("hidden");
                            $(".graciasbienvenido").removeClass("hidden");
                            $('html, body').animate({
                                scrollTop: $(".graciasbienvenido").offset().top
                            }, 500);
                            if (hasConsent(["Performance"])) {
                                ga('send', 'event', 'CinesaUser', 'Registro', 'Solo CC');
                                wa.bt_queue.push
                                    ({
                                        //"customIdentifier": "xxx",
                                        "tags": [
                                            { tag: "ALTA", value: "CC_Finalizado" }
                                        ],
                                        "async": true,
                                        "isTargeting": true,
                                        "isEvent": false
                                    });
                            }
                        } else {
                            if (typeof (data.NewCinesacard_CinesaUserResponse.returnDescription) != "undefined") {
                                customalert(data.NewCinesacard_CinesaUserResponse.returnDescription);
                            } else {
                                customalert(localization.enestosmomentosincidencias);
                            }
                        }
                    }
                    $(".frm3 .cc_btn").removeClass("hidden");
                    //UU_NewCinesacard_CinesaUser
                });
            }
            return false;
        });
        $("a.resend").click(function (e) {
            e.preventDefault();
            $.post("/CinesaUser/CCAltaResend", function (data) {
                customalert("Te hemos reenviado el email de confirmación");
                $("a.resend").addClass("hidden");
            });
        });
        if (logged) {
            $(".nologin").addClass("hidden");
            $(".frm1").removeClass("activo").addClass("inactivo");
            $(".frm2").addClass("activo");/*.addClass("inactivo");
            $(".frm3").addClass("activo");*/
            $(".frm2 .row").removeClass("hidden");
            //$(".frm3 .row").removeClass("hidden");
            //$(".frm3 .cc_btn").removeClass("hidden");
            $(".frm2 input[name=name]").change();
            $("#formlogin").removeClass("hidden");
        } else {

        }
        return false;

    }
    //var _gaq = [];
    $("#tipodocumento").customselect();
    $("#provincia").customselect();
    $("#dia").customselect();
    $("#mes").customselect();
    $("#ano").customselect();
    $("#sexo").customselect();
    $("#profesion").customselect();
    $("#estatus").customselect();

    /*for (x = 2; x <= 4; x++) {
        $("article[data-id=" + x + "]").removeClass("inactivo");
        $("article[data-id=" + x + "]").removeClass("activo");
        $("article[data-id=" + x + "] .row").addClass("hidden");
    }*/
    //_gaq.push(['_trackEvent', 'CinesaCard', 'Alta', 'Paso1']);
    if (hasConsent(["Performance"])) {
        ga('send', 'event', 'CinesaCard', 'Alta', 'Paso1');
    }

    $(".enviar_solicitud").click(function (e) {
        e.preventDefault();
        switch ($(this).attr("data-id")) {
            case "1":
                var DocumentType = $("#tipodocumento").attr("data-value");
                var DocumentNumber = $("input[name=DocumentNumber]").val();
                var Email = $("input[name=Email]").val();
                var EmailConfirm = $("input[name=EmailConfirm]").val();
                var Password = $("input[name=Password]").val();
                var PasswordConfirm = $("input[name=PasswordConfirm]").val();
                var Acepto = $("input[name=Acepto]").val();

                // Validaciones

                var msg = "";
                if (DocumentType == "0") {
                    msg += "\n\t- Debes seleccionar un tipo de documento";
                }
                if (DocumentType != "P" && DocumentType != "0") {
                    var validaNIF_CIF = new NIF_CIFValidator();
                    if (!validaNIF_CIF.checkAll($("[name=DocumentNumber]").val())) {
                        msg += "\n\t- " + localization.numerodocnovalido;
                    };
                }
                if (!_validateEmail($("[name=Email]").val()) || $("[name=Email]").val() == "") {
                    msg += "\n\t- " + localization.emailnovalido;
                }
                if ($("[name=Email]").val() != $("[name=EmailConfirm]").val()) {
                    msg += "\n\t- " + localization.porfavorconfirmaemail;
                }
                if ((($("[name=Password]").val()) != ($("[name=PasswordConfirm]").val())) || $("[name=Password]").val() == "") {
                    msg += "\n\t- " + localization.porfavorconfirmacontrasena;
                }
                if (!($("[name=Acepto]").is(":checked"))) {
                    msg += "\n\t- " + localization.porfavorconfirmacontrasena;
                }
                if (msg != "") {
                    customalert(localization.porfavorrevisadatos + msg);
                    return false;
                }

                //

                $.post("/CinesaCard/_Alta/1", { DocumentType: DocumentType, DocumentNumber: DocumentNumber, Email: Email, EmailConfirm: EmailConfirm, Password: Password, PasswordConfirm: PasswordConfirm, Acepto: Acepto }, function (data) {
                    if (data.OK) {
                        if (hasConsent(["Performance"])) {
                            ga('send', 'event', 'CinesaCard', 'Alta', 'Paso2');
                        }
                        $("article[data-id=1]").addClass("inactivo");
                        $("article[data-id=1]").removeClass("activo");
                        $("article[data-id=2]").removeClass("inactivo");
                        $("article[data-id=2]").addClass("activo");
                        $("article[data-id=2] .row").removeClass("hidden");
                        $(".enviar_solicitud[data-id=1]").hide();
                        $("article[data-id=1] input").attr("disabled", "disabled");
                    } else {
                        customalert(data.smsError);
                    }
                });
                break;
            case "2":
                var Name = $("input[name=Name]").val();
                var FirstSurname = $("input[name=FirstSurname]").val();
                var SecondSurname = $("input[name=SecondSurname]").val();
                var Address = $("input[name=Address]").val();
                var Location = $("input[name=Location]").val();
                var ZipCode = $("input[name=ZipCode]").val();
                var ddProvincia = $("#provincia").attr("data-value");

                // Validaciones

                var msg = "";
                if ($("[name=Name]").val() == "") {
                    msg += "\n\t- " + localization.camponombreobligatorio;
                }
                if (hasNumber($("[name=Name]").val())) {
                    msg += "\n\t- " + localization.camponombresinnumeros;
                }
                if ($("[name=FirstSurname]").val() == "") {
                    msg += "\n\t- " + localization.campoprimerapellidoobligatorio;
                }
                if (hasNumber($("[name=FirstSurname]").val())) {
                    msg += "\n\t- " + localization.campoprimerapellidosinnumeros;
                }
                if ($("[name=Address]").val() == "") {
                    msg += "\n\t- " + localization.campodireccionobligatorio;
                }
                if ($("[name=Location]").val() == "") {
                    msg += "\n\t- " + localization.campopoblacionobligatorio;
                }
                if (ddProvincia == "0") {
                    msg += "\n\t- " + localization.campoprovinciaobligatorio;
                }
                if ($("[name=ZipCode]").val().length != 5 || !isNumber($("[name=ZipCode]").val())) {
                    msg += "\n\t- " + localization.codigopostalnovalido;
                }
                if (msg != "") {
                    customalert(localization.porfavorrevisadatos + msg);
                    return false;
                }

                //

                $.post("/CinesaCard/_Alta/2", { Name: Name, FirstSurname: FirstSurname, SecondSurname: SecondSurname, Address: Address, Location: Location, ZipCode: ZipCode, ddProvincia: ddProvincia }, function (data) {
                    if (data.OK) {
                        if (hasConsent(["Performance"])) {
                            ga('send', 'event', 'CinesaCard', 'Alta', 'Paso3');
                        }
                        $("article[data-id=2]").addClass("inactivo");
                        $("article[data-id=2]").removeClass("activo");
                        $("article[data-id=3]").removeClass("inactivo");
                        $("article[data-id=3]").addClass("activo");
                        $("article[data-id=3] .row").removeClass("hidden");
                        $(".enviar_solicitud[data-id=2]").hide();
                        $("article[data-id=2] input").attr("disabled", "disabled");
                    } else {
                        customalert(data.smsError);
                    }
                });
                break;
            case "3":
                var Mobile = $("input[name=Mobile]").val();
                var Telephone = $("input[name=Telephone]").val();
                var BirthDate = $("#dia").attr("data-value") + "/" + $("#mes").attr("data-value") + "/" + $("#ano").attr("data-value");
                var Sexo = $("#sexo").attr("data-value");
                var ddProfesion = $("#profesion").attr("data-value");
                var EstatusCivil = $("#estatus").attr("data-value");
                var SonsNumber = $("input[name=SonsNumber]").val();

                // Validaciones

                var msg = "";

                if (BirthDate == "" || !_validaFecha(BirthDate) || BirthDate == "01/01/1900") {
                    msg += "\n\t- " + localization.fechanacimientonovalida;
                }


                if ($("[name=Mobile]").val().length != 9 || !isNumber($("[name=Mobile]").val())) {
                    msg += "\n\t- " + localization.movilnovalido;
                }

                if (($("[name=Telephone]").val().length != 9 || !isNumber($("[name=Telephone]").val())) && $("[name=Telephone]").val() != "") {
                    msg += "\n\t- " + localization.telefononovalido;
                }

                if (!isNumber($("[name=SonsNumber]").val()) && $("[name=SonsNumber]").val() != "") {
                    msg += "\n\t- " + localization.numerohijosnovalido;
                }
                if (msg != "") {
                    customalert(localization.porfavorformulario + " " + msg);
                    return false;
                }

                //

                $.post("/CinesaCard/_Alta/3", { Mobile: Mobile, Telephone: Telephone, BirthDate: BirthDate, Sexo: Sexo, ddProfesion: ddProfesion, EstatusCivil: EstatusCivil, SonsNumber: SonsNumber }, function (data) {
                    if (data.OK) {
                        if (hasConsent(["Performance"])) {
                            ga('send', 'event', 'CinesaCard', 'Alta', 'Completada'); //Todo: Poner dentro del gracias
                        }
                        $(".enviar_solicitud[data-id=3]").hide();
                        $("article[data-id=3] input").attr("disabled", "disabled");
                        document.location.href = "/CinesaCard/_Gracias";

                        //Gracias
                    } else {
                        customalert(data.smsError);
                    }
                });
                break;
        }
    });

    /*$("article[data-id]").click(function () {
        for (y = $(this).attr("data-id") ; y >= 1; y--) {
            $("article[data-id=" + y + "]").addClass("inactivo");
            $("article[data-id=" + y + "]").removeClass("activo");
        }

        for (z = $(this).attr("data-id") ; z <= 4; z++) {
            if ($("article[data-id=" + z + "]").hasClass("activo")) {
                $("article[data-id=" + z + "]").addClass("inactivo");
                $("article[data-id=" + z + "]").removeClass("activo");
            }
        }

        $(this).removeClass("inactivo");
        $(this).addClass("activo");
        $("article[data-id=" + $(this).attr("data-id") + "] .row").removeClass("hidden");
    });*/
}

function initccform_activar() {
    $(".rb_rellenar label").on("touch click", function () {
        var rellenar = $(this).attr("data-rellenar");
        $(".row-rellenar").addClass("hidden");
        $(".row-rellenar[data-rellenar='" + rellenar + "']").removeClass("hidden");
    });
    if ($("body").hasClass("n_cc")) {
        var logged = $("#cinefavorito_header").hasClass("logged");
        if (logged) {
            $(".nologin").addClass("hidden");
            $("#formlogin").removeClass("hidden");
        } else {

        }
        $(".frm1 .cc_btn").click(function () {
            var Cinesacard = $(".frm1 input[name=Cinesacard]").val();
            var Email = $(".frm1 input[name=emailfirst]").val();
            var Mobile = $(".frm1 input[name=mobilefirst]").val();
            var DocumentType = "";
            if (!$(".frm1 input[name=documentTypefirst][disabled]").length) {
                DocumentType = $(".frm1 input[name=documentTypefirst]:checked").val();
            } else {
                DocumentType = $(".frm1 input[name=documentTypefirst]").val();
            }
            if (typeof (DocumentType) == "undefined") {
                DocumentType = "";
            }
            var DocumentNumber = $(".frm1 input[name=documentNumberfirst]").val();
            var seleccion = $(".frm1 input[name=rellenar]:checked").val();
            var postdata = "";
            switch (seleccion) {
                case "1":
                    postdata = { Cinesacard: Cinesacard, DocumentType: DocumentType, DocumentNumber: DocumentNumber };
                    break;
                case "2":
                    postdata = { Cinesacard: Cinesacard, Email: Email };
                    break;
                case "3":
                    postdata = { Cinesacard: Cinesacard, Mobile: Mobile };
                    break;
            }
            if ((Cinesacard.length >= 8) && ((Email.length && _validateEmail(Email)) || Mobile.length || (DocumentType.length && DocumentNumber.length))) {
                $.post("/CinesaUser/CCActivaCheck", postdata, function (data) {
                    //console.log(data);
                    if (data.GetCard_ToActivateResponse.returnCode == 0 || data.GetCard_ToActivateResponse.returnCode == "0") {
                        $(".frm1 .row").addClass("hidden");
                        $(".frm1 p").addClass("hidden");
                        $(".frm1 input[name=Cinesacard]").attr("disabled", "disabled").attr("readonly", "readonly");
                        $(".frm1 input[name=Cinesacard]").parents(".row").removeClass("hidden");
                        $(".frm1").removeClass("activo");
                        $(".frm1").addClass("inactivo");
                        $(".frm1 .cc_btn").addClass("hidden");
                        $(".frm2").addClass("activo");
                        $(".frm2 #formstart").removeClass("hidden");

                        $(".frm2 input[name=useralta],.frm2 input[name=loginuser]").val(data.GetCard_ToActivateResponse.UserToActivate.UserToActivate.email);


                        $(".frm3 input[name=documentType][value=" + data.GetCard_ToActivateResponse.UserToActivate.UserToActivate.documentType + "]").parent().click();
                        $(".frm3 input[name=documentNumber]").val(data.GetCard_ToActivateResponse.UserToActivate.UserToActivate.documentNumber);
                        $(".frm3 input[name=name]").val(data.GetCard_ToActivateResponse.UserToActivate.UserToActivate.name);
                        $(".frm3 input[name=firstsurname]").val(data.GetCard_ToActivateResponse.UserToActivate.UserToActivate.firstSurname);
                        $(".frm3 input[name=secondsurname]").val(data.GetCard_ToActivateResponse.UserToActivate.UserToActivate.secondSurname);
                        if (data.GetCard_ToActivateResponse.UserToActivate.UserToActivate.birthDate != null) {
                            var fecha = data.GetCard_ToActivateResponse.UserToActivate.UserToActivate.birthDate.split(" ")[0].split("/");
                            if (fecha[2] != "1900") {
                                $(".frm3 input[name=dd][value=" + fecha[0] + "]").parent().click().parents(".radiobox").addClass("disabled");
                                $(".frm3 input[name=mm][value=" + fecha[1] + "]").parent().click().parents(".radiobox").addClass("disabled");
                                $(".frm3 input[name=aaaa][value=" + fecha[2] + "]").parent().click().parents(".radiobox").addClass("disabled");
                            }
                        }
                        $(".frm4 input[name=mobile]").val(data.GetCard_ToActivateResponse.UserToActivate.UserToActivate.mobile);
                    } else {
                        if (typeof (data.GetCard_ToActivateResponse.returnDescription) != "undefined") {
                            customalert(data.GetCard_ToActivateResponse.returnDescription);
                        } else {
                            customalert(localization.enestosmomentosincidencias);
                        }
                    }
                });
            } else {
                customalert(localization.porfavorcompruebadatos);
            }
        });
        $("#formstart .cc_btn.log").click(function () {
            if (!$("#cinefavorito_header").hasClass("logged")) {
                $("#formlogin").removeClass("hidden");
            } else {
                $(".frm3").addClass("activo");
                $(".frm3 .row").removeClass("hidden");
                $(".frm3").removeClass("activo").addClass("inactivo");
                $(".frm4").addClass("activo").removeClass("hidden");
                $(".frm4 .row").removeClass("hidden");
                $(".frm4 .cc_btn").removeClass("hidden");
                $('html, body').animate({
                    scrollTop: $(".frm4").offset().top
                }, 500);
            }
            $("#formstart").addClass("hidden");
        });

        $("#formlogin .cc_btn").click(function () {
            loginCinesaUser($("#formlogin input[name=loginuser]").val(), $("#formlogin input[name=loginpass]").val(), false, function (data) {
                if (data.UserLoginResponse.UserInformation.UserInformation.isCinesaCardUser == "Y") {
                    location.reload();
                }
                $("#formlogin input[name=loginuser]").attr("disabled", "disabled").attr("readonly", "readonly");
                $("#formlogin input[name=loginpass]").attr("disabled", "disabled").attr("readonly", "readonly");
                $("#formlogin .cc_btn.nologin").addClass("hidden");
                $("#formlogin .mini.nologin").addClass("hidden");
                $.post("/CinesaUser/UserDetail", function (data) {
                    $(".frm2").removeClass("activo").addClass("inactivo");
                    $(".frm3").addClass("activo");
                    $(".frm3 .row").removeClass("hidden");
                    $(".frm3 input[name=documentType][value=" + data.UserGetPersonalInformationResponse.userInformation.User.documentType + "]").parent().click();
                    $(".frm4 input[name=civilstatus][value=" + data.UserGetPersonalInformationResponse.userInformation.User.civilStatus + "]").parent().click();
                    $(".frm3 input[name=gender][value=" + data.UserGetPersonalInformationResponse.userInformation.User.gender + "]").parent().click();
                    $(".frm4 input[name=profession][value=" + data.UserGetPersonalInformationResponse.userInformation.User.profession + "]").parent().click();
                    $(".frm4 input[name=provincia][value=" + data.UserGetPersonalInformationResponse.userInformation.User.region + "]").parent().click();
                    $(".frm3 input[name=documentNumber]").val(data.UserGetPersonalInformationResponse.userInformation.User.documentNumber);
                    $(".frm3 input[name=name]").val(data.UserGetPersonalInformationResponse.userInformation.User.name);
                    $(".frm3 input[name=firstsurname]").val(data.UserGetPersonalInformationResponse.userInformation.User.firstSurname);
                    $(".frm3 input[name=secondsurname]").val(data.UserGetPersonalInformationResponse.userInformation.User.secondSurname);
                    $(".frm4 input[name=address]").val(data.UserGetPersonalInformationResponse.userInformation.User.address);
                    $(".frm4 input[name=kidsnumber]").val(data.UserGetPersonalInformationResponse.userInformation.User.kidsNumber);
                    $(".frm4 input[name=location]").val(data.UserGetPersonalInformationResponse.userInformation.User.location);
                    $(".frm4 input[name=mobile]").val(data.UserGetPersonalInformationResponse.userInformation.User.mobile);
                    $(".frm4 input[name=postalcode]").val(data.UserGetPersonalInformationResponse.userInformation.User.postalCode);


                    if (data.UserGetPersonalInformationResponse.userInformation.User.birthDate != null) {
                        var fecha = data.UserGetPersonalInformationResponse.userInformation.User.birthDate.split(" ")[0].split("/");
                        if (fecha[2] != "1900") {
                            $(".frm3 input[name=dd][value=" + fecha[0] + "]").parent().click().parents(".radiobox").addClass("disabled");
                            $(".frm3 input[name=mm][value=" + fecha[1] + "]").parent().click().parents(".radiobox").addClass("disabled");
                            $(".frm3 input[name=aaaa][value=" + fecha[2] + "]").parent().click().parents(".radiobox").addClass("disabled");
                        }
                    }

                    $(".frm4 .cc_btn").removeClass("hidden");
                    //console.log(data);
                });

                //console.log(data);
            });
        });

        $("#formstart .cc_btn.reg").click(function () {
            $("#formalta").removeClass("hidden");
            $("#formstart").addClass("hidden");
        });

        $("#formalta input[name=useralta]").change(function () {
            $("#formalta input[name=useralta]").removeClass("pop_ok").removeClass("pop_bad");
            $(".pop_error[data-errorfor=useralta]").html("");
            
            if ($("#formalta input[name=ruseralta]").val().length > 0) {
                $("#formalta input[name=ruseralta]").change();
            }
        });

        $("#formalta input[name=ruseralta]").change(function () {
            $("#formalta input[name=ruseralta]").removeClass("pop_ok").removeClass("pop_bad");
            $(".pop_error[data-errorfor=useralta]").html("");
            if ($("#formalta input[name=useralta]").val() == $("#formalta input[name=ruseralta]").val()) {
                $("#formalta input[name=ruseralta]").addClass("pop_ok");
            } else {
                $("#formalta input[name=ruseralta]").addClass("pop_bad");
                $(".pop_error[data-errorfor=useralta]").html("El usuario debe coincidir");
            }
        });

        $("#formalta input[name=passalta]").change(function () {
            var res = _validaPass($("#formalta input[name=passalta]").val());
            $("#formalta input[name=passalta]").removeClass("pop_ok").removeClass("pop_bad");
            $(".pop_error[data-errorfor=passalta]").html("");
            if (res != "OK") {
                $("#formalta input[name=passalta]").addClass("pop_bad");
                $(".pop_error[data-errorfor=passalta]").html(res);
            } else {
                $("#formalta input[name=passalta]").addClass("pop_ok");
            }
            if ($("#formalta input[name=rpassalta]").val().length > 0) {
                $("#formalta input[name=rpassalta]").change();
            }
        });

        $("#formalta input[name=rpassalta]").change(function () {
            $("#formalta input[name=rpassalta]").removeClass("pop_ok").removeClass("pop_bad");
            $(".pop_error[data-errorfor=passalta]").html("");
            if ($("#formalta input[name=passalta]").val() == $("#formalta input[name=rpassalta]").val()) {
                $("#formalta input[name=rpassalta]").addClass("pop_ok");
            } else {
                $("#formalta input[name=rpassalta]").addClass("pop_bad");
                $(".pop_error[data-errorfor=passalta]").html(localization.contrasenascoincidir);
            }
        });

        $("#formalta input").change(function () {
            var send = true;
            var errmsg = "";
            if ($("#formalta input[name=useralta]").val() != "" && $("#formalta input[name=ruseralta]").val() != ""
                && $("#formalta input[name=passalta]").val() != "" && $("#formalta input[name=rpassalta]").val() != "") {
                $(".pop_error[data-errorfor=useralta]").html("");
                $(".pop_error[data-errorfor=passalta]").html("");
                $("#formalta input[name=useralta]").removeClass("pop_ok").removeClass("pop_bad");
                $("#formalta input[name=ruseralta]").removeClass("pop_ok").removeClass("pop_bad");
                $("#formalta input[name=passalta]").removeClass("pop_ok").removeClass("pop_bad");
                $("#formalta input[name=rpassalta]").removeClass("pop_ok").removeClass("pop_bad");
                //User
                if (!_validateEmail($("#formalta input[name=useralta]").val())) {
                    send = false;
                    $("#formalta input[name=useralta]").addClass("pop_bad");
                    errmsg += "\n" + localization.nombredeusuario;
                }

                if (!($("#formalta input[name=useralta]").val()) == $("#formalta input[name=ruseralta]").val()) {
                    $("#formalta input[name=ruseralta]").addClass("pop_bad");
                    $(".pop_error[data-errorfor=useralta]").html(localization.usuariodebecoincidir);
                    errmsg += "\n" + localization.nombredeusuariocoincidir;
                }

                //Pass
                var res = _validaPass($("#formalta input[name=passalta]").val());
                if (res != "OK") {
                    send = false;
                    $(".pop_error[data-errorfor=passalta]").html(res);
                    errmsg += "\n" + localization.password;
                }

                if (!($("#formalta input[name=passalta]").val() == $("#formalta input[name=rpassalta]").val())) {
                    send = false;
                    $("#formalta input[name=rpassalta]").addClass("pop_bad");
                    $(".pop_error[data-errorfor=passalta]").html(localization.contrasenascoincidir);
                    errmsg += "\n" + localization.passworddebecoincidir;
                }

                if (send) {
                    //$("#formalta").addClass("hidden");
                    $(".frm3").addClass("activo");
                    $(".frm2").addClass("inactivo").removeClass("activo");
                    $(".frm3 .row").removeClass("hidden");
                } else {
                    //errmsg = "Por favor revisa los siguientes campos:" + errmsg;
                    //alert(errmsg);
                }
            }
            return false;
        });

        $(".frm3 input").change(function () {
            var send = true;
            if (!$(".frm3 input[name=documentType][disabled]").length) {
                if (!$(".frm3 input[name=documentType]:checked").length) {
                    //console.log("documentType");
                    send = false;
                }
            }
            if (!$(".frm3 input[name=dd]:checked").length) {
                //console.log("dd");
                send = false;
            }
            if (!$(".frm3 input[name=mm]:checked").length) {
                //console.log("mm");
                send = false;
            }
            if (!$(".frm3 input[name=aaaa]:checked").length) {
                //console.log("aaaa");
                send = false;
            }
            if (!$(".frm3 input[name=gender]:checked").length) {
                //console.log("gender");
                send = false;
            }
            if ($(".frm3 input[name=documentNumber]").val() == "") {
                //console.log("documentNumber");
                send = false;
            }
            if ($(".frm3 input[name=name]").val() == "") {
                //console.log("name");
                send = false;
            }
            if ($(".frm3 input[name=firstsurname]").val() == "") {
                //console.log("firstsurname");
                send = false;
            }

            if (send) {
                $(".frm3").removeClass("activo").addClass("inactivo");
                $(".frm4").addClass("activo").removeClass("hidden");
                $(".frm4 .row").removeClass("hidden");
                $(".frm4 .cc_btn").removeClass("hidden");
                $('html, body').animate({
                    scrollTop: $(".frm4").offset().top
                }, 500);
            } else {
                $(".frm4 .cc_btn").addClass("hidden");
            }
        });

        $(".frm4 input").change(function () {
            //console.log("Entro");
            var send = true;
            if (!$(".frm4 input[name=provincia]:checked").length) {
                send = false;
            }
            /*if (!$(".frm4 input[name=profesion]:checked").length) {
                send = false;
            }
            if (!$(".frm4 input[name=civilstatus]:checked").length) {
                send = false;
            }*/
            if ($(".frm4 input[name=address]").val() == "") {
                send = false;
            }
            if ($(".frm4 input[name=location]").val() == "") {
                send = false;
            }
            if ($(".frm4 input[name=postalcode]").val() == "") {
                send = false;
            }
            else {
                if (country.toLowerCase() == "es") {
                    var pattern = new RegExp(/^([1-9]{2}|[0-9][1-9]|[1-9][0-9])[0-9]{3}$/);
                    if (!pattern.test($(".frm4 input[name=postalcode]").val())) {
                        errormsg += "- " + localization.codigopostalincorrecto + "\n";
                    }
                }
            }
            if ($(".frm4 input[name=mobile]").val() == "") {
                send = false;
            }
            else {
                var pattern = new RegExp(/^[\d]{3}[-]*([\d]{2}[-]*){2}[\d]{2}$/);
                if (!pattern.test($(".frm4 input[name=mobile]").val())) {
                    errormsg += "- " + localization.telefonomovilincorrecto + "\n";
                }
            }
            /*if ($(".frm4 input[name=kidsnumber]").val() == "") {
                send = false;
            }*/
            if (!$(".frm4 input[name=privacidad]").is(":checked")) {
                send = false;
            }
            if (send) {
                //$(".frm3").removeClass("activo").addClass("inactivo");
                $(".frm4 .cc_btn").removeAttr("disabled");
            } else {
                $(".frm4 .cc_btn").attr("disabled", "disabled");
                //$(".frm4 .cc_btn").addClass("hidden");
            }
        });

        // Alta User + CC a la vez
        $(".frm4 .cc_btn").click(function (e) {
            e.preventDefault();
            var isNewUser = !$("#cinefavorito_header").hasClass("logged");
            var objEnvio = new Object();
            var UserInformation = new Object;
            if (isNewUser) {
                objEnvio.Email = $("#formalta input[name=useralta]").val();
                objEnvio.Password = $("#formalta input[name=passalta]").val();
            } else {
                objEnvio.Email = $("#formlogin input[name=loginuser]").val();
            }
            objEnvio.Gender = $(".frm3 input[name=gender]:checked").val();
            objEnvio.Name = $(".frm3 input[name=name]").val();
            objEnvio.FirstSurname = $(".frm3 input[name=firstsurname]").val();
            if ($(".frm3 input[name=secondsurname]").val() != "") {
                objEnvio.SecondSurname = $(".frm3 input[name=secondsurname]").val();
            }
            objEnvio.BirthDate = $(".frm3 input[name=dd]:checked").val() + "/" + $(".frm3 input[name=mm]:checked").val() + "/" + $(".frm3 input[name=aaaa]:checked").val();
            if (objEnvio.BirthDate.length > 10) {
                customalert(localization.porfavorfechanacimiento);
                return false;
            }
            objEnvio.Mobile = $(".frm4 input[name=mobile]").val();
            if (objEnvio.Mobile.length < 9) {
                customalert(localization.porfavornumeromovilcorrecto);
                return false;
            }
            else {
                var pattern = new RegExp(/^[\d]{3}[-]*([\d]{2}[-]*){2}[\d]{2}$/);
                if (!pattern.test(objEnvio.Mobile)) {
                    errormsg += localization.porfavornumeromovilcorrecto + "\n";
                }
            }
            if (!$(".frm3 input[name=documentType][disabled]").length) {
                objEnvio.DocumentType = $(".frm3 input[name=documentType]:checked").val();
            } else {
                objEnvio.DocumentType = $(".frm3 input[name=documentType]").val();
            }
            objEnvio.DocumentNumber = $(".frm3 input[name=documentNumber]").val();
            objEnvio.Address = $(".frm4 input[name=address]").val();
            objEnvio.Location = $(".frm4 input[name=location]").val();
            objEnvio.PostalCode = $(".frm4 input[name=postalcode]").val();
            objEnvio.Region = $(".frm4 input[name=provincia]:checked").val();
            /*objEnvio.X = $("#formalta input[name=passalta]").val();
            objEnvio.Y = $("#formalta input[name=passalta]").val();*/
            //objEnvio.Profession = $(".frm4 input[name=profesion]:checked").val();
            //objEnvio.CivilStatus = $(".frm4 input[name=civilstatus]:checked").val();
            if ($(".frm4 input[name=kidsnumber]").val() != "") {
                objEnvio.KidsNumber = $(".frm4 input[name=kidsnumber]").val();
            }
            //objEnvio.ReceiveComunications = $(".frm4 input[name=comm]").is(":checked") ? "Y" : "N";
            //objEnvio.ReceiveComunications_cinesacard = $(".frm4 input[name=comm]").is(":checked") ? "N" : "Y";

            UserInformation.UserInformation = objEnvio;
            isNewUser = (isNewUser ? "Y" : "N");
            $.post("/CinesaUser/CCActivaForm", { UserInformation: JSON.stringify(UserInformation), NU: isNewUser, Email: objEnvio.Email, fbid: _fbid, fbat: _fbat }, function (data) {
                if (isNewUser == "Y") {
                    if (data.ActivateCinesacard_NewUserResponse.returnCode == "0" || data.ActivateCinesacard_NewUserResponse.returnCode == 0) {
                        $(".graciasbienvenido .mail").html(objEnvio.Email);
                        $(".regform").addClass("hidden");
                        $(".graciasbienvenido").removeClass("hidden");
                        if (hasConsent(["Performance"])) {
                            ga('send', 'event', 'CinesaUser', 'Activacion', 'CinesaUser+CC');
                        }
                    } else {
                        if (typeof (data.ActivateCinesacard_NewUserResponse.returnDescription) != "undefined") {
                            customalert(data.ActivateCinesacard_NewUserResponse.returnDescription);
                        } else {
                            customalert(localization.enestosmomentosincidencias);
                        }
                    }
                } else {
                    if (data.ActivateCinesacard_CinesaUserResponse.returnCode == "0" || data.ActivateCinesacard_CinesaUserResponse.returnCode == 0) {
                        $(".graciasbienvenido .mail").html(objEnvio.Email);
                        $(".regform").addClass("hidden");
                        $(".graciasbienvenido").removeClass("hidden");
                        if (hasConsent(["Performance"])) {
                            ga('send', 'event', 'CinesaUser', 'Activacion', 'Solo CC');
                        }
                    } else {
                        if (typeof (data.ActivateCinesacard_CinesaUserResponse.returnDescription) != "undefined") {
                            customalert(data.ActivateCinesacard_CinesaUserResponse.returnDescription);
                        } else {
                            customalert(localization.enestosmomentosincidencias);
                        }
                    }
                }
            });
            return false;
        });
        $("a.resend").click(function (e) {
            e.preventDefault();
            $.post("/CinesaUser/CCActivaResend", function (data) {
                customalert(localization.tehemosenviadoemailconfirmacion);
                $("a.resend").addClass("hidden");
            });
        });
        return false;
    }
    $("#tipodocumento").customselect();
    $("#provincia").customselect();
    $("#dia").customselect();
    $("#mes").customselect();
    $("#ano").customselect();
    $("#sexo").customselect();
    $("#profesion").customselect();
    $("#estatus").customselect();

    /*for (x = 2; x <= 4; x++) {
        $("article[data-id=" + x + "]").removeClass("inactivo");
        $("article[data-id=" + x + "]").removeClass("activo");
        $("article[data-id=" + x + "] .row").addClass("hidden");
    }*/

    //gaq.push(['_trackEvent', 'CinesaCard', 'Activar', 'Paso1']);

    $(".enviar_solicitud").click(function (e) {
        e.preventDefault();
        switch ($(this).attr("data-id")) {
            case "0":
                var CinesacardNumber = $("input[name=CinesacardNumber]").val();
                // Validacion
                $.post("/CinesaCard/_Activar/0", { CinesacardNumber: CinesacardNumber }, function (data) {
                    if (data.OK) {
                        if (hasConsent(["Performance"])) {
                            ga('send', 'event', 'CinesaCard', 'Activar', 'Paso1');
                        }
                        $(".enviar_solicitud[data-id=0]").hide();
                        $("article[data-id=1]").addClass("inactivo");
                        $("article[data-id=1]").removeClass("activo");
                        $("article[data-id=2]").removeClass("inactivo");
                        $("article[data-id=2]").addClass("activo");
                        $("article[data-id=2] .row").removeClass("hidden");
                        $("article[data-id=1] input").attr("disabled", "disabled");
                    } else {
                        customalert(data.smsError);
                    }
                });
                break;
            case "1":
                var CinesacardNumber = $("input[name=CinesacardNumber]").val();
                var DocumentType = $("#tipodocumento").attr("data-value");
                var DocumentNumber = $("input[name=DocumentNumber]").val();
                var Mobile = $("input[name=MobileChek]").val();
                var Email = $("input[name=EmailChek]").val();
                // Validacion
                $.post("/CinesaCard/_Activar/1", { CinesacardNumber: CinesacardNumber, DocumentType: DocumentType, DocumentNumber: DocumentNumber, Mobile: Mobile, Email: Email }, function (data) {
                    if (data.OK) {
                        if (hasConsent(["Performance"])) {
                            ga('send', 'event', 'CinesaCard', 'Activar', 'Paso2');
                        }
                        $(".enviar_solicitud[data-id=1]").hide();
                        $("article[data-id=2]").addClass("inactivo");
                        $("article[data-id=2]").removeClass("activo");
                        $("article[data-id=3]").removeClass("inactivo");
                        $("article[data-id=3]").addClass("activo");
                        $("article[data-id=3] .row").removeClass("hidden");
                        $("article[data-id=2] input").attr("disabled", "disabled");
                        $("input[name=Name]").val(data.clientInfo.ClientInfo.Name ? data.clientInfo.ClientInfo.Name : "");
                        $("input[name=FirstSurname]").val(data.clientInfo.ClientInfo.FirstSurname ? data.clientInfo.ClientInfo.FirstSurname : "");
                        $("input[name=SecondSurname]").val(data.clientInfo.ClientInfo.SecondSurname ? data.clientInfo.ClientInfo.SecondSurname : "");
                        $("input[name=Location]").val(data.clientInfo.ClientInfo.Location ? data.clientInfo.ClientInfo.Location : "");
                        $("input[name=Address]").val(data.clientInfo.ClientInfo.Address ? data.clientInfo.ClientInfo.Address : "");
                        $("input[name=ZipCode]").val(data.clientInfo.ClientInfo.ZipCode ? data.clientInfo.ClientInfo.ZipCode : "");
                        $("input[name=Email]").val(data.clientInfo.ClientInfo.Email ? data.clientInfo.ClientInfo.Email : Email);
                        $("input[name=Mobile]").val(data.clientInfo.ClientInfo.Mobile ? data.clientInfo.ClientInfo.Mobile : Mobile);
                        $("input[name=Telephone]").val(data.clientInfo.ClientInfo.Telephone ? data.clientInfo.ClientInfo.Telephone : "");
                        $("input[name=SonsNumber]").val(data.clientInfo.ClientInfo.SonsNumber ? data.clientInfo.ClientInfo.SonsNumber : "");
                    } else {
                        customalert(data.smsError);
                    }
                });
                break;
            case "2":
                var Email = $("input[name=Email]").val();
                var EmailConfirm = $("input[name=EmailConfirm]").val();
                var Password = $("input[name=Password]").val();
                var PasswordConfirm = $("input[name=PasswordConfirm]").val();
                var FirstName = $("input[name=Name]").val();
                var FirstSurname = $("input[name=FirstSurname]").val();
                var SecondSurname = $("input[name=SecondSurname]").val();
                var Location = $("input[name=Location]").val();
                var Address = $("input[name=Address]").val();
                var ZipCode = $("input[name=ZipCode]").val();
                var ddProvincia = $("#provincia").attr("data-value");
                // Validacion
                $.post("/CinesaCard/_Activar/2", { Email: Email, EmailConfirm: EmailConfirm, Password: Password, PasswordConfirm: PasswordConfirm, Name: FirstName, FirstSurname: FirstSurname, SecondSurname: SecondSurname, Location: Location, Address: Address, ZipCode: ZipCode, ddProvincia: ddProvincia }, function (data) {
                    if (data.OK) {
                        if (hasConsent(["Performance"])) {
                            ga('send', 'event', 'CinesaCard', 'Activar', 'Paso3');
                        }
                        $("article[data-id=3]").addClass("inactivo");
                        $("article[data-id=3]").removeClass("activo");
                        $("article[data-id=4]").removeClass("inactivo");
                        $("article[data-id=4]").addClass("activo");
                        $("article[data-id=4] .row").removeClass("hidden");
                    } else {
                        customalert(data.smsError);
                    }
                });
                break;
            case "3":
                var BirthDate = $("#dia").attr("data-value") + "/" + $("#mes").attr("data-value") + "/" + $("#ano").attr("data-value");
                var Sexo = $("#sexo").attr("data-value");
                var ddProfesion = $("#profesion").attr("data-value");
                var EstatusCivil = $("#estatus").attr("data-value");
                var SonsNumber = $("input[name=SonsNumber]").val();
                var Telephone = $("input[name=Telephone]").val();
                var Mobile = $("input[name=Mobile]").val();
                // Validacion
                $.post("/CinesaCard/_Activar/3", { BirthDate: BirthDate, Sexo: Sexo, ddProfesion: ddProfesion, EstatusCivil: EstatusCivil, SonsNumber: SonsNumber, Telephone: Telephone, Mobile: Mobile }, function (data) {
                    if (data.OK) {
                        if (hasConsent(["Performance"])) {
                            ga('send', 'event', 'CinesaCard', 'Activar', 'Paso4');
                        }
                        document.location.href = "/CinesaCard/_Gracias";
                    } else {
                        customalert(data.smsError);
                    }
                });
                break;
        }
    });

    /*$("article[data-id]").click(function () {
        for (y = $(this).attr("data-id") ; y >= 1; y--) {
            $("article[data-id=" + y + "]").addClass("inactivo");
            $("article[data-id=" + y + "]").removeClass("activo");
        }

        for (z = $(this).attr("data-id") ; z <= 4; z++) {
            if ($("article[data-id=" + z + "]").hasClass("activo")) {
                $("article[data-id=" + z + "]").addClass("inactivo");
                $("article[data-id=" + z + "]").removeClass("activo");
            }
        }

        $(this).removeClass("inactivo");
        $(this).addClass("activo");
        $("article[data-id=" + $(this).attr("data-id") + "] .row").removeClass("hidden");
    });*/
}

function initCinesacard() {
    $(".puntos_menu li").click(function () {
        var section = ($(this).html());
        switch (section) {
            case "TABLA DE PUNTOS Y REGALOS":
                $(this).parent().find("li").removeClass("selected");
                $(this).addClass("selected");
                $(".puntos .div-1").removeClass("hidden");
                $(".puntos .div-2").addClass("hidden");
                $(".puntos .div-3").addClass("hidden");
                break;
            case "¿CÓMO ACUMULAR PUNTOS?":
                $(this).parent().find("li").removeClass("selected");
                $(this).addClass("selected");
                $(".puntos .div-1").addClass("hidden");
                $(".puntos .div-2").removeClass("hidden");
                $(".puntos .div-3").addClass("hidden");
                break;
            case "PREGUNTAS FRECUENTES":
                $(this).parent().find("li").removeClass("selected");
                $(this).addClass("selected");
                $(".puntos .div-1").addClass("hidden");
                $(".puntos .div-2").addClass("hidden");
                $(".puntos .div-3").removeClass("hidden");
                break;
        }
    });

    $("li.pregunta").click(function () {
        var pregunta;
        pregunta = $(this).attr("data-id");
        if ($("li.respuesta[data-id=" + pregunta + "]").hasClass("hidden")) {
            $("li.respuesta[data-id=" + pregunta + "]").removeClass("hidden");
            $("li.pregunta[data-id=" + pregunta + "] span.mas").addClass("menos");
            $("li.pregunta[data-id=" + pregunta + "] span").removeClass("mas");
        } else {
            $("li.respuesta[data-id=" + pregunta + "]").addClass("hidden");
            $("li.pregunta[data-id=" + pregunta + "] span.menos").addClass("mas");
            $("li.pregunta[data-id=" + pregunta + "] span").removeClass("menos");
        }
    });

    $(".formlogin form").submit(function () {
        if ($("body").hasClass("n_cc")) {
            loginCinesaUser($(".formlogin form input[name=email]").val(), $(".formlogin form input[name=pass]").val(), true);
        } else {
            loginCinesacard($(".formlogin form input[name=email]").val(), $(".formlogin form input[name=pass]").val());
        }
        return false;
    });
}

function initEventos() {
    var preferencias = ["Ballet", "Comedia", "Concierto", "Deportivo", "Documental", "Evento: Musical", "Evento: Ópera", "Evento: Teatro", "Evento: Bollywood", "Evento: Otaku"];
    $("#filtroeventos li").addClass("hidden");

    $("#filtroeventos li a[data-filter=todos]").parents("li").removeClass("hidden");
    //$("#filtroeventos li a[data-filter=otros]").parents("li").removeClass("hidden");
    $("#cartelera>ul>li").each(function () {
        if ($("#filtroeventos li a[data-filter='" + $(this).attr("data-preferencia") + "']").length > 0) {
            $("#filtroeventos li a[data-filter='" + $(this).attr("data-preferencia") + "']").parents("li").removeClass("hidden");
        } else {
            $("#filtroeventos li a[data-filter=otros]").parents("li").removeClass("hidden");
        }
    });

    $("#filtroeventos li.eventos_empresa").removeClass("hidden");
    /*$.each(preferencias, function (i, v) {
        console.log(v);
    });*/

    $("#filtroeventos a").click(function (e) {
        if ($(this).parent().hasClass("eventos_empresa")) {
            return true;
        }
        $("#filtroeventos li").removeClass("selected");
        $(this).parent().parent().addClass("selected");
        $("#cartelera li.listado-peliculas-item").hide();
        switch ($(this).attr("data-filter")) {
            case "todos":
                $("#cartelera li.listado-peliculas-item").show();
                /*
                $("#cartelera li.listado-peliculas-item").each(function () {
                    switch ($(this).attr("data-preferencia")) {
                        case preferencias[5]:
                            console.log("musica");
                            break;
                        default:
                            console.log("otros");
                    
                });}*/
                break;
            case "otros":
                $("#cartelera li.listado-peliculas-item").each(function () {
                    if ($.inArray($(this).attr("data-preferencia"), preferencias) == -1) {
                        $(this).show();
                    }
                });
                //console.log("otros");
                break;
            default:
                $("#cartelera li.listado-peliculas-item[data-preferencia='" + $(this).attr("data-filter") + "']").show();
        }
    });



}

function initTrailers(seccion) {
    if (seccion != "cartelera") {
        $("a.vf.linkcartel").contents().unwrap();
        setupAds();
    }
    $("#orden a").click(sortButtons);
}

function setupAds() {
    /*
    $fpad('*', {
        clickThroughDialogEnabled: false,
        //preroll: 'http://des.smartclip.net/ads?t=de&p=9372&pl=testc&test=ms_vast2_socialmenu&sz=400x320&rnd=[random]',
        //midroll: 'http://des.smartclip.net/ads?t=de&p=9372&pl=testc&test=ms_vast2&sz=400x320&rnd=[random]',
        //postroll: 'http://des.smartclip.net/ads?t=de&p=9372&pl=testc&test=ms_vast2&sz=400x320&rnd=[random]',
        preroll: 'http://des.smartclip.net/ads?t=de&p=9372&pl=a03fd96c&sz=400x320&rnd=[random]',
        //midroll: 'http://des.smartclip.net/ads?t=de&p=9372&pl=a03fd96c&sz=400x299&rnd=[random]',
        postroll: 'http://des.smartclip.net/ads?t=de&p=9372&pl=a03fd96c&sz=400x300&rnd=[random]',
        //overlay: 'http://des.smartclip.net/ads?t=de&p=9372&pl=testpfadxwr&cat=ms_vast2_overlay&sz=300x50&rnd=[random]',
        overlayDelay: 3,
        overlayDuration: 25,
        minDurationForMidrolls: 30,
        adCountdownText: 'This ad remains [time] seconds',
    });
    */
}

function trailerHome(trailer) {
    if ((trailer.indexOf(".webm") > -1) || (trailer.indexOf(".mp4") > -1)) {
        $("#trailerhome").show();
        if (!$("#trailerhome").hasClass("closed")) {
            $("#trailerhome").flowplayer({
                analytics: "UA-8080924-4",
                key: "$265253087756312",
                playlist: [
                    [
                        { mp4: trailer.replace(".webm", ".mp4") }
                    ]
                ],
                ratio: 9 / 16,   // video with 4:3 aspect ratio
                splash: false  // a splash setup
            }).one('ready', function (ev, api) {
                //console.log(this);
                setupAds();
                $("#trailerhome").append('<a style="display: block; top: -50px; width: 50px; height: 50px; background-image: none; line-height: 50px; font-size: 30px; text-align: center; color: #FFF; background-color: #000; right: 0px;" class="fp-close">X</a>');
                $("#trailerhome").addClass("closed");
                trailerHome(trailer);
            });
        } else {
            $("#trailerhome").flowplayer().load([
                { mp4: trailer.replace(".webm", ".mp4") }
            ], function (event, api, video) {
                setTimeout(function () {
                    api.resume();
                }, 500)

                //api.play();
            });
        }
    }
}

function trailerHome2(trailer, nombre, cartel) {
    var htmltrailer = '<video id="trailerhome_video" controls preload="auto" poster="' + cartel + '" class="video-js vjs-big-play-centered vjs-16-9" data-setup="{}" width="437" height="284"><source src="' + trailer + '" type="video/mp4"></video><a data-rel="trailerhome_video" class="skipbutton hidden" href="#">Saltar publicidad</a>';
    if (trailer.match(/youtu/i)) {
        if (country.toLowerCase() == "es") {
            htmltrailer = '<video id="trailerhome_video" controls preload="auto" poster="' + cartel + '" class="video-js vjs-big-play-centered vjs-16-9" data-setup=\'{"techOrder": ["youtube"], "sources": [{ "type": "video/youtube", "src": "' + trailer + '"}]}\' width="437" height="284"></video><a data-rel="trailerhome_video" class="skipbutton hidden" href="#">Saltar publicidad</a>';
        } else {
            youtube_id = trailer.split(/v\/|v=|youtu\.be\//)[1].split(/[?&]/)[0];
            htmltrailer = '<iframe class="trailer" src="//www.youtube.com/embed/' + youtube_id + '" frameborder="0" allowfullscreen width="100%" height="400"></iframe>';
        }
    }
    $(".video_wrapper").html(htmltrailer);
    $("#trailerhome").removeClass("hidden").removeClass("closed");
    $("#trailerhome_video").parent().attr("data-titulo", nombre);
    if (country.toLowerCase() != "es") {
        return;
    }
    var _player = new Player("trailerhome_video");
    _player.init();
    setTimeout(function () {
        $("#trailerhome_video_ima-ad-container").click();
    }, 1000);


}

function clockDate(futureDate) {
    var currentDate = new Date();
    if (futureDate.getTime() < currentDate.getTime()) {
        futureDate = currentDate;
    }
    return futureDate.getTime() / 1000 - currentDate.getTime() / 1000;
}

function pers_followCursor() {
    if ($("html").hasClass("touch")) {
        return;
    }
    var easingAmount = 0.005;
    var ship = $("#pers_dory");
    ship.removeClass("hidden");
    var currentMousePos = { x: -1, y: -1 };
    var fps = 60;
    var fpsani = 5;
    var anipos = 0;
    var offsetfromcursor = 80;
    $(document).mousemove(function (event) {
        currentMousePos.x = event.pageX;
        currentMousePos.y = event.pageY;
    });
    setInterval(function () {
        var shippos = ship.offset();
        var xDistance = currentMousePos.x - shippos.left;
        var yDistance = currentMousePos.y - shippos.top;
        var distance = Math.sqrt(xDistance * xDistance + yDistance * yDistance);
        if (distance > offsetfromcursor) {
            ship.offset({ left: shippos.left + (xDistance * easingAmount), top: shippos.top + (yDistance * easingAmount) });
        }
        if (xDistance > 0) {
            ship.addClass("reverse");
        } else {
            ship.removeClass("reverse");
        }
    }, 1000 / fps);
    setInterval(function () {
        ship.removeClass("pers_dory_" + anipos);
        anipos = (anipos + 1) % 4;
        ship.addClass("pers_dory_" + anipos);
    }, 1000 / fpsani);
}

function initHome() {
    $(".principal_carousel .trailer").click(function (e) {
        e.preventDefault();
        $('#carousel').trigger("stop");
        var trailer = $(this).attr("data-playlist");
        var nombre = $(this).parent().find(".ficha").text().trim();
        var cartel = $(this).parent().parent().find("a.noSwipe img").attr("src");
        //$("#trailerhome").height($(".principal_carousel").height());
        trailerHome2(trailer, nombre, cartel);
    });
    //pers_followCursor();
    /* COUNTDOWN */
    var contador = Math.floor(Math.random() * 10);


    /* TEMATIZACIONES */
    /* ---------------------------------------------------------- */
    /* COUNTDOWN */
    if (country.toLowerCase() == "es") {
        $("body").addClass("pers_count");
        customizations("countdown");
    }
    /* LOGO */
    if (country.toLowerCase() == "es") {
        if (resolucion > 800) {
            $("body").addClass("pers_logo");
            customizations("logo");
        }
    }

    $(".article_cont a.pers_background").click(function () {
        if (GTMEnabled) {
            uaEvent('home page', 'countdown banner - click', $(this).attr("data-pelicula"));
        }
    });

    $('#carousel').carouFredSel({
        prev: '.principal_carousel .img_left',
        next: '.principal_carousel .img_right',
        auto: {
            timeoutDuration: 5000, //5000
            pauseOnHover: "immediate"
        },
        /*width: '100%',*/
        responsive: true,
        //items:1,
        items: {
            /*start: -1,
            visible: 3*/
            width: "790",
            height: "46%"
        },
        scroll: {
            items: 1,
            onBefore: function (data) {
                /*$("video#player").trigger("pause");
                $("section>.trailer").hide();*/
                //$("#trailerhome").
            },
            onAfter: function (data) {
                /*if($("#trailerhome").hasClass("flowplayer")){
						
						$("#trailerhome>div").not('[class^="fp"]').remove();
						var trailer = $(data.items.visible[0]).find(".trailer").attr("data-playlist");
						
						$("#trailerhome").flowplayer().load([
								  { webm: trailer.replace(".mp4",".webm") },
								  { mp4: trailer.replace(".webm", ".mp4") }
						], function (event, api, video) {
							
							api.resume();
						});
						
				}*/

            }
        },
        pagination: ".radios",
        swipe: {
            onMouse: true,
            onTouch: true
        },
        onCreate: function () {
            $('#home #carousel > li').css('visibility', 'visible');
            /*$(window).trigger('resize');*/
        }
    });

    $('.promociones ul').carouFredSel({
        auto: {
            timeoutDuration: 5000,
            pauseOnHover: "immediate"
        },
        prev: '.promociones .img_left',
        next: '.promociones .img_right',
        width: '100%',
        height: 'variable',
        items: {
            height: 'variable',
            width: 295
        },
        /*items: {
            start: -1,
            visible: 5
        },*/
        scroll: {
            items: 1,
            onBefore: function (data) {
                //$(".promociones .selected").removeClass("selected");
            },
            onAfter: function (data) {
                /*console.log(data.items.visible);
                $(data.items.visible[1]).addClass("selected");
                $(data.items.visible[2]).addClass("selected");
                $(data.items.visible[3]).addClass("selected");*/
            }
        },
        swipe: {
            onMouse: true,
            onTouch: true
        }
    });

    $(".carteles-carrusel[rel=peliculas] ul").carouFredSel({
        auto: {
            timeoutDuration: 5000,
            pauseOnHover: "immediate"
        },
        prev: '.carteles-carrusel[rel=peliculas] .img_left',
        next: '.carteles-carrusel[rel=peliculas] .img_right',
        width: '100%',
        height: 'variable',
        items: {
            height: 'variable'
        },
        scroll: {
            items: 1
        },
        swipe: {
            onMouse: true,
            onTouch: true
        }
    });

    /*$(".carteles-carrusel[rel=eventos] ul").carouFredSel({
        auto: {
            timeoutDuration: 5000,
            pauseOnHover: "immediate"
        },
        prev: '.carteles-carrusel[rel=eventos] .img_left',
        next: '.carteles-carrusel[rel=eventos] .img_right',
        width: '100%',
        scroll: {
            items: 1
        },
        swipe: {
            onMouse: true,
            onTouch: true
        }
    });*/

    $(".cart-menu a").click(function (e) {
        e.preventDefault();
        if ($(this).hasClass("eventos")) {
            $(".carteles-carrusel[rel=peliculas]").addClass("hidden");
            $(".carteles-carrusel[rel=eventos]").removeClass("hidden");
            $(".carteles-carrusel[rel=eventos] ul").trigger("updateSizes");
        }
        if ($(this).hasClass("pelicula")) {
            $(".carteles-carrusel[rel=eventos]").addClass("hidden");
            $(".carteles-carrusel[rel=peliculas]").removeClass("hidden");
            $(".carteles-carrusel[rel=peliculas] ul").trigger("updateSizes");
        }
        $(".cart-menu a").removeClass("selected");
        $(this).addClass("selected");
    });

    $("#trailerhome").on("click", ".fp-close", function (e) {
        if (country.toLowerCase() == "es") {
            videojs("trailerhome_video").dispose();
        }
        $('.video_wrapper').html('');
        $("#trailerhome").addClass("closed").addClass("hidden");
        //$("#trailerhome>div").not('[class^="fp"]').remove();
        $('#carousel').trigger("play", true);
    });
    setupAds();
    fixHome();
    /*if (isIpad() && (typeof ($.cookie('inter_ipad')) == "undefined") && localization.country == "ES") {
        if (confirm("¿Sabias que disponemos de un app para iPad? Pulsa en aceptar para descargarla.")) {
            document.location = "http://itunes.apple.com/es/app/cinesa-para-ipad/id534215234?l=es&mt=8";
        }
        $.cookie('inter_ipad', "OK", { domain: 'cinesa.es', expires: 365, path: '/' });
    }*/
    if (GTMEnabled) {
        // uaEvent ('<event category>','<event action>', '<event label>','<event value>','<event interactive>' );
        $(".trending_marquee a").click(function () {
            uaEvent('home page', 'top highlights - click', $(this).text());
        });
        $(".principal_carousel li a").click(function () {
            if ($(this).hasClass("trailer")) {
                uaEvent('home page', 'main banner – view trailer', 'slot ' + $(this).parents("li").attr("data-slot") + " - " + $(this).parent().find(".ficha").text());
            } else {
                uaEvent('home page', 'main banner - click', 'slot ' + $(this).parents("li").attr("data-slot") + " - " + ($(this).hasClass("ficha") ? "button" : "img") + " - " + $(this).parent().find(".ficha").text());
            }
        });
        $(".principal_carousel .img_left").click(function () {
            uaEvent('home page', 'main banner navigation', 'backward');
        });
        $(".principal_carousel .img_right").click(function () {
            uaEvent('home page', 'main banner navigation', 'forward');
        });

        $(".carteles-carrusel li a").click(function () {
            uaEvent('home page', 'cartelera - click', "slot " + $(this).attr("data-slot") + " - " + $(this).find(".infopeli.pelicula h4").text());
        });

        $(".carteles-carrusel .img_left").click(function () {
            uaEvent('home page', 'cartelera - navigation', 'backward');
        });
        $(".carteles-carrusel .img_right").click(function () {
            uaEvent('home page', 'cartelera - navigation', 'forward');
        });

        $(".cartelera .home-row a").click(function () {
            uaEvent('home page', 'cartelera – view more');
        });

        $(".tecnologia .tecno a").click(function () {
            uaEvent('home page', 'premium - click', $(this).attr("class"));
        });
    }
    siteEmu("LOGO_CSS");
    siteEmu("HOME_D");
    siteEmu("HOME_ESPACIO2_CARRUSEL");
    siteEmu("CURSOR");

    animatefrog();
    $(".rana .close").click(function () {
        $(".rana").addClass("hidden");
    });
    $(".rana .sprite_rana").mouseenter(function () {
        $("#rana_sound")[0].play();
    });
    $(".rana .sprite_rana").click(function () {
        $("#rana_sound")[0].play();
        document.location = "/Promociones/te-devolvemos-la-entrada";
    });
}

function fixCarouselHeight(carousel, suma, _resolucion) {
    if (typeof (suma) != "undefined") {
        if (typeof (_resolucion) != "undefined") {
            if (resolucion == _resolucion) {
                carousel.parent().add(carousel).height(carousel.children().first().height() + suma);
            } else {
                carousel.parent().add(carousel).height(carousel.children().first().height());
            }
        } else {
            carousel.parent().add(carousel).height(carousel.children().first().height() + suma);
        }
    } else {
        carousel.parent().add(carousel).height(carousel.children().first().height());
    }
}

function initPromosLanding() {
    setTimeout(
        function () {
            if ($(".cartel-promo map area").length) {
                var tamano = $(".cartel-promo .cartel").width();
                var tamanoreal = 784;
                if (tamano) {
                    var factor = tamano / tamanoreal;
                    $(".cartel-promo map area").each(function () {
                        var area = $(this).attr("coords").split(",");
                        for (var i = 0; i < area.length; i++) {
                            area[i] = area[i] * factor;
                        }
                        var areafinal = area.join(",");
                        $(this).attr("coords", areafinal);
                    });
                }
            }
        }, 500);
    /*if ($("body").hasClass("lagranquedada")) {
        $("#mapaPromo area").click(function (e) {
            e.preventDefault();
            $(".step2").addClass("hidden");
            $($(this).attr("href")).removeClass("hidden");
        });
    }*/
    $('area[href$="/content/docs/CUPON-CUPON-4-10-GRAN-CASA.PDF"]').click(function () {
        _nextCallback = function () {
			if (hasConsent(["Performance"])) {
				wa.bt_queue.push
					({
						"tags": [
							{ tag: "DESCARGA", value: "CUPON_ELCINEA410" }
						],
						"async": true,
						"isTargeting": true,
						"isEvent": false
					});
			}
            sendTo($(this).attr("href"));
        }
        return controlCupones();
    });
    $('area[href$="/content/docs/CUPON-CUPON-4-10-PUERTO-VENECIA.PDF"]').click(function () {
        _nextCallback = function () {
			if (hasConsent(["Performance"])) {
				wa.bt_queue.push
					({
						"tags": [
							{ tag: "DESCARGA", value: "CUPON_ELCINEA410" }
						],
						"async": true,
						"isTargeting": true,
						"isEvent": false
					});
			}
            sendTo($(this).attr("href"));
        }
        return controlCupones();
    });
    $('area[href$="/content/docs/CUPON-CUPON-MENU-PUERTO-VENECIA.PDF"]').click(function () {
        _nextCallback = function () {
			if (hasConsent(["Performance"])) {
				wa.bt_queue.push
					({
						"tags": [
							{ tag: "DESCARGA", value: "CUPON_MENU" }
						],
						"async": true,
						"isTargeting": true,
						"isEvent": false
					});
			}
            sendTo($(this).attr("href"));
        }
        return controlCupones();
    });
    $('a[href$="/content/docs/CUPON-CUPON-5-SIETE-PALMAS.pdf"]').click(function () {
        _nextCallback = function () {
			if (hasConsent(["Performance"])) {
				wa.bt_queue.push
					({
						"tags": [
							{ tag: "DESCARGA", value: "CUPON_CINEA5" }
						],
						"async": true,
						"isTargeting": true,
						"isEvent": false
					});
			}
            sendTo($(this).attr("href"));
        }
        return controlCupones();
    });
}

function controlCupones() {
    var logged = $("#cinefavorito_header").hasClass("logged");
    if (logged) {
        return true;
    } else {
        $(".pop_mask").removeClass("hidden");
        $(".pop_entrar").removeClass("hidden");
        $(".pop_entrar .pop_frm>p").html("Para poder descargar el cupón regístrate como usuario Cinesa:");
        //$(".pop_entrar").addClass("fiesta");
        $('html, body').animate({
            scrollTop: 0
        }, 500);
    }
    return false;
}

function initGames() {
    $(".respuesta").addClass("hidden");

    $("li.pregunta").click(function () {
        var pregunta;
        pregunta = $(this).attr("data-id");
        if ($("li.respuesta[data-id=" + pregunta + "]").hasClass("hidden")) {
            $("li.respuesta[data-id=" + pregunta + "]").removeClass("hidden");
            $("li.pregunta[data-id=" + pregunta + "] span.mas").addClass("menos");
            $("li.pregunta[data-id=" + pregunta + "] span").removeClass("mas");
        } else {
            $("li.respuesta[data-id=" + pregunta + "]").addClass("hidden");
            $("li.pregunta[data-id=" + pregunta + "] span.menos").addClass("mas");
            $("li.pregunta[data-id=" + pregunta + "] span").removeClass("menos");
        }
    });
}

function initPromos() {
    /*$("#select").customselect();
    $("#select2").customselect();
    $("#select3").customselect();
    $("#select4").customselect();*/

    $(".btn_borrar").click(function (e) {
        e.preventDefault();
        $(".select_cinefav input[name=anos][value=-1]").click();
        $(".select_cinefav input[name=quien][value=-1]").click();
        $(".select_cinefav input[name=cuando][value=-1]").click();
        /*$("#select2").customselect("reset");
        $("#select3").customselect("reset");
        $("#select4").customselect("reset");*/
    });

    $(".select_cinefav input[name=cine]").change(function () {
        if ($(".select_cinefav input[name=cine]:checked").val() == "-1") {
            $(".filtrar").hide();
            $(".entucine").hide();
            $(this).parents(".radiobox").removeClass("selected");
        } else {
            $(".filtrar").show();
            $(this).parents(".radiobox").addClass("selected");
            $.post("/Promociones/CinesaPlanWS_Planes/" + $(".select_cinefav input[name=cine]:checked").val(), function (data) {
                var output = "";
                $.each(data, function (k, v) {
                    output += '<a target="_blank" href="' + v.Url + '">';
                    output += '<div class="plan"><div class="titulo"><p>' + v.Nombre + '</p><img alt="" src="/Content/img/cinesaplantit.png"></div><img alt="" src="https://www.cinesa.es' + v.Imagen + '"></div>';
                    output += '</a>';
                    if (hasConsent(["Performance"])) {
                        ga('send', 'event', 'CinesaPlan', 'Impresiones', v.Nombre);
                    }
                });
                $("article.cinesaplan").html(output);
            });
            $.post("/Promociones/PromocionesFiltro", { cine: $(".select_cinefav input[name=cine]:checked").val(), edad: -1, cuando: -1, acompanante: -1 }, function (data) {
                var hasContent = false;
                var output = "<ul>";
                $.each(data.normal, function (idx, obj) {
                    hasContent = true;
                    output += "<li>";
                    output += "<h3>";
                    if (obj.URL != null) {
                        output += "<a data-promocampaign=\"" + (obj.Titulo).replace('"', "") + "\" data-promoformat=\"banner\" class=\"vf\" href=\"" + obj.URL + "\">";
                    }
                    output += obj.Titulo;
                    if (obj.URL != null) {
                        output += "</a>";
                    }
                    output += "</h3>";
                    if (obj.URL != null) {
                        output += "<a href=\"" + obj.URL + "\">";
                    }
                    output += "<img class=\"promo\" src=\"" + staticURL + "Manager/promociones/" + obj.Promo_ID + "/" + obj.ID + ".jpg\"/>";
                    if (obj.URL != null) {
                        output += "</a>";
                    }
                    output += "</li>";
                });
                var outputbig = "<a href=\"##\" class=\"img_left\"></a><a href=\"##\" class=\"img_right\"></a><ul class=\"slide\">";
                $.each(data.big, function (idx, obj) {
                    outputbig += "<li>";
                    if (obj.URL != null) {
                        outputbig += "<a data-promocampaign=\"" + (obj.Titulo).replace('"', "") + "\" data-promoformat=\"horarios\" href=\"" + obj.URL + "/\">";
                    }
                    outputbig += "<img class=\"promo\" src=\"" + staticURL + "Manager/promociones/" + obj.Promo_ID + "/" + obj.ID + ".jpg\"/>";
                    if (obj.URL != null) {
                        outputbig += "</a>";
                    }
                    outputbig += "</li>";
                });
                output += "</ul>";
                outputbig += "</ul><div class=\"radios\"><a href=\"\" class=\"radio_active\"></a><a href=\"\" class=\"radio_inactive\"></a><a href=\"\" class=\"radio_inactive\"></a></div>";
                if (hasContent) {
                    //$(".sinfiltro").hide();
                    //$(".titulo_filtro").show();
                    //$(".resultados h4").show();
                    $(".listapromos.entucine").html(output);
                    $("#banner_seccion").html(outputbig);
                    if ($("#banner_seccion>ul").length) {
                        $("#banner_seccion>ul").carouFredSel({
                            prev: '.img_left',
                            next: '.img_right',
                            responsive: true,
                            auto: {
                                timeoutDuration: 5000,
                                pauseOnHover: "immediate"
                            },
                            items: {
                                visible: 1,
                                width: 954,
                                height: "23%"
                            },
                            pagination: ".radios",
                            align: "center",
                            swipe: {
                                onMouse: true,
                                onTouch: true
                            }
                        });
                    }
                    $(".entucine").show();
                } else {
                    $(".titulo_filtro").hide();
                    /*$(".sinfiltro").show();
                    $(".resultados h4").hide();*/
                    $("#banner_seccion").html("");
                    $(".listapromos.entucine").html("");
                    $(".entucine").hide();
                }
            });
        }
    });

    $(".select_cinefav input[name=anos],.select_cinefav input[name=cuando],.select_cinefav input[name=quien]").change(function () {
        if ($(this).val() == -1) {
            $(this).parents(".radiobox").removeClass("selected");
        } else {
            $(this).parents(".radiobox").addClass("selected");
        }

        if ((!($(".select_cinefav input[name=cine]:checked").val() == "-1")) && (!(($(".select_cinefav input[name=anos]:checked").val() == "-1") && ($(".select_cinefav input[name=quien]:checked").val() == "-1") && ($(".select_cinefav input[name=cuando]:checked").val() == "-1")))) {
            $.post("/Promociones/PromocionesFiltro", { cine: $(".select_cinefav input[name=cine]:checked").val(), edad: $(".select_cinefav input[name=anos]:checked").val(), cuando: $(".select_cinefav input[name=cuando]:checked").val(), acompanante: $(".select_cinefav input[name=quien]:checked").val() }, function (data) {
                var hasContent = false;
                var output = "<ul>";
                $.each(data.normal, function (idx, obj) {
                    hasContent = true;
                    output += "<li>";
                    output += "<h3>";
                    if (obj.URL != null) {
                        output += "<a class=\"vf\" href=\"" + obj.URL + "/\">";
                    }
                    output += obj.Titulo;
                    if (obj.URL != null) {
                        output += "</a>";
                    }
                    output += "</h3>";
                    if (obj.URL != null) {
                        output += "<a href=\"" + obj.URL + "/\">";
                    }
                    output += "<img class=\"promo\" src=\"" + staticURL + "Manager/promociones/" + obj.Promo_ID + "/" + obj.ID + ".jpg\"/>";
                    if (obj.URL != null) {
                        output += "</a>";
                    }
                    output += "</li>";
                });
                output += "</ul>";
                if (hasContent) {
                    //$(".sinfiltro").hide();
                    $(".titulo_filtro").show();
                    //$(".resultados h4").show();
                    $("#seleccionado").html(output);
                    $("#seleccionado").show();
                } else {
                    $(".titulo_filtro").hide();
                    /*$(".sinfiltro").show();
                    $(".resultados h4").hide();*/
                    $("#seleccionado").html("");
                }
            });
        }
    });
    if ($("#banner_seccion>ul").length) {
        $("#banner_seccion>ul").carouFredSel({
            prev: '.img_left',
            next: '.img_right',
            responsive: true,
            auto: {
                timeoutDuration: 5000,
                pauseOnHover: "immediate"
            },
            items: {
                visible: 1,
                width: 954,
                height: "23%"
            },
            pagination: ".radios",
            align: "center",
            swipe: {
                onMouse: true,
                onTouch: true
            }
        });
    }
    selectCineFav();
    if (typeof (promopath_cine) == "function") promopath_cine();
}

function initCine() {

    setTimeout(function () {
        $("#ficha_cine .rb input[value=311],#ficha_cine .rb input[value=631]").parents("label").append("<span> Cinesa Luxe</span>");

        $("#ficha_cine .select_cinefav .rb_selected").each(function () {

            setTimeout(function () {
                var evt = window.document.createEvent('UIEvents');
                evt.initUIEvent('resize', true, false, window, 0);
                window.dispatchEvent(evt);
            }, 1000);

            if ($(this).text() == "Xanadú") {
                $(this).html("<span class='rb_ico'></span>Xanadú Cinesa Luxe");
            }
            else if ($(this).text() == "Equinoccio Madrid") {
                $(this).html("<span class='rb_ico'></span>Equinoccio Madrid Cinesa Luxe");

                $(".luxe_play").click(function (e) {

                    if ($("#trailerhome").hasClass("hidden")) {
                        var trailer = $(this).attr("data-playlist");
                        var nombre = $(this).attr("data-name");
                        var cartel = $(this).attr("data-img");

                        $(".video_wrapper").html("");

                        var htmltrailer = '<video id="trailerhome_video" controls preload="auto" poster="' + cartel + '" class="video-js vjs-big-play-centered vjs-16-9" data-setup="{}" width="437" height="284"><source src="' + trailer + '" type="video/mp4"></video><a data-rel="trailerhome_video" class="skipbutton hidden" href="#">Saltar publicidad</a>';
                        if (trailer.match(/youtu/i)) {
                            htmltrailer = '<video id="trailerhome_video" controls preload="auto" poster="' + cartel + '" class="video-js vjs-big-play-centered vjs-16-9" data-setup=\'{"techOrder": ["youtube"], "sources": [{ "type": "video/youtube", "src": "' + trailer + '"}]}\' width="437" height="284"></video><a data-rel="trailerhome_video" class="skipbutton hidden" href="#">Saltar publicidad</a>';
                        }
                        $(".video_wrapper").html(htmltrailer);
                        $("#trailerhome").removeClass("hidden").removeClass("closed");
                        $(".cs_mask").addClass("cs_on");
                        $("#trailerhome_video").parent().attr("data-titulo", nombre);
                        var _player = new Player("trailerhome_video");
                        _player.init();
                        setTimeout(function () {
                            $("#trailerhome_video_ima-ad-container").click();
                        }, 1000);
                    }
                });

                //CONTROL Trailers
                $(".fp-close, .cs_mask").on("click", function (e) {
                    videojs("trailerhome_video").dispose();
                    $('.video_wrapper').html('');
                    $("#trailerhome").addClass("closed").addClass("hidden");
                    $(".cs_mask").removeClass("cs_on");
                });

            }
        });
    }, 200);


    if ($("section.luxe").length > 0) {
        initFichaLuxe();
    } else if ($(".luxeCarrusel").length > 0) {
        initSalasLuxe();
    }

    $("span#mas_promos").click(function () {

        $('div.cine_promos').toggleClass("mas");

        if ($('div.cine_promos').hasClass("mas")) {
            $(this).html("VER MENOS PROMOS");
        }
        else {
            $(this).html("VER MÁS PROMOS");
        }
    });
    $(".btn_promos").click(function () {
        if (GTMEnabled) {
            uaEvent('cinema details', 'top navigation - view promotions', $(this).attr("data-nombre"));
        }
    });
    $(".selectcinedia input[name=cine]").change(function () {
        //$(".zona .btn_zona").removeClass("hidden").removeClass("open");
        if (GTMEnabled) {
            uaEvent('cinema details', 'top navigation - change cinema', $(this).parent().text());
        }
        document.location = $(this).attr("data-href");
    });
    //$(".selectcinedia input[name=cine]:checked").trigger("change");
    $(".select_cinefav a.maps").click(function () {
        if (GTMEnabled) {
            uaEvent('cinema details', 'top navigation - locate cinema', $(this).attr("data-nombre"));
        }
    });
    $(".zona .btn_zona").click(function () {
        var u = "";
        if ($(this).hasClass("open")) {
            u = "/Peliculas/Horarios/" + $("#info").attr("data-id") + "/" + $(".selectcine input[name=cine]:checked").attr("data-id") + "/" + $(".selectcine input[name=cine]:checked").attr("data-poblacion");
            $(this).removeClass("open");
        } else {
            u = "/Peliculas/Horarios/" + $("#info").attr("data-id") + "/" + "-1" + "/" + $(".selectcine input[name=cine]:checked").attr("data-poblacion");
            $(this).addClass("open");
        }
        var isPromoL = false;
        if (typeof ($.cookie("promoCode")) != "undefined") {
            if ($.cookie("promoCode") != "") {
                isPromoL = true;
            }
        }
        $.ajax({
            url: u,
            cache: !isPromoL
        }).done(function (data) {
            peliculaRenderHorario2(data);
            if (typeof (promotionRouteExecute) == "function") promotionRouteExecute();
        });
    });

    //"PRECIOS EN ESTE CINE" Y "VER CALIFICACIONES"
    $("article.precios .div_precios").hide();
    $("article.calif .div_calificaciones").hide();

    $("article.precios .btn_mostrar").on("touch click", function () {
        if (!$(this).hasClass("open")) {
            $("article.precios .div_precios").show();
            $(this).addClass("open");
            if (GTMEnabled) {
                uaEvent('cinema details', 'bottom navigation - view prices');
            }
        } else {
            $("article.precios .div_precios").hide();
            $(this).removeClass("open");
        }
    });

    $("article.calif .btn_mostrar").on("touch click", function () {
        if (!$(this).hasClass("open")) {
            $("article.calif .div_calificaciones").show();
            $(this).addClass("open");
            if (GTMEnabled) {
                uaEvent('cinema details', 'bottom navigation - view ratings');
            }
        } else {
            $("article.calif .div_calificaciones").hide();
            $(this).removeClass("open");
        }
    });
    //HORARIOS OCULTOS EN MOVIL
    //$(".horarios .sala").addClass("movil_hide");

    $(".horarios").on("touch click", ".pelicula", function () {
        if (!$(this).find(".verhorarios").hasClass("open")) {
            $(this).find(".verhorarios").addClass("open").addClass("cerrar");
            $(this).find(".verhorarios").html("CERRAR");
            $(this).parents("ul").find(".sala").removeClass("movil_hide");
        } else {
            $(this).find(".verhorarios").removeClass("open").removeClass("cerrar");
            $(this).find(".verhorarios").html("HORARIOS");
            $(this).parents("ul").find(".sala").addClass("movil_hide");
        }
    });

    $(".horarios").on("touch click", ".horario", function () {
        var titulopelicula = $(this).parents("ul[data-dia]").find(".pelicula .peli_info h4").text();
        var titulocine = $(".select_cinefav .selectcinedia .rb_star .rb_selected").text();
        if (hasConsent(["Performance"])) {
            ga('send', 'event', 'IntencionCompra', titulopelicula, titulocine);
            if (GTMEnabled) {
                uaEvent('cinema details', 'billboard – select session', titulopelicula);
            }
        }
        //_gaq.push(['_trackEvent', 'IntencionCompra', titulopelicula, titulocine]);
    });

    //DESPLEGAR PELICULAS
    $(".horarios.evento").addClass("movil_hide");
    $(".promociones").not(".cinesaplan").addClass("movil_hide");
    $(".solo_movil .field").addClass("movil_hide");

    $(".solo_movil .btn_contenido").on("touch click", function () {
        if (!$(this).hasClass("open")) {
            $(this).addClass("open");
            if ($(this).hasClass("bc_peli")) {
                $(this).parents(".solo_movil").find(".field").removeClass("movil_hide");
                $(".horarios[data-id='cartelera']").removeClass("movil_hide");
            } else if ($(this).hasClass("bc_event")) {
                $(".horarios.evento").removeClass("movil_hide");
            } else if ($(this).hasClass("bc_promo")) {
                $(".promociones").removeClass("movil_hide");
                $(this).html("Cerrar promociones de este cine");
            }
        } else {
            $(this).removeClass("open");
            if ($(this).hasClass("bc_peli")) {
                $(this).parents(".solo_movil").find(".field").addClass("movil_hide");
                $(".horarios[data-id='cartelera']").addClass("movil_hide");
            } else if ($(this).hasClass("bc_event")) {
                $(".horarios.evento").addClass("movil_hide");
            } else if ($(this).hasClass("bc_promo")) {
                $(".promociones").not(".cinesaplan").addClass("movil_hide");
                $(this).html("Ver promociones de este cine");
            }
        }
    });

    $(".precios .btn_mostrar").click(function () {
        if ($(".precios .div_precios").html().length == 0) {
            $.get("/Cines/Precios/" + $(".selectcinedia input[name=cine]:checked").val(), function (response) {
                if (response.length > 1) {
                    $(".precios .div_precios").html(response);
                    //anuncio posterios a los precios
                    //$(".precios .div_precios").append("<p style='text-align:center; width:100%; margin: 0px auto; font-size: 15px; font-family: Trebuchet MS; color: #94a5b9; padding: 10px 0 30px;'>Precios válidos para sesiones hasta el 18/12/2019</p>");
                }
            });
        }
    });

    if ($("#banner_seccion>ul").length) {
        $("#banner_seccion>ul").carouFredSel({
            prev: '#banner_seccion .img_left',
            next: '#banner_seccion .img_right',
            responsive: true,
            auto: {
                timeoutDuration: 5000,
                pauseOnHover: "immediate"
            },
            items: {
                visible: 1,
                width: 954,
                height: "23%"
            },
            pagination: ".radios",
            align: "center",
            swipe: {
                onMouse: true,
                onTouch: true
            }
        });
    }

    if (resolucion > 640) {
        $(".banners_promo .slide").carouFredSel({
            prev: '.banners_promo .img_left',
            next: '.banners_promo .img_right',
            align: "center",
            auto: true,
            width: '100%',
            height: 128,
            scroll: 1,
            circular: true,
            infinite: true,
            items: {
                width: 295,
                height: 128
            },
            swipe: {
                onMouse: true,
                onTouch: true
            }
        });
    }

    $('.print_btn').on("touch click", function () {
        if (GTMEnabled) {
            uaEvent('cinema details', 'top navigation - print movies', $(this).attr("data-nombre"));
        }
        window.print();
    });

    var isPromoL = false;
    if (typeof ($.cookie("promoCode")) != "undefined") {
        if ($.cookie("promoCode") != "") {
            isPromoL = true;
        }
    }
    //alert(isPromoL);

    if (typeof ($(".selectcinedia input[name=cine]:checked").attr("data-id")) != "undefined") {
        $.ajax({
            url: "/Cines/Horarios/" + $(".selectcinedia input[name=cine]:checked").attr("data-id") + "/" + $(".selectcinedia input[name=cine]:checked").attr("data-poblacion"),
            cache: !isPromoL
        }).done(function (data) {
            cineRenderHorario2(data);
            if (typeof (promotionRouteExecute) == "function") promotionRouteExecute();
        });

    }

    $(".cinesaplan>a").each(function () {
        if (hasConsent(["Performance"])) {
            ga('send', 'event', 'CinesaPlan', 'Impresiones', $(this).find(".titulo").text());
        }
    });
    $(".cinesaplan>a").click(function (e) {
        if (hasConsent(["Performance"])) {
            ga('send', 'event', 'CinesaPlan', 'ClickTrough', $(this).find(".titulo").text());
        }
    });
    $("#banner_seccion .slide a").click(function () {
        if (GTMEnabled) {
            uaEvent('cinema details', 'main banner - click', "slot " + $(this).attr("data-slot") + " - " + $(this).attr("data-promocampaign"));
        }
    });
    $(".btn_contenido.bc_peli").click();
    //testAB();
    siteEmu("BANNER_CINE");
}

function generalInit() {
    //if ((typeof ($.cookie("uulogged")) != "undefined") && (typeof(objUser.UserLoginResponse) == "undefined" || typeof(objUser.UserLoginResponse.UserInformation) == "undefined")) {
    //    logoutCinesaUser();
    //}

    //popinComingSoon();

    if (location.search.indexOf('mov=1') > -1) {
        $("header").addClass("hidden");
        $("footer").addClass("hidden");
    }
    $("a[href=#]").click(function (e) {
        e.preventDefault();
    });
    $(document).click(function (event) {
        if (resolucion > 640) {
            if ((!$(event.target).closest('.new_login').length)) { // || ($("#select").hasClass("open") && $(event.target).hasClass("inner"))){
                $("header #cinefavorito_header .new_login").addClass("hidden");
                $("header #cinefavorito_header>a.log_link").removeClass("is-active");
                if (typeof (toggleLoginMenu) != "undefined" && toggleLoginMenu != 0) {
                    clearTimeout(toggleLoginMenu);
                    toggleLoginMenu = 0;
                }
            }
        }
    });
    /*if (typeof ($.cookie("ck")) === "undefined") {
        $("#cookie_popup").show();
        $("#cookie_popup img").click(function () {
            $.cookie('ck', "OK", { expires: 1, path: '/' });
            $("#cookie_popup").hide();
        });
        $("a").click(function () {
            $.cookie('ck', "OK", { expires: 1, path: '/' });
        });
    }*/

    setInterval(function () {
        $(".cc_banner.cc_container.cc_container--open p a").attr("target", "_blank");
        if ($(".cc_banner_x").length <= 0) {
            var cookieconsent = $(".cc_banner.cc_container.cc_container--open");
            var cc_html = "<div class='cc_banner_x'>x</div>";
            cookieconsent.append(cc_html);
            $(".cc_banner_x").css({
                "position": "absolute",
                "top": "0",
                "right": "10px",
                "cursor": "pointer"
            });
            $(".cc_banner_x").on("click", function () {
                cookieconsent.fadeOut()
            });
        }
        $(".cc_more_info").attr("href", "https://www.cinesa.es/Content/docs/PoliticaCookiesES.pdf")
    }, 1000);
    if (typeof ($.cookie("cookieconsent_dismissed")) === "undefined") {
        $("a").click(function () {
            $.cookie('cookieconsent_dismissed', "yes", { expires: 365, path: '/' });
        });
    }




    $.ajaxSetup({ cache: false });
    $(document).ajaxStart(function () {
        $("#loading").removeClass("hidden");
    });
    $(document).ajaxStop(function () {
        $("#loading").addClass("hidden");
    });
    $(document).ajaxError(function (event, jqxhr, settings, thrownError) {
        $("#loading").addClass("hidden");
        if ((settings.url.toLowerCase().indexOf("cinesauser") > -1)) {
            customalert(localization.noconexion);
        }
        if (settings.url.toLowerCase().indexOf("cinesacard") > -1) {
            customalert(localization.tareasmantenimiento);
        }
    });
    $(window).on("message", function (e) {
        var data = e.originalEvent.data;
        switch (data) {
            case "showPopupLogin":
                showPopupLogin();
                break;
        }
    });
    setTimeout(function () {
        favorito();
    }, 200);
    resizefix();
    ratings(); //estrellas de puntuación de los carteles de películas
    compartir_opt(); //muestra el div de compartir de los carteles de películas
    $.slidebars(); //menú desplegable para moviles
    loginheader();
    initMenumovil();
    menulistacines();
    RRSS();
    setUserEvents();
    $(".flowplayer").bind("load", function (e, api) {
        if (hasConsent(["Performance"])) {
            ga('send', 'event', 'Trailers', 'Play', $(this).attr("data-titulo"));

            var evtcat = "";

            if (GTMEnabled) {
                if ($("body").attr("id") == "ficha_pelicula") {
                    evtcat = "movie";
                } else if ($("body").attr("id") == "ficha_pelicula") {
                    evtcat = "event";
                }
                if (evtcat != "") {
                    uaEvent(evtcat + ' detail', 'view trailer', $(this).attr("data-titulo"));
                } else {
                    uaEvent('trailers section', 'view trailer', $(this).attr("data-titulo"));
                }
            }
            wa.bt_queue.push
                ({
                    "tags": [
                        { tag: "TRAILERS", value: $(this).attr("data-titulo").split(" ").join("-") }
                    ],
                    "async": true,
                    "isTargeting": true,
                    "isEvent": false
                });
        }
    });

    var radioboxInterval = setInterval(function () {
        if ($(".popup.pop_registro_2.new_popup #aaaa_newcinesauser .radiobox").length < 1) {
            $("#dd_newcinesauser").radioBox({
                name: "dd",
                arrowBackground: "#FFFFFF",
                position: "left",
                defaultText: localization.dia,
                aditionalClasses: 'rb2'
            });

            $("#mm_newcinesauser").radioBox({
                name: "mm",
                arrowBackground: "#FFFFFF",
                position: "left",
                defaultText: localization.mes,
                aditionalClasses: 'rb2'
            });

            $("#aaaa_newcinesauser").radioBox({
                name: "aaaa",
                arrowBackground: "#FFFFFF",
                position: "left",
                defaultText: localization.anyo,
                aditionalClasses: 'rb2'
            });

            $("#cineFavorito").radioBox({
                name: "cineFavorito",
                arrowBackground: "#FFFFFF",
                position: "left",
                defaultText: 'Cine Preferido',
                aditionalClasses: 'rb2'
            });

            $("#hijos").radioBox({
                name: "hijos",
                arrowBackground: "#FFFFFF",
                position: "left",
                defaultText: '¿Hay niños en casa?',
                aditionalClasses: 'rb2'
            });

        } else {
            clearInterval(radioboxInterval);
        }        
    }, 500);
    

    $("#dd_newcinesausercard").radioBox({
        name: "ddcard",
        arrowBackground: "#FFFFFF",
        position: "left",
        defaultText: localization.dia,
        aditionalClasses: 'rb2'
    });

    $("#mm_newcinesausercard").radioBox({
        name: "mmcard",
        arrowBackground: "#FFFFFF",
        position: "left",
        defaultText: localization.mes,
        aditionalClasses: 'rb2'
    });

    $("#aaaa_newcinesausercard").radioBox({
        name: "aaaacard",
        arrowBackground: "#FFFFFF",
        position: "left",
        defaultText: localization.anyo,
        aditionalClasses: 'rb2'
    });

    $("#dd_type_document").radioBox({
        name: "typedocument",
        arrowBackground: "#FFFFFF",
        position: "left",
        defaultText: localization.tipodedoc,
        aditionalClasses: 'rb2'
    });

    $("#dd_gender").radioBox({
        name: "gender",
        arrowBackground: "#FFFFFF",
        position: "left",
        defaultText: localization.genero,
        aditionalClasses: 'rb2'
    });

    $("#dd_provinceccard").radioBox({
        name: "province",
        arrowBackground: "#FFFFFF",
        position: "left",
        defaultText: localization.provincia,
        aditionalClasses: 'rb2'
    });

    $("#ddprovince_ccfisica").radioBox({
        name: "province_ccfisica",
        arrowBackground: "#FFFFFF",
        position: "left",
        defaultText: localization.provincia,
        aditionalClasses: 'rb2'
    });

    $.when(wsData.cinesauser.GetPersonalInformation()).done(function (result) {
        if (result != null) {
            UserInfo = result;
            if (UserInfo != null && UserInfo.logged == true) {
                if (window.location.hash) {
                    if (window.location.hash == "#ccardFisica") {
                        $("a.link-ccfisica").click();
                    }

                    if (window.location.hash == "#ccardBBVA") {
                        popupShow("bbva-action", true);
                        $(".bbva-action form")[0].reset();
                    }
                }
            }
        }
    });


    gotoTop();
    fblogin();
  
    if (hasConsent(["Performance"])) {
        metricasBanners();
        ga('create', 'UA-33911646-37', 'auto', { 'name': 'b' });
        ga('b.send', 'pageview');
    }
    initProgreso();
    //triggerPublicidad();

    if ($.cookie("promoCode") != null && $.cookie("promoCode") != "") {
        $.get("/Promociones/getPromotion/" + $.cookie("promoCode"), function (data) {
            if (data.promocion != null) {
                if (data.promocion.promoUses != 0) {
                    renderPromotion(data);
                    dataPromo = data;
                    promotionRouteExecute();
                    if (hasConsent(["Performance"])) {
                        ga('send', { 'hitType': 'pageview', 'page': '/promociones/showpromotion/' + $.cookie("promoCode"), 'title': 'PromoLink ' + $.cookie("promoCode") });
                    }
                } else {
                    $(".noPromoUses").removeClass("hidden");
                    $(".pop_noPromoUses").removeClass("hidden");
                }
            }
        });
    }

    /*$(".video-js").each(function () {
        var _player = new Player($(this).attr("id"));
        _player.init();
    });*/

    $("body").on("click", ".skipbutton", function (e) {
        e.preventDefault();
        skip($(this).attr("data-rel"));
    });

    $(".initpoplogin").click(function (e) {
        e.preventDefault();
        if ($("#cinefavorito_header").hasClass("logged")) {
            document.location = "/CinesaUser/CinesaCard";
        } else {
            popupShow("pop_login_general", true);
        }
    });
    newpopups();
    fixanims(4, 500); //gchrome fix
    if (navigator.userAgent.toLowerCase().indexOf('firefox') > -1) { //ffox fix
        $("#login-email").on("input", function (e) {
            if (typeof (e.view) == "undefined") {
                $("#login-contasena").parents(".anim-input-span").removeClass("anim-input-completado").addClass("anim-input-completado");
            }
        });
    }

    if (typeof (promotionRouteExecute) == "function") promotionRouteExecute();

    //MyCinesa
    //crear cuenta header
    $("#header #menu .reg_link, .myCinesaCreateAccountBtn").click(function (e) {
        e.preventDefault();
        if (!$("#cinefavorito_header").hasClass("logged")) {
            $(".pop_registro_2 form")[0].reset();
            popupShow("pop_registro_2", true);
        }
    });

    //hash registro
    var hash = new URL(window.location.href).hash;
    console.log(hash)
    if (hash == "#registro") {
        if (!$("#cinefavorito_header").hasClass("logged")) {
            $(".pop_registro_2 form")[0].reset();
            popupShow("pop_registro_2", true);
        }
    }

    //initRecaptchas
    initRecaptchas();

}

function newpopups() {
    $("#dd_pop_registro_3_alta").radioBox({
        name: "dd",
        arrowBackground: "#FFFFFF",
        position: "left",
        defaultText: localization.dia,
        aditionalClasses: 'rb2'
    });

    $("#mm_pop_registro_3_alta").radioBox({
        name: "mm",
        arrowBackground: "#FFFFFF",
        position: "left",
        defaultText: localization.mes,
        aditionalClasses: 'rb2'
    });

    $("#aaaa_pop_registro_3_alta").radioBox({
        name: "aaaa",
        arrowBackground: "#FFFFFF",
        position: "left",
        defaultText: localization.anyo,
        aditionalClasses: 'rb2'
    });

    $("#documento_pop_registro_3_alta").radioBox({
        name: "documentType",
        arrowBackground: "#FFFFFF",
        position: "left",
        defaultText: localization.selecciona,
        aditionalClasses: 'rb2'
    });

    $("#genero_pop_registro_3_alta").radioBox({
        name: "genero",
        arrowBackground: "#FFFFFF",
        position: "left",
        defaultText: localization.selecciona,
        aditionalClasses: 'rb2'
    });

    $("#provincia_pop_registro_3_alta").radioBox({
        name: "provincia",
        arrowBackground: "#FFFFFF",
        position: "left",
        defaultText: localization.selecciona,
        aditionalClasses: 'rb2'
    });

    $("#provincia_pop_registro_3_activacion").radioBox({
        name: "provincia",
        arrowBackground: "#FFFFFF",
        position: "left",
        defaultText: localization.selecciona,
        aditionalClasses: 'rb2'
    });

    $("#rellenar").radioBox({
        name: "rellenar",
        arrowBackground: "#FFFFFF",
        position: "left",
        defaultText: localization.selecciona,
        aditionalClasses: 'rb2'
    });

    $("#documentTypefirst").radioBox({
        name: "documentTypefirst",
        arrowBackground: "#FFFFFF",
        position: "left",
        defaultText: localization.selecciona,
        aditionalClasses: 'rb2'
    });

    $("#documentType_pop_registro_3_alta").radioBox({
        name: "documentType",
        arrowBackground: "#FFFFFF",
        position: "left",
        defaultText: localization.selecciona,
        aditionalClasses: 'rb2'
    });


    $("#documentType_activacion").radioBox({
        name: "documentType",
        arrowBackground: "#FFFFFF",
        position: "left",
        defaultText: localization.selecciona,
        aditionalClasses: 'rb2'
    });

    $("#genero_activacion").radioBox({
        name: "genero",
        arrowBackground: "#FFFFFF",
        position: "left",
        defaultText: localization.selecciona,
        aditionalClasses: 'rb2'
    });

    $("#dd_activacion").radioBox({
        name: "dd",
        arrowBackground: "#FFFFFF",
        position: "left",
        defaultText: localization.dia,
        aditionalClasses: 'rb2'
    });

    $("#mm_activacion").radioBox({
        name: "mm",
        arrowBackground: "#FFFFFF",
        position: "left",
        defaultText: localization.mes,
        aditionalClasses: 'rb2'
    });

    $("#aaaa_activacion").radioBox({
        name: "aaaa",
        arrowBackground: "#FFFFFF",
        position: "left",
        defaultText: localization.anyo,
        aditionalClasses: 'rb2'
    });

    //INPUT ANIMADO LOGIN
    $("input.log-in-field").val("");

    $("input.log-in-field").on('focus', function () {
        $(this).parent("span.log-in-span").addClass("log-in-completado");
    });

    $("input.log-in-field").on('blur', function () {
        if (!$(this).val()) {
            $(this).parent("span.log-in-span").removeClass("log-in-completado");
        }
    });

    //INPUT ANIMADO NOFOCUS + VALUE	
    $("input.anim-input-field").on('focus', function () {
        $(this).parent("span.anim-input-span").addClass("anim-input-completado");
    });

    $("input.anim-input-field").on('blur', function () {
        if (!$(this).val()) {
            $(this).parent("span.anim-input-span").removeClass("anim-input-completado");
        }
    });

    //LOGIN SHOW


    $("header #cinefavorito_header>a.log_link").on('mouseenter', function (e) {
        e.preventDefault();
        if (toggleLoginMenu != 0) {
            clearTimeout(toggleLoginMenu);
            toggleLoginMenu = 0;
        }
        $("header #cinefavorito_header .new_login").removeClass("hidden");
        $("header #cinefavorito_header>a.log_link").addClass("is-active");
        if (typeof ($.cookie('uunp')) != "undefined") {
            var usupass = Base64.decode($.cookie('uunp'));
            if ((usupass.split('|1|').length == 1)) {
                $("#login-email").val(usupass.split('||')[0]);
                $("#login-contasena").val(usupass.split('||')[1]);
            }
            else {
                $("#login-email").val('');
                $("#login-contasena").val('');
            }
        }
    });

    $("header #cinefavorito_header .new_login").on('mouseenter', function (e) {
        e.preventDefault();
        if (toggleLoginMenu != 0) {
            clearTimeout(toggleLoginMenu);
            toggleLoginMenu = 0;
        }
    });

    $("header #cinefavorito_header .new_login").on('mouseleave', function (e) {
        e.preventDefault();
        if (toggleLoginMenu != 0) {
            clearTimeout(toggleLoginMenu);
            toggleLoginMenu = 0;
        }
        toggleLoginMenu = setTimeout(function () {
            if ($("header #cinefavorito_header .new_login input:focus").length) {
                //
            } else {
                $("header #cinefavorito_header .new_login").addClass("hidden");
                $("header #cinefavorito_header>a.log_link").removeClass("is-active");
            }
        }, 2000);
    });


    /*MI AREA MENU MASTER*/

    $("header #cinefavorito_header>a.nameLogged").on('mouseenter', function (e) {
        if (toggleLoginMenu != 0) {
            clearTimeout(toggleLoginMenu);
            toggleLoginMenu = 0;
        }
        $("header #cinefavorito_header .access").removeClass("hidden");
        $("header #cinefavorito_header>a.nameLogged").addClass("is-active");
    });

    $("header #cinefavorito_header .nameLogged").on('mouseenter', function (e) {
        if (toggleLoginMenu != 0) {
            clearTimeout(toggleLoginMenu);
            toggleLoginMenu = 0;
        }
    });

    $("header #cinefavorito_header .nameLogged").on('mouseleave', function (e) {
        if (toggleLoginMenu != 0) {
            clearTimeout(toggleLoginMenu);
            toggleLoginMenu = 0;
        }
        toggleLoginMenu = setTimeout(function () {
            if ($("header #cinefavorito_header .access input:focus").length) {
            } else {
                $("header #cinefavorito_header .access").addClass("hidden");
                $("header #cinefavorito_header>a.nameLogged").removeClass("is-active");
            }
        }, 2000);
    });



    //CCARD LANDING MBL
    $("#ventaja_satisfaccion_mbl").on('click', function () {
        $("body#alta_ccard main .alta_ventajas_mbl>div.descripcion_ventaja").each(function (i) {
            $(this).addClass("hidden");
        });
        $("#descripcion_satisfaccion").toggleClass('hidden');
    });

    $("#ventaja_precios_mbl").on('click', function () {
        $("body#alta_ccard main .alta_ventajas_mbl>div.descripcion_ventaja").each(function (i) {
            $(this).addClass("hidden");
        });
        $("#descripcion_precios").toggleClass('hidden');
    });

    $("#ventaja_comodidad_mbl").on('click', function () {
        $("body#alta_ccard main .alta_ventajas_mbl>div.descripcion_ventaja").each(function (i) {
            $(this).addClass("hidden");
        });
        $("#descripcion_comodidad").toggleClass('hidden');
    });

    $("#ventaja_descuentos_mbl").on('click', function () {
        $("body#alta_ccard main .alta_ventajas_mbl>div.descripcion_ventaja").each(function (i) {
            $(this).addClass("hidden");
        });
        $("#descripcion_descuentos").toggleClass('hidden');
    });

    $("#ventaja_puntos_mbl").on('click', function () {
        $("body#alta_ccard main .alta_ventajas_mbl>div.descripcion_ventaja").each(function (i) {
            $(this).addClass("hidden");
        });
        $("#descripcion_puntos").toggleClass('hidden');
    });

    $("#ventaja_eventos_mbl").on('click', function () {
        $("body#alta_ccard main .alta_ventajas_mbl>div.descripcion_ventaja").each(function (i) {
            $(this).addClass("hidden");
        });
        $("#descripcion_eventos").toggleClass('hidden');
    });

    //ACTIVACIÓN CCARD INFO
    $("#info_activacion_ccard").on('click', function () {
        $(".activacion_info").toggleClass('hidden');
    });
}
// Create Base64 Object
var Base64 = { _keyStr: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", encode: function (e) { var t = ""; var n, r, i, s, o, u, a; var f = 0; e = Base64._utf8_encode(e); while (f < e.length) { n = e.charCodeAt(f++); r = e.charCodeAt(f++); i = e.charCodeAt(f++); s = n >> 2; o = (n & 3) << 4 | r >> 4; u = (r & 15) << 2 | i >> 6; a = i & 63; if (isNaN(r)) { u = a = 64 } else if (isNaN(i)) { a = 64 } t = t + this._keyStr.charAt(s) + this._keyStr.charAt(o) + this._keyStr.charAt(u) + this._keyStr.charAt(a) } return t }, decode: function (e) { var t = ""; var n, r, i; var s, o, u, a; var f = 0; e = e.replace(/[^A-Za-z0-9+/=]/g, ""); while (f < e.length) { s = this._keyStr.indexOf(e.charAt(f++)); o = this._keyStr.indexOf(e.charAt(f++)); u = this._keyStr.indexOf(e.charAt(f++)); a = this._keyStr.indexOf(e.charAt(f++)); n = s << 2 | o >> 4; r = (o & 15) << 4 | u >> 2; i = (u & 3) << 6 | a; t = t + String.fromCharCode(n); if (u != 64) { t = t + String.fromCharCode(r) } if (a != 64) { t = t + String.fromCharCode(i) } } t = Base64._utf8_decode(t); return t }, _utf8_encode: function (e) { e = e.replace(/rn/g, "n"); var t = ""; for (var n = 0; n < e.length; n++) { var r = e.charCodeAt(n); if (r < 128) { t += String.fromCharCode(r) } else if (r > 127 && r < 2048) { t += String.fromCharCode(r >> 6 | 192); t += String.fromCharCode(r & 63 | 128) } else { t += String.fromCharCode(r >> 12 | 224); t += String.fromCharCode(r >> 6 & 63 | 128); t += String.fromCharCode(r & 63 | 128) } } return t }, _utf8_decode: function (e) { var t = ""; var n = 0; var r = c1 = c2 = 0; while (n < e.length) { r = e.charCodeAt(n); if (r < 128) { t += String.fromCharCode(r); n++ } else if (r > 191 && r < 224) { c2 = e.charCodeAt(n + 1); t += String.fromCharCode((r & 31) << 6 | c2 & 63); n += 2 } else { c2 = e.charCodeAt(n + 1); c3 = e.charCodeAt(n + 2); t += String.fromCharCode((r & 15) << 12 | (c2 & 63) << 6 | c3 & 63); n += 3 } } return t } }

function testAB() {
    //if (chosenVariation == 1) {
    //    $(".btn_contenido.bc_peli").click();
    //}
    //triggerPublicidad();
    //if (chosenVariation==1) {
    //    //$("body").addClass("formb");

    //    //initPopEfects();
    //}
}

function initProgreso() {
    $(".formb .popup input.text.required").attr("data-complete", "0");
    $(".formb .popup .radiobox.required").attr("data-complete", "0");

    $(".formb .popup input.text.required").on('change', function () {
        if ($(this).val() != "") {
            $(this).attr("data-complete", "1");
        } else {
            $(this).attr("data-complete", "0");
        }

        actualizaProgressBar(this);
    });

    $(".formb .popup .radiobox.required .rb").on("touch click", function () {
        if ($(this).find("input").is(':checked')) {
            $(this).parents(".radiobox.required").attr("data-complete", "1");
        } else {
            $(this).parents(".radiobox.required").attr("data-complete", "0");
        }

        actualizaProgressBar(this);
    });
}

function actualizaProgressBar(sender) {
    var completeFields = 0;
    var isCinesaCardAlta = $(sender).parents(".popup").hasClass("pop_registro_3_alta");
    var isCinesaCardActiva = (!isCinesaCardAlta) && $(sender).parents(".popup").hasClass("popccard");
    var progression = 100 / 9;
    if (isCinesaCardAlta) {
        progression = 100 / 6;
    }
    if (isCinesaCardActiva) {
        progression = 100 / 10;
    }

    if (isCinesaCardAlta) {
        completeFields = $(".formb .pop_registro_3_alta .required[data-complete=1]").length;
        /*
        $(".formb .pop_registro_3_alta .required[data-complete]").each(function () {
            if ($(this).attr("data-complete") == 1) {
                completeFields++;
            }
        });*/
    } else {
        completeFields = $(".formb .required[data-complete=1]").length;
        /*
        $(".formb .required[data-complete]").each(function () {
            if ($(this).attr("data-complete") == 1) {
                completeFields++;
            }
        });*/
    }
    console.log(completeFields + "|" + progression);
    progression *= completeFields;
    progression = (progression > 100) ? 100 : progression;
    $(".formb .progress_bar").css("width", progression + "%");

}

function actualizaProgressBarMD() {
    var completeFields = 0;
    $("#inp_08").val() != "" ? completeFields++ : false;
    $("#inp_09").val() != "" ? completeFields++ : false;
    $("#inp_10").val() != "" ? completeFields++ : false;
    $("input[name=gender]").val() != "" ? completeFields++ : false;
    $("#dd_actualizacion li").length == 1 ? completeFields++ : false;
    $("#mm_actualizacion li").length == 1 ? completeFields++ : false;
    $("#aaaa_actualizacion li").length == 1 ? completeFields++ : false;
    $("#inp_14").val() != "" ? completeFields++ : false;
    //$("#localidad_actualizacion").val() != "" ? completeFields++ : false;
    $("#direccion_actualizacion").val() != "" ? completeFields++ : false;
    $("input[name=provincia]").val() != "" ? completeFields++ : false;
    $("#inp_11").val() != "" ? completeFields++ : false;
    $("#inp_12").val() != "" ? completeFields++ : false;
    $("#inp_13").val() != "" ? completeFields++ : false;
    $("input[name=inp_15]").val() != "" ? completeFields++ : false;
    var progression = 100 / 13;

    console.log(completeFields + "|" + progression);
    progression *= completeFields;
    progression = Math.ceil(progression);
    progression = (progression > 100) ? 100 : progression;
    $(".ma_mi_perfil .progress_bar").css("width", progression + "%");
    $(".post_progress_bar span").html(progression.toFixed(0) + "%");
}

function resetProgressBar() {
    $(".formb [data-complete]").attr("data-complete", 0);
    $(".formb .progress_bar").css("width", 0);
}


function initPopEfects() {
    $(window).bind('scroll', function () {
        var screenHeight = parseInt(window.innerHeight) + 50;
        var popupHeight = $(".popup").height();
        var actualHeight = $(document).scrollTop();

        if ((screenHeight + actualHeight) >= popupHeight) {
            $(".popup").addClass("pop_fixed");
        } else {
            $(".popup").removeClass("pop_fixed");

        }
    });
}

function renderPromotion(data) {

    var output = "<div id=\"promoHeader\" class=\"header-promotion\">" +
        "<span></span><label class=\"busca\">Selecciona cine o película, este icono te indicará dónde es válida la promoción.</label>" +
        "<label class=\"promoActivaOff\">Actualmente no existe ninguna sesión para la promoción.</label>" +
        "<a href=\"/Promociones/HidePromotion\">" +
        "<label class=\"exit\"> CERRAR FILTRO DE PROMOCIÓN</label>" +
        "<img class=\"exit\" />" +
        "</a></div>" +
        "<script type=\"text/javascript\" > cargaFixedHeader(); </script>";

    $(promoWrapper).html(output);
}

function cargaFixedHeader() {
    var altura = $('.header-promotion').offset().top;
    $(window).on('scroll', function () {
        if ($(window).scrollTop() > altura + $(publicidad_header).height()) {
            $('.header-promotion').addClass('header-promotion-fixed');
        } else {
            $('.header-promotion').removeClass('header-promotion-fixed');
        }
    });
}
function triggerPublicidad() {
    // Espacios de GPT
    if (["cinesacard", "promos_landing", "apps", "oscars"].includes($("body").attr("id"))) {
        return;
    }
    if (typeof googletag !== 'undefined') {
        if ((country.toLowerCase() == "es") && (typeof (googletag.display) == "undefined")) {
            return;
        }
        if ($("body").attr("id") == "home") {
            var gptAdSlots = [];
            googletag.cmd.push(function () {
                // Defina un objeto de asignaciC3n de espacio. El primer parC!metro para addSize es
                // un tamaC1o de ventana grC!fica, mientras que el segundo es una lista de los anuncios permitidos.
                var mapping = googletag.sizeMapping().
                    // Acepta ambos formatos de banner para mC3viles habituales
                    addSize([320, 480], [[320, 50], [320, 100]]).
                    // Misma anchura que la asignaciC3n anterior, mC!s altura disponible
                    addSize([320, 1000], [[320, 50], [320, 100]]).
                    // Tablet con orientaciC3n vertical 
                    addSize([720, 200], [728, 90]).
                    // Tablet con orientaciC3n horizontal 
                    addSize([980, 200], [[728, 90], [980, 90]]).
                    // Desktop
                    addSize([1025, 200], [[728, 90], [980, 90], [980, 200]]).build();
                // Defina el espacio de GPT
                googletag.defineOutOfPageSlot('/5555/adconion.cinesa.es/home', 'div-gpt-ad-1453371893713-0-oop').addService(googletag.pubads());
                gptAdSlots[0] = googletag.defineSlot('/5555/adconion.cinesa.es/home', [0, 0], 'div-gpt-ad-1453371893713-0').
                    defineSizeMapping(mapping).
                    addService(googletag.pubads());
                // Inicie la recuperaciC3n del anuncio
                googletag.enableServices();
            });

            // 728x90 CINESA.ES#ES000038/home_TABLET
            googletag.display('div-gpt-ad-1453371893713-0');
            googletag.display('div-gpt-ad-1453371893713-0-oop');


            googletag.defineSlot('/5555/adconion.cinesa.es/home', [[300, 250]], 'div-gpt-ad-1454658438640-0').addService(googletag.pubads());
            googletag.pubads().enableSyncRendering();
            googletag.enableServices();
            // 300x600, 300x250 CINESA.ES#ES000038/home_TABLET
            googletag.display('div-gpt-ad-1454658438640-0');
            /*
            googletag.defineSlot('/5555/adconion.cinesa.es/homeBTF', [[300, 250]], 'div-gpt-ad-1454658486658-0').addService(googletag.pubads());
            googletag.pubads().enableSyncRendering();
            googletag.enableServices();
            // 300x250  CINESA.ES#ES000038/homeBTF_TABLET
            googletag.display('div-gpt-ad-1454658486658-0'); */

        } else {
            // Espacios de GPT
            var gptAdSlots = [];
            googletag.cmd.push(function () {

                // Defina un objeto de asignaciC3n de espacio. El primer parC!metro para addSize es
                // un tamaC1o de ventana grC!fica, mientras que el segundo es una lista de los anuncios permitidos.
                var mapping = googletag.sizeMapping().
                    // Acepta ambos formatos de banner para mC3viles habituales
                    addSize([320, 480], [[320, 50], [320, 100]]).
                    // Misma anchura que la asignaciC3n anterior, mC!s altura disponible
                    addSize([320, 1000], [[320, 50], [320, 100]]).
                    // Tablet con orientaciC3n vertical 
                    addSize([720, 200], [728, 90]).
                    // Tablet con orientaciC3n horizontal 
                    addSize([980, 200], [[728, 90], [980, 90]]).
                    // Desktop
                    addSize([1025, 200], [[728, 90], [980, 90], [980, 200]]).build();
                // Defina el espacio de GPT
                if ($("#div-gpt-ad-1547805202603-0").length) {
                    googletag.defineSlot('/5555/adconion.cinesa.es/lunnis', [[980, 90], [980, 200], [728, 90]], 'div-gpt-ad-1547805202603-0').addService(googletag.pubads());
                } else {
                    googletag.defineOutOfPageSlot('/5555/adconion.cinesa.es/resto', 'div-gpt-ad-1453371893713-0-oop')
                        .addService(googletag.pubads())
                        .setTargeting("cine", agm_cine)
                        .setTargeting("provincia", agm_provincia);
                    gptAdSlots[0] = googletag.defineSlot('/5555/adconion.cinesa.es/resto', [0, 0], 'div-gpt-ad-1453371893713-0').
                        defineSizeMapping(mapping).
                        addService(googletag.pubads())
                        .setTargeting("cine", agm_cine)
                        .setTargeting("provincia", agm_provincia);
                }
                // Inicie la recuperaciC3n del anuncio
                googletag.enableServices();
            });

            if ($("#div-gpt-ad-1547805202603-0").length) {
                googletag.display('div-gpt-ad-1547805202603-0');
            } else {
                // 728x90  CINESA.ES#ES000038/resto_TABLET
                googletag.display('div-gpt-ad-1453371893713-0');
                googletag.display('div-gpt-ad-1453371893713-0-oop');
            }

            googletag.defineSlot('/5555/adconion.cinesa.es/resto', [[300, 250], [300, 600]], 'div-gpt-ad-1454658438640-0')
                .addService(googletag.pubads())
                .setTargeting("cine", agm_cine)
                .setTargeting("provincia", agm_provincia);
            googletag.pubads().enableSyncRendering();
            googletag.enableServices();
            // 300x600, 300x250  CINESA.ES#ES000038/resto_TABLET
            googletag.display('div-gpt-ad-1454658438640-0');
            // 300x250 BTF CINESA.ES#ES000038/restoBTF_TABLET
            /*
            googletag.defineSlot('/5555/adconion.cinesa.es/restoBTF', [[300, 250], [300, 600]], 'div-gpt-ad-1454658486658-0')
            .addService(googletag.pubads())
            .setTargeting("cine", agm_cine)
            .setTargeting("provincia", agm_provincia);
            googletag.pubads().enableSyncRendering();
            googletag.enableServices();
            googletag.display('div-gpt-ad-1454658486658-0'); */

        }
    }
    skinListener();

}

function fblogin() {
    $(".sociallogin_btn").click(function () {
        var that = this;
        FB.login(function (response) {
            if (response.authResponse) {
                // user sucessfully logged in
                //console.log(response);
                _fbat = response.authResponse.accessToken;
                _fbid = response.authResponse.userID;
                //var accessToken = response.authResponse.accessToken;
                //var fbuserid = response.authResponse.userID;
                getfbdata(_fbat, function (fbdata) {
                    if ($(that).parents(".m_login").length) {
                        loginCinesaUserFB(_fbid, _fbat);
                    }
                    if ($(that).parents(".pop_registro_2").length) {
                        loginCinesaUserFB(_fbid, _fbat, false, function () {
                            customalert("¡Ya tienes una cuenta Cinesa, bienvenido!");
                        });
                    }
                    if ($(that).parents(".new_login").length || $(that).parents(".pop_login_ccard").length || $(that).parents(".pop_login_ccard").length) {
                        loginCinesaUserFB(_fbid, _fbat, true);
                    }

                    //if ($(that).parents("#formalta").length) {
                    //    if (((typeof (fbdata.email) !== 'undefined') && (fbdata.email))) {
                    //        $("input[name=useralta]").val(fbdata.email);
                    //        $("input[name=ruseralta]").val(fbdata.email);
                    //    }
                    //    $("input[name=name]").val(fbdata.first_name);
                    //    $("input[name=firstsurname]").val(fbdata.last_name);
                    //    switch (fbdata.gender) {
                    //        case "male": $("label input[value=M]").parent().click();
                    //            break;
                    //        case "female": $("label input[value=F]").parent().click();
                    //            break;
                    //    }
                    //    if (typeof (fbdata.location) !== 'undefined') {
                    //        //TODO
                    //    }
                    //    if (typeof (fbdata.birthday) !== 'undefined') {
                    //        var fecha = fbdata.birthday.split("/"); // "09/21/1984"
                    //        $("input[name=dd][value=" + fecha[1] + "]").parent().click().parents(".radiobox").addClass("disabled");
                    //        $("input[name=mm][value=" + fecha[0] + "]").parent().click().parents(".radiobox").addClass("disabled");
                    //        $("input[name=aaaa][value=" + fecha[2] + "]").parent().click().parents(".radiobox").addClass("disabled");
                    //    }
                    //    $("#formalta input[name=passalta]").parent().addClass("hidden");
                    //    $("#formalta input[name=rpassalta]").parent().addClass("hidden");
                    //    $("#formalta .mini").addClass("hidden");
                    //    $("#formalta .cc_btn").click();
                    //    if ($("#cc_form_activar").length) {
                    //        $(".frm2").removeClass("activo").addClass("inactivo");
                    //        $(".frm3").addClass("activo");
                    //        $(".frm3 .row").removeClass("hidden");
                    //    }
                    //}
                });
            }
        }, { scope: 'email' });
    });
}

function getfbdata(at, callback) {
    FB.api('/me?fields=id,name,email,first_name,last_name,gender', { access_token: at }, function (response) {
        callback(response);
    });
}

function metricasBanners() {
    $("a[data-promoformat]").each(function () {
        ga('send', 'event', 'Promociones', 'Impresiones', $(this).attr("data-promoformat") + ' - ' + $(this).attr("data-promocampaign"));
    });
    $(document).on("click", "a[data-promoformat]", function (e) {
		if (hasConsent(["Performance"])) {
			ga('send', 'event', 'Promociones', 'ClickTrough', $(this).attr("data-promoformat") + ' - ' + $(this).attr("data-promocampaign"));
			wa.bt_queue.push
				({
					"tags": [
						{ tag: "PROMOCIONESWEB", value: "click_" + $(this).attr("data-promocampaign").split(" ").join("-") + "_" + $(this).attr("data-promoformat").split(" ").join("-") }
					],
					"async": true,
					"isTargeting": true,
					"isEvent": false
				});
		}
    });
}

function setUserEvents() {
    //if ($("body").attr("id") != "debug") {
    //    initPopupsUser();
    //} else {
    //    initPopupsUser2();
    //}
    initPopupsUser2();
}

function initPopupsUser2() {

    


    // NEW
    $(".anim-input-field").on('keyup blur', function () {
        if ($(this).is(":invalid") && !$(this).is(":focus") && ($(this).val() != "")) {
            $(this).parent("span").find("label").removeClass("anim-input-label-color-1").addClass("anim-input-label-color-2");
        } else {
            $(this).parent("span").find("label").removeClass("anim-input-label-color-2").addClass("anim-input-label-color-1");
        }
    });



    // General
    $("a[href|='/CinesaUser/CCActiva']").click(function (e) {
        e.preventDefault();
        if (Object.keys(objUser).length) {
            if (userIsCinesaCard()) {
                customalert(localization.yadisponesdecc);
            } else {
                rellenaDatosCC("activacion");
            }
        } else {
            popupShow("pop_login_ccard_activa", true);
        }
    });

    $(".popup").click(function (e) {
        if ($(e.target).parents(".radiobox").length == 0) {
            $(".radiobox").removeClass("open");
        }
    });
    $(document).on("touch click", ".rb_selected", function (e) {
        if (!$(e.target).hasClass("rb_starfav")) {
            if (!$(this).parents(".radiobox").hasClass("disabled")) {
                if ($(this).parents(".radiobox").hasClass("open")) {
                    $(this).parents(".radiobox").removeClass("open");
                } else {
                    $(".radiobox").removeClass("open");
                    $(this).parents(".radiobox").addClass("open");
                }
            }
        }
    });

    $(document).on("touch click", ".rb label", function () {
        if ($(this).parent().hasClass("disabled")) {
            $(this).find("input").prop('checked', false);
        } else {
            var selected = $(this).html();
            $(this).parents(".radiobox").find(".rb_selected").html('<span class="rb_ico"></span>' + selected);
            $(this).parents(".radiobox").find(".rb_selected input").remove();
            $(this).parents(".radiobox").removeClass("open");
            if ($(this).hasClass("promo")) {
                $(this).parents(".radiobox").find(".rb_selected").addClass("promo");
            } else {
                $(this).parents(".radiobox").find(".rb_selected").removeClass("promo");
            }
        }
    });

    $(".rb_selected[data-defaultvalue]").each(function () {
        if ($(this).attr("data-defaultvalue") != "") {
            $(this).parent().find("input[value=" + $(this).attr("data-defaultvalue") + "]").parent().click();
        }
    });
    $(".pop_close").on("touch click", function () {
        popupClose(true);
    });
    $(".alert .alert_close,.alert .alert_btn").click(function () {
        customalertClose();
    });

    $(".popup.pop_confirmacion a.pop2_btn").click(function (e) {
        e.preventDefault();
        location.reload();
    });


    // CCActivar - Paso 1 Login UU
    $(".popup.pop_login_ccard.pop_login_ccard_activa form").submit(function () {
        /* 12/2016 */
        var scope = ".popup.pop_login_ccard.pop_login_ccard_activa form ";
        /* /12/2016 */
        if (_validateEmail($(scope + "input[name=email]").val())) {
            loginCinesaUser($(scope + "input[name=email]").val(), $(scope + "input[name=passwd]").val(), false, function (data) {
                if ((data.UserLoginResponse.UserInformation.UserInformation.ccCard == "" || data.UserLoginResponse.UserInformation.UserInformation.ccCard == null) && data.UserLoginResponse.UserInformation.UserInformation.isCinesaCardUser != "Y") {//if (data.UserLoginResponse.UserInformation.UserInformation.ccCard == "" || data.UserLoginResponse.UserInformation.UserInformation.ccCard == null) {
                    //$(".postuser .row span").html("activaremos tu Cinesacard");
                    //$(".postuser a.new_btn").click(function(e) {
                    //    e.preventDefault();
                    //    rellenaDatosCC("activacion");
                    //});
                    rellenaDatosCC("activacion");
                    popupShow("pop_registro_activacion", true);
                    //
                } else {
                    customalert(localization.yadisponesdeccactivada);
                }
            });
        } else {
            customalert(localization.direccionemailincorrecta);
        }
        return false;
    });



    $(".popup.pop_login_general form").submit(function () {
        /* 12/2016 */
        var scope = ".popup.pop_login_general form ";
        /* /12/2016 */
        if (_validateEmail($(scope + "input[name=email]").val())) {
            loginCinesaUser($(scope + "input[name=email]").val(), $(scope + "input[name=passwd]").val(), true);
        } else {
            customalert(localization.direccionemailincorrecta);
        }
        return false;
    });

    $(".popup.pop_login_general a.pop2_btn").click(function (e) {
        e.preventDefault();
        popupClose();
        popupShow("pop_registro_2", true);
        resetProgressBar();
    });

    // CCActivar - Paso 2 Verificación
    $(".popup.pop_registro_activacion input[name=Cinesacard]").change(function () {
        var scope = "popup.pop_registro_activacion.popccard form ";
        $.post("/CinesaUser/ValidateUser", { Cinesacard: $(this).val() }, function (data) {
            if (data.ValidateCinesacard.returnCode == 0 || data.ValidateCinesacard.returnCode == "0") {
                //
            } else {
                /* 12/2016 */
                if (data.ValidateCinesacard.returnCode == 101 || data.ValidateCinesacard.returnCode == "101") {
                    customalert(data.ValidateCinesacard.returnDescription + "<!--img src=''-->");
                } else if (data.ValidateCinesacard.returnCode == 102 || data.ValidateCinesacard.returnCode == "102") {
                    customalert(data.ValidateCinesacard.returnDescription + "<!--img src=''-->");
                } else {
                    errorActions(scope, data.ValidateCinesacard.returnCode, data.ValidateCinesacard.returnDescription);
                    //customalert(data.ValidateCinesacard.returnDescription);
                }
                /* /12/2016 */
                //$("#formalta input[name=useralta]").addClass("pop_bad");
                //$(".pop_error[data-errorfor=useralta]").html(data.ValidateCinesacardResponse.returnDescription);
            }
        });
    });

    $(document).on("change", "input[name=rellenar]", function () {
        var scope = ".popup.pop_registro_activacion ";
        $(scope + ".row[data-rellenar]").addClass("hidden");
        $(scope + ".row[data-rellenar=" + $(this).val() + "]").removeClass("hidden");
    });

    $(".popup.pop_registro_activacion form").submit(function () {
        var scope = ".popup.pop_registro_activacion ";
        var Cinesacard = $(scope + "input[name=Cinesacard]").val();
        var Email = $(scope + "input[name=emailfirst]").val();
        var Mobile = $(scope + "input[name=mobilefirst]").val();
        var DocumentType = "";
        if (!$(scope + "input[name=documentTypefirst][disabled]").length) {
            DocumentType = $(scope + "input[name=documentTypefirst]").val();
        } else {
            DocumentType = $(scope + "input[name=documentTypefirst]").val();
        }
        if (typeof (DocumentType) == "undefined") {
            DocumentType = "";
        }
        var DocumentNumber = $(scope + "input[name=documentNumberfirst]").val();
        var seleccion = $(scope + "input[name=rellenar]").val();
        var postdata = "";
        switch (seleccion) {
            case "1":
                if (DocumentType == "D") {

                    var validaNIF_CIF = new NIF_CIFValidator();
                    if (!validaNIF_CIF.checkAll(DocumentNumber)) {
                        customalert(localization.numerodocnovalido);
                        return false;
                    };
                }
                if (DocumentNumber == "") {
                    customalert(localization.porfavorintroducenumerodoc);
                    return false;
                }
                postdata = { Cinesacard: Cinesacard, DocumentType: DocumentType, DocumentNumber: DocumentNumber };
                break;
            case "2":
                if (!_validateEmail(Email)) {
                    customalert(localization.emailnovalido);
                    return false;
                }
                postdata = { Cinesacard: Cinesacard, Email: Email };
                break;
            case "3":
                if (Mobile == "") {
                    customalert(localization.porfavorintroducenumeromovil);
                    return false;
                }
                else {
                    var pattern = new RegExp(/^[\d]{3}[-]*([\d]{2}[-]*){2}[\d]{2}$/);
                    if (!pattern.test(Mobile)) {
                        errormsg += "- " + numeromovilincorrecto + "\n";
                    }
                }
                postdata = { Cinesacard: Cinesacard, Mobile: Mobile };
                break;
        }
        if ((postdata != "") && (Cinesacard.length >= 8) && ((Email.length && _validateEmail(Email)) || Mobile.length || (DocumentType.length && DocumentNumber.length))) {
            $.post("/CinesaUser/ValidateUser", { Cinesacard: postdata.Cinesacard }, function (data) {
                if (data.ValidateCinesacard.returnCode == 0 || data.ValidateCinesacard.returnCode == "0") {
                    $.post("/CinesaUser/CCActivaCheck", postdata, function (data) {
                        if (data.GetCard_ToActivateResponse.returnCode == 0 || data.GetCard_ToActivateResponse.returnCode == "0") {
                            $(".popup.pop_registro_3_activacion input[name=ccnumber]").val($(".popup.pop_registro_activacion input[name=Cinesacard]").val())
                            popupClose();
                            popupShow("pop_registro_3_activacion", true);
                        } else {
                            if (typeof (data.GetCard_ToActivateResponse.returnDescription) != "undefined") {
                                customalert(data.GetCard_ToActivateResponse.returnDescription);
                            } else {
                                customalert(localization.enestosmomentosincidencias);
                            }
                        }
                    });
                } else {
                    /* 12/2016 */
                    if (data.ValidateCinesacard.returnCode == 101 || data.ValidateCinesacard.returnCode == "101") {
                        customalert(data.ValidateCinesacard.returnDescription + "<!--img src=''-->");
                    } else if (data.ValidateCinesacard.returnCode == 102 || data.ValidateCinesacard.returnCode == "102") {
                        customalert(data.ValidateCinesacard.returnDescription + "<!--img src=''-->");
                    } else {
                        errorActions(scope, data.ValidateCinesacard.returnCode, data.ValidateCinesacard.returnDescription);
                        //customalert(data.ValidateCinesacard.returnDescription);
                    }
                    /* /12/2016 */
                    //$("#formalta input[name=useralta]").addClass("pop_bad");
                    //$(".pop_error[data-errorfor=useralta]").html(data.ValidateCinesacardResponse.returnDescription);
                }
            });

        } else {
            customalert(localization.porfavorcompruebadatos);
        }
        return false;
    });

    // CC Activar - Paso 3 Envío
    $(".popup.pop_registro_3_activacion form").submit(function () {
        var UserInformation = new Object;
        var isNewUser = "N";
        var datosEnvio = generaDatosEnvioCC("activacion");
        if (datosEnvio.errormsg != "") {
            customalert(localization.porfavorcompruebadatosoblitatorios + "\n" + datosEnvio.errormsg);
            delete datosEnvio.errormsg;
            return false;
        }
        delete datosEnvio.errormsg;
        UserInformation.UserInformation = datosEnvio;

        $.post("/CinesaUser/CCActivaForm", { UserInformation: JSON.stringify(UserInformation), NU: isNewUser, Email: UserInformation.UserInformation.Email, fbid: _fbid, fbat: _fbat, Consents: JSON.stringify(prepareConsents(".popup.pop_registro_3_activacion ")) }, function (data) {
            if (data.ActivateCinesacard_CinesaUserResponse.returnCode == "0" || data.ActivateCinesacard_CinesaUserResponse.returnCode == 0) {
                popupClose();
                popupShow("pop_bienvenida_activar", true);
                if (hasConsent(["Performance"])) {
                    ga('send', 'event', 'CinesaUser', 'Activacion', 'Solo CC');
                }
            } else {
                if (typeof (data.ActivateCinesacard_CinesaUserResponse.returnDescription) != "undefined") {
                    customalert(data.ActivateCinesacard_CinesaUserResponse.returnDescription);
                } else {
                    customalert(localization.enestosmomentosincidencias);
                }
            }
        });
        return false;
    });


    // CCAlta - Paso 1 Login UU
    //$(".popup.pop_login_ccard.pop_login_ccard_alta form").submit(function () {
    //    var scope = ".popup.pop_login_ccard.pop_login_ccard_alta form ";
    //    if (_validateEmail($(scope + "input[name=email]").val())) {
    //        loginCinesaUser($(scope + "input[name=email]").val(), $(scope + "input[name=passwd]").val(), false, function (data) {
    //            if ((data.UserLoginResponse.UserInformation.UserInformation.ccCard == "" || data.UserLoginResponse.UserInformation.UserInformation.ccCard == null) && data.UserLoginResponse.UserInformation.UserInformation.isCinesaCardUser != "Y") {
    //                //$(".postuser .row span").html("pediremos tu Cinesacard");
    //                //$(".postuser a.new_btn").click(function (e) {
    //                //    e.preventDefault();
    //                //    
    //                //});
    //                rellenaDatosCC("alta");
    //                popupShow("pop_registro_3_alta", true);
    //            } else {
    //                customalert(localization.yadisponesdecc);
    //            }
    //        });
    //    } else {
    //        customalert(localization.direccionemailincorrecta);
    //    }
    //    return false;
    //});


    // CCAlta - Paso 2 Envío
    $(".popup.pop_registro_3_alta form").submit(function () {
        var UserInformation = new Object;
        var isNewUser = "N";
        var datosEnvio = generaDatosEnvioCC("alta");

        if (datosEnvio.errormsg != "") {
            customalert(localization.porfavorcompruebadatosoblitatorios + "\n" + datosEnvio.errormsg);
            delete datosEnvio.errormsg;
            return false;
        }
        delete datosEnvio.errormsg;
        UserInformation.UserInformation = datosEnvio;

        $.post("/CinesaUser/CCAltaForm", { UserInformation: JSON.stringify(UserInformation), NU: isNewUser, Email: UserInformation.UserInformation.Email, fbid: _fbid, fbat: _fbat, Consents: JSON.stringify(prepareConsents(".popup.pop_registro_3_alta ")) }, function (data) {
            if (data.NewCinesacard_CinesaUserResponse.returnCode == "0" || data.NewCinesacard_CinesaUserResponse.returnCode == 0) {

                $(".cupon_datos .ccname").html(UserInformation.UserInformation.Name + " " + UserInformation.UserInformation.FirstSurname);
                $(".cupon_datos .ccdoctype").html(UserInformation.UserInformation.DocumentType);
                $(".cupon_datos .ccdocnum").html(UserInformation.UserInformation.DocumentNumber);
                $(".cupon_datos .ccnum").html(objUser.UserLoginResponse.UserInformation.UserInformation.userId);
                popupClose();
                popupShow("pop_cupon", true);
                if (hasConsent(["Performance"])) {
                    ga('send', 'event', 'CinesaUser', 'Registro', 'Solo CC');
                    wa.bt_queue.push
                        ({
                            //"customIdentifier": "xxx",
                            "tags": [
                                { tag: "ALTA", value: "CC_Finalizado" }
                            ],
                            "async": true,
                            "isTargeting": true,
                            "isEvent": false
                        });
                }
            } else {
                if (typeof (data.NewCinesacard_CinesaUserResponse.returnDescription) != "undefined") {
                    customalert(data.NewCinesacard_CinesaUserResponse.returnDescription);
                } else {
                    customalert(localization.enestosmomentosincidencias);
                }
            }
        });
        return false;
    });
    // Registro UU - Paso 1
    $(".popup.pop_registro form").submit(function () {
        $.post("/CinesaUser/calculaCaptcha", { response: grecaptcha.getResponse() }, function (result) {
            if (result == "true") {
                var scope = ".popup.pop_registro form ";
                $(scope + "*").removeClass("inputNok");
                var res = _validaPass($(scope + "input[name=passwd]").val());
                if (_validateEmail($(scope + "input[name=email]").val())) {
                    if (res == "OK") {
                        $.post("/CinesaUser/ValidateUser", { Email: $(scope + "input[name=email]").val() }, function (data) {
                            if (data.ValidateUserMailResponse.returnCode == 0 || data.ValidateUserMailResponse.returnCode == "0") {
                                $(".popup.pop_registro_2 input[name=email]").val($(scope + "input[name=email]").val());
                                $(".popup.pop_registro_2 input[name=passwd]").val($(scope + "input[name=passwd]").val());
                                popupClose();
                                popupShow("pop_registro_2", true);
                            } else {
                                if (typeof (data.ValidateUserMailResponse.returnDescription) != "undefined") {
                                    grecaptcha.reset();
                                    errorActions(scope, data.ValidateUserMailResponse.returnCode, data.ValidateUserMailResponse.returnDescription);
                                } else {
                                    grecaptcha.reset();
                                    customalert(localization.enestosmomentosincidencias);
                                }
                            }
                        });
                    } else {
                        grecaptcha.reset();
                        $(scope + "input[name=passwd]").addClass("inputNok");
                        customalert(localization.lacontrasenaminimo6digitos);
                    }
                } else {
                    $(scope + "input[name=email]").addClass("inputNok");
                    grecaptcha.reset();
                    customalert(localization.emailnovalido);
                }
            }
            else {
                grecaptcha.reset();
                customalert(localization.porfavornosoyrobot);
            }
        });
        return false;
    });

    // Registro UU - Paso 2
    $(".pop_cinesacard form").submit(function () {
        //$.post("/CinesaUser/SetConsents", { Consents: JSON.stringify(prepareConsents(".FistAccessPopIn ")) }, function (data) {
        //});
        var scope = ".pop_cinesacard form ";
        var consentss = prepareConsents(scope);

        var consents = [];

        $.each(consentss, function (i, c) {
            var c = c.Consent[0];
            var state = false;

            if (c.estado == "Y") {
                state = true;
            }

            var consent = {
                IdConsent: c.idConsent,
                Estado: state
            };

            consents.push(consent);
        });

        //var rcom = $("#FistAccessPopInconsent3").is(":checked") ? "Y" : "N";
        if ($("#politica2").is(":checked")) {
            $.post("/CinesaUser/UserFirstAccess/", { consents: JSON.stringify(consents) }, function (data) {
                if (data.UserFirstAccessResponse.returnCode == "0" || data.UserFirstAccessResponse.returnCode == 0) {
                    if (GTMEnabled) {
                        uaEvent('CinesaUser', 'Registro', 'Migrado CC');
                    }
                    updateHeader();
                    $(".close_menu_left.sb-close").click();
                    popupClose();
                    //_nextCallback();
                } else {
                    customalert(data.UserFirstAccessResponse.returnDescription);
                }
            });
        } else {
            customalert(localization.debesaceptarprivacidadyuso);
        }
        return false;

    });
}

function rellenaDatosCC(accion) {
    $.post("/CinesaUser/UserDetail", function (datapersonal) {
        objUser.UserGetPersonalInformationResponse = datapersonal.UserGetPersonalInformationResponse;
        var scope = ".popup.pop_registro_activacion ";
        if (accion == "activacion") {
            $(scope + "input[name=emailfirst]").val(objUser.UserLoginResponse.UserInformation.UserInformation.email);
            $(scope + "input[name=mobilefirst]").val(objUser.UserLoginResponse.UserInformation.UserInformation.mobile);
            $(scope + "input[name=documentNumberfirst]").val(objUser.UserLoginResponse.UserInformation.UserInformation.documentNumber);
            if (objUser.UserLoginResponse.UserInformation.UserInformation.documentType != "") {
                $(scope + "input[name=documentTypefirst-0][value=" + objUser.UserLoginResponse.UserInformation.UserInformation.documentType + "]").parent().parent().click();
            }
        }
        scope = ".popup.pop_registro_3_" + accion + " ";
        if (objUser.UserLoginResponse.UserInformation.UserInformation.documentType != "") {
            $(scope + "input[name=documentType-0][value=" + objUser.UserLoginResponse.UserInformation.UserInformation.documentType + "]").parent().parent().click();
        }
        $(scope + "input[name=documentNumber]").val(objUser.UserLoginResponse.UserInformation.UserInformation.documentNumber || objUser.UserGetPersonalInformationResponse.userInformation.User.documentNumber);
        $(scope + "input[name=postalcode]").val(objUser.UserLoginResponse.UserInformation.UserInformation.postalCode || objUser.UserGetPersonalInformationResponse.userInformation.User.postalCode);
        $(scope + "input[name=address]").val(objUser.UserGetPersonalInformationResponse.userInformation.User.address);
        $(scope + "input[name=location]").val(objUser.UserGetPersonalInformationResponse.userInformation.User.location);
        if (objUser.UserGetPersonalInformationResponse.userInformation.User.region != "") {
            $(scope + "input[name=provincia-0][value=" + objUser.UserGetPersonalInformationResponse.userInformation.User.region + "]").parent().parent().click();
        }
        if (objUser.UserGetPersonalInformationResponse.userInformation.User.gender != "") {
            $(scope + "input[name=genero-0][value=" + objUser.UserGetPersonalInformationResponse.userInformation.User.gender + "]").parent().parent().click();
        }
        if (objUser.UserGetPersonalInformationResponse.userInformation.User.birthDate != "") {
            var _birthDate = objUser.UserGetPersonalInformationResponse.userInformation.User.birthDate.split(" ")[0].split("/");
            $(scope + "input[name=dd-0][value=" + _birthDate[0] + "]").parent().parent().click();
            $(scope + "input[name=mm-0][value=" + _birthDate[1] + "]").parent().parent().click();
            $(scope + "input[name=aaaa-0][value=" + _birthDate[2] + "]").parent().parent().click();
        }
        $(scope + "input[name=kidsnumber]").val(objUser.UserGetPersonalInformationResponse.userInformation.User.kidsNumber);
        resetProgressBar();
        popupClose();
        if (accion == "activacion") {
            popupShow("pop_registro_activacion", true);
        }
        if (accion == "alta") {
            popupShow("pop_registro_3_alta", true);
        }
        fixanims();
    });
}

function generaDatosEnvioCC(accion) {
    var scope = ".popup.pop_registro_3_" + accion + " ";
    var errormsg = "";
    var objEnvio = new Object();
    objEnvio.Email = objUser.UserLoginResponse.UserInformation.UserInformation.email;
    objEnvio.Gender = objUser.UserLoginResponse.UserInformation.UserInformation.Gender || $(scope + "input[name=genero]").val();
    objEnvio.Name = objUser.UserLoginResponse.UserInformation.UserInformation.name;
    objEnvio.FirstSurname = objUser.UserLoginResponse.UserInformation.UserInformation.firstSurname;
    objEnvio.SecondSurname = objUser.UserLoginResponse.UserInformation.UserInformation.secondSurname;
    objEnvio.BirthDate = objUser.UserLoginResponse.UserInformation.UserInformation.birthdate.substr(0, 10) || $(scope + "input[name=dd]").val() + "/" + $(scope + "input[name=mm]").val() + "/" + $(scope + "input[name=aaaa]").val();
    objEnvio.Mobile = objUser.UserLoginResponse.UserInformation.UserInformation.mobile;

    if (objEnvio.Gender == "U") {
        objEnvio.Gender = $(scope + "input[name=genero]").val();
    }

    objEnvio.DocumentType = $(scope + "input[name=documentType]").val(); // O
    objEnvio.DocumentNumber = $(scope + "input[name=documentNumber]").val(); // O
    objEnvio.Address = $(scope + "input[name=address]").val(); // O
    objEnvio.Location = $(scope + "input[name=location]").val(); // O
    objEnvio.PostalCode = $(scope + "input[name=postalcode]").val(); // O
    objEnvio.Region = $(scope + "input[name=provincia]").val(); // O

    if (objEnvio.DocumentType == "") {
        $(scope + "input[name=documentType]").parents(".radiobox").addClass("inputNok");
        errormsg += "- " + localization.tipodedoc + "\n";
    }
    if (objEnvio.DocumentNumber == "") {
        $(scope + "input[name=documentNumber]").addClass("inputNok");
        errormsg += "- " + localization.numerodedoc + "\n";
    } else {
        var validaNIF_CIF = new NIF_CIFValidator();
        if ((typeof (objEnvio.DocumentType) != "undefined") && (objEnvio.DocumentType == "D") && (!validaNIF_CIF.checkAll(objEnvio.DocumentNumber))) {
            $(scope + "input[name=documentNumber]").addClass("inputNok");
            errormsg += "- " + localization.numerodedoc + "\n";
        }
    }
    if (objEnvio.Address == "") {
        $(scope + "input[name=address]").addClass("inputNok");
        errormsg += "- " + localization.direccion + "\n";
    }
    if (objEnvio.Location == "") {
        $(scope + "input[name=location]").addClass("inputNok");
        errormsg += "- " + localization.ciudad + "\n";
    }

    if (objEnvio.Gender == "") {
        $(scope + "input[name=genero]").addClass("inputNok");
        errormsg += "- " + localization.genero + "\n";
    }

    if (objEnvio.BirthDate.length != 10) {
        errormsg += "- " + localization.tucumple + "\n";
    } else {
        try {
            var bdatearr = objEnvio.BirthDate.split("/");
            var bdate = new Date(bdatearr[2], parseInt(bdatearr[1]) - 1, bdatearr[0]);
            var validdate = new Date();
            validdate.setFullYear(validdate.getFullYear() - 14);
            if (bdate > validdate) {
                errormsg += "- " + localization.debessermayorde14alta + "\n";
            }
        } catch (err) {
            errormsg += "- " + localization.tucumple + "\n";
        }
    }
    if (typeof (objEnvio.Region) == "undefined") {
        $(scope + "input[name=provincia]").parents(".radiobox").addClass("inputNok");
        errormsg += "- " + localization.provincia + "\n";
    }
    if (objEnvio.PostalCode == "") {
        $(scope + "input[name=postalcode]").addClass("inputNok");
        errormsg += "- " + localization.codigopostal + "\n";
    }
    else {
        if (country.toLowerCase() == "es") {
            var pattern = new RegExp(/^([1-9]{2}|[0-9][1-9]|[1-9][0-9])[0-9]{3}$/);
            if (!pattern.test(objEnvio.PostalCode)) {
                $(scope + "input[name=postalcode]").addClass("inputNok");
                errormsg += "- " + localization.codigopostalincorrecto + "\n";
            }
        }
    }

    if (!$(scope + "input[name=politica]").is(":checked")) {
        $(scope + "input[name=politica]").parents(".pop_field_check").find("label").addClass("inputNok");
        errormsg += "- " + localization.debesaceptarprogramacc + "\n";
    }
    objEnvio.errormsg = errormsg;
    return objEnvio;

}

function initPopupsUser() {
    $(".popup").click(function (e) {
        if ($(e.target).parents(".radiobox").length == 0) {
            $(".radiobox").removeClass("open");
        }
    });
    $(document).on("touch click", ".rb_selected", function (e) {
        if (!$(e.target).hasClass("rb_starfav")) {
            if (!$(this).parents(".radiobox").hasClass("disabled")) {
                if ($(this).parents(".radiobox").hasClass("open")) {
                    $(this).parents(".radiobox").removeClass("open");
                } else {
                    $(".radiobox").removeClass("open");
                    $(this).parents(".radiobox").addClass("open");
                }
            }
        }
    });

    $(document).on("touch click", ".rb label", function () {
        if ($(this).parent().hasClass("disabled")) {
            $(this).find("input").prop('checked', false);
        } else {
            var selected = $(this).html();
            $(this).parents(".radiobox").find(".rb_selected").html('<span class="rb_ico"></span>' + selected);
            $(this).parents(".radiobox").find(".rb_selected input").remove();
            $(this).parents(".radiobox").removeClass("open");
        }
    });

    $(".rb_selected[data-defaultvalue]").each(function () {
        if ($(this).attr("data-defaultvalue") != "") {
            $(this).parent().find("input[value=" + $(this).attr("data-defaultvalue") + "]").parent().click();
        }
    });

    $(".alert .alert_close,.alert .alert_btn").click(function () {
        customalertClose();
    });

    $(".pop_close").on("touch click", function () {
        popupClose(true);
    });

    $(".pop_btn.noreg").click(function () {
        popupClose();
    });

    $(".pop_registro_1 .pop_btn").click(function () {
        $(".pop_registro_1").addClass("hidden");
        $(".pop_registro_2").removeClass("hidden");
    })

    $(".pop_entrar .pop_btn.reg").click(function () {
        $(".pop_entrar").addClass("hidden");
        $(".pop_registro_1").removeClass("hidden");
        $(".pop_registro_2 form")[0].reset();
        $(".pop_error[data-errorfor=user]").html("");
        $(".pop_error[data-errorfor=pass]").html("");
        $("#user").removeClass("pop_ok").removeClass("pop_bad");
        $("#r-user").removeClass("pop_ok").removeClass("pop_bad");
        $("#pass").removeClass("pop_ok").removeClass("pop_bad");
        $("#r-pass").removeClass("pop_ok").removeClass("pop_bad");
    });

    $(".pop_entrar .pop_frm form").submit(function () {
        $("#user_login").removeClass("pop_ok").removeClass("pop_bad");
        if ($(".pop_entrar").hasClass("fiesta")) {
            loginCinesaUser($("#user_login").val(), $("#pass_login").val(), false, _nextCallback);
        } else {
            loginCinesaUser($("#user_login").val(), $("#pass_login").val());
        }

        return false;
    });

    // Registro
    $(".pop_registro_1 .pop_btn.reg").click(function () {
        $(".pop_registro_1").addClass("hidden");
        $(".pop_registro_2").removeClass("hidden");
        $(".pop_registro_2 form")[0].reset();
        $(".pop_error[data-errorfor=user]").html("");
        $(".pop_error[data-errorfor=pass]").html("");
        $("#user").removeClass("pop_ok").removeClass("pop_bad");
        $("#r-user").removeClass("pop_ok").removeClass("pop_bad");
        $("#pass").removeClass("pop_ok").removeClass("pop_bad");
        $("#r-pass").removeClass("pop_ok").removeClass("pop_bad");
    });

    $("#user").change(function () {
        $("#user").removeClass("pop_ok").removeClass("pop_bad");
        $(".pop_error[data-errorfor=user]").html("");
        if (_validateEmail($("#user").val())) {
            $.post("/CinesaUser/ValidateUser", { Email: $("#user").val() }, function (data) {
                if (data.ValidateUserMailResponse.returnCode == 0 || data.ValidateUserMailResponse.returnCode == "0") {
                    $("#user").addClass("pop_ok");
                    if ($("#r-user").val().length > 0) {
                        $("#r-user").change();
                    }
                } else {
                    $("#user").addClass("pop_bad");
                    $(".pop_error[data-errorfor=user]").html(data.ValidateUserMailResponse.returnDescription);
                }
            });
        } else {
            $("#user").addClass("pop_bad");
            $(".pop_error[data-errorfor=user]").html("Email incorrecto");
        }
    });

    $("#r-user").change(function () {
        $("#r-user").removeClass("pop_ok").removeClass("pop_bad");
        $(".pop_error[data-errorfor=user]").html("");
        if ($("#user").val() == $("#r-user").val()) {
            $("#r-user").addClass("pop_ok");
            if ($("#user").hasClass("pop_bad")) {
                if ($("#user").val().length > 0) {
                    $("#user").change();
                }
            }
        } else {
            $("#r-user").addClass("pop_bad");
            $(".pop_error[data-errorfor=user]").html(localization.usuariodebecoincidir);
        }
    });

    $("#pass").change(function () {
        var res = _validaPass($("#pass").val());
        $("#pass").removeClass("pop_ok").removeClass("pop_bad");
        $(".pop_error[data-errorfor=pass]").html("");
        if (res != "OK") {
            $("#pass").addClass("pop_bad");
            $(".pop_error[data-errorfor=pass]").html(res);
        } else {
            $("#pass").addClass("pop_ok");
            if ($("#r-pass").val().length > 0) {
                $("#r-pass").change();
            }
        }

    });

    $("#r-pass").change(function () {
        $("#r-pass").removeClass("pop_ok").removeClass("pop_bad");
        $(".pop_error[data-errorfor=pass]").html("");
        if ($("#pass").val() == $("#r-pass").val()) {
            $("#r-pass").addClass("pop_ok");
            if ($("#pass").hasClass("pop_bad")) {
                if ($("#pass").val().length > 0) {
                    $("#pass").change();
                }
            }
        } else {
            $("#r-pass").addClass("pop_bad");
            $(".pop_error[data-errorfor=pass]").html(localization.contrasenascoincidir);
        }
    });

    $(".pop_registro_2 .pop_frm form input").change(function () {
        var send = true;
        var errmsg = "";
        /*
        $(".pop_error[data-errorfor=user]").html("");
        $(".pop_error[data-errorfor=pass]").html("");
        $("#user").removeClass("pop_ok").removeClass("pop_bad");
        $("#r-user").removeClass("pop_ok").removeClass("pop_bad");
        $("#pass").removeClass("pop_ok").removeClass("pop_bad");
        $("#r-pass").removeClass("pop_ok").removeClass("pop_bad");
        //User
        if (!_validateEmail($("#user").val())) {
            send = false;
            $("#user_login").addClass("pop_bad");
            errmsg += "\nNombre de usuario";
        }

        if (!(($("#user").val()) == $("#r-user").val())) {
            send = false;
            $("#r-user").addClass("pop_bad");
            $(".pop_error[data-errorfor=user]").html("El usuario debe coincidir");
            errmsg += "\nNombre de usuario debe coincidir";
        }

        //Pass
        var res = _validaPass($("#pass").val());
        if (res != "OK") {
            send = false;
            $(".pop_error[data-errorfor=pass]").html(res);
            errmsg += "\nPassword";
        }

        if (!($("#pass").val() == $("#r-pass").val())) {
            send = false;
            $("#r-pass").addClass("pop_bad");
            $(".pop_error[data-errorfor=pass]").html(localization.contrasenascoincidir);
            errmsg += "\nPasswords deben coincidir";
        }
        */
        //Nombre
        if ($("#nombre").val() == "") {
            send = false;
            errmsg += "\n" + localization.nombre;
        }

        //Primer apellido
        if ($("#apellido").val() == "") {
            send = false;
            errmsg += "\n" + localization.primerapellido;
        }



        //Telefono
        if ($("#tlf").val() == "") {
            send = false;
            errmsg += "\n" + localization.telefono;
        }

        //CP
        if ($("#CP").val() == "") {
            send = false;
            errmsg += "\n" + localization.codigopostal;
        }
        else {
            var pattern = new RegExp(/^([1-9]{2}|[0-9][1-9]|[1-9][0-9])[0-9]{3}$/);
            if (!pattern.test($("#CP").val())) {
                errormsg += "- " + localization.codigopostalincorrecto + "\n";
            }
        }
        //Genero
        if ($(".pop_registro_2 input[name=genero]:checked").length == 0) {
            send = false;
            errmsg += "\n" + localization.genero;
        }

        //Cumple
        if (($(".pop_registro_2 input[name=dd]:checked").length == 0) || ($(".pop_registro_2 input[name=mm]:checked").length == 0) || ($(".pop_registro_2 input[name=aaaa]:checked").length == 0)) {
            send = false;
            errmsg += "\n" + localization.tucumple;
        } else {
            if (rangoEdad($(".pop_registro_2 input[name=dd]:checked").val() + "/" + $(".pop_registro_2 input[name=mm]:checked").val() + "/" + $(".pop_registro_2 input[name=aaaa]:checked").val(), 14, 100) != 1) {
                send = false;
                errmsg += "\n" + localization.debessermayorde14alta;
            }
        }

        //Privacidad
        if (!$("#politica").is(":checked")) {
            send = false;
            errmsg += "\n" + localization.aceptacionpoliticaprivacidadcondiciones;
        }


        if (send) {
            $(".pop_registro_2 input[type=submit]").removeAttr("disabled");
        } else {
            $(".pop_registro_2 input[type=submit]").attr("disabled", "disabled");
        }
    });

    $(".pop_registro_2 .pop_frm form").submit(function () {
        var send = true;
        var errmsg = "";
        $(".pop_error[data-errorfor=user]").html("");
        $(".pop_error[data-errorfor=pass]").html("");
        $("#user").removeClass("pop_ok").removeClass("pop_bad");
        $("#r-user").removeClass("pop_ok").removeClass("pop_bad");
        $("#pass").removeClass("pop_ok").removeClass("pop_bad");
        $("#r-pass").removeClass("pop_ok").removeClass("pop_bad");
        //User
        if (!_validateEmail($("#user").val())) {
            send = false;
            $("#user_login").addClass("pop_bad");
            errmsg += "\nNombre de usuario";
        }

        if (!(($("#user").val()) == $("#r-user").val())) {
            send = false;
            $("#r-user").addClass("pop_bad");
            $(".pop_error[data-errorfor=user]").html(localization.usuariodebecoincidir);
            errmsg += "\n" + localization.nombredeusuariocoincidir;
        }

        //Pass
        var res = _validaPass($("#pass").val());
        if (res != "OK") {
            send = false;
            $(".pop_error[data-errorfor=pass]").html(res);
            errmsg += "\n" + localization.password;
        }

        if (!($("#pass").val() == $("#r-pass").val())) {
            send = false;
            $("#r-pass").addClass("pop_bad");
            $(".pop_error[data-errorfor=pass]").html(localization.contrasenascoincidir);
            errmsg += "\n" + localization.contrasenascoincidir;
        }

        //Nombre
        if ($("#nombre").val() == "") {
            send = false;
            errmsg += "\n" + localization.nombre;
        }

        //Primer apellido
        if ($("#apellido").val() == "") {
            send = false;
            errmsg += "\n" + localization.primerapellido;
        }



        //Telefono
        if ($("#tlf").val() == "") {
            send = false;
            errmsg += "\n" + localization.telefono;
        }

        //CP
        if ($("#CP").val() == "") {
            send = false;
            errmsg += "\n" + localization.codigopostal;
        }
        else {
            var pattern = new RegExp(/^([1-9]{2}|[0-9][1-9]|[1-9][0-9])[0-9]{3}$/);
            if (!pattern.test($("#CP").val())) {
                errormsg += "- " + localization.codigopostalincorrecto + "\n";
            }
        }

        //Genero
        if ($("input[name=genero]:checked").length == 0) {
            send = false;
            errmsg += "\n" + localization.genero;
        }

        //Cumple
        if (($(".pop_registro_2 input[name=dd]:checked").length == 0) || ($(".pop_registro_2 input[name=mm]:checked").length == 0) || ($(".pop_registro_2 input[name=aaaa]:checked").length == 0)) {
            send = false;
            errmsg += "\n" + localization.tucumple;
        } else {
            if (rangoEdad($(".pop_registro_2 input[name=dd]:checked").val() + "/" + $(".pop_registro_2 input[name=mm]:checked").val() + "/" + $(".pop_registro_2 input[name=aaaa]:checked").val(), 14, 100) != 1) {
                send = false;
                errmsg += "\n" + localization.debessermayorde14alta;
            }
        }

        //Privacidad
        if (!$("#politica").is(":checked")) {
            send = false;
            errmsg += "\n" + localization.aceptacionpoliticaprivacidadcondiciones;
        }


        if (send) {
            var regusr = new Object;
            var UserInformation = new Object;
            regusr.Email = $("#user").val();
            regusr.Password = $("#pass").val();
            regusr.Gender = $("input[name=genero]:checked").val();
            regusr.Name = $("#nombre").val();
            regusr.FirstSurname = $("#apellido").val();
            if ($("#sapellido").val() != "") {
                regusr.SecondSurname = $("#sapellido").val();
            }
            regusr.BirthDate = $("input[name=dd]:checked").val() + "/" + $("input[name=mm]:checked").val() + "/" + $("input[name=aaaa]:checked").val();
            regusr.Mobile = $("#tlf").val();
            regusr.PostalCode = $("#CP").val();
            regusr.ReceiveComunications = $("#news").is(":checked") ? "Y" : "N";
            UserInformation.UserInformation = regusr;
            $(".pop_registro_2 input[type=submit]").addClass("hidden");
            $.post("/CinesaUser/ValidateUser", { Email: $("#user").val() }, function (data) {
                if (data.ValidateUserMailResponse.returnCode == 0 || data.ValidateUserMailResponse.returnCode == "0") {
                    $.post("/CinesaUser/Register", { Email: regusr.Email, FullName: regusr.Name + " " + regusr.FirstSurname, UserInformation: JSON.stringify(UserInformation), fbat: _fbat, fbid: _fbid }, function (data) {
                        $(".pop_registro_2 input[type=submit]").removeClass("hidden");
                        if (data.NewCinesaUserResponse.returnCode == 0 || data.NewCinesaUserResponse.returnCode == "0") {
                            //$("#ltlUID").val(data.NewCinesaUserResponse.userId);
                            //TODO: Mostrar Gracias
                            //popupClose();
                            if (hasConsent(["Performance"])) {
                                if (GTMEnabled) {
                                    uaEvent('login module', 'login', 'new account');
                                }
                                ga('send', 'event', 'CinesaUser', 'Registro', 'Solo Usuario');
                                wa.bt_queue.push
                                    ({
                                        "tags": [
                                            { tag: "ALTA", value: "CinesaUser_Finalizado" }
                                        ],
                                        "async": true,
                                        "isTargeting": true,
                                        "isEvent": false
                                    });
                            }
                            if ($(".pop_entrar").hasClass("fiesta")) {
                                if (hasConsent(["Performance"])) {
                                    ga('send', 'event', 'SaltoCompra', 'Status', 'Registro');
                                }
                            }
                            if ($("#porlapatilla_registro").length > 0) {
                                porlapatilla_callback(data);
                                return false;
                            }
                            $(".pop_registro_2").addClass("hidden");
                            $(".pop_confirmacion .pop_dest").html(regusr.Email);
                            $(".pop_confirmacion").removeClass("hidden");
                            $('html, body').animate({
                                scrollTop: $(".pop_confirmacion").offset().top
                            }, 500);
                            if ($(".pop_entrar").hasClass("fiesta")) {
                                sendToA1(_linkCompra);
                            }
                        } else {
                            if (typeof (data.NewCinesaUserResponse.returnDescription) != "undefined") {
                                customalert(data.NewCinesaUserResponse.returnDescription);
                            } else {
                                customalert(localization.enestosmomentosincidencias);
                            }
                        }
                    });
                } else {
                    $("#user").addClass("pop_bad");
                    $(".pop_error[data-errorfor=user]").html(data.ValidateUserMailResponse.returnDescription);
                }
            });
        } else {
            errmsg = "Por favor revisa los siguientes campos:" + errmsg;
            customalert(errmsg);
        }
        return false;
    });
    if ($(".pop_bienvenida").length > 0) {
        $(".pop_mask").removeClass("hidden");
        /*$(".pop_bienvenida .pop_btn").click(function (e) {
            e.preventDefault();
            $(".pop_bienvenida").addClass("hidden");
            $(".pop_entrar").removeClass("hidden");
        });*/
    };
    $(".pop_confirmacion .pop_btn").click(function (e) {
        e.preventDefault();
        popupClose();
    });

    $(".pop_cinesacard form").submit(function () {
        //var rcom = $("#FistAccessPopInconsent3").is(":checked") ? "N" : "Y";

        var scope = ".pop_cinesacard form ";
        var consentss = prepareConsents(scope);

        var consents = [];

        $.each(consentss, function (i, c) {
            var c = c.Consent[0];
            var state = false;

            if (c.estado == "Y") {
                state = true;
            }

            var consent = {
                IdConsent: c.idConsent,
                Estado: state
            };

            consents.push(consent);
        });

        if ($("#politica2").is(":checked")) {
            $.post("/CinesaUser/UserFirstAccess/", { consents: JSON.stringify(consents) }, function (data) {
                if (data.UserFirstAccessResponse.returnCode == "0" || data.UserFirstAccessResponse.returnCode == 0) {
                    if (GTMEnabled) {
                        uaEvent('CinesaUser', 'Registro', 'Migrado CC');
                    }
                    updateHeader();
                    $(".close_menu_left.sb-close").click();
                    popupClose();
                    popupShow("pop_cinesacard_final_reg", true);
                } else {
                    customalert(data.UserFirstAccessResponse.returnDescription);
                }
            });
        } else {
            customalert(localization.debesaceptarprivacidadyuso);
        }
        return false;
    });

    $(".pop_cinesacard_final_reg .pop_btn,.pop_cinesacard_final_reg .pop_close").click(function (e) {
        e.preventDefault();
        popupClose();
        _nextCallback();
    });
}

function RRSS() {
    // FB
    $(".com_facebook").click(function (e) {
        e.preventDefault();
        var enlace = $(this).attr("href");
        FB.ui({
            method: 'share',
            href: trim(staticURL, "/") + enlace
        }, function (response) { });
    });
}

function menulistacines() {
    $(".listacines .btnlistacines").on("touch click", function () {
        if ($("header .submenucines").hasClass("open")) {
            $("header .submenucines").removeClass("open");
        } else {
            $("header .submenucines").addClass("open");
        }
    });
    $("#header #menu_web .cines > div").click(function (e) {
        e.preventDefault();
        if ($(".submenucines").hasClass("open")) {
            $(".submenucines").removeClass("open");
        } else {
            $(".submenucines").addClass("open");
        }
    });
}

function initMenumovil() {
    $(".menu_left li").on("touch click", function () {
        if ($(this).find("a").length == 0) {
            var submenu = $(this).attr("class");
            setTimeout(function () {
                $('.ml_submenu_peliculas[data-submenu="' + submenu + '"]').addClass("open");
            }, 50);
        }
    });
    /*$(".menu_left .peliculas").click(function(){
		$(".ml_submenu_peliculas").addClass("open");
	});*/

    $(".ml_submenu_peliculas .menu_btn").on("touch click", function () {
        setTimeout(function () {
            $(".ml_submenu_peliculas").removeClass("open");
        }, 50);
    });

    $(".close_menu_left").on("touch click", function () {
        setTimeout(function () {
            $(".ml_submenu_peliculas").removeClass("open");
        }, 50);
    });

}

function favorito() {
    $(document).on("click", "#ficha_cine .starfav", function (e) {
        e.preventDefault();
        if ($(this).hasClass("rb_fav")) {
            $(this).removeClass("rb_fav").addClass("rb_nofav");
            $.removeCookie("cine");
            $.removeCookie("cinen");
            $.removeCookie("cineu");
        } else {
            $(this).addClass("rb_fav").removeClass("rb_nofav");
            var cineid = $("#info_cine .select_cinefav .selectcinedia .rb_selected").attr("data-defaultvalue");
            $.cookie("cine", cineid, { path: '/', expires: 365 });
            $.cookie("cinen", $("#info_cine .select_cinefav .selectcinedia .rb_selected").text().trim(), { path: '/', expires: 365 });
            $.cookie("cineu", $("#info_cine .select_cinefav .selectcinedia .rb label input[value=" + cineid + "]").attr("data-href"), { path: '/', expires: 365 });
        }
    });

    if ($("#ficha_cine .starfav").length) {
        if (typeof ($.cookie("cine")) !== "undefined") {
            if ($.cookie("cine") == $("#info_cine .select_cinefav .selectcinedia .rb_selected").attr("data-defaultvalue")) {
                $("#ficha_cine .starfav").addClass("rb_fav");
            }
        }
    }

    $(document).on("click", ".radiobox.rb_star .rb_starfav", function (e) {
        //e.preventDefault();

        if ($(this).parent().hasClass("rb_selected")) {
            e.preventDefault();

            if ($(this).parent().text() != $.cookie("cine")) {
                $(".radiobox.rb_star .rb_starfav").removeClass("rb_fav").addClass("rb_nofav");
                $(this).removeClass("rb_nofav").addClass("rb_fav");
                var textinput = $(this).parent().text();
                $.cookie("cine", $(this).parents(".radiobox").find("ul li label:contains(" + textinput + ") input").attr("data-id"), { path: '/', expires: 365 });
                $.cookie("cinen", textinput, { path: '/', expires: 365 });
                $.cookie("cineu", $(this).parents(".radiobox").find("ul li label:contains(" + textinput + ") input").attr("data-href"), { path: '/', expires: 365 });
                var preselected = $(this).parents(".radiobox").find("ul li label:contains(" + textinput + ") input").attr("data-id");
                selectCineFav(preselected);
                $(this).parents(".radiobox").removeClass("open");

            } else {
                $(this).removeClass("rb_fav").addClass("rb_nofav");
                $.removeCookie("cine");
                $.removeCookie("cinen");
                $.removeCookie("cineu");
            }
        } else {
            if ($(this).parent().find("input").val() != $.cookie("cine")) {
                $(".radiobox.rb_star .rb_starfav").removeClass("rb_fav").addClass("rb_nofav");
                $(this).removeClass("rb_nofav").addClass("rb_fav");
                $.cookie("cine", $(this).parent().find("input").attr("data-id"), { path: '/', expires: 365 });
                $.cookie("cinen", $(this).parent().text(), { path: '/', expires: 365 });
                $.cookie("cineu", $(this).parent().find("input").attr("data-href"), { path: '/', expires: 365 });
                var preselected = $(this).parent().find("input").attr("data-id");
                selectCineFav(preselected);
            } else {
                $(this).removeClass("rb_fav").addClass("rb_nofav");
                $.removeCookie("cine");
                $.removeCookie("cinen");
                $.removeCookie("cineu");
            }
        }
    });

    $(".submenucines .cine span").click(function (e) {
        if ($(this).parent().attr("data-id") != $.cookie("cine")) {
            $(".submenucines .cine span").removeClass("fav").addClass("nofav");
            $(this).removeClass("nofav").addClass("fav");
            $.cookie("cine", $(this).parent().attr("data-id"), { path: '/', expires: 365 });
            $.cookie("cinen", $(this).parent().text(), { path: '/', expires: 365 });
            $.cookie("cineu", $(this).parent().find("a").attr("href"), { path: '/', expires: 365 });
            var preselected = $(this).parent().attr("data-id");
            selectCineFav(preselected);
        } else {
            $(this).removeClass("fav").addClass("nofav");
            $.removeCookie("cine");
            $.removeCookie("cinen");
            $.removeCookie("cineu");
        }
    });

    $(".radiobox.rb_star input[name=cine]").each(function () {
        if ($(this).attr("data-value") == $.cookie("cine")) {
            $(this).parent().find("span").removeClass("rb_nofav").addClass("rb_fav");
        }
    });


    selectCineFav();
}

function viewportfix() {
    updateOrientation();
}



function initCartelera() {
    $("#orden a").click(sortButtons);
}

function sortButtons(e) {
    e.preventDefault();
    $("#orden a").removeClass("selected");
    $(this).addClass("selected");
    $("#cartelera > ul li.listado-peliculas-item").tsort({ order: $(this).attr("data-order"), attr: "data-" + $(this).attr("data-orderby") });
    $("#cartelera > ul").prepend($("#cartelera > ul li.listado-peliculas-item.promo").detach());
}

function initPelicula() {
    var isPromoL = false;
    if (typeof ($.cookie("promoCode")) != "undefined") {
        if ($.cookie("promoCode") != "") {
            isPromoL = true;
        }
    }
    var evtcat = (($("body").attr("id") == "ficha_eventos") ? "event" : "movie");
    $(".selectcine input[name=cine]").change(function () {
        $(".zona .btn_zona").removeClass("hidden").removeClass("open");
        $.ajax({
            url: "/Peliculas/Horarios/" + $("#info").attr("data-id") + "/" + $(this).attr("data-id") + "/" + $(this).attr("data-poblacion"),
            cache: !isPromoL
        }).done(function (data) {
            peliculaRenderHorario2(data, $("body").attr("id") == "ficha_eventos");
            if (typeof (promotionRouteExecute) == "function") promotionRouteExecute();
        });
        if (GTMEnabled) {
            uaEvent(evtcat + ' detail', 'select cinema', $(this).parent().text());
        }
    });
    selectCineFav();
    $(".zona .btn_zona").click(function () {
        var u = "";
        var openclose;
        if ($(this).hasClass("open")) {
            openclose = "close";
            u = "/Peliculas/Horarios/" + $("#info").attr("data-id") + "/" + $(".selectcine input[name=cine]:checked").attr("data-id") + "/" + $(".selectcine input[name=cine]:checked").attr("data-poblacion");
            $(this).removeClass("open");
        } else {
            openclose = "open";
            u = "/Peliculas/Horarios/" + $("#info").attr("data-id") + "/" + "-1" + "/" + $(".selectcine input[name=cine]:checked").attr("data-poblacion");
            $(this).addClass("open");
        }
        if (GTMEnabled) {
            uaEvent(evtcat + ' detail', openclose + ' timetable', $(this).parent().text());
        }
        var isPromoL = false;
        if (typeof ($.cookie("promoCode")) != "undefined") {
            if ($.cookie("promoCode") != "") {
                isPromoL = true;
            }
        }
        $.ajax({
            url: u,
            cache: !isPromoL
        }).done(function (data) {
            peliculaRenderHorario2(data);
            if (typeof (promotionRouteExecute) == "function") promotionRouteExecute();
        });

    });
    setupAds();
    $(".horarios").on("touch click", ".horario", function () {
        var titulopelicula = $("#navegacion_fichas #center").text();
        var titulocine = $(".select_cinefav .selectcine .rb_star .rb_selected").text();
        if (hasConsent(["Performance"])) {
            ga('send', 'event', 'IntencionCompra', titulopelicula, titulocine);
            if (GTMEnabled) {
                uaEvent(evtcat + ' detail', 'select session', $(this).parent().text());
            }
        }
    });

    var cineselected = $(".selectcine .radiobox.rb_star .rb_selected").attr("data-defaultvalue");
    if (cineselected != "") {
        $(".selectcine input[name=cine][value=" + cineselected + "]").trigger("change");
    }
    if (GTMEnabled) {
        // uaEvent ('<event category>','<event action>', '<event label>','<event value>','<event interactive>' );
        $("#navegacion_fichas a").click(function () {
            uaEvent(evtcat + ' detail', 'top cross - navigation', $(this).text());
        });
        //$("body").attr("id")
    }
	if (hasConsent(["Performance"])) {
		wa.bt_queue.push
			({
				"tags": [
					{ tag: "PELICULAS", value: "ficha_" + $("#info").attr("data-titulo").split(" ").join("-") }
				],
				"async": true,
				"isTargeting": true,
				"isEvent": false
			});
	}

    setTimeout(function () {
        $(".avisoDbox").each(function () {
            var tmpDbox = "";
            var parent = $(this).parent();
            parent.find(".sala").each(function () {
                if ($(this).find(".tipo").text() == "Digital") {
                    $(this).find("li").each(function () {
                        tmpDbox += '<li data-hora="' + $(this).text().replace(':', '') + '">' + $(this).html() + '</li>';
                    });
                    $(this).remove();
                }
            });
            $(this).remove();
            parent.append("<li class='sala dboxFinal'><div class='lista_horarios'><p class='tipo' style='width: 140px;'>Digital</p><ul style='width: calc(100% - 160px);'>" + tmpDbox + "</ul></div></li><li class='avisoDbox'>Las sesiones indicadas en color naranja tienen algunas butacas en movimiento<span></span></li>")


            var dboxFinal = $(".dboxFinal").find('ul');
            dboxFinal.find('li').sort(function (a, b) {
                return $(a).attr('data-hora') - $(b).attr('data-hora');
            }).appendTo(dboxFinal);

            $(".sala").removeClass("dboxFinal");


        });
    }, 300);

    if ($(".FilmContent img").length > 0) {
        $(".FilmContent img").on("click touch", function () {
            var img = $(this).attr("src").split("/");
            $("body").append("<div class='popFilmContentMask'></div><div class='popFilmContent'><div class='popCloseFilmContent'></div><img src='" + img[0] + "/" + img[1] + "/" + img[2] + "/HD_" + img[3] + "' alt='" + $(this).attr("alt") + "'/></div>");
        });

        $("body").on("click touch", ".popCloseFilmContent, .popFilmContentMask", function () {
            $(".popFilmContent, .popFilmContentMask").remove();
        });
    }
}

function setupSelect() {
    $("#select").click(function (e) {
        if (!$(e.target).is("a") && !$(e.target).is("span")) {
            if (!$(this).hasClass("open")) {
                $(this).addClass("open");
                $(this).find("li").slideDown();
            }
        }
    });

    $("#select li span").mouseenter(function () {
        if ($(this).parent().is(":not([data-fav])")) {
            $(this).attr("class", "estrella_100");
        }
    }).mouseleave(function () {
        if ($(this).parent().is(":not([data-fav]")) {
            $(this).attr("class", "estrella_0");
        }
    });

    $("#select li span").click(function () {
        if ($(this).parent().is(":not([data-fav])")) {
            $("#select li[data-fav] span").attr("class", "estrella_0");
            $("#select li[data-fav]").removeAttr("data-fav");
            $.cookie("cine", $(this).parents("li").attr("data-id"), { path: '/', expires: 365 });
            $.cookie("cinen", $(this).parents("li").text(), { path: '/', expires: 365 });
            $.cookie("cineu", $(this).parents("li").find("a").attr("href"), { path: '/', expires: 365 });
            var preselected = $(this).parents("li").attr("data-id");
            selectCineFav(preselected);
        } else {
            $("#select li[data-fav] span").attr("class", "estrella_0");
            $("#select li[data-fav]").removeAttr("data-fav");
            $.removeCookie("cine");
            $.removeCookie("cinen");
            $.removeCookie("cineu");
        }
    });



    $(document).click(function (event) {
        if ((!$(event.target).closest('#select').length)) {// || ($("#select").hasClass("open") && $(event.target).hasClass("inner"))){
            closeSelect();
        }
    });

    selectCineFav();
}


var fdcflag = (new Date()) < (new Date(2019, 9, 27, 0, 1, 0));
var fdcdate = ["2019-10-28", "2019-10-29", "2019-10-30"];

function cineRenderHorario2(_data) {
    $(".selectdias").removeClass("hidden");
    var outputdias = "";
    var output = "";
    var output_eventosdestacados = "";
    var output_anticipadas = "";
    var output_eventos = "";
    var output_cartelera = "";
    var lastCine = "";
    var multiplecine = false;
    var eventodestacadofilled = false;
    var ventaanticipadafilled = false;
    var anticipadalastpeli = "";
    var eventolastpeli = "";
    var anticipadalastpelictrl = new Array();
    var eventolastpelictrl = new Array();

    $.each(_data, function (o, data) {
        output = "";
        if (data.length > 0) {
            if (o == "eventos") {
                output += '<ul class="destacado evento movil_hide"><li class="destacado"><div id="cerrar_eventos" class="horarios_cerrar"></div><p>' + localization.eventosmayus + '</p></li></ul>';
            }
            //if (o == "cartelera"){ // TODO: FIX
            $.each(data, function (i, dia) {
                var showlink = !((-1 < $.inArray(dia.dia, fdcdate)) && fdcflag);
                if (o == "cartelera") {
                    outputdias += "<li class=\"rb\"><label>" + dia.dia_str + "<span class=\"rb_icono\"></span><input type=\"radio\" value=\"" + dia.dia + "\" name=\"dia\" data-promo=\"" + dia.promo + "\"></label></li>";
                }
                $.each(dia.peliculas, function (j, pelicula) {
                    switch (o) {
                        case "eventosdestacados":
                            if ((eventolastpeli != pelicula.idgrupo) && (!($.inArray(pelicula.idgrupo, eventolastpelictrl) > -1)) && (eventolastpelictrl.length < 2)) {
                                if (!eventodestacadofilled) {
                                    output += "<ul class=\"destacado evento\"><li class=\"destacado\"><p>" + localization.eventodestacadomayus + "</p></li>";
                                    eventodestacadofilled = true;
                                }
                                output += "<li class=\"pelicula\"><div class=\"peli_info anticipada\"><h4><a href=\"/Eventos/" + pelicula.url + "/" + varcine + "\">" + pelicula.titulo + "</a></h4><p>" + localization.estreno + " " + _fecha(pelicula.estreno, "aaaa-mm-dd", "dd/mm/aaaa") + "</p><a href=\"/Eventos/" + pelicula.url + "/" + varcine + "\">" + localization.horariosycompramayus + "</a></div></li>";
                                eventolastpeli = pelicula.idgrupo;
                                eventolastpelictrl.push(pelicula.idgrupo);
                            }
                            return false;
                            break;
                        case "anticipadas":
                            if ((anticipadalastpeli != pelicula.idgrupo) && (!($.inArray(pelicula.idgrupo, anticipadalastpelictrl) > -1))) {
                                if (!ventaanticipadafilled) {
                                    output += "<ul class=\"destacado\"><li class=\"destacado\"><p>" + localization.ventaanticipadamayus + "</p></li>";
                                    ventaanticipadafilled = true;
                                }
                                output += "<li class=\"pelicula\"><div class=\"peli_info anticipada\"><h4><a href=\"/Peliculas/" + pelicula.url + "/" + varcine + "\">" + pelicula.titulo + "</a></h4><p>" + localization.estreno + " " + _fecha(pelicula.estreno, "aaaa-mm-dd", "dd/mm/aaaa") + "</p><a href=\"/Peliculas/" + pelicula.url + "/" + varcine + "\">" + localization.horariosycompramayus + "</a></div></li>";
                                anticipadalastpeli = pelicula.idgrupo;
                                anticipadalastpelictrl.push(pelicula.idgrupo);
                            }
                            break;
                        case "eventos":
                            output += "<ul id=\"fichaPeli\" class=\"evento\">";
                            $("article.ev").removeClass("hidden"); break;

                        case "cartelera":
                            output += "<ul id=\"fichaPeli\" class=\"hidden\" data-dia=\"" + dia.dia + "\">"; break;
                    }
                    if (o != "anticipadas") {
                        output += "<li class=\"pelicula" /*+ (pelicula.warner ? " warner" : "")*/ + "\"><div class=\"poster\"><a href=\"/" + ((country.toLowerCase() == "es") ? "Peliculas" : "Filmes") + "/" + pelicula.url + "/" + varcine + "\"><img src=\"" + pelicula.cartel + "\"/></a>" +
                            "<span></span></div><div class=\"peli_info\"><h4><a href=\"/" + ((country.toLowerCase() == "es") ? "Peliculas" : "Filmes") + "/" + pelicula.url + "/" + varcine + "\">" + pelicula.titulo + "</a></h4>" +
                            "<p>" + ((o != "cartelera") ? "<p>" + _fecha(dia.dia, "aaaa-mm-dd", "dd/mm/aaaa") + ".</p> " : "") + (pelicula.duracion == null ? "" : pelicula.duracion + " min.") + "</p><p>" + pelicula.genero + ".</p>" +
                            (pelicula.directores == null ? "" : "<p><span>" + localization.directores + ": </span>" + pelicula.directores + "</p>") +
                            (pelicula.actores == null ? "" : "<p><span>" + localization.actores + ": </span>" + pelicula.actores + "</p>");

                        if (pelicula.calificacion == 5) {
                            output += "<p>" + localization.pendientedecalificacion + "</p>";
                        } else {
                            if (country.toLowerCase() == "es") {
                                output += "<div class=\"calificacion calificacion_" + pelicula.calificacion + "\" data-calificacion=\"" + pelicula.calificaciontxt + "\"></div><div class=\"tecnologia\"></div></div>";
                            }
                        }


                        output += "<div id=\"botonHorarios\" class=\"verhorarios\">" + localization.horariosmayus + "</div><!-- class=\"verhorarios open\" --></li>";
                        $.each(pelicula.cines, function (k, cine) {
                            var golfa = false;
                            var svbmiercoles = (dia.dia == "2016-06-22") && (pelicula.idgrupo == 9974);
                            var patrociniognf = 0;
                            var cineverano = 0;
                            var patrocinioikea = 0;
                            var festivalnocturna = 0;
                            var iff = 0;
                            var dbox = 0;
                            var ldbox = 0; //sala luxe dbox
                            var arrayCines = ["Camas", "Diagonal", "Diagonal Mar", "Heron City Barcelona", "La Gavia", "Las Rozas Heron City", "Manoteras", "Nassica", "Parc Vallès", "Parquesur", "Puerto Venecia", "Bahía Santander", "Bonaire", "Plaza Loranca 2", "Max Ocio", "Salera", "Nueva Condomina", "Méndez Alvaro", "Intu Asturias", "Zaratán", "El Muelle", "Marineda City", "Mataró Parc"];
                            var arrayPelis = ["1263", "10485", "11317", "9435", "9977", "10229"];


                            if (cine.cine == "Proyecciones" && (dia.dia == "2018-10-23" || dia.dia == "2018-10-24" || dia.dia == "2018-10-25" || dia.dia == "2018-10-26" || dia.dia == "2018-10-27") && (cine.tipos[0].salas[0].salanum == "1" || cine.tipos[0].salas[0].salanum == "2")) {
                                festivalnocturna = 1;
                            }
                            if ($.inArray(cine.cine, arrayCines) != -1 && $.inArray(pelicula.idgrupo.toString(), arrayPelis) != -1) {
                                iff = 1;
                            }

                            if (lastCine == "") {
                                lastCine = cine.cine;
                            }
                            if (cine.cine != lastCine) {
                                multiplecine = true;
                            }
                            output += "<li class=\"cine\"><p>" + cine.cine + "</p></li>";
                            $.each(cine.tipos, function (l, tipo) {

                                var enteredtipo = false;
                                var enteredspecial = false;
                                $.each(tipo.salas, function (m, sala) {

                                    if (isSalaIkea(sala, cine)) {
                                        patrocinioikea = sala.salanum;
                                    }
                                    if (/(gas natural)/.test(sala.sala.toLowerCase())) {
                                        patrociniognf = sala.salanum;
                                    }
                                    if (/(verano)/.test(sala.sala.toLowerCase())) {
                                        cineverano = sala.salanum;
                                    }
                                    if (/(d-box)/.test(tipo.tipo.toLowerCase())) {
                                        dbox = 1;
                                    }
                                    if (/(luxe)/.test(sala.sala.toLowerCase())) {
                                        if (/(dbox|d-box)/.test(sala.sala.toLowerCase())) {
                                            ldbox = 1;
                                            dbox = 0;
                                            sala.sala = "l-dbox";
                                        }
                                    }
                                    if (/(imax|isens|dolby|luxe|l-dbox)/.test(sala.sala.toLowerCase())) {

                                        if (!enteredtipo && enteredspecial) {
                                            output += "</ul></div></li>";
                                        }
                                        if (enteredtipo) {

                                            output += "</ul></div></li>";
                                            enteredtipo = false;
                                        }
                                        output += "<li class=\"sala " + (/(isens|dolby|luxe|l-dbox)/.test(sala.sala.toLowerCase()) ? sala.sala.toLowerCase() : "") + (/(imax)/.test(tipo.tipo.toLowerCase()) ? tipo.tipo.toLowerCase() : "") + "\"><div class=\"lista_horarios\"><p class=\"tipo\">"; //"Sala " + sala.sala + " / " + tipo.tipo + "</p><ul>";
                                        output += tipo.tipo + "</p><ul>";

                                        $.each(sala.sesiones, function (n, sesion) {

                                            if (!golfa) {
                                                golfa = (Number(sesion.hora.substr(0, 2)) < 10);
                                            }
                                            if (!showlink) {
                                                sesion.pasada = true;
                                                sesion.ao = "#";
                                            }

                                            output += "<li data-hora=\"" + ((sesion.hora.substr(0, 2) < 10) ? (Number(sesion.hora.substr(0, 2)) + 24) + sesion.hora.substr(3, 4) : sesion.hora.replace(":", "")) + "\"><a data-promo=\"" + sesion.promo + "\" target=\"_blank\" href=\"" + sesion.ao + "\" class=\"sala_" + sala.sala.toLowerCase() + " horario" + (sesion.pasada ? " pasada" : "") + "\">" + sesion.hora + "</a></li>";
                                        });
                                        enteredspecial = true;
                                        enteredtipo = false;
                                    } else {

                                        if (enteredspecial) {
                                            output += "</ul></div></li>";
                                            enteredspecial = true;
                                        }
                                        if (!enteredtipo) {
                                            output += "<li class=\"sala screenXstring " + (/(isens|dolby|luxe|l-dbox)/.test(sala.sala.toLowerCase()) ? sala.sala.toLowerCase() : "") + (/(imax)/.test(tipo.tipo.toLowerCase()) ? tipo.tipo.toLowerCase() : "") + "\"><div class=\"lista_horarios\"><p class=\"tipo\">"; //"Sala " + sala.sala + " / " + tipo.tipo + "</p><ul>";

                                            if (/(d-box)/.test(tipo.tipo.toLowerCase())) {
                                                output += "Digital</p><ul>";
                                            } else {
                                                output += tipo.tipo + "</p><ul>";
                                            }

                                        }
                                        $.each(sala.sesiones, function (n, sesion) {
                                            if (sesion.tipo == "ScreenX") {
                                                output = output.replace("screenXstring", "screenx");
                                            } else {
                                                output = output.replace("screenXstring", "");
                                            }
                                            if (!golfa) {
                                                golfa = (Number(sesion.hora.substr(0, 2)) < 10);
                                            }
                                            if (!showlink) {
                                                sesion.pasada = true;
                                                sesion.ao = "#";
                                            }
                                            output += "<li data-hora=\"" + ((sesion.hora.substr(0, 2) < 10) ? (Number(sesion.hora.substr(0, 2)) + 24) + sesion.hora.substr(3, 4) : sesion.hora.replace(":", "")) + "\"><a data-promo=\"" + sesion.promo + "\" target=\"_blank\" href=\"" + sesion.ao + "\" class=\"horario" + (sesion.pasada ? " pasada" : "") + (/(verano)/.test(sala.sala.toLowerCase()) ? " cverano" : "") + (isSalaIkea(sala, cine) ? " ikea" : "") + (/(d-box)/.test(tipo.tipo.toLowerCase()) ? " dbox" : "") + "\">" + sesion.hora + (/(verano)/.test(sala.sala.toLowerCase()) ? "*" : "") + "</a></li>";
                                        });
                                        enteredtipo = true;

                                    }

                                });

                                output += "</ul></div></li>";

                            });
                            if (svbmiercoles) {
                                output += "<li class=\"golfa\">Este día sólo aplica precio Miércoles al cine en entradas compradas anticipadamente. El día del estreno sí aplica precio reducido Día del espectador en los cines que lo tengan.</li>";
                            }
                            if (golfa && country.toLowerCase() == "es") {
                                output += "<li class=\"golfa\">" + localization.htmlgolfa1 + " " + (dia.dia_str.indexOf(",") > -1 ? dia.dia_str.toLowerCase().split(" ")[1] : dia.dia_str.toLowerCase().split(" ")[0]) + " " + localization.htmlgolfa2 + " " + diasiguiente(dia.dia_str) + "</li>";
                            }
                            if (patrociniognf) {
                                output += "<li class=\"patrocinio\"><div class=\"sala_patrocinada gnf\"><p>Las sesiones en la sala " + patrociniognf + " están patrocinadas por <span></span></p></div></li>";
                            }
                            if (patrocinioikea) {
                                output += "<li class=\"patrocinio\"><div class=\"sala_patrocinada ikea\"></div></li>";
                            }
                            if (cineverano) {
                                output += "<li class=\"golfa cdv\">* Sesión al aire libre de Cine de Verano en la Plaza Multiusos del centro</li>";
                            }
                            if ((!showlink) && country.toLowerCase() == "es") {
                                output += "<li class=\"golfa\">Las sesiones de la Fiesta del Cine estarán a la venta a partir del domingo 27 de octubre.</li>";
                            }
                            if (festivalnocturna == 1) {
                                output += "<li class=\"golfa\">Esta película forma parte del Festival Nocturna</li>";
                            }
                            if (iff == 1) {
                                output += "<li class=\"golfa\">Esta película forma parte del Illumination Film Festival</li>";
                            }
                            if (dbox == 1) {
                                output += "<li class=\"avisoDbox\">Las sesiones indicadas en color naranja tienen algunas butacas en movimiento<span></span></li>";
                            }
                            if (ldbox == 1) {
                                output += "<li class=\"avisoSalaDbox\">Las sesiones indicadas en color naranja tienen algunas butacas en movimiento<span></span></li>";
                            }
                        });

                        output += "</ul>";
                    }
                });
            });
            switch (o) {
                case "eventosdestacados":
                    output_eventosdestacados += output; break;
                case "anticipadas":
                    output_anticipadas += output + "</ul>"; break;
                case "eventos":
                    output_eventos += output; break;
                case "cartelera":
                    output_cartelera += output; break;
            }
        }
    });

    $(".horarios[data-id=anticipada]").html(output_anticipadas);
    $(".horarios[data-id=eventodestacado]").html(output_eventosdestacados);
    $(".horarios[data-id=cartelera]").html(output_cartelera);
    $(".horarios[data-id=evento]").html(output_eventos);
    replaceConIntermedio(true);


    if (!multiplecine) {
        $(".horarios li.cine").remove();
    }

    $(".selectdias ul").html(outputdias);
    $(".selectdias .rb_selected").attr("data-defaultvalue", "");

    $(".selectdias ul li input[name=dia]").change(function () {
        $(".horarios[data-id=cartelera]>ul").addClass("hidden");
        $(".horarios[data-id=cartelera]>ul[data-dia=" + $(this).val() + "]").removeClass("hidden");
        if (GTMEnabled) {
            uaEvent('cinema details', 'billboard - change day', '', '', false);
        }
    });
    $(".selectdias ul li:first-child label").click();

    $(".horarios .sala").addClass("movil_hide");

    $(".sala.imax,.sala.isens,.sala.dolby").each(function () {
        $(this).parent().find(".pelicula").after($(this));
    });

    $(".sala.imax,.sala.isens,.sala.dolby").each(function () {
        $(this).parents("article").prepend($(this).parents("ul"));
        $(this).parents("article").prepend($(this).parents("article").find("h3"));
    });

    $(".horario.pasada").click(function (e) {
        e.preventDefault();
    });

    $(".horarios[data-id=cartelera] .lista_horarios ul").each(function () {
        $(this).find("li").tsort({ attr: "data-hora" });
    });

    $(".horarios[data-id=anticipada] .peli_info a").click(function () {
        if (GTMEnabled) {
            uaEvent('cinema details', 'advance sale', $(this).parent().find("h4 a").text());
        }
    });

    tooltipIkea();
    /*
        $(".lista_horarios ul li a").qtip({
            content: {
                text: function (event, api) {
                    api.tooltip.addClass('hidden');
                    $.ajax({
                        url: getPreciosURL($(this).attr("href"))
                    })
                    .then(function (content) {
                        var output = "";
                        var vipnovip = "";
                        $.each(content, function (k, v) {
                            if (vipnovip == "") {
                                vipnovip = v.asientoCode;
                            }
                            //if (vipnovip != v.asientoCode) {
                            //    vipnovip = v.asientoCode;
                            //    output += "<b>VIP</b><br/>";
                            //}
                            if (vipnovip == v.asientoCode) {
                                if (v.ShortDescription.toLowerCase().indexOf("online")>=0){
                                    output += v.ShortDescription + ": " + (v.precio / 100).toFixed(2) + "€";
                                    output += "<br/>";
                                    api.tooltip.removeClass('hidden');
                                }
                            }
                        });
                        api.set('content.text', output);
                    },
                    function (xhr, status, error) {
                        // Upon failure... set the tooltip content to the status and error value
                        api.set('content.text', status + ': ' + error);
                    });
    
                    //return 'Loading...';
                }
            }
        });*/
}

function sendToA1(enlace) {
    /*$.post("/Helper/sendToA1",function(data){
		document.location = enlace+"&d="+data;
	});*/
    document.location = enlace;
}

function sendTo(enlace) {
    document.location = enlace;
}

function isSalaIkea(sala, cine) {
    var output = false;
    $.each(sala_sofas, function (i, n) {
        if ((n.cine == cine.cine) && (n.nombre == sala.sala)) {
            output = true;
            return false;
        }
    });
    return output;
}

function peliculaRenderHorario2(data, evento) {
    if (typeof (evento) == "undefined") {
        evento = false;
    }
    var diaant = $(".field.dias").hasClass("hidden") ? "" : $(".field.dias .radiobox .rb_selected").text().trim();
    $(".field.dias").removeClass("hidden");
    var outputdias = "";
    var output = "";

    $.each(data.horarios, function (i, dia) {
        outputdias += "<li class=\"rb\"><label>" + dia.dia_str + "<span class=\"rb_icono\"></span><input type=\"radio\" value=\"" + dia.dia + "\" name=\"dia\" data-promo=\"" + dia.promo + "\"></label></li>";
        output += "<ul class=\"hidden" + (evento ? " evento" : "") + "\" data-dia=\"" + dia.dia + "\">";
        $.each(dia.cines, function (j, cine) {
            output += "<li class=\"cine\"><p>" + cine.cine + "</p></li>";
            var patrociniognf = 0;
            var cineverano = 0;
            var golfa = false;
            var svbmiercoles = (dia.dia == "2016-06-22") && ($("#info").attr("data-id") == 9974);
            var showlink = !((-1 < $.inArray(dia.dia, fdcdate)) && fdcflag);
            var patrocinioikea = 0;
            var festivalnocturna = 0;
            var dbox = 0;
            var ldbox = 0; //sala luxe dbox
            var iff = 0;
            var arrayCines = ["Camas", "Diagonal", "Diagonal Mar", "Heron City Barcelona", "La Gavia", "Las Rozas Heron City", "Manoteras", "Nassica", "Parc Vallès", "Parquesur", "Puerto Venecia", "Bahía Santander", "Bonaire", "Plaza Loranca 2", "Max Ocio", "Salera", "Nueva Condomina", "Méndez Alvaro", "Intu Asturias", "Zaratán", "El Muelle", "Marineda City", "Mataró Parc"];
            var arrayPelis = ["1263", "10485", "11317", "9435", "9977", "10229"];

            if ($.inArray(cine.cine, arrayCines) != -1 && $.inArray($("#info").attr("data-id").toString(), arrayPelis) != -1) {
                iff = 1;
            }
            if (cine.cine == "Proyecciones" && (dia.dia == "2018-10-23" || dia.dia == "2018-10-24" || dia.dia == "2018-10-25" || dia.dia == "2018-10-26" || dia.dia == "2018-10-27") && (cine.tipos[0].salas[0].salanum == "1" || cine.tipos[0].salas[0].salanum == "2")) {
                festivalnocturna = 1;
            }

            $.each(cine.tipos, function (k, tipo) {
                var enteredtipo = false;
                var enteredspecial = false;
                $.each(tipo.salas, function (m, sala) {
                    if (isSalaIkea(sala, cine)) {
                        patrocinioikea = sala.salanum;
                    }
                    if (/(gas natural)/.test(sala.sala.toLowerCase())) {
                        patrociniognf = sala.salanum;
                    }
                    if (/(verano)/.test(sala.sala.toLowerCase())) {
                        cineverano = sala.salanum;
                    }
                    if (/(d-box)/.test(tipo.tipo.toLowerCase())) {
                        dbox = 1;
                        if ($(".cuadros_ficha .tecnologias .dbox").length < 1) {
                            $(".cuadros_ficha .tecnologias").append("<span class=\"dbox\"></span>");
                        }
                    }
                    if (/(luxe)/.test(sala.sala.toLowerCase())) {
                        if (/(dbox|d-box)/.test(sala.sala.toLowerCase())) {
                            if ($(".cuadros_ficha .tecnologias .dbox").length < 1) {
                                $(".cuadros_ficha .tecnologias").append("<span class=\"dbox\"></span>");
                            }
                            ldbox = 1;
                            dbox = 0;
                            sala.sala = "l-dbox";
                        }
                        if ($(".cuadros_ficha .tecnologias .luxe").length < 1) {
                            $(".cuadros_ficha .tecnologias").append("<span class=\"luxe\"></span>");
                        }
                    }
                    if (/(imax|isens|dolby|screenx|ScreenX|luxe|l-dbox)/.test(sala.sala.toLowerCase())) {
                        if (!enteredtipo && enteredspecial) {
                            output += "</ul></div></li>";
                        }
                        if (enteredtipo) {
                            output += "</ul></div></li>";
                            enteredtipo = false;
                        }
                        output += "<li class=\"sala " + (/(isens|dolby|screenx|ScreenX|luxe|l-dbox)/.test(sala.sala.toLowerCase()) ? sala.sala.toLowerCase() : "") + (/(imax)/.test(tipo.tipo.toLowerCase()) ? tipo.tipo.toLowerCase() : "") + "\"><div class=\"lista_horarios\"><p class=\"tipo\">"; //"Sala " + sala.sala + " / " + tipo.tipo + "</p><ul>";
                        output += tipo.tipo + "</p><ul>";
                        $.each(sala.sesiones, function (n, sesion) {
                            if (!golfa) {
                                golfa = (Number(sesion.hora.substr(0, 2)) < 10);
                            }
                            if (!showlink) {
                                sesion.pasada = true;
                                sesion.ao = "#";
                            }
                            output += "<li data-hora=\"" + ((sesion.hora.substr(0, 2) < 10) ? (Number(sesion.hora.substr(0, 2)) + 24) + sesion.hora.substr(3, 4) : sesion.hora.replace(":", "")) + "\" ><a data-promo=\"" + sesion.promo + "\" target=\"_blank\" href=\"" + sesion.ao + "\" class=\"sala_" + sala.sala.toLowerCase() + " horario" + (sesion.pasada ? " pasada" : "") + "\">" + sesion.hora + "</a></li>";
                        });
                        //output += "</ul></div></li>";
                        enteredspecial = true;
                        enteredtipo = false;
                    } else {
                        if (enteredspecial) {
                            output += "</ul></div></li>";
                            enteredspecial = true;
                        }
                        if (!enteredtipo) {
                            output += "<li class=\"sala screenXstring" + (/(isens|dolby|screenx|ScreenX|luxe|l-dbox)/.test(sala.sala.toLowerCase()) ? sala.sala.toLowerCase() : "") + (/(imax)/.test(tipo.tipo.toLowerCase()) ? tipo.tipo.toLowerCase() : "") + "\"><div class=\"lista_horarios\"><p class=\"tipo\">"; //"Sala " + sala.sala + " / " + tipo.tipo + "</p><ul>";

                            if (/(d-box)/.test(tipo.tipo.toLowerCase())) {
                                output += "Digital</p><ul>";
                            } else {
                                output += tipo.tipo + "</p><ul>";
                            }

                        }
                        $.each(sala.sesiones, function (n, sesion) {
                            if (sesion.tipo == "ScreenX") {
                                output = output.replace("screenXstring", "screenx");
                                
								if ($("#info.cuadros_ficha .tecnologias .screenX").length > 1) {
                                    $("#info.cuadros_ficha .tecnologias").append("<a href=\"../ScreenX\" class=\"screenX\"></a>");
                                }
                                if ($(".cuadros_ficha.d2 .tecnologias .screenX").length > 1) {
                                    $(".cuadros_ficha.d2 .tecnologias").append("<a href=\"../ScreenX\" class=\"screenX\"></a>");
                                }
								
                            } else {
                                output = output.replace("screenXstring", "");
                            }
                            if (!golfa) {
                                golfa = (Number(sesion.hora.substr(0, 2)) < 10);
                            }
                            if (!showlink) {
                                sesion.pasada = true;
                                sesion.ao = "#";
                            }
                            output += "<li data-hora=\"" + ((sesion.hora.substr(0, 2) < 10) ? (Number(sesion.hora.substr(0, 2)) + 24) + sesion.hora.substr(3, 4) : sesion.hora.replace(":", "")) + "\"><a  data-promo=\"" + sesion.promo + "\" target=\"_blank\" href=\"" + sesion.ao + "\" class=\"horario" + (sesion.pasada ? " pasada" : "") + (/(d-box)/.test(tipo.tipo.toLowerCase()) ? " dbox" : "") + (/(verano)/.test(sala.sala.toLowerCase()) ? " cverano" : "") + (isSalaIkea(sala, cine) ? " ikea" : "") + "\">" + sesion.hora + (/(verano)/.test(sala.sala.toLowerCase()) ? "*" : "") + "</a></li>";
                        });
                        enteredtipo = true;
                    }
                }); output += "</ul></div></li>";
            });
            if (svbmiercoles) {
                output += "<li class=\"golfa\">Este día sólo aplica precio Miércoles al cine en entradas compradas anticipadamente. El día del estreno sí aplica precio reducido Día del espectador en los cines que lo tengan.</li>";
            }
            if (patrociniognf) {
                output += "<li class=\"patrocinio\"><div class=\"sala_patrocinada gnf\"><p>Las sesiones en la sala " + patrociniognf + " están patrocinadas por <span></span></p></div></li>";
            }
            if (patrocinioikea) {
                output += "<li class=\"patrocinio\"><div class=\"sala_patrocinada ikea\"></div></li>";
            }
            if (golfa && country.toLowerCase() == "es") {
                output += "<li class=\"golfa\">" + localization.htmlgolfa1 + " " + (dia.dia_str.indexOf(",") > -1 ? dia.dia_str.toLowerCase().split(" ")[1] : dia.dia_str.toLowerCase().split(" ")[0]) + " " + localization.htmlgolfa2 + " " + diasiguiente(dia.dia_str) + "</li>";
            }
            if (cineverano) {
                output += "<li class=\"golfa cdv\">* Sesión al aire libre de Cine de Verano en la Plaza Multiusos del centro</li>";
            }
            if ((!showlink) && country.toLowerCase() == "es") {
                output += "<li class=\"golfa\">Las sesiones de la Fiesta del Cine estarán a la venta a partir del domingo 27 de octubre.</li>";
            }
            if (festivalnocturna == 1) {
                output += "<li class=\"golfa\">Esta película forma parte del Festival Nocturna</li>";
            }
            if (iff == 1) {
                output += "<li class=\"golfa\">Esta película forma parte del Illumination Film Festival</li>";
            }
            if (dbox == 1) {
                output += "<li class=\"avisoDbox\">Las sesiones indicadas en color naranja tienen algunas butacas en movimiento<span></span></li>";
            }
            if (ldbox == 1) {
                output += "<li class=\"avisoSalaDbox\">Las sesiones indicadas en color naranja tienen butacas en movimiento<span></span></li>";
            }
        }); output += "</ul>";
    });
    $(".field.dias ul").html(outputdias);
    $("article.horarios").html(output);
    replaceConIntermedio(false);
    $(".field.dias ul li input[name=dia]").change(function () {
        $("article.horarios>ul").addClass("hidden");
        $("article.horarios>ul:eq(" + $(this).parent().parent().index() + ")").removeClass("hidden");
        if (GTMEnabled) {
            var evtcat = (($("body").attr("id") == "ficha_eventos") ? "event" : "movie");
            uaEvent(evtcat + ' detail', 'select day', $(this).parent().text(), '', false);
        }
    });
    if (diaant == "") {
        var tmpel = $(".field.dias ul li label input[value=" + $("#diaseleccionado").val() + "]");
        if (tmpel.length) {
            tmpel.parent("label").click();
        } else {
            $(".field.dias ul li label").first().click();
        }
    } else {
        var tmpel = $(".field.dias ul li label:contains('" + diaant + "')");
        if (tmpel.length) {
            tmpel.first().click();
        } else {
            $(".field.dias ul li label").first().click();
        }
    }
    window.dispatchEvent(new Event('resize'));
    $(".horarios .lista_horarios ul").each(function () {
        $(this).find("li").tsort({ attr: "data-hora" });
    });
    tooltipIkea();
    /*$(".lista_horarios ul li a").qtip({
        content: {
            text: function (event, api) {
                api.tooltip.addClass('hidden');
                $.ajax({
                    url: getPreciosURL($(this).attr("href"))
                })
                .then(function (content) {
                    var output = "";
                    var vipnovip = "";
                    $.each(content, function (k, v) {
                        if (vipnovip == "") {
                            vipnovip = v.asientoCode;
                        }
                        //if (vipnovip != v.asientoCode) {
                        //    vipnovip = v.asientoCode;
                        //    output += "<b>VIP</b><br/>";
                        //}
                        if (vipnovip == v.asientoCode) {
                            if (v.ShortDescription.toLowerCase().indexOf("online") >= 0) {
                                output += v.ShortDescription + ": " + (v.precio / 100).toFixed(2) + "€";
                                output += "<br/>";
                                api.tooltip.removeClass('hidden');
                            }
                        }
                    });
                    api.set('content.text', output);
                },
                function (xhr, status, error) {
                    // Upon failure... set the tooltip content to the status and error value
                    api.set('content.text', status + ': ' + error);
                });

                //return 'Loading...';
            }
        }
    });*/
}

function tooltipIkea() {
    $(".lista_horarios ul li a.ikea").qtip({
        content: {
            text: "¡Puedes sentarte<br/>en un sofá!"
        },
        position: {
            my: 'top center'
        }
    });
}
function getPreciosURL(strURL) {
    var data = getUrlVars(strURL);
    return ("/Peliculas/GetPrecio/" + data.performanceCode + "/" + data.s);
}

function selectCineFav(preselected) {
    if (typeof ($.cookie("cine")) !== "undefined" || typeof (preselected) !== "undefined") {
        var cinefav;
        if (typeof (preselected) !== "undefined") {
            cinefav = preselected;
        } else {
            cinefav = $.cookie("cine");
        }
        $(".radiobox.rb_star input[name=cine]").each(function () {
            if ($(this).parents(".radiobox").find(".rb_selected").attr("data-defaultvalue") == "") {
                if ($.cookie("cine") == $(this).attr("data-value")) {
                    $(this).parent().click();
                    $(this).trigger("change");
                    $(this).parents(".radiobox").find(".rb_selected").attr("data-defaultvalue", $.cookie("cine"));
                }
            }
        });

        $(".submenucines .cine[data-value=" + cinefav + "] span").removeClass("nofav").addClass("fav");
    };
    if ((typeof ($.cookie("cine")) !== "undefined") && (typeof ($.cookie("cineu")) !== "undefined") && (typeof ($.cookie("cinen")) !== "undefined")) {
        $(".cinefav .btn_cinefav .lbl_cinefav").html(" " + $.cookie("cinen"));
        $(".cinefav").attr("href", $.cookie("cineu")).attr("data-id", $.cookie("cine")).removeAttr("style");
    } else {
        $(".cinefav").hide();
    }
}

function closeSelect() {
    if ($('#select').hasClass("open")) {
        $("#select").find("li:not([class=selected])").slideUp();
        $('#select').removeClass("open");
    }
}

function hashclick() {
    if (window.location.hash) {
        if ($("a[href=" + window.location.hash + "]").length == 1) {
            $("a[href=" + window.location.hash + "]").click();
        }
        if ($("[data-hashclick=" + window.location.hash + "]").length == 1) {
            $("[data-hashclick=" + window.location.hash + "]").click();
        }
    }
}

/*PUNTUACIÓN DE LAS PELICULAS*/
function ratings() {
    $(".puntuacion li").mouseover(function () {
        var tope = false;
        var nodo = 0;
        $(this).addClass("selected");
        $(this).parent().find("li").each(function () {
            nodo += 1;
            if (!tope) {
                if ($(this).hasClass("selected")) {
                    tope = true;
                } else {
                    $(this).addClass("selected");
                }
            } else {
                $(this).addClass("notselected");
            }
        });
    }).mouseout(function () {
        $(this).parent().find("li").each(function () {
            $(this).removeClass("selected");
            $(this).removeClass("notselected");
        });
    });

    $(".puntuacion li").click(function () {

        var evtcat = "";
        var votoidg = "";
        if ($("body").attr("id") == "ficha_pelicula") {
            evtcat = "movie";
            votoidg = $("#info").attr("data-id");
        } else if ($("body").attr("id") == "ficha_pelicula") {
            evtcat = "event";
            votoidg = $("#info").attr("data-id");
        } else {
            //evtcat = ($(this).parents(".listado-peliculas-item").attr("data-evento") == "True" ? "event" : "movie");
            votoidg = $(this).parents(".listado-peliculas-item").attr("data-group");
        }
        if (GTMEnabled) {
            if (evtcat != "") {
                uaEvent(evtcat + ' detail', 'vote movie', $(this).attr("title"));
            }
        }
        $.post("/Forms/VotoPelicula/?nocache=" + new Date().getTime(), { pelicula: votoidg, voto: $(this).attr("title") }, function (datos) {
            if (datos.OK) {
                customalert(localization.graciastuvoto + datos.Voto);
            } else {
                customalert(localization.yavotastepelicula + " (" + datos.Voto + ")");
            }
        });
    });
}

/*BOTONES DE COMPARTIR EN LAS PELICULAS DE LA CARTELERA*/
function compartir_opt() {
    var nodo;
    $("div.compartir").click(function () {
        nodo = $(this);
        $(this).addClass("hidden");
        $(this).parent().find("div.compartir_opt").removeClass("hidden");
    }).mouseleave(function () {
        setTimeout(function () {
            nodo.removeClass("hidden");
            nodo.parent().find("div.compartir_opt").addClass("hidden");
        }, 5000);
    });
}

$(window).load(function () {
    fixCollection();
});

function fixHome() {
    fixCarouselHeight($(".carteles-carrusel[rel=peliculas] ul"));
    fixCarouselHeight($(".carteles-carrusel[rel=eventos] ul"));
    fixCarouselHeight($('.promociones ul'));
    fixCarouselHeight($('#carousel'), $('#carousel').find(".principal-info").first().height(), 480);
}

function fixCollection() {
    $(".caroufredsel_wrapper>ul").trigger("updateSizes");
    switch ($("body").attr("id")) {
        case "home": fixHome(); break;
        case "proximos_estrenos": fixEstrenos(); break;
        case "alta_ccard":
            fixPremios();
            break;
        case "ciclos":
            fixCiclos();
            break;
    }
}

function fixCiclos() {
    fixCarouselHeight($(".carteles-carrusel ul"));
}

function resizefix() {
    //if ($("#banner1").length) {
    //    if ($("#banner1").width() != document.getElementsByClassName("fb-comments")[0].getAttribute("data-width")) {
    //        $(".fb-comments").attr("data-width", $("#banner1").width());
    //    }
    //}
    $(window).smartresize(function () {
        //if ($("#banner1").length) {
        //    if ($("#banner1").width() != document.getElementsByClassName("fb-comments")[0].getAttribute("data-width")) {
        //        $(".fb-comments").attr("data-width", $("#banner1").width());
        //        FB.XFBML.parse($("#banner1")[0]);
        //    }
        //}
        fixCollection();
    });
    /*(function ($, sr) {
        // debouncing function from John Hann
        // http://unscriptable.com/index.php/2009/03/20/debouncing-javascript-methods/
        var debounce = function(func, threshold, execAsap) {
            var timeout;

            return function debounced() {
                var obj = this, args = arguments;

                function delayed() {
                    if (!execAsap)
                        func.apply(obj, args);
                    timeout = null;
                };

                if (timeout)
                    clearTimeout(timeout);
                else if (execAsap)
                    func.apply(obj, args);

                timeout = setTimeout(delayed, threshold || 100);
            };
        };
        // smartresize 
        jQuery.fn[sr] = function (fn) { return fn ? this.bind('resize', debounce(fn)) : this.trigger(sr); };

    })(jQuery, 'smartresize');*/



    //$(".fb-comments").attr("data-width", $(".fb-comments").parent().width()); $(window).on('resize', function () { resizeFacebookComments(); }); function resizeFacebookComments() { var src = $('.fb-comments iframe').attr('src').split('width='), width = $(".fb-comments").parent().width(); $('.fb-comments iframe').attr('src', src[0] + 'width=' + width); }
}

window.onorientationchange = function () {
    updateOrientation();
};

function updateOrientation() {
    if (isIpad()) {
        $("meta[name=viewport]").attr("content", "width=800");
        return;
    }
    if (window.innerWidth < 480) {
        $("meta[name=viewport]").attr("content", "width=480");
        return;
    }
    var orientation = window.orientation;
    var extraContent = ""; //", initial-scale=1.0";
    switch (orientation) {
        case 0:
            $("meta[name=viewport]").attr("content", "width=device-width" + extraContent);
            break;

        case 90:
            $("meta[name=viewport]").attr("content", "width=device-height" + extraContent);
            break;

        case -90:
            $("meta[name=viewport]").attr("content", "width=device-height" + extraContent);
            break;
        case 180:
            $("meta[name=viewport]").attr("content", "width=device-width" + extraContent);
            break;
    }
};

function initMapaCines() {
    var comunidades = jQuery.parseJSON('{ "comunidades": [{ "comunidad": "andalucia", "ciudades": ["malaga", "sevilla","cadiz"] }, { "comunidad": "madrid", "ciudades": ["madrid"] }, { "comunidad": "IBaleares", "ciudades": ["mallorca"] }, { "comunidad": "extremadura", "ciudades": ["merida"] }, { "comunidad": "galicia", "ciudades": ["acoruna", "santiago"] }, { "comunidad": "asturias", "ciudades": ["oviedo"] }, { "comunidad": "paisVasco", "ciudades": ["bilbao"] }, { "comunidad": "aragon", "ciudades": ["zaragoza"] }, { "comunidad": "catalunya", "ciudades": ["barcelona"] }, { "comunidad": "valencia", "ciudades": ["valencia", "alicante"] }, { "comunidad": "murcia", "ciudades": ["murcia"] }, { "comunidad": "cantabria", "ciudades": ["santander"] },{ "comunidad": "castilla", "ciudades": ["valladolid"] }, { "comunidad": "canarias", "ciudades": ["canarias"]}] }');
    //$("#mapa").maphilight();
    $("#mapa").maphilight({ fillColor: 'E8CB00', stroke: false, fillOpacity: 1.0, neverOn: true });
    $.each(comunidades, function (i, icomunidades) {
        $.each(icomunidades, function (j, icomunidad) {
            $.each(icomunidad, function (k, iciudad) {
                if (k == "ciudades") {
                    $.each(iciudad, function (l, ciudad) {
                        $("#menu_" + ciudad).on("mouseenter", function () {
                            var data = $('.mapa_' + icomunidad.comunidad).data('maphilight') || {};
                            data.neverOn = false;
                            $('.mapa_' + icomunidad.comunidad).data('maphilight', data);
                            $(".mapa_" + icomunidad.comunidad).mouseover();
                        }).on("mouseleave", function () {
                            var data = $('.mapa_' + icomunidad.comunidad).data('maphilight') || {};
                            data.neverOn = true;
                            $('.mapa_' + icomunidad.comunidad).data('maphilight', data);
                            $(".mapa_" + icomunidad.comunidad).mouseout();
                        });
                    });
                }
            });
        });
    });
    //Cine favorito
    $(".listado li .nofav").click(function (e) {
        $.cookie("cine", $(this).parent().attr("data-id"), { path: '/', expires: 365 });
        $.cookie("cinen", $(this).parent().text(), { path: '/', expires: 365 });
        $.cookie("cineu", $(this).parent().find("a").attr("href"), { path: '/', expires: 365 });
        $(".listado li .fav").removeClass("fav").addClass("nofav");
        $(this).removeClass("nofav").addClass("fav");
        //favorito();
        selectCineFav();
    });

    if (typeof ($.cookie("cine")) !== "undefined") {
        $(".listado li[data-id=" + $.cookie("cine") + "] .nofav").removeClass("nofav").addClass("fav");
    }

}

function initProxEstreno() {
    fixEstrenos();
}

function fixEstrenos() {
    var _estreno = "";
    var _posy = 0;
    var _item = "";
    $(".fechaestreno").removeClass("fe-last");
    $(".fechaestreno span").hide();
    $("#proximos_estrenos #cartelera>ul>li").each(function () {
        if ($(this).attr("data-estreno") != _estreno || $(this).offset().top != _posy) {
            $(this).find(".fechaestreno span").show();
            _estreno = $(this).attr("data-estreno");
            _posy = $(this).offset().top;
            if (_item.length) {
                _item.find(".fechaestreno").addClass("fe-last");
            }
        }
        _item = $(this);
    });
}

function fixPremios() {
    var _premio = "";
    var _posy = 0;
    var _item = "";
    $(".gift").removeClass("gift_last");
    $(".gift_titulo span").addClass("hidden");
    $(".gift").each(function () {
        if ($(this).find(".gift_titulo span").text() != _premio || $(this).offset().top != _posy) {
            $(this).find(".gift_titulo span").removeClass("hidden");
            _premio = $(this).find(".gift_titulo span").text();
            _posy = $(this).offset().top;
            if (_item.length) {
                _item.addClass("gift_last");
            }
        }
        _item = $(this);
    });
}

function loginCinesacard(email, pass) {
    if (pass != "" && _validateEmail(email)) {
        $.post("/Forms/LoginCinesaCard/?nocache=" + new Date().getTime(), { email: email, pass: pass }, function (response) {
            if (hasConsent(["Performance"])) {
                ga('send', 'event', 'CinesaCard', 'Login', $('title').text());
            }
            $.cookie("cclogged", "ok", { path: '/' });
            $.globalEval(response);
        })
            .error(function () { customalert(localization.haocurridoerrormastarde); });
    }
}

function loginCinesaUserFB(fbuserid, accessToken, refresh, f) {
    if (typeof (refresh) == "undefined") {
        refresh = false;
    }
    if (typeof (f) == "undefined") {
        f = function (data) { };
    }
    $.post("/CinesaUser/FBLogin/?nocache=" + new Date().getTime(), { id: fbuserid, at: accessToken }, function (data) {
        if (data.UserLogin_WithSNResponse.returnCode == 0 || data.UserLogin_WithSNResponse.returnCode == "0") {
            if (GTMEnabled) {
                uaEvent('login module', 'login', 'facebook login');
            }
            if (data.UserLogin_WithSNResponse.UserInformation.UserInformation.CinesaFirstAccess == "Y") {
                popupClose();
                popupShow("pop_cinesacard", true);
                $(".pop_cinesacard .usrnombre").html(data.UserLogin_WithSNResponse.UserInformation.UserInformation.name);
            } else {
                objUser.UserLoginResponse = data.UserLogin_WithSNResponse;
                f(data);
                if (refresh) {
                    location.reload();
                }
                $(".pop_cinesacard .usrnombre").html(data.UserLogin_WithSNResponse.UserInformation.UserInformation.name);


                $.cookie("uulogged", data.UserLogin_WithSNResponse.UserInformation.UserInformation.name, { path: '/' });
                if (hasConsent(["Performance"])) {
                    ga('send', 'event', 'CinesaUser', 'Login', $("body").attr("id"));
                }

                updateHeader();
                //$("#cinefavorito_header").addClass("logged");
                //if ($("body.n_cc").length) {
                //    $("#cinefavorito_header.nuevo_logged .logged_msg").html( /*"HOLA " + data.UserLoginResponse.UserInformation.UserInformation.name.toUpperCase()*/"IR A MI CUENTA");
                //}
                //$("#cinefavorito_header").attr("data-info", data.UserLoginResponse.UserInformation.UserInformation.userId);
                $(".close_menu_left.sb-close").click();
                _nextCallback();
            }
        } else {
            if (typeof (data.UserLogin_WithSNResponse.returnDescription) != "undefined") {
                getfbdata(_fbat, function (fbdata) {
                    popupClose();
                    popupShow("pop_registro_2", true);
                    var scope = ".popup.pop_registro_2 ";
                    if (((typeof (fbdata.email) !== 'undefined') && (fbdata.email))) {
                        $(scope + "input[name=email]").val(fbdata.email);
                    }
                    $(scope + "input[name=passwd]").parent().addClass("hidden");
                    $(scope + ".password_min").addClass("hidden");
                    $(scope + "input[name=name]").val(fbdata.first_name);
                    $(scope + "input[name=firstsurname]").val(fbdata.last_name);
                    switch (fbdata.gender) {
                        case "male": $(scope + "label[for=g-1]").click();
                            break;
                        case "female": $(scope + "label[for=g-2]").click();
                            break;
                    }
                    if (typeof (fbdata.location) !== 'undefined') {
                        //TODO
                    }
                    if (typeof (fbdata.birthday) !== 'undefined') {
                        var fecha = fbdata.birthday.split("/"); // "09/21/1984"
                        $(scope + "input[name=dd][value=" + fecha[1] + "]").parent().find("label").click();
                        $(scope + "input[name=mm][value=" + fecha[0] + "]").parent().find("label").click();
                        $(scope + "input[name=aaaa][value=" + fecha[2] + "]").parent().find("label").click();
                    }
                });
            } else {
                customalert(localization.enestosmomentosincidencias);
            }
        }
        fixanims();
    });

}
// Create Base64 Object
//var Base64 = { _keyStr: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", encode: function (e) { var t = ""; var n, r, i, s, o, u, a; var f = 0; e = Base64._utf8_encode(e); while (f < e.length) { n = e.charCodeAt(f++); r = e.charCodeAt(f++); i = e.charCodeAt(f++); s = n >> 2; o = (n & 3) << 4 | r >> 4; u = (r & 15) << 2 | i >> 6; a = i & 63; if (isNaN(r)) { u = a = 64 } else if (isNaN(i)) { a = 64 } t = t + this._keyStr.charAt(s) + this._keyStr.charAt(o) + this._keyStr.charAt(u) + this._keyStr.charAt(a) } return t }, decode: function (e) { var t = ""; var n, r, i; var s, o, u, a; var f = 0; e = e.replace(/[^A-Za-z0-9+/=]/g, ""); while (f < e.length) { s = this._keyStr.indexOf(e.charAt(f++)); o = this._keyStr.indexOf(e.charAt(f++)); u = this._keyStr.indexOf(e.charAt(f++)); a = this._keyStr.indexOf(e.charAt(f++)); n = s << 2 | o >> 4; r = (o & 15) << 4 | u >> 2; i = (u & 3) << 6 | a; t = t + String.fromCharCode(n); if (u != 64) { t = t + String.fromCharCode(r) } if (a != 64) { t = t + String.fromCharCode(i) } } t = Base64._utf8_decode(t); return t }, _utf8_encode: function (e) { e = e.replace(/rn/g, "n"); var t = ""; for (var n = 0; n < e.length; n++) { var r = e.charCodeAt(n); if (r < 128) { t += String.fromCharCode(r) } else if (r > 127 && r < 2048) { t += String.fromCharCode(r >> 6 | 192); t += String.fromCharCode(r & 63 | 128) } else { t += String.fromCharCode(r >> 12 | 224); t += String.fromCharCode(r >> 6 & 63 | 128); t += String.fromCharCode(r & 63 | 128) } } return t }, _utf8_decode: function (e) { var t = ""; var n = 0; var r = c1 = c2 = 0; while (n < e.length) { r = e.charCodeAt(n); if (r < 128) { t += String.fromCharCode(r); n++ } else if (r > 191 && r < 224) { c2 = e.charCodeAt(n + 1); t += String.fromCharCode((r & 31) << 6 | c2 & 63); n += 2 } else { c2 = e.charCodeAt(n + 1); c3 = e.charCodeAt(n + 2); t += String.fromCharCode((r & 15) << 12 | (c2 & 63) << 6 | c3 & 63); n += 3 } } return t } }

$("#login-email").blur(function () {
    if (typeof ($.cookie('uunp')) != "undefined") {
        var usupass = Base64.decode($.cookie('uunp')).split('|1|');
        $.each(usupass, function (index, value) {
            if (value.indexOf($("#login-email").val()) == 0) {
                $("#login-contasena").val(value.split('||')[1]);
                return false;
            }
            else {
                $("#login-contasena").val('');
            }
        });
    }
    else {
        $("#login-contasena").val('');
    }
});

function loginCinesaUser(email, pass, refresh, f) {
    if (typeof (refresh) == "undefined") {
        refresh = false;
    }
    if (typeof (f) == "undefined") {
        f = function (data) { };
    }

    var scope = ".m_login form ";
    $(scope + "*").removeClass("inputNok");

    if (pass != "" && _validateEmail(email)) {
        $.post("/CinesaUser/Login/?nocache=" + new Date().getTime(), { email: email, pass: pass }, function (data) {
            if (data.UserLoginResponse.returnCode == 0 || data.UserLoginResponse.returnCode == "0") {
                $.when(wsData.cinesauser.GetPersonalInformation()).done(function (result) {
                    if (result != null) {
                        UserInfo = result;
                    }
                    if ($("#politicareg2").is(":checked")) {
                        if (typeof $.cookie('uunp') === 'undefined') {
                            $.cookie("uunp", Base64.encode($("#login-email").val() + '||' + $("#login-contasena").val()));
                        }
                        else {
                            if (Base64.decode($.cookie('uunp')).indexOf($("#login-email").val()) < 0) {
                                $.cookie("uunp", $.cookie('uunp') + Base64.encode('|1|' + $("#login-email").val() + '||' + $("#login-contasena").val()));
                            }
                        }
                    }
                    if (GTMEnabled) {
                        uaEvent('login module', 'login', 'cinesa login');
                    }

                    if (data.UserLoginResponse.UserInformation.UserInformation.CinesaFirstAccess == "Y") {
                        popupClose();
                        popupShow("pop_cinesacard", true);
                        $(".pop_cinesacard .usrnombre").html(data.UserLoginResponse.UserInformation.UserInformation.name);
                        $.cookie("uulogged", data.UserLoginResponse.UserInformation.UserInformation.name, { path: '/' });
                    } else {
                        objUser.UserLoginResponse = data.UserLoginResponse;
                        f(data);
                        if (refresh) {
                            location.reload();
                        }
                        $.cookie("uulogged", data.UserLoginResponse.UserInformation.UserInformation.name, { path: '/' });
                        if (hasConsent(["Performance"])) {
                            ga('send', 'event', 'CinesaUser', 'Login', $("body").attr("id"));
                        }

                        updateHeader();
                        //$("#cinefavorito_header").addClass("logged");
                        //if ($("body.n_cc").length) {
                        //    $("#cinefavorito_header.nuevo_logged .logged_msg").html(/*"HOLA " + data.UserLoginResponse.UserInformation.UserInformation.name.toUpperCase()*/"IR A MI CUENTA");
                        //}
                        //$("#cinefavorito_header").attr("data-info", data.UserLoginResponse.UserInformation.UserInformation.userId);
                        $(".close_menu_left.sb-close").click();
                        if ($("body").attr("id") == "home") {
                            siteEmu("LOGO_CSS");
                            siteEmu("HOME_D");
                            siteEmu("HOME_ESPACIO2_CARRUSEL");
                            siteEmu("CURSOR");
                        };
                        if (data.UserLoginResponse.UserInformation.UserInformation.ccCard != "" || data.UserLoginResponse.UserInformation.UserInformation.isCinesaCardUser == "Y") {
                            $("#menu_web2 a.cinesacard ~ ul li:eq(1)").addClass("hidden");
                            $("#menu_web2 a.cinesacard ~ ul li:eq(2)").addClass("hidden");
                        }
                        _nextCallback();
                    }
                });
            } else {
                if (typeof (data.UserLoginResponse.returnDescription) != "undefined") {
                    $(scope + ".text").addClass("inputNok");
                    errorActions(scope, data.UserLoginResponse.returnCode, data.UserLoginResponse.returnDescription);
                } else {
                    customalert("En estos momentos estamos sufriendo incidencias técnicas, por favor vuelve a intentarlo más tarde");
                }
            }
        });
    } else {
        $(scope + ".text").addClass("inputNok");
        customalert("Por favor revisa que los datos introducidos sean válidos");
    }
}

$("#pop_login_general").ready(function () {
    if (typeof ($.cookie('uunp')) != "undefined") {
        var usupass = Base64.decode($.cookie('uunp'));
        if ((usupass.split('|1|').length == 1)) {
            $("#email_poplogin").val(usupass.split('||')[0]);
            $("#passwd_poplogin").val(usupass.split('||')[1]);
        }
        else {
            $("#email_poplogin").val('');
            $("#passwd_poplogin").val('');
        }
    }
});

$("#email_poplogin").blur(function () {
    if (!!$.cookie('uunp')) {
        var usupass = Base64.decode($.cookie('uunp')).split('|1|');
        $.each(usupass, function (index, value) {
            if (value.indexOf($("#email_poplogin").val()) == 0) {
                $("#passwd_poplogin").val(value.split('||')[1]);
                return false;
            }
            else {
                $("#passwd_poplogin").val('');
            }
        });
    }
    else {
        $("#passwd_poplogin").val('');
    }
});

function loginCinesaUser2(email, pass, refresh, f) {
    if (typeof (refresh) == "undefined") {
        refresh = false;
    }
    if (typeof (f) == "undefined") {
        f = function (data) { };
    }

    var scope = ".m_login form ";
    $(scope + "*").removeClass("inputNok");

    if (pass != "" && _validateEmail(email)) {
        $.post("/CinesaUser/Login/?nocache=" + new Date().getTime(), { email: email, pass: pass }, function (data) {
            if (data.UserLoginResponse.returnCode == 0 || data.UserLoginResponse.returnCode == "0") {
                if ($("#politicareg3").is(":checked")) {
                    if (typeof $.cookie('uunp') === 'undefined') {
                        $.cookie("uunp", Base64.encode($("#email_poplogin").val() + '||' + $("#passwd_poplogin").val()));
                    }
                    else {
                        if (Base64.decode($.cookie('uunp')).indexOf($("#email_poplogin").val()) < 0) {
                            $.cookie("uunp", $.cookie('uunp') + Base64.encode('|1|' + $("#email_poplogin").val() + '||' + $("#passwd_poplogin").val()));
                        }
                    }
                }
                if (GTMEnabled) {
                    uaEvent('login module', 'login', 'cinesa login');
                }
                if (data.UserLoginResponse.UserInformation.UserInformation.CinesaFirstAccess == "Y") {
                    popupClose();
                    popupShow("pop_cinesacard", true);
                    $(".pop_cinesacard .usrnombre").html(data.UserLoginResponse.UserInformation.UserInformation.name);
                    $.cookie("uulogged", data.UserLoginResponse.UserInformation.UserInformation.name, { path: '/' });
                } else {
                    objUser.UserLoginResponse = data.UserLoginResponse;
                    f(data);
                    if (refresh) {
                        location.reload();
                    }
                    $.cookie("uulogged", data.UserLoginResponse.UserInformation.UserInformation.name, { path: '/' });
                    if (hasConsent(["Performance"])) {
                        ga('send', 'event', 'CinesaUser', 'Login', $("body").attr("id"));
                    }
                    updateHeader();
                    //$("#cinefavorito_header").addClass("logged");
                    //if ($("body.n_cc").length) {
                    //    $("#cinefavorito_header.nuevo_logged .logged_msg").html(/*"HOLA " + data.UserLoginResponse.UserInformation.UserInformation.name.toUpperCase()*/"IR A MI CUENTA");
                    //}
                    //$("#cinefavorito_header").attr("data-info", data.UserLoginResponse.UserInformation.UserInformation.userId);
                    $(".close_menu_left.sb-close").click();
                    if ($("body").attr("id") == "home") {
                        siteEmu("LOGO_CSS");
                        siteEmu("HOME_D");
                        siteEmu("HOME_ESPACIO2_CARRUSEL");
                        siteEmu("CURSOR");
                    };
                    if (data.UserLoginResponse.UserInformation.UserInformation.ccCard != "" || data.UserLoginResponse.UserInformation.UserInformation.isCinesaCardUser == "Y") {
                        $("#menu_web2 a.cinesacard ~ ul li:eq(1)").addClass("hidden");
                        $("#menu_web2 a.cinesacard ~ ul li:eq(2)").addClass("hidden");
                    }
                    _nextCallback();
                }
            } else {
                if (typeof (data.UserLoginResponse.returnDescription) != "undefined") {
                    $(scope + ".text").addClass("inputNok");
                    errorActions(scope, data.UserLoginResponse.returnCode, data.UserLoginResponse.returnDescription);
                } else {
                    customalert("En estos momentos estamos sufriendo incidencias técnicas, por favor vuelve a intentarlo más tarde");
                }
            }
        });
    } else {
        $(scope + ".text").addClass("inputNok");
        customalert("Por favor revisa que los datos introducidos sean válidos");
    }
}

$("#pop_login_general").ready(function () {
    if (typeof ($.cookie('uunp')) != "undefined") {
        var usupass = Base64.decode($.cookie('uunp'));
        if ((usupass.split('|1|').length == 1)) {
            $("#email_poplogin").val(usupass.split('||')[0]);
            $("#passwd_poplogin").val(usupass.split('||')[1]);
        }
        else {
            $("#email_poplogin").val('');
            $("#passwd_poplogin").val('');
        }
    }
});

$("#email_poplogin").blur(function () {
    if (typeof ($.cookie('uunp')) != "undefined") {
        var usupass = Base64.decode($.cookie('uunp')).split('|1|');
        $.each(usupass, function (index, value) {
            if (value.indexOf($("#email_poplogin").val()) == 0) {
                $("#passwd_poplogin").val(value.split('||')[1]);
                return false;
            }
            else {
                $("#passwd_poplogin").val('');
            }
        });
    }
    else {
        $("#passwd_poplogin").val('');
    }
});

function loginCinesaUser2(email, pass, refresh, f) {
    if (typeof (refresh) == "undefined") {
        refresh = false;
    }
    if (typeof (f) == "undefined") {
        f = function (data) { };
    }

    var scope = ".m_login form ";
    $(scope + "*").removeClass("inputNok");

    if (pass != "" && _validateEmail(email)) {
        $.post("/CinesaUser/Login/?nocache=" + new Date().getTime(), { email: email, pass: pass }, function (data) {
            if (data.UserLoginResponse.returnCode == 0 || data.UserLoginResponse.returnCode == "0") {
                if ($("#politicareg3").is(":checked")) {
                    if (typeof $.cookie('uunp') === 'undefined') {
                        $.cookie("uunp", Base64.encode($("#email_poplogin").val() + '||' + $("#passwd_poplogin").val()));
                    }
                    else {
                        if (Base64.decode($.cookie('uunp')).indexOf($("#email_poplogin").val()) < 0) {
                            $.cookie("uunp", $.cookie('uunp') + Base64.encode('|1|' + $("#email_poplogin").val() + '||' + $("#passwd_poplogin").val()));
                        }
                    }
                }
                if (GTMEnabled) {
                    uaEvent('login module', 'login', 'cinesa login');
                }
                if (data.UserLoginResponse.UserInformation.UserInformation.CinesaFirstAccess == "Y") {
                    popupClose();
                    popupShow("pop_cinesacard", true);
                    $(".pop_cinesacard .usrnombre").html(data.UserLoginResponse.UserInformation.UserInformation.name);
                    $.cookie("uulogged", data.UserLoginResponse.UserInformation.UserInformation.name, { path: '/' });
                } else {
                    objUser.UserLoginResponse = data.UserLoginResponse;
                    f(data);
                    if (refresh) {
                        location.reload();
                    }
                    $.cookie("uulogged", data.UserLoginResponse.UserInformation.UserInformation.name, { path: '/' });
                    if (hasConsent(["Performance"])) {
                        ga('send', 'event', 'CinesaUser', 'Login', $("body").attr("id"));
                    }

                    updateHeader();
                    //$("#cinefavorito_header").addClass("logged");
                    //if ($("body.n_cc").length) {
                    //    $("#cinefavorito_header.nuevo_logged .logged_msg").html(/*"HOLA " + data.UserLoginResponse.UserInformation.UserInformation.name.toUpperCase()*/"IR A MI CUENTA");
                    //}
                    //$("#cinefavorito_header").attr("data-info", data.UserLoginResponse.UserInformation.UserInformation.userId);
                    $(".close_menu_left.sb-close").click();
                    if ($("body").attr("id") == "home") {
                        siteEmu("LOGO_CSS");
                        siteEmu("HOME_D");
                        siteEmu("HOME_ESPACIO2_CARRUSEL");
                        siteEmu("CURSOR");
                    };
                    if (data.UserLoginResponse.UserInformation.UserInformation.ccCard != "" || data.UserLoginResponse.UserInformation.UserInformation.isCinesaCardUser == "Y") {
                        $("#menu_web2 a.cinesacard ~ ul li:eq(1)").addClass("hidden");
                        $("#menu_web2 a.cinesacard ~ ul li:eq(2)").addClass("hidden");
                    }
                    _nextCallback();
                }
            } else {
                if (typeof (data.UserLoginResponse.returnDescription) != "undefined") {
                    $(scope + ".text").addClass("inputNok");
                    errorActions(scope, data.UserLoginResponse.returnCode, data.UserLoginResponse.returnDescription);
                } else {
                    customalert(localization.enestosmomentosincidencias);
                }
            }
        });
    } else {
        $(scope + ".text").addClass("inputNok");
        customalert(localization.porfavordatosvalidos);
    }
}
$("#pop_login_general").ready(function () {
    if (typeof ($.cookie('uunp')) != "undefined") {
        var usupass = Base64.decode($.cookie('uunp'));
        if ((usupass.split('|1|').length == 1)) {
            $("#email_poplogin").val(usupass.split('||')[0]);
            $("#passwd_poplogin").val(usupass.split('||')[1]);
        }
        else {
            $("#email_poplogin").val('');
            $("#passwd_poplogin").val('');
        }
    }
});

$("#email_poplogin").blur(function () {
    if (typeof ($.cookie('uunp')) != "undefined") {
        var usupass = Base64.decode($.cookie('uunp')).split('|1|');
        $.each(usupass, function (index, value) {
            if (value.indexOf($("#email_poplogin").val()) == 0) {
                $("#passwd_poplogin").val(value.split('||')[1]);
                return false;
            }
            else {
                $("#passwd_poplogin").val('');
            }
        });
    }
    else {
        $("#passwd_poplogin").val('');
    }
});

function loginCinesaUser2(email, pass, refresh, f) {
    if (typeof (refresh) == "undefined") {
        refresh = false;
    }
    if (typeof (f) == "undefined") {
        f = function (data) { };
    }

    var scope = ".m_login form ";
    $(scope + "*").removeClass("inputNok");

    if (pass != "" && _validateEmail(email)) {
        $.post("/CinesaUser/Login/?nocache=" + new Date().getTime(), { email: email, pass: pass }, function (data) {
            if (data.UserLoginResponse.returnCode == 0 || data.UserLoginResponse.returnCode == "0") {
                if ($("#politicareg3").is(":checked")) {
                    if (typeof $.cookie('uunp') === 'undefined') {
                        $.cookie("uunp", Base64.encode($("#email_poplogin").val() + '||' + $("#passwd_poplogin").val()));
                    }
                    else {
                        if (Base64.decode($.cookie('uunp')).indexOf($("#email_poplogin").val()) < 0) {
                            $.cookie("uunp", $.cookie('uunp') + Base64.encode('|1|' + $("#email_poplogin").val() + '||' + $("#passwd_poplogin").val()));
                        }
                    }
                }
                if (GTMEnabled) {
                    uaEvent('login module', 'login', 'cinesa login');
                }
                if (data.UserLoginResponse.UserInformation.UserInformation.CinesaFirstAccess == "Y") {
                    popupClose();
                    popupShow("pop_cinesacard", true);
                    $(".pop_cinesacard .usrnombre").html(data.UserLoginResponse.UserInformation.UserInformation.name);
                    $.cookie("uulogged", data.UserLoginResponse.UserInformation.UserInformation.name, { path: '/' });
                } else {
                    objUser.UserLoginResponse = data.UserLoginResponse;
                    f(data);
                    if (refresh) {
                        location.reload();
                    }
                    $.cookie("uulogged", data.UserLoginResponse.UserInformation.UserInformation.name, { path: '/' });
                    if (hasConsent(["Performance"])) {
                        ga('send', 'event', 'CinesaUser', 'Login', $("body").attr("id"));
                    }

                    updateHeader();
                    //$("#cinefavorito_header").addClass("logged");
                    //if ($("body.n_cc").length) {
                    //    $("#cinefavorito_header.nuevo_logged .logged_msg").html(/*"HOLA " + data.UserLoginResponse.UserInformation.UserInformation.name.toUpperCase()*/"IR A MI CUENTA");
                    //}
                    //$("#cinefavorito_header").attr("data-info", data.UserLoginResponse.UserInformation.UserInformation.userId);
                    $(".close_menu_left.sb-close").click();
                    if ($("body").attr("id") == "home") {
                        siteEmu("LOGO_CSS");
                        siteEmu("HOME_D");
                        siteEmu("HOME_ESPACIO2_CARRUSEL");
                        siteEmu("CURSOR");
                    };
                    if (data.UserLoginResponse.UserInformation.UserInformation.ccCard != "" || data.UserLoginResponse.UserInformation.UserInformation.isCinesaCardUser == "Y") {
                        $("#menu_web2 a.cinesacard ~ ul li:eq(1)").addClass("hidden");
                        $("#menu_web2 a.cinesacard ~ ul li:eq(2)").addClass("hidden");
                    }
                    _nextCallback();
                }
            } else {
                if (typeof (data.UserLoginResponse.returnDescription) != "undefined") {
                    $(scope + ".text").addClass("inputNok");
                    errorActions(scope, data.UserLoginResponse.returnCode, data.UserLoginResponse.returnDescription);
                } else {
                    customalert(localization.enestosmomentosincidencias);
                }
            }
        });
    } else {
        $(scope + ".text").addClass("inputNok");
        customalert(localization.porfavordatosvalidos);
    }
}

function logoutCinesaUser() {
    $.post("/CinesaUser/Logout/?nocache=" + new Date().getTime(), function (data) {
        if ($("body").attr("id") == "ma_resumen") {
            document.location = "/";
        }
        if ($("body#cc_form.n_cc").length) {
            location.reload();
        }
    });
    $.removeCookie("uulogged", { domain: ".cinesa.es", path: '/' });
    $("#cinefavorito_header").removeClass("logged");
    $("header #cinefavorito_header a.user_img > div").removeClass("fb").removeAttr("style");
    $(".submenuHeader li").removeClass("hidden");
}

function logoutCinesacard() {
    $.cookie("cclogged", null, { path: '/' });
}

function popupClose(click) {
    if (typeof (click) == "undefined") {
        click = false;
    }
    $(".pop_mask").addClass("hidden");
    $(".pop_mask_new").addClass("hidden");
    $(".popup").addClass("hidden");
    $(".sb-slidebar.sb-active").removeClass("sb-active");
    if ($(".pop_entrar").hasClass("fiesta") && click) {
        if (hasConsent(["Performance"])) {
            ga('send', 'event', 'SaltoCompra', 'CierrePopup', 'Click');
        }
    }
    if (click) {
        resetProgressBar();
    }
}

function gotoTop() {
    $('.ir-arriba').click(function () {
        $('body, html').animate({
            scrollTop: '0px'
        }, 300);
    });

    $(window).scroll(function () {
        if ($(this).scrollTop() > 0) {
            $('.ir-arriba').slideDown(300);
        } else {
            $('.ir-arriba').slideUp(300);
        }
    });
}

function popupShow(classname, isnew) {
    if (typeof (isnew) == "undefined") { isnew = false }
    $(".pop_mask" + (isnew ? "_new" : "")).removeClass("hidden");
    $(".popup." + classname).removeClass("hidden");
    $('html, body').animate({
        scrollTop: 0
    }, 500);
    if (classname == "pop_registro_2") {
        getConsents("pop_registro_2");
    }
    if (classname == "pop_registro_3_alta") {
        getConsents("pop_registro_3_alta", "cc");
    }
    if (classname == "pop_registro_3_activacion") {
        getConsents("pop_registro_3_activacion", "cc");
    }
    if (classname == "pop_cinesacard") {
        getConsents("FistAccessPopIn", "firstAccess");
    }
    //if (classname == "popup_newccard") {
    //    getConsents("popup_newccard");
    //}
}

function showPopupLogin() {
    $(".bt-popin").addClass("hidden");
    $(".pop_mask").removeClass("hidden");
    $(".pop_registro_1").removeClass("hidden");
}

function customalert(mensaje) {
    mensaje = mensaje.split("\n").join("<br />");
    $(".alert_mask").removeClass("hidden");
    $(".alert").removeClass("hidden");
    $(".alert p").html(mensaje);
}

function customalertClose() {
    $(".alert_mask").addClass("hidden");
    $(".alert").addClass("hidden");
    $(".alert p").html("");
};

function radiobox_reset(selector, valor) {
    if (typeof (valor) == "undefined") {
        valor = "Seleccionar";
    }
    $(selector).parents(".radiobox").find(".rb_selected").html('<span class="rb_ico"></span>' + valor);
    $(selector).parents(".radiobox").removeClass("open");
}

var _nextCallback = function () { };
var _linkCompra = "";
var _fbat = "";
var _fbid = "";
var wa;

function diasiguiente(strdia) {
    var daynames = null;
    if (country.toLowerCase() == "es") {
        daynames = ["domingo", "lunes", "martes", "miércoles", "jueves", "viernes", "sábado"];
    }
    if (country.toLowerCase() == "pt") {
        daynames = ["domingo", "segunda-feira", "terça-feira", "quarta-feira", "quinta-feira", "sexta-feira", "sábado"];
    }
    var output = "";
    $.each(daynames, function (i, v) {
        if (strdia.toLowerCase().indexOf(v) > -1) {
            output = daynames[(i + 1) % 7];
            return;
        }
    });
    return output;
}

var objUser = new Object();

var dataPromo = {};

var disableClick = function () { return false; };

function promopath_date() {
    console.log('promopath_date');
    var data = dataPromo.promocion;
    if (data) {
        $(".selectdias input[data-promo=" + data.PromocionId + "]").siblings(".rb_icono").addClass("rb_promo").parent().addClass("promo"); //cine: combo select dias
        $(".field.dias input[data-promo=" + data.PromocionId + "]").siblings(".rb_icono").addClass("rb_promo");//PELICULA - Dia: combo select dias
        $(".field.dias input[data-promo=" + data.PromocionId + "]").parent().addClass("promo"); // Marcamos el label padre como promo para que se ponga rojo

        if ($(".selectdias li:first() .rb_icono").hasClass("rb_promo")) {
            $(".selectdias .rb_selected .rb_icono").addClass("rb_promo"); //CINE - Dia: combo select dias (selected item)
            $(".selectdias .rb_selected .rb_icono").parent().addClass("promo");
        }

        if ($(".dias li:first() .rb_icono").hasClass("rb_promo")) {
            $(".dias .rb_selected .rb_icono").addClass("rb_promo"); //PELICULA - Dia: combo select dias (selected item)
            $(".dias .rb_selected .rb_icono").parent().addClass("promo");
        }

        $(".horarios .horario[data-promo=" + data.PromocionId + "]").append("<span class='rb_promo'></span>");
        //$(".horarios .horario[data-promo=" + data.PromocionId + "]").parents('ul[id="fichaPeli"]').addClass("promo");
        $(".horarios .horario[data-promo=" + data.PromocionId + "]").parents('.sala').siblings('.pelicula').children('div[id="botonHorarios"]').after("<span class='rb_promo'></span>");
    }
}

function promopath_cine() {
    console.log('promopath_cine');
    var data = dataPromo.promocion;
    $(".field.selectcine input[data-promo=" + data.PromocionId + "]").after("<span class='rb_promo'></span>").parent().addClass("promo");  //pelicula: combo select cines
}

function promotionRouteExecute() {
    console.log('promotionRouteExecute');
    var data = dataPromo.promocion;
    if (data != null) {
        if (data.promoActiva == 'no') {
            $(".promoActivaOff").removeClass("promoActivaOff").addClass("promoActivaOn");
            $(".busca").hide();
        }

        $.each(data.Cinemas, function (i, el) {
            $("#header .submenucines .cine[data-value=" + el + "] a").text($("#header .submenucines .cine[data-value=" + el + "] a").text().substring(0, 15)).after("<span class='promo'></span>").addClass("promo");  //submenu cines
            $("#header .submenucines .cine[data-value=" + el + "] a").attr("href", $("#mapa-cines .listado li[data-id=" + el + "] a").attr("href") + "?promoLink=" + Math.round((new Date()).getTime() / 1000));  //href en submenu cines para evitar el WAF
            $("#mapa-cines .listado li[data-id=" + el + "] a").text($("#mapa-cines .listado li[data-id=" + el + "] a").text().substring(0, 10)).after("<span class='promo'></span>").addClass("promo"); //mapa cines
            $("#mapa-cines .listado li[data-id=" + el + "] a").attr("href", $("#mapa-cines .listado li[data-id=" + el + "] a").attr("href") + "?promoLink=" + Math.round((new Date()).getTime() / 1000));//href en mapa cines para evitar el WAF
        });

        var identi = $(".field.selectcine .rb_selected").attr("data-defaultvalue");
        if (identi != "" && $(".field.selectcine input[data-id=" + identi + "]").attr("data-promo") == data.PromocionId) {
            $(".field.selectcine .rb_selected").after("<span class='rb_promo'></span>").parent().addClass("promo"); //pelicula: combo select cines (selected item)
        }
        $(".field.selectcine input[data-promo=" + data.PromocionId + "]").after("<span class='rb_promo'></span>").parent().addClass("promo");  //pelicula: combo select cines

        var identi2 = $(".field.selectcinedia .rb_selected").attr("data-defaultvalue");
        if (identi2 != "" && $(".field.selectcinedia input[data-id=" + identi2 + "]").attr("data-promo") == data.PromocionId) {
            $(".field.selectcinedia .rb_selected").after("<span class='rb_promo'></span>").parent().addClass("promo"); //cine: combo select cines (selected item)
        }
        $(".field.selectcinedia input[data-promo=" + data.PromocionId + "]").after("<span class='rb_promo'></span>").parent().addClass("promo");  //cine: combo select cines

        var identi3 = $(".field.selectcinepromo .rb_selected").attr("data-defaultvalue");
        if (identi3 != "" && $(".field.selectcinepromo input[data-id=" + identi3 + "]").attr("data-promo") == data.PromocionId) {
            $(".field.selectcinepromo .rb_selected").after("<span class='rb_promo'></span>").parent().addClass("promo"); //promo: combo select cines (selected item)
        }
        $(".field.selectcinepromo input[data-promo=" + data.PromocionId + "]").after("<span class='rb_promo'></span>").parent().addClass("promo");  //promo: combo select cines

        $.each(data.Films, function (i, el) {
            $("#cartelera .listado-peliculas-item[data-id=" + el + "]").addClass("promo"); //listado peliculas

            $(" .caroufredsel_wrapper li[data-id=" + el + "]").append("<span class='rb_promo'></span>");//CICLOS
            $(".caroufredsel_wrapper li[data-id=" + el + "] img").addClass("promo"); //CICLOS
        });

        if ($("body").attr("id") == "isens" || $("body").attr("id") == "imax") {
            $("#cartelera > ul li.listado-peliculas-item").tsort({ order: "asc", attr: "data-" + "name" });
            $("#cartelera > ul").prepend($("#cartelera > ul li.listado-peliculas-item.promo").detach());
        } else {
            $("#orden a.selected").click();
        }

        $("#menu_web2 > ul li a.peliculas").attr("href", $("#menu_web2 > ul li a.peliculas").attr("href") + "?promoLink=" + Math.round((new Date()).getTime() / 1000));

        promopath_date();
    }
}

function skip(id) {
    var player = videojs(id);
    player.ima.onAdComplete_(null);
    // Stop and clear ad assets
    adsManager = player.ima.getAdsManager();
    adsManager.stop();
    $(".skipbutton[data-rel=" + id + "]").addClass("hidden");
}

var Player = function (id) {
    this.id = id;
    this.init = function () {
        var skiptimeout = 5000;
        var player = videojs(this.id);
        var rnd = Math.floor((Math.random() * (9999 - 1000 + 1) + 1000));
        var options = hasConsent(["Targeting"]) ? {
            id: id,
            adTagUrl: 'https://cinesaes.engine.adglare.net/?456493567'
        } : {
                id: id
            };

        player.ima(options, function () {
		
            if ((typeof (google.ima) != "undefined")) {
                player.ima.addEventListener(google.ima.AdEvent.Type.STARTED, function () {
                    setTimeout(function () {
                        $(".skipbutton[data-rel=" + id + "]").removeClass("hidden");
                    }, skiptimeout);
                });
                player.ima.addEventListener(google.ima.AdEvent.Type.COMPLETE, function () {
                    $(".skipbutton[data-rel=" + id + "]").addClass("hidden");
                });
                player.ima.startFromReadyCallback();
            }
        });

	/*if (hasConsent(["Performance"])) {
	        player.ga({
	            eventCategory: "Trailers",
	            eventLabel: $("#" + this.id).parent().attr("data-titulo")
	        });
	}*/

        // Remove controls from the player on iPad to stop native controls from stealing
        // our click
        var contentPlayer = document.getElementById(id + '_html5_api');
        if ((contentPlayer != null) && (navigator.userAgent.match(/iPad/i) ||
            navigator.userAgent.match(/Android/i)) &&
            contentPlayer.hasAttribute('controls')) {
            contentPlayer.removeAttribute('controls');
        }

        // Initialize the ad container when the video player is clicked, but only the
        // first time it's clicked.

        var startEvent = 'click';
        if (navigator.userAgent.match(/iPhone/i) ||
            navigator.userAgent.match(/iPad/i) ||
            navigator.userAgent.match(/Android/i)) {
            startEvent = 'touchend';
        }

        player.one(startEvent, function () {
            if (hasConsent(["Targeting"])) {
                player.ima.initializeAdDisplayContainer();
                player.ima.requestAds();
            }
            player.play();
        });

        player.on("ended", function () {
            player.hasStarted(false);
        });
    }
}

function errorActions(scope, errorID, errorRes) {
    //grecaptcha.reset();
    /*if(errorID == 90 || errorID == 91 || errorID == 99 || errorID == 104 || errorID == 107 || errorID == 108 || errorID == 109 || errorID == 110 || errorID == 111|| errorID == 112 || errorID == 113 || errorID == 123 || errorID == 134 || errorID == 115 || errorID == 116 || errorID == 117 || errorID == 118 || errorID == 119 || errorID == 121 || errorID == 124 || errorID == 127 || errorID == 129 || errorID == 130 || errorID == 138 || errorID == 140 || errorID == 999 || errorID == 100 || errorID == 140){
		customalert(errorRes);
	}else{*/
    switch (errorID) {
        case "101": //mail incorrecto
            $(scope + "input[name=email]").addClass("inputNok");
            break;
        case "102": //pass incorrecto
            $(scope + "input[name=passwd]").addClass("inputNok");
            break;
        case "103": //sexo no especificado
            $(scope + "input[name=gender]").addClass("inputNok");
            break;
        case "105": //max caracteres superado ¿se puede saber?
            break;
        case "106": //fecha incorrecta
            $(scope + "input[name=dd]", scope + "input[name=mm]", scope + "input[name=aaaa]").addClass("inputNok");
            break;
        case "114": //falta dato obligatorio
            $(scope + "input.text").each(function () {
                if ($(this).val() == "") {
                    $(this).addClass("inputNok");
                }
            });
            break;
        case "111":
            errorRes = errorRes.replace("__email__", '');
            break;
        case "113":
            errorRes = errorRes.replace("__email__", '');
            break;
        case "123":
            errorRes = errorRes.replace("__email__", '');
            break;
        case "134":
            errorRes = errorRes.replace("__email__", '');
            break;
        case "138":
            errorRes = errorRes.replace("__email__", '');
            break;
        case "116":
            errorRes = errorRes.replace("__aquí__", '<a href="javascript:customalertClose();popupClose();popupShow(\'pop_registro_2\',true);">aquí</a>');
            break;
        case "158":
            errorRes = errorRes.replace("__aquí__", '<a href="javascript:customalertClose();popupClose();popupShow(\'pop_registro_2\',true);">aquí</a>');
            break;
        case "120":
            break;
        case "126": //dni incorrecto
            $(scope + "input[name=documentNumber]").addClass("inputNok");
            break;
        case "136":
            break;
        case "150":
            errorRes = 'El campo es demasaido largo. Revisa los datos introducidos.';
            break;
        case "153":
            errorRes = 'Ya existe un usuario con este DNI. Revisa los datos introducidos, recupera contraseña o escribe a <a href="mailto:info@cinesa.es" target="_blank">info@cinesa.es</a> para comprobar si ya tienes un usuario.';
            break;
        case "1513":
            errorRes = 'Ya existe un usuario con este Email. Revisa los datos introducidos, recupera contraseña o escribe a <a href="mailto:info@cinesa.es" target="_blank">info@cinesa.es</a> para comprobar si ya tienes un usuario';
            break;
    }
    customalert(errorRes);
    //}

}



function siteEmu(placement) {
    if (placement != "CURSOR") {
        return false;
    }
    if (typeof ($.cookie("uuid")) == "undefined") {
        return false;
    }
    $.get("/helper/siteEmu/" + placement + "/" + $.cookie("uuid"), function (data) {
        if (data.indexOf("_KO__") >= 0) {
            return false;
        }
        switch (placement) {
            case "HOME_D":
                $("body").addClass("pers_count");
                $(".article_cont").html(data);
                $(".article_cont").css("height", "auto");
                break;
            case "LOGO_CSS":
                if (resolucion > 800) {
                    $("body").addClass("pers_logo");
                    $("header #logo_header").css("background-image", "url(" + data + ")");
                }
                break;
            case "HOME_ESPACIO2_CARRUSEL":
                $(".pelicula_principal").html(data);
                break;
            case "BANNER_CINE":
                $("div.cine_promos").prepend(data);
                break;
            case "CURSOR":
                data = data.replace(/^\s+|\s+$/g, '');
                $("body").append("<style>*{cursor:url('" + data + "') 0 0, auto !important;</style>");
                break;
        }
    });

}

function fixanims(n, t) {
    if (typeof (n) == "undefined" || typeof (t) == "undefined") {
        n = 1;
        t = 0;
    }
    for (var i = 0; i < n; i++) {
        setTimeout(function () {
            $(".anim-input-span input").each(function () {
                if ($(this).val() != "" || ((typeof ($(this).attr("placeholder")) != "undefined") && ($(this).attr("placeholder") != ""))) {
                    $(this).parents(".anim-input-span").removeClass("anim-input-completado").addClass("anim-input-completado");
                    if ($(this).attr("id") == "login-email") {
                        $("#login-contasena").parents(".anim-input-span").removeClass("anim-input-completado").addClass("anim-input-completado");
                    }
                }
            });
        }, i * t);
    }
}

function userIsCinesaCard() {
    if (typeof ($.cookie("CCTemp")) != "undefined") {
        return true;
    }
    if (Object.keys(objUser).length && typeof (objUser.UserLoginResponse) != "undefined" && typeof (objUser.UserLoginResponse.UserInformation) != "undefined") {
        return (objUser.UserLoginResponse.UserInformation.UserInformation.ccCard != "") || (objUser.UserLoginResponse.UserInformation.UserInformation.isCinesaCardUser == "Y")
    }
    return false;
}


function infoDescriptionContentCheckState() {
    if ($(".infoDescriptionContent").hasClass("infoDescriptionContentOppen") || $(".infoDescriptionContent").css("display")) {
        infoDescriptionContentVisible("close");
    } else {
        infoDescriptionContentVisible("open");
    }
}
;
function infoDescriptionContentVisible(action) {
    if (action === "open") {
        $(".infoDescriptionContent").addClass("infoDescriptionContentOppen");
    } else {
        $(".infoDescriptionContent").removeClass("infoDescriptionContentOppen");
    }
}
function replaceConIntermedio(ficha) {
    var msgInfoDescription = "Sesión con intermedio de 10 minutos";
    $("p.tipo:contains('CON INTERMEDIO')").html('<div class="infoDescriptionContainer"><span onclick="infoDescriptionContentCheckState()" class="infoDescriptionBtn">i</span> CON INTERMEDIO<span class="infoDescriptionContent"><span class="infoDescriptionContenBefore">&#9658;</span><span class="infoDescriptionContentText">' + msgInfoDescription + '</span></span></div>');
    if (!ficha) {
        $("p.tipo").css("width", "140px");
        $("p.tipo").next().css("width", "calc(100% - 160px)");
    }
}

function animatefrog(frame) {
    var timings = [100, 100, 200, 100, 100, 200];
    if (typeof (frame) == "undefined") { frame = timings.length }
    var newframe = (frame + 1) % timings.length;
    $(".sprite_rana").removeClass("larana_" + frame);
    $(".sprite_rana").addClass("larana_" + newframe);
    setTimeout(function () {
        animatefrog(newframe);
    }, timings[newframe]);
}

function initkingsman() {
    $("#kingsman .kingsman_container input[type=submit]").on("touch click", function (e) {
        e.preventDefault();
        var ID = $("#kingsman .kingsman_container input[name=ID]").val();
        var CODE = $("#kingsman .kingsman_container input[name=code]").val();
        document.location = ("https://cinesa.emsecure.net/optiext/optiextension.dll?ID=Imr04K8nd27p1xAcCksk0svCnCnyeCUYDCsaRvyC_lJldT8kZE3dF5Pt1BOMwsQh%2B%2B7bpz1KTRbII9" + "&USER_ID=" + ID + "&CODE=" + CODE);
        //alert(piratasID + " - " + piratasCODE);
    });
}
if (window.addEventListener) {
    window.addEventListener("message", onMessage, false);
}
else if (window.attachEvent) {
    window.attachEvent("onmessage", onMessage, false);
}

function onMessage(event) {
    //console.log(event);
    //console.log(event.origin);
    if (event.origin !== "https://cinesa.emsecure.net") return;
    var data = event.data;
    //console.log(data);
    if (typeof (window[data.func]) == "function") {
        window[data.func].call(null, data);
    }

}

function replaceHTML(data) {
    //console.log(data);
    //console.log(data.selector);
    //console.log(data.message);
    $(data.selector).html(data.message);
    $(data.selector + " a").click(function (e) {
        e.preventDefault();
        trackTarget(data.clickId, $(this).attr("href"));
    });
}

function appendHTML(data) {
    //console.log(data);
    //console.log(data.selector);
    //console.log(data.message);
    $(data.selector).append(data.message);
    $(data.selector + " a.sitetracking").click(function (e) {
        e.preventDefault();
        trackTarget(data.clickId, $(this).attr("href"));
    });
}

function prependHTML(data) {
    //console.log(data);
    //console.log(data.selector);
    //console.log(data.message);
    $(data.selector).prepend(data.message);
    $(data.selector + " a.sitetracking").click(function (e) {
        e.preventDefault();
        trackTarget(data.clickId, $(this).attr("href"));
    });
}

function replaceCSS(data) {
    //console.log(data);
    //console.log(data.message);
    $(data.selector).css(data.message);
}

function triggerCountdown(_datetime, color) {
    //format dd/MM/YYYY
    var _time = "00:00";
    if (_datetime.split(" ").length > 1) {
        _time = _datetime.split(" ")[1];
    }
    _date = _datetime.split(" ")[0];
    _day = _date.split("/")[0];
    _month = _date.split("/")[1] - 1;
    _year = _date.split("/")[2];
    _hour = _time.split(":")[0];
    _minute = _time.split(":")[1];

    var fechaActual = new Date();
    var fechaEstreno = new Date(_year, _month, _day, _hour, _minute, 0);

    if (fechaEstreno.getTime() > fechaActual.getTime()) {
        $('#countdown').timeTo({
            timeTo: new Date(_year, _month, _day, _hour, _minute, 0),
            displayDays: 2,
            displayCaptions: true,
            fontSize: 48,
            width: 30,
            captionSize: 14,
            lang: "sp"
        });
        $(".timeTo.timeTo-white div, #countdown, .timeTo figcaption").css("color", color);
        $('#countdown').removeClass("hidden");
    } else {

        setTimeout(function () {
            $('#countdown').addClass("hidden");
            var x = $('.article_cont a.pers_background').attr("style").split(".jpg");
            var y = (x[0].replace("_B_B", "") + "_B.jpg" + x[1]);
            $('.article_cont a.pers_background').attr("style", y);
            $('.article_cont a.pers_background').css('background-size', 'contain');
        }, 300);
              
    }


}

function trackTarget(clickId, sendtoUrl) {
	if (hasConsent(["Performance"])) {
		wa.bt_queue.push
			({
				"isTargeting": false,
				"isEvent": true,
				"clickId": clickId,
				"finishedCallback": function () {
					location.href = sendtoUrl;
				}
			});
	}
}


function initApps() {
    $('.owl-carousel').owlCarousel({
        loop: true,
        margin: 10,
        nav: false,
        responsive: {
            0: {
                items: 1
            },
            600: {
                items: 2
            },
            1000: {
                items: 4
            }
        }
    });
}

function trim(s, c) {
    if (c === "]") c = "\\]";
    if (c === "\\") c = "\\\\";
    return s.replace(new RegExp(
        "^[" + c + "]+|[" + c + "]+$", "g"
    ), "");
}
function initComingSoon() {
    //variables
    var aceptaBases = 0;
    var marcadas;
    var npelis = $("#cs_htmlinputs input").length;

    //LOGGED
    if (typeof ($.cookie("uulogged")) != "undefined") {
        $("#comingsoon .cs_row h1 span").text($.cookie("uulogged"));
        $("#comingsoon #main section > form").removeClass("hidden");
    } else {
        $("#comingsoon .pop_login_general .pop_container .row:first-child h2").text($("#comingsoon .pop_login_general .pop_container .row:first-child h2").text() + " para puntuar tus películas favoritas").addClass("cs_popin_login_copie");
        popupShow("pop_login_general", true);
        nextCallback = function () { location.reload(); };
    }

    //carrousel

    var owl = $('.owl-carousel').owlCarousel({
        loop: true,
        margin: 20,
        nav: false,
        dots: false,
        center: true,
        rewind: false,
        responsive: {
            480: {
                items: 2
            },
            640: {
                items: 3
            },
            800: {
                items: 3
            },
            1000: {
                items: 4
            },
            1280: {
                items: 6
            },
            1600: {
                items: 8
            }
        }
    });

    //FLECHAS OWL
    $(".cs_owl_prev").click(function () {
        owl.trigger('prev.owl.carousel');
    });
    $(".cs_owl_next").click(function () {
        owl.trigger('next.owl.carousel');
    });

    //marcar películas
    $(".item .cs_ico_1, .item .cs_ico_2, .item .cs_ico_3").click(function () {
        var id = $(this).parents(".item").attr("data-id");
        var value = $(this).attr("data-value");
        var clickInActive = 0;

		/*if($(this).hasClass("cs_active")){
			clickInActive = 1;
		}*/

        marcadas = parseInt($(".cs_marcadas").text());

        if (!$(this).parents(".cs_punt_container").find("span").hasClass("cs_active")) {
            marcadas++;
            if (marcadas > npelis) {
                marcadas = npelis;
            }
        } else {
            clickInActive = 1;
        }

        $(this).parents(".owl-carousel").find(".item[data-id=" + id + "]").find(".cs_punt_container span").removeClass("cs_active");
        $(this).parents(".owl-carousel").find(".item[data-id=" + id + "]").find(".cs_punt_container span[data-value=" + value + "]").addClass("cs_active");

        $("input[name=" + id + "]").val(value);

        $(".cs_marcadas").text(marcadas);
        if (clickInActive == 0) {
            owl.trigger('next.owl.carousel');
        }
        desbloqueaBTN();
    });

    //COMS
    setTimeout(function () {
        getConsents("cs_coms", "comingsoon");
    }, 300);


    //Acepta bases
    $("input[name=bases]").change(function () {
        if ($(this).is(":checked")) {
            aceptaBases = 1;
        } else {
            aceptaBases = 0;
        }
        desbloqueaBTN();
    });


    //Desbloquea BTN
    function desbloqueaBTN() {
        if (aceptaBases == 1 && marcadas == npelis) {
            $("input.cs_btn").removeAttr("disabled");
        } else {
            $("input.cs_btn").attr("disabled", "disabled");
        }
    }

    //TRAILERS
    $(".cs_play").click(function (e) {

        if ($("#trailerhome").hasClass("hidden")) {
            var trailer = $(this).attr("data-playlist");
            var nombre = $(this).attr("data-name");
            var cartel = $(this).attr("data-img");

            $(".video_wrapper").html("");

            var htmltrailer = '<video id="trailerhome_video" controls preload="auto" poster="' + cartel + '" class="video-js vjs-big-play-centered vjs-16-9" data-setup="{}" width="437" height="284"><source src="' + trailer + '" type="video/mp4"></video><a data-rel="trailerhome_video" class="skipbutton hidden" href="#">Saltar publicidad</a>';
            if (trailer.match(/youtu/i)) {
                htmltrailer = '<video id="trailerhome_video" controls preload="auto" poster="' + cartel + '" class="video-js vjs-big-play-centered vjs-16-9" data-setup=\'{"techOrder": ["youtube"], "sources": [{ "type": "video/youtube", "src": "' + trailer + '"}]}\' width="437" height="284"></video><a data-rel="trailerhome_video" class="skipbutton hidden" href="#">Saltar publicidad</a>';
            }
            $(".video_wrapper").html(htmltrailer);
            $("#trailerhome").removeClass("hidden").removeClass("closed");
            $(".cs_mask").addClass("cs_on");
            $("#trailerhome_video").parent().attr("data-titulo", nombre);
            var _player = new Player("trailerhome_video");
            _player.init();
            setTimeout(function () {
                $("#trailerhome_video_ima-ad-container").click();
            }, 1000);
        }
    });

    //CONTROL Trailers
    $(".fp-close, .cs_mask").on("click", function (e) {
        videojs("trailerhome_video").dispose();
        $('.video_wrapper').html('');
        $("#trailerhome").addClass("closed").addClass("hidden");
        $(".cs_mask").removeClass("cs_on");
    });

    //ENVIAR
    $("input.cs_btn").on("click touch", function (e) {
        e.preventDefault();

        //comunicaciones
        if ($("#cs_comsconsent3").length > 0) {
            $.post("/CinesaUser/SetConsents", { Consents: JSON.stringify(prepareConsents(".cs_coms ")) }, function (data) {
            });
        }

        var peliculas = $("#cs_htmlinputs input").map(function () { return $(this).val() });

        //var ID_SELLIGENT_INPUT = "7YUW03qMVr2DzGJfofwv5rgE7k4mRFlAbPDZXG0YLjGvObE77RMXO1VqekVm99TNA0hTdIvASXl77A";
        var ID_SELLIGENT_INPUT = "vHKFcKET90IhR2TQ4JWwa41ygp5cEqQT9Tp3nJiqL2A16KuunmFcezZx2uXPfbGiNUDBA37VRCfvvN";


        var u = '/Promociones/insertComingSoon/?u=' + ID_SELLIGENT_INPUT;
        for (var i = 0; i < peliculas.length; i++) {
            u += '&p' + (i + 1) + '=' + peliculas[i];
        }
        //u += '&testab=0';

        $.get(u, function (data) {
            if (data.indexOf("__OK__") > -1) {
                $("#comingsoon section form").addClass("hidden");
                $("#comingsoon .cs_response_container").removeClass("hidden");
                $('body, html').animate({
                    scrollTop: '0px'
                }, 100);
            } else {
                if (data.indexOf("__NOLOGIN__") > -1) {
                    customalert("Inicia sesión para poder participar en el sorteo.");
                } else {
                    if (data.indexOf("__EXIST__") > -1) {
                        customalert("¡Oh! Ya has valorado estos próximos estrenos.");
                    } else {
                        customalert("Error en el servidor.");
                        console.log(data)
                    }

                }
            }
        });
    });
}

function initOscars() {
    //$("#oscars #main section > form").removeClass("hidden");

    //variables
    var aceptaBases = 0;
    var marcadas;
    var ncampos = 4;
    var npelis = Math.round($("#cs_htmlinputs input").length / ncampos);

    //LOGGED

    if (typeof ($.cookie("uulogged")) != "undefined") {
        $("#oscars .cs_row h1 span").text($.cookie("uulogged"));
        $("#oscars #main section > form").removeClass("hidden");
    } else {
        $("#oscars .pop_login_general .pop_container .row:first-child h2").text($("#oscars .pop_login_general .pop_container .row:first-child h2").text() + " para votar por tus ganadores de los premios Óscar").addClass("cs_popin_login_copie");
        popupShow("pop_login_general", true);
        nextCallback = function () { location.reload(); };
    }

    if (resolucion == "480") {
        $(".owl-carousel").append('<div class="item lastitem" style="width:205px"></div>');
    }

    //carrousel
    var owl = $('.owl-carousel').owlCarousel({
        loop: false,
        margin: 20,
        nav: false,
        dots: false,
        center: (resolucion == "480"),
        rewind: false,
        //stagePadding: ((resolucion == "480")?100:0),
        startPosition: ((resolucion == "480") ? 1 : 0),
        autoWidth: (resolucion == "480"),
        responsive: {
            480: {
                items: 1
            },
            640: {
                items: 3
            },
            800: {
                items: 3
            },
            1000: {
                items: 4
            },
            1280: {
                items: 5
            },
            1600: {
                items: 7
            }
        }
    });

    //FLECHAS OWL
    $(".cs_owl_prev").click(function () {
        owl.trigger('prev.owl.carousel');
    });
    $(".cs_owl_next").click(function () {
        owl.trigger('next.owl.carousel');
    });

    //marcar películas
    $(".item .cs_oscar").click(function () {
        // data-value="@pelicula.idgrupo" data-cast="" data-titulo="@pelicula.titulo" data-poster="@PeliculasController.CartelURL(pelicula.titulo)" data-categoria="p5"
        var categoria = $(this).attr("data-categoria");
        var id = $(this).parents(".item").attr("data-id");
        var cast = $(this).attr("data-cast");
        var titulo = $(this).attr("data-titulo");
        var poster = $(this).attr("data-poster");

        $("#cs_htmlinputs input[name=" + categoria + "]").val(id);
        $("#cs_htmlinputs input[name=" + categoria + "CAST]").val(cast);
        $("#cs_htmlinputs input[name=" + categoria + "TITULO]").val(titulo);
        $("#cs_htmlinputs input[name=" + categoria + "CARTEL]").val(poster);



        //var id = $(this).parents(".item").attr("data-id");
        //var value = $(this).attr("data-value");
        var clickInActive = 0;


        $(this).parents(".owl-carousel").find(".item .cs_punt_container span").removeClass("cs_active");
        $(this).parents(".owl-carousel").find(".item[data-id=" + id + "] .cs_punt_container span").addClass("cs_active");

        marcadas = $(".item .cs_punt_container span.cs_active").length;

        //if (!$(this).parents(".cs_punt_container").find("span").hasClass("cs_active")) {
        //    marcadas++;
        //    if (marcadas > npelis) {
        //        marcadas = npelis;
        //    }
        //} else {
        //     clickInActive = 1;
        //}

        if (marcadas > npelis) {
            marcadas = npelis;
        }


        // $("input[name=" + id + "]").val(value);

        $(".cs_marcadas").text(marcadas);
        if (clickInActive == 0) {
            // owl.trigger('next.owl.carousel');
        }
        desbloqueaBTN();
    });

    //COMS
    setTimeout(function () {
        if (objUser.UserLoginResponse.UserInformation.UserInformation.showComunicationsCheck == "N") {
            $("#coms").addClass("hidden");
        }
    }, 1000);


    $("input[name=comunicaciones]").change(function () {
        if ($(this).is(":checked")) {
            customalert("Si dejas marcada esta casilla, no podremos informarte de tus estrenos favoritos ni de las mejores promociones.");
        }
    });

    //Acepta bases
    $("input[name=bases]").change(function () {
        if ($(this).is(":checked")) {
            aceptaBases = 1;
        } else {
            aceptaBases = 0;
        }
        desbloqueaBTN();
    });

    //Desbloquea BTN
    function desbloqueaBTN() {
        if (aceptaBases == 1 && marcadas == npelis) {
            $("input.cs_btn").removeAttr("disabled");
        } else {
            $("input.cs_btn").attr("disabled", "disabled");
        }
    }

    //TRAILERS
    $(".cs_play").click(function (e) {

        if ($("#trailerhome").hasClass("hidden")) {
            var trailer = $(this).attr("data-playlist");
            var nombre = $(this).attr("data-name");
            var cartel = $(this).attr("data-img");

            $(".video_wrapper").html("");

            var htmltrailer = '<video id="trailerhome_video" controls preload="auto" poster="' + cartel + '" class="video-js vjs-big-play-centered vjs-16-9" data-setup="{}" width="437" height="284"><source src="' + trailer + '" type="video/mp4"></video><a data-rel="trailerhome_video" class="skipbutton hidden" href="#">Saltar publicidad</a>';
            if (trailer.match(/youtu/i)) {
                htmltrailer = '<video id="trailerhome_video" controls preload="auto" poster="' + cartel + '" class="video-js vjs-big-play-centered vjs-16-9" data-setup=\'{"techOrder": ["youtube"], "sources": [{ "type": "video/youtube", "src": "' + trailer + '"}]}\' width="437" height="284"></video><a data-rel="trailerhome_video" class="skipbutton hidden" href="#">Saltar publicidad</a>';
            }
            $(".video_wrapper").html(htmltrailer);
            $("#trailerhome").removeClass("hidden").removeClass("closed");
            $(".cs_mask").addClass("cs_on");
            $("#trailerhome_video").parent().attr("data-titulo", nombre);
            var _player = new Player("trailerhome_video");
            _player.init();
            setTimeout(function () {
                $("#trailerhome_video_ima-ad-container").click();
            }, 1000);
        }
    });

    //CONTROL Trailers
    $(".fp-close, .cs_mask").on("click", function (e) {
        videojs("trailerhome_video").dispose();
        $('.video_wrapper').html('');
        $("#trailerhome").addClass("closed").addClass("hidden");
        $(".cs_mask").removeClass("cs_on");
    });

    //ENVIAR
    $("input.cs_btn").on("click touch", function (e) {
        e.preventDefault();

        //comunicaciones
        if ($("input[name=comunicaciones]").is(":checked")) {
            if (objUser.UserLoginResponse.UserInformation.UserInformation.showComunicationsCheck == "Y") {
                $.post("/CinesaUser/AcceptCom");
                if (hasConsent(["Performance"])) {
                    ga('send', 'event', 'CinesaUser', 'Acepta Comunicaciones', 'OK');
                }
            }
        }

        //var peliculas = $("#cs_htmlinputs input").map(function () { return $(this).val() });


        var ID_SELLIGENT_INPUT = "NcWyqX7IUedTFJtbB4jON3LxSBiRwEi0ZTRPBv5bkCPj89TUuA1oYHF6WUz5EzONNKUnsZPMIuWNNK";

        var u = '/Promociones/insertOscars/?u=' + ID_SELLIGENT_INPUT + "&PROCEDENCIA=" + origen + "&";
        u += $("#oscars #main section > form").serialize();

        $.get(u, function (data) {
            if (data.indexOf("__OK__") > -1) {
                $("#oscars section form").addClass("hidden");
                $("#oscars .cs_response_container").removeClass("hidden");
                $('body, html').animate({
                    scrollTop: '0px'
                }, 100);
            } else {
                if (data.indexOf("__NOLOGIN__") > -1) {
                    customalert("Inicia sesión para poder participar en la promoción.");
                } else {
                    if (data.indexOf("__EXIST__") > -1) {
                        customalert("Oh! Ya has elegido tus ganadores.");
                    } else {
                        customalert("Error en el servidor.");
                    }

                }
            }
        });
    });

}

function popinComingSoon() {
    var html = "<div class='cs_site_popin'><a href='https://www.cinesa.es/promociones/comingsoon'></a></div>";

    if (typeof ($.cookie("uulogged")) != "undefined") {
        if (typeof ($.cookie("popComingSoon")) != "undefined") {
        } else {
            setTimeout(function () {
                if (objUser.UserLoginResponse.UserInformation.UserInformation.ReceiveComunications == "N") {
                    $.cookie("popComingSoon", "1", { path: '/' });
                    $(".sb-site").append(html);
                }
            }, 1000);
        }
    }

    $("html").click(".cs_site_popin", function () {
        $(".cs_site_popin").addClass("hidden");
    });

}
var consents = [];
function getConsents(container, p) {
    /*consents = [];
    $.get("/cinesauser/getconsents", function (data) {
        data.UU_UserGetConsentsByUserResponse.consents.consent[0].descripcion["#cdata-section"] = "Quiero recibir publicidad relacionada con mi perfil de consumo y mis gustos por email"

        if (data.UU_UserGetConsentsByUserResponse.consents.consent.length > 1) {
            data.UU_UserGetConsentsByUserResponse.consents.consent[1].descripcion["#cdata-section"] = "Acepto recibir por email publicidad relacionada con mi perfil de consumo y mis gustos"
        }


        consents = [];
        $.each(data.UU_UserGetConsentsByUserResponse.consents.consent, function (n, v) {
            v.descripcion = v.descripcion["#cdata-section"];
            v.estado = (v.estado == "Y");
            v.obligatorio = (v.obligatorio == "Y");
            v.iscc = (p == "cc");
            consents.push(v);
        });
        renderConsents(container, p);
    });*/
}
function renderConsents(container, p) {
    if (typeof (p) == "undefined") { p = "" }
    var output = "";
    var todosaceptados = true;

    if (p == "elladodelafuerza") {
        output += '<p class="sw_aviso"><strong>Recuerda:</strong> Para que podamos enviarte estas u otras comunicaciones, deberás tener aceptada la recepción de comunicaciones comerciales de Cinesa.</p>';
    }

    $.each(consents, function (n, v) {
        if (p == "" || p == "cc") {
            output += '<div class="row">';
            output += (p == "cc" ? '<div class="pop_field pop_field_check">' : '');
            output += '<label class="anim_checkbox" for="' + container + 'consent' + v.idConsent + '">';
            output += '<input type="checkbox" id="' + container + 'consent' + v.idConsent + '" name="consent' + v.idConsent + '" ' + (v.estado ? 'checked=checked' : '') + '>';
            output += '<div class="anim_checkbox_box">';
            output += '<div class="anim_checkbox_check"></div>';
            output += '</div><p>' + v.descripcion + '</p>';
            output += '</label>';
            output += (p == "cc" ? '</div">' : '');
            output += '</div>';
        }
        if (p == "misdatos") {
            output += '<div class="form_row">';
            output += '<div class="onoffswitch">';
            output += '<input type="checkbox" name="consent' + v.idConsent + '" class="onoffswitch-checkbox" id="' + container + 'consent' + v.idConsent + '" ' + (v.estado ? 'checked=checked' : '') + '>';
            output += '<label class="onoffswitch-label" for="' + container + 'consent' + v.idConsent + '">';
            output += '<span class="onoffswitch-inner"></span>';
            output += '<span class="onoffswitch-switch"></span>';
            output += '</label>';
            output += '</div>';
            output += '<span style="display: inline-block;vertical-align: top;font-size:13px;max-width:270px;">' + v.descripcion + '</span>';
            output += '</div>';
        }
        if (p == "comingsoon") {
            output += '<label class="cs_check" id="coms" for="' + container + 'consent' + v.idConsent + '">';
            output += ' <input type="checkbox" id="' + container + 'consent' + v.idConsent + '" name="consent' + v.idConsent + '" ' + (v.estado ? 'checked=checked' : '') + '>';
            output += ' <p>' + v.descripcion + '</p>';
            output += '</label>';
            output += '<p class="cs_aviso">¡Recuerda! Si no aceptas la recepción de comunicaciones no podremos enviarte comunicaciones acorde con tu interés en estas películas, cuando se estrenen.</p>';
        }
        if (p == "firstAccess") {
            output += '<label class="anim_checkbox" for="' + container + 'consent' + v.idConsent + '">';
            output += '   <input type="checkbox" id="' + container + 'consent' + v.idConsent + '" name="consent' + v.idConsent + '" ' + (v.estado ? 'checked=checked' : '') + '>';
            output += '   <div class="anim_checkbox_box">';
            output += '       <div class="anim_checkbox_check"></div>';
            output += '   </div><p>' + v.descripcion + '</p>';
            output += '</label>';
        }
        if (p == "elladodelafuerza") {
            output += '<label class="cs_check" id="coms" for="' + container + 'consent' + v.idConsent + '">';
            output += ' <input type="checkbox" id="' + container + 'consent' + v.idConsent + '" name="consent' + v.idConsent + '" ' + (v.estado ? 'checked=checked' : '') + '>';
            output += ' <p>' + v.descripcion + '</p>';
            output += '</label>';            
        }
        if (!v.estado) {
            todosaceptados = false;
        }
    });

    if (p == "elladodelafuerza") {
        output += '<p class="sw_aviso">En cualquier momento podrás darte de baja de las comunicaciones directamente en \'Mi Perfil\' de tu Área privada.</p>';
    }

    if (todosaceptados && ((p == "cc") || (p == "comingsoon") || (p == "elladodelafuerza"))) {
        //if (p == "comingsoon") {
        output = "";
    }
    $("." + container + " .consentContainer").replaceWith(output);
    if (p == "misdatos") {
        /*$(".sectionprivacidad input").on("change", function () {
            $.post("/CinesaUser/SetConsents", { Consents: JSON.stringify(prepareConsents(".sectionprivacidad ")) }, function (data) {
            });
        });*/
    }
}
function validateConsents(container) {
    var output = true;
    // Según documentación se usará en el futuro
    //$.each(consents, function (n, v) {
    //    if (v.obligatorio && !$(container +" [name=consent" + v.idConsent).is(":checked")) {
    //        output = false;
    //    }
    //});
    return output;
}
function prepareConsents(container) {
    /*var output = [];
    var empty = true;
    Consents = new Object();
    Consents.Consent = new Object();
    $.each(consents, function (n, v) {
        p = new Object();
        p.idConsent = v.idConsent;
        p.estado = $(container + "[name=consent" + v.idConsent + "]").is(":checked") ? "Y" : "N";
        if ($(container + "[name=consent" + v.idConsent + "]").length < 1) {
            p.estado = "-";
        }
        empty = false;
        output.push(p);
    });
    if (!empty) {
        Consents.Consent.Consent = output;
        //console.log(Consents);
        return Consents;
    }
    return null;*/
    //$.post("/cinesauser/setconsents", { consents: JSON.stringify(output) }, function (data) {
    //});
}
//function testSetConsents() {
//    var scope = ".popup.pop_registro_2 ";
//    $.post("/CinesaUser/SetConsents", { Consents: JSON.stringify(prepareConsents(scope)) }, function (data) {
//        console.log(data);
//    });
//}
function initEmpleados() {
    var inputEmail = $('input[name="empleados_email"]');
    var inputNombre = $('input[name="empleados_nombre"]');
    var inputAceptar = $('input#empleados_aceptar');

    //Validar inputs
    function validarInputs() {
        var emailValidation = true;
        var nombreValidation = true;
        var aceptarValidation = true;
        if (!_validateEmail(inputEmail.val())) {
            emailValidation = false;
        }
        if (!inputNombre.val().length >= 1) {
            nombreValidation = false;
        }
        if (!$('input#empleados_aceptar').is(":checked")) {
            aceptarValidation = false;
        }
        if (emailValidation && nombreValidation && aceptarValidation) {
            buttonSubmitActive(true);
        } else {
            buttonSubmitActive(false);
        }
    }

    //Validar inputs en change
    inputEmail.on("click keydown keypress keyup change touch", function () {
        validarInputs();
    });
    inputNombre.on("click keydown keypress keyup change touch", function () {
        validarInputs();
    });
    inputAceptar.on("change", function () {
        validarInputs();
    });

    //Desbloquea BTN
    function buttonSubmitActive(active) {
        if (active) {
            $('#empleados_form input[type="submit"]').removeAttr('disabled');
        } else {
            $('#empleados_form input[type="submit"]').attr("disabled", "disabled");
        }
    }

    //ENVIAR
    $('form#empleados_form').submit(function (e) {
        e.preventDefault();

        var ID_SELLIGENT_INPUT = "lq4EGCF9P5uXvp18ij8lPEzFgt1SAgz7aRGkAb45I5ByVOjl2U30qiXaWfdRdrzWNq0Vbu9lHKlll6";

        var u = '/Promociones/insertEmpleados?u=' + ID_SELLIGENT_INPUT;
        u += '&email=' + inputEmail.val();
        u += '&nombre=' + inputNombre.val();

        $.get(u, function (data) {
            var code = data.split("___")[1];

            if (code == "PROMO AGOTADA") {
                customalert('<img src="/Content/img/promos/empleados_popin_agotado.png">');
            } else {
                $("#section_empleado_form").fadeOut();
                $(".code").append("<p>" + code + "</p>");
                $("#section_empleado_done").fadeIn();
            }
        });
    });
}

function initFichaLuxe() {
    $("section.luxe").removeClass("luxe");
    $("main").addClass("luxe");

    var owl = $('.owl-carousel').owlCarousel({
        loop: true,
        margin: 0,
        nav: false,
        dots: true,
        center: true,
        rewind: false,
        items: 1,
        autoplay: true,
        autoplayTimeout: 8000,
        autoplayHoverPause: true
    });

    //dbox
    setTimeout(function () {
        $(".avisoDbox").each(function () {
            var tmpDbox = "";
            var parent = $(this).parent();
            parent.find(".sala").each(function () {
                if ($(this).find(".tipo").text() == "Digital") {
                    $(this).find("li").each(function () {
                        tmpDbox += '<li data-hora="' + $(this).text().replace(':', '') + '">' + $(this).html() + '</li>';
                    });
                    $(this).remove();
                }
            });
            $(this).remove();
            parent.append("<li class='sala dboxFinal'><div class='lista_horarios'><p class='tipo'>Digital</p><ul>" + tmpDbox + "</ul></div></li><li class='avisoDbox'>Las sesiones indicadas en color naranja tienen algunas butacas en movimiento<span></span></li>")

            var dboxFinal = $(".dboxFinal").find('ul');
            dboxFinal.find('li').sort(function (a, b) {
                return $(a).attr('data-hora') - $(b).attr('data-hora');
            }).appendTo(dboxFinal);

            $(".sala").removeClass("dboxFinal");
        });
    }, 300);


}

function initSalasLuxe() {
    $("main").addClass("salasLuxe");
    var owl = $('.owl-carousel').owlCarousel({
        loop: true,
        margin: 0,
        nav: false,
        dots: true,
        center: true,
        rewind: false,
        items: 1,
        autoplay: true,
        autoplayTimeout: 8000,
        autoplayHoverPause: true
    });
}

function initLuxe() {
    var parallaxOption = { frictionY: 0.05, scalarX: 0, scalarY: 25 }
    var parallaxInstance = new Parallax(document.getElementById('scene'), parallaxOption);
    var options1 = { defaultText: "Compra entradas para tu cine LUXE", arrowBackground: "#fff", arrowColor: "#002956", position: "left", hiddenSelectedOption: "true" };
    var options2 = { defaultText: "Compra entradas para tu cine LUXE", arrowBackground: "#fff", arrowColor: "#002956", position: "left" };
    $("#r1").radioBox(options1);
    $("#r2").radioBox(options2);

    var touch = Modernizr.touch;
    $('.img-holder').imageScroll({
        imageAttribute: (touch === true) ? 'image-mobile' : 'image',
        touch: touch,
        holderMaxHeight: 600
    });
    $("article.map span").not('[data-value="1"]').hide();

    $("#luxe .parallax #r2 input").change(function () {
        var selectedValue = $(this).val();
        if (selectedValue == 1) {
            window.open('https://www.cinesa.es/Cines/intu-Xanadu', '_blank');
        } else if (selectedValue == 2) {
            window.open('https://www.cinesa.es/Cines/Equinoccio-Madrid', '_blank');
        } else if (selectedValue == 3) {
            window.open('https://www.cinesa.es/Cines/La-Moraleja', '_blank');
        } else if (selectedValue == 4) {
            window.open('https://www.cinesa.es/Cines/plaza-loranca-2', '_blank');
        } else if (selectedValue == 5) {
            window.open('https://www.cinesa.es/Cines/Bonaire', '_blank');
        } else if (selectedValue == 6) {
            window.open('https://www.cinesa.es/Cines/La-Farga', '_blank');
        } else if (selectedValue == 7) {
            window.open('https://www.cinesa.es/Cines/Barnasud', '_blank');
        } else if (selectedValue == 8) {
            window.open('/Cines/Garbera', '_blank');
        } else if (selectedValue == 9) {
            window.open('https://web.cinesa.es/cines/Oasiz', '_blank');
        }
    });

    $("#r1 input").change(function () {
        var selectedValue = $(this).val();
        $("article.map span").not('[data-value="' + selectedValue + '"]').hide();
        $('article.map span[data-value="' + selectedValue + '"]').show();
    });
}
function customizations(position) {
    var u = '/Home/GetCustomization/?u=' + position;
    $.get(u, function (customization) {
        customization = JSON.parse(customization.replace(/'/g, '"'));
        //Format Dates
        var startDateFormated = customization.FechaInicio.split('/');
        startDateFormated = startDateFormated[2].split(' ')[0] + startDateFormated[1] + startDateFormated[0];
        var endDateFormated = customization.FechaFin.split('/');
        endDateFormated = endDateFormated[2].split(' ')[0] + endDateFormated[1] + endDateFormated[0];

        var currentMonth = String(new Date().getMonth() + 1);
        if (currentMonth.length == "1") {
            currentMonth = "0" + currentMonth;
        }

        var currentDateToday = String(new Date().getDate());
        if (currentDateToday.length == "1") {
            currentDateToday = "0" + currentDateToday;
        }
        var currentDateFormated = String(new Date().getFullYear()) + currentMonth + currentDateToday;

        if (position == "logo") {
            if (parseInt(startDateFormated) <= parseInt(currentDateFormated) && parseInt(endDateFormated) >= parseInt(currentDateFormated) && customization.Activo == "1") {
                $("header #logo_header").css("background-image", "url(https://www.cinesa.es/_/tematizaciones/" + customization._id + customization.Extension + "?v=" + Math.floor(Math.random() * 10000) + ")").css("background-size", "100%");
            } else {
                $("body").removeClass("pers_logo");
            }
        } else if (position == "countdown") {
            if (customization.Activo == "1") {
                $("body.pers_count .article_cont .pers_background").attr("href", customization.Enlace);
                var dateCustomizationEnd = customization.FechaFin.split("/");
                dateCustomizationEndFormated = endDateFormated.substring(6, 8) + "/" + endDateFormated.substring(4, 6) + "/" + endDateFormated.substring(0, 4);
                triggerCountdown(dateCustomizationEndFormated + " 00:01", customization.Color);
                $(".article_cont .pers_background").css("background-image", "url(https://www.cinesa.es/_/tematizaciones/" + customization._id + customization.Extension + "?v=" + Math.floor(Math.random() * 10000) + ")");
            } else {
                $("main .article_cont").css("display", "none");
            }
        }
    });
}

//LANDING ACCIÓN STAR WARS: ESCOGE TU LADO DE LA FUERZA
function initElladodelafuerza() {
    //LOGGED
    if (typeof ($.cookie("uulogged")) != "undefined") {
        $(".sw_name").text($.cookie("uulogged"));
        $("#elladodelafuerza #main section").removeClass("hidden");

        //COMS
        setTimeout(function () {
            getConsents("sw_coms", "elladodelafuerza");
        }, 300);
        
        //Select force side
        $(".sw_btn_container .sw_btn").on("touch click", function () {
            $(".sw_btn_container .sw_btn").removeClass("selected");
            $(this).addClass("selected");
            $("#sw_save").removeClass("sw_disabled");
            $("#sw_side").text($(this).attr("data-id"));
        });
 
        //enviar
        $("#sw_save").on("touch click", function () {
            //comunicaciones
            if ($("#sw_comsconsent3").length > 0) {
                $.post("/CinesaUser/SetConsents", { Consents: JSON.stringify(prepareConsents(".sw_coms ")) }, function (data) {
                });
            }

            var u = '/Promociones/insertElladodelafuerza/?side=' + $("#sw_side").text();

            $.get(u, function (data) {
                console.log(data)
                if (data.indexOf("__OK__") > -1) {
                    $("#elladodelafuerza .sw_container").addClass("hidden");
                    $("#elladodelafuerza .sw_container_response").removeClass("hidden");
                    $('body, html').animate({
                        scrollTop: '0px'
                    }, 100);
                } else {
                    if (data.indexOf("__NOLOGIN__") > -1) {
                        customalert("Inicia sesión para indicar que eres fan de Star Wars.");
                    } else {
                        customalert("Error en el servidor. Intentalo más tarde.");
                    }
                }
            });


        });

    } else {
        $("#elladodelafuerza .pop_login_general .pop_container .row:first-child h2").text($("#elladodelafuerza .pop_login_general .pop_container .row:first-child h2").text() + " para escoger tu lado de la Fuerza").addClass("cs_popin_login_copie");
        popupShow("pop_login_general", true);
        nextCallback = function () { location.reload(); };
    }

    $(".popup.pop-design.popup_welcome.color_user .pop2_btn.new_btn").text("Escoge tu lado de la Fuerza").on("touch click", function (e) {
        e.preventDefault();
        location.reload();
    });

    //particles
    setTimeout(function () {
        particlesJS("particles-js", { "particles": { "number": { "value": 301, "density": { "enable": true, "value_area": 789.1476416322727 } }, "color": { "value": "#ffffff" }, "shape": { "type": "circle", "stroke": { "width": 0, "color": "#000000" }, "polygon": { "nb_sides": 5 }, "image": { "src": "img/github.svg", "width": 100, "height": 100 } }, "opacity": { "value": 1, "random": true, "anim": { "enable": true, "speed": 1, "opacity_min": 1, "sync": false } }, "size": { "value": 1, "random": true, "anim": { "enable": true, "speed": 2, "size_min": 0.3, "sync": false } }, "line_linked": { "enable": false, "distance": 150, "color": "#ffffff", "opacity": 0.4, "width": 1 }, "move": { "enable": true, "speed": 0.8, "direction": "none", "random": true, "straight": false, "out_mode": "out", "bounce": false, "attract": { "enable": false, "rotateX": 600, "rotateY": 600 } } }, "interactivity": { "detect_on": "window", "events": { "onhover": { "enable": false, "mode": "bubble" }, "onclick": { "enable": false, "mode": "repulse" }, "resize": true }, "modes": { "grab": { "distance": 400, "line_linked": { "opacity": 1 } }, "bubble": { "distance": 250, "size": 0, "duration": 2, "opacity": 0, "speed": 3 }, "repulse": { "distance": 400, "duration": 0.4 }, "push": { "particles_nb": 4 }, "remove": { "particles_nb": 2 } } }, "retina_detect": true }); var count_particles, stats, update; stats = new Stats; stats.setMode(0); stats.domElement.style.position = 'absolute'; stats.domElement.style.left = '0px'; stats.domElement.style.top = '0px'; document.body.appendChild(stats.domElement); count_particles = document.querySelector('.js-count-particles'); update = function () { stats.begin(); stats.end(); if (window.pJSDom[0].pJS.particles && window.pJSDom[0].pJS.particles.array) { count_particles.innerText = window.pJSDom[0].pJS.particles.array.length; } requestAnimationFrame(update); }; requestAnimationFrame(update);;
    }, 300);

}
function initSorteos(){
    $("form.sorteo").submit(function (e) {
        e.preventDefault();
        var forminfo = $(this);
        /* comprobar captcha */
        $.post("/CinesaUser/calculaCaptcha", { response: grecaptcha.getResponse(recaptchaSorteos) }, function (result) {
            if (result == "true") {
                //form submit
                if ($("#sorteobases").is(":checked")) {
                    $.post("/Sorteos/Submit", forminfo.serialize(), function (data) {
                        if (data.error == 0) {
                            $(".htmlContentGracias").removeClass("hidden");
                            $(".htmlContent").addClass("hidden");
                            $("html").scrollTop(0);
                        } else {
                            customalert(data.mensaje);
                        }
                    });
                } else {
                    customalert("Asegurate de aceptar los términos y condiciones si quieres participar.");
                }
                grecaptcha.reset(recaptchaSorteos);
            } else {
                customalert("Por favor, por motivos de seguridad, recuerda marcar la opción 'No soy un robot'.");
                grecaptcha.reset(recaptchaSorteos);
            }
        });
    });
}


function initCinesRedirect() {
    var u = '/Home/GetCinesRedirect';
    $.get(u, function (data) {
        console.log(data)        
        $.each(data, function (i, cine) {
            CinesRedirect(cine);
        });
    });
}

var contadorRedirects = 0;
function CinesRedirect(_cine) {
    switch ($("body").attr("id")) {
        case "ficha_pelicula":
            // borro el cine si existe previamente
            $("#main .select_cinefav .field.selectcine .radiobox ul li").each(function (i, item) {
                if ($(this).find("label").text() == _cine.Nombre) {
                    $(this).remove();
                }
            });

            var list = $("#main .select_cinefav .field.selectcine .radiobox ul li");
            var CineToAdd;
            var Added = false;

            list.each(function (i, item) {
                $(this).attr("data-order", i + 1);
                if ($(this).find("label").text() == _cine.Nombre) {
                    $(this).attr("data-order", "-1");
                    CineToAdd = $(this);
                    $(this).remove();
                }
            });



            list = $("#main .select_cinefav .field.selectcine .radiobox ul li");
            list.each(function (i, item) {
                //console.log($(this).find("label").text().charAt(0).toLowerCase() +" > "+ _cine.Nombre.charAt(0).toLowerCase())
                if ($(this).find("label").text().charAt(0).toLowerCase() > _cine.Nombre.charAt(0).toLowerCase()) {
                    if (!Added) {
                        $(this).before(`<li class="rb"><label><a href="${_cine.Url}" target="_blank" style="text-align: left;color: #909090;display: block;width: calc(100% - 23px);white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">${_cine.Nombre}</a><span class="rb_starfav rb_nofav"></span></label></li>`);
                        Added = true;
                    }
                }
            });
            if (!Added) {
                $("#main .select_cinefav .field.selectcine .radiobox ul").append(`<li class="rb"><label><a href="${_cine.Url}" target="_blank" style="text-align: left;color: #909090;display: block;width: calc(100% - 23px);white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">${_cine.Nombre}</a><span class="rb_starfav rb_nofav"></span></label></li>`);
                Added = true;
            }

            break;
        case "ficha_eventos":

            // borro el cine si existe previamente
            $("#main .select_cinefav .field.selectcine .radiobox ul li").each(function (i, item) {
                if ($(this).find("label").text() == _cine.Nombre) {
                    $(this).remove();
                }
            });

            var list = $("#main .select_cinefav .field.selectcine .radiobox ul li");
            var CineToAdd;
            var Added = false;

            list.each(function (i, item) {
                $(this).attr("data-order", i + 1);
                if ($(this).find("label").text() == _cine.Nombre) {
                    $(this).attr("data-order", "-1");
                    CineToAdd = $(this);
                    $(this).remove();
                }
            });

            list = $("#main .select_cinefav .field.selectcine .radiobox ul li");
            list.each(function (i, item) {
                //console.log($(this).find("label").text().charAt(0).toLowerCase() +" > "+ _cine.Nombre.charAt(0).toLowerCase())
                if ($(this).find("label").text().charAt(0).toLowerCase() > _cine.Nombre.charAt(0).toLowerCase()) {
                    if (!Added) {
                        $(this).before(`<li class="rb"><label><a href="${_cine.Url}" target="_blank" style="text-align: left;color: #909090;display: block;width: calc(100% - 23px);white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">${_cine.Nombre}</a><span class="rb_starfav rb_nofav"></span></label></li>`);
                        Added = true;
                    }
                }
            });
            if (!Added) {
                $("#main .select_cinefav .field.selectcine .radiobox ul").append(`<li class="rb"><label><a href="${_cine.Url}" target="_blank" style="text-align: left;color: #909090;display: block;width: calc(100% - 23px);white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">${_cine.Nombre}</a><span class="rb_starfav rb_nofav"></span></label></li>`);
                Added = true;
            }

            break;
        case "ficha_cine":
            $("#info_cine .radiobox input").each(function () {
                if ($(this).attr("value") == _cine.CodAgrupacion) {
                    var name = $(this).parent().text()
                    $(this).parents("li.rb").html(`<label><a href="${_cine.Url}" target="_blank" style="text-align: left;color: #909090;display: block;width: calc(100% - 23px);white-space: nowrap;overflow: hidden;text-overflow: ellipsis;font-size: 19px;">${name}</a></label>`);
                }
            });
            break;
        case "promos":
        /*$(".select_cinefav .radiobox input").each(function () {
            if ($(this).attr("value") == _cine.CodAgrupacion) {
                var name = $(this).parent().text()
                $(this).parents("li.rb").html(`<label><a href="${_cine.Url}" target="_blank" style="text-align: left;color: #909090;display: block;width: calc(100% - 23px);white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">${name}</a></label>`);
            }
        });
        break;*/
        case "isens":
            if (_cine.isense === true) {

                var list = $("#main section #select .select-group li")
                var Added = false;

                list.each(function (i, item) {
                    if ($(this).find("a").text().charAt(0).toLowerCase() > _cine.Nombre.charAt(0).toLowerCase()) {
                        if (!Added) {
                            $(this).before(`<li><a target="_blank" href="${_cine.Url}">${_cine.Nombre}</a></li>`);
                            Added = true;
                        }
                    }
                });
                if (!Added) {
                    $("#main .select_cinefav .field.selectcine .radiobox ul").append(`<li><a target="_blank" href="${_cine.Url}">${_cine.Nombre}</a></li>`);
                    Added = true;
                }

            }
            break;
        case "imax":
            if (_cine.imax === true) {
                var list = $("#main section #select .select-group li")
                var Added = false;

                list.each(function (i, item) {
                    if ($(this).find("a").text().charAt(0).toLowerCase() > _cine.Nombre.charAt(0).toLowerCase()) {
                        if (!Added) {
                            $(this).before(`<li><a target="_blank" href="${_cine.Url}">${_cine.Nombre}</a></li>`);
                            Added = true;
                        }
                    }
                });
                if (!Added) {
                    $("#main .select_cinefav .field.selectcine .radiobox ul").append(`<li><a target="_blank" href="${_cine.Url}">${_cine.Nombre}</a></li>`);
                    Added = true;
                }
            }
            break;
        case "screenX":
            if (_cine.screenx === true) {
                var list = $("#main section #select .select-group li")
                var Added = false;

                list.each(function (i, item) {
                    if ($(this).find("a").text().charAt(0).toLowerCase() > _cine.Nombre.charAt(0).toLowerCase()) {
                        if (!Added) {
                            $(this).before(`<li><a target="_blank" href="${_cine.Url}">${_cine.Nombre}</a></li>`);
                            Added = true;
                        }
                    }
                });
                if (!Added) {
                    $("#main .select_cinefav .field.selectcine .radiobox ul").append(`<li><a target="_blank" href="${_cine.Url}">${_cine.Nombre}</a></li>`);
                    Added = true;
                }
            }
            break;
        case "mapa":
            $("#mapa-cines li").each(function () {
                if ($(this).attr("data-id") == _cine.CodAgrupacion) {
                    $(this).find("a").attr("href", _cine.Url).attr("target", "_blank");
                }
            });
            break;
        case "home":
            $(".submenucines li").each(function () {
                if ($(this).attr("data-id") == _cine.CodAgrupacion) {
                    $(this).find("a").attr("href", _cine.Url).attr("target", "_blank");
                }
            });
            break;
    }

    //POPIN REGISTRO
    //var radiobox = $(".pop_registro_2 #cineFavorito ul");
   //radiobox.append(`<li data-id="${contadorRedirects}"><label><input type="radio" name="cineFavorito-0" value="${_cine.Nombre}"><p>${_cine.Nombre}</p></label></li>`);
    //contadorRedirects++;

}

function initRecaptchas() {

    //var recaptchaContactos = null, recaptchaColegios = null, recaptchaSorteos = null;


    $.post("/CinesaUser/GetGoogleControl", null, function (result, status, xhr) {
        if (country.toLowerCase() == "es") {

            if ($("#google-control-Contactos").length > 0) {
                recaptchaContactos = grecaptcha.render('google-control-Contactos', {
                    sitekey: result,
                    callback: function (response) {
                        console.log(response);
                    }
                });
                $(".row_captcha_contacto").hide();
            }

            if ($("#google-control-Colegios").length > 0) {
                recaptchaColegios = grecaptcha.render('google-control-Colegios', {
                    sitekey: result,
                    callback: function (response) {
                        console.log(response);
                    }
                });
            }

            if ($("#google-control-Sorteos").length > 0) {
                recaptchaSorteos = grecaptcha.render('google-control-Sorteos', {
                    sitekey: result,
                    callback: function (response) {
                        console.log(response);
                    }
                });
            }

        }
    });
};
$("a.bbva-action").click(function (e) {
    e.preventDefault();
    popupShow("bbva-action", true);
    $(".bbva-action form")[0].reset();
});


$(document).ready(function () {
    $.when(wsData.fisica.GetPrice()).done(function (resultPrice) {
        if (resultPrice != null) {
            
            if (!resultPrice.Result) {

                customalert(localization.enestosmomentosincidencias);
                return false;
            }

            var price = (resultPrice.ResultObj.ConfigParameter.IntValue / 100).toFixed(2).replace(".", ",") + "€";
            $(".price-fisica").text(price);

        }
    });
});;
var getDaysInMonth = function (month, year) {
    // Here January is 1 based
    //Day 0 is the last day in the previous month
    return new Date(year, month, 0).getDate();
    // Here January is 0 based
    // return new Date(year, month+1, 0).getDate();
};

//var pad = function (num, size) {
//    var s = "000000000" + num;
//    return s.substr(s.length - size);
//}

function pad(str, max) {
    str = str.toString();
    return str.length < max ? pad("0" + str, max) : str;
}

var loadSelectDay = function (dropdownDay, dropdownMonth, dropdownYear) {
    dropdownDay.empty();
    dropdownDay.append('<option>Día</option>');

    if (isNumeric(dropdownMonth.val()) && isNumeric(dropdownYear.val())) {
        if (parseInt(dropdownMonth.val()) > 0 && parseInt(dropdownYear.val()) > 0) {
            var days = getDaysInMonth(dropdownMonth.val(), dropdownYear.val());
            for (var day = 1; day <= days; day++) {
                dropdownDay.append($('<option></option>').attr('value', pad(day, 2)).text(day));
            }
        }
    }
};

var isNumeric = function (num) {
    return !isNaN(num)
};

function validateDate(initDate, endDate) {
    valuesStart = initDate.split("/");
    valuesEnd = endDate.split("/");

    // Verificamos que la fecha no sea posterior a la actual
    var dateStart = new Date(valuesStart[2], (valuesStart[1] - 1), valuesStart[0]);
    var dateEnd = new Date(valuesEnd[2], (valuesEnd[1] - 1), valuesEnd[0]);
    if (dateStart >= dateEnd) {
        return 0;
    }
    return 1;
};
var controllers = controllers || {};
var popup = popup || {};
var popreggrecaptcha = null, popccardgrecaptcha = null, gcreqfisicacc = null, poploginrecaptcha = null;

//POPUP WELCOME START
$("a.reg_btn").click(function (e) {
    e.preventDefault();
    popup.NewUser.Show();
    popup.NewUser.ResetGrecaptcha();

});

//MYCINESA - PWD validation (front)
$(".popup.pop_registro_2 #passwd_registro").on("change keyup keypress keydown", function () {
    var pwd = $(this).val();
    $("#validPassMayus").removeClass("p_ok").addClass("p_nok")
    $("#validPassMinus").removeClass("p_ok").addClass("p_nok")
    $("#validPassNum").removeClass("p_ok").addClass("p_nok")
    $("#validPassEsp").removeClass("p_ok").addClass("p_nok")
    $("#validPass10").removeClass("p_ok").addClass("p_nok")

    for (var i = 0; i < pwd.length; i++) {
        //mayus
        if (pwd[i].match(/^[A-Z]*$/)) {
            $("#validPassMayus").removeClass("p_nok").addClass("p_ok")
        }
        //minus
        if (pwd[i].match(/^[a-z]*$/)) {
            $("#validPassMinus").removeClass("p_nok").addClass("p_ok")
        }
        //number
        if (pwd[i].match(/^[0-9]*$/)) {
            $("#validPassNum").removeClass("p_nok").addClass("p_ok")
        }
        //special
        if (/[!@#$%^&*\-\(\){}_+.¨¬=º<>~ª,;¿?¡:\[\]]/.test(pwd[i])) {
            $("#validPassEsp").removeClass("p_nok").addClass("p_ok")
        }
    }
    //length
    if (pwd.length > 9) {
        $("#validPass10").removeClass("p_nok").addClass("p_ok")
    }

});


$(".popup.pop_registro_2 form").submit(function () {
    var scope = ".popup.pop_registro_2 ";
    var UserInformation = new Object;
    var dataForm = popup.NewUser.GetData();
    var errormsg = popup.NewUser.Validate(dataForm);
    UserInformation.UserInformation = dataForm.regusr;

    if (errormsg == "") {
        $.post("/CinesaUser/calculaCaptcha", { response: popup.NewUser.GetResponseGrecaptcha() }, function (result) {
            if (result == "true") {
                $.when(wsData.unique.NewCinesaUser(JSON.stringify(UserInformation), null, _fbat, _fbid, "")).done(function (resultNewCinesaUser) {
                    if (resultNewCinesaUser.NewMyCinesaUser.returnCode == 0 || resultNewCinesaUser.NewMyCinesaUser.returnCode == "0") {
                        if (GTMEnabled) uaEvent('login module', 'login', 'new account');
                            popupClose();
                                    
                            $.when(wsData.cinesauser.GetPersonalInformation()).done(function (result) {

                                if (result != null) {
                                    UserInfo = result;
                                    $("#popup-welcome-title").html($("#popup-welcome-title").html().replace("{{name}}", dataForm.regusr.FirstName));
                                    popupShow("popup_welcome", true);
                                    updateHeader();
                                }
                            });

                        if (hasConsent(["Performance"])) {
                            ga('send', 'event', 'CinesaUser', 'Registro', 'Solo Usuario');
                            wa.bt_queue.push({ "tags": [{ tag: "ALTA", value: "CinesaUser_Finalizado" }], "async": true, "isTargeting": true, "isEvent": false });
                        }
                    } else {

                        if (typeof (resultNewCinesaUser.NewMyCinesaUser.returnDescription) != "undefined") {
                            errorActions(scope, resultNewCinesaUser.NewMyCinesaUser.returnCode, resultNewCinesaUser.NewMyCinesaUser.returnDescription);
                        } else {
                            customalert(localization.enestosmomentosincidencias);
                        }
                        popup.NewUser.ResetGrecaptcha();
                    }
                });
            } else {
                popup.NewUser.ResetGrecaptcha();
                customalert(localization.porfavornosoyrobot);
            }
        });
    } else {
        errormsg = localization.porfavorcompruebadatosoblitatorios + "\n" + errormsg;
        customalert(errormsg);
    }

    return false;
});

popup.NewUser = {
    Validate: function (dataForm) {
        var scope = ".popup.pop_registro_2 ";
        var errormsg = "";

        $(scope + "*").removeClass("inputNok");

        if (!_validateEmail(dataForm.regusr.Email)) errormsg += "- " + localization.email + "\n";
        //if (dataForm.regusr.Email != dataForm.RepeatedEmail) errormsg += "- " + localization.emailsdebencoincidir + "\n";
        var res = _validaPass(dataForm.regusr.Password);
        if (res != "OK") errormsg += "- " + res + "\n";
        if (dataForm.regusr.FirstName == "") {
            $(scope + "input[name=name]").addClass("inputNok");
            errormsg += "- " + localization.nombre + "\n";
        }
        if (dataForm.regusr.LastName == "") {
            $(scope + "input[name=firstsurname]").addClass("inputNok");
            errormsg += "- Apellidos" + "\n";
        }
        if (dataForm.regusr.NationaID == "") {
            $(scope + "input[name=documentNumber]").addClass("inputNok");
            errormsg += "- Documento de identidad" + "\n";
        }
        
        
        if (country.toLowerCase() == "es") {
            if (dataForm.regusr.DateOfBirth.length != 10) {
                $(scope + ".row.r_cumple .radiobox").addClass("inputNok");
                errormsg += "- Fecha de nacimiento\n";
            }

            if (dataForm.DateBirthDate != null) {
                var d = new Date();
                var year = d.getFullYear();
                var month = d.getMonth();
                var day = d.getDate();
                var c = new Date(year - 14, month, day);
                if (dataForm.DateBirthDate > c)
                    errormsg += "- Debes ser mayor de 14 años\n";
            }
        }
        if (!$(scope + "input[name=politica]").is(":checked")) {
            $(scope + "input[name=politica]").parents(".pop_field_check").addClass("inputNok");
            errormsg += "- " + localization.debesaceptarprivacidad + "\n";
        }

        return errormsg;
    },
    IsValidEmail: function (result) {
        var scope = ".popup.pop_registro_2 ";
        if (result) {
            if (result.ValidateUserMailResponse.returnCode == 0 || result.ValidateUserMailResponse.returnCode == "0") {
                return true;
            }
        }
        else {
            if (typeof (result.ValidateUserMailResponse.returnDescription) != "undefined") {
                errorActions(scope, result.ValidateUserMailResponse.returnCode, result.ValidateUserMailResponse.returnDescription);
            } else {
                customalert(localization.enestosmomentosincidencias);
            }
            popup.NewUser.ResetGrecaptcha();
            return false;
        }
    },
    GetData: function () {
        var scope = ".popup.pop_registro_2 ";
        var dataform = new Object;
        dataform.regusr = new Object;

        dataform.regusr.Email = $(scope + "input[name=email]").val();
        //dataform.RepeatedEmail = $(scope + "input[name=email_rep]").val();
        dataform.regusr.Password = $(scope + "input[name=passwd]").val();
        dataform.regusr.FirstName = $(scope + "input[name=name]").val();
        dataform.regusr.LastName = $(scope + "input[name=firstsurname]").val();
        dataform.regusr.NationaID = $(scope + "input[name=documentNumber]").val();
        //dataform.regusr.SecondSurname = $(scope + "input[name=secondsurname]").val();

        if (country.toLowerCase() == "es") {
            dataform.regusr.DateOfBirth = $(scope + "input[name=dd]").val() + "/" + $(scope + "input[name=mm]").val() + "/" + $(scope + "input[name=aaaa]").val();
            if ($(scope + "input[name=aaaa]").val().length > 0 && $(scope + "input[name=mm]").val().length > 0 && $(scope + "input[name=dd]").val().length > 0)
                dataform.DateBirthDate = new Date($(scope + "input[name=aaaa]").val(), $(scope + "input[name=mm]").val(), $(scope + "input[name=dd]").val());
        }

        //dataform.regusr.Mobile = $(scope + "input[name=mobile]").val();

        dataform.regusr.Adress = $(scope + "input[name=direccion1]").val();
        dataform.regusr.Adress_moreinfo = $(scope + "input[name=direccion2]").val();
        dataform.regusr.City = $(scope + "input[name=location]").val();
        dataform.regusr.ZipCode = $(scope + "input[name=postalcode]").val();
        dataform.regusr.PreferredComplex = $(scope + "input[name=cineFavorito]").val();
        dataform.regusr.Children = $(scope + "input[name=hijos]").val();

        //SendNewsletter
        dataform.regusr.SendNewsletter = false;
        if ($(scope + "#checkcoms").is(':checked')) {
            dataform.regusr.SendNewsletter = true;
        }
        
        //dataform.Consents = prepareConsents(scope);
        return dataform;
    },
    ResetGrecaptcha: function () {
        grecaptcha.reset(popreggrecaptcha);
    },
    GetResponseGrecaptcha: function () {
        return grecaptcha.getResponse(0);
    },
    Show: function () {
        popupShow("pop_registro_2", true);
        $(".pop_registro_2 form")[0].reset();
        var scope = ".popup.pop_registro_2 ";
        $(scope + "input[name=email_rep]").bind("cut copy paste", function (e) {
            e.preventDefault();
        });
    },
}
//POPUP WELCOME END


//POPUP CINESACARD 
$("a.link-ccard").click(function (e) {
    e.preventDefault();
    popupClose(e);
    popupShow("popup_newccard", true);
    $(".popup_newccard form")[0].reset();
    popup.CinesaCard.ResetGrecaptcha();
    var scope = ".popup.popup_newccard form ";

    $(scope + "input[name=email_rep]").bind("cut copy paste", function (e) {
        e.preventDefault();
    });

    popup.CinesaCard.LoadDataUser();
    resetProgressBar();
});

$(".popup.popup_newccard form").submit(function () {
    var UserInformation = new Object;
    var dataForm = popup.CinesaCard.GetData();
    var errormsg = popup.CinesaCard.Validate(dataForm);
    UserInformation.UserInformation = dataForm.regusr;

    if (errormsg == "") {
        $.post("/CinesaUser/calculaCaptcha", { response: popup.CinesaCard.GetResponseGrecaptcha() }, function (result) {
            if (result == "true") {
                $.when(wsData.unique.ValidateUser(dataForm.regusr.Email)).done(function (rValidateUser) {
                    if (popup.CinesaCard.IsValidEmail(rValidateUser) == true || UserInfo.logged == true) {
                        if (UserInfo.logged == true) popup.CinesaCard.CinesaCardCinesaUser(UserInformation, dataForm.Consents, dataForm);
                        else popup.CinesaCard.CinesaCardNewUser(UserInformation, dataForm.Consents, dataForm);
                    }
                });
            } else {
                popup.CinesaCard.ResetGrecaptcha();
                customalert(localization.porfavornosoyrobot);
            }
        });
    } else {
        errormsg = localization.porfavorcompruebadatosoblitatorios + "\n" + errormsg;
        customalert(errormsg);
    }
    return false;
});

popup.CinesaCard = {
    Validate: function (dataForm) {
        var scope = ".popup.popup_newccard form ";
        var errormsg = "";

        if (dataForm.regusr.Email == "" && UserInfo == null) { $(scope + "input[name=email]").addClass("inputNok"); errormsg += "- " + localization.email + "\n"; }
        if (dataForm.RepeatedEmail == "" && UserInfo == null) { $(scope + "input[name=email_rep]").addClass("inputNok"); errormsg += "- " + localization.email + "\n"; }
        if (dataForm.regusr.Password == "" && UserInfo == null) { $(scope + "input[name=name]").addClass("inputNok"); errormsg += "- " + localization.password + "\n"; }
        if (dataForm.regusr.Name == "") { $(scope + "input[name=name]").addClass("inputNok"); errormsg += "- " + localization.nombre + "\n"; }
        if (dataForm.regusr.FirstSurname == "") { $(scope + "input[name=firstsurname]").addClass("inputNok"); errormsg += "- " + localization.primerapellido + "\n"; }
        if (dataForm.regusr.BirthDate.length != 10) { $(scope + "input[name=ddcard]").addClass("inputNok"); errormsg += "- " + localization.tucumple + "\n"; }/*&& UserInfo == null*/
        if (dataForm.regusr.Mobile == "") { $(scope + "input[name=mobile]").addClass("inputNok"); errormsg += "- " + localization.movil + "\n"; }
        if (dataForm.regusr.Gender == "") { $(scope + "input[name=gender]").addClass("inputNok"); errormsg += "- " + localization.genero + "\n"; }
        if (dataForm.regusr.DocumentType == "") { $(scope + "input[name=typedocument]").addClass("inputNok"); errormsg += "- " + localization.tipodedoc + "\n"; }
        if (dataForm.regusr.DocumentNumber == "") { $(scope + "input[name=numberdoc]").addClass("inputNok"); errormsg += "- " + localization.numerodedoc + "\n"; }
        if (dataForm.regusr.Address == "") { $(scope + "input[name=street]").addClass("inputNok"); errormsg += "- " + localization.direccion + "\n"; }
        if (dataForm.regusr.Region == "") { $(scope + "input[name=province]").addClass("inputNok"); errormsg += "- " + localization.provincia + "\n"; }
        if (dataForm.regusr.PostalCode == "") { $(scope + "input[name=postalcode]").addClass("inputNok"); errormsg += "- " + localization.codigopostal + "\n"; }
        if (dataForm.regusr.Location == "") { $(scope + "input[name=city]").addClass("inputNok"); errormsg += "- " + localization.ciudad + "\n"; }
        if (!_validateEmail(dataForm.regusr.Email) && UserInfo == null) errormsg += "- " + localization.email + "\n";
        if (dataForm.regusr.Email != dataForm.RepeatedEmail && UserInfo == null) errormsg += "- " + localization.emailsdebencoincidir + "\n";
        if (UserInfo == null) {
            var res = _validaPass(dataForm.regusr.Password);
            if (res != "OK") errormsg += "- " + res + "\n";
        }

        if (UserInfo.logged == false) {
            if (!$(scope + "input[name=politica]").is(":checked")) {
                $(scope + "input[name=politica]").parents(".pop_field_check").addClass("inputNok");
                errormsg += "- " + localization.debesaceptarprivacidad + "\n";
            }
        }

        if (!$(scope + "input[name=basesccard]").is(":checked")) {
            $(scope + "input[name=basesccard]").parents(".pop_field_check").addClass("inputNok");
            errormsg += "- " + localization.debesaceptarbases + "\n";
        }


        return errormsg;
    },
    GetData: function () {
        var scope = ".popup.popup_newccard form ";
        var dataform = new Object;
        dataform.regusr = new Object;

        dataform.regusr.Email = $(scope + "input[name=email]").val();
        dataform.regusr.Name = $(scope + "input[name=name]").val();
        dataform.regusr.FirstSurname = $(scope + "input[name=firstsurname]").val();
        dataform.regusr.SecondSurname = $(scope + "input[name=secondsurname]").val();
        dataform.regusr.BirthDate = $(scope + "input[name=ddcard]").val() + "/" + $(scope + "input[name=mmcard]").val() + "/" + $(scope + "input[name=aaaacard]").val();
        dataform.regusr.Mobile = $(scope + "input[name=mobile]").val();
        dataform.regusr.Gender = $(scope + "input[name=gender]").val();
        dataform.regusr.DocumentType = $(scope + "input[name=typedocument]").val();
        dataform.regusr.DocumentNumber = $(scope + "input[name=numberdoc]").val();
        dataform.regusr.Address = $(scope + "input[name=street]").val();
        dataform.regusr.Location = $(scope + "input[name=city]").val();
        dataform.regusr.PostalCode = $(scope + "input[name=postalcode]").val();
        dataform.regusr.Region = $(scope + "input[name=province]").val();

        if (UserInfo.logged == true) {
            if ($(scope + " .anim_checkbox").length > 0) {
                dataform.Consents = prepareConsents(scope);
            }
        }
        else {
            dataform.Consents = prepareConsents(scope);
        }

        if (UserInfo.logged == false) {
            dataform.RepeatedEmail = $(scope + "input[name=email_rep]").val();
            dataform.regusr.Password = $(scope + "input[name=passwd]").val();
        }

        return dataform;
    },
    IsValidEmail: function (result) {
        var scope = ".popup.popup_newccard form ";
        if (result) {
            if (result.ValidateUserMailResponse.returnCode == 0 || result.ValidateUserMailResponse.returnCode == "0") {
                return true;
            }
        }
        else {
            if (typeof (result.ValidateUserMailResponse.returnDescription) != "undefined") {
                errorActions(scope, result.ValidateUserMailResponse.returnCode, result.ValidateUserMailResponse.returnDescription);
            } else {
                customalert(localization.enestosmomentosincidencias);
            }
            popup.CinesaCard.ResetGrecaptcha();
            return false;
        }
    },
    ResetGrecaptcha: function () {
        return grecaptcha.reset(popccardgrecaptcha);
    },
    LoadDataUser: function () {
        var popupContent = ".popup.popup_newccard ";
        var scope = ".popup.popup_newccard form ";
        var completed = "anim-input-completado";

        $.when(wsData.cinesauser.GetPersonalInformation()).done(function (result) {
            if (result != null) {
                UserInfo = result;
            }

            if (UserInfo.logged == true) {

                $(popupContent + ".sociallogin_btn").hide();

                var user = JSON.parse(UserInfo.UserInformation).UserGetPersonalInformationResponse.userInformation.User;

                if (user.email != "") {
                    $(scope + "input[name=email]").val(user.email);
                    $(scope + "input[name=email]").parent().addClass(completed);
                    $(scope + "input[name=email]").attr("disabled", "disabled");
                    $(scope + "input[name=email_rep]").hide();
                    $(scope + "label[name=label_email_rep]").hide();
                }
                $("#box-pwsd").hide();
                if (user.name != "") {
                    $(scope + "input[name=name]").val(user.name);
                    $(scope + "input[name=name]").parent().addClass(completed);
                }
                if (user.firstSurname != "") {
                    $(scope + "input[name=firstsurname]").val(user.firstSurname);
                    $(scope + "input[name=firstsurname]").parent().addClass(completed);
                }
                if (user.secondSurname != "") {
                    $(scope + "input[name=secondsurname]").val(user.secondSurname);
                    $(scope + "input[name=secondsurname]").parent().addClass(completed);
                }
                if (user.mobile != "") {
                    $(scope + "input[name=mobile]").val(user.mobile);
                    $(scope + "input[name=mobile]").parent().addClass(completed);
                }
                if (user.postalCode != "") {
                    $(scope + "input[name=postalcode]").val(user.postalCode);
                    $(scope + "input[name=postalcode]").parent().addClass(completed);
                }
                if (user.documentNumber != "") {
                    $(scope + "input[name=numberdoc]").val(user.documentNumber);
                    $(scope + "input[name=numberdoc]").parent().addClass(completed);
                }
                if (user.address) {
                    $(scope + "input[name=street]").val(user.address);
                    $(scope + "input[name=street]").parent().addClass(completed);
                }
                if (user.location) {
                    $(scope + "input[name=city]").val(user.location);
                    $(scope + "input[name=city]").parent().addClass(completed);
                }
                if (user.gender != "") $(scope + "input[name=gender-0][value=" + user.gender + "]").parent().parent().click();
                if (user.documentType != "") $(scope + "input[name=typedocument-0][value=" + user.documentType + "]").parent().parent().click();
                if (user.region != "") $(scope + "input[name=province-0][value=" + user.region + "]").parent().parent().click();

                if (Number.isInteger(UserInfo.day)) $(scope + "input[name=ddcard-0][value=" + pad(UserInfo.day, 2) + "]").parent().parent().click();
                if (Number.isInteger(UserInfo.month)) $(scope + "input[name=mmcard-0][value=" + pad(UserInfo.month, 2) + "]").parent().parent().click();
                if (Number.isInteger(UserInfo.year)) $(scope + "input[name=aaaacard-0][value=" + UserInfo.year + "]").parent().parent().click();
            }
            else {

                $(popupContent + ".sociallogin_btn").show();

                $("#email_registroccard").blur(function (e) {
                    if ($(this).parents(".popup").hasClass("hidden")) {
                        return;
                    }
                    if (_validateEmail($("#email_registroccard").val())) {
                        /*$.post("/CinesaUser/ValidateUser", { Email: $("#email_registroccard").val() }, function (data) {
                            if (data.ValidateUserMailResponse.returnCode == 0 || data.ValidateUserMailResponse.returnCode == "0") {
                                //
                            } else {
                                if (typeof (data.ValidateUserMailResponse.returnDescription) != "undefined") {
                                    errorActions("#noscope", data.ValidateUserMailResponse.returnCode, data.ValidateUserMailResponse.returnDescription);
                                } else {
                                    customalert(localization.enestosmomentosincidencias);
                                }
                                $("#email_registroccard").parent("span").find("label").removeClass("anim-input-label-color-1").addClass("anim-input-label-color-2");
                            }
                        });*/
                    } else {
                        customalert(localization.emailincorrectorevisa);
                    }
                });
            }

            $.when(wsData.cinesauser.GetConsents().done(function (resultGetConsents) {
                consents = [];
                var p = "";
                $.each(resultGetConsents.UU_UserGetConsentsByUserResponse.consents.consent, function (n, v) {
                    v.descripcion = v.descripcion["#cdata-section"];
                    v.estado = (v.estado == "Y");
                    v.obligatorio = (v.obligatorio == "Y");
                    v.iscc = (p == "cc");
                    consents.push(v);
                });
                renderConsents("popup_newccard", p);

                $(scope + " .anim_checkbox").each(function (index) {
                    if (index == 0 && UserInfo.logged == true || $(this)[0].children[0].checked) {
                        $(this).parent().hide()
                    }
                });
            }));

        });

    },
    GetResponseGrecaptcha: function () {
        return grecaptcha.getResponse(1);
    },
    CinesaCardNewUser: function (userInformation, consents, dataForm) {
        var scope = ".popup.popup_newccard form ";
        $.when(wsData.unique.NewCinesaCard(JSON.stringify(userInformation), null, _fbat, _fbid, JSON.stringify(consents))).done(function (rNewCinesaCard) {
            if (rNewCinesaCard.NewCinesacard_NewUserResponse.returnCode == 0 || rNewCinesaCard.NewCinesacard_NewUserResponse.returnCode == "0") {
                updateHeader();
                popup.CinesaCard.GoPageOK(dataForm.regusr.Name);
            }
            else {
                if (typeof (rNewCinesaCard.NewCinesacard_NewUserResponse.returnDescription) != "undefined") {
                    errorActions(scope, rNewCinesaCard.NewCinesacard_NewUserResponse.returnCode, rNewCinesaCard.NewCinesacard_NewUserResponse.returnDescription);
                } else {
                    customalert(localization.enestosmomentosincidencias);
                }
                popup.CinesaCard.ResetGrecaptcha();
            }
        });
    },
    CinesaCardCinesaUser: function (userInformation, consents, dataForm) {
        $.when(wsData.unique.NewCCCinesaUser(JSON.stringify(userInformation), JSON.stringify(consents))).done(function (result) {
            if (result.NewCinesacard_CinesaUserResponse.returnCode == 0 || result.NewCinesacard_CinesaUserResponse.returnCode == "0") {
                updateHeader();
                popup.CinesaCard.GoPageOK(dataForm.regusr.Name);
            }
            else popup.CinesaCard.GoKO(result);
        });
    },
    GoPageOK: function (name) {
        $.when(wsData.bank.IsEnabled().done(function (result) {
            if (result.enabled) {
                $("#bbva-request").show();
            }
            else {
                $("#bbva-request").hide();
            }
            popupClose();
            $(".popup_welcomeccard .title").html($(".popup_welcomeccard .title").html().replace("{{name}}", name));
            popupShow("popup_welcomeccard", true);
        }));
    },
    GoKO: function (result) {
        var scope = ".popup.popup_newccard form ";
        if (typeof (result.NewCinesacard_CinesaUserResponse.returnDescription) != "undefined") {
            errorActions(scope, result.NewCinesacard_CinesaUserResponse.returnCode, result.NewCinesacard_CinesaUserResponse.returnDescription);
        } else {
            customalert(localization.enestosmomentosincidencias);
        }
        popup.CinesaCard.ResetGrecaptcha();
    },
}
//POPUP CINESACARD END

function onloadCallback() {
    $.post("/CinesaUser/GetGoogleControl", null, function (result, status, xhr) {
        popreggrecaptcha = grecaptcha.render('google-control', {
            sitekey: result,
            callback: function (response) {
                console.log(response);
            }
        });

        if (country.toLowerCase() == "es") {
            popccardgrecaptcha = grecaptcha.render('google-control-ccard', {
                sitekey: result,
                callback: function (response) {
                    console.log(response);
                }
            });

            gcreqfisicacc = grecaptcha.render('gc-reqfisicacc', {
                sitekey: result,
                callback: function (response) {
                    console.log(response);
                }
            });

            poploginrecaptcha = grecaptcha.render('google-control-2', {
                sitekey: result,
                callback: function (response) {
                    console.log(response);
                }
            });
        }

        


    });
}

$(".popup.pop_login_ccard_alta form").submit(function () {
    var scope = ".popup.pop_login_ccard_alta form ";
    if (_validateEmail($(scope + "input[name=email]").val())) {
        loginCinesaUser($(scope + "input[name=email]").val(), $(scope + "input[name=passwd]").val(), false, function (data) {
            if ((data.UserLoginResponse.UserInformation.UserInformation.ccCard == "" || data.UserLoginResponse.UserInformation.UserInformation.ccCard == null) && data.UserLoginResponse.UserInformation.UserInformation.isCinesaCardUser != "Y") {
                $("a.link-ccard").click();
            } else {
                customalert(localization.yadisponesdecc);
            }
        });
    } else {
        customalert(localization.direccionemailincorrecta);
    }
    return false;
});

//POPUP CINESACARD FISICA
var order = null;
//REQUEST
$("a.link-ccfisica").click(function (e) {
    e.preventDefault();
    popupClose(e);
    popupShow("pop-ccfisica-1", true);
    $(".pop-ccfisica-1 form")[0].reset();
    popup.RequestCCFisica.Load();
    resetProgressBar();
});

popup.RequestCCFisica = {
    Init: function () {

        $(".link-popup-ccfisica").click(function () {

            popupShow("pop-ccfisica-1", true);
            $(".pop-ccfisica-1 form")[0].reset();
            popup.RequestCCFisica.Load();

        });

    },
    GetForm: function () {
        return ".popup.pop-ccfisica-1 form ";
    },
    Load: function () {
        var scope = popup.RequestCCFisica.GetForm();

        $.when(wsData.unique.GetPersonalInformation(), wsData.fisica.GetPrice()).done(function (resultInformation, resultPrice) {
            if (resultInformation != null && resultPrice != null) {
                if (resultPrice[0].Result && resultInformation[0].Result) {
                    var user = JSON.parse(resultInformation[0].Information).UserGetPersonalInformationResponse.userInformation.User;
                    var completed = "anim-input-completado";

                    if (user.name != "") {
                        $(scope + "input[name=name]").val(user.name);
                        $(scope + "input[name=name]").parent().addClass(completed);
                    }
                    if (user.firstSurname != "") {
                        $(scope + "input[name=firstsurname]").val(user.firstSurname);
                        $(scope + "input[name=firstsurname]").parent().addClass(completed);
                    }
                    if (user.secondSurname != "") {
                        $(scope + "input[name=secondsurname]").val(user.secondSurname);
                        $(scope + "input[name=secondsurname]").parent().addClass(completed);
                    }
                    if (user.mobile != "") {
                        $(scope + "input[name=mobile]").val(user.mobile);
                        $(scope + "input[name=mobile]").parent().addClass(completed);
                    }
                    if (user.address) {
                        $(scope + "input[name=street]").val(user.address);
                        $(scope + "input[name=street]").parent().addClass(completed);
                    }
                    if (user.postalCode != "") {
                        $(scope + "input[name=postalcode]").val(user.postalCode);
                        $(scope + "input[name=postalcode]").parent().addClass(completed);
                    }
                    if (user.location) {
                        $(scope + "input[name=city]").val(user.location);
                        $(scope + "input[name=city]").parent().addClass(completed);
                    }
                    if (user.region != "") {
                        //$(scope + "input[name=province_ccfisica-0][value=" + user.region + "]").parent().parent().click();
                        //$(scope + 'input[name=province_ccfisica-0]').attr('data-selectedvalue', user.region)
                        //$(scope + 'input[name=province_ccfisica-0]').attr('data-selectedvalue', user.region);
                        $(scope + 'input[name=province_ccfisica-0][value="' + user.region + '"]').click();
                    }
                    price = (resultPrice[0].ResultObj.ConfigParameter.IntValue / 100).toFixed(2).replace(".", ",") + "€";
                    $("#lblprice").html($("#lblprice").html().replace("{{price}}", price));

                }
            }
        });
    },
    ResetGrecaptcha: function () {
        return grecaptcha.reset(gcreqfisicacc);
    },
    GetResponseGrecaptcha: function () {
        return grecaptcha.getResponse(2);
    },
    GetData: function () {
        var scope = popup.RequestCCFisica.GetForm();
        var dataform = new Object;

        dataform.Name = $(scope + "input[name=name]").val();
        dataform.FirstSurname = $(scope + "input[name=firstsurname]").val();
        dataform.SecondSurname = $(scope + "input[name=secondsurname]").val();
        dataform.Mobile = $(scope + "input[name=mobile]").val();
        dataform.Address = $(scope + "input[name=street]").val();
        dataform.PostalCode = $(scope + "input[name=postalcode]").val();
        dataform.Region = $(scope + "input[name=city]").val();
        dataform.Location = $(scope + "input[name=province_ccfisica]").val();

        return dataform;
    },
    Validate: function () {
        var scope = popup.RequestCCFisica.GetForm();
        var dataform = popup.RequestCCFisica.GetData();
        var errormsg = "";

        $(scope + "*").removeClass("inputNok");

        if (dataform.Name == "") { $(scope + "input[name=name]").addClass("inputNok"); errormsg += "- " + localization.nombre + "\n"; }
        if (dataform.FirstSurname == "") { $(scope + "input[name=firstsurname]").addClass("inputNok"); errormsg += "- " + localization.primerapellido + "\n"; }
        if (dataform.Mobile == "") { $(scope + "input[name=mobile]").addClass("inputNok"); errormsg += "- " + localization.movil + "\n"; }
        if (dataform.Address == "") { $(scope + "input[name=street]").addClass("inputNok"); errormsg += "- " + localization.direccion + "\n"; }
        if (dataform.PostalCode == "") { $(scope + "input[name=postalcode]").addClass("inputNok"); errormsg += "- " + localization.codigopostal + "\n"; }
        if (dataform.Region == "") { $(scope + "input[name=city]").addClass("inputNok"); errormsg += "- " + localization.ciudad + "\n"; }
        if (dataform.Location == "") { $(scope + "input[name=province_ccfisica]").addClass("inputNok"); errormsg += "- " + localization.provincia + "\n"; }

        return errormsg;
    },
    Action: function (e) {
        var scope = popup.RequestCCFisica.GetForm();
        var errormsg = popup.RequestCCFisica.Validate();
        var dataform = popup.RequestCCFisica.GetData();

        if (errormsg == "") {
            $.post("/CinesaUser/calculaCaptcha", { response: popup.RequestCCFisica.GetResponseGrecaptcha() }, function (result) {
                if (result == "true") {
                    $.when(wsData.fisica.GetCodeOrder(dataform)).done(function (response) {
                        if (response.Result) {
                            popupClose();
                            order = response.ResultObj.IdCompra;
                            popup.RequestCCFisica.ResetGrecaptcha();
                            popup.ConfCCFisica.Load();
                        }
                        else {
                            popup.RequestCCFisica.ResetGrecaptcha();
                            customalert(response.ResultMessage);
                        }
                    });
                } else {
                    popup.RequestCCFisica.ResetGrecaptcha();
                    customalert(localization.porfavornosoyrobot);
                }
            });
        }
        else {
            errormsg = localization.porfavorcompruebadatosoblitatorios + "\n" + errormsg;
            customalert(errormsg);
        }

    },
    Show: function () {
        popupShow("pop-ccfisica-1", true);
        popup.RequestCCFisica.ResetGrecaptcha();
    },
}

var submitlock = true;
//CONFIRM
popup.ConfCCFisica = {
    GetForm: function () {
        return ".popup.pop-ccfisica-2 div.form ";
    },
    Load: function (info) {
        var scope = popup.ConfCCFisica.GetForm();
        var completed = "anim-input-completado";
        var dataform = popup.RequestCCFisica.GetData();

        $.when(wsData.cinesauser.GetCinesaCardNumber(), wsData.fisica.GetPrice(), wsData.fisica.GetIva()).done(function (resultCCNumber, resultPrice, resultIva) {
            if (resultCCNumber != null && resultPrice != null) {
                if (!resultCCNumber[0].Result) {
                    customalert(resultCCNumber[0].ResultMessage);
                    return false;
                }
                if (!resultPrice[0].Result) {
                    customalert(resultCCNumber[0].ResultMessage);
                    return false;
                }

                popupShow("pop-ccfisica-2", true);

                $("#con-ccnum").html($("#con-ccnum").html().replace("{{numccard}}", resultCCNumber[0].CCCard));
                price = (resultPrice[0].ResultObj.ConfigParameter.IntValue / 100).toFixed(2).replace(".", ",") + "€";
                $("#conprice").text(price);

                $(scope + "input[name=name]").val(dataform.Name + " " + dataform.FirstSurname + " " + dataform.SecondSurname);
                $(scope + "input[name=name]").parent().addClass(completed);
                $(scope + "input[name=mobile]").val(dataform.Mobile);
                $(scope + "input[name=mobile]").parent().addClass(completed);
                $(scope + "input[name=street]").val(dataform.Address + ", " + dataform.Region + "(" + dataform.PostalCode + "), " + dataform.Location);
                $(scope + "input[name=street]").parent().addClass(completed);
                $("#btn-action-pay").click(function () { popup.ConfCCFisica.Action(); });
                $("#payback").click(function (e) { e.preventDefault(); popup.ConfCCFisica.GoBack(e); });

                if (resultIva[0].Result) {
                    $(".numiva").text(resultIva[0].Iva);
                }
            }
        });
    },
    Validate: function () {
        var scope = popup.ConfCCFisica.GetForm();
        var errormsg = "";

        if (!$(scope + "input[name=fisicacontratacion]").is(":checked")) {
            $(scope + "input[name=fisicacontratacion]").parents(".pop_field_check").addClass("inputNok");
            errormsg += "- " + localization.debesaceptarbases + "\n";
        }

        return errormsg;
    },
    Action: function () {
        var errormsg = popup.ConfCCFisica.Validate();
        if (errormsg == "") {
            if (!submitlock) {
                return true;
            } else {
                $('#btrj').prop('disabled', true);

                $.when(wsData.fisica.GoTPVPayment(order)).done(function (response) {
                    if (response.Result == true) {
                        $("form[name=C] input[name=Ds_MerchantParameters]").attr("value", response.idt);
                        $("form[name=C] input[name=Ds_Signature]").attr("value", response.signature);
                        submitlock = false;
                        $("form[name=C]").submit();
                    }
                    else {
                        customalert(response.ResultMessage);
                    }
                });
            }
        }
        else {
            errormsg = localization.porfavorcompruebadatosoblitatorios + "\n" + errormsg;
            customalert(errormsg);
        }
        return false;
    },
    GoBack: function (e) {
        popupClose(e);
        popup.RequestCCFisica.Show();
    },
}

popup.RequestCCFisicaOK = {
    Verify: function () {
        var param = popup.RequestCCFisicaOK.GetQueryUrl();
        if (param != "") {
            $.when(wsData.fisica.GetStateOrder(param)).done(function (result) {
                if (result.Result) {
                    if (result.Pagado == true) {
                        popup.RequestCCFisicaOK.Show();
                    }
                }
                else {
                    customalert(result.ResultMessage);
                }
            });
        }
    },
    GetQueryUrl: function () {
        return getUrlParameter('payment');
    },
    Show: function () {
        popupShow("pop-fisica-3", true);
    },
}
//POPUP CINESACARD FISICA END

$(document).ready(function () {

    popup.RequestCCFisica.Init();
    popup.RequestCCFisicaOK.Verify();
    popup.BBVA.Init();

    $('iframe').on("load", function () {

        popup.BBVA.Resize();

    });

});

popup.BBVA = {
    Init: function () {

        popup.BBVA.Resize();

        $(".link-popup-bbva").click(function (e) {
            popupClose(e);
            popupShow("bbva-action", true);
            $(".bbva-action form")[0].reset();

        });

    },

    Resize: function () {

        if (document.myFisica != null) {

            //var height = document.myBBVA.offsetHeight;
            //document.myFisica.style.height = height + "px";

            /*var height = document.myFisica.getElementsByClassName("my-Information")[0].offsetHeight;
            document.myBBVA.getElementsByClassName("my-Information")[0].style.height = height + "px";

            var height = document.myFisica.getElementsByClassName("my-title")[0].offsetHeight;
            document.myBBVA.getElementsByClassName("my-title")[0].style.height = height + "px";
            */
        }

    },
}

function resize() {

    popup.BBVA.Resize();

}

function getUrlParameter(name) {
    name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]');
    var regex = new RegExp('[\\?&]' + name + '=([^&#]*)');
    var results = regex.exec(location.search);
    return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' '));
};

Number.isInteger = Number.isInteger || function (value) {
    return typeof value === "number" &&
        isFinite(value) &&
        Math.floor(value) === value;
};;
var wsData = wsData || {};

wsData.unique = {
    NewCinesaUser: function (userInformation, socialNetworkInformation, _fbat, _fbid, consents) {

        var data = {
            UserInformation: userInformation,
            fbat: _fbat,
            fbid: _fbid,
            Consents: consents
        }

        return $.post("/CinesaUser/Register", data, function (result, status, xhr) {
        }).error(function () {
        });
    },
    ValidateUser: function (email) {
        /*var data = {
            Email: email
        }

        return $.post("/CinesaUser/ValidateUser", data, function (result, status, xhr) {
        }).error(function () {
        });*/
    },
    NewCinesaCard: function (userInformation, socialNetworkInformation, _fbat, _fbid, consents) {
        var data = {
            UserInformation: userInformation,
            fbat: _fbat,
            fbid: _fbid,
            Consents: consents
        }

        return $.post("/UniqueUser/CinesacardNewUser", data, function (result, status, xhr) {
        }).error(function () {
        });
    },
    NewCCCinesaUser: function (userInformation, consents) {
        var data = {
            UserInformation: userInformation,
            Consents: consents
        }

        return $.post("/UniqueUser/CinesacardCinesaUser", data, function (result, status, xhr) {
        }).error(function () {
        });
    },
    GetPersonalInformation: function () {
        var data = null;

        return $.post("/UniqueUser/GetPersonalInformation", data, function (result, status, xhr) {
        }).error(function () {
        });
    }
};
wsData.cinesauser = {
    GetPersonalInformation: function () {

        var data = null;

        return $.post("/CinesaUser/GetPersonalInformation", data, function (result, status, xhr) {
        }).error(function () {
        });
    },
    GetConsents: function () {
        var data = null;
        return $.post("/CinesaUser/GetConsents", data, function (result, status, xhr) {
        }).error(function () {
        });
    },
    GetCinesaCardNumber: function () {
        var data = null;
        return $.post("/CinesaUser/GetCinesaCardNumber", data, function (result, status, xhr) {
        }).error(function () {
        });
    },
};
wsData.fisica = {
    GetCodeOrder: function (userinfo) {
        var data = {
            UserInformation: userinfo
        }
        return $.post("/Fisica/GetCodeOrder", data, function (result, status, xhr) {
        }).error(function () {
        });
    },
    GetPrice: function () {
        var data = null;
        return $.post("/Fisica/GetPrice", data, function (result, status, xhr) {
        }).error(function () {
        });
    },
    GoTPVPayment: function (order) {
        var data = {
            order: order
        }
        return $.post("/Fisica/GoTPVPayment", data, function (result, status, xhr) {
        }).error(function () {
        });
    },
    GetStateOrder: function (order) {
        var data = {
            order: order
        }
        return $.post("/Fisica/GetStateOrder", data, function (result, status, xhr) {
        }).error(function () {
        });
    },
    GetIva: function (order) {
        var data = null;
        return $.post("/Fisica/GetIva", data, function (result, status, xhr) {
        }).error(function () {
        });
    },
}

wsData.bank = {
    IsEnabled: function (userinfo) {
        var data = null;

        return $.post("/Bank/IsEnabled", data, function (result, status, xhr) {
        }).error(function () {
        });
    },
};
function initLead() {
    setLead();
    $("#landinglead").removeClass("hidden");
}

function setLead() {
    $.cookie('lead', "1", { domain: '.cinesa.es', path: '/', expires: 7 });
};
