/*! jQuery v3.6.0 | (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(C,e){"use strict";var t=[],r=Object.getPrototypeOf,s=t.slice,g=t.flat?function(e){return t.flat.call(e)}:function(e){return t.concat.apply([],e)},u=t.push,i=t.indexOf,n={},o=n.toString,v=n.hasOwnProperty,a=v.toString,l=a.call(Object),y={},m=function(e){return"function"==typeof e&&"number"!=typeof e.nodeType&&"function"!=typeof e.item},x=function(e){return null!=e&&e===e.window},E=C.document,c={type:!0,src:!0,nonce:!0,noModule:!0};function b(e,t,n){var r,i,o=(n=n||E).createElement("script");if(o.text=e,t)for(r in c)(i=t[r]||t.getAttribute&&t.getAttribute(r))&&o.setAttribute(r,i);n.head.appendChild(o).parentNode.removeChild(o)}function w(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?n[o.call(e)]||"object":typeof e}var f="3.6.0",S=function(e,t){return new S.fn.init(e,t)};function p(e){var t=!!e&&"length"in e&&e.length,n=w(e);return!m(e)&&!x(e)&&("array"===n||0===t||"number"==typeof t&&0<t&&t-1 in e)}S.fn=S.prototype={jquery:f,constructor:S,length:0,toArray:function(){return s.call(this)},get:function(e){return null==e?s.call(this):e<0?this[e+this.length]:this[e]},pushStack:function(e){var t=S.merge(this.constructor(),e);return t.prevObject=this,t},each:function(e){return S.each(this,e)},map:function(n){return this.pushStack(S.map(this,function(e,t){return n.call(e,t,e)}))},slice:function(){return this.pushStack(s.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},even:function(){return this.pushStack(S.grep(this,function(e,t){return(t+1)%2}))},odd:function(){return this.pushStack(S.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:u,sort:t.sort,splice:t.splice},S.extend=S.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||m(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&&(S.isPlainObject(r)||(i=Array.isArray(r)))?(n=a[t],o=i&&!Array.isArray(n)?[]:i||S.isPlainObject(n)?n:{},i=!1,a[t]=S.extend(l,o,r)):void 0!==r&&(a[t]=r));return a},S.extend({expando:"jQuery"+(f+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]"!==o.call(e))&&(!(t=r(e))||"function"==typeof(n=v.call(t,"constructor")&&t.constructor)&&a.call(n)===l)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},globalEval:function(e,t,n){b(e,{nonce:t&&t.nonce},n)},each:function(e,t){var n,r=0;if(p(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},makeArray:function(e,t){var n=t||[];return null!=e&&(p(Object(e))?S.merge(n,"string"==typeof e?[e]:e):u.call(n,e)),n},inArray:function(e,t,n){return null==t?-1:i.call(t,e,n)},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(p(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:y}),"function"==typeof Symbol&&(S.fn[Symbol.iterator]=t[Symbol.iterator]),S.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(e,t){n["[object "+t+"]"]=t.toLowerCase()});var d=function(n){var e,d,b,o,i,h,f,g,w,u,l,T,C,a,E,v,s,c,y,S="sizzle"+1*new Date,p=n.document,k=0,r=0,m=ue(),x=ue(),A=ue(),N=ue(),j=function(e,t){return e===t&&(l=!0),0},D={}.hasOwnProperty,t=[],q=t.pop,L=t.push,H=t.push,O=t.slice,P=function(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1},R="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",M="[\\x20\\t\\r\\n\\f]",I="(?:\\\\[\\da-fA-F]{1,6}"+M+"?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+",W="\\["+M+"*("+I+")(?:"+M+"*([*^$|!~]?=)"+M+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+I+"))|)"+M+"*\\]",F=":("+I+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+W+")*)|.*)\\)|)",B=new RegExp(M+"+","g"),$=new RegExp("^"+M+"+|((?:^|[^\\\\])(?:\\\\.)*)"+M+"+$","g"),_=new RegExp("^"+M+"*,"+M+"*"),z=new RegExp("^"+M+"*([>+~]|"+M+")"+M+"*"),U=new RegExp(M+"|>"),X=new RegExp(F),V=new RegExp("^"+I+"$"),G={ID:new RegExp("^#("+I+")"),CLASS:new RegExp("^\\.("+I+")"),TAG:new RegExp("^("+I+"|[*])"),ATTR:new RegExp("^"+W),PSEUDO:new RegExp("^"+F),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+R+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},Y=/HTML$/i,Q=/^(?:input|select|textarea|button)$/i,J=/^h\d$/i,K=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ee=/[+~]/,te=new RegExp("\\\\[\\da-fA-F]{1,6}"+M+"?|\\\\([^\\r\\n\\f])","g"),ne=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))},re=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ie=function(e,t){return t?"\0"===e?"\ufffd":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},oe=function(){T()},ae=be(function(e){return!0===e.disabled&&"fieldset"===e.nodeName.toLowerCase()},{dir:"parentNode",next:"legend"});try{H.apply(t=O.call(p.childNodes),p.childNodes),t[p.childNodes.length].nodeType}catch(e){H={apply:t.length?function(e,t){L.apply(e,O.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}function se(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&&(T(e),e=e||C,E)){if(11!==p&&(u=Z.exec(t)))if(i=u[1]){if(9===p){if(!(a=e.getElementById(i)))return n;if(a.id===i)return n.push(a),n}else if(f&&(a=f.getElementById(i))&&y(e,a)&&a.id===i)return n.push(a),n}else{if(u[2])return H.apply(n,e.getElementsByTagName(t)),n;if((i=u[3])&&d.getElementsByClassName&&e.getElementsByClassName)return H.apply(n,e.getElementsByClassName(i)),n}if(d.qsa&&!N[t+" "]&&(!v||!v.test(t))&&(1!==p||"object"!==e.nodeName.toLowerCase())){if(c=t,f=e,1===p&&(U.test(t)||z.test(t))){(f=ee.test(t)&&ye(e.parentNode)||e)===e&&d.scope||((s=e.getAttribute("id"))?s=s.replace(re,ie):e.setAttribute("id",s=S)),o=(l=h(t)).length;while(o--)l[o]=(s?"#"+s:":scope")+" "+xe(l[o]);c=l.join(",")}try{return H.apply(n,f.querySelectorAll(c)),n}catch(e){N(t,!0)}finally{s===S&&e.removeAttribute("id")}}}return g(t.replace($,"$1"),e,n,r)}function ue(){var r=[];return function e(t,n){return r.push(t+" ")>b.cacheLength&&delete e[r.shift()],e[t+" "]=n}}function le(e){return e[S]=!0,e}function ce(e){var t=C.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function fe(e,t){var n=e.split("|"),r=n.length;while(r--)b.attrHandle[n[r]]=t}function pe(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function de(t){return function(e){return"input"===e.nodeName.toLowerCase()&&e.type===t}}function he(n){return function(e){var t=e.nodeName.toLowerCase();return("input"===t||"button"===t)&&e.type===n}}function ge(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&&ae(e)===t:e.disabled===t:"label"in e&&e.disabled===t}}function ve(a){return le(function(o){return o=+o,le(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 ye(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}for(e in d=se.support={},i=se.isXML=function(e){var t=e&&e.namespaceURI,n=e&&(e.ownerDocument||e).documentElement;return!Y.test(t||n&&n.nodeName||"HTML")},T=se.setDocument=function(e){var t,n,r=e?e.ownerDocument||e:p;return r!=C&&9===r.nodeType&&r.documentElement&&(a=(C=r).documentElement,E=!i(C),p!=C&&(n=C.defaultView)&&n.top!==n&&(n.addEventListener?n.addEventListener("unload",oe,!1):n.attachEvent&&n.attachEvent("onunload",oe)),d.scope=ce(function(e){return a.appendChild(e).appendChild(C.createElement("div")),"undefined"!=typeof e.querySelectorAll&&!e.querySelectorAll(":scope fieldset div").length}),d.attributes=ce(function(e){return e.className="i",!e.getAttribute("className")}),d.getElementsByTagName=ce(function(e){return e.appendChild(C.createComment("")),!e.getElementsByTagName("*").length}),d.getElementsByClassName=K.test(C.getElementsByClassName),d.getById=ce(function(e){return a.appendChild(e).id=S,!C.getElementsByName||!C.getElementsByName(S).length}),d.getById?(b.filter.ID=function(e){var t=e.replace(te,ne);return function(e){return e.getAttribute("id")===t}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&E){var n=t.getElementById(e);return n?[n]:[]}}):(b.filter.ID=function(e){var n=e.replace(te,ne);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&&E){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=d.getElementsByTagName?function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):d.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},b.find.CLASS=d.getElementsByClassName&&function(e,t){if("undefined"!=typeof t.getElementsByClassName&&E)return t.getElementsByClassName(e)},s=[],v=[],(d.qsa=K.test(C.querySelectorAll))&&(ce(function(e){var t;a.appendChild(e).innerHTML="<a id='"+S+"'></a><select id='"+S+"-\r\\' msallowcapture=''><option selected=''></option></select>",e.querySelectorAll("[msallowcapture^='']").length&&v.push("[*^$]="+M+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||v.push("\\["+M+"*(?:value|"+R+")"),e.querySelectorAll("[id~="+S+"-]").length||v.push("~="),(t=C.createElement("input")).setAttribute("name",""),e.appendChild(t),e.querySelectorAll("[name='']").length||v.push("\\["+M+"*name"+M+"*="+M+"*(?:''|\"\")"),e.querySelectorAll(":checked").length||v.push(":checked"),e.querySelectorAll("a#"+S+"+*").length||v.push(".#.+[+~]"),e.querySelectorAll("\\\f"),v.push("[\\r\\n\\f]")}),ce(function(e){e.innerHTML="<a href='' disabled='disabled'></a><select disabled='disabled'><option/></select>";var t=C.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&v.push("name"+M+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&v.push(":enabled",":disabled"),a.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&v.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),v.push(",.*:")})),(d.matchesSelector=K.test(c=a.matches||a.webkitMatchesSelector||a.mozMatchesSelector||a.oMatchesSelector||a.msMatchesSelector))&&ce(function(e){d.disconnectedMatch=c.call(e,"*"),c.call(e,"[s!='']:x"),s.push("!=",F)}),v=v.length&&new RegExp(v.join("|")),s=s.length&&new RegExp(s.join("|")),t=K.test(a.compareDocumentPosition),y=t||K.test(a.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},j=t?function(e,t){if(e===t)return l=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n||(1&(n=(e.ownerDocument||e)==(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!d.sortDetached&&t.compareDocumentPosition(e)===n?e==C||e.ownerDocument==p&&y(p,e)?-1:t==C||t.ownerDocument==p&&y(p,t)?1:u?P(u,e)-P(u,t):0:4&n?-1:1)}:function(e,t){if(e===t)return l=!0,0;var n,r=0,i=e.parentNode,o=t.parentNode,a=[e],s=[t];if(!i||!o)return e==C?-1:t==C?1:i?-1:o?1:u?P(u,e)-P(u,t):0;if(i===o)return pe(e,t);n=e;while(n=n.parentNode)a.unshift(n);n=t;while(n=n.parentNode)s.unshift(n);while(a[r]===s[r])r++;return r?pe(a[r],s[r]):a[r]==p?-1:s[r]==p?1:0}),C},se.matches=function(e,t){return se(e,null,null,t)},se.matchesSelector=function(e,t){if(T(e),d.matchesSelector&&E&&!N[t+" "]&&(!s||!s.test(t))&&(!v||!v.test(t)))try{var n=c.call(e,t);if(n||d.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(e){N(t,!0)}return 0<se(t,C,null,[e]).length},se.contains=function(e,t){return(e.ownerDocument||e)!=C&&T(e),y(e,t)},se.attr=function(e,t){(e.ownerDocument||e)!=C&&T(e);var n=b.attrHandle[t.toLowerCase()],r=n&&D.call(b.attrHandle,t.toLowerCase())?n(e,t,!E):void 0;return void 0!==r?r:d.attributes||!E?e.getAttribute(t):(r=e.getAttributeNode(t))&&r.specified?r.value:null},se.escape=function(e){return(e+"").replace(re,ie)},se.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},se.uniqueSort=function(e){var t,n=[],r=0,i=0;if(l=!d.detectDuplicates,u=!d.sortStable&&e.slice(0),e.sort(j),l){while(t=e[i++])t===e[i]&&(r=n.push(i));while(r--)e.splice(n[r],1)}return u=null,e},o=se.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(1===i||9===i||11===i){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=o(e)}else if(3===i||4===i)return e.nodeValue}else while(t=e[r++])n+=o(t);return n},(b=se.selectors={cacheLength:50,createPseudo:le,match:G,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(te,ne),e[3]=(e[3]||e[4]||e[5]||"").replace(te,ne),"~="===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]||se.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]&&se.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return G.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&X.test(n)&&(t=h(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(te,ne).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=m[e+" "];return t||(t=new RegExp("(^|"+M+")"+e+"("+M+"|$)"))&&m(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=se.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(B," ")+" ").indexOf(i):"|="===r&&(t===i||t.slice(0,i.length+1)===i+"-"))}},CHILD:function(h,e,t,g,v){var y="nth"!==h.slice(0,3),m="last"!==h.slice(-4),x="of-type"===e;return 1===g&&0===v?function(e){return!!e.parentNode}:function(e,t,n){var r,i,o,a,s,u,l=y!==m?"nextSibling":"previousSibling",c=e.parentNode,f=x&&e.nodeName.toLowerCase(),p=!n&&!x,d=!1;if(c){if(y){while(l){a=e;while(a=a[l])if(x?a.nodeName.toLowerCase()===f:1===a.nodeType)return!1;u=l="only"===h&&!u&&"nextSibling"}return!0}if(u=[m?c.firstChild:c.lastChild],m&&p){d=(s=(r=(i=(o=(a=c)[S]||(a[S]={}))[a.uniqueID]||(o[a.uniqueID]={}))[h]||[])[0]===k&&r[1])&&r[2],a=s&&c.childNodes[s];while(a=++s&&a&&a[l]||(d=s=0)||u.pop())if(1===a.nodeType&&++d&&a===e){i[h]=[k,s,d];break}}else if(p&&(d=s=(r=(i=(o=(a=e)[S]||(a[S]={}))[a.uniqueID]||(o[a.uniqueID]={}))[h]||[])[0]===k&&r[1]),!1===d)while(a=++s&&a&&a[l]||(d=s=0)||u.pop())if((x?a.nodeName.toLowerCase()===f:1===a.nodeType)&&++d&&(p&&((i=(o=a[S]||(a[S]={}))[a.uniqueID]||(o[a.uniqueID]={}))[h]=[k,d]),a===e))break;return(d-=v)===g||d%g==0&&0<=d/g}}},PSEUDO:function(e,o){var t,a=b.pseudos[e]||b.setFilters[e.toLowerCase()]||se.error("unsupported pseudo: "+e);return a[S]?a(o):1<a.length?(t=[e,e,"",o],b.setFilters.hasOwnProperty(e.toLowerCase())?le(function(e,t){var n,r=a(e,o),i=r.length;while(i--)e[n=P(e,r[i])]=!(t[n]=r[i])}):function(e){return a(e,0,t)}):a}},pseudos:{not:le(function(e){var r=[],i=[],s=f(e.replace($,"$1"));return s[S]?le(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:le(function(t){return function(e){return 0<se(t,e).length}}),contains:le(function(t){return t=t.replace(te,ne),function(e){return-1<(e.textContent||o(e)).indexOf(t)}}),lang:le(function(n){return V.test(n||"")||se.error("unsupported lang: "+n),n=n.replace(te,ne).toLowerCase(),function(e){var t;do{if(t=E?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=n.location&&n.location.hash;return t&&t.slice(1)===e.id},root:function(e){return e===a},focus:function(e){return e===C.activeElement&&(!C.hasFocus||C.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:ge(!1),disabled:ge(!0),checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!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 J.test(e.nodeName)},input:function(e){return Q.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||"text"===t.toLowerCase())},first:ve(function(){return[0]}),last:ve(function(e,t){return[t-1]}),eq:ve(function(e,t,n){return[n<0?n+t:n]}),even:ve(function(e,t){for(var n=0;n<t;n+=2)e.push(n);return e}),odd:ve(function(e,t){for(var n=1;n<t;n+=2)e.push(n);return e}),lt:ve(function(e,t,n){for(var r=n<0?n+t:t<n?t:n;0<=--r;)e.push(r);return e}),gt:ve(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]=de(e);for(e in{submit:!0,reset:!0})b.pseudos[e]=he(e);function me(){}function xe(e){for(var t=0,n=e.length,r="";t<n;t++)r+=e[t].value;return r}function be(s,e,t){var u=e.dir,l=e.next,c=l||u,f=t&&"parentNode"===c,p=r++;return e.first?function(e,t,n){while(e=e[u])if(1===e.nodeType||f)return s(e,t,n);return!1}:function(e,t,n){var r,i,o,a=[k,p];if(n){while(e=e[u])if((1===e.nodeType||f)&&s(e,t,n))return!0}else while(e=e[u])if(1===e.nodeType||f)if(i=(o=e[S]||(e[S]={}))[e.uniqueID]||(o[e.uniqueID]={}),l&&l===e.nodeName.toLowerCase())e=e[u]||e;else{if((r=i[c])&&r[0]===k&&r[1]===p)return a[2]=r[2];if((i[c]=a)[2]=s(e,t,n))return!0}return!1}}function we(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 Te(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 Ce(d,h,g,v,y,e){return v&&!v[S]&&(v=Ce(v)),y&&!y[S]&&(y=Ce(y,e)),le(function(e,t,n,r){var i,o,a,s=[],u=[],l=t.length,c=e||function(e,t,n){for(var r=0,i=t.length;r<i;r++)se(e,t[r],n);return n}(h||"*",n.nodeType?[n]:n,[]),f=!d||!e&&h?c:Te(c,s,d,n,r),p=g?y||(e?d:l||v)?[]:t:f;if(g&&g(f,p,n,r),v){i=Te(p,u),v(i,[],n,r),o=i.length;while(o--)(a=i[o])&&(p[u[o]]=!(f[u[o]]=a))}if(e){if(y||d){if(y){i=[],o=p.length;while(o--)(a=p[o])&&i.push(f[o]=a);y(null,p=[],i,r)}o=p.length;while(o--)(a=p[o])&&-1<(i=y?P(e,a):s[o])&&(e[i]=!(t[i]=a))}}else p=Te(p===t?p.splice(l,p.length):p),y?y(null,t,p,r):H.apply(t,p)})}function Ee(e){for(var i,t,n,r=e.length,o=b.relative[e[0].type],a=o||b.relative[" "],s=o?1:0,u=be(function(e){return e===i},a,!0),l=be(function(e){return-1<P(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=[be(we(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 Ce(1<s&&we(c),1<s&&xe(e.slice(0,s-1).concat({value:" "===e[s-2].type?"*":""})).replace($,"$1"),t,s<n&&Ee(e.slice(s,n)),n<r&&Ee(e=e.slice(n)),n<r&&xe(e))}c.push(t)}return we(c)}return me.prototype=b.filters=b.pseudos,b.setFilters=new me,h=se.tokenize=function(e,t){var n,r,i,o,a,s,u,l=x[e+" "];if(l)return t?0:l.slice(0);a=e,s=[],u=b.preFilter;while(a){for(o in n&&!(r=_.exec(a))||(r&&(a=a.slice(r[0].length)||a),s.push(i=[])),n=!1,(r=z.exec(a))&&(n=r.shift(),i.push({value:n,type:r[0].replace($," ")}),a=a.slice(n.length)),b.filter)!(r=G[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?se.error(e):x(e,s).slice(0)},f=se.compile=function(e,t){var n,v,y,m,x,r,i=[],o=[],a=A[e+" "];if(!a){t||(t=h(e)),n=t.length;while(n--)(a=Ee(t[n]))[S]?i.push(a):o.push(a);(a=A(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=k+=null==p?1:Math.random()||.1,g=d.length;for(i&&(w=t==C||t||i);l!==g&&null!=(o=d[l]);l++){if(x&&o){a=0,t||o.ownerDocument==C||(T(o),n=!E);while(s=v[a++])if(s(o,t||C,n)){r.push(o);break}i&&(k=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]=q.call(r));f=Te(f)}H.apply(r,f),i&&!e&&0<f.length&&1<u+y.length&&se.uniqueSort(r)}return i&&(k=h,w=p),c},m?le(r):r))).selector=e}return a},g=se.select=function(e,t,n,r){var i,o,a,s,u,l="function"==typeof e&&e,c=!r&&h(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&&E&&b.relative[o[1].type]){if(!(t=(b.find.ID(a.matches[0].replace(te,ne),t)||[])[0]))return n;l&&(t=t.parentNode),e=e.slice(o.shift().value.length)}i=G.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(te,ne),ee.test(o[0].type)&&ye(t.parentNode)||t))){if(o.splice(i,1),!(e=r.length&&xe(o)))return H.apply(n,r),n;break}}}return(l||f(e,c))(r,t,!E,n,!t||ee.test(e)&&ye(t.parentNode)||t),n},d.sortStable=S.split("").sort(j).join("")===S,d.detectDuplicates=!!l,T(),d.sortDetached=ce(function(e){return 1&e.compareDocumentPosition(C.createElement("fieldset"))}),ce(function(e){return e.innerHTML="<a href='#'></a>","#"===e.firstChild.getAttribute("href")})||fe("type|href|height|width",function(e,t,n){if(!n)return e.getAttribute(t,"type"===t.toLowerCase()?1:2)}),d.attributes&&ce(function(e){return e.innerHTML="<input/>",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")})||fe("value",function(e,t,n){if(!n&&"input"===e.nodeName.toLowerCase())return e.defaultValue}),ce(function(e){return null==e.getAttribute("disabled")})||fe(R,function(e,t,n){var r;if(!n)return!0===e[t]?t.toLowerCase():(r=e.getAttributeNode(t))&&r.specified?r.value:null}),se}(C);S.find=d,S.expr=d.selectors,S.expr[":"]=S.expr.pseudos,S.uniqueSort=S.unique=d.uniqueSort,S.text=d.getText,S.isXMLDoc=d.isXML,S.contains=d.contains,S.escapeSelector=d.escape;var h=function(e,t,n){var r=[],i=void 0!==n;while((e=e[t])&&9!==e.nodeType)if(1===e.nodeType){if(i&&S(e).is(n))break;r.push(e)}return r},T=function(e,t){for(var n=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n},k=S.expr.match.needsContext;function A(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()}var N=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function j(e,n,r){return m(n)?S.grep(e,function(e,t){return!!n.call(e,t,e)!==r}):n.nodeType?S.grep(e,function(e){return e===n!==r}):"string"!=typeof n?S.grep(e,function(e){return-1<i.call(n,e)!==r}):S.filter(n,e,r)}S.filter=function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===r.nodeType?S.find.matchesSelector(r,e)?[r]:[]:S.find.matches(e,S.grep(t,function(e){return 1===e.nodeType}))},S.fn.extend({find:function(e){var t,n,r=this.length,i=this;if("string"!=typeof e)return this.pushStack(S(e).filter(function(){for(t=0;t<r;t++)if(S.contains(i[t],this))return!0}));for(n=this.pushStack([]),t=0;t<r;t++)S.find(e,i[t],n);return 1<r?S.uniqueSort(n):n},filter:function(e){return this.pushStack(j(this,e||[],!1))},not:function(e){return this.pushStack(j(this,e||[],!0))},is:function(e){return!!j(this,"string"==typeof e&&k.test(e)?S(e):e||[],!1).length}});var D,q=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/;(S.fn.init=function(e,t,n){var r,i;if(!e)return this;if(n=n||D,"string"==typeof e){if(!(r="<"===e[0]&&">"===e[e.length-1]&&3<=e.length?[null,e,null]:q.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 S?t[0]:t,S.merge(this,S.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:E,!0)),N.test(r[1])&&S.isPlainObject(t))for(r in t)m(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}return(i=E.getElementById(r[2]))&&(this[0]=i,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):m(e)?void 0!==n.ready?n.ready(e):e(S):S.makeArray(e,this)}).prototype=S.fn,D=S(E);var L=/^(?:parents|prev(?:Until|All))/,H={children:!0,contents:!0,next:!0,prev:!0};function O(e,t){while((e=e[t])&&1!==e.nodeType);return e}S.fn.extend({has:function(e){var t=S(e,this),n=t.length;return this.filter(function(){for(var e=0;e<n;e++)if(S.contains(this,t[e]))return!0})},closest:function(e,t){var n,r=0,i=this.length,o=[],a="string"!=typeof e&&S(e);if(!k.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&&S.find.matchesSelector(n,e))){o.push(n);break}return this.pushStack(1<o.length?S.uniqueSort(o):o)},index:function(e){return e?"string"==typeof e?i.call(S(e),this[0]):i.call(this,e.jquery?e[0]:e):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){return this.pushStack(S.uniqueSort(S.merge(this.get(),S(e,t))))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}}),S.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return h(e,"parentNode")},parentsUntil:function(e,t,n){return h(e,"parentNode",n)},next:function(e){return O(e,"nextSibling")},prev:function(e){return O(e,"previousSibling")},nextAll:function(e){return h(e,"nextSibling")},prevAll:function(e){return h(e,"previousSibling")},nextUntil:function(e,t,n){return h(e,"nextSibling",n)},prevUntil:function(e,t,n){return h(e,"previousSibling",n)},siblings:function(e){return T((e.parentNode||{}).firstChild,e)},children:function(e){return T(e.firstChild)},contents:function(e){return null!=e.contentDocument&&r(e.contentDocument)?e.contentDocument:(A(e,"template")&&(e=e.content||e),S.merge([],e.childNodes))}},function(r,i){S.fn[r]=function(e,t){var n=S.map(this,i,e);return"Until"!==r.slice(-5)&&(t=e),t&&"string"==typeof t&&(n=S.filter(t,n)),1<this.length&&(H[r]||S.uniqueSort(n),L.test(r)&&n.reverse()),this.pushStack(n)}});var P=/[^\x20\t\r\n\f]+/g;function R(e){return e}function M(e){throw e}function I(e,t,n,r){var i;try{e&&m(i=e.promise)?i.call(e).done(t).fail(n):e&&m(i=e.then)?i.call(e,t,n):t.apply(void 0,[e].slice(r))}catch(e){n.apply(void 0,[e])}}S.Callbacks=function(r){var e,n;r="string"==typeof r?(e=r,n={},S.each(e.match(P)||[],function(e,t){n[t]=!0}),n):S.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){S.each(e,function(e,t){m(t)?r.unique&&f.has(t)||s.push(t):t&&t.length&&"string"!==w(t)&&n(t)})}(arguments),t&&!i&&c()),this},remove:function(){return S.each(arguments,function(e,t){var n;while(-1<(n=S.inArray(t,s,n)))s.splice(n,1),n<=l&&l--}),this},has:function(e){return e?-1<S.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},S.extend({Deferred:function(e){var o=[["notify","progress",S.Callbacks("memory"),S.Callbacks("memory"),2],["resolve","done",S.Callbacks("once memory"),S.Callbacks("once memory"),0,"resolved"],["reject","fail",S.Callbacks("once memory"),S.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 S.Deferred(function(r){S.each(o,function(e,t){var n=m(i[t[4]])&&i[t[4]];s[t[1]](function(){var e=n&&n.apply(this,arguments);e&&m(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,m(t)?s?t.call(e,l(u,o,R,s),l(u,o,M,s)):(u++,t.call(e,l(u,o,R,s),l(u,o,M,s),l(u,o,R,o.notifyWith))):(a!==R&&(n=void 0,r=[e]),(s||o.resolveWith)(n,r))}},t=s?e:function(){try{e()}catch(e){S.Deferred.exceptionHook&&S.Deferred.exceptionHook(e,t.stackTrace),u<=i+1&&(a!==M&&(n=void 0,r=[e]),o.rejectWith(n,r))}};i?t():(S.Deferred.getStackHook&&(t.stackTrace=S.Deferred.getStackHook()),C.setTimeout(t))}}return S.Deferred(function(e){o[0][3].add(l(0,e,m(r)?r:R,e.notifyWith)),o[1][3].add(l(0,e,m(t)?t:R)),o[2][3].add(l(0,e,m(n)?n:M))}).promise()},promise:function(e){return null!=e?S.extend(e,a):a}},s={};return S.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=s.call(arguments),o=S.Deferred(),a=function(t){return function(e){r[t]=this,i[t]=1<arguments.length?s.call(arguments):e,--n||o.resolveWith(r,i)}};if(n<=1&&(I(e,o.done(a(t)).resolve,o.reject,!n),"pending"===o.state()||m(i[t]&&i[t].then)))return o.then();while(t--)I(i[t],a(t),o.reject);return o.promise()}});var W=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;S.Deferred.exceptionHook=function(e,t){C.console&&C.console.warn&&e&&W.test(e.name)&&C.console.warn("jQuery.Deferred exception: "+e.message,e.stack,t)},S.readyException=function(e){C.setTimeout(function(){throw e})};var F=S.Deferred();function B(){E.removeEventListener("DOMContentLoaded",B),C.removeEventListener("load",B),S.ready()}S.fn.ready=function(e){return F.then(e)["catch"](function(e){S.readyException(e)}),this},S.extend({isReady:!1,readyWait:1,ready:function(e){(!0===e?--S.readyWait:S.isReady)||(S.isReady=!0)!==e&&0<--S.readyWait||F.resolveWith(E,[S])}}),S.ready.then=F.then,"complete"===E.readyState||"loading"!==E.readyState&&!E.documentElement.doScroll?C.setTimeout(S.ready):(E.addEventListener("DOMContentLoaded",B),C.addEventListener("load",B));var $=function(e,t,n,r,i,o,a){var s=0,u=e.length,l=null==n;if("object"===w(n))for(s in i=!0,n)$(e,t,s,n[s],!0,o,a);else if(void 0!==r&&(i=!0,m(r)||(a=!0),l&&(a?(t.call(e,r),t=null):(l=t,t=function(e,t,n){return l.call(S(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},_=/^-ms-/,z=/-([a-z])/g;function U(e,t){return t.toUpperCase()}function X(e){return e.replace(_,"ms-").replace(z,U)}var V=function(e){return 1===e.nodeType||9===e.nodeType||!+e.nodeType};function G(){this.expando=S.expando+G.uid++}G.uid=1,G.prototype={cache:function(e){var t=e[this.expando];return t||(t={},V(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[X(t)]=n;else for(r in t)i[X(r)]=t[r];return i},get:function(e,t){return void 0===t?this.cache(e):e[this.expando]&&e[this.expando][X(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(X):(t=X(t))in r?[t]:t.match(P)||[]).length;while(n--)delete r[t[n]]}(void 0===t||S.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&&!S.isEmptyObject(t)}};var Y=new G,Q=new G,J=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,K=/[A-Z]/g;function Z(e,t,n){var r,i;if(void 0===n&&1===e.nodeType)if(r="data-"+t.replace(K,"-$&").toLowerCase(),"string"==typeof(n=e.getAttribute(r))){try{n="true"===(i=n)||"false"!==i&&("null"===i?null:i===+i+""?+i:J.test(i)?JSON.parse(i):i)}catch(e){}Q.set(e,t,n)}else n=void 0;return n}S.extend({hasData:function(e){return Q.hasData(e)||Y.hasData(e)},data:function(e,t,n){return Q.access(e,t,n)},removeData:function(e,t){Q.remove(e,t)},_data:function(e,t,n){return Y.access(e,t,n)},_removeData:function(e,t){Y.remove(e,t)}}),S.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=Q.get(o),1===o.nodeType&&!Y.get(o,"hasDataAttrs"))){t=a.length;while(t--)a[t]&&0===(r=a[t].name).indexOf("data-")&&(r=X(r.slice(5)),Z(o,r,i[r]));Y.set(o,"hasDataAttrs",!0)}return i}return"object"==typeof n?this.each(function(){Q.set(this,n)}):$(this,function(e){var t;if(o&&void 0===e)return void 0!==(t=Q.get(o,n))?t:void 0!==(t=Z(o,n))?t:void 0;this.each(function(){Q.set(this,n,e)})},null,e,1<arguments.length,null,!0)},removeData:function(e){return this.each(function(){Q.remove(this,e)})}}),S.extend({queue:function(e,t,n){var r;if(e)return t=(t||"fx")+"queue",r=Y.get(e,t),n&&(!r||Array.isArray(n)?r=Y.access(e,t,S.makeArray(n)):r.push(n)),r||[]},dequeue:function(e,t){t=t||"fx";var n=S.queue(e,t),r=n.length,i=n.shift(),o=S._queueHooks(e,t);"inprogress"===i&&(i=n.shift(),r--),i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,function(){S.dequeue(e,t)},o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return Y.get(e,n)||Y.access(e,n,{empty:S.Callbacks("once memory").add(function(){Y.remove(e,[t+"queue",n])})})}}),S.fn.extend({queue:function(t,n){var e=2;return"string"!=typeof t&&(n=t,t="fx",e--),arguments.length<e?S.queue(this[0],t):void 0===n?this:this.each(function(){var e=S.queue(this,t,n);S._queueHooks(this,t),"fx"===t&&"inprogress"!==e[0]&&S.dequeue(this,t)})},dequeue:function(e){return this.each(function(){S.dequeue(this,e)})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,t){var n,r=1,i=S.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=Y.get(o[a],e+"queueHooks"))&&n.empty&&(r++,n.empty.add(s));return s(),i.promise(t)}});var ee=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,te=new RegExp("^(?:([+-])=|)("+ee+")([a-z%]*)$","i"),ne=["Top","Right","Bottom","Left"],re=E.documentElement,ie=function(e){return S.contains(e.ownerDocument,e)},oe={composed:!0};re.getRootNode&&(ie=function(e){return S.contains(e.ownerDocument,e)||e.getRootNode(oe)===e.ownerDocument});var ae=function(e,t){return"none"===(e=t||e).style.display||""===e.style.display&&ie(e)&&"none"===S.css(e,"display")};function se(e,t,n,r){var i,o,a=20,s=r?function(){return r.cur()}:function(){return S.css(e,t,"")},u=s(),l=n&&n[3]||(S.cssNumber[t]?"":"px"),c=e.nodeType&&(S.cssNumber[t]||"px"!==l&&+u)&&te.exec(S.css(e,t));if(c&&c[3]!==l){u/=2,l=l||c[3],c=+u||1;while(a--)S.style(e,t,c+l),(1-o)*(1-(o=s()/u||.5))<=0&&(a=0),c/=o;c*=2,S.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 ue={};function le(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]=Y.get(r,"display")||null,l[c]||(r.style.display="")),""===r.style.display&&ae(r)&&(l[c]=(u=a=o=void 0,a=(i=r).ownerDocument,s=i.nodeName,(u=ue[s])||(o=a.body.appendChild(a.createElement(s)),u=S.css(o,"display"),o.parentNode.removeChild(o),"none"===u&&(u="block"),ue[s]=u)))):"none"!==n&&(l[c]="none",Y.set(r,"display",n)));for(c=0;c<f;c++)null!=l[c]&&(e[c].style.display=l[c]);return e}S.fn.extend({show:function(){return le(this,!0)},hide:function(){return le(this)},toggle:function(e){return"boolean"==typeof e?e?this.show():this.hide():this.each(function(){ae(this)?S(this).show():S(this).hide()})}});var ce,fe,pe=/^(?:checkbox|radio)$/i,de=/<([a-z][^\/\0>\x20\t\r\n\f]*)/i,he=/^$|^module$|\/(?:java|ecma)script/i;ce=E.createDocumentFragment().appendChild(E.createElement("div")),(fe=E.createElement("input")).setAttribute("type","radio"),fe.setAttribute("checked","checked"),fe.setAttribute("name","t"),ce.appendChild(fe),y.checkClone=ce.cloneNode(!0).cloneNode(!0).lastChild.checked,ce.innerHTML="<textarea>x</textarea>",y.noCloneChecked=!!ce.cloneNode(!0).lastChild.defaultValue,ce.innerHTML="<option></option>",y.option=!!ce.lastChild;var ge={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 ve(e,t){var n;return n="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&A(e,t)?S.merge([e],n):n}function ye(e,t){for(var n=0,r=e.length;n<r;n++)Y.set(e[n],"globalEval",!t||Y.get(t[n],"globalEval"))}ge.tbody=ge.tfoot=ge.colgroup=ge.caption=ge.thead,ge.th=ge.td,y.option||(ge.optgroup=ge.option=[1,"<select multiple='multiple'>","</select>"]);var me=/<|&#?\w+;/;function xe(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"===w(o))S.merge(p,o.nodeType?[o]:o);else if(me.test(o)){a=a||f.appendChild(t.createElement("div")),s=(de.exec(o)||["",""])[1].toLowerCase(),u=ge[s]||ge._default,a.innerHTML=u[1]+S.htmlPrefilter(o)+u[2],c=u[0];while(c--)a=a.lastChild;S.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<S.inArray(o,r))i&&i.push(o);else if(l=ie(o),a=ve(f.appendChild(o),"script"),l&&ye(a),n){c=0;while(o=a[c++])he.test(o.type||"")&&n.push(o)}return f}var be=/^([^.]*)(?:\.(.+)|)/;function we(){return!0}function Te(){return!1}function Ce(e,t){return e===function(){try{return E.activeElement}catch(e){}}()==("focus"===t)}function Ee(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)Ee(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=Te;else if(!i)return e;return 1===o&&(a=i,(i=function(e){return S().off(e),a.apply(this,arguments)}).guid=a.guid||(a.guid=S.guid++)),e.each(function(){S.event.add(this,t,i,r,n)})}function Se(e,i,o){o?(Y.set(e,i,!1),S.event.add(e,i,{namespace:!1,handler:function(e){var t,n,r=Y.get(this,i);if(1&e.isTrigger&&this[i]){if(r.length)(S.event.special[i]||{}).delegateType&&e.stopPropagation();else if(r=s.call(arguments),Y.set(this,i,r),t=o(this,i),this[i](),r!==(n=Y.get(this,i))||t?Y.set(this,i,!1):n={},r!==n)return e.stopImmediatePropagation(),e.preventDefault(),n&&n.value}else r.length&&(Y.set(this,i,{value:S.event.trigger(S.extend(r[0],S.Event.prototype),r.slice(1),this)}),e.stopImmediatePropagation())}})):void 0===Y.get(e,i)&&S.event.add(e,i,we)}S.event={global:{},add:function(t,e,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,v=Y.get(t);if(V(t)){n.handler&&(n=(o=n).handler,i=o.selector),i&&S.find.matchesSelector(re,i),n.guid||(n.guid=S.guid++),(u=v.events)||(u=v.events=Object.create(null)),(a=v.handle)||(a=v.handle=function(e){return"undefined"!=typeof S&&S.event.triggered!==e.type?S.event.dispatch.apply(t,arguments):void 0}),l=(e=(e||"").match(P)||[""]).length;while(l--)d=g=(s=be.exec(e[l])||[])[1],h=(s[2]||"").split(".").sort(),d&&(f=S.event.special[d]||{},d=(i?f.delegateType:f.bindType)||d,f=S.event.special[d]||{},c=S.extend({type:d,origType:g,data:r,handler:n,guid:n.guid,selector:i,needsContext:i&&S.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),S.event.global[d]=!0)}},remove:function(e,t,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,v=Y.hasData(e)&&Y.get(e);if(v&&(u=v.events)){l=(t=(t||"").match(P)||[""]).length;while(l--)if(d=g=(s=be.exec(t[l])||[])[1],h=(s[2]||"").split(".").sort(),d){f=S.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)||S.removeEvent(e,d,v.handle),delete u[d])}else for(d in u)S.event.remove(e,d+t[l],n,r,!0);S.isEmptyObject(u)&&Y.remove(e,"handle events")}},dispatch:function(e){var t,n,r,i,o,a,s=new Array(arguments.length),u=S.event.fix(e),l=(Y.get(this,"events")||Object.create(null))[u.type]||[],c=S.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=S.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=((S.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<S(i,this).index(l):S.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(S.Event.prototype,t,{enumerable:!0,configurable:!0,get:m(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[S.expando]?e:new S.Event(e)},special:{load:{noBubble:!0},click:{setup:function(e){var t=this||e;return pe.test(t.type)&&t.click&&A(t,"input")&&Se(t,"click",we),!1},trigger:function(e){var t=this||e;return pe.test(t.type)&&t.click&&A(t,"input")&&Se(t,"click"),!0},_default:function(e){var t=e.target;return pe.test(t.type)&&t.click&&A(t,"input")&&Y.get(t,"click")||A(t,"a")}},beforeunload:{postDispatch:function(e){void 0!==e.result&&e.originalEvent&&(e.originalEvent.returnValue=e.result)}}}},S.removeEvent=function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n)},S.Event=function(e,t){if(!(this instanceof S.Event))return new S.Event(e,t);e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||void 0===e.defaultPrevented&&!1===e.returnValue?we:Te,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&&S.extend(this,t),this.timeStamp=e&&e.timeStamp||Date.now(),this[S.expando]=!0},S.Event.prototype={constructor:S.Event,isDefaultPrevented:Te,isPropagationStopped:Te,isImmediatePropagationStopped:Te,isSimulated:!1,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=we,e&&!this.isSimulated&&e.preventDefault()},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=we,e&&!this.isSimulated&&e.stopPropagation()},stopImmediatePropagation:function(){var e=this.originalEvent;this.isImmediatePropagationStopped=we,e&&!this.isSimulated&&e.stopImmediatePropagation(),this.stopPropagation()}},S.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},S.event.addProp),S.each({focus:"focusin",blur:"focusout"},function(e,t){S.event.special[e]={setup:function(){return Se(this,e,Ce),!1},trigger:function(){return Se(this,e),!0},_default:function(){return!0},delegateType:t}}),S.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(e,i){S.event.special[e]={delegateType:i,bindType:i,handle:function(e){var t,n=e.relatedTarget,r=e.handleObj;return n&&(n===this||S.contains(this,n))||(e.type=r.origType,t=r.handler.apply(this,arguments),e.type=i),t}}}),S.fn.extend({on:function(e,t,n,r){return Ee(this,e,t,n,r)},one:function(e,t,n,r){return Ee(this,e,t,n,r,1)},off:function(e,t,n){var r,i;if(e&&e.preventDefault&&e.handleObj)return r=e.handleObj,S(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=Te),this.each(function(){S.event.remove(this,e,n,t)})}});var ke=/<script|<style|<link/i,Ae=/checked\s*(?:[^=]|=\s*.checked.)/i,Ne=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;function je(e,t){return A(e,"table")&&A(11!==t.nodeType?t:t.firstChild,"tr")&&S(e).children("tbody")[0]||e}function De(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function qe(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Le(e,t){var n,r,i,o,a,s;if(1===t.nodeType){if(Y.hasData(e)&&(s=Y.get(e).events))for(i in Y.remove(t,"handle events"),s)for(n=0,r=s[i].length;n<r;n++)S.event.add(t,i,s[i][n]);Q.hasData(e)&&(o=Q.access(e),a=S.extend({},o),Q.set(t,a))}}function He(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=m(d);if(h||1<f&&"string"==typeof d&&!y.checkClone&&Ae.test(d))return n.each(function(e){var t=n.eq(e);h&&(r[0]=d.call(this,e,t.html())),He(t,r,i,o)});if(f&&(t=(e=xe(r,n[0].ownerDocument,!1,n,o)).firstChild,1===e.childNodes.length&&(e=t),t||o)){for(s=(a=S.map(ve(e,"script"),De)).length;c<f;c++)u=e,c!==p&&(u=S.clone(u,!0,!0),s&&S.merge(a,ve(u,"script"))),i.call(n[c],u,c);if(s)for(l=a[a.length-1].ownerDocument,S.map(a,qe),c=0;c<s;c++)u=a[c],he.test(u.type||"")&&!Y.access(u,"globalEval")&&S.contains(l,u)&&(u.src&&"module"!==(u.type||"").toLowerCase()?S._evalUrl&&!u.noModule&&S._evalUrl(u.src,{nonce:u.nonce||u.getAttribute("nonce")},l):b(u.textContent.replace(Ne,""),u,l))}return n}function Oe(e,t,n){for(var r,i=t?S.filter(t,e):e,o=0;null!=(r=i[o]);o++)n||1!==r.nodeType||S.cleanData(ve(r)),r.parentNode&&(n&&ie(r)&&ye(ve(r,"script")),r.parentNode.removeChild(r));return e}S.extend({htmlPrefilter:function(e){return e},clone:function(e,t,n){var r,i,o,a,s,u,l,c=e.cloneNode(!0),f=ie(e);if(!(y.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||S.isXMLDoc(e)))for(a=ve(c),r=0,i=(o=ve(e)).length;r<i;r++)s=o[r],u=a[r],void 0,"input"===(l=u.nodeName.toLowerCase())&&pe.test(s.type)?u.checked=s.checked:"input"!==l&&"textarea"!==l||(u.defaultValue=s.defaultValue);if(t)if(n)for(o=o||ve(e),a=a||ve(c),r=0,i=o.length;r<i;r++)Le(o[r],a[r]);else Le(e,c);return 0<(a=ve(c,"script")).length&&ye(a,!f&&ve(e,"script")),c},cleanData:function(e){for(var t,n,r,i=S.event.special,o=0;void 0!==(n=e[o]);o++)if(V(n)){if(t=n[Y.expando]){if(t.events)for(r in t.events)i[r]?S.event.remove(n,r):S.removeEvent(n,r,t.handle);n[Y.expando]=void 0}n[Q.expando]&&(n[Q.expando]=void 0)}}}),S.fn.extend({detach:function(e){return Oe(this,e,!0)},remove:function(e){return Oe(this,e)},text:function(e){return $(this,function(e){return void 0===e?S.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 He(this,arguments,function(e){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||je(this,e).appendChild(e)})},prepend:function(){return He(this,arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=je(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return He(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return He(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&&(S.cleanData(ve(e,!1)),e.textContent="");return this},clone:function(e,t){return e=null!=e&&e,t=null==t?e:t,this.map(function(){return S.clone(this,e,t)})},html:function(e){return $(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&&!ke.test(e)&&!ge[(de.exec(e)||["",""])[1].toLowerCase()]){e=S.htmlPrefilter(e);try{for(;n<r;n++)1===(t=this[n]||{}).nodeType&&(S.cleanData(ve(t,!1)),t.innerHTML=e);t=0}catch(e){}}t&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(){var n=[];return He(this,arguments,function(e){var t=this.parentNode;S.inArray(this,n)<0&&(S.cleanData(ve(this)),t&&t.replaceChild(e,this))},n)}}),S.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,a){S.fn[e]=function(e){for(var t,n=[],r=S(e),i=r.length-1,o=0;o<=i;o++)t=o===i?this:this.clone(!0),S(r[o])[a](t),u.apply(n,t.get());return this.pushStack(n)}});var Pe=new RegExp("^("+ee+")(?!px)[a-z%]+$","i"),Re=function(e){var t=e.ownerDocument.defaultView;return t&&t.opener||(t=C),t.getComputedStyle(e)},Me=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},Ie=new RegExp(ne.join("|"),"i");function We(e,t,n){var r,i,o,a,s=e.style;return(n=n||Re(e))&&(""!==(a=n.getPropertyValue(t)||n[t])||ie(e)||(a=S.style(e,t)),!y.pixelBoxStyles()&&Pe.test(a)&&Ie.test(t)&&(r=s.width,i=s.minWidth,o=s.maxWidth,s.minWidth=s.maxWidth=s.width=a,a=n.width,s.width=r,s.minWidth=i,s.maxWidth=o)),void 0!==a?a+"":a}function Fe(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%",re.appendChild(u).appendChild(l);var e=C.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),re.removeChild(u),l=null}}function t(e){return Math.round(parseFloat(e))}var n,r,i,o,a,s,u=E.createElement("div"),l=E.createElement("div");l.style&&(l.style.backgroundClip="content-box",l.cloneNode(!0).style.backgroundClip="",y.clearCloneStyle="content-box"===l.style.backgroundClip,S.extend(y,{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=E.createElement("table"),t=E.createElement("tr"),n=E.createElement("div"),e.style.cssText="position:absolute;left:-11111px;border-collapse:separate",t.style.cssText="border:1px solid",t.style.height="1px",n.style.height="9px",n.style.display="block",re.appendChild(e).appendChild(t).appendChild(n),r=C.getComputedStyle(t),a=parseInt(r.height,10)+parseInt(r.borderTopWidth,10)+parseInt(r.borderBottomWidth,10)===t.offsetHeight,re.removeChild(e)),a}}))}();var Be=["Webkit","Moz","ms"],$e=E.createElement("div").style,_e={};function ze(e){var t=S.cssProps[e]||_e[e];return t||(e in $e?e:_e[e]=function(e){var t=e[0].toUpperCase()+e.slice(1),n=Be.length;while(n--)if((e=Be[n]+t)in $e)return e}(e)||e)}var Ue=/^(none|table(?!-c[ea]).+)/,Xe=/^--/,Ve={position:"absolute",visibility:"hidden",display:"block"},Ge={letterSpacing:"0",fontWeight:"400"};function Ye(e,t,n){var r=te.exec(t);return r?Math.max(0,r[2]-(n||0))+(r[3]||"px"):t}function Qe(e,t,n,r,i,o){var a="width"===t?1:0,s=0,u=0;if(n===(r?"border":"content"))return 0;for(;a<4;a+=2)"margin"===n&&(u+=S.css(e,n+ne[a],!0,i)),r?("content"===n&&(u-=S.css(e,"padding"+ne[a],!0,i)),"margin"!==n&&(u-=S.css(e,"border"+ne[a]+"Width",!0,i))):(u+=S.css(e,"padding"+ne[a],!0,i),"padding"!==n?u+=S.css(e,"border"+ne[a]+"Width",!0,i):s+=S.css(e,"border"+ne[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}function Je(e,t,n){var r=Re(e),i=(!y.boxSizingReliable()||n)&&"border-box"===S.css(e,"boxSizing",!1,r),o=i,a=We(e,t,r),s="offset"+t[0].toUpperCase()+t.slice(1);if(Pe.test(a)){if(!n)return a;a="auto"}return(!y.boxSizingReliable()&&i||!y.reliableTrDimensions()&&A(e,"tr")||"auto"===a||!parseFloat(a)&&"inline"===S.css(e,"display",!1,r))&&e.getClientRects().length&&(i="border-box"===S.css(e,"boxSizing",!1,r),(o=s in e)&&(a=e[s])),(a=parseFloat(a)||0)+Qe(e,t,n||(i?"border":"content"),o,r,a)+"px"}function Ke(e,t,n,r,i){return new Ke.prototype.init(e,t,n,r,i)}S.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=We(e,"opacity");return""===n?"1":n}}}},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!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,widows:!0,zIndex:!0,zoom:!0},cssProps:{},style:function(e,t,n,r){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var i,o,a,s=X(t),u=Xe.test(t),l=e.style;if(u||(t=ze(s)),a=S.cssHooks[t]||S.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=te.exec(n))&&i[1]&&(n=se(e,t,i),o="number"),null!=n&&n==n&&("number"!==o||u||(n+=i&&i[3]||(S.cssNumber[s]?"":"px")),y.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=X(t);return Xe.test(t)||(t=ze(s)),(a=S.cssHooks[t]||S.cssHooks[s])&&"get"in a&&(i=a.get(e,!0,n)),void 0===i&&(i=We(e,t,r)),"normal"===i&&t in Ge&&(i=Ge[t]),""===n||n?(o=parseFloat(i),!0===n||isFinite(o)?o||0:i):i}}),S.each(["height","width"],function(e,u){S.cssHooks[u]={get:function(e,t,n){if(t)return!Ue.test(S.css(e,"display"))||e.getClientRects().length&&e.getBoundingClientRect().width?Je(e,u,n):Me(e,Ve,function(){return Je(e,u,n)})},set:function(e,t,n){var r,i=Re(e),o=!y.scrollboxSize()&&"absolute"===i.position,a=(o||n)&&"border-box"===S.css(e,"boxSizing",!1,i),s=n?Qe(e,u,n,a,i):0;return a&&o&&(s-=Math.ceil(e["offset"+u[0].toUpperCase()+u.slice(1)]-parseFloat(i[u])-Qe(e,u,"border",!1,i)-.5)),s&&(r=te.exec(t))&&"px"!==(r[3]||"px")&&(e.style[u]=t,t=S.css(e,u)),Ye(0,t,s)}}}),S.cssHooks.marginLeft=Fe(y.reliableMarginLeft,function(e,t){if(t)return(parseFloat(We(e,"marginLeft"))||e.getBoundingClientRect().left-Me(e,{marginLeft:0},function(){return e.getBoundingClientRect().left}))+"px"}),S.each({margin:"",padding:"",border:"Width"},function(i,o){S.cssHooks[i+o]={expand:function(e){for(var t=0,n={},r="string"==typeof e?e.split(" "):[e];t<4;t++)n[i+ne[t]+o]=r[t]||r[t-2]||r[0];return n}},"margin"!==i&&(S.cssHooks[i+o].set=Ye)}),S.fn.extend({css:function(e,t){return $(this,function(e,t,n){var r,i,o={},a=0;if(Array.isArray(t)){for(r=Re(e),i=t.length;a<i;a++)o[t[a]]=S.css(e,t[a],!1,r);return o}return void 0!==n?S.style(e,t,n):S.css(e,t)},e,t,1<arguments.length)}}),((S.Tween=Ke).prototype={constructor:Ke,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||S.easing._default,this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(S.cssNumber[n]?"":"px")},cur:function(){var e=Ke.propHooks[this.prop];return e&&e.get?e.get(this):Ke.propHooks._default.get(this)},run:function(e){var t,n=Ke.propHooks[this.prop];return this.options.duration?this.pos=t=S.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):Ke.propHooks._default.set(this),this}}).init.prototype=Ke.prototype,(Ke.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=S.css(e.elem,e.prop,""))&&"auto"!==t?t:0},set:function(e){S.fx.step[e.prop]?S.fx.step[e.prop](e):1!==e.elem.nodeType||!S.cssHooks[e.prop]&&null==e.elem.style[ze(e.prop)]?e.elem[e.prop]=e.now:S.style(e.elem,e.prop,e.now+e.unit)}}}).scrollTop=Ke.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},S.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2},_default:"swing"},S.fx=Ke.prototype.init,S.fx.step={};var Ze,et,tt,nt,rt=/^(?:toggle|show|hide)$/,it=/queueHooks$/;function ot(){et&&(!1===E.hidden&&C.requestAnimationFrame?C.requestAnimationFrame(ot):C.setTimeout(ot,S.fx.interval),S.fx.tick())}function at(){return C.setTimeout(function(){Ze=void 0}),Ze=Date.now()}function st(e,t){var n,r=0,i={height:e};for(t=t?1:0;r<4;r+=2-t)i["margin"+(n=ne[r])]=i["padding"+n]=e;return t&&(i.opacity=i.width=e),i}function ut(e,t,n){for(var r,i=(lt.tweeners[t]||[]).concat(lt.tweeners["*"]),o=0,a=i.length;o<a;o++)if(r=i[o].call(n,t,e))return r}function lt(o,e,t){var n,a,r=0,i=lt.prefilters.length,s=S.Deferred().always(function(){delete u.elem}),u=function(){if(a)return!1;for(var e=Ze||at(),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:S.extend({},e),opts:S.extend(!0,{specialEasing:{},easing:S.easing._default},t),originalProperties:e,originalOptions:t,startTime:Ze||at(),duration:t.duration,tweens:[],createTween:function(e,t){var n=S.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=X(n)],o=e[n],Array.isArray(o)&&(i=o[1],o=e[n]=o[0]),n!==r&&(e[r]=o,delete e[n]),(a=S.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=lt.prefilters[r].call(l,o,c,l.opts))return m(n.stop)&&(S._queueHooks(l.elem,l.opts.queue).stop=n.stop.bind(n)),n;return S.map(c,ut,l),m(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),S.fx.timer(S.extend(u,{elem:o,anim:l,queue:l.opts.queue})),l}S.Animation=S.extend(lt,{tweeners:{"*":[function(e,t){var n=this.createTween(e,t);return se(n.elem,e,te.exec(t),n),n}]},tweener:function(e,t){m(e)?(t=e,e=["*"]):e=e.match(P);for(var n,r=0,i=e.length;r<i;r++)n=e[r],lt.tweeners[n]=lt.tweeners[n]||[],lt.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&&ae(e),v=Y.get(e,"fxshow");for(r in n.queue||(null==(a=S._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--,S.queue(e,"fx").length||a.empty.fire()})})),t)if(i=t[r],rt.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]||S.style(e,r)}if((u=!S.isEmptyObject(t))||!S.isEmptyObject(d))for(r in f&&1===e.nodeType&&(n.overflow=[h.overflow,h.overflowX,h.overflowY],null==(l=v&&v.display)&&(l=Y.get(e,"display")),"none"===(c=S.css(e,"display"))&&(l?c=l:(le([e],!0),l=e.style.display||l,c=S.css(e,"display"),le([e]))),("inline"===c||"inline-block"===c&&null!=l)&&"none"===S.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=Y.access(e,"fxshow",{display:l}),o&&(v.hidden=!g),g&&le([e],!0),p.done(function(){for(r in g||le([e]),Y.remove(e,"fxshow"),d)S.style(e,r,d[r])})),u=ut(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?lt.prefilters.unshift(e):lt.prefilters.push(e)}}),S.speed=function(e,t,n){var r=e&&"object"==typeof e?S.extend({},e):{complete:n||!n&&t||m(e)&&e,duration:e,easing:n&&t||t&&!m(t)&&t};return S.fx.off?r.duration=0:"number"!=typeof r.duration&&(r.duration in S.fx.speeds?r.duration=S.fx.speeds[r.duration]:r.duration=S.fx.speeds._default),null!=r.queue&&!0!==r.queue||(r.queue="fx"),r.old=r.complete,r.complete=function(){m(r.old)&&r.old.call(this),r.queue&&S.dequeue(this,r.queue)},r},S.fn.extend({fadeTo:function(e,t,n,r){return this.filter(ae).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(t,e,n,r){var i=S.isEmptyObject(t),o=S.speed(e,n,r),a=function(){var e=lt(this,S.extend({},t),o);(i||Y.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=S.timers,r=Y.get(this);if(t)r[t]&&r[t].stop&&a(r[t]);else for(t in r)r[t]&&r[t].stop&&it.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||S.dequeue(this,i)})},finish:function(a){return!1!==a&&(a=a||"fx"),this.each(function(){var e,t=Y.get(this),n=t[a+"queue"],r=t[a+"queueHooks"],i=S.timers,o=n?n.length:0;for(t.finish=!0,S.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})}}),S.each(["toggle","show","hide"],function(e,r){var i=S.fn[r];S.fn[r]=function(e,t,n){return null==e||"boolean"==typeof e?i.apply(this,arguments):this.animate(st(r,!0),e,t,n)}}),S.each({slideDown:st("show"),slideUp:st("hide"),slideToggle:st("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,r){S.fn[e]=function(e,t,n){return this.animate(r,e,t,n)}}),S.timers=[],S.fx.tick=function(){var e,t=0,n=S.timers;for(Ze=Date.now();t<n.length;t++)(e=n[t])()||n[t]!==e||n.splice(t--,1);n.length||S.fx.stop(),Ze=void 0},S.fx.timer=function(e){S.timers.push(e),S.fx.start()},S.fx.interval=13,S.fx.start=function(){et||(et=!0,ot())},S.fx.stop=function(){et=null},S.fx.speeds={slow:600,fast:200,_default:400},S.fn.delay=function(r,e){return r=S.fx&&S.fx.speeds[r]||r,e=e||"fx",this.queue(e,function(e,t){var n=C.setTimeout(e,r);t.stop=function(){C.clearTimeout(n)}})},tt=E.createElement("input"),nt=E.createElement("select").appendChild(E.createElement("option")),tt.type="checkbox",y.checkOn=""!==tt.value,y.optSelected=nt.selected,(tt=E.createElement("input")).value="t",tt.type="radio",y.radioValue="t"===tt.value;var ct,ft=S.expr.attrHandle;S.fn.extend({attr:function(e,t){return $(this,S.attr,e,t,1<arguments.length)},removeAttr:function(e){return this.each(function(){S.removeAttr(this,e)})}}),S.extend({attr:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return"undefined"==typeof e.getAttribute?S.prop(e,t,n):(1===o&&S.isXMLDoc(e)||(i=S.attrHooks[t.toLowerCase()]||(S.expr.match.bool.test(t)?ct:void 0)),void 0!==n?null===n?void S.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=S.find.attr(e,t))?void 0:r)},attrHooks:{type:{set:function(e,t){if(!y.radioValue&&"radio"===t&&A(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(P);if(i&&1===e.nodeType)while(n=i[r++])e.removeAttribute(n)}}),ct={set:function(e,t,n){return!1===t?S.removeAttr(e,n):e.setAttribute(n,n),n}},S.each(S.expr.match.bool.source.match(/\w+/g),function(e,t){var a=ft[t]||S.find.attr;ft[t]=function(e,t,n){var r,i,o=t.toLowerCase();return n||(i=ft[o],ft[o]=r,r=null!=a(e,t,n)?o:null,ft[o]=i),r}});var pt=/^(?:input|select|textarea|button)$/i,dt=/^(?:a|area)$/i;function ht(e){return(e.match(P)||[]).join(" ")}function gt(e){return e.getAttribute&&e.getAttribute("class")||""}function vt(e){return Array.isArray(e)?e:"string"==typeof e&&e.match(P)||[]}S.fn.extend({prop:function(e,t){return $(this,S.prop,e,t,1<arguments.length)},removeProp:function(e){return this.each(function(){delete this[S.propFix[e]||e]})}}),S.extend({prop:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return 1===o&&S.isXMLDoc(e)||(t=S.propFix[t]||t,i=S.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=S.find.attr(e,"tabindex");return t?parseInt(t,10):pt.test(e.nodeName)||dt.test(e.nodeName)&&e.href?0:-1}}},propFix:{"for":"htmlFor","class":"className"}}),y.optSelected||(S.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)}}),S.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){S.propFix[this.toLowerCase()]=this}),S.fn.extend({addClass:function(t){var e,n,r,i,o,a,s,u=0;if(m(t))return this.each(function(e){S(this).addClass(t.call(this,e,gt(this)))});if((e=vt(t)).length)while(n=this[u++])if(i=gt(n),r=1===n.nodeType&&" "+ht(i)+" "){a=0;while(o=e[a++])r.indexOf(" "+o+" ")<0&&(r+=o+" ");i!==(s=ht(r))&&n.setAttribute("class",s)}return this},removeClass:function(t){var e,n,r,i,o,a,s,u=0;if(m(t))return this.each(function(e){S(this).removeClass(t.call(this,e,gt(this)))});if(!arguments.length)return this.attr("class","");if((e=vt(t)).length)while(n=this[u++])if(i=gt(n),r=1===n.nodeType&&" "+ht(i)+" "){a=0;while(o=e[a++])while(-1<r.indexOf(" "+o+" "))r=r.replace(" "+o+" "," ");i!==(s=ht(r))&&n.setAttribute("class",s)}return this},toggleClass:function(i,t){var o=typeof i,a="string"===o||Array.isArray(i);return"boolean"==typeof t&&a?t?this.addClass(i):this.removeClass(i):m(i)?this.each(function(e){S(this).toggleClass(i.call(this,e,gt(this),t),t)}):this.each(function(){var e,t,n,r;if(a){t=0,n=S(this),r=vt(i);while(e=r[t++])n.hasClass(e)?n.removeClass(e):n.addClass(e)}else void 0!==i&&"boolean"!==o||((e=gt(this))&&Y.set(this,"__className__",e),this.setAttribute&&this.setAttribute("class",e||!1===i?"":Y.get(this,"__className__")||""))})},hasClass:function(e){var t,n,r=0;t=" "+e+" ";while(n=this[r++])if(1===n.nodeType&&-1<(" "+ht(gt(n))+" ").indexOf(t))return!0;return!1}});var yt=/\r/g;S.fn.extend({val:function(n){var r,e,i,t=this[0];return arguments.length?(i=m(n),this.each(function(e){var t;1===this.nodeType&&(null==(t=i?n.call(this,e,S(this).val()):n)?t="":"number"==typeof t?t+="":Array.isArray(t)&&(t=S.map(t,function(e){return null==e?"":e+""})),(r=S.valHooks[this.type]||S.valHooks[this.nodeName.toLowerCase()])&&"set"in r&&void 0!==r.set(this,t,"value")||(this.value=t))})):t?(r=S.valHooks[t.type]||S.valHooks[t.nodeName.toLowerCase()])&&"get"in r&&void 0!==(e=r.get(t,"value"))?e:"string"==typeof(e=t.value)?e.replace(yt,""):null==e?"":e:void 0}}),S.extend({valHooks:{option:{get:function(e){var t=S.find.attr(e,"value");return null!=t?t:ht(S.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||!A(n.parentNode,"optgroup"))){if(t=S(n).val(),a)return t;s.push(t)}return s},set:function(e,t){var n,r,i=e.options,o=S.makeArray(t),a=i.length;while(a--)((r=i[a]).selected=-1<S.inArray(S.valHooks.option.get(r),o))&&(n=!0);return n||(e.selectedIndex=-1),o}}}}),S.each(["radio","checkbox"],function(){S.valHooks[this]={set:function(e,t){if(Array.isArray(t))return e.checked=-1<S.inArray(S(e).val(),t)}},y.checkOn||(S.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})}),y.focusin="onfocusin"in C;var mt=/^(?:focusinfocus|focusoutblur)$/,xt=function(e){e.stopPropagation()};S.extend(S.event,{trigger:function(e,t,n,r){var i,o,a,s,u,l,c,f,p=[n||E],d=v.call(e,"type")?e.type:e,h=v.call(e,"namespace")?e.namespace.split("."):[];if(o=f=a=n=n||E,3!==n.nodeType&&8!==n.nodeType&&!mt.test(d+S.event.triggered)&&(-1<d.indexOf(".")&&(d=(h=d.split(".")).shift(),h.sort()),u=d.indexOf(":")<0&&"on"+d,(e=e[S.expando]?e:new S.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]:S.makeArray(t,[e]),c=S.event.special[d]||{},r||!c.trigger||!1!==c.trigger.apply(n,t))){if(!r&&!c.noBubble&&!x(n)){for(s=c.delegateType||d,mt.test(s+d)||(o=o.parentNode);o;o=o.parentNode)p.push(o),a=o;a===(n.ownerDocument||E)&&p.push(a.defaultView||a.parentWindow||C)}i=0;while((o=p[i++])&&!e.isPropagationStopped())f=o,e.type=1<i?s:c.bindType||d,(l=(Y.get(o,"events")||Object.create(null))[e.type]&&Y.get(o,"handle"))&&l.apply(o,t),(l=u&&o[u])&&l.apply&&V(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)||!V(n)||u&&m(n[d])&&!x(n)&&((a=n[u])&&(n[u]=null),S.event.triggered=d,e.isPropagationStopped()&&f.addEventListener(d,xt),n[d](),e.isPropagationStopped()&&f.removeEventListener(d,xt),S.event.triggered=void 0,a&&(n[u]=a)),e.result}},simulate:function(e,t,n){var r=S.extend(new S.Event,n,{type:e,isSimulated:!0});S.event.trigger(r,null,t)}}),S.fn.extend({trigger:function(e,t){return this.each(function(){S.event.trigger(e,t,this)})},triggerHandler:function(e,t){var n=this[0];if(n)return S.event.trigger(e,t,n,!0)}}),y.focusin||S.each({focus:"focusin",blur:"focusout"},function(n,r){var i=function(e){S.event.simulate(r,e.target,S.event.fix(e))};S.event.special[r]={setup:function(){var e=this.ownerDocument||this.document||this,t=Y.access(e,r);t||e.addEventListener(n,i,!0),Y.access(e,r,(t||0)+1)},teardown:function(){var e=this.ownerDocument||this.document||this,t=Y.access(e,r)-1;t?Y.access(e,r,t):(e.removeEventListener(n,i,!0),Y.remove(e,r))}}});var bt=C.location,wt={guid:Date.now()},Tt=/\?/;S.parseXML=function(e){var t,n;if(!e||"string"!=typeof e)return null;try{t=(new C.DOMParser).parseFromString(e,"text/xml")}catch(e){}return n=t&&t.getElementsByTagName("parsererror")[0],t&&!n||S.error("Invalid XML: "+(n?S.map(n.childNodes,function(e){return e.textContent}).join("\n"):e)),t};var Ct=/\[\]$/,Et=/\r?\n/g,St=/^(?:submit|button|image|reset|file)$/i,kt=/^(?:input|select|textarea|keygen)/i;function At(n,e,r,i){var t;if(Array.isArray(e))S.each(e,function(e,t){r||Ct.test(n)?i(n,t):At(n+"["+("object"==typeof t&&null!=t?e:"")+"]",t,r,i)});else if(r||"object"!==w(e))i(n,e);else for(t in e)At(n+"["+t+"]",e[t],r,i)}S.param=function(e,t){var n,r=[],i=function(e,t){var n=m(t)?t():t;r[r.length]=encodeURIComponent(e)+"="+encodeURIComponent(null==n?"":n)};if(null==e)return"";if(Array.isArray(e)||e.jquery&&!S.isPlainObject(e))S.each(e,function(){i(this.name,this.value)});else for(n in e)At(n,e[n],t,i);return r.join("&")},S.fn.extend({serialize:function(){return S.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=S.prop(this,"elements");return e?S.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!S(this).is(":disabled")&&kt.test(this.nodeName)&&!St.test(e)&&(this.checked||!pe.test(e))}).map(function(e,t){var n=S(this).val();return null==n?null:Array.isArray(n)?S.map(n,function(e){return{name:t.name,value:e.replace(Et,"\r\n")}}):{name:t.name,value:n.replace(Et,"\r\n")}}).get()}});var Nt=/%20/g,jt=/#.*$/,Dt=/([?&])_=[^&]*/,qt=/^(.*?):[ \t]*([^\r\n]*)$/gm,Lt=/^(?:GET|HEAD)$/,Ht=/^\/\//,Ot={},Pt={},Rt="*/".concat("*"),Mt=E.createElement("a");function It(o){return function(e,t){"string"!=typeof e&&(t=e,e="*");var n,r=0,i=e.toLowerCase().match(P)||[];if(m(t))while(n=i[r++])"+"===n[0]?(n=n.slice(1)||"*",(o[n]=o[n]||[]).unshift(t)):(o[n]=o[n]||[]).push(t)}}function Wt(t,i,o,a){var s={},u=t===Pt;function l(e){var r;return s[e]=!0,S.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 Ft(e,t){var n,r,i=S.ajaxSettings.flatOptions||{};for(n in t)void 0!==t[n]&&((i[n]?e:r||(r={}))[n]=t[n]);return r&&S.extend(!0,e,r),e}Mt.href=bt.href,S.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:bt.href,type:"GET",isLocal:/^(?:about|app|app-storage|.+-extension|file|res|widget):$/.test(bt.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Rt,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":S.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?Ft(Ft(e,S.ajaxSettings),t):Ft(S.ajaxSettings,e)},ajaxPrefilter:It(Ot),ajaxTransport:It(Pt),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=S.ajaxSetup({},t),y=v.context||v,m=v.context&&(y.nodeType||y.jquery)?S(y):S.event,x=S.Deferred(),b=S.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=qt.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||bt.href)+"").replace(Ht,bt.protocol+"//"),v.type=t.method||t.type||v.method||v.type,v.dataTypes=(v.dataType||"*").toLowerCase().match(P)||[""],null==v.crossDomain){r=E.createElement("a");try{r.href=v.url,r.href=r.href,v.crossDomain=Mt.protocol+"//"+Mt.host!=r.protocol+"//"+r.host}catch(e){v.crossDomain=!0}}if(v.data&&v.processData&&"string"!=typeof v.data&&(v.data=S.param(v.data,v.traditional)),Wt(Ot,v,t,T),h)return T;for(i in(g=S.event&&v.global)&&0==S.active++&&S.event.trigger("ajaxStart"),v.type=v.type.toUpperCase(),v.hasContent=!Lt.test(v.type),f=v.url.replace(jt,""),v.hasContent?v.data&&v.processData&&0===(v.contentType||"").indexOf("application/x-www-form-urlencoded")&&(v.data=v.data.replace(Nt,"+")):(o=v.url.slice(f.length),v.data&&(v.processData||"string"==typeof v.data)&&(f+=(Tt.test(f)?"&":"?")+v.data,delete v.data),!1===v.cache&&(f=f.replace(Dt,"$1"),o=(Tt.test(f)?"&":"?")+"_="+wt.guid+++o),v.url=f+o),v.ifModified&&(S.lastModified[f]&&T.setRequestHeader("If-Modified-Since",S.lastModified[f]),S.etag[f]&&T.setRequestHeader("If-None-Match",S.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]?", "+Rt+"; 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=Wt(Pt,v,t,T)){if(T.readyState=1,g&&m.trigger("ajaxSend",[T,v]),h)return T;v.async&&0<v.timeout&&(d=C.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&&C.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<S.inArray("script",v.dataTypes)&&S.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"))&&(S.lastModified[f]=u),(u=T.getResponseHeader("etag"))&&(S.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]),--S.active||S.event.trigger("ajaxStop")))}return T},getJSON:function(e,t,n){return S.get(e,t,n,"json")},getScript:function(e,t){return S.get(e,void 0,t,"script")}}),S.each(["get","post"],function(e,i){S[i]=function(e,t,n,r){return m(t)&&(r=r||n,n=t,t=void 0),S.ajax(S.extend({url:e,type:i,dataType:r,data:t,success:n},S.isPlainObject(e)&&e))}}),S.ajaxPrefilter(function(e){var t;for(t in e.headers)"content-type"===t.toLowerCase()&&(e.contentType=e.headers[t]||"")}),S._evalUrl=function(e,t,n){return S.ajax({url:e,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,converters:{"text script":function(){}},dataFilter:function(e){S.globalEval(e,t,n)}})},S.fn.extend({wrapAll:function(e){var t;return this[0]&&(m(e)&&(e=e.call(this[0])),t=S(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 m(n)?this.each(function(e){S(this).wrapInner(n.call(this,e))}):this.each(function(){var e=S(this),t=e.contents();t.length?t.wrapAll(n):e.append(n)})},wrap:function(t){var n=m(t);return this.each(function(e){S(this).wrapAll(n?t.call(this,e):t)})},unwrap:function(e){return this.parent(e).not("body").each(function(){S(this).replaceWith(this.childNodes)}),this}}),S.expr.pseudos.hidden=function(e){return!S.expr.pseudos.visible(e)},S.expr.pseudos.visible=function(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)},S.ajaxSettings.xhr=function(){try{return new C.XMLHttpRequest}catch(e){}};var Bt={0:200,1223:204},$t=S.ajaxSettings.xhr();y.cors=!!$t&&"withCredentials"in $t,y.ajax=$t=!!$t,S.ajaxTransport(function(i){var o,a;if(y.cors||$t&&!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(Bt[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&&C.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()}}}),S.ajaxPrefilter(function(e){e.crossDomain&&(e.contents.script=!1)}),S.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 S.globalEval(e),e}}}),S.ajaxPrefilter("script",function(e){void 0===e.cache&&(e.cache=!1),e.crossDomain&&(e.type="GET")}),S.ajaxTransport("script",function(n){var r,i;if(n.crossDomain||n.scriptAttrs)return{send:function(e,t){r=S("<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)}),E.head.appendChild(r[0])},abort:function(){i&&i()}}});var _t,zt=[],Ut=/(=)\?(?=&|$)|\?\?/;S.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=zt.pop()||S.expando+"_"+wt.guid++;return this[e]=!0,e}}),S.ajaxPrefilter("json jsonp",function(e,t,n){var r,i,o,a=!1!==e.jsonp&&(Ut.test(e.url)?"url":"string"==typeof e.data&&0===(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&Ut.test(e.data)&&"data");if(a||"jsonp"===e.dataTypes[0])return r=e.jsonpCallback=m(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,a?e[a]=e[a].replace(Ut,"$1"+r):!1!==e.jsonp&&(e.url+=(Tt.test(e.url)?"&":"?")+e.jsonp+"="+r),e.converters["script json"]=function(){return o||S.error(r+" was not called"),o[0]},e.dataTypes[0]="json",i=C[r],C[r]=function(){o=arguments},n.always(function(){void 0===i?S(C).removeProp(r):C[r]=i,e[r]&&(e.jsonpCallback=t.jsonpCallback,zt.push(r)),o&&m(i)&&i(o[0]),o=i=void 0}),"script"}),y.createHTMLDocument=((_t=E.implementation.createHTMLDocument("").body).innerHTML="<form></form><form></form>",2===_t.childNodes.length),S.parseHTML=function(e,t,n){return"string"!=typeof e?[]:("boolean"==typeof t&&(n=t,t=!1),t||(y.createHTMLDocument?((r=(t=E.implementation.createHTMLDocument("")).createElement("base")).href=E.location.href,t.head.appendChild(r)):t=E),o=!n&&[],(i=N.exec(e))?[t.createElement(i[1])]:(i=xe([e],t,o),o&&o.length&&S(o).remove(),S.merge([],i.childNodes)));var r,i,o},S.fn.load=function(e,t,n){var r,i,o,a=this,s=e.indexOf(" ");return-1<s&&(r=ht(e.slice(s)),e=e.slice(0,s)),m(t)?(n=t,t=void 0):t&&"object"==typeof t&&(i="POST"),0<a.length&&S.ajax({url:e,type:i||"GET",dataType:"html",data:t}).done(function(e){o=arguments,a.html(r?S("<div>").append(S.parseHTML(e)).find(r):e)}).always(n&&function(e,t){a.each(function(){n.apply(this,o||[e.responseText,t,e])})}),this},S.expr.pseudos.animated=function(t){return S.grep(S.timers,function(e){return t===e.elem}).length},S.offset={setOffset:function(e,t,n){var r,i,o,a,s,u,l=S.css(e,"position"),c=S(e),f={};"static"===l&&(e.style.position="relative"),s=c.offset(),o=S.css(e,"top"),u=S.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),m(t)&&(t=t.call(e,n,S.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)}},S.fn.extend({offset:function(t){if(arguments.length)return void 0===t?this:this.each(function(e){S.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"===S.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"===S.css(e,"position"))e=e.parentNode;e&&e!==r&&1===e.nodeType&&((i=S(e).offset()).top+=S.css(e,"borderTopWidth",!0),i.left+=S.css(e,"borderLeftWidth",!0))}return{top:t.top-i.top-S.css(r,"marginTop",!0),left:t.left-i.left-S.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent;while(e&&"static"===S.css(e,"position"))e=e.offsetParent;return e||re})}}),S.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(t,i){var o="pageYOffset"===i;S.fn[t]=function(e){return $(this,function(e,t,n){var r;if(x(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)}}),S.each(["top","left"],function(e,n){S.cssHooks[n]=Fe(y.pixelPosition,function(e,t){if(t)return t=We(e,n),Pe.test(t)?S(e).position()[n]+"px":t})}),S.each({Height:"height",Width:"width"},function(a,s){S.each({padding:"inner"+a,content:s,"":"outer"+a},function(r,o){S.fn[o]=function(e,t){var n=arguments.length&&(r||"boolean"!=typeof e),i=r||(!0===e||!0===t?"margin":"border");return $(this,function(e,t,n){var r;return x(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?S.css(e,t,i):S.style(e,t,n,i)},s,n?e:void 0,n)}})}),S.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){S.fn[t]=function(e){return this.on(t,e)}}),S.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.mouseenter(e).mouseleave(t||e)}}),S.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){S.fn[n]=function(e,t){return 0<arguments.length?this.on(n,null,e,t):this.trigger(n)}});var Xt=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;S.proxy=function(e,t){var n,r,i;if("string"==typeof t&&(n=e[t],t=e,e=n),m(e))return r=s.call(arguments,2),(i=function(){return e.apply(t||this,r.concat(s.call(arguments)))}).guid=e.guid=e.guid||S.guid++,i},S.holdReady=function(e){e?S.readyWait++:S.ready(!0)},S.isArray=Array.isArray,S.parseJSON=JSON.parse,S.nodeName=A,S.isFunction=m,S.isWindow=x,S.camelCase=X,S.type=w,S.now=Date.now,S.isNumeric=function(e){var t=S.type(e);return("number"===t||"string"===t)&&!isNaN(e-parseFloat(e))},S.trim=function(e){return null==e?"":(e+"").replace(Xt,"")},"function"==typeof define&&define.amd&&define("jquery",[],function(){return S});var Vt=C.jQuery,Gt=C.$;return S.noConflict=function(e){return C.$===S&&(C.$=Gt),e&&C.jQuery===S&&(C.jQuery=Vt),S},"undefined"==typeof e&&(C.jQuery=C.$=S),S});
;
// Analytics (GA helper function)
var Analytics = {
	GAUtilityID: "",
	GAUtilityName: "",
	GARollupID: "UA-50029723-1",
	GARollupName: "regionalutilitiesrollup",
	GAEventRollupID: "UA-76398043-1",
	GAEventRollupName: "regionalutilitieseventrollup",
	extend: function() {
		for(var i = 1; i < arguments.length; i++) {
			for(var key in arguments[i]) {
				if(arguments[i].hasOwnProperty(key)) {
					arguments[0][key] = arguments[i][key];
				}
			}
		}
		return arguments[0];
	},
	getEnvironment: function() {
		var host = window.location.hostname.toLowerCase();
        if (host.indexOf("localhost") >= 0) { return "local"; }
        if (host.indexOf("dv") >= 0) { return "dv"; }
		if(host.indexOf("ts.") >= 0) { return "ts"; }
		if(host.indexOf("qa.") >= 0 || host.indexOf("qacol.") >= 0 || host.indexOf("qatul.") >= 0) { return "qa"; }
		return "prod";
	},
	trackGAEvent: function(c, a, l, options) {
		options = Analytics.extend({}, { type: "event", category: c, action: a, label: l }, options);
		Analytics.trackGA(options);
	},
	trackGAPage: function(options) {
		var settings = $.extend({ id: Analytics.GAUtilityID, name: Analytics.GAUtilityName }, options);
		var env = Analytics.getEnvironment();
        if (env === "prod") {

            window.ga = window.ga || function () { (ga.q = ga.q || []).push(arguments) }; ga.l = +new Date;

            //if(window && window.console && window.console.log) { window.console.log("trackGAPage.settings.id=" + settings.id); }		                

            ga('create', settings.id, 'auto');
            ga('create', Analytics.GARollupID, 'auto', { 'name': Analytics.GARollupName });  // roll-up
            ga('create', Analytics.GAEventRollupID, 'auto', { 'name': Analytics.GAEventRollupName }); // event roll-up

            //if (typeof WURFL !== "undefined" && typeof WURFL.complete_device_name !== "undefined" && typeof WURFL.form_factor !== "undefined") {
            //    //ga('set', 'dimension1', WURFL.complete_device_name);
            //    //ga('set', 'dimension2', WURFL.form_factor);
            //    //ga('set', 'dimension3', WURFL.is_mobile);
            //    ga('send', 'pageview', { 'dimension1': WURFL.complete_device_name, 'dimension2': WURFL.form_factor, 'dimension3': WURFL.is_mobile });
            //    ga('regionalutilitiesrollup.send', 'pageview', { 'dimension1': WURFL.complete_device_name, 'dimension2': WURFL.form_factor, 'dimension3': WURFL.is_mobile });
            //} else {
            //    ga('send', 'pageview');
            //    ga('regionalutilitiesrollup.send', 'pageview');
            //}
            ga('send', 'pageview');
            ga('regionalutilitiesrollup.send', 'pageview');

        }
	},
	trackGA: function(options) {
		var env = Analytics.getEnvironment();
        if (env === "prod" && ga.hasOwnProperty('loaded') && ga.loaded === true) {
            var settings = $.extend({ id: Analytics.GAUtilityID, name: Analytics.GAUtilityName, type: "", category: "", action: "", label: "", trackRollup: true }, options);
            if (!settings.type) { settings.type = "event"; }
            if (!settings.category) { settings.category = "unknown"; }
            if (!settings.action) { settings.action = "unknown"; }
            if (!settings.transport) { settings.transport = "beacon"; }

            // Start with required parameters
            var gaEventOptions = {
                'hitType': settings.type,
                'eventCategory': settings.category,
                'eventAction': settings.action
                //'transport': settings.transport
            };
            // Add optional if they exist
            if (settings.label) { gaEventOptions.eventLabel = settings.label; }
            if (typeof (settings.value) === "number") { gaEventOptions.eventValue = settings.value; }
            if (typeof (settings.nonInteraction) === "boolean") { gaEventOptions.nonInteraction = settings.nonInteraction; }

            if (settings.trackRollup) {
                // new separate rollup
                ga('regionalutilitieseventrollup.send', gaEventOptions); // rollup event tracking
            }
            // add hitcallback function is specified
            if (settings.hitCallback) {
                gaEventOptions.hitCallback = createFunctionWithTimeout(settings.hitCallback, 1000);
            }

            ga('send', gaEventOptions); // opco event tracking

        } else if (options.hitCallback) {
            options.hitCallback();
        }
			
    }
  
};
function createFunctionWithTimeout(callback, opt_timeout) {
    var called = false;
    function fn() {
        if (!called) {
            called = true;
            callback();
        }
    }
    setTimeout(fn, opt_timeout || 1000);
    return fn;
}

// GA function

//(function(i, s, o, g, r, a, m) {
//	i['GoogleAnalyticsObject'] = r; i[r] = i[r] || function() {
//		(i[r].q = i[r].q || []).push(arguments)
//	}, i[r].l = 1 * new Date(); a = s.createElement(o),
//	m = s.getElementsByTagName(o)[0]; a.async = 1; a.src = g; m.parentNode.insertBefore(a, m)
//})(window, document, 'script', (Analytics.getEnvironment()!=='prod' ? '//' : '//www.google-analytics.com/analytics.js'), 'ga');
;
/*!
 * JavaScript Cookie v2.2.1
 * https://github.com/js-cookie/js-cookie
 *
 * Copyright 2006, 2015 Klaus Hartl & Fagner Brack
 * Released under the MIT license
 */
;(function (factory) {
	var registeredInModuleLoader;
	if (typeof define === 'function' && define.amd) {
		define(factory);
		registeredInModuleLoader = true;
	}
	if (typeof exports === 'object') {
		module.exports = factory();
		registeredInModuleLoader = true;
	}
	if (!registeredInModuleLoader) {
		var OldCookies = window.Cookies;
		var api = window.Cookies = factory();
		api.noConflict = function () {
			window.Cookies = OldCookies;
			return api;
		};
	}
}(function () {
	function extend () {
		var i = 0;
		var result = {};
		for (; i < arguments.length; i++) {
			var attributes = arguments[ i ];
			for (var key in attributes) {
				result[key] = attributes[key];
			}
		}
		return result;
	}

	function decode (s) {
		return s.replace(/(%[0-9A-Z]{2})+/g, decodeURIComponent);
	}

	function init (converter) {
		function api() {}

		function set (key, value, attributes) {
			if (typeof document === 'undefined') {
				return;
			}

			attributes = extend({
				path: '/'
			}, api.defaults, attributes);

			if (typeof attributes.expires === 'number') {
				attributes.expires = new Date(new Date() * 1 + attributes.expires * 864e+5);
			}

			// We're using "expires" because "max-age" is not supported by IE
			attributes.expires = attributes.expires ? attributes.expires.toUTCString() : '';

			try {
				var result = JSON.stringify(value);
				if (/^[\{\[]/.test(result)) {
					value = result;
				}
			} catch (e) {}

			value = converter.write ?
				converter.write(value, key) :
				encodeURIComponent(String(value))
					.replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g, decodeURIComponent);

			key = encodeURIComponent(String(key))
				.replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent)
				.replace(/[\(\)]/g, escape);

			var stringifiedAttributes = '';
			for (var attributeName in attributes) {
				if (!attributes[attributeName]) {
					continue;
				}
				stringifiedAttributes += '; ' + attributeName;
				if (attributes[attributeName] === true) {
					continue;
				}

				// Considers RFC 6265 section 5.2:
				// ...
				// 3.  If the remaining unparsed-attributes contains a %x3B (";")
				//     character:
				// Consume the characters of the unparsed-attributes up to,
				// not including, the first %x3B (";") character.
				// ...
				stringifiedAttributes += '=' + attributes[attributeName].split(';')[0];
			}

			return (document.cookie = key + '=' + value + stringifiedAttributes);
		}

		function get (key, json) {
			if (typeof document === 'undefined') {
				return;
			}

			var jar = {};
			// To prevent the for loop in the first place assign an empty array
			// in case there are no cookies at all.
			var cookies = document.cookie ? document.cookie.split('; ') : [];
			var i = 0;

			for (; i < cookies.length; i++) {
				var parts = cookies[i].split('=');
				var cookie = parts.slice(1).join('=');

				if (!json && cookie.charAt(0) === '"') {
					cookie = cookie.slice(1, -1);
				}

				try {
					var name = decode(parts[0]);
					cookie = (converter.read || converter)(cookie, name) ||
						decode(cookie);

					if (json) {
						try {
							cookie = JSON.parse(cookie);
						} catch (e) {}
					}

					jar[name] = cookie;

					if (key === name) {
						break;
					}
				} catch (e) {}
			}

			return key ? jar[key] : jar;
		}

		api.set = set;
		api.get = function (key) {
			return get(key, false /* read as raw */);
		};
		api.getJSON = function (key) {
			return get(key, true /* read as json */);
		};
		api.remove = function (key, attributes) {
			set(key, '', extend(attributes, {
				expires: -1
			}));
		};

		api.defaults = {};

		api.withConverter = init;

		return api;
	}

	return init(function () {});
}));
;
/**
 * @version: 1.0 Alpha-1
 * @author: Coolite Inc. http://www.coolite.com/
 * @date: 2008-05-13
 * @copyright: Copyright (c) 2006-2008, Coolite Inc. (http://www.coolite.com/). All rights reserved.
 * @license: Licensed under The MIT License. See license.txt and http://www.datejs.com/license/. 
 * @website: http://www.datejs.com/
 */
Date.CultureInfo = { name: "en-US", englishName: "English (United States)", nativeName: "English (United States)", dayNames: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], abbreviatedDayNames: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], shortestDayNames: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], firstLetterDayNames: ["S", "M", "T", "W", "T", "F", "S"], monthNames: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], abbreviatedMonthNames: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], amDesignator: "AM", pmDesignator: "PM", firstDayOfWeek: 0, twoDigitYearMax: 2029, dateElementOrder: "mdy", formatPatterns: { shortDate: "M/d/yyyy", longDate: "dddd, MMMM dd, yyyy", shortTime: "h:mm tt", longTime: "h:mm:ss tt", fullDateTime: "dddd, MMMM dd, yyyy h:mm:ss tt", sortableDateTime: "yyyy-MM-ddTHH:mm:ss", universalSortableDateTime: "yyyy-MM-dd HH:mm:ssZ", rfc1123: "ddd, dd MMM yyyy HH:mm:ss GMT", monthDay: "MMMM dd", yearMonth: "MMMM, yyyy" }, regexPatterns: { jan: /^jan(uary)?/i, feb: /^feb(ruary)?/i, mar: /^mar(ch)?/i, apr: /^apr(il)?/i, may: /^may/i, jun: /^jun(e)?/i, jul: /^jul(y)?/i, aug: /^aug(ust)?/i, sep: /^sep(t(ember)?)?/i, oct: /^oct(ober)?/i, nov: /^nov(ember)?/i, dec: /^dec(ember)?/i, sun: /^su(n(day)?)?/i, mon: /^mo(n(day)?)?/i, tue: /^tu(e(s(day)?)?)?/i, wed: /^we(d(nesday)?)?/i, thu: /^th(u(r(s(day)?)?)?)?/i, fri: /^fr(i(day)?)?/i, sat: /^sa(t(urday)?)?/i, future: /^next/i, past: /^last|past|prev(ious)?/i, add: /^(\+|aft(er)?|from|hence)/i, subtract: /^(\-|bef(ore)?|ago)/i, yesterday: /^yes(terday)?/i, today: /^t(od(ay)?)?/i, tomorrow: /^tom(orrow)?/i, now: /^n(ow)?/i, millisecond: /^ms|milli(second)?s?/i, second: /^sec(ond)?s?/i, minute: /^mn|min(ute)?s?/i, hour: /^h(our)?s?/i, week: /^w(eek)?s?/i, month: /^m(onth)?s?/i, day: /^d(ay)?s?/i, year: /^y(ear)?s?/i, shortMeridian: /^(a|p)/i, longMeridian: /^(a\.?m?\.?|p\.?m?\.?)/i, timezone: /^((e(s|d)t|c(s|d)t|m(s|d)t|p(s|d)t)|((gmt)?\s*(\+|\-)\s*\d\d\d\d?)|gmt|utc)/i, ordinalSuffix: /^\s*(st|nd|rd|th)/i, timeContext: /^\s*(\:|a(?!u|p)|p)/i }, timezones: [{ name: "UTC", offset: "-000" }, { name: "GMT", offset: "-000" }, { name: "EST", offset: "-0500" }, { name: "EDT", offset: "-0400" }, { name: "CST", offset: "-0600" }, { name: "CDT", offset: "-0500" }, { name: "MST", offset: "-0700" }, { name: "MDT", offset: "-0600" }, { name: "PST", offset: "-0800" }, { name: "PDT", offset: "-0700" }] };
(function () {
    var $D = Date, $P = $D.prototype, $C = $D.CultureInfo, p = function (s, l) {
        if (!l) { l = 2; }
        return ("000" + s).slice(l * -1);
    }; $P.clearTime = function () { this.setHours(0); this.setMinutes(0); this.setSeconds(0); this.setMilliseconds(0); return this; }; $P.setTimeToNow = function () { var n = new Date(); this.setHours(n.getHours()); this.setMinutes(n.getMinutes()); this.setSeconds(n.getSeconds()); this.setMilliseconds(n.getMilliseconds()); return this; }; $D.today = function () { return new Date().clearTime(); }; $D.compare = function (date1, date2) { if (isNaN(date1) || isNaN(date2)) { throw new Error(date1 + " - " + date2); } else if (date1 instanceof Date && date2 instanceof Date) { return (date1 < date2) ? -1 : (date1 > date2) ? 1 : 0; } else { throw new TypeError(date1 + " - " + date2); } }; $D.equals = function (date1, date2) { return (date1.compareTo(date2) === 0); }; $D.getDayNumberFromName = function (name) {
        var n = $C.dayNames, m = $C.abbreviatedDayNames, o = $C.shortestDayNames, s = name.toLowerCase(); for (var i = 0; i < n.length; i++) { if (n[i].toLowerCase() == s || m[i].toLowerCase() == s || o[i].toLowerCase() == s) { return i; } }
        return -1;
    }; $D.getMonthNumberFromName = function (name) {
        var n = $C.monthNames, m = $C.abbreviatedMonthNames, s = name.toLowerCase(); for (var i = 0; i < n.length; i++) { if (n[i].toLowerCase() == s || m[i].toLowerCase() == s) { return i; } }
        return -1;
    }; $D.isLeapYear = function (year) { return ((year % 4 === 0 && year % 100 !== 0) || year % 400 === 0); }; $D.getDaysInMonth = function (year, month) { return [31, ($D.isLeapYear(year) ? 29 : 28), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month]; }; $D.getTimezoneAbbreviation = function (offset) {
        var z = $C.timezones, p; for (var i = 0; i < z.length; i++) { if (z[i].offset === offset) { return z[i].name; } }
        return null;
    }; $D.getTimezoneOffset = function (name) {
        var z = $C.timezones, p; for (var i = 0; i < z.length; i++) { if (z[i].name === name.toUpperCase()) { return z[i].offset; } }
        return null;
    }; $P.clone = function () { return new Date(this.getTime()); }; $P.compareTo = function (date) { return Date.compare(this, date); }; $P.equals = function (date) { return Date.equals(this, date || new Date()); }; $P.between = function (start, end) { return this.getTime() >= start.getTime() && this.getTime() <= end.getTime(); }; $P.isAfter = function (date) { return this.compareTo(date || new Date()) === 1; }; $P.isBefore = function (date) { return (this.compareTo(date || new Date()) === -1); }; $P.isToday = function () { return this.isSameDay(new Date()); }; $P.isSameDay = function (date) { return this.clone().clearTime().equals(date.clone().clearTime()); }; $P.addMilliseconds = function (value) { this.setMilliseconds(this.getMilliseconds() + value); return this; }; $P.addSeconds = function (value) { return this.addMilliseconds(value * 1000); }; $P.addMinutes = function (value) { return this.addMilliseconds(value * 60000); }; $P.addHours = function (value) { return this.addMilliseconds(value * 3600000); }; $P.addDays = function (value) { this.setDate(this.getDate() + value); return this; }; $P.addWeeks = function (value) { return this.addDays(value * 7); }; $P.addMonths = function (value) { var n = this.getDate(); this.setDate(1); this.setMonth(this.getMonth() + value); this.setDate(Math.min(n, $D.getDaysInMonth(this.getFullYear(), this.getMonth()))); return this; }; $P.addYears = function (value) { return this.addMonths(value * 12); }; $P.add = function (config) {
        if (typeof config == "number") { this._orient = config; return this; }
        var x = config; if (x.milliseconds) { this.addMilliseconds(x.milliseconds); }
        if (x.seconds) { this.addSeconds(x.seconds); }
        if (x.minutes) { this.addMinutes(x.minutes); }
        if (x.hours) { this.addHours(x.hours); }
        if (x.weeks) { this.addWeeks(x.weeks); }
        if (x.months) { this.addMonths(x.months); }
        if (x.years) { this.addYears(x.years); }
        if (x.days) { this.addDays(x.days); }
        return this;
    }; var $y, $m, $d; $P.getWeek = function () {
        var a, b, c, d, e, f, g, n, s, w; $y = (!$y) ? this.getFullYear() : $y; $m = (!$m) ? this.getMonth() + 1 : $m; $d = (!$d) ? this.getDate() : $d; if ($m <= 2) { a = $y - 1; b = (a / 4 | 0) - (a / 100 | 0) + (a / 400 | 0); c = ((a - 1) / 4 | 0) - ((a - 1) / 100 | 0) + ((a - 1) / 400 | 0); s = b - c; e = 0; f = $d - 1 + (31 * ($m - 1)); } else { a = $y; b = (a / 4 | 0) - (a / 100 | 0) + (a / 400 | 0); c = ((a - 1) / 4 | 0) - ((a - 1) / 100 | 0) + ((a - 1) / 400 | 0); s = b - c; e = s + 1; f = $d + ((153 * ($m - 3) + 2) / 5) + 58 + s; }
        g = (a + b) % 7; d = (f + g - e) % 7; n = (f + 3 - d) | 0; if (n < 0) { w = 53 - ((g - s) / 5 | 0); } else if (n > 364 + s) { w = 1; } else { w = (n / 7 | 0) + 1; }
        $y = $m = $d = null; return w;
    }; $P.getISOWeek = function () { $y = this.getUTCFullYear(); $m = this.getUTCMonth() + 1; $d = this.getUTCDate(); return p(this.getWeek()); }; $P.setWeek = function (n) { return this.moveToDayOfWeek(1).addWeeks(n - this.getWeek()); }; $D._validate = function (n, min, max, name) {
        if (typeof n == "undefined") { return false; } else if (typeof n != "number") { throw new TypeError(n + " is not a Number."); } else if (n < min || n > max) { throw new RangeError(n + " is not a valid value for " + name + "."); }
        return true;
    }; $D.validateMillisecond = function (value) { return $D._validate(value, 0, 999, "millisecond"); }; $D.validateSecond = function (value) { return $D._validate(value, 0, 59, "second"); }; $D.validateMinute = function (value) { return $D._validate(value, 0, 59, "minute"); }; $D.validateHour = function (value) { return $D._validate(value, 0, 23, "hour"); }; $D.validateDay = function (value, year, month) { return $D._validate(value, 1, $D.getDaysInMonth(year, month), "day"); }; $D.validateMonth = function (value) { return $D._validate(value, 0, 11, "month"); }; $D.validateYear = function (value) { return $D._validate(value, 0, 9999, "year"); }; $P.set = function (config) {
        if ($D.validateMillisecond(config.millisecond)) { this.addMilliseconds(config.millisecond - this.getMilliseconds()); }
        if ($D.validateSecond(config.second)) { this.addSeconds(config.second - this.getSeconds()); }
        if ($D.validateMinute(config.minute)) { this.addMinutes(config.minute - this.getMinutes()); }
        if ($D.validateHour(config.hour)) { this.addHours(config.hour - this.getHours()); }
        if ($D.validateMonth(config.month)) { this.addMonths(config.month - this.getMonth()); }
        if ($D.validateYear(config.year)) { this.addYears(config.year - this.getFullYear()); }
        if ($D.validateDay(config.day, this.getFullYear(), this.getMonth())) { this.addDays(config.day - this.getDate()); }
        if (config.timezone) { this.setTimezone(config.timezone); }
        if (config.timezoneOffset) { this.setTimezoneOffset(config.timezoneOffset); }
        if (config.week && $D._validate(config.week, 0, 53, "week")) { this.setWeek(config.week); }
        return this;
    }; $P.moveToFirstDayOfMonth = function () { return this.set({ day: 1 }); }; $P.moveToLastDayOfMonth = function () { return this.set({ day: $D.getDaysInMonth(this.getFullYear(), this.getMonth()) }); }; $P.moveToNthOccurrence = function (dayOfWeek, occurrence) {
        var shift = 0; if (occurrence > 0) { shift = occurrence - 1; }
        else if (occurrence === -1) {
            this.moveToLastDayOfMonth(); if (this.getDay() !== dayOfWeek) { this.moveToDayOfWeek(dayOfWeek, -1); }
            return this;
        }
        return this.moveToFirstDayOfMonth().addDays(-1).moveToDayOfWeek(dayOfWeek, +1).addWeeks(shift);
    }; $P.moveToDayOfWeek = function (dayOfWeek, orient) { var diff = (dayOfWeek - this.getDay() + 7 * (orient || +1)) % 7; return this.addDays((diff === 0) ? diff += 7 * (orient || +1) : diff); }; $P.moveToMonth = function (month, orient) { var diff = (month - this.getMonth() + 12 * (orient || +1)) % 12; return this.addMonths((diff === 0) ? diff += 12 * (orient || +1) : diff); }; $P.getOrdinalNumber = function () { return Math.ceil((this.clone().clearTime() - new Date(this.getFullYear(), 0, 1)) / 86400000) + 1; }; $P.getTimezone = function () { return $D.getTimezoneAbbreviation(this.getUTCOffset()); }; $P.setTimezoneOffset = function (offset) { var here = this.getTimezoneOffset(), there = Number(offset) * -6 / 10; return this.addMinutes(there - here); }; $P.setTimezone = function (offset) { return this.setTimezoneOffset($D.getTimezoneOffset(offset)); }; $P.hasDaylightSavingTime = function () { return (Date.today().set({ month: 0, day: 1 }).getTimezoneOffset() !== Date.today().set({ month: 6, day: 1 }).getTimezoneOffset()); }; $P.isDaylightSavingTime = function () { return (this.hasDaylightSavingTime() && new Date().getTimezoneOffset() === Date.today().set({ month: 6, day: 1 }).getTimezoneOffset()); }; $P.getUTCOffset = function () { var n = this.getTimezoneOffset() * -10 / 6, r; if (n < 0) { r = (n - 10000).toString(); return r.charAt(0) + r.substr(2); } else { r = (n + 10000).toString(); return "+" + r.substr(1); } }; $P.getElapsed = function (date) { return (date || new Date()) - this; }; if (!$P.toISOString) {
        $P.toISOString = function () {
            function f(n) { return n < 10 ? '0' + n : n; }
            return '"' + this.getUTCFullYear() + '-' +
                f(this.getUTCMonth() + 1) + '-' +
                f(this.getUTCDate()) + 'T' +
                f(this.getUTCHours()) + ':' +
                f(this.getUTCMinutes()) + ':' +
                f(this.getUTCSeconds()) + 'Z"';
        };
    }
    $P._toString = $P.toString; $P.toString = function (format) {
        var x = this; if (format && format.length == 1) { var c = $C.formatPatterns; x.t = x.toString; switch (format) { case "d": return x.t(c.shortDate); case "D": return x.t(c.longDate); case "F": return x.t(c.fullDateTime); case "m": return x.t(c.monthDay); case "r": return x.t(c.rfc1123); case "s": return x.t(c.sortableDateTime); case "t": return x.t(c.shortTime); case "T": return x.t(c.longTime); case "u": return x.t(c.universalSortableDateTime); case "y": return x.t(c.yearMonth); } }
        var ord = function (n) { switch (n * 1) { case 1: case 21: case 31: return "st"; case 2: case 22: return "nd"; case 3: case 23: return "rd"; default: return "th"; } }; return format ? format.replace(/(\\)?(dd?d?d?|MM?M?M?|yy?y?y?|hh?|HH?|mm?|ss?|tt?|S)/g, function (m) {
            if (m.charAt(0) === "\\") { return m.replace("\\", ""); }
            x.h = x.getHours; switch (m) { case "hh": return p(x.h() < 13 ? (x.h() === 0 ? 12 : x.h()) : (x.h() - 12)); case "h": return x.h() < 13 ? (x.h() === 0 ? 12 : x.h()) : (x.h() - 12); case "HH": return p(x.h()); case "H": return x.h(); case "mm": return p(x.getMinutes()); case "m": return x.getMinutes(); case "ss": return p(x.getSeconds()); case "s": return x.getSeconds(); case "yyyy": return p(x.getFullYear(), 4); case "yy": return p(x.getFullYear()); case "dddd": return $C.dayNames[x.getDay()]; case "ddd": return $C.abbreviatedDayNames[x.getDay()]; case "dd": return p(x.getDate()); case "d": return x.getDate(); case "MMMM": return $C.monthNames[x.getMonth()]; case "MMM": return $C.abbreviatedMonthNames[x.getMonth()]; case "MM": return p((x.getMonth() + 1)); case "M": return x.getMonth() + 1; case "t": return x.h() < 12 ? $C.amDesignator.substring(0, 1) : $C.pmDesignator.substring(0, 1); case "tt": return x.h() < 12 ? $C.amDesignator : $C.pmDesignator; case "S": return ord(x.getDate()); default: return m; }
        }) : this._toString();
    };
}());
(function () {
    var $D = Date, $P = $D.prototype, $C = $D.CultureInfo, $N = Number.prototype; $P._orient = +1; $P._nth = null; $P._is = false; $P._same = false; $P._isSecond = false; $N._dateElement = "day"; $P.next = function () { this._orient = +1; return this; }; $D.next = function () { return $D.today().next(); }; $P.last = $P.prev = $P.previous = function () { this._orient = -1; return this; }; $D.last = $D.prev = $D.previous = function () { return $D.today().last(); }; $P.is = function () { this._is = true; return this; }; $P.same = function () { this._same = true; this._isSecond = false; return this; }; $P.today = function () { return this.same().day(); }; $P.weekday = function () {
        if (this._is) { this._is = false; return (!this.is().sat() && !this.is().sun()); }
        return false;
    }; $P.at = function (time) { return (typeof time === "string") ? $D.parse(this.toString("d") + " " + time) : this.set(time); }; $N.fromNow = $N.after = function (date) { var c = {}; c[this._dateElement] = this; return ((!date) ? new Date() : date.clone()).add(c); }; $N.ago = $N.before = function (date) { var c = {}; c[this._dateElement] = this * -1; return ((!date) ? new Date() : date.clone()).add(c); }; var dx = ("sunday monday tuesday wednesday thursday friday saturday").split(/\s/), mx = ("january february march april may june july august september october november december").split(/\s/), px = ("Millisecond Second Minute Hour Day Week Month Year").split(/\s/), pxf = ("Milliseconds Seconds Minutes Hours Date Week Month FullYear").split(/\s/), nth = ("final first second third fourth fifth").split(/\s/), de; $P.toObject = function () {
        var o = {}; for (var i = 0; i < px.length; i++) { o[px[i].toLowerCase()] = this["get" + pxf[i]](); }
        return o;
    }; $D.fromObject = function (config) { config.week = null; return Date.today().set(config); }; var df = function (n) {
        return function () {
            if (this._is) { this._is = false; return this.getDay() == n; }
            if (this._nth !== null) {
                if (this._isSecond) { this.addSeconds(this._orient * -1); }
                this._isSecond = false; var ntemp = this._nth; this._nth = null; var temp = this.clone().moveToLastDayOfMonth(); this.moveToNthOccurrence(n, ntemp); if (this > temp) { throw new RangeError($D.getDayName(n) + " does not occur " + ntemp + " times in the month of " + $D.getMonthName(temp.getMonth()) + " " + temp.getFullYear() + "."); }
                return this;
            }
            return this.moveToDayOfWeek(n, this._orient);
        };
    }; var sdf = function (n) {
        return function () {
            var t = $D.today(), shift = n - t.getDay(); if (n === 0 && $C.firstDayOfWeek === 1 && t.getDay() !== 0) { shift = shift + 7; }
            return t.addDays(shift);
        };
    }; for (var i = 0; i < dx.length; i++) { $D[dx[i].toUpperCase()] = $D[dx[i].toUpperCase().substring(0, 3)] = i; $D[dx[i]] = $D[dx[i].substring(0, 3)] = sdf(i); $P[dx[i]] = $P[dx[i].substring(0, 3)] = df(i); }
    var mf = function (n) {
        return function () {
            if (this._is) { this._is = false; return this.getMonth() === n; }
            return this.moveToMonth(n, this._orient);
        };
    }; var smf = function (n) { return function () { return $D.today().set({ month: n, day: 1 }); }; }; for (var j = 0; j < mx.length; j++) { $D[mx[j].toUpperCase()] = $D[mx[j].toUpperCase().substring(0, 3)] = j; $D[mx[j]] = $D[mx[j].substring(0, 3)] = smf(j); $P[mx[j]] = $P[mx[j].substring(0, 3)] = mf(j); }
    var ef = function (j) {
        return function () {
            if (this._isSecond) { this._isSecond = false; return this; }
            if (this._same) {
                this._same = this._is = false; var o1 = this.toObject(), o2 = (arguments[0] || new Date()).toObject(), v = "", k = j.toLowerCase(); for (var m = (px.length - 1); m > -1; m--) {
                    v = px[m].toLowerCase(); if (o1[v] != o2[v]) { return false; }
                    if (k == v) { break; }
                }
                return true;
            }
            if (j.substring(j.length - 1) != "s") { j += "s"; }
            return this["add" + j](this._orient);
        };
    }; var nf = function (n) { return function () { this._dateElement = n; return this; }; }; for (var k = 0; k < px.length; k++) { de = px[k].toLowerCase(); $P[de] = $P[de + "s"] = ef(px[k]); $N[de] = $N[de + "s"] = nf(de); }
    $P._ss = ef("Second"); var nthfn = function (n) {
        return function (dayOfWeek) {
            if (this._same) { return this._ss(arguments[0]); }
            if (dayOfWeek || dayOfWeek === 0) { return this.moveToNthOccurrence(dayOfWeek, n); }
            this._nth = n; if (n === 2 && (dayOfWeek === undefined || dayOfWeek === null)) { this._isSecond = true; return this.addSeconds(this._orient); }
            return this;
        };
    }; for (var l = 0; l < nth.length; l++) { $P[nth[l]] = (l === 0) ? nthfn(-1) : nthfn(l); }
}());
(function () {
    Date.Parsing = { Exception: function (s) { this.message = "Parse error at '" + s.substring(0, 10) + " ...'"; } }; var $P = Date.Parsing; var _ = $P.Operators = {
        rtoken: function (r) { return function (s) { var mx = s.match(r); if (mx) { return ([mx[0], s.substring(mx[0].length)]); } else { throw new $P.Exception(s); } }; }, token: function (s) { return function (s) { return _.rtoken(new RegExp("^\s*" + s + "\s*"))(s); }; }, stoken: function (s) { return _.rtoken(new RegExp("^" + s)); }, until: function (p) {
            return function (s) {
                var qx = [], rx = null; while (s.length) {
                    try { rx = p.call(this, s); } catch (e) { qx.push(rx[0]); s = rx[1]; continue; }
                    break;
                }
                return [qx, s];
            };
        }, many: function (p) {
            return function (s) {
                var rx = [], r = null; while (s.length) {
                    try { r = p.call(this, s); } catch (e) { return [rx, s]; }
                    rx.push(r[0]); s = r[1];
                }
                return [rx, s];
            };
        }, optional: function (p) {
            return function (s) {
                var r = null; try { r = p.call(this, s); } catch (e) { return [null, s]; }
                return [r[0], r[1]];
            };
        }, not: function (p) {
            return function (s) {
                try { p.call(this, s); } catch (e) { return [null, s]; }
                throw new $P.Exception(s);
            };
        }, ignore: function (p) { return p ? function (s) { var r = null; r = p.call(this, s); return [null, r[1]]; } : null; }, product: function () {
            var px = arguments[0], qx = Array.prototype.slice.call(arguments, 1), rx = []; for (var i = 0; i < px.length; i++) { rx.push(_.each(px[i], qx)); }
            return rx;
        }, cache: function (rule) {
            var cache = {}, r = null; return function (s) {
                try { r = cache[s] = (cache[s] || rule.call(this, s)); } catch (e) { r = cache[s] = e; }
                if (r instanceof $P.Exception) { throw r; } else { return r; }
            };
        }, any: function () {
            var px = arguments; return function (s) {
                var r = null; for (var i = 0; i < px.length; i++) {
                    if (px[i] == null) { continue; }
                    try { r = (px[i].call(this, s)); } catch (e) { r = null; }
                    if (r) { return r; }
                }
                throw new $P.Exception(s);
            };
        }, each: function () {
            var px = arguments; return function (s) {
                var rx = [], r = null; for (var i = 0; i < px.length; i++) {
                    if (px[i] == null) { continue; }
                    try { r = (px[i].call(this, s)); } catch (e) { throw new $P.Exception(s); }
                    rx.push(r[0]); s = r[1];
                }
                return [rx, s];
            };
        }, all: function () { var px = arguments, _ = _; return _.each(_.optional(px)); }, sequence: function (px, d, c) {
            d = d || _.rtoken(/^\s*/); c = c || null; if (px.length == 1) { return px[0]; }
            return function (s) {
                var r = null, q = null; var rx = []; for (var i = 0; i < px.length; i++) {
                    try { r = px[i].call(this, s); } catch (e) { break; }
                    rx.push(r[0]); try { q = d.call(this, r[1]); } catch (ex) { q = null; break; }
                    s = q[1];
                }
                if (!r) { throw new $P.Exception(s); }
                if (q) { throw new $P.Exception(q[1]); }
                if (c) { try { r = c.call(this, r[1]); } catch (ey) { throw new $P.Exception(r[1]); } }
                return [rx, (r ? r[1] : s)];
            };
        }, between: function (d1, p, d2) { d2 = d2 || d1; var _fn = _.each(_.ignore(d1), p, _.ignore(d2)); return function (s) { var rx = _fn.call(this, s); return [[rx[0][0], r[0][2]], rx[1]]; }; }, list: function (p, d, c) { d = d || _.rtoken(/^\s*/); c = c || null; return (p instanceof Array ? _.each(_.product(p.slice(0, -1), _.ignore(d)), p.slice(-1), _.ignore(c)) : _.each(_.many(_.each(p, _.ignore(d))), px, _.ignore(c))); }, set: function (px, d, c) {
            d = d || _.rtoken(/^\s*/); c = c || null; return function (s) {
                var r = null, p = null, q = null, rx = null, best = [[], s], last = false; for (var i = 0; i < px.length; i++) {
                    q = null; p = null; r = null; last = (px.length == 1); try { r = px[i].call(this, s); } catch (e) { continue; }
                    rx = [[r[0]], r[1]]; if (r[1].length > 0 && !last) { try { q = d.call(this, r[1]); } catch (ex) { last = true; } } else { last = true; }
                    if (!last && q[1].length === 0) { last = true; }
                    if (!last) {
                        var qx = []; for (var j = 0; j < px.length; j++) { if (i != j) { qx.push(px[j]); } }
                        p = _.set(qx, d).call(this, q[1]); if (p[0].length > 0) { rx[0] = rx[0].concat(p[0]); rx[1] = p[1]; }
                    }
                    if (rx[1].length < best[1].length) { best = rx; }
                    if (best[1].length === 0) { break; }
                }
                if (best[0].length === 0) { return best; }
                if (c) {
                    try { q = c.call(this, best[1]); } catch (ey) { throw new $P.Exception(best[1]); }
                    best[1] = q[1];
                }
                return best;
            };
        }, forward: function (gr, fname) { return function (s) { return gr[fname].call(this, s); }; }, replace: function (rule, repl) { return function (s) { var r = rule.call(this, s); return [repl, r[1]]; }; }, process: function (rule, fn) { return function (s) { var r = rule.call(this, s); return [fn.call(this, r[0]), r[1]]; }; }, min: function (min, rule) {
            return function (s) {
                var rx = rule.call(this, s); if (rx[0].length < min) { throw new $P.Exception(s); }
                return rx;
            };
        }
    }; var _generator = function (op) {
        return function () {
            var args = null, rx = []; if (arguments.length > 1) { args = Array.prototype.slice.call(arguments); } else if (arguments[0] instanceof Array) { args = arguments[0]; }
            if (args) { for (var i = 0, px = args.shift(); i < px.length; i++) { args.unshift(px[i]); rx.push(op.apply(null, args)); args.shift(); return rx; } } else { return op.apply(null, arguments); }
        };
    }; var gx = "optional not ignore cache".split(/\s/); for (var i = 0; i < gx.length; i++) { _[gx[i]] = _generator(_[gx[i]]); }
    var _vector = function (op) { return function () { if (arguments[0] instanceof Array) { return op.apply(null, arguments[0]); } else { return op.apply(null, arguments); } }; }; var vx = "each any all".split(/\s/); for (var j = 0; j < vx.length; j++) { _[vx[j]] = _vector(_[vx[j]]); }
}()); (function () {
    var $D = Date, $P = $D.prototype, $C = $D.CultureInfo; var flattenAndCompact = function (ax) {
        var rx = []; for (var i = 0; i < ax.length; i++) { if (ax[i] instanceof Array) { rx = rx.concat(flattenAndCompact(ax[i])); } else { if (ax[i]) { rx.push(ax[i]); } } }
        return rx;
    }; $D.Grammar = {}; $D.Translator = {
        hour: function (s) { return function () { this.hour = Number(s); }; }, minute: function (s) { return function () { this.minute = Number(s); }; }, second: function (s) { return function () { this.second = Number(s); }; }, meridian: function (s) { return function () { this.meridian = s.slice(0, 1).toLowerCase(); }; }, timezone: function (s) { return function () { var n = s.replace(/[^\d\+\-]/g, ""); if (n.length) { this.timezoneOffset = Number(n); } else { this.timezone = s.toLowerCase(); } }; }, day: function (x) { var s = x[0]; return function () { this.day = Number(s.match(/\d+/)[0]); }; }, month: function (s) { return function () { this.month = (s.length == 3) ? "jan feb mar apr may jun jul aug sep oct nov dec".indexOf(s) / 4 : Number(s) - 1; }; }, year: function (s) { return function () { var n = Number(s); this.year = ((s.length > 2) ? n : (n + (((n + 2000) < $C.twoDigitYearMax) ? 2000 : 1900))); }; }, rday: function (s) { return function () { switch (s) { case "yesterday": this.days = -1; break; case "tomorrow": this.days = 1; break; case "today": this.days = 0; break; case "now": this.days = 0; this.now = true; break; } }; }, finishExact: function (x) {
            x = (x instanceof Array) ? x : [x]; for (var i = 0; i < x.length; i++) { if (x[i]) { x[i].call(this); } }
            var now = new Date(); if ((this.hour || this.minute) && (!this.month && !this.year && !this.day)) { this.day = now.getDate(); }
            if (!this.year) { this.year = now.getFullYear(); }
            if (!this.month && this.month !== 0) { this.month = now.getMonth(); }
            if (!this.day) { this.day = 1; }
            if (!this.hour) { this.hour = 0; }
            if (!this.minute) { this.minute = 0; }
            if (!this.second) { this.second = 0; }
            if (this.meridian && this.hour) { if (this.meridian == "p" && this.hour < 12) { this.hour = this.hour + 12; } else if (this.meridian == "a" && this.hour == 12) { this.hour = 0; } }
            if (this.day > $D.getDaysInMonth(this.year, this.month)) { throw new RangeError(this.day + " is not a valid value for days."); }
            var r = new Date(this.year, this.month, this.day, this.hour, this.minute, this.second); if (this.timezone) { r.set({ timezone: this.timezone }); } else if (this.timezoneOffset) { r.set({ timezoneOffset: this.timezoneOffset }); }
            return r;
        }, finish: function (x) {
            x = (x instanceof Array) ? flattenAndCompact(x) : [x]; if (x.length === 0) { return null; }
            for (var i = 0; i < x.length; i++) { if (typeof x[i] == "function") { x[i].call(this); } }
            var today = $D.today(); if (this.now && !this.unit && !this.operator) { return new Date(); } else if (this.now) { today = new Date(); }
            var expression = !!(this.days && this.days !== null || this.orient || this.operator); var gap, mod, orient; orient = ((this.orient == "past" || this.operator == "subtract") ? -1 : 1); if (!this.now && "hour minute second".indexOf(this.unit) != -1) { today.setTimeToNow(); }
            if (this.month || this.month === 0) { if ("year day hour minute second".indexOf(this.unit) != -1) { this.value = this.month + 1; this.month = null; expression = true; } }
            if (!expression && this.weekday && !this.day && !this.days) {
                var temp = Date[this.weekday](); this.day = temp.getDate(); if (!this.month) { this.month = temp.getMonth(); }
                this.year = temp.getFullYear();
            }
            if (expression && this.weekday && this.unit != "month") { this.unit = "day"; gap = ($D.getDayNumberFromName(this.weekday) - today.getDay()); mod = 7; this.days = gap ? ((gap + (orient * mod)) % mod) : (orient * mod); }
            if (this.month && this.unit == "day" && this.operator) { this.value = (this.month + 1); this.month = null; }
            if (this.value != null && this.month != null && this.year != null) { this.day = this.value * 1; }
            if (this.month && !this.day && this.value) { today.set({ day: this.value * 1 }); if (!expression) { this.day = this.value * 1; } }
            if (!this.month && this.value && this.unit == "month" && !this.now) { this.month = this.value; expression = true; }
            if (expression && (this.month || this.month === 0) && this.unit != "year") { this.unit = "month"; gap = (this.month - today.getMonth()); mod = 12; this.months = gap ? ((gap + (orient * mod)) % mod) : (orient * mod); this.month = null; }
            if (!this.unit) { this.unit = "day"; }
            if (!this.value && this.operator && this.operator !== null && this[this.unit + "s"] && this[this.unit + "s"] !== null) { this[this.unit + "s"] = this[this.unit + "s"] + ((this.operator == "add") ? 1 : -1) + (this.value || 0) * orient; } else if (this[this.unit + "s"] == null || this.operator != null) {
                if (!this.value) { this.value = 1; }
                this[this.unit + "s"] = this.value * orient;
            }
            if (this.meridian && this.hour) { if (this.meridian == "p" && this.hour < 12) { this.hour = this.hour + 12; } else if (this.meridian == "a" && this.hour == 12) { this.hour = 0; } }
            if (this.weekday && !this.day && !this.days) { var temp = Date[this.weekday](); this.day = temp.getDate(); if (temp.getMonth() !== today.getMonth()) { this.month = temp.getMonth(); } }
            if ((this.month || this.month === 0) && !this.day) { this.day = 1; }
            if (!this.orient && !this.operator && this.unit == "week" && this.value && !this.day && !this.month) { return Date.today().setWeek(this.value); }
            if (expression && this.timezone && this.day && this.days) { this.day = this.days; }
            return (expression) ? today.add(this) : today.set(this);
        }
    }; var _ = $D.Parsing.Operators, g = $D.Grammar, t = $D.Translator, _fn; g.datePartDelimiter = _.rtoken(/^([\s\-\.\,\/\x27]+)/); g.timePartDelimiter = _.stoken(":"); g.whiteSpace = _.rtoken(/^\s*/); g.generalDelimiter = _.rtoken(/^(([\s\,]|at|@|on)+)/); var _C = {}; g.ctoken = function (keys) {
        var fn = _C[keys]; if (!fn) {
            var c = $C.regexPatterns; var kx = keys.split(/\s+/), px = []; for (var i = 0; i < kx.length; i++) { px.push(_.replace(_.rtoken(c[kx[i]]), kx[i])); }
            fn = _C[keys] = _.any.apply(null, px);
        }
        return fn;
    }; g.ctoken2 = function (key) { return _.rtoken($C.regexPatterns[key]); }; g.h = _.cache(_.process(_.rtoken(/^(0[0-9]|1[0-2]|[1-9])/), t.hour)); g.hh = _.cache(_.process(_.rtoken(/^(0[0-9]|1[0-2])/), t.hour)); g.H = _.cache(_.process(_.rtoken(/^([0-1][0-9]|2[0-3]|[0-9])/), t.hour)); g.HH = _.cache(_.process(_.rtoken(/^([0-1][0-9]|2[0-3])/), t.hour)); g.m = _.cache(_.process(_.rtoken(/^([0-5][0-9]|[0-9])/), t.minute)); g.mm = _.cache(_.process(_.rtoken(/^[0-5][0-9]/), t.minute)); g.s = _.cache(_.process(_.rtoken(/^([0-5][0-9]|[0-9])/), t.second)); g.ss = _.cache(_.process(_.rtoken(/^[0-5][0-9]/), t.second)); g.hms = _.cache(_.sequence([g.H, g.m, g.s], g.timePartDelimiter)); g.t = _.cache(_.process(g.ctoken2("shortMeridian"), t.meridian)); g.tt = _.cache(_.process(g.ctoken2("longMeridian"), t.meridian)); g.z = _.cache(_.process(_.rtoken(/^((\+|\-)\s*\d\d\d\d)|((\+|\-)\d\d\:?\d\d)/), t.timezone)); g.zz = _.cache(_.process(_.rtoken(/^((\+|\-)\s*\d\d\d\d)|((\+|\-)\d\d\:?\d\d)/), t.timezone)); g.zzz = _.cache(_.process(g.ctoken2("timezone"), t.timezone)); g.timeSuffix = _.each(_.ignore(g.whiteSpace), _.set([g.tt, g.zzz])); g.time = _.each(_.optional(_.ignore(_.stoken("T"))), g.hms, g.timeSuffix); g.d = _.cache(_.process(_.each(_.rtoken(/^([0-2]\d|3[0-1]|\d)/), _.optional(g.ctoken2("ordinalSuffix"))), t.day)); g.dd = _.cache(_.process(_.each(_.rtoken(/^([0-2]\d|3[0-1])/), _.optional(g.ctoken2("ordinalSuffix"))), t.day)); g.ddd = g.dddd = _.cache(_.process(g.ctoken("sun mon tue wed thu fri sat"), function (s) { return function () { this.weekday = s; }; })); g.M = _.cache(_.process(_.rtoken(/^(1[0-2]|0\d|\d)/), t.month)); g.MM = _.cache(_.process(_.rtoken(/^(1[0-2]|0\d)/), t.month)); g.MMM = g.MMMM = _.cache(_.process(g.ctoken("jan feb mar apr may jun jul aug sep oct nov dec"), t.month)); g.y = _.cache(_.process(_.rtoken(/^(\d\d?)/), t.year)); g.yy = _.cache(_.process(_.rtoken(/^(\d\d)/), t.year)); g.yyy = _.cache(_.process(_.rtoken(/^(\d\d?\d?\d?)/), t.year)); g.yyyy = _.cache(_.process(_.rtoken(/^(\d\d\d\d)/), t.year)); _fn = function () { return _.each(_.any.apply(null, arguments), _.not(g.ctoken2("timeContext"))); }; g.day = _fn(g.d, g.dd); g.month = _fn(g.M, g.MMM); g.year = _fn(g.yyyy, g.yy); g.orientation = _.process(g.ctoken("past future"), function (s) { return function () { this.orient = s; }; }); g.operator = _.process(g.ctoken("add subtract"), function (s) { return function () { this.operator = s; }; }); g.rday = _.process(g.ctoken("yesterday tomorrow today now"), t.rday); g.unit = _.process(g.ctoken("second minute hour day week month year"), function (s) { return function () { this.unit = s; }; }); g.value = _.process(_.rtoken(/^\d\d?(st|nd|rd|th)?/), function (s) { return function () { this.value = s.replace(/\D/g, ""); }; }); g.expression = _.set([g.rday, g.operator, g.value, g.unit, g.orientation, g.ddd, g.MMM]); _fn = function () { return _.set(arguments, g.datePartDelimiter); }; g.mdy = _fn(g.ddd, g.month, g.day, g.year); g.ymd = _fn(g.ddd, g.year, g.month, g.day); g.dmy = _fn(g.ddd, g.day, g.month, g.year); g.date = function (s) { return ((g[$C.dateElementOrder] || g.mdy).call(this, s)); }; g.format = _.process(_.many(_.any(_.process(_.rtoken(/^(dd?d?d?|MM?M?M?|yy?y?y?|hh?|HH?|mm?|ss?|tt?|zz?z?)/), function (fmt) { if (g[fmt]) { return g[fmt]; } else { throw $D.Parsing.Exception(fmt); } }), _.process(_.rtoken(/^[^dMyhHmstz]+/), function (s) { return _.ignore(_.stoken(s)); }))), function (rules) { return _.process(_.each.apply(null, rules), t.finishExact); }); var _F = {}; var _get = function (f) { return _F[f] = (_F[f] || g.format(f)[0]); }; g.formats = function (fx) {
        if (fx instanceof Array) {
            var rx = []; for (var i = 0; i < fx.length; i++) { rx.push(_get(fx[i])); }
            return _.any.apply(null, rx);
        } else { return _get(fx); }
    }; g._formats = g.formats(["\"yyyy-MM-ddTHH:mm:ssZ\"", "yyyy-MM-ddTHH:mm:ssZ", "yyyy-MM-ddTHH:mm:ssz", "yyyy-MM-ddTHH:mm:ss", "yyyy-MM-ddTHH:mmZ", "yyyy-MM-ddTHH:mmz", "yyyy-MM-ddTHH:mm", "ddd, MMM dd, yyyy H:mm:ss tt", "ddd MMM d yyyy HH:mm:ss zzz", "MMddyyyy", "ddMMyyyy", "Mddyyyy", "ddMyyyy", "Mdyyyy", "dMyyyy", "yyyy", "Mdyy", "dMyy", "d"]); g._start = _.process(_.set([g.date, g.time, g.expression], g.generalDelimiter, g.whiteSpace), t.finish); g.start = function (s) {
        try { var r = g._formats.call({}, s); if (r[1].length === 0) { return r; } } catch (e) { }
        return g._start.call({}, s);
    }; $D._parse = $D.parse; $D.parse = function (s) {
        var r = null; if (!s) { return null; }
        if (s instanceof Date) { return s; }
        try { r = $D.Grammar.start.call({}, s.replace(/^\s*(\S*(\s+\S+)*)\s*$/, "$1")); } catch (e) { return null; }
        return ((r[1].length === 0) ? r[0] : null);
    }; $D.getParseFunction = function (fx) {
        var fn = $D.Grammar.formats(fx); return function (s) {
            var r = null; try { r = fn.call({}, s); } catch (e) { return null; }
            return ((r[1].length === 0) ? r[0] : null);
        };
    }; $D.parseExact = function (s, fx) { return $D.getParseFunction(fx)(s); };
}());;
'use strict';

String.prototype.padLeft = function (padString, length) {
	var str = this;
	while (str.length < length) {
		str = padString + str;
	}
	return str;
};
Number.prototype.formatString = function (format) {
    if (format == "c") {
        // Determine dollar sign placing
        if (this < 0) {
            return ("-$" + (0 - this).formatString("0.00"));
        }
        return ("$" + this.formatString("0.00"));
    } else if (format == "(c)") {
        // Determine dollar sign placing
        if (this < 0) {
            return ("($" + (0 - this).formatString("0.00") + ")");
        }
        return ("$" + this.formatString("0.00"));
    }
    var displayPlus = (format.length > 0) && (format.substr(0, 1) == "+");
    if (displayPlus) {
        format = format.substr(1, format.length - 1);
    }

    var afterDecimal = "";
    var splitFormat = format.split(".");
    var scaleDigits = 0;
    var precisionDigits = 0;

    if (splitFormat.length == 2) {
        scaleDigits = splitFormat[0].length;
        precisionDigits = splitFormat[1].length;
    } else if (splitFormat.length == 1) {
        scaleDigits = 1;
        precisionDigits = 0;
    }


    var multiplier = Math.pow(10, precisionDigits);
    var rounded = (multiplier == 0) ?
        Math.round(this) :
        (Math.round(this * multiplier) / multiplier);
    var beforeDecimal = (rounded > 0) ? Math.floor(rounded) : (Math.ceil(rounded));
    afterDecimal = (precisionDigits <= 0) ? 0 : (rounded - beforeDecimal);
    if (("" + afterDecimal).length > (precisionDigits + 2) && (multiplier != 0)) {
        afterDecimal = (Math.round(afterDecimal * multiplier) / multiplier);
    }

    var beforeDecimalString = "" + beforeDecimal
    if (format.length > 0 && format.substr(0, 1) == ".") {
        // Don't start with 0 if format starts with .
        beforeDecimalString = "";
    }

    var beforeDecimalDigits = beforeDecimalString.replace(/\D/g, "");


    var numberOfCommas = Math.abs(Math.floor((beforeDecimalDigits.length - 1) / 3));
    while (numberOfCommas > 0) {
        var insertPoint = beforeDecimalDigits.length - (3 * numberOfCommas);
        beforeDecimalString = beforeDecimalDigits.substr(0, insertPoint) +
            "," +
            beforeDecimalDigits.substr(insertPoint, beforeDecimalDigits - insertPoint);
        numberOfCommas--;
    }

    var afterDecimalString = "" + afterDecimal
    if (afterDecimal < 1) {
        if (afterDecimalString == "0") {
            afterDecimalString = ".";
        } else if (afterDecimalString.length >= 2 && afterDecimalString.substr(0, 2) == "0.") {
            // Remove the leading zero
            afterDecimalString = afterDecimalString.substr(1, afterDecimalString.length - 1);
        } else if (afterDecimalString.length >= 3 && afterDecimalString.substr(0, 3) == "-0.") {
            // Remove the leading zero
            afterDecimalString = "-" + afterDecimalString.substr(2, afterDecimalString.length - 2);
        }
    }

    var output = "";
    if (scaleDigits > 0) {
        output = beforeDecimalString;
    }
    if (precisionDigits > 0) {
        while (afterDecimalString.length < (precisionDigits + 1)) {
            afterDecimalString += "0";
        }
        // Don't allow double negative sign case
        if (output.indexOf("-") >= 0 && afterDecimalString.indexOf("-") >= 0) {
            afterDecimalString = afterDecimalString.replace("-", "");
        }
        // Don't allow 0-.99 case
        if (output.indexOf("-") < 0 && scaleDigits > 0 && afterDecimalString.indexOf("-") >= 0) {
            output = "-" + output + afterDecimalString.replace("-", "");
        } else {
            output += afterDecimalString;
        }
    }


    // Sign
    if ((output.length > 0) && (output.indexOf("-") < 0) && displayPlus) {
        output = "+" + output;
    }

    return output;
};;
// Array prototypes

/*
 * indexOf polyfill
 * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf#Polyfill
*/
if (!Array.prototype.indexOf) {
    Array.prototype.indexOf = function (searchElement, fromIndex) {

        var k;

        // 1. Let O be the result of calling ToObject passing
        //    the this value as the argument.
        if (this == null) {
            throw new TypeError('"this" is null or not defined');
        }

        var O = Object(this);

        // 2. Let lenValue be the result of calling the Get
        //    internal method of O with the argument "length".
        // 3. Let len be ToUint32(lenValue).
        var len = O.length >>> 0;

        // 4. If len is 0, return -1.
        if (len === 0) {
            return -1;
        }

        // 5. If argument fromIndex was passed let n be
        //    ToInteger(fromIndex); else let n be 0.
        var n = +fromIndex || 0;

        if (Math.abs(n) === Infinity) {
            n = 0;
        }

        // 6. If n >= len, return -1.
        if (n >= len) {
            return -1;
        }

        // 7. If n >= 0, then Let k be n.
        // 8. Else, n<0, Let k be len - abs(n).
        //    If k is less than 0, then let k be 0.
        k = Math.max(n >= 0 ? n : len - Math.abs(n), 0);

        // 9. Repeat, while k < len
        while (k < len) {
            var kValue;
            // a. Let Pk be ToString(k).
            //   This is implicit for LHS operands of the in operator
            // b. Let kPresent be the result of calling the
            //    HasProperty internal method of O with argument Pk.
            //   This step can be combined with c
            // c. If kPresent is true, then
            //    i.  Let elementK be the result of calling the Get
            //        internal method of O with the argument ToString(k).
            //   ii.  Let same be the result of applying the
            //        Strict Equality Comparison Algorithm to
            //        searchElement and elementK.
            //  iii.  If same is true, return k.
            if (k in O && O[k] === searchElement) {
                return k;
            }
            k++;
        }
        return -1;
    };
}

/*
 * filter polyfill 
 * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter
*/

if (!Array.prototype.filter) {
    Array.prototype.filter = function (fun /*, thisArg */) {
        "use strict";

        if (this === void 0 || this === null)
            throw new TypeError();

        var t = Object(this);
        var len = t.length >>> 0;
        if (typeof fun !== "function")
            throw new TypeError();

        var res = [];
        var thisArg = arguments.length >= 2 ? arguments[1] : void 0;
        for (var i = 0; i < len; i++) {
            if (i in t) {
                var val = t[i];

                // NOTE: Technically this should Object.defineProperty at
                //       the next index, as push can be affected by
                //       properties on Object.prototype and Array.prototype.
                //       But that method's new, and collisions should be
                //       rare, so use the more-compatible alternative.
                if (fun.call(thisArg, val, i, t))
                    res.push(val);
            }
        }

        return res;
    };
}

// Requires Date.toString() function in Date.js
Array.prototype.containsDate = function(d) {
	for(var i=0; i<this.length; i++) {
		if((this[i]==null) && (d==null)) { return true; }
		if((this[i]!=null) && (d!=null)) {
			if(this[i].toString() == d.toString()) { return true; }
		}
	}
	return false;
};
//--------------------------------------------------
// Date.prototype.toString
//--------------------------------------------------
Date.prototype.toString = function(formatString) {
	// Default format: M/d/yyyy
	if(formatString == null) { formatString = "M/d/yyyy h:mm:ss tt"; }

	var monthAbbrs = new Array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec");
	var monthNames = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
	var dayAbbrs = new Array("Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat");

	// Example Date: Friday, October 5th, 2007
	var M = this.getMonth() + 1; // ex. 10
	var MM = (M < 10) ? ("0" + M) : M; // ex. 10 (September = 09)
	var MMM = monthAbbrs[this.getMonth()]; // ex. Oct
	var MMMM = monthNames[this.getMonth()]; // ex. Oct
	var d = this.getDate(); // ex. 5
	var dd = (d < 10) ? ("0" + d) : d; // ex. 05
	var ddd = dayAbbrs[this.getDay()]; // ex. Fri
	var dddd = this.getDayName();
	var yyyy = this.getFullYear(); // ex. 2007
	if(yyyy < 10) {
		yyyy = "000" + yyyy;
	} else if(yyyy < 100) {
		yyyy = "00" + yyyy;
	} else if(yyyy < 1000) {
		yyyy = "0" + yyyy;
	}

	var HH = this.getHours(); // ex. 18 in 06:30:59 PM
	var hh = HH;
	if(hh > 12) { hh -= 12; }
	if(hh == 0) { hh = 12; }

	var h = "" + hh;

	if(hh < 10) { hh = "0" + hh; }
	if(HH < 10) { HH = "0" + HH; }
	var mm = this.getMinutes(); // ex. 30 in 06:30:59 PM
	if(mm < 10) { mm = "0" + mm; }
	var ss = this.getSeconds(); // ex. 59 in 06:30:59 PM
	if(ss < 10) { ss = "0" + ss; }
	var fff = this.getMilliseconds();
	if(fff < 10) {
		fff = "00" + fff;
	} else if(fff < 100) {
		fff = "0" + fff;
	} else {
		fff = "" + fff;
	}


	var tt = (HH >= 12) ? "PM" : "AM"; // ex. PM in 06:30:59 PM




	switch(formatString) {
		case "M": { return M; } 
		case "MMM": { return MMM; } 
		case "d": { return d; } 
		case "ddd": { return ddd; } 
		case "dddd": { return dddd; } 
		case "yyyy": { return yyyy; } 
		case "h": { return h; } 
		case "hh": { return hh; } 
		case "mm": { return mm; } 
		case "h:mm": { return h + ":" + mm; } 
		case "h:mm tt": { return h + ":" + mm + " " + tt; } 
		case "hh:mm": { return hh + ":" + mm; } 
		case "hh:mm tt": { return hh + ":" + mm + " " + tt; } 
		case "h:mm:ss tt": { return h + ":" + mm + ":" + ss + " " + tt; } 
		case "h:mm:ss.fff tt": { return h + ":" + mm + ":" + ss + "." + fff + " " + tt; } 
		case "MMMM yyyy": { return MMMM + " " + yyyy; } 
        case "dddd MMMM d yyyy": { return dddd + " " + MMMM + " " + d + " " + yyyy; }
		case "M/d/yyyy": { return M + "/" + d + "/" + yyyy; } 
        case "MM/dd/yyyy": { return MM + "/" + dd + "/" + yyyy; }
		case "ddd M/d/yyyy": { return ddd + " " + M + "/" + d + "/" + yyyy; } 
		case "dddd, M/d/yyyy": { return dddd + ", " + M + "/" + d + "/" + yyyy; } 
		case "M/d/yyyy HH:mm:ss": { return M + "/" + d + "/" + yyyy + " " + HH + ":" + mm + ":" + ss; } 
		case "M/d/yyyy h:mm tt": { return M + "/" + d + "/" + yyyy + " " + h + ":" + mm + " " + tt; } 
		case "M/d/yyyy h:mm:ss tt": { return M + "/" + d + "/" + yyyy + " " + h + ":" + mm + ":" + ss + " " + tt; } 
		case "M/d/yyyy h:mm:ss.fff tt": { return M + "/" + d + "/" + yyyy + " " + h + ":" + mm + ":" + ss + "." + fff + " " + tt; } 
		case "M/d/yyyy hh:mm:ss tt": { return M + "/" + d + "/" + yyyy + " " + hh + ":" + mm + ":" + ss + " " + tt; } 
		case "M/d/yyyy hh:mm:ss.fff tt": { return M + "/" + d + "/" + yyyy + " " + hh + ":" + mm + ":" + ss + "." + fff + " " + tt; } 
		default: { return M + "/" + d + "/" + yyyy; }
	}
};

/**
 * Gets the name of the day of the week.
 * @param {Boolean}  true to return the abbreviated name of the day of the week
 * @return {String}  The name of the day
 * Requires Date.js
 */
Date.prototype.getDayName = function (abbrev) {
	return abbrev ? Date.CultureInfo.abbreviatedDayNames[this.getDay()] :
		Date.CultureInfo.dayNames[this.getDay()];
};

/**
 * Get the number of days in the current month, adjusted for leap year.
 * @return {Number}  The number of days in the month
 * Requires Date.js
 */
Date.prototype.getDaysInMonth = function () {
	return Date.getDaysInMonth(this.getFullYear(), this.getMonth());
};


//--------------------------------------------------
// DATE HOLIDAY GETTERS
//--------------------------------------------------
// getNewYearsDay
Date.prototype.getNewYearsDay = function(year) {
	return new Date(year, 0, 1); // 1/1
};
// getGoodFriday
Date.prototype.getGoodFriday = function(year) {
	// Subtract from Easter
	return this.getEasterSunday(year).addDays(-2);
};
// getEasterSunday
Date.prototype.getEasterSunday = function(year) {
	// G: Golden Number - 1
	// H: 23-Epact (modulo 30)
	// I: Number of days from March 21 to Paschal full moon
	// J: The weekday for the Paschal full moon (0=Su ... 6=Sa)
	// L: Number of days from March 21 to the Sunday on or before the Paschal full moon (-6 to 28)

	/*
		var G = year % 19;
		var I = (19 * G + 15);
		var J = (year + (year / 4) + I) % 7;
		var C = year / 100;
		var H = (C - (C / 4) - ((8 * C + 13) / 25) + (19 * G) + 15) % 30;

		I = H - (H / 28) * (1 - (29 / (H + 1))) * ((21 - G) / 11);
		J = (year + (year / 4) + I + 2 - C + (C / 4)) % 7;
		var L = I - J;
		var EasterMonth = 3 + ((L + 40) / 44);
		var EasterDay = L + 28 - 31 * (EasterMonth / 4);
	*/
	// Add parseInt for integer division
	var G = parseInt(year % 19);
	var I = parseInt(19 * G + 15);
	var J = parseInt(parseInt(year + parseInt(year / 4) + I) % 7);
	var C = parseInt(year / 100);
	var H = parseInt(parseInt(C - parseInt(C / 4) - parseInt((parseInt(8 * C) + 13) / 25) + parseInt(19 * G) + 15) % 30);

	I = parseInt(H - parseInt(H / 28) * parseInt(1 - parseInt(29 / (H + 1))) * parseInt((21 - G) / 11));
	J = parseInt(parseInt(year + (year / 4) + I + 2 - C + parseInt(C / 4)) % 7);
	var L = parseInt(I - J);
	var EasterMonth = 3 + parseInt((L + 40) / 44);
	var EasterDay = parseInt(L + 28 - 31 * parseInt(EasterMonth / 4));


	return new Date(year, EasterMonth - 1, EasterDay);
};
// getMemorialDay
Date.prototype.getMemorialDay = function(year) {
	// Last Monday of May
	var lastMondayOfMay = new Date(year, 4, 31); // 5/31
	// If last day isn't Monday, subtract days until we get one
	while((lastMondayOfMay.toString("ddd") != "Mon")) {
		lastMondayOfMay = lastMondayOfMay.addDays(-1);
	}
	return lastMondayOfMay;
};
// getIndependenceDay
Date.prototype.getIndependenceDay = function(year) {
	return new Date(year, 6, 4); // 7/4
};
// getLaborDay
Date.prototype.getLaborDay = function(year) {
	// First Monday in September
	var firstMondayInSeptember = new Date(year, 8, 1); // 9/1
	// If first day isn't Monday, add until we get one
	//while(firstMondayInSeptember.toString("ddd") != "Mon") {
	while(firstMondayInSeptember.getDayName() != "Monday") {
		firstMondayInSeptember = firstMondayInSeptember.addDays(1);
	}
	return firstMondayInSeptember;
};
// getThanksgivingDay
Date.prototype.getThanksgivingDay = function(year) {
	// Fourth Thursday in November
	var fourthThursdayInNovember = new Date(year, 10, 1); // 11/1
	// Add days until we get the FIRST Thursday
	while(fourthThursdayInNovember.toString("ddd") != "Thu") {
		fourthThursdayInNovember = fourthThursdayInNovember.addDays(1);
	}
	// Add 3 weeks worth of days to get the 4th Thursday
	fourthThursdayInNovember = fourthThursdayInNovember.addDays(21);
	return fourthThursdayInNovember;
};
// getDayAfterThanksgiving
Date.prototype.getDayAfterThanksgiving = function(year) {
	// Simply add a day to Thanksgiving
	return this.getThanksgivingDay(year).addDays(1);
};
// getChristmasEve
Date.prototype.getChristmasEve = function(year) {
	return new Date(year, 11, 24); // 12/24
};
// getChristmasDay
Date.prototype.getChristmasDay = function(year) {
	return new Date(year, 11, 25); // 12/25
};




// getFirstCalendarDay
Date.prototype.getFirstCalendarDay = function() {
	return new Date(this.getFullYear(), this.getMonth(), 1);
};
// getLastCalendarDay
Date.prototype.getLastCalendarDay = function() {
	var year = this.getFullYear();
	var month = this.getMonth();
	var isLeapYear = (year%4)==0;
	var monthDays = new Array(31,(isLeapYear ? 29 : 28),31,30,31,30,31,31,30,31,30,31);
	return new Date(year, month, monthDays[month]);
};



//--------------------------------------------------
// BUSINESS DAY / WEEKEND CALCULATIONS
//--------------------------------------------------
// addDaysAssertBusinessDayBackward
Date.prototype.addDaysAssertBusinessDayBackward = function(days) {
	var day = this.addDays(days);
	if(!day.isBusinessDay()) {
		day = day.getPreviousBusinessDay();
	}
	return day;
};
// addDaysAssertBusinessDayForward
Date.prototype.addDaysAssertBusinessDayForward = function(days) {
	var day = this.addDays(days);
	if(!day.isBusinessDay()) {
		day = day.getNextBusinessDay();
	}
	return day;
};
// getNextBusinessDay
Date.prototype.getNextBusinessDay = function() {
	var businessDay = this;
	for(var i = 0; i < 30; i++) {
		businessDay = businessDay.addDays(1);
		if(businessDay.isBusinessDay()) {
			return businessDay;
		}
	}
	return businessDay;
};
// getPreviousBusinessDay
Date.prototype.getPreviousBusinessDay = function() {
	var businessDay = this;
	for(var i = 0; i < 30; i++) {
		businessDay = businessDay.addDays(-1);
		if(businessDay.isBusinessDay()) {
			return businessDay;
		}
	}
	return businessDay;
};
// isBusinessDay
Date.prototype.isBusinessDay = function() {
	return !this.isWeekend() && !this.isAEPObservedHoliday();
};
// isWeekend
Date.prototype.isWeekend = function() {
	return !this.isWeekday();
	//var dayOfWeek = this.toString("ddd");
	//return (dayOfWeek=="Sat") || (dayOfWeek=="Sun");
};

/**
 * Determines whether or not this instance is a weekday.
 * @return {Boolean} true if this instance is a weekday
 */
Date.prototype.isWeekday = function () {
	return !(this.is().sat() || this.is().sun());
};



//--------------------------------------------------
// AEP HOLIDAY DETECTION / CONVERSIONS
//--------------------------------------------------
// convertToObservedHoliday
Date.prototype.convertToObservedHoliday = function() {
	// Remove time information if it exists
	var holiday = new Date(this.getFullYear(), this.getMonth(), this.getDate());
	var dayOfWeek = this.toString("ddd");

	if(holiday.equals(this.getChristmasEve(holiday.getFullYear()))) {
		// SPECIAL CASE: Christmas Eve
		// The day before Christmas shall be observed the day on which it falls
		// with the following exceptions:
		// 1. When it falls on Friday, it shall be ovserved the preceding Thursday
		// 2. When it falls on Saturday or Sunday, it shall be observed on the preceding Friday
		// 3. When it falls on a Wednesday, it shall be observed on Friday

		if(dayOfWeek == "Fri") {
			return holiday.addDays(-1); // Preceding Thursday
		} else if(dayOfWeek == "Sat") {
			return holiday.addDays(-1); // Preceding Friday
		} else if(dayOfWeek == "Sun") {
			return holiday.addDays(-2); // Preceding Friday
		} else if(dayOfWeek == "Wed") {
			return holiday.addDays(2); // Next Friday
		}

	} else {
		// NORMAL CASE
		// 1. When any holiday (except day before Christmas) falls on Sunday, 
		//    the following Monday is observed.
		// 2. When any holiday falls on Saturday, the preceding Friday is observed.
		if(dayOfWeek == "Sun") {
			return holiday.addDays(1); // Sunday -> Monday
		} else if(dayOfWeek == "Sat") {
			return holiday.addDays(-1); // Friday <- Saturday
		}
	}
	// Otherwise, just use the date we have
	return holiday;
};
// getAEPHolidays
Date.prototype.getAEPHolidays = function(year) {
	return new Array(
		this.getNewYearsDay(year),
		this.getGoodFriday(year),
		this.getMemorialDay(year),
		this.getIndependenceDay(year),
		this.getLaborDay(year),
		this.getThanksgivingDay(year),
		this.getDayAfterThanksgiving(year),
		this.getChristmasEve(year),
		this.getChristmasDay(year)
	);
};
// getAEPObservedHolidays
Date.prototype.getAEPObservedHolidays = function(year) {
	// Get actual holidays
	var holidays = this.getAEPHolidays(year);

	// Loop through and make each actual holiday an observed holiday
	for(var i = 0; i < holidays.length; i++) {
		holidays[i] = holidays[i].convertToObservedHoliday();
	}

	return holidays;
};


var DateHelper = {
	//--------------------------------------------------
	// compareTo
	//--------------------------------------------------
	compareTo: function(d1, d2) {
		if(isNaN(d1)) {
			throw new Error(d1);
		}
		if(d2 instanceof Date && !isNaN(d2)) {
			return (d1 > d2) ? 1 : (d1 < d2) ? -1 : 0;
		} else {
			throw new TypeError(d2);
		}
	},
	//--------------------------------------------------
	// equals
	//--------------------------------------------------
	equals: function(d1, d2) {
		return (DateHelper.compareTo(d1, d2) === 0);
	},
	//--------------------------------------------------
	// getAEPHolidaysWithNames
	//--------------------------------------------------
	getAEPHolidaysWithNames: function(year) {
		var dateObj = new Date();
		return new Array(
			{ name: "New Year's Day", date: dateObj.getNewYearsDay(year) },
			{ name: "Good Friday", date: dateObj.getGoodFriday(year) },
			{ name: "Memorial Day", date: dateObj.getMemorialDay(year) },
			{ name: "Independence Day", date: dateObj.getIndependenceDay(year) },
			{ name: "Labor Day", date: dateObj.getLaborDay(year) },
			{ name: "Thanksgiving Day", date: dateObj.getThanksgivingDay(year) },
			{ name: "Day after Thanksgiving", date: dateObj.getDayAfterThanksgiving(year) },
			{ name: "Christmas Eve", date: dateObj.getChristmasEve(year) },
			{ name: "Christmas Day", date: dateObj.getChristmasDay(year) }
		);
	},
	//--------------------------------------------------
	// getAEPObservedHolidaysWithNames
	//--------------------------------------------------
	getAEPObservedHolidaysWithNames: function(year) {
		// Get actual holidays
		var holidayData = this.getAEPHolidaysWithNames(year);

		// Loop through and make each actual holiday an observed holiday
		for(var i = 0; i < holidayData.length; i++) {
			var holiday = holidayData[i];
			var beginDate = holiday.date;
			var endDate = holiday.date.convertToObservedHoliday();
			holiday.date = endDate;

			if(!DateHelper.equals(beginDate, endDate)) {
				holiday.name += " (observed)";
			}
		}

		return holidayData;
	},
	getAEPObservedHolidayName: function(date) {
		var observedHolidays = DateHelper.getAEPObservedHolidaysWithNames(date.getFullYear());
		for(var i = 0; i < observedHolidays.length; i++) {
			var holiday = observedHolidays[i];
			if(DateHelper.equals(date, holiday.date)) {
				return holiday.name;
			}
		}
		return "";
	}
};


// getAEPObservedHolidaysWithNames
Date.prototype.getAEPObservedHolidaysWithNames = function(year) {
	// Get actual holidays
	var holidayData = this.getAEPHolidaysWithNames(year);

	// Loop through and make each actual holiday an observed holiday
	for(var i = 0; i < holidayData.length; i++) {
		var holiday = holidayData[i];
		var beginDate = holiday.date;
		var endDate = holiday.date.convertToObservedHoliday();
		holiday.date = endDate;

		log(beginDate.toString("M/d/yyyy h:mm:ss tt") + " compared to " + endDate.toString("M/d/yyyy h:mm:ss tt") + ": " + Date.compare(beginDate, endDate));

		if(DateHelper.areDatesEqual(beginDate, endDate)) {
			holiday.name += " (observed)";
		}
	}

	return holidayData;
};
// getAEPObservedHolidayName
Date.prototype.getAEPObservedHolidayName = function() {
	if(this.isAEPObservedHoliday()) {
		var observedHolidays = this.getAEPObservedHolidays(this.getFullYear());

	}
	return "";
};

// isAEPObservedHoliday
Date.prototype.isAEPObservedHoliday = function() {
	// Get observed holidays for this year
	var observedHolidays = this.getAEPObservedHolidays(this.getFullYear());
	// Check to see if this one exists in list
	for(var i = 0; i < observedHolidays.length; i++) {
		if(this.equals(observedHolidays[i])) {
			return true;
		}
	}
	return false;
};



//// tryParse
//Date.prototype.tryParse = function(dateString) {
//	try {
//		var d = new Date(Date.parse(dateString));
//		var isInvalid = (isNaN(d) || (d == "Invalid Date"))
//		return (isInvalid) ? null : d;
//	} catch(ex) { return null; }
//};



;
// String prototypes
String.prototype.padLeft = function(padString, length) {
	var str = this;
	while(str.length < length) {
		str = padString + str;
	}
	return str;
};

String.prototype.endsWith = function(suffix) {
	return this.indexOf(suffix, this.length - suffix.length) !== -1;
};

String.prototype.includes = function (search, start) {
    'use strict';

    if (search instanceof RegExp) {
        throw TypeError('first argument must not be a RegExp');
    }
    if (start === undefined) { start = 0; }
    return this.indexOf(search, start) !== -1;
};
;
//==================================================
// DOCUMENT READY
//==================================================
$(document).ready(function () {
    formValidate();

    // Change iPhone/iPod tel fields to number for currency fields
    if (VAL.isDeviceCurrencyTypeNumber()) {
        $("input[data-field-type='currency'][type='tel']").each(function () {
            $(this).attr("type", "number");
        });
        $("input[data-field-type='currency'][type='number']").on("keypress", function (e) {
            return e.metaKey || // cmd/ctrl
                e.which <= 0 || // arrow keys
                e.which === 8 || // delete key
                e.which === 110 ||  // decimal
                e.which === 190 ||  // period
                e.which === 46 ||  // ios decimal
                /[0-9]/.test(String.fromCharCode(e.which)); // numbers
        });
    }
    //if(VAL.isDeviceDateNumber()) {
    //	$(".date-chooser > input").each(function() {
    //		$(this).attr("type", "number");
    //	});
    //}
});

//==================================================
// UTILITY FUNCTIONS
//==================================================
function getDigits(s) {
    if (s === null || typeof (s) !== "string") { return ""; }
    var pat = /\d+/g;
    return pat.test(s) ? s.match(pat).join("") : "";
}
function getAlphaNumeric(s) {
    if (s === null || typeof (s) !== "string") { return ""; }
    return s.replace(/[^a-z0-9]/gi, '');
}
function isEmpty(val) {
    if (typeof (val) === "undefined" || val === null) { return true; }
    return $.trim(val).length === 0;
}
function isNullOrEmpty(s) {
    if (typeof (s) === "string") { return s === null || s === ""; }
    return true;
}

function getParentFieldset($input) {
    var $fieldset = null;
    if ($input) {
        var $parent = $input;
        var i = 0;
        while ($fieldset === null && $parent !== null && $parent.is(":not(form)") && $parent.is(":not(html)") && i < 1000) {
            if ($parent.is("fieldset")) {
                $fieldset = $parent;
            }
            $parent = $parent.parent();
            i++;
        }
    }
    return $fieldset;
}
var VAL = {
    //--------------------------------------------------
    // isDeviceCurrencyNumber
    //--------------------------------------------------
    isDeviceCurrencyTypeNumber: function () {
        // Use number keyboard for all phones, iPod, iPad (more touch devices? less phones?)
        return APP.isPhone() || /(iPod|iPad)/g.test(typeof (navigator) === "undefined" ? "" : navigator.userAgent);
    },
    //--------------------------------------------------
    // isDeviceCurrencyNumber
    //--------------------------------------------------
    isDeviceNumberTypeNumber: function () {
        // Use number keyboard for all phones, iPod, iPad (more touch devices? less phones?)
        return APP.isPhone() || /(iPad)/g.test(typeof (navigator) === "undefined" ? "" : navigator.userAgent);
    }
}

function encodePasswordFields(fields) {
    for (var i = 0; i < fields.length; i++) {
        var type = "";
        if (typeof (fields[i].type) !== "undefined" && fields[i].type === "password") {
            var value = fields[i].value;//.replace(/</g, '&lt;').replace(/>/g, '&gt;');
            fields[i].value = value;
        } 

    }
}

//==================================================
// FORM VALIDATION FUNCTIONS
//==================================================
function formGetValidators($form, validationGroup, type) {
    if (!type) { type = "all"; }
    var validationGroupSelector = validationGroup ? ("[validationgroup='" + validationGroup + "']") : ":not(*[validationgroup])";
    var selector = validationGroupSelector;
    if (type === "invalid") {
        selector += ":visible";
    }
    return $(".validator" + selector);
}
function formGetAEPInputs($form, validationGroup) {
    var validationGroupSelector = validationGroup ? ("[validationgroup='" + validationGroup + "']") : ":not(*[validationgroup])";
    var defaultSelector = "*[data-field-type]" + validationGroupSelector;
    //var enabledSelector = "*[data-field-type]" + validationGroupSelector + ":enabled";
    var $aepInputs = $form.find(defaultSelector);

    return $aepInputs;
}
function formValidate(validationGroup) {
    var $form = $("#form1");

    createCompareToEvents();

    var $submitButtons = $form.find("input[type=submit]");
    $submitButtons.click(function () {
        $("input[type=submit]", $(this).parents("form")).removeAttr("clicked");
        $(this).attr("clicked", "true");
    });
    $submitButtons.mousedown(function (e) {
        $(this).data("mouse-down", true);
    });
    $submitButtons.mouseup(function (e) {
        $(this).data("mouse-down", false);
    });

    var FORM_SUBMIT_ACTIVE = false;
    $form.submit(function (e) {
        APP.log("$form.submit");
        if (!FORM_SUBMIT_ACTIVE) {
            APP.log("processing form validation");
            var $buttonClicked = $("input[type=submit][clicked=true]").not("[data-causes-validation='false']");

            if ($buttonClicked.length > 0) {
                // enter key will trigger first submit button, which is the in the global login panel, if global login panel isn't visible check for next submit button
                if ($buttonClicked.is(":visible") === false && $buttonClicked[0].id.indexOf("BtnLogin") > 0) {
                    $buttonClicked = $($("input[type=submit]").not("[data-causes-validation='false']")[1]);
                    if ($buttonClicked.length <= 0) {
                        return;
                    } else {
                        $buttonClicked.click();
                        return;
                    }
                }
                // Set processing classes
                var $fieldset = getParentFieldset($buttonClicked);
                if ($fieldset !== null) {
                    $fieldset.addClass("dimmed processing");
                }

                var onclickVal = $buttonClicked.attr('onclick');
                var regex4thParam = /WebForm_PostBackOptions[^,]+,[^,]+,[^,]+,[^"]+"([^"]*)",/ig
                var match = regex4thParam.exec(onclickVal);
                if (match && match.length > 0) {
                    validationGroup = match[1];
                }
                var validationGroupSelector = validationGroup ? ("[validationgroup='" + validationGroup + "']") : ":not(*[validationgroup])";
                var defaultSelector = "*[data-field-type]" + validationGroupSelector;

                var $aepInputs = formGetAEPInputs($form, validationGroup);
                var aepvalIsValid = $aepInputs.validate({ validationEvent: "submit" });

                var $allValidators = $(".validator" + validationGroupSelector);
                var $standaloneValidators = $allValidators.not('[data-validate-field]');
                $standaloneValidators.validateCustomValidators();

                var $allInvalid = $(".validator" + validationGroupSelector + ":visible");

                // fix .net validators to display block instead of inline
                $($allInvalid).each(function () {
                    if ($(this).css("display") === "inline") {
                        $(this).css("display", "block");
                    } else if ($(this).css("visibility") === "hidden") {
                        $(this).css("display", "none");
                    }
                });
                // get new list of invalid fields after fixing display
                $allInvalid = $(".validator" + validationGroupSelector + ":visible");

                var isFormValid = $allInvalid.length <= 0;
                if (isFormValid) {
                    FORM_SUBMIT_ACTIVE = true;
                    // encode password fields
                    encodePasswordFields($aepInputs);
                    APP.log("FORM_SUBMIT_ACTIVE");

                    // NOTE: This will display the form processing overlay if all frontend validation passes. If this step is reached, the page should refresh, and hide this overlay again, so there is no need to programmatically hide it after showing it. - CMA
                    $('.form-processing-overlay').show();
                }

                if (!isFormValid) {
                    // hide overlay that is immediately shown on form submit to prevent multiple submits
                    $('.form-processing-overlay').hide();
                    // TODO update to remove new classes for processing form
                    $form.find(".dimmed.processing").removeClass("dimmed processing");

                    $($allInvalid).each(function () {
                        if ($(this).css("display") === "inline") {
                            $(this).css("display", "block");
                        }
                    });

                    var $firstInvalidField = $form.find(".is-invalid, .invalid-feedback:visible").first();

                    var inputIsSelector = $firstInvalidField.hasClass("radio") || $firstInvalidField.hasClass("checkbox") || $firstInvalidField.hasClass("chips");
                    var isValidator = $firstInvalidField.hasClass("invalid-feedback");
                    // NOTE: If we have forms with multiple pages, we could wrap each page in the same parent class,
                    // then target that class with $firstInvalidField.closest('.parent-class'),
                    // then either check to see whether that parent is visible, or if we should programatically
                    // navigate the user back to that page first before focusing the first invalid input - CMA
                    var offsetAmount;
                    if (isValidator) {
                        offsetAmount = 15;
                    } else {
                        var hasMoveableLabel = $firstInvalidField.closest('.form-group').hasClass('moveable-label');
                        if (inputIsSelector) {
                            offsetAmount = 68;
                        } else if (hasMoveableLabel) {
                            offsetAmount = 15;
                        } else {
                            offsetAmount = 40; // if no moveable label, give more space in offset for larger label space - CMA
                        }
                    }


                    $('html, body').animate({
                        scrollTop: $firstInvalidField.offset().top - offsetAmount
                    },
                        500,
                        function () {
                            $firstInvalidField.focus();
                        });

                    e.preventDefault();
                    e.stopPropagation();

                    // Check if aspnet validator triggered validation summary
                    var $valSummary = $(".validation-summary" + validationGroupSelector);
                    if ($valSummary.length > 0) {
                        var errorListHTML = "";

                        if ($allInvalid.length <= 2) {
                            errorListHTML = "<p class='lead'>There " + ($allInvalid.length === 1 ? "was a problem" : "were a couple of problems") + " submitting the form:</p><ul>";
                            $allInvalid.each(function () {
                                var errorMessage = $(this).html();
                                errorListHTML += ("<li>" + errorMessage + "</li>");
                            });
                            errorListHTML += "</ul>";
                        } else {
                            errorListHTML = "<p class='lead'>There were multiple problems submitting the form.</p>";
                        }

                        $valSummary.html(errorListHTML);

                        var fieldsetNumber = Number($valSummary.attr("data-fieldset-number"));
                        if (isNaN(fieldsetNumber)) { fieldsetNumber = 0; }

                        $fieldset = $("#content fieldset").eq(fieldsetNumber);
                        var $visibleFieldset = $("fieldset:visible");

                        var $h2 = $fieldset.find("> h2:first-of-type,> div.row:first-of-type h2").eq(0)
                        if ($h2.length > 0) {
                            $valSummary.insertAfter($h2).show();
                        } else {
                            //$fieldset.prepend($valSummary.show());
                            $visibleFieldset.prepend($valSummary.show());
                        }


                        var scrollTime = 300;
                        if (typeof ($("form").attr("data-validate-scroll-time")) !== "undefined") {
                            var ms = Number($("form").attr("data-validate-scroll-time"));
                            if (!isNaN(ms)) {
                                scrollTime = ms;
                            }
                        }
                        if ($visibleFieldset.is(":visible")) {
                            $('html, body').animate({
                                scrollTop: $visibleFieldset.offset().top
                            }, scrollTime);
                        }

                    }
                } else {
                    // restore radio button names
                    try {
                        $('.radio input[type="radio"]').each(function (i, control) {
                            var aspnetname = $(this).data('aspnetname');
                            control.name = aspnetname;
                        });
                    } catch (e) { }
                }

            }
        }
    });
}
function formUpdateProcessingState($inputInFieldset, isValid) {
    var $fieldset = getParentFieldset($inputInFieldset);
    if (isValid) {
        $fieldset.addClass("dimmed processing");
    } else {
        $fieldset.removeClass("dimmed processing");
    }
}

function createCompareToEvents() {
    $('input[data-compare-to]').each(function () {
        var compareTo = $(this).attr("data-compare-to");
        if (!isNullOrEmpty(compareTo)) {
            var $compareFrom = $("#" + compareTo).eq(0);
            if ($compareFrom.length > 0) {
                $compareFrom.blur(function (e) {
                    // call validation on the first validator
                    var compareToInput = $('input[data-compare-to="' + e.target.id + '"]');
                    if (compareToInput !== 'undefined' && compareToInput.val() != "") {
                        compareToInput.validate();
                    }
                });
            }
        }
    });
}



function isBaseInputValid(val) {
    var output = { isValid: true, errorMessage: "" };
    output.isValid = (typeof (val) === "string" || val !== null);
    if (!output.isValid) { output.errorMessage = "Invalid input"; }
    return output;
}


function validateGetBaseInput(input, field) {
    if (field === undefined) {
        field = null;
    }
    var baseInput = $.extend({ field: field, val: "", isRequired: false, compareTo: "", validationEvent: "blur", eventObject: null, extraValidation: null, causesValidation: true }, input);
    if (baseInput.field) {
        if (baseInput.field.attr("data-causes-validation")) {
            baseInput.causesValidation = (baseInput.field.attr("data-causes-validation").toLowerCase() !== "false");
        }
        // Disabled validation if field is disabled
        if (!baseInput.field.is(":enabled")) {
            baseInput.causesValidation = false;
        }
        if (baseInput.field.attr("data-compare-to")) { baseInput.compareTo = baseInput.field.attr("data-compare-to"); }
    }

    return baseInput;
}
function validateGetBaseOutput(input) {
    var output = { isValid: true, errorMessage: "", formatted: null, requiredMessage: "", invalidMessage: "", maxlengthMessage: "", compareToMessage: "", requiresFormatting: false, validFormatting: true, };
    if (typeof (input) !== "undefined") {
        if (typeof (input.field) !== "undefined" && input.field !== null) {
            if (input.field.attr("data-required-message")) { output.requiredMessage = input.field.attr("data-required-message"); }
            if (input.field.attr("data-invalid-message")) { output.invalidMessage = input.field.attr("data-invalid-message"); }
            if (input.field.attr("data-maxlength-message")) { output.maxlengthMessage = input.field.attr("data-maxlength-message"); }
            if (input.field.attr("data-compare-to-message")) { output.compareToMessage = input.field.attr("data-compare-to-message"); }
        }
    }
    return output;
}

function validateBaseInputCheck(input) {
    var output = validateGetBaseOutput(input);
    output.isValid = (typeof (input.val) === "string" || input.val !== null);
    if (!output.isValid) {
        output.errorMessage = "Invalid input";
        output.requiresFormatting = true;
        output.validFormatting = false;
    }
    return output;
}
function validateIsNotCellularDomain(input) {
    if (!isNullOrEmpty(input.val)) {
        email = input.val.toLowerCase();
        var cellularDomains = new Array("email.uscc.net", "vtext.com", "vmobl.com", "txt.att.net", "messaging.nextel.com", "messaging.sprintpcs.com", "tmomail.net");
        for (var domain in cellularDomains) {
            if (email.endsWith(cellularDomains[domain])) {
                return false;
            }
        }
    }
    return true;
}
function validateIsCompareToValid(input, ignoreCase) {
    if (ignoreCase === null) { ignoreCase = true; }
    try {
        if (!isNullOrEmpty(input.compareTo)) {
            var anotherInputVal = $("#" + input.compareTo).val();
            var isRequired = $("#" + input.compareTo).attr('data-required') ? $("#" + input.compareTo).attr('data-required').toLowerCase() === "true" : false;
            // Don't compare against empty values unless field is not required
            if (isRequired === false && input.validationEvent == "submit" || !isNullOrEmpty(anotherInputVal)) {
                if (ignoreCase) {
                    return input.val.toLowerCase() === anotherInputVal.toLowerCase();
                } else {
                    return input.val === anotherInputVal;
                }
            }
        }
    } catch (e) { }
    return true;
}

function validateIsEmptyAndNotRequired(input) {
    return !input.isRequired && input.val.length === 0 && isNullOrEmpty(input.compareTo);
}

function validateIsEmptyAndRequired(input) {
    // Don't do required field validation on blur or keyup states
    //if (input.validationEvent.indexOf("blur") >= 0 || input.validationEvent.indexOf("keyup") >= 0) { return false; }
    if (input.validationEvent.indexOf("keyup") >= 0) { return false; }
    return input.isRequired && input.val.length === 0;
}
function validateMaxLength(input) {
    var length = input.field.attr('maxlength') ? input.field.attr('maxlength') : 0;
    return (length > 0 && input.val.length > length);
}
function validateGetIsRequiredErrorMessage(field) { return ""; }



//==================================================
// INDIVIDUAL FIELD VALIDATION FUNCTIONS
//==================================================
// ACCOUNT NUMBER
function accountNumberFormat(val) {
    // Format account # to 123-123-123-1 or 123-123-123-1-1
    var digits = getDigits(val);

    if (digits.length === 10) {
        return digits.substr(0, 3) + "-" + digits.substr(3, 3) + "-" + digits.substr(6, 3) + "-" + digits.substr(9, 1);
    } else if (digits.length === 11) {
        return digits.substr(0, 3) + "-" + digits.substr(3, 3) + "-" + digits.substr(6, 3) + "-" + digits.substr(9, 1) + "-" + digits.substr(10, 1);
    }
    return val;
}
function accountNumberIsValid(input) {
    console.log("accountNumberIsValid input=" + input);
    input = validateGetBaseInput(input);
    var output = validateGetBaseOutput(input);
    output.requiresFormatting = true;

    var inputCheck = validateBaseInputCheck(input);

    if (!inputCheck.isValid) { return inputCheck; }

    if (validateIsEmptyAndRequired(input)) {
        output.isValid = false;
        output.errorMessage = isNullOrEmpty(output.requiredMessage) ? "Please enter an 11-digit account number" : output.requiredMessage;
    } else if (isNullOrEmpty(input.val)) {
        // empty string (but not required) state
    } else {
        var digits = getDigits(input.val);
        var acctNumPattern = /^[0-9\-]+$/;
        //output.isValid = acctNumPattern.test(input.val) && (digits.length === 10 || digits.length === 11);
        output.isValid = digits.length == 0 || digits.length == 10 || digits.length == 11;

        if (!output.isValid) {
            output.isValid = false;
            output.validFormatting = false;
            output.errorMessage = isNullOrEmpty(output.invalidMessage) ? "Please enter a valid 11-digit account number" : output.invalidMessage;
        } else {
            output.formatted = accountNumberFormat(input.val);

            if (!validateIsCompareToValid(input)) {
                output.isValid = false;
                output.errorMessage = isNullOrEmpty(output.compareToMessage) ? "The account numbers entered do not match" : output.compareToMessage;
            }
        }
    }
    console.log("output.isValid=" + output.isValid);
    console.log("output.formatted=" + output.formatted);
    return output;
}
// CURRENCY
function currencyFormat(val, options) {
    options = $.extend({ direction: "ltr", prefix: "", useCommas: false }, options);

    var formattedVal = val.replace(/[\$,\s]/g, "");
    var valAsNumber = Number(formattedVal);

    if (!isNaN(valAsNumber)) {
        var roundedVal = "";
        var decimalRounded = valAsNumber.toFixed(2);
        roundedVal = decimalRounded.toString();

        return roundedVal;
    }


    //var numberString = val.replace(/[\$,\s]/g, "");
    //var aDecimal = numberString.split(".");
    //var lstr = "";
    //var rstr = "";
    //if (aDecimal.length === 1 && !isNaN(Number(aDecimal[0]))) {
    //    // NO DECIMAL
    //    if (options.direction === "ltr") {
    //        lstr = aDecimal[0].toString();
    //        return Number(lstr).toString() + ".00";
    //    } else if (options.direction === "rtl") {
    //        rstr = aDecimal[0].toString();
    //        if (rstr.length > 2) {
    //            lstr = rstr.substr(0, rstr.length - 2);
    //            rstr = rstr.substr(rstr.length - 2, rstr.length - 1);
    //        }

    //    }
    //} else if (aDecimal.length === 2) {
    //    // HAS DECIMAL
    //    lstr = aDecimal[0].toString();
    //    rstr = aDecimal[1].toString();
    //    if (options.direction === "rtl" && rstr.length > 2) {
    //        // Shift left
    //        var shifted = rstr.substr(0, rstr.length - 2);
    //        lstr += shifted;
    //        rstr = rstr.substr(rstr.length - 2, rstr.length - 1);
    //    }
    //}

    //if ((!isNaN(Number(lstr))) && (!isNaN(Number(rstr)))) {
    //    lstr = Number(lstr).toString();
    //    if (rstr.length > 2) {
    //        // Round decimal if needed

    //        var rounded = Number(rstr.substr(0, 2) + "." + rstr.substr(2, 1))
    //        if (!isNaN(rounded)) {
    //            rounded = Math.round(rounded);
    //            rstr = rounded.toString();
    //        }
    //    }

    //    if (options.direction === "ltr") {
    //        // Right-pad zeroes if needed
    //        for (var i = rstr.length; i < 2; i++) {
    //            rstr += "0";
    //        }
    //    } else if (options.direction === "rtl") {
    //        // Left-pad zeroes if needed
    //        for (var i = rstr.length; i < 2; i++) {
    //            rstr = "0" + rstr;
    //        }
    //    }
    //    // Left pad leading zero if needed
    //    if (lstr.length <= 0) {
    //        lstr = "0";
    //    }

    //    if (options.useCommas) {
    //        return "99.99";
    //    }

    //    return lstr + "." + rstr;
    //}
    return val; // Returned if not a number
}

function currencyIsValid(input) {
    input = validateGetBaseInput(input);
    var output = validateGetBaseOutput(input);
    output.requiresFormatting = true;

    var inputCheck = validateBaseInputCheck(input);
    if (!inputCheck.isValid) { return inputCheck; }

    if (validateIsEmptyAndRequired(input)) {
        output.isValid = false;
        output.errorMessage = isNullOrEmpty(output.requiredMessage) ? "Please enter a dollar amount" : output.requiredMessage;
    } else if (isNullOrEmpty(input.val)) {
        // empty string (but not required) state
    } else {
        var numberString = currencyFormat(input.val);
        var currencyValNumber = Number(numberString);
        output.isValid = !isNaN(currencyValNumber);
        
        var minValue = Number(input.field.attr("data-min-value"));
        var maxValue = Number(input.field.attr("data-max-value"));
        if (!output.isValid) {
            //output.isValid = false;
            output.errorMessage = isNullOrEmpty(output.invalidMessage) ? "Please enter a valid dollar amount" : output.invalidMessage;
        } else if (!isNaN(minValue) && minValue > currencyValNumber) {
            output.formatted = numberString;
            output.isValid = false;
            output.errorMessage = "Invalid amount. (Minimum = $" + currencyFormat(minValue.toString(), { useCommas: true }) + ")";
        } else if (!isNaN(maxValue) && (maxValue != 0 && maxValue < currencyValNumber)) {
            output.formatted = numberString;
            output.isValid = false;
            output.errorMessage = "Invalid amount. (Maximum = $" + currencyFormat(maxValue.toString(), { useCommas: true }) + ")";
        } else {
            output.formatted = numberString;

            if (!validateIsCompareToValid(input)) {
                output.isValid = false;
                output.errorMessage = isNullOrEmpty(output.compareToMessage) ? "The values entered do not match" : output.compareToMessage;
            }
        }

        if (!output.isValid) {
            output.validFormatting = false;
        }
    }
    return output;
}


// DATE CHOOSER - requires date.js
function dateChooserIsValid(input) {
    // First validate date text (input should contain dateType)
    var output = dateTextIsValid(input);
    output.requiresFormatting = true;

    if (output.isValid) {
        var field = input.field;
        // Next validate date-chooser specific entries
        var dateVal = Date.parse(input.val);
        var compareDateOnly = (input.dateType === "date");
        if (dateVal !== null) {
            // Only validate date portion unless type==datetime
            if (compareDateOnly) { dateVal = dateVal.clearTime(); }

            // Get Disable options from date-chooser.js
            var disableOptions = getCalendarDisableOptions(field);
            // MIN DATE
            var minDate = disableOptions.minDate;
            var customMessage = "";
            if (minDate !== null) {
                if (compareDateOnly) { minDate = minDate.clearTime(); }
                if (minDate > dateVal) {
                    output.isValid = false;
                    customMessage  = field.attr("data-min-date-message");
                    output.errorMessage = !isNullOrEmpty(customMessage) ? customMessage : ("The date entered (" + dateVal.toString("M/d/yyyy") + ") is earlier than the earliest possible date (" + minDate.toString("M/d/yyyy") + ").");
                }
            }

            // MAX DATE
            var maxDate = disableOptions.maxDate;
            if (maxDate !== null) {
                if (compareDateOnly) { maxDate = maxDate.clearTime(); }
                if (dateVal > maxDate) {
                    output.isValid = false;
                    customMessage  = field.attr("data-max-date-message");
                    output.errorMessage = !isNullOrEmpty(customMessage) ? customMessage : ("The date entered (" + dateVal.toString("M/d/yyyy") + ") is later than the latest possible date (" + maxDate.toString("M/d/yyyy") + ").");
                }
            }

            // DISABLE HOLIDAYS
            var disableHolidays = disableOptions.disableHolidays;
            if (disableHolidays) {
                if (dateVal.isAEPObservedHoliday()) {
                    var holidayName =
                        output.isValid = false;
                    customMessage  = field.attr("data-disabled-holiday-message");
                    output.errorMessage = !isNullOrEmpty(customMessage) ? customMessage : ("The date entered (" + dateVal.toString("dddd, M/d/yyyy") + ") falls on a holiday (" + DateHelper.getAEPObservedHolidayName(dateVal) + "). Please select a non-holiday.");
                }
            }

            // DISABLE WEEKENDS
            var disableWeekends = disableOptions.disableWeekends;
            if (disableWeekends) {
                if (!dateVal.isWeekday()) {
                    output.isValid = false;
                    customMessage  = field.attr("data-disabled-weekend-message");
                    output.errorMessage = !isNullOrEmpty(customMessage) ? customMessage : ("The date entered (" + dateVal.toString("dddd, M/d/yyyy") + ") falls on a weekend. Please select a weekday.");
                }
            }

            // DISABLE OTHER DATES
            var disableOtherDates = disableOptions.disableOtherDates;
            if (disableOtherDates.length > 0) {
                for (var j = 0; j < disableOtherDates.length; j++) {
                    var disableDate = Date.parse(disableOtherDates[j]);
                    if (disableDate !== null) {
                        if (disableDate.getFullYear() === 9999) {
                            // Partial date - set invalid for all
                            disableDate = disableDate.set({ year: dateVal.getFullYear() });
                        }
                        if (disableDate !== null && disableDate.equals(dateVal)) {
                            output.isValid = false;
                            customMessage  = field.attr("data-other-date-message");
                            output.errorMessage = !isNullOrEmpty(customMessage) ? customMessage : ("The date entered (" + dateVal.toString("M/d/yyyy") + ") is not a valid selection. Please choose another date.");
                        }
                    }
                }
            }
        }

        if (!output.isValid) {
            output.validFormatting = false;
        }
    }
    return output;
}

// DATE TEXT - requires date.js
function dateTextIsValid(input) {
    input = validateGetBaseInput(input);
    var output = validateGetBaseOutput(input);
    output.requiresFormatting = true;

    var inputCheck = validateBaseInputCheck(input);
    if (!inputCheck.isValid) { return inputCheck; }
    if (validateIsEmptyAndRequired(input)) {
        output.isValid = false;
        output.errorMessage = isNullOrEmpty(output.requiredMessage) ? "Please enter a date" : output.requiredMessage;
    } else if (isNullOrEmpty(input.val)) {
        // empty string (but not required) state
    } else {
        var dateType = typeof (input.dateType) === "undefined" || input.dateType === null ? "date" : input.dateType;
        var date = Date.parse(input.val);
        output.isValid = date !== null;
        if (!output.isValid) {
            output.isValid = false;
            output.errorMessage = isNullOrEmpty(output.invalidMessage) ? "Please enter a valid date (mm/dd/yyyy)" : output.invalidMessage;
        } else {
            var isMidnight = date.equals(Date.parse(date.toString("M/d/yyyy")));
            output.formatted = date.toString(dateType === "datetime" || !isMidnight ? "M/d/yyyy h:mm tt" : "M/d/yyyy");

            if (!validateIsCompareToValid(input)) {
                output.isValid = false;
                output.errorMessage = isNullOrEmpty(output.compareToMessage) ? "The dates entered do not match" : output.compareToMessage;
            }
        }

        if (!output.isValid) {
            output.validFormatting = false;
        }
    }
    return output;
}

// EMAIL
function emailIsValid(input) {
    input = validateGetBaseInput(input);
    var output = validateGetBaseOutput(input);
    output.requiresFormatting = true;

    var inputCheck = validateBaseInputCheck(input);
    if (!inputCheck.isValid) { return inputCheck; }
    if (validateIsEmptyAndRequired(input)) {
        output.isValid = false;
        output.errorMessage = isNullOrEmpty(output.requiredMessage) ? "Please enter an email address" : output.requiredMessage;
    } else if (isNullOrEmpty(input.val)) {
        // empty string (but not required) state
    } else {
        output.isValid = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(input.val);
        if (!output.isValid) {
            output.isValid = false;
            output.errorMessage = isNullOrEmpty(output.invalidMessage) ? "Please enter a valid email address" : output.invalidMessage;
        } else if (validateMaxLength(input)) {
            output.isValid = false;
            var length = field.attr('maxlength');
            output.errorMessage = isNullOrEmpty(output.maxlengthMessage) ? "Please enter an email address that is no more than " + length + " characters" : output.maxlengthMessage;
        } else if (!validateIsCompareToValid(input)) {
            output.isValid = false;
            output.errorMessage = isNullOrEmpty(output.compareToMessage) ? "The email addresses entered do not match" : output.compareToMessage;
        } else if (input.validateCellular && !validateIsNotCellularDomain(input)) {
            output.isValid = false;
            output.errorMessage = "Please enter a valid, non-cellular email address";
        }

        if (!output.isValid) {
            output.validFormatting = false;
        }
    }

    return output;
}

// ESID
function esidIsValid(input) {
    input = validateGetBaseInput(input);
    var output = validateGetBaseOutput(input);
    output.requiresFormatting = true;

    var inputCheck = validateBaseInputCheck(input);
    if (!inputCheck.isValid) { return inputCheck; }

    //var inputContainsOnlyDigits = /^\d+$/.test(input.val);


    if (validateIsEmptyAndRequired(input)) {
        output.isValid = false;
        output.errorMessage = isNullOrEmpty(output.requiredMessage) ? "Please enter an ESID number" : output.requiredMessage;

    }
    else if (isNullOrEmpty(input.val)) {
        // empty string (but not required) state
    }
    //else if (!inputContainsOnlyDigits) {
    //    output.validFormatting = false;
    //    output.isValid = false;
    //    output.errorMessage = isNullOrEmpty(output.invalidMessage) ? "Please enter a valid 17-digit ESID" : output.invalidMessage;
    //}
    else {
        var digits = getDigits(input.val);
        var isValidLength = digits.length === 17;
        output.isValid = isValidLength;
        output.formatted = digits;

        if (!output.isValid) {
            output.validFormatting = false;
            output.isValid = false;
            output.errorMessage = isNullOrEmpty(output.invalidMessage) ? "Please enter a valid 17-digit ESID" : output.invalidMessage;
        }
    }
    return output;
}

// METER NUMBER
function meterNumberIsValid(input) {
    input = validateGetBaseInput(input);
    var output = validateGetBaseOutput(input);
    output.requiresFormatting = true;

    var inputCheck = validateBaseInputCheck(input);
    if (!inputCheck.isValid) { return inputCheck; }

    var inputContainsOnlyAlphanumeric = /^\w+$/.test(input.val);


    if (validateIsEmptyAndRequired(input)) {
        output.isValid = false;
        output.errorMessage = isNullOrEmpty(output.requiredMessage) ? "Please enter a meter number" : output.requiredMessage;

    }
    else if (isNullOrEmpty(input.val)) {
        // empty string (but not required) state
    }
    else if (!inputContainsOnlyAlphanumeric) {
        output.validFormatting = false;
        output.formatted = getAlphaNumeric(input.val);
        output.isValid = false;
        output.errorMessage = isNullOrEmpty(output.invalidMessage) ? "Please enter a valid meter number" : output.invalidMessage;
    }
    else {
        //** found valid 9 digit meter numbers, removing length validation

        //var inputLength = input.val.length;
        //var isValidLength = inputLength >= 12 && inputLength <= 17;

        //output.isValid = isValidLength;

        //// If input is invalid but has value, it get appropriate properties and error message. If it is valid, the value is formatted to look like an ssn. - CMA
        //if (!output.isValid) {
        //    output.validFormatting = false;
        //    output.isValid = false;
        //    output.errorMessage = isNullOrEmpty(output.invalidMessage) ? "Please enter a valid 12-17 character meter number" : output.invalidMessage;
        //}
    }
    return output;
}

// NUMBER
function numberFormat(val, options) {
    options = $.extend({ direction: "ltr", prefix: "", useCommas: false }, options);

    var numberString = val.replace(/[\$,\s]/g, "");
    return numberString; // Not in correct format
}
function numberIsValid(input) {
    input = validateGetBaseInput(input);
    var output = validateGetBaseOutput(input);
    output.requiresFormatting = true;

    var inputCheck = validateBaseInputCheck(input);
    if (!inputCheck.isValid) { return inputCheck; }
    if (validateIsEmptyAndRequired(input)) {
        output.isValid = false;
        output.errorMessage = isNullOrEmpty(output.requiredMessage) ? "Please enter a number" : output.requiredMessage;
    } else if (isNullOrEmpty(input.val)) {
        // empty string (but not required) state
    } else {
        var numberString = numberFormat(input.val);
        var number = Number(numberString);
        output.isValid = !isNaN(number);
        var minValue = Number(input.field.attr("data-min-value"));
        var maxValue = Number(input.field.attr("data-max-value"));
        if (!output.isValid) {
            output.isValid = false;
            output.errorMessage = isNullOrEmpty(output.invalidMessage) ? "Please enter a valid number" : output.invalidMessage;
        } else if (!isNaN(minValue) && minValue > number) {
            output.formatted = numberString;
            output.isValid = false;
            output.errorMessage = "Invalid number (minimum = " + numberFormat(minValue.toString(), { useCommas: false }) + ")";
        } else if (!isNaN(maxValue) && maxValue < number) {
            output.formatted = numberString;
            output.isValid = false;
            output.errorMessage = "Invalid amount (maximum = " + numberFormat(maxValue.toString(), { useCommas: false }) + ")";
        } else {
            output.formatted = numberString;

            if (!validateIsCompareToValid(input)) {
                output.isValid = false;
                output.errorMessage = isNullOrEmpty(output.compareToMessage) ? "The values entered do not match" : output.compareToMessage;
            }
        }

        if (!output.isValid) {
            output.validFormatting = false;
        }
    }
    return output;
}
// PASSWORD
function passwordIsValid(input) {

    input = validateGetBaseInput(input);
    var output = validateGetBaseOutput(input);
    output.requiresFormatting = true;

    var inputCheck = validateBaseInputCheck(input);
    if (!inputCheck.isValid) { return inputCheck; }
    if (validateIsEmptyAndRequired(input)) {
        output.isValid = false;
        output.errorMessage = isNullOrEmpty(output.requiredMessage) ? "Please enter your password" : output.requiredMessage;
        $("#divStrengthBar").attr("data-password-strength", "");
    } else if (isNullOrEmpty(input.val)) {
        if (input.compareTo === "") {
            $("#divStrengthBar").attr("data-password-strength", "");
        }
        // empty string (but not required) state
    } else if (input.validationType === "registration") {
        var isBlur = input.validationEvent === "blur";
        //var isKeyUp = input.validationEvent === "keyup";
        var isSubmit = input.validationEvent === "submit";
        var minChars = 8;
        var maxChars = 255;
        var strengthMessage = "";
        input.val = ReplaceWordFormattedChars(input.val);

        var evalPwd = input.val.replace(new RegExp(/(.)(?=\1\1)/g), "");

        if (input.compareTo === "") {
              
            //if (!isKeyUp && input.val.length < minChars ) {
            if (input.val.length < minChars ) {
                output.isValid = false;
                output.errorMessage = "Passwords must have at least " + minChars + " characters; you entered " + input.val.length + ".";
                $("#divStrengthBar").attr("data-password-strength", "1");
              //  strengthMessage = "Must be at least 8 characters";
            } else if ( input.val.length >= minChars &&  evalPwd.length < minChars )  {
                output.isValid = false;
                output.errorMessage = "Passwords must have at least " + minChars + " characters; you entered " + evalPwd.length + ". Characters repeated more than 2 consecutive times count as 2 toward the minimum requirements.";
                $("#divStrengthBar").attr("data-password-strength", "1");
               // strengthMessage = "Add more characters";
            }
            else if (input.val.length > maxChars) {
                output.isValid = false;
                output.errorMessage = "Passwords must be between " + minChars + "-" + maxChars + " characters; you entered " + input.val.length  +".";
            } else {
                $(input.field).parent().find("span.validator").hide();
               // output.isValid = /^[a-zA-Z0-9!"#%&'\(\)\$\*\+,-\.\/:;<=>\?@\[\]\\\^_`\{\}\|~\s+]+$/i.test(input.val);
                output.isValid = /^[a-zA-Z0-9!"#%&'\(\)\$\*\+,-\.\/:;<=>\?@\\_`\{\}\|~\s+]+$/i.test(input.val);
                if (/^\s/.test(input.val)) {
                    output.isValid = false;
                    output.errorMessage = "Passwords cannot begin with a space.";
               //     strengthMessage ="Can’t begin or end with a space";
                //} else if (!isKeyUp && /\s$/.test(input.val)) {
                } else if (/\s$/.test(input.val)) {
                    output.isValid = false;
                    output.errorMessage = "Passwords cannot end with a space.";
                //    strengthMessage = "Can’t begin or end with a space";
                }
                else if (!output.isValid) {
                    output.isValid = false;
                    // output.errorMessage = "Passwords may only consist of letters, numbers, or the special characters !\"#$%&'()*+,-./:;<=>?@[\]^_`{|}~";
                    output.errorMessage = "Passwords may only consist of letters, numbers, or the special characters !\"#$%&'()*+,-./:;<=>?@\_`{|}~";
                 //   strengthMessage = "Contains unusable characters";
                } else if (/[^\S]{2,}/.test(input.val)) {
                    output.isValid = false;
                    output.errorMessage = "Multiple consecutive spaces are not allowed in a password.";
                    //  strengthMessage = "Consecutive spaces now allowed";
                } else if (input.val.length >= minChars && pwdBlackListObj.indexOf(input.val.toLowerCase()) > 0) {
                    output.isValid = false;
                    output.errorMessage = "This password is too common. Please use more characters, phrases, or numbers.";
                //    strengthMessage = "Sorry, password not allowed";
                }
            } 
             

            if (input.val.length >= minChars && output.isValid) {
                var result = zxcvbn(evalPwd, pwdBlackListObj);
                var pwdStrength = 2; 
                    if (result.guesses_log10 > 6 && result.guesses_log10 <= 9)
                        pwdStrength = 3;
                    else if (result.guesses_log10 > 9)
                        pwdStrength = 4;
                 
                    $("#divStrengthBar").attr("data-password-strength", pwdStrength);
                    $("#hdnPasswordStrength").val(pwdStrength);
            } 
            else if (input.val.length < minChars && output.isValid) {
                $("#divStrengthBar").attr("data-password-strength", "1");
                $("#divStrength").attr("data-strength-message", "Passwords must have at least " + minChars + " characters"); 
            }
            else  {
          
                $("#divStrengthBar").attr("data-password-strength", "-1");
            }

        } else {
            //if (!isKeyUp && !validateIsCompareToValid(input, false)) {
            if (!validateIsCompareToValid(input, false)) {
                output.isValid = false;
                output.errorMessage = isNullOrEmpty(output.compareToMessage) ? "The passwords entered do not match" : output.compareToMessage;
            }
        }
        
        // Override error message if specified
        //output.errorMessage = isNullOrEmpty(output.invalidMessage) ? "Please enter a valid password" : output.invalidMessage;

        if (!output.isValid) {
            output.validFormatting = false;
        }
    } else if (!validateIsCompareToValid(input, false)) {
        output.isValid = false;
        output.errorMessage = isNullOrEmpty(output.compareToMessage) ? "The passwords entered do not match" : output.compareToMessage;

        if (!output.isValid) {
            output.validFormatting = false;
        }
    }
    return output;
}



 function ReplaceWordFormattedChars(text) { 

    // smart single quotes and apostrophe
    text = text.replace(/[\u2018\u2019\u201A]/g, "\'");
    // smart double quotes
    text = text.replace(/[\u201C\u201D\u201E]/g, "\"");
    // ellipsis
    text = text.replace(/\u2026/g, "...");
    // dashes
    text = text.replace(/[\u2013\u2014]/g, "-");
    // circumflex
    text = text.replace(/\u02C6/g, "^");
    // open angle bracket
    text = text.replace(/\u2039/g, "<");
    // close angle bracket
    text = text.replace(/\u203A/g, ">");
    // spaces
    text = text.replace(/[\u02DC\u00A0]/g, " "); 

    return text;
}

function testpwdRegex(input) {

    var tempIp = input;
    var tempOp = tempIp.replace(new RegExp(/[^\w\s]|(.)(?=\1\1\1)/gi), "");
    return tempOp;

}
// PHONE NUMBER
function phoneNumberFormat(val) {
    // Format phone # to xxx-xxx-xxxx
    var digits = getDigits(val);
    if (digits.length === 10) {
        return digits.substr(0, 3) + "-" + digits.substr(3, 3) + "-" + digits.substr(6, 4);
    } else if (digits.length === 11 && digits.substr(0, 1) === "1") {
        // If 11 digits specified and leading '1' provided, remove and use remaining 10
        return digits.substr(1, 3) + "-" + digits.substr(4, 3) + "-" + digits.substr(7, 4);
    }
    return val;
}
function phoneNumberIsValid(input) {
    input = validateGetBaseInput(input);
    var output = validateGetBaseOutput(input);
    output.requiresFormatting = true;

    var inputCheck = validateBaseInputCheck(input);
    if (!inputCheck.isValid) { return inputCheck; }
    if (validateIsEmptyAndRequired(input)) {
        output.isValid = false;
        output.errorMessage = isNullOrEmpty(output.requiredMessage) ? "Please enter a phone number" : output.requiredMessage;
    } else if (isNullOrEmpty(input.val)) {
        // empty string (but not required) state
        if (!validateIsCompareToValid(input)) {
            output.isValid = false;
            output.errorMessage = isNullOrEmpty(output.compareToMessage) ? "The phone numbers entered do not match" : output.compareToMessage;
        }
    } else {
        var digits = getDigits(input.val);
        // If 11 digits specified and leading '1' provided, remove and use remaining 10
        if (digits.length === 11 && digits.substr(0, 1) === "1") { digits = digits.substr(1, 10); }

        var isValidLength = digits.length === 10;
        var containsInvalidRepeats = false;
        if (digits.length > 0) {

            // Make sure phone is not all one character, e.g. 999-999-9999
            if (digits === "".padLeft(digits[0], 10)) { containsInvalidRepeats = true; }


            // Make sure area code and exchange are not all zeroes (e.g. 000-716-1000 or 614-000-1000)
            if (digits.Length === 10) {
                // Area code 000
                if (digits.substr(0, 3) === "000") { containsInvalidRepeats = true; }
                // Exchange 000  
                if (digits.substr(3, 3) === "000") { containsInvalidRepeats = true; }
            }
        }

        //if (input.validationEvent === "keyup") {
        //    output.isValid = (digits.length <= 10) && !containsInvalidRepeats;
        //} else {
            output.isValid = isValidLength && !containsInvalidRepeats;
        //}

        if (!output.isValid) {
            output.isValid = false;
            output.errorMessage = isNullOrEmpty(output.invalidMessage) ? "Please enter a valid 10-digit phone number" : output.invalidMessage;
        } else {
            output.formatted = phoneNumberFormat(input.val);

            if (!validateIsCompareToValid(input)) {
                output.isValid = false;
                output.errorMessage = isNullOrEmpty(output.compareToMessage) ? "The phone numbers entered do not match" : output.compareToMessage;
            }
        }

        if (!output.isValid) {
            output.validFormatting = false;
        }
    }
    return output;
}

function socialSecurityNumberFormat(val) {
    var digits = getDigits(val);
    if (digits.length === 9) {
        return digits.substr(0, 3) + "-" + digits.substr(3, 2) + "-" + digits.substr(5, 4);
    }
    return val;
}

function socialSecurityNumberIsValid(input) {
    input = validateGetBaseInput(input);
    var output = validateGetBaseOutput(input);
    output.requiresFormatting = true;

    var inputCheck = validateBaseInputCheck(input);
    if (!inputCheck.isValid) { return inputCheck; }


    if (validateIsEmptyAndRequired(input)) {
        output.isValid = false;
        output.errorMessage = isNullOrEmpty(output.requiredMessage) ? "Please enter a social security number" : output.requiredMessage;

    }
    else if (isNullOrEmpty(input.val)) {
        // empty string (but not required) state
    }
    else {
        var digits = getDigits(input.val);

        var isValidLength = digits.length === 9;
        var containsInvalidRepeats = false;

        output.isValid = isValidLength && !containsInvalidRepeats;

        if (!output.isValid) {
            output.validFormatting = false;
            output.isValid = false;
            output.errorMessage = isNullOrEmpty(output.invalidMessage) ? "Please enter a 9-digit social security number" : output.invalidMessage;
        } else {
            output.formatted = socialSecurityNumberFormat(input.val);
        }
    }
    return output;
}

// REGEX
function regexIsValid(input) {
    input = validateGetBaseInput(input);
    var output = validateGetBaseOutput(input);
    output.requiresFormatting = true;

    var inputCheck = validateBaseInputCheck(input);
    if (!inputCheck.isValid) { return inputCheck; }
    if (validateIsEmptyAndRequired(input)) {
        output.isValid = false;
        output.errorMessage = isNullOrEmpty(output.requiredMessage) ? "Please enter a value" : output.requiredMessage;
    } else if (isNullOrEmpty(input.val)) {
        // empty string (but not required) state
    } else {
        var pattern = input.field.attr("data-regex-pattern") ? input.field.attr("data-regex-pattern") : "";
        var flags = ""; // g,i
        var regex = new RegExp(pattern, flags);

        output.isValid = regex.test(input.val);

        if (!output.isValid) {
            output.errorMessage = isNullOrEmpty(output.invalidMessage) ? "Input invalid" : output.invalidMessage;
        } else if (!validateIsCompareToValid(input)) {
            output.isValid = false;
            output.errorMessage = isNullOrEmpty(output.compareToMessage) ? "The values entered do not match" : output.compareToMessage;
        }

        if (!output.isValid) {
            output.validFormatting = false;
        }
    }
    return output;
}
// USERID 
function userIDIsValid(input) {
    input = validateGetBaseInput(input);

    var output = validateGetBaseOutput(input);
    output.requiresFormatting = true;

    var inputCheck = validateBaseInputCheck(input);

    if (!inputCheck.isValid) { return inputCheck; }

    if (validateIsEmptyAndRequired(input)) {
        output.isValid = false;
        output.errorMessage = isNullOrEmpty(output.requiredMessage) ? "Please enter your User ID" : output.requiredMessage;
    } else if (isNullOrEmpty(input.val)) {
        // empty string (but not required) state
    } else if (input.validationType === "registration") {
        var isBlur = input.validationEvent === "blur";
        //var isKeyUp = input.validationEvent === "keyup";
        var isSubmit = input.validationEvent === "submit";
        var minChars = 6;
        var maxChars = 120;
        //if (!isKeyUp && input.val.length < minChars) {
        if (input.val.length < minChars) {
            output.isValid = false;
            output.errorMessage = "Your ID must be at least " + minChars + " alphanumeric or special characters.";
        } else if (input.val.length > maxChars) {
            output.isValid = false;
            output.errorMessage = "Your ID must be less than or equal to " + maxChars + " alphanumeric or special characters.";
        } else {
            output.isValid = /^[a-z0-9`!_@#$%*+=.]+$/i.test(input.val);
            if (!output.isValid) {
                output.errorMessage = "The user id contains invalid characters. A user id must consist of only letters, numbers, or the special characters ` ! _ @ # $ % * + = .";
            //} else if (!isKeyUp && !validateIsCompareToValid(input, false)) {
            } else if (!validateIsCompareToValid(input, false)) {
                output.isValid = false;
                output.errorMessage = isNullOrEmpty(output.compareToMessage) ? "The user ids entered do not match" : output.compareToMessage;
            }
        }
        // Override error message if specified
        //output.errorMessage = isNullOrEmpty(output.invalidMessage) ? "Please enter a valid user id" : output.invalidMessage;

        if (!output.isValid) {
            output.validFormatting = false;
        }
    } else if (!validateIsCompareToValid(input, false)) {
        output.isValid = false;
        output.errorMessage = isNullOrEmpty(output.compareToMessage) ? "The user ids entered do not match" : output.compareToMessage;

        if (!output.isValid) {
            output.validFormatting = false;
        }
    }

    if (input.validationEvent === "blur") {
        // Format output onblur
        if (input.field.val() !== $.trim(input.field.val())) {
            output.formatted = $.trim(input.field.val());
        }
    }
    return output;
}

// ZIP CODE
function zipCodeFormat(val) {
    // Format zip to 12345-6789 if it is ZIP+4
    var digits = getDigits(val);
    if (digits.length === 9) {
        return digits.substr(0, 5) + "-" + digits.substr(5, 4);
    }
    return val;
}
function zipCodeIsValid(input) {
    input = validateGetBaseInput(input);
    var output = validateGetBaseOutput(input);
    output.requiresFormatting = true;

    var inputCheck = validateBaseInputCheck(input);
    if (!inputCheck.isValid) { return inputCheck; }
    if (validateIsEmptyAndRequired(input)) {
        output.isValid = false;
        output.errorMessage = isNullOrEmpty(output.requiredMessage) ? "Please enter a ZIP code" : output.requiredMessage;
    } else if (isNullOrEmpty(input.val)) {
        // empty string (but not required) state
    } else {
        var digits = getDigits(input.val);
        output.isValid = (digits.length === 5) || (digits.length === 9);
        if (!output.isValid) {
            output.isValid = false;
            output.errorMessage = isNullOrEmpty(output.invalidMessage) ? "Please enter a 5 or 9-digit ZIP code" : output.invalidMessage;
        } else {
            output.formatted = zipCodeFormat(input.val);
            if (!validateIsCompareToValid(input)) {
                output.isValid = false;
                output.errorMessage = isNullOrEmpty(output.compareToMessage) ? "The ZIP codes entered do not match" : output.compareToMessage;
            }
        }

        if (!output.isValid) {
            output.validFormatting = false;
        }
    }
    return output;
}

var CURRENCY_DISABLE_FORMAT = false;

//==================================================
// JQUERY VALIDATE CLOSURE
//==================================================
(function ($) {
    // plugin definition
    $.fn.formatField = function (input) {
        input = $.extend({ "eventObject": null }, input);

        // iterate and reformat each matched element
        return this.each(function () {
            var $el = $(this);
            var type = $el.attr('data-field-type');
            var val = $el.val();
            if (typeof (type) !== "undefined") {
                type = type.toLowerCase();
            }

            if (type === "currency") {
                var useAlternateFormatting = VAL.isDeviceCurrencyTypeNumber();
                useAlternateFormatting = false; // iOs switch to number
                if (useAlternateFormatting) {
                    // ONKEYUP: FORMAT RIGHT TO LEFT
                    var currencyRTL = val;
                    var keyCode = (input.eventObject !== null && input.eventObject.keyCode !== null) ? input.eventObject.keyCode : null;
                    var isDelete = (keyCode === 8 || keyCode === 46);
                    var isDecimal = (keyCode === 110);

                    if (isDecimal) {
                        // Remove extra decimals
                        currencyRTL = Number(val.replace(/\./g, "")) + ".";
                        $el.val(currencyRTL);
                    }

                    // Determine if we need to reformat
                    var aDecimal = val.split(".");
                    var isDecimalIncomplete = ((aDecimal.length === 2) && (aDecimal[1].length === 1));
                    var CURRENCY_DISABLE_FORMAT = isDecimalIncomplete || isDelete || isDecimal;
                    if (!CURRENCY_DISABLE_FORMAT) {
                        currencyRTL = currencyFormat(val, { direction: "rtl" });
                        $el.val(currencyRTL);
                    }
                } else {
                    // LEFT TO RIGHT NOT VALIDATED ONKEYUP
                    //var currencyLTR = currencyFormat(val);
                    //$el.val(currencyLTR);
                }

            }
        });
    };



    // VALIDATE
    $.fn.validate = function (input) {
        var numberInvalid = 0;
        var invalid = Array();
        var formFields = $(this);

        formFields.each(function () {
            var result = $(this).validateSingleField(input);

            if (!result.isValid) {
                numberInvalid++;
                invalid.push(result);
            }
        });

        return numberInvalid === 0;
    }




    $.fn.validateSingleField = function (input) {
        var field = $(this);

        input = validateGetBaseInput(input, field);
        var output = validateGetBaseOutput(input);

        var type = "";
        if (typeof (input.type) !== "undefined") {
            // Use input type if specified
            type = input.type;
        } else if (field.attr("data-field-type")) {
            // Use data attribute if specified
            type = field.attr("data-field-type");
        }
        var isFieldDefined = field.length > 0;
        var isFieldEnabled = isFieldDefined ? (field.is(":enabled")) : false;

        if (type === "radio-button-list" || type === "checkbox-list") {
            isFieldEnabled = field.find("input:enabled").length > 0;
        }

        var causesValidation = field.attr("data-causes-validation") ? (field.attr("data-causes-validation").toLowerCase() !== "false") : true;


        if (isFieldDefined && isFieldEnabled && causesValidation) {
            var fieldID = field.attr("id");
            var val;
            var isRequired = field.attr('data-required') ? field.attr('data-required').toLowerCase() === "true" : false;

            if (type === "password") {
                val = field.val();
            } else {
                val = $.trim(field.val());
            }
            var $checked;
            if (type === "radio-button-list") {
                $checked = field.find("input:checked");
                val = $checked.length > 0 ? $checked.val() : "";
            } else if (type === "checkbox-list") {
                $checked = field.find("input:checked");
                val = "";
                $checked.each(function () {
                    var checkedVal = $(this).val();
                    if (val.length > 0) { val += ","; }
                    val += checkedVal;
                });
            }

            input.field = field;
            input.val = val;
            input.isRequired = isRequired;



            if (input.validationEvent === "keyup") {
                var keyCode = (input.eventObject !== null && input.eventObject.keyCode !== null) ? input.eventObject.keyCode : null;
                // Don't validate keyup on enter (let form submit process instead)
                if (keyCode === 13) {
                    return output;
                }
            }

            // Get output again now that input is defined
            output = validateGetBaseOutput(input);

            //------------------------------
            // SPECIFIC TYPE CASES
            //------------------------------
            if (validateIsEmptyAndNotRequired(input)) {
                output.isValid = true;
            } else {
                if (type === "account-number") {
                    // ACCOUNT NUMBER
                    output = accountNumberIsValid(input);
                    if (!isNullOrEmpty(output.formatted)) { field.val(output.formatted); } // update formatting
                } else if (type === "checkbox") {
                    output.isValid = (input.validationEvent !== "submit") ? true : !(input.isRequired && !input.field[0].checked);
                    output.errorMessage = isNullOrEmpty(output.requiredMessage) ? "This field is required." : output.requiredMessage;
                } else if (type === "currency") {
                    // CURRENCY
                    output = currencyIsValid(input);
                    if (!isNullOrEmpty(output.formatted)) { field.val(output.formatted); } // update formatting
                } else if (type === "date-chooser") {
                    // DATE-CHOOSER
                    // First validate actual date text
                    var dateType = "date";
                    if (field.attr("data-date-type")) { dateType = field.attr("data-date-type"); }
                    output = dateChooserIsValid($.extend({ dateType: dateType }, input));
                    // Close calendars if invalid
                    //if(!result.isValid) { calendarClose(); }

                    if (!isNullOrEmpty(output.formatted)) { field.val(output.formatted); } // update formatting

                } else if (type === "date-text") {
                    // DATE-TEXT
                    var dateType = "date";
                    if (field.attr("data-date-type")) { dateType = field.attr("data-date-type"); }
                    output = dateTextIsValid($.extend({ dateType: dateType }, input));
                    if (!isNullOrEmpty(output.formatted)) { field.val(output.formatted); } // update formatting
                } else if (type === "email") {
                    // EMAIL 
                    var validateCellular = false;
                    if (field.attr("data-validate-cellular")) { validateCellular = field.attr("data-validate-cellular") === "true"; }
                    output = emailIsValid($.extend({ validateCellular: validateCellular }, input));
                } else if (type === "esid") {
                    output = esidIsValid(input);
                    if (!isNullOrEmpty(output.formatted)) { field.val(output.formatted); }
                } else if (type === "meter-number") {
                    output = meterNumberIsValid(input);
                    if (!isNullOrEmpty(output.formatted)) { field.val(output.formatted); }
                } else if (type === "number") {
                    // NUMBER
                    output = numberIsValid(input);
                    if (!isNullOrEmpty(output.formatted)) { field.val(output.formatted); } // update formatting
                } else if (type === "password") {
                    // PASSWORD
                    var validationType = "";
                    if (field.attr("data-validation-type")) { validationType = field.attr("data-validation-type"); }
                    output = passwordIsValid($.extend({ validationType: validationType }, input));
                } else if (type === "phone-number") {
                    // PHONE NUMBER
                    output = phoneNumberIsValid(input);
                    if (!isNullOrEmpty(output.formatted)) { field.val(output.formatted); } // update formatting
                } else if (type === "ssn") {
                    // SOCIAL SECURITY NUMBER
                    output = socialSecurityNumberIsValid(input);
                    if (!isNullOrEmpty(output.formatted)) { field.val(output.formatted); } // update formatting
                } else if (type === "user-id") {
                    // USER ID
                    var validationType = "";
                    if (field.attr("data-validation-type")) { validationType = field.attr("data-validation-type"); }
                    output = userIDIsValid($.extend({ validationType: validationType }, input));
                    if (!isNullOrEmpty(output.formatted)) { field.val(output.formatted); } // update formatting
                } else if (type === "zip") {
                    // ZIP CODE
                    output = zipCodeIsValid(input);
                    if (!isNullOrEmpty(output.formatted)) { field.val(output.formatted); } // update formatting
                } else {
                    // GENERIC TEXTBOX

                    // Required check
                    var fieldID = (input === null || input.field === null) ? "null" : input.field.attr("id");
                    if (validateIsEmptyAndRequired(input)) {
                        output.isValid = false;
                        var typeIsTextarea = input.field.is('textarea');
                        var verb = (type === "dropdown") ? "select" : "enter";
                        var requiredMessage = typeIsTextarea ? "This information is required." : "Please " + verb + " a value";
                        output.errorMessage = isNullOrEmpty(output.requiredMessage) ? requiredMessage : output.requiredMessage;
                    } else if (validateMaxLength(input)) {
                        output.isValid = false;
                        var length = field.attr('maxlength');
                        var diff = input.val.length - length;
                        output.errorMessage = isNullOrEmpty(output.maxlengthMessage) ? length + "character limit exceeded by " + diff + "characters." : output.maxlengthMessage;
                    } else if (!validateIsCompareToValid(input)) {
                        output.isValid = false;
                        output.errorMessage = isNullOrEmpty(output.compareToMessage) ? "The values entered do not match" : output.compareToMessage;
                    }
                }
            }

            // ADDITIONAL REGEX HANDLING
            if (typeof (input.field.attr("data-regex-pattern")) !== "undefined") {
                if (output.isValid) {
                    output = regexIsValid(input);
                }
            }


            // Validator handling
            var validator = field.getValidator({ validator: input.validator });

            // EXTRA (CUSTOM) validation
            //if(output.isValid && input.extraValidation !== null) {
            var extraValidationFunctionName = field.attr("data-extra-validation") === "undefined" ? null : field.attr("data-extra-validation");
            if (output.isValid && extraValidationFunctionName !== null) {
                var args = {
                    field: field,
                    value: input.val,
                    validator: validator,
                    validationEvent: input.validationEvent,
                    errorMessage: "",
                    isValid: true
                };

                // Call custom function
                if (typeof (window[extraValidationFunctionName]) !== "undefined") {
                    window[extraValidationFunctionName].apply({}, [args]);
                    if (typeof (args.isValid) === "string") {
                        args.isValid = (args.isValid === "true");
                    }
                }
                output.isValid = args.isValid;
                // Set output validity based on result
                if (!output.isValid) {
                    output.errorMessage = args.errorMessage;
                }
            }


            if (!output.isValid) {
                // Invalid
                validator.setInvalid(output, input);

            } else {
                // Valid

                // Don't set valid if the onblur event triggered the validation 
                // when the user was clicking the submit button.
                // The redraw can cause the submit button to change position which
                // prevents the mouseup event from firing and subsequently prevents form.submit
                var anySubmitButtonsClicked = false;
                if (input.validationEvent === "blur") {
                    var $submitButtons = $("input[type='submit']");

                    $submitButtons.each(function () {
                        if ($(this).data("mouse-down")) {
                            anySubmitButtonsClicked = true;
                        }
                    });
                }

                if (!anySubmitButtonsClicked) {
                    validator.setValid(output, input);
                }
            }
        }

        return output;
    }

    $.fn.getValidator = function (args) {
        var $field = $(this);
        var validatorArgs = $.extend({ validator: null }, args);
        if (validatorArgs.validator !== null) {
            // return the input validator
            return validatorArgs.validator;
        }
        if ($field.length > 0) {
            // return the validator based on input id
            return $(".validator[data-validate-field='" + $field.attr("id") + "']").first();
        }
        return null;
    }

    $.fn.validateCustomValidators = function () {
        $(this).each(function () {
            var $validator = $(this);
            $validator.validateSingleCustomValidator();
        });
    }

    $.fn.validateSingleCustomValidator = function (args) {
        var output = { isValid: true, errorMessage: "" };
        var $validator = $(this);

        var extraValidationFunctionName = ($validator.length === 0) ? null : $validator.attr("data-extra-validation");
        if (extraValidationFunctionName) {
            args = $.extend({ isValid: true, errorMessage: "Invalid", value: "", validationEvent: "" }, args);
            var defaultErrorMessage = $validator.attr("data-invalid-message")
            if (defaultErrorMessage) { args.errorMessage = defaultErrorMessage; }

            var customArgs = {
                field: null,
                value: args.value,
                validator: $validator,
                validationEvent: args.validationEvent,
                errorMessage: args.errorMessage,
                isValid: true
            };

            // Call custom function
            if (typeof (window[extraValidationFunctionName]) !== "undefined") {
                window[extraValidationFunctionName].apply({}, [customArgs]);
                if (typeof (customArgs.isValid) === "string") {
                    customArgs.isValid = (customArgs.isValid === "true");
                }
            }

            var output = { isValid: customArgs.isValid, errorMessage: customArgs.errorMessage }

            // Set output validity based on result
            if (!output.isValid) {
                // Invalid
                $validator.setInvalid(output, null);
            } else {
                // Valid
                $validator.setValid(output, null);
            }

        }
        return output;
    }

    $.fn.setInvalid = function (args, input) {
        var $validator = $(this);
        var $input = !!input ? input.field : null;
        var fieldType = $input ? $input.data("fieldType") : null;
        var eventIsKeyup = !!input && input.validationEvent === 'keyup';
        var eventIsNotKeyup = !input || (!!input && (!eventIsKeyup));
        var canValidateOnKeyup = !!input && (eventIsKeyup) && input.field.hasClass('has-value') && (input.field.hasClass('is-valid') || input.field.hasClass('is-invalid'));
        var inputsNotValidatedOnKeyup = getInputsWithSpecialHandlingOnKeyup();
        var noValidationOnKeyup = inputsNotValidatedOnKeyup.lastIndexOf(fieldType) > -1;

        // if input is included in array of inputs that are formatted, but should not validate on keyup, return and do nothing - CMA
        if (noValidationOnKeyup && eventIsKeyup) {
            return;
        }

        if (eventIsNotKeyup && !!$input && !!$input.val()) {
            $input.addClass("has-value");
        }

        if (eventIsNotKeyup && !!$input &&  !$input.val()) {
            $input.removeClass("has-value");
        }

        if (eventIsNotKeyup || canValidateOnKeyup) {
            if (!!input) {
                resetInputGroup($input);

                $formFieldHelper = $input.closest('.form-group').find('.form-field-helper');
                if ($formFieldHelper.length > 0) {
                    $formFieldHelper.hide();
                }

                $input.addClass('is-invalid');
                $input.attr("aria-invalid", "true");

                // Special handling for single checkbox, since backend builds it differently from checkbox list and hidden input is targeted - CMA
                var inputTypeIsCheckbox = $input.attr("type") === "checkbox";
                if (inputTypeIsCheckbox) {
                    $input.closest(".checkbox").addClass('is-invalid');
                }
            }

            if ($validator.length > 0) {
                $input.attr("aria-describedby", $validator.attr("id"));

                var validatorArgs = $.extend({ errorMessage: "" }, args);
                $validator.html(validatorArgs.errorMessage);
                $validator.show();
                if ($validator.css("visibility") !== null) {
                    $validator.css('visibility', 'visible');
                }
            }
        }
    }
    $.fn.setValid = function (args, input) {
        var $validator = $(this);
        var $input = input ? input.field : null;
        var inputExists = !!$input;
        var validValue = args.requiresFormatting && !!$input && !!$input.val();

        if (inputExists) {
            resetInputGroup($input);
        }

        if (inputExists && !!$input.val()) {
            $input.addClass('has-value');
        }

        if (inputExists &&  !$input.val()) {
            $input.removeClass('has-value');
        }

        if (validValue) {
            $input.addClass('is-valid');
            $input.removeAttr("aria-describedby");
            $input.attr("aria-invalid", "false");
        }
        if ($validator.length > 0) {
            $validator.hide();
            if ($validator.css("visibility") !== null) {
                $validator.css('visibility', 'hidden');
            }
        }
    }

    function resetInputGroup($input) {
        $formFieldHelper = $input.closest('.form-group').find('.form-field-helper');

        $input.removeClass('is-invalid');
        $input.removeClass('is-valid');

        // Special handling for single checkbox, since backend builds it differently from checkbox list and hidden input is targeted - CMA
        var inputTypeIsCheckbox = $input.attr("type") === "checkbox";
        if (inputTypeIsCheckbox) {
            $input.closest(".checkbox").removeClass('is-invalid');
        }

        $formFieldHelper.show();
    }

    // NOTE: any other inputs that do not validate on keyup, but have formatting, should be added to this returned array - CMA
    function getInputsWithSpecialHandlingOnKeyup() {
        return [
            "zip"
        ];
    }

    // end of closure
})(jQuery);

;
// IE detection
var ua = window.navigator.userAgent;
var isIE = /MSIE|Trident/.test(ua);

//==================================================
// APP (Application) NAMESPACE DEFINITION
//==================================================
var APP = {

    globalLoginFormToggle: function(visible) {
        if (visible) {
            if ($("#mobileNavToggle").hasClass("collapsed") === false) {
                $("#mobileNav").removeClass("show");
                $("#mobileNavToggle").addClass("collapsed");
                $("#mobileNavToggle").attr("aria-expanded", "false");
            }
           
            $("a[data-btn='login'], button[data-btn='login']").addClass("login-expanded");
            $("#loginOverlay").addClass("login-visible");

            var $uid = $("#globalLoginMenu").find("input[id*='TbUserID']");
            if ($uid.length > 0) { $uid.select(); }
            var formHeight = $("#globalLoginMenu").get(0).scrollHeight;

        } else {
            $("a[data-btn='login'], button[data-btn='login']").removeClass("login-expanded");
            $("#loginOverlay").removeClass("login-visible");

            if ($(".btn-global-login").hasClass("collapsed") === false) {
                $("#globalLoginMenu").removeClass("show");
                $(".btn-global-login").addClass("collapsed");
                $(".btn-global-login").attr("aria-expanded", "false");
            }
            
        }
    },
    //--------------------------------------------------
    // cookieDelete (requires js-cookie)
    //--------------------------------------------------
    cookieDelete: function (key) {
        //$.removeCookie('Modal.Paperless.QuestionAsked');
        Cookies.remove(key, { path: '/' });
    },
    //--------------------------------------------------
    // cookieGet (requires js-cookie)
    //--------------------------------------------------
    cookieGet: function (key) {
        return Cookies.get(key);
    },
    //--------------------------------------------------
    // cookieSetPersistent (requires js-cookie)
    //--------------------------------------------------
    cookieSetPersistent: function (key, value, days) {
        Cookies.set(key, value, { expires: days, path: '/' });
    },
    //--------------------------------------------------
    // cookieSetSession (requires js-cookie)
    //--------------------------------------------------
    cookieSetSession: function (key, value) {
        Cookies.set(key, value, { path: '/' });
    },
    //--------------------------------------------------
    // getQueryString
    //--------------------------------------------------
    getDigits: function (s) {
        if (s === null || typeof (s) !== "string") { return ""; }
        var pat = /\d+/g
        return pat.test(s) ? s.match(pat).join("") : "";
    },
    //--------------------------------------------------
    // getQueryString
    //--------------------------------------------------
    getQueryString: function () {
        var result = {}, queryString = location.search.substring(1),
            re = /([^&=]+)=([^&]*)/g, m;
        while (m = re.exec(queryString)) {
            result[decodeURIComponent(m[1])] = decodeURIComponent(m[2]);
        }
        return result;
    },

    //--------------------------------------------------
    // isDeviceiPad
    //--------------------------------------------------
    isDeviceiPad: function () { return /(iPad)/g.test(typeof (navigator) === "undefined" ? "" : navigator.userAgent); },
    //--------------------------------------------------
    // isDeviceiPhone
    //--------------------------------------------------
    isDeviceiPhone: function () { return /(iPhone)/g.test(typeof (navigator) === "undefined" ? "" : navigator.userAgent); },
    //--------------------------------------------------
    // isDeviceiPod
    //--------------------------------------------------
    isDeviceiPod: function () { return /(iPod)/g.test(typeof (navigator) === "undefined" ? "" : navigator.userAgent); },
    //--------------------------------------------------
    // isDeviceiOS
    //--------------------------------------------------
    isDeviceiOS: function () { return /(iPad|iPhone|iPod)/g.test(typeof (navigator) === "undefined" ? "" : navigator.userAgent); },
    //--------------------------------------------------
    // isPhone (derived from http://detectmobilebrowsers.com/)
    //--------------------------------------------------
    isPhone: function () {
        var a = navigator.userAgent || navigator.vendor || window.opera;
        return (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0, 4)));
    },
    //---------------------------------------------
    // isTouch
    //--------------------------------------------------
    isDeviceTouch: function () { return (typeof (Modernizr) === "undefined") ? false : Modernizr.touch; },
    //--------------------------------------------------
    // modalClose(selector)
    //--------------------------------------------------
    modalClose: function (selector) { $(selector).foundation('reveal', 'close'); },
    //--------------------------------------------------
    // modalOpen(selector)
    //--------------------------------------------------
    modalOpen: function (selector) { $(selector).foundation('reveal', 'open'); },
    //--------------------------------------------------
    // tableColumnsAlign
    //--------------------------------------------------
    tableDataColumnsAlign: function (alignment) {
        $("table[data-columns-" + alignment + "]").each(function () {
            var cols = ($(this).attr("data-columns-" + alignment)).split(",");
            for (var i = 0; i < cols.length; i++) {
                $(this).find("td:nth-child(" + cols[i] + ")").addClass("text-" + alignment);
            }
        });
    },
    tableDataColumnsAlignAll: function () {
        APP.tableDataColumnsAlign("right");
        APP.tableDataColumnsAlign("center");
        APP.tableDataColumnsAlign("left");
    },

    log: function (msg) {
        var DEBUGGING_ENABLED = $("meta[name='env']").length > 0;
        if (DEBUGGING_ENABLED && window && window.console && window.console.log) {
            window.console.log(msg);
        }
    }
};


//getFormElementByPartialID
function getFormElementByPartialID(partialID) {
    var el = $("input[id*='" + partialID + "'],select[id*='" + partialID + "'],textarea[id*='" + partialID + "']").get(0);
    if (!el) {
        return null;
    }
    return el;
}

function scrollToAccordion() {
    // show accordion
    var el = $(window.location.hash);

    // accordion
    if (el && $(el).hasClass("collapse") === true) {

        //find parent dt
        var dt = $(el).prev();
        $(dt).removeClass("collapsed");
        //open accordion
        $(el).addClass('show');
        //scroll to accordion item
        $("body,html").scrollTop(($(el).offset().top) - 80);
    }
    // tabs
    if (el && $(el).hasClass("tab-pane") === true) {
        var $dl = $(el).parents("dl");
        //close all other tabs
        var $dds = $dl.children("dd");
        $dds.removeClass("active");
        //open selected tab
        $(el).addClass('active');

        // change tab links
        var $ul = $dl.prev("ul");
        // remove active classes
        $dl.prev("ul").find("a.active").removeClass("active");
        // add active class to our tab
        $dl.prev("ul").find("a[href='" + window.location.hash + "']").addClass("active");
        //scroll to accordion item
        $("body,html").scrollTop(($(el).offset().top) - 120);
    }
}

function onYouTubeIframeAPIReady() {

    // target the element based on the class
    var videos = $("[data-embed-video]");
    if (videos !== undefined && videos.length > 0) {
        videos.each(function () {
            var player;
            // data attributes for video id
            var videoID = $(this).data("video-id");

            // TODO: need to add this class embed-responsive-item to iframe
            player = new YT.Player(this, {
                videoId: videoID, // YouTube Video ID            // Player height (in px)
                host: 'https://www.youtube-nocookie.com',
                playerVars: {
                    origin: window.location.host,
                    rel: 0,
                    autoplay: 0,          // Auto-play the video on load
                    controls: 1,          // Show pause/play buttons in player
                    showinfo: 0,          // Hide the video title
                    modestbranding: 1,    // Hide the Youtube Logo
                    loop: 0,              // Run the video in a loop
                    fs: 1,                // Hide the full screen button
                    cc_load_policy: 0,    // Hide closed captions
                    autohide: 0           // Hide video controls when playing
                }
            });
        });
    }
}
  
function convertAccordionsToTabs() {
    $(".accordion.tabs").each(function () {
        //check if we are already showing tabs
        var hasTabs = $(this).hasClass("tab-content");

        //check window size
        if ($(window).width() > 768) {
            if (hasTabs === false) { //// TABS //////
                $(this).addClass("tab-content");
                var ul = $('<ul class="nav nav-tabs" role="tablist">');
                //loop through and find all DTs
                var dts = $(this).find(".accordion-header");
                var dtCounter = 0;
                $(dts).each(function () {
                    var activeClass = (dtCounter === 0) ? "active" : "";
                    var dt = $(this).parent();

                    //build the tab bar
                    var li = $('<li class="nav-item"><a class="nav-link ' + activeClass + '" data-toggle="tab" href="' + $(dt).attr("data-target") + '" role="tab">' + $(this).text() + '</a></li>');
                    ul.append(li);

                    //manipulate the dt and hide
                    $(dt).removeClass("d-flex");
                    $(dt).hide();

                    var dd = $(dt).next(); //get corresponding dd
                    $(dd).removeClass("collapse justify-content-between collapsed");
                    $(dd).addClass("tab-pane " + activeClass);
                    $(dd).attr("role", "tabpanel");

                    dtCounter++; //increment counter
                });

                $(ul).insertBefore(this);
            }
        } else { //// ACCORDIONS //////                    
            if (hasTabs === true) {                
                $(".nav.nav-tabs").remove(); //remove tab nav
                $(this).removeClass("tab-content");
                $(this).find("dt").each(function () { //loop through dt elements
                    $(this).addClass("d-flex");
                    $(this).show();
                    var dd = $(this).next(); //get corresponding dd
                    $(dd).addClass("collapse justify-content-between collapsed");
                    $(dd).removeClass("tab-pane active");
                    $(dd).attr("role", "");
                });
            }
        }
    });
}

function responsiveStackedTables() {
    if ($(window).width() < 769) {
        //Assign class to each header
        $('.table-stacked th').each(function () {
            $(this).addClass('header-' + $(this).index());
        });

        //Assign a data-label attribute with the text from the corresponding header
        $('.table-stacked td').each(function () {
            $(this).attr('data-label', $('.header-' + $(this).index()).text() + ':');
        });
    }
}

function SetUniqueRadioButton(strGroupName, current) {
    $("input[name$='" + strGroupName + "']").each(function () {
        if (current.id !== this.id) {
            this.checked = false;
            this.removeAttribute("checked");
        }
    });
    $(current).validate();
}

function setFirstTimeHashValue(val) {
    var isEmpty = (val === undefined || val == null || val.length <= 0) ? true : false;    
    if (!isEmpty) {
        var hash = location.hash.replace('#', '');
        if (hash == "") {
            location.hash = val;
        }
    }
}

function adjustLoginBoxheight() {
   
    var login = $('#globalLoginMenu');
    if (login.length > 0) {
        var menuBarHeight = $('.aep-navbar').outerHeight();
        var espanolHeader = $('.espanol-toggle-header').outerHeight();
        if (espanolHeader !== undefined && $('.espanol-toggle-header').is(":visible")) {
            menuBarHeight += espanolHeader;
        }
        var breadcrumbHeight = 0;
        if ($('.aep-breadcrumb-nav').length > 0 && $('.aep-breadcrumb-nav').is(":visible")) {
            breadcrumbHeight = $('.aep-breadcrumb-nav').outerHeight();
        }
        var topBannerHeight = 0;
        if ($('.top-banner').length > 0 && $('.top-banner').is(":visible")) {
            $('.top-banner:visible').each(function () {
                topBannerHeight += $(this).outerHeight();
            });
        }
        login.css('top', menuBarHeight + topBannerHeight + breadcrumbHeight + 'px');
    }
   
}

function switchLanguage(lang) {
    MP.SrcUrl = unescape('mp_js_orgin_url'); MP.UrlLang = 'mp_js_current_lang'; MP.init();
    MP.switchLanguage(MP.UrlLang == lang ? 'en' : lang);
    return false;
}

function pageLoad(sender, args) { 
    try {
        document.getElementsByClassName("form-processing-overlay")[0].setAttribute("style", "display:none");
    } catch (e) { }
}
;
