/* Minification failed. Returning unminified contents.
(1407,45-53): run-time error JS1006: Expected ')': function
(1407,56): run-time error JS1004: Expected ';'
(1410,22): run-time error JS1004: Expected ';'
(1413,14-15): run-time error JS1195: Expected expression: )
(2758,34-35): run-time error JS1195: Expected expression: .
(2758,68-69): run-time error JS1003: Expected ':': ,
(2759,23-24): run-time error JS1009: Expected '}': :
(2757,20): run-time error JS1004: Expected ';'
(2759,23-24): run-time error JS1195: Expected expression: :
(2759,40-41): run-time error JS1195: Expected expression: .
(2759,74-75): run-time error JS1003: Expected ':': ,
(2760,15): run-time error JS1004: Expected ';'
(2760,15-16): run-time error JS1195: Expected expression: :
(2760,32-33): run-time error JS1195: Expected expression: .
(2760,66-67): run-time error JS1003: Expected ':': ,
(2761,22): run-time error JS1004: Expected ';'
(2761,22-23): run-time error JS1195: Expected expression: :
(2761,39-40): run-time error JS1195: Expected expression: .
(2761,72-73): run-time error JS1003: Expected ':': ,
(2762,22): run-time error JS1004: Expected ';'
(2762,22-23): run-time error JS1195: Expected expression: :
(2763,3-4): run-time error JS1195: Expected expression: }
(2769,1-2): run-time error JS1002: Syntax error: }
 */
/*! jQuery v3.7.1 | (c) OpenJS Foundation and other contributors | jquery.org/license */
!function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(ie,e){"use strict";var oe=[],r=Object.getPrototypeOf,ae=oe.slice,g=oe.flat?function(e){return oe.flat.call(e)}:function(e){return oe.concat.apply([],e)},s=oe.push,se=oe.indexOf,n={},i=n.toString,ue=n.hasOwnProperty,o=ue.toString,a=o.call(Object),le={},v=function(e){return"function"==typeof e&&"number"!=typeof e.nodeType&&"function"!=typeof e.item},y=function(e){return null!=e&&e===e.window},C=ie.document,u={type:!0,src:!0,nonce:!0,noModule:!0};function m(e,t,n){var r,i,o=(n=n||C).createElement("script");if(o.text=e,t)for(r in u)(i=t[r]||t.getAttribute&&t.getAttribute(r))&&o.setAttribute(r,i);n.head.appendChild(o).parentNode.removeChild(o)}function x(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?n[i.call(e)]||"object":typeof e}var t="3.7.1",l=/HTML$/i,ce=function(e,t){return new ce.fn.init(e,t)};function c(e){var t=!!e&&"length"in e&&e.length,n=x(e);return!v(e)&&!y(e)&&("array"===n||0===t||"number"==typeof t&&0<t&&t-1 in e)}function fe(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()}ce.fn=ce.prototype={jquery:t,constructor:ce,length:0,toArray:function(){return ae.call(this)},get:function(e){return null==e?ae.call(this):e<0?this[e+this.length]:this[e]},pushStack:function(e){var t=ce.merge(this.constructor(),e);return t.prevObject=this,t},each:function(e){return ce.each(this,e)},map:function(n){return this.pushStack(ce.map(this,function(e,t){return n.call(e,t,e)}))},slice:function(){return this.pushStack(ae.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},even:function(){return this.pushStack(ce.grep(this,function(e,t){return(t+1)%2}))},odd:function(){return this.pushStack(ce.grep(this,function(e,t){return t%2}))},eq:function(e){var t=this.length,n=+e+(e<0?t:0);return this.pushStack(0<=n&&n<t?[this[n]]:[])},end:function(){return this.prevObject||this.constructor()},push:s,sort:oe.sort,splice:oe.splice},ce.extend=ce.fn.extend=function(){var e,t,n,r,i,o,a=arguments[0]||{},s=1,u=arguments.length,l=!1;for("boolean"==typeof a&&(l=a,a=arguments[s]||{},s++),"object"==typeof a||v(a)||(a={}),s===u&&(a=this,s--);s<u;s++)if(null!=(e=arguments[s]))for(t in e)r=e[t],"__proto__"!==t&&a!==r&&(l&&r&&(ce.isPlainObject(r)||(i=Array.isArray(r)))?(n=a[t],o=i&&!Array.isArray(n)?[]:i||ce.isPlainObject(n)?n:{},i=!1,a[t]=ce.extend(l,o,r)):void 0!==r&&(a[t]=r));return a},ce.extend({expando:"jQuery"+(t+Math.random()).replace(/\D/g,""),isReady:!0,error:function(e){throw new Error(e)},noop:function(){},isPlainObject:function(e){var t,n;return!(!e||"[object Object]"!==i.call(e))&&(!(t=r(e))||"function"==typeof(n=ue.call(t,"constructor")&&t.constructor)&&o.call(n)===a)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},globalEval:function(e,t,n){m(e,{nonce:t&&t.nonce},n)},each:function(e,t){var n,r=0;if(c(e)){for(n=e.length;r<n;r++)if(!1===t.call(e[r],r,e[r]))break}else for(r in e)if(!1===t.call(e[r],r,e[r]))break;return e},text:function(e){var t,n="",r=0,i=e.nodeType;if(!i)while(t=e[r++])n+=ce.text(t);return 1===i||11===i?e.textContent:9===i?e.documentElement.textContent:3===i||4===i?e.nodeValue:n},makeArray:function(e,t){var n=t||[];return null!=e&&(c(Object(e))?ce.merge(n,"string"==typeof e?[e]:e):s.call(n,e)),n},inArray:function(e,t,n){return null==t?-1:se.call(t,e,n)},isXMLDoc:function(e){var t=e&&e.namespaceURI,n=e&&(e.ownerDocument||e).documentElement;return!l.test(t||n&&n.nodeName||"HTML")},merge:function(e,t){for(var n=+t.length,r=0,i=e.length;r<n;r++)e[i++]=t[r];return e.length=i,e},grep:function(e,t,n){for(var r=[],i=0,o=e.length,a=!n;i<o;i++)!t(e[i],i)!==a&&r.push(e[i]);return r},map:function(e,t,n){var r,i,o=0,a=[];if(c(e))for(r=e.length;o<r;o++)null!=(i=t(e[o],o,n))&&a.push(i);else for(o in e)null!=(i=t(e[o],o,n))&&a.push(i);return g(a)},guid:1,support:le}),"function"==typeof Symbol&&(ce.fn[Symbol.iterator]=oe[Symbol.iterator]),ce.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(e,t){n["[object "+t+"]"]=t.toLowerCase()});var pe=oe.pop,de=oe.sort,he=oe.splice,ge="[\\x20\\t\\r\\n\\f]",ve=new RegExp("^"+ge+"+|((?:^|[^\\\\])(?:\\\\.)*)"+ge+"+$","g");ce.contains=function(e,t){var n=t&&t.parentNode;return e===n||!(!n||1!==n.nodeType||!(e.contains?e.contains(n):e.compareDocumentPosition&&16&e.compareDocumentPosition(n)))};var f=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g;function p(e,t){return t?"\0"===e?"\ufffd":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e}ce.escapeSelector=function(e){return(e+"").replace(f,p)};var ye=C,me=s;!function(){var e,b,w,o,a,T,r,C,d,i,k=me,S=ce.expando,E=0,n=0,s=W(),c=W(),u=W(),h=W(),l=function(e,t){return e===t&&(a=!0),0},f="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",t="(?:\\\\[\\da-fA-F]{1,6}"+ge+"?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+",p="\\["+ge+"*("+t+")(?:"+ge+"*([*^$|!~]?=)"+ge+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+t+"))|)"+ge+"*\\]",g=":("+t+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+p+")*)|.*)\\)|)",v=new RegExp(ge+"+","g"),y=new RegExp("^"+ge+"*,"+ge+"*"),m=new RegExp("^"+ge+"*([>+~]|"+ge+")"+ge+"*"),x=new RegExp(ge+"|>"),j=new RegExp(g),A=new RegExp("^"+t+"$"),D={ID:new RegExp("^#("+t+")"),CLASS:new RegExp("^\\.("+t+")"),TAG:new RegExp("^("+t+"|[*])"),ATTR:new RegExp("^"+p),PSEUDO:new RegExp("^"+g),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+ge+"*(even|odd|(([+-]|)(\\d*)n|)"+ge+"*(?:([+-]|)"+ge+"*(\\d+)|))"+ge+"*\\)|)","i"),bool:new RegExp("^(?:"+f+")$","i"),needsContext:new RegExp("^"+ge+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+ge+"*((?:-\\d)?\\d*)"+ge+"*\\)|)(?=[^-]|$)","i")},N=/^(?:input|select|textarea|button)$/i,q=/^h\d$/i,L=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,H=/[+~]/,O=new RegExp("\\\\[\\da-fA-F]{1,6}"+ge+"?|\\\\([^\\r\\n\\f])","g"),P=function(e,t){var n="0x"+e.slice(1)-65536;return t||(n<0?String.fromCharCode(n+65536):String.fromCharCode(n>>10|55296,1023&n|56320))},M=function(){V()},R=J(function(e){return!0===e.disabled&&fe(e,"fieldset")},{dir:"parentNode",next:"legend"});try{k.apply(oe=ae.call(ye.childNodes),ye.childNodes),oe[ye.childNodes.length].nodeType}catch(e){k={apply:function(e,t){me.apply(e,ae.call(t))},call:function(e){me.apply(e,ae.call(arguments,1))}}}function I(t,e,n,r){var i,o,a,s,u,l,c,f=e&&e.ownerDocument,p=e?e.nodeType:9;if(n=n||[],"string"!=typeof t||!t||1!==p&&9!==p&&11!==p)return n;if(!r&&(V(e),e=e||T,C)){if(11!==p&&(u=L.exec(t)))if(i=u[1]){if(9===p){if(!(a=e.getElementById(i)))return n;if(a.id===i)return k.call(n,a),n}else if(f&&(a=f.getElementById(i))&&I.contains(e,a)&&a.id===i)return k.call(n,a),n}else{if(u[2])return k.apply(n,e.getElementsByTagName(t)),n;if((i=u[3])&&e.getElementsByClassName)return k.apply(n,e.getElementsByClassName(i)),n}if(!(h[t+" "]||d&&d.test(t))){if(c=t,f=e,1===p&&(x.test(t)||m.test(t))){(f=H.test(t)&&U(e.parentNode)||e)==e&&le.scope||((s=e.getAttribute("id"))?s=ce.escapeSelector(s):e.setAttribute("id",s=S)),o=(l=Y(t)).length;while(o--)l[o]=(s?"#"+s:":scope")+" "+Q(l[o]);c=l.join(",")}try{return k.apply(n,f.querySelectorAll(c)),n}catch(e){h(t,!0)}finally{s===S&&e.removeAttribute("id")}}}return re(t.replace(ve,"$1"),e,n,r)}function W(){var r=[];return function e(t,n){return r.push(t+" ")>b.cacheLength&&delete e[r.shift()],e[t+" "]=n}}function F(e){return e[S]=!0,e}function $(e){var t=T.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function B(t){return function(e){return fe(e,"input")&&e.type===t}}function _(t){return function(e){return(fe(e,"input")||fe(e,"button"))&&e.type===t}}function z(t){return function(e){return"form"in e?e.parentNode&&!1===e.disabled?"label"in e?"label"in e.parentNode?e.parentNode.disabled===t:e.disabled===t:e.isDisabled===t||e.isDisabled!==!t&&R(e)===t:e.disabled===t:"label"in e&&e.disabled===t}}function X(a){return F(function(o){return o=+o,F(function(e,t){var n,r=a([],e.length,o),i=r.length;while(i--)e[n=r[i]]&&(e[n]=!(t[n]=e[n]))})})}function U(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}function V(e){var t,n=e?e.ownerDocument||e:ye;return n!=T&&9===n.nodeType&&n.documentElement&&(r=(T=n).documentElement,C=!ce.isXMLDoc(T),i=r.matches||r.webkitMatchesSelector||r.msMatchesSelector,r.msMatchesSelector&&ye!=T&&(t=T.defaultView)&&t.top!==t&&t.addEventListener("unload",M),le.getById=$(function(e){return r.appendChild(e).id=ce.expando,!T.getElementsByName||!T.getElementsByName(ce.expando).length}),le.disconnectedMatch=$(function(e){return i.call(e,"*")}),le.scope=$(function(){return T.querySelectorAll(":scope")}),le.cssHas=$(function(){try{return T.querySelector(":has(*,:jqfake)"),!1}catch(e){return!0}}),le.getById?(b.filter.ID=function(e){var t=e.replace(O,P);return function(e){return e.getAttribute("id")===t}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&C){var n=t.getElementById(e);return n?[n]:[]}}):(b.filter.ID=function(e){var n=e.replace(O,P);return function(e){var t="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return t&&t.value===n}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&C){var n,r,i,o=t.getElementById(e);if(o){if((n=o.getAttributeNode("id"))&&n.value===e)return[o];i=t.getElementsByName(e),r=0;while(o=i[r++])if((n=o.getAttributeNode("id"))&&n.value===e)return[o]}return[]}}),b.find.TAG=function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):t.querySelectorAll(e)},b.find.CLASS=function(e,t){if("undefined"!=typeof t.getElementsByClassName&&C)return t.getElementsByClassName(e)},d=[],$(function(e){var t;r.appendChild(e).innerHTML="<a id='"+S+"' href='' disabled='disabled'></a><select id='"+S+"-\r\\' disabled='disabled'><option selected=''></option></select>",e.querySelectorAll("[selected]").length||d.push("\\["+ge+"*(?:value|"+f+")"),e.querySelectorAll("[id~="+S+"-]").length||d.push("~="),e.querySelectorAll("a#"+S+"+*").length||d.push(".#.+[+~]"),e.querySelectorAll(":checked").length||d.push(":checked"),(t=T.createElement("input")).setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),r.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&d.push(":enabled",":disabled"),(t=T.createElement("input")).setAttribute("name",""),e.appendChild(t),e.querySelectorAll("[name='']").length||d.push("\\["+ge+"*name"+ge+"*="+ge+"*(?:''|\"\")")}),le.cssHas||d.push(":has"),d=d.length&&new RegExp(d.join("|")),l=function(e,t){if(e===t)return a=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n||(1&(n=(e.ownerDocument||e)==(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!le.sortDetached&&t.compareDocumentPosition(e)===n?e===T||e.ownerDocument==ye&&I.contains(ye,e)?-1:t===T||t.ownerDocument==ye&&I.contains(ye,t)?1:o?se.call(o,e)-se.call(o,t):0:4&n?-1:1)}),T}for(e in I.matches=function(e,t){return I(e,null,null,t)},I.matchesSelector=function(e,t){if(V(e),C&&!h[t+" "]&&(!d||!d.test(t)))try{var n=i.call(e,t);if(n||le.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(e){h(t,!0)}return 0<I(t,T,null,[e]).length},I.contains=function(e,t){return(e.ownerDocument||e)!=T&&V(e),ce.contains(e,t)},I.attr=function(e,t){(e.ownerDocument||e)!=T&&V(e);var n=b.attrHandle[t.toLowerCase()],r=n&&ue.call(b.attrHandle,t.toLowerCase())?n(e,t,!C):void 0;return void 0!==r?r:e.getAttribute(t)},I.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},ce.uniqueSort=function(e){var t,n=[],r=0,i=0;if(a=!le.sortStable,o=!le.sortStable&&ae.call(e,0),de.call(e,l),a){while(t=e[i++])t===e[i]&&(r=n.push(i));while(r--)he.call(e,n[r],1)}return o=null,e},ce.fn.uniqueSort=function(){return this.pushStack(ce.uniqueSort(ae.apply(this)))},(b=ce.expr={cacheLength:50,createPseudo:F,match:D,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(O,P),e[3]=(e[3]||e[4]||e[5]||"").replace(O,P),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||I.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&I.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return D.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&j.test(n)&&(t=Y(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(O,P).toLowerCase();return"*"===e?function(){return!0}:function(e){return fe(e,t)}},CLASS:function(e){var t=s[e+" "];return t||(t=new RegExp("(^|"+ge+")"+e+"("+ge+"|$)"))&&s(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(n,r,i){return function(e){var t=I.attr(e,n);return null==t?"!="===r:!r||(t+="","="===r?t===i:"!="===r?t!==i:"^="===r?i&&0===t.indexOf(i):"*="===r?i&&-1<t.indexOf(i):"$="===r?i&&t.slice(-i.length)===i:"~="===r?-1<(" "+t.replace(v," ")+" ").indexOf(i):"|="===r&&(t===i||t.slice(0,i.length+1)===i+"-"))}},CHILD:function(d,e,t,h,g){var v="nth"!==d.slice(0,3),y="last"!==d.slice(-4),m="of-type"===e;return 1===h&&0===g?function(e){return!!e.parentNode}:function(e,t,n){var r,i,o,a,s,u=v!==y?"nextSibling":"previousSibling",l=e.parentNode,c=m&&e.nodeName.toLowerCase(),f=!n&&!m,p=!1;if(l){if(v){while(u){o=e;while(o=o[u])if(m?fe(o,c):1===o.nodeType)return!1;s=u="only"===d&&!s&&"nextSibling"}return!0}if(s=[y?l.firstChild:l.lastChild],y&&f){p=(a=(r=(i=l[S]||(l[S]={}))[d]||[])[0]===E&&r[1])&&r[2],o=a&&l.childNodes[a];while(o=++a&&o&&o[u]||(p=a=0)||s.pop())if(1===o.nodeType&&++p&&o===e){i[d]=[E,a,p];break}}else if(f&&(p=a=(r=(i=e[S]||(e[S]={}))[d]||[])[0]===E&&r[1]),!1===p)while(o=++a&&o&&o[u]||(p=a=0)||s.pop())if((m?fe(o,c):1===o.nodeType)&&++p&&(f&&((i=o[S]||(o[S]={}))[d]=[E,p]),o===e))break;return(p-=g)===h||p%h==0&&0<=p/h}}},PSEUDO:function(e,o){var t,a=b.pseudos[e]||b.setFilters[e.toLowerCase()]||I.error("unsupported pseudo: "+e);return a[S]?a(o):1<a.length?(t=[e,e,"",o],b.setFilters.hasOwnProperty(e.toLowerCase())?F(function(e,t){var n,r=a(e,o),i=r.length;while(i--)e[n=se.call(e,r[i])]=!(t[n]=r[i])}):function(e){return a(e,0,t)}):a}},pseudos:{not:F(function(e){var r=[],i=[],s=ne(e.replace(ve,"$1"));return s[S]?F(function(e,t,n,r){var i,o=s(e,null,r,[]),a=e.length;while(a--)(i=o[a])&&(e[a]=!(t[a]=i))}):function(e,t,n){return r[0]=e,s(r,null,n,i),r[0]=null,!i.pop()}}),has:F(function(t){return function(e){return 0<I(t,e).length}}),contains:F(function(t){return t=t.replace(O,P),function(e){return-1<(e.textContent||ce.text(e)).indexOf(t)}}),lang:F(function(n){return A.test(n||"")||I.error("unsupported lang: "+n),n=n.replace(O,P).toLowerCase(),function(e){var t;do{if(t=C?e.lang:e.getAttribute("xml:lang")||e.getAttribute("lang"))return(t=t.toLowerCase())===n||0===t.indexOf(n+"-")}while((e=e.parentNode)&&1===e.nodeType);return!1}}),target:function(e){var t=ie.location&&ie.location.hash;return t&&t.slice(1)===e.id},root:function(e){return e===r},focus:function(e){return e===function(){try{return T.activeElement}catch(e){}}()&&T.hasFocus()&&!!(e.type||e.href||~e.tabIndex)},enabled:z(!1),disabled:z(!0),checked:function(e){return fe(e,"input")&&!!e.checked||fe(e,"option")&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,!0===e.selected},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeType<6)return!1;return!0},parent:function(e){return!b.pseudos.empty(e)},header:function(e){return q.test(e.nodeName)},input:function(e){return N.test(e.nodeName)},button:function(e){return fe(e,"input")&&"button"===e.type||fe(e,"button")},text:function(e){var t;return fe(e,"input")&&"text"===e.type&&(null==(t=e.getAttribute("type"))||"text"===t.toLowerCase())},first:X(function(){return[0]}),last:X(function(e,t){return[t-1]}),eq:X(function(e,t,n){return[n<0?n+t:n]}),even:X(function(e,t){for(var n=0;n<t;n+=2)e.push(n);return e}),odd:X(function(e,t){for(var n=1;n<t;n+=2)e.push(n);return e}),lt:X(function(e,t,n){var r;for(r=n<0?n+t:t<n?t:n;0<=--r;)e.push(r);return e}),gt:X(function(e,t,n){for(var r=n<0?n+t:n;++r<t;)e.push(r);return e})}}).pseudos.nth=b.pseudos.eq,{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})b.pseudos[e]=B(e);for(e in{submit:!0,reset:!0})b.pseudos[e]=_(e);function G(){}function Y(e,t){var n,r,i,o,a,s,u,l=c[e+" "];if(l)return t?0:l.slice(0);a=e,s=[],u=b.preFilter;while(a){for(o in n&&!(r=y.exec(a))||(r&&(a=a.slice(r[0].length)||a),s.push(i=[])),n=!1,(r=m.exec(a))&&(n=r.shift(),i.push({value:n,type:r[0].replace(ve," ")}),a=a.slice(n.length)),b.filter)!(r=D[o].exec(a))||u[o]&&!(r=u[o](r))||(n=r.shift(),i.push({value:n,type:o,matches:r}),a=a.slice(n.length));if(!n)break}return t?a.length:a?I.error(e):c(e,s).slice(0)}function Q(e){for(var t=0,n=e.length,r="";t<n;t++)r+=e[t].value;return r}function J(a,e,t){var s=e.dir,u=e.next,l=u||s,c=t&&"parentNode"===l,f=n++;return e.first?function(e,t,n){while(e=e[s])if(1===e.nodeType||c)return a(e,t,n);return!1}:function(e,t,n){var r,i,o=[E,f];if(n){while(e=e[s])if((1===e.nodeType||c)&&a(e,t,n))return!0}else while(e=e[s])if(1===e.nodeType||c)if(i=e[S]||(e[S]={}),u&&fe(e,u))e=e[s]||e;else{if((r=i[l])&&r[0]===E&&r[1]===f)return o[2]=r[2];if((i[l]=o)[2]=a(e,t,n))return!0}return!1}}function K(i){return 1<i.length?function(e,t,n){var r=i.length;while(r--)if(!i[r](e,t,n))return!1;return!0}:i[0]}function Z(e,t,n,r,i){for(var o,a=[],s=0,u=e.length,l=null!=t;s<u;s++)(o=e[s])&&(n&&!n(o,r,i)||(a.push(o),l&&t.push(s)));return a}function ee(d,h,g,v,y,e){return v&&!v[S]&&(v=ee(v)),y&&!y[S]&&(y=ee(y,e)),F(function(e,t,n,r){var i,o,a,s,u=[],l=[],c=t.length,f=e||function(e,t,n){for(var r=0,i=t.length;r<i;r++)I(e,t[r],n);return n}(h||"*",n.nodeType?[n]:n,[]),p=!d||!e&&h?f:Z(f,u,d,n,r);if(g?g(p,s=y||(e?d:c||v)?[]:t,n,r):s=p,v){i=Z(s,l),v(i,[],n,r),o=i.length;while(o--)(a=i[o])&&(s[l[o]]=!(p[l[o]]=a))}if(e){if(y||d){if(y){i=[],o=s.length;while(o--)(a=s[o])&&i.push(p[o]=a);y(null,s=[],i,r)}o=s.length;while(o--)(a=s[o])&&-1<(i=y?se.call(e,a):u[o])&&(e[i]=!(t[i]=a))}}else s=Z(s===t?s.splice(c,s.length):s),y?y(null,t,s,r):k.apply(t,s)})}function te(e){for(var i,t,n,r=e.length,o=b.relative[e[0].type],a=o||b.relative[" "],s=o?1:0,u=J(function(e){return e===i},a,!0),l=J(function(e){return-1<se.call(i,e)},a,!0),c=[function(e,t,n){var r=!o&&(n||t!=w)||((i=t).nodeType?u(e,t,n):l(e,t,n));return i=null,r}];s<r;s++)if(t=b.relative[e[s].type])c=[J(K(c),t)];else{if((t=b.filter[e[s].type].apply(null,e[s].matches))[S]){for(n=++s;n<r;n++)if(b.relative[e[n].type])break;return ee(1<s&&K(c),1<s&&Q(e.slice(0,s-1).concat({value:" "===e[s-2].type?"*":""})).replace(ve,"$1"),t,s<n&&te(e.slice(s,n)),n<r&&te(e=e.slice(n)),n<r&&Q(e))}c.push(t)}return K(c)}function ne(e,t){var n,v,y,m,x,r,i=[],o=[],a=u[e+" "];if(!a){t||(t=Y(e)),n=t.length;while(n--)(a=te(t[n]))[S]?i.push(a):o.push(a);(a=u(e,(v=o,m=0<(y=i).length,x=0<v.length,r=function(e,t,n,r,i){var o,a,s,u=0,l="0",c=e&&[],f=[],p=w,d=e||x&&b.find.TAG("*",i),h=E+=null==p?1:Math.random()||.1,g=d.length;for(i&&(w=t==T||t||i);l!==g&&null!=(o=d[l]);l++){if(x&&o){a=0,t||o.ownerDocument==T||(V(o),n=!C);while(s=v[a++])if(s(o,t||T,n)){k.call(r,o);break}i&&(E=h)}m&&((o=!s&&o)&&u--,e&&c.push(o))}if(u+=l,m&&l!==u){a=0;while(s=y[a++])s(c,f,t,n);if(e){if(0<u)while(l--)c[l]||f[l]||(f[l]=pe.call(r));f=Z(f)}k.apply(r,f),i&&!e&&0<f.length&&1<u+y.length&&ce.uniqueSort(r)}return i&&(E=h,w=p),c},m?F(r):r))).selector=e}return a}function re(e,t,n,r){var i,o,a,s,u,l="function"==typeof e&&e,c=!r&&Y(e=l.selector||e);if(n=n||[],1===c.length){if(2<(o=c[0]=c[0].slice(0)).length&&"ID"===(a=o[0]).type&&9===t.nodeType&&C&&b.relative[o[1].type]){if(!(t=(b.find.ID(a.matches[0].replace(O,P),t)||[])[0]))return n;l&&(t=t.parentNode),e=e.slice(o.shift().value.length)}i=D.needsContext.test(e)?0:o.length;while(i--){if(a=o[i],b.relative[s=a.type])break;if((u=b.find[s])&&(r=u(a.matches[0].replace(O,P),H.test(o[0].type)&&U(t.parentNode)||t))){if(o.splice(i,1),!(e=r.length&&Q(o)))return k.apply(n,r),n;break}}}return(l||ne(e,c))(r,t,!C,n,!t||H.test(e)&&U(t.parentNode)||t),n}G.prototype=b.filters=b.pseudos,b.setFilters=new G,le.sortStable=S.split("").sort(l).join("")===S,V(),le.sortDetached=$(function(e){return 1&e.compareDocumentPosition(T.createElement("fieldset"))}),ce.find=I,ce.expr[":"]=ce.expr.pseudos,ce.unique=ce.uniqueSort,I.compile=ne,I.select=re,I.setDocument=V,I.tokenize=Y,I.escape=ce.escapeSelector,I.getText=ce.text,I.isXML=ce.isXMLDoc,I.selectors=ce.expr,I.support=ce.support,I.uniqueSort=ce.uniqueSort}();var d=function(e,t,n){var r=[],i=void 0!==n;while((e=e[t])&&9!==e.nodeType)if(1===e.nodeType){if(i&&ce(e).is(n))break;r.push(e)}return r},h=function(e,t){for(var n=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n},b=ce.expr.match.needsContext,w=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function T(e,n,r){return v(n)?ce.grep(e,function(e,t){return!!n.call(e,t,e)!==r}):n.nodeType?ce.grep(e,function(e){return e===n!==r}):"string"!=typeof n?ce.grep(e,function(e){return-1<se.call(n,e)!==r}):ce.filter(n,e,r)}ce.filter=function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===r.nodeType?ce.find.matchesSelector(r,e)?[r]:[]:ce.find.matches(e,ce.grep(t,function(e){return 1===e.nodeType}))},ce.fn.extend({find:function(e){var t,n,r=this.length,i=this;if("string"!=typeof e)return this.pushStack(ce(e).filter(function(){for(t=0;t<r;t++)if(ce.contains(i[t],this))return!0}));for(n=this.pushStack([]),t=0;t<r;t++)ce.find(e,i[t],n);return 1<r?ce.uniqueSort(n):n},filter:function(e){return this.pushStack(T(this,e||[],!1))},not:function(e){return this.pushStack(T(this,e||[],!0))},is:function(e){return!!T(this,"string"==typeof e&&b.test(e)?ce(e):e||[],!1).length}});var k,S=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/;(ce.fn.init=function(e,t,n){var r,i;if(!e)return this;if(n=n||k,"string"==typeof e){if(!(r="<"===e[0]&&">"===e[e.length-1]&&3<=e.length?[null,e,null]:S.exec(e))||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof ce?t[0]:t,ce.merge(this,ce.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:C,!0)),w.test(r[1])&&ce.isPlainObject(t))for(r in t)v(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}return(i=C.getElementById(r[2]))&&(this[0]=i,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):v(e)?void 0!==n.ready?n.ready(e):e(ce):ce.makeArray(e,this)}).prototype=ce.fn,k=ce(C);var E=/^(?:parents|prev(?:Until|All))/,j={children:!0,contents:!0,next:!0,prev:!0};function A(e,t){while((e=e[t])&&1!==e.nodeType);return e}ce.fn.extend({has:function(e){var t=ce(e,this),n=t.length;return this.filter(function(){for(var e=0;e<n;e++)if(ce.contains(this,t[e]))return!0})},closest:function(e,t){var n,r=0,i=this.length,o=[],a="string"!=typeof e&&ce(e);if(!b.test(e))for(;r<i;r++)for(n=this[r];n&&n!==t;n=n.parentNode)if(n.nodeType<11&&(a?-1<a.index(n):1===n.nodeType&&ce.find.matchesSelector(n,e))){o.push(n);break}return this.pushStack(1<o.length?ce.uniqueSort(o):o)},index:function(e){return e?"string"==typeof e?se.call(ce(e),this[0]):se.call(this,e.jquery?e[0]:e):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){return this.pushStack(ce.uniqueSort(ce.merge(this.get(),ce(e,t))))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}}),ce.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return d(e,"parentNode")},parentsUntil:function(e,t,n){return d(e,"parentNode",n)},next:function(e){return A(e,"nextSibling")},prev:function(e){return A(e,"previousSibling")},nextAll:function(e){return d(e,"nextSibling")},prevAll:function(e){return d(e,"previousSibling")},nextUntil:function(e,t,n){return d(e,"nextSibling",n)},prevUntil:function(e,t,n){return d(e,"previousSibling",n)},siblings:function(e){return h((e.parentNode||{}).firstChild,e)},children:function(e){return h(e.firstChild)},contents:function(e){return null!=e.contentDocument&&r(e.contentDocument)?e.contentDocument:(fe(e,"template")&&(e=e.content||e),ce.merge([],e.childNodes))}},function(r,i){ce.fn[r]=function(e,t){var n=ce.map(this,i,e);return"Until"!==r.slice(-5)&&(t=e),t&&"string"==typeof t&&(n=ce.filter(t,n)),1<this.length&&(j[r]||ce.uniqueSort(n),E.test(r)&&n.reverse()),this.pushStack(n)}});var D=/[^\x20\t\r\n\f]+/g;function N(e){return e}function q(e){throw e}function L(e,t,n,r){var i;try{e&&v(i=e.promise)?i.call(e).done(t).fail(n):e&&v(i=e.then)?i.call(e,t,n):t.apply(void 0,[e].slice(r))}catch(e){n.apply(void 0,[e])}}ce.Callbacks=function(r){var e,n;r="string"==typeof r?(e=r,n={},ce.each(e.match(D)||[],function(e,t){n[t]=!0}),n):ce.extend({},r);var i,t,o,a,s=[],u=[],l=-1,c=function(){for(a=a||r.once,o=i=!0;u.length;l=-1){t=u.shift();while(++l<s.length)!1===s[l].apply(t[0],t[1])&&r.stopOnFalse&&(l=s.length,t=!1)}r.memory||(t=!1),i=!1,a&&(s=t?[]:"")},f={add:function(){return s&&(t&&!i&&(l=s.length-1,u.push(t)),function n(e){ce.each(e,function(e,t){v(t)?r.unique&&f.has(t)||s.push(t):t&&t.length&&"string"!==x(t)&&n(t)})}(arguments),t&&!i&&c()),this},remove:function(){return ce.each(arguments,function(e,t){var n;while(-1<(n=ce.inArray(t,s,n)))s.splice(n,1),n<=l&&l--}),this},has:function(e){return e?-1<ce.inArray(e,s):0<s.length},empty:function(){return s&&(s=[]),this},disable:function(){return a=u=[],s=t="",this},disabled:function(){return!s},lock:function(){return a=u=[],t||i||(s=t=""),this},locked:function(){return!!a},fireWith:function(e,t){return a||(t=[e,(t=t||[]).slice?t.slice():t],u.push(t),i||c()),this},fire:function(){return f.fireWith(this,arguments),this},fired:function(){return!!o}};return f},ce.extend({Deferred:function(e){var o=[["notify","progress",ce.Callbacks("memory"),ce.Callbacks("memory"),2],["resolve","done",ce.Callbacks("once memory"),ce.Callbacks("once memory"),0,"resolved"],["reject","fail",ce.Callbacks("once memory"),ce.Callbacks("once memory"),1,"rejected"]],i="pending",a={state:function(){return i},always:function(){return s.done(arguments).fail(arguments),this},"catch":function(e){return a.then(null,e)},pipe:function(){var i=arguments;return ce.Deferred(function(r){ce.each(o,function(e,t){var n=v(i[t[4]])&&i[t[4]];s[t[1]](function(){var e=n&&n.apply(this,arguments);e&&v(e.promise)?e.promise().progress(r.notify).done(r.resolve).fail(r.reject):r[t[0]+"With"](this,n?[e]:arguments)})}),i=null}).promise()},then:function(t,n,r){var u=0;function l(i,o,a,s){return function(){var n=this,r=arguments,e=function(){var e,t;if(!(i<u)){if((e=a.apply(n,r))===o.promise())throw new TypeError("Thenable self-resolution");t=e&&("object"==typeof e||"function"==typeof e)&&e.then,v(t)?s?t.call(e,l(u,o,N,s),l(u,o,q,s)):(u++,t.call(e,l(u,o,N,s),l(u,o,q,s),l(u,o,N,o.notifyWith))):(a!==N&&(n=void 0,r=[e]),(s||o.resolveWith)(n,r))}},t=s?e:function(){try{e()}catch(e){ce.Deferred.exceptionHook&&ce.Deferred.exceptionHook(e,t.error),u<=i+1&&(a!==q&&(n=void 0,r=[e]),o.rejectWith(n,r))}};i?t():(ce.Deferred.getErrorHook?t.error=ce.Deferred.getErrorHook():ce.Deferred.getStackHook&&(t.error=ce.Deferred.getStackHook()),ie.setTimeout(t))}}return ce.Deferred(function(e){o[0][3].add(l(0,e,v(r)?r:N,e.notifyWith)),o[1][3].add(l(0,e,v(t)?t:N)),o[2][3].add(l(0,e,v(n)?n:q))}).promise()},promise:function(e){return null!=e?ce.extend(e,a):a}},s={};return ce.each(o,function(e,t){var n=t[2],r=t[5];a[t[1]]=n.add,r&&n.add(function(){i=r},o[3-e][2].disable,o[3-e][3].disable,o[0][2].lock,o[0][3].lock),n.add(t[3].fire),s[t[0]]=function(){return s[t[0]+"With"](this===s?void 0:this,arguments),this},s[t[0]+"With"]=n.fireWith}),a.promise(s),e&&e.call(s,s),s},when:function(e){var n=arguments.length,t=n,r=Array(t),i=ae.call(arguments),o=ce.Deferred(),a=function(t){return function(e){r[t]=this,i[t]=1<arguments.length?ae.call(arguments):e,--n||o.resolveWith(r,i)}};if(n<=1&&(L(e,o.done(a(t)).resolve,o.reject,!n),"pending"===o.state()||v(i[t]&&i[t].then)))return o.then();while(t--)L(i[t],a(t),o.reject);return o.promise()}});var H=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;ce.Deferred.exceptionHook=function(e,t){ie.console&&ie.console.warn&&e&&H.test(e.name)&&ie.console.warn("jQuery.Deferred exception: "+e.message,e.stack,t)},ce.readyException=function(e){ie.setTimeout(function(){throw e})};var O=ce.Deferred();function P(){C.removeEventListener("DOMContentLoaded",P),ie.removeEventListener("load",P),ce.ready()}ce.fn.ready=function(e){return O.then(e)["catch"](function(e){ce.readyException(e)}),this},ce.extend({isReady:!1,readyWait:1,ready:function(e){(!0===e?--ce.readyWait:ce.isReady)||(ce.isReady=!0)!==e&&0<--ce.readyWait||O.resolveWith(C,[ce])}}),ce.ready.then=O.then,"complete"===C.readyState||"loading"!==C.readyState&&!C.documentElement.doScroll?ie.setTimeout(ce.ready):(C.addEventListener("DOMContentLoaded",P),ie.addEventListener("load",P));var M=function(e,t,n,r,i,o,a){var s=0,u=e.length,l=null==n;if("object"===x(n))for(s in i=!0,n)M(e,t,s,n[s],!0,o,a);else if(void 0!==r&&(i=!0,v(r)||(a=!0),l&&(a?(t.call(e,r),t=null):(l=t,t=function(e,t,n){return l.call(ce(e),n)})),t))for(;s<u;s++)t(e[s],n,a?r:r.call(e[s],s,t(e[s],n)));return i?e:l?t.call(e):u?t(e[0],n):o},R=/^-ms-/,I=/-([a-z])/g;function W(e,t){return t.toUpperCase()}function F(e){return e.replace(R,"ms-").replace(I,W)}var $=function(e){return 1===e.nodeType||9===e.nodeType||!+e.nodeType};function B(){this.expando=ce.expando+B.uid++}B.uid=1,B.prototype={cache:function(e){var t=e[this.expando];return t||(t={},$(e)&&(e.nodeType?e[this.expando]=t:Object.defineProperty(e,this.expando,{value:t,configurable:!0}))),t},set:function(e,t,n){var r,i=this.cache(e);if("string"==typeof t)i[F(t)]=n;else for(r in t)i[F(r)]=t[r];return i},get:function(e,t){return void 0===t?this.cache(e):e[this.expando]&&e[this.expando][F(t)]},access:function(e,t,n){return void 0===t||t&&"string"==typeof t&&void 0===n?this.get(e,t):(this.set(e,t,n),void 0!==n?n:t)},remove:function(e,t){var n,r=e[this.expando];if(void 0!==r){if(void 0!==t){n=(t=Array.isArray(t)?t.map(F):(t=F(t))in r?[t]:t.match(D)||[]).length;while(n--)delete r[t[n]]}(void 0===t||ce.isEmptyObject(r))&&(e.nodeType?e[this.expando]=void 0:delete e[this.expando])}},hasData:function(e){var t=e[this.expando];return void 0!==t&&!ce.isEmptyObject(t)}};var _=new B,z=new B,X=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,U=/[A-Z]/g;function V(e,t,n){var r,i;if(void 0===n&&1===e.nodeType)if(r="data-"+t.replace(U,"-$&").toLowerCase(),"string"==typeof(n=e.getAttribute(r))){try{n="true"===(i=n)||"false"!==i&&("null"===i?null:i===+i+""?+i:X.test(i)?JSON.parse(i):i)}catch(e){}z.set(e,t,n)}else n=void 0;return n}ce.extend({hasData:function(e){return z.hasData(e)||_.hasData(e)},data:function(e,t,n){return z.access(e,t,n)},removeData:function(e,t){z.remove(e,t)},_data:function(e,t,n){return _.access(e,t,n)},_removeData:function(e,t){_.remove(e,t)}}),ce.fn.extend({data:function(n,e){var t,r,i,o=this[0],a=o&&o.attributes;if(void 0===n){if(this.length&&(i=z.get(o),1===o.nodeType&&!_.get(o,"hasDataAttrs"))){t=a.length;while(t--)a[t]&&0===(r=a[t].name).indexOf("data-")&&(r=F(r.slice(5)),V(o,r,i[r]));_.set(o,"hasDataAttrs",!0)}return i}return"object"==typeof n?this.each(function(){z.set(this,n)}):M(this,function(e){var t;if(o&&void 0===e)return void 0!==(t=z.get(o,n))?t:void 0!==(t=V(o,n))?t:void 0;this.each(function(){z.set(this,n,e)})},null,e,1<arguments.length,null,!0)},removeData:function(e){return this.each(function(){z.remove(this,e)})}}),ce.extend({queue:function(e,t,n){var r;if(e)return t=(t||"fx")+"queue",r=_.get(e,t),n&&(!r||Array.isArray(n)?r=_.access(e,t,ce.makeArray(n)):r.push(n)),r||[]},dequeue:function(e,t){t=t||"fx";var n=ce.queue(e,t),r=n.length,i=n.shift(),o=ce._queueHooks(e,t);"inprogress"===i&&(i=n.shift(),r--),i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,function(){ce.dequeue(e,t)},o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return _.get(e,n)||_.access(e,n,{empty:ce.Callbacks("once memory").add(function(){_.remove(e,[t+"queue",n])})})}}),ce.fn.extend({queue:function(t,n){var e=2;return"string"!=typeof t&&(n=t,t="fx",e--),arguments.length<e?ce.queue(this[0],t):void 0===n?this:this.each(function(){var e=ce.queue(this,t,n);ce._queueHooks(this,t),"fx"===t&&"inprogress"!==e[0]&&ce.dequeue(this,t)})},dequeue:function(e){return this.each(function(){ce.dequeue(this,e)})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,t){var n,r=1,i=ce.Deferred(),o=this,a=this.length,s=function(){--r||i.resolveWith(o,[o])};"string"!=typeof e&&(t=e,e=void 0),e=e||"fx";while(a--)(n=_.get(o[a],e+"queueHooks"))&&n.empty&&(r++,n.empty.add(s));return s(),i.promise(t)}});var G=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,Y=new RegExp("^(?:([+-])=|)("+G+")([a-z%]*)$","i"),Q=["Top","Right","Bottom","Left"],J=C.documentElement,K=function(e){return ce.contains(e.ownerDocument,e)},Z={composed:!0};J.getRootNode&&(K=function(e){return ce.contains(e.ownerDocument,e)||e.getRootNode(Z)===e.ownerDocument});var ee=function(e,t){return"none"===(e=t||e).style.display||""===e.style.display&&K(e)&&"none"===ce.css(e,"display")};function te(e,t,n,r){var i,o,a=20,s=r?function(){return r.cur()}:function(){return ce.css(e,t,"")},u=s(),l=n&&n[3]||(ce.cssNumber[t]?"":"px"),c=e.nodeType&&(ce.cssNumber[t]||"px"!==l&&+u)&&Y.exec(ce.css(e,t));if(c&&c[3]!==l){u/=2,l=l||c[3],c=+u||1;while(a--)ce.style(e,t,c+l),(1-o)*(1-(o=s()/u||.5))<=0&&(a=0),c/=o;c*=2,ce.style(e,t,c+l),n=n||[]}return n&&(c=+c||+u||0,i=n[1]?c+(n[1]+1)*n[2]:+n[2],r&&(r.unit=l,r.start=c,r.end=i)),i}var ne={};function re(e,t){for(var n,r,i,o,a,s,u,l=[],c=0,f=e.length;c<f;c++)(r=e[c]).style&&(n=r.style.display,t?("none"===n&&(l[c]=_.get(r,"display")||null,l[c]||(r.style.display="")),""===r.style.display&&ee(r)&&(l[c]=(u=a=o=void 0,a=(i=r).ownerDocument,s=i.nodeName,(u=ne[s])||(o=a.body.appendChild(a.createElement(s)),u=ce.css(o,"display"),o.parentNode.removeChild(o),"none"===u&&(u="block"),ne[s]=u)))):"none"!==n&&(l[c]="none",_.set(r,"display",n)));for(c=0;c<f;c++)null!=l[c]&&(e[c].style.display=l[c]);return e}ce.fn.extend({show:function(){return re(this,!0)},hide:function(){return re(this)},toggle:function(e){return"boolean"==typeof e?e?this.show():this.hide():this.each(function(){ee(this)?ce(this).show():ce(this).hide()})}});var xe,be,we=/^(?:checkbox|radio)$/i,Te=/<([a-z][^\/\0>\x20\t\r\n\f]*)/i,Ce=/^$|^module$|\/(?:java|ecma)script/i;xe=C.createDocumentFragment().appendChild(C.createElement("div")),(be=C.createElement("input")).setAttribute("type","radio"),be.setAttribute("checked","checked"),be.setAttribute("name","t"),xe.appendChild(be),le.checkClone=xe.cloneNode(!0).cloneNode(!0).lastChild.checked,xe.innerHTML="<textarea>x</textarea>",le.noCloneChecked=!!xe.cloneNode(!0).lastChild.defaultValue,xe.innerHTML="<option></option>",le.option=!!xe.lastChild;var ke={thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};function Se(e,t){var n;return n="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&fe(e,t)?ce.merge([e],n):n}function Ee(e,t){for(var n=0,r=e.length;n<r;n++)_.set(e[n],"globalEval",!t||_.get(t[n],"globalEval"))}ke.tbody=ke.tfoot=ke.colgroup=ke.caption=ke.thead,ke.th=ke.td,le.option||(ke.optgroup=ke.option=[1,"<select multiple='multiple'>","</select>"]);var je=/<|&#?\w+;/;function Ae(e,t,n,r,i){for(var o,a,s,u,l,c,f=t.createDocumentFragment(),p=[],d=0,h=e.length;d<h;d++)if((o=e[d])||0===o)if("object"===x(o))ce.merge(p,o.nodeType?[o]:o);else if(je.test(o)){a=a||f.appendChild(t.createElement("div")),s=(Te.exec(o)||["",""])[1].toLowerCase(),u=ke[s]||ke._default,a.innerHTML=u[1]+ce.htmlPrefilter(o)+u[2],c=u[0];while(c--)a=a.lastChild;ce.merge(p,a.childNodes),(a=f.firstChild).textContent=""}else p.push(t.createTextNode(o));f.textContent="",d=0;while(o=p[d++])if(r&&-1<ce.inArray(o,r))i&&i.push(o);else if(l=K(o),a=Se(f.appendChild(o),"script"),l&&Ee(a),n){c=0;while(o=a[c++])Ce.test(o.type||"")&&n.push(o)}return f}var De=/^([^.]*)(?:\.(.+)|)/;function Ne(){return!0}function qe(){return!1}function Le(e,t,n,r,i,o){var a,s;if("object"==typeof t){for(s in"string"!=typeof n&&(r=r||n,n=void 0),t)Le(e,s,n,r,t[s],o);return e}if(null==r&&null==i?(i=n,r=n=void 0):null==i&&("string"==typeof n?(i=r,r=void 0):(i=r,r=n,n=void 0)),!1===i)i=qe;else if(!i)return e;return 1===o&&(a=i,(i=function(e){return ce().off(e),a.apply(this,arguments)}).guid=a.guid||(a.guid=ce.guid++)),e.each(function(){ce.event.add(this,t,i,r,n)})}function He(e,r,t){t?(_.set(e,r,!1),ce.event.add(e,r,{namespace:!1,handler:function(e){var t,n=_.get(this,r);if(1&e.isTrigger&&this[r]){if(n)(ce.event.special[r]||{}).delegateType&&e.stopPropagation();else if(n=ae.call(arguments),_.set(this,r,n),this[r](),t=_.get(this,r),_.set(this,r,!1),n!==t)return e.stopImmediatePropagation(),e.preventDefault(),t}else n&&(_.set(this,r,ce.event.trigger(n[0],n.slice(1),this)),e.stopPropagation(),e.isImmediatePropagationStopped=Ne)}})):void 0===_.get(e,r)&&ce.event.add(e,r,Ne)}ce.event={global:{},add:function(t,e,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,v=_.get(t);if($(t)){n.handler&&(n=(o=n).handler,i=o.selector),i&&ce.find.matchesSelector(J,i),n.guid||(n.guid=ce.guid++),(u=v.events)||(u=v.events=Object.create(null)),(a=v.handle)||(a=v.handle=function(e){return"undefined"!=typeof ce&&ce.event.triggered!==e.type?ce.event.dispatch.apply(t,arguments):void 0}),l=(e=(e||"").match(D)||[""]).length;while(l--)d=g=(s=De.exec(e[l])||[])[1],h=(s[2]||"").split(".").sort(),d&&(f=ce.event.special[d]||{},d=(i?f.delegateType:f.bindType)||d,f=ce.event.special[d]||{},c=ce.extend({type:d,origType:g,data:r,handler:n,guid:n.guid,selector:i,needsContext:i&&ce.expr.match.needsContext.test(i),namespace:h.join(".")},o),(p=u[d])||((p=u[d]=[]).delegateCount=0,f.setup&&!1!==f.setup.call(t,r,h,a)||t.addEventListener&&t.addEventListener(d,a)),f.add&&(f.add.call(t,c),c.handler.guid||(c.handler.guid=n.guid)),i?p.splice(p.delegateCount++,0,c):p.push(c),ce.event.global[d]=!0)}},remove:function(e,t,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,v=_.hasData(e)&&_.get(e);if(v&&(u=v.events)){l=(t=(t||"").match(D)||[""]).length;while(l--)if(d=g=(s=De.exec(t[l])||[])[1],h=(s[2]||"").split(".").sort(),d){f=ce.event.special[d]||{},p=u[d=(r?f.delegateType:f.bindType)||d]||[],s=s[2]&&new RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),a=o=p.length;while(o--)c=p[o],!i&&g!==c.origType||n&&n.guid!==c.guid||s&&!s.test(c.namespace)||r&&r!==c.selector&&("**"!==r||!c.selector)||(p.splice(o,1),c.selector&&p.delegateCount--,f.remove&&f.remove.call(e,c));a&&!p.length&&(f.teardown&&!1!==f.teardown.call(e,h,v.handle)||ce.removeEvent(e,d,v.handle),delete u[d])}else for(d in u)ce.event.remove(e,d+t[l],n,r,!0);ce.isEmptyObject(u)&&_.remove(e,"handle events")}},dispatch:function(e){var t,n,r,i,o,a,s=new Array(arguments.length),u=ce.event.fix(e),l=(_.get(this,"events")||Object.create(null))[u.type]||[],c=ce.event.special[u.type]||{};for(s[0]=u,t=1;t<arguments.length;t++)s[t]=arguments[t];if(u.delegateTarget=this,!c.preDispatch||!1!==c.preDispatch.call(this,u)){a=ce.event.handlers.call(this,u,l),t=0;while((i=a[t++])&&!u.isPropagationStopped()){u.currentTarget=i.elem,n=0;while((o=i.handlers[n++])&&!u.isImmediatePropagationStopped())u.rnamespace&&!1!==o.namespace&&!u.rnamespace.test(o.namespace)||(u.handleObj=o,u.data=o.data,void 0!==(r=((ce.event.special[o.origType]||{}).handle||o.handler).apply(i.elem,s))&&!1===(u.result=r)&&(u.preventDefault(),u.stopPropagation()))}return c.postDispatch&&c.postDispatch.call(this,u),u.result}},handlers:function(e,t){var n,r,i,o,a,s=[],u=t.delegateCount,l=e.target;if(u&&l.nodeType&&!("click"===e.type&&1<=e.button))for(;l!==this;l=l.parentNode||this)if(1===l.nodeType&&("click"!==e.type||!0!==l.disabled)){for(o=[],a={},n=0;n<u;n++)void 0===a[i=(r=t[n]).selector+" "]&&(a[i]=r.needsContext?-1<ce(i,this).index(l):ce.find(i,this,null,[l]).length),a[i]&&o.push(r);o.length&&s.push({elem:l,handlers:o})}return l=this,u<t.length&&s.push({elem:l,handlers:t.slice(u)}),s},addProp:function(t,e){Object.defineProperty(ce.Event.prototype,t,{enumerable:!0,configurable:!0,get:v(e)?function(){if(this.originalEvent)return e(this.originalEvent)}:function(){if(this.originalEvent)return this.originalEvent[t]},set:function(e){Object.defineProperty(this,t,{enumerable:!0,configurable:!0,writable:!0,value:e})}})},fix:function(e){return e[ce.expando]?e:new ce.Event(e)},special:{load:{noBubble:!0},click:{setup:function(e){var t=this||e;return we.test(t.type)&&t.click&&fe(t,"input")&&He(t,"click",!0),!1},trigger:function(e){var t=this||e;return we.test(t.type)&&t.click&&fe(t,"input")&&He(t,"click"),!0},_default:function(e){var t=e.target;return we.test(t.type)&&t.click&&fe(t,"input")&&_.get(t,"click")||fe(t,"a")}},beforeunload:{postDispatch:function(e){void 0!==e.result&&e.originalEvent&&(e.originalEvent.returnValue=e.result)}}}},ce.removeEvent=function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n)},ce.Event=function(e,t){if(!(this instanceof ce.Event))return new ce.Event(e,t);e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||void 0===e.defaultPrevented&&!1===e.returnValue?Ne:qe,this.target=e.target&&3===e.target.nodeType?e.target.parentNode:e.target,this.currentTarget=e.currentTarget,this.relatedTarget=e.relatedTarget):this.type=e,t&&ce.extend(this,t),this.timeStamp=e&&e.timeStamp||Date.now(),this[ce.expando]=!0},ce.Event.prototype={constructor:ce.Event,isDefaultPrevented:qe,isPropagationStopped:qe,isImmediatePropagationStopped:qe,isSimulated:!1,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=Ne,e&&!this.isSimulated&&e.preventDefault()},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=Ne,e&&!this.isSimulated&&e.stopPropagation()},stopImmediatePropagation:function(){var e=this.originalEvent;this.isImmediatePropagationStopped=Ne,e&&!this.isSimulated&&e.stopImmediatePropagation(),this.stopPropagation()}},ce.each({altKey:!0,bubbles:!0,cancelable:!0,changedTouches:!0,ctrlKey:!0,detail:!0,eventPhase:!0,metaKey:!0,pageX:!0,pageY:!0,shiftKey:!0,view:!0,"char":!0,code:!0,charCode:!0,key:!0,keyCode:!0,button:!0,buttons:!0,clientX:!0,clientY:!0,offsetX:!0,offsetY:!0,pointerId:!0,pointerType:!0,screenX:!0,screenY:!0,targetTouches:!0,toElement:!0,touches:!0,which:!0},ce.event.addProp),ce.each({focus:"focusin",blur:"focusout"},function(r,i){function o(e){if(C.documentMode){var t=_.get(this,"handle"),n=ce.event.fix(e);n.type="focusin"===e.type?"focus":"blur",n.isSimulated=!0,t(e),n.target===n.currentTarget&&t(n)}else ce.event.simulate(i,e.target,ce.event.fix(e))}ce.event.special[r]={setup:function(){var e;if(He(this,r,!0),!C.documentMode)return!1;(e=_.get(this,i))||this.addEventListener(i,o),_.set(this,i,(e||0)+1)},trigger:function(){return He(this,r),!0},teardown:function(){var e;if(!C.documentMode)return!1;(e=_.get(this,i)-1)?_.set(this,i,e):(this.removeEventListener(i,o),_.remove(this,i))},_default:function(e){return _.get(e.target,r)},delegateType:i},ce.event.special[i]={setup:function(){var e=this.ownerDocument||this.document||this,t=C.documentMode?this:e,n=_.get(t,i);n||(C.documentMode?this.addEventListener(i,o):e.addEventListener(r,o,!0)),_.set(t,i,(n||0)+1)},teardown:function(){var e=this.ownerDocument||this.document||this,t=C.documentMode?this:e,n=_.get(t,i)-1;n?_.set(t,i,n):(C.documentMode?this.removeEventListener(i,o):e.removeEventListener(r,o,!0),_.remove(t,i))}}}),ce.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(e,i){ce.event.special[e]={delegateType:i,bindType:i,handle:function(e){var t,n=e.relatedTarget,r=e.handleObj;return n&&(n===this||ce.contains(this,n))||(e.type=r.origType,t=r.handler.apply(this,arguments),e.type=i),t}}}),ce.fn.extend({on:function(e,t,n,r){return Le(this,e,t,n,r)},one:function(e,t,n,r){return Le(this,e,t,n,r,1)},off:function(e,t,n){var r,i;if(e&&e.preventDefault&&e.handleObj)return r=e.handleObj,ce(e.delegateTarget).off(r.namespace?r.origType+"."+r.namespace:r.origType,r.selector,r.handler),this;if("object"==typeof e){for(i in e)this.off(i,t,e[i]);return this}return!1!==t&&"function"!=typeof t||(n=t,t=void 0),!1===n&&(n=qe),this.each(function(){ce.event.remove(this,e,n,t)})}});var Oe=/<script|<style|<link/i,Pe=/checked\s*(?:[^=]|=\s*.checked.)/i,Me=/^\s*<!\[CDATA\[|\]\]>\s*$/g;function Re(e,t){return fe(e,"table")&&fe(11!==t.nodeType?t:t.firstChild,"tr")&&ce(e).children("tbody")[0]||e}function Ie(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function We(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Fe(e,t){var n,r,i,o,a,s;if(1===t.nodeType){if(_.hasData(e)&&(s=_.get(e).events))for(i in _.remove(t,"handle events"),s)for(n=0,r=s[i].length;n<r;n++)ce.event.add(t,i,s[i][n]);z.hasData(e)&&(o=z.access(e),a=ce.extend({},o),z.set(t,a))}}function $e(n,r,i,o){r=g(r);var e,t,a,s,u,l,c=0,f=n.length,p=f-1,d=r[0],h=v(d);if(h||1<f&&"string"==typeof d&&!le.checkClone&&Pe.test(d))return n.each(function(e){var t=n.eq(e);h&&(r[0]=d.call(this,e,t.html())),$e(t,r,i,o)});if(f&&(t=(e=Ae(r,n[0].ownerDocument,!1,n,o)).firstChild,1===e.childNodes.length&&(e=t),t||o)){for(s=(a=ce.map(Se(e,"script"),Ie)).length;c<f;c++)u=e,c!==p&&(u=ce.clone(u,!0,!0),s&&ce.merge(a,Se(u,"script"))),i.call(n[c],u,c);if(s)for(l=a[a.length-1].ownerDocument,ce.map(a,We),c=0;c<s;c++)u=a[c],Ce.test(u.type||"")&&!_.access(u,"globalEval")&&ce.contains(l,u)&&(u.src&&"module"!==(u.type||"").toLowerCase()?ce._evalUrl&&!u.noModule&&ce._evalUrl(u.src,{nonce:u.nonce||u.getAttribute("nonce")},l):m(u.textContent.replace(Me,""),u,l))}return n}function Be(e,t,n){for(var r,i=t?ce.filter(t,e):e,o=0;null!=(r=i[o]);o++)n||1!==r.nodeType||ce.cleanData(Se(r)),r.parentNode&&(n&&K(r)&&Ee(Se(r,"script")),r.parentNode.removeChild(r));return e}ce.extend({htmlPrefilter:function(e){return e},clone:function(e,t,n){var r,i,o,a,s,u,l,c=e.cloneNode(!0),f=K(e);if(!(le.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||ce.isXMLDoc(e)))for(a=Se(c),r=0,i=(o=Se(e)).length;r<i;r++)s=o[r],u=a[r],void 0,"input"===(l=u.nodeName.toLowerCase())&&we.test(s.type)?u.checked=s.checked:"input"!==l&&"textarea"!==l||(u.defaultValue=s.defaultValue);if(t)if(n)for(o=o||Se(e),a=a||Se(c),r=0,i=o.length;r<i;r++)Fe(o[r],a[r]);else Fe(e,c);return 0<(a=Se(c,"script")).length&&Ee(a,!f&&Se(e,"script")),c},cleanData:function(e){for(var t,n,r,i=ce.event.special,o=0;void 0!==(n=e[o]);o++)if($(n)){if(t=n[_.expando]){if(t.events)for(r in t.events)i[r]?ce.event.remove(n,r):ce.removeEvent(n,r,t.handle);n[_.expando]=void 0}n[z.expando]&&(n[z.expando]=void 0)}}}),ce.fn.extend({detach:function(e){return Be(this,e,!0)},remove:function(e){return Be(this,e)},text:function(e){return M(this,function(e){return void 0===e?ce.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=e)})},null,e,arguments.length)},append:function(){return $e(this,arguments,function(e){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||Re(this,e).appendChild(e)})},prepend:function(){return $e(this,arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=Re(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return $e(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return $e(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},empty:function(){for(var e,t=0;null!=(e=this[t]);t++)1===e.nodeType&&(ce.cleanData(Se(e,!1)),e.textContent="");return this},clone:function(e,t){return e=null!=e&&e,t=null==t?e:t,this.map(function(){return ce.clone(this,e,t)})},html:function(e){return M(this,function(e){var t=this[0]||{},n=0,r=this.length;if(void 0===e&&1===t.nodeType)return t.innerHTML;if("string"==typeof e&&!Oe.test(e)&&!ke[(Te.exec(e)||["",""])[1].toLowerCase()]){e=ce.htmlPrefilter(e);try{for(;n<r;n++)1===(t=this[n]||{}).nodeType&&(ce.cleanData(Se(t,!1)),t.innerHTML=e);t=0}catch(e){}}t&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(){var n=[];return $e(this,arguments,function(e){var t=this.parentNode;ce.inArray(this,n)<0&&(ce.cleanData(Se(this)),t&&t.replaceChild(e,this))},n)}}),ce.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,a){ce.fn[e]=function(e){for(var t,n=[],r=ce(e),i=r.length-1,o=0;o<=i;o++)t=o===i?this:this.clone(!0),ce(r[o])[a](t),s.apply(n,t.get());return this.pushStack(n)}});var _e=new RegExp("^("+G+")(?!px)[a-z%]+$","i"),ze=/^--/,Xe=function(e){var t=e.ownerDocument.defaultView;return t&&t.opener||(t=ie),t.getComputedStyle(e)},Ue=function(e,t,n){var r,i,o={};for(i in t)o[i]=e.style[i],e.style[i]=t[i];for(i in r=n.call(e),t)e.style[i]=o[i];return r},Ve=new RegExp(Q.join("|"),"i");function Ge(e,t,n){var r,i,o,a,s=ze.test(t),u=e.style;return(n=n||Xe(e))&&(a=n.getPropertyValue(t)||n[t],s&&a&&(a=a.replace(ve,"$1")||void 0),""!==a||K(e)||(a=ce.style(e,t)),!le.pixelBoxStyles()&&_e.test(a)&&Ve.test(t)&&(r=u.width,i=u.minWidth,o=u.maxWidth,u.minWidth=u.maxWidth=u.width=a,a=n.width,u.width=r,u.minWidth=i,u.maxWidth=o)),void 0!==a?a+"":a}function Ye(e,t){return{get:function(){if(!e())return(this.get=t).apply(this,arguments);delete this.get}}}!function(){function e(){if(l){u.style.cssText="position:absolute;left:-11111px;width:60px;margin-top:1px;padding:0;border:0",l.style.cssText="position:relative;display:block;box-sizing:border-box;overflow:scroll;margin:auto;border:1px;padding:1px;width:60%;top:1%",J.appendChild(u).appendChild(l);var e=ie.getComputedStyle(l);n="1%"!==e.top,s=12===t(e.marginLeft),l.style.right="60%",o=36===t(e.right),r=36===t(e.width),l.style.position="absolute",i=12===t(l.offsetWidth/3),J.removeChild(u),l=null}}function t(e){return Math.round(parseFloat(e))}var n,r,i,o,a,s,u=C.createElement("div"),l=C.createElement("div");l.style&&(l.style.backgroundClip="content-box",l.cloneNode(!0).style.backgroundClip="",le.clearCloneStyle="content-box"===l.style.backgroundClip,ce.extend(le,{boxSizingReliable:function(){return e(),r},pixelBoxStyles:function(){return e(),o},pixelPosition:function(){return e(),n},reliableMarginLeft:function(){return e(),s},scrollboxSize:function(){return e(),i},reliableTrDimensions:function(){var e,t,n,r;return null==a&&(e=C.createElement("table"),t=C.createElement("tr"),n=C.createElement("div"),e.style.cssText="position:absolute;left:-11111px;border-collapse:separate",t.style.cssText="box-sizing:content-box;border:1px solid",t.style.height="1px",n.style.height="9px",n.style.display="block",J.appendChild(e).appendChild(t).appendChild(n),r=ie.getComputedStyle(t),a=parseInt(r.height,10)+parseInt(r.borderTopWidth,10)+parseInt(r.borderBottomWidth,10)===t.offsetHeight,J.removeChild(e)),a}}))}();var Qe=["Webkit","Moz","ms"],Je=C.createElement("div").style,Ke={};function Ze(e){var t=ce.cssProps[e]||Ke[e];return t||(e in Je?e:Ke[e]=function(e){var t=e[0].toUpperCase()+e.slice(1),n=Qe.length;while(n--)if((e=Qe[n]+t)in Je)return e}(e)||e)}var et=/^(none|table(?!-c[ea]).+)/,tt={position:"absolute",visibility:"hidden",display:"block"},nt={letterSpacing:"0",fontWeight:"400"};function rt(e,t,n){var r=Y.exec(t);return r?Math.max(0,r[2]-(n||0))+(r[3]||"px"):t}function it(e,t,n,r,i,o){var a="width"===t?1:0,s=0,u=0,l=0;if(n===(r?"border":"content"))return 0;for(;a<4;a+=2)"margin"===n&&(l+=ce.css(e,n+Q[a],!0,i)),r?("content"===n&&(u-=ce.css(e,"padding"+Q[a],!0,i)),"margin"!==n&&(u-=ce.css(e,"border"+Q[a]+"Width",!0,i))):(u+=ce.css(e,"padding"+Q[a],!0,i),"padding"!==n?u+=ce.css(e,"border"+Q[a]+"Width",!0,i):s+=ce.css(e,"border"+Q[a]+"Width",!0,i));return!r&&0<=o&&(u+=Math.max(0,Math.ceil(e["offset"+t[0].toUpperCase()+t.slice(1)]-o-u-s-.5))||0),u+l}function ot(e,t,n){var r=Xe(e),i=(!le.boxSizingReliable()||n)&&"border-box"===ce.css(e,"boxSizing",!1,r),o=i,a=Ge(e,t,r),s="offset"+t[0].toUpperCase()+t.slice(1);if(_e.test(a)){if(!n)return a;a="auto"}return(!le.boxSizingReliable()&&i||!le.reliableTrDimensions()&&fe(e,"tr")||"auto"===a||!parseFloat(a)&&"inline"===ce.css(e,"display",!1,r))&&e.getClientRects().length&&(i="border-box"===ce.css(e,"boxSizing",!1,r),(o=s in e)&&(a=e[s])),(a=parseFloat(a)||0)+it(e,t,n||(i?"border":"content"),o,r,a)+"px"}function at(e,t,n,r,i){return new at.prototype.init(e,t,n,r,i)}ce.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Ge(e,"opacity");return""===n?"1":n}}}},cssNumber:{animationIterationCount:!0,aspectRatio:!0,borderImageSlice:!0,columnCount:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,gridArea:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnStart:!0,gridRow:!0,gridRowEnd:!0,gridRowStart:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,scale:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeMiterlimit:!0,strokeOpacity:!0},cssProps:{},style:function(e,t,n,r){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var i,o,a,s=F(t),u=ze.test(t),l=e.style;if(u||(t=Ze(s)),a=ce.cssHooks[t]||ce.cssHooks[s],void 0===n)return a&&"get"in a&&void 0!==(i=a.get(e,!1,r))?i:l[t];"string"===(o=typeof n)&&(i=Y.exec(n))&&i[1]&&(n=te(e,t,i),o="number"),null!=n&&n==n&&("number"!==o||u||(n+=i&&i[3]||(ce.cssNumber[s]?"":"px")),le.clearCloneStyle||""!==n||0!==t.indexOf("background")||(l[t]="inherit"),a&&"set"in a&&void 0===(n=a.set(e,n,r))||(u?l.setProperty(t,n):l[t]=n))}},css:function(e,t,n,r){var i,o,a,s=F(t);return ze.test(t)||(t=Ze(s)),(a=ce.cssHooks[t]||ce.cssHooks[s])&&"get"in a&&(i=a.get(e,!0,n)),void 0===i&&(i=Ge(e,t,r)),"normal"===i&&t in nt&&(i=nt[t]),""===n||n?(o=parseFloat(i),!0===n||isFinite(o)?o||0:i):i}}),ce.each(["height","width"],function(e,u){ce.cssHooks[u]={get:function(e,t,n){if(t)return!et.test(ce.css(e,"display"))||e.getClientRects().length&&e.getBoundingClientRect().width?ot(e,u,n):Ue(e,tt,function(){return ot(e,u,n)})},set:function(e,t,n){var r,i=Xe(e),o=!le.scrollboxSize()&&"absolute"===i.position,a=(o||n)&&"border-box"===ce.css(e,"boxSizing",!1,i),s=n?it(e,u,n,a,i):0;return a&&o&&(s-=Math.ceil(e["offset"+u[0].toUpperCase()+u.slice(1)]-parseFloat(i[u])-it(e,u,"border",!1,i)-.5)),s&&(r=Y.exec(t))&&"px"!==(r[3]||"px")&&(e.style[u]=t,t=ce.css(e,u)),rt(0,t,s)}}}),ce.cssHooks.marginLeft=Ye(le.reliableMarginLeft,function(e,t){if(t)return(parseFloat(Ge(e,"marginLeft"))||e.getBoundingClientRect().left-Ue(e,{marginLeft:0},function(){return e.getBoundingClientRect().left}))+"px"}),ce.each({margin:"",padding:"",border:"Width"},function(i,o){ce.cssHooks[i+o]={expand:function(e){for(var t=0,n={},r="string"==typeof e?e.split(" "):[e];t<4;t++)n[i+Q[t]+o]=r[t]||r[t-2]||r[0];return n}},"margin"!==i&&(ce.cssHooks[i+o].set=rt)}),ce.fn.extend({css:function(e,t){return M(this,function(e,t,n){var r,i,o={},a=0;if(Array.isArray(t)){for(r=Xe(e),i=t.length;a<i;a++)o[t[a]]=ce.css(e,t[a],!1,r);return o}return void 0!==n?ce.style(e,t,n):ce.css(e,t)},e,t,1<arguments.length)}}),((ce.Tween=at).prototype={constructor:at,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||ce.easing._default,this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(ce.cssNumber[n]?"":"px")},cur:function(){var e=at.propHooks[this.prop];return e&&e.get?e.get(this):at.propHooks._default.get(this)},run:function(e){var t,n=at.propHooks[this.prop];return this.options.duration?this.pos=t=ce.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=t=e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):at.propHooks._default.set(this),this}}).init.prototype=at.prototype,(at.propHooks={_default:{get:function(e){var t;return 1!==e.elem.nodeType||null!=e.elem[e.prop]&&null==e.elem.style[e.prop]?e.elem[e.prop]:(t=ce.css(e.elem,e.prop,""))&&"auto"!==t?t:0},set:function(e){ce.fx.step[e.prop]?ce.fx.step[e.prop](e):1!==e.elem.nodeType||!ce.cssHooks[e.prop]&&null==e.elem.style[Ze(e.prop)]?e.elem[e.prop]=e.now:ce.style(e.elem,e.prop,e.now+e.unit)}}}).scrollTop=at.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},ce.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2},_default:"swing"},ce.fx=at.prototype.init,ce.fx.step={};var st,ut,lt,ct,ft=/^(?:toggle|show|hide)$/,pt=/queueHooks$/;function dt(){ut&&(!1===C.hidden&&ie.requestAnimationFrame?ie.requestAnimationFrame(dt):ie.setTimeout(dt,ce.fx.interval),ce.fx.tick())}function ht(){return ie.setTimeout(function(){st=void 0}),st=Date.now()}function gt(e,t){var n,r=0,i={height:e};for(t=t?1:0;r<4;r+=2-t)i["margin"+(n=Q[r])]=i["padding"+n]=e;return t&&(i.opacity=i.width=e),i}function vt(e,t,n){for(var r,i=(yt.tweeners[t]||[]).concat(yt.tweeners["*"]),o=0,a=i.length;o<a;o++)if(r=i[o].call(n,t,e))return r}function yt(o,e,t){var n,a,r=0,i=yt.prefilters.length,s=ce.Deferred().always(function(){delete u.elem}),u=function(){if(a)return!1;for(var e=st||ht(),t=Math.max(0,l.startTime+l.duration-e),n=1-(t/l.duration||0),r=0,i=l.tweens.length;r<i;r++)l.tweens[r].run(n);return s.notifyWith(o,[l,n,t]),n<1&&i?t:(i||s.notifyWith(o,[l,1,0]),s.resolveWith(o,[l]),!1)},l=s.promise({elem:o,props:ce.extend({},e),opts:ce.extend(!0,{specialEasing:{},easing:ce.easing._default},t),originalProperties:e,originalOptions:t,startTime:st||ht(),duration:t.duration,tweens:[],createTween:function(e,t){var n=ce.Tween(o,l.opts,e,t,l.opts.specialEasing[e]||l.opts.easing);return l.tweens.push(n),n},stop:function(e){var t=0,n=e?l.tweens.length:0;if(a)return this;for(a=!0;t<n;t++)l.tweens[t].run(1);return e?(s.notifyWith(o,[l,1,0]),s.resolveWith(o,[l,e])):s.rejectWith(o,[l,e]),this}}),c=l.props;for(!function(e,t){var n,r,i,o,a;for(n in e)if(i=t[r=F(n)],o=e[n],Array.isArray(o)&&(i=o[1],o=e[n]=o[0]),n!==r&&(e[r]=o,delete e[n]),(a=ce.cssHooks[r])&&"expand"in a)for(n in o=a.expand(o),delete e[r],o)n in e||(e[n]=o[n],t[n]=i);else t[r]=i}(c,l.opts.specialEasing);r<i;r++)if(n=yt.prefilters[r].call(l,o,c,l.opts))return v(n.stop)&&(ce._queueHooks(l.elem,l.opts.queue).stop=n.stop.bind(n)),n;return ce.map(c,vt,l),v(l.opts.start)&&l.opts.start.call(o,l),l.progress(l.opts.progress).done(l.opts.done,l.opts.complete).fail(l.opts.fail).always(l.opts.always),ce.fx.timer(ce.extend(u,{elem:o,anim:l,queue:l.opts.queue})),l}ce.Animation=ce.extend(yt,{tweeners:{"*":[function(e,t){var n=this.createTween(e,t);return te(n.elem,e,Y.exec(t),n),n}]},tweener:function(e,t){v(e)?(t=e,e=["*"]):e=e.match(D);for(var n,r=0,i=e.length;r<i;r++)n=e[r],yt.tweeners[n]=yt.tweeners[n]||[],yt.tweeners[n].unshift(t)},prefilters:[function(e,t,n){var r,i,o,a,s,u,l,c,f="width"in t||"height"in t,p=this,d={},h=e.style,g=e.nodeType&&ee(e),v=_.get(e,"fxshow");for(r in n.queue||(null==(a=ce._queueHooks(e,"fx")).unqueued&&(a.unqueued=0,s=a.empty.fire,a.empty.fire=function(){a.unqueued||s()}),a.unqueued++,p.always(function(){p.always(function(){a.unqueued--,ce.queue(e,"fx").length||a.empty.fire()})})),t)if(i=t[r],ft.test(i)){if(delete t[r],o=o||"toggle"===i,i===(g?"hide":"show")){if("show"!==i||!v||void 0===v[r])continue;g=!0}d[r]=v&&v[r]||ce.style(e,r)}if((u=!ce.isEmptyObject(t))||!ce.isEmptyObject(d))for(r in f&&1===e.nodeType&&(n.overflow=[h.overflow,h.overflowX,h.overflowY],null==(l=v&&v.display)&&(l=_.get(e,"display")),"none"===(c=ce.css(e,"display"))&&(l?c=l:(re([e],!0),l=e.style.display||l,c=ce.css(e,"display"),re([e]))),("inline"===c||"inline-block"===c&&null!=l)&&"none"===ce.css(e,"float")&&(u||(p.done(function(){h.display=l}),null==l&&(c=h.display,l="none"===c?"":c)),h.display="inline-block")),n.overflow&&(h.overflow="hidden",p.always(function(){h.overflow=n.overflow[0],h.overflowX=n.overflow[1],h.overflowY=n.overflow[2]})),u=!1,d)u||(v?"hidden"in v&&(g=v.hidden):v=_.access(e,"fxshow",{display:l}),o&&(v.hidden=!g),g&&re([e],!0),p.done(function(){for(r in g||re([e]),_.remove(e,"fxshow"),d)ce.style(e,r,d[r])})),u=vt(g?v[r]:0,r,p),r in v||(v[r]=u.start,g&&(u.end=u.start,u.start=0))}],prefilter:function(e,t){t?yt.prefilters.unshift(e):yt.prefilters.push(e)}}),ce.speed=function(e,t,n){var r=e&&"object"==typeof e?ce.extend({},e):{complete:n||!n&&t||v(e)&&e,duration:e,easing:n&&t||t&&!v(t)&&t};return ce.fx.off?r.duration=0:"number"!=typeof r.duration&&(r.duration in ce.fx.speeds?r.duration=ce.fx.speeds[r.duration]:r.duration=ce.fx.speeds._default),null!=r.queue&&!0!==r.queue||(r.queue="fx"),r.old=r.complete,r.complete=function(){v(r.old)&&r.old.call(this),r.queue&&ce.dequeue(this,r.queue)},r},ce.fn.extend({fadeTo:function(e,t,n,r){return this.filter(ee).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(t,e,n,r){var i=ce.isEmptyObject(t),o=ce.speed(e,n,r),a=function(){var e=yt(this,ce.extend({},t),o);(i||_.get(this,"finish"))&&e.stop(!0)};return a.finish=a,i||!1===o.queue?this.each(a):this.queue(o.queue,a)},stop:function(i,e,o){var a=function(e){var t=e.stop;delete e.stop,t(o)};return"string"!=typeof i&&(o=e,e=i,i=void 0),e&&this.queue(i||"fx",[]),this.each(function(){var e=!0,t=null!=i&&i+"queueHooks",n=ce.timers,r=_.get(this);if(t)r[t]&&r[t].stop&&a(r[t]);else for(t in r)r[t]&&r[t].stop&&pt.test(t)&&a(r[t]);for(t=n.length;t--;)n[t].elem!==this||null!=i&&n[t].queue!==i||(n[t].anim.stop(o),e=!1,n.splice(t,1));!e&&o||ce.dequeue(this,i)})},finish:function(a){return!1!==a&&(a=a||"fx"),this.each(function(){var e,t=_.get(this),n=t[a+"queue"],r=t[a+"queueHooks"],i=ce.timers,o=n?n.length:0;for(t.finish=!0,ce.queue(this,a,[]),r&&r.stop&&r.stop.call(this,!0),e=i.length;e--;)i[e].elem===this&&i[e].queue===a&&(i[e].anim.stop(!0),i.splice(e,1));for(e=0;e<o;e++)n[e]&&n[e].finish&&n[e].finish.call(this);delete t.finish})}}),ce.each(["toggle","show","hide"],function(e,r){var i=ce.fn[r];ce.fn[r]=function(e,t,n){return null==e||"boolean"==typeof e?i.apply(this,arguments):this.animate(gt(r,!0),e,t,n)}}),ce.each({slideDown:gt("show"),slideUp:gt("hide"),slideToggle:gt("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,r){ce.fn[e]=function(e,t,n){return this.animate(r,e,t,n)}}),ce.timers=[],ce.fx.tick=function(){var e,t=0,n=ce.timers;for(st=Date.now();t<n.length;t++)(e=n[t])()||n[t]!==e||n.splice(t--,1);n.length||ce.fx.stop(),st=void 0},ce.fx.timer=function(e){ce.timers.push(e),ce.fx.start()},ce.fx.interval=13,ce.fx.start=function(){ut||(ut=!0,dt())},ce.fx.stop=function(){ut=null},ce.fx.speeds={slow:600,fast:200,_default:400},ce.fn.delay=function(r,e){return r=ce.fx&&ce.fx.speeds[r]||r,e=e||"fx",this.queue(e,function(e,t){var n=ie.setTimeout(e,r);t.stop=function(){ie.clearTimeout(n)}})},lt=C.createElement("input"),ct=C.createElement("select").appendChild(C.createElement("option")),lt.type="checkbox",le.checkOn=""!==lt.value,le.optSelected=ct.selected,(lt=C.createElement("input")).value="t",lt.type="radio",le.radioValue="t"===lt.value;var mt,xt=ce.expr.attrHandle;ce.fn.extend({attr:function(e,t){return M(this,ce.attr,e,t,1<arguments.length)},removeAttr:function(e){return this.each(function(){ce.removeAttr(this,e)})}}),ce.extend({attr:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return"undefined"==typeof e.getAttribute?ce.prop(e,t,n):(1===o&&ce.isXMLDoc(e)||(i=ce.attrHooks[t.toLowerCase()]||(ce.expr.match.bool.test(t)?mt:void 0)),void 0!==n?null===n?void ce.removeAttr(e,t):i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:(e.setAttribute(t,n+""),n):i&&"get"in i&&null!==(r=i.get(e,t))?r:null==(r=ce.find.attr(e,t))?void 0:r)},attrHooks:{type:{set:function(e,t){if(!le.radioValue&&"radio"===t&&fe(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},removeAttr:function(e,t){var n,r=0,i=t&&t.match(D);if(i&&1===e.nodeType)while(n=i[r++])e.removeAttribute(n)}}),mt={set:function(e,t,n){return!1===t?ce.removeAttr(e,n):e.setAttribute(n,n),n}},ce.each(ce.expr.match.bool.source.match(/\w+/g),function(e,t){var a=xt[t]||ce.find.attr;xt[t]=function(e,t,n){var r,i,o=t.toLowerCase();return n||(i=xt[o],xt[o]=r,r=null!=a(e,t,n)?o:null,xt[o]=i),r}});var bt=/^(?:input|select|textarea|button)$/i,wt=/^(?:a|area)$/i;function Tt(e){return(e.match(D)||[]).join(" ")}function Ct(e){return e.getAttribute&&e.getAttribute("class")||""}function kt(e){return Array.isArray(e)?e:"string"==typeof e&&e.match(D)||[]}ce.fn.extend({prop:function(e,t){return M(this,ce.prop,e,t,1<arguments.length)},removeProp:function(e){return this.each(function(){delete this[ce.propFix[e]||e]})}}),ce.extend({prop:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return 1===o&&ce.isXMLDoc(e)||(t=ce.propFix[t]||t,i=ce.propHooks[t]),void 0!==n?i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:e[t]=n:i&&"get"in i&&null!==(r=i.get(e,t))?r:e[t]},propHooks:{tabIndex:{get:function(e){var t=ce.find.attr(e,"tabindex");return t?parseInt(t,10):bt.test(e.nodeName)||wt.test(e.nodeName)&&e.href?0:-1}}},propFix:{"for":"htmlFor","class":"className"}}),le.optSelected||(ce.propHooks.selected={get:function(e){var t=e.parentNode;return t&&t.parentNode&&t.parentNode.selectedIndex,null},set:function(e){var t=e.parentNode;t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex)}}),ce.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){ce.propFix[this.toLowerCase()]=this}),ce.fn.extend({addClass:function(t){var e,n,r,i,o,a;return v(t)?this.each(function(e){ce(this).addClass(t.call(this,e,Ct(this)))}):(e=kt(t)).length?this.each(function(){if(r=Ct(this),n=1===this.nodeType&&" "+Tt(r)+" "){for(o=0;o<e.length;o++)i=e[o],n.indexOf(" "+i+" ")<0&&(n+=i+" ");a=Tt(n),r!==a&&this.setAttribute("class",a)}}):this},removeClass:function(t){var e,n,r,i,o,a;return v(t)?this.each(function(e){ce(this).removeClass(t.call(this,e,Ct(this)))}):arguments.length?(e=kt(t)).length?this.each(function(){if(r=Ct(this),n=1===this.nodeType&&" "+Tt(r)+" "){for(o=0;o<e.length;o++){i=e[o];while(-1<n.indexOf(" "+i+" "))n=n.replace(" "+i+" "," ")}a=Tt(n),r!==a&&this.setAttribute("class",a)}}):this:this.attr("class","")},toggleClass:function(t,n){var e,r,i,o,a=typeof t,s="string"===a||Array.isArray(t);return v(t)?this.each(function(e){ce(this).toggleClass(t.call(this,e,Ct(this),n),n)}):"boolean"==typeof n&&s?n?this.addClass(t):this.removeClass(t):(e=kt(t),this.each(function(){if(s)for(o=ce(this),i=0;i<e.length;i++)r=e[i],o.hasClass(r)?o.removeClass(r):o.addClass(r);else void 0!==t&&"boolean"!==a||((r=Ct(this))&&_.set(this,"__className__",r),this.setAttribute&&this.setAttribute("class",r||!1===t?"":_.get(this,"__className__")||""))}))},hasClass:function(e){var t,n,r=0;t=" "+e+" ";while(n=this[r++])if(1===n.nodeType&&-1<(" "+Tt(Ct(n))+" ").indexOf(t))return!0;return!1}});var St=/\r/g;ce.fn.extend({val:function(n){var r,e,i,t=this[0];return arguments.length?(i=v(n),this.each(function(e){var t;1===this.nodeType&&(null==(t=i?n.call(this,e,ce(this).val()):n)?t="":"number"==typeof t?t+="":Array.isArray(t)&&(t=ce.map(t,function(e){return null==e?"":e+""})),(r=ce.valHooks[this.type]||ce.valHooks[this.nodeName.toLowerCase()])&&"set"in r&&void 0!==r.set(this,t,"value")||(this.value=t))})):t?(r=ce.valHooks[t.type]||ce.valHooks[t.nodeName.toLowerCase()])&&"get"in r&&void 0!==(e=r.get(t,"value"))?e:"string"==typeof(e=t.value)?e.replace(St,""):null==e?"":e:void 0}}),ce.extend({valHooks:{option:{get:function(e){var t=ce.find.attr(e,"value");return null!=t?t:Tt(ce.text(e))}},select:{get:function(e){var t,n,r,i=e.options,o=e.selectedIndex,a="select-one"===e.type,s=a?null:[],u=a?o+1:i.length;for(r=o<0?u:a?o:0;r<u;r++)if(((n=i[r]).selected||r===o)&&!n.disabled&&(!n.parentNode.disabled||!fe(n.parentNode,"optgroup"))){if(t=ce(n).val(),a)return t;s.push(t)}return s},set:function(e,t){var n,r,i=e.options,o=ce.makeArray(t),a=i.length;while(a--)((r=i[a]).selected=-1<ce.inArray(ce.valHooks.option.get(r),o))&&(n=!0);return n||(e.selectedIndex=-1),o}}}}),ce.each(["radio","checkbox"],function(){ce.valHooks[this]={set:function(e,t){if(Array.isArray(t))return e.checked=-1<ce.inArray(ce(e).val(),t)}},le.checkOn||(ce.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})});var Et=ie.location,jt={guid:Date.now()},At=/\?/;ce.parseXML=function(e){var t,n;if(!e||"string"!=typeof e)return null;try{t=(new ie.DOMParser).parseFromString(e,"text/xml")}catch(e){}return n=t&&t.getElementsByTagName("parsererror")[0],t&&!n||ce.error("Invalid XML: "+(n?ce.map(n.childNodes,function(e){return e.textContent}).join("\n"):e)),t};var Dt=/^(?:focusinfocus|focusoutblur)$/,Nt=function(e){e.stopPropagation()};ce.extend(ce.event,{trigger:function(e,t,n,r){var i,o,a,s,u,l,c,f,p=[n||C],d=ue.call(e,"type")?e.type:e,h=ue.call(e,"namespace")?e.namespace.split("."):[];if(o=f=a=n=n||C,3!==n.nodeType&&8!==n.nodeType&&!Dt.test(d+ce.event.triggered)&&(-1<d.indexOf(".")&&(d=(h=d.split(".")).shift(),h.sort()),u=d.indexOf(":")<0&&"on"+d,(e=e[ce.expando]?e:new ce.Event(d,"object"==typeof e&&e)).isTrigger=r?2:3,e.namespace=h.join("."),e.rnamespace=e.namespace?new RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,e.result=void 0,e.target||(e.target=n),t=null==t?[e]:ce.makeArray(t,[e]),c=ce.event.special[d]||{},r||!c.trigger||!1!==c.trigger.apply(n,t))){if(!r&&!c.noBubble&&!y(n)){for(s=c.delegateType||d,Dt.test(s+d)||(o=o.parentNode);o;o=o.parentNode)p.push(o),a=o;a===(n.ownerDocument||C)&&p.push(a.defaultView||a.parentWindow||ie)}i=0;while((o=p[i++])&&!e.isPropagationStopped())f=o,e.type=1<i?s:c.bindType||d,(l=(_.get(o,"events")||Object.create(null))[e.type]&&_.get(o,"handle"))&&l.apply(o,t),(l=u&&o[u])&&l.apply&&$(o)&&(e.result=l.apply(o,t),!1===e.result&&e.preventDefault());return e.type=d,r||e.isDefaultPrevented()||c._default&&!1!==c._default.apply(p.pop(),t)||!$(n)||u&&v(n[d])&&!y(n)&&((a=n[u])&&(n[u]=null),ce.event.triggered=d,e.isPropagationStopped()&&f.addEventListener(d,Nt),n[d](),e.isPropagationStopped()&&f.removeEventListener(d,Nt),ce.event.triggered=void 0,a&&(n[u]=a)),e.result}},simulate:function(e,t,n){var r=ce.extend(new ce.Event,n,{type:e,isSimulated:!0});ce.event.trigger(r,null,t)}}),ce.fn.extend({trigger:function(e,t){return this.each(function(){ce.event.trigger(e,t,this)})},triggerHandler:function(e,t){var n=this[0];if(n)return ce.event.trigger(e,t,n,!0)}});var qt=/\[\]$/,Lt=/\r?\n/g,Ht=/^(?:submit|button|image|reset|file)$/i,Ot=/^(?:input|select|textarea|keygen)/i;function Pt(n,e,r,i){var t;if(Array.isArray(e))ce.each(e,function(e,t){r||qt.test(n)?i(n,t):Pt(n+"["+("object"==typeof t&&null!=t?e:"")+"]",t,r,i)});else if(r||"object"!==x(e))i(n,e);else for(t in e)Pt(n+"["+t+"]",e[t],r,i)}ce.param=function(e,t){var n,r=[],i=function(e,t){var n=v(t)?t():t;r[r.length]=encodeURIComponent(e)+"="+encodeURIComponent(null==n?"":n)};if(null==e)return"";if(Array.isArray(e)||e.jquery&&!ce.isPlainObject(e))ce.each(e,function(){i(this.name,this.value)});else for(n in e)Pt(n,e[n],t,i);return r.join("&")},ce.fn.extend({serialize:function(){return ce.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=ce.prop(this,"elements");return e?ce.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!ce(this).is(":disabled")&&Ot.test(this.nodeName)&&!Ht.test(e)&&(this.checked||!we.test(e))}).map(function(e,t){var n=ce(this).val();return null==n?null:Array.isArray(n)?ce.map(n,function(e){return{name:t.name,value:e.replace(Lt,"\r\n")}}):{name:t.name,value:n.replace(Lt,"\r\n")}}).get()}});var Mt=/%20/g,Rt=/#.*$/,It=/([?&])_=[^&]*/,Wt=/^(.*?):[ \t]*([^\r\n]*)$/gm,Ft=/^(?:GET|HEAD)$/,$t=/^\/\//,Bt={},_t={},zt="*/".concat("*"),Xt=C.createElement("a");function Ut(o){return function(e,t){"string"!=typeof e&&(t=e,e="*");var n,r=0,i=e.toLowerCase().match(D)||[];if(v(t))while(n=i[r++])"+"===n[0]?(n=n.slice(1)||"*",(o[n]=o[n]||[]).unshift(t)):(o[n]=o[n]||[]).push(t)}}function Vt(t,i,o,a){var s={},u=t===_t;function l(e){var r;return s[e]=!0,ce.each(t[e]||[],function(e,t){var n=t(i,o,a);return"string"!=typeof n||u||s[n]?u?!(r=n):void 0:(i.dataTypes.unshift(n),l(n),!1)}),r}return l(i.dataTypes[0])||!s["*"]&&l("*")}function Gt(e,t){var n,r,i=ce.ajaxSettings.flatOptions||{};for(n in t)void 0!==t[n]&&((i[n]?e:r||(r={}))[n]=t[n]);return r&&ce.extend(!0,e,r),e}Xt.href=Et.href,ce.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:Et.href,type:"GET",isLocal:/^(?:about|app|app-storage|.+-extension|file|res|widget):$/.test(Et.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":zt,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":ce.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?Gt(Gt(e,ce.ajaxSettings),t):Gt(ce.ajaxSettings,e)},ajaxPrefilter:Ut(Bt),ajaxTransport:Ut(_t),ajax:function(e,t){"object"==typeof e&&(t=e,e=void 0),t=t||{};var c,f,p,n,d,r,h,g,i,o,v=ce.ajaxSetup({},t),y=v.context||v,m=v.context&&(y.nodeType||y.jquery)?ce(y):ce.event,x=ce.Deferred(),b=ce.Callbacks("once memory"),w=v.statusCode||{},a={},s={},u="canceled",T={readyState:0,getResponseHeader:function(e){var t;if(h){if(!n){n={};while(t=Wt.exec(p))n[t[1].toLowerCase()+" "]=(n[t[1].toLowerCase()+" "]||[]).concat(t[2])}t=n[e.toLowerCase()+" "]}return null==t?null:t.join(", ")},getAllResponseHeaders:function(){return h?p:null},setRequestHeader:function(e,t){return null==h&&(e=s[e.toLowerCase()]=s[e.toLowerCase()]||e,a[e]=t),this},overrideMimeType:function(e){return null==h&&(v.mimeType=e),this},statusCode:function(e){var t;if(e)if(h)T.always(e[T.status]);else for(t in e)w[t]=[w[t],e[t]];return this},abort:function(e){var t=e||u;return c&&c.abort(t),l(0,t),this}};if(x.promise(T),v.url=((e||v.url||Et.href)+"").replace($t,Et.protocol+"//"),v.type=t.method||t.type||v.method||v.type,v.dataTypes=(v.dataType||"*").toLowerCase().match(D)||[""],null==v.crossDomain){r=C.createElement("a");try{r.href=v.url,r.href=r.href,v.crossDomain=Xt.protocol+"//"+Xt.host!=r.protocol+"//"+r.host}catch(e){v.crossDomain=!0}}if(v.data&&v.processData&&"string"!=typeof v.data&&(v.data=ce.param(v.data,v.traditional)),Vt(Bt,v,t,T),h)return T;for(i in(g=ce.event&&v.global)&&0==ce.active++&&ce.event.trigger("ajaxStart"),v.type=v.type.toUpperCase(),v.hasContent=!Ft.test(v.type),f=v.url.replace(Rt,""),v.hasContent?v.data&&v.processData&&0===(v.contentType||"").indexOf("application/x-www-form-urlencoded")&&(v.data=v.data.replace(Mt,"+")):(o=v.url.slice(f.length),v.data&&(v.processData||"string"==typeof v.data)&&(f+=(At.test(f)?"&":"?")+v.data,delete v.data),!1===v.cache&&(f=f.replace(It,"$1"),o=(At.test(f)?"&":"?")+"_="+jt.guid+++o),v.url=f+o),v.ifModified&&(ce.lastModified[f]&&T.setRequestHeader("If-Modified-Since",ce.lastModified[f]),ce.etag[f]&&T.setRequestHeader("If-None-Match",ce.etag[f])),(v.data&&v.hasContent&&!1!==v.contentType||t.contentType)&&T.setRequestHeader("Content-Type",v.contentType),T.setRequestHeader("Accept",v.dataTypes[0]&&v.accepts[v.dataTypes[0]]?v.accepts[v.dataTypes[0]]+("*"!==v.dataTypes[0]?", "+zt+"; q=0.01":""):v.accepts["*"]),v.headers)T.setRequestHeader(i,v.headers[i]);if(v.beforeSend&&(!1===v.beforeSend.call(y,T,v)||h))return T.abort();if(u="abort",b.add(v.complete),T.done(v.success),T.fail(v.error),c=Vt(_t,v,t,T)){if(T.readyState=1,g&&m.trigger("ajaxSend",[T,v]),h)return T;v.async&&0<v.timeout&&(d=ie.setTimeout(function(){T.abort("timeout")},v.timeout));try{h=!1,c.send(a,l)}catch(e){if(h)throw e;l(-1,e)}}else l(-1,"No Transport");function l(e,t,n,r){var i,o,a,s,u,l=t;h||(h=!0,d&&ie.clearTimeout(d),c=void 0,p=r||"",T.readyState=0<e?4:0,i=200<=e&&e<300||304===e,n&&(s=function(e,t,n){var r,i,o,a,s=e.contents,u=e.dataTypes;while("*"===u[0])u.shift(),void 0===r&&(r=e.mimeType||t.getResponseHeader("Content-Type"));if(r)for(i in s)if(s[i]&&s[i].test(r)){u.unshift(i);break}if(u[0]in n)o=u[0];else{for(i in n){if(!u[0]||e.converters[i+" "+u[0]]){o=i;break}a||(a=i)}o=o||a}if(o)return o!==u[0]&&u.unshift(o),n[o]}(v,T,n)),!i&&-1<ce.inArray("script",v.dataTypes)&&ce.inArray("json",v.dataTypes)<0&&(v.converters["text script"]=function(){}),s=function(e,t,n,r){var i,o,a,s,u,l={},c=e.dataTypes.slice();if(c[1])for(a in e.converters)l[a.toLowerCase()]=e.converters[a];o=c.shift();while(o)if(e.responseFields[o]&&(n[e.responseFields[o]]=t),!u&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),u=o,o=c.shift())if("*"===o)o=u;else if("*"!==u&&u!==o){if(!(a=l[u+" "+o]||l["* "+o]))for(i in l)if((s=i.split(" "))[1]===o&&(a=l[u+" "+s[0]]||l["* "+s[0]])){!0===a?a=l[i]:!0!==l[i]&&(o=s[0],c.unshift(s[1]));break}if(!0!==a)if(a&&e["throws"])t=a(t);else try{t=a(t)}catch(e){return{state:"parsererror",error:a?e:"No conversion from "+u+" to "+o}}}return{state:"success",data:t}}(v,s,T,i),i?(v.ifModified&&((u=T.getResponseHeader("Last-Modified"))&&(ce.lastModified[f]=u),(u=T.getResponseHeader("etag"))&&(ce.etag[f]=u)),204===e||"HEAD"===v.type?l="nocontent":304===e?l="notmodified":(l=s.state,o=s.data,i=!(a=s.error))):(a=l,!e&&l||(l="error",e<0&&(e=0))),T.status=e,T.statusText=(t||l)+"",i?x.resolveWith(y,[o,l,T]):x.rejectWith(y,[T,l,a]),T.statusCode(w),w=void 0,g&&m.trigger(i?"ajaxSuccess":"ajaxError",[T,v,i?o:a]),b.fireWith(y,[T,l]),g&&(m.trigger("ajaxComplete",[T,v]),--ce.active||ce.event.trigger("ajaxStop")))}return T},getJSON:function(e,t,n){return ce.get(e,t,n,"json")},getScript:function(e,t){return ce.get(e,void 0,t,"script")}}),ce.each(["get","post"],function(e,i){ce[i]=function(e,t,n,r){return v(t)&&(r=r||n,n=t,t=void 0),ce.ajax(ce.extend({url:e,type:i,dataType:r,data:t,success:n},ce.isPlainObject(e)&&e))}}),ce.ajaxPrefilter(function(e){var t;for(t in e.headers)"content-type"===t.toLowerCase()&&(e.contentType=e.headers[t]||"")}),ce._evalUrl=function(e,t,n){return ce.ajax({url:e,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,converters:{"text script":function(){}},dataFilter:function(e){ce.globalEval(e,t,n)}})},ce.fn.extend({wrapAll:function(e){var t;return this[0]&&(v(e)&&(e=e.call(this[0])),t=ce(e,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstElementChild)e=e.firstElementChild;return e}).append(this)),this},wrapInner:function(n){return v(n)?this.each(function(e){ce(this).wrapInner(n.call(this,e))}):this.each(function(){var e=ce(this),t=e.contents();t.length?t.wrapAll(n):e.append(n)})},wrap:function(t){var n=v(t);return this.each(function(e){ce(this).wrapAll(n?t.call(this,e):t)})},unwrap:function(e){return this.parent(e).not("body").each(function(){ce(this).replaceWith(this.childNodes)}),this}}),ce.expr.pseudos.hidden=function(e){return!ce.expr.pseudos.visible(e)},ce.expr.pseudos.visible=function(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)},ce.ajaxSettings.xhr=function(){try{return new ie.XMLHttpRequest}catch(e){}};var Yt={0:200,1223:204},Qt=ce.ajaxSettings.xhr();le.cors=!!Qt&&"withCredentials"in Qt,le.ajax=Qt=!!Qt,ce.ajaxTransport(function(i){var o,a;if(le.cors||Qt&&!i.crossDomain)return{send:function(e,t){var n,r=i.xhr();if(r.open(i.type,i.url,i.async,i.username,i.password),i.xhrFields)for(n in i.xhrFields)r[n]=i.xhrFields[n];for(n in i.mimeType&&r.overrideMimeType&&r.overrideMimeType(i.mimeType),i.crossDomain||e["X-Requested-With"]||(e["X-Requested-With"]="XMLHttpRequest"),e)r.setRequestHeader(n,e[n]);o=function(e){return function(){o&&(o=a=r.onload=r.onerror=r.onabort=r.ontimeout=r.onreadystatechange=null,"abort"===e?r.abort():"error"===e?"number"!=typeof r.status?t(0,"error"):t(r.status,r.statusText):t(Yt[r.status]||r.status,r.statusText,"text"!==(r.responseType||"text")||"string"!=typeof r.responseText?{binary:r.response}:{text:r.responseText},r.getAllResponseHeaders()))}},r.onload=o(),a=r.onerror=r.ontimeout=o("error"),void 0!==r.onabort?r.onabort=a:r.onreadystatechange=function(){4===r.readyState&&ie.setTimeout(function(){o&&a()})},o=o("abort");try{r.send(i.hasContent&&i.data||null)}catch(e){if(o)throw e}},abort:function(){o&&o()}}}),ce.ajaxPrefilter(function(e){e.crossDomain&&(e.contents.script=!1)}),ce.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(e){return ce.globalEval(e),e}}}),ce.ajaxPrefilter("script",function(e){void 0===e.cache&&(e.cache=!1),e.crossDomain&&(e.type="GET")}),ce.ajaxTransport("script",function(n){var r,i;if(n.crossDomain||n.scriptAttrs)return{send:function(e,t){r=ce("<script>").attr(n.scriptAttrs||{}).prop({charset:n.scriptCharset,src:n.url}).on("load error",i=function(e){r.remove(),i=null,e&&t("error"===e.type?404:200,e.type)}),C.head.appendChild(r[0])},abort:function(){i&&i()}}});var Jt,Kt=[],Zt=/(=)\?(?=&|$)|\?\?/;ce.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Kt.pop()||ce.expando+"_"+jt.guid++;return this[e]=!0,e}}),ce.ajaxPrefilter("json jsonp",function(e,t,n){var r,i,o,a=!1!==e.jsonp&&(Zt.test(e.url)?"url":"string"==typeof e.data&&0===(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&Zt.test(e.data)&&"data");if(a||"jsonp"===e.dataTypes[0])return r=e.jsonpCallback=v(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,a?e[a]=e[a].replace(Zt,"$1"+r):!1!==e.jsonp&&(e.url+=(At.test(e.url)?"&":"?")+e.jsonp+"="+r),e.converters["script json"]=function(){return o||ce.error(r+" was not called"),o[0]},e.dataTypes[0]="json",i=ie[r],ie[r]=function(){o=arguments},n.always(function(){void 0===i?ce(ie).removeProp(r):ie[r]=i,e[r]&&(e.jsonpCallback=t.jsonpCallback,Kt.push(r)),o&&v(i)&&i(o[0]),o=i=void 0}),"script"}),le.createHTMLDocument=((Jt=C.implementation.createHTMLDocument("").body).innerHTML="<form></form><form></form>",2===Jt.childNodes.length),ce.parseHTML=function(e,t,n){return"string"!=typeof e?[]:("boolean"==typeof t&&(n=t,t=!1),t||(le.createHTMLDocument?((r=(t=C.implementation.createHTMLDocument("")).createElement("base")).href=C.location.href,t.head.appendChild(r)):t=C),o=!n&&[],(i=w.exec(e))?[t.createElement(i[1])]:(i=Ae([e],t,o),o&&o.length&&ce(o).remove(),ce.merge([],i.childNodes)));var r,i,o},ce.fn.load=function(e,t,n){var r,i,o,a=this,s=e.indexOf(" ");return-1<s&&(r=Tt(e.slice(s)),e=e.slice(0,s)),v(t)?(n=t,t=void 0):t&&"object"==typeof t&&(i="POST"),0<a.length&&ce.ajax({url:e,type:i||"GET",dataType:"html",data:t}).done(function(e){o=arguments,a.html(r?ce("<div>").append(ce.parseHTML(e)).find(r):e)}).always(n&&function(e,t){a.each(function(){n.apply(this,o||[e.responseText,t,e])})}),this},ce.expr.pseudos.animated=function(t){return ce.grep(ce.timers,function(e){return t===e.elem}).length},ce.offset={setOffset:function(e,t,n){var r,i,o,a,s,u,l=ce.css(e,"position"),c=ce(e),f={};"static"===l&&(e.style.position="relative"),s=c.offset(),o=ce.css(e,"top"),u=ce.css(e,"left"),("absolute"===l||"fixed"===l)&&-1<(o+u).indexOf("auto")?(a=(r=c.position()).top,i=r.left):(a=parseFloat(o)||0,i=parseFloat(u)||0),v(t)&&(t=t.call(e,n,ce.extend({},s))),null!=t.top&&(f.top=t.top-s.top+a),null!=t.left&&(f.left=t.left-s.left+i),"using"in t?t.using.call(e,f):c.css(f)}},ce.fn.extend({offset:function(t){if(arguments.length)return void 0===t?this:this.each(function(e){ce.offset.setOffset(this,t,e)});var e,n,r=this[0];return r?r.getClientRects().length?(e=r.getBoundingClientRect(),n=r.ownerDocument.defaultView,{top:e.top+n.pageYOffset,left:e.left+n.pageXOffset}):{top:0,left:0}:void 0},position:function(){if(this[0]){var e,t,n,r=this[0],i={top:0,left:0};if("fixed"===ce.css(r,"position"))t=r.getBoundingClientRect();else{t=this.offset(),n=r.ownerDocument,e=r.offsetParent||n.documentElement;while(e&&(e===n.body||e===n.documentElement)&&"static"===ce.css(e,"position"))e=e.parentNode;e&&e!==r&&1===e.nodeType&&((i=ce(e).offset()).top+=ce.css(e,"borderTopWidth",!0),i.left+=ce.css(e,"borderLeftWidth",!0))}return{top:t.top-i.top-ce.css(r,"marginTop",!0),left:t.left-i.left-ce.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent;while(e&&"static"===ce.css(e,"position"))e=e.offsetParent;return e||J})}}),ce.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(t,i){var o="pageYOffset"===i;ce.fn[t]=function(e){return M(this,function(e,t,n){var r;if(y(e)?r=e:9===e.nodeType&&(r=e.defaultView),void 0===n)return r?r[i]:e[t];r?r.scrollTo(o?r.pageXOffset:n,o?n:r.pageYOffset):e[t]=n},t,e,arguments.length)}}),ce.each(["top","left"],function(e,n){ce.cssHooks[n]=Ye(le.pixelPosition,function(e,t){if(t)return t=Ge(e,n),_e.test(t)?ce(e).position()[n]+"px":t})}),ce.each({Height:"height",Width:"width"},function(a,s){ce.each({padding:"inner"+a,content:s,"":"outer"+a},function(r,o){ce.fn[o]=function(e,t){var n=arguments.length&&(r||"boolean"!=typeof e),i=r||(!0===e||!0===t?"margin":"border");return M(this,function(e,t,n){var r;return y(e)?0===o.indexOf("outer")?e["inner"+a]:e.document.documentElement["client"+a]:9===e.nodeType?(r=e.documentElement,Math.max(e.body["scroll"+a],r["scroll"+a],e.body["offset"+a],r["offset"+a],r["client"+a])):void 0===n?ce.css(e,t,i):ce.style(e,t,n,i)},s,n?e:void 0,n)}})}),ce.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){ce.fn[t]=function(e){return this.on(t,e)}}),ce.fn.extend({bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)},hover:function(e,t){return this.on("mouseenter",e).on("mouseleave",t||e)}}),ce.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(e,n){ce.fn[n]=function(e,t){return 0<arguments.length?this.on(n,null,e,t):this.trigger(n)}});var en=/^[\s\uFEFF\xA0]+|([^\s\uFEFF\xA0])[\s\uFEFF\xA0]+$/g;ce.proxy=function(e,t){var n,r,i;if("string"==typeof t&&(n=e[t],t=e,e=n),v(e))return r=ae.call(arguments,2),(i=function(){return e.apply(t||this,r.concat(ae.call(arguments)))}).guid=e.guid=e.guid||ce.guid++,i},ce.holdReady=function(e){e?ce.readyWait++:ce.ready(!0)},ce.isArray=Array.isArray,ce.parseJSON=JSON.parse,ce.nodeName=fe,ce.isFunction=v,ce.isWindow=y,ce.camelCase=F,ce.type=x,ce.now=Date.now,ce.isNumeric=function(e){var t=ce.type(e);return("number"===t||"string"===t)&&!isNaN(e-parseFloat(e))},ce.trim=function(e){return null==e?"":(e+"").replace(en,"$1")},"function"==typeof define&&define.amd&&define("jquery",[],function(){return ce});var tn=ie.jQuery,nn=ie.$;return ce.noConflict=function(e){return ie.$===ce&&(ie.$=nn),e&&ie.jQuery===ce&&(ie.jQuery=tn),ce},"undefined"==typeof e&&(ie.jQuery=ie.$=ce),ce});
;
jQuery.easing["jswing"]=jQuery.easing["swing"];jQuery.extend(jQuery.easing,{def:"easeOutQuad",swing:function(x,t,b,c,d){return jQuery.easing[jQuery.easing.def](x,t,b,c,d)},easeInQuad:function(x,t,b,c,d){return c*(t/=d)*t+b},easeOutQuad:function(x,t,b,c,d){return-c*(t/=d)*(t-2)+b},easeInOutQuad:function(x,t,b,c,d){if((t/=d/2)<1)return c/2*t*t+b;return-c/2*(--t*(t-2)-1)+b},easeInCubic:function(x,t,b,c,d){return c*(t/=d)*t*t+b},easeOutCubic:function(x,t,b,c,d){return c*((t=t/d-1)*t*t+1)+b},easeInOutCubic:function(x,t,b,c,d){if((t/=d/2)<1)return c/2*t*t*t+b;return c/2*((t-=2)*t*t+2)+b},easeInQuart:function(x,t,b,c,d){return c*(t/=d)*t*t*t+b},easeOutQuart:function(x,t,b,c,d){return-c*((t=t/d-1)*t*t*t-1)+b},easeInOutQuart:function(x,t,b,c,d){if((t/=d/2)<1)return c/2*t*t*t*t+b;return-c/2*((t-=2)*t*t*t-2)+b},easeInQuint:function(x,t,b,c,d){return c*(t/=d)*t*t*t*t+b},easeOutQuint:function(x,t,b,c,d){return c*((t=t/d-1)*t*t*t*t+1)+b},easeInOutQuint:function(x,t,b,c,d){if((t/=d/2)<1)return c/2*t*t*t*t*t+b;return c/2*((t-=2)*t*t*t*t+2)+b},easeInSine:function(x,t,b,c,d){return-c*Math.cos(t/d*(Math.PI/2))+c+b},easeOutSine:function(x,t,b,c,d){return c*Math.sin(t/d*(Math.PI/2))+b},easeInOutSine:function(x,t,b,c,d){return-c/2*(Math.cos(Math.PI*t/d)-1)+b},easeInExpo:function(x,t,b,c,d){return t==0?b:c*Math.pow(2,10*(t/d-1))+b},easeOutExpo:function(x,t,b,c,d){return t==d?b+c:c*(-Math.pow(2,-10*t/d)+1)+b},easeInOutExpo:function(x,t,b,c,d){if(t==0)return b;if(t==d)return b+c;if((t/=d/2)<1)return c/2*Math.pow(2,10*(t-1))+b;return c/2*(-Math.pow(2,-10*--t)+2)+b},easeInCirc:function(x,t,b,c,d){return-c*(Math.sqrt(1-(t/=d)*t)-1)+b},easeOutCirc:function(x,t,b,c,d){return c*Math.sqrt(1-(t=t/d-1)*t)+b},easeInOutCirc:function(x,t,b,c,d){if((t/=d/2)<1)return-c/2*(Math.sqrt(1-t*t)-1)+b;return c/2*(Math.sqrt(1-(t-=2)*t)+1)+b},easeInElastic:function(x,t,b,c,d){var s=1.70158;var p=0;var a=c;if(t==0)return b;if((t/=d)==1)return b+c;if(!p)p=d*.3;if(a<Math.abs(c)){a=c;var s=p/4}else var s=p/(2*Math.PI)*Math.asin(c/a);return-(a*Math.pow(2,10*(t-=1))*Math.sin((t*d-s)*2*Math.PI/p))+b},easeOutElastic:function(x,t,b,c,d){var s=1.70158;var p=0;var a=c;if(t==0)return b;if((t/=d)==1)return b+c;if(!p)p=d*.3;if(a<Math.abs(c)){a=c;var s=p/4}else var s=p/(2*Math.PI)*Math.asin(c/a);return a*Math.pow(2,-10*t)*Math.sin((t*d-s)*2*Math.PI/p)+c+b},easeInOutElastic:function(x,t,b,c,d){var s=1.70158;var p=0;var a=c;if(t==0)return b;if((t/=d/2)==2)return b+c;if(!p)p=d*.3*1.5;if(a<Math.abs(c)){a=c;var s=p/4}else var s=p/(2*Math.PI)*Math.asin(c/a);if(t<1)return-.5*a*Math.pow(2,10*(t-=1))*Math.sin((t*d-s)*2*Math.PI/p)+b;return a*Math.pow(2,-10*(t-=1))*Math.sin((t*d-s)*2*Math.PI/p)*.5+c+b},easeInBack:function(x,t,b,c,d,s){if(s==undefined)s=1.70158;return c*(t/=d)*t*((s+1)*t-s)+b},easeOutBack:function(x,t,b,c,d,s){if(s==undefined)s=1.70158;return c*((t=t/d-1)*t*((s+1)*t+s)+1)+b},easeInOutBack:function(x,t,b,c,d,s){if(s==undefined)s=1.70158;if((t/=d/2)<1)return c/2*t*t*(((s*=1.525)+1)*t-s)+b;return c/2*((t-=2)*t*(((s*=1.525)+1)*t+s)+2)+b},easeInBounce:function(x,t,b,c,d){return c-jQuery.easing.easeOutBounce(x,d-t,0,c,d)+b},easeOutBounce:function(x,t,b,c,d){if((t/=d)<1/2.75){return c*7.5625*t*t+b}else if(t<2/2.75){return c*(7.5625*(t-=1.5/2.75)*t+.75)+b}else if(t<2.5/2.75){return c*(7.5625*(t-=2.25/2.75)*t+.9375)+b}else{return c*(7.5625*(t-=2.625/2.75)*t+.984375)+b}},easeInOutBounce:function(x,t,b,c,d){if(t<d/2)return jQuery.easing.easeInBounce(x,t*2,0,c,d)*.5+b;return jQuery.easing.easeOutBounce(x,t*2-d,0,c,d)*.5+c*.5+b}});;
/*!
 * jQuery Cookie Plugin v1.3.1
 * https://github.com/carhartl/jquery-cookie
 *
 * Copyright 2013 Klaus Hartl
 * Released under the MIT license
 */
(function(e,f,b){var d=/\+/g;function g(j){return j}function h(j){return c(decodeURIComponent(j.replace(d," ")))}function c(j){if(j.indexOf('"')===0){j=j.slice(1,-1).replace(/\\"/g,'"').replace(/\\\\/g,"\\")}return j}function i(j){return a.json?JSON.parse(j):j}var a=e.cookie=function(r,q,w){if(q!==b){w=e.extend({},a.defaults,w);if(q===null){w.expires=-1}if(typeof w.expires==="number"){var s=w.expires,v=w.expires=new Date();v.setDate(v.getDate()+s)}q=a.json?JSON.stringify(q):String(q);return(f.cookie=[encodeURIComponent(r),"=",a.raw?q:encodeURIComponent(q),w.expires?"; expires="+w.expires.toUTCString():"",w.path?"; path="+w.path:"",w.domain?"; domain="+w.domain:"",w.secure?"; secure":""].join(""))}var j=a.raw?g:h;var u=f.cookie.split("; ");var x=r?null:{};for(var p=0,n=u.length;p<n;p++){var o=u[p].split("=");var k=j(o.shift());var m=j(o.join("="));if(r&&r===k){x=i(m);break}if(!r){x[k]=i(m)}}return x};a.defaults={};e.removeCookie=function(k,j){if(e.cookie(k)!==null){e.cookie(k,null,j);return true}return false}})(jQuery,document);;
/*! Lazy Load 1.9.7 - MIT license - Copyright 2010-2015 Mika Tuupola */
!function(a,b,c,d){var e=a(b);a.fn.lazyload=function(f){function g(){var b=0;i.each(function(){var c=a(this);if(!j.skip_invisible||c.is(":visible"))if(a.abovethetop(this,j)||a.leftofbegin(this,j));else if(a.belowthefold(this,j)||a.rightoffold(this,j)){if(++b>j.failure_limit)return!1}else c.trigger("appear"),b=0})}var h,i=this,j={threshold:0,failure_limit:0,event:"scroll",effect:"show",container:b,data_attribute:"original",skip_invisible:!1,appear:null,load:null,placeholder:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB/AAffA0nNPuCLAAAAAElFTkSuQmCC"};return f&&(d!==f.failurelimit&&(f.failure_limit=f.failurelimit,delete f.failurelimit),d!==f.effectspeed&&(f.effect_speed=f.effectspeed,delete f.effectspeed),a.extend(j,f)),h=j.container===d||j.container===b?e:a(j.container),0===j.event.indexOf("scroll")&&h.bind(j.event,function(){return g()}),this.each(function(){var b=this,c=a(b);b.loaded=!1,(c.attr("src")===d||c.attr("src")===!1)&&c.is("img")&&c.attr("src",j.placeholder),c.one("appear",function(){if(!this.loaded){if(j.appear){var d=i.length;j.appear.call(b,d,j)}a("<img />").bind("load",function(){var d=c.attr("data-"+j.data_attribute);c.hide(),c.is("img")?c.attr("src",d):c.css("background-image","url('"+d+"')"),c[j.effect](j.effect_speed),b.loaded=!0;var e=a.grep(i,function(a){return!a.loaded});if(i=a(e),j.load){var f=i.length;j.load.call(b,f,j)}}).attr("src",c.attr("data-"+j.data_attribute))}}),0!==j.event.indexOf("scroll")&&c.bind(j.event,function(){b.loaded||c.trigger("appear")})}),e.bind("resize",function(){g()}),/(?:iphone|ipod|ipad).*os 5/gi.test(navigator.appVersion)&&e.bind("pageshow",function(b){b.originalEvent&&b.originalEvent.persisted&&i.each(function(){a(this).trigger("appear")})}),a(c).ready(function(){g()}),this},a.belowthefold=function(c,f){var g;return g=f.container===d||f.container===b?(b.innerHeight?b.innerHeight:e.height())+e.scrollTop():a(f.container).offset().top+a(f.container).height(),g<=a(c).offset().top-f.threshold},a.rightoffold=function(c,f){var g;return g=f.container===d||f.container===b?e.width()+e.scrollLeft():a(f.container).offset().left+a(f.container).width(),g<=a(c).offset().left-f.threshold},a.abovethetop=function(c,f){var g;return g=f.container===d||f.container===b?e.scrollTop():a(f.container).offset().top,g>=a(c).offset().top+f.threshold+a(c).height()},a.leftofbegin=function(c,f){var g;return g=f.container===d||f.container===b?e.scrollLeft():a(f.container).offset().left,g>=a(c).offset().left+f.threshold+a(c).width()},a.inviewport=function(b,c){return!(a.rightoffold(b,c)||a.leftofbegin(b,c)||a.belowthefold(b,c)||a.abovethetop(b,c))},a.extend(a.expr[":"],{"below-the-fold":function(b){return a.belowthefold(b,{threshold:0})},"above-the-top":function(b){return!a.belowthefold(b,{threshold:0})},"right-of-screen":function(b){return a.rightoffold(b,{threshold:0})},"left-of-screen":function(b){return!a.rightoffold(b,{threshold:0})},"in-viewport":function(b){return a.inviewport(b,{threshold:0})},"above-the-fold":function(b){return!a.belowthefold(b,{threshold:0})},"right-of-fold":function(b){return a.rightoffold(b,{threshold:0})},"left-of-fold":function(b){return!a.rightoffold(b,{threshold:0})}})}(jQuery,window,document);;
/*!
 * Bootstrap v3.4.1 (https://getbootstrap.com/)
 * Copyright 2011-2019 Twitter, Inc.
 * Licensed under the MIT license
 */
if("undefined"==typeof jQuery)throw new Error("Bootstrap's JavaScript requires jQuery");!function(t){"use strict";var e=jQuery.fn.jquery.split(" ")[0].split(".");if(e[0]<2&&e[1]<9||1==e[0]&&9==e[1]&&e[2]<1||3<e[0])throw new Error("Bootstrap's JavaScript requires jQuery version 1.9.1 or higher, but lower than version 4")}(),function(n){"use strict";n.fn.emulateTransitionEnd=function(t){var e=!1,i=this;n(this).one("bsTransitionEnd",function(){e=!0});return setTimeout(function(){e||n(i).trigger(n.support.transition.end)},t),this},n(function(){n.support.transition=function o(){var t=document.createElement("bootstrap"),e={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var i in e)if(t.style[i]!==undefined)return{end:e[i]};return!1}(),n.support.transition&&(n.event.special.bsTransitionEnd={bindType:n.support.transition.end,delegateType:n.support.transition.end,handle:function(t){if(n(t.target).is(this))return t.handleObj.handler.apply(this,arguments)}})})}(jQuery),function(s){"use strict";var e='[data-dismiss="alert"]',a=function(t){s(t).on("click",e,this.close)};a.VERSION="3.4.1",a.TRANSITION_DURATION=150,a.prototype.close=function(t){var e=s(this),i=e.attr("data-target");i||(i=(i=e.attr("href"))&&i.replace(/.*(?=#[^\s]*$)/,"")),i="#"===i?[]:i;var o=s(document).find(i);function n(){o.detach().trigger("closed.bs.alert").remove()}t&&t.preventDefault(),o.length||(o=e.closest(".alert")),o.trigger(t=s.Event("close.bs.alert")),t.isDefaultPrevented()||(o.removeClass("in"),s.support.transition&&o.hasClass("fade")?o.one("bsTransitionEnd",n).emulateTransitionEnd(a.TRANSITION_DURATION):n())};var t=s.fn.alert;s.fn.alert=function o(i){return this.each(function(){var t=s(this),e=t.data("bs.alert");e||t.data("bs.alert",e=new a(this)),"string"==typeof i&&e[i].call(t)})},s.fn.alert.Constructor=a,s.fn.alert.noConflict=function(){return s.fn.alert=t,this},s(document).on("click.bs.alert.data-api",e,a.prototype.close)}(jQuery),function(s){"use strict";var n=function(t,e){this.$element=s(t),this.options=s.extend({},n.DEFAULTS,e),this.isLoading=!1};function i(o){return this.each(function(){var t=s(this),e=t.data("bs.button"),i="object"==typeof o&&o;e||t.data("bs.button",e=new n(this,i)),"toggle"==o?e.toggle():o&&e.setState(o)})}n.VERSION="3.4.1",n.DEFAULTS={loadingText:"loading..."},n.prototype.setState=function(t){var e="disabled",i=this.$element,o=i.is("input")?"val":"html",n=i.data();t+="Text",null==n.resetText&&i.data("resetText",i[o]()),setTimeout(s.proxy(function(){i[o](null==n[t]?this.options[t]:n[t]),"loadingText"==t?(this.isLoading=!0,i.addClass(e).attr(e,e).prop(e,!0)):this.isLoading&&(this.isLoading=!1,i.removeClass(e).removeAttr(e).prop(e,!1))},this),0)},n.prototype.toggle=function(){var t=!0,e=this.$element.closest('[data-toggle="buttons"]');if(e.length){var i=this.$element.find("input");"radio"==i.prop("type")?(i.prop("checked")&&(t=!1),e.find(".active").removeClass("active"),this.$element.addClass("active")):"checkbox"==i.prop("type")&&(i.prop("checked")!==this.$element.hasClass("active")&&(t=!1),this.$element.toggleClass("active")),i.prop("checked",this.$element.hasClass("active")),t&&i.trigger("change")}else this.$element.attr("aria-pressed",!this.$element.hasClass("active")),this.$element.toggleClass("active")};var t=s.fn.button;s.fn.button=i,s.fn.button.Constructor=n,s.fn.button.noConflict=function(){return s.fn.button=t,this},s(document).on("click.bs.button.data-api",'[data-toggle^="button"]',function(t){var e=s(t.target).closest(".btn");i.call(e,"toggle"),s(t.target).is('input[type="radio"], input[type="checkbox"]')||(t.preventDefault(),e.is("input,button")?e.trigger("focus"):e.find("input:visible,button:visible").first().trigger("focus"))}).on("focus.bs.button.data-api blur.bs.button.data-api",'[data-toggle^="button"]',function(t){s(t.target).closest(".btn").toggleClass("focus",/^focus(in)?$/.test(t.type))})}(jQuery),function(p){"use strict";var c=function(t,e){this.$element=p(t),this.$indicators=this.$element.find(".carousel-indicators"),this.options=e,this.paused=null,this.sliding=null,this.interval=null,this.$active=null,this.$items=null,this.options.keyboard&&this.$element.on("keydown.bs.carousel",p.proxy(this.keydown,this)),"hover"==this.options.pause&&!("ontouchstart"in document.documentElement)&&this.$element.on("mouseenter.bs.carousel",p.proxy(this.pause,this)).on("mouseleave.bs.carousel",p.proxy(this.cycle,this))};function r(n){return this.each(function(){var t=p(this),e=t.data("bs.carousel"),i=p.extend({},c.DEFAULTS,t.data(),"object"==typeof n&&n),o="string"==typeof n?n:i.slide;e||t.data("bs.carousel",e=new c(this,i)),"number"==typeof n?e.to(n):o?e[o]():i.interval&&e.pause().cycle()})}c.VERSION="3.4.1",c.TRANSITION_DURATION=600,c.DEFAULTS={interval:5e3,pause:"hover",wrap:!0,keyboard:!0},c.prototype.keydown=function(t){if(!/input|textarea/i.test(t.target.tagName)){switch(t.which){case 37:this.prev();break;case 39:this.next();break;default:return}t.preventDefault()}},c.prototype.cycle=function(t){return t||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(p.proxy(this.next,this),this.options.interval)),this},c.prototype.getItemIndex=function(t){return this.$items=t.parent().children(".item"),this.$items.index(t||this.$active)},c.prototype.getItemForDirection=function(t,e){var i=this.getItemIndex(e);if(("prev"==t&&0===i||"next"==t&&i==this.$items.length-1)&&!this.options.wrap)return e;var o=(i+("prev"==t?-1:1))%this.$items.length;return this.$items.eq(o)},c.prototype.to=function(t){var e=this,i=this.getItemIndex(this.$active=this.$element.find(".item.active"));if(!(t>this.$items.length-1||t<0))return this.sliding?this.$element.one("slid.bs.carousel",function(){e.to(t)}):i==t?this.pause().cycle():this.slide(i<t?"next":"prev",this.$items.eq(t))},c.prototype.pause=function(t){return t||(this.paused=!0),this.$element.find(".next, .prev").length&&p.support.transition&&(this.$element.trigger(p.support.transition.end),this.cycle(!0)),this.interval=clearInterval(this.interval),this},c.prototype.next=function(){if(!this.sliding)return this.slide("next")},c.prototype.prev=function(){if(!this.sliding)return this.slide("prev")},c.prototype.slide=function(t,e){var i=this.$element.find(".item.active"),o=e||this.getItemForDirection(t,i),n=this.interval,s="next"==t?"left":"right",a=this;if(o.hasClass("active"))return this.sliding=!1;var r=o[0],l=p.Event("slide.bs.carousel",{relatedTarget:r,direction:s});if(this.$element.trigger(l),!l.isDefaultPrevented()){if(this.sliding=!0,n&&this.pause(),this.$indicators.length){this.$indicators.find(".active").removeClass("active");var h=p(this.$indicators.children()[this.getItemIndex(o)]);h&&h.addClass("active")}var d=p.Event("slid.bs.carousel",{relatedTarget:r,direction:s});return p.support.transition&&this.$element.hasClass("slide")?(o.addClass(t),"object"==typeof o&&o.length&&o[0].offsetWidth,i.addClass(s),o.addClass(s),i.one("bsTransitionEnd",function(){o.removeClass([t,s].join(" ")).addClass("active"),i.removeClass(["active",s].join(" ")),a.sliding=!1,setTimeout(function(){a.$element.trigger(d)},0)}).emulateTransitionEnd(c.TRANSITION_DURATION)):(i.removeClass("active"),o.addClass("active"),this.sliding=!1,this.$element.trigger(d)),n&&this.cycle(),this}};var t=p.fn.carousel;p.fn.carousel=r,p.fn.carousel.Constructor=c,p.fn.carousel.noConflict=function(){return p.fn.carousel=t,this};var e=function(t){var e=p(this),i=e.attr("href");i&&(i=i.replace(/.*(?=#[^\s]+$)/,""));var o=e.attr("data-target")||i,n=p(document).find(o);if(n.hasClass("carousel")){var s=p.extend({},n.data(),e.data()),a=e.attr("data-slide-to");a&&(s.interval=!1),r.call(n,s),a&&n.data("bs.carousel").to(a),t.preventDefault()}};p(document).on("click.bs.carousel.data-api","[data-slide]",e).on("click.bs.carousel.data-api","[data-slide-to]",e),p(window).on("load",function(){p('[data-ride="carousel"]').each(function(){var t=p(this);r.call(t,t.data())})})}(jQuery),function(a){"use strict";var r=function(t,e){this.$element=a(t),this.options=a.extend({},r.DEFAULTS,e),this.$trigger=a('[data-toggle="collapse"][href="#'+t.id+'"],[data-toggle="collapse"][data-target="#'+t.id+'"]'),this.transitioning=null,this.options.parent?this.$parent=this.getParent():this.addAriaAndCollapsedClass(this.$element,this.$trigger),this.options.toggle&&this.toggle()};function n(t){var e,i=t.attr("data-target")||(e=t.attr("href"))&&e.replace(/.*(?=#[^\s]+$)/,"");return a(document).find(i)}function l(o){return this.each(function(){var t=a(this),e=t.data("bs.collapse"),i=a.extend({},r.DEFAULTS,t.data(),"object"==typeof o&&o);!e&&i.toggle&&/show|hide/.test(o)&&(i.toggle=!1),e||t.data("bs.collapse",e=new r(this,i)),"string"==typeof o&&e[o]()})}r.VERSION="3.4.1",r.TRANSITION_DURATION=350,r.DEFAULTS={toggle:!0},r.prototype.dimension=function(){return this.$element.hasClass("width")?"width":"height"},r.prototype.show=function(){if(!this.transitioning&&!this.$element.hasClass("in")){var t,e=this.$parent&&this.$parent.children(".panel").children(".in, .collapsing");if(!(e&&e.length&&(t=e.data("bs.collapse"))&&t.transitioning)){var i=a.Event("show.bs.collapse");if(this.$element.trigger(i),!i.isDefaultPrevented()){e&&e.length&&(l.call(e,"hide"),t||e.data("bs.collapse",null));var o=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[o](0).attr("aria-expanded",!0),this.$trigger.removeClass("collapsed").attr("aria-expanded",!0),this.transitioning=1;var n=function(){this.$element.removeClass("collapsing").addClass("collapse in")[o](""),this.transitioning=0,this.$element.trigger("shown.bs.collapse")};if(!a.support.transition)return n.call(this);var s=a.camelCase(["scroll",o].join("-"));this.$element.one("bsTransitionEnd",a.proxy(n,this)).emulateTransitionEnd(r.TRANSITION_DURATION)[o](this.$element[0][s])}}}},r.prototype.hide=function(){if(!this.transitioning&&this.$element.hasClass("in")){var t=a.Event("hide.bs.collapse");if(this.$element.trigger(t),!t.isDefaultPrevented()){var e=this.dimension();this.$element[e](this.$element[e]())[0].offsetHeight,this.$element.addClass("collapsing").removeClass("collapse in").attr("aria-expanded",!1),this.$trigger.addClass("collapsed").attr("aria-expanded",!1),this.transitioning=1;var i=function(){this.transitioning=0,this.$element.removeClass("collapsing").addClass("collapse").trigger("hidden.bs.collapse")};if(!a.support.transition)return i.call(this);this.$element[e](0).one("bsTransitionEnd",a.proxy(i,this)).emulateTransitionEnd(r.TRANSITION_DURATION)}}},r.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()},r.prototype.getParent=function(){return a(document).find(this.options.parent).find('[data-toggle="collapse"][data-parent="'+this.options.parent+'"]').each(a.proxy(function(t,e){var i=a(e);this.addAriaAndCollapsedClass(n(i),i)},this)).end()},r.prototype.addAriaAndCollapsedClass=function(t,e){var i=t.hasClass("in");t.attr("aria-expanded",i),e.toggleClass("collapsed",!i).attr("aria-expanded",i)};var t=a.fn.collapse;a.fn.collapse=l,a.fn.collapse.Constructor=r,a.fn.collapse.noConflict=function(){return a.fn.collapse=t,this},a(document).on("click.bs.collapse.data-api",'[data-toggle="collapse"]',function(t){var e=a(this);e.attr("data-target")||t.preventDefault();var i=n(e),o=i.data("bs.collapse")?"toggle":e.data();l.call(i,o)})}(jQuery),function(a){"use strict";var r='[data-toggle="dropdown"]',o=function(t){a(t).on("click.bs.dropdown",this.toggle)};function l(t){var e=t.attr("data-target");e||(e=(e=t.attr("href"))&&/#[A-Za-z]/.test(e)&&e.replace(/.*(?=#[^\s]*$)/,""));var i="#"!==e?a(document).find(e):null;return i&&i.length?i:t.parent()}function s(o){o&&3===o.which||(a(".dropdown-backdrop").remove(),a(r).each(function(){var t=a(this),e=l(t),i={relatedTarget:this};e.hasClass("open")&&(o&&"click"==o.type&&/input|textarea/i.test(o.target.tagName)&&a.contains(e[0],o.target)||(e.trigger(o=a.Event("hide.bs.dropdown",i)),o.isDefaultPrevented()||(t.attr("aria-expanded","false"),e.removeClass("open").trigger(a.Event("hidden.bs.dropdown",i)))))}))}o.VERSION="3.4.1",o.prototype.toggle=function(t){var e=a(this);if(!e.is(".disabled, :disabled")){var i=l(e),o=i.hasClass("open");if(s(),!o){"ontouchstart"in document.documentElement&&!i.closest(".navbar-nav").length&&a(document.createElement("div")).addClass("dropdown-backdrop").insertAfter(a(this)).on("click",s);var n={relatedTarget:this};if(i.trigger(t=a.Event("show.bs.dropdown",n)),t.isDefaultPrevented())return;e.trigger("focus").attr("aria-expanded","true"),i.toggleClass("open").trigger(a.Event("shown.bs.dropdown",n))}return!1}},o.prototype.keydown=function(t){if(/(38|40|27|32)/.test(t.which)&&!/input|textarea/i.test(t.target.tagName)){var e=a(this);if(t.preventDefault(),t.stopPropagation(),!e.is(".disabled, :disabled")){var i=l(e),o=i.hasClass("open");if(!o&&27!=t.which||o&&27==t.which)return 27==t.which&&i.find(r).trigger("focus"),e.trigger("click");var n=i.find(".dropdown-menu li:not(.disabled):visible a");if(n.length){var s=n.index(t.target);38==t.which&&0<s&&s--,40==t.which&&s<n.length-1&&s++,~s||(s=0),n.eq(s).trigger("focus")}}}};var t=a.fn.dropdown;a.fn.dropdown=function e(i){return this.each(function(){var t=a(this),e=t.data("bs.dropdown");e||t.data("bs.dropdown",e=new o(this)),"string"==typeof i&&e[i].call(t)})},a.fn.dropdown.Constructor=o,a.fn.dropdown.noConflict=function(){return a.fn.dropdown=t,this},a(document).on("click.bs.dropdown.data-api",s).on("click.bs.dropdown.data-api",".dropdown form",function(t){t.stopPropagation()}).on("click.bs.dropdown.data-api",r,o.prototype.toggle).on("keydown.bs.dropdown.data-api",r,o.prototype.keydown).on("keydown.bs.dropdown.data-api",".dropdown-menu",o.prototype.keydown)}(jQuery),function(a){"use strict";var s=function(t,e){this.options=e,this.$body=a(document.body),this.$element=a(t),this.$dialog=this.$element.find(".modal-dialog"),this.$backdrop=null,this.isShown=null,this.originalBodyPad=null,this.scrollbarWidth=0,this.ignoreBackdropClick=!1,this.fixedContent=".navbar-fixed-top, .navbar-fixed-bottom",this.options.remote&&this.$element.find(".modal-content").load(this.options.remote,a.proxy(function(){this.$element.trigger("loaded.bs.modal")},this))};function r(o,n){return this.each(function(){var t=a(this),e=t.data("bs.modal"),i=a.extend({},s.DEFAULTS,t.data(),"object"==typeof o&&o);e||t.data("bs.modal",e=new s(this,i)),"string"==typeof o?e[o](n):i.show&&e.show(n)})}s.VERSION="3.4.1",s.TRANSITION_DURATION=300,s.BACKDROP_TRANSITION_DURATION=150,s.DEFAULTS={backdrop:!0,keyboard:!0,show:!0},s.prototype.toggle=function(t){return this.isShown?this.hide():this.show(t)},s.prototype.show=function(i){var o=this,t=a.Event("show.bs.modal",{relatedTarget:i});this.$element.trigger(t),this.isShown||t.isDefaultPrevented()||(this.isShown=!0,this.checkScrollbar(),this.setScrollbar(),this.$body.addClass("modal-open"),this.escape(),this.resize(),this.$element.on("click.dismiss.bs.modal",'[data-dismiss="modal"]',a.proxy(this.hide,this)),this.$dialog.on("mousedown.dismiss.bs.modal",function(){o.$element.one("mouseup.dismiss.bs.modal",function(t){a(t.target).is(o.$element)&&(o.ignoreBackdropClick=!0)})}),this.backdrop(function(){var t=a.support.transition&&o.$element.hasClass("fade");o.$element.parent().length||o.$element.appendTo(o.$body),o.$element.show().scrollTop(0),o.adjustDialog(),t&&o.$element[0].offsetWidth,o.$element.addClass("in"),o.enforceFocus();var e=a.Event("shown.bs.modal",{relatedTarget:i});t?o.$dialog.one("bsTransitionEnd",function(){o.$element.trigger("focus").trigger(e)}).emulateTransitionEnd(s.TRANSITION_DURATION):o.$element.trigger("focus").trigger(e)}))},s.prototype.hide=function(t){t&&t.preventDefault(),t=a.Event("hide.bs.modal"),this.$element.trigger(t),this.isShown&&!t.isDefaultPrevented()&&(this.isShown=!1,this.escape(),this.resize(),a(document).off("focusin.bs.modal"),this.$element.removeClass("in").off("click.dismiss.bs.modal").off("mouseup.dismiss.bs.modal"),this.$dialog.off("mousedown.dismiss.bs.modal"),a.support.transition&&this.$element.hasClass("fade")?this.$element.one("bsTransitionEnd",a.proxy(this.hideModal,this)).emulateTransitionEnd(s.TRANSITION_DURATION):this.hideModal())},s.prototype.enforceFocus=function(){a(document).off("focusin.bs.modal").on("focusin.bs.modal",a.proxy(function(t){document===t.target||this.$element[0]===t.target||this.$element.has(t.target).length||this.$element.trigger("focus")},this))},s.prototype.escape=function(){this.isShown&&this.options.keyboard?this.$element.on("keydown.dismiss.bs.modal",a.proxy(function(t){27==t.which&&this.hide()},this)):this.isShown||this.$element.off("keydown.dismiss.bs.modal")},s.prototype.resize=function(){this.isShown?a(window).on("resize.bs.modal",a.proxy(this.handleUpdate,this)):a(window).off("resize.bs.modal")},s.prototype.hideModal=function(){var t=this;this.$element.hide(),this.backdrop(function(){t.$body.removeClass("modal-open"),t.resetAdjustments(),t.resetScrollbar(),t.$element.trigger("hidden.bs.modal")})},s.prototype.removeBackdrop=function(){this.$backdrop&&this.$backdrop.remove(),this.$backdrop=null},s.prototype.backdrop=function(t){var e=this,i=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var o=a.support.transition&&i;if(this.$backdrop=a(document.createElement("div")).addClass("modal-backdrop "+i).appendTo(this.$body),this.$element.on("click.dismiss.bs.modal",a.proxy(function(t){this.ignoreBackdropClick?this.ignoreBackdropClick=!1:t.target===t.currentTarget&&("static"==this.options.backdrop?this.$element[0].focus():this.hide())},this)),o&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),!t)return;o?this.$backdrop.one("bsTransitionEnd",t).emulateTransitionEnd(s.BACKDROP_TRANSITION_DURATION):t()}else if(!this.isShown&&this.$backdrop){this.$backdrop.removeClass("in");var n=function(){e.removeBackdrop(),t&&t()};a.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one("bsTransitionEnd",n).emulateTransitionEnd(s.BACKDROP_TRANSITION_DURATION):n()}else t&&t()},s.prototype.handleUpdate=function(){this.adjustDialog()},s.prototype.adjustDialog=function(){var t=this.$element[0].scrollHeight>document.documentElement.clientHeight;this.$element.css({paddingLeft:!this.bodyIsOverflowing&&t?this.scrollbarWidth:"",paddingRight:this.bodyIsOverflowing&&!t?this.scrollbarWidth:""})},s.prototype.resetAdjustments=function(){this.$element.css({paddingLeft:"",paddingRight:""})},s.prototype.checkScrollbar=function(){var t=window.innerWidth;if(!t){var e=document.documentElement.getBoundingClientRect();t=e.right-Math.abs(e.left)}this.bodyIsOverflowing=document.body.clientWidth<t,this.scrollbarWidth=this.measureScrollbar()},s.prototype.setScrollbar=function(){var t=parseInt(this.$body.css("padding-right")||0,10);this.originalBodyPad=document.body.style.paddingRight||"";var n=this.scrollbarWidth;this.bodyIsOverflowing&&(this.$body.css("padding-right",t+n),a(this.fixedContent).each(function(t,e){var i=e.style.paddingRight,o=a(e).css("padding-right");a(e).data("padding-right",i).css("padding-right",parseFloat(o)+n+"px")}))},s.prototype.resetScrollbar=function(){this.$body.css("padding-right",this.originalBodyPad),a(this.fixedContent).each(function(t,e){var i=a(e).data("padding-right");a(e).removeData("padding-right"),e.style.paddingRight=i||""})},s.prototype.measureScrollbar=function(){var t=document.createElement("div");t.className="modal-scrollbar-measure",this.$body.append(t);var e=t.offsetWidth-t.clientWidth;return this.$body[0].removeChild(t),e};var t=a.fn.modal;a.fn.modal=r,a.fn.modal.Constructor=s,a.fn.modal.noConflict=function(){return a.fn.modal=t,this},a(document).on("click.bs.modal.data-api",'[data-toggle="modal"]',function(t){var e=a(this),i=e.attr("href"),o=e.attr("data-target")||i&&i.replace(/.*(?=#[^\s]+$)/,""),n=a(document).find(o),s=n.data("bs.modal")?"toggle":a.extend({remote:!/#/.test(i)&&i},n.data(),e.data());e.is("a")&&t.preventDefault(),n.one("show.bs.modal",function(t){t.isDefaultPrevented()||n.one("hidden.bs.modal",function(){e.is(":visible")&&e.trigger("focus")})}),r.call(n,s,this)})}(jQuery),function(g){"use strict";var o=["sanitize","whiteList","sanitizeFn"],a=["background","cite","href","itemtype","longdesc","poster","src","xlink:href"],t={"*":["class","dir","id","lang","role",/^aria-[\w-]*$/i],a:["target","href","title","rel"],area:[],b:[],br:[],col:[],code:[],div:[],em:[],hr:[],h1:[],h2:[],h3:[],h4:[],h5:[],h6:[],i:[],img:["src","alt","title","width","height"],li:[],ol:[],p:[],pre:[],s:[],small:[],span:[],sub:[],sup:[],strong:[],u:[],ul:[]},r=/^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi,l=/^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[a-z0-9+/]+=*$/i;function u(t,e){var i=t.nodeName.toLowerCase();if(-1!==g.inArray(i,e))return-1===g.inArray(i,a)||Boolean(t.nodeValue.match(r)||t.nodeValue.match(l));for(var o=g(e).filter(function(t,e){return e instanceof RegExp}),n=0,s=o.length;n<s;n++)if(i.match(o[n]))return!0;return!1}function n(t,e,i){if(0===t.length)return t;if(i&&"function"==typeof i)return i(t);if(!document.implementation||!document.implementation.createHTMLDocument)return t;var o=document.implementation.createHTMLDocument("sanitization");o.body.innerHTML=t;for(var n=g.map(e,function(t,e){return e}),s=g(o.body).find("*"),a=0,r=s.length;a<r;a++){var l=s[a],h=l.nodeName.toLowerCase();if(-1!==g.inArray(h,n))for(var d=g.map(l.attributes,function(t){return t}),p=[].concat(e["*"]||[],e[h]||[]),c=0,f=d.length;c<f;c++)u(d[c],p)||l.removeAttribute(d[c].nodeName);else l.parentNode.removeChild(l)}return o.body.innerHTML}var m=function(t,e){this.type=null,this.options=null,this.enabled=null,this.timeout=null,this.hoverState=null,this.$element=null,this.inState=null,this.init("tooltip",t,e)};m.VERSION="3.4.1",m.TRANSITION_DURATION=150,m.DEFAULTS={animation:!0,placement:"top",selector:!1,template:'<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover focus",title:"",delay:0,html:!1,container:!1,viewport:{selector:"body",padding:0},sanitize:!0,sanitizeFn:null,whiteList:t},m.prototype.init=function(t,e,i){if(this.enabled=!0,this.type=t,this.$element=g(e),this.options=this.getOptions(i),this.$viewport=this.options.viewport&&g(document).find(g.isFunction(this.options.viewport)?this.options.viewport.call(this,this.$element):this.options.viewport.selector||this.options.viewport),this.inState={click:!1,hover:!1,focus:!1},this.$element[0]instanceof document.constructor&&!this.options.selector)throw new Error("`selector` option must be specified when initializing "+this.type+" on the window.document object!");for(var o=this.options.trigger.split(" "),n=o.length;n--;){var s=o[n];if("click"==s)this.$element.on("click."+this.type,this.options.selector,g.proxy(this.toggle,this));else if("manual"!=s){var a="hover"==s?"mouseenter":"focusin",r="hover"==s?"mouseleave":"focusout";this.$element.on(a+"."+this.type,this.options.selector,g.proxy(this.enter,this)),this.$element.on(r+"."+this.type,this.options.selector,g.proxy(this.leave,this))}}this.options.selector?this._options=g.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},m.prototype.getDefaults=function(){return m.DEFAULTS},m.prototype.getOptions=function(t){var e=this.$element.data();for(var i in e)e.hasOwnProperty(i)&&-1!==g.inArray(i,o)&&delete e[i];return(t=g.extend({},this.getDefaults(),e,t)).delay&&"number"==typeof t.delay&&(t.delay={show:t.delay,hide:t.delay}),t.sanitize&&(t.template=n(t.template,t.whiteList,t.sanitizeFn)),t},m.prototype.getDelegateOptions=function(){var i={},o=this.getDefaults();return this._options&&g.each(this._options,function(t,e){o[t]!=e&&(i[t]=e)}),i},m.prototype.enter=function(t){var e=t instanceof this.constructor?t:g(t.currentTarget).data("bs."+this.type);if(e||(e=new this.constructor(t.currentTarget,this.getDelegateOptions()),g(t.currentTarget).data("bs."+this.type,e)),t instanceof g.Event&&(e.inState["focusin"==t.type?"focus":"hover"]=!0),e.tip().hasClass("in")||"in"==e.hoverState)e.hoverState="in";else{if(clearTimeout(e.timeout),e.hoverState="in",!e.options.delay||!e.options.delay.show)return e.show();e.timeout=setTimeout(function(){"in"==e.hoverState&&e.show()},e.options.delay.show)}},m.prototype.isInStateTrue=function(){for(var t in this.inState)if(this.inState[t])return!0;return!1},m.prototype.leave=function(t){var e=t instanceof this.constructor?t:g(t.currentTarget).data("bs."+this.type);if(e||(e=new this.constructor(t.currentTarget,this.getDelegateOptions()),g(t.currentTarget).data("bs."+this.type,e)),t instanceof g.Event&&(e.inState["focusout"==t.type?"focus":"hover"]=!1),!e.isInStateTrue()){if(clearTimeout(e.timeout),e.hoverState="out",!e.options.delay||!e.options.delay.hide)return e.hide();e.timeout=setTimeout(function(){"out"==e.hoverState&&e.hide()},e.options.delay.hide)}},m.prototype.show=function(){var t=g.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){this.$element.trigger(t);var e=g.contains(this.$element[0].ownerDocument.documentElement,this.$element[0]);if(t.isDefaultPrevented()||!e)return;var i=this,o=this.tip(),n=this.getUID(this.type);this.setContent(),o.attr("id",n),this.$element.attr("aria-describedby",n),this.options.animation&&o.addClass("fade");var s="function"==typeof this.options.placement?this.options.placement.call(this,o[0],this.$element[0]):this.options.placement,a=/\s?auto?\s?/i,r=a.test(s);r&&(s=s.replace(a,"")||"top"),o.detach().css({top:0,left:0,display:"block"}).addClass(s).data("bs."+this.type,this),this.options.container?o.appendTo(g(document).find(this.options.container)):o.insertAfter(this.$element),this.$element.trigger("inserted.bs."+this.type);var l=this.getPosition(),h=o[0].offsetWidth,d=o[0].offsetHeight;if(r){var p=s,c=this.getPosition(this.$viewport);s="bottom"==s&&l.bottom+d>c.bottom?"top":"top"==s&&l.top-d<c.top?"bottom":"right"==s&&l.right+h>c.width?"left":"left"==s&&l.left-h<c.left?"right":s,o.removeClass(p).addClass(s)}var f=this.getCalculatedOffset(s,l,h,d);this.applyPlacement(f,s);var u=function(){var t=i.hoverState;i.$element.trigger("shown.bs."+i.type),i.hoverState=null,"out"==t&&i.leave(i)};g.support.transition&&this.$tip.hasClass("fade")?o.one("bsTransitionEnd",u).emulateTransitionEnd(m.TRANSITION_DURATION):u()}},m.prototype.applyPlacement=function(t,e){var i=this.tip(),o=i[0].offsetWidth,n=i[0].offsetHeight,s=parseInt(i.css("margin-top"),10),a=parseInt(i.css("margin-left"),10);isNaN(s)&&(s=0),isNaN(a)&&(a=0),t.top+=s,t.left+=a,g.offset.setOffset(i[0],g.extend({using:function(t){i.css({top:Math.round(t.top),left:Math.round(t.left)})}},t),0),i.addClass("in");var r=i[0].offsetWidth,l=i[0].offsetHeight;"top"==e&&l!=n&&(t.top=t.top+n-l);var h=this.getViewportAdjustedDelta(e,t,r,l);h.left?t.left+=h.left:t.top+=h.top;var d=/top|bottom/.test(e),p=d?2*h.left-o+r:2*h.top-n+l,c=d?"offsetWidth":"offsetHeight";i.offset(t),this.replaceArrow(p,i[0][c],d)},m.prototype.replaceArrow=function(t,e,i){this.arrow().css(i?"left":"top",50*(1-t/e)+"%").css(i?"top":"left","")},m.prototype.setContent=function(){var t=this.tip(),e=this.getTitle();this.options.html?(this.options.sanitize&&(e=n(e,this.options.whiteList,this.options.sanitizeFn)),t.find(".tooltip-inner").html(e)):t.find(".tooltip-inner").text(e),t.removeClass("fade in top bottom left right")},m.prototype.hide=function(t){var e=this,i=g(this.$tip),o=g.Event("hide.bs."+this.type);function n(){"in"!=e.hoverState&&i.detach(),e.$element&&e.$element.removeAttr("aria-describedby").trigger("hidden.bs."+e.type),t&&t()}if(this.$element.trigger(o),!o.isDefaultPrevented())return i.removeClass("in"),g.support.transition&&i.hasClass("fade")?i.one("bsTransitionEnd",n).emulateTransitionEnd(m.TRANSITION_DURATION):n(),this.hoverState=null,this},m.prototype.fixTitle=function(){var t=this.$element;(t.attr("title")||"string"!=typeof t.attr("data-original-title"))&&t.attr("data-original-title",t.attr("title")||"").attr("title","")},m.prototype.hasContent=function(){return this.getTitle()},m.prototype.getPosition=function(t){var e=(t=t||this.$element)[0],i="BODY"==e.tagName,o=e.getBoundingClientRect();null==o.width&&(o=g.extend({},o,{width:o.right-o.left,height:o.bottom-o.top}));var n=window.SVGElement&&e instanceof window.SVGElement,s=i?{top:0,left:0}:n?null:t.offset(),a={scroll:i?document.documentElement.scrollTop||document.body.scrollTop:t.scrollTop()},r=i?{width:g(window).width(),height:g(window).height()}:null;return g.extend({},o,a,r,s)},m.prototype.getCalculatedOffset=function(t,e,i,o){return"bottom"==t?{top:e.top+e.height,left:e.left+e.width/2-i/2}:"top"==t?{top:e.top-o,left:e.left+e.width/2-i/2}:"left"==t?{top:e.top+e.height/2-o/2,left:e.left-i}:{top:e.top+e.height/2-o/2,left:e.left+e.width}},m.prototype.getViewportAdjustedDelta=function(t,e,i,o){var n={top:0,left:0};if(!this.$viewport)return n;var s=this.options.viewport&&this.options.viewport.padding||0,a=this.getPosition(this.$viewport);if(/right|left/.test(t)){var r=e.top-s-a.scroll,l=e.top+s-a.scroll+o;r<a.top?n.top=a.top-r:l>a.top+a.height&&(n.top=a.top+a.height-l)}else{var h=e.left-s,d=e.left+s+i;h<a.left?n.left=a.left-h:d>a.right&&(n.left=a.left+a.width-d)}return n},m.prototype.getTitle=function(){var t=this.$element,e=this.options;return t.attr("data-original-title")||("function"==typeof e.title?e.title.call(t[0]):e.title)},m.prototype.getUID=function(t){for(;t+=~~(1e6*Math.random()),document.getElementById(t););return t},m.prototype.tip=function(){if(!this.$tip&&(this.$tip=g(this.options.template),1!=this.$tip.length))throw new Error(this.type+" `template` option must consist of exactly 1 top-level element!");return this.$tip},m.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},m.prototype.enable=function(){this.enabled=!0},m.prototype.disable=function(){this.enabled=!1},m.prototype.toggleEnabled=function(){this.enabled=!this.enabled},m.prototype.toggle=function(t){var e=this;t&&((e=g(t.currentTarget).data("bs."+this.type))||(e=new this.constructor(t.currentTarget,this.getDelegateOptions()),g(t.currentTarget).data("bs."+this.type,e))),t?(e.inState.click=!e.inState.click,e.isInStateTrue()?e.enter(e):e.leave(e)):e.tip().hasClass("in")?e.leave(e):e.enter(e)},m.prototype.destroy=function(){var t=this;clearTimeout(this.timeout),this.hide(function(){t.$element.off("."+t.type).removeData("bs."+t.type),t.$tip&&t.$tip.detach(),t.$tip=null,t.$arrow=null,t.$viewport=null,t.$element=null})},m.prototype.sanitizeHtml=function(t){return n(t,this.options.whiteList,this.options.sanitizeFn)};var e=g.fn.tooltip;g.fn.tooltip=function i(o){return this.each(function(){var t=g(this),e=t.data("bs.tooltip"),i="object"==typeof o&&o;!e&&/destroy|hide/.test(o)||(e||t.data("bs.tooltip",e=new m(this,i)),"string"==typeof o&&e[o]())})},g.fn.tooltip.Constructor=m,g.fn.tooltip.noConflict=function(){return g.fn.tooltip=e,this}}(jQuery),function(n){"use strict";var s=function(t,e){this.init("popover",t,e)};if(!n.fn.tooltip)throw new Error("Popover requires tooltip.js");s.VERSION="3.4.1",s.DEFAULTS=n.extend({},n.fn.tooltip.Constructor.DEFAULTS,{placement:"right",trigger:"click",content:"",template:'<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'}),((s.prototype=n.extend({},n.fn.tooltip.Constructor.prototype)).constructor=s).prototype.getDefaults=function(){return s.DEFAULTS},s.prototype.setContent=function(){var t=this.tip(),e=this.getTitle(),i=this.getContent();if(this.options.html){var o=typeof i;this.options.sanitize&&(e=this.sanitizeHtml(e),"string"===o&&(i=this.sanitizeHtml(i))),t.find(".popover-title").html(e),t.find(".popover-content").children().detach().end()["string"===o?"html":"append"](i)}else t.find(".popover-title").text(e),t.find(".popover-content").children().detach().end().text(i);t.removeClass("fade top bottom left right in"),t.find(".popover-title").html()||t.find(".popover-title").hide()},s.prototype.hasContent=function(){return this.getTitle()||this.getContent()},s.prototype.getContent=function(){var t=this.$element,e=this.options;return t.attr("data-content")||("function"==typeof e.content?e.content.call(t[0]):e.content)},s.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")};var t=n.fn.popover;n.fn.popover=function e(o){return this.each(function(){var t=n(this),e=t.data("bs.popover"),i="object"==typeof o&&o;!e&&/destroy|hide/.test(o)||(e||t.data("bs.popover",e=new s(this,i)),"string"==typeof o&&e[o]())})},n.fn.popover.Constructor=s,n.fn.popover.noConflict=function(){return n.fn.popover=t,this}}(jQuery),function(s){"use strict";function n(t,e){this.$body=s(document.body),this.$scrollElement=s(t).is(document.body)?s(window):s(t),this.options=s.extend({},n.DEFAULTS,e),this.selector=(this.options.target||"")+" .nav li > a",this.offsets=[],this.targets=[],this.activeTarget=null,this.scrollHeight=0,this.$scrollElement.on("scroll.bs.scrollspy",s.proxy(this.process,this)),this.refresh(),this.process()}function e(o){return this.each(function(){var t=s(this),e=t.data("bs.scrollspy"),i="object"==typeof o&&o;e||t.data("bs.scrollspy",e=new n(this,i)),"string"==typeof o&&e[o]()})}n.VERSION="3.4.1",n.DEFAULTS={offset:10},n.prototype.getScrollHeight=function(){return this.$scrollElement[0].scrollHeight||Math.max(this.$body[0].scrollHeight,document.documentElement.scrollHeight)},n.prototype.refresh=function(){var t=this,o="offset",n=0;this.offsets=[],this.targets=[],this.scrollHeight=this.getScrollHeight(),s.isWindow(this.$scrollElement[0])||(o="position",n=this.$scrollElement.scrollTop()),this.$body.find(this.selector).map(function(){var t=s(this),e=t.data("target")||t.attr("href"),i=/^#./.test(e)&&s(e);return i&&i.length&&i.is(":visible")&&[[i[o]().top+n,e]]||null}).sort(function(t,e){return t[0]-e[0]}).each(function(){t.offsets.push(this[0]),t.targets.push(this[1])})},n.prototype.process=function(){var t,e=this.$scrollElement.scrollTop()+this.options.offset,i=this.getScrollHeight(),o=this.options.offset+i-this.$scrollElement.height(),n=this.offsets,s=this.targets,a=this.activeTarget;if(this.scrollHeight!=i&&this.refresh(),o<=e)return a!=(t=s[s.length-1])&&this.activate(t);if(a&&e<n[0])return this.activeTarget=null,this.clear();for(t=n.length;t--;)a!=s[t]&&e>=n[t]&&(n[t+1]===undefined||e<n[t+1])&&this.activate(s[t])},n.prototype.activate=function(t){this.activeTarget=t,this.clear();var e=this.selector+'[data-target="'+t+'"],'+this.selector+'[href="'+t+'"]',i=s(e).parents("li").addClass("active");i.parent(".dropdown-menu").length&&(i=i.closest("li.dropdown").addClass("active")),i.trigger("activate.bs.scrollspy")},n.prototype.clear=function(){s(this.selector).parentsUntil(this.options.target,".active").removeClass("active")};var t=s.fn.scrollspy;s.fn.scrollspy=e,s.fn.scrollspy.Constructor=n,s.fn.scrollspy.noConflict=function(){return s.fn.scrollspy=t,this},s(window).on("load.bs.scrollspy.data-api",function(){s('[data-spy="scroll"]').each(function(){var t=s(this);e.call(t,t.data())})})}(jQuery),function(r){"use strict";var a=function(t){this.element=r(t)};function e(i){return this.each(function(){var t=r(this),e=t.data("bs.tab");e||t.data("bs.tab",e=new a(this)),"string"==typeof i&&e[i]()})}a.VERSION="3.4.1",a.TRANSITION_DURATION=150,a.prototype.show=function(){var t=this.element,e=t.closest("ul:not(.dropdown-menu)"),i=t.data("target");if(i||(i=(i=t.attr("href"))&&i.replace(/.*(?=#[^\s]*$)/,"")),!t.parent("li").hasClass("active")){var o=e.find(".active:last a"),n=r.Event("hide.bs.tab",{relatedTarget:t[0]}),s=r.Event("show.bs.tab",{relatedTarget:o[0]});if(o.trigger(n),t.trigger(s),!s.isDefaultPrevented()&&!n.isDefaultPrevented()){var a=r(document).find(i);this.activate(t.closest("li"),e),this.activate(a,a.parent(),function(){o.trigger({type:"hidden.bs.tab",relatedTarget:t[0]}),t.trigger({type:"shown.bs.tab",relatedTarget:o[0]})})}}},a.prototype.activate=function(t,e,i){var o=e.find("> .active"),n=i&&r.support.transition&&(o.length&&o.hasClass("fade")||!!e.find("> .fade").length);function s(){o.removeClass("active").find("> .dropdown-menu > .active").removeClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!1),t.addClass("active").find('[data-toggle="tab"]').attr("aria-expanded",!0),n?(t[0].offsetWidth,t.addClass("in")):t.removeClass("fade"),t.parent(".dropdown-menu").length&&t.closest("li.dropdown").addClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!0),i&&i()}o.length&&n?o.one("bsTransitionEnd",s).emulateTransitionEnd(a.TRANSITION_DURATION):s(),o.removeClass("in")};var t=r.fn.tab;r.fn.tab=e,r.fn.tab.Constructor=a,r.fn.tab.noConflict=function(){return r.fn.tab=t,this};var i=function(t){t.preventDefault(),e.call(r(this),"show")};r(document).on("click.bs.tab.data-api",'[data-toggle="tab"]',i).on("click.bs.tab.data-api",'[data-toggle="pill"]',i)}(jQuery),function(l){"use strict";var h=function(t,e){this.options=l.extend({},h.DEFAULTS,e);var i=this.options.target===h.DEFAULTS.target?l(this.options.target):l(document).find(this.options.target);this.$target=i.on("scroll.bs.affix.data-api",l.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",l.proxy(this.checkPositionWithEventLoop,this)),this.$element=l(t),this.affixed=null,this.unpin=null,this.pinnedOffset=null,this.checkPosition()};function i(o){return this.each(function(){var t=l(this),e=t.data("bs.affix"),i="object"==typeof o&&o;e||t.data("bs.affix",e=new h(this,i)),"string"==typeof o&&e[o]()})}h.VERSION="3.4.1",h.RESET="affix affix-top affix-bottom",h.DEFAULTS={offset:0,target:window},h.prototype.getState=function(t,e,i,o){var n=this.$target.scrollTop(),s=this.$element.offset(),a=this.$target.height();if(null!=i&&"top"==this.affixed)return n<i&&"top";if("bottom"==this.affixed)return null!=i?!(n+this.unpin<=s.top)&&"bottom":!(n+a<=t-o)&&"bottom";var r=null==this.affixed,l=r?n:s.top;return null!=i&&n<=i?"top":null!=o&&t-o<=l+(r?a:e)&&"bottom"},h.prototype.getPinnedOffset=function(){if(this.pinnedOffset)return this.pinnedOffset;this.$element.removeClass(h.RESET).addClass("affix");var t=this.$target.scrollTop(),e=this.$element.offset();return this.pinnedOffset=e.top-t},h.prototype.checkPositionWithEventLoop=function(){setTimeout(l.proxy(this.checkPosition,this),1)},h.prototype.checkPosition=function(){if(this.$element.is(":visible")){var t=this.$element.height(),e=this.options.offset,i=e.top,o=e.bottom,n=Math.max(l(document).height(),l(document.body).height());"object"!=typeof e&&(o=i=e),"function"==typeof i&&(i=e.top(this.$element)),"function"==typeof o&&(o=e.bottom(this.$element));var s=this.getState(n,t,i,o);if(this.affixed!=s){null!=this.unpin&&this.$element.css("top","");var a="affix"+(s?"-"+s:""),r=l.Event(a+".bs.affix");if(this.$element.trigger(r),r.isDefaultPrevented())return;this.affixed=s,this.unpin="bottom"==s?this.getPinnedOffset():null,this.$element.removeClass(h.RESET).addClass(a).trigger(a.replace("affix","affixed")+".bs.affix")}"bottom"==s&&this.$element.offset({top:n-t-o})}};var t=l.fn.affix;l.fn.affix=i,l.fn.affix.Constructor=h,l.fn.affix.noConflict=function(){return l.fn.affix=t,this},l(window).on("load",function(){l('[data-spy="affix"]').each(function(){var t=l(this),e=t.data();e.offset=e.offset||{},null!=e.offsetBottom&&(e.offset.bottom=e.offsetBottom),null!=e.offsetTop&&(e.offset.top=e.offsetTop),i.call(t,e)})})}(jQuery);;
/**
 * From http://tympanus.net/Development/FullscreenOverlayStyles/index3.html.
 */


(function ($) {
    $.fn.toggleOverlay = function() {
        var el = this,
                overlay = document.querySelector( 'div.overlay' ),
                closeBttn = overlay.querySelector( 'button.overlay-close' );
                transEndEventNames = {
                    'WebkitTransition': 'webkitTransitionEnd',
                    'MozTransition': 'transitionend',
                    'OTransition': 'oTransitionEnd',
                    'msTransition': 'MSTransitionEnd',
                    'transition': 'transitionend'
                },
                transEndEventName = transEndEventNames[ 'transition' ],
                support = { transitions : true };


        if (el.hasClass("overlay") && el.hasClass("open")) {
            el.removeClass("open");
            el.addClass("close");
            // $("body").css("overflow-y", "auto");

            var onEndTransitionFn = function (ev) {
                if( support.transitions ) {
                    if( ev.originalEvent.propertyName !== 'visibility' ) return;
                    $(this).off(transEndEventName, onEndTransitionFn);
                }
                el.removeClass("close");
            };

            if (support.transitions) {
                el.on(transEndEventName, onEndTransitionFn);
            }
            else {
                onEndTransitionFn();
            }

        }
        else {
            el.addClass("open");
            // $("body").css("overflow-y", "hidden");
        }

        return this;
    }
}(jQuery));
;
var Utility = {
    splitParam: function (input) {
        var nameValuePairs = {};
        var e,
            a = /\+/g,  // Regex for replacing addition symbol with a space
            r = /([^&=]+)=?([^&]*)/g,
            d = function (s) { return decodeURIComponent(s.replace(a, " ")); },
            q = input;

        while (e = r.exec(q))
            nameValuePairs[d(e[1])] = d(e[2]);

        return nameValuePairs;
    },

    GetAbsoluteURL: function() {
        var currentUrl = location.href.toString();
        if (currentUrl.toLowerCase().indexOf(res.SECURESERVER.toLowerCase()) >= 0) {
            return res.SECURESERVER;
        }
        else {
            if (typeof (global) != 'undefined') {
                return global.store.storeServer;
            }
            else {
                return "";
            }
        }

    },

    RemoveUTM: function() {
        if (loc.search.includes("utm")) {
            if (window.history.replaceState) {
                history.replaceState({}, '', loc.pathname);
            }
            else {
                loc.hash = '';
            }
        }
    }
};

var urlParams = {};
(function () {
    var e,
        a = /\+/g,  // Regex for replacing addition symbol with a space
        r = /([^&=]+)=?([^&]*)/g,
        d = function (s) { return decodeURIComponent(s.replace(a, " ")); },
        q = window.location.search.substring(1);

    while (e = r.exec(q)) {
        urlParams[d(e[1]).toLowerCase()] = d(e[2]);
    }
})();

/**
 * String.format for JavaScript
 * www.masterdata.se/r/string_format_for_javascript/
 */

var msf = {}; (function () { function B(E) { return (E < 10 ? "0" : "") + E } function D(F) { F = F.toLowerCase(); var E = { name: "en-GB", d: "dd/MM/yyyy", D: "dd MMMM yyyy", t: "HH:mm", T: "HH:mm:ss", M: "d MMMM", Y: "MMMM yyyy", s: "yyyy-MM-ddTHH:mm:ss", _m: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], _d: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], _r: ".", _t: ",", _c: "?,0.00", _ct: ",", _cr: "." }; if (F.substr(0, 2) == "sv") { E.name = "sv-SE"; E.d = "yyyy-MM-dd"; E.D = "den dd MMMM yyyy"; E._m = ["januari", "februari", "mars", "april", "maj", "juni", "juli", "augusti", "september", "oktober", "november", "december"]; E._d = ["s鰊dag", "m錸dag", "tisdag", "onsdag", "torsdag", "fredag", "l鰎dag"]; E._r = ","; E._t = " "; E._ct = "."; E._cr = ","; E._c = "#,0.00 kr" } else { if (F != "en-gb") { E.name = "en-US"; E.t = "hh:mm tt"; E.T = "hh:mm:ss tt"; E.d = "MM/dd/yyyy"; E.D = "MMMM dd, yyyy"; E.Y = "MMMM, yyyy"; E._c = "$#,0.00" } } E.f = E.D + " " + E.t; E.F = E.D + " " + E.T; E.g = E.d + " " + E.t; E.G = E.d + " " + E.T; return E } function C(O, H) { var F = 0, I = -1, K = -1, S = 0, G = 0, J = -1, P = false, M = true, E = [], R, L; function N(U) { for (var T = 0; T < U.length; T++) { E.push(U.charAt(T)); if (S > 1 && S-- % 3 == 1) { E.push(H.t) } } } for (L = 0; L < H.f.length; L++) { R = H.f.charAt(L); if (R == "0" || R == "#") { G += P; if (R == "0") { if (P) { J = G } else { if (I < 0) { I = F } } } F += !P } P = P || R == "." } I = I < 0 ? 1 : F - I; if (O < 0) { E.push("-") } O = (Math.round(Math.abs(O) * Math.pow(10, G)) / Math.pow(10, G)).toString(); K = O.indexOf("."); K = K < 0 ? O.length : K; L = K - F; if (H.f.match(/^[^\.]*[0#],[0#]/)) { S = Math.max(K, I) } for (var Q = 0; Q < H.f.length; Q++) { R = H.f.charAt(Q); if (R == "#" || R == "0") { if (L < K) { if (L >= 0) { if (M) { N(O.substr(0, L)) } N(O.charAt(L)) } else { if (L >= K - I) { N("0") } } M = false } else { if (J-- > 0 || L < O.length) { N(L >= O.length ? "0" : O.charAt(L)) } } L++ } else { if (R == ".") { if (O.length > ++L || J > 0) { E.push(H.r) } } else { if (R !== ",") { E.push(R) } } } } return E.join("") } Number.prototype.__Format = function (F) { var J = Number(this); if (F == "X") { return Math.round(J).toString(16).toUpperCase() } else { if (F == "x") { return Math.round(J).toString(16) } else { var H = { t: msf.LC._t, r: msf.LC._r }; var E = "0.################", I = F ? F.toLowerCase() : null; if (I === null || I == "g") { F = E } else { if (I == "n") { F = "#," + E } else { if (I == "c") { F = msf.LC._c; H.r = msf.LC._cr; H.t = msf.LC._ct } else { if (I == "f") { F = "0.00" } } } } if (F.indexOf(",.") !== -1) { J /= 1000 } if (F.indexOf("%") !== -1) { J *= 100 } var G = F.split(";"); if (J < 0 && G.length > 1) { J *= -1; H.f = G[1] } else { H.f = G[!J && G.length > 2 ? 2 : 0] } return C(J, H) } } }; Date.prototype.__Format = function (F) { var G = this; var H = ""; var E; if (F.length == 1) { F = msf.LC[F] } return F.replace(/(d{1,4}|M{1,4}|yyyy|yy|HH|H|hh|h|mm|m|ss|s|tt)/g, function () { switch (arguments[0]) { case "dddd": return msf.LC._d[G.getDay()]; case "ddd": return msf.LC._d[G.getDay()].substr(0, 3); case "dd": return B(G.getDate()); case "d": return G.getDate(); case "MMMM": return msf.LC._m[G.getMonth()]; case "MMM": return msf.LC._m[G.getMonth()].substr(0, 3); case "MM": return B(G.getMonth() + 1); case "M": return G.getMonth() + 1; case "yyyy": return G.getFullYear(); case "yy": return G.getFullYear().toString().substr(2); case "HH": return B(G.getHours()); case "hh": return B((G.getHours() - 1) % 12 + 1); case "H": return G.getHours(); case "h": return (G.getHours() - 1) % 12 + 1; case "mm": return B(G.getMinutes()); case "m": return G.getMinutes(); case "ss": return B(G.getSeconds()); case "s": return G.getSeconds(); case "tt": return G.getHours() < 12 ? "AM" : "PM"; default: return "" } }) }; String.__Format = function (I, J, E, G) { var F = arguments, H; return I.replace(/(\{*)\{((\d+)(\,(-?\d*))?(\:([^\}]*))?)\}/g, function () { var O = arguments; if (O[1] && O[1].length % 2 == 1) { return O[0] } if ((H = F[parseInt(O[3], 10) + 1]) === undefined) { throw "Missing argument" } var K = H.__Format ? H.__Format(O[7]) : H.toString(); var N = parseInt(O[5], 10) || 0; var L = Math.abs(N) - K.length; if (L > 0) { var M = " "; while (M.length < L) { M += " " } K = N > 0 ? K + M : M + K } return O[1] + K }).replace(/\{\{/g, "{") }; msf.LC = null; msf.setCulture = function (E) { msf.LC = D(E) || D(E.substr(0, 2)) || D() }; msf.setCulture(navigator.systemLanguage || navigator.language || "en-US"); var A = Date.prototype; A.format = A.format || A.__Format; A = Number.prototype; A.format = A.format || A.__Format; String.format = String.format || String.__Format })();

String.prototype.format = function () {
    var output = this;
    var i = 0;

    for (; i < arguments.length; i++) {
        output = output.replace(new RegExp('\\{' + i + '\\}', "g"), arguments[i]);
    }
    return output;
};


function GetAbsoluteURL() {
    return Utility.GetAbsoluteURL();
}


/*
 * Title Caps
 *
 * Ported to JavaScript By John Resig - http://ejohn.org/ - 21 May 2008
 * Original by John Gruber - http://daringfireball.net/ - 10 May 2008
 * License: http://www.opensource.org/licenses/mit-license.php
 */
(function () {
    var small = "(a|an|and|as|at|but|by|en|for|if|in|of|on|or|the|to|v[.]?|via|vs[.]?)";
    var punct = "([!\"#$%&'()*+,./:;<=>?@[\\\\\\]^_`{|}~-]*)";

    this.titleCaps = function (title) {
        var parts = [], split = /[:.;?!] |(?: |^)["Ò]/g, index = 0;

        while (true) {
            var m = split.exec(title);

            parts.push(title.substring(index, m ? m.index : title.length)
                .replace(/\b([A-Za-z][a-z.'Õ]*)\b/g, function (all) {
                    return /[A-Za-z]\.[A-Za-z]/.test(all) ? all : upper(all);
                })
                .replace(RegExp("\\b" + small + "\\b", "ig"), lower)
                .replace(RegExp("^" + punct + small + "\\b", "ig"), function (all, punct, word) {
                    return punct + upper(word);
                })
                .replace(RegExp("\\b" + small + punct + "$", "ig"), upper));

            index = split.lastIndex;

            if (m) parts.push(m[0]);
            else break;
        }

        return parts.join("").replace(/ V(s?)\. /ig, " v$1. ")
            .replace(/(['Õ])S\b/ig, "$1s")
            .replace(/\b(AT&T|Q&A)\b/ig, function (all) {
                return all.toUpperCase();
            });
    };

    function lower(word) {
        return word.toLowerCase();
    }

    function upper(word) {
        return word.substr(0, 1).toUpperCase() + word.substr(1);
    }
})();

function newWindow(img, width, height, left, top) {

    if (img.toLowerCase().indexOf("youtube.com") >= 0 && img.toLowerCase().indexOf("embed") >= 0) {
        $.fancybox.open({
            title: '&nbsp;',
            href: img,
            type: 'iframe',
            maxWidth: 800,
            maxHeight: 600,
            fitToView: false,
            width: '70%',
            height: '70%',
            autoSize: false,
            closeClick: false,
            openEffect: 'elastic',
            closeEffect: 'elastic'
        });
    }
    else {

        if (img.toLowerCase().indexOf(res.IMAGESERVER.toLowerCase()) == -1) {
            img = img.replace("/images/inline/products/", "");
            if (img.indexOf("img=") >= 0) {
                if (img.indexOf(".jpg") >= 0) {
                    img = img.substring(img.indexOf("img=") + 4, img.indexOf(".jpg") + 4);
                }
                if (img.indexOf(".gif") >= 0) {
                    img = img.substring(img.indexOf("img=") + 4, img.indexOf(".gif") + 4);
                }
                if (img.indexOf(".png") >= 0) {
                    img = img.substring(img.indexOf("img=") + 4, img.indexOf(".png") + 4);
                }
            }
            img = res.IMAGESERVER + '/images/inline/products/' + img;
        }

        if (img.toLowerCase().indexOf(".html") >= 0) {
            $.fancybox.open({ href: img, type: 'iframe', title: '&nbsp;', openEffect: 'elastic', closeEffect: 'elastic', width: width, height: height });
        }
        else {
            if (height > 800) {
                $.fancybox.open({ href: img, title: '&nbsp;', openEffect: 'elastic', closeEffect: 'elastic', fitToView: false });
            } else {
                $.fancybox.open({ href: img, title: '&nbsp;', openEffect: 'elastic', closeEffect: 'elastic' });
            }
        }
    }
}

function containsAll(needles, haystack) {
    for (var i = 0, len = needles.length; i < len; i++) {
        if ($.inArray(needles[i], haystack) == -1) return false;
    }
    return true;
}


Array.prototype.clone = function () {
    return $(this).slice(0);
};
Array.prototype.unique = function () {
    for (var a = {}, b = {}, i = 0, n = this.length; i < n; i++) {
        if (typeof (b[this[i]]) != "undefined") continue;
        if (typeof (a[this[i]]) == "undefined") a[this[i]] = 1;
        //else { b[this[i]] = 1; delete a[this[i]] }
    }
    this.length = 0;
    for (i in a) this[this.length] = i; return this;
};

var notificationBar = {
    show: function(message) {
        var self = this;
        if (arguments[1] !== undefined ) {
            var delay = arguments[1];

            window.setTimeout(function() {
                self.hide();
            }, delay);
        }
        $("#notification-bar > div").html(message).parent().addClass("show");
    },

    hide: function() {
        $("#notification-bar").removeClass("show");
    },

    init: function() {
        var self = this;
        $("#notification-bar .close").click(function(e) {
            e.preventDefault();
            self.hide();
        })
    }
};
;
jQuery.fn.extend({
	pressEnter: function (callback) {
		this.keypress(function (e) {
			if (e.which == "13") callback();
		});
		return this;
	},
	pressNavigationUp: function (callback) {
		this.keyup(function (e) {
			if (e.which == "38") callback();
		});
		return this;
	},
	pressNavigationDown: function (callback) {
		this.keyup(function (e) {
			if (e.which == "40") callback();
		});
		return this;
	},
	pressEscape: function (callback) {
		this.keyup(function (e) {
			if (e.which == "27") callback();
		});
		return this;
	},
	pressKey: function (callback) {
		this.keyup(function (e) {
			if (e.which != "13" && e.which != "27" && e.which != "38" && e.which != "40") callback();
		});
		return this;
	},
});

var SEARCHPRODUCTS,
	eStoreSearch =
	{
		ProductData: null,
		SearchProduct: new Array(),
		CategoryKeywords: new Array(),
		SearchResults: [],
		DisplayCount: 0,
		CurrentId: -1,
		ProductUrl: '',
		bAbove: false,
		CountLimit: 14,

		init: function () {
			var self = this;
			$('#searchform').submit(function () { return false });

			var injectHtml = res.txt_searchneedhelp.replace(/\{rooturl\}+/g, res.NORMALSTORESERVER);
			injectHtml = injectHtml.replace('javascript:$zopim.livechat.window.show();', '#');
			$("#global-search .search-need-help").html(injectHtml);

			if (global.store.livechatenabled == "0") {
				$("#needHelpResult .help-livechat,#needHelpResult .help-faq").remove();
			}
			this.EventClick();
			this.RegEvent();
			this.EventSearch();

			$.getJSON('/search', function (response) {
				SEARCHPRODUCTS = response;
				self.loadData();
			});
		},
		loadData: function () {
			if (this.ProductData == null && typeof (SEARCHPRODUCTS) != 'undefined') {
				var removeProduct = function (prodList) {
					if (prodList.C != PIECEPART && !PRODUCTEXCLUDE.includes(prodList.M))
						return prodList
				}
				const PRODUCTEXCLUDE = [20271, 20272, 20370, 22501, 22390, 20396, 23860, 23861, 23862, 23904, 23905, 23906, 23907]		// Old products ID to remove
				const STOREEXCLUDE = [7, 8, 9, 10, 11, 12, 37, 39, 41]
				const PIECEPART = 1214
				const NEWPRODLIST = SEARCHPRODUCTS.Products.filter(removeProduct)

				this.ProductData = STOREEXCLUDE.includes(global.store.id) ? NEWPRODLIST : SEARCHPRODUCTS.Products;
				this.CategoryKeywords = SEARCHPRODUCTS.Keywords;
			}
			if (this.ProductData == null && typeof (SEARCHPRODUCTS) == 'undefined') {
				this.ProductData = [];
				this.CategoryKeywords = [];
			}
		},
		EventClick: function () {
			var self = this;
			$("#search-keywords").pressEnter(function () {
				if (self.ProductUrl != 'undefined' && self.ProductUrl != '') {
					window.location = self.ProductUrl;
				}
				return false;
			});
		},
		EventSearch: function () {
			var self = this;

			$("#search-keywords")
				.on('pressEscape', function () {
					$('#global-search #btn-close-search').trigger('click');
				})
				.pressKey(function () {
					var keyword = $("#search-keywords").val();
					if (keyword.length) {
						$("#needHelpResult").hide();
						$("#searchResult").show();
						self.EnterSearch(keyword);
					}
					else {
						$("#needHelpResult").show();
						$("#searchResult").hide();
					}
				})
				.on('focus', function () {
					var keyword = $("#search-keywords").val();
					if (!keyword.length) {
						$("#searchResult").hide();
						$("#needHelpResult").show();
					}
				})
		},
		KeyFilter: function (s) {
			s = s.replace(/\(|\)/g, "");
			return s.replace(/[^a-zA-Z0-9\u4E00-\u9FA5]*$/, '');
		},
		KeyFilter4SpecialChars: function (s) {
			return s.replace(/\s|[-+*&^%$#@!~<>\[\]{}()]/g, "");
		},
		CheckProduct: function (searchProduct, productId) {
			for (var i = 0; i < searchProduct.length; i++) {
				if (searchProduct[i] == productId) {
					return true;
				}
			}
			return false;
		},
		LoadProduct: function (Item, ImgServer, Key, DisplayCount) {
			var txt = Item.H2 == '' ? this.htmlDecode(Item.Te) : this.htmlDecode(Item.H2);
			txt = txt.replace(new RegExp(Key, "gi"), "<span class='highlight'>" + Key + "</span>");
			var purl = res.NORMALSTORESERVER + "/go/p/" + Item.C + "/" + Item.I;
			var pImgName = Item.M;

			//if is sxfi air on tw, show black version
			if (pImgName == 23271 && global.store.id == 29) {
				pImgName = 23273;
			}

			//	$("#searchResult #searchproductlist #plscroll").append(
			this.SearchResults.push({
				'productId': Item.M,
				'category': Item.C,
				'html': '<div class="searchResultProductItem col-xs-6 col-sm-4 col-md-3 col-lg-3" id="searchProductItem_' + (DisplayCount + 1) + '">\
				<div class="pimg">' +
					'<a data-productid="' + Item.M + '" data-productname="' + Item.N + '" data-pos="' + (DisplayCount + 1) + '" data-listname="Search Results" data-brand="Creative" href="' + purl + '" onclick="return TrackSearchResultClick(this)"><img src="' + ImgServer + '/images/products/large/pdt_' + pImgName + '.png?width=200&height=200" class="center-block img-responsive"></a>\
				</div>' +
					'<div class="ptext">\
					<span class="title">\
						<a data-productid="' + Item.M + '" data-productname="' + Item.N + '" data-pos="' + (DisplayCount + 1) + '" data-listname="Search Results" data-brand="Creative" href="' + purl + '" onclick="return TrackSearchResultClick(this)">' + Item.N.replace(new RegExp(Key, "gi"), "<span class='highlight'>" + Key + "</span>") + '</a></span>' +
					(Item.MN && Item.MN.length > 0 ? '<span class="model-number">' + Item.MN + '</span>' : '') +
					'<span class="detail">\
						<a data-productid="' + Item.M + '" data-productname="' + Item.N + '" data-pos="' + (DisplayCount + 1) + '" data-listname="Search Results" data-brand="Creative" href="' + purl + '" onclick="return TrackSearchResultClick(this)">' + txt + '</a></span>\
				</div>\
			</div>'
			});
			//);
		},
		ShowSearchProducts: function () {
			if (this.SearchResults && this.SearchResults.length > 0) {
				var html = '';
				// show normal product first
				for (var i = 0; i < this.SearchResults.length; i++) {
					if (this.SearchResults[i].category != 1091) {
						html += this.SearchResults[i].html;
					}
				}
				// show archived product after normal product
				for (var i = 0; i < this.SearchResults.length; i++) {
					if (this.SearchResults[i].category == 1091) {
						html += this.SearchResults[i].html;
					}
				}
				$("#searchResult #searchproductlist #plscroll").append(html);
			}
		},
		SearchCategoryKey: function (keyword) {
			if (this.DisplayCount <= this.CountLimit) {
				var categoryID = 0;
				var regKey = new RegExp(this.KeyFilter(this.KeyFilter4SpecialChars(keyword)), "gi");
				for (var i = 0; i < this.CategoryKeywords.length && this.DisplayCount <= this.CountLimit; i++) {
					var ckeywords = this.CategoryKeywords[i].Keywords;
					if (ckeywords != null && ckeywords != '') {
						if (this.KeyFilter4SpecialChars(ckeywords).search(regKey) >= 0) {
							categoryID = this.CategoryKeywords[i].CID;
							break;
						}
					}
				}
				if (categoryID > 0) {
					for (var i = 0; i < this.ProductData.length && this.DisplayCount <= this.CountLimit; i++) {
						if (!this.CheckProduct(this.SearchProduct, this.ProductData[i].I) &&
							this.ProductData[i].C == categoryID) {
							this.SearchProduct.push(this.ProductData[i].I);
							this.LoadProduct(this.ProductData[i], res.IMAGESERVER, keyword, this.DisplayCount);
							this.DisplayCount++;
						}
					}
				}
			}
		},
		SearchKey: function (keyword, searchType) {
			if (searchType == 2) {
				keyword = this.KeyFilter4SpecialChars(keyword);
			}
			var regKey = new RegExp(this.KeyFilter(keyword), "gi");

			for (var i = 0; i < this.ProductData.length && this.DisplayCount <= this.CountLimit; i++) {
				var pname = this.ProductData[i].N;
				if (searchType == 2) {
					pname = this.KeyFilter4SpecialChars(pname);
				}
				if (!this.CheckProduct(this.SearchProduct, this.ProductData[i].I) &&
					pname.search(regKey) >= 0) {
					this.SearchProduct.push(this.ProductData[i].I);
					this.LoadProduct(this.ProductData[i], res.IMAGESERVER, keyword, this.DisplayCount);
					this.DisplayCount++;
				}
			}

			for (var i = 0; i < this.ProductData.length && this.DisplayCount <= this.CountLimit; i++) {
				var ptag = this.ProductData[i].Ta;
				if (searchType == 2) {
					ptag = this.KeyFilter4SpecialChars(ptag);
				}
				if (!this.CheckProduct(this.SearchProduct, this.ProductData[i].I) &&
					ptag.search(regKey) >= 0) {
					this.SearchProduct.push(this.ProductData[i].I);
					this.LoadProduct(this.ProductData[i], res.IMAGESERVER, keyword, this.DisplayCount);
					this.DisplayCount++;
				}
			}
			for (var i = 0; i < this.ProductData.length && this.DisplayCount <= this.CountLimit; i++) {
				var ptext = this.ProductData[i].H2;
				if (searchType == 2 && ptext != null && ptext.length > 0) {
					ptext = this.KeyFilter4SpecialChars(ptext);
				}
				if (ptext != null && ptext.length > 0 && !this.CheckProduct(this.SearchProduct, this.ProductData[i].I) &&
					ptext.search(regKey) >= 0) {
					this.SearchProduct.push(this.ProductData[i].I);
					this.LoadProduct(this.ProductData[i], res.IMAGESERVER, keyword, this.DisplayCount);
					this.DisplayCount++;
				}
			}
			for (var i = 0; i < this.ProductData.length && this.DisplayCount <= this.CountLimit; i++) {
				var ptext = this.ProductData[i].Te;
				if (searchType == 2) {
					ptext = this.KeyFilter4SpecialChars(ptext);
				}
				if (!this.CheckProduct(this.SearchProduct, this.ProductData[i].I) &&
					ptext.search(regKey) >= 0) {
					this.SearchProduct.push(this.ProductData[i].I);
					this.LoadProduct(this.ProductData[i], res.IMAGESERVER, keyword, this.DisplayCount);
					this.DisplayCount++;
				}
			}
		},
		SmartSearch: function (keyWords, stype) {
			var keyWordArray = this.KeywordSplit(keyWords);
			for (var i = 0; i < keyWordArray.length; i++) {
				if (keyWordArray[i] != "")
					this.SearchKey(keyWordArray[i], stype);
			}
		},
		ErrorSearch: function (key) {
			res.SearchNoResults = res.SearchNoResults.replace(/\$root/g, res.NORMALSTORESERVER);
			if (key.length > 18) {
				key = key.substring(0, 16) + '...';
			}
			var errorHtml = '<div class="searchResultError col-xs-12">' +
				res.SearchNoResults +
				'</div>';
			var closeHtml = '<table class="closetable"><tr><td>' +
				'<h2>' + res.SearchResults + '</h2>' +
				'<p>' + String.format(res.SearchNoResultsText.replace("F66c11", "0cbdef"), key) + '</p>' +
				'<p>' + res.SearchNoResultsTip + '</p>' +
				'</td></tr></table>';
			$("#searchclose").html(closeHtml);
			$("#searchproductlist #plscroll").html(errorHtml);
		},
		LoadingSearch: function (key) {
			$("#searchclose").html("&nbsp;");
			$("#searchproductlist  #plscroll").html('<div class="loading"><div>' + res.SearchLoading + '</div><div>' + String.format(res.SearchingTip, key) + '</div></div>');
		},
		GetSearchResult: function (key) {
			this.loadData();
			var reslut = new Array();
			if (this.ProductData != null && this.ProductData.length > 0) {
				key = key.replace(/^\s|[*.<>]/g, '');

				this.DisplayCount = 0;
				this.SearchProduct = new Array();

				this.SearchCategoryKey(key);
				this.SearchKey(key, 1);
				this.SmartSearch(key, 1);
				this.SearchKey(key, 2);
				this.SmartSearch(key, 2);

				for (var i = 0; i < this.SearchProduct.length; i++) {
					for (var p = 0; p < this.ProductData.length; p++) {
						if (this.SearchProduct[i] == this.ProductData[p].I) {
							reslut.push(this.ProductData[p]);
							break;
						}
					}
				}
			}
			return reslut;
		},
		EnterSearch: function (key) {
			if (this.ProductData != null && this.ProductData.length > 0) {
				key = key.replace(/\*/ig, "");
				// key = key.replace(/\./ig, "");
				key = key.replace(/\</ig, "");
				key = key.replace(/\>/ig, "");
				key = key.replace(/^\s+|\s+$/g, '');
				this.LoadingSearch(key);
				this.ProductUrl = '';
				this.CurrentId = -1;
				$("#searchproductlist  #plscroll").html('');
				this.DisplayCount = 0;
				this.SearchProduct = new Array();
				this.SearchResults = [];

				this.SearchCategoryKey(key);
				this.SearchKey(key, 1);

				this.SmartSearch(key, 1);
				this.SearchKey(key, 2);
				this.SmartSearch(key, 2);
				this.ShowSearchProducts();
				if (key.length > 18) {
					key = key.substring(0, 16) + '...';
				}
				var closeHtml = '<table class="closetable"><tr><td>' +
					'<h2>' + res.SearchResults + '</h2>' +
					'<p>' + String.format(res.SearchDisplaying.replace("F66c11", "0cbdef"), this.DisplayCount, key) + '</p>' +
					'</td><td width="90"><a class="cancel-search i-cross" href="javascript:eStoreSearch.CancelSearch();">' + res.SearchCancel + '</a></td></tr></table>';
				$("#searchclose").html(closeHtml);

				this.RegEvent();

				if (this.DisplayCount <= 0) {
					this.ErrorSearch(key);
				}
			}
			else {
				this.ErrorSearch(key);
			}
			if (this.ProductData == null) {
				this.LoadingSearch(key);
			}
		},
		CancelSearch: function () {
			$("#searchResult").hide();
			$('#search-keywords').val('').focus();
		},
		RegEvent: function () {
			var self = this;

			$("#searchproductlist .searchResultProductItem").hover(function () {
				self.ProductUrl = '';
				$(".searchResultProductItem").removeClass("searchResultSelectProduct");
				$(this).addClass("searchResultSelectProduct");
			}, function () {
				$(this).removeClass("searchResultSelectProduct");
			});
		},
		htmlEncode: function (value) {
			return $('<div/>').text(value).html();
		},
		htmlDecode: function (value) {
			return $('<div/>').html(value).text();
		},
		KeywordSplit: function (keyWords) {
			var keyWordArray = null;
			if (typeof keyWords == "string")
				keyWordArray = keyWords.split(" ");
			else if (jQuery.isArray(keyWords))
				keyWordArray = keyWords;

			for (var i = 0; i < keyWordArray.length; i++) {
				var kewWord = keyWordArray[i];
				for (var j = keyWordArray.length - 1; j > i; j--) {
					if (kewWord == keyWordArray[j])
						keyWordArray.splice(j, 1);
				}
			}
			return keyWordArray;
		},
	};


function TrackSearchResultClick(e) {
	var listName = $(e).data("listname");
	var productID = $(e).data("productid");
	var productName = $(e).data("productname");
	var pos = $(this).data("pos");

	if (window.Moengage) {
		Moengage.track_event("Search", {
			"Store Code": global.store.storeCode,
			"Keyword": $("#search-keywords").val(),
			"Clicked Product": productName
		}).then(x => {
			return;
		});
	}
}
;
/*
CryptoJS v3.1.2
code.google.com/p/crypto-js
(c) 2009-2013 by Jeff Mott. All rights reserved.
code.google.com/p/crypto-js/wiki/License
*/
var CryptoJS=CryptoJS||function(s,p){var m={},l=m.lib={},n=function(){},r=l.Base={extend:function(b){n.prototype=this;var h=new n;b&&h.mixIn(b);h.hasOwnProperty("init")||(h.init=function(){h.$super.init.apply(this,arguments)});h.init.prototype=h;h.$super=this;return h},create:function(){var b=this.extend();b.init.apply(b,arguments);return b},init:function(){},mixIn:function(b){for(var h in b)b.hasOwnProperty(h)&&(this[h]=b[h]);b.hasOwnProperty("toString")&&(this.toString=b.toString)},clone:function(){return this.init.prototype.extend(this)}},
q=l.WordArray=r.extend({init:function(b,h){b=this.words=b||[];this.sigBytes=h!=p?h:4*b.length},toString:function(b){return(b||t).stringify(this)},concat:function(b){var h=this.words,a=b.words,j=this.sigBytes;b=b.sigBytes;this.clamp();if(j%4)for(var g=0;g<b;g++)h[j+g>>>2]|=(a[g>>>2]>>>24-8*(g%4)&255)<<24-8*((j+g)%4);else if(65535<a.length)for(g=0;g<b;g+=4)h[j+g>>>2]=a[g>>>2];else h.push.apply(h,a);this.sigBytes+=b;return this},clamp:function(){var b=this.words,h=this.sigBytes;b[h>>>2]&=4294967295<<
32-8*(h%4);b.length=s.ceil(h/4)},clone:function(){var b=r.clone.call(this);b.words=this.words.slice(0);return b},random:function(b){for(var h=[],a=0;a<b;a+=4)h.push(4294967296*s.random()|0);return new q.init(h,b)}}),v=m.enc={},t=v.Hex={stringify:function(b){var a=b.words;b=b.sigBytes;for(var g=[],j=0;j<b;j++){var k=a[j>>>2]>>>24-8*(j%4)&255;g.push((k>>>4).toString(16));g.push((k&15).toString(16))}return g.join("")},parse:function(b){for(var a=b.length,g=[],j=0;j<a;j+=2)g[j>>>3]|=parseInt(b.substr(j,
2),16)<<24-4*(j%8);return new q.init(g,a/2)}},a=v.Latin1={stringify:function(b){var a=b.words;b=b.sigBytes;for(var g=[],j=0;j<b;j++)g.push(String.fromCharCode(a[j>>>2]>>>24-8*(j%4)&255));return g.join("")},parse:function(b){for(var a=b.length,g=[],j=0;j<a;j++)g[j>>>2]|=(b.charCodeAt(j)&255)<<24-8*(j%4);return new q.init(g,a)}},u=v.Utf8={stringify:function(b){try{return decodeURIComponent(escape(a.stringify(b)))}catch(g){throw Error("Malformed UTF-8 data");}},parse:function(b){return a.parse(unescape(encodeURIComponent(b)))}},
g=l.BufferedBlockAlgorithm=r.extend({reset:function(){this._data=new q.init;this._nDataBytes=0},_append:function(b){"string"==typeof b&&(b=u.parse(b));this._data.concat(b);this._nDataBytes+=b.sigBytes},_process:function(b){var a=this._data,g=a.words,j=a.sigBytes,k=this.blockSize,m=j/(4*k),m=b?s.ceil(m):s.max((m|0)-this._minBufferSize,0);b=m*k;j=s.min(4*b,j);if(b){for(var l=0;l<b;l+=k)this._doProcessBlock(g,l);l=g.splice(0,b);a.sigBytes-=j}return new q.init(l,j)},clone:function(){var b=r.clone.call(this);
b._data=this._data.clone();return b},_minBufferSize:0});l.Hasher=g.extend({cfg:r.extend(),init:function(b){this.cfg=this.cfg.extend(b);this.reset()},reset:function(){g.reset.call(this);this._doReset()},update:function(b){this._append(b);this._process();return this},finalize:function(b){b&&this._append(b);return this._doFinalize()},blockSize:16,_createHelper:function(b){return function(a,g){return(new b.init(g)).finalize(a)}},_createHmacHelper:function(b){return function(a,g){return(new k.HMAC.init(b,
g)).finalize(a)}}});var k=m.algo={};return m}(Math);
(function(s){function p(a,k,b,h,l,j,m){a=a+(k&b|~k&h)+l+m;return(a<<j|a>>>32-j)+k}function m(a,k,b,h,l,j,m){a=a+(k&h|b&~h)+l+m;return(a<<j|a>>>32-j)+k}function l(a,k,b,h,l,j,m){a=a+(k^b^h)+l+m;return(a<<j|a>>>32-j)+k}function n(a,k,b,h,l,j,m){a=a+(b^(k|~h))+l+m;return(a<<j|a>>>32-j)+k}for(var r=CryptoJS,q=r.lib,v=q.WordArray,t=q.Hasher,q=r.algo,a=[],u=0;64>u;u++)a[u]=4294967296*s.abs(s.sin(u+1))|0;q=q.MD5=t.extend({_doReset:function(){this._hash=new v.init([1732584193,4023233417,2562383102,271733878])},
_doProcessBlock:function(g,k){for(var b=0;16>b;b++){var h=k+b,w=g[h];g[h]=(w<<8|w>>>24)&16711935|(w<<24|w>>>8)&4278255360}var b=this._hash.words,h=g[k+0],w=g[k+1],j=g[k+2],q=g[k+3],r=g[k+4],s=g[k+5],t=g[k+6],u=g[k+7],v=g[k+8],x=g[k+9],y=g[k+10],z=g[k+11],A=g[k+12],B=g[k+13],C=g[k+14],D=g[k+15],c=b[0],d=b[1],e=b[2],f=b[3],c=p(c,d,e,f,h,7,a[0]),f=p(f,c,d,e,w,12,a[1]),e=p(e,f,c,d,j,17,a[2]),d=p(d,e,f,c,q,22,a[3]),c=p(c,d,e,f,r,7,a[4]),f=p(f,c,d,e,s,12,a[5]),e=p(e,f,c,d,t,17,a[6]),d=p(d,e,f,c,u,22,a[7]),
c=p(c,d,e,f,v,7,a[8]),f=p(f,c,d,e,x,12,a[9]),e=p(e,f,c,d,y,17,a[10]),d=p(d,e,f,c,z,22,a[11]),c=p(c,d,e,f,A,7,a[12]),f=p(f,c,d,e,B,12,a[13]),e=p(e,f,c,d,C,17,a[14]),d=p(d,e,f,c,D,22,a[15]),c=m(c,d,e,f,w,5,a[16]),f=m(f,c,d,e,t,9,a[17]),e=m(e,f,c,d,z,14,a[18]),d=m(d,e,f,c,h,20,a[19]),c=m(c,d,e,f,s,5,a[20]),f=m(f,c,d,e,y,9,a[21]),e=m(e,f,c,d,D,14,a[22]),d=m(d,e,f,c,r,20,a[23]),c=m(c,d,e,f,x,5,a[24]),f=m(f,c,d,e,C,9,a[25]),e=m(e,f,c,d,q,14,a[26]),d=m(d,e,f,c,v,20,a[27]),c=m(c,d,e,f,B,5,a[28]),f=m(f,c,
d,e,j,9,a[29]),e=m(e,f,c,d,u,14,a[30]),d=m(d,e,f,c,A,20,a[31]),c=l(c,d,e,f,s,4,a[32]),f=l(f,c,d,e,v,11,a[33]),e=l(e,f,c,d,z,16,a[34]),d=l(d,e,f,c,C,23,a[35]),c=l(c,d,e,f,w,4,a[36]),f=l(f,c,d,e,r,11,a[37]),e=l(e,f,c,d,u,16,a[38]),d=l(d,e,f,c,y,23,a[39]),c=l(c,d,e,f,B,4,a[40]),f=l(f,c,d,e,h,11,a[41]),e=l(e,f,c,d,q,16,a[42]),d=l(d,e,f,c,t,23,a[43]),c=l(c,d,e,f,x,4,a[44]),f=l(f,c,d,e,A,11,a[45]),e=l(e,f,c,d,D,16,a[46]),d=l(d,e,f,c,j,23,a[47]),c=n(c,d,e,f,h,6,a[48]),f=n(f,c,d,e,u,10,a[49]),e=n(e,f,c,d,
C,15,a[50]),d=n(d,e,f,c,s,21,a[51]),c=n(c,d,e,f,A,6,a[52]),f=n(f,c,d,e,q,10,a[53]),e=n(e,f,c,d,y,15,a[54]),d=n(d,e,f,c,w,21,a[55]),c=n(c,d,e,f,v,6,a[56]),f=n(f,c,d,e,D,10,a[57]),e=n(e,f,c,d,t,15,a[58]),d=n(d,e,f,c,B,21,a[59]),c=n(c,d,e,f,r,6,a[60]),f=n(f,c,d,e,z,10,a[61]),e=n(e,f,c,d,j,15,a[62]),d=n(d,e,f,c,x,21,a[63]);b[0]=b[0]+c|0;b[1]=b[1]+d|0;b[2]=b[2]+e|0;b[3]=b[3]+f|0},_doFinalize:function(){var a=this._data,k=a.words,b=8*this._nDataBytes,h=8*a.sigBytes;k[h>>>5]|=128<<24-h%32;var l=s.floor(b/
4294967296);k[(h+64>>>9<<4)+15]=(l<<8|l>>>24)&16711935|(l<<24|l>>>8)&4278255360;k[(h+64>>>9<<4)+14]=(b<<8|b>>>24)&16711935|(b<<24|b>>>8)&4278255360;a.sigBytes=4*(k.length+1);this._process();a=this._hash;k=a.words;for(b=0;4>b;b++)h=k[b],k[b]=(h<<8|h>>>24)&16711935|(h<<24|h>>>8)&4278255360;return a},clone:function(){var a=t.clone.call(this);a._hash=this._hash.clone();return a}});r.MD5=t._createHelper(q);r.HmacMD5=t._createHmacHelper(q)})(Math);
;
//================================ VARS ===================================//
var console = console || { log: function () { } },// Fix IE issues.

    // Global vars - in order to avoid naming conflicts.
    // You can place your vars here if it is needed on every pages.
    // If your var is needed on a few pages only, then you can create another specific shared object container.
    g = {
        liveChatEnabled: window.hasOwnProperty('$zopim'),
        winWidth: $(window).width(),
        windowFormat: '',
        openMenu: null,
        eventTrack: function (category, action, label) {
            if (typeof dataLayer === 'object') {
                dataLayer.push({ 'event': 'click', 'eventCategory': category, 'eventAction': action, 'eventLabel': label });
                // console.log(category + "," + action + "," + label);
            }
        }
    };
//=========================================================================//



//=========================================================================//
//=========================== DOCUMENT READY ==============================//
//!\ Shared behavior only!
//   Everything you put here should be common to all the pages.
//   If you want to add a function for a specific page, trigger your function from initPage().

$(document).ready(function () {
    g.windowFormat = g.winWidth > 1000 ? 'large' : (g.winWidth > 480 ? 'medium' : 'small');
    $('html').addClass(g.windowFormat + '-screen');

    initCart();
    initAccount();

    // $.accountSignup.open();


    // Don't load on _blank page (using _blank.cshtml template).
    if ($('#all').length) {
        initAuthentication();
        notificationBar.init();
        eStoreSearch.init();
        if (window.location.host === 'en.stage2.creative.com' ||
            window.location.host === 'gr.stage2.creative.com') {
            $.ajax({
                url: "https://api.dev.creative.com/creative-ai/api/v1/test2",
                success: function (result) {
                    eStoreTranslate.init();
                },
                error: function (result) {
                    console.log("Failed to connect to Creative VPN")
                }
            });
        }

        if (g.liveChatEnabled) initLiveChat();

        initTracking();

        if (location.hash.length > 2) openMenuFromHash();

        // Lazyload img with a 'data-original' attribute.
        do_lazy();

        // Any shared event-triggered behavior.
        bindEvents();

        // You can trigger some specific page functions from there.
        initPage();
    }

    // if ('serviceWorker' in navigator) {
    //     navigator.serviceWorker.register('/sw.js').then(function(reg) {main
    //         console.log('ServiceWorker registration successful with scope: ', reg.scope);
    //     }, function(err) {
    //         console.log('ServiceWorker registration failed: ', err);
    //     })
    // }

    $('#product-menu .work-solutions .menu-items a').click(function (e) {
        $('#product-menu a.close').click()
    })

    //Country Selector
    var defaultCountry = "";
    var inputWidth = "";

    var obj_Product = function(id, value) {
        var _this = {};
        _this.id = id;
        _this.value = value;
        return _this;
    };

    var countryArray = [];
    countryArray.push(obj_Product("93,1,2", "Afghanistan"));
    countryArray.push(obj_Product("355,1,3", "Albania"));
    countryArray.push(obj_Product("213,1,2", "Algeria"));
    countryArray.push(obj_Product("376,7,3", "Andorra"));
    countryArray.push(obj_Product("244,1,2", "Angola"));
    countryArray.push(obj_Product("101,1,1", "Anguilla"));
    countryArray.push(obj_Product("102,1,1", "Antigua"));
    countryArray.push(obj_Product("54,1,1", "Argentina"));
    countryArray.push(obj_Product("374,8,3", "Armenia"));
    countryArray.push(obj_Product("297,1,1", "Aruba"));
    countryArray.push(obj_Product("61,1,2", "Australia"));
    countryArray.push(obj_Product("43,2,3", "Austria"));
    countryArray.push(obj_Product("994,1,2", "Azerbaijan"));
    countryArray.push(obj_Product("103,1,1", "Bahamas"));
    countryArray.push(obj_Product("973,1,2", "Bahrain"));
    countryArray.push(obj_Product("880,1,2", "Bangladesh"));
    countryArray.push(obj_Product("104,1,1", "Barbados"));
    countryArray.push(obj_Product("375,8,3", "Belarus"));
    countryArray.push(obj_Product("32,1,3", "Belgium"));
    countryArray.push(obj_Product("501,1,1", "Belize"));
    countryArray.push(obj_Product("229,1,2", "Benin"));
    countryArray.push(obj_Product("105,1,1", "Bermuda"));
    countryArray.push(obj_Product("975,1,2", "Bhutan"));
    countryArray.push(obj_Product("591,1,1", "Bolivia"));
    countryArray.push(obj_Product("387,1,3", "Bosnia"));
    countryArray.push(obj_Product("267,1,2", "Botswana"));
    countryArray.push(obj_Product("55,1,1", "Brazil"));
    countryArray.push(obj_Product("106,1,1", "British Virgin Islands"));
    countryArray.push(obj_Product("673,1,2", "Brunei"));
    countryArray.push(obj_Product("359,1,3", "Bulgaria"));
    countryArray.push(obj_Product("226,1,2", "Burkina Faso"));
    countryArray.push(obj_Product("257,1,2", "Burundi"));
    countryArray.push(obj_Product("237,1,2", "Cameroon"));
    countryArray.push(obj_Product("107,1,1", "Canada"));
    countryArray.push(obj_Product("238,1,2", "Cape Verde Islands"));
    countryArray.push(obj_Product("236,1,2", "Central African Republic"));
    countryArray.push(obj_Product("235,1,2", "Chad"));
    countryArray.push(obj_Product("56,1,1", "Chile"));
    countryArray.push(obj_Product("86,23,2", "China"));
    countryArray.push(obj_Product("672,1,2", "Christmas Island"));
    countryArray.push(obj_Product("6101,1,2", "Cocos-Keeling Islands"));
    countryArray.push(obj_Product("57,1,1", "Colombia"));
    countryArray.push(obj_Product("2691,1,2", "Comoros"));
    countryArray.push(obj_Product("242,1,2", "Congo"));
    countryArray.push(obj_Product("243,1,2", "Congo, Democratic Republic of the"));
    countryArray.push(obj_Product("506,1,1", "Costa Rica"));
    countryArray.push(obj_Product("385,1,3", "Croatia"));
    countryArray.push(obj_Product("53,1,1", "Cuba"));
    countryArray.push(obj_Product("357,1,3", "Cyprus"));
    countryArray.push(obj_Product("420,10,3", "Czech Republic"));
    countryArray.push(obj_Product("45,11,3", "Denmark"));
    countryArray.push(obj_Product("253,1,2", "Djibouti"));
    countryArray.push(obj_Product("109,1,1", "Dominica"));
    countryArray.push(obj_Product("593,1,1", "Ecuador"));
    countryArray.push(obj_Product("20,1,2", "Egypt"));
    countryArray.push(obj_Product("503,1,1", "El Salvador"));
    countryArray.push(obj_Product("240,1,2", "Equatorial Guinea"));
    countryArray.push(obj_Product("291,1,2", "Eritrea"));
    countryArray.push(obj_Product("372,1,3", "Estonia"));
    countryArray.push(obj_Product("251,1,2", "Ethiopia"));
    countryArray.push(obj_Product("500,1,1", "Falkland Islands"));
    countryArray.push(obj_Product("298,1,3", "Faroe Islands"));
    countryArray.push(obj_Product("679,1,2", "Fiji Islands"));
    countryArray.push(obj_Product("358,13,3", "Finland"));
    countryArray.push(obj_Product("389,1,3", "Former Yugoslav Republic of Macedonia"));
    countryArray.push(obj_Product("33,4,3", "France"));
    countryArray.push(obj_Product("594,1,1", "French Guiana"));
    countryArray.push(obj_Product("689,1,2", "French Polynesia"));
    countryArray.push(obj_Product("241,1,2", "Gabon"));
    countryArray.push(obj_Product("220,1,2", "Gambia"));
    countryArray.push(obj_Product("995,1,3", "Georgia"));
    countryArray.push(obj_Product("49,2,3", "Germany"));
    countryArray.push(obj_Product("233,1,2", "Ghana"));
    countryArray.push(obj_Product("350,1,3", "Gibraltar"));
    countryArray.push(obj_Product("30,1,3", "Greece"));
    countryArray.push(obj_Product("299,1,3", "Greenland"));
    countryArray.push(obj_Product("111,1,1", "Grenada"));
    countryArray.push(obj_Product("590,1,1", "Guadeloupe"));
    countryArray.push(obj_Product("124,1,1", "Guam"));
    countryArray.push(obj_Product("502,1,1", "Guatemala"));
    countryArray.push(obj_Product("224,1,2", "Guinea"));
    countryArray.push(obj_Product("245,1,2", "Guinea-Bissau"));
    countryArray.push(obj_Product("592,1,1", "Guyana"));
    countryArray.push(obj_Product("509,1,1", "Haiti"));
    countryArray.push(obj_Product("7002,1,3", "Herzegovina"));
    countryArray.push(obj_Product("504,1,1", "Honduras"));
    countryArray.push(obj_Product("852,101,2", "Hong Kong SAR, PRC"));
    countryArray.push(obj_Product("36,1,3", "Hungary"));
    countryArray.push(obj_Product("354,1,3", "Iceland"));
    countryArray.push(obj_Product("91,1,2", "India"));
    countryArray.push(obj_Product("62,1,2", "Indonesia"));
    countryArray.push(obj_Product("98,1,2", "Iran"));
    countryArray.push(obj_Product("964,1,2", "Iraq"));
    countryArray.push(obj_Product("353,1,3", "Ireland"));
    countryArray.push(obj_Product("972,1,2", "Israel"));
    countryArray.push(obj_Product("39,5,3", "Italy"));
    countryArray.push(obj_Product("112,1,1", "Jamaica"));
    countryArray.push(obj_Product("81,24,2", "Japan"));
    countryArray.push(obj_Product("962,1,2", "Jordan"));
    countryArray.push(obj_Product("705,1,2", "Kazakhstan"));
    countryArray.push(obj_Product("254,1,2", "Kenya"));
    countryArray.push(obj_Product("686,1,2", "Kiribati Republic"));
    countryArray.push(obj_Product("850,1,2", "Korea (North)"));
    countryArray.push(obj_Product("82,1,2", "Korea (Republic of)"));
    countryArray.push(obj_Product("965,1,2", "Kuwait"));
    countryArray.push(obj_Product("706,1,2", "Kyrgyz Republic"));
    countryArray.push(obj_Product("856,1,2", "Laos"));
    countryArray.push(obj_Product("371,1,3", "Latvia"));
    countryArray.push(obj_Product("961,1,2", "Lebanon"));
    countryArray.push(obj_Product("266,1,2", "Lesotho"));
    countryArray.push(obj_Product("231,1,2", "Liberia"));
    countryArray.push(obj_Product("218,1,2", "Libya"));
    countryArray.push(obj_Product("4175,2,3", "Liechtenstein"));
    countryArray.push(obj_Product("370,1,3", "Lithuania"));
    countryArray.push(obj_Product("352,4,3", "Luxembourg"));
    countryArray.push(obj_Product("261,1,2", "Madagascar"));
    countryArray.push(obj_Product("265,1,2", "Malawi"));
    countryArray.push(obj_Product("60,1,2", "Malaysia"));
    countryArray.push(obj_Product("960,1,2", "Maldives"));
    countryArray.push(obj_Product("223,1,2", "Mali"));
    countryArray.push(obj_Product("356,1,3", "Malta"));
    countryArray.push(obj_Product("692,1,2", "Marshall Islands"));
    countryArray.push(obj_Product("596,1,1", "Martinique"));
    countryArray.push(obj_Product("222,1,2", "Mauritania"));
    countryArray.push(obj_Product("230,1,2", "Mauritius"));
    countryArray.push(obj_Product("269,1,2", "Mayotte Island"));
    countryArray.push(obj_Product("52,1,1", "Mexico"));
    countryArray.push(obj_Product("691,1,2", "Micronesia, Federated States of"));
    countryArray.push(obj_Product("373,1,3", "Moldova"));
    countryArray.push(obj_Product("377,4,3", "Monaco"));
    countryArray.push(obj_Product("976,1,2", "Mongolia"));
    countryArray.push(obj_Product("382,1,3", "Montenegro"));
    countryArray.push(obj_Product("113,1,1", "Montserrat"));
    countryArray.push(obj_Product("212,1,2", "Morocco"));
    countryArray.push(obj_Product("258,1,2", "Mozambique"));
    countryArray.push(obj_Product("95,1,2", "Myanmar"));
    countryArray.push(obj_Product("264,1,2", "Namibia"));
    countryArray.push(obj_Product("977,1,2", "Nepal"));
    countryArray.push(obj_Product("31,3,3", "Netherlands"));
    countryArray.push(obj_Product("599,1,1", "Netherlands Antilles"));
    countryArray.push(obj_Product("687,1,2", "New Caledonia"));
    countryArray.push(obj_Product("64,1,2", "New Zealand"));
    countryArray.push(obj_Product("505,1,1", "Nicaragua"));
    countryArray.push(obj_Product("227,1,2", "Niger"));
    countryArray.push(obj_Product("234,1,2", "Nigeria"));
    countryArray.push(obj_Product("683,1,2", "Niue"));
    countryArray.push(obj_Product("6722,1,2", "Norfolk Island"));
    countryArray.push(obj_Product("47,14,3", "Norway"));
    countryArray.push(obj_Product("968,1,2", "Oman"));
    countryArray.push(obj_Product("92,1,2", "Pakistan"));
    countryArray.push(obj_Product("680,1,2", "Palau"));
    countryArray.push(obj_Product("507,1,1", "Panama"));
    countryArray.push(obj_Product("675,1,2", "Papua New Guinea"));
    countryArray.push(obj_Product("595,1,1", "Paraguay"));
    countryArray.push(obj_Product("51,1,1", "Peru"));
    countryArray.push(obj_Product("63,1,2", "Philippines"));
    countryArray.push(obj_Product("48,6,3", "Poland"));
    countryArray.push(obj_Product("351,15,3", "Portugal"));
    countryArray.push(obj_Product("121,1,1", "Puerto Rico"));
    countryArray.push(obj_Product("974,1,2", "Qatar"));
    countryArray.push(obj_Product("262,1,2", "Reunion Island"));
    countryArray.push(obj_Product("40,1,3", "Romania"));
    countryArray.push(obj_Product("7,8,3", "Russia"));
    countryArray.push(obj_Product("250,1,2", "Rwanda"));
    countryArray.push(obj_Product("7001,4,3", "Saint Barthelemy"));
    countryArray.push(obj_Product("114,1,1", "Saint Kitts & Nevis Anguilla"));
    countryArray.push(obj_Product("122,1,1", "Saint Lucia"));
    countryArray.push(obj_Product("721,4,3", "Saint Martin"));
    countryArray.push(obj_Product("378,5,3", "San Marino"));
    countryArray.push(obj_Product("239,1,2", "Sao Tome and Principe"));
    countryArray.push(obj_Product("966,1,2", "Saudi Arabia"));
    countryArray.push(obj_Product("221,1,2", "Senegal Republic"));
    countryArray.push(obj_Product("381,1,3", "Serbia"));
    countryArray.push(obj_Product("248,1,2", "Seychelle Islands"));
    countryArray.push(obj_Product("232,1,2", "Sierra Leone"));
    countryArray.push(obj_Product("65,1,2", "Singapore"));
    countryArray.push(obj_Product("421,10,3", "Slovak Republic"));
    countryArray.push(obj_Product("386,1,3", "Slovenia"));
    countryArray.push(obj_Product("677,1,2", "Solomon Islands"));
    countryArray.push(obj_Product("252,1,2", "Somalia"));
    countryArray.push(obj_Product("27,1,2", "South Africa"));
    countryArray.push(obj_Product("34,7,3", "Spain"));
    countryArray.push(obj_Product("94,1,2", "Sri Lanka"));
    countryArray.push(obj_Product("508,1,1", "St. Pierre and Miquelon"));
    countryArray.push(obj_Product("116,1,1", "St. Vincent and the Grenadines"));
    countryArray.push(obj_Product("249,1,2", "Sudan"));
    countryArray.push(obj_Product("597,1,1", "Suriname"));
    countryArray.push(obj_Product("268,1,2", "Swaziland"));
    countryArray.push(obj_Product("46,12,3", "Sweden"));
    countryArray.push(obj_Product("41,1,3", "Switzerland"));
    countryArray.push(obj_Product("963,1,2", "Syria"));
    countryArray.push(obj_Product("886,21,2", "Taiwan"));
    countryArray.push(obj_Product("708,1,2", "Tajikistan"));
    countryArray.push(obj_Product("255,1,2", "Tanzania"));
    countryArray.push(obj_Product("66,104,2", "Thailand"));
    countryArray.push(obj_Product("228,1,2", "Togo"));
    countryArray.push(obj_Product("690,1,2", "Tokelau"));
    countryArray.push(obj_Product("676,1,2", "Tonga"));
    countryArray.push(obj_Product("117,1,1", "Trinidad and Tobago"));
    countryArray.push(obj_Product("90,99,2", "Turkey"));
    countryArray.push(obj_Product("118,1,1", "Turks and Caicos Islands"));
    countryArray.push(obj_Product("380,8,3", "Ukraine"));
    countryArray.push(obj_Product("971,1,2", "United Arab Emirates"));
    countryArray.push(obj_Product("44,1,3", "United Kingdom"));
    countryArray.push(obj_Product("1,1,1", "United States of America"));
    countryArray.push(obj_Product("123,1,1", "United States Virgin Islands"));
    countryArray.push(obj_Product("598,1,1", "Uruguay"));
    countryArray.push(obj_Product("711,1,2", "Uzbekistan"));
    countryArray.push(obj_Product("379,5,3", "Vatican City"));
    countryArray.push(obj_Product("58,1,1", "Venezuela"));
    countryArray.push(obj_Product("84,1,2", "Vietnam"));
    countryArray.push(obj_Product("967,1,2", "Yemen"));
    countryArray.push(obj_Product("260,1,2", "Zambia"));
    countryArray.push(obj_Product("263,1,2", "Zimbabwe"));

    str_country = "";
    const isLayout2024 = (document.querySelector("html").classList.contains("layout-2024"));
    const classCountryItem = (isLayout2024) ? `menu-item` : ``;
    for (var i = 0; i < countryArray.length; i++) {
        str_country += `<li class="${classCountryItem}" data-countryid="${countryArray[i].id}" value="${countryArray[i].value}">${countryArray[i].value}</li>`;
    }

    if (window.document.querySelector("#side-menu") != null) {
        const queryCountryList = (isLayout2024) ? `#side-menu .menu-content .sub-menu[data-id="location-menu"] ul` : `#side-menu .countryselector ul`;
        window.document.querySelector(queryCountryList).innerHTML = str_country;
    }

    if (window.document.querySelector("#global-footer") != null) {
        window.document.querySelector("#global-footer .countryselector ul").innerHTML = str_country;
    }

    var insertData = function() {
        if (global.store.storeCountryID) {
            let countrySelector = "#countrylist1.countryselector ul li,#countrylist2.countryselector ul li";
            let countrySelectorInput = "#countrylist1.countryselector input,#countrylist2.countryselector input";
            if(isLayout2024){
                countrySelector = "#countrylist2.countryselector ul li";
                countrySelectorInput = "#countrylist2.countryselector input";
            }
            $(countrySelector).each(function() {
                if ($(this).data('countryid').indexOf(global.store.storeCountryID + ",") === 0) {
                    $(this).addClass("defaultCountry");
                    defaultCountry = $(this).text();
                    //return false; //break
                }
            })
            $(countrySelectorInput).attr("value", defaultCountry);
            inputWidth = defaultCountry.length + 2;
            $("#countrylist2.countryselector input").attr('size', inputWidth);
        }

        if(!isLayout2024){
            const input1 = document.querySelector('#countrylist1 input');
            input1.addEventListener('keyup', filterFunction1);
            function filterFunction1() {
                let container, filter, li, input_val;
                container = $(this).closest(".countryselector");
                input_val = input1.value.toUpperCase();
  
                li = container.find("ul li");
                li.each(function(i, obj) {
                  if ($(this).text().toUpperCase().indexOf(input_val) > -1) {
                  $(this).show();
                  } else {
                  $(this).hide();
                  }
                });
            };

            function onSelect(val) {
                var selectedCountry = "";
                var value = val;
                selectedCountry = $('#countrylist1.countryselector [value="' + value + '"]').data('countryid');
                if (selectedCountry !== "" && selectedCountry !== undefined) {
                    location.href = GetAbsoluteURL() + "/home/country?id=" + selectedCountry;
                }
            }

            $("#countrylist1.countryselector input").focus(function() {
                $('#countrylist1.countryselector').addClass("focused");
                $(this).closest("#countrylist1.countryselector").find("ul").show();
                $(this).closest("#countrylist1.countryselector").find("ul li").show();
                var list = document.querySelector("#countrylist1.countryselector ul");
                var targetLi = document.querySelector("#countrylist1.countryselector ul li.defaultCountry");
                list.scrollTop = (targetLi.offsetTop - 150);
                $('#countrylist1.countryselector input').attr("value", "");
            });

            $("#countrylist1.countryselector input").blur(function() {
            let that = this;
            setTimeout(function() {
                $('#countrylist1.countryselector').removeClass("focused");
                $('#countrylist1.countryselector ul').scrollTop(0);
                $('#countrylist1.countryselector input').attr("value", defaultCountry);
                $(that).closest("#countrylist1.countryselector").find("ul").hide();
            }, 100);
            });

            $(document).on('mousedown', '#countrylist1.countryselector ul li', function() {
                $(this).closest(".countryselector").find("input").val($(this).text()).blur();
                if (defaultCountry != $(this).text()) {
                    onSelect($(this).text())
                }
            });

            $("#countrylist1.countryselector ul li").hover(
            function(){ $(this).addClass("selected")
            },
            function(){ $(this).removeClass('selected')
            });
        }

        const input2 = document.querySelector('#countrylist2 input');
        input2.addEventListener('keyup', filterFunction2);
        function filterFunction2() {
            let container, filter, li, input_val;
            container = $(this).closest(".countryselector");
            input_val = input2.value.toUpperCase();

            li = container.find("ul li");
            li.each(function(i, obj) {
                if ($(this).text().toUpperCase().indexOf(input_val) > -1) {
                    $(this).show();
                } else {
                    $(this).hide();
                }
            });
        };

        function onSelect2(val) {
            var selectedCountry = "";
            var value = val;
            selectedCountry = $('#countrylist2.countryselector [value="' + value + '"]').data('countryid');
            if (selectedCountry !== "" && selectedCountry !== undefined) {
                location.href = GetAbsoluteURL() + "/home/country?id=" + selectedCountry;
            }
        }

        $("#countrylist2.countryselector input").focus(function() {
            $('html').addClass("no-scroll");
            $('#countrylist2.countryselector').addClass("focused");
            $(this).closest("#countrylist2.countryselector").find("ul").show();
            $(this).closest("#countrylist2.countryselector").find("ul li").show();
            var list = document.querySelector("#countrylist2.countryselector ul");
            var targetLi = document.querySelector("#countrylist2.countryselector ul li.defaultCountry");
            list.scrollTop = (targetLi.offsetTop - 150);
            $('#countrylist2.countryselector input').attr("value", "");
        });

        $("#countrylist2.countryselector input").blur(function() {
            let that = this;
            setTimeout(function() {
                $('html').removeClass("no-scroll");
                $('#countrylist2.countryselector').removeClass("focused");
                $('#countrylist2.countryselector ul').scrollTop(0);
                $('#countrylist2.countryselector input').attr("value", defaultCountry);
                $(that).closest("#countrylist2.countryselector").find("ul").hide();
            }, 100);
        });

        $(document).on('mousedown', '#countrylist2.countryselector ul li', function() {
            $(this).closest(".countryselector").find("input").val($(this).text()).blur();
            if (defaultCountry != $(this).text()) {
                onSelect2($(this).text())
            }
        });

        $("#countrylist2.countryselector ul li").hover(
        function(){
            $(this).addClass("selected")
        },
        function(){
            $(this).removeClass('selected')
        });

    }
    
    const locationMenu = isLayout2024 ? document.querySelector(`#side-menu .sub-menu[data-id="location-menu"]`) : null;

    const countryList1 = document.querySelector('#countrylist1');
    const countryList2 = document.querySelector('#countrylist2');

    if ((isLayout2024 && locationMenu && countryList2) || (countryList1 && countryList2)) {
        insertData();
    }
});
//=========================================================================//
//=========================================================================//

//========================= /!\ WRONG-PLACE STUFF /!\ =====================//
if ($(".floating-sidebar").length) {
    var top = 0;

    top = $('.floating-sidebar').offset().top - parseFloat($('.floating-sidebar').css('marginTop').replace(/auto/, 0));

    $(window).scroll(function (event) {
        var y = $(this).scrollTop();
        var distanceToBottom = $("body").height() - ($(".floating-sidebar").position().top + $(".floating-sidebar").height()) - $("footer").height();

        if (y >= top && distanceToBottom >= 10) {
            $('.floating-sidebar').addClass('fixed');
        }
        else {
            if (distanceToBottom < 10) {
                $('.floating-sidebar').css("margin-top", distanceToBottom + "px");
            }
            else {
                $('.floating-sidebar').css("margin-top", "0px");
                $('.floating-sidebar').removeClass('fixed');
            }
        }
    });
}
//==================== End of /!\ WRONG-PLACE STUFF /!\ ===================//







//=========================================================================//
//=========================== GENERAL FUNCTIONS ===========================//
// Only place here the functions that are common (shared) to multiple pages.

var bindEvents = function () {

    // Alertbox Events

    if (typeof showAlert === 'function' && showAlert()) {
        $('#alert-box-toggle').removeClass("hide");
    }

    if (typeof enableAlertBouncing === 'function' && enableAlertBouncing()) {
        $('#alert-box-toggle').addClass('bounce');
    }

    $('#alert-box-toggle').click(function () {
        if (typeof onAlertBoxOpen === 'function' && !onAlertBoxOpen()) return false;
        if (typeof $(this).data('event-category') !== 'undefined') {
            g.eventTrack($(this).data('event-category'), $(this).data('event-action'), $(this).data('event-label'))
        }
        $('#alert-box-toggle').addClass('open');
    });

    $('#alert-box .close').click(function () {
        if (typeof onAlertBoxClose === 'function' && !onAlertBoxClose()) return false;
        if (typeof $(this).data('event-category') !== 'undefined') {
            g.eventTrack($(this).data('event-category'), $(this).data('event-action'), $(this).data('event-label'))
        }
        $('#alert-box-toggle').removeClass('open bounce');
    });
    // End Alertbox Events

    $(window)
        .on('load resize', function () {
            $(".screenres").html(window.innerWidth);// Bootstrap screen size.

            // Update the screen width class on resize - can be used for convenience.
            g.windowFormat = window.innerWidth > 1000 ? 'large' : (window.innerWidth >= 480 ? 'medium' : 'small');
            $('html').removeClass('small-screen medium-screen large-screen').addClass(g.windowFormat + '-screen');

            onResize();
        })
        .on('keyup', function (e) {
            switch (e.which) {
                case 13: $(this).trigger('keyupEnter'); break;
                case 27: $(this).trigger('keyupEscape'); break;
                case 38: $(this).trigger('keyupUp'); break;
                case 40: $(this).trigger('keyupDown'); break;
                default: $(this).trigger('keyupAny'); break;
            }
        })
        .on('keyupEscape', function (e) {
            if (g.openMenu) $('#' + g.openMenu + ' .close').trigger('click');
            else {
                // Put in this array all the containers that you want to be closable by pressing escape key.
                // Make sure this container contains a .close element to trigger a click on.
                var closableOpenBoxes = [
                    '.review-box:visible',
                    '.open ~ #alert-box',
                    '#modalwindow:visible',
                    '#compare-products.open',
                    '#compare-results.open',
                    '#gallery-container:visible',
                    '#view360.show'
                ];
                $(closableOpenBoxes.join(' .close,') + ' .close').trigger('click');
            }
        })

    $('html')
        // Toggle menus.
        .on('click', function (e) {
            // Close any open menu when clicking outside it - except a click on notification bar.
            if (g.openMenu === 'toc-menu'
                && !$('#' + g.openMenu + ' .toc-menu-inner').is(e.target) && !$('#' + g.openMenu + ' .toc-menu-inner').find(e.target).length)// If the clicked element is not contained in open menu.
            {
                $('#' + g.openMenu + ' > .close').trigger('click');
                return false;
            }
            else if (g.openMenu === 'side-menu'
                && $('.md-select-menu-container').find(e.target).length)// If the clicked element is not contained in open menu.
            {

                return false;
            }
            else if (g.openMenu// If there is an open menu.
                && !$('#' + g.openMenu).is(e.target) && !$('#' + g.openMenu).find(e.target).length// If the clicked element is not contained in open menu.
                && !$('#notification-bar').is(e.target) && !$('#notification-bar').find(e.target).length)// Exclude notification bar clicks.
            {
                $('#' + g.openMenu + ' > .close').trigger('click');
                return false;
            }
        })
        .on('click', '[data-target-id]', function (e) {
            e.stopPropagation();
            e.preventDefault();

            var clickedTargetMenu = $(this).attr('data-target-id'),
                menuToOpen = g.openMenu === clickedTargetMenu ? null : clickedTargetMenu,
                menuToClose = g.openMenu === clickedTargetMenu ? clickedTargetMenu : g.openMenu;


            // First close any open menu.
            if (menuToClose) $('#' + menuToClose + ' > .close').trigger('click');

            // Then open target menu if any.
            if (menuToOpen) {
                $('#all').attr('class', 'blur open-' + menuToOpen);
                if ($(this).is('#main-nav *')) $('html').scrollTop(0);

                if (menuToOpen === 'search-bar') {
                    eStoreSearch.searchBarOpen = true;
                    $("#search-keywords").focus();
                }

                // Update open menu global var.
                g.openMenu = menuToOpen;
            }

            // Toggle no-scroll class.
            if ($('html').hasClass('no-scroll') && !menuToOpen) $('html').removeClass('no-scroll');
            else if ($('#' + menuToOpen).attr('data-prevent-scroll') !== undefined) $('html').addClass('no-scroll');
        })
        .on('click', '.close', function (e) {
            e.preventDefault();

            if ($('#notification-bar').find(this).length) return true;// Don't prevent extra events on that close btn.

            // Close the open menu.
            if ($('#' + g.openMenu).children(this).length || $(this).parents('#gallery-container').length) {

                if ($('#all').hasClass('small-logo')) {
                    $('#all').attr('class', 'small-logo');
                }
                else {
                    $('#all').attr('class', '');
                }


                if (g.openMenu === 'search-bar') {
                    eStoreSearch.searchBarOpen = false;
                    eStoreSearch.CancelSearch();
                    $("#search-keywords").trigger('blur');
                }

                if (location.hash == '#buy' && g.openMenu === 'buy-menu') location.hash = '#buy-menu';

                // Update open menu global var.
                g.openMenu = null;
                $('html').removeClass('no-scroll');
            }
        });

    $(document)
        .on('click', '#signout-link', async function(e) {
        e.preventDefault();
        if (window.Moengage) {
                await Moengage.destroy_session();
            }
                location.replace(e.target.href);
            });

    // Footer accordion menu on mobile.
    $(document)
        .on('click', '.small-screen #global-footer .title', function () {
            $(this)
                .next().stop(true, true).slideToggle(400)
                .parents('ul').toggleClass('open')
                .parents('.footer-section').siblings().find('ul ul').stop(true, true).slideUp(300)
                .parents('ul').removeClass('open');
        });
};

var touchHandler = function (event) {
    var touch = event.hasOwnProperty('changedTouches') ? event.changedTouches[0] : event.originalEvent.changedTouches[0];

    var simulatedEvent = document.createEvent("MouseEvent");
    simulatedEvent.initMouseEvent({
        touchstart: "mousedown",
        touchmove: "mousemove",
        touchend: "mouseup"
    }[event.type], true, true, window, 1,
        touch.screenX, touch.screenY,
        touch.clientX, touch.clientY, false,
        false, false, false, 0, null);

    touch.target.dispatchEvent(simulatedEvent);

    event.preventDefault();
};

var openMenuFromHash = function () {
    var target = '', delay = 0;

    switch (location.hash.replace('#', '')) {
        case 'signin':
        case '/signin':
        case 'register':
        case '/register':
            // First get an email from url like: sth?e=username@domain.ext&whateverElse#signin.
            // Not doing just location.search.match(...)[1] || null cz if match fails it will throw an error.
            var email = (location.search.match(/(?:\?|&)e=(.*?)(?:$|&)/) || [null, null])[1],
                // Get a possible redirect URL to navigate to in case of success.
                redirectLink = (location.search.match(/(?:\?|&)r=(.*?)(?:$|&)/) || [null, null])[1],
                params = {
                    source: 'top',
                    success: function (cartMerged, data) {
                        if (redirectLink) location.href = decodeURIComponent(redirectLink);
                        else {
                            if (data.message && data.message.length > 0) notificationBar.show(data.message, 1000 * 8);
                            $.accountMenu.refresh();
                        }
                    }
                };

            if (email) params.email = email;

            // If email or redirect link is matched open the signup view.
            if (email || redirectLink) $.accountSignup.open(params);

            break;
    }
    if (target) setTimeout(function () { $(target).trigger('click'); }, delay);
};

var initPage = function () {
    // Useful if-then-else alternative to check on conditions to fire off the code snipplets.
    switch (true) {
        // Products category / Newsletter page.
        case ($(".leftnav-container .filter-close").length > 0):
            initProductCategory();
            break;

        case ($(".widget li #print").length > 0):
            initOrderDetailPrint();
            break;

        // Another specific page.
        /*case (whatever your condition to target that page only):
            initThePageBehavior();
            break;*/
    }
};

var onResize = function () {
    switch (true) {
        // Products 3 pane category switching for /Contactus/Corporate Sales, Techincal Assistance page.
        case ($("#LBox1").length):
            resizeCorporate3Pane();
            break;
    }
};

// Products 3 pane category switching for /Contactus/Corporate Sales, Techincal Assistance page.
var resizeCorporate3Pane = function () {
    if (window.innerWidth <= 960) {
        $("#LBox1").attr("size", 1);
        $("#LBox2").attr("size", 1);
        $("#LBox3").attr("size", 5);
    }
    else {
        $("#LBox1").attr("size", 10);
        $("#LBox2").attr("size", 10);
        $("#LBox3").attr("size", 10);
    }
}

var initLiveChat = function () {
    $zopim(function () {
        $zopim.livechat.set({
            language: global.store.language,
            onStatus: function (status) {
                if (status === undefined) status = '';
                $(".livechat-status").html(": " + titleCaps(status));
                global.livechatStatus = titleCaps(status);
            }
        });
    });

    $("html")
        .on("click", '.livechat-link, .help-livechat a', function (e) {
            e.preventDefault();

            if (g.openMenu) $('#' + g.openMenu + ' > .close').trigger('click');
            $zopim.livechat.window.show();
        });

    if (window.location.toString().indexOf('chat=1') > -1) $zopim.livechat.window.show();
};

var initCart = function () {
    $.cartUtility = {
        productImg: function (id) {
            if (typeof StoreImageServer === 'string') {
                return StoreImageServer + "/images/products/large/pdt_" + id + ".png?width=120&height=120";
            }
            else {
                return "https://img.creative.com/images/products/large/pdt_" + id + ".png?width=120&height=120";
            }
        },
        secureUrl: function (path) {
            //if (typeof StoreSecureServer === 'string') {
            //    return StoreSecureServer + path;
            //}
            //else if (typeof res.SECURESERVER === 'string') {
            //    return res.SECURESERVER + path;
            //}
            //else {
            return path;
            //}
        },
        attribute: function (data, type) {

            var result = data.ProductAttributes;

            if (data == null || typeof result != 'object' || result == null) return;

            var userStartSelect = false;

            var productid;

            // if (type != 'PWP' && type != 'FREE') {
            productid = data.ProductID;
            //  }

            for (var i = 0; i < result.length; i++) {
                if (result[i].KeyID === 1) {
                    result[i].Style = 'COLOR';
                }
                else {
                    result[i].Style = 'SELECT';
                }

                for (var v = 0; v < result[i].Attributes.length; v++) {
                    if (result[i].Attributes[v].UserSelected) {
                        userStartSelect = true;
                    }

                    if (type == 'PWP') {

                        var pids = [];

                        for (var p = 0; p < data.ChildProductIDs.length; p++) {
                            var pid = data.ChildProductIDs[p];

                            if (result[i].Attributes[v].ProductIDs.indexOf(pid) >= 0) {
                                pids.push(pid);
                            }
                        }

                        result[i].Attributes[v].ProductIDs = pids;
                    }


                    if (type == 'FREE') {

                        var pids = [];

                        for (var p = 0; p < data.ChildProduct.length; p++) {
                            var pid = data.ChildProduct[p];

                            if (result[i].Attributes[v].ProductIDs.indexOf(pid) >= 0) {
                                pids.push(pid);
                            }
                        }

                        result[i].Attributes[v].ProductIDs = pids;
                    }

                }

                for (var v = 0; v < result[i].Attributes.length; v++) {
                    var productIDs = result[i].Attributes[v].ProductIDs;
                    result[i].Attributes[v].Selected = false;
                    var newid = [];
                    for (var p = 0; p < productIDs.length; p++) {
                        var id = productIDs[p];
                        if (type == 'master') {

                            var child = this.getProduct(data, id);
                            if (child != null) {
                                newid.push(id);
                            }

                        } else {
                            var child = this.getChild(data, id);
                            if (child != null && child.InStock && child.Price > 0) {
                                newid.push(id);
                            }
                        }
                        if (result[i].Attributes[v].UserSelected) {
                            result[i].Attributes[v].Selected = true;
                        }
                        if (!userStartSelect && id === productid) {
                            result[i].Attributes[v].Selected = true;
                        }
                    }
                    result[i].Attributes[v].ProductIDs = newid;
                }
            }

            if (userStartSelect && result.length > 1) {
                for (var i = 1; i < result.length; i++) {
                    var selected = false;
                    for (var v = 0; v < result[i].Attributes.length; v++) {
                        if (result[i].Attributes[v].Selected) {
                            selected = true;
                        }
                    }

                    if (!selected) {

                        var parent = [];
                        for (var v = 0; v < result[i - 1].Attributes.length; v++) {
                            if (result[i - 1].Attributes[v].Selected) {
                                parent = result[i - 1].Attributes[v].ProductIDs;
                            }
                        }

                        for (var v = 0; v < result[i].Attributes.length; v++) {
                            if (result[i].Attributes[v].ProductIDs.indexOf(productid) != -1 &&
                                parent.indexOf(productid) != -1
                            ) {
                                result[i].Attributes[v].Selected = true;
                            }
                        }
                    }
                }

            }

            for (var i = 0; i < result.length; i++) {

                var parentProductIDs = [];

                if (i > 0)
                    for (var v = 0; v < result[i - 1].Attributes.length; v++) {
                        if (result[i - 1].Attributes[v].Selected)
                            parentProductIDs = result[i - 1].Attributes[v].ProductIDs;
                    }

                for (var v = 0; v < result[i].Attributes.length; v++) {
                    var pids = result[i].Attributes[v].ProductIDs;
                    if (pids.length > 0 &&
                        (parentProductIDs.length == 0 || this.compareProduct(pids, parentProductIDs))
                    ) {
                        result[i].Attributes[v].Show = true;
                    }
                    else {
                        result[i].Attributes[v].Show = false;
                    }
                }

            }

            return result;
        },
        getChild: function (data, id) {

            for (var i = 0; i < data.Child.length; i++) {
                if (data.Child[i].ProductID === id) {
                    return data.Child[i];
                }
            }

            return null;
        },
        getProduct: function (master, id) {
            for (var i = 0; i < master.Products.length; i++) {
                if (master.Products[i].ProductID === id) {
                    return master.Products[i];
                }
            }
            return null;
        },
        productSelect: function (data, pid) {
            for (var i = 0; i < data.ProductAttributes.length; i++) {
                for (var v = 0; v < data.ProductAttributes[i].Attributes.length; v++) {
                    if (data.ProductAttributes[i].Attributes[v].ProductIDs.indexOf(pid) >= 0) {
                        data.ProductAttributes[i].Attributes[v].UserSelected = true;
                    }
                }
            }
        },
        clearSelect: function (data) {
            for (var i = 0; i < data.ProductAttributes.length; i++) {
                for (var v = 0; v < data.ProductAttributes[i].Attributes.length; v++) {
                    data.ProductAttributes[i].Attributes[v].UserSelected = false;
                }
            }
        },
        userSelect: function (item, key, value) {
            var nextclear = false;
            for (var i = 0; i < item.ProductAttributes.length; i++) {
                for (var v = 0; v < item.ProductAttributes[i].Attributes.length; v++) {
                    if (nextclear) {
                        item.ProductAttributes[i].Attributes[v].UserSelected = false;
                    }
                    else {
                        var attr = item.ProductAttributes[i].Attributes[v];
                        if (attr.KeyID == key) {
                            item.ProductAttributes[i].Attributes[v].UserSelected = false;
                            if (attr.ID == value) {
                                item.ProductAttributes[i].Attributes[v].UserSelected = true;
                                nextclear = true;
                            }
                        }
                    }
                }
            }

            //  console.log(item.ProductAttributes);
        },
        userSelectGetProduct: function (item, key, value) {

            var parentProduct = [];
            var selectlevel = item.ProductAttributes.length;
            for (var i = 0; i < item.ProductAttributes.length; i++) {
                for (var v = 0; v < item.ProductAttributes[i].Attributes.length; v++) {


                    if (
                        value === item.ProductAttributes[i].Attributes[v].ID ||
                        (item.ProductAttributes[i].Attributes[v].Selected && item.ProductAttributes[i].Attributes[v].KeyID != key)
                    ) {
                        if (i == 0) {
                            for (var p = 0; p < item.ProductAttributes[i].Attributes[v].ProductIDs.length; p++)
                                parentProduct.push(item.ProductAttributes[i].Attributes[v].ProductIDs[p]);
                        }
                        else {

                            var newProduct = [];
                            for (var p = 0; p < item.ProductAttributes[i].Attributes[v].ProductIDs.length; p++) {
                                var pid = item.ProductAttributes[i].Attributes[v].ProductIDs[p];
                                if (parentProduct.indexOf(pid) != -1)
                                    newProduct.push(pid);
                            }
                            parentProduct = newProduct;
                        }

                        selectlevel--;
                    }
                }
                if (key === item.ProductAttributes[i].KeyID) {
                    break;
                }
            }

            if (selectlevel == 0 && parentProduct.length > 0) {
                return parentProduct[0];
            }
            else {
                return 0;
            }
        },
        compareProduct: function (item1, item2) {

            for (var i = 0; i < item1.length; i++) {
                for (var p = 0; p < item2.length; p++) {
                    if (item1[i] === item2[p]) return true;
                }
            }

            return false;
        },
        loadShipConfig: function (data, model) {
            if (data != null) {

                var country = data.CountryID;

                // console.log(country);

                if (country && addressConfig && addressConfig.length > 0) {
                    model.config = addressConfig[0];
                    for (var i = 1; i < addressConfig.length; i++) {
                        if (addressConfig[i].country == country) {
                            model.config = $.extend({}, addressConfig[0], addressConfig[i]);
                            break;
                        }
                    }
                }

                if (data.IsBilling &&
                    model.config &&
                    model.config.billingStates &&
                    model.config.billingStates.length > 0) {
                    data.stateList = model.config.billingStates;
                }
                else if (!data.IsBilling &&
                    model.config &&
                    model.config.shippingStates &&
                    model.config.shippingStates.length > 0) {
                    data.stateList = model.config.shippingStates;
                }
                else {
                    data.stateList = [];
                }

                model.countryList = [];
                if (data.IsBilling && typeof billingCountryList === 'object') {
                    model.countryList = billingCountryList;
                }
                else if (!data.IsBilling && typeof shippingCountryList === 'object') {
                    model.countryList = shippingCountryList;
                }
            }
        }
    };
}

/**
 * @dependencies: initCart().
 * @return void.
 */
var initAccount = function () {
    $.loadCustomer = function (data) {
        $.updateCartCount(data.CartItemCount);

        $.loadAccountMenu(data);
    };

    $.updateCartCount = function (i) {
        if (i > 0) {
            if (i > 99) {
                $("#header-cart-count").text('99+').css({ 'font-size': '8px' });
            } else
                $("#header-cart-count").text(i).css({ 'font-size': '10px' });
        } else {
            $("#header-cart-count").text('');
        }
    };

    $.loadAccountMenu = function (data) {
        $.accountMenu.init(data);
        $("#nav-sign-in, #sidebar-sign-in").click(function (e) {
            e.preventDefault();
            $.accountMenu.toggle();
        });
    };

    $.accountMenu = {
        init: function (data) {
            this.config = $.extend(this.config, data);

            //no need to load html to account menu by default, because load menu will affect page performance
            //when user click 'sign in', the login form will to load automatic.
            //DC - 2016-10-02
            //$("#nav-account-menu .inner").html(this.menuContent());

            this.updateHeader();
            this.message();
            this.addClass();
        },
        updateHeader: function () {

            $("#nav-sign-in .text").text(this.config.LoggedIn ? res.bcMyAccount : res.lb_SignIn).parent().show();
        },
        config: {},
        open: false,
        loaded: false,
        toggle: function () {
            this[this.open ? 'turnOff' : 'turnOn']();
            $('html').scrollTop(0);
        },
        turnOn: function () {
            // console.log("---html---" + this.loaded);
            if (!this.loaded) {

                var html = this.menuContent();
                //using setTimeout to add delay, some time the jQuary .html() function not work right.
                setTimeout(function () {
                    //console.log("---html---");
                    //console.log(html);
                    //console.log("---html---");
                    $("#nav-account-menu .inner").html(html);
                }, 600);

                this.loaded = true;

                if (this.config.LoggedIn) {
                    this.update(0);
                }
            }
            this.open = true;
        },
        turnOff: function () {
            this.open = false;
        },
        menuContent: function () {
            var accountContent;

            if (this.config.LoggedIn) {
                if (!this.config.Icon || this.config.Icon.length == 0) {
                    this.config.Icon = res.SECURESERVER + "/content2/images/account.jpg";
                }

                var news = '';
                if (this.config.News) for (var i = 0; i < this.config.News.length; i++) {
                    news += '<p class="news">' + this.config.News[i] + '</p>';
                }

                var orders = '';
                if (this.config.Orders && this.config.Orders.length > 0) {
                    orders = '<h2>' + res.hdRecentOrders + '</h2><ul>';

                    for (var i = 0; i < this.config.Orders.length; i++) {
                        orders += '<li><a href="' + $.cartUtility.secureUrl('/account/order/' + this.config.Orders[i][0]) + '">' + this.config.Orders[i][0] + '</a>: ' + this.config.Orders[i][1] + '</li>';
                    }
                    orders += '</ul><p><a href="' + $.cartUtility.secureUrl('/account') + '" class="view-all raa">' + res.lbViewAllOrders + '</a></p>';
                }

                accountContent =
                    '<div class="account-quick-links">\
                        <p>' + res.bcMyAccount + '</p>\
                        <ul>\
                            <li><i class="i-arr-r-lt"></i><a href="' + $.cartUtility.secureUrl('/account/') + '">' + res.menu_orders + '</a></li>\
                            <li ' + ((this.config.Staff || this.config.Reseller || !this.config.MembershipEnable) ? 'style="display:none"' : '') + '><i class="i-arr-r-lt"></i><a href="' + $.cartUtility.secureUrl('/account/membership') + '">' + res.membership_program + '</a></li>\
                            <li><i class="i-arr-r-lt"></i><a href="' + $.cartUtility.secureUrl('/account/profile') + '">' + res.Mobile_AccountProfile + '</a></li>\
                            <li><i class="i-arr-r-lt"></i><a href="' + $.cartUtility.secureUrl('/account/contactus') + '">' + res.ttl_Contact + '</a></li>\
                            <li><i class="i-arr-r-lt"></i><a id="signout-link" href="' + $.cartUtility.secureUrl('/account/Signout') + '">' + res.Logout + '</a></li>\
                        </ul>\
                    </div>';

                //To show different content when order record is empty.
                if (orders.length > 0) {
                    accountContent += '<div class="container summary">\
                        <div class="row">\
                            <div class="col-xs-3 col-xxs-12 col-sm-1">\
                                <img src="'+ this.config.Icon + '" class="user-avatar">\
                            </div>\
                            <div class="col-xxs-12 col-xs-9 col-sm-5">\
                                <h2>' + res.HeaderFooterMaster_Welcome.replace('{0}', this.config.FirstName) + '</h2>\
                                '+ news + '\
                            </div>\
                            <div class="col-xxs-12 col-sm-5 col-sm-offset-1">\
                                <div class="orders clearfix">'+ orders + '</div>\
                            </div>\
                        </div>\
                    </div>';
                }
                else {
                    accountContent += '<div class="container summary">\
                        <div class="row">\
                            <div class="col-xs-1 col-xxs-12">\
                                <img src="'+ this.config.Icon + '" class="user-avatar">\
                            </div>\
                            <div class="col-xs-9">\
                                <h2>' + res.HeaderFooterMaster_Welcome.replace('{0}', this.config.FirstName) + '</h2>\
                                '+ news + '\
                            </div>\
                        </div>\
                    </div>';
                }
            }
            else {
                //DC 2016-08-26
                //Using iframe to do secure login from non-secure site
                accountContent = '<iframe src="' + res.SECURESERVER + '/account/signup?layout=no&source=topmenu" scrolling="no" width="100%" id="loginiframe" name="loginiframe" style="height:250px"></iframe>\
                                  <div id="loginLoading" style="position: absolute;width: 100%;height: 100%;top: 0;left: 0;text-align: center;padding-top: 100px;background-color: #f2f2f2;"><div class="loading medium"></div></div>';
            }

            return accountContent;
        },
        update: function (h) {
            $("#nav-account-menu").css("height", h == 0 ? "auto" : h + "px");
            $("#loginiframe").css("height", h + "px");
            $("#loginLoading").hide();
        },
        message: function () {

            window.addEventListener('message', function (e) {
                //    console.log(e.data);
                if (typeof e.data === 'string' && e.data != '' && e.data.indexOf('{') == 0) {
                    var result = $.parseJSON(e.data);

                    if (result.source == 'topmenu') {
                        if (result.action == 'update') {
                            var height = parseInt(result.height);
                            $.accountMenu.update(height);
                        }
                        else if (result.action == 'loginsuccess') {
                            $.accountMenu.open = true;
                            $.accountMenu.refresh();

                            if (result.cartMerged && (new RegExp('/shoppingcart')).test(location.href.toLowerCase())) {
                                notificationBar.show(res.cart_combined.replace('{0}', $.cartUtility.secureUrl("/shoppingcart/")), 1000 * 30);
                            }

                            //DC 2016-08-26
                            //when customer logged in, current page should be refresh to update promo price or other.
                            if (typeof $.accountMenu.pageRefresh === 'function')
                                $.accountMenu.pageRefresh.call();
                            else {
                                //if page has not refresh function, the page will force a refresh
                                $("#nav-account-menu > .i-cross.close,#nav-sign-in").on('click', function () {
                                    location.reload();
                                });
                            }
                        }
                        else if (result.action == 'close') {
                            $.accountMenu.close();
                        }
                    }

                    if (result.action === 'loginsuccess') {
                        if (window.Moengage && result.optIn) {
                            Moengage.add_unique_user_id(result.email).then(x=> {
                                if (result.newRegistration) {
                                    // console.log('new registration');
                                    Moengage.add_first_name(result.firstName);
                                    Moengage.add_last_name(result.lastName);
                                    Moengage.add_email(result.email);
                                    Moengage.add_user_attribute('CountryCode', global.store.countrycode);
                                    Moengage.add_user_attribute('AcousticLastCreateUpdateDate', new Date().toISOString());

                                  //  Moengage.track_event("Signup", {
                                  //    "Store Code": global.store.storeCode,
                                  //    "First Name": result.firstName,
                                  //    "Last Name": result.lastName,
                                  //    "Email": result.email,
                                  //    "CountryCode": global.store.countrycode
                                  // })
                                }
                            })
                        }
                    }
                }
            });

        },
        refresh: function () {
            $("#loginLoading").show();
            //DC 2016-08-26,
            //using jsonp to update customer status, for cross domain
            //some pages will to request secure url from non-secure site
            $.ajax({
                url: res.SECURESERVER + '/customer/?r=' + Math.random(),
                dataType: 'jsonp',
                success: function (data) {
                    $.accountMenu.updateData(data);
                }
            });
        },
        updateData: function (data) {
            this.config = $.extend(this.config, data);
            this.updateHeader();
            this.addClass()
            this.loaded = false;
            if (this.open) {
                this.turnOn();
            }
            $.updateCartCount(this.config.CartItemCount);
        },
        close: function () {
            $.accountMenu.turnOff();
            $.accountMenu.loaded = false;
            $("#nav-account-menu > .i-cross.close").click();
        },
        pageRefresh: null,
        addClass: function () {
            if ($.accountMenu && $.accountMenu.config && $.accountMenu.config.LoggedIn) {
                $('#alert-box-toggle').addClass('logged-in')
            } else {
                $('#alert-box-toggle').removeClass('logged-in')
            }
        }
    };
};

// Account authentification.
var initAuthentication = function () {
    var signup =
    {
        config: {
            type: '',
            success: function () {
                // On login/register success, redirect to the redirectLink if set (from URL).
                if ($.accountSignup.config.redirect) location = $.accountSignup.config.redirect;
            },
            fail: function () { },
            messageType: 0,
            email: '',
            redirect: '',
            firstName: '',
            lastName: '',
            month: '0',
            year: '0',
            facebook: true,
            source: 'popup',  // popup, top
            validateCode: ''
        },
        //update login status by ajax
        updateStatus: function () {
            //using jsonp to update customer status, for cross domain
            $.ajax({
                url: res.SECURESERVER + '/customer/?r=' + Math.random(),
                dataType: 'jsonp',
                success: function (data) {
                    $.loadCustomer(data);
                }
            });
        },
        open: function (option) {
            $.extend(this.config, option);

            // If email address is set then pass it trough the URL.
            var emailUrl = this.config.email ? '&e=' + this.config.email : '';
            if (this.config.validateCode && this.config.validateCode.length > 0) {
                emailUrl += '&v=' + this.config.validateCode;
            }
            var url = res.SECURESERVER + '/account/signup/?layout=no&id=' + this.config.type + '&source=' + this.config.source + emailUrl + '&fn=' + this.config.firstName + '&m=' + this.config.month + '&y=' + this.config.year + '&ln=' + this.config.lastName + '&messagetype=' + this.config.messageType + '&fb=' + this.config.facebook;
            if (this.config.source === 'popup') {
                url += '&theme=white';
                $.modalW({ url: url, width: 'auto', height: 'auto', background: '#fff' });
            }
            else {
                // url += '&theme=grey';
                var html = '<iframe src="' + url + '" scrolling="no" width="100%" id="loginiframe" name="loginiframe" style="height:250px"></iframe>\
                                  <div id="loginLoading" style="position: absolute;width: 100%;height: 100%;top: 0;left: 0;text-align: center;padding-top: 100px;background-color: #f2f2f2;"><div class="loading medium"></div></div>';
                $.accountMenu.loaded = true;
                $.accountMenu.open = true;
                $("#nav-account-menu .inner").html(html);
                setTimeout(function () { $("#nav-sign-in").click(); }, 400);
            }
        },
        update: function (width, height) {
            $.modalWUpdate(width, height);
        },
        message: function () {
            // The 'Message' event is triggered from secure site.
            window.addEventListener('message', function (e) {
                if (typeof e.data == 'string' && e.data != '' && e.data.indexOf('{') == 0) {
                    var result = $.parseJSON(e.data);
                    if (result.source == 'popup') {
                        if (result.action == 'update') {
                            var height = parseInt(result.height);
                            var width = parseInt(result.width);
                            $.accountSignup.update(width, height);
                        }
                        else if (result.action == 'loginsuccess') {
                            $.accountSignup.config.success.call(this, result.cartMerged);
                        }
                        else if (result.action == 'fail') {
                            $.accountSignup.config.fail.call();
                        }
                        else if (result.action == 'close') {
                            $.modalWClose();
                        }
                    }
                    else if (result.source == 'top') {
                        if (result.action == 'update') {
                            var height = parseInt(result.height);
                            $.accountMenu.update(height);
                        }
                        else if (result.action == 'loginsuccess') {
                            $.accountMenu.open = true;
                            $.accountSignup.config.success.call(this, result.cartMerged, result);
                        }
                        else if (result.action == 'fail') {
                            $.accountSignup.config.fail.call();
                        }
                        else if (result.action == 'close') {
                            $.accountMenu.turnOff();
                            $.accountMenu.loaded = false;
                            $("#nav-account-menu > .i-cross.close").click();
                        }
                    }

                }
            });
        },
        close: function () {
            $.modalWClose();
        }
    };

    if (global.store.hasStore == "1") {
        signup.updateStatus();
    }

    $.accountSignup = signup;
    $.accountSignup.message();
}

var initTracking = function () {
    // Campaign Tracking.
    var campaign_id = urlParams.ctlcmp || urlParams.refid;
    if (campaign_id != '' && campaign_id != undefined) {
        campaign_id = validateCampaignID(campaign_id.substr(0, 36));
        jQuery.cookie('ctlcmp', campaign_id, { expires: 7, path: '/', domain: '.creative.com' });
    }

    // Referral Tracking.
    var referral_id = urlParams.refid;
    if (referral_id != '' && referral_id != undefined) {
        referral_id = validateCampaignID(referral_id.substr(0, 36));
        jQuery.cookie('referral_id', referral_id, { expires: 7, path: '/', domain: '.creative.com' });
    }

    // Associate Tracking.
    var associate_id = urlParams.assoc;
    if (associate_id != '' && associate_id != undefined) {
        jQuery.cookie('aid', associate_id, { path: '/', domain: '.creative.com' });
    }

    // Student Beans Tracking
    var aff_sub = urlParams.aff_sub;
    if (aff_sub != '' && aff_sub != undefined) {
        aff_sub = validateCampaignID(aff_sub);
        jQuery.cookie('aff_sub', aff_sub, { path: '/', domain: '.creative.com' });
    }

};

var validateCampaignID = function (str) {
    var regexS = "[A-Za-z0-9_-]{0,100}";

    var regex = new RegExp(regexS);
    var match = regex.exec(str);
    if (match == null)
        return "";
    else
        return match[0];
}

/**
 * Lazy load images using the lazyload jquery plugin.
 *
 * @param string|jQuery object scope_images: an optional param to perform lazyload on a specific scope images.
 * @param Function callback: if given, the callback function will be executed once the image is loaded.
 * @return void.
 */
var do_lazy = function (scope_images, callback, container) {
    var settings = { effect: "fadeIn" };
    if (scope_images === undefined) scope_images = '.lazy, [data-original]';
    if (container !== undefined) settings.container = container;

    $(scope_images).each(function (i, curr) {
        // Ecxlude gif images and already resized images.
        if ($(curr).attr('data-original').indexOf('?') === -1 && !/^.*\.gif/.test($(curr).attr('data-original'))) {
            // First check if we can serve smaller size images.
            if (g.windowFormat === 'small') {
                $(curr).attr('data-original', $(curr).attr('data-small') ? $(curr).attr('data-small')
                    : ($(curr).attr('data-original') + '?width=750'));
            }
            else if (g.windowFormat === 'medium') {
                $(curr).attr('data-original', $(curr).attr('data-medium') ? $(curr).attr('data-medium')
                    : ($(curr).attr('data-original') + '?width=1500'));
            }


            // Trick to get the 'loaded' class on loaded background images too.
            if (typeof callback === 'function') $('<img>').on('load', function () {
                $(curr).addClass('ready');
                if (callback) callback($(curr));
            }).attr('src', $(curr).attr('data-original'));
        }
    }).lazyload(settings);
};

/**
 * Parallax class to animate an image background in a parallax effect.
 * This class can be called multiple times but on different elements.
 *
 * Example of use:
 *     var imgSet = $('#state-of-the-art-section img:first, #MultipleAdvancedTech-section img:first');
 *     new parallax(imgSet, {amount: 40});
 *
 * @param  {jQuery collection} imgSet: the <img> tags to transform to parallax bg (preferably full width and tall images for best effect).
 * @param  {object} options: settings to customize the parallax effect.
 * @return void.
 */
var parallaxReady, parallax = function (imgSet, options) {
    var self = this;
    self.imgSet = imgSet;
    self.options = $.extend(
        {
            amount: 30,// Percentage of image.
            boxShadow: 'normal'// 'normal' or 'darker'.
        }, options);

    var wh,
        bindEvents = function () {
            parallaxReady = true;
            $(document)
                .on('resize', function (e) { wh = $(window).height() })
                .on('scroll', function (e) {
                    var ps = $(window).scrollTop();
                    $('.parallax .bg').each(function () {
                        var posInView = $(this).offset().top - ps,
                            posInViewPercent = posInView * 100 / wh,
                            scrollInViewPercent = wh / $(this).height();

                        if (posInViewPercent > 0 && posInViewPercent < 100)
                            $(this).css('top', - Math.min((posInViewPercent) * self.options.amount / 100, self.options.amount) + '%')
                    })
                });
        },
        init = function () {
            wh = $(window).height();

            if (!parallaxReady) bindEvents();

            imgSet.each(function () {
                var img = $(this);
                img.wrap('<div class="parallax shadow' + (self.options.boxShadow === 'darker' ? ' darker' : '') + '"/>')
                    .after('<div class="wrapper" style="height:' + (100 - self.options.amount) + '%;">\
                                <div class="bg" style="background-image: url(' + img.fadeTo(0, 0).attr('src') + ');height:' + (100 * 100 / (100 - self.options.amount)) + '%;"></div>\
                            </div>');
            });
        }();
};

const SideMenuHandler = {
    // Constants
    menuSelectors: {
        sideMenu: '#side-menu',
        contentMenu: '.menu-content', //child of #side-menu
        footerMenu: '.menu-footer', //child of #side-menu
        mainNav: '#main-nav',
        sideMenuHeader: '#side-menu-header', //child of #main-nav
        hamburgerBtn: '#nav-sitemap', //child of #main-nav
        footerTxtLogin: '.txt-login',
        footerTxtAccount: '.txt-account'
    },

    homeMenu: "home-menu",
    currentMenu: "home-menu",
    menu: null,
    contentMenu: null,
    footerMenu: null,
    mainNav: null,
    sideMenuHeader: null,
    hamburgerBtn: null,
    arrSiblingMenu: ["nav-account-menu"],

    elemReady: true,

    initElements: function() {
        try {
            this.menu = document.querySelector(this.menuSelectors.sideMenu);
            this.contentMenu = this.menu.querySelector(this.menuSelectors.contentMenu);
            this.footerMenu = this.menu.querySelector(this.menuSelectors.footerMenu);

            this.mainNav = document.querySelector(this.menuSelectors.mainNav);
            this.sideMenuHeader = this.mainNav.querySelector(this.menuSelectors.sideMenuHeader);
            this.hamburgerBtn = this.mainNav.querySelector(this.menuSelectors.hamburgerBtn);

            const missingElements = [];

            if (!this.menu) missingElements.push('sideMenu');
            if (!this.mainNav) missingElements.push('mainNav');
            if (!this.sideMenuHeader) missingElements.push('sideMenuHeader');
            if (!this.hamburgerBtn) missingElements.push('hamburgerBtn');
            if (missingElements.length > 0) {
                throw new Error(`Required menu elements not found: ${missingElements.join(', ')}`);
            }

        } catch (error) {
            console.error('Failed to initialize menu elements:', error);
            this.elemReady = false;
        }
    },

    //Move selected submenu to under their parent position
    initSubmenu: function() {
        const expandMenus = this.menu.querySelectorAll(`.sub-menu[open='expand']`);

        expandMenus.forEach(submenu => {
            const menuId = submenu.dataset.id;
            const menuItem = this.menu.querySelector(`.menu-item[data-target="${menuId}"]`);
            if (menuItem && !menuItem.contains(submenu)) {
                menuItem.after(submenu);
            }
        });
    },

    setFooterLoginText: function(){
        if(global.store.hasStore != '0'){
            const booHaveEmail = global.store.customer.email != "";
            this.footerMenu.querySelector(this.menuSelectors.footerTxtLogin).classList.toggle("active", !booHaveEmail);
            this.footerMenu.querySelector(this.menuSelectors.footerTxtAccount).classList.toggle("active", booHaveEmail);
        }
    },

    getCountryName: function() {
        const currentCountryID = global.store.storeCountryID;
        if (!currentCountryID) return global.store.storeName;
    
        const countryItem = [...this.menu.querySelectorAll('[data-countryid]')].find(item => 
            Number(item.dataset.countryid.split(',')[0]) === currentCountryID
        );
    
        return countryItem ? countryItem.getAttribute("value") : global.store.storeName;
    },

    setFooterCountryName: function(){
        const btnLocation = this.footerMenu.querySelector(".btn-location");
        if(!btnLocation || btnLocation.querySelector("div")){
            return;
        }

        const newDiv = document.createElement("div");
        newDiv.className = "i-globe txt-storename";
        newDiv.innerHTML = this.getCountryName();
        btnLocation.appendChild(newDiv);
    },

    hasMenuDataID: function(menuId) {
        return this.getMenuDataID(menuId) != null;
    },

    getMenuDataID: function(menuId) {
        return this.menu.querySelector(`[data-id="${menuId}"]`);
    },

    openMethod: function(menuId) {
        return (this.hasMenuDataID(menuId)) ? this.getMenuDataID(menuId).getAttribute("open") : "";
    },

    setCurrentMenu: function(menuId) {
        this.contentMenu.dataset.current = menuId;
    },

    resetSideMenu: function(){
        this.mainNav.classList.remove("open-side-menu-header");
        this.setCurrentMenu("");
        this.menu.querySelectorAll(".sub-menu.active, .sub-menu.open").forEach(submenu => {
            if(submenu.classList.contains("open")){
                submenu.style.display = "none";
            }
            submenu.classList.remove("active","open");
        });
        this.menu.querySelectorAll(".menu-item.i-minus").forEach(menuItem => {
            menuItem.classList.remove("i-minus");
            menuItem.classList.add("i-plus");
        });
        this.menu.querySelectorAll("[data-countryid].selected").forEach(countryItem => {
            countryItem.classList.remove("selected");
        });
    },

    toggleSideMenuHeader: function(targetMenu) {
        //menu header
        const isHomeMenu = targetMenu === this.homeMenu;
        this.sideMenuHeader.querySelector(".back-btn").innerHTML = isHomeMenu ? "" : this.getMenuDataID(targetMenu).getAttribute("data-header");
        this.mainNav.classList.toggle("open-side-menu-header", !isHomeMenu);
    },

    toggleMenu: function(targetMenu) {
        if (this.openMethod(targetMenu) === "expand") {
            this.getMenuDataID(targetMenu).classList.toggle("open");
            if(this.getMenuDataID(targetMenu).classList.contains("open")){
                $(`#side-menu li.sub-menu[data-id="${targetMenu}"]`).slideDown(300);
            }else{
                $(`#side-menu li.sub-menu[data-id="${targetMenu}"]`).slideUp(300);
            }
            return;
        }

        //if target menu is sibling menu (not side menu child), skip statement
        if(this.arrSiblingMenu.includes(targetMenu)){
            switch(targetMenu){
                case "nav-account-menu":
                    document.querySelector(`[data-target-id="nav-account-menu"]`).click();
                    break;
            }
            return;
        }

        //if not expand menu, update content data
        this.setCurrentMenu(targetMenu);

        // show header and back button
        this.toggleSideMenuHeader(targetMenu);

        // The "Home" menu always stays on the last layer of the side menu,
        // so no need to toggle its active state.
        // The target menu is always visible before sliding in from the right and exiting.
        // Before showing the target menu, remove "active" from all existing submenus.
        if(targetMenu != "home-menu"){
            // Remove "active" from all sub-menus
            this.menu.querySelectorAll(".sub-menu.active").forEach(submenu => submenu.classList.remove("active"));
            // Update the current menu reference
            this.currentMenu = targetMenu;
            // Add "active" to the target menu
            this.getMenuDataID(this.currentMenu).classList.add("active");
        }
    },

    toggleExpandIcon: function(element) {
        if (!element.classList.contains("i-plus") && !element.classList.contains("i-minus")) {
            return;
        }
        
        const isPlus = element.classList.contains("i-plus");
        element.classList.toggle("i-plus", !isPlus);
        element.classList.toggle("i-minus", isPlus);
    },

    observeExpandState: function(target) {
        let timeoutTouch=null, observer=null;
        if (!target.hasTouchObserver) {
            target.hasTouchObserver = true;

            const disconnectObserver = function(){
                target.classList.remove("touch");
                if(observer) observer.disconnect();
                if(timeoutTouch) clearTimeout(timeoutTouch);
                target.hasTouchObserver = false;
            };

            observer = new MutationObserver((mutations) => {
                if (mutations.some(mutation => mutation.attributeName === "class" && target.classList.contains("i-minus"))) {
                    disconnectObserver();
                }
            });
            observer.observe(target, { attributes: true });

            timeoutTouch = setTimeout(() => {
                disconnectObserver();
            }, 100);
        }
    },

    addEventListeners: function() {
        this.hamburgerBtn.addEventListener("click", (e) => {
            e.preventDefault();

            if(document.querySelector("#all.open-side-menu")==null){
                //when open side menu

                this.resetSideMenu();

                //update info
                this.setFooterLoginText();
                this.setFooterCountryName();

                //show home menu
                this.toggleMenu(this.homeMenu);
            }
        });

        this.sideMenuHeader.addEventListener("click", (e) => {
            e.stopPropagation();
            //get current menu from side menu data current, remove menu class active
            this.menu.querySelector(`.sub-menu[data-id="${this.contentMenu.dataset.current}"]`).classList.remove("active");
            this.toggleMenu(this.homeMenu);
        });

        // Menu click handlers
        this.menu.addEventListener("click", (e) => {
            const item = e.target;
            const parentElement = item.parentElement;

            //if have url
            if (item.dataset.href) {
                const hrefTarget = item.dataset.hrefTarget || "_self";
                
                if (hrefTarget === "_self") {
                    try {
                        location.href = new URL(item.dataset.href, location.origin).href;
                    } catch (e) {
                        console.log("Error: incorrect url");
                        return; //block xss
                    }
                } else {
                    try {
                        //return when incorrect url
                        const url = new URL(item.dataset.href.trim());
                        if (url.protocol !== "http:" && url.protocol !== "https:") return;
                
                        window.open(url.href, "_blank", "noopener,noreferrer");
                    } catch (e) {
                        console.log("Error: incorrect url");
                        return; //block xss
                    }
                }

                return;
            }
            
            //if is country selector
            if(item.dataset.countryid && parentElement && parentElement.parentElement.matches("#side-menu li[data-id='location-menu']")) {
                item.classList.add("selected");
                location.href = GetAbsoluteURL() + "/home/country?id=" + item.dataset.countryid;
                return;
            }

            const isFooterButton = ["btn-login", "btn-location"].some(className => parentElement.classList.contains(className));

            //if dun have menu target and not footer button
            if (!item.hasAttribute("data-target") && !isFooterButton) return;

            e.stopPropagation();

            const targetMenu = isFooterButton ? parentElement.dataset.target : item.dataset.target;

            this.toggleMenu(targetMenu);
            this.toggleExpandIcon(item);
        });

        // menu item touch handler
        // when touch start - add classname 'touch' on elem
        // when touch end or cancel - remove classname 'touch' on elem
        ['touchstart', 'touchcancel'].forEach(event => {
            this.menu.addEventListener(event, e => {
                if (e.target.classList.contains('menu-item')) {
                    e.target.classList.toggle('touch', event === 'touchstart');
                }
            });
        });

        this.menu.addEventListener("touchend", (e) => {
            const target = e.target;
            
            // if not menu item, return
            if (!target.classList.contains("menu-item")) return;

            const targetSibling = target.nextElementSibling;

            if (!target.getAttribute("data-target") ||
                target.classList.contains("i-minus") ||
                !targetSibling ||
                targetSibling.getAttribute("open") !== "expand") {
                    return target.classList.remove("touch");
            }

            //if expand item not open, observe expand state
            this.observeExpandState(target);
        });
    },

    init: function() {
        this.initElements();
        if(this.elemReady){
            this.initSubmenu();
            this.addEventListeners();
        }
    }

};

document.addEventListener("DOMContentLoaded", () => {
    if(document.querySelector("html").classList.contains("layout-2024")){
        SideMenuHandler.init();
    }
});

//======================== End of GENERAL FUNCTIONS =======================//
//=========================================================================//


//=========================================================================//
//======================== SPECIFIC PAGES FUNCTIONS =======================//
// Only place here the functions that are used on a specific page.

// Products category page.
var initProductCategory = function () {
    $(".leftnav-container .filter-close")
        .click(function () {
            if ($(this).hasClass("closed")) {
                $(this).removeClass("closed");
                var parentobj = $(this).parent().parent().parent();
                var height = 25;
                parentobj.find(">li").each(function () {
                    height += $(this).height();
                });
                parentobj.animate({ height: height }, 300);
            }
            else {
                $(this).addClass("closed");
                $(this).parent().parent().parent().animate({ height: $(this).height() }, 300);
            }
        })
        .each(function () {
            $(this).parent().parent().find("a:first").click(function () {
                $(this).next().find("a:first").click();
            });
            if ($(this).hasClass("closed")) {
                $(this).parent().parent().parent().css("height", ($(this).parent().parent().height() + 16) + "px");
            }
        });
}

var initOrderDetailPrint = function () {
    // Do auto-print popup from "Account Order Summary" page when print option is clicked
    if (location.href.indexOf("print=1") > 0) {
        window.print();
    }

};
//==================== End of SPECIFIC PAGES FUNCTIONS ====================//
//=========================================================================//;
// Setup default consent mode for Google Analytics/GTM
window.dataLayer = window.dataLayer || [];
function gtag() { dataLayer.push(arguments); }


if ([7, 8, 9, 10, 11, 12, 13, 21, 22, 23, 24, 25, 26, 27, 28, 31, 37, 39, 41].includes(global.store.id)) {

  const cookieSettings = JSON.parse($.cookie('cookieSettings'));
  // console.log({ cookieSettings });

  const consent = {
    ad_user_data: cookieSettings?.thirdParty ? 'granted' : 'denied',
    ad_personalization: cookieSettings?.thirdParty ? 'granted' : 'denied',
    ad_storage: cookieSettings?.thirdParty ? 'granted' : 'denied',
    analytics_storage: cookieSettings?.analytics ? 'granted' : 'denied',
    'wait_for_update': 500,
  };

  // console.log({ consent });

  gtag('consent', 'default', consent);
  dataLayer.push({ 'gtm.start': new Date().getTime(), 'event': 'gtm.js' });
}

const ckNotiz = {
  acceptCookies: false,
  cookieSettings: { dismissed: false, necessary: true, analytics: false, thirdParty: false },

  setCookie: function (cookieSettings) {
    $.cookie("cookieSettings", JSON.stringify(cookieSettings), { expires: 365, path: "/" });
  },

  getCookie: function () {
    return JSON.parse($.cookie('cookieSettings'));
  },

  init: function () {
    var _this = this;
    if (this.getCookie() !== null) _this.cookieSettings = this.getCookie();

    $('.cookie-action, .ck-notiz .close-btn').on('click', function (e) {
      if (e.target.name === 'accept') {
        $('#cookies_analytics').prop('checked', true);
        $('#cookies_thirdParty').prop('checked', true);
        _this.cookieSettings = { necessary: true, analytics: true, thirdParty: true };

        _this.setConsent(
          {
            ad_user_data: 'granted',
            ad_personalization: 'granted',
            ad_storage: 'granted',
            analytics_storage: 'granted'
          }
        );
      }
      else if (e.target.name === 'reject') {
        $('#cookies_analytics').prop('checked', false);
        $('#cookies_thirdParty').prop('checked', false);
        _this.cookieSettings = { necessary: true, analytics: false, thirdParty: false };

        _this.setConsent(
          {
            ad_user_data: 'denied',
            ad_personalization: 'denied',
            ad_storage: 'denied',
            analytics_storage: 'denied'
          }
        );
      }
      else if (e.target.name === 'close') {
        _this.cookieSettings.analytics = $('#cookies_analytics').prop('checked');
        _this.cookieSettings.thirdParty = $('#cookies_thirdParty').prop('checked');

        _this.setConsent(
          {
            ad_user_data: _this.cookieSettings.thirdParty ? 'granted' : 'denied',
            ad_personalization: _this.cookieSettings.thirdParty ? 'granted' : 'denied',
            ad_storage: _this.cookieSettings.thirdParty ? 'granted' : 'denied',
            analytics_storage: _this.cookieSettings.analytics ? 'granted' : 'denied'
          }
        );

        _this.hide();
      }

      _this.cookieSettings.dismissed = true;
      _this.setCookie(_this.cookieSettings);
      _this.hide();
      notificationBar.show(res.cookie_settings_saved, 10000);
    });

    $('.ck-notiz .learnmore-btn').on('click', function () {
      $('.learnmore').slideDown();
      $('.ck-notiz .learnmore-btn').hide();
      $('.ck-notiz .close-btn').show();
    });

    $('.ck-notiz input[type=checkbox]').on('change', function (e) {
      _this.cookieSettings[e.target.id.replace('cookies_', '')] = $('#' + e.target.id).prop('checked');
      _this.setCookie(_this.cookieSettings);

      _this.setConsent(
        {
          ad_user_data: _this.cookieSettings.thirdParty ? 'granted' : 'denied',
          ad_personalization: _this.cookieSettings.thirdParty ? 'granted' : 'denied',
          ad_storage: _this.cookieSettings.thirdParty ? 'granted' : 'denied',
          analytics_storage: _this.cookieSettings.analytics ? 'granted' : 'denied'
        }
      );
    })

    // Pre-check the checkboxes according to what was previously set and saved in the cookie
    $('.ck-notiz input[type=checkbox]').each(function (i) {
      $(this).prop('checked', _this.cookieSettings[this.id.replace('cookies_', '')]);
    })

    const storeListShowCookie = [2, 7, 8, 9, 10, 11, 12, 13, 21, 22, 23, 24, 25, 26, 27, 28, 31, 37, 39, 41];

    if (this.cookieSettings.dismissed !== true && storeListShowCookie.includes(global.store.id)) {
      _this.show();
    }

  },

  show: function () {
    $('.ck-notiz').addClass('open');
  },

  hide: function () {
    notificationBar.hide();
    $('.ck-notiz').removeClass('open');
  },

  setConsent: function (consentFlags) {
    // console.log('setconsent');
    // console.log(consentFlags);
    gtag('consent', 'update', consentFlags);
  },

  reset: function () {
    var settings = { dismissed: false, necessary: true, analytics: false, thirdParty: false };
    this.cookieSettings = settings;
    $.cookie("cookieSettings", JSON.stringify(settings), { expires: -9999, path: "/" });
  }

};

$(document).ready(function () {
  ckNotiz.init();
});


;
