﻿/* Modernizr 2.6.2 (Custom Build) | MIT & BSD
 * Build: http://modernizr.com/download/#-fontface-backgroundsize-borderradius-boxshadow-opacity-rgba-textshadow-cssanimations-cssgradients-input-inputtypes-shiv-mq-cssclasses-teststyles-testprop-testallprops-prefixes-domprefixes-load
 */
; window.Modernizr = function (a, b, c) { function B(a) { j.cssText = a } function C(a, b) { return B(n.join(a + ";") + (b || "")) } function D(a, b) { return typeof a === b } function E(a, b) { return !!~("" + a).indexOf(b) } function F(a, b) { for (var d in a) { var e = a[d]; if (!E(e, "-") && j[e] !== c) return b == "pfx" ? e : !0 } return !1 } function G(a, b, d) { for (var e in a) { var f = b[a[e]]; if (f !== c) return d === !1 ? a[e] : D(f, "function") ? f.bind(d || b) : f } return !1 } function H(a, b, c) { var d = a.charAt(0).toUpperCase() + a.slice(1), e = (a + " " + p.join(d + " ") + d).split(" "); return D(b, "string") || D(b, "undefined") ? F(e, b) : (e = (a + " " + q.join(d + " ") + d).split(" "), G(e, b, c)) } function I() { e.input = function (c) { for (var d = 0, e = c.length; d < e; d++) t[c[d]] = c[d] in k; return t.list && (t.list = !!b.createElement("datalist") && !!a.HTMLDataListElement), t }("autocomplete autofocus list placeholder max min multiple pattern required step".split(" ")), e.inputtypes = function (a) { for (var d = 0, e, f, h, i = a.length; d < i; d++) k.setAttribute("type", f = a[d]), e = k.type !== "text", e && (k.value = l, k.style.cssText = "position:absolute;visibility:hidden;", /^range$/.test(f) && k.style.WebkitAppearance !== c ? (g.appendChild(k), h = b.defaultView, e = h.getComputedStyle && h.getComputedStyle(k, null).WebkitAppearance !== "textfield" && k.offsetHeight !== 0, g.removeChild(k)) : /^(search|tel)$/.test(f) || (/^(url|email)$/.test(f) ? e = k.checkValidity && k.checkValidity() === !1 : e = k.value != l)), s[a[d]] = !!e; return s }("search tel url email datetime date month week time datetime-local number range color".split(" ")) } var d = "2.6.2", e = {}, f = !0, g = b.documentElement, h = "modernizr", i = b.createElement(h), j = i.style, k = b.createElement("input"), l = ":)", m = {}.toString, n = " -webkit- -moz- -o- -ms- ".split(" "), o = "Webkit Moz O ms", p = o.split(" "), q = o.toLowerCase().split(" "), r = {}, s = {}, t = {}, u = [], v = u.slice, w, x = function (a, c, d, e) { var f, i, j, k, l = b.createElement("div"), m = b.body, n = m || b.createElement("body"); if (parseInt(d, 10)) while (d--) j = b.createElement("div"), j.id = e ? e[d] : h + (d + 1), l.appendChild(j); return f = ["&#173;", '<style id="s', h, '">', a, "</style>"].join(""), l.id = h, (m ? l : n).innerHTML += f, n.appendChild(l), m || (n.style.background = "", n.style.overflow = "hidden", k = g.style.overflow, g.style.overflow = "hidden", g.appendChild(n)), i = c(l, a), m ? l.parentNode.removeChild(l) : (n.parentNode.removeChild(n), g.style.overflow = k), !!i }, y = function (b) { var c = a.matchMedia || a.msMatchMedia; if (c) return c(b).matches; var d; return x("@media " + b + " { #" + h + " { position: absolute; } }", function (b) { d = (a.getComputedStyle ? getComputedStyle(b, null) : b.currentStyle)["position"] == "absolute" }), d }, z = {}.hasOwnProperty, A; !D(z, "undefined") && !D(z.call, "undefined") ? A = function (a, b) { return z.call(a, b) } : A = function (a, b) { return b in a && D(a.constructor.prototype[b], "undefined") }, Function.prototype.bind || (Function.prototype.bind = function (b) { var c = this; if (typeof c != "function") throw new TypeError; var d = v.call(arguments, 1), e = function () { if (this instanceof e) { var a = function () { }; a.prototype = c.prototype; var f = new a, g = c.apply(f, d.concat(v.call(arguments))); return Object(g) === g ? g : f } return c.apply(b, d.concat(v.call(arguments))) }; return e }), r.rgba = function () { return B("background-color:rgba(150,255,150,.5)"), E(j.backgroundColor, "rgba") }, r.backgroundsize = function () { return H("backgroundSize") }, r.borderradius = function () { return H("borderRadius") }, r.boxshadow = function () { return H("boxShadow") }, r.textshadow = function () { return b.createElement("div").style.textShadow === "" }, r.opacity = function () { return C("opacity:.55"), /^0.55$/.test(j.opacity) }, r.cssanimations = function () { return H("animationName") }, r.cssgradients = function () { var a = "background-image:", b = "gradient(linear,left top,right bottom,from(#9f9),to(white));", c = "linear-gradient(left top,#9f9, white);"; return B((a + "-webkit- ".split(" ").join(b + a) + n.join(c + a)).slice(0, -a.length)), E(j.backgroundImage, "gradient") }, r.fontface = function () { var a; return x('@font-face {font-family:"font";src:url("https://")}', function (c, d) { var e = b.getElementById("smodernizr"), f = e.sheet || e.styleSheet, g = f ? f.cssRules && f.cssRules[0] ? f.cssRules[0].cssText : f.cssText || "" : ""; a = /src/i.test(g) && g.indexOf(d.split(" ")[0]) === 0 }), a }; for (var J in r) A(r, J) && (w = J.toLowerCase(), e[w] = r[J](), u.push((e[w] ? "" : "no-") + w)); return e.input || I(), e.addTest = function (a, b) { if (typeof a == "object") for (var d in a) A(a, d) && e.addTest(d, a[d]); else { a = a.toLowerCase(); if (e[a] !== c) return e; b = typeof b == "function" ? b() : b, typeof f != "undefined" && f && (g.className += " " + (b ? "" : "no-") + a), e[a] = b } return e }, B(""), i = k = null, function (a, b) { function k(a, b) { var c = a.createElement("p"), d = a.getElementsByTagName("head")[0] || a.documentElement; return c.innerHTML = "x<style>" + b + "</style>", d.insertBefore(c.lastChild, d.firstChild) } function l() { var a = r.elements; return typeof a == "string" ? a.split(" ") : a } function m(a) { var b = i[a[g]]; return b || (b = {}, h++, a[g] = h, i[h] = b), b } function n(a, c, f) { c || (c = b); if (j) return c.createElement(a); f || (f = m(c)); var g; return f.cache[a] ? g = f.cache[a].cloneNode() : e.test(a) ? g = (f.cache[a] = f.createElem(a)).cloneNode() : g = f.createElem(a), g.canHaveChildren && !d.test(a) ? f.frag.appendChild(g) : g } function o(a, c) { a || (a = b); if (j) return a.createDocumentFragment(); c = c || m(a); var d = c.frag.cloneNode(), e = 0, f = l(), g = f.length; for (; e < g; e++) d.createElement(f[e]); return d } function p(a, b) { b.cache || (b.cache = {}, b.createElem = a.createElement, b.createFrag = a.createDocumentFragment, b.frag = b.createFrag()), a.createElement = function (c) { return r.shivMethods ? n(c, a, b) : b.createElem(c) }, a.createDocumentFragment = Function("h,f", "return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&(" + l().join().replace(/\w+/g, function (a) { return b.createElem(a), b.frag.createElement(a), 'c("' + a + '")' }) + ");return n}")(r, b.frag) } function q(a) { a || (a = b); var c = m(a); return r.shivCSS && !f && !c.hasCSS && (c.hasCSS = !!k(a, "article,aside,figcaption,figure,footer,header,hgroup,nav,section{display:block}mark{background:#FF0;color:#000}")), j || p(a, c), a } var c = a.html5 || {}, d = /^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i, e = /^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i, f, g = "_html5shiv", h = 0, i = {}, j; (function () { try { var a = b.createElement("a"); a.innerHTML = "<xyz></xyz>", f = "hidden" in a, j = a.childNodes.length == 1 || function () { b.createElement("a"); var a = b.createDocumentFragment(); return typeof a.cloneNode == "undefined" || typeof a.createDocumentFragment == "undefined" || typeof a.createElement == "undefined" }() } catch (c) { f = !0, j = !0 } })(); var r = { elements: c.elements || "abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video", shivCSS: c.shivCSS !== !1, supportsUnknownElements: j, shivMethods: c.shivMethods !== !1, type: "default", shivDocument: q, createElement: n, createDocumentFragment: o }; a.html5 = r, q(b) }(this, b), e._version = d, e._prefixes = n, e._domPrefixes = q, e._cssomPrefixes = p, e.mq = y, e.testProp = function (a) { return F([a]) }, e.testAllProps = H, e.testStyles = x, g.className = g.className.replace(/(^|\s)no-js(\s|$)/, "$1$2") + (f ? " js " + u.join(" ") : ""), e }(this, this.document), function (a, b, c) { function d(a) { return "[object Function]" == o.call(a) } function e(a) { return "string" == typeof a } function f() { } function g(a) { return !a || "loaded" == a || "complete" == a || "uninitialized" == a } function h() { var a = p.shift(); q = 1, a ? a.t ? m(function () { ("c" == a.t ? B.injectCss : B.injectJs)(a.s, 0, a.a, a.x, a.e, 1) }, 0) : (a(), h()) : q = 0 } function i(a, c, d, e, f, i, j) { function k(b) { if (!o && g(l.readyState) && (u.r = o = 1, !q && h(), l.onload = l.onreadystatechange = null, b)) { "img" != a && m(function () { t.removeChild(l) }, 50); for (var d in y[c]) y[c].hasOwnProperty(d) && y[c][d].onload() } } var j = j || B.errorTimeout, l = b.createElement(a), o = 0, r = 0, u = { t: d, s: c, e: f, a: i, x: j }; 1 === y[c] && (r = 1, y[c] = []), "object" == a ? l.data = c : (l.src = c, l.type = a), l.width = l.height = "0", l.onerror = l.onload = l.onreadystatechange = function () { k.call(this, r) }, p.splice(e, 0, u), "img" != a && (r || 2 === y[c] ? (t.insertBefore(l, s ? null : n), m(k, j)) : y[c].push(l)) } function j(a, b, c, d, f) { return q = 0, b = b || "j", e(a) ? i("c" == b ? v : u, a, b, this.i++, c, d, f) : (p.splice(this.i++, 0, a), 1 == p.length && h()), this } function k() { var a = B; return a.loader = { load: j, i: 0 }, a } var l = b.documentElement, m = a.setTimeout, n = b.getElementsByTagName("script")[0], o = {}.toString, p = [], q = 0, r = "MozAppearance" in l.style, s = r && !!b.createRange().compareNode, t = s ? l : n.parentNode, l = a.opera && "[object Opera]" == o.call(a.opera), l = !!b.attachEvent && !l, u = r ? "object" : l ? "script" : "img", v = l ? "script" : u, w = Array.isArray || function (a) { return "[object Array]" == o.call(a) }, x = [], y = {}, z = { timeout: function (a, b) { return b.length && (a.timeout = b[0]), a } }, A, B; B = function (a) { function b(a) { var a = a.split("!"), b = x.length, c = a.pop(), d = a.length, c = { url: c, origUrl: c, prefixes: a }, e, f, g; for (f = 0; f < d; f++) g = a[f].split("="), (e = z[g.shift()]) && (c = e(c, g)); for (f = 0; f < b; f++) c = x[f](c); return c } function g(a, e, f, g, h) { var i = b(a), j = i.autoCallback; i.url.split(".").pop().split("?").shift(), i.bypass || (e && (e = d(e) ? e : e[a] || e[g] || e[a.split("/").pop().split("?")[0]]), i.instead ? i.instead(a, e, f, g, h) : (y[i.url] ? i.noexec = !0 : y[i.url] = 1, f.load(i.url, i.forceCSS || !i.forceJS && "css" == i.url.split(".").pop().split("?").shift() ? "c" : c, i.noexec, i.attrs, i.timeout), (d(e) || d(j)) && f.load(function () { k(), e && e(i.origUrl, h, g), j && j(i.origUrl, h, g), y[i.url] = 2 }))) } function h(a, b) { function c(a, c) { if (a) { if (e(a)) c || (j = function () { var a = [].slice.call(arguments); k.apply(this, a), l() }), g(a, j, b, 0, h); else if (Object(a) === a) for (n in m = function () { var b = 0, c; for (c in a) a.hasOwnProperty(c) && b++; return b }(), a) a.hasOwnProperty(n) && (!c && !--m && (d(j) ? j = function () { var a = [].slice.call(arguments); k.apply(this, a), l() } : j[n] = function (a) { return function () { var b = [].slice.call(arguments); a && a.apply(this, b), l() } }(k[n])), g(a[n], j, b, n, h)) } else !c && l() } var h = !!a.test, i = a.load || a.both, j = a.callback || f, k = j, l = a.complete || f, m, n; c(h ? a.yep : a.nope, !!i), i && c(i) } var i, j, l = this.yepnope.loader; if (e(a)) g(a, 0, l, 0); else if (w(a)) for (i = 0; i < a.length; i++) j = a[i], e(j) ? g(j, 0, l, 0) : w(j) ? B(j) : Object(j) === j && h(j, l); else Object(a) === a && h(a, l) }, B.addPrefix = function (a, b) { z[a] = b }, B.addFilter = function (a) { x.push(a) }, B.errorTimeout = 1e4, null == b.readyState && b.addEventListener && (b.readyState = "loading", b.addEventListener("DOMContentLoaded", A = function () { b.removeEventListener("DOMContentLoaded", A, 0), b.readyState = "complete" }, 0)), a.yepnope = k(), a.yepnope.executeStack = h, a.yepnope.injectJs = function (a, c, d, e, i, j) { var k = b.createElement("script"), l, o, e = e || B.errorTimeout; k.src = a; for (o in d) k.setAttribute(o, d[o]); c = j ? h : c || f, k.onreadystatechange = k.onload = function () { !l && g(k.readyState) && (l = 1, c(), k.onload = k.onreadystatechange = null) }, m(function () { l || (l = 1, c(1)) }, e), i ? k.onload() : n.parentNode.insertBefore(k, n) }, a.yepnope.injectCss = function (a, c, d, e, g, i) { var e = b.createElement("link"), j, c = i ? h : c || f; e.href = a, e.rel = "stylesheet", e.type = "text/css"; for (j in d) e.setAttribute(j, d[j]); g || (n.parentNode.insertBefore(e, n), m(c, 0)) } }(this, document), Modernizr.load = function () { yepnope.apply(window, [].slice.call(arguments, 0)) };
;;;$(function () {
    //$(document).ajaxComplete(function (event, request, settings) {
    //    repositionFooter();
    //});

    documentReady();
});

function documentReady() {

}

function windowResized() {
    if (typeof console == "object") {
        console.info("windowResized");
    }
}

function repositionFooter() {
    if (typeof console == "object") {
        console.info("repositionFooter");
    }
}
;;;/*!
  * Bootstrap v4.0.0 (https://getbootstrap.com)
  * Copyright 2011-2018 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  */
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("jquery"),require("popper.js")):"function"==typeof define&&define.amd?define(["exports","jquery","popper.js"],e):e(t.bootstrap={},t.jQuery,t.Popper)}(this,function(t,e,n){"use strict";function i(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function s(t,e,n){return e&&i(t.prototype,e),n&&i(t,n),t}function r(){return(r=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t}).apply(this,arguments)}e=e&&e.hasOwnProperty("default")?e.default:e,n=n&&n.hasOwnProperty("default")?n.default:n;var o,a,l,h,c,u,f,d,_,g,p,m,v,E,T,y,C,I,A,b,D,S,w,N,O,k,P=function(t){var e=!1;function n(e){var n=this,s=!1;return t(this).one(i.TRANSITION_END,function(){s=!0}),setTimeout(function(){s||i.triggerTransitionEnd(n)},e),this}var i={TRANSITION_END:"bsTransitionEnd",getUID:function(t){do{t+=~~(1e6*Math.random())}while(document.getElementById(t));return t},getSelectorFromElement:function(e){var n,i=e.getAttribute("data-target");i&&"#"!==i||(i=e.getAttribute("href")||""),"#"===i.charAt(0)&&(n=i,i=n="function"==typeof t.escapeSelector?t.escapeSelector(n).substr(1):n.replace(/(:|\.|\[|\]|,|=|@)/g,"\\$1"));try{return t(document).find(i).length>0?i:null}catch(t){return null}},reflow:function(t){return t.offsetHeight},triggerTransitionEnd:function(n){t(n).trigger(e.end)},supportsTransitionEnd:function(){return Boolean(e)},isElement:function(t){return(t[0]||t).nodeType},typeCheckConfig:function(t,e,n){for(var s in n)if(Object.prototype.hasOwnProperty.call(n,s)){var r=n[s],o=e[s],a=o&&i.isElement(o)?"element":(l=o,{}.toString.call(l).match(/\s([a-zA-Z]+)/)[1].toLowerCase());if(!new RegExp(r).test(a))throw new Error(t.toUpperCase()+': Option "'+s+'" provided type "'+a+'" but expected type "'+r+'".')}var l}};return e=("undefined"==typeof window||!window.QUnit)&&{end:"transitionend"},t.fn.emulateTransitionEnd=n,i.supportsTransitionEnd()&&(t.event.special[i.TRANSITION_END]={bindType:e.end,delegateType:e.end,handle:function(e){if(t(e.target).is(this))return e.handleObj.handler.apply(this,arguments)}}),i}(e),L=(a="alert",h="."+(l="bs.alert"),c=(o=e).fn[a],u={CLOSE:"close"+h,CLOSED:"closed"+h,CLICK_DATA_API:"click"+h+".data-api"},f="alert",d="fade",_="show",g=function(){function t(t){this._element=t}var e=t.prototype;return e.close=function(t){t=t||this._element;var e=this._getRootElement(t);this._triggerCloseEvent(e).isDefaultPrevented()||this._removeElement(e)},e.dispose=function(){o.removeData(this._element,l),this._element=null},e._getRootElement=function(t){var e=P.getSelectorFromElement(t),n=!1;return e&&(n=o(e)[0]),n||(n=o(t).closest("."+f)[0]),n},e._triggerCloseEvent=function(t){var e=o.Event(u.CLOSE);return o(t).trigger(e),e},e._removeElement=function(t){var e=this;o(t).removeClass(_),P.supportsTransitionEnd()&&o(t).hasClass(d)?o(t).one(P.TRANSITION_END,function(n){return e._destroyElement(t,n)}).emulateTransitionEnd(150):this._destroyElement(t)},e._destroyElement=function(t){o(t).detach().trigger(u.CLOSED).remove()},t._jQueryInterface=function(e){return this.each(function(){var n=o(this),i=n.data(l);i||(i=new t(this),n.data(l,i)),"close"===e&&i[e](this)})},t._handleDismiss=function(t){return function(e){e&&e.preventDefault(),t.close(this)}},s(t,null,[{key:"VERSION",get:function(){return"4.0.0"}}]),t}(),o(document).on(u.CLICK_DATA_API,'[data-dismiss="alert"]',g._handleDismiss(new g)),o.fn[a]=g._jQueryInterface,o.fn[a].Constructor=g,o.fn[a].noConflict=function(){return o.fn[a]=c,g._jQueryInterface},g),R=(m="button",E="."+(v="bs.button"),T=".data-api",y=(p=e).fn[m],C="active",I="btn",A="focus",b='[data-toggle^="button"]',D='[data-toggle="buttons"]',S="input",w=".active",N=".btn",O={CLICK_DATA_API:"click"+E+T,FOCUS_BLUR_DATA_API:"focus"+E+T+" blur"+E+T},k=function(){function t(t){this._element=t}var e=t.prototype;return e.toggle=function(){var t=!0,e=!0,n=p(this._element).closest(D)[0];if(n){var i=p(this._element).find(S)[0];if(i){if("radio"===i.type)if(i.checked&&p(this._element).hasClass(C))t=!1;else{var s=p(n).find(w)[0];s&&p(s).removeClass(C)}if(t){if(i.hasAttribute("disabled")||n.hasAttribute("disabled")||i.classList.contains("disabled")||n.classList.contains("disabled"))return;i.checked=!p(this._element).hasClass(C),p(i).trigger("change")}i.focus(),e=!1}}e&&this._element.setAttribute("aria-pressed",!p(this._element).hasClass(C)),t&&p(this._element).toggleClass(C)},e.dispose=function(){p.removeData(this._element,v),this._element=null},t._jQueryInterface=function(e){return this.each(function(){var n=p(this).data(v);n||(n=new t(this),p(this).data(v,n)),"toggle"===e&&n[e]()})},s(t,null,[{key:"VERSION",get:function(){return"4.0.0"}}]),t}(),p(document).on(O.CLICK_DATA_API,b,function(t){t.preventDefault();var e=t.target;p(e).hasClass(I)||(e=p(e).closest(N)),k._jQueryInterface.call(p(e),"toggle")}).on(O.FOCUS_BLUR_DATA_API,b,function(t){var e=p(t.target).closest(N)[0];p(e).toggleClass(A,/^focus(in)?$/.test(t.type))}),p.fn[m]=k._jQueryInterface,p.fn[m].Constructor=k,p.fn[m].noConflict=function(){return p.fn[m]=y,k._jQueryInterface},k),j=function(t){var e="carousel",n="bs.carousel",i="."+n,o=t.fn[e],a={interval:5e3,keyboard:!0,slide:!1,pause:"hover",wrap:!0},l={interval:"(number|boolean)",keyboard:"boolean",slide:"(boolean|string)",pause:"(string|boolean)",wrap:"boolean"},h="next",c="prev",u="left",f="right",d={SLIDE:"slide"+i,SLID:"slid"+i,KEYDOWN:"keydown"+i,MOUSEENTER:"mouseenter"+i,MOUSELEAVE:"mouseleave"+i,TOUCHEND:"touchend"+i,LOAD_DATA_API:"load"+i+".data-api",CLICK_DATA_API:"click"+i+".data-api"},_="carousel",g="active",p="slide",m="carousel-item-right",v="carousel-item-left",E="carousel-item-next",T="carousel-item-prev",y={ACTIVE:".active",ACTIVE_ITEM:".active.carousel-item",ITEM:".carousel-item",NEXT_PREV:".carousel-item-next, .carousel-item-prev",INDICATORS:".carousel-indicators",DATA_SLIDE:"[data-slide], [data-slide-to]",DATA_RIDE:'[data-ride="carousel"]'},C=function(){function o(e,n){this._items=null,this._interval=null,this._activeElement=null,this._isPaused=!1,this._isSliding=!1,this.touchTimeout=null,this._config=this._getConfig(n),this._element=t(e)[0],this._indicatorsElement=t(this._element).find(y.INDICATORS)[0],this._addEventListeners()}var C=o.prototype;return C.next=function(){this._isSliding||this._slide(h)},C.nextWhenVisible=function(){!document.hidden&&t(this._element).is(":visible")&&"hidden"!==t(this._element).css("visibility")&&this.next()},C.prev=function(){this._isSliding||this._slide(c)},C.pause=function(e){e||(this._isPaused=!0),t(this._element).find(y.NEXT_PREV)[0]&&P.supportsTransitionEnd()&&(P.triggerTransitionEnd(this._element),this.cycle(!0)),clearInterval(this._interval),this._interval=null},C.cycle=function(t){t||(this._isPaused=!1),this._interval&&(clearInterval(this._interval),this._interval=null),this._config.interval&&!this._isPaused&&(this._interval=setInterval((document.visibilityState?this.nextWhenVisible:this.next).bind(this),this._config.interval))},C.to=function(e){var n=this;this._activeElement=t(this._element).find(y.ACTIVE_ITEM)[0];var i=this._getItemIndex(this._activeElement);if(!(e>this._items.length-1||e<0))if(this._isSliding)t(this._element).one(d.SLID,function(){return n.to(e)});else{if(i===e)return this.pause(),void this.cycle();var s=e>i?h:c;this._slide(s,this._items[e])}},C.dispose=function(){t(this._element).off(i),t.removeData(this._element,n),this._items=null,this._config=null,this._element=null,this._interval=null,this._isPaused=null,this._isSliding=null,this._activeElement=null,this._indicatorsElement=null},C._getConfig=function(t){return t=r({},a,t),P.typeCheckConfig(e,t,l),t},C._addEventListeners=function(){var e=this;this._config.keyboard&&t(this._element).on(d.KEYDOWN,function(t){return e._keydown(t)}),"hover"===this._config.pause&&(t(this._element).on(d.MOUSEENTER,function(t){return e.pause(t)}).on(d.MOUSELEAVE,function(t){return e.cycle(t)}),"ontouchstart"in document.documentElement&&t(this._element).on(d.TOUCHEND,function(){e.pause(),e.touchTimeout&&clearTimeout(e.touchTimeout),e.touchTimeout=setTimeout(function(t){return e.cycle(t)},500+e._config.interval)}))},C._keydown=function(t){if(!/input|textarea/i.test(t.target.tagName))switch(t.which){case 37:t.preventDefault(),this.prev();break;case 39:t.preventDefault(),this.next()}},C._getItemIndex=function(e){return this._items=t.makeArray(t(e).parent().find(y.ITEM)),this._items.indexOf(e)},C._getItemByDirection=function(t,e){var n=t===h,i=t===c,s=this._getItemIndex(e),r=this._items.length-1;if((i&&0===s||n&&s===r)&&!this._config.wrap)return e;var o=(s+(t===c?-1:1))%this._items.length;return-1===o?this._items[this._items.length-1]:this._items[o]},C._triggerSlideEvent=function(e,n){var i=this._getItemIndex(e),s=this._getItemIndex(t(this._element).find(y.ACTIVE_ITEM)[0]),r=t.Event(d.SLIDE,{relatedTarget:e,direction:n,from:s,to:i});return t(this._element).trigger(r),r},C._setActiveIndicatorElement=function(e){if(this._indicatorsElement){t(this._indicatorsElement).find(y.ACTIVE).removeClass(g);var n=this._indicatorsElement.children[this._getItemIndex(e)];n&&t(n).addClass(g)}},C._slide=function(e,n){var i,s,r,o=this,a=t(this._element).find(y.ACTIVE_ITEM)[0],l=this._getItemIndex(a),c=n||a&&this._getItemByDirection(e,a),_=this._getItemIndex(c),C=Boolean(this._interval);if(e===h?(i=v,s=E,r=u):(i=m,s=T,r=f),c&&t(c).hasClass(g))this._isSliding=!1;else if(!this._triggerSlideEvent(c,r).isDefaultPrevented()&&a&&c){this._isSliding=!0,C&&this.pause(),this._setActiveIndicatorElement(c);var I=t.Event(d.SLID,{relatedTarget:c,direction:r,from:l,to:_});P.supportsTransitionEnd()&&t(this._element).hasClass(p)?(t(c).addClass(s),P.reflow(c),t(a).addClass(i),t(c).addClass(i),t(a).one(P.TRANSITION_END,function(){t(c).removeClass(i+" "+s).addClass(g),t(a).removeClass(g+" "+s+" "+i),o._isSliding=!1,setTimeout(function(){return t(o._element).trigger(I)},0)}).emulateTransitionEnd(600)):(t(a).removeClass(g),t(c).addClass(g),this._isSliding=!1,t(this._element).trigger(I)),C&&this.cycle()}},o._jQueryInterface=function(e){return this.each(function(){var i=t(this).data(n),s=r({},a,t(this).data());"object"==typeof e&&(s=r({},s,e));var l="string"==typeof e?e:s.slide;if(i||(i=new o(this,s),t(this).data(n,i)),"number"==typeof e)i.to(e);else if("string"==typeof l){if("undefined"==typeof i[l])throw new TypeError('No method named "'+l+'"');i[l]()}else s.interval&&(i.pause(),i.cycle())})},o._dataApiClickHandler=function(e){var i=P.getSelectorFromElement(this);if(i){var s=t(i)[0];if(s&&t(s).hasClass(_)){var a=r({},t(s).data(),t(this).data()),l=this.getAttribute("data-slide-to");l&&(a.interval=!1),o._jQueryInterface.call(t(s),a),l&&t(s).data(n).to(l),e.preventDefault()}}},s(o,null,[{key:"VERSION",get:function(){return"4.0.0"}},{key:"Default",get:function(){return a}}]),o}();return t(document).on(d.CLICK_DATA_API,y.DATA_SLIDE,C._dataApiClickHandler),t(window).on(d.LOAD_DATA_API,function(){t(y.DATA_RIDE).each(function(){var e=t(this);C._jQueryInterface.call(e,e.data())})}),t.fn[e]=C._jQueryInterface,t.fn[e].Constructor=C,t.fn[e].noConflict=function(){return t.fn[e]=o,C._jQueryInterface},C}(e),H=function(t){var e="collapse",n="bs.collapse",i="."+n,o=t.fn[e],a={toggle:!0,parent:""},l={toggle:"boolean",parent:"(string|element)"},h={SHOW:"show"+i,SHOWN:"shown"+i,HIDE:"hide"+i,HIDDEN:"hidden"+i,CLICK_DATA_API:"click"+i+".data-api"},c="show",u="collapse",f="collapsing",d="collapsed",_="width",g="height",p={ACTIVES:".show, .collapsing",DATA_TOGGLE:'[data-toggle="collapse"]'},m=function(){function i(e,n){this._isTransitioning=!1,this._element=e,this._config=this._getConfig(n),this._triggerArray=t.makeArray(t('[data-toggle="collapse"][href="#'+e.id+'"],[data-toggle="collapse"][data-target="#'+e.id+'"]'));for(var i=t(p.DATA_TOGGLE),s=0;s<i.length;s++){var r=i[s],o=P.getSelectorFromElement(r);null!==o&&t(o).filter(e).length>0&&(this._selector=o,this._triggerArray.push(r))}this._parent=this._config.parent?this._getParent():null,this._config.parent||this._addAriaAndCollapsedClass(this._element,this._triggerArray),this._config.toggle&&this.toggle()}var o=i.prototype;return o.toggle=function(){t(this._element).hasClass(c)?this.hide():this.show()},o.show=function(){var e,s,r=this;if(!this._isTransitioning&&!t(this._element).hasClass(c)&&(this._parent&&0===(e=t.makeArray(t(this._parent).find(p.ACTIVES).filter('[data-parent="'+this._config.parent+'"]'))).length&&(e=null),!(e&&(s=t(e).not(this._selector).data(n))&&s._isTransitioning))){var o=t.Event(h.SHOW);if(t(this._element).trigger(o),!o.isDefaultPrevented()){e&&(i._jQueryInterface.call(t(e).not(this._selector),"hide"),s||t(e).data(n,null));var a=this._getDimension();t(this._element).removeClass(u).addClass(f),this._element.style[a]=0,this._triggerArray.length>0&&t(this._triggerArray).removeClass(d).attr("aria-expanded",!0),this.setTransitioning(!0);var l=function(){t(r._element).removeClass(f).addClass(u).addClass(c),r._element.style[a]="",r.setTransitioning(!1),t(r._element).trigger(h.SHOWN)};if(P.supportsTransitionEnd()){var _="scroll"+(a[0].toUpperCase()+a.slice(1));t(this._element).one(P.TRANSITION_END,l).emulateTransitionEnd(600),this._element.style[a]=this._element[_]+"px"}else l()}}},o.hide=function(){var e=this;if(!this._isTransitioning&&t(this._element).hasClass(c)){var n=t.Event(h.HIDE);if(t(this._element).trigger(n),!n.isDefaultPrevented()){var i=this._getDimension();if(this._element.style[i]=this._element.getBoundingClientRect()[i]+"px",P.reflow(this._element),t(this._element).addClass(f).removeClass(u).removeClass(c),this._triggerArray.length>0)for(var s=0;s<this._triggerArray.length;s++){var r=this._triggerArray[s],o=P.getSelectorFromElement(r);if(null!==o)t(o).hasClass(c)||t(r).addClass(d).attr("aria-expanded",!1)}this.setTransitioning(!0);var a=function(){e.setTransitioning(!1),t(e._element).removeClass(f).addClass(u).trigger(h.HIDDEN)};this._element.style[i]="",P.supportsTransitionEnd()?t(this._element).one(P.TRANSITION_END,a).emulateTransitionEnd(600):a()}}},o.setTransitioning=function(t){this._isTransitioning=t},o.dispose=function(){t.removeData(this._element,n),this._config=null,this._parent=null,this._element=null,this._triggerArray=null,this._isTransitioning=null},o._getConfig=function(t){return(t=r({},a,t)).toggle=Boolean(t.toggle),P.typeCheckConfig(e,t,l),t},o._getDimension=function(){return t(this._element).hasClass(_)?_:g},o._getParent=function(){var e=this,n=null;P.isElement(this._config.parent)?(n=this._config.parent,"undefined"!=typeof this._config.parent.jquery&&(n=this._config.parent[0])):n=t(this._config.parent)[0];var s='[data-toggle="collapse"][data-parent="'+this._config.parent+'"]';return t(n).find(s).each(function(t,n){e._addAriaAndCollapsedClass(i._getTargetFromElement(n),[n])}),n},o._addAriaAndCollapsedClass=function(e,n){if(e){var i=t(e).hasClass(c);n.length>0&&t(n).toggleClass(d,!i).attr("aria-expanded",i)}},i._getTargetFromElement=function(e){var n=P.getSelectorFromElement(e);return n?t(n)[0]:null},i._jQueryInterface=function(e){return this.each(function(){var s=t(this),o=s.data(n),l=r({},a,s.data(),"object"==typeof e&&e);if(!o&&l.toggle&&/show|hide/.test(e)&&(l.toggle=!1),o||(o=new i(this,l),s.data(n,o)),"string"==typeof e){if("undefined"==typeof o[e])throw new TypeError('No method named "'+e+'"');o[e]()}})},s(i,null,[{key:"VERSION",get:function(){return"4.0.0"}},{key:"Default",get:function(){return a}}]),i}();return t(document).on(h.CLICK_DATA_API,p.DATA_TOGGLE,function(e){"A"===e.currentTarget.tagName&&e.preventDefault();var i=t(this),s=P.getSelectorFromElement(this);t(s).each(function(){var e=t(this),s=e.data(n)?"toggle":i.data();m._jQueryInterface.call(e,s)})}),t.fn[e]=m._jQueryInterface,t.fn[e].Constructor=m,t.fn[e].noConflict=function(){return t.fn[e]=o,m._jQueryInterface},m}(e),W=function(t){var e="dropdown",i="bs.dropdown",o="."+i,a=".data-api",l=t.fn[e],h=new RegExp("38|40|27"),c={HIDE:"hide"+o,HIDDEN:"hidden"+o,SHOW:"show"+o,SHOWN:"shown"+o,CLICK:"click"+o,CLICK_DATA_API:"click"+o+a,KEYDOWN_DATA_API:"keydown"+o+a,KEYUP_DATA_API:"keyup"+o+a},u="disabled",f="show",d="dropup",_="dropright",g="dropleft",p="dropdown-menu-right",m="dropdown-menu-left",v="position-static",E='[data-toggle="dropdown"]',T=".dropdown form",y=".dropdown-menu",C=".navbar-nav",I=".dropdown-menu .dropdown-item:not(.disabled)",A="top-start",b="top-end",D="bottom-start",S="bottom-end",w="right-start",N="left-start",O={offset:0,flip:!0,boundary:"scrollParent"},k={offset:"(number|string|function)",flip:"boolean",boundary:"(string|element)"},L=function(){function a(t,e){this._element=t,this._popper=null,this._config=this._getConfig(e),this._menu=this._getMenuElement(),this._inNavbar=this._detectNavbar(),this._addEventListeners()}var l=a.prototype;return l.toggle=function(){if(!this._element.disabled&&!t(this._element).hasClass(u)){var e=a._getParentFromElement(this._element),i=t(this._menu).hasClass(f);if(a._clearMenus(),!i){var s={relatedTarget:this._element},r=t.Event(c.SHOW,s);if(t(e).trigger(r),!r.isDefaultPrevented()){if(!this._inNavbar){if("undefined"==typeof n)throw new TypeError("Bootstrap dropdown require Popper.js (https://popper.js.org)");var o=this._element;t(e).hasClass(d)&&(t(this._menu).hasClass(m)||t(this._menu).hasClass(p))&&(o=e),"scrollParent"!==this._config.boundary&&t(e).addClass(v),this._popper=new n(o,this._menu,this._getPopperConfig())}"ontouchstart"in document.documentElement&&0===t(e).closest(C).length&&t("body").children().on("mouseover",null,t.noop),this._element.focus(),this._element.setAttribute("aria-expanded",!0),t(this._menu).toggleClass(f),t(e).toggleClass(f).trigger(t.Event(c.SHOWN,s))}}}},l.dispose=function(){t.removeData(this._element,i),t(this._element).off(o),this._element=null,this._menu=null,null!==this._popper&&(this._popper.destroy(),this._popper=null)},l.update=function(){this._inNavbar=this._detectNavbar(),null!==this._popper&&this._popper.scheduleUpdate()},l._addEventListeners=function(){var e=this;t(this._element).on(c.CLICK,function(t){t.preventDefault(),t.stopPropagation(),e.toggle()})},l._getConfig=function(n){return n=r({},this.constructor.Default,t(this._element).data(),n),P.typeCheckConfig(e,n,this.constructor.DefaultType),n},l._getMenuElement=function(){if(!this._menu){var e=a._getParentFromElement(this._element);this._menu=t(e).find(y)[0]}return this._menu},l._getPlacement=function(){var e=t(this._element).parent(),n=D;return e.hasClass(d)?(n=A,t(this._menu).hasClass(p)&&(n=b)):e.hasClass(_)?n=w:e.hasClass(g)?n=N:t(this._menu).hasClass(p)&&(n=S),n},l._detectNavbar=function(){return t(this._element).closest(".navbar").length>0},l._getPopperConfig=function(){var t=this,e={};return"function"==typeof this._config.offset?e.fn=function(e){return e.offsets=r({},e.offsets,t._config.offset(e.offsets)||{}),e}:e.offset=this._config.offset,{placement:this._getPlacement(),modifiers:{offset:e,flip:{enabled:this._config.flip},preventOverflow:{boundariesElement:this._config.boundary}}}},a._jQueryInterface=function(e){return this.each(function(){var n=t(this).data(i);if(n||(n=new a(this,"object"==typeof e?e:null),t(this).data(i,n)),"string"==typeof e){if("undefined"==typeof n[e])throw new TypeError('No method named "'+e+'"');n[e]()}})},a._clearMenus=function(e){if(!e||3!==e.which&&("keyup"!==e.type||9===e.which))for(var n=t.makeArray(t(E)),s=0;s<n.length;s++){var r=a._getParentFromElement(n[s]),o=t(n[s]).data(i),l={relatedTarget:n[s]};if(o){var h=o._menu;if(t(r).hasClass(f)&&!(e&&("click"===e.type&&/input|textarea/i.test(e.target.tagName)||"keyup"===e.type&&9===e.which)&&t.contains(r,e.target))){var u=t.Event(c.HIDE,l);t(r).trigger(u),u.isDefaultPrevented()||("ontouchstart"in document.documentElement&&t("body").children().off("mouseover",null,t.noop),n[s].setAttribute("aria-expanded","false"),t(h).removeClass(f),t(r).removeClass(f).trigger(t.Event(c.HIDDEN,l)))}}}},a._getParentFromElement=function(e){var n,i=P.getSelectorFromElement(e);return i&&(n=t(i)[0]),n||e.parentNode},a._dataApiKeydownHandler=function(e){if((/input|textarea/i.test(e.target.tagName)?!(32===e.which||27!==e.which&&(40!==e.which&&38!==e.which||t(e.target).closest(y).length)):h.test(e.which))&&(e.preventDefault(),e.stopPropagation(),!this.disabled&&!t(this).hasClass(u))){var n=a._getParentFromElement(this),i=t(n).hasClass(f);if((i||27===e.which&&32===e.which)&&(!i||27!==e.which&&32!==e.which)){var s=t(n).find(I).get();if(0!==s.length){var r=s.indexOf(e.target);38===e.which&&r>0&&r--,40===e.which&&r<s.length-1&&r++,r<0&&(r=0),s[r].focus()}}else{if(27===e.which){var o=t(n).find(E)[0];t(o).trigger("focus")}t(this).trigger("click")}}},s(a,null,[{key:"VERSION",get:function(){return"4.0.0"}},{key:"Default",get:function(){return O}},{key:"DefaultType",get:function(){return k}}]),a}();return t(document).on(c.KEYDOWN_DATA_API,E,L._dataApiKeydownHandler).on(c.KEYDOWN_DATA_API,y,L._dataApiKeydownHandler).on(c.CLICK_DATA_API+" "+c.KEYUP_DATA_API,L._clearMenus).on(c.CLICK_DATA_API,E,function(e){e.preventDefault(),e.stopPropagation(),L._jQueryInterface.call(t(this),"toggle")}).on(c.CLICK_DATA_API,T,function(t){t.stopPropagation()}),t.fn[e]=L._jQueryInterface,t.fn[e].Constructor=L,t.fn[e].noConflict=function(){return t.fn[e]=l,L._jQueryInterface},L}(e),M=function(t){var e="modal",n="bs.modal",i="."+n,o=t.fn.modal,a={backdrop:!0,keyboard:!0,focus:!0,show:!0},l={backdrop:"(boolean|string)",keyboard:"boolean",focus:"boolean",show:"boolean"},h={HIDE:"hide"+i,HIDDEN:"hidden"+i,SHOW:"show"+i,SHOWN:"shown"+i,FOCUSIN:"focusin"+i,RESIZE:"resize"+i,CLICK_DISMISS:"click.dismiss"+i,KEYDOWN_DISMISS:"keydown.dismiss"+i,MOUSEUP_DISMISS:"mouseup.dismiss"+i,MOUSEDOWN_DISMISS:"mousedown.dismiss"+i,CLICK_DATA_API:"click"+i+".data-api"},c="modal-scrollbar-measure",u="modal-backdrop",f="modal-open",d="fade",_="show",g={DIALOG:".modal-dialog",DATA_TOGGLE:'[data-toggle="modal"]',DATA_DISMISS:'[data-dismiss="modal"]',FIXED_CONTENT:".fixed-top, .fixed-bottom, .is-fixed, .sticky-top",STICKY_CONTENT:".sticky-top",NAVBAR_TOGGLER:".navbar-toggler"},p=function(){function o(e,n){this._config=this._getConfig(n),this._element=e,this._dialog=t(e).find(g.DIALOG)[0],this._backdrop=null,this._isShown=!1,this._isBodyOverflowing=!1,this._ignoreBackdropClick=!1,this._originalBodyPadding=0,this._scrollbarWidth=0}var p=o.prototype;return p.toggle=function(t){return this._isShown?this.hide():this.show(t)},p.show=function(e){var n=this;if(!this._isTransitioning&&!this._isShown){P.supportsTransitionEnd()&&t(this._element).hasClass(d)&&(this._isTransitioning=!0);var i=t.Event(h.SHOW,{relatedTarget:e});t(this._element).trigger(i),this._isShown||i.isDefaultPrevented()||(this._isShown=!0,this._checkScrollbar(),this._setScrollbar(),this._adjustDialog(),t(document.body).addClass(f),this._setEscapeEvent(),this._setResizeEvent(),t(this._element).on(h.CLICK_DISMISS,g.DATA_DISMISS,function(t){return n.hide(t)}),t(this._dialog).on(h.MOUSEDOWN_DISMISS,function(){t(n._element).one(h.MOUSEUP_DISMISS,function(e){t(e.target).is(n._element)&&(n._ignoreBackdropClick=!0)})}),this._showBackdrop(function(){return n._showElement(e)}))}},p.hide=function(e){var n=this;if(e&&e.preventDefault(),!this._isTransitioning&&this._isShown){var i=t.Event(h.HIDE);if(t(this._element).trigger(i),this._isShown&&!i.isDefaultPrevented()){this._isShown=!1;var s=P.supportsTransitionEnd()&&t(this._element).hasClass(d);s&&(this._isTransitioning=!0),this._setEscapeEvent(),this._setResizeEvent(),t(document).off(h.FOCUSIN),t(this._element).removeClass(_),t(this._element).off(h.CLICK_DISMISS),t(this._dialog).off(h.MOUSEDOWN_DISMISS),s?t(this._element).one(P.TRANSITION_END,function(t){return n._hideModal(t)}).emulateTransitionEnd(300):this._hideModal()}}},p.dispose=function(){t.removeData(this._element,n),t(window,document,this._element,this._backdrop).off(i),this._config=null,this._element=null,this._dialog=null,this._backdrop=null,this._isShown=null,this._isBodyOverflowing=null,this._ignoreBackdropClick=null,this._scrollbarWidth=null},p.handleUpdate=function(){this._adjustDialog()},p._getConfig=function(t){return t=r({},a,t),P.typeCheckConfig(e,t,l),t},p._showElement=function(e){var n=this,i=P.supportsTransitionEnd()&&t(this._element).hasClass(d);this._element.parentNode&&this._element.parentNode.nodeType===Node.ELEMENT_NODE||document.body.appendChild(this._element),this._element.style.display="block",this._element.removeAttribute("aria-hidden"),this._element.scrollTop=0,i&&P.reflow(this._element),t(this._element).addClass(_),this._config.focus&&this._enforceFocus();var s=t.Event(h.SHOWN,{relatedTarget:e}),r=function(){n._config.focus&&n._element.focus(),n._isTransitioning=!1,t(n._element).trigger(s)};i?t(this._dialog).one(P.TRANSITION_END,r).emulateTransitionEnd(300):r()},p._enforceFocus=function(){var e=this;t(document).off(h.FOCUSIN).on(h.FOCUSIN,function(n){document!==n.target&&e._element!==n.target&&0===t(e._element).has(n.target).length&&e._element.focus()})},p._setEscapeEvent=function(){var e=this;this._isShown&&this._config.keyboard?t(this._element).on(h.KEYDOWN_DISMISS,function(t){27===t.which&&(t.preventDefault(),e.hide())}):this._isShown||t(this._element).off(h.KEYDOWN_DISMISS)},p._setResizeEvent=function(){var e=this;this._isShown?t(window).on(h.RESIZE,function(t){return e.handleUpdate(t)}):t(window).off(h.RESIZE)},p._hideModal=function(){var e=this;this._element.style.display="none",this._element.setAttribute("aria-hidden",!0),this._isTransitioning=!1,this._showBackdrop(function(){t(document.body).removeClass(f),e._resetAdjustments(),e._resetScrollbar(),t(e._element).trigger(h.HIDDEN)})},p._removeBackdrop=function(){this._backdrop&&(t(this._backdrop).remove(),this._backdrop=null)},p._showBackdrop=function(e){var n=this,i=t(this._element).hasClass(d)?d:"";if(this._isShown&&this._config.backdrop){var s=P.supportsTransitionEnd()&&i;if(this._backdrop=document.createElement("div"),this._backdrop.className=u,i&&t(this._backdrop).addClass(i),t(this._backdrop).appendTo(document.body),t(this._element).on(h.CLICK_DISMISS,function(t){n._ignoreBackdropClick?n._ignoreBackdropClick=!1:t.target===t.currentTarget&&("static"===n._config.backdrop?n._element.focus():n.hide())}),s&&P.reflow(this._backdrop),t(this._backdrop).addClass(_),!e)return;if(!s)return void e();t(this._backdrop).one(P.TRANSITION_END,e).emulateTransitionEnd(150)}else if(!this._isShown&&this._backdrop){t(this._backdrop).removeClass(_);var r=function(){n._removeBackdrop(),e&&e()};P.supportsTransitionEnd()&&t(this._element).hasClass(d)?t(this._backdrop).one(P.TRANSITION_END,r).emulateTransitionEnd(150):r()}else e&&e()},p._adjustDialog=function(){var t=this._element.scrollHeight>document.documentElement.clientHeight;!this._isBodyOverflowing&&t&&(this._element.style.paddingLeft=this._scrollbarWidth+"px"),this._isBodyOverflowing&&!t&&(this._element.style.paddingRight=this._scrollbarWidth+"px")},p._resetAdjustments=function(){this._element.style.paddingLeft="",this._element.style.paddingRight=""},p._checkScrollbar=function(){var t=document.body.getBoundingClientRect();this._isBodyOverflowing=t.left+t.right<window.innerWidth,this._scrollbarWidth=this._getScrollbarWidth()},p._setScrollbar=function(){var e=this;if(this._isBodyOverflowing){t(g.FIXED_CONTENT).each(function(n,i){var s=t(i)[0].style.paddingRight,r=t(i).css("padding-right");t(i).data("padding-right",s).css("padding-right",parseFloat(r)+e._scrollbarWidth+"px")}),t(g.STICKY_CONTENT).each(function(n,i){var s=t(i)[0].style.marginRight,r=t(i).css("margin-right");t(i).data("margin-right",s).css("margin-right",parseFloat(r)-e._scrollbarWidth+"px")}),t(g.NAVBAR_TOGGLER).each(function(n,i){var s=t(i)[0].style.marginRight,r=t(i).css("margin-right");t(i).data("margin-right",s).css("margin-right",parseFloat(r)+e._scrollbarWidth+"px")});var n=document.body.style.paddingRight,i=t("body").css("padding-right");t("body").data("padding-right",n).css("padding-right",parseFloat(i)+this._scrollbarWidth+"px")}},p._resetScrollbar=function(){t(g.FIXED_CONTENT).each(function(e,n){var i=t(n).data("padding-right");"undefined"!=typeof i&&t(n).css("padding-right",i).removeData("padding-right")}),t(g.STICKY_CONTENT+", "+g.NAVBAR_TOGGLER).each(function(e,n){var i=t(n).data("margin-right");"undefined"!=typeof i&&t(n).css("margin-right",i).removeData("margin-right")});var e=t("body").data("padding-right");"undefined"!=typeof e&&t("body").css("padding-right",e).removeData("padding-right")},p._getScrollbarWidth=function(){var t=document.createElement("div");t.className=c,document.body.appendChild(t);var e=t.getBoundingClientRect().width-t.clientWidth;return document.body.removeChild(t),e},o._jQueryInterface=function(e,i){return this.each(function(){var s=t(this).data(n),a=r({},o.Default,t(this).data(),"object"==typeof e&&e);if(s||(s=new o(this,a),t(this).data(n,s)),"string"==typeof e){if("undefined"==typeof s[e])throw new TypeError('No method named "'+e+'"');s[e](i)}else a.show&&s.show(i)})},s(o,null,[{key:"VERSION",get:function(){return"4.0.0"}},{key:"Default",get:function(){return a}}]),o}();return t(document).on(h.CLICK_DATA_API,g.DATA_TOGGLE,function(e){var i,s=this,o=P.getSelectorFromElement(this);o&&(i=t(o)[0]);var a=t(i).data(n)?"toggle":r({},t(i).data(),t(this).data());"A"!==this.tagName&&"AREA"!==this.tagName||e.preventDefault();var l=t(i).one(h.SHOW,function(e){e.isDefaultPrevented()||l.one(h.HIDDEN,function(){t(s).is(":visible")&&s.focus()})});p._jQueryInterface.call(t(i),a,this)}),t.fn.modal=p._jQueryInterface,t.fn.modal.Constructor=p,t.fn.modal.noConflict=function(){return t.fn.modal=o,p._jQueryInterface},p}(e),U=function(t){var e="tooltip",i="bs.tooltip",o="."+i,a=t.fn[e],l=new RegExp("(^|\\s)bs-tooltip\\S+","g"),h={animation:"boolean",template:"string",title:"(string|element|function)",trigger:"string",delay:"(number|object)",html:"boolean",selector:"(string|boolean)",placement:"(string|function)",offset:"(number|string)",container:"(string|element|boolean)",fallbackPlacement:"(string|array)",boundary:"(string|element)"},c={AUTO:"auto",TOP:"top",RIGHT:"right",BOTTOM:"bottom",LEFT:"left"},u={animation:!0,template:'<div class="tooltip" role="tooltip"><div class="arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover focus",title:"",delay:0,html:!1,selector:!1,placement:"top",offset:0,container:!1,fallbackPlacement:"flip",boundary:"scrollParent"},f="show",d="out",_={HIDE:"hide"+o,HIDDEN:"hidden"+o,SHOW:"show"+o,SHOWN:"shown"+o,INSERTED:"inserted"+o,CLICK:"click"+o,FOCUSIN:"focusin"+o,FOCUSOUT:"focusout"+o,MOUSEENTER:"mouseenter"+o,MOUSELEAVE:"mouseleave"+o},g="fade",p="show",m=".tooltip-inner",v=".arrow",E="hover",T="focus",y="click",C="manual",I=function(){function a(t,e){if("undefined"==typeof n)throw new TypeError("Bootstrap tooltips require Popper.js (https://popper.js.org)");this._isEnabled=!0,this._timeout=0,this._hoverState="",this._activeTrigger={},this._popper=null,this.element=t,this.config=this._getConfig(e),this.tip=null,this._setListeners()}var I=a.prototype;return I.enable=function(){this._isEnabled=!0},I.disable=function(){this._isEnabled=!1},I.toggleEnabled=function(){this._isEnabled=!this._isEnabled},I.toggle=function(e){if(this._isEnabled)if(e){var n=this.constructor.DATA_KEY,i=t(e.currentTarget).data(n);i||(i=new this.constructor(e.currentTarget,this._getDelegateConfig()),t(e.currentTarget).data(n,i)),i._activeTrigger.click=!i._activeTrigger.click,i._isWithActiveTrigger()?i._enter(null,i):i._leave(null,i)}else{if(t(this.getTipElement()).hasClass(p))return void this._leave(null,this);this._enter(null,this)}},I.dispose=function(){clearTimeout(this._timeout),t.removeData(this.element,this.constructor.DATA_KEY),t(this.element).off(this.constructor.EVENT_KEY),t(this.element).closest(".modal").off("hide.bs.modal"),this.tip&&t(this.tip).remove(),this._isEnabled=null,this._timeout=null,this._hoverState=null,this._activeTrigger=null,null!==this._popper&&this._popper.destroy(),this._popper=null,this.element=null,this.config=null,this.tip=null},I.show=function(){var e=this;if("none"===t(this.element).css("display"))throw new Error("Please use show on visible elements");var i=t.Event(this.constructor.Event.SHOW);if(this.isWithContent()&&this._isEnabled){t(this.element).trigger(i);var s=t.contains(this.element.ownerDocument.documentElement,this.element);if(i.isDefaultPrevented()||!s)return;var r=this.getTipElement(),o=P.getUID(this.constructor.NAME);r.setAttribute("id",o),this.element.setAttribute("aria-describedby",o),this.setContent(),this.config.animation&&t(r).addClass(g);var l="function"==typeof this.config.placement?this.config.placement.call(this,r,this.element):this.config.placement,h=this._getAttachment(l);this.addAttachmentClass(h);var c=!1===this.config.container?document.body:t(this.config.container);t(r).data(this.constructor.DATA_KEY,this),t.contains(this.element.ownerDocument.documentElement,this.tip)||t(r).appendTo(c),t(this.element).trigger(this.constructor.Event.INSERTED),this._popper=new n(this.element,r,{placement:h,modifiers:{offset:{offset:this.config.offset},flip:{behavior:this.config.fallbackPlacement},arrow:{element:v},preventOverflow:{boundariesElement:this.config.boundary}},onCreate:function(t){t.originalPlacement!==t.placement&&e._handlePopperPlacementChange(t)},onUpdate:function(t){e._handlePopperPlacementChange(t)}}),t(r).addClass(p),"ontouchstart"in document.documentElement&&t("body").children().on("mouseover",null,t.noop);var u=function(){e.config.animation&&e._fixTransition();var n=e._hoverState;e._hoverState=null,t(e.element).trigger(e.constructor.Event.SHOWN),n===d&&e._leave(null,e)};P.supportsTransitionEnd()&&t(this.tip).hasClass(g)?t(this.tip).one(P.TRANSITION_END,u).emulateTransitionEnd(a._TRANSITION_DURATION):u()}},I.hide=function(e){var n=this,i=this.getTipElement(),s=t.Event(this.constructor.Event.HIDE),r=function(){n._hoverState!==f&&i.parentNode&&i.parentNode.removeChild(i),n._cleanTipClass(),n.element.removeAttribute("aria-describedby"),t(n.element).trigger(n.constructor.Event.HIDDEN),null!==n._popper&&n._popper.destroy(),e&&e()};t(this.element).trigger(s),s.isDefaultPrevented()||(t(i).removeClass(p),"ontouchstart"in document.documentElement&&t("body").children().off("mouseover",null,t.noop),this._activeTrigger[y]=!1,this._activeTrigger[T]=!1,this._activeTrigger[E]=!1,P.supportsTransitionEnd()&&t(this.tip).hasClass(g)?t(i).one(P.TRANSITION_END,r).emulateTransitionEnd(150):r(),this._hoverState="")},I.update=function(){null!==this._popper&&this._popper.scheduleUpdate()},I.isWithContent=function(){return Boolean(this.getTitle())},I.addAttachmentClass=function(e){t(this.getTipElement()).addClass("bs-tooltip-"+e)},I.getTipElement=function(){return this.tip=this.tip||t(this.config.template)[0],this.tip},I.setContent=function(){var e=t(this.getTipElement());this.setElementContent(e.find(m),this.getTitle()),e.removeClass(g+" "+p)},I.setElementContent=function(e,n){var i=this.config.html;"object"==typeof n&&(n.nodeType||n.jquery)?i?t(n).parent().is(e)||e.empty().append(n):e.text(t(n).text()):e[i?"html":"text"](n)},I.getTitle=function(){var t=this.element.getAttribute("data-original-title");return t||(t="function"==typeof this.config.title?this.config.title.call(this.element):this.config.title),t},I._getAttachment=function(t){return c[t.toUpperCase()]},I._setListeners=function(){var e=this;this.config.trigger.split(" ").forEach(function(n){if("click"===n)t(e.element).on(e.constructor.Event.CLICK,e.config.selector,function(t){return e.toggle(t)});else if(n!==C){var i=n===E?e.constructor.Event.MOUSEENTER:e.constructor.Event.FOCUSIN,s=n===E?e.constructor.Event.MOUSELEAVE:e.constructor.Event.FOCUSOUT;t(e.element).on(i,e.config.selector,function(t){return e._enter(t)}).on(s,e.config.selector,function(t){return e._leave(t)})}t(e.element).closest(".modal").on("hide.bs.modal",function(){return e.hide()})}),this.config.selector?this.config=r({},this.config,{trigger:"manual",selector:""}):this._fixTitle()},I._fixTitle=function(){var t=typeof this.element.getAttribute("data-original-title");(this.element.getAttribute("title")||"string"!==t)&&(this.element.setAttribute("data-original-title",this.element.getAttribute("title")||""),this.element.setAttribute("title",""))},I._enter=function(e,n){var i=this.constructor.DATA_KEY;(n=n||t(e.currentTarget).data(i))||(n=new this.constructor(e.currentTarget,this._getDelegateConfig()),t(e.currentTarget).data(i,n)),e&&(n._activeTrigger["focusin"===e.type?T:E]=!0),t(n.getTipElement()).hasClass(p)||n._hoverState===f?n._hoverState=f:(clearTimeout(n._timeout),n._hoverState=f,n.config.delay&&n.config.delay.show?n._timeout=setTimeout(function(){n._hoverState===f&&n.show()},n.config.delay.show):n.show())},I._leave=function(e,n){var i=this.constructor.DATA_KEY;(n=n||t(e.currentTarget).data(i))||(n=new this.constructor(e.currentTarget,this._getDelegateConfig()),t(e.currentTarget).data(i,n)),e&&(n._activeTrigger["focusout"===e.type?T:E]=!1),n._isWithActiveTrigger()||(clearTimeout(n._timeout),n._hoverState=d,n.config.delay&&n.config.delay.hide?n._timeout=setTimeout(function(){n._hoverState===d&&n.hide()},n.config.delay.hide):n.hide())},I._isWithActiveTrigger=function(){for(var t in this._activeTrigger)if(this._activeTrigger[t])return!0;return!1},I._getConfig=function(n){return"number"==typeof(n=r({},this.constructor.Default,t(this.element).data(),n)).delay&&(n.delay={show:n.delay,hide:n.delay}),"number"==typeof n.title&&(n.title=n.title.toString()),"number"==typeof n.content&&(n.content=n.content.toString()),P.typeCheckConfig(e,n,this.constructor.DefaultType),n},I._getDelegateConfig=function(){var t={};if(this.config)for(var e in this.config)this.constructor.Default[e]!==this.config[e]&&(t[e]=this.config[e]);return t},I._cleanTipClass=function(){var e=t(this.getTipElement()),n=e.attr("class").match(l);null!==n&&n.length>0&&e.removeClass(n.join(""))},I._handlePopperPlacementChange=function(t){this._cleanTipClass(),this.addAttachmentClass(this._getAttachment(t.placement))},I._fixTransition=function(){var e=this.getTipElement(),n=this.config.animation;null===e.getAttribute("x-placement")&&(t(e).removeClass(g),this.config.animation=!1,this.hide(),this.show(),this.config.animation=n)},a._jQueryInterface=function(e){return this.each(function(){var n=t(this).data(i),s="object"==typeof e&&e;if((n||!/dispose|hide/.test(e))&&(n||(n=new a(this,s),t(this).data(i,n)),"string"==typeof e)){if("undefined"==typeof n[e])throw new TypeError('No method named "'+e+'"');n[e]()}})},s(a,null,[{key:"VERSION",get:function(){return"4.0.0"}},{key:"Default",get:function(){return u}},{key:"NAME",get:function(){return e}},{key:"DATA_KEY",get:function(){return i}},{key:"Event",get:function(){return _}},{key:"EVENT_KEY",get:function(){return o}},{key:"DefaultType",get:function(){return h}}]),a}();return t.fn[e]=I._jQueryInterface,t.fn[e].Constructor=I,t.fn[e].noConflict=function(){return t.fn[e]=a,I._jQueryInterface},I}(e),x=function(t){var e="popover",n="bs.popover",i="."+n,o=t.fn[e],a=new RegExp("(^|\\s)bs-popover\\S+","g"),l=r({},U.Default,{placement:"right",trigger:"click",content:"",template:'<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-header"></h3><div class="popover-body"></div></div>'}),h=r({},U.DefaultType,{content:"(string|element|function)"}),c="fade",u="show",f=".popover-header",d=".popover-body",_={HIDE:"hide"+i,HIDDEN:"hidden"+i,SHOW:"show"+i,SHOWN:"shown"+i,INSERTED:"inserted"+i,CLICK:"click"+i,FOCUSIN:"focusin"+i,FOCUSOUT:"focusout"+i,MOUSEENTER:"mouseenter"+i,MOUSELEAVE:"mouseleave"+i},g=function(r){var o,g;function p(){return r.apply(this,arguments)||this}g=r,(o=p).prototype=Object.create(g.prototype),o.prototype.constructor=o,o.__proto__=g;var m=p.prototype;return m.isWithContent=function(){return this.getTitle()||this._getContent()},m.addAttachmentClass=function(e){t(this.getTipElement()).addClass("bs-popover-"+e)},m.getTipElement=function(){return this.tip=this.tip||t(this.config.template)[0],this.tip},m.setContent=function(){var e=t(this.getTipElement());this.setElementContent(e.find(f),this.getTitle());var n=this._getContent();"function"==typeof n&&(n=n.call(this.element)),this.setElementContent(e.find(d),n),e.removeClass(c+" "+u)},m._getContent=function(){return this.element.getAttribute("data-content")||this.config.content},m._cleanTipClass=function(){var e=t(this.getTipElement()),n=e.attr("class").match(a);null!==n&&n.length>0&&e.removeClass(n.join(""))},p._jQueryInterface=function(e){return this.each(function(){var i=t(this).data(n),s="object"==typeof e?e:null;if((i||!/destroy|hide/.test(e))&&(i||(i=new p(this,s),t(this).data(n,i)),"string"==typeof e)){if("undefined"==typeof i[e])throw new TypeError('No method named "'+e+'"');i[e]()}})},s(p,null,[{key:"VERSION",get:function(){return"4.0.0"}},{key:"Default",get:function(){return l}},{key:"NAME",get:function(){return e}},{key:"DATA_KEY",get:function(){return n}},{key:"Event",get:function(){return _}},{key:"EVENT_KEY",get:function(){return i}},{key:"DefaultType",get:function(){return h}}]),p}(U);return t.fn[e]=g._jQueryInterface,t.fn[e].Constructor=g,t.fn[e].noConflict=function(){return t.fn[e]=o,g._jQueryInterface},g}(e),K=function(t){var e="scrollspy",n="bs.scrollspy",i="."+n,o=t.fn[e],a={offset:10,method:"auto",target:""},l={offset:"number",method:"string",target:"(string|element)"},h={ACTIVATE:"activate"+i,SCROLL:"scroll"+i,LOAD_DATA_API:"load"+i+".data-api"},c="dropdown-item",u="active",f={DATA_SPY:'[data-spy="scroll"]',ACTIVE:".active",NAV_LIST_GROUP:".nav, .list-group",NAV_LINKS:".nav-link",NAV_ITEMS:".nav-item",LIST_ITEMS:".list-group-item",DROPDOWN:".dropdown",DROPDOWN_ITEMS:".dropdown-item",DROPDOWN_TOGGLE:".dropdown-toggle"},d="offset",_="position",g=function(){function o(e,n){var i=this;this._element=e,this._scrollElement="BODY"===e.tagName?window:e,this._config=this._getConfig(n),this._selector=this._config.target+" "+f.NAV_LINKS+","+this._config.target+" "+f.LIST_ITEMS+","+this._config.target+" "+f.DROPDOWN_ITEMS,this._offsets=[],this._targets=[],this._activeTarget=null,this._scrollHeight=0,t(this._scrollElement).on(h.SCROLL,function(t){return i._process(t)}),this.refresh(),this._process()}var g=o.prototype;return g.refresh=function(){var e=this,n=this._scrollElement===this._scrollElement.window?d:_,i="auto"===this._config.method?n:this._config.method,s=i===_?this._getScrollTop():0;this._offsets=[],this._targets=[],this._scrollHeight=this._getScrollHeight(),t.makeArray(t(this._selector)).map(function(e){var n,r=P.getSelectorFromElement(e);if(r&&(n=t(r)[0]),n){var o=n.getBoundingClientRect();if(o.width||o.height)return[t(n)[i]().top+s,r]}return null}).filter(function(t){return t}).sort(function(t,e){return t[0]-e[0]}).forEach(function(t){e._offsets.push(t[0]),e._targets.push(t[1])})},g.dispose=function(){t.removeData(this._element,n),t(this._scrollElement).off(i),this._element=null,this._scrollElement=null,this._config=null,this._selector=null,this._offsets=null,this._targets=null,this._activeTarget=null,this._scrollHeight=null},g._getConfig=function(n){if("string"!=typeof(n=r({},a,n)).target){var i=t(n.target).attr("id");i||(i=P.getUID(e),t(n.target).attr("id",i)),n.target="#"+i}return P.typeCheckConfig(e,n,l),n},g._getScrollTop=function(){return this._scrollElement===window?this._scrollElement.pageYOffset:this._scrollElement.scrollTop},g._getScrollHeight=function(){return this._scrollElement.scrollHeight||Math.max(document.body.scrollHeight,document.documentElement.scrollHeight)},g._getOffsetHeight=function(){return this._scrollElement===window?window.innerHeight:this._scrollElement.getBoundingClientRect().height},g._process=function(){var t=this._getScrollTop()+this._config.offset,e=this._getScrollHeight(),n=this._config.offset+e-this._getOffsetHeight();if(this._scrollHeight!==e&&this.refresh(),t>=n){var i=this._targets[this._targets.length-1];this._activeTarget!==i&&this._activate(i)}else{if(this._activeTarget&&t<this._offsets[0]&&this._offsets[0]>0)return this._activeTarget=null,void this._clear();for(var s=this._offsets.length;s--;){this._activeTarget!==this._targets[s]&&t>=this._offsets[s]&&("undefined"==typeof this._offsets[s+1]||t<this._offsets[s+1])&&this._activate(this._targets[s])}}},g._activate=function(e){this._activeTarget=e,this._clear();var n=this._selector.split(",");n=n.map(function(t){return t+'[data-target="'+e+'"],'+t+'[href="'+e+'"]'});var i=t(n.join(","));i.hasClass(c)?(i.closest(f.DROPDOWN).find(f.DROPDOWN_TOGGLE).addClass(u),i.addClass(u)):(i.addClass(u),i.parents(f.NAV_LIST_GROUP).prev(f.NAV_LINKS+", "+f.LIST_ITEMS).addClass(u),i.parents(f.NAV_LIST_GROUP).prev(f.NAV_ITEMS).children(f.NAV_LINKS).addClass(u)),t(this._scrollElement).trigger(h.ACTIVATE,{relatedTarget:e})},g._clear=function(){t(this._selector).filter(f.ACTIVE).removeClass(u)},o._jQueryInterface=function(e){return this.each(function(){var i=t(this).data(n);if(i||(i=new o(this,"object"==typeof e&&e),t(this).data(n,i)),"string"==typeof e){if("undefined"==typeof i[e])throw new TypeError('No method named "'+e+'"');i[e]()}})},s(o,null,[{key:"VERSION",get:function(){return"4.0.0"}},{key:"Default",get:function(){return a}}]),o}();return t(window).on(h.LOAD_DATA_API,function(){for(var e=t.makeArray(t(f.DATA_SPY)),n=e.length;n--;){var i=t(e[n]);g._jQueryInterface.call(i,i.data())}}),t.fn[e]=g._jQueryInterface,t.fn[e].Constructor=g,t.fn[e].noConflict=function(){return t.fn[e]=o,g._jQueryInterface},g}(e),V=function(t){var e="bs.tab",n="."+e,i=t.fn.tab,r={HIDE:"hide"+n,HIDDEN:"hidden"+n,SHOW:"show"+n,SHOWN:"shown"+n,CLICK_DATA_API:"click.bs.tab.data-api"},o="dropdown-menu",a="active",l="disabled",h="fade",c="show",u=".dropdown",f=".nav, .list-group",d=".active",_="> li > .active",g='[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]',p=".dropdown-toggle",m="> .dropdown-menu .active",v=function(){function n(t){this._element=t}var i=n.prototype;return i.show=function(){var e=this;if(!(this._element.parentNode&&this._element.parentNode.nodeType===Node.ELEMENT_NODE&&t(this._element).hasClass(a)||t(this._element).hasClass(l))){var n,i,s=t(this._element).closest(f)[0],o=P.getSelectorFromElement(this._element);if(s){var h="UL"===s.nodeName?_:d;i=(i=t.makeArray(t(s).find(h)))[i.length-1]}var c=t.Event(r.HIDE,{relatedTarget:this._element}),u=t.Event(r.SHOW,{relatedTarget:i});if(i&&t(i).trigger(c),t(this._element).trigger(u),!u.isDefaultPrevented()&&!c.isDefaultPrevented()){o&&(n=t(o)[0]),this._activate(this._element,s);var g=function(){var n=t.Event(r.HIDDEN,{relatedTarget:e._element}),s=t.Event(r.SHOWN,{relatedTarget:i});t(i).trigger(n),t(e._element).trigger(s)};n?this._activate(n,n.parentNode,g):g()}}},i.dispose=function(){t.removeData(this._element,e),this._element=null},i._activate=function(e,n,i){var s=this,r=("UL"===n.nodeName?t(n).find(_):t(n).children(d))[0],o=i&&P.supportsTransitionEnd()&&r&&t(r).hasClass(h),a=function(){return s._transitionComplete(e,r,i)};r&&o?t(r).one(P.TRANSITION_END,a).emulateTransitionEnd(150):a()},i._transitionComplete=function(e,n,i){if(n){t(n).removeClass(c+" "+a);var s=t(n.parentNode).find(m)[0];s&&t(s).removeClass(a),"tab"===n.getAttribute("role")&&n.setAttribute("aria-selected",!1)}if(t(e).addClass(a),"tab"===e.getAttribute("role")&&e.setAttribute("aria-selected",!0),P.reflow(e),t(e).addClass(c),e.parentNode&&t(e.parentNode).hasClass(o)){var r=t(e).closest(u)[0];r&&t(r).find(p).addClass(a),e.setAttribute("aria-expanded",!0)}i&&i()},n._jQueryInterface=function(i){return this.each(function(){var s=t(this),r=s.data(e);if(r||(r=new n(this),s.data(e,r)),"string"==typeof i){if("undefined"==typeof r[i])throw new TypeError('No method named "'+i+'"');r[i]()}})},s(n,null,[{key:"VERSION",get:function(){return"4.0.0"}}]),n}();return t(document).on(r.CLICK_DATA_API,g,function(e){e.preventDefault(),v._jQueryInterface.call(t(this),"show")}),t.fn.tab=v._jQueryInterface,t.fn.tab.Constructor=v,t.fn.tab.noConflict=function(){return t.fn.tab=i,v._jQueryInterface},v}(e);!function(t){if("undefined"==typeof t)throw new TypeError("Bootstrap's JavaScript requires jQuery. jQuery must be included before Bootstrap's JavaScript.");var e=t.fn.jquery.split(" ")[0].split(".");if(e[0]<2&&e[1]<9||1===e[0]&&9===e[1]&&e[2]<1||e[0]>=4)throw new Error("Bootstrap's JavaScript requires at least jQuery v1.9.1 but less than v4.0.0")}(e),t.Util=P,t.Alert=L,t.Button=R,t.Carousel=j,t.Collapse=H,t.Dropdown=W,t.Modal=M,t.Popover=x,t.Scrollspy=K,t.Tab=V,t.Tooltip=U,Object.defineProperty(t,"__esModule",{value:!0})});
//# sourceMappingURL=bootstrap.min.js.map
;;;/**
 * loupe - an image magnifier for jQuery
 * (C) 2010 jdbartlett, MIT license
 * http://github.com/jdbartlett/loupe
 */
(function ($) {
	$.fn.loupe = function (arg) {
		var options = $.extend({
			loupe: 'loupe',
			width: 200,
			height: 150
		}, arg || {});

		return this.length ? this.each(function () {
			var $this = $(this), $big, $loupe,
				$small = $this.is('img') ? $this : $this.find('img:first'),
				move, hide = function () { $loupe.hide(); },
				time;

			if ($this.data('loupe') != null) {
				return $this.data('loupe', arg);
			}

			move = function (e) {
				var os = $small.offset(),
					sW = $small.outerWidth(),
					sH = $small.outerHeight(),
					oW = options.width / 2,
					oH = options.height / 2;

				if (!$this.data('loupe') ||
					e.pageX > sW + os.left + 10 || e.pageX < os.left - 10 ||
					e.pageY > sH + os.top + 10 || e.pageY < os.top - 10) {
					return hide();
				}

				time = time ? clearTimeout(time) : 0;

				$loupe.show().css({
					left: e.pageX - oW,
					top: e.pageY - oH
				});
				$big.css({
					left: -(((e.pageX - os.left) / sW) * $big.width() - oW)|0,
					top: -(((e.pageY - os.top) / sH) * $big.height() - oH)|0
				});
			};

			$loupe = $('<div />')
				.addClass(options.loupe)
				.css({
					width: options.width,
					height: options.height,
					position: 'absolute',
					overflow: 'hidden'
				})
				.append($big = $('<img />').attr('src', $this.attr($this.is('img') ? 'src' : 'href')).css('position', 'absolute'))
				.mousemove(move)
				.hide()
				.appendTo('body');

			$this.data('loupe', true)
				.mouseenter(move)
				.mouseout(function () {
					time = setTimeout(hide, 10);
				});
		}) : this;
	};
}(jQuery));

;;;/**
 * Lightbox v2.7.1
 * by Lokesh Dhakar - http://lokeshdhakar.com/projects/lightbox2/
 *
 * @license http://creativecommons.org/licenses/by/2.5/
 * - Free for use in both personal and commercial projects
 * - Attribution requires leaving author name, author link, and the license info intact
 */
(function(){var a=jQuery,b=function(){function a(){this.fadeDuration=500,this.fitImagesInViewport=!0,this.resizeDuration=700,this.positionFromTop=50,this.showImageNumberLabel=!0,this.alwaysShowNavOnTouchDevices=!1,this.wrapAround=!0}return a.prototype.albumLabel=function(a,b){return"Image "+a+" of "+b},a}(),c=function(){function b(a){this.options=a,this.album=[],this.currentImageIndex=void 0,this.init()}return b.prototype.init=function(){this.enable(),this.build()},b.prototype.enable=function(){var b=this;a("body").on("click","a[rel^=lightbox], area[rel^=lightbox], a[data-lightbox], area[data-lightbox]",function(c){return b.start(a(c.currentTarget)),!1})},b.prototype.build=function(){var b=this;a("<div id='lightboxOverlay' class='lightboxOverlay'></div><div id='lightbox' class='lightbox'><div class='lb-outerContainer'><div class='lb-container'><img class='lb-image' src='' /><div class='lb-nav'><a class='lb-prev' href='' ></a><a class='lb-next' href='' ></a></div><div class='lb-loader'><a class='lb-cancel'></a></div></div></div><div class='lb-dataContainer'><div class='lb-data'><div class='lb-details'><span class='lb-caption'></span><span class='lb-number'></span></div><div class='lb-closeContainer'><a class='lb-close'></a></div></div></div></div>").appendTo(a("body")),this.$lightbox=a("#lightbox"),this.$overlay=a("#lightboxOverlay"),this.$outerContainer=this.$lightbox.find(".lb-outerContainer"),this.$container=this.$lightbox.find(".lb-container"),this.containerTopPadding=parseInt(this.$container.css("padding-top"),10),this.containerRightPadding=parseInt(this.$container.css("padding-right"),10),this.containerBottomPadding=parseInt(this.$container.css("padding-bottom"),10),this.containerLeftPadding=parseInt(this.$container.css("padding-left"),10),this.$overlay.hide().on("click",function(){return b.end(),!1}),this.$lightbox.hide().on("click",function(c){return"lightbox"===a(c.target).attr("id")&&b.end(),!1}),this.$outerContainer.on("click",function(c){return"lightbox"===a(c.target).attr("id")&&b.end(),!1}),this.$lightbox.find(".lb-prev").on("click",function(){return b.changeImage(0===b.currentImageIndex?b.album.length-1:b.currentImageIndex-1),!1}),this.$lightbox.find(".lb-next").on("click",function(){return b.changeImage(b.currentImageIndex===b.album.length-1?0:b.currentImageIndex+1),!1}),this.$lightbox.find(".lb-loader, .lb-close").on("click",function(){return b.end(),!1})},b.prototype.start=function(b){function c(a){d.album.push({link:a.attr("href"),title:a.attr("data-title")||a.attr("title")})}var d=this,e=a(window);e.on("resize",a.proxy(this.sizeOverlay,this)),a("select, object, embed").css({visibility:"hidden"}),this.sizeOverlay(),this.album=[];var f,g=0,h=b.attr("data-lightbox");if(h){f=a(b.prop("tagName")+'[data-lightbox="'+h+'"]');for(var i=0;i<f.length;i=++i)c(a(f[i])),f[i]===b[0]&&(g=i)}else if("lightbox"===b.attr("rel"))c(b);else{f=a(b.prop("tagName")+'[rel="'+b.attr("rel")+'"]');for(var j=0;j<f.length;j=++j)c(a(f[j])),f[j]===b[0]&&(g=j)}var k=e.scrollTop()+this.options.positionFromTop,l=e.scrollLeft();this.$lightbox.css({top:k+"px",left:l+"px"}).fadeIn(this.options.fadeDuration),this.changeImage(g)},b.prototype.changeImage=function(b){var c=this;this.disableKeyboardNav();var d=this.$lightbox.find(".lb-image");this.$overlay.fadeIn(this.options.fadeDuration),a(".lb-loader").fadeIn("slow"),this.$lightbox.find(".lb-image, .lb-nav, .lb-prev, .lb-next, .lb-dataContainer, .lb-numbers, .lb-caption").hide(),this.$outerContainer.addClass("animating");var e=new Image;e.onload=function(){var f,g,h,i,j,k,l;d.attr("src",c.album[b].link),f=a(e),d.width(e.width),d.height(e.height),c.options.fitImagesInViewport&&(l=a(window).width(),k=a(window).height(),j=l-c.containerLeftPadding-c.containerRightPadding-20,i=k-c.containerTopPadding-c.containerBottomPadding-120,(e.width>j||e.height>i)&&(e.width/j>e.height/i?(h=j,g=parseInt(e.height/(e.width/h),10),d.width(h),d.height(g)):(g=i,h=parseInt(e.width/(e.height/g),10),d.width(h),d.height(g)))),c.sizeContainer(d.width(),d.height())},e.src=this.album[b].link,this.currentImageIndex=b},b.prototype.sizeOverlay=function(){this.$overlay.width(a(window).width()).height(a(document).height())},b.prototype.sizeContainer=function(a,b){function c(){d.$lightbox.find(".lb-dataContainer").width(g),d.$lightbox.find(".lb-prevLink").height(h),d.$lightbox.find(".lb-nextLink").height(h),d.showImage()}var d=this,e=this.$outerContainer.outerWidth(),f=this.$outerContainer.outerHeight(),g=a+this.containerLeftPadding+this.containerRightPadding,h=b+this.containerTopPadding+this.containerBottomPadding;e!==g||f!==h?this.$outerContainer.animate({width:g,height:h},this.options.resizeDuration,"swing",function(){c()}):c()},b.prototype.showImage=function(){this.$lightbox.find(".lb-loader").hide(),this.$lightbox.find(".lb-image").fadeIn("slow"),this.updateNav(),this.updateDetails(),this.preloadNeighboringImages(),this.enableKeyboardNav()},b.prototype.updateNav=function(){var a=!1;try{document.createEvent("TouchEvent"),a=this.options.alwaysShowNavOnTouchDevices?!0:!1}catch(b){}this.$lightbox.find(".lb-nav").show(),this.album.length>1&&(this.options.wrapAround?(a&&this.$lightbox.find(".lb-prev, .lb-next").css("opacity","1"),this.$lightbox.find(".lb-prev, .lb-next").show()):(this.currentImageIndex>0&&(this.$lightbox.find(".lb-prev").show(),a&&this.$lightbox.find(".lb-prev").css("opacity","1")),this.currentImageIndex<this.album.length-1&&(this.$lightbox.find(".lb-next").show(),a&&this.$lightbox.find(".lb-next").css("opacity","1"))))},b.prototype.updateDetails=function(){var b=this;"undefined"!=typeof this.album[this.currentImageIndex].title&&""!==this.album[this.currentImageIndex].title&&this.$lightbox.find(".lb-caption").html(this.album[this.currentImageIndex].title).fadeIn("fast").find("a").on("click",function(){location.href=a(this).attr("href")}),this.album.length>1&&this.options.showImageNumberLabel?this.$lightbox.find(".lb-number").text(this.options.albumLabel(this.currentImageIndex+1,this.album.length)).fadeIn("fast"):this.$lightbox.find(".lb-number").hide(),this.$outerContainer.removeClass("animating"),this.$lightbox.find(".lb-dataContainer").fadeIn(this.options.resizeDuration,function(){return b.sizeOverlay()})},b.prototype.preloadNeighboringImages=function(){if(this.album.length>this.currentImageIndex+1){var a=new Image;a.src=this.album[this.currentImageIndex+1].link}if(this.currentImageIndex>0){var b=new Image;b.src=this.album[this.currentImageIndex-1].link}},b.prototype.enableKeyboardNav=function(){a(document).on("keyup.keyboard",a.proxy(this.keyboardAction,this))},b.prototype.disableKeyboardNav=function(){a(document).off(".keyboard")},b.prototype.keyboardAction=function(a){var b=27,c=37,d=39,e=a.keyCode,f=String.fromCharCode(e).toLowerCase();e===b||f.match(/x|o|c/)?this.end():"p"===f||e===c?0!==this.currentImageIndex?this.changeImage(this.currentImageIndex-1):this.options.wrapAround&&this.album.length>1&&this.changeImage(this.album.length-1):("n"===f||e===d)&&(this.currentImageIndex!==this.album.length-1?this.changeImage(this.currentImageIndex+1):this.options.wrapAround&&this.album.length>1&&this.changeImage(0))},b.prototype.end=function(){this.disableKeyboardNav(),a(window).off("resize",this.sizeOverlay),this.$lightbox.fadeOut(this.options.fadeDuration),this.$overlay.fadeOut(this.options.fadeDuration),a("select, object, embed").css({visibility:"visible"})},b}();a(function(){{var a=new b;new c(a)}})}).call(this);
//# sourceMappingURL=lightbox.min.map
;;;var DNN_COL_DELIMITER=String.fromCharCode(16);var DNN_ROW_DELIMITER=String.fromCharCode(15);var __dnn_m_bPageLoaded=false;if(window.addEventListener){window.addEventListener("load",__dnn_Page_OnLoad,false)}else{window.attachEvent("onload",__dnn_Page_OnLoad)}function __dnn_ClientAPIEnabled(){return typeof(dnn)!="undefined"&&typeof (dnn.dom)!="undefined"}function __dnn_Page_OnLoad(){if(__dnn_ClientAPIEnabled()){dnn.dom.attachEvent(window,"onscroll",__dnn_bodyscroll)}__dnn_m_bPageLoaded=true}function __dnn_KeyDown(iKeyCode,sFunc,e){if(e==null){e=window.event}if(e.keyCode==iKeyCode){eval(unescape(sFunc));return false}}function __dnn_bodyscroll(){var a=document.forms[0];if(__dnn_ClientAPIEnabled()&&__dnn_m_bPageLoaded&&typeof(a.ScrollTop)!="undefined"){a.ScrollTop.value=document.documentElement.scrollTop?document.documentElement.scrollTop:dnn.dom.getByTagName("body")[0].scrollTop}}function __dnn_setScrollTop(c){if(__dnn_ClientAPIEnabled()){if(c==null){c=document.forms[0].ScrollTop.value}var a=dnn.getVar("ScrollToControl");if(a!=null&&a.length>0){var b=dnn.dom.getById(a);if(b!=null){c=dnn.dom.positioning.elementTop(b);dnn.setVar("ScrollToControl","")}}if(document.getElementsByTagName("html")[0].style.overflow!="hidden"){window.scrollTo(0,c)}}}function __dnn_SetInitialFocus(a){var b=dnn.dom.getById(a);if(b!=null&&__dnn_CanReceiveFocus(b)){b.focus()}}function __dnn_CanReceiveFocus(b){if(b.style.display!="none"&&b.tabIndex>-1&&b.disabled==false&&b.style.visible!="hidden"){var a=b.parentElement;while(a!=null&&a.tagName!="BODY"){if(a.style.display=="none"||a.disabled||a.style.visible=="hidden"){return false}a=a.parentElement}return true}else{return false}}function __dnn_ContainerMaxMin_OnClick(i,b){var g=dnn.dom.getById(b);if(g!=null){var e=i.childNodes[0];var l=dnn.getVar("containerid_"+b);var j=dnn.getVar("cookieid_"+b);var d=e.src.toLowerCase().substr(e.src.lastIndexOf("/"));var a;var h;var k;if(dnn.getVar("min_icon_"+l)){k=dnn.getVar("min_icon_"+l)}else{k=dnn.getVar("min_icon")}if(dnn.getVar("max_icon_"+l)){h=dnn.getVar("max_icon_"+l)}else{h=dnn.getVar("max_icon")}a=h.toLowerCase().substr(h.lastIndexOf("/"));var c=5;var f=dnn.getVar("animf_"+b);if(f!=null){c=new Number(f)}if(d==a){e.src=k;dnn.dom.expandElement(g,c);e.title=dnn.getVar("min_text");if(j!=null){if(dnn.getVar("__dnn_"+l+":defminimized")=="true"){dnn.dom.setCookie(j,"true",365)}else{dnn.dom.deleteCookie(j)}}else{dnn.setVar("__dnn_"+l+"_Visible","true")}}else{e.src=h;dnn.dom.collapseElement(g,c);e.title=dnn.getVar("max_text");if(j!=null){if(dnn.getVar("__dnn_"+l+":defminimized")=="true"){dnn.dom.deleteCookie(j)}else{dnn.dom.setCookie(j,"false",365)}}else{dnn.setVar("__dnn_"+l+"_Visible","false")}}return true}return false}function __dnn_Help_OnClick(a){var b=dnn.dom.getById(a);if(b!=null){if(b.style.display=="none"){b.style.display=""}else{b.style.display="none"}return true}return false}function __dnn_SectionMaxMin(f,c){var d=dnn.dom.getById(c);if(d!=null){var g=f.getAttribute("max_icon");var e=f.getAttribute("min_icon");var a=f.getAttribute("userctr")!=null;var b;if(d.style.display=="none"){f.src=e;d.style.display="";if(a){b="True"}else{dnn.setVar(f.id+":exp",1)}}else{f.src=g;d.style.display="none";if(a){b="False"}else{dnn.setVar(f.id+":exp",0)}}if(a){dnncore.setUserProp(f.getAttribute("userctr"),f.getAttribute("userkey"),b,null)}return true}return false}function __dnn_enableDragDrop(){var b=dnn.getVar("__dnn_dragDrop").split(";");var e;for(var c=0;c<b.length;c++){e=b[c].split(" ");if(e[0].length>0){var a=dnn.dom.getById(e[0]);var d=dnn.dom.getById(e[1]);if(a!=null&&d!=null){a.setAttribute("moduleid",e[2]);dnn.dom.positioning.enableDragAndDrop(a,d,"__dnn_dragComplete()","__dnn_dragOver()")}}}}var __dnn_oPrevSelPane;var __dnn_oPrevSelModule;var __dnn_dragEventCount=0;function __dnn_dragOver(){__dnn_dragEventCount++;if(__dnn_dragEventCount%75!=0){return}var c=dnn.dom.getById(dnn.dom.positioning.dragCtr.contID);var a=__dnn_getMostSelectedPane(dnn.dom.positioning.dragCtr);if(__dnn_oPrevSelPane!=null){__dnn_oPrevSelPane.pane.style.border=__dnn_oPrevSelPane.origBorder}if(a!=null){__dnn_oPrevSelPane=a;a.pane.style.border="4px double "+DNN_HIGHLIGHT_COLOR;var e=__dnn_getPaneControlIndex(c,a);var b;var f;for(var d=0;d<a.controls.length;d++){if(e>d&&a.controls[d].id!=c.id){b=a.controls[d]}if(e<=d&&a.controls[d].id!=c.id){f=a.controls[d];break}}if(__dnn_oPrevSelModule!=null){dnn.dom.getNonTextNode(__dnn_oPrevSelModule.control).style.border=__dnn_oPrevSelModule.origBorder}if(f!=null){__dnn_oPrevSelModule=f;dnn.dom.getNonTextNode(f.control).style.borderTop="5px groove "+DNN_HIGHLIGHT_COLOR}else{if(b!=null){__dnn_oPrevSelModule=b;dnn.dom.getNonTextNode(b.control).style.borderBottom="5px groove "+DNN_HIGHLIGHT_COLOR}}}}function __dnn_dragComplete(){var f=dnn.dom.getById(dnn.dom.positioning.dragCtr.contID);var d=f.getAttribute("moduleid");if(__dnn_oPrevSelPane!=null){__dnn_oPrevSelPane.pane.style.border=__dnn_oPrevSelPane.origBorder}if(__dnn_oPrevSelModule!=null){dnn.dom.getNonTextNode(__dnn_oPrevSelModule.control).style.border=__dnn_oPrevSelModule.origBorder}var b=__dnn_getMostSelectedPane(dnn.dom.positioning.dragCtr);var e;if(b==null){var a=__dnn_Panes();for(var c=0;c<a.length;c++){if(a[c].id==f.parentNode.id){b=a[c]}}}if(b!=null){e=__dnn_getPaneControlIndex(f,b);__dnn_MoveToPane(b,f,e);dnn.callPostBack("MoveToPane","moduleid="+d,"pane="+b.paneName,"order="+e*2)}}function __dnn_MoveToPane(a,e,d){if(a!=null){var c=new Array();for(var b=d;b<a.controls.length;b++){if(a.controls[b].control.id!=e.id){c[c.length]=a.controls[b].control}dnn.dom.removeChild(a.controls[b].control)}dnn.dom.appendChild(a.pane,e);e.style.top=0;e.style.left=0;e.style.position="relative";for(var b=0;b<c.length;b++){dnn.dom.appendChild(a.pane,c[b])}__dnn_RefreshPanes()}else{e.style.top=0;e.style.left=0;e.style.position="relative"}}function __dnn_RefreshPanes(){var b=dnn.getVar("__dnn_Panes").split(";");var a=dnn.getVar("__dnn_PaneNames").split(";");__dnn_m_aryPanes=new Array();for(var c=0;c<b.length;c++){if(b[c].length>0){__dnn_m_aryPanes[__dnn_m_aryPanes.length]=new __dnn_Pane(dnn.dom.getById(b[c]),a[c])}}}var __dnn_m_aryPanes;var __dnn_m_aryModules;function __dnn_Panes(){if(__dnn_m_aryPanes==null){__dnn_m_aryPanes=new Array();__dnn_RefreshPanes()}return __dnn_m_aryPanes}function __dnn_Modules(a){if(__dnn_m_aryModules==null){__dnn_RefreshPanes()}return __dnn_m_aryModules[a]}function __dnn_getMostSelectedPane(g){var c=new dnn.dom.positioning.dims(g);var f=0;var a;var h;for(var e=0;e<__dnn_Panes().length;e++){var b=__dnn_Panes()[e];var d=new dnn.dom.positioning.dims(b.pane);a=dnn.dom.positioning.elementOverlapScore(d,c);if(a>f){f=a;h=b}}return h}function __dnn_getPaneControlIndex(f,b){if(b==null){return}var a=new dnn.dom.positioning.dims(f);var e;if(b.controls.length==0){return 0}for(var c=0;c<b.controls.length;c++){e=b.controls[c];var d=new dnn.dom.positioning.dims(e.control);if(a.t<d.t){return e.index}}if(e!=null){return e.index+1}else{return 0}}function __dnn_Pane(a,b){this.pane=a;this.id=a.id;this.controls=new Array();this.origBorder=a.style.border;this.paneName=b;var f=0;var e="";for(var d=0;d<a.childNodes.length;d++){var g=a.childNodes[d];if(dnn.dom.isNonTextNode(g)){if(__dnn_m_aryModules==null){__dnn_m_aryModules=new Array()}var c=g.getAttribute("moduleid");if(c!=null&&c.length>0){e+=c+"~";this.controls[this.controls.length]=new __dnn_PaneControl(g,f);__dnn_m_aryModules[c]=g.id;f+=1}}}this.moduleOrder=e}function __dnn_PaneControl(a,b){this.control=a;this.id=a.id;this.index=b;this.origBorder=a.style.border}function __dnn_ShowModalPage(a){dnnModal.show(a,true,550,950,true,"")}function __dnncore(){this.GetUserVal=0;this.SetUserVal=1}__dnncore.prototype={getUserProp:function(b,c,a){this._doUserCallBack(dnncore.GetUserVal,b,c,null,new dnncore.UserPropArgs(b,c,a))},setUserProp:function(c,d,a,b){this._doUserCallBack(dnncore.SetUserVal,c,d,a,new dnncore.UserPropArgs(c,d,b))},_doUserCallBack:function(c,d,e,a,b){if(dnn&&dnn.xmlhttp){var f=c+COL_DELIMITER+d+COL_DELIMITER+e+COL_DELIMITER+a;dnn.xmlhttp.doCallBack("__Page",f,dnncore._callBackSuccess,b,dnncore._callBackFail,null,true,null,0)}else{alert("Client Personalization not enabled")}},_callBackSuccess:function(a,b,c){if(b.pFunc){b.pFunc(b.namingCtr,b.key,a)}},_callBackFail:function(a,b){window.status=a}};__dnncore.prototype.UserPropArgs=function(b,c,a){this.namingCtr=b;this.key=c;this.pFunc=a};var dnncore=new __dnncore();
;;;
;;;//     Underscore.js 1.8.3
//     http://underscorejs.org
//     (c) 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
//     Underscore may be freely distributed under the MIT license.
(function(){function n(n){function t(t,r,e,u,i,o){for(;i>=0&&o>i;i+=n){var a=u?u[i]:i;e=r(e,t[a],a,t)}return e}return function(r,e,u,i){e=b(e,i,4);var o=!k(r)&&m.keys(r),a=(o||r).length,c=n>0?0:a-1;return arguments.length<3&&(u=r[o?o[c]:c],c+=n),t(r,e,u,o,c,a)}}function t(n){return function(t,r,e){r=x(r,e);for(var u=O(t),i=n>0?0:u-1;i>=0&&u>i;i+=n)if(r(t[i],i,t))return i;return-1}}function r(n,t,r){return function(e,u,i){var o=0,a=O(e);if("number"==typeof i)n>0?o=i>=0?i:Math.max(i+a,o):a=i>=0?Math.min(i+1,a):i+a+1;else if(r&&i&&a)return i=r(e,u),e[i]===u?i:-1;if(u!==u)return i=t(l.call(e,o,a),m.isNaN),i>=0?i+o:-1;for(i=n>0?o:a-1;i>=0&&a>i;i+=n)if(e[i]===u)return i;return-1}}function e(n,t){var r=I.length,e=n.constructor,u=m.isFunction(e)&&e.prototype||a,i="constructor";for(m.has(n,i)&&!m.contains(t,i)&&t.push(i);r--;)i=I[r],i in n&&n[i]!==u[i]&&!m.contains(t,i)&&t.push(i)}var u=this,i=u._,o=Array.prototype,a=Object.prototype,c=Function.prototype,f=o.push,l=o.slice,s=a.toString,p=a.hasOwnProperty,h=Array.isArray,v=Object.keys,g=c.bind,y=Object.create,d=function(){},m=function(n){return n instanceof m?n:this instanceof m?void(this._wrapped=n):new m(n)};"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=m),exports._=m):u._=m,m.VERSION="1.8.3";var b=function(n,t,r){if(t===void 0)return n;switch(null==r?3:r){case 1:return function(r){return n.call(t,r)};case 2:return function(r,e){return n.call(t,r,e)};case 3:return function(r,e,u){return n.call(t,r,e,u)};case 4:return function(r,e,u,i){return n.call(t,r,e,u,i)}}return function(){return n.apply(t,arguments)}},x=function(n,t,r){return null==n?m.identity:m.isFunction(n)?b(n,t,r):m.isObject(n)?m.matcher(n):m.property(n)};m.iteratee=function(n,t){return x(n,t,1/0)};var _=function(n,t){return function(r){var e=arguments.length;if(2>e||null==r)return r;for(var u=1;e>u;u++)for(var i=arguments[u],o=n(i),a=o.length,c=0;a>c;c++){var f=o[c];t&&r[f]!==void 0||(r[f]=i[f])}return r}},j=function(n){if(!m.isObject(n))return{};if(y)return y(n);d.prototype=n;var t=new d;return d.prototype=null,t},w=function(n){return function(t){return null==t?void 0:t[n]}},A=Math.pow(2,53)-1,O=w("length"),k=function(n){var t=O(n);return"number"==typeof t&&t>=0&&A>=t};m.each=m.forEach=function(n,t,r){t=b(t,r);var e,u;if(k(n))for(e=0,u=n.length;u>e;e++)t(n[e],e,n);else{var i=m.keys(n);for(e=0,u=i.length;u>e;e++)t(n[i[e]],i[e],n)}return n},m.map=m.collect=function(n,t,r){t=x(t,r);for(var e=!k(n)&&m.keys(n),u=(e||n).length,i=Array(u),o=0;u>o;o++){var a=e?e[o]:o;i[o]=t(n[a],a,n)}return i},m.reduce=m.foldl=m.inject=n(1),m.reduceRight=m.foldr=n(-1),m.find=m.detect=function(n,t,r){var e;return e=k(n)?m.findIndex(n,t,r):m.findKey(n,t,r),e!==void 0&&e!==-1?n[e]:void 0},m.filter=m.select=function(n,t,r){var e=[];return t=x(t,r),m.each(n,function(n,r,u){t(n,r,u)&&e.push(n)}),e},m.reject=function(n,t,r){return m.filter(n,m.negate(x(t)),r)},m.every=m.all=function(n,t,r){t=x(t,r);for(var e=!k(n)&&m.keys(n),u=(e||n).length,i=0;u>i;i++){var o=e?e[i]:i;if(!t(n[o],o,n))return!1}return!0},m.some=m.any=function(n,t,r){t=x(t,r);for(var e=!k(n)&&m.keys(n),u=(e||n).length,i=0;u>i;i++){var o=e?e[i]:i;if(t(n[o],o,n))return!0}return!1},m.contains=m.includes=m.include=function(n,t,r,e){return k(n)||(n=m.values(n)),("number"!=typeof r||e)&&(r=0),m.indexOf(n,t,r)>=0},m.invoke=function(n,t){var r=l.call(arguments,2),e=m.isFunction(t);return m.map(n,function(n){var u=e?t:n[t];return null==u?u:u.apply(n,r)})},m.pluck=function(n,t){return m.map(n,m.property(t))},m.where=function(n,t){return m.filter(n,m.matcher(t))},m.findWhere=function(n,t){return m.find(n,m.matcher(t))},m.max=function(n,t,r){var e,u,i=-1/0,o=-1/0;if(null==t&&null!=n){n=k(n)?n:m.values(n);for(var a=0,c=n.length;c>a;a++)e=n[a],e>i&&(i=e)}else t=x(t,r),m.each(n,function(n,r,e){u=t(n,r,e),(u>o||u===-1/0&&i===-1/0)&&(i=n,o=u)});return i},m.min=function(n,t,r){var e,u,i=1/0,o=1/0;if(null==t&&null!=n){n=k(n)?n:m.values(n);for(var a=0,c=n.length;c>a;a++)e=n[a],i>e&&(i=e)}else t=x(t,r),m.each(n,function(n,r,e){u=t(n,r,e),(o>u||1/0===u&&1/0===i)&&(i=n,o=u)});return i},m.shuffle=function(n){for(var t,r=k(n)?n:m.values(n),e=r.length,u=Array(e),i=0;e>i;i++)t=m.random(0,i),t!==i&&(u[i]=u[t]),u[t]=r[i];return u},m.sample=function(n,t,r){return null==t||r?(k(n)||(n=m.values(n)),n[m.random(n.length-1)]):m.shuffle(n).slice(0,Math.max(0,t))},m.sortBy=function(n,t,r){return t=x(t,r),m.pluck(m.map(n,function(n,r,e){return{value:n,index:r,criteria:t(n,r,e)}}).sort(function(n,t){var r=n.criteria,e=t.criteria;if(r!==e){if(r>e||r===void 0)return 1;if(e>r||e===void 0)return-1}return n.index-t.index}),"value")};var F=function(n){return function(t,r,e){var u={};return r=x(r,e),m.each(t,function(e,i){var o=r(e,i,t);n(u,e,o)}),u}};m.groupBy=F(function(n,t,r){m.has(n,r)?n[r].push(t):n[r]=[t]}),m.indexBy=F(function(n,t,r){n[r]=t}),m.countBy=F(function(n,t,r){m.has(n,r)?n[r]++:n[r]=1}),m.toArray=function(n){return n?m.isArray(n)?l.call(n):k(n)?m.map(n,m.identity):m.values(n):[]},m.size=function(n){return null==n?0:k(n)?n.length:m.keys(n).length},m.partition=function(n,t,r){t=x(t,r);var e=[],u=[];return m.each(n,function(n,r,i){(t(n,r,i)?e:u).push(n)}),[e,u]},m.first=m.head=m.take=function(n,t,r){return null==n?void 0:null==t||r?n[0]:m.initial(n,n.length-t)},m.initial=function(n,t,r){return l.call(n,0,Math.max(0,n.length-(null==t||r?1:t)))},m.last=function(n,t,r){return null==n?void 0:null==t||r?n[n.length-1]:m.rest(n,Math.max(0,n.length-t))},m.rest=m.tail=m.drop=function(n,t,r){return l.call(n,null==t||r?1:t)},m.compact=function(n){return m.filter(n,m.identity)};var S=function(n,t,r,e){for(var u=[],i=0,o=e||0,a=O(n);a>o;o++){var c=n[o];if(k(c)&&(m.isArray(c)||m.isArguments(c))){t||(c=S(c,t,r));var f=0,l=c.length;for(u.length+=l;l>f;)u[i++]=c[f++]}else r||(u[i++]=c)}return u};m.flatten=function(n,t){return S(n,t,!1)},m.without=function(n){return m.difference(n,l.call(arguments,1))},m.uniq=m.unique=function(n,t,r,e){m.isBoolean(t)||(e=r,r=t,t=!1),null!=r&&(r=x(r,e));for(var u=[],i=[],o=0,a=O(n);a>o;o++){var c=n[o],f=r?r(c,o,n):c;t?(o&&i===f||u.push(c),i=f):r?m.contains(i,f)||(i.push(f),u.push(c)):m.contains(u,c)||u.push(c)}return u},m.union=function(){return m.uniq(S(arguments,!0,!0))},m.intersection=function(n){for(var t=[],r=arguments.length,e=0,u=O(n);u>e;e++){var i=n[e];if(!m.contains(t,i)){for(var o=1;r>o&&m.contains(arguments[o],i);o++);o===r&&t.push(i)}}return t},m.difference=function(n){var t=S(arguments,!0,!0,1);return m.filter(n,function(n){return!m.contains(t,n)})},m.zip=function(){return m.unzip(arguments)},m.unzip=function(n){for(var t=n&&m.max(n,O).length||0,r=Array(t),e=0;t>e;e++)r[e]=m.pluck(n,e);return r},m.object=function(n,t){for(var r={},e=0,u=O(n);u>e;e++)t?r[n[e]]=t[e]:r[n[e][0]]=n[e][1];return r},m.findIndex=t(1),m.findLastIndex=t(-1),m.sortedIndex=function(n,t,r,e){r=x(r,e,1);for(var u=r(t),i=0,o=O(n);o>i;){var a=Math.floor((i+o)/2);r(n[a])<u?i=a+1:o=a}return i},m.indexOf=r(1,m.findIndex,m.sortedIndex),m.lastIndexOf=r(-1,m.findLastIndex),m.range=function(n,t,r){null==t&&(t=n||0,n=0),r=r||1;for(var e=Math.max(Math.ceil((t-n)/r),0),u=Array(e),i=0;e>i;i++,n+=r)u[i]=n;return u};var E=function(n,t,r,e,u){if(!(e instanceof t))return n.apply(r,u);var i=j(n.prototype),o=n.apply(i,u);return m.isObject(o)?o:i};m.bind=function(n,t){if(g&&n.bind===g)return g.apply(n,l.call(arguments,1));if(!m.isFunction(n))throw new TypeError("Bind must be called on a function");var r=l.call(arguments,2),e=function(){return E(n,e,t,this,r.concat(l.call(arguments)))};return e},m.partial=function(n){var t=l.call(arguments,1),r=function(){for(var e=0,u=t.length,i=Array(u),o=0;u>o;o++)i[o]=t[o]===m?arguments[e++]:t[o];for(;e<arguments.length;)i.push(arguments[e++]);return E(n,r,this,this,i)};return r},m.bindAll=function(n){var t,r,e=arguments.length;if(1>=e)throw new Error("bindAll must be passed function names");for(t=1;e>t;t++)r=arguments[t],n[r]=m.bind(n[r],n);return n},m.memoize=function(n,t){var r=function(e){var u=r.cache,i=""+(t?t.apply(this,arguments):e);return m.has(u,i)||(u[i]=n.apply(this,arguments)),u[i]};return r.cache={},r},m.delay=function(n,t){var r=l.call(arguments,2);return setTimeout(function(){return n.apply(null,r)},t)},m.defer=m.partial(m.delay,m,1),m.throttle=function(n,t,r){var e,u,i,o=null,a=0;r||(r={});var c=function(){a=r.leading===!1?0:m.now(),o=null,i=n.apply(e,u),o||(e=u=null)};return function(){var f=m.now();a||r.leading!==!1||(a=f);var l=t-(f-a);return e=this,u=arguments,0>=l||l>t?(o&&(clearTimeout(o),o=null),a=f,i=n.apply(e,u),o||(e=u=null)):o||r.trailing===!1||(o=setTimeout(c,l)),i}},m.debounce=function(n,t,r){var e,u,i,o,a,c=function(){var f=m.now()-o;t>f&&f>=0?e=setTimeout(c,t-f):(e=null,r||(a=n.apply(i,u),e||(i=u=null)))};return function(){i=this,u=arguments,o=m.now();var f=r&&!e;return e||(e=setTimeout(c,t)),f&&(a=n.apply(i,u),i=u=null),a}},m.wrap=function(n,t){return m.partial(t,n)},m.negate=function(n){return function(){return!n.apply(this,arguments)}},m.compose=function(){var n=arguments,t=n.length-1;return function(){for(var r=t,e=n[t].apply(this,arguments);r--;)e=n[r].call(this,e);return e}},m.after=function(n,t){return function(){return--n<1?t.apply(this,arguments):void 0}},m.before=function(n,t){var r;return function(){return--n>0&&(r=t.apply(this,arguments)),1>=n&&(t=null),r}},m.once=m.partial(m.before,2);var M=!{toString:null}.propertyIsEnumerable("toString"),I=["valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"];m.keys=function(n){if(!m.isObject(n))return[];if(v)return v(n);var t=[];for(var r in n)m.has(n,r)&&t.push(r);return M&&e(n,t),t},m.allKeys=function(n){if(!m.isObject(n))return[];var t=[];for(var r in n)t.push(r);return M&&e(n,t),t},m.values=function(n){for(var t=m.keys(n),r=t.length,e=Array(r),u=0;r>u;u++)e[u]=n[t[u]];return e},m.mapObject=function(n,t,r){t=x(t,r);for(var e,u=m.keys(n),i=u.length,o={},a=0;i>a;a++)e=u[a],o[e]=t(n[e],e,n);return o},m.pairs=function(n){for(var t=m.keys(n),r=t.length,e=Array(r),u=0;r>u;u++)e[u]=[t[u],n[t[u]]];return e},m.invert=function(n){for(var t={},r=m.keys(n),e=0,u=r.length;u>e;e++)t[n[r[e]]]=r[e];return t},m.functions=m.methods=function(n){var t=[];for(var r in n)m.isFunction(n[r])&&t.push(r);return t.sort()},m.extend=_(m.allKeys),m.extendOwn=m.assign=_(m.keys),m.findKey=function(n,t,r){t=x(t,r);for(var e,u=m.keys(n),i=0,o=u.length;o>i;i++)if(e=u[i],t(n[e],e,n))return e},m.pick=function(n,t,r){var e,u,i={},o=n;if(null==o)return i;m.isFunction(t)?(u=m.allKeys(o),e=b(t,r)):(u=S(arguments,!1,!1,1),e=function(n,t,r){return t in r},o=Object(o));for(var a=0,c=u.length;c>a;a++){var f=u[a],l=o[f];e(l,f,o)&&(i[f]=l)}return i},m.omit=function(n,t,r){if(m.isFunction(t))t=m.negate(t);else{var e=m.map(S(arguments,!1,!1,1),String);t=function(n,t){return!m.contains(e,t)}}return m.pick(n,t,r)},m.defaults=_(m.allKeys,!0),m.create=function(n,t){var r=j(n);return t&&m.extendOwn(r,t),r},m.clone=function(n){return m.isObject(n)?m.isArray(n)?n.slice():m.extend({},n):n},m.tap=function(n,t){return t(n),n},m.isMatch=function(n,t){var r=m.keys(t),e=r.length;if(null==n)return!e;for(var u=Object(n),i=0;e>i;i++){var o=r[i];if(t[o]!==u[o]||!(o in u))return!1}return!0};var N=function(n,t,r,e){if(n===t)return 0!==n||1/n===1/t;if(null==n||null==t)return n===t;n instanceof m&&(n=n._wrapped),t instanceof m&&(t=t._wrapped);var u=s.call(n);if(u!==s.call(t))return!1;switch(u){case"[object RegExp]":case"[object String]":return""+n==""+t;case"[object Number]":return+n!==+n?+t!==+t:0===+n?1/+n===1/t:+n===+t;case"[object Date]":case"[object Boolean]":return+n===+t}var i="[object Array]"===u;if(!i){if("object"!=typeof n||"object"!=typeof t)return!1;var o=n.constructor,a=t.constructor;if(o!==a&&!(m.isFunction(o)&&o instanceof o&&m.isFunction(a)&&a instanceof a)&&"constructor"in n&&"constructor"in t)return!1}r=r||[],e=e||[];for(var c=r.length;c--;)if(r[c]===n)return e[c]===t;if(r.push(n),e.push(t),i){if(c=n.length,c!==t.length)return!1;for(;c--;)if(!N(n[c],t[c],r,e))return!1}else{var f,l=m.keys(n);if(c=l.length,m.keys(t).length!==c)return!1;for(;c--;)if(f=l[c],!m.has(t,f)||!N(n[f],t[f],r,e))return!1}return r.pop(),e.pop(),!0};m.isEqual=function(n,t){return N(n,t)},m.isEmpty=function(n){return null==n?!0:k(n)&&(m.isArray(n)||m.isString(n)||m.isArguments(n))?0===n.length:0===m.keys(n).length},m.isElement=function(n){return!(!n||1!==n.nodeType)},m.isArray=h||function(n){return"[object Array]"===s.call(n)},m.isObject=function(n){var t=typeof n;return"function"===t||"object"===t&&!!n},m.each(["Arguments","Function","String","Number","Date","RegExp","Error"],function(n){m["is"+n]=function(t){return s.call(t)==="[object "+n+"]"}}),m.isArguments(arguments)||(m.isArguments=function(n){return m.has(n,"callee")}),"function"!=typeof/./&&"object"!=typeof Int8Array&&(m.isFunction=function(n){return"function"==typeof n||!1}),m.isFinite=function(n){return isFinite(n)&&!isNaN(parseFloat(n))},m.isNaN=function(n){return m.isNumber(n)&&n!==+n},m.isBoolean=function(n){return n===!0||n===!1||"[object Boolean]"===s.call(n)},m.isNull=function(n){return null===n},m.isUndefined=function(n){return n===void 0},m.has=function(n,t){return null!=n&&p.call(n,t)},m.noConflict=function(){return u._=i,this},m.identity=function(n){return n},m.constant=function(n){return function(){return n}},m.noop=function(){},m.property=w,m.propertyOf=function(n){return null==n?function(){}:function(t){return n[t]}},m.matcher=m.matches=function(n){return n=m.extendOwn({},n),function(t){return m.isMatch(t,n)}},m.times=function(n,t,r){var e=Array(Math.max(0,n));t=b(t,r,1);for(var u=0;n>u;u++)e[u]=t(u);return e},m.random=function(n,t){return null==t&&(t=n,n=0),n+Math.floor(Math.random()*(t-n+1))},m.now=Date.now||function(){return(new Date).getTime()};var B={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"},T=m.invert(B),R=function(n){var t=function(t){return n[t]},r="(?:"+m.keys(n).join("|")+")",e=RegExp(r),u=RegExp(r,"g");return function(n){return n=null==n?"":""+n,e.test(n)?n.replace(u,t):n}};m.escape=R(B),m.unescape=R(T),m.result=function(n,t,r){var e=null==n?void 0:n[t];return e===void 0&&(e=r),m.isFunction(e)?e.call(n):e};var q=0;m.uniqueId=function(n){var t=++q+"";return n?n+t:t},m.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var K=/(.)^/,z={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},D=/\\|'|\r|\n|\u2028|\u2029/g,L=function(n){return"\\"+z[n]};m.template=function(n,t,r){!t&&r&&(t=r),t=m.defaults({},t,m.templateSettings);var e=RegExp([(t.escape||K).source,(t.interpolate||K).source,(t.evaluate||K).source].join("|")+"|$","g"),u=0,i="__p+='";n.replace(e,function(t,r,e,o,a){return i+=n.slice(u,a).replace(D,L),u=a+t.length,r?i+="'+\n((__t=("+r+"))==null?'':_.escape(__t))+\n'":e?i+="'+\n((__t=("+e+"))==null?'':__t)+\n'":o&&(i+="';\n"+o+"\n__p+='"),t}),i+="';\n",t.variable||(i="with(obj||{}){\n"+i+"}\n"),i="var __t,__p='',__j=Array.prototype.join,"+"print=function(){__p+=__j.call(arguments,'');};\n"+i+"return __p;\n";try{var o=new Function(t.variable||"obj","_",i)}catch(a){throw a.source=i,a}var c=function(n){return o.call(this,n,m)},f=t.variable||"obj";return c.source="function("+f+"){\n"+i+"}",c},m.chain=function(n){var t=m(n);return t._chain=!0,t};var P=function(n,t){return n._chain?m(t).chain():t};m.mixin=function(n){m.each(m.functions(n),function(t){var r=m[t]=n[t];m.prototype[t]=function(){var n=[this._wrapped];return f.apply(n,arguments),P(this,r.apply(m,n))}})},m.mixin(m),m.each(["pop","push","reverse","shift","sort","splice","unshift"],function(n){var t=o[n];m.prototype[n]=function(){var r=this._wrapped;return t.apply(r,arguments),"shift"!==n&&"splice"!==n||0!==r.length||delete r[0],P(this,r)}}),m.each(["concat","join","slice"],function(n){var t=o[n];m.prototype[n]=function(){return P(this,t.apply(this._wrapped,arguments))}}),m.prototype.value=function(){return this._wrapped},m.prototype.valueOf=m.prototype.toJSON=m.prototype.value,m.prototype.toString=function(){return""+this._wrapped},"function"==typeof define&&define.amd&&define("underscore",[],function(){return m})}).call(this);
;;;/*
	Masked Input plugin for jQuery
	Copyright (c) 2007-2013 Josh Bush (digitalbush.com)
	Licensed under the MIT license (http://digitalbush.com/projects/masked-input-plugin/#license)
	Version: 1.3.1
*/
(function($) {
	function getPasteEvent() {
    var el = document.createElement('input'),
        name = 'onpaste';
    el.setAttribute(name, '');
    return (typeof el[name] === 'function')?'paste':'input';             
}

var pasteEventName = getPasteEvent() + ".mask",
	ua = navigator.userAgent,
	iPhone = /iphone/i.test(ua),
	android=/android/i.test(ua),
	caretTimeoutId;

$.mask = {
	//Predefined character definitions
	definitions: {
		'9': "[0-9]",
		'a': "[A-Za-z]",
		'*': "[A-Za-z0-9]"
	},
	dataName: "rawMaskFn",
	placeholder: '_',
};

$.fn.extend({
	//Helper Function for Caret positioning
	caret: function(begin, end) {
		var range;

		if (this.length === 0 || this.is(":hidden")) {
			return;
		}

		if (typeof begin == 'number') {
			end = (typeof end === 'number') ? end : begin;
			return this.each(function() {
				if (this.setSelectionRange) {
					this.setSelectionRange(begin, end);
				} else if (this.createTextRange) {
					range = this.createTextRange();
					range.collapse(true);
					range.moveEnd('character', end);
					range.moveStart('character', begin);
					range.select();
				}
			});
		} else {
			if (this[0].setSelectionRange) {
				begin = this[0].selectionStart;
				end = this[0].selectionEnd;
			} else if (document.selection && document.selection.createRange) {
				range = document.selection.createRange();
				begin = 0 - range.duplicate().moveStart('character', -100000);
				end = begin + range.text.length;
			}
			return { begin: begin, end: end };
		}
	},
	unmask: function() {
		return this.trigger("unmask");
	},
	mask: function(mask, settings) {
		var input,
			defs,
			tests,
			partialPosition,
			firstNonMaskPos,
			len;

		if (!mask && this.length > 0) {
			input = $(this[0]);
			return input.data($.mask.dataName)();
		}
		settings = $.extend({
			placeholder: $.mask.placeholder, // Load default placeholder
			completed: null
		}, settings);


		defs = $.mask.definitions;
		tests = [];
		partialPosition = len = mask.length;
		firstNonMaskPos = null;

		$.each(mask.split(""), function(i, c) {
			if (c == '?') {
				len--;
				partialPosition = i;
			} else if (defs[c]) {
				tests.push(new RegExp(defs[c]));
				if (firstNonMaskPos === null) {
					firstNonMaskPos = tests.length - 1;
				}
			} else {
				tests.push(null);
			}
		});

		return this.trigger("unmask").each(function() {
			var input = $(this),
				buffer = $.map(
				mask.split(""),
				function(c, i) {
					if (c != '?') {
						return defs[c] ? settings.placeholder : c;
					}
				}),
				focusText = input.val();

			function seekNext(pos) {
				while (++pos < len && !tests[pos]);
				return pos;
			}

			function seekPrev(pos) {
				while (--pos >= 0 && !tests[pos]);
				return pos;
			}

			function shiftL(begin,end) {
				var i,
					j;

				if (begin<0) {
					return;
				}

				for (i = begin, j = seekNext(end); i < len; i++) {
					if (tests[i]) {
						if (j < len && tests[i].test(buffer[j])) {
							buffer[i] = buffer[j];
							buffer[j] = settings.placeholder;
						} else {
							break;
						}

						j = seekNext(j);
					}
				}
				writeBuffer();
				input.caret(Math.max(firstNonMaskPos, begin));
			}

			function shiftR(pos) {
				var i,
					c,
					j,
					t;

				for (i = pos, c = settings.placeholder; i < len; i++) {
					if (tests[i]) {
						j = seekNext(i);
						t = buffer[i];
						buffer[i] = c;
						if (j < len && tests[j].test(t)) {
							c = t;
						} else {
							break;
						}
					}
				}
			}

			function keydownEvent(e) {
				var k = e.which,
					pos,
					begin,
					end;

				//backspace, delete, and escape get special treatment
				if (k === 8 || k === 46 || (iPhone && k === 127)) {
					pos = input.caret();
					begin = pos.begin;
					end = pos.end;

					if (end - begin === 0) {
						begin=k!==46?seekPrev(begin):(end=seekNext(begin-1));
						end=k===46?seekNext(end):end;
					}
					clearBuffer(begin, end);
					shiftL(begin, end - 1);

					e.preventDefault();
				} else if (k == 27) {//escape
					input.val(focusText);
					input.caret(0, checkVal());
					e.preventDefault();
				}
			}

			function keypressEvent(e) {
				var k = e.which,
					pos = input.caret(),
					p,
					c,
					next;

				if (e.ctrlKey || e.altKey || e.metaKey || k < 32) {//Ignore
					return;
				} else if (k) {
					if (pos.end - pos.begin !== 0){
						clearBuffer(pos.begin, pos.end);
						shiftL(pos.begin, pos.end-1);
					}

					p = seekNext(pos.begin - 1);
					if (p < len) {
						c = String.fromCharCode(k);
						if (tests[p].test(c)) {
							shiftR(p);

							buffer[p] = c;
							writeBuffer();
							next = seekNext(p);

							if(android){
								setTimeout($.proxy($.fn.caret,input,next),0);
							}else{
								input.caret(next);
							}

							if (settings.completed && next >= len) {
								settings.completed.call(input);
							}
						}
					}
					e.preventDefault();
				}
			}

			function clearBuffer(start, end) {
				var i;
				for (i = start; i < end && i < len; i++) {
					if (tests[i]) {
						buffer[i] = settings.placeholder;
					}
				}
			}

			function writeBuffer() { input.val(buffer.join('')); }

			function checkVal(allow) {
				//try to place characters where they belong
				var test = input.val(),
					lastMatch = -1,
					i,
					c;

				for (i = 0, pos = 0; i < len; i++) {
					if (tests[i]) {
						buffer[i] = settings.placeholder;
						while (pos++ < test.length) {
							c = test.charAt(pos - 1);
							if (tests[i].test(c)) {
								buffer[i] = c;
								lastMatch = i;
								break;
							}
						}
						if (pos > test.length) {
							break;
						}
					} else if (buffer[i] === test.charAt(pos) && i !== partialPosition) {
						pos++;
						lastMatch = i;
					}
				}
				if (allow) {
					writeBuffer();
				} else if (lastMatch + 1 < partialPosition) {
					//input.val("");
				    //clearBuffer(0, len);
				    writeBuffer();
				    input.val(input.val().substring(0, lastMatch + 1));
				} else {
					writeBuffer();
					input.val(input.val().substring(0, lastMatch + 1));
				}
				return (partialPosition ? i : firstNonMaskPos);
			}

			input.data($.mask.dataName,function(){
				return $.map(buffer, function(c, i) {
					return tests[i]&&c!=settings.placeholder ? c : null;
				}).join('');
			});

			if (!input.attr("readonly"))
				input
				.one("unmask", function() {
					input
						.unbind(".mask")
						.removeData($.mask.dataName);
				})
				.bind("focus.mask", function() {
					clearTimeout(caretTimeoutId);
					var pos,
						moveCaret;

					focusText = input.val();
					pos = checkVal();
					
					caretTimeoutId = setTimeout(function(){
						writeBuffer();
						if (pos == mask.length) {
							input.caret(0, pos);
						} else {
							input.caret(pos);
						}
					}, 10);
				})
				.bind("blur.mask", function() {
					checkVal();
					/*if (input.val() != focusText)
						input.change();*/
				})
				.bind("keydown.mask", keydownEvent)
				.bind("keypress.mask", keypressEvent)
				.bind(pasteEventName, function() {
					setTimeout(function() { 
						var pos=checkVal(true);
						input.caret(pos); 
						if (settings.completed && pos == input.val().length)
							settings.completed.call(input);
					}, 0);
				});
			checkVal(); //Perform initial check for existing values
		});
	}
});


})(jQuery);
;;;/*
 * qTip2 - Pretty powerful tooltips - v2.2.0
 * http://qtip2.com
 *
 * Copyright (c) 2014 Craig Michael Thompson
 * Released under the MIT, GPL licenses
 * http://jquery.org/license
 *
 * Date: Sat Mar 15 2014 11:30 EDT-0400
 * Plugins: None
 * Styles: basic
 */
/*global window: false, jQuery: false, console: false, define: false */

/* Cache window, document, undefined */
(function (window, document, undefined) {

    // Uses AMD or browser globals to create a jQuery plugin.
    (function (factory) {
        "use strict";
        if (typeof define === 'function' && define.amd) {
            define(['jquery'], factory);
        }
        else if (jQuery && !jQuery.fn.qtip) {
            factory(jQuery);
        }
    }
    (function ($) {
        "use strict"; // Enable ECMAScript "strict" operation for this function. See more: http://ejohn.org/blog/ecmascript-5-strict-mode-json-and-more/

        ;// Munge the primitives - Paul Irish tip
        var TRUE = true,
        FALSE = false,
        NULL = null,

        // Common variables
        X = 'x', Y = 'y',
        WIDTH = 'width',
        HEIGHT = 'height',

        // Positioning sides
        TOP = 'top',
        LEFT = 'left',
        BOTTOM = 'bottom',
        RIGHT = 'right',
        CENTER = 'center',

        // Position adjustment types
        FLIP = 'flip',
        FLIPINVERT = 'flipinvert',
        SHIFT = 'shift',

        // Shortcut vars
        QTIP, PROTOTYPE, CORNER, CHECKS,
        PLUGINS = {},
        NAMESPACE = 'qtip',
        ATTR_HAS = 'data-hasqtip',
        ATTR_ID = 'data-qtip-id',
        WIDGET = ['ui-widget', 'ui-tooltip'],
        SELECTOR = '.' + NAMESPACE,
        INACTIVE_EVENTS = 'click dblclick mousedown mouseup mousemove mouseleave mouseenter'.split(' '),

        CLASS_FIXED = NAMESPACE + '-fixed',
        CLASS_DEFAULT = NAMESPACE + '-default',
        CLASS_FOCUS = NAMESPACE + '-focus',
        CLASS_HOVER = NAMESPACE + '-hover',
        CLASS_DISABLED = NAMESPACE + '-disabled',

        replaceSuffix = '_replacedByqTip',
        oldtitle = 'oldtitle',
        trackingBound,

        // Browser detection
        BROWSER = {
            /*
             * IE version detection
             *
             * Adapted from: http://ajaxian.com/archives/attack-of-the-ie-conditional-comment
             * Credit to James Padolsey for the original implemntation!
             */
            ie: (function () {
                var v = 3, div = document.createElement('div');
                while ((div.innerHTML = '<!--[if gt IE ' + (++v) + ']><i></i><![endif]-->')) {
                    if (!div.getElementsByTagName('i')[0]) { break; }
                }
                return v > 4 ? v : NaN;
            }()),

            /*
             * iOS version detection
             */
            iOS: parseFloat(
                ('' + (/CPU.*OS ([0-9_]{1,5})|(CPU like).*AppleWebKit.*Mobile/i.exec(navigator.userAgent) || [0, ''])[1])
                .replace('undefined', '3_2').replace('_', '.').replace('_', '')
            ) || FALSE
        };

        ; function QTip(target, options, id, attr) {
            // Elements and ID
            this.id = id;
            this.target = target;
            this.tooltip = NULL;
            this.elements = { target: target };

            // Internal constructs
            this._id = NAMESPACE + '-' + id;
            this.timers = { img: {} };
            this.options = options;
            this.plugins = {};

            // Cache object
            this.cache = {
                event: {},
                target: $(),
                disabled: FALSE,
                attr: attr,
                onTooltip: FALSE,
                lastClass: ''
            };

            // Set the initial flags
            this.rendered = this.destroyed = this.disabled = this.waiting =
                this.hiddenDuringWait = this.positioning = this.triggering = FALSE;
        }
        PROTOTYPE = QTip.prototype;

        PROTOTYPE._when = function (deferreds) {
            return $.when.apply($, deferreds);
        };

        PROTOTYPE.render = function (show) {
            if (this.rendered || this.destroyed) { return this; } // If tooltip has already been rendered, exit

            var self = this,
                options = this.options,
                cache = this.cache,
                elements = this.elements,
                text = options.content.text,
                title = options.content.title,
                button = options.content.button,
                posOptions = options.position,
                namespace = '.' + this._id + ' ',
                deferreds = [],
                tooltip;

            // Add ARIA attributes to target
            $.attr(this.target[0], 'aria-describedby', this._id);

            // Create tooltip element
            this.tooltip = elements.tooltip = tooltip = $('<div/>', {
                'id': this._id,
                'class': [NAMESPACE, CLASS_DEFAULT, options.style.classes, NAMESPACE + '-pos-' + options.position.my.abbrev()].join(' '),
                'width': options.style.width || '',
                'height': options.style.height || '',
                'tracking': posOptions.target === 'mouse' && posOptions.adjust.mouse,

                /* ARIA specific attributes */
                'role': 'alert',
                'aria-live': 'polite',
                'aria-atomic': FALSE,
                'aria-describedby': this._id + '-content',
                'aria-hidden': TRUE
            })
            .toggleClass(CLASS_DISABLED, this.disabled)
            .attr(ATTR_ID, this.id)
            .data(NAMESPACE, this)
            .appendTo(posOptions.container)
            .append(
                // Create content element
                elements.content = $('<div />', {
                    'class': NAMESPACE + '-content',
                    'id': this._id + '-content',
                    'aria-atomic': TRUE
                })
            );

            // Set rendered flag and prevent redundant reposition calls for now
            this.rendered = -1;
            this.positioning = TRUE;

            // Create title...
            if (title) {
                this._createTitle();

                // Update title only if its not a callback (called in toggle if so)
                if (!$.isFunction(title)) {
                    deferreds.push(this._updateTitle(title, FALSE));
                }
            }

            // Create button
            if (button) { this._createButton(); }

            // Set proper rendered flag and update content if not a callback function (called in toggle)
            if (!$.isFunction(text)) {
                deferreds.push(this._updateContent(text, FALSE));
            }
            this.rendered = TRUE;

            // Setup widget classes
            this._setWidget();

            // Initialize 'render' plugins
            $.each(PLUGINS, function (name) {
                var instance;
                if (this.initialize === 'render' && (instance = this(self))) {
                    self.plugins[name] = instance;
                }
            });

            // Unassign initial events and assign proper events
            this._unassignEvents();
            this._assignEvents();

            // When deferreds have completed
            this._when(deferreds).then(function () {
                // tooltiprender event
                self._trigger('render');

                // Reset flags
                self.positioning = FALSE;

                // Show tooltip if not hidden during wait period
                if (!self.hiddenDuringWait && (options.show.ready || show)) {
                    self.toggle(TRUE, cache.event, FALSE);
                }
                self.hiddenDuringWait = FALSE;
            });

            // Expose API
            QTIP.api[this.id] = this;

            return this;
        };

        PROTOTYPE.destroy = function (immediate) {
            // Set flag the signify destroy is taking place to plugins
            // and ensure it only gets destroyed once!
            if (this.destroyed) { return this.target; }

            function process() {
                if (this.destroyed) { return; }
                this.destroyed = TRUE;

                var target = this.target,
                    title = target.attr(oldtitle);

                // Destroy tooltip if rendered
                if (this.rendered) {
                    this.tooltip.stop(1, 0).find('*').remove().end().remove();
                }

                // Destroy all plugins
                $.each(this.plugins, function (name) {
                    this.destroy && this.destroy();
                });

                // Clear timers and remove bound events
                clearTimeout(this.timers.show);
                clearTimeout(this.timers.hide);
                this._unassignEvents();

                // Remove api object and ARIA attributes
                target.removeData(NAMESPACE)
                    .removeAttr(ATTR_ID)
                    .removeAttr(ATTR_HAS)
                    .removeAttr('aria-describedby');

                // Reset old title attribute if removed
                if (this.options.suppress && title) {
                    target.attr('title', title).removeAttr(oldtitle);
                }

                // Remove qTip events associated with this API
                this._unbind(target);

                // Remove ID from used id objects, and delete object references
                // for better garbage collection and leak protection
                this.options = this.elements = this.cache = this.timers =
                    this.plugins = this.mouse = NULL;

                // Delete epoxsed API object
                delete QTIP.api[this.id];
            }

            // If an immediate destory is needed
            if ((immediate !== TRUE || this.triggering === 'hide') && this.rendered) {
                this.tooltip.one('tooltiphidden', $.proxy(process, this));
                !this.triggering && this.hide();
            }

                // If we're not in the process of hiding... process
            else { process.call(this); }

            return this.target;
        };

        ; function invalidOpt(a) {
            return a === NULL || $.type(a) !== 'object';
        }

        function invalidContent(c) {
            return !($.isFunction(c) || (c && c.attr) || c.length || ($.type(c) === 'object' && (c.jquery || c.then)));
        }

        // Option object sanitizer
        function sanitizeOptions(opts) {
            var content, text, ajax, once;

            if (invalidOpt(opts)) { return FALSE; }

            if (invalidOpt(opts.metadata)) {
                opts.metadata = { type: opts.metadata };
            }

            if ('content' in opts) {
                content = opts.content;

                if (invalidOpt(content) || content.jquery || content.done) {
                    content = opts.content = {
                        text: (text = invalidContent(content) ? FALSE : content)
                    };
                }
                else { text = content.text; }

                // DEPRECATED - Old content.ajax plugin functionality
                // Converts it into the proper Deferred syntax
                if ('ajax' in content) {
                    ajax = content.ajax;
                    once = ajax && ajax.once !== FALSE;
                    delete content.ajax;

                    content.text = function (event, api) {
                        var loading = text || $(this).attr(api.options.content.attr) || 'Loading...',

                        deferred = $.ajax(
                            $.extend({}, ajax, { context: api })
                        )
                        .then(ajax.success, NULL, ajax.error)
                        .then(function (content) {
                            if (content && once) { api.set('content.text', content); }
                            return content;
                        },
                        function (xhr, status, error) {
                            if (api.destroyed || xhr.status === 0) { return; }
                            api.set('content.text', status + ': ' + error);
                        });

                        return !once ? (api.set('content.text', loading), deferred) : loading;
                    };
                }

                if ('title' in content) {
                    if (!invalidOpt(content.title)) {
                        content.button = content.title.button;
                        content.title = content.title.text;
                    }

                    if (invalidContent(content.title || FALSE)) {
                        content.title = FALSE;
                    }
                }
            }

            if ('position' in opts && invalidOpt(opts.position)) {
                opts.position = { my: opts.position, at: opts.position };
            }

            if ('show' in opts && invalidOpt(opts.show)) {
                opts.show = opts.show.jquery ? { target: opts.show } :
                    opts.show === TRUE ? { ready: TRUE } : { event: opts.show };
            }

            if ('hide' in opts && invalidOpt(opts.hide)) {
                opts.hide = opts.hide.jquery ? { target: opts.hide } : { event: opts.hide };
            }

            if ('style' in opts && invalidOpt(opts.style)) {
                opts.style = { classes: opts.style };
            }

            // Sanitize plugin options
            $.each(PLUGINS, function () {
                this.sanitize && this.sanitize(opts);
            });

            return opts;
        }

        // Setup builtin .set() option checks
        CHECKS = PROTOTYPE.checks = {
            builtin: {
                // Core checks
                '^id$': function (obj, o, v, prev) {
                    var id = v === TRUE ? QTIP.nextid : v,
                        new_id = NAMESPACE + '-' + id;

                    if (id !== FALSE && id.length > 0 && !$('#' + new_id).length) {
                        this._id = new_id;

                        if (this.rendered) {
                            this.tooltip[0].id = this._id;
                            this.elements.content[0].id = this._id + '-content';
                            this.elements.title[0].id = this._id + '-title';
                        }
                    }
                    else { obj[o] = prev; }
                },
                '^prerender': function (obj, o, v) {
                    v && !this.rendered && this.render(this.options.show.ready);
                },

                // Content checks
                '^content.text$': function (obj, o, v) {
                    this._updateContent(v);
                },
                '^content.attr$': function (obj, o, v, prev) {
                    if (this.options.content.text === this.target.attr(prev)) {
                        this._updateContent(this.target.attr(v));
                    }
                },
                '^content.title$': function (obj, o, v) {
                    // Remove title if content is null
                    if (!v) { return this._removeTitle(); }

                    // If title isn't already created, create it now and update
                    v && !this.elements.title && this._createTitle();
                    this._updateTitle(v);
                },
                '^content.button$': function (obj, o, v) {
                    this._updateButton(v);
                },
                '^content.title.(text|button)$': function (obj, o, v) {
                    this.set('content.' + o, v); // Backwards title.text/button compat
                },

                // Position checks
                '^position.(my|at)$': function (obj, o, v) {
                    'string' === typeof v && (obj[o] = new CORNER(v, o === 'at'));
                },
                '^position.container$': function (obj, o, v) {
                    this.rendered && this.tooltip.appendTo(v);
                },

                // Show checks
                '^show.ready$': function (obj, o, v) {
                    v && (!this.rendered && this.render(TRUE) || this.toggle(TRUE));
                },

                // Style checks
                '^style.classes$': function (obj, o, v, p) {
                    this.rendered && this.tooltip.removeClass(p).addClass(v);
                },
                '^style.(width|height)': function (obj, o, v) {
                    this.rendered && this.tooltip.css(o, v);
                },
                '^style.widget|content.title': function () {
                    this.rendered && this._setWidget();
                },
                '^style.def': function (obj, o, v) {
                    this.rendered && this.tooltip.toggleClass(CLASS_DEFAULT, !!v);
                },

                // Events check
                '^events.(render|show|move|hide|focus|blur)$': function (obj, o, v) {
                    this.rendered && this.tooltip[($.isFunction(v) ? '' : 'un') + 'bind']('tooltip' + o, v);
                },

                // Properties which require event reassignment
                '^(show|hide|position).(event|target|fixed|inactive|leave|distance|viewport|adjust)': function () {
                    if (!this.rendered) { return; }

                    // Set tracking flag
                    var posOptions = this.options.position;
                    this.tooltip.attr('tracking', posOptions.target === 'mouse' && posOptions.adjust.mouse);

                    // Reassign events
                    this._unassignEvents();
                    this._assignEvents();
                }
            }
        };

        // Dot notation converter
        function convertNotation(options, notation) {
            var i = 0, obj, option = options,

            // Split notation into array
            levels = notation.split('.');

            // Loop through
            while (option = option[levels[i++]]) {
                if (i < levels.length) { obj = option; }
            }

            return [obj || options, levels.pop()];
        }

        PROTOTYPE.get = function (notation) {
            if (this.destroyed) { return this; }

            var o = convertNotation(this.options, notation.toLowerCase()),
                result = o[0][o[1]];

            return result.precedance ? result.string() : result;
        };

        function setCallback(notation, args) {
            var category, rule, match;

            for (category in this.checks) {
                for (rule in this.checks[category]) {
                    if (match = (new RegExp(rule, 'i')).exec(notation)) {
                        args.push(match);

                        if (category === 'builtin' || this.plugins[category]) {
                            this.checks[category][rule].apply(
                                this.plugins[category] || this, args
                            );
                        }
                    }
                }
            }
        }

        var rmove = /^position\.(my|at|adjust|target|container|viewport)|style|content|show\.ready/i,
            rrender = /^prerender|show\.ready/i;

        PROTOTYPE.set = function (option, value) {
            if (this.destroyed) { return this; }

            var rendered = this.rendered,
                reposition = FALSE,
                options = this.options,
                checks = this.checks,
                name;

            // Convert singular option/value pair into object form
            if ('string' === typeof option) {
                name = option; option = {}; option[name] = value;
            }
            else { option = $.extend({}, option); }

            // Set all of the defined options to their new values
            $.each(option, function (notation, value) {
                if (rendered && rrender.test(notation)) {
                    delete option[notation]; return;
                }

                // Set new obj value
                var obj = convertNotation(options, notation.toLowerCase()), previous;
                previous = obj[0][obj[1]];
                obj[0][obj[1]] = value && value.nodeType ? $(value) : value;

                // Also check if we need to reposition
                reposition = rmove.test(notation) || reposition;

                // Set the new params for the callback
                option[notation] = [obj[0], obj[1], value, previous];
            });

            // Re-sanitize options
            sanitizeOptions(options);

            /*
             * Execute any valid callbacks for the set options
             * Also set positioning flag so we don't get loads of redundant repositioning calls.
             */
            this.positioning = TRUE;
            $.each(option, $.proxy(setCallback, this));
            this.positioning = FALSE;

            // Update position if needed
            if (this.rendered && this.tooltip[0].offsetWidth > 0 && reposition) {
                this.reposition(options.position.target === 'mouse' ? NULL : this.cache.event);
            }

            return this;
        };

        ; PROTOTYPE._update = function (content, element, reposition) {
            var self = this,
                cache = this.cache;

            // Make sure tooltip is rendered and content is defined. If not return
            if (!this.rendered || !content) { return FALSE; }

            // Use function to parse content
            if ($.isFunction(content)) {
                content = content.call(this.elements.target, cache.event, this) || '';
            }

            // Handle deferred content
            if ($.isFunction(content.then)) {
                cache.waiting = TRUE;
                return content.then(function (c) {
                    cache.waiting = FALSE;
                    return self._update(c, element);
                }, NULL, function (e) {
                    return self._update(e, element);
                });
            }

            // If content is null... return false
            if (content === FALSE || (!content && content !== '')) { return FALSE; }

            // Append new content if its a DOM array and show it if hidden
            if (content.jquery && content.length > 0) {
                element.empty().append(
                    content.css({ display: 'block', visibility: 'visible' })
                );
            }

                // Content is a regular string, insert the new content
            else { element.html(content); }

            // Wait for content to be loaded, and reposition
            return this._waitForContent(element).then(function (images) {
                if (images.images && images.images.length && self.rendered && self.tooltip[0].offsetWidth > 0) {
                    self.reposition(cache.event, !images.length);
                }
            });
        };

        PROTOTYPE._waitForContent = function (element) {
            var cache = this.cache;

            // Set flag
            cache.waiting = TRUE;

            // If imagesLoaded is included, ensure images have loaded and return promise
            return ($.fn.imagesLoaded ? element.imagesLoaded() : $.Deferred().resolve([]))
                .done(function () { cache.waiting = FALSE; })
                .promise();
        };

        PROTOTYPE._updateContent = function (content, reposition) {
            this._update(content, this.elements.content, reposition);
        };

        PROTOTYPE._updateTitle = function (content, reposition) {
            if (this._update(content, this.elements.title, reposition) === FALSE) {
                this._removeTitle(FALSE);
            }
        };

        PROTOTYPE._createTitle = function () {
            var elements = this.elements,
                id = this._id + '-title';

            // Destroy previous title element, if present
            if (elements.titlebar) { this._removeTitle(); }

            // Create title bar and title elements
            elements.titlebar = $('<div />', {
                'class': NAMESPACE + '-titlebar ' + (this.options.style.widget ? createWidgetClass('header') : '')
            })
            .append(
                elements.title = $('<div />', {
                    'id': id,
                    'class': NAMESPACE + '-title',
                    'aria-atomic': TRUE
                })
            )
            .insertBefore(elements.content)

            // Button-specific events
            .delegate('.qtip-close', 'mousedown keydown mouseup keyup mouseout', function (event) {
                $(this).toggleClass('ui-state-active ui-state-focus', event.type.substr(-4) === 'down');
            })
            .delegate('.qtip-close', 'mouseover mouseout', function (event) {
                $(this).toggleClass('ui-state-hover', event.type === 'mouseover');
            });

            // Create button if enabled
            if (this.options.content.button) { this._createButton(); }
        };

        PROTOTYPE._removeTitle = function (reposition) {
            var elements = this.elements;

            if (elements.title) {
                elements.titlebar.remove();
                elements.titlebar = elements.title = elements.button = NULL;

                // Reposition if enabled
                if (reposition !== FALSE) { this.reposition(); }
            }
        };

        ; PROTOTYPE.reposition = function (event, effect) {
            if (!this.rendered || this.positioning || this.destroyed) { return this; }

            // Set positioning flag
            this.positioning = TRUE;

            var cache = this.cache,
                tooltip = this.tooltip,
                posOptions = this.options.position,
                target = posOptions.target,
                my = posOptions.my,
                at = posOptions.at,
                viewport = posOptions.viewport,
                container = posOptions.container,
                adjust = posOptions.adjust,
                method = adjust.method.split(' '),
                tooltipWidth = tooltip.outerWidth(FALSE),
                tooltipHeight = tooltip.outerHeight(FALSE),
                targetWidth = 0,
                targetHeight = 0,
                type = tooltip.css('position'),
                position = { left: 0, top: 0 },
                visible = tooltip[0].offsetWidth > 0,
                isScroll = event && event.type === 'scroll',
                win = $(window),
                doc = container[0].ownerDocument,
                mouse = this.mouse,
                pluginCalculations, offset;

            // Check if absolute position was passed
            if ($.isArray(target) && target.length === 2) {
                // Force left top and set position
                at = { x: LEFT, y: TOP };
                position = { left: target[0], top: target[1] };
            }

                // Check if mouse was the target
            else if (target === 'mouse') {
                // Force left top to allow flipping
                at = { x: LEFT, y: TOP };

                // Use the cached mouse coordinates if available, or passed event has no coordinates
                if (mouse && mouse.pageX && (adjust.mouse || !event || !event.pageX)) {
                    event = mouse;
                }

                    // If the passed event has no coordinates (such as a scroll event)
                else if (!event || !event.pageX) {
                    // Use the mouse origin that caused the show event, if distance hiding is enabled
                    if ((!adjust.mouse || this.options.show.distance) && cache.origin && cache.origin.pageX) {
                        event = cache.origin;
                    }

                        // Use cached event for resize/scroll events
                    else if (!event || (event && (event.type === 'resize' || event.type === 'scroll'))) {
                        event = cache.event;
                    }
                }

                // Calculate body and container offset and take them into account below
                if (type !== 'static') { position = container.offset(); }
                if (doc.body.offsetWidth !== (window.innerWidth || doc.documentElement.clientWidth)) {
                    offset = $(document.body).offset();
                }

                // Use event coordinates for position
                position = {
                    left: event.pageX - position.left + (offset && offset.left || 0),
                    top: event.pageY - position.top + (offset && offset.top || 0)
                };

                // Scroll events are a pain, some browsers
                if (adjust.mouse && isScroll && mouse) {
                    position.left -= (mouse.scrollX || 0) - win.scrollLeft();
                    position.top -= (mouse.scrollY || 0) - win.scrollTop();
                }
            }

                // Target wasn't mouse or absolute...
            else {
                // Check if event targetting is being used
                if (target === 'event') {
                    if (event && event.target && event.type !== 'scroll' && event.type !== 'resize') {
                        cache.target = $(event.target);
                    }
                    else if (!event.target) {
                        cache.target = this.elements.target;
                    }
                }
                else if (target !== 'event') {
                    cache.target = $(target.jquery ? target : this.elements.target);
                }
                target = cache.target;

                // Parse the target into a jQuery object and make sure there's an element present
                target = $(target).eq(0);
                if (target.length === 0) { return this; }

                    // Check if window or document is the target
                else if (target[0] === document || target[0] === window) {
                    targetWidth = BROWSER.iOS ? window.innerWidth : target.width();
                    targetHeight = BROWSER.iOS ? window.innerHeight : target.height();

                    if (target[0] === window) {
                        position = {
                            top: (viewport || target).scrollTop(),
                            left: (viewport || target).scrollLeft()
                        };
                    }
                }

                    // Check if the target is an <AREA> element
                else if (PLUGINS.imagemap && target.is('area')) {
                    pluginCalculations = PLUGINS.imagemap(this, target, at, PLUGINS.viewport ? method : FALSE);
                }

                    // Check if the target is an SVG element
                else if (PLUGINS.svg && target && target[0].ownerSVGElement) {
                    pluginCalculations = PLUGINS.svg(this, target, at, PLUGINS.viewport ? method : FALSE);
                }

                    // Otherwise use regular jQuery methods
                else {
                    targetWidth = target.outerWidth(FALSE);
                    targetHeight = target.outerHeight(FALSE);
                    position = target.offset();
                }

                // Parse returned plugin values into proper variables
                if (pluginCalculations) {
                    targetWidth = pluginCalculations.width;
                    targetHeight = pluginCalculations.height;
                    offset = pluginCalculations.offset;
                    position = pluginCalculations.position;
                }

                // Adjust position to take into account offset parents
                position = this.reposition.offset(target, position, container);

                // Adjust for position.fixed tooltips (and also iOS scroll bug in v3.2-4.0 & v4.3-4.3.2)
                if ((BROWSER.iOS > 3.1 && BROWSER.iOS < 4.1) ||
                    (BROWSER.iOS >= 4.3 && BROWSER.iOS < 4.33) ||
                    (!BROWSER.iOS && type === 'fixed')
                ) {
                    position.left -= win.scrollLeft();
                    position.top -= win.scrollTop();
                }

                // Adjust position relative to target
                if (!pluginCalculations || (pluginCalculations && pluginCalculations.adjustable !== FALSE)) {
                    position.left += at.x === RIGHT ? targetWidth : at.x === CENTER ? targetWidth / 2 : 0;
                    position.top += at.y === BOTTOM ? targetHeight : at.y === CENTER ? targetHeight / 2 : 0;
                }
            }

            // Adjust position relative to tooltip
            position.left += adjust.x + (my.x === RIGHT ? -tooltipWidth : my.x === CENTER ? -tooltipWidth / 2 : 0);
            position.top += adjust.y + (my.y === BOTTOM ? -tooltipHeight : my.y === CENTER ? -tooltipHeight / 2 : 0);

            // Use viewport adjustment plugin if enabled
            if (PLUGINS.viewport) {
                position.adjusted = PLUGINS.viewport(
                    this, position, posOptions, targetWidth, targetHeight, tooltipWidth, tooltipHeight
                );

                // Apply offsets supplied by positioning plugin (if used)
                if (offset && position.adjusted.left) { position.left += offset.left; }
                if (offset && position.adjusted.top) { position.top += offset.top; }
            }

                // Viewport adjustment is disabled, set values to zero
            else { position.adjusted = { left: 0, top: 0 }; }

            // tooltipmove event
            if (!this._trigger('move', [position, viewport.elem || viewport], event)) { return this; }
            delete position.adjusted;

            // If effect is disabled, target it mouse, no animation is defined or positioning gives NaN out, set CSS directly
            if (effect === FALSE || !visible || isNaN(position.left) || isNaN(position.top) || target === 'mouse' || !$.isFunction(posOptions.effect)) {
                tooltip.css(position);
            }

                // Use custom function if provided
            else if ($.isFunction(posOptions.effect)) {
                posOptions.effect.call(tooltip, this, $.extend({}, position));
                tooltip.queue(function (next) {
                    // Reset attributes to avoid cross-browser rendering bugs
                    $(this).css({ opacity: '', height: '' });
                    if (BROWSER.ie) { this.style.removeAttribute('filter'); }

                    next();
                });
            }

            // Set positioning flag
            this.positioning = FALSE;

            return this;
        };

        // Custom (more correct for qTip!) offset calculator
        PROTOTYPE.reposition.offset = function (elem, pos, container) {
            if (!container[0]) { return pos; }

            var ownerDocument = $(elem[0].ownerDocument),
                quirks = !!BROWSER.ie && document.compatMode !== 'CSS1Compat',
                parent = container[0],
                scrolled, position, parentOffset, overflow;

            function scroll(e, i) {
                pos.left += i * e.scrollLeft();
                pos.top += i * e.scrollTop();
            }

            // Compensate for non-static containers offset
            do {
                if ((position = $.css(parent, 'position')) !== 'static') {
                    if (position === 'fixed') {
                        parentOffset = parent.getBoundingClientRect();
                        scroll(ownerDocument, -1);
                    }
                    else {
                        parentOffset = $(parent).position();
                        parentOffset.left += (parseFloat($.css(parent, 'borderLeftWidth')) || 0);
                        parentOffset.top += (parseFloat($.css(parent, 'borderTopWidth')) || 0);
                    }

                    pos.left -= parentOffset.left + (parseFloat($.css(parent, 'marginLeft')) || 0);
                    pos.top -= parentOffset.top + (parseFloat($.css(parent, 'marginTop')) || 0);

                    // If this is the first parent element with an overflow of "scroll" or "auto", store it
                    if (!scrolled && (overflow = $.css(parent, 'overflow')) !== 'hidden' && overflow !== 'visible') { scrolled = $(parent); }
                }
            }
            while ((parent = parent.offsetParent));

            // Compensate for containers scroll if it also has an offsetParent (or in IE quirks mode)
            if (scrolled && (scrolled[0] !== ownerDocument[0] || quirks)) {
                scroll(scrolled, 1);
            }

            return pos;
        };

        // Corner class
        var C = (CORNER = PROTOTYPE.reposition.Corner = function (corner, forceY) {
            corner = ('' + corner).replace(/([A-Z])/, ' $1').replace(/middle/gi, CENTER).toLowerCase();
            this.x = (corner.match(/left|right/i) || corner.match(/center/) || ['inherit'])[0].toLowerCase();
            this.y = (corner.match(/top|bottom|center/i) || ['inherit'])[0].toLowerCase();
            this.forceY = !!forceY;

            var f = corner.charAt(0);
            this.precedance = (f === 't' || f === 'b' ? Y : X);
        }).prototype;

        C.invert = function (z, center) {
            this[z] = this[z] === LEFT ? RIGHT : this[z] === RIGHT ? LEFT : center || this[z];
        };

        C.string = function () {
            var x = this.x, y = this.y;
            return x === y ? x : this.precedance === Y || (this.forceY && y !== 'center') ? y + ' ' + x : x + ' ' + y;
        };

        C.abbrev = function () {
            var result = this.string().split(' ');
            return result[0].charAt(0) + (result[1] && result[1].charAt(0) || '');
        };

        C.clone = function () {
            return new CORNER(this.string(), this.forceY);
        };;
        PROTOTYPE.toggle = function (state, event) {
            var cache = this.cache,
                options = this.options,
                tooltip = this.tooltip;

            // Try to prevent flickering when tooltip overlaps show element
            if (event) {
                if ((/over|enter/).test(event.type) && (/out|leave/).test(cache.event.type) &&
                    options.show.target.add(event.target).length === options.show.target.length &&
                    tooltip.has(event.relatedTarget).length) {
                    return this;
                }

                // Cache event
                cache.event = cloneEvent(event);
            }

            // If we're currently waiting and we've just hidden... stop it
            this.waiting && !state && (this.hiddenDuringWait = TRUE);

            // Render the tooltip if showing and it isn't already
            if (!this.rendered) { return state ? this.render(1) : this; }
            else if (this.destroyed || this.disabled) { return this; }

            var type = state ? 'show' : 'hide',
                opts = this.options[type],
                otherOpts = this.options[!state ? 'show' : 'hide'],
                posOptions = this.options.position,
                contentOptions = this.options.content,
                width = this.tooltip.css('width'),
                visible = this.tooltip.is(':visible'),
                animate = state || opts.target.length === 1,
                sameTarget = !event || opts.target.length < 2 || cache.target[0] === event.target,
                identicalState, allow, showEvent, delay, after;

            // Detect state if valid one isn't provided
            if ((typeof state).search('boolean|number')) { state = !visible; }

            // Check if the tooltip is in an identical state to the new would-be state
            identicalState = !tooltip.is(':animated') && visible === state && sameTarget;

            // Fire tooltip(show/hide) event and check if destroyed
            allow = !identicalState ? !!this._trigger(type, [90]) : NULL;

            // Check to make sure the tooltip wasn't destroyed in the callback
            if (this.destroyed) { return this; }

            // If the user didn't stop the method prematurely and we're showing the tooltip, focus it
            if (allow !== FALSE && state) { this.focus(event); }

            // If the state hasn't changed or the user stopped it, return early
            if (!allow || identicalState) { return this; }

            // Set ARIA hidden attribute
            $.attr(tooltip[0], 'aria-hidden', !!!state);

            // Execute state specific properties
            if (state) {
                // Store show origin coordinates
                cache.origin = cloneEvent(this.mouse);

                // Update tooltip content & title if it's a dynamic function
                if ($.isFunction(contentOptions.text)) { this._updateContent(contentOptions.text, FALSE); }
                if ($.isFunction(contentOptions.title)) { this._updateTitle(contentOptions.title, FALSE); }

                // Cache mousemove events for positioning purposes (if not already tracking)
                if (!trackingBound && posOptions.target === 'mouse' && posOptions.adjust.mouse) {
                    $(document).bind('mousemove.' + NAMESPACE, this._storeMouse);
                    trackingBound = TRUE;
                }

                // Update the tooltip position (set width first to prevent viewport/max-width issues)
                if (!width) { tooltip.css('width', tooltip.outerWidth(FALSE)); }
                this.reposition(event, arguments[2]);
                if (!width) { tooltip.css('width', ''); }

                // Hide other tooltips if tooltip is solo
                if (!!opts.solo) {
                    (typeof opts.solo === 'string' ? $(opts.solo) : $(SELECTOR, opts.solo))
                        .not(tooltip).not(opts.target).qtip('hide', $.Event('tooltipsolo'));
                }
            }
            else {
                // Clear show timer if we're hiding
                clearTimeout(this.timers.show);

                // Remove cached origin on hide
                delete cache.origin;

                // Remove mouse tracking event if not needed (all tracking qTips are hidden)
                if (trackingBound && !$(SELECTOR + '[tracking="true"]:visible', opts.solo).not(tooltip).length) {
                    $(document).unbind('mousemove.' + NAMESPACE);
                    trackingBound = FALSE;
                }

                // Blur the tooltip
                this.blur(event);
            }

            // Define post-animation, state specific properties
            after = $.proxy(function () {
                if (state) {
                    // Prevent antialias from disappearing in IE by removing filter
                    if (BROWSER.ie) { tooltip[0].style.removeAttribute('filter'); }

                    // Remove overflow setting to prevent tip bugs
                    tooltip.css('overflow', '');

                    // Autofocus elements if enabled
                    if ('string' === typeof opts.autofocus) {
                        $(this.options.show.autofocus, tooltip).focus();
                    }

                    // If set, hide tooltip when inactive for delay period
                    this.options.show.target.trigger('qtip-' + this.id + '-inactive');
                }
                else {
                    // Reset CSS states
                    tooltip.css({
                        display: '',
                        visibility: '',
                        opacity: '',
                        left: '',
                        top: ''
                    });
                }

                // tooltipvisible/tooltiphidden events
                this._trigger(state ? 'visible' : 'hidden');
            }, this);

            // If no effect type is supplied, use a simple toggle
            if (opts.effect === FALSE || animate === FALSE) {
                tooltip[type]();
                after();
            }

                // Use custom function if provided
            else if ($.isFunction(opts.effect)) {
                tooltip.stop(1, 1);
                opts.effect.call(tooltip, this);
                tooltip.queue('fx', function (n) {
                    after(); n();
                });
            }

                // Use basic fade function by default
            else { tooltip.fadeTo(90, state ? 1 : 0, after); }

            // If inactive hide method is set, active it
            if (state) { opts.target.trigger('qtip-' + this.id + '-inactive'); }

            return this;
        };

        PROTOTYPE.show = function (event) { return this.toggle(TRUE, event); };

        PROTOTYPE.hide = function (event) { return this.toggle(FALSE, event); };

        ; PROTOTYPE.focus = function (event) {
            if (!this.rendered || this.destroyed) { return this; }

            var qtips = $(SELECTOR),
                tooltip = this.tooltip,
                curIndex = parseInt(tooltip[0].style.zIndex, 10),
                newIndex = QTIP.zindex + qtips.length,
                focusedElem;

            // Only update the z-index if it has changed and tooltip is not already focused
            if (!tooltip.hasClass(CLASS_FOCUS)) {
                // tooltipfocus event
                if (this._trigger('focus', [newIndex], event)) {
                    // Only update z-index's if they've changed
                    if (curIndex !== newIndex) {
                        // Reduce our z-index's and keep them properly ordered
                        qtips.each(function () {
                            if (this.style.zIndex > curIndex) {
                                this.style.zIndex = this.style.zIndex - 1;
                            }
                        });

                        // Fire blur event for focused tooltip
                        qtips.filter('.' + CLASS_FOCUS).qtip('blur', event);
                    }

                    // Set the new z-index
                    tooltip.addClass(CLASS_FOCUS)[0].style.zIndex = newIndex;
                }
            }

            return this;
        };

        PROTOTYPE.blur = function (event) {
            if (!this.rendered || this.destroyed) { return this; }

            // Set focused status to FALSE
            this.tooltip.removeClass(CLASS_FOCUS);

            // tooltipblur event
            this._trigger('blur', [this.tooltip.css('zIndex')], event);

            return this;
        };

        ; PROTOTYPE.disable = function (state) {
            if (this.destroyed) { return this; }

            // If 'toggle' is passed, toggle the current state
            if (state === 'toggle') {
                state = !(this.rendered ? this.tooltip.hasClass(CLASS_DISABLED) : this.disabled);
            }

                // Disable if no state passed
            else if ('boolean' !== typeof state) {
                state = TRUE;
            }

            if (this.rendered) {
                this.tooltip.toggleClass(CLASS_DISABLED, state)
                    .attr('aria-disabled', state);
            }

            this.disabled = !!state;

            return this;
        };

        PROTOTYPE.enable = function () { return this.disable(FALSE); };

        ; PROTOTYPE._createButton = function () {
            var self = this,
                elements = this.elements,
                tooltip = elements.tooltip,
                button = this.options.content.button,
                isString = typeof button === 'string',
                close = isString ? button : 'Close tooltip';

            if (elements.button) { elements.button.remove(); }

            // Use custom button if one was supplied by user, else use default
            if (button.jquery) {
                elements.button = button;
            }
            else {
                elements.button = $('<a />', {
                    'class': 'qtip-close ' + (this.options.style.widget ? '' : NAMESPACE + '-icon'),
                    'title': close,
                    'aria-label': close
                })
                .prepend(
                    $('<span />', {
                        'class': 'ui-icon ui-icon-close',
                        'html': '&times;'
                    })
                );
            }

            // Create button and setup attributes
            elements.button.appendTo(elements.titlebar || tooltip)
                .attr('role', 'button')
                .click(function (event) {
                    if (!tooltip.hasClass(CLASS_DISABLED)) { self.hide(event); }
                    return FALSE;
                });
        };

        PROTOTYPE._updateButton = function (button) {
            // Make sure tooltip is rendered and if not, return
            if (!this.rendered) { return FALSE; }

            var elem = this.elements.button;
            if (button) { this._createButton(); }
            else { elem.remove(); }
        };

        ;// Widget class creator
        function createWidgetClass(cls) {
            return WIDGET.concat('').join(cls ? '-' + cls + ' ' : ' ');
        }

        // Widget class setter method
        PROTOTYPE._setWidget = function () {
            var on = this.options.style.widget,
                elements = this.elements,
                tooltip = elements.tooltip,
                disabled = tooltip.hasClass(CLASS_DISABLED);

            tooltip.removeClass(CLASS_DISABLED);
            CLASS_DISABLED = on ? 'ui-state-disabled' : 'qtip-disabled';
            tooltip.toggleClass(CLASS_DISABLED, disabled);

            tooltip.toggleClass('ui-helper-reset ' + createWidgetClass(), on).toggleClass(CLASS_DEFAULT, this.options.style.def && !on);

            if (elements.content) {
                elements.content.toggleClass(createWidgetClass('content'), on);
            }
            if (elements.titlebar) {
                elements.titlebar.toggleClass(createWidgetClass('header'), on);
            }
            if (elements.button) {
                elements.button.toggleClass(NAMESPACE + '-icon', !on);
            }
        };; function cloneEvent(event) {
            return event && {
                type: event.type,
                pageX: event.pageX,
                pageY: event.pageY,
                target: event.target,
                relatedTarget: event.relatedTarget,
                scrollX: event.scrollX || window.pageXOffset || document.body.scrollLeft || document.documentElement.scrollLeft,
                scrollY: event.scrollY || window.pageYOffset || document.body.scrollTop || document.documentElement.scrollTop
            } || {};
        }

        function delay(callback, duration) {
            // If tooltip has displayed, start hide timer
            if (duration > 0) {
                return setTimeout(
                    $.proxy(callback, this), duration
                );
            }
            else { callback.call(this); }
        }

        function showMethod(event) {
            if (this.tooltip.hasClass(CLASS_DISABLED)) { return FALSE; }

            // Clear hide timers
            clearTimeout(this.timers.show);
            clearTimeout(this.timers.hide);

            // Start show timer
            this.timers.show = delay.call(this,
                function () { this.toggle(TRUE, event); },
                this.options.show.delay
            );
        }

        function hideMethod(event) {
            if (this.tooltip.hasClass(CLASS_DISABLED)) { return FALSE; }

            // Check if new target was actually the tooltip element
            var relatedTarget = $(event.relatedTarget),
                ontoTooltip = relatedTarget.closest(SELECTOR)[0] === this.tooltip[0],
                ontoTarget = relatedTarget[0] === this.options.show.target[0];

            // Clear timers and stop animation queue
            clearTimeout(this.timers.show);
            clearTimeout(this.timers.hide);

            // Prevent hiding if tooltip is fixed and event target is the tooltip.
            // Or if mouse positioning is enabled and cursor momentarily overlaps
            if (this !== relatedTarget[0] &&
                (this.options.position.target === 'mouse' && ontoTooltip) ||
                (this.options.hide.fixed && (
                    (/mouse(out|leave|move)/).test(event.type) && (ontoTooltip || ontoTarget))
                )) {
                try {
                    event.preventDefault();
                    event.stopImmediatePropagation();
                } catch (e) { }

                return;
            }

            // If tooltip has displayed, start hide timer
            this.timers.hide = delay.call(this,
                function () { this.toggle(FALSE, event); },
                this.options.hide.delay,
                this
            );
        }

        function inactiveMethod(event) {
            if (this.tooltip.hasClass(CLASS_DISABLED) || !this.options.hide.inactive) { return FALSE; }

            // Clear timer
            clearTimeout(this.timers.inactive);

            this.timers.inactive = delay.call(this,
                function () { this.hide(event); },
                this.options.hide.inactive
            );
        }

        function repositionMethod(event) {
            if (this.rendered && this.tooltip[0].offsetWidth > 0) { this.reposition(event); }
        }

        // Store mouse coordinates
        PROTOTYPE._storeMouse = function (event) {
            (this.mouse = cloneEvent(event)).type = 'mousemove';
        };

        // Bind events
        PROTOTYPE._bind = function (targets, events, method, suffix, context) {
            var ns = '.' + this._id + (suffix ? '-' + suffix : '');
            events.length && $(targets).bind(
                (events.split ? events : events.join(ns + ' ')) + ns,
                $.proxy(method, context || this)
            );
        };
        PROTOTYPE._unbind = function (targets, suffix) {
            $(targets).unbind('.' + this._id + (suffix ? '-' + suffix : ''));
        };

        // Apply common event handlers using delegate (avoids excessive .bind calls!)
        var ns = '.' + NAMESPACE;
        function delegate(selector, events, method) {
            $(document.body).delegate(selector,
                (events.split ? events : events.join(ns + ' ')) + ns,
                function () {
                    var api = QTIP.api[$.attr(this, ATTR_ID)];
                    api && !api.disabled && method.apply(api, arguments);
                }
            );
        }

        $(function () {
            delegate(SELECTOR, ['mouseenter', 'mouseleave'], function (event) {
                var state = event.type === 'mouseenter',
                    tooltip = $(event.currentTarget),
                    target = $(event.relatedTarget || event.target),
                    options = this.options;

                // On mouseenter...
                if (state) {
                    // Focus the tooltip on mouseenter (z-index stacking)
                    this.focus(event);

                    // Clear hide timer on tooltip hover to prevent it from closing
                    tooltip.hasClass(CLASS_FIXED) && !tooltip.hasClass(CLASS_DISABLED) && clearTimeout(this.timers.hide);
                }

                    // On mouseleave...
                else {
                    // Hide when we leave the tooltip and not onto the show target (if a hide event is set)
                    if (options.position.target === 'mouse' && options.hide.event &&
                        options.show.target && !target.closest(options.show.target[0]).length) {
                        this.hide(event);
                    }
                }

                // Add hover class
                tooltip.toggleClass(CLASS_HOVER, state);
            });

            // Define events which reset the 'inactive' event handler
            delegate('[' + ATTR_ID + ']', INACTIVE_EVENTS, inactiveMethod);
        });

        // Event trigger
        PROTOTYPE._trigger = function (type, args, event) {
            var callback = $.Event('tooltip' + type);
            callback.originalEvent = (event && $.extend({}, event)) || this.cache.event || NULL;

            this.triggering = type;
            this.tooltip.trigger(callback, [this].concat(args || []));
            this.triggering = FALSE;

            return !callback.isDefaultPrevented();
        };

        PROTOTYPE._bindEvents = function (showEvents, hideEvents, showTarget, hideTarget, showMethod, hideMethod) {
            // If hide and show targets are the same...
            if (hideTarget.add(showTarget).length === hideTarget.length) {
                var toggleEvents = [];

                // Filter identical show/hide events
                hideEvents = $.map(hideEvents, function (type) {
                    var showIndex = $.inArray(type, showEvents);

                    // Both events are identical, remove from both hide and show events
                    // and append to toggleEvents
                    if (showIndex > -1) {
                        toggleEvents.push(showEvents.splice(showIndex, 1)[0]);
                        return;
                    }

                    return type;
                });

                // Toggle events are special case of identical show/hide events, which happen in sequence
                toggleEvents.length && this._bind(showTarget, toggleEvents, function (event) {
                    var state = this.rendered ? this.tooltip[0].offsetWidth > 0 : false;
                    (state ? hideMethod : showMethod).call(this, event);
                });
            }

            // Apply show/hide/toggle events
            this._bind(showTarget, showEvents, showMethod);
            this._bind(hideTarget, hideEvents, hideMethod);
        };

        PROTOTYPE._assignInitialEvents = function (event) {
            var options = this.options,
                showTarget = options.show.target,
                hideTarget = options.hide.target,
                showEvents = options.show.event ? $.trim('' + options.show.event).split(' ') : [],
                hideEvents = options.hide.event ? $.trim('' + options.hide.event).split(' ') : [];

            /*
             * Make sure hoverIntent functions properly by using mouseleave as a hide event if
             * mouseenter/mouseout is used for show.event, even if it isn't in the users options.
             */
            if (/mouse(over|enter)/i.test(options.show.event) && !/mouse(out|leave)/i.test(options.hide.event)) {
                hideEvents.push('mouseleave');
            }

            /*
             * Also make sure initial mouse targetting works correctly by caching mousemove coords
             * on show targets before the tooltip has rendered. Also set onTarget when triggered to
             * keep mouse tracking working.
             */
            this._bind(showTarget, 'mousemove', function (event) {
                this._storeMouse(event);
                this.cache.onTarget = TRUE;
            });

            // Define hoverIntent function
            function hoverIntent(event) {
                // Only continue if tooltip isn't disabled
                if (this.disabled || this.destroyed) { return FALSE; }

                // Cache the event data
                this.cache.event = cloneEvent(event);
                this.cache.target = event ? $(event.target) : [undefined];

                // Start the event sequence
                clearTimeout(this.timers.show);
                this.timers.show = delay.call(this,
                    function () { this.render(typeof event === 'object' || options.show.ready); },
                    options.show.delay
                );
            }

            // Filter and bind events
            this._bindEvents(showEvents, hideEvents, showTarget, hideTarget, hoverIntent, function () {
                clearTimeout(this.timers.show);
            });

            // Prerendering is enabled, create tooltip now
            if (options.show.ready || options.prerender) { hoverIntent.call(this, event); }
        };

        // Event assignment method
        PROTOTYPE._assignEvents = function () {
            var self = this,
                options = this.options,
                posOptions = options.position,

                tooltip = this.tooltip,
                showTarget = options.show.target,
                hideTarget = options.hide.target,
                containerTarget = posOptions.container,
                viewportTarget = posOptions.viewport,
                documentTarget = $(document),
                bodyTarget = $(document.body),
                windowTarget = $(window),

                showEvents = options.show.event ? $.trim('' + options.show.event).split(' ') : [],
                hideEvents = options.hide.event ? $.trim('' + options.hide.event).split(' ') : [];


            // Assign passed event callbacks
            $.each(options.events, function (name, callback) {
                self._bind(tooltip, name === 'toggle' ? ['tooltipshow', 'tooltiphide'] : ['tooltip' + name], callback, null, tooltip);
            });

            // Hide tooltips when leaving current window/frame (but not select/option elements)
            if (/mouse(out|leave)/i.test(options.hide.event) && options.hide.leave === 'window') {
                this._bind(documentTarget, ['mouseout', 'blur'], function (event) {
                    if (!/select|option/.test(event.target.nodeName) && !event.relatedTarget) {
                        this.hide(event);
                    }
                });
            }

            // Enable hide.fixed by adding appropriate class
            if (options.hide.fixed) {
                hideTarget = hideTarget.add(tooltip.addClass(CLASS_FIXED));
            }

                /*
                 * Make sure hoverIntent functions properly by using mouseleave to clear show timer if
                 * mouseenter/mouseout is used for show.event, even if it isn't in the users options.
                 */
            else if (/mouse(over|enter)/i.test(options.show.event)) {
                this._bind(hideTarget, 'mouseleave', function () {
                    clearTimeout(this.timers.show);
                });
            }

            // Hide tooltip on document mousedown if unfocus events are enabled
            if (('' + options.hide.event).indexOf('unfocus') > -1) {
                this._bind(containerTarget.closest('html'), ['mousedown', 'touchstart'], function (event) {
                    var elem = $(event.target),
                        enabled = this.rendered && !this.tooltip.hasClass(CLASS_DISABLED) && this.tooltip[0].offsetWidth > 0,
                        isAncestor = elem.parents(SELECTOR).filter(this.tooltip[0]).length > 0;

                    if (elem[0] !== this.target[0] && elem[0] !== this.tooltip[0] && !isAncestor &&
                        !this.target.has(elem[0]).length && enabled
                    ) {
                        this.hide(event);
                    }
                });
            }

            // Check if the tooltip hides when inactive
            if ('number' === typeof options.hide.inactive) {
                // Bind inactive method to show target(s) as a custom event
                this._bind(showTarget, 'qtip-' + this.id + '-inactive', inactiveMethod);

                // Define events which reset the 'inactive' event handler
                this._bind(hideTarget.add(tooltip), QTIP.inactiveEvents, inactiveMethod, '-inactive');
            }

            // Filter and bind events
            this._bindEvents(showEvents, hideEvents, showTarget, hideTarget, showMethod, hideMethod);

            // Mouse movement bindings
            this._bind(showTarget.add(tooltip), 'mousemove', function (event) {
                // Check if the tooltip hides when mouse is moved a certain distance
                if ('number' === typeof options.hide.distance) {
                    var origin = this.cache.origin || {},
                        limit = this.options.hide.distance,
                        abs = Math.abs;

                    // Check if the movement has gone beyond the limit, and hide it if so
                    if (abs(event.pageX - origin.pageX) >= limit || abs(event.pageY - origin.pageY) >= limit) {
                        this.hide(event);
                    }
                }

                // Cache mousemove coords on show targets
                this._storeMouse(event);
            });

            // Mouse positioning events
            if (posOptions.target === 'mouse') {
                // If mouse adjustment is on...
                if (posOptions.adjust.mouse) {
                    // Apply a mouseleave event so we don't get problems with overlapping
                    if (options.hide.event) {
                        // Track if we're on the target or not
                        this._bind(showTarget, ['mouseenter', 'mouseleave'], function (event) {
                            this.cache.onTarget = event.type === 'mouseenter';
                        });
                    }

                    // Update tooltip position on mousemove
                    this._bind(documentTarget, 'mousemove', function (event) {
                        // Update the tooltip position only if the tooltip is visible and adjustment is enabled
                        if (this.rendered && this.cache.onTarget && !this.tooltip.hasClass(CLASS_DISABLED) && this.tooltip[0].offsetWidth > 0) {
                            this.reposition(event);
                        }
                    });
                }
            }

            // Adjust positions of the tooltip on window resize if enabled
            if (posOptions.adjust.resize || viewportTarget.length) {
                this._bind($.event.special.resize ? viewportTarget : windowTarget, 'resize', repositionMethod);
            }

            // Adjust tooltip position on scroll of the window or viewport element if present
            if (posOptions.adjust.scroll) {
                this._bind(windowTarget.add(posOptions.container), 'scroll', repositionMethod);
            }
        };

        // Un-assignment method
        PROTOTYPE._unassignEvents = function () {
            var targets = [
                this.options.show.target[0],
                this.options.hide.target[0],
                this.rendered && this.tooltip[0],
                this.options.position.container[0],
                this.options.position.viewport[0],
                this.options.position.container.closest('html')[0], // unfocus
                window,
                document
            ];

            this._unbind($([]).pushStack($.grep(targets, function (i) {
                return typeof i === 'object';
            })));
        };

        ;// Initialization method
        function init(elem, id, opts) {
            var obj, posOptions, attr, config, title,

            // Setup element references
            docBody = $(document.body),

            // Use document body instead of document element if needed
            newTarget = elem[0] === document ? docBody : elem,

            // Grab metadata from element if plugin is present
            metadata = (elem.metadata) ? elem.metadata(opts.metadata) : NULL,

            // If metadata type if HTML5, grab 'name' from the object instead, or use the regular data object otherwise
            metadata5 = opts.metadata.type === 'html5' && metadata ? metadata[opts.metadata.name] : NULL,

            // Grab data from metadata.name (or data-qtipopts as fallback) using .data() method,
            html5 = elem.data(opts.metadata.name || 'qtipopts');

            // If we don't get an object returned attempt to parse it manualyl without parseJSON
            try { html5 = typeof html5 === 'string' ? $.parseJSON(html5) : html5; } catch (e) { }

            // Merge in and sanitize metadata
            config = $.extend(TRUE, {}, QTIP.defaults, opts,
                typeof html5 === 'object' ? sanitizeOptions(html5) : NULL,
                sanitizeOptions(metadata5 || metadata));

            // Re-grab our positioning options now we've merged our metadata and set id to passed value
            posOptions = config.position;
            config.id = id;

            // Setup missing content if none is detected
            if ('boolean' === typeof config.content.text) {
                attr = elem.attr(config.content.attr);

                // Grab from supplied attribute if available
                if (config.content.attr !== FALSE && attr) { config.content.text = attr; }

                    // No valid content was found, abort render
                else { return FALSE; }
            }

            // Setup target options
            if (!posOptions.container.length) { posOptions.container = docBody; }
            if (posOptions.target === FALSE) { posOptions.target = newTarget; }
            if (config.show.target === FALSE) { config.show.target = newTarget; }
            if (config.show.solo === TRUE) { config.show.solo = posOptions.container.closest('body'); }
            if (config.hide.target === FALSE) { config.hide.target = newTarget; }
            if (config.position.viewport === TRUE) { config.position.viewport = posOptions.container; }

            // Ensure we only use a single container
            posOptions.container = posOptions.container.eq(0);

            // Convert position corner values into x and y strings
            posOptions.at = new CORNER(posOptions.at, TRUE);
            posOptions.my = new CORNER(posOptions.my);

            // Destroy previous tooltip if overwrite is enabled, or skip element if not
            if (elem.data(NAMESPACE)) {
                if (config.overwrite) {
                    elem.qtip('destroy', true);
                }
                else if (config.overwrite === FALSE) {
                    return FALSE;
                }
            }

            // Add has-qtip attribute
            elem.attr(ATTR_HAS, id);

            // Remove title attribute and store it if present
            if (config.suppress && (title = elem.attr('title'))) {
                // Final attr call fixes event delegatiom and IE default tooltip showing problem
                elem.removeAttr('title').attr(oldtitle, title).attr('title', '');
            }

            // Initialize the tooltip and add API reference
            obj = new QTip(elem, config, id, !!attr);
            elem.data(NAMESPACE, obj);

            // Catch remove/removeqtip events on target element to destroy redundant tooltip
            elem.one('remove.qtip-' + id + ' removeqtip.qtip-' + id, function () {
                var api; if ((api = $(this).data(NAMESPACE))) { api.destroy(true); }
            });

            return obj;
        }

        // jQuery $.fn extension method
        QTIP = $.fn.qtip = function (options, notation, newValue) {
            var command = ('' + options).toLowerCase(), // Parse command
                returned = NULL,
                args = $.makeArray(arguments).slice(1),
                event = args[args.length - 1],
                opts = this[0] ? $.data(this[0], NAMESPACE) : NULL;

            // Check for API request
            if ((!arguments.length && opts) || command === 'api') {
                return opts;
            }

                // Execute API command if present
            else if ('string' === typeof options) {
                this.each(function () {
                    var api = $.data(this, NAMESPACE);
                    if (!api) { return TRUE; }

                    // Cache the event if possible
                    if (event && event.timeStamp) { api.cache.event = event; }

                    // Check for specific API commands
                    if (notation && (command === 'option' || command === 'options')) {
                        if (newValue !== undefined || $.isPlainObject(notation)) {
                            api.set(notation, newValue);
                        }
                        else {
                            returned = api.get(notation);
                            return FALSE;
                        }
                    }

                        // Execute API command
                    else if (api[command]) {
                        api[command].apply(api, args);
                    }
                });

                return returned !== NULL ? returned : this;
            }

                // No API commands. validate provided options and setup qTips
            else if ('object' === typeof options || !arguments.length) {
                // Sanitize options first
                opts = sanitizeOptions($.extend(TRUE, {}, options));

                return this.each(function (i) {
                    var api, id;

                    // Find next available ID, or use custom ID if provided
                    id = $.isArray(opts.id) ? opts.id[i] : opts.id;
                    id = !id || id === FALSE || id.length < 1 || QTIP.api[id] ? QTIP.nextid++ : id;

                    // Initialize the qTip and re-grab newly sanitized options
                    api = init($(this), id, opts);
                    if (api === FALSE) { return TRUE; }
                    else { QTIP.api[id] = api; }

                    // Initialize plugins
                    $.each(PLUGINS, function () {
                        if (this.initialize === 'initialize') { this(api); }
                    });

                    // Assign initial pre-render events
                    api._assignInitialEvents(event);
                });
            }
        };

        // Expose class
        $.qtip = QTip;

        // Populated in render method
        QTIP.api = {};
        ; $.each({
            /* Allow other plugins to successfully retrieve the title of an element with a qTip applied */
            attr: function (attr, val) {
                if (this.length) {
                    var self = this[0],
                        title = 'title',
                        api = $.data(self, 'qtip');

                    if (attr === title && api && 'object' === typeof api && api.options.suppress) {
                        if (arguments.length < 2) {
                            return $.attr(self, oldtitle);
                        }

                        // If qTip is rendered and title was originally used as content, update it
                        if (api && api.options.content.attr === title && api.cache.attr) {
                            api.set('content.text', val);
                        }

                        // Use the regular attr method to set, then cache the result
                        return this.attr(oldtitle, val);
                    }
                }

                return $.fn['attr' + replaceSuffix].apply(this, arguments);
            },

            /* Allow clone to correctly retrieve cached title attributes */
            clone: function (keepData) {
                var titles = $([]), title = 'title',

                // Clone our element using the real clone method
                elems = $.fn['clone' + replaceSuffix].apply(this, arguments);

                // Grab all elements with an oldtitle set, and change it to regular title attribute, if keepData is false
                if (!keepData) {
                    elems.filter('[' + oldtitle + ']').attr('title', function () {
                        return $.attr(this, oldtitle);
                    })
                    .removeAttr(oldtitle);
                }

                return elems;
            }
        }, function (name, func) {
            if (!func || $.fn[name + replaceSuffix]) { return TRUE; }

            var old = $.fn[name + replaceSuffix] = $.fn[name];
            $.fn[name] = function () {
                return func.apply(this, arguments) || old.apply(this, arguments);
            };
        });

        /* Fire off 'removeqtip' handler in $.cleanData if jQuery UI not present (it already does similar).
         * This snippet is taken directly from jQuery UI source code found here:
         *     http://code.jquery.com/ui/jquery-ui-git.js
         */
        if (!$.ui) {
            $['cleanData' + replaceSuffix] = $.cleanData;
            $.cleanData = function (elems) {
                for (var i = 0, elem; (elem = $(elems[i])).length; i++) {
                    if (elem.attr(ATTR_HAS)) {
                        try { elem.triggerHandler('removeqtip'); }
                        catch (e) { }
                    }
                }
                $['cleanData' + replaceSuffix].apply(this, arguments);
            };
        }

        ;// qTip version
        QTIP.version = '2.2.0';

        // Base ID for all qTips
        QTIP.nextid = 0;

        // Inactive events array
        QTIP.inactiveEvents = INACTIVE_EVENTS;

        // Base z-index for all qTips
        QTIP.zindex = 15000;

        // Define configuration defaults
        QTIP.defaults = {
            prerender: FALSE,
            id: FALSE,
            overwrite: TRUE,
            suppress: TRUE,
            content: {
                text: TRUE,
                attr: 'title',
                title: FALSE,
                button: FALSE
            },
            position: {
                my: 'top left',
                at: 'bottom right',
                target: FALSE,
                container: FALSE,
                viewport: FALSE,
                adjust: {
                    x: 0, y: 0,
                    mouse: TRUE,
                    scroll: TRUE,
                    resize: TRUE,
                    method: 'flipinvert flipinvert'
                },
                effect: function (api, pos, viewport) {
                    $(this).animate(pos, {
                        duration: 200,
                        queue: FALSE
                    });
                }
            },
            show: {
                target: FALSE,
                event: 'mouseenter',
                effect: TRUE,
                delay: 90,
                solo: FALSE,
                ready: FALSE,
                autofocus: FALSE
            },
            hide: {
                target: FALSE,
                event: 'mouseleave',
                effect: TRUE,
                delay: 0,
                fixed: FALSE,
                inactive: FALSE,
                leave: 'window',
                distance: FALSE
            },
            style: {
                classes: '',
                widget: FALSE,
                width: FALSE,
                height: FALSE,
                def: TRUE
            },
            events: {
                render: NULL,
                move: NULL,
                show: NULL,
                hide: NULL,
                toggle: NULL,
                visible: NULL,
                hidden: NULL,
                focus: NULL,
                blur: NULL
            }
        };

        ;
    }));
}(window, document));



;;;!function(e){"use strict";function t(e,t){if(this.createTextRange){var a=this.createTextRange();a.collapse(!0),a.moveStart("character",e),a.moveEnd("character",t-e),a.select()}else this.setSelectionRange&&(this.focus(),this.setSelectionRange(e,t))}function a(e){var t=this.value.length;if(e="start"==e.toLowerCase()?"Start":"End",document.selection){var a,i,n,l=document.selection.createRange();return a=l.duplicate(),a.expand("textedit"),a.setEndPoint("EndToEnd",l),i=a.text.length-l.text.length,n=i+l.text.length,"Start"==e?i:n}return"undefined"!=typeof this["selection"+e]&&(t=this["selection"+e]),t}var i={codes:{46:127,188:44,109:45,190:46,191:47,192:96,220:92,222:39,221:93,219:91,173:45,187:61,186:59,189:45,110:46},shifts:{96:"~",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",48:")",45:"_",61:"+",91:"{",93:"}",92:"|",59:":",39:'"',44:"<",46:">",47:"?"}};e.fn.number=function(n,l,s,r){r="undefined"==typeof r?",":r,s="undefined"==typeof s?".":s,l="undefined"==typeof l?0:l;var u="\\u"+("0000"+s.charCodeAt(0).toString(16)).slice(-4),h=new RegExp("[^"+u+"0-9]","g"),o=new RegExp(u,"g");return n===!0?this.is("input:text")?this.on({"keydown.format":function(n){var u=e(this),h=u.data("numFormat"),o=n.keyCode?n.keyCode:n.which,c="",v=a.apply(this,["start"]),d=a.apply(this,["end"]),p="",f=!1;if(i.codes.hasOwnProperty(o)&&(o=i.codes[o]),!n.shiftKey&&o>=65&&90>=o?o+=32:!n.shiftKey&&o>=69&&105>=o?o-=48:n.shiftKey&&i.shifts.hasOwnProperty(o)&&(c=i.shifts[o]),""==c&&(c=String.fromCharCode(o)),8!=o&&45!=o&&127!=o&&c!=s&&!c.match(/[0-9]/)){var g=n.keyCode?n.keyCode:n.which;if(46==g||8==g||127==g||9==g||27==g||13==g||(65==g||82==g||80==g||83==g||70==g||72==g||66==g||74==g||84==g||90==g||61==g||173==g||48==g)&&(n.ctrlKey||n.metaKey)===!0||(86==g||67==g||88==g)&&(n.ctrlKey||n.metaKey)===!0||g>=35&&39>=g||g>=112&&123>=g)return;return n.preventDefault(),!1}if(0==v&&d==this.value.length?8==o?(v=d=1,this.value="",h.init=l>0?-1:0,h.c=l>0?-(l+1):0,t.apply(this,[0,0])):c==s?(v=d=1,this.value="0"+s+new Array(l+1).join("0"),h.init=l>0?1:0,h.c=l>0?-(l+1):0):45==o?(v=d=2,this.value="-0"+s+new Array(l+1).join("0"),h.init=l>0?1:0,h.c=l>0?-(l+1):0,t.apply(this,[2,2])):(h.init=l>0?-1:0,h.c=l>0?-l:0):h.c=d-this.value.length,h.isPartialSelection=v==d?!1:!0,l>0&&c==s&&v==this.value.length-l-1)h.c++,h.init=Math.max(0,h.init),n.preventDefault(),f=this.value.length+h.c;else if(45!=o||0==v&&0!=this.value.indexOf("-"))if(c==s)h.init=Math.max(0,h.init),n.preventDefault();else if(l>0&&127==o&&v==this.value.length-l-1)n.preventDefault();else if(l>0&&8==o&&v==this.value.length-l)n.preventDefault(),h.c--,f=this.value.length+h.c;else if(l>0&&127==o&&v>this.value.length-l-1){if(""===this.value)return;"0"!=this.value.slice(v,v+1)&&(p=this.value.slice(0,v)+"0"+this.value.slice(v+1),u.val(p)),n.preventDefault(),f=this.value.length+h.c}else if(l>0&&8==o&&v>this.value.length-l){if(""===this.value)return;"0"!=this.value.slice(v-1,v)&&(p=this.value.slice(0,v-1)+"0"+this.value.slice(v),u.val(p)),n.preventDefault(),h.c--,f=this.value.length+h.c}else 127==o&&this.value.slice(v,v+1)==r?n.preventDefault():8==o&&this.value.slice(v-1,v)==r?(n.preventDefault(),h.c--,f=this.value.length+h.c):l>0&&v==d&&this.value.length>l+1&&v>this.value.length-l-1&&isFinite(+c)&&!n.metaKey&&!n.ctrlKey&&!n.altKey&&1===c.length&&(p=d===this.value.length?this.value.slice(0,v-1):this.value.slice(0,v)+this.value.slice(v+1),this.value=p,f=v);else n.preventDefault();f!==!1&&t.apply(this,[f,f]),u.data("numFormat",h)},"keyup.format":function(i){var n,s=e(this),r=s.data("numFormat"),u=i.keyCode?i.keyCode:i.which,h=a.apply(this,["start"]),o=a.apply(this,["end"]);0!==h||0!==o||189!==u&&109!==u||(s.val("-"+s.val()),h=1,r.c=1-this.value.length,r.init=1,s.data("numFormat",r),n=this.value.length+r.c,t.apply(this,[n,n])),""===this.value||(48>u||u>57)&&(96>u||u>105)&&8!==u&&46!==u&&110!==u||(s.val(s.val()),l>0&&(r.init<1?(h=this.value.length-l-(r.init<0?1:0),r.c=h-this.value.length,r.init=1,s.data("numFormat",r)):h>this.value.length-l&&8!=u&&(r.c++,s.data("numFormat",r))),46!=u||r.isPartialSelection||(r.c++,s.data("numFormat",r)),n=this.value.length+r.c,t.apply(this,[n,n]))},"paste.format":function(t){var a=e(this),i=t.originalEvent,n=null;return window.clipboardData&&window.clipboardData.getData?n=window.clipboardData.getData("Text"):i.clipboardData&&i.clipboardData.getData&&(n=i.clipboardData.getData("text/plain")),a.val(n),t.preventDefault(),!1}}).each(function(){var t=e(this).data("numFormat",{c:-(l+1),decimals:l,thousands_sep:r,dec_point:s,regex_dec_num:h,regex_dec:o,init:this.value.indexOf(".")?!0:!1});""!==this.value&&t.val(t.val())}):this.each(function(){var t=e(this),a=+t.text().replace(h,"").replace(o,".");t.number(isFinite(a)?+a:0,l,s,r)}):this.text(e.number.apply(window,arguments))};var n=null,l=null;e.isPlainObject(e.valHooks.text)?(e.isFunction(e.valHooks.text.get)&&(n=e.valHooks.text.get),e.isFunction(e.valHooks.text.set)&&(l=e.valHooks.text.set)):e.valHooks.text={},e.valHooks.text.get=function(t){var a,i=e(t),l=i.data("numFormat");return l?""===t.value?"":(a=+t.value.replace(l.regex_dec_num,"").replace(l.regex_dec,"."),(0===t.value.indexOf("-")?"-":"")+(isFinite(a)?a:0)):e.isFunction(n)?n(t):void 0},e.valHooks.text.set=function(t,a){var i=e(t),n=i.data("numFormat");if(n){var s=e.number(a,n.decimals,n.dec_point,n.thousands_sep);return e.isFunction(l)?l(t,s):t.value=s}return e.isFunction(l)?l(t,a):void 0},e.number=function(e,t,a,i){i="undefined"==typeof i?"1000"!==new Number(1e3).toLocaleString()?new Number(1e3).toLocaleString().charAt(1):"":i,a="undefined"==typeof a?new Number(.1).toLocaleString().charAt(1):a,t=isFinite(+t)?Math.abs(t):0;var n="\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4),l="\\u"+("0000"+i.charCodeAt(0).toString(16)).slice(-4);e=(e+"").replace(".",a).replace(new RegExp(l,"g"),"").replace(new RegExp(n,"g"),".").replace(new RegExp("[^0-9+-Ee.]","g"),"");var s=isFinite(+e)?+e:0,r="",u=function(e,t){return""+ +(Math.round((""+e).indexOf("e")>0?e:e+"e+"+t)+"e-"+t)};return r=(t?u(s,t):""+Math.round(s)).split("."),r[0].length>3&&(r[0]=r[0].replace(/\B(?=(?:\d{3})+(?!\d))/g,i)),(r[1]||"").length<t&&(r[1]=r[1]||"",r[1]+=new Array(t-r[1].length+1).join("0")),r.join(a)}}(jQuery);
;;;/*
 * Note that this is toastr v2.1.3, the "latest" version in url has no more maintenance,
 * please go to https://cdnjs.com/libraries/toastr.js and pick a certain version you want to use,
 * make sure you copy the url from the website since the url may change between versions.
 * */
!function(e){e(["jquery"],function(e){return function(){function t(e,t,n){return g({type:O.error,iconClass:m().iconClasses.error,message:e,optionsOverride:n,title:t})}function n(t,n){return t||(t=m()),v=e("#"+t.containerId),v.length?v:(n&&(v=d(t)),v)}function o(e,t,n){return g({type:O.info,iconClass:m().iconClasses.info,message:e,optionsOverride:n,title:t})}function s(e){C=e}function i(e,t,n){return g({type:O.success,iconClass:m().iconClasses.success,message:e,optionsOverride:n,title:t})}function a(e,t,n){return g({type:O.warning,iconClass:m().iconClasses.warning,message:e,optionsOverride:n,title:t})}function r(e,t){var o=m();v||n(o),u(e,o,t)||l(o)}function c(t){var o=m();return v||n(o),t&&0===e(":focus",t).length?void h(t):void(v.children().length&&v.remove())}function l(t){for(var n=v.children(),o=n.length-1;o>=0;o--)u(e(n[o]),t)}function u(t,n,o){var s=!(!o||!o.force)&&o.force;return!(!t||!s&&0!==e(":focus",t).length)&&(t[n.hideMethod]({duration:n.hideDuration,easing:n.hideEasing,complete:function(){h(t)}}),!0)}function d(t){return v=e("<div/>").attr("id",t.containerId).addClass(t.positionClass),v.appendTo(e(t.target)),v}function p(){return{tapToDismiss:!0,toastClass:"toast",containerId:"toast-container",debug:!1,showMethod:"fadeIn",showDuration:300,showEasing:"swing",onShown:void 0,hideMethod:"fadeOut",hideDuration:1e3,hideEasing:"swing",onHidden:void 0,closeMethod:!1,closeDuration:!1,closeEasing:!1,closeOnHover:!0,extendedTimeOut:1e3,iconClasses:{error:"toast-error",info:"toast-info",success:"toast-success",warning:"toast-warning"},iconClass:"toast-info",positionClass:"toast-top-right",timeOut:5e3,titleClass:"toast-title",messageClass:"toast-message",escapeHtml:!1,target:"body",closeHtml:'<button type="button">&times;</button>',closeClass:"toast-close-button",newestOnTop:!0,preventDuplicates:!1,progressBar:!1,progressClass:"toast-progress",rtl:!1}}function f(e){C&&C(e)}function g(t){function o(e){return null==e&&(e=""),e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function s(){c(),u(),d(),p(),g(),C(),l(),i()}function i(){var e="";switch(t.iconClass){case"toast-success":case"toast-info":e="polite";break;default:e="assertive"}I.attr("aria-live",e)}function a(){E.closeOnHover&&I.hover(H,D),!E.onclick&&E.tapToDismiss&&I.click(b),E.closeButton&&j&&j.click(function(e){e.stopPropagation?e.stopPropagation():void 0!==e.cancelBubble&&e.cancelBubble!==!0&&(e.cancelBubble=!0),E.onCloseClick&&E.onCloseClick(e),b(!0)}),E.onclick&&I.click(function(e){E.onclick(e),b()})}function r(){I.hide(),I[E.showMethod]({duration:E.showDuration,easing:E.showEasing,complete:E.onShown}),E.timeOut>0&&(k=setTimeout(b,E.timeOut),F.maxHideTime=parseFloat(E.timeOut),F.hideEta=(new Date).getTime()+F.maxHideTime,E.progressBar&&(F.intervalId=setInterval(x,10)))}function c(){t.iconClass&&I.addClass(E.toastClass).addClass(y)}function l(){E.newestOnTop?v.prepend(I):v.append(I)}function u(){if(t.title){var e=t.title;E.escapeHtml&&(e=o(t.title)),M.append(e).addClass(E.titleClass),I.append(M)}}function d(){if(t.message){var e=t.message;E.escapeHtml&&(e=o(t.message)),B.append(e).addClass(E.messageClass),I.append(B)}}function p(){E.closeButton&&(j.addClass(E.closeClass).attr("role","button"),I.prepend(j))}function g(){E.progressBar&&(q.addClass(E.progressClass),I.prepend(q))}function C(){E.rtl&&I.addClass("rtl")}function O(e,t){if(e.preventDuplicates){if(t.message===w)return!0;w=t.message}return!1}function b(t){var n=t&&E.closeMethod!==!1?E.closeMethod:E.hideMethod,o=t&&E.closeDuration!==!1?E.closeDuration:E.hideDuration,s=t&&E.closeEasing!==!1?E.closeEasing:E.hideEasing;if(!e(":focus",I).length||t)return clearTimeout(F.intervalId),I[n]({duration:o,easing:s,complete:function(){h(I),clearTimeout(k),E.onHidden&&"hidden"!==P.state&&E.onHidden(),P.state="hidden",P.endTime=new Date,f(P)}})}function D(){(E.timeOut>0||E.extendedTimeOut>0)&&(k=setTimeout(b,E.extendedTimeOut),F.maxHideTime=parseFloat(E.extendedTimeOut),F.hideEta=(new Date).getTime()+F.maxHideTime)}function H(){clearTimeout(k),F.hideEta=0,I.stop(!0,!0)[E.showMethod]({duration:E.showDuration,easing:E.showEasing})}function x(){var e=(F.hideEta-(new Date).getTime())/F.maxHideTime*100;q.width(e+"%")}var E=m(),y=t.iconClass||E.iconClass;if("undefined"!=typeof t.optionsOverride&&(E=e.extend(E,t.optionsOverride),y=t.optionsOverride.iconClass||y),!O(E,t)){T++,v=n(E,!0);var k=null,I=e("<div/>"),M=e("<div/>"),B=e("<div/>"),q=e("<div/>"),j=e(E.closeHtml),F={intervalId:null,hideEta:null,maxHideTime:null},P={toastId:T,state:"visible",startTime:new Date,options:E,map:t};return s(),r(),a(),f(P),E.debug&&console&&console.log(P),I}}function m(){return e.extend({},p(),b.options)}function h(e){v||(v=n()),e.is(":visible")||(e.remove(),e=null,0===v.children().length&&(v.remove(),w=void 0))}var v,C,w,T=0,O={error:"error",info:"info",success:"success",warning:"warning"},b={clear:r,remove:c,error:t,getContainer:n,info:o,options:{},subscribe:s,success:i,version:"2.1.3",warning:a};return b}()})}("function"==typeof define&&define.amd?define:function(e,t){"undefined"!=typeof module&&module.exports?module.exports=t(require("jquery")):window.toastr=t(window.jQuery)});

;;;/**
 * speakingurl
 * @version v13.0.0
 * @link http://pid.github.io/speakingurl/
 * @license BSD
 * @author Sascha Droste
 */!function(a){"use strict";var e={"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"Ae","Å":"A","Æ":"AE","Ç":"C","È":"E","É":"E","Ê":"E","Ë":"E","Ì":"I","Í":"I","Î":"I","Ï":"I","Ð":"D","Ñ":"N","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"Oe","Ő":"O","Ø":"O","Ù":"U","Ú":"U","Û":"U","Ü":"Ue","Ű":"U","Ý":"Y","Þ":"TH","ß":"ss","à":"a","á":"a","â":"a","ã":"a","ä":"ae","å":"a","æ":"ae","ç":"c","è":"e","é":"e","ê":"e","ë":"e","ì":"i","í":"i","î":"i","ï":"i","ð":"d","ñ":"n","ò":"o","ó":"o","ô":"o","õ":"o","ö":"oe","ő":"o","ø":"o","ù":"u","ú":"u","û":"u","ü":"ue","ű":"u","ý":"y","þ":"th","ÿ":"y","ẞ":"SS","ا":"a","أ":"a","إ":"i","آ":"aa","ؤ":"u","ئ":"e","ء":"a","ب":"b","ت":"t","ث":"th","ج":"j","ح":"h","خ":"kh","د":"d","ذ":"th","ر":"r","ز":"z","س":"s","ش":"sh","ص":"s","ض":"dh","ط":"t","ظ":"z","ع":"a","غ":"gh","ف":"f","ق":"q","ك":"k","ل":"l","م":"m","ن":"n","ه":"h","و":"w","ي":"y","ى":"a","ة":"h","ﻻ":"la","ﻷ":"laa","ﻹ":"lai","ﻵ":"laa","گ":"g","چ":"ch","پ":"p","ژ":"zh","ک":"k","ی":"y","َ":"a","ً":"an","ِ":"e","ٍ":"en","ُ":"u","ٌ":"on","ْ":"","٠":"0","١":"1","٢":"2","٣":"3","٤":"4","٥":"5","٦":"6","٧":"7","٨":"8","٩":"9","۰":"0","۱":"1","۲":"2","۳":"3","۴":"4","۵":"5","۶":"6","۷":"7","۸":"8","۹":"9","က":"k","ခ":"kh","ဂ":"g","ဃ":"ga","င":"ng","စ":"s","ဆ":"sa","ဇ":"z","စျ":"za","ည":"ny","ဋ":"t","ဌ":"ta","ဍ":"d","ဎ":"da","ဏ":"na","တ":"t","ထ":"ta","ဒ":"d","ဓ":"da","န":"n","ပ":"p","ဖ":"pa","ဗ":"b","ဘ":"ba","မ":"m","ယ":"y","ရ":"ya","လ":"l","ဝ":"w","သ":"th","ဟ":"h","ဠ":"la","အ":"a","ြ":"y","ျ":"ya","ွ":"w","ြွ":"yw","ျွ":"ywa","ှ":"h","ဧ":"e","၏":"-e","ဣ":"i","ဤ":"-i","ဉ":"u","ဦ":"-u","ဩ":"aw","သြော":"aw","ဪ":"aw","၀":"0","၁":"1","၂":"2","၃":"3","၄":"4","၅":"5","၆":"6","၇":"7","၈":"8","၉":"9","္":"","့":"","း":"","č":"c","ď":"d","ě":"e","ň":"n","ř":"r","š":"s","ť":"t","ů":"u","ž":"z","Č":"C","Ď":"D","Ě":"E","Ň":"N","Ř":"R","Š":"S","Ť":"T","Ů":"U","Ž":"Z","ހ":"h","ށ":"sh","ނ":"n","ރ":"r","ބ":"b","ޅ":"lh","ކ":"k","އ":"a","ވ":"v","މ":"m","ފ":"f","ދ":"dh","ތ":"th","ލ":"l","ގ":"g","ޏ":"gn","ސ":"s","ޑ":"d","ޒ":"z","ޓ":"t","ޔ":"y","ޕ":"p","ޖ":"j","ޗ":"ch","ޘ":"tt","ޙ":"hh","ޚ":"kh","ޛ":"th","ޜ":"z","ޝ":"sh","ޞ":"s","ޟ":"d","ޠ":"t","ޡ":"z","ޢ":"a","ޣ":"gh","ޤ":"q","ޥ":"w","ަ":"a","ާ":"aa","ި":"i","ީ":"ee","ު":"u","ޫ":"oo","ެ":"e","ޭ":"ey","ޮ":"o","ޯ":"oa","ް":"","ა":"a","ბ":"b","გ":"g","დ":"d","ე":"e","ვ":"v","ზ":"z","თ":"t","ი":"i","კ":"k","ლ":"l","მ":"m","ნ":"n","ო":"o","პ":"p","ჟ":"zh","რ":"r","ს":"s","ტ":"t","უ":"u","ფ":"p","ქ":"k","ღ":"gh","ყ":"q","შ":"sh","ჩ":"ch","ც":"ts","ძ":"dz","წ":"ts","ჭ":"ch","ხ":"kh","ჯ":"j","ჰ":"h","α":"a","β":"v","γ":"g","δ":"d","ε":"e","ζ":"z","η":"i","θ":"th","ι":"i","κ":"k","λ":"l","μ":"m","ν":"n","ξ":"ks","ο":"o","π":"p","ρ":"r","σ":"s","τ":"t","υ":"y","φ":"f","χ":"x","ψ":"ps","ω":"o","ά":"a","έ":"e","ί":"i","ό":"o","ύ":"y","ή":"i","ώ":"o","ς":"s","ϊ":"i","ΰ":"y","ϋ":"y","ΐ":"i","Α":"A","Β":"B","Γ":"G","Δ":"D","Ε":"E","Ζ":"Z","Η":"I","Θ":"TH","Ι":"I","Κ":"K","Λ":"L","Μ":"M","Ν":"N","Ξ":"KS","Ο":"O","Π":"P","Ρ":"R","Σ":"S","Τ":"T","Υ":"Y","Φ":"F","Χ":"X","Ψ":"PS","Ω":"O","Ά":"A","Έ":"E","Ί":"I","Ό":"O","Ύ":"Y","Ή":"I","Ώ":"O","Ϊ":"I","Ϋ":"Y","ā":"a","ē":"e","ģ":"g","ī":"i","ķ":"k","ļ":"l","ņ":"n","ū":"u","Ā":"A","Ē":"E","Ģ":"G","Ī":"I","Ķ":"k","Ļ":"L","Ņ":"N","Ū":"U","Ќ":"Kj","ќ":"kj","Љ":"Lj","љ":"lj","Њ":"Nj","њ":"nj","Тс":"Ts","тс":"ts","ą":"a","ć":"c","ę":"e","ł":"l","ń":"n","ś":"s","ź":"z","ż":"z","Ą":"A","Ć":"C","Ę":"E","Ł":"L","Ń":"N","Ś":"S","Ź":"Z","Ż":"Z","Є":"Ye","І":"I","Ї":"Yi","Ґ":"G","є":"ye","і":"i","ї":"yi","ґ":"g","ă":"a","Ă":"A","ș":"s","Ș":"S","ț":"t","Ț":"T","ţ":"t","Ţ":"T","а":"a","б":"b","в":"v","г":"g","д":"d","е":"e","ё":"yo","ж":"zh","з":"z","и":"i","й":"i","к":"k","л":"l","м":"m","н":"n","о":"o","п":"p","р":"r","с":"s","т":"t","у":"u","ф":"f","х":"kh","ц":"c","ч":"ch","ш":"sh","щ":"sh","ъ":"","ы":"y","ь":"","э":"e","ю":"yu","я":"ya","А":"A","Б":"B","В":"V","Г":"G","Д":"D","Е":"E","Ё":"Yo","Ж":"Zh","З":"Z","И":"I","Й":"I","К":"K","Л":"L","М":"M","Н":"N","О":"O","П":"P","Р":"R","С":"S","Т":"T","У":"U","Ф":"F","Х":"Kh","Ц":"C","Ч":"Ch","Ш":"Sh","Щ":"Sh","Ъ":"","Ы":"Y","Ь":"","Э":"E","Ю":"Yu","Я":"Ya","ђ":"dj","ј":"j","ћ":"c","џ":"dz","Ђ":"Dj","Ј":"j","Ћ":"C","Џ":"Dz","ľ":"l","ĺ":"l","ŕ":"r","Ľ":"L","Ĺ":"L","Ŕ":"R","ş":"s","Ş":"S","ı":"i","İ":"I","ğ":"g","Ğ":"G","ả":"a","Ả":"A","ẳ":"a","Ẳ":"A","ẩ":"a","Ẩ":"A","đ":"d","Đ":"D","ẹ":"e","Ẹ":"E","ẽ":"e","Ẽ":"E","ẻ":"e","Ẻ":"E","ế":"e","Ế":"E","ề":"e","Ề":"E","ệ":"e","Ệ":"E","ễ":"e","Ễ":"E","ể":"e","Ể":"E","ỏ":"o","ọ":"o","Ọ":"o","ố":"o","Ố":"O","ồ":"o","Ồ":"O","ổ":"o","Ổ":"O","ộ":"o","Ộ":"O","ỗ":"o","Ỗ":"O","ơ":"o","Ơ":"O","ớ":"o","Ớ":"O","ờ":"o","Ờ":"O","ợ":"o","Ợ":"O","ỡ":"o","Ỡ":"O","Ở":"o","ở":"o","ị":"i","Ị":"I","ĩ":"i","Ĩ":"I","ỉ":"i","Ỉ":"i","ủ":"u","Ủ":"U","ụ":"u","Ụ":"U","ũ":"u","Ũ":"U","ư":"u","Ư":"U","ứ":"u","Ứ":"U","ừ":"u","Ừ":"U","ự":"u","Ự":"U","ữ":"u","Ữ":"U","ử":"u","Ử":"ư","ỷ":"y","Ỷ":"y","ỳ":"y","Ỳ":"Y","ỵ":"y","Ỵ":"Y","ỹ":"y","Ỹ":"Y","ạ":"a","Ạ":"A","ấ":"a","Ấ":"A","ầ":"a","Ầ":"A","ậ":"a","Ậ":"A","ẫ":"a","Ẫ":"A","ắ":"a","Ắ":"A","ằ":"a","Ằ":"A","ặ":"a","Ặ":"A","ẵ":"a","Ẵ":"A","“":'"',"”":'"',"‘":"'","’":"'","∂":"d","ƒ":"f","™":"(TM)","©":"(C)","œ":"oe","Œ":"OE","®":"(R)","†":"+","℠":"(SM)","…":"...","˚":"o","º":"o","ª":"a","•":"*","၊":",","။":".",$:"USD","€":"EUR","₢":"BRN","₣":"FRF","£":"GBP","₤":"ITL","₦":"NGN","₧":"ESP","₩":"KRW","₪":"ILS","₫":"VND","₭":"LAK","₮":"MNT","₯":"GRD","₱":"ARS","₲":"PYG","₳":"ARA","₴":"UAH","₵":"GHS","¢":"cent","¥":"CNY","元":"CNY","円":"YEN","﷼":"IRR","₠":"EWE","฿":"THB","₨":"INR","₹":"INR","₰":"PF","₺":"TRY","؋":"AFN","₼":"AZN","лв":"BGN","៛":"KHR","₡":"CRC","₸":"KZT","ден":"MKD","zł":"PLN","₽":"RUB","₾":"GEL"},n=["်","ް"],t={"ာ":"a","ါ":"a","ေ":"e","ဲ":"e","ိ":"i","ီ":"i","ို":"o","ု":"u","ူ":"u","ေါင်":"aung","ော":"aw","ော်":"aw","ေါ":"aw","ေါ်":"aw","်":"်","က်":"et","ိုက်":"aik","ောက်":"auk","င်":"in","ိုင်":"aing","ောင်":"aung","စ်":"it","ည်":"i","တ်":"at","ိတ်":"eik","ုတ်":"ok","ွတ်":"ut","ေတ်":"it","ဒ်":"d","ိုဒ်":"ok","ုဒ်":"ait","န်":"an","ာန်":"an","ိန်":"ein","ုန်":"on","ွန်":"un","ပ်":"at","ိပ်":"eik","ုပ်":"ok","ွပ်":"ut","န်ုပ်":"nub","မ်":"an","ိမ်":"ein","ုမ်":"on","ွမ်":"un","ယ်":"e","ိုလ်":"ol","ဉ်":"in","ံ":"an","ိံ":"ein","ုံ":"on","ައް":"ah","ަށް":"ah"},i={en:{},az:{"ç":"c","ə":"e","ğ":"g","ı":"i","ö":"o","ş":"s","ü":"u","Ç":"C","Ə":"E","Ğ":"G","İ":"I","Ö":"O","Ş":"S","Ü":"U"},cs:{"č":"c","ď":"d","ě":"e","ň":"n","ř":"r","š":"s","ť":"t","ů":"u","ž":"z","Č":"C","Ď":"D","Ě":"E","Ň":"N","Ř":"R","Š":"S","Ť":"T","Ů":"U","Ž":"Z"},fi:{"ä":"a","Ä":"A","ö":"o","Ö":"O"},hu:{"ä":"a","Ä":"A","ö":"o","Ö":"O","ü":"u","Ü":"U","ű":"u","Ű":"U"},lt:{"ą":"a","č":"c","ę":"e","ė":"e","į":"i","š":"s","ų":"u","ū":"u","ž":"z","Ą":"A","Č":"C","Ę":"E","Ė":"E","Į":"I","Š":"S","Ų":"U","Ū":"U"},lv:{"ā":"a","č":"c","ē":"e","ģ":"g","ī":"i","ķ":"k","ļ":"l","ņ":"n","š":"s","ū":"u","ž":"z","Ā":"A","Č":"C","Ē":"E","Ģ":"G","Ī":"i","Ķ":"k","Ļ":"L","Ņ":"N","Š":"S","Ū":"u","Ž":"Z"},pl:{"ą":"a","ć":"c","ę":"e","ł":"l","ń":"n","ó":"o","ś":"s","ź":"z","ż":"z","Ą":"A","Ć":"C","Ę":"e","Ł":"L","Ń":"N","Ó":"O","Ś":"S","Ź":"Z","Ż":"Z"},sk:{"ä":"a","Ä":"A"},sr:{"љ":"lj","њ":"nj","Љ":"Lj","Њ":"Nj","đ":"dj","Đ":"Dj"},tr:{"Ü":"U","Ö":"O","ü":"u","ö":"o"}},o={ar:{"∆":"delta","∞":"la-nihaya","♥":"hob","&":"wa","|":"aw","<":"aqal-men",">":"akbar-men","∑":"majmou","¤":"omla"},az:{},ca:{"∆":"delta","∞":"infinit","♥":"amor","&":"i","|":"o","<":"menys que",">":"mes que","∑":"suma dels","¤":"moneda"},cs:{"∆":"delta","∞":"nekonecno","♥":"laska","&":"a","|":"nebo","<":"mensi nez",">":"vetsi nez","∑":"soucet","¤":"mena"},de:{"∆":"delta","∞":"unendlich","♥":"Liebe","&":"und","|":"oder","<":"kleiner als",">":"groesser als","∑":"Summe von","¤":"Waehrung"},dv:{"∆":"delta","∞":"kolunulaa","♥":"loabi","&":"aai","|":"noonee","<":"ah vure kuda",">":"ah vure bodu","∑":"jumula","¤":"faisaa"},en:{"∆":"delta","∞":"infinity","♥":"love","&":"and","|":"or","<":"less than",">":"greater than","∑":"sum","¤":"currency"},es:{"∆":"delta","∞":"infinito","♥":"amor","&":"y","|":"u","<":"menos que",">":"mas que","∑":"suma de los","¤":"moneda"},fa:{"∆":"delta","∞":"bi-nahayat","♥":"eshgh","&":"va","|":"ya","<":"kamtar-az",">":"bishtar-az","∑":"majmooe","¤":"vahed"},fi:{"∆":"delta","∞":"aarettomyys","♥":"rakkaus","&":"ja","|":"tai","<":"pienempi kuin",">":"suurempi kuin","∑":"summa","¤":"valuutta"},fr:{"∆":"delta","∞":"infiniment","♥":"Amour","&":"et","|":"ou","<":"moins que",">":"superieure a","∑":"somme des","¤":"monnaie"},ge:{"∆":"delta","∞":"usasruloba","♥":"siqvaruli","&":"da","|":"an","<":"naklebi",">":"meti","∑":"jami","¤":"valuta"},gr:{},hu:{"∆":"delta","∞":"vegtelen","♥":"szerelem","&":"es","|":"vagy","<":"kisebb mint",">":"nagyobb mint","∑":"szumma","¤":"penznem"},it:{"∆":"delta","∞":"infinito","♥":"amore","&":"e","|":"o","<":"minore di",">":"maggiore di","∑":"somma","¤":"moneta"},lt:{"∆":"delta","∞":"begalybe","♥":"meile","&":"ir","|":"ar","<":"maziau nei",">":"daugiau nei","∑":"suma","¤":"valiuta"},lv:{"∆":"delta","∞":"bezgaliba","♥":"milestiba","&":"un","|":"vai","<":"mazak neka",">":"lielaks neka","∑":"summa","¤":"valuta"},my:{"∆":"kwahkhyaet","∞":"asaonasme","♥":"akhyait","&":"nhin","|":"tho","<":"ngethaw",">":"kyithaw","∑":"paungld","¤":"ngwekye"},mk:{},nl:{"∆":"delta","∞":"oneindig","♥":"liefde","&":"en","|":"of","<":"kleiner dan",">":"groter dan","∑":"som","¤":"valuta"},pl:{"∆":"delta","∞":"nieskonczonosc","♥":"milosc","&":"i","|":"lub","<":"mniejsze niz",">":"wieksze niz","∑":"suma","¤":"waluta"},pt:{"∆":"delta","∞":"infinito","♥":"amor","&":"e","|":"ou","<":"menor que",">":"maior que","∑":"soma","¤":"moeda"},ro:{"∆":"delta","∞":"infinit","♥":"dragoste","&":"si","|":"sau","<":"mai mic ca",">":"mai mare ca","∑":"suma","¤":"valuta"},ru:{"∆":"delta","∞":"beskonechno","♥":"lubov","&":"i","|":"ili","<":"menshe",">":"bolshe","∑":"summa","¤":"valjuta"},sk:{"∆":"delta","∞":"nekonecno","♥":"laska","&":"a","|":"alebo","<":"menej ako",">":"viac ako","∑":"sucet","¤":"mena"},sr:{},tr:{"∆":"delta","∞":"sonsuzluk","♥":"ask","&":"ve","|":"veya","<":"kucuktur",">":"buyuktur","∑":"toplam","¤":"para birimi"},uk:{"∆":"delta","∞":"bezkinechnist","♥":"lubov","&":"i","|":"abo","<":"menshe",">":"bilshe","∑":"suma","¤":"valjuta"},vn:{"∆":"delta","∞":"vo cuc","♥":"yeu","&":"va","|":"hoac","<":"nho hon",">":"lon hon","∑":"tong","¤":"tien te"}},u=[";","?",":","@","&","=","+","$",",","/"].join(""),s=[";","?",":","@","&","=","+","$",","].join(""),l=[".","!","~","*","'","(",")"].join(""),r=function(a,r){var m,d,g,k,y,f,p,z,b,A,v,E,j,O,S="-",w="",U="",C=!0,N={},R="";if("string"!=typeof a)return"";if("string"==typeof r&&(S=r),p=o.en,z=i.en,"object"==typeof r){m=r.maintainCase||!1,N=r.custom&&"object"==typeof r.custom?r.custom:N,g=+r.truncate>1&&r.truncate||!1,k=r.uric||!1,y=r.uricNoSlash||!1,f=r.mark||!1,C=r.symbols!==!1&&r.lang!==!1,S=r.separator||S,k&&(R+=u),y&&(R+=s),f&&(R+=l),p=r.lang&&o[r.lang]&&C?o[r.lang]:C?o.en:{},z=r.lang&&i[r.lang]?i[r.lang]:r.lang===!1||r.lang===!0?{}:i.en,r.titleCase&&"number"==typeof r.titleCase.length&&Array.prototype.toString.call(r.titleCase)?(r.titleCase.forEach(function(a){N[a+""]=a+""}),d=!0):d=!!r.titleCase,r.custom&&"number"==typeof r.custom.length&&Array.prototype.toString.call(r.custom)&&r.custom.forEach(function(a){N[a+""]=a+""}),Object.keys(N).forEach(function(e){var n;n=e.length>1?new RegExp("\\b"+h(e)+"\\b","gi"):new RegExp(h(e),"gi"),a=a.replace(n,N[e])});for(v in N)R+=v}for(R+=S,R=h(R),a=a.replace(/(^\s+|\s+$)/g,""),j=!1,O=!1,A=0,E=a.length;A<E;A++)v=a[A],c(v,N)?j=!1:z[v]?(v=j&&z[v].match(/[A-Za-z0-9]/)?" "+z[v]:z[v],j=!1):v in e?(A+1<E&&n.indexOf(a[A+1])>=0?(U+=v,v=""):O===!0?(v=t[U]+e[v],U=""):v=j&&e[v].match(/[A-Za-z0-9]/)?" "+e[v]:e[v],j=!1,O=!1):v in t?(U+=v,v="",A===E-1&&(v=t[U]),O=!0):!p[v]||k&&u.indexOf(v)!==-1||y&&s.indexOf(v)!==-1?(O===!0?(v=t[U]+v,U="",O=!1):j&&(/[A-Za-z0-9]/.test(v)||w.substr(-1).match(/A-Za-z0-9]/))&&(v=" "+v),j=!1):(v=j||w.substr(-1).match(/[A-Za-z0-9]/)?S+p[v]:p[v],v+=void 0!==a[A+1]&&a[A+1].match(/[A-Za-z0-9]/)?S:"",j=!0),w+=v.replace(new RegExp("[^\\w\\s"+R+"_-]","g"),S);return d&&(w=w.replace(/(\w)(\S*)/g,function(a,e,n){var t=e.toUpperCase()+(null!==n?n:"");return Object.keys(N).indexOf(t.toLowerCase())<0?t:t.toLowerCase()})),w=w.replace(/\s+/g,S).replace(new RegExp("\\"+S+"+","g"),S).replace(new RegExp("(^\\"+S+"+|\\"+S+"+$)","g"),""),g&&w.length>g&&(b=w.charAt(g)===S,w=w.slice(0,g),b||(w=w.slice(0,w.lastIndexOf(S)))),m||d||(w=w.toLowerCase()),w},m=function(a){return function(e){return r(e,a)}},h=function(a){return a.replace(/[-\\^$*+?.()|[\]{}\/]/g,"\\$&")},c=function(a,e){for(var n in e)if(e[n]===a)return!0};if("undefined"!=typeof module&&module.exports)module.exports=r,module.exports.createSlug=m;else if("undefined"!=typeof define&&define.amd)define([],function(){return r});else try{if(a.getSlug||a.createSlug)throw"speakingurl: globals exists /(getSlug|createSlug)/";a.getSlug=r,a.createSlug=m}catch(a){}}(this);
;;;String.prototype.replaceAll = function (search, replacement) {
    var target = this;
    return target.split(search).join(replacement);
};
;;;'use strict'

var Valcke = Valcke || {};
Valcke.webshop = {};
Valcke.webshop = (function () {

    var isResponsiveView = false;

    function initialise() {
        //Disable ajax cache for IE / EDGE :(
        $.ajaxSetup({ cache: false });

        applyWindowResize();
        applyScrollToTop();
        applySlidingMessage();
        applyTabletTooltips();

        Valcke.parameters.initialise();
        Valcke.navigation.loadUrl();
    }

    function getData(controller, action, data, callback, cache) {
        var rvToken = $("input[name='__RequestVerificationToken']").val();
        var moduleID = $("#hdnDnn_ModuleID").val();
        var tabID = $("#hdnDnn_TabID").val();

        var url = "/DesktopModules/MVC/ValckeVerven.Modules.Webshop.MVC/" + controller + "/" + action;

        if (cache === undefined || cache === null) {
            cache = false;
        }

        var request = $.ajax({
            url: url,
            method: "Get",
            headers: {
                "ModuleId": moduleID,
                "TabId": tabID,
                "RequestVerificationToken": rvToken
            },
            data: data,
            cache: cache
        }).done(function (data) {
            if (callback) {
                callback(data);
            }
        }).fail(function (ex) {
            if (ex.statusText != "abort") {
                showToastr("error", "Fout bij het ophalen van de data. Probeer nogmaals. Als de fout zich blijft voordoen, neem contact op met Valcke BV.");
                console.log("Fout bij ophalen data", ex);
            }
        }).always(function () {
            //
        });

        return request;
    }

    function applyScrollToTop() {
        $(window).scroll(function () {
            if ($(this).scrollTop() > 100) {
                $('#scrollup').fadeIn();
            } else {
                $('#scrollup').fadeOut();
            }
        });

        $('#scrollup').click(function () {
            scrollToTop();
            return false;
        });
    }

    function scrollToTop() {
        $("html, body").animate({
            scrollTop: 0
        }, 200);
    }

    function applyWindowResize() {
        $(window).resize(function () {
            windowResized();
        });
    }

    function windowResized() {
        if ($(window).width() + 20 < 990) {
            isResponsiveView = true;
        } else {
            isResponsiveView = false;
        }

        if (isResponsiveView) {
            Valcke.category.collapseCategories();
            Valcke.filter.collapseBrands();
            Valcke.filter.collapseFilters();
        } else {
            Valcke.category.expandCategories();
            Valcke.filter.expandBrands();
            Valcke.filter.expandFilters();
        }
    }

    function applyTabletTooltips() {
        //set tooltip manually on click
        $('body').on('click', '.hasTooltip', function () {
            $(".tooltipContainer").find(".newTooltip").remove();
            //var newTooltip = $(this).parents(".tooltipContainer").find(".newTooltip");

            $(this).parents(".tooltipContainer").append('<span class="newTooltip">' + $(this).attr("title") + '</span>');
            setTimeout(function () {
                $(".tooltipContainer").find(".newTooltip").remove();
            }, 2000);
        });

        $('body').on('click', '.newTooltip', function () {
            $(this).remove();
        });
    }

    function applySlidingMessage() {
        //$("#product-sliding-msg").portamento({
        //    wrapper: $('#valcke-webshopcontainer'),
        //    gap: 150
        //});

        $("#product-sliding-msg").click(function () {
            scrollToTop();
        });

        $(window).scroll(function () {
            checkSlidingMessage();
        });
    }

    function checkSlidingMessage() {
        try {
            if ($("#productList").length > 0 && $("#navbar").length > 0 && $("#product-sliding-msg").length > 0) {
                var currentPosition = $(window).scrollTop();
                var listOffsetTop = $("#productList").offset().top;
                var navHeight = $("#navbar").height();
                var listHeight = $("#productList").height();

                var shouldTrigger = currentPosition >= (listOffsetTop + listHeight - navHeight - 100);
                if (shouldTrigger) {
                    if (Valcke.product.getVisibleProductCount() > 0) {
                        $("#product-sliding-msg").fadeIn();
                    }
                } else {
                    $("#product-sliding-msg").fadeOut();
                }
            }
        }
        catch (err) {
            console.log("Error in scrolling event-handler");
        }
    }

    function showToastr(type, msg) {
        toastr.options.timeOut = 0;
        toastr.options.extendedTimeOut = 0;
        toastr.options.closeButton = true;

        if (type == "warning") {
            toastr.warning(msg);

        } else if (type == "error") {
            toastr.error(msg);
        }
    }

    function getUserID() {
        return $("#hdnUserID").val()
    }

    function getShoppingCartGuid() {
        return $("#hdnShoppingCartGuid").val()
    }

    return {
        initialise: initialise,
        getData: getData,
        getUserID: getUserID,
        getShoppingCartGuid: getShoppingCartGuid,
        applySlidingMessage: applySlidingMessage,
        checkSlidingMessage: checkSlidingMessage,
        windowResized: windowResized,
        showToastr: showToastr
    };
})();
;;;Valcke.constants = {};
Valcke.constants = {
    basePage: "/Webshop",
    navigationKeyword: {
        SEARCH: 'Search',
        CATEGORY: 'Categorie',
        FILTER: 'Filter',
        BRAND: 'Merk',
        WIZARD: 'Wizard',
        WIZARD_PLAATS: 'pl',
        WIZARD_TOESTAND: 'toe',
        WIZARD_OPPERVLAK: 'opp',
        WIZARD_TYPE: 'typ',
        WIZARD_GLANS: 'gla',
        WIZARD_OPLOS: 'opl',
        WIZARD_OPACITEIT: 'opa',
        PRODUCT: 'Product',
        ONLYPROMO: "OnlyPromo"
    },
    navigationType: {
        SEARCH: "SEARCH",
        CATEGORY: "CATEGORY",
        FILTER: "FILTER",
        BRAND: "BRANDS",
        WIZARD: "WIZARD",
        PRODUCT: "PRODUCT",
        ONLYPROMO: "ONLYPROMO"
    }
}
;;;'use strict'

Valcke.navigation = {};
Valcke.navigation.storage = {};
Valcke.navigation = (function () {
    var webshopContainer = "#valcke-webshopcontainer";

    //don't forget to add field in clearStorage()
    var storage = {
        categoryID: "",
        category: "",
        brandID: "",
        brand: "",
        search: "",
        filter: "",
        product: "",
        productCode: "",
        onlyPromo: "False"
    };

    function initialise() {
    }

    function navigateTo(type, value, text) {
        Valcke.navigation.storage.productCode = "";
        Valcke.navigation.storage.product = "";

        //CATEGORY
        if (type == Valcke.constants.navigationType.CATEGORY) {
            clearStorage();

            Valcke.navigation.storage.categoryID = value;
            Valcke.navigation.storage.category = text;

            //clear search field
            Valcke.search.clearSearch();
        }

        //SEARCH
        if (type == Valcke.constants.navigationType.SEARCH) {
            clearStorage();

            Valcke.navigation.storage.search = value;

            //clear category selection
            Valcke.category.clearCategorySelection();
        }

        //BRAND
        if (type == Valcke.constants.navigationType.BRAND) {
            Valcke.navigation.storage.brandID = value;
            Valcke.navigation.storage.brand = text;
        }

        //FILTER
        if (type == Valcke.constants.navigationType.FILTER) {
            Valcke.navigation.storage.filter = value;
        }

        //WIZARD
        if (type == Valcke.constants.navigationType.WIZARD) {
            clearStorage();

            Valcke.navigation.storage.wizard = value;

            //clear search field
            Valcke.search.clearSearch();

            //clear category selection
            Valcke.category.clearCategorySelection();

        } else {

            if (type != Valcke.constants.navigationType.BRAND) {
                //always clear selectorWizard
                Valcke.selectorwizard.clearWizard();
                Valcke.navigation.storage.wizard = "";
            }
        }

        //PRODUCT
        if (type == Valcke.constants.navigationType.PRODUCT) {
            clearStorage();

            Valcke.navigation.storage.productCode = value;
            Valcke.navigation.storage.product = text;
        }

        //Change URL
        pushToCorrectState();

        //Load products
        loadProductListByStorage();


        //$("#params").remove();
        //$("#search").prepend("<div id='params'>categoryID: " + categoryID + "<br />" +
        //                            "searchterm: " + searchterm + "<br />" +
        //                            "brands: " + brands + "<br />" +
        //                            "filterSelector: " + filterSelector + "</div>");
    }

    function pushToCorrectState() {
        var categoryID = Valcke.navigation.storage.categoryID;
        var categoryName = Valcke.navigation.storage.category;
        var searchterm = Valcke.navigation.storage.search;
        var brandIDs = Valcke.navigation.storage.brandID;
        var brandNames = Valcke.navigation.storage.brand;
        var filterIDs = Valcke.navigation.storage.filter;
        var wizard = Valcke.navigation.storage.wizard;
        var product = Valcke.navigation.storage.product;
        var productCode = Valcke.navigation.storage.productCode;

        var newUrl = getStateUrl(categoryID, categoryName, searchterm, brandIDs, brandNames, filterIDs, wizard, productCode, product);

        if (typeof (window.history.pushState) == 'function') {
            window.history.pushState(null, "", newUrl);
        } else{
            //fallback for older browsers
            window.location = newUrl;
        }
    }

    function getStateUrl(categoryID, categoryName, searchterm, brandIDs, brandNames, filterIDs, wizard, productCode, product) {
        var newUrl = Valcke.constants.basePage;

        if (categoryID && categoryID != "") {
            newUrl += '/' + Valcke.constants.navigationKeyword.CATEGORY + '/' + createSafeUrl(categoryID) + "-" + createSafeUrl(categoryName);
        }

        if (searchterm && searchterm != "") {
            newUrl += '/' + Valcke.constants.navigationKeyword.SEARCH + '/' + createSafeUrl(searchterm);
        }

        if ((brandIDs && brandIDs != "") || (brandNames && brandNames != "")) {
            newUrl += '/' + Valcke.constants.navigationKeyword.BRAND + '/' + createSafeUrl(brandNames);
        }

        if (filterIDs && filterIDs != "") {
            newUrl += '/' + Valcke.constants.navigationKeyword.FILTER + '/' + createSafeUrl(filterIDs);
        }

        if (wizard && wizard != "") {
            newUrl += '/' + Valcke.constants.navigationKeyword.WIZARD;

            var wizPl = Valcke.navigation.storage.wizard.plaats;
            var wizToe = Valcke.navigation.storage.wizard.toestand;
            var wizOpp = Valcke.navigation.storage.wizard.oppervlak;
            var wizTyp = Valcke.navigation.storage.wizard.type;
            var wizGla = Valcke.navigation.storage.wizard.glansgraad;
            var wizOpl = Valcke.navigation.storage.wizard.oplosmiddel;
            var wizOpa = Valcke.navigation.storage.wizard.opaciteit;

            if (wizPl && wizPl != "") newUrl += '/' + Valcke.constants.navigationKeyword.WIZARD_PLAATS + '/' + wizPl;
            if (wizToe && wizToe != "") newUrl += '/' + Valcke.constants.navigationKeyword.WIZARD_TOESTAND + '/' + wizToe;
            if (wizOpp && wizOpp != "") newUrl += '/' + Valcke.constants.navigationKeyword.WIZARD_OPPERVLAK + '/' + wizOpp;
            if (wizTyp && wizTyp != "") newUrl += '/' + Valcke.constants.navigationKeyword.WIZARD_TYPE + '/' + wizTyp;
            if (wizGla && wizGla != "") newUrl += '/' + Valcke.constants.navigationKeyword.WIZARD_GLANS + '/' + wizGla;
            if (wizOpl && wizOpl != "") newUrl += '/' + Valcke.constants.navigationKeyword.WIZARD_OPLOS + '/' + wizOpl;
            if (wizOpa && wizOpa != "") newUrl += '/' + Valcke.constants.navigationKeyword.WIZARD_OPACITEIT + '/' + wizOpa;
        }

        if (productCode && productCode != "") {
            newUrl += '/' + Valcke.constants.navigationKeyword.PRODUCT + '/' + createSafeUrl(productCode) + "/" + createSafeUrl(product);
        }

        return newUrl;
    }

    function loadUrl() {
        $(webshopContainer).addClass("loading");
        var callback = function (data) {
            $(webshopContainer).html(data);
            $(webshopContainer).removeClass("loading");

            var url = window.location.pathname;
            var querystring = url.replace(Valcke.constants.basePage + '/', "");

            var onlyPromo = getUrlPartValue(querystring, Valcke.constants.navigationKeyword.ONLYPROMO);
            var category = getUrlPartValue(querystring, Valcke.constants.navigationKeyword.CATEGORY);
            var search = getUrlPartValue(querystring, Valcke.constants.navigationKeyword.SEARCH);
            var brand = getUrlPartValue(querystring, Valcke.constants.navigationKeyword.BRAND);
            var filter = getUrlPartValue(querystring, Valcke.constants.navigationKeyword.FILTER);
            var productCode = getUrlPartValue(querystring, Valcke.constants.navigationKeyword.PRODUCT);
            var wizard = getUrlWizardObject(querystring);

            //decode urlparts
            search = decodeURIComponent(search);
            category = decodeURIComponent(category);
            brand = decodeURIComponent(brand);
            filter = decodeURIComponent(filter);
            productCode = decodeURIComponent(productCode);

            var categoryID = "";
            var categoryName = "";

            if (category && category != "") {
                var categorySplitIndex = category.indexOf('-');
                categoryID = category.substring(0, categorySplitIndex);
                categoryName = category.substring(categorySplitIndex + 1, category.length);
                Valcke.category.loadUrlCategoryByID(categoryID);
            }

            if (search && search != "") {
                Valcke.search.loadUrlBySearch(search);
            }

            if (wizard && wizard != "" && (wizard.plaats != "" || wizard.toestand != "" || wizard.oppervlak != "" || wizard.type != "" || wizard.glansgraad != "" || wizard.oplosmiddel != "" || wizard.opaciteit != "")) {
                Valcke.selectorwizard.loadUrlByWizard(wizard);
            }

            if (onlyPromo == "") {
                onlyPromo = "False";
            }

            Valcke.navigation.storage.onlyPromo = onlyPromo;
            Valcke.navigation.storage.categoryID = categoryID;
            Valcke.navigation.storage.category = categoryName;
            Valcke.navigation.storage.search = search;
            //Valcke.navigation.storage.brandID 
            //Valcke.navigation.storage.brand = brand; //URL shows only brandNAMES nog IDs
            Valcke.navigation.storage.brand = brand;
            Valcke.navigation.storage.filter = filter;
            Valcke.navigation.storage.wizard = wizard;
            Valcke.navigation.storage.productCode = productCode;


            loadProductListByStorage();

            var shoppingCartGuid = Valcke.webshop.getShoppingCartGuid();
            Valcke.shoppingcart.getShoppingCartSummary(shoppingCartGuid);


            /*var state = url.replace("/WebshopMvc/", "");
            var urlParts = state.split("/");
            var type = state.split("/")[0];
            var value = state.split("/")[1];

            //IF CATEGORY
            var categoryID = value.split("-")[0];

            Valcke.category.loadUrlCategoryByID(categoryID);*/
        };

        Valcke.webshop.getData("ProductList", "Index", null, callback);
    }

    function loadProductListByStorage(isFullRefresh) {
        if (isFullRefresh == undefined || isFullRefresh == true) {
            $("#hdnProductListCount").val("0");
            $("#hdnMoreProductsAvailable").val("False");
            $("#hdnCurrentPage").val("0");
            $("#hdnPageSize").val("0");
        }

        var onlyPromo = Valcke.navigation.storage.onlyPromo;
        var categoryID = Valcke.navigation.storage.categoryID;
        var searchterm = Valcke.navigation.storage.search;
        var brandIDs = Valcke.navigation.storage.brandID;
        var brandNames = Valcke.navigation.storage.brand;
        var filterIDs = Valcke.navigation.storage.filter;
        var wizard = Valcke.navigation.storage.wizard;
        var productCode = Valcke.navigation.storage.productCode;

        //exit to prevent error
        /*if (categoryID == "" && searchterm == "" && brandIDs == "" && filterIDs == "" && wizard == "") {
            //$(webshopContainer).html("Teveel resultaten om weer te geven");
            $(webshopContainer).removeClass("loading");
            return;
        }*/

        if (productCode == undefined || productCode == "")
        {
            if (window.location.href.toLowerCase().indexOf("/product/") > -1) {
                var producturl = window.location.href.toLowerCase().substring(window.location.href.toLowerCase().indexOf("/product/"));
                var urlSplit = producturl.split("/");
                if (urlSplit.length >= 2) {
                    productCode = urlSplit[2];
                }
            }
        }


        Valcke.product.loadProductList(categoryID, searchterm, brandIDs, filterIDs, brandNames, wizard, productCode, onlyPromo);
    }

    function getUrlWizardObject(url) {
        var wizPl = getUrlPartValue(url, Valcke.constants.navigationKeyword.WIZARD_PLAATS);
        var wizToe = getUrlPartValue(url, Valcke.constants.navigationKeyword.WIZARD_TOESTAND);
        var wizOpp = getUrlPartValue(url, Valcke.constants.navigationKeyword.WIZARD_OPPERVLAK);
        var wizTyp = getUrlPartValue(url, Valcke.constants.navigationKeyword.WIZARD_TYPE);
        var wizGla = getUrlPartValue(url, Valcke.constants.navigationKeyword.WIZARD_GLANS);
        var wizOpl = getUrlPartValue(url, Valcke.constants.navigationKeyword.WIZARD_OPLOS);
        var wizOpa = getUrlPartValue(url, Valcke.constants.navigationKeyword.WIZARD_OPACITEIT);

        if (wizPl != "" || wizToe != "" || wizOpp != "" || wizTyp != "" || wizGla != "" || wizOpl != "" || wizOpa != "") {
            var wizardObj = {
                plaats: wizPl,
                toestand: wizToe,
                oppervlak: wizOpp,
                type: wizTyp,
                glansgraad: wizGla,
                oplosmiddel: wizOpl,
                opaciteit: wizOpa
            }
            return wizardObj;
        } else {
            return "";
        }
    }

    function getUrlPartValue(url, partName) {
        var parts = url.split('/');
        var partIndex = parts.indexOf(partName);

        if (partIndex >= 0) {
            if (partIndex + 1 < parts.length) {
                var partValue = parts[partIndex + 1];
                return partValue;
            }
        }

        return "";
    }

    function createSafeUrl(input) {
        return getSlug(input);

        /*if (input && input != "") {
            var textEncoded = input;

            return encodeURIComponent(textEncoded);
        } else {
            return input;
        }*/
    }

    function clearStorage() {
        Valcke.navigation.storage = {
            categoryID: "",
            category: "",
            brandID: "",
            brand: "",
            search: "",
            filter: "",
            product: "",
            productCode: "",
            onlyPromo: "False"
        };
    }

    initialise();

    return {
        navigateTo: navigateTo,
        storage: storage,
        loadUrl: loadUrl,
        getStateUrl: getStateUrl,
        loadProductListByStorage: loadProductListByStorage
    };
})();
;;;"use strict";

Valcke.parameters = {};
Valcke.parameters = (function () {

    function initialise() {
        Valcke.parameters.data = {};
        getColorTypes();
    }

    function getColorTypes() {
        var callback = function (data) {
            Valcke.parameters.data.colorTypes = data;
        };

        Valcke.parameters.data.colorTypes = {};
        Valcke.webshop.getData("Parameters", "ColorTypes", null, callback);
    };

    function getColorTypeById(colorTypeId) {
        return _.filter(Valcke.parameters.data.colorTypes, function (color) { return color.ID == colorTypeId; })[0];
    };

    return {
        initialise: initialise,
        getColorTypeById: getColorTypeById
    };
})();
;;;"use strict";

Valcke.selectorwizard = (function () {

    function initialise() {
        $("#searchassistant").click(function () {
            if ($("#selectorwizard").hasClass("hide")){
                $("#selectorwizard").removeClass("hide");
            } else {
                collapseWizard();
            }
        });

        $(".cboWizardOptions").selectmenu({
            change: function (event, ui) {
                getMatchingProductsCount();
            },
            width: "100%"
        });

        $("#btnConfirmSelectorWizard").click(function () {
            navigateToWizardUrl();
        });

        $("#btnClearSelectorWizard").click(function () {
            clearSelectorWizardClicked();
        });
    }

    function collapseWizard() {
        if (!$("#selectorwizard").hasClass("hide")) {
            $("#selectorwizard").addClass("hide");
        }
    }

    function navigateToWizardUrl() {
        var wizPl = $("#wizard-options-plaats").val();
        var wizToe = $("#wizard-options-toestand").val();
        var wizOpp = $("#wizard-options-oppervlak").val();
        var wizTyp = $("#wizard-options-soort").val();
        var wizGla = $("#wizard-options-glansgraad").val();
        var wizOpl = $("#wizard-options-oplosmiddel").val();
        var wizOpa = $("#wizard-options-opaciteit").val();

        if (wizPl != "" || wizToe != "" || wizOpp != "" || wizTyp != "" || wizGla != "" || wizOpl != "" || wizOpa != "") {
            var wizardObj = {
                plaats: wizPl,
                toestand: wizToe,
                oppervlak: wizOpp,
                type: wizTyp,
                glansgraad: wizGla,
                oplosmiddel: wizOpl,
                opaciteit: wizOpa
            }

            Valcke.navigation.navigateTo(Valcke.constants.navigationType.WIZARD, wizardObj);
        }
    }

    function resetCombobox(item) {
        $(item).children(":first").attr('selected', 'selected');
        $(item).selectmenu("refresh");
    }

    function loadUrlByWizard(wizardObj) {
        $("#selectorwizard").removeClass("hide");

        $("#wizard-options-plaats").val(wizardObj.plaats);
        $("#wizard-options-toestand").val(wizardObj.toestand);
        $("#wizard-options-oppervlak").val(wizardObj.oppervlak);
        $("#wizard-options-soort").val(wizardObj.type);
        $("#wizard-options-glansgraad").val(wizardObj.glansgraad);
        $("#wizard-options-oplosmiddel").val(wizardObj.oplosmiddel);
        $("#wizard-options-opaciteit").val(wizardObj.opaciteit);

        $("#wizard-options-plaats").selectmenu("refresh");
        $("#wizard-options-toestand").selectmenu("refresh");
        $("#wizard-options-oppervlak").selectmenu("refresh");
        $("#wizard-options-soort").selectmenu("refresh");
        $("#wizard-options-glansgraad").selectmenu("refresh");
        $("#wizard-options-oplosmiddel").selectmenu("refresh");
        $("#wizard-options-opaciteit").selectmenu("refresh");

        getMatchingProductsCount()
    }

    function getMatchingProductsCount() {
        var wizPl = $("#wizard-options-plaats").val();
        var wizToe = $("#wizard-options-toestand").val();
        var wizOpp = $("#wizard-options-oppervlak").val();
        var wizTyp = $("#wizard-options-soort").val();
        var wizGla = $("#wizard-options-glansgraad").val();
        var wizOpl = $("#wizard-options-oplosmiddel").val();
        var wizOpa = $("#wizard-options-opaciteit").val();

        if (wizPl != "" || wizToe != "" || wizOpp != "" || wizTyp != "" || wizGla != "" || wizOpl != "" || wizOpa != "") {
            $("#btnClearSelectorWizard").show();
            $("#btnConfirmSelectorWizard").show();
        } else {
            $("#btnClearSelectorWizard").hide();
            $("#btnConfirmSelectorWizard").hide();
        }

        var url = "/DesktopModules/ValckeServices/API/Selector/GetMatchingProductsCount";
        $.ajax({
            url: url,
            type: "POST",
            data: {
                wizPl: wizPl,
                wizToe: wizToe,
                wizOpp: wizOpp,
                wizTyp: wizTyp,
                wizGla: wizGla,
                wizOpl: wizOpl,
                wizOpa: wizOpa
            },
            success: function (data) {
                var intCount = parseInt(data);

                if (intCount == 0) {
                    $("#btnConfirmSelectorWizard").prop("text", "Geen resultaten");
                } else if (intCount == 1) {
                    $("#btnConfirmSelectorWizard").prop("text", "Toon 1 resultaat");
                } else {
                    $("#btnConfirmSelectorWizard").prop("text", "Toon " + intCount + " resultaten");
                }
            }
        });
    }

    function clearSelectorWizardClicked() {
        resetCombobox("#wizard-options-plaats");
        resetCombobox("#wizard-options-toestand");
        resetCombobox("#wizard-options-oppervlak");
        resetCombobox("#wizard-options-soort");
        resetCombobox("#wizard-options-glansgraad");
        resetCombobox("#wizard-options-oplosmiddel");
        resetCombobox("#wizard-options-opaciteit");
        getMatchingProductsCount();
    }
    
    function clearWizard() {
        clearSelectorWizardClicked();
        collapseWizard();
    }

    return {
        initialise: initialise,
        loadUrlByWizard: loadUrlByWizard,
        clearWizard: clearWizard
    };
})();
;;;"use strict";

Valcke.shoppingcart = (function () {

    function initialise() {

    }

    function shoppingCartSummaryCallback(data) {
    };

    function addProductModelToShoppingCart(shoppingCartGuid, productModelCode,
        hasCboStandardColor, hasCboColorType, hasTxtMixedColor, hasTxtNeedsSpec, hasTxtSize, hasSquareMeter, hasDdlSize,
        txtQuantity, cboStandardColor, cboColorType, txtMixedColor, txtNeedsSpec, txtSquareMeter, txtSize, ddlSize, callbackSuccess, callbackError) {

        var url = "/DesktopModules/ValckeServices/API/ShoppingCart/AddToCart";
        $.ajax({
            type: "POST",
            url: url,
            data: {
                shoppingCartGuid: shoppingCartGuid,
                productModelCode: productModelCode,
                hasCboStandardColor: hasCboStandardColor,
                hasCboColorType: hasCboColorType,
                hasTxtMixedColor: hasTxtMixedColor,
                hasTxtNeedsSpec: hasTxtNeedsSpec,
                hasTxtSize: hasTxtSize,
                hasSquareMeter: hasSquareMeter,
                hasDdlSize: hasDdlSize,
                txtQuantity: txtQuantity,
                cboStandardColor: cboStandardColor,
                cboColorType: cboColorType,
                txtMixedColor: txtMixedColor,
                txtNeedsSpec: txtNeedsSpec,
                txtSquareMeter: txtSquareMeter,
                txtSize: txtSize,
                ddlSize: ddlSize
            },
            success: function (data) {
                if (callbackSuccess) {
                    callbackSuccess(data);
                }
            },
            error: function (data) {
                if (callbackError) {
                    callbackError(data);
                }
            }
        });
    }

    function getShoppingCartSummary(shoppingCartGuid, callback) {
        var url = "/DesktopModules/ValckeServices/API/ShoppingCart/GetCartSummary";
        $.ajax({
            type: "GET",
            url: url,
            data: {
                shoppingCartGuid: shoppingCartGuid
            },
            success: function (data) {
                var html1 = data.itemsCount + " " + (data.itemsCount == 1 ? "stuk" : "stuks");
                $("#shoppingcartsummary-content").html(html1);

                if (data.userName) {
                    var html2 = "Welkom [USERNAME]";
                    html2 = html2.replace("[USERNAME]", data.userName.substr(0, 15));
                    $("#shoppingcartsummary-name").html(html2);
                } else {
                    $("#shoppingcartsummary-name").html("Welkom");
                }

                if (callback) {
                    callback(data);
                }
            },
            error: function (data) {

            }
        });
    }

    return {
        addProductModelToShoppingCart: addProductModelToShoppingCart,
        getShoppingCartSummary: getShoppingCartSummary
    };
})();
;;;'use strict'

Valcke.paintcalculator = (function () {

    function initialise() {
        $("#modal-paintCalculator #txtPaintCalculator_width,#modal-paintCalculator #txtPaintCalculator_length,#modal-paintCalculator #txtPaintCalculator_height,#modal-paintCalculator #txtPaintCalculator_deduction,#modal-paintCalculator #txtPaintCalculator_numberofcoats,#modal-paintCalculator #txtPaintCalculator_marge,#modal-paintCalculator #txtPaintCalculator_efficiency,#modal-paintCalculator input[type=radio][name=rbtPaintCalculator_includeCeiling]")
            .change(function () {
                calculate();
            });

        $("#modal-paintCalculator input[type=radio][name=rbtPaintCalculator_surfaces]").change(function () {
            checkFieldVisibility();
        });

        $("#modal-paintCalculator #txtPaintCalculator_width").val("5.00");
        $("#modal-paintCalculator #txtPaintCalculator_length").val("4.00");
        $("#modal-paintCalculator #txtPaintCalculator_height").val("2.50");
        $("#modal-paintCalculator #txtPaintCalculator_deduction").val("5.00");
        $("#modal-paintCalculator #txtPaintCalculator_numberofcoats").val("2");
        $("#modal-paintCalculator #txtPaintCalculator_marge").val("10");
        $("#modal-paintCalculator input[type=radio][name=rbtPaintCalculator_includeCeiling][value='0']").prop("checked", true);
        $("#modal-paintCalculator input[type=radio][name=rbtPaintCalculator_surfaces][value='wall']").prop("checked", true);

        calculate();
    }

    function checkFieldVisibility() {
        var surfacesWall = Helpers.isRadiobuttonSelected("rbtPaintCalculator_surfaces", "wall");
        var surfacesCeiling = Helpers.isRadiobuttonSelected("rbtPaintCalculator_surfaces", "ceiling");
        var surfacesFloor = Helpers.isRadiobuttonSelected("rbtPaintCalculator_surfaces", "floor");

        if (!surfacesWall && (surfacesCeiling || surfacesFloor)) {
            $("#paintCalculator_field_height").hide();
            $("#paintCalculator_field_deduction").hide();
            $("#paintCalculator_field_includeceiling").hide();
        } else {
            $("#paintCalculator_field_height").show();
            $("#paintCalculator_field_deduction").show();
            $("#paintCalculator_field_includeceiling").show();
        }

        calculate();
    }

    function calculate() {
        var width = parseFloat($("#modal-paintCalculator #txtPaintCalculator_width").val());
        var length = parseFloat($("#modal-paintCalculator #txtPaintCalculator_length").val());
        var height = parseFloat($("#modal-paintCalculator #txtPaintCalculator_height").val());
        var deduction = parseFloat($("#modal-paintCalculator #txtPaintCalculator_deduction").val());
        var numberofcoats = parseFloat($("#modal-paintCalculator #txtPaintCalculator_numberofcoats").val());
        var marge = parseFloat($("#modal-paintCalculator #txtPaintCalculator_marge").val());
        var efficiency = parseFloat($("#modal-paintCalculator #txtPaintCalculator_efficiency").val());
        var includeCeiling = Helpers.isRadiobuttonSelected("rbtPaintCalculator_includeCeiling", 1);

        var surfacesWall = Helpers.isRadiobuttonSelected("rbtPaintCalculator_surfaces", "wall");
        var surfacesCeiling = Helpers.isRadiobuttonSelected("rbtPaintCalculator_surfaces", "ceiling");
        var surfacesFloor = Helpers.isRadiobuttonSelected("rbtPaintCalculator_surfaces", "floor");

        //Validate input
        var atLeastOneSurface = (surfacesWall || surfacesCeiling || surfacesFloor);
        var validInput = (width && length && height && deduction && numberofcoats && marge && efficiency) || deduction == 0 || marge == 0;

        //Invisible fields
        if (!surfacesWall) {
            height = 0;
            deduction = 0;
        }

        if (surfacesCeiling || surfacesFloor) {
            includeCeiling = true;
        }

        //Calculate
        if (atLeastOneSurface && validInput) {
            var subtotal = 2 * ((width * height) + (length * height)); //2 x lengte * breedte

            if (includeCeiling) {
                subtotal += (width * length); //plafond
            }

            subtotal -= deduction; //aftrek
            
            var subtotal_coats = subtotal * numberofcoats; //aantal lagen
            var total = subtotal_coats * (100 + marge) / 100; //marge
            var total_liters = total / efficiency; //aantal liter

            $("#lblPaintCalculator_subtotal").text(Helpers.round2Decimals(subtotal) + " m²");
            $("#lblPaintCalculator_total").text(Helpers.round2Decimals(total) + " m²");
            $("#lblPaintCalculator_totalliters").text(Helpers.round2Decimals(total_liters) + " liter");

        } else {

            $("#lblPaintCalculator_subtotal").text("-");
            $("#lblPaintCalculator_total").text("-");
            $("#lblPaintCalculator_totalliters").text("-");
        }
    }

    return {
        initialise: initialise,
        calculate: calculate
    };
})();
;;;"use strict";

Valcke.category = {};
Valcke.category = (function () {

    var categoryList = "#categoryList";
    var categoryTitle = "#categoryList #category-title";
    //var categoryFilterClear = "#categoryList #category-title .valcke-clearfilter";
    //var categoryFilterCollapse = "#categoryList #category-title .valcke-collapse";
    var categoryFilter_imgRemove = "#categoryList #category-title #imgRemove";
    var categoryFilter_imgCollapse = "#categoryList #category-title #imgCollapse";
    var categoryFilter_imgExpand = "#categoryList #category-title #imgExpand";

    function initialise() {
        $(".category-group").click(function () {
            categoryGroupClicked($(this));
        });

        $(".category-sub").click(function (evt) {
            categoryClicked($(this));

            //disable redirect
            evt.preventDefault();
            return false;
        });

        $(categoryTitle).click(function () {
            categoryTitleClicked();
        });

        $(categoryFilter_imgRemove).click(function (evt) {
            clearCategorySelection();
            Valcke.navigation.navigateTo(Valcke.constants.navigationType.CATEGORY, "");
            evt.stopPropagation();//do not propagate to title bar
        });

        //load sliding message
        Valcke.webshop.applySlidingMessage();
    }

    function loadUrlCategoryByID(categoryID) {
        var selectorCategory = $(".category-sub[data-category-id='" + categoryID + "']");
        if (selectorCategory.length > 0) {
            $(selectorCategory).addClass("isActive");
        }

        var selectorCategoryGroup = $(selectorCategory).parent().prev();
        if (selectorCategoryGroup.length > 0) {
            $(selectorCategoryGroup).trigger("click");
        }
    }

    function categoryClicked(item) {
        var categoryID = $(item).attr("data-category-id");
        var categoryName = $(item).text();
        Valcke.navigation.navigateTo(Valcke.constants.navigationType.CATEGORY, categoryID, categoryName);

        $(".category-sub").removeClass("isActive");
        $(item).addClass("isActive");

        $(categoryFilter_imgRemove).removeClass("hide");
    }

    function categoryGroupClicked(item) {
        $(".category-group").removeClass("isActive");
        $(".category-level1").removeClass("isActive");

        $(item).addClass("isActive");
        $(item).next(".category-level1").addClass("isActive");
    }

    function clearCategorySelection() {
        $(".category-group").removeClass("isActive");
        $(".category-level1").removeClass("isActive");
        $(".category-sub").removeClass("isActive");
        $(categoryFilter_imgRemove).addClass("hide");
    }

    function categoryTitleClicked() {
        if ($(categoryList).hasClass("collapsed")) {
            expandCategories();
        } else {
            collapseCategories();
        }
    }

    function collapseCategories() {
        $(categoryList).addClass("collapsed");
        $(categoryList).find(".category-content").addClass("hide");

        $(categoryFilter_imgCollapse).addClass("hide");
        $(categoryFilter_imgExpand).removeClass("hide");
    }

    function expandCategories() {
        $(categoryList).removeClass("collapsed");
        $(categoryList).find(".category-content").removeClass("hide");

        $(categoryFilter_imgCollapse).removeClass("hide");
        $(categoryFilter_imgExpand).addClass("hide");
    }

    return {
        initialise: initialise,
        loadUrlCategoryByID: loadUrlCategoryByID,
        clearCategorySelection: clearCategorySelection,
        collapseCategories: collapseCategories,
        expandCategories: expandCategories
    };
})();
;;;"use strict";

Valcke.product = {};
Valcke.product = (function () {

    var webshopContainer = "#productList";
    var brandList = "#brandList";
    var filterList = "#filterList";

    $.mask.definitions['*'] = "[a-zA-Z0-9-.',()-* ]";
    $.mask.definitions['#'] = $.mask.definitions['9'];  //Set # to do what 9 does
    $.mask.definitions['9'] = null;                     //Remove 9 as a masking character

    function init() {
        //setInterval(function () {
        //    $(".product-text-extrainfo").toggleClass("accentcolor");
        //}, 2000);        
    }

    function changeProductListViewMode(type) {
        var callback = function (data) {
            Valcke.navigation.loadProductListByStorage(true);
        };

        Valcke.webshop.getData("Product", "SetProductListViewMode", { type: type }, callback);
    }

    function getCurrentPage() {
        return parseInt($("#hdnCurrentPage").val());
    }

    function isFullRefresh() {
        return (getCurrentPage() == 0);
    }

    function loadProductList(categoryID, searchTerm, filterbrand, filterselector, filterbrandNames, filterwizard, filterproductcode, filterOnlyPromo) {
        var page = getCurrentPage();
        var pageSize = $("#hdnPageSize").val();

        var data = {
            "categoryID": categoryID,
            "searchTerm": searchTerm,
            "filterbrand": filterbrand,
            "filterbrandNames": filterbrandNames,
            "filterselector": filterselector,
            "filterwizard.plaats": filterwizard.plaats,
            "filterwizard.glansgraad": filterwizard.glansgraad,
            "filterwizard.opaciteit": filterwizard.opaciteit,
            "filterwizard.oplosmiddel": filterwizard.oplosmiddel,
            "filterwizard.oppervlak": filterwizard.oppervlak,
            "filterwizard.toestand": filterwizard.toestand,
            "filterwizard.type": filterwizard.type,
            "filterproductcode": filterproductcode,
            "filterOnlyPromo": filterOnlyPromo,
            "page": page,
            "pageSize": pageSize
        };

        $(webshopContainer).addClass("loading");
        $(brandList).addClass("loading");
        $(filterList).addClass("loading");

        if ($("#product-noitems").length) {
            $("#product-noitems").hide();
            $("#product-loadingText").removeClass("hide");
        }

        var callback = function (data) {
            if (isFullRefresh()) {
                //page 0 is the first page and contains the filterbar
                $(webshopContainer).html(data);

                //Check if we are in tablet-mode
                Valcke.webshop.windowResized();
            } else {
                $("#webshop-producten").append(data);
            }

            $(webshopContainer).removeClass("loading");
            $(brandList).removeClass("loading");
            $(filterList).removeClass("loading");

            productListLoaded();

            // This prevents the page from scrolling down to where it was previously.
            if ('scrollRestoration' in history) {
                history.scrollRestoration = 'manual';
            }
            // This is needed if the user scrolls down during page load and you want to make sure the page is scrolled to the top once it's fully loaded. This has Cross-browser support.
            window.scrollTo(0, 0);

        };

        Valcke.webshop.getData("product", "index", data, callback);
        
    }

    function productListLoaded() {
        //Move brandlist and filterlist to filterbar
        if (isFullRefresh()) {
            $("#brandList-wrapper").html("");
            $("#filterList-wrapper").html("");
            $(brandList).detach().appendTo("#brandList-wrapper");
            $(filterList).detach().appendTo("#filterList-wrapper");
        }

        var pageTitle = $("#hdnPageTitle").val();
        if (pageTitle && pageTitle != '') {
            document.title = pageTitle;
        }

        var $txtQuantity = $(".txtQuantity");
        var $cboStandardColor = $(".cboStandardColor");
        var $cboColorType = $(".cboColorType");
        var $btnAddProductModelToCart = $(".btnAddProductModelToCart");
        var $txtNeedsSpec = $(".txtNeedsSpec");
        var $cboQuantityWidth = $(".cboQuantityWidth");
        var $txtQuantityLength = $(".txtQuantityLength");
        var $lblPriceWithVolumePrice = $(".lblPrice.hasVolumePrice");
        var $btnShowPaintCalculator = $(".btnShowPaintCalculator");

        $("#btnLoadMoreItems").off();
        $("#btnLoadMoreItems").click(function () {
            var page = $("#hdnCurrentPage").val();

            if (page) {
                var newPage = parseInt(page) + 1;
                $("#hdnCurrentPage").val(newPage);
            }

            Valcke.navigation.loadProductListByStorage(false);
        });

        $('#valckeverven-webshop').off();
        $('#valckeverven-webshop').on('click', '.product .product-actionbuttons .product-actionbutton', function () {
            //collapse other tabs
            var otherTabsContent = getProductSiblingControl($(this), ".product-descriptionwrapper, .product-documentswrapper, .product-orderwrapper");
            $(otherTabsContent).addClass("hide");
            var otherTabs = getProductSiblingControl($(this), ".product-actionbuttons .product-actionbutton");
            $(otherTabs).removeClass("isActive");

            //open current tab
            var targetName = "." + $(this).attr("data-target");
            var target = getProductSiblingControl($(this), targetName);
            $(this).addClass("isActive");
            $(target).removeClass("hide");
        });

        $('#btnViewModeBasic').off();
        $("#btnViewModeBasic").click(function () {
            changeProductListViewMode("BASIC");
        });

        $('#btnViewModeAdvanced').off();
        $("#btnViewModeAdvanced").click(function () {
            changeProductListViewMode("ADVANCED");
        });


        //COL - Standard color
        $.each($cboStandardColor, function (index, cboStandardColor) {
            $(cboStandardColor).selectmenu({
                change: function (event, ui) {
                    cboStandardColorChanged(event, ui, cboStandardColor);
                },
                width: $(this).attr("width")
            });

            var firstValue = $(cboStandardColor).find("option:first").val();
            if (firstValue != -1) {
                cboStandardColorChanged(null, null, cboStandardColor, firstValue);
            }
        });

        //COL - Color Types
        $.each($cboColorType, function (index, cboColorType) {
            $(cboColorType).append(
                $('<option disabled selected></option>').html("Kleurkaart")
            );
            var fillColorTypes = function () {
                $.each(Valcke.parameters.data.colorTypes, function (val, colortype) {
                    $(cboColorType).append(
                        $('<option></option>').val(colortype.ID).html(colortype.Name)
                    );
                });
            };

            //Force to wait until colortypes are loaded
            if (Valcke.parameters.data.colorTypes == undefined || Valcke.parameters.data.colorTypes.constructor === Object || Valcke.parameters.data.colorTypes.length <= 0) {
                setTimeout(function () {
                    fillColorTypes();
                }, 1000);

                console.log("Wait one second");
            } else {
                fillColorTypes();
            }

        });

        //COL - Needs spec
        $.each($txtNeedsSpec, function (index, txtNeedsSpec) {
            $(txtNeedsSpec).change(function () {
                showIconAddProductModelToCartDefault(txtNeedsSpec);
            });
        });

        //COL - Mixed Colors
        $.each($cboColorType, function (index, cboColorType) {
            var txtMixedColor = getProductRowSiblingControl(cboColorType, ".txtMixedColor");
            $(cboColorType).selectmenu({
                change: function (event, ui) {
                    cboColorTypeChanged(event, ui, txtMixedColor);
                },
                width: $(this).attr("width")
            });
        });

        $cboColorType.trigger("selectmenuchange");


        //COL - Price
        $.each($lblPriceWithVolumePrice, function (index, val) {
            var pnlVolumePrice = getProductRowSiblingControl(this, ".pnlTooltipVolumePrice");
            var lblPriceWithVolumePrice = $(this);
            loadVolumePriceTooltip(lblPriceWithVolumePrice);
        });

        //COL - QuantityWidth
        $.each($cboQuantityWidth, function (index, cboQuantityWidth) {
            $(cboQuantityWidth).change(function (evt, itm) {
                cboQuantityWidthChanged($(this));
            });

            var firstValue = $(cboQuantityWidth).find("option:first").val();
            if (firstValue != -1) {
                cboQuantityWidthChanged($(cboQuantityWidth));
            }
        });

        //COL - txtQuantityLength
        $.each($txtQuantityLength, function (index, txtQuantityLength) {
            //$(txtQuantityLength).number(true, 2, ',');
            /*$(txtQuantityLength).keypress(function (evt) {
                if (String.fromCharCode(evt.which) == ".") {
                    $(this).val($(this).val() + ',');
                    return false;
                }
            });*/
            $(txtQuantityLength).change(function (evt, itm) {
                txtQuantityLengthChanged($(this));
            });
        });

        //COL - Quantity
        $.each($txtQuantity, function (index, txtQuantity) {
            var minamount = parseFloat($(txtQuantity).attr("data-minamount"));
            var defaultdisabled = $(txtQuantity).attr("data-defaultdisabled");

            var lblPriceCtrl = getProductRowSiblingControl($(txtQuantity), ".lblPrice");
            if (minamount > 1 && lblPriceCtrl.hasClass("hasVolumePrice")) {
                getVolumePrice(lblPriceCtrl, minamount);
            }

            $(txtQuantity).spinner({
                min: minamount,
                step: minamount,
                change: function (evt, ui) {
                    //Check if value is correct
                    var newValue = $(this).spinner("value");
                    var minamount = $(this).attr("data-minamount");

                    if ((parseInt(newValue * 100) % parseInt(parseFloat(minamount) * 100)) != 0) {
                        var correctedValue = Math.round(newValue / parseFloat(minamount)) * minamount;
                        $(this).spinner("value", correctedValue);

                        var msg = "De opgegeven waarde '{0}' is ongeldig. Gelieve de keuzepijltjes te gebruiken om de gewenste hoeveelheid te selecteren.";
                        msg = msg.replace("{0}", newValue);

                        Valcke.webshop.showToastr("warning", msg);
                    }

                    //Check volume prices
                    var lblPrice = getProductRowSiblingControl($(this), ".lblPrice");
                    if (lblPrice.hasClass("hasVolumePrice")) {
                        getVolumePrice(lblPrice, newValue);
                    }
                },
                spin: function (evt, ui) {
                    var lblPrice = getProductRowSiblingControl($(this), ".lblPrice");
                    if (lblPrice.hasClass("hasVolumePrice")) {
                        getVolumePrice(lblPrice, ui.value);
                    }
                }
            });

            if (defaultdisabled === "True") {
                $(txtQuantity).spinner("disable");
            }
        });


        //COL - Add to cart
        $btnAddProductModelToCart.off();
        $btnAddProductModelToCart.click(function () {
            addProductToShoppingCart(this);
        });

        //COL - Add to cart
        $btnShowPaintCalculator.off();
        $btnShowPaintCalculator.click(function () {
            showPaintCalculator(this);
        });

        //Check scrollposition to shop message
        Valcke.webshop.checkSlidingMessage();
    }

    function getVolumePrice(lblPrice, newValue) {
        var productModelCode = getProductRowProductModelCode(lblPrice);
        var userID = Valcke.webshop.getUserID();
        var lblDiscount = getProductRowSiblingControl(lblPrice, ".lblDiscount");

        //Behaviour is different if there is also a nettoprice
        if ($(lblPrice).hasClass("hasDiscount")) {
            var nettoPrice = getProductRowSiblingControl(lblPrice, ".nettoprice-inner");
            lblPrice = nettoPrice;
        }

        loadVolumePriceByAmount(productModelCode, userID, newValue, lblDiscount, lblPrice);
    }

    function loadVolumePriceTooltip(lblPriceWithVolumePrice) {
        $(lblPriceWithVolumePrice).qtip({
            content: {
                text: function (event, api) {
                    var productModelCode = getProductRowProductModelCode(lblPriceWithVolumePrice);
                    var userID = Valcke.webshop.getUserID();
                    loadVolumePricesTooltip(api, productModelCode, userID);
                    return 'De prijzen worden geladen...';
                },
                title: "Volumeprijzen:"
            },
            position: {
                my: 'top center',
                at: 'bottom center'
            },
            style: {
                classes: 'qtip-light'
            },
            hide: {
                fixed: true,
                delay: 100
            }
        });
    }

    function cboStandardColorChanged(evt, ui, item, selectedValue) {
        var newValue = null;

        if (selectedValue) {
            newValue = selectedValue; //manual triggered
        } else {
            newValue = ui.item.value; //from event
        }

        var newValues = newValue.split('|');

        var productModelCode = newValues[0];
        var price = newValues[1];
        var onOrder = newValues[2] == "True";
        var packageAndUnit = newValues[3];
        var minAmount = newValues[4];
        var squareMeterDefaultWidth = newValues[5];
        var hasDifferentModelPicture = newValues[6];
        var isFinalSeries = newValues[7] == "True";
        var squareMeterMinimumCutOff = newValues[8];
        var discountBlock = newValues[9];
        var discountValue = discountBlock.split("#")[0];
        var discountColor = discountBlock.split("#")[1] == "True";

        var imgOnOrder = getProductRowSiblingControl(item, ".imgOnOrder");
        var imgIsFinalSeries = getProductRowSiblingControl(item, ".imgIsFinalSeries");
        var lblPackageAndUnit = getProductRowSiblingControl(item, ".lblPackageAndUnit");
        var hdnProductModelCode = getProductRowSiblingControl(item, ".hdnProductModelCode");
        var lblPrice = getProductRowSiblingControl(item, ".lblPrice");
        var txtQuantityLength = getProductRowSiblingControl(item, ".txtQuantityLength");
        var txtQuantity = getProductRowSiblingControl(item, ".txtQuantity");
        var cboQuantityWidth = getProductRowSiblingControl(item, ".cboQuantityWidth");
        var lblDiscount = getProductRowSiblingControl(item, ".lblDiscount");
        var lblPriceWithVolumePrice = getProductRowSiblingControl(item, ".lblPrice.hasVolumePrice");

        $(lblPackageAndUnit).text(packageAndUnit);
        $(hdnProductModelCode).val(productModelCode);
        $(lblDiscount).text(discountValue);
        $(txtQuantityLength).val(squareMeterMinimumCutOff);
        $(txtQuantityLength).attr("data-minamount", squareMeterMinimumCutOff);

        //destroy tooltip so it will be reloaded next time
        $(lblPriceWithVolumePrice).qtip("destroy");
        loadVolumePriceTooltip(lblPriceWithVolumePrice);
        
        if (price.indexOf("#") > 0) {
            //Price with discount
            var priceHtml = "<span class='oldprice-wrapper'><span class='oldprice'>€ [OLDPRICE]</span></span><span class='nettoprice[ORANGE]'>netto: € [NEWPRICE]</span>";
            priceHtml = priceHtml.replace("[OLDPRICE]", price.split("#")[0]);
            priceHtml = priceHtml.replace("[NEWPRICE]", price.split("#")[1]);

            if (price.split("#")[2] == "True") { //orange
                priceHtml = priceHtml.replace("[ORANGE]", " orange");
            } else {
                priceHtml = priceHtml.replace("[ORANGE]", "");
            }

            $(lblPrice).html(priceHtml);

        } else {
            //Default price
            $(lblPrice).text("€ " + price);
        }

        $(txtQuantity).val(parseFloat(minAmount));
        $(txtQuantity).attr("data-minamount", minAmount);

        if (squareMeterDefaultWidth && squareMeterDefaultWidth != "") {
            $(cboQuantityWidth).html("");
            var squareMeterWidths = squareMeterDefaultWidth.split(';');
            for (var i = 0; i < squareMeterWidths.length; i++) {
                var currentWidth = squareMeterWidths[i];
                $(cboQuantityWidth).append($("<option></option>")
                    .attr("value", currentWidth)
                    .text(currentWidth));
            }
            recalculateSquareMeterQuantity(txtQuantityLength, cboQuantityWidth, txtQuantity);
        }

        if (onOrder) {
            $(imgOnOrder).removeClass("hide");
        } else {
            $(imgOnOrder).addClass("hide");
        }

        if (isFinalSeries) {
            $(imgIsFinalSeries).removeClass("hide");
        } else {
            $(imgIsFinalSeries).addClass("hide");
        }

        if (hasDifferentModelPicture.toLowerCase() == "true") {
            //set custom image for productmodel
            var productModelCode = getProductRowProductModelCode(item);
            var picturewrapper = getProductSiblingControl(item, ".product-picture-wrapper");

            var dataProductImages = {
                productModelCode: productModelCode
            };

            var callback = function (data) {
                if (data != "") {
                    $(picturewrapper).html(data);
                }
            };
            Valcke.webshop.getData("Product", "ProductModelPictures", dataProductImages, callback);
        } else {
            //set default image
            var picturewrapper = getProductSiblingControl(item, ".product-picture-wrapper");
            var defaultImages = getProductSiblingControl(item, ".product-picture-default-images");
            $(picturewrapper).html(defaultImages.html());
        }
    }

    function cboColorTypeChanged(evt, ui, item) {
        var $txtMixedColor = $(item);
        var $imgMixedColorInfo = $(getProductRowSiblingControl(item, ".imgMixedColorInfo"));
        var selectedValue = ui.item.value;

        $(item).unmask();
        $(item).val('');

        if (selectedValue != "-1") {
            $txtMixedColor.removeAttr("disabled");
        }

        var colorType = Valcke.parameters.getColorTypeById(selectedValue);
        var mask = colorType.Mask;
        mask = mask.replace("\\", "");
        //mask = mask.replace(/#/g, '9');
        mask = mask.replace(/a/g, '*');
        mask = mask.replace(/x/g, 'a');

        if (mask == "") {
            $(item).unmask();
        }
        else {
            $(item).mask(mask);
        }
        $imgMixedColorInfo.attr("title", colorType.Description);
        $imgMixedColorInfo.removeClass("hide");
    }

    function cboQuantityWidthChanged(item) {
        var txtQuantityLength = getProductRowSiblingControl(item, ".txtQuantityLength");
        var txtQuantity = getProductRowSiblingControl(item, ".txtQuantity");

        recalculateSquareMeterQuantity(item, txtQuantityLength, txtQuantity);
    }

    function txtQuantityLengthChanged(item) {

        var minimumAmount = parseFloat($(item).attr("data-minamount"));
        var newValue = parseFloat($(item).val().replace(",", "."));

        if (newValue >= minimumAmount) {
            var cboQuantityWidth = getProductRowSiblingControl(item, ".cboQuantityWidth");
            var txtQuantity = getProductRowSiblingControl(item, ".txtQuantity");

            recalculateSquareMeterQuantity(item, cboQuantityWidth, txtQuantity);
        } else {
            var msg = "De opgegeven waarde {0} lm is ongeldig. De minimale afnamehoeveelheid is {1} lm.";
            msg = msg.replace("{0}", newValue).replace("{1}", minimumAmount);
            Valcke.webshop.showToastr("warning", msg);
        }
    }

    function recalculateSquareMeterQuantity(txtQuantityLength, cboQuantityWidth, txtQuantity) {
        if ($(txtQuantityLength).val() != "" && $(cboQuantityWidth).val() != "") {
            var newValueLength = parseFloat($(txtQuantityLength).val().replace(",", "."));
            var newValueWidth = parseFloat($(cboQuantityWidth).val().replace(",", "."));
            var newQuantity = newValueLength * newValueWidth;

            newQuantity = Math.round(newQuantity * 1000) / 1000;

            $(txtQuantity).val(newQuantity);
        }
    }

    function loadVolumePricesTooltip(api, productModelCode, userId) {
        var url = "/DesktopModules/ValckeServices/API/Product/VolumePricesTooltip";
        $.ajax({
            url: url,
            data: {
                productModelCode: productModelCode,
                userId: userId
            },
            success: function (data) {
                var tooltipHtml = data;
                //var tooltipHtml = $("#" + pnlVolumePrice + " .tooltipVolumePrice").html();
                api.set('content.text', tooltipHtml);
            }
        });
    }

    function loadVolumePriceByAmount(productModelCode, userID, quantity, lblDiscount, lblPrice) {
        var url = "/DesktopModules/ValckeServices/API/Product/VolumePriceByAmount";
        $.ajax({
            url: url,
            data: {
                productModelCode: productModelCode,
                userID: userID,
                amount: quantity
            },
            success: function (data) {
                if (data != "" && data != undefined) {
                    var newPrice = data.Price;
                    var newDiscount = data.Discount;
                    var isOrange = data.IsOrange === true;

                    $(lblDiscount).text(newDiscount.replace(",", "."));

                    if (newPrice != "" && newPrice != undefined) {
                        $(lblPrice).text(newPrice.replace(",", "."));
                    }

                    var nettoPrice = $(lblPrice).parents(".nettoprice");
                    if (nettoPrice != undefined) {
                        if (isOrange) {
                            $(nettoPrice).addClass("orange");
                            $(lblDiscount).addClass("orange");
                        } else {
                            $(nettoPrice).removeClass("orange");
                            $(lblDiscount).removeClass("orange");
                        }
                    }
                }
            }
        });
    }

    function showPaintCalculator(item) {
        var efficiency = $(item).attr("data-calculator-efficiency");
        $("#modal-paintCalculator #txtPaintCalculator_efficiency").val(parseFloat(efficiency).toFixed(2));

        $("#modal-paintCalculator").modal();
        Valcke.paintcalculator.initialise();
    }

    function addProductToShoppingCart(item) {
        var productName = $(getProductSiblingControl(item, ".product-name")[0]).text();
        var cboStandardColor = getProductRowSiblingControl(item, ".cboStandardColor");
        var cboColorType = getProductRowSiblingControl(item, ".cboColorType");
        var txtMixedColor = getProductRowSiblingControl(item, ".txtMixedColor");
        var txtNeedsSpec = getProductRowSiblingControl(item, ".txtNeedsSpec");
        var txtQuantity = getProductRowSiblingControl(item, ".txtQuantity");
        var txtQuantityLength = getProductRowSiblingControl(item, ".txtQuantityLength");
        var cboQuantityWidth = getProductRowSiblingControl(item, ".cboQuantityWidth");

        var shoppingCartGuid = Valcke.webshop.getShoppingCartGuid();
        var productModelCode = getProductRowProductModelCode(item);
        var hasCboStandardColor = $(cboStandardColor).length > 0;
        var hasCboColorType = $(cboColorType).length > 0;
        var hasTxtMixedColor = $(txtMixedColor).length > 0;
        var hasTxtNeedsSpec = $(txtNeedsSpec).length > 0;
        var hasSquareMeter = ($(txtQuantityLength).length > 0) && ($(cboQuantityWidth).length > 0);
        var hasTxtSize = false; //TEMP
        var hasDdlSize = false; //TEMP
        var quantity = $(txtQuantity).val();
        var cboStandardColor = $(cboStandardColor).val();
        var cboColorType = $(cboColorType).val();
        var txtMixedColor = $(txtMixedColor).val();
        var txtNeedsSpec = $(txtNeedsSpec).val();
        var txtSquareMeter = "";
        var txtSize = ""; //TEMP
        var ddlSize = ""; //TEMP

        if (hasSquareMeter) {
            var quantityLength = $(txtQuantityLength).val();
            var quantityWidth = $(cboQuantityWidth).val();
            txtSquareMeter = quantityLength + " lm x " + quantityWidth + " b";
        }

        quantity = quantity.replace('.', ',');

        var hasError = false;
        var hasErrorMsg = "";

        if (hasTxtNeedsSpec && txtNeedsSpec == "") {
            hasError = true;
            hasErrorMsg = "Geef een geldige kleur/referentie op voor '" + productName + "'.";
        }


        //ICONS
        var btnAddProductModelToCart = getProductRowSiblingControl(item, ".btnAddProductModelToCart");
        var btnAddProductModelToCartSuccess = getProductRowSiblingControl(item, ".btnAddProductModelToCartSuccess");
        var btnAddProductModelToCartError = getProductRowSiblingControl(item, ".btnAddProductModelToCartError");
        var btnAddProductModelToCartLoading = getProductRowSiblingControl(item, ".btnAddProductModelToCartLoading");

        if (hasError) {
            $(btnAddProductModelToCart).addClass("hide");
            $(btnAddProductModelToCartError).removeClass("hide");
            Valcke.webshop.showToastr("warning", hasErrorMsg);
            return;
        }


        $(btnAddProductModelToCartLoading).removeClass("hide");
        $(btnAddProductModelToCart).addClass("hide");
        $(btnAddProductModelToCartSuccess).addClass("hide");
        $(btnAddProductModelToCartError).addClass("hide");

        var addProductToShoppingCartCallbackError = function (data, productModelName) {
            $(btnAddProductModelToCartError).removeClass("hide");
            $(btnAddProductModelToCartLoading).addClass("hide");

            var msg = "Er is iets foutgelopen bij het toevoegen van '" + productModelName + "'. Probeer nogmaals.";

            if (data.message != "") {
                msg = "Het product '" + productModelName + "' bevat fouten:";
                msg += data.message;
            }

            Valcke.webshop.showToastr("error", msg);

            setTimeout(function () {
                $(btnAddProductModelToCartError).addClass("hide");
                $(btnAddProductModelToCart).removeClass("hide");
            }, 2000);
        };

        var addProductToShoppingCartCallbackSuccess = function (data) {
            if (data.isSuccess.toString().toLowerCase() == "true") {
                $(btnAddProductModelToCartSuccess).removeClass("hide");
                $(btnAddProductModelToCartLoading).addClass("hide");

                setTimeout(function () {
                    $(btnAddProductModelToCart).removeClass("hide");
                    $(btnAddProductModelToCartSuccess).addClass("hide");
                }, 3000);

                //REFRESH CART
                Valcke.shoppingcart.getShoppingCartSummary(shoppingCartGuid);

                //REFRESH PRODUCTROW
                resetProductModelRow(btnAddProductModelToCartSuccess);

                //SHOW POPUP
                showProductAddedModal(data.productCode, data.productModelName, data.productSpecification, data.productQuantity, data.productPackage);

            } else {

                if (data.message == "INVALIDUSER") {
                    $(btnAddProductModelToCartError).removeClass("hide");
                    $(btnAddProductModelToCartLoading).addClass("hide");

                    var redirectUrl = "/Login?returnurl=" + window.location.pathname;
                    window.location.replace(redirectUrl);

                } else {
                    addProductToShoppingCartCallbackError(data, data.productModelName);
                }
            }
        };


        //ADD ITEM TO CART
        Valcke.shoppingcart.addProductModelToShoppingCart(shoppingCartGuid, productModelCode,
            hasCboStandardColor, hasCboColorType, hasTxtMixedColor, hasTxtNeedsSpec, hasTxtSize, hasSquareMeter, hasDdlSize,
            quantity, cboStandardColor, cboColorType, txtMixedColor, txtNeedsSpec, txtSquareMeter, txtSize, ddlSize,
            addProductToShoppingCartCallbackSuccess, addProductToShoppingCartCallbackError);
    }

    function showProductAddedModal(productCode, productName, specification, quantity, productPackage) {
        $("#modal-productRelations #modalTitle1").text(productName + " is toegevoegd aan uw winkelwagen.");
        $("#modal-productRelations #lblProductRelation_Specification").html("<b>Specificatie:</b> " + specification);
        $("#modal-productRelations #lblProductRelation_Quantity").html("<b>Hoeveelheid:</b> " + quantity + " x " + productPackage);

        var dataRelations = {
            productCode: productCode
        };

        var callback = function (data) {
            if (data != "") {
                $("#modal-productRelations #productRelations").html(data);
                $("#modal-productRelations #productRelationsWrapper").show();
            }
        };
        Valcke.webshop.getData("Product", "ProductRelations", dataRelations, callback);

        $("#modal-productRelations").modal();
    }

    function showIconAddProductModelToCartDefault(item) {
        var btnAddProductModelToCart = getProductRowSiblingControl(item, ".btnAddProductModelToCart");
        var btnAddProductModelToCartSuccess = getProductRowSiblingControl(item, ".btnAddProductModelToCartSuccess");
        var btnAddProductModelToCartError = getProductRowSiblingControl(item, ".btnAddProductModelToCartError");
        var btnAddProductModelToCartLoading = getProductRowSiblingControl(item, ".btnAddProductModelToCartLoading");

        $(btnAddProductModelToCartLoading).addClass("hide");
        $(btnAddProductModelToCart).addClass("hide");
        $(btnAddProductModelToCartSuccess).addClass("hide");
        $(btnAddProductModelToCartError).addClass("hide");

        $(btnAddProductModelToCart).removeClass("hide");
    }

    function resetProductModelRow(item) {
        //SELECT DEFAULT VALUES
        var cboStandardColor = getProductRowSiblingControl(item, ".cboStandardColor");
        var txtNeedsSpec = getProductRowSiblingControl(item, ".txtNeedsSpec");
        var txtQuantityLength = getProductRowSiblingControl(item, ".txtQuantityLength");
        var cboQuantityWidth = getProductRowSiblingControl(item, ".cboQuantityWidth");
        var txtQuantity = getProductRowSiblingControl(item, ".txtQuantity");
        var txtMixedColor = getProductRowSiblingControl(item, ".txtMixedColor ");

        var quantityDefaultValue = $(txtQuantity).attr("data-minamount");
        var quantityLengthDefaultValue = $(txtQuantityLength).attr("data-minamount");

        if ($(txtNeedsSpec).length > 0)
            $(txtNeedsSpec).val("");

        if ($(txtMixedColor).length > 0)
            $(txtMixedColor).val("");

        if ($(txtQuantityLength).length > 0)
            $(txtQuantityLength).val(parseFloat(quantityLengthDefaultValue));

        if ($(txtQuantity).length > 0)
            $(txtQuantity).val(parseFloat(quantityDefaultValue));

        if ($(cboStandardColor).length > 0) {
            $(cboStandardColor).children(":first").attr('selected', 'selected');
            $(cboStandardColor).selectmenu("refresh");
        }

        if ($(cboQuantityWidth).length > 0)
            $(cboQuantityWidth).children(":first").attr('selected', 'selected');

        if ($(txtQuantityLength).length > 0 && $(cboQuantityWidth).length > 0 && $(txtQuantity).length > 0)
            recalculateSquareMeterQuantity(txtQuantityLength, cboQuantityWidth, txtQuantity);
    }

    function getProductRowSiblingControl(item, siblingName) {
        return $(item).parents(".product-row").find(siblingName);
    }

    function getProductSiblingControl(item, siblingName) {
        return $(item).parents(".product").find(siblingName);
    }



    function getProductRowProductModelCode(item) {
        var hdnProductModelCode = $(item).parents(".product-row").find(".hdnProductModelCode");
        if ($(hdnProductModelCode).length > 0) {
            return $(hdnProductModelCode).val();
        } else {
            return null;
        }
    }

    function getVisibleProductCount() {
        var productCount = $("#hdnProductListCount").val();
        return parseInt(productCount);
    }

    init();

    return {
        loadProductList: loadProductList,
        getVisibleProductCount: getVisibleProductCount
    };
})();
;;;"use strict";

Valcke.search = (function () {

    function initialise() {
        $("#btnSearch").click(function () {
            searchClicked($(this));
        });

        $("#btnClearSearch").click(function () {
            clearSearchClicked($(this));
        });

        $("#txtSearch").autocomplete({
            source: "/DesktopModules/ValckeServices/API/Product/SearchModelName",
            minLength: 2,
            delay: 150,
            select: function (event, ui) {
                //var txtSearchField = $find("txtSearch");
                //txtSearchField.set_value(ui.item.value);
                $("#txtSearch").val(ui.item.label);
                $("#btnSearch").trigger("click");
            }
        });

        $('#txtSearch').on("keypress", function (e) {
            if (e.keyCode == 13) {
                $("#btnSearch").trigger("click");
                return false; // prevent the button click from happening
            }
        });
    }

    function searchClicked(btn) {
        var searchTerm = $("#txtSearch").val();
        Valcke.navigation.navigateTo(Valcke.constants.navigationType.SEARCH, searchTerm);
    }

    function loadUrlBySearch(searchterm) {
        $("#txtSearch").val(searchterm);
    }

    function clearSearchClicked(btn) {
        clearSearch();
        Valcke.navigation.navigateTo(Valcke.constants.navigationType.SEARCH, "");
    }

    function clearSearch() {
        $("#txtSearch").val("");
    }

    return {
        initialise: initialise,
        loadUrlBySearch: loadUrlBySearch,
        clearSearch: clearSearch
    };
})();
;;;"use strict";

Valcke.filter = {};
Valcke.filter = (function () {

    var brandList = "#brandList";
    var brandTitle = "#brandList #brand-title";
    //var brandFilterClear = "#brandList #brand-title .valcke-clearfilter";
    //var brandFilterCollapse = "#brandList #brand-title .valcke-collapse";

    var brandFilter_imgRemove = "#brandList #brand-title #imgRemove";
    var brandFilter_imgCollapse = "#brandList #brand-title #imgCollapse";
    var brandFilter_imgExpand = "#brandList #brand-title #imgExpand";

    var filterList = "#filterList";
    var filterTitle = "#filterList #filter-title";
    //var filterFilter_imgRemove = "#filterList #filter-title .valcke-clearfilter";
    //var filterFilterCollapse = "#filterList #filter-title .valcke-collapse";

    var filterFilter_imgRemove = "#filterList #filter-title #imgRemove";
    var filterFilter_imgCollapse = "#filterList #filter-title #imgCollapse";
    var filterFilter_imgExpand = "#filterList #filter-title #imgExpand";

    function initialise() {
        //Move brandlist and filterlist to filterbar
        //if (isFullRefresh()) {
        //$("#brandList-wrapper").html("");
        //$("#filterList-wrapper").html("");
        //$(brandList).detach().appendTo("#brandList-wrapper");
        //$(filterList).detach().appendTo("#filterList-wrapper");
        //}

        $(".chkBrand").click(function () {
            brandClicked($(this));
        });

        $(".chkFilterItem").click(function () {
            filterItemClicked($(this));
        });

        $(brandTitle).click(function () {
            brandTitleClicked();
        });

        $(filterTitle).click(function () {
            filterTitleClicked();
        });

        $(brandFilter_imgRemove).click(function (evt) {
            clearBrandSelection();
            Valcke.navigation.navigateTo(Valcke.constants.navigationType.BRAND, "");
            evt.stopPropagation();//do not propagate to title bar
        });

        $(filterFilter_imgRemove).click(function (evt) {
            clearFilterSelection();
            Valcke.navigation.navigateTo(Valcke.constants.navigationType.FILTER, "");
            evt.stopPropagation();//do not propagate to title bar
        });
    }

    function brandClicked(item) {
        var selectedBrandIDs = [];
        var selectedBrandValues = [];
        $(brandList).find('input:checked').each(function () {
            selectedBrandIDs.push($(this).val());
            selectedBrandValues.push($(this).attr("data-brand-text").replace(' ', ''));
        });

        $(brandFilter_imgRemove).removeClass("hide");
        Valcke.navigation.navigateTo(Valcke.constants.navigationType.BRAND, selectedBrandIDs.join('-'), selectedBrandValues.join('-'));
    }

    function filterItemClicked(item) {
        var selectedFilters = [];
        $(filterList).find('input:checked').each(function () {
            selectedFilters.push($(this).val());
        });

        $(filterFilter_imgRemove).removeClass("hide");
        Valcke.navigation.navigateTo(Valcke.constants.navigationType.FILTER, selectedFilters.join('-'));
    }

    function clearBrandSelection() {
        $(brandFilter_imgRemove).addClass("hide");
        $(brandList).find('input:checked').removeAttr('checked');
    }

    function clearFilterSelection() {
        $(filterFilter_imgRemove).addClass("hide");
        $(filterList).find('input:checked').removeAttr('checked');
    }

    function brandTitleClicked() {
        if ($(brandList).hasClass("collapsed")) {
            expandBrands();
        } else {
            collapseBrands();
        }
    }

    function collapseBrands() {
        $(brandList).addClass("collapsed");
        $("#brandList .brand-content").addClass("hide");

        $(brandFilter_imgCollapse).addClass("hide");
        $(brandFilter_imgExpand).removeClass("hide");
    }

    function expandBrands() {
        $(brandList).removeClass("collapsed");
        $("#brandList .brand-content").removeClass("hide");

        $(brandFilter_imgCollapse).removeClass("hide");
        $(brandFilter_imgExpand).addClass("hide");
    }

    function filterTitleClicked() {
        if ($(filterList).hasClass("collapsed")) {
            expandFilters();
        } else {
            collapseFilters();
        }
    }

    function collapseFilters() {
        $(filterList).addClass("collapsed");
        $("#filterList .filter-content").addClass("hide");

        $(filterFilter_imgCollapse).addClass("hide");
        $(filterFilter_imgExpand).removeClass("hide");
    }

    function expandFilters() {
        $(filterList).removeClass("collapsed");
        $("#filterList .filter-content").removeClass("hide");

        $(filterFilter_imgCollapse).removeClass("hide");
        $(filterFilter_imgExpand).addClass("hide");
    }

    return {
        initialise: initialise,
        collapseBrands: collapseBrands,
        expandBrands: expandBrands,
        collapseFilters: collapseFilters,
        expandFilters: expandFilters
    };
})();
;;;'use strict'

var Helpers = Helpers || {};
Helpers = (function () {

    function isCheckboxChecked(itemID) {
        return $('#' + itemID).is(':checked');
    }

    function isRadiobuttonSelected(name, value) {
        return $('[name=' + name + '][value=' + value + ']').is(':checked');
    }

    function round2Decimals(input) {
        return Math.round(input * 100) / 100;
    }

    return {
        isCheckboxChecked: isCheckboxChecked,
        isRadiobuttonSelected: isRadiobuttonSelected,
        round2Decimals: round2Decimals
    };
})();

;;;