PageSourceSearch

https://www.legalcontracts.com/common/scripts/m.js?v=857

js legalcontracts.com collected 2026-10-05 04:00:43 UTC 1,543,777 bytes, 25,390 lines download raw bytes

1var Sequiter = Sequiter || {};function onJsReady(callback){
2    if(typeof fetchModules === 'object' && typeof fetchModules.then === 'function'){
3        fetchModules.then(callback);
4    } else {
5        callback();
6    }
7}function RadAjaxManager_AjaxRequestStart(){AjaxRequestStart()};function RadAjaxManager_AjaxResponseEnd(){AjaxResponseEnd()};
8/* Include jquery-3.3.1.min */
9/*! jQuery v3.3.1 | (c) JS Foundation and other contributors | jquery.org/license */
10!function(e,t){"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(e,t){
vendor: 86,550 bytes, line 10
10var n=[],r=e.document,i=Object.getPrototypeOf,o=n.slice,a=n.concat,s=n.push,u=n.indexOf,l={},c=l.toString,f=l.hasOwnProperty,p=f.toString,d=p.call(Object),h={},g=function e(t){return"function"==typeof t&&"number"!=typeof t.nodeType},y=function e(t){return null!=t&&t===t.window},v={type:!0,src:!0,noModule:!0};function m(e,t,n){var i,o=(t=t||r).createElement("script");if(o.text=e,n)for(i in v)n[i]&&(o[i]=n[i]);t.head.appendChild(o).parentNode.removeChild(o)}function x(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?l[c.call(e)]||"object":typeof e}var b="3.3.1",w=function(e,t){return new w.fn.init(e,t)},T=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;w.fn=w.prototype={jquery:"3.3.1",constructor:w,length:0,toArray:function(){return o.call(this)},get:function(e){return null==e?o.call(this):e<0?this[e+this.length]:this[e]},pushStack:function(e){var t=w.merge(this.constructor(),e);return t.prevObject=this,t},each:function(e){return w.each(this,e)},map:function(e){return this.pushStack(w.map(this,function(t,n){return e.call(t,n,t)}))},slice:function(){return this.pushStack(o.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(e<0?t:0);return this.pushStack(n>=0&&n<t?[this[n]]:[])},end:function(){return this.prevObject||this.constructor()},push:s,sort:n.sort,splice:n.splice},w.extend=w.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||g(a)||(a={}),s===u&&(a=this,s--);s<u;s++)if(null!=(e=arguments[s]))for(t in e)n=a[t],a!==(r=e[t])&&(l&&r&&(w.isPlainObject(r)||(i=Array.isArray(r)))?(i?(i=!1,o=n&&Array.isArray(n)?n:[]):o=n&&w.isPlainObject(n)?n:{},a[t]=w.extend(l,o,r)):void 0!==r&&(a[t]=r));return a},w.extend({expando:"jQuery"+("3.3.1"+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]"!==c.call(e))&&(!(t=i(e))||"function"==typeof(n=f.call(t,"constructor")&&t.constructor)&&p.call(n)===d)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},globalEval:function(e){m(e)},each:function(e,t){var n,r=0;if(C(e)){for(n=e.length;r<n;r++)if(!1===t.call(e[r],r,e[r]))break}else for(r in e)if(!1===t.call(e[r],r,e[r]))break;return e},trim:function(e){return null==e?"":(e+"").replace(T,"")},makeArray:function(e,t){var n=t||[];return null!=e&&(C(Object(e))?w.merge(n,"string"==typeof e?[e]:e):s.call(n,e)),n},inArray:function(e,t,n){return null==t?-1:u.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=[],o=0,a=e.length,s=!n;o<a;o++)(r=!t(e[o],o))!==s&&i.push(e[o]);return i},map:function(e,t,n){var r,i,o=0,s=[];if(C(e))for(r=e.length;o<r;o++)null!=(i=t(e[o],o,n))&&s.push(i);else for(o in e)null!=(i=t(e[o],o,n))&&s.push(i);return a.apply([],s)},guid:1,support:h}),"function"==typeof Symbol&&(w.fn[Symbol.iterator]=n[Symbol.iterator]),w.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(e,t){l["[object "+t+"]"]=t.toLowerCase()});function C(e){var t=!!e&&"length"in e&&e.length,n=x(e);return!g(e)&&!y(e)&&("array"===n||0===t||"number"==typeof t&&t>0&&t-1 in e)}var E=function(e){var t,n,r,i,o,a,s,u,l,c,f,p,d,h,g,y,v,m,x,b="sizzle"+1*new Date,w=e.document,T=0,C=0,E=ae(),k=ae(),S=ae(),D=function(e,t){return e===t&&(f=!0),0},N={}.hasOwnProperty,A=[],j=A.pop,q=A.push,L=A.push,H=A.slice,O=function(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1},P="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",M="[\\x20\\t\\r\\n\\f]",R="(?:\\\\.|[\\w-]|[^\0-\\xa0])+",I="\\["+M+"*("+R+")(?:"+M+"*([*^$|!~]?=)"+M+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+R+"))|)"+M+"*\\]",W=":("+R+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+I+")*)|.*)\\)|)",$=new RegExp(M+"+","g"),B=new RegExp("^"+M+"+|((?:^|[^\\\\])(?:\\\\.)*)"+M+"+$","g"),F=new RegExp("^"+M+"*,"+M+"*"),_=new RegExp("^"+M+"*([>+~]|"+M+")"+M+"*"),z=new RegExp("="+M+"*([^\\]'\"]*?)"+M+"*\\]","g"),X=new RegExp(W),U=new RegExp("^"+R+"$"),V={ID:new RegExp("^#("+R+")"),CLASS:new RegExp("^\\.("+R+")"),TAG:new RegExp("^("+R+"|[*])"),ATTR:new RegExp("^"+I),PSEUDO:new RegExp("^"+W),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("^(?:"+P+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},G=/^(?:input|select|textarea|button)$/i,Y=/^h\d$/i,Q=/^[^{]+\{\s*\[native \w/,J=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,K=/[+~]/,Z=new RegExp("\\\\([\\da-f]{1,6}"+M+"?|("+M+")|.)","ig"),ee=function(e,t,n){var r="0x"+t-65536;return r!==r||n?t:r<0?String.fromCharCode(r+65536):String.fromCharCode(r>>10|55296,1023&r|56320)},te=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ne=function(e,t){return t?"\0"===e?"\ufffd":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},re=function(){p()},ie=me(function(e){return!0===e.disabled&&("form"in e||"label"in e)},{dir:"parentNode",next:"legend"});try{L.apply(A=H.call(w.childNodes),w.childNodes),A[w.childNodes.length].nodeType}catch(e){L={apply:A.length?function(e,t){q.apply(e,H.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}function oe(e,t,r,i){var o,s,l,c,f,h,v,m=t&&t.ownerDocument,T=t?t.nodeType:9;if(r=r||[],"string"!=typeof e||!e||1!==T&&9!==T&&11!==T)return r;if(!i&&((t?t.ownerDocument||t:w)!==d&&p(t),t=t||d,g)){if(11!==T&&(f=J.exec(e)))if(o=f[1]){if(9===T){if(!(l=t.getElementById(o)))return r;if(l.id===o)return r.push(l),r}else if(m&&(l=m.getElementById(o))&&x(t,l)&&l.id===o)return r.push(l),r}else{if(f[2])return L.apply(r,t.getElementsByTagName(e)),r;if((o=f[3])&&n.getElementsByClassName&&t.getElementsByClassName)return L.apply(r,t.getElementsByClassName(o)),r}if(n.qsa&&!S[e+" "]&&(!y||!y.test(e))){if(1!==T)m=t,v=e;else if("object"!==t.nodeName.toLowerCase()){(c=t.getAttribute("id"))?c=c.replace(te,ne):t.setAttribute("id",c=b),s=(h=a(e)).length;while(s--)h[s]="#"+c+" "+ve(h[s]);v=h.join(","),m=K.test(e)&&ge(t.parentNode)||t}if(v)try{return L.apply(r,m.querySelectorAll(v)),r}catch(e){}finally{c===b&&t.removeAttribute("id")}}}return u(e.replace(B,"$1"),t,r,i)}function ae(){var e=[];function t(n,i){return e.push(n+" ")>r.cacheLength&&delete t[e.shift()],t[n+" "]=i}return t}function se(e){return e[b]=!0,e}function ue(e){var t=d.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function le(e,t){var n=e.split("|"),i=n.length;while(i--)r.attrHandle[n[i]]=t}function ce(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 fe(e){return function(t){return"input"===t.nodeName.toLowerCase()&&t.type===e}}function pe(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function de(e){return function(t){return"form"in t?t.parentNode&&!1===t.disabled?"label"in t?"label"in t.parentNode?t.parentNode.disabled===e:t.disabled===e:t.isDisabled===e||t.isDisabled!==!e&&ie(t)===e:t.disabled===e:"label"in t&&t.disabled===e}}function he(e){return se(function(t){return t=+t,se(function(n,r){var i,o=e([],n.length,t),a=o.length;while(a--)n[i=o[a]]&&(n[i]=!(r[i]=n[i]))})})}function ge(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}n=oe.support={},o=oe.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return!!t&&"HTML"!==t.nodeName},p=oe.setDocument=function(e){var t,i,a=e?e.ownerDocument||e:w;return a!==d&&9===a.nodeType&&a.documentElement?(d=a,h=d.documentElement,g=!o(d),w!==d&&(i=d.defaultView)&&i.top!==i&&(i.addEventListener?i.addEventListener("unload",re,!1):i.attachEvent&&i.attachEvent("onunload",re)),n.attributes=ue(function(e){return e.className="i",!e.getAttribute("className")}),n.getElementsByTagName=ue(function(e){return e.appendChild(d.createComment("")),!e.getElementsByTagName("*").length}),n.getElementsByClassName=Q.test(d.getElementsByClassName),n.getById=ue(function(e){return h.appendChild(e).id=b,!d.getElementsByName||!d.getElementsByName(b).length}),n.getById?(r.filter.ID=function(e){var t=e.replace(Z,ee);return function(e){return e.getAttribute("id")===t}},r.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&g){var n=t.getElementById(e);return n?[n]:[]}}):(r.filter.ID=function(e){var t=e.replace(Z,ee);return function(e){var n="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return n&&n.value===t}},r.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&g){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[]}}),r.find.TAG=n.getElementsByTagName?function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):n.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},r.find.CLASS=n.getElementsByClassName&&function(e,t){if("undefined"!=typeof t.getElementsByClassName&&g)return t.getElementsByClassName(e)},v=[],y=[],(n.qsa=Q.test(d.querySelectorAll))&&(ue(function(e){h.appendChild(e).innerHTML="<a id='"+b+"'></a><select id='"+b+"-\r\\' msallowcapture=''><option selected=''></option></select>",e.querySelectorAll("[msallowcapture^='']").length&&y.push("[*^$]="+M+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||y.push("\\["+M+"*(?:value|"+P+")"),e.querySelectorAll("[id~="+b+"-]").length||y.push("~="),e.querySelectorAll(":checked").length||y.push(":checked"),e.querySelectorAll("a#"+b+"+*").length||y.push(".#.+[+~]")}),ue(function(e){e.innerHTML="<a href='' disabled='disabled'></a><select disabled='disabled'><option/></select>";var t=d.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&y.push("name"+M+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&y.push(":enabled",":disabled"),h.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&y.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),y.push(",.*:")})),(n.matchesSelector=Q.test(m=h.matches||h.webkitMatchesSelector||h.mozMatchesSelector||h.oMatchesSelector||h.msMatchesSelector))&&ue(function(e){n.disconnectedMatch=m.call(e,"*"),m.call(e,"[s!='']:x"),v.push("!=",W)}),y=y.length&&new RegExp(y.join("|")),v=v.length&&new RegExp(v.join("|")),t=Q.test(h.compareDocumentPosition),x=t||Q.test(h.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},D=t?function(e,t){if(e===t)return f=!0,0;var r=!e.compareDocumentPosition-!t.compareDocumentPosition;return r||(1&(r=(e.ownerDocument||e)===(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!n.sortDetached&&t.compareDocumentPosition(e)===r?e===d||e.ownerDocument===w&&x(w,e)?-1:t===d||t.ownerDocument===w&&x(w,t)?1:c?O(c,e)-O(c,t):0:4&r?-1:1)}:function(e,t){if(e===t)return f=!0,0;var n,r=0,i=e.parentNode,o=t.parentNode,a=[e],s=[t];if(!i||!o)return e===d?-1:t===d?1:i?-1:o?1:c?O(c,e)-O(c,t):0;if(i===o)return ce(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?ce(a[r],s[r]):a[r]===w?-1:s[r]===w?1:0},d):d},oe.matches=function(e,t){return oe(e,null,null,t)},oe.matchesSelector=function(e,t){if((e.ownerDocument||e)!==d&&p(e),t=t.replace(z,"='$1']"),n.matchesSelector&&g&&!S[t+" "]&&(!v||!v.test(t))&&(!y||!y.test(t)))try{var r=m.call(e,t);if(r||n.disconnectedMatch||e.document&&11!==e.document.nodeType)return r}catch(e){}return oe(t,d,null,[e]).length>0},oe.contains=function(e,t){return(e.ownerDocument||e)!==d&&p(e),x(e,t)},oe.attr=function(e,t){(e.ownerDocument||e)!==d&&p(e);var i=r.attrHandle[t.toLowerCase()],o=i&&N.call(r.attrHandle,t.toLowerCase())?i(e,t,!g):void 0;return void 0!==o?o:n.attributes||!g?e.getAttribute(t):(o=e.getAttributeNode(t))&&o.specified?o.value:null},oe.escape=function(e){return(e+"").replace(te,ne)},oe.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},oe.uniqueSort=function(e){var t,r=[],i=0,o=0;if(f=!n.detectDuplicates,c=!n.sortStable&&e.slice(0),e.sort(D),f){while(t=e[o++])t===e[o]&&(i=r.push(o));while(i--)e.splice(r[i],1)}return c=null,e},i=oe.getText=function(e){var t,n="",r=0,o=e.nodeType;if(o){if(1===o||9===o||11===o){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=i(e)}else if(3===o||4===o)return e.nodeValue}else while(t=e[r++])n+=i(t);return n},(r=oe.selectors={cacheLength:50,createPseudo:se,match:V,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(Z,ee),e[3]=(e[3]||e[4]||e[5]||"").replace(Z,ee),"~="===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]||oe.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]&&oe.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return V.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&X.test(n)&&(t=a(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(Z,ee).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=E[e+" "];return t||(t=new RegExp("(^|"+M+")"+e+"("+M+"|$)"))&&E(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r){var i=oe.attr(r,e);return null==i?"!="===t:!t||(i+="","="===t?i===n:"!="===t?i!==n:"^="===t?n&&0===i.indexOf(n):"*="===t?n&&i.indexOf(n)>-1:"$="===t?n&&i.slice(-n.length)===n:"~="===t?(" "+i.replace($," ")+" ").indexOf(n)>-1:"|="===t&&(i===n||i.slice(0,n.length+1)===n+"-"))}},CHILD:function(e,t,n,r,i){var o="nth"!==e.slice(0,3),a="last"!==e.slice(-4),s="of-type"===t;return 1===r&&0===i?function(e){return!!e.parentNode}:function(t,n,u){var l,c,f,p,d,h,g=o!==a?"nextSibling":"previousSibling",y=t.parentNode,v=s&&t.nodeName.toLowerCase(),m=!u&&!s,x=!1;if(y){if(o){while(g){p=t;while(p=p[g])if(s?p.nodeName.toLowerCase()===v:1===p.nodeType)return!1;h=g="only"===e&&!h&&"nextSibling"}return!0}if(h=[a?y.firstChild:y.lastChild],a&&m){x=(d=(l=(c=(f=(p=y)[b]||(p[b]={}))[p.uniqueID]||(f[p.uniqueID]={}))[e]||[])[0]===T&&l[1])&&l[2],p=d&&y.childNodes[d];while(p=++d&&p&&p[g]||(x=d=0)||h.pop())if(1===p.nodeType&&++x&&p===t){c[e]=[T,d,x];break}}else if(m&&(x=d=(l=(c=(f=(p=t)[b]||(p[b]={}))[p.uniqueID]||(f[p.uniqueID]={}))[e]||[])[0]===T&&l[1]),!1===x)while(p=++d&&p&&p[g]||(x=d=0)||h.pop())if((s?p.nodeName.toLowerCase()===v:1===p.nodeType)&&++x&&(m&&((c=(f=p[b]||(p[b]={}))[p.uniqueID]||(f[p.uniqueID]={}))[e]=[T,x]),p===t))break;return(x-=i)===r||x%r==0&&x/r>=0}}},PSEUDO:function(e,t){var n,i=r.pseudos[e]||r.setFilters[e.toLowerCase()]||oe.error("unsupported pseudo: "+e);return i[b]?i(t):i.length>1?(n=[e,e,"",t],r.setFilters.hasOwnProperty(e.toLowerCase())?se(function(e,n){var r,o=i(e,t),a=o.length;while(a--)e[r=O(e,o[a])]=!(n[r]=o[a])}):function(e){return i(e,0,n)}):i}},pseudos:{not:se(function(e){var t=[],n=[],r=s(e.replace(B,"$1"));return r[b]?se(function(e,t,n,i){var o,a=r(e,null,i,[]),s=e.length;while(s--)(o=a[s])&&(e[s]=!(t[s]=o))}):function(e,i,o){return t[0]=e,r(t,null,o,n),t[0]=null,!n.pop()}}),has:se(function(e){return function(t){return oe(e,t).length>0}}),contains:se(function(e){return e=e.replace(Z,ee),function(t){return(t.textContent||t.innerText||i(t)).indexOf(e)>-1}}),lang:se(function(e){return U.test(e||"")||oe.error("unsupported lang: "+e),e=e.replace(Z,ee).toLowerCase(),function(t){var n;do{if(n=g?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return(n=n.toLowerCase())===e||0===n.indexOf(e+"-")}while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===h},focus:function(e){return e===d.activeElement&&(!d.hasFocus||d.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:de(!1),disabled:de(!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!r.pseudos.empty(e)},header:function(e){return Y.test(e.nodeName)},input:function(e){return G.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:he(function(){return[0]}),last:he(function(e,t){return[t-1]}),eq:he(function(e,t,n){return[n<0?n+t:n]}),even:he(function(e,t){for(var n=0;n<t;n+=2)e.push(n);return e}),odd:he(function(e,t){for(var n=1;n<t;n+=2)e.push(n);return e}),lt:he(function(e,t,n){for(var r=n<0?n+t:n;--r>=0;)e.push(r);return e}),gt:he(function(e,t,n){for(var r=n<0?n+t:n;++r<t;)e.push(r);return e})}}).pseudos.nth=r.pseudos.eq;for(t in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})r.pseudos[t]=fe(t);for(t in{submit:!0,reset:!0})r.pseudos[t]=pe(t);function ye(){}ye.prototype=r.filters=r.pseudos,r.setFilters=new ye,a=oe.tokenize=function(e,t){var n,i,o,a,s,u,l,c=k[e+" "];if(c)return t?0:c.slice(0);s=e,u=[],l=r.preFilter;while(s){n&&!(i=F.exec(s))||(i&&(s=s.slice(i[0].length)||s),u.push(o=[])),n=!1,(i=_.exec(s))&&(n=i.shift(),o.push({value:n,type:i[0].replace(B," ")}),s=s.slice(n.length));for(a in r.filter)!(i=V[a].exec(s))||l[a]&&!(i=l[a](i))||(n=i.shift(),o.push({value:n,type:a,matches:i}),s=s.slice(n.length));if(!n)break}return t?s.length:s?oe.error(e):k(e,u).slice(0)};function ve(e){for(var t=0,n=e.length,r="";t<n;t++)r+=e[t].value;return r}function me(e,t,n){var r=t.dir,i=t.next,o=i||r,a=n&&"parentNode"===o,s=C++;return t.first?function(t,n,i){while(t=t[r])if(1===t.nodeType||a)return e(t,n,i);return!1}:function(t,n,u){var l,c,f,p=[T,s];if(u){while(t=t[r])if((1===t.nodeType||a)&&e(t,n,u))return!0}else while(t=t[r])if(1===t.nodeType||a)if(f=t[b]||(t[b]={}),c=f[t.uniqueID]||(f[t.uniqueID]={}),i&&i===t.nodeName.toLowerCase())t=t[r]||t;else{if((l=c[o])&&l[0]===T&&l[1]===s)return p[2]=l[2];if(c[o]=p,p[2]=e(t,n,u))return!0}return!1}}function xe(e){return e.length>1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return!1;return!0}:e[0]}function be(e,t,n){for(var r=0,i=t.length;r<i;r++)oe(e,t[r],n);return n}function we(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 Te(e,t,n,r,i,o){return r&&!r[b]&&(r=Te(r)),i&&!i[b]&&(i=Te(i,o)),se(function(o,a,s,u){var l,c,f,p=[],d=[],h=a.length,g=o||be(t||"*",s.nodeType?[s]:s,[]),y=!e||!o&&t?g:we(g,p,e,s,u),v=n?i||(o?e:h||r)?[]:a:y;if(n&&n(y,v,s,u),r){l=we(v,d),r(l,[],s,u),c=l.length;while(c--)(f=l[c])&&(v[d[c]]=!(y[d[c]]=f))}if(o){if(i||e){if(i){l=[],c=v.length;while(c--)(f=v[c])&&l.push(y[c]=f);i(null,v=[],l,u)}c=v.length;while(c--)(f=v[c])&&(l=i?O(o,f):p[c])>-1&&(o[l]=!(a[l]=f))}}else v=we(v===a?v.splice(h,v.length):v),i?i(null,a,v,u):L.apply(a,v)})}function Ce(e){for(var t,n,i,o=e.length,a=r.relative[e[0].type],s=a||r.relative[" "],u=a?1:0,c=me(function(e){return e===t},s,!0),f=me(function(e){return O(t,e)>-1},s,!0),p=[function(e,n,r){var i=!a&&(r||n!==l)||((t=n).nodeType?c(e,n,r):f(e,n,r));return t=null,i}];u<o;u++)if(n=r.relative[e[u].type])p=[me(xe(p),n)];else{if((n=r.filter[e[u].type].apply(null,e[u].matches))[b]){for(i=++u;i<o;i++)if(r.relative[e[i].type])break;return Te(u>1&&xe(p),u>1&&ve(e.slice(0,u-1).concat({value:" "===e[u-2].type?"*":""})).replace(B,"$1"),n,u<i&&Ce(e.slice(u,i)),i<o&&Ce(e=e.slice(i)),i<o&&ve(e))}p.push(n)}return xe(p)}function Ee(e,t){var n=t.length>0,i=e.length>0,o=function(o,a,s,u,c){var f,h,y,v=0,m="0",x=o&&[],b=[],w=l,C=o||i&&r.find.TAG("*",c),E=T+=null==w?1:Math.random()||.1,k=C.length;for(c&&(l=a===d||a||c);m!==k&&null!=(f=C[m]);m++){if(i&&f){h=0,a||f.ownerDocument===d||(p(f),s=!g);while(y=e[h++])if(y(f,a||d,s)){u.push(f);break}c&&(T=E)}n&&((f=!y&&f)&&v--,o&&x.push(f))}if(v+=m,n&&m!==v){h=0;while(y=t[h++])y(x,b,a,s);if(o){if(v>0)while(m--)x[m]||b[m]||(b[m]=j.call(u));b=we(b)}L.apply(u,b),c&&!o&&b.length>0&&v+t.length>1&&oe.uniqueSort(u)}return c&&(T=E,l=w),x};return n?se(o):o}return s=oe.compile=function(e,t){var n,r=[],i=[],o=S[e+" "];if(!o){t||(t=a(e)),n=t.length;while(n--)(o=Ce(t[n]))[b]?r.push(o):i.push(o);(o=S(e,Ee(i,r))).selector=e}return o},u=oe.select=function(e,t,n,i){var o,u,l,c,f,p="function"==typeof e&&e,d=!i&&a(e=p.selector||e);if(n=n||[],1===d.length){if((u=d[0]=d[0].slice(0)).length>2&&"ID"===(l=u[0]).type&&9===t.nodeType&&g&&r.relative[u[1].type]){if(!(t=(r.find.ID(l.matches[0].replace(Z,ee),t)||[])[0]))return n;p&&(t=t.parentNode),e=e.slice(u.shift().value.length)}o=V.needsContext.test(e)?0:u.length;while(o--){if(l=u[o],r.relative[c=l.type])break;if((f=r.find[c])&&(i=f(l.matches[0].replace(Z,ee),K.test(u[0].type)&&ge(t.parentNode)||t))){if(u.splice(o,1),!(e=i.length&&ve(u)))return L.apply(n,i),n;break}}}return(p||s(e,d))(i,t,!g,n,!t||K.test(e)&&ge(t.parentNode)||t),n},n.sortStable=b.split("").sort(D).join("")===b,n.detectDuplicates=!!f,p(),n.sortDetached=ue(function(e){return 1&e.compareDocumentPosition(d.createElement("fieldset"))}),ue(function(e){return e.innerHTML="<a href='#'></a>","#"===e.firstChild.getAttribute("href")})||le("type|href|height|width",function(e,t,n){if(!n)return e.getAttribute(t,"type"===t.toLowerCase()?1:2)}),n.attributes&&ue(function(e){return e.innerHTML="<input/>",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")})||le("value",function(e,t,n){if(!n&&"input"===e.nodeName.toLowerCase())return e.defaultValue}),ue(function(e){return null==e.getAttribute("disabled")})||le(P,function(e,t,n){var r;if(!n)return!0===e[t]?t.toLowerCase():(r=e.getAttributeNode(t))&&r.specified?r.value:null}),oe}(e);w.find=E,w.expr=E.selectors,w.expr[":"]=w.expr.pseudos,w.uniqueSort=w.unique=E.uniqueSort,w.text=E.getText,w.isXMLDoc=E.isXML,w.contains=E.contains,w.escapeSelector=E.escape;var k=function(e,t,n){var r=[],i=void 0!==n;while((e=e[t])&&9!==e.nodeType)if(1===e.nodeType){if(i&&w(e).is(n))break;r.push(e)}return r},S=function(e,t){for(var n=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n},D=w.expr.match.needsContext;function N(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()}var A=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function j(e,t,n){return g(t)?w.grep(e,function(e,r){return!!t.call(e,r,e)!==n}):t.nodeType?w.grep(e,function(e){return e===t!==n}):"string"!=typeof t?w.grep(e,function(e){return u.call(t,e)>-1!==n}):w.filter(t,e,n)}w.filter=function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===r.nodeType?w.find.matchesSelector(r,e)?[r]:[]:w.find.matches(e,w.grep(t,function(e){return 1===e.nodeType}))},w.fn.extend({find:function(e){var t,n,r=this.length,i=this;if("string"!=typeof e)return this.pushStack(w(e).filter(function(){for(t=0;t<r;t++)if(w.contains(i[t],this))return!0}));for(n=this.pushStack([]),t=0;t<r;t++)w.find(e,i[t],n);return r>1?w.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&&D.test(e)?w(e):e||[],!1).length}});var q,L=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/;(w.fn.init=function(e,t,n){var i,o;if(!e)return this;if(n=n||q,"string"==typeof e){if(!(i="<"===e[0]&&">"===e[e.length-1]&&e.length>=3?[null,e,null]:L.exec(e))||!i[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(i[1]){if(t=t instanceof w?t[0]:t,w.merge(this,w.parseHTML(i[1],t&&t.nodeType?t.ownerDocument||t:r,!0)),A.test(i[1])&&w.isPlainObject(t))for(i in t)g(this[i])?this[i](t[i]):this.attr(i,t[i]);return this}return(o=r.getElementById(i[2]))&&(this[0]=o,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):g(e)?void 0!==n.ready?n.ready(e):e(w):w.makeArray(e,this)}).prototype=w.fn,q=w(r);var H=/^(?:parents|prev(?:Until|All))/,O={children:!0,contents:!0,next:!0,prev:!0};w.fn.extend({has:function(e){var t=w(e,this),n=t.length;return this.filter(function(){for(var e=0;e<n;e++)if(w.contains(this,t[e]))return!0})},closest:function(e,t){var n,r=0,i=this.length,o=[],a="string"!=typeof e&&w(e);if(!D.test(e))for(;r<i;r++)for(n=this[r];n&&n!==t;n=n.parentNode)if(n.nodeType<11&&(a?a.index(n)>-1:1===n.nodeType&&w.find.matchesSelector(n,e))){o.push(n);break}return this.pushStack(o.length>1?w.uniqueSort(o):o)},index:function(e){return e?"string"==typeof e?u.call(w(e),this[0]):u.call(this,e.jquery?e[0]:e):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){return this.pushStack(w.uniqueSort(w.merge(this.get(),w(e,t))))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}});function P(e,t){while((e=e[t])&&1!==e.nodeType);return e}w.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return k(e,"parentNode")},parentsUntil:function(e,t,n){return k(e,"parentNode",n)},next:function(e){return P(e,"nextSibling")},prev:function(e){return P(e,"previousSibling")},nextAll:function(e){return k(e,"nextSibling")},prevAll:function(e){return k(e,"previousSibling")},nextUntil:function(e,t,n){return k(e,"nextSibling",n)},prevUntil:function(e,t,n){return k(e,"previousSibling",n)},siblings:function(e){return S((e.parentNode||{}).firstChild,e)},children:function(e){return S(e.firstChild)},contents:function(e){return N(e,"iframe")?e.contentDocument:(N(e,"template")&&(e=e.content||e),w.merge([],e.childNodes))}},function(e,t){w.fn[e]=function(n,r){var i=w.map(this,t,n);return"Until"!==e.slice(-5)&&(r=n),r&&"string"==typeof r&&(i=w.filter(r,i)),this.length>1&&(O[e]||w.uniqueSort(i),H.test(e)&&i.reverse()),this.pushStack(i)}});var M=/[^\x20\t\r\n\f]+/g;function R(e){var t={};return w.each(e.match(M)||[],function(e,n){t[n]=!0}),t}w.Callbacks=function(e){e="string"==typeof e?R(e):w.extend({},e);var t,n,r,i,o=[],a=[],s=-1,u=function(){for(i=i||e.once,r=t=!0;a.length;s=-1){n=a.shift();while(++s<o.length)!1===o[s].apply(n[0],n[1])&&e.stopOnFalse&&(s=o.length,n=!1)}e.memory||(n=!1),t=!1,i&&(o=n?[]:"")},l={add:function(){return o&&(n&&!t&&(s=o.length-1,a.push(n)),function t(n){w.each(n,function(n,r){g(r)?e.unique&&l.has(r)||o.push(r):r&&r.length&&"string"!==x(r)&&t(r)})}(arguments),n&&!t&&u()),this},remove:function(){return w.each(arguments,function(e,t){var n;while((n=w.inArray(t,o,n))>-1)o.splice(n,1),n<=s&&s--}),this},has:function(e){return e?w.inArray(e,o)>-1:o.length>0},empty:function(){return o&&(o=[]),this},disable:function(){return i=a=[],o=n="",this},disabled:function(){return!o},lock:function(){return i=a=[],n||t||(o=n=""),this},locked:function(){return!!i},fireWith:function(e,n){return i||(n=[e,(n=n||[]).slice?n.slice():n],a.push(n),t||u()),this},fire:function(){return l.fireWith(this,arguments),this},fired:function(){return!!r}};return l};function I(e){return e}function W(e){throw e}function $(e,t,n,r){var i;try{e&&g(i=e.promise)?i.call(e).done(t).fail(n):e&&g(i=e.then)?i.call(e,t,n):t.apply(void 0,[e].slice(r))}catch(e){n.apply(void 0,[e])}}w.extend({Deferred:function(t){var n=[["notify","progress",w.Callbacks("memory"),w.Callbacks("memory"),2],["resolve","done",w.Callbacks("once memory"),w.Callbacks("once memory"),0,"resolved"],["reject","fail",w.Callbacks("once memory"),w.Callbacks("once memory"),1,"rejected"]],r="pending",i={state:function(){return r},always:function(){return o.done(arguments).fail(arguments),this},"catch":function(e){return i.then(null,e)},pipe:function(){var e=arguments;return w.Deferred(function(t){w.each(n,function(n,r){var i=g(e[r[4]])&&e[r[4]];o[r[1]](function(){var e=i&&i.apply(this,arguments);e&&g(e.promise)?e.promise().progress(t.notify).done(t.resolve).fail(t.reject):t[r[0]+"With"](this,i?[e]:arguments)})}),e=null}).promise()},then:function(t,r,i){var o=0;function a(t,n,r,i){return function(){var s=this,u=arguments,l=function(){var e,l;if(!(t<o)){if((e=r.apply(s,u))===n.promise())throw new TypeError("Thenable self-resolution");l=e&&("object"==typeof e||"function"==typeof e)&&e.then,g(l)?i?l.call(e,a(o,n,I,i),a(o,n,W,i)):(o++,l.call(e,a(o,n,I,i),a(o,n,W,i),a(o,n,I,n.notifyWith))):(r!==I&&(s=void 0,u=[e]),(i||n.resolveWith)(s,u))}},c=i?l:function(){try{l()}catch(e){w.Deferred.exceptionHook&&w.Deferred.exceptionHook(e,c.stackTrace),t+1>=o&&(r!==W&&(s=void 0,u=[e]),n.rejectWith(s,u))}};t?c():(w.Deferred.getStackHook&&(c.stackTrace=w.Deferred.getStackHook()),e.setTimeout(c))}}return w.Deferred(function(e){n[0][3].add(a(0,e,g(i)?i:I,e.notifyWith)),n[1][3].add(a(0,e,g(t)?t:I)),n[2][3].add(a(0,e,g(r)?r:W))}).promise()},promise:function(e){return null!=e?w.extend(e,i):i}},o={};return w.each(n,function(e,t){var a=t[2],s=t[5];i[t[1]]=a.add,s&&a.add(function(){r=s},n[3-e][2].disable,n[3-e][3].disable,n[0][2].lock,n[0][3].lock),a.add(t[3].fire),o[t[0]]=function(){return o[t[0]+"With"](this===o?void 0:this,arguments),this},o[t[0]+"With"]=a.fireWith}),i.promise(o),t&&t.call(o,o),o},when:function(e){var t=arguments.length,n=t,r=Array(n),i=o.call(arguments),a=w.Deferred(),s=function(e){return function(n){r[e]=this,i[e]=arguments.length>1?o.call(arguments):n,--t||a.resolveWith(r,i)}};if(t<=1&&($(e,a.done(s(n)).resolve,a.reject,!t),"pending"===a.state()||g(i[n]&&i[n].then)))return a.then();while(n--)$(i[n],s(n),a.reject);return a.promise()}});var B=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;w.Deferred.exceptionHook=function(t,n){e.console&&e.console.warn&&t&&B.test(t.name)&&e.console.warn("jQuery.Deferred exception: "+t.message,t.stack,n)},w.readyException=function(t){e.setTimeout(function(){throw t})};var F=w.Deferred();w.fn.ready=function(e){return F.then(e)["catch"](function(e){w.readyException(e)}),this},w.extend({isReady:!1,readyWait:1,ready:function(e){(!0===e?--w.readyWait:w.isReady)||(w.isReady=!0,!0!==e&&--w.readyWait>0||F.resolveWith(r,[w]))}}),w.ready.then=F.then;function _(){r.removeEventListener("DOMContentLoaded",_),e.removeEventListener("load",_),w.ready()}"complete"===r.readyState||"loading"!==r.readyState&&!r.documentElement.doScroll?e.setTimeout(w.ready):(r.addEventListener("DOMContentLoaded",_),e.addEventListener("load",_));var z=function(e,t,n,r,i,o,a){var s=0,u=e.length,l=null==n;if("object"===x(n)){i=!0;for(s in n)z(e,t,s,n[s],!0,o,a)}else if(void 0!==r&&(i=!0,g(r)||(a=!0),l&&(a?(t.call(e,r),t=null):(l=t,t=function(e,t,n){return l.call(w(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},X=/^-ms-/,U=/-([a-z])/g;function V(e,t){return t.toUpperCase()}function G(e){return e.replace(X,"ms-").replace(U,V)}var Y=function(e){return 1===e.nodeType||9===e.nodeType||!+e.nodeType};function Q(){this.expando=w.expando+Q.uid++}Q.uid=1,Q.prototype={cache:function(e){var t=e[this.expando];return t||(t={},Y(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[G(t)]=n;else for(r in t)i[G(r)]=t[r];return i},get:function(e,t){return void 0===t?this.cache(e):e[this.expando]&&e[this.expando][G(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(G):(t=G(t))in r?[t]:t.match(M)||[]).length;while(n--)delete r[t[n]]}(void 0===t||w.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&&!w.isEmptyObject(t)}};var J=new Q,K=new Q,Z=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,ee=/[A-Z]/g;function te(e){return"true"===e||"false"!==e&&("null"===e?null:e===+e+""?+e:Z.test(e)?JSON.parse(e):e)}function ne(e,t,n){var r;if(void 0===n&&1===e.nodeType)if(r="data-"+t.replace(ee,"-$&").toLowerCase(),"string"==typeof(n=e.getAttribute(r))){try{n=te(n)}catch(e){}K.set(e,t,n)}else n=void 0;return n}w.extend({hasData:function(e){return K.hasData(e)||J.hasData(e)},data:function(e,t,n){return K.access(e,t,n)},removeData:function(e,t){K.remove(e,t)},_data:function(e,t,n){return J.access(e,t,n)},_removeData:function(e,t){J.remove(e,t)}}),w.fn.extend({data:function(e,t){var n,r,i,o=this[0],a=o&&o.attributes;if(void 0===e){if(this.length&&(i=K.get(o),1===o.nodeType&&!J.get(o,"hasDataAttrs"))){n=a.length;while(n--)a[n]&&0===(r=a[n].name).indexOf("data-")&&(r=G(r.slice(5)),ne(o,r,i[r]));J.set(o,"hasDataAttrs",!0)}return i}return"object"==typeof e?this.each(function(){K.set(this,e)}):z(this,function(t){var n;if(o&&void 0===t){if(void 0!==(n=K.get(o,e)))return n;if(void 0!==(n=ne(o,e)))return n}else this.each(function(){K.set(this,e,t)})},null,t,arguments.length>1,null,!0)},removeData:function(e){return this.each(function(){K.remove(this,e)})}}),w.extend({queue:function(e,t,n){var r;if(e)return t=(t||"fx")+"queue",r=J.get(e,t),n&&(!r||Array.isArray(n)?r=J.access(e,t,w.makeArray(n)):r.push(n)),r||[]},dequeue:function(e,t){t=t||"fx";var n=w.queue(e,t),r=n.length,i=n.shift(),o=w._queueHooks(e,t),a=function(){w.dequeue(e,t)};"inprogress"===i&&(i=n.shift(),r--),i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,a,o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return J.get(e,n)||J.access(e,n,{empty:w.Callbacks("once memory").add(function(){J.remove(e,[t+"queue",n])})})}}),w.fn.extend({queue:function(e,t){var n=2;return"string"!=typeof e&&(t=e,e="fx",n--),arguments.length<n?w.queue(this[0],e):void 0===t?this:this.each(function(){var n=w.queue(this,e,t);w._queueHooks(this,e),"fx"===e&&"inprogress"!==n[0]&&w.dequeue(this,e)})},dequeue:function(e){return this.each(function(){w.dequeue(this,e)})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,t){var n,r=1,i=w.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=J.get(o[a],e+"queueHooks"))&&n.empty&&(r++,n.empty.add(s));return s(),i.promise(t)}});var re=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,ie=new RegExp("^(?:([+-])=|)("+re+")([a-z%]*)$","i"),oe=["Top","Right","Bottom","Left"],ae=function(e,t){return"none"===(e=t||e).style.display||""===e.style.display&&w.contains(e.ownerDocument,e)&&"none"===w.css(e,"display")},se=function(e,t,n,r){var i,o,a={};for(o in t)a[o]=e.style[o],e.style[o]=t[o];i=n.apply(e,r||[]);for(o in t)e.style[o]=a[o];return i};function ue(e,t,n,r){var i,o,a=20,s=r?function(){return r.cur()}:function(){return w.css(e,t,"")},u=s(),l=n&&n[3]||(w.cssNumber[t]?"":"px"),c=(w.cssNumber[t]||"px"!==l&&+u)&&ie.exec(w.css(e,t));if(c&&c[3]!==l){u/=2,l=l||c[3],c=+u||1;while(a--)w.style(e,t,c+l),(1-o)*(1-(o=s()/u||.5))<=0&&(a=0),c/=o;c*=2,w.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 le={};function ce(e){var t,n=e.ownerDocument,r=e.nodeName,i=le[r];return i||(t=n.body.appendChild(n.createElement(r)),i=w.css(t,"display"),t.parentNode.removeChild(t),"none"===i&&(i="block"),le[r]=i,i)}function fe(e,t){for(var n,r,i=[],o=0,a=e.length;o<a;o++)(r=e[o]).style&&(n=r.style.display,t?("none"===n&&(i[o]=J.get(r,"display")||null,i[o]||(r.style.display="")),""===r.style.display&&ae(r)&&(i[o]=ce(r))):"none"!==n&&(i[o]="none",J.set(r,"display",n)));for(o=0;o<a;o++)null!=i[o]&&(e[o].style.display=i[o]);return e}w.fn.extend({show:function(){return fe(this,!0)},hide:function(){return fe(this)},toggle:function(e){return"boolean"==typeof e?e?this.show():this.hide():this.each(function(){ae(this)?w(this).show():w(this).hide()})}});var pe=/^(?:checkbox|radio)$/i,de=/<([a-z][^\/\0>\x20\t\r\n\f]+)/i,he=/^$|^module$|\/(?:java|ecma)script/i,ge={option:[1,"<select multiple='multiple'>","</select>"],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,"",""]};ge.optgroup=ge.option,ge.tbody=ge.tfoot=ge.colgroup=ge.caption=ge.thead,ge.th=ge.td;function ye(e,t){var n;return n="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&N(e,t)?w.merge([e],n):n}function ve(e,t){for(var n=0,r=e.length;n<r;n++)J.set(e[n],"globalEval",!t||J.get(t[n],"globalEval"))}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"===x(o))w.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]+w.htmlPrefilter(o)+u[2],c=u[0];while(c--)a=a.lastChild;w.merge(p,a.childNodes),(a=f.firstChild).textContent=""}else p.push(t.createTextNode(o));f.textContent="",d=0;while(o=p[d++])if(r&&w.inArray(o,r)>-1)i&&i.push(o);else if(l=w.contains(o.ownerDocument,o),a=ye(f.appendChild(o),"script"),l&&ve(a),n){c=0;while(o=a[c++])he.test(o.type||"")&&n.push(o)}return f}!function(){var e=r.createDocumentFragment().appendChild(r.createElement("div")),t=r.createElement("input");t.setAttribute("type","radio"),t.setAttribute("checked","checked"),t.setAttribute("name","t"),e.appendChild(t),h.checkClone=e.cloneNode(!0).cloneNode(!0).lastChild.checked,e.innerHTML="<textarea>x</textarea>",h.noCloneChecked=!!e.cloneNode(!0).lastChild.defaultValue}();var be=r.documentElement,we=/^key/,Te=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,Ce=/^([^.]*)(?:\.(.+)|)/;function Ee(){return!0}function ke(){return!1}function Se(){try{return r.activeElement}catch(e){}}function De(e,t,n,r,i,o){var a,s;if("object"==typeof t){"string"!=typeof n&&(r=r||n,n=void 0);for(s in t)De(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=ke;else if(!i)return e;return 1===o&&(a=i,(i=function(e){return w().off(e),a.apply(this,arguments)}).guid=a.guid||(a.guid=w.guid++)),e.each(function(){w.event.add(this,t,i,r,n)})}w.event={global:{},add:function(e,t,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,y=J.get(e);if(y){n.handler&&(n=(o=n).handler,i=o.selector),i&&w.find.matchesSelector(be,i),n.guid||(n.guid=w.guid++),(u=y.events)||(u=y.events={}),(a=y.handle)||(a=y.handle=function(t){return"undefined"!=typeof w&&w.event.triggered!==t.type?w.event.dispatch.apply(e,arguments):void 0}),l=(t=(t||"").match(M)||[""]).length;while(l--)d=g=(s=Ce.exec(t[l])||[])[1],h=(s[2]||"").split(".").sort(),d&&(f=w.event.special[d]||{},d=(i?f.delegateType:f.bindType)||d,f=w.event.special[d]||{},c=w.extend({type:d,origType:g,data:r,handler:n,guid:n.guid,selector:i,needsContext:i&&w.expr.match.needsContext.test(i),namespace:h.join(".")},o),(p=u[d])||((p=u[d]=[]).delegateCount=0,f.setup&&!1!==f.setup.call(e,r,h,a)||e.addEventListener&&e.addEventListener(d,a)),f.add&&(f.add.call(e,c),c.handler.guid||(c.handler.guid=n.guid)),i?p.splice(p.delegateCount++,0,c):p.push(c),w.event.global[d]=!0)}},remove:function(e,t,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,y=J.hasData(e)&&J.get(e);if(y&&(u=y.events)){l=(t=(t||"").match(M)||[""]).length;while(l--)if(s=Ce.exec(t[l])||[],d=g=s[1],h=(s[2]||"").split(".").sort(),d){f=w.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,y.handle)||w.removeEvent(e,d,y.handle),delete u[d])}else for(d in u)w.event.remove(e,d+t[l],n,r,!0);w.isEmptyObject(u)&&J.remove(e,"handle events")}},dispatch:function(e){var t=w.event.fix(e),n,r,i,o,a,s,u=new Array(arguments.length),l=(J.get(this,"events")||{})[t.type]||[],c=w.event.special[t.type]||{};for(u[0]=t,n=1;n<arguments.length;n++)u[n]=arguments[n];if(t.delegateTarget=this,!c.preDispatch||!1!==c.preDispatch.call(this,t)){s=w.event.handlers.call(this,t,l),n=0;while((o=s[n++])&&!t.isPropagationStopped()){t.currentTarget=o.elem,r=0;while((a=o.handlers[r++])&&!t.isImmediatePropagationStopped())t.rnamespace&&!t.rnamespace.test(a.namespace)||(t.handleObj=a,t.data=a.data,void 0!==(i=((w.event.special[a.origType]||{}).handle||a.handler).apply(o.elem,u))&&!1===(t.result=i)&&(t.preventDefault(),t.stopPropagation()))}return c.postDispatch&&c.postDispatch.call(this,t),t.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&&e.button>=1))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?w(i,this).index(l)>-1:w.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(e,t){Object.defineProperty(w.Event.prototype,e,{enumerable:!0,configurable:!0,get:g(t)?function(){if(this.originalEvent)return t(this.originalEvent)}:function(){if(this.originalEvent)return this.originalEvent[e]},set:function(t){Object.defineProperty(this,e,{enumerable:!0,configurable:!0,writable:!0,value:t})}})},fix:function(e){return e[w.expando]?e:new w.Event(e)},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==Se()&&this.focus)return this.focus(),!1},delegateType:"focusin"},blur:{trigger:function(){if(this===Se()&&this.blur)return this.blur(),!1},delegateType:"focusout"},click:{trigger:function(){if("checkbox"===this.type&&this.click&&N(this,"input"))return this.click(),!1},_default:function(e){return N(e.target,"a")}},beforeunload:{postDispatch:function(e){void 0!==e.result&&e.originalEvent&&(e.originalEvent.returnValue=e.result)}}}},w.removeEvent=function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n)},w.Event=function(e,t){if(!(this instanceof w.Event))return new w.Event(e,t);e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||void 0===e.defaultPrevented&&!1===e.returnValue?Ee:ke,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&&w.extend(this,t),this.timeStamp=e&&e.timeStamp||Date.now(),this[w.expando]=!0},w.Event.prototype={constructor:w.Event,isDefaultPrevented:ke,isPropagationStopped:ke,isImmediatePropagationStopped:ke,isSimulated:!1,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=Ee,e&&!this.isSimulated&&e.preventDefault()},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=Ee,e&&!this.isSimulated&&e.stopPropagation()},stopImmediatePropagation:function(){var e=this.originalEvent;this.isImmediatePropagationStopped=Ee,e&&!this.isSimulated&&e.stopImmediatePropagation(),this.stopPropagation()}},w.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,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:function(e){var t=e.button;return null==e.which&&we.test(e.type)?null!=e.charCode?e.charCode:e.keyCode:!e.which&&void 0!==t&&Te.test(e.type)?1&t?1:2&t?3:4&t?2:0:e.which}},w.event.addProp),w.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(e,t){w.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=this,i=e.relatedTarget,o=e.handleObj;return i&&(i===r||w.contains(r,i))||(e.type=o.origType,n=o.handler.apply(this,arguments),e.type=t),n}}}),w.fn.extend({on:function(e,t,n,r){return De(this,e,t,n,r)},one:function(e,t,n,r){return De(this,e,t,n,r,1)},off:function(e,t,n){var r,i;if(e&&e.preventDefault&&e.handleObj)return r=e.handleObj,w(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=ke),this.each(function(){w.event.remove(this,e,n,t)})}});var Ne=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,Ae=/<script|<style|<link/i,je=/checked\s*(?:[^=]|=\s*.checked.)/i,qe=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;function Le(e,t){return N(e,"table")&&N(11!==t.nodeType?t:t.firstChild,"tr")?w(e).children("tbody")[0]||e:e}function He(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function Oe(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Pe(e,t){var n,r,i,o,a,s,u,l;if(1===t.nodeType){if(J.hasData(e)&&(o=J.access(e),a=J.set(t,o),l=o.events)){delete a.handle,a.events={};for(i in l)for(n=0,r=l[i].length;n<r;n++)w.event.add(t,i,l[i][n])}K.hasData(e)&&(s=K.access(e),u=w.extend({},s),K.set(t,u))}}function Me(e,t){var n=t.nodeName.toLowerCase();"input"===n&&pe.test(e.type)?t.checked=e.checked:"input"!==n&&"textarea"!==n||(t.defaultValue=e.defaultValue)}function Re(e,t,n,r){t=a.apply([],t);var i,o,s,u,l,c,f=0,p=e.length,d=p-1,y=t[0],v=g(y);if(v||p>1&&"string"==typeof y&&!h.checkClone&&je.test(y))return e.each(function(i){var o=e.eq(i);v&&(t[0]=y.call(this,i,o.html())),Re(o,t,n,r)});if(p&&(i=xe(t,e[0].ownerDocument,!1,e,r),o=i.firstChild,1===i.childNodes.length&&(i=o),o||r)){for(u=(s=w.map(ye(i,"script"),He)).length;f<p;f++)l=i,f!==d&&(l=w.clone(l,!0,!0),u&&w.merge(s,ye(l,"script"))),n.call(e[f],l,f);if(u)for(c=s[s.length-1].ownerDocument,w.map(s,Oe),f=0;f<u;f++)l=s[f],he.test(l.type||"")&&!J.access(l,"globalEval")&&w.contains(c,l)&&(l.src&&"module"!==(l.type||"").toLowerCase()?w._evalUrl&&w._evalUrl(l.src):m(l.textContent.replace(qe,""),c,l))}return e}function Ie(e,t,n){for(var r,i=t?w.filter(t,e):e,o=0;null!=(r=i[o]);o++)n||1!==r.nodeType||w.cleanData(ye(r)),r.parentNode&&(n&&w.contains(r.ownerDocument,r)&&ve(ye(r,"script")),r.parentNode.removeChild(r));return e}w.extend({htmlPrefilter:function(e){return e.replace(Ne,"<$1></$2>")},clone:function(e,t,n){var r,i,o,a,s=e.cloneNode(!0),u=w.contains(e.ownerDocument,e);if(!(h.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||w.isXMLDoc(e)))for(a=ye(s),r=0,i=(o=ye(e)).length;r<i;r++)Me(o[r],a[r]);if(t)if(n)for(o=o||ye(e),a=a||ye(s),r=0,i=o.length;r<i;r++)Pe(o[r],a[r]);else Pe(e,s);return(a=ye(s,"script")).length>0&&ve(a,!u&&ye(e,"script")),s},cleanData:function(e){for(var t,n,r,i=w.event.special,o=0;void 0!==(n=e[o]);o++)if(Y(n)){if(t=n[J.expando]){if(t.events)for(r in t.events)i[r]?w.event.remove(n,r):w.removeEvent(n,r,t.handle);n[J.expando]=void 0}n[K.expando]&&(n[K.expando]=void 0)}}}),w.fn.extend({detach:function(e){return Ie(this,e,!0)},remove:function(e){return Ie(this,e)},text:function(e){return z(this,function(e){return void 0===e?w.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 Re(this,arguments,function(e){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||Le(this,e).appendChild(e)})},prepend:function(){return Re(this,arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=Le(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return Re(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return Re(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&&(w.cleanData(ye(e,!1)),e.textContent="");return this},clone:function(e,t){return e=null!=e&&e,t=null==t?e:t,this.map(function(){return w.clone(this,e,t)})},html:function(e){return z(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&&!Ae.test(e)&&!ge[(de.exec(e)||["",""])[1].toLowerCase()]){e=w.htmlPrefilter(e);try{for(;n<r;n++)1===(t=this[n]||{}).nodeType&&(w.cleanData(ye(t,!1)),t.innerHTML=e);t=0}catch(e){}}t&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(){var e=[];return Re(this,arguments,function(t){var n=this.parentNode;w.inArray(this,e)<0&&(w.cleanData(ye(this)),n&&n.replaceChild(t,this))},e)}}),w.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){w.fn[e]=function(e){for(var n,r=[],i=w(e),o=i.length-1,a=0;a<=o;a++)n=a===o?this:this.clone(!0),w(i[a])[t](n),s.apply(r,n.get());return this.pushStack(r)}});var We=new RegExp("^("+re+")(?!px)[a-z%]+$","i"),$e=function(t){var n=t.ownerDocument.defaultView;return n&&n.opener||(n=e),n.getComputedStyle(t)},Be=new RegExp(oe.join("|"),"i");!function(){function t(){if(c){l.style.cssText="position:absolute;left:-11111px;width:60px;margin-top:1px;padding:0;border:0",c.style.cssText="position:relative;display:block;box-sizing:border-box;overflow:scroll;margin:auto;border:1px;padding:1px;width:60%;top:1%",be.appendChild(l).appendChild(c);var t=e.getComputedStyle(c);i="1%"!==t.top,u=12===n(t.marginLeft),c.style.right="60%",s=36===n(t.right),o=36===n(t.width),c.style.position="absolute",a=36===c.offsetWidth||"absolute",be.removeChild(l),c=null}}function n(e){return Math.round(parseFloat(e))}var i,o,a,s,u,l=r.createElement("div"),c=r.createElement("div");c.style&&(c.style.backgroundClip="content-box",c.cloneNode(!0).style.backgroundClip="",h.clearCloneStyle="content-box"===c.style.backgroundClip,w.extend(h,{boxSizingReliable:function(){return t(),o},pixelBoxStyles:function(){return t(),s},pixelPosition:function(){return t(),i},reliableMarginLeft:function(){return t(),u},scrollboxSize:function(){return t(),a}}))}();function Fe(e,t,n){var r,i,o,a,s=e.style;return(n=n||$e(e))&&(""!==(a=n.getPropertyValue(t)||n[t])||w.contains(e.ownerDocument,e)||(a=w.style(e,t)),!h.pixelBoxStyles()&&We.test(a)&&Be.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 _e(e,t){return{get:function(){if(!e())return(this.get=t).apply(this,arguments);delete this.get}}}var ze=/^(none|table(?!-c[ea]).+)/,Xe=/^--/,Ue={position:"absolute",visibility:"hidden",display:"block"},Ve={letterSpacing:"0",fontWeight:"400"},Ge=["Webkit","Moz","ms"],Ye=r.createElement("div").style;function Qe(e){if(e in Ye)return e;var t=e[0].toUpperCase()+e.slice(1),n=Ge.length;while(n--)if((e=Ge[n]+t)in Ye)return e}function Je(e){var t=w.cssProps[e];return t||(t=w.cssProps[e]=Qe(e)||e),t}function Ke(e,t,n){var r=ie.exec(t);return r?Math.max(0,r[2]-(n||0))+(r[3]||"px"):t}function Ze(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+=w.css(e,n+oe[a],!0,i)),r?("content"===n&&(u-=w.css(e,"padding"+oe[a],!0,i)),"margin"!==n&&(u-=w.css(e,"border"+oe[a]+"Width",!0,i))):(u+=w.css(e,"padding"+oe[a],!0,i),"padding"!==n?u+=w.css(e,"border"+oe[a]+"Width",!0,i):s+=w.css(e,"border"+oe[a]+"Width",!0,i));return!r&&o>=0&&(u+=Math.max(0,Math.ceil(e["offset"+t[0].toUpperCase()+t.slice(1)]-o-u-s-.5))),u}function et(e,t,n){var r=$e(e),i=Fe(e,t,r),o="border-box"===w.css(e,"boxSizing",!1,r),a=o;if(We.test(i)){if(!n)return i;i="auto"}return a=a&&(h.boxSizingReliable()||i===e.style[t]),("auto"===i||!parseFloat(i)&&"inline"===w.css(e,"display",!1,r))&&(i=e["offset"+t[0].toUpperCase()+t.slice(1)],a=!0),(i=parseFloat(i)||0)+Ze(e,t,n||(o?"border":"content"),a,r,i)+"px"}w.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Fe(e,"opacity");return""===n?"1":n}}}},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!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=G(t),u=Xe.test(t),l=e.style;if(u||(t=Je(s)),a=w.cssHooks[t]||w.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=ie.exec(n))&&i[1]&&(n=ue(e,t,i),o="number"),null!=n&&n===n&&("number"===o&&(n+=i&&i[3]||(w.cssNumber[s]?"":"px")),h.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=G(t);return Xe.test(t)||(t=Je(s)),(a=w.cssHooks[t]||w.cssHooks[s])&&"get"in a&&(i=a.get(e,!0,n)),void 0===i&&(i=Fe(e,t,r)),"normal"===i&&t in Ve&&(i=Ve[t]),""===n||n?(o=parseFloat(i),!0===n||isFinite(o)?o||0:i):i}}),w.each(["height","width"],function(e,t){w.cssHooks[t]={get:function(e,n,r){if(n)return!ze.test(w.css(e,"display"))||e.getClientRects().length&&e.getBoundingClientRect().width?et(e,t,r):se(e,Ue,function(){return et(e,t,r)})},set:function(e,n,r){var i,o=$e(e),a="border-box"===w.css(e,"boxSizing",!1,o),s=r&&Ze(e,t,r,a,o);return a&&h.scrollboxSize()===o.position&&(s-=Math.ceil(e["offset"+t[0].toUpperCase()+t.slice(1)]-parseFloat(o[t])-Ze(e,t,"border",!1,o)-.5)),s&&(i=ie.exec(n))&&"px"!==(i[3]||"px")&&(e.style[t]=n,n=w.css(e,t)),Ke(e,n,s)}}}),w.cssHooks.marginLeft=_e(h.reliableMarginLeft,function(e,t){if(t)return(parseFloat(Fe(e,"marginLeft"))||e.getBoundingClientRect().left-se(e,{marginLeft:0},function(){return e.getBoundingClientRect().left}))+"px"}),w.each({margin:"",padding:"",border:"Width"},function(e,t){w.cssHooks[e+t]={expand:function(n){for(var r=0,i={},o="string"==typeof n?n.split(" "):[n];r<4;r++)i[e+oe[r]+t]=o[r]||o[r-2]||o[0];return i}},"margin"!==e&&(w.cssHooks[e+t].set=Ke)}),w.fn.extend({css:function(e,t){return z(this,function(e,t,n){var r,i,o={},a=0;if(Array.isArray(t)){for(r=$e(e),i=t.length;a<i;a++)o[t[a]]=w.css(e,t[a],!1,r);return o}return void 0!==n?w.style(e,t,n):w.css(e,t)},e,t,arguments.length>1)}});function tt(e,t,n,r,i){return new tt.prototype.init(e,t,n,r,i)}w.Tween=tt,tt.prototype={constructor:tt,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||w.easing._default,this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(w.cssNumber[n]?"":"px")},cur:function(){var e=tt.propHooks[this.prop];return e&&e.get?e.get(this):tt.propHooks._default.get(this)},run:function(e){var t,n=tt.propHooks[this.prop];return this.options.duration?this.pos=t=w.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):tt.propHooks._default.set(this),this}},tt.prototype.init.prototype=tt.prototype,tt.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=w.css(e.elem,e.prop,""))&&"auto"!==t?t:0},set:function(e){w.fx.step[e.prop]?w.fx.step[e.prop](e):1!==e.elem.nodeType||null==e.elem.style[w.cssProps[e.prop]]&&!w.cssHooks[e.prop]?e.elem[e.prop]=e.now:w.style(e.elem,e.prop,e.now+e.unit)}}},tt.propHooks.scrollTop=tt.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},w.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2},_default:"swing"},w.fx=tt.prototype.init,w.fx.step={};var nt,rt,it=/^(?:toggle|show|hide)$/,ot=/queueHooks$/;function at(){rt&&(!1===r.hidden&&e.requestAnimationFrame?e.requestAnimationFrame(at):e.setTimeout(at,w.fx.interval),w.fx.tick())}function st(){return e.setTimeout(function(){nt=void 0}),nt=Date.now()}function ut(e,t){var n,r=0,i={height:e};for(t=t?1:0;r<4;r+=2-t)i["margin"+(n=oe[r])]=i["padding"+n]=e;return t&&(i.opacity=i.width=e),i}function lt(e,t,n){for(var r,i=(pt.tweeners[t]||[]).concat(pt.tweeners["*"]),o=0,a=i.length;o<a;o++)if(r=i[o].call(n,t,e))return r}function ct(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),y=J.get(e,"fxshow");n.queue||(null==(a=w._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--,w.queue(e,"fx").length||a.empty.fire()})}));for(r in t)if(i=t[r],it.test(i)){if(delete t[r],o=o||"toggle"===i,i===(g?"hide":"show")){if("show"!==i||!y||void 0===y[r])continue;g=!0}d[r]=y&&y[r]||w.style(e,r)}if((u=!w.isEmptyObject(t))||!w.isEmptyObject(d)){f&&1===e.nodeType&&(n.overflow=[h.overflow,h.overflowX,h.overflowY],null==(l=y&&y.display)&&(l=J.get(e,"display")),"none"===(c=w.css(e,"display"))&&(l?c=l:(fe([e],!0),l=e.style.display||l,c=w.css(e,"display"),fe([e]))),("inline"===c||"inline-block"===c&&null!=l)&&"none"===w.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;for(r in d)u||(y?"hidden"in y&&(g=y.hidden):y=J.access(e,"fxshow",{display:l}),o&&(y.hidden=!g),g&&fe([e],!0),p.done(function(){g||fe([e]),J.remove(e,"fxshow");for(r in d)w.style(e,r,d[r])})),u=lt(g?y[r]:0,r,p),r in y||(y[r]=u.start,g&&(u.end=u.start,u.start=0))}}function ft(e,t){var n,r,i,o,a;for(n in e)if(r=G(n),i=t[r],o=e[n],Array.isArray(o)&&(i=o[1],o=e[n]=o[0]),n!==r&&(e[r]=o,delete e[n]),(a=w.cssHooks[r])&&"expand"in a){o=a.expand(o),delete e[r];for(n in o)n in e||(e[n]=o[n],t[n]=i)}else t[r]=i}function pt(e,t,n){var r,i,o=0,a=pt.prefilters.length,s=w.Deferred().always(function(){delete u.elem}),u=function(){if(i)return!1;for(var t=nt||st(),n=Math.max(0,l.startTime+l.duration-t),r=1-(n/l.duration||0),o=0,a=l.tweens.length;o<a;o++)l.tweens[o].run(r);return s.notifyWith(e,[l,r,n]),r<1&&a?n:(a||s.notifyWith(e,[l,1,0]),s.resolveWith(e,[l]),!1)},l=s.promise({elem:e,props:w.extend({},t),opts:w.extend(!0,{specialEasing:{},easing:w.easing._default},n),originalProperties:t,originalOptions:n,startTime:nt||st(),duration:n.duration,tweens:[],createTween:function(t,n){var r=w.Tween(e,l.opts,t,n,l.opts.specialEasing[t]||l.opts.easing);return l.tweens.push(r),r},stop:function(t){var n=0,r=t?l.tweens.length:0;if(i)return this;for(i=!0;n<r;n++)l.tweens[n].run(1);return t?(s.notifyWith(e,[l,1,0]),s.resolveWith(e,[l,t])):s.rejectWith(e,[l,t]),this}}),c=l.props;for(ft(c,l.opts.specialEasing);o<a;o++)if(r=pt.prefilters[o].call(l,e,c,l.opts))return g(r.stop)&&(w._queueHooks(l.elem,l.opts.queue).stop=r.stop.bind(r)),r;return w.map(c,lt,l),g(l.opts.start)&&l.opts.start.call(e,l),l.progress(l.opts.progress).done(l.opts.done,l.opts.complete).fail(l.opts.fail).always(l.opts.always),w.fx.timer(w.extend(u,{elem:e,anim:l,queue:l.opts.queue})),l}w.Animation=w.extend(pt,{tweeners:{"*":[function(e,t){var n=this.createTween(e,t);return ue(n.elem,e,ie.exec(t),n),n}]},tweener:function(e,t){g(e)?(t=e,e=["*"]):e=e.match(M);for(var n,r=0,i=e.length;r<i;r++)n=e[r],pt.tweeners[n]=pt.tweeners[n]||[],pt.tweeners[n].unshift(t)},prefilters:[ct],prefilter:function(e,t){t?pt.prefilters.unshift(e):pt.prefilters.push(e)}}),w.speed=function(e,t,n){var r=e&&"object"==typeof e?w.extend({},e):{complete:n||!n&&t||g(e)&&e,duration:e,easing:n&&t||t&&!g(t)&&t};return w.fx.off?r.duration=0:"number"!=typeof r.duration&&(r.duration in w.fx.speeds?r.duration=w.fx.speeds[r.duration]:r.duration=w.fx.speeds._default),null!=r.queue&&!0!==r.queue||(r.queue="fx"),r.old=r.complete,r.complete=function(){g(r.old)&&r.old.call(this),r.queue&&w.dequeue(this,r.queue)},r},w.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(e,t,n,r){var i=w.isEmptyObject(e),o=w.speed(t,n,r),a=function(){var t=pt(this,w.extend({},e),o);(i||J.get(this,"finish"))&&t.stop(!0)};return a.finish=a,i||!1===o.queue?this.each(a):this.queue(o.queue,a)},stop:function(e,t,n){var r=function(e){var t=e.stop;delete e.stop,t(n)};return"string"!=typeof e&&(n=t,t=e,e=void 0),t&&!1!==e&&this.queue(e||"fx",[]),this.each(function(){var t=!0,i=null!=e&&e+"queueHooks",o=w.timers,a=J.get(this);if(i)a[i]&&a[i].stop&&r(a[i]);else for(i in a)a[i]&&a[i].stop&&ot.test(i)&&r(a[i]);for(i=o.length;i--;)o[i].elem!==this||null!=e&&o[i].queue!==e||(o[i].anim.stop(n),t=!1,o.splice(i,1));!t&&n||w.dequeue(this,e)})},finish:function(e){return!1!==e&&(e=e||"fx"),this.each(function(){var t,n=J.get(this),r=n[e+"queue"],i=n[e+"queueHooks"],o=w.timers,a=r?r.length:0;for(n.finish=!0,w.queue(this,e,[]),i&&i.stop&&i.stop.call(this,!0),t=o.length;t--;)o[t].elem===this&&o[t].queue===e&&(o[t].anim.stop(!0),o.splice(t,1));for(t=0;t<a;t++)r[t]&&r[t].finish&&r[t].finish.call(this);delete n.finish})}}),w.each(["toggle","show","hide"],function(e,t){var n=w.fn[t];w.fn[t]=function(e,r,i){return null==e||"boolean"==typeof e?n.apply(this,arguments):this.animate(ut(t,!0),e,r,i)}}),w.each({slideDown:ut("show"),slideUp:ut("hide"),slideToggle:ut("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){w.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),w.timers=[],w.fx.tick=function(){var e,t=0,n=w.timers;for(nt=Date.now();t<n.length;t++)(e=n[t])()||n[t]!==e||n.splice(t--,1);n.length||w.fx.stop(),nt=void 0},w.fx.timer=function(e){w.timers.push(e),w.fx.start()},w.fx.interval=13,w.fx.start=function(){rt||(rt=!0,at())},w.fx.stop=function(){rt=null},w.fx.speeds={slow:600,fast:200,_default:400},w.fn.delay=function(t,n){return t=w.fx?w.fx.speeds[t]||t:t,n=n||"fx",this.queue(n,function(n,r){var i=e.setTimeout(n,t);r.stop=function(){e.clearTimeout(i)}})},function(){var e=r.createElement("input"),t=r.createElement("select").appendChild(r.createElement("option"));e.type="checkbox",h.checkOn=""!==e.value,h.optSelected=t.selected,(e=r.createElement("input")).value="t",e.type="radio",h.radioValue="t"===e.value}();var dt,ht=w.expr.attrHandle;w.fn.extend({attr:function(e,t){return z(this,w.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){w.removeAttr(this,e)})}}),w.extend({attr:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return"undefined"==typeof e.getAttribute?w.prop(e,t,n):(1===o&&w.isXMLDoc(e)||(i=w.attrHooks[t.toLowerCase()]||(w.expr.match.bool.test(t)?dt:void 0)),void 0!==n?null===n?void w.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=w.find.attr(e,t))?void 0:r)},attrHooks:{type:{set:function(e,t){if(!h.radioValue&&"radio"===t&&N(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(M);if(i&&1===e.nodeType)while(n=i[r++])e.removeAttribute(n)}}),dt={set:function(e,t,n){return!1===t?w.removeAttr(e,n):e.setAttribute(n,n),n}},w.each(w.expr.match.bool.source.match(/\w+/g),function(e,t){var n=ht[t]||w.find.attr;ht[t]=function(e,t,r){var i,o,a=t.toLowerCase();return r||(o=ht[a],ht[a]=i,i=null!=n(e,t,r)?a:null,ht[a]=o),i}});var gt=/^(?:input|select|textarea|button)$/i,yt=/^(?:a|area)$/i;w.fn.extend({prop:function(e,t){return z(this,w.prop,e,t,arguments.length>1)},removeProp:function(e){return this.each(function(){delete this[w.propFix[e]||e]})}}),w.extend({prop:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return 1===o&&w.isXMLDoc(e)||(t=w.propFix[t]||t,i=w.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=w.find.attr(e,"tabindex");return t?parseInt(t,10):gt.test(e.nodeName)||yt.test(e.nodeName)&&e.href?0:-1}}},propFix:{"for":"htmlFor","class":"className"}}),h.optSelected||(w.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)}}),w.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){w.propFix[this.toLowerCase()]=this});function vt(e){return(e.match(M)||[]).join(" ")}function mt(e){return e.getAttribute&&e.getAttribute("class")||""}function xt(e){return Array.isArray(e)?e:"string"==typeof e?e.match(M)||[]:[]}w.fn.extend({addClass:function(e){var t,n,r,i,o,a,s,u=0;if(g(e))return this.each(function(t){w(this).addClass(e.call(this,t,mt(this)))});if((t=xt(e)).length)while(n=this[u++])if(i=mt(n),r=1===n.nodeType&&" "+vt(i)+" "){a=0;while(o=t[a++])r.indexOf(" "+o+" ")<0&&(r+=o+" ");i!==(s=vt(r))&&n.setAttribute("class",s)}return this},removeClass:function(e){var t,n,r,i,o,a,s,u=0;if(g(e))return this.each(function(t){w(this).removeClass(e.call(this,t,mt(this)))});if(!arguments.length)return this.attr("class","");if((t=xt(e)).length)while(n=this[u++])if(i=mt(n),r=1===n.nodeType&&" "+vt(i)+" "){a=0;while(o=t[a++])while(r.indexOf(" "+o+" ")>-1)r=r.replace(" "+o+" "," ");i!==(s=vt(r))&&n.setAttribute("class",s)}return this},toggleClass:function(e,t){var n=typeof e,r="string"===n||Array.isArray(e);return"boolean"==typeof t&&r?t?this.addClass(e):this.removeClass(e):g(e)?this.each(function(n){w(this).toggleClass(e.call(this,n,mt(this),t),t)}):this.each(function(){var t,i,o,a;if(r){i=0,o=w(this),a=xt(e);while(t=a[i++])o.hasClass(t)?o.removeClass(t):o.addClass(t)}else void 0!==e&&"boolean"!==n||((t=mt(this))&&J.set(this,"__className__",t),this.setAttribute&&this.setAttribute("class",t||!1===e?"":J.get(this,"__className__")||""))})},hasClass:function(e){var t,n,r=0;t=" "+e+" ";while(n=this[r++])if(1===n.nodeType&&(" "+vt(mt(n))+" ").indexOf(t)>-1)return!0;return!1}});var bt=/\r/g;w.fn.extend({val:function(e){var t,n,r,i=this[0];{if(arguments.length)return r=g(e),this.each(function(n){var i;1===this.nodeType&&(null==(i=r?e.call(this,n,w(this).val()):e)?i="":"number"==typeof i?i+="":Array.isArray(i)&&(i=w.map(i,function(e){return null==e?"":e+""})),(t=w.valHooks[this.type]||w.valHooks[this.nodeName.toLowerCase()])&&"set"in t&&void 0!==t.set(this,i,"value")||(this.value=i))});if(i)return(t=w.valHooks[i.type]||w.valHooks[i.nodeName.toLowerCase()])&&"get"in t&&void 0!==(n=t.get(i,"value"))?n:"string"==typeof(n=i.value)?n.replace(bt,""):null==n?"":n}}}),w.extend({valHooks:{option:{get:function(e){var t=w.find.attr(e,"value");return null!=t?t:vt(w.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||!N(n.parentNode,"optgroup"))){if(t=w(n).val(),a)return t;s.push(t)}return s},set:function(e,t){var n,r,i=e.options,o=w.makeArray(t),a=i.length;while(a--)((r=i[a]).selected=w.inArray(w.valHooks.option.get(r),o)>-1)&&(n=!0);return n||(e.selectedIndex=-1),o}}}}),w.each(["radio","checkbox"],function(){w.valHooks[this]={set:function(e,t){if(Array.isArray(t))return e.checked=w.inArray(w(e).val(),t)>-1}},h.checkOn||(w.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})}),h.focusin="onfocusin"in e;var wt=/^(?:focusinfocus|focusoutblur)$/,Tt=function(e){e.stopPropagation()};w.extend(w.event,{trigger:function(t,n,i,o){var a,s,u,l,c,p,d,h,v=[i||r],m=f.call(t,"type")?t.type:t,x=f.call(t,"namespace")?t.namespace.split("."):[];if(s=h=u=i=i||r,3!==i.nodeType&&8!==i.nodeType&&!wt.test(m+w.event.triggered)&&(m.indexOf(".")>-1&&(m=(x=m.split(".")).shift(),x.sort()),c=m.indexOf(":")<0&&"on"+m,t=t[w.expando]?t:new w.Event(m,"object"==typeof t&&t),t.isTrigger=o?2:3,t.namespace=x.join("."),t.rnamespace=t.namespace?new RegExp("(^|\\.)"+x.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,t.result=void 0,t.target||(t.target=i),n=null==n?[t]:w.makeArray(n,[t]),d=w.event.special[m]||{},o||!d.trigger||!1!==d.trigger.apply(i,n))){if(!o&&!d.noBubble&&!y(i)){for(l=d.delegateType||m,wt.test(l+m)||(s=s.parentNode);s;s=s.parentNode)v.push(s),u=s;u===(i.ownerDocument||r)&&v.push(u.defaultView||u.parentWindow||e)}a=0;while((s=v[a++])&&!t.isPropagationStopped())h=s,t.type=a>1?l:d.bindType||m,(p=(J.get(s,"events")||{})[t.type]&&J.get(s,"handle"))&&p.apply(s,n),(p=c&&s[c])&&p.apply&&Y(s)&&(t.result=p.apply(s,n),!1===t.result&&t.preventDefault());return t.type=m,o||t.isDefaultPrevented()||d._default&&!1!==d._default.apply(v.pop(),n)||!Y(i)||c&&g(i[m])&&!y(i)&&((u=i[c])&&(i[c]=null),w.event.triggered=m,t.isPropagationStopped()&&h.addEventListener(m,Tt),i[m](),t.isPropagationStopped()&&h.removeEventListener(m,Tt),w.event.triggered=void 0,u&&(i[c]=u)),t.result}},simulate:function(e,t,n){var r=w.extend(new w.Event,n,{type:e,isSimulated:!0});w.event.trigger(r,null,t)}}),w.fn.extend({trigger:function(e,t){return this.each(function(){w.event.trigger(e,t,this)})},triggerHandler:function(e,t){var n=this[0];if(n)return w.event.trigger(e,t,n,!0)}}),h.focusin||w.each({focus:"focusin",blur:"focusout"},function(e,t){var n=function(e){w.event.simulate(t,e.target,w.event.fix(e))};w.event.special[t]={setup:function(){var r=this.ownerDocument||this,i=J.access(r,t);i||r.addEventListener(e,n,!0),J.access(r,t,(i||0)+1)},teardown:function(){var r=this.ownerDocument||this,i=J.access(r,t)-1;i?J.access(r,t,i):(r.removeEventListener(e,n,!0),J.remove(r,t))}}});var Ct=e.location,Et=Date.now(),kt=/\?/;w.parseXML=function(t){var n;if(!t||"string"!=typeof t)return null;try{n=(new e.DOMParser).parseFromString(t,"text/xml")}catch(e){n=void 0}return n&&!n.getElementsByTagName("parsererror").length||w.error("Invalid XML: "+t),n};var St=/\[\]$/,Dt=/\r?\n/g,Nt=/^(?:submit|button|image|reset|file)$/i,At=/^(?:input|select|textarea|keygen)/i;function jt(e,t,n,r){var i;if(Array.isArray(t))w.each(t,function(t,i){n||St.test(e)?r(e,i):jt(e+"["+("object"==typeof i&&null!=i?t:"")+"]",i,n,r)});else if(n||"object"!==x(t))r(e,t);else for(i in t)jt(e+"["+i+"]",t[i],n,r)}w.param=function(e,t){var n,r=[],i=function(e,t){var n=g(t)?t():t;r[r.length]=encodeURIComponent(e)+"="+encodeURIComponent(null==n?"":n)};if(Array.isArray(e)||e.jquery&&!w.isPlainObject(e))w.each(e,function(){i(this.name,this.value)});else for(n in e)jt(n,e[n],t,i);return r.join("&")},w.fn.extend({serialize:function(){return w.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=w.prop(this,"elements");return e?w.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!w(this).is(":disabled")&&At.test(this.nodeName)&&!Nt.test(e)&&(this.checked||!pe.test(e))}).map(function(e,t){var n=w(this).val();return null==n?null:Array.isArray(n)?w.map(n,function(e){return{name:t.name,value:e.replace(Dt,"\r\n")}}):{name:t.name,value:n.replace(Dt,"\r\n")}}).get()}});var qt=/%20/g,Lt=/#.*$/,Ht=/([?&])_=[^&]*/,Ot=/^(.*?):[ \t]*([^\r\n]*)$/gm,Pt=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Mt=/^(?:GET|HEAD)$/,Rt=/^\/\//,It={},Wt={},$t="*/".concat("*"),Bt=r.createElement("a");Bt.href=Ct.href;function Ft(e){return function(t,n){"string"!=typeof t&&(n=t,t="*");var r,i=0,o=t.toLowerCase().match(M)||[];if(g(n))while(r=o[i++])"+"===r[0]?(r=r.slice(1)||"*",(e[r]=e[r]||[]).unshift(n)):(e[r]=e[r]||[]).push(n)}}function _t(e,t,n,r){var i={},o=e===Wt;function a(s){var u;return i[s]=!0,w.each(e[s]||[],function(e,s){var l=s(t,n,r);return"string"!=typeof l||o||i[l]?o?!(u=l):void 0:(t.dataTypes.unshift(l),a(l),!1)}),u}return a(t.dataTypes[0])||!i["*"]&&a("*")}function zt(e,t){var n,r,i=w.ajaxSettings.flatOptions||{};for(n in t)void 0!==t[n]&&((i[n]?e:r||(r={}))[n]=t[n]);return r&&w.extend(!0,e,r),e}function Xt(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]}function Ut(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}}w.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:Ct.href,type:"GET",isLocal:Pt.test(Ct.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":$t,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":w.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?zt(zt(e,w.ajaxSettings),t):zt(w.ajaxSettings,e)},ajaxPrefilter:Ft(It),ajaxTransport:Ft(Wt),ajax:function(t,n){"object"==typeof t&&(n=t,t=void 0),n=n||{};var i,o,a,s,u,l,c,f,p,d,h=w.ajaxSetup({},n),g=h.context||h,y=h.context&&(g.nodeType||g.jquery)?w(g):w.event,v=w.Deferred(),m=w.Callbacks("once memory"),x=h.statusCode||{},b={},T={},C="canceled",E={readyState:0,getResponseHeader:function(e){var t;if(c){if(!s){s={};while(t=Ot.exec(a))s[t[1].toLowerCase()]=t[2]}t=s[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return c?a:null},setRequestHeader:function(e,t){return null==c&&(e=T[e.toLowerCase()]=T[e.toLowerCase()]||e,b[e]=t),this},overrideMimeType:function(e){return null==c&&(h.mimeType=e),this},statusCode:function(e){var t;if(e)if(c)E.always(e[E.status]);else for(t in e)x[t]=[x[t],e[t]];return this},abort:function(e){var t=e||C;return i&&i.abort(t),k(0,t),this}};if(v.promise(E),h.url=((t||h.url||Ct.href)+"").replace(Rt,Ct.protocol+"//"),h.type=n.method||n.type||h.method||h.type,h.dataTypes=(h.dataType||"*").toLowerCase().match(M)||[""],null==h.crossDomain){l=r.createElement("a");try{l.href=h.url,l.href=l.href,h.crossDomain=Bt.protocol+"//"+Bt.host!=l.protocol+"//"+l.host}catch(e){h.crossDomain=!0}}if(h.data&&h.processData&&"string"!=typeof h.data&&(h.data=w.param(h.data,h.traditional)),_t(It,h,n,E),c)return E;(f=w.event&&h.global)&&0==w.active++&&w.event.trigger("ajaxStart"),h.type=h.type.toUpperCase(),h.hasContent=!Mt.test(h.type),o=h.url.replace(Lt,""),h.hasContent?h.data&&h.processData&&0===(h.contentType||"").indexOf("application/x-www-form-urlencoded")&&(h.data=h.data.replace(qt,"+")):(d=h.url.slice(o.length),h.data&&(h.processData||"string"==typeof h.data)&&(o+=(kt.test(o)?"&":"?")+h.data,delete h.data),!1===h.cache&&(o=o.replace(Ht,"$1"),d=(kt.test(o)?"&":"?")+"_="+Et+++d),h.url=o+d),h.ifModified&&(w.lastModified[o]&&E.setRequestHeader("If-Modified-Since",w.lastModified[o]),w.etag[o]&&E.setRequestHeader("If-None-Match",w.etag[o])),(h.data&&h.hasContent&&!1!==h.contentType||n.contentType)&&E.setRequestHeader("Content-Type",h.contentType),E.setRequestHeader("Accept",h.dataTypes[0]&&h.accepts[h.dataTypes[0]]?h.accepts[h.dataTypes[0]]+("*"!==h.dataTypes[0]?", "+$t+"; q=0.01":""):h.accepts["*"]);for(p in h.headers)E.setRequestHeader(p,h.headers[p]);if(h.beforeSend&&(!1===h.beforeSend.call(g,E,h)||c))return E.abort();if(C="abort",m.add(h.complete),E.done(h.success),E.fail(h.error),i=_t(Wt,h,n,E)){if(E.readyState=1,f&&y.trigger("ajaxSend",[E,h]),c)return E;h.async&&h.timeout>0&&(u=e.setTimeout(function(){E.abort("timeout")},h.timeout));try{c=!1,i.send(b,k)}catch(e){if(c)throw e;k(-1,e)}}else k(-1,"No Transport");function k(t,n,r,s){var l,p,d,b,T,C=n;c||(c=!0,u&&e.clearTimeout(u),i=void 0,a=s||"",E.readyState=t>0?4:0,l=t>=200&&t<300||304===t,r&&(b=Xt(h,E,r)),b=Ut(h,b,E,l),l?(h.ifModified&&((T=E.getResponseHeader("Last-Modified"))&&(w.lastModified[o]=T),(T=E.getResponseHeader("etag"))&&(w.etag[o]=T)),204===t||"HEAD"===h.type?C="nocontent":304===t?C="notmodified":(C=b.state,p=b.data,l=!(d=b.error))):(d=C,!t&&C||(C="error",t<0&&(t=0))),E.status=t,E.statusText=(n||C)+"",l?v.resolveWith(g,[p,C,E]):v.rejectWith(g,[E,C,d]),E.statusCode(x),x=void 0,f&&y.trigger(l?"ajaxSuccess":"ajaxError",[E,h,l?p:d]),m.fireWith(g,[E,C]),f&&(y.trigger("ajaxComplete",[E,h]),--w.active||w.event.trigger("ajaxStop")))}return E},getJSON:function(e,t,n){return w.get(e,t,n,"json")},getScript:function(e,t){return w.get(e,void 0,t,"script")}}),w.each(["get","post"],function(e,t){w[t]=function(e,n,r,i){return g(n)&&(i=i||r,r=n,n=void 0),w.ajax(w.extend({url:e,type:t,dataType:i,data:n,success:r},w.isPlainObject(e)&&e))}}),w._evalUrl=function(e){return w.ajax({url:e,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,"throws":!0})},w.fn.extend({wrapAll:function(e){var t;return this[0]&&(g(e)&&(e=e.call(this[0])),t=w(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(e){return g(e)?this.each(function(t){w(this).wrapInner(e.call(this,t))}):this.each(function(){var t=w(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=g(e);return this.each(function(n){w(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(e){return this.parent(e).not("body").each(function(){w(this).replaceWith(this.childNodes)}),this}}),w.expr.pseudos.hidden=function(e){return!w.expr.pseudos.visible(e)},w.expr.pseudos.visible=function(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)},w.ajaxSettings.xhr=function(){try{return new e.XMLHttpRequest}catch(e){}};var Vt={0:200,1223:204},Gt=w.ajaxSettings.xhr();h.cors=!!Gt&&"withCredentials"in Gt,h.ajax=Gt=!!Gt,w.ajaxTransport(function(t){var n,r;if(h.cors||Gt&&!t.crossDomain)return{send:function(i,o){var a,s=t.xhr();if(s.open(t.type,t.url,t.async,t.username,t.password),t.xhrFields)for(a in t.xhrFields)s[a]=t.xhrFields[a];t.mimeType&&s.overrideMimeType&&s.overrideMimeType(t.mimeType),t.crossDomain||i["X-Requested-With"]||(i["X-Requested-With"]="XMLHttpRequest");for(a in i)s.setRequestHeader(a,i[a]);n=function(e){return function(){n&&(n=r=s.onload=s.onerror=s.onabort=s.ontimeout=s.onreadystatechange=null,"abort"===e?s.abort():"error"===e?"number"!=typeof s.status?o(0,"error"):o(s.status,s.statusText):o(Vt[s.status]||s.status,s.statusText,"text"!==(s.responseType||"text")||"string"!=typeof s.responseText?{binary:s.response}:{text:s.responseText},s.getAllResponseHeaders()))}},s.onload=n(),r=s.onerror=s.ontimeout=n("error"),void 0!==s.onabort?s.onabort=r:s.onreadystatechange=function(){4===s.readyState&&e.setTimeout(function(){n&&r()})},n=n("abort");try{s.send(t.hasContent&&t.data||null)}catch(e){if(n)throw e}},abort:function(){n&&n()}}}),w.ajaxPrefilter(function(e){e.crossDomain&&(e.contents.script=!1)}),w.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 w.globalEval(e),e}}}),w.ajaxPrefilter("script",function(e){void 0===e.cache&&(e.cache=!1),e.crossDomain&&(e.type="GET")}),w.ajaxTransport("script",function(e){if(e.crossDomain){var t,n;return{send:function(i,o){t=w("<script>").prop({charset:e.scriptCharset,src:e.url}).on("load error",n=function(e){t.remove(),n=null,e&&o("error"===e.type?404:200,e.type)}),r.head.appendChild(t[0])},abort:function(){n&&n()}}}});var Yt=[],Qt=/(=)\?(?=&|$)|\?\?/;w.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Yt.pop()||w.expando+"_"+Et++;return this[e]=!0,e}}),w.ajaxPrefilter("json jsonp",function(t,n,r){var i,o,a,s=!1!==t.jsonp&&(Qt.test(t.url)?"url":"string"==typeof t.data&&0===(t.contentType||"").indexOf("application/x-www-form-urlencoded")&&Qt.test(t.data)&&"data");if(s||"jsonp"===t.dataTypes[0])return i=t.jsonpCallback=g(t.jsonpCallback)?t.jsonpCallback():t.jsonpCallback,s?t[s]=t[s].replace(Qt,"$1"+i):!1!==t.jsonp&&(t.url+=(kt.test(t.url)?"&":"?")+t.jsonp+"="+i),t.converters["script json"]=function(){return a||w.error(i+" was not called"),a[0]},t.dataTypes[0]="json",o=e[i],e[i]=function(){a=arguments},r.always(function(){void 0===o?w(e).removeProp(i):e[i]=o,t[i]&&(t.jsonpCallback=n.jsonpCallback,Yt.push(i)),a&&g(o)&&o(a[0]),a=o=void 0}),"script"}),h.createHTMLDocument=function(){var e=r.implementation.createHTMLDocument("").body;return e.innerHTML="<form></form><form></form>",2===e.childNodes.length}(),w.parseHTML=function(e,t,n){if("string"!=typeof e)return[];"boolean"==typeof t&&(n=t,t=!1);var i,o,a;return t||(h.createHTMLDocument?((i=(t=r.implementation.createHTMLDocument("")).createElement("base")).href=r.location.href,t.head.appendChild(i)):t=r),o=A.exec(e),a=!n&&[],o?[t.createElement(o[1])]:(o=xe([e],t,a),a&&a.length&&w(a).remove(),w.merge([],o.childNodes))},w.fn.load=function(e,t,n){var r,i,o,a=this,s=e.indexOf(" ");return s>-1&&(r=vt(e.slice(s)),e=e.slice(0,s)),g(t)?(n=t,t=void 0):t&&"object"==typeof t&&(i="POST"),a.length>0&&w.ajax({url:e,type:i||"GET",dataType:"html",data:t}).done(function(e){o=arguments,a.html(r?w("<div>").append(w.parseHTML(e)).find(r):e)}).always(n&&function(e,t){a.each(function(){n.apply(this,o||[e.responseText,t,e])})}),this},w.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){w.fn[t]=function(e){return this.on(t,e)}}),w.expr.pseudos.animated=function(e){return w.grep(w.timers,function(t){return e===t.elem}).length},w.offset={setOffset:function(e,t,n){var r,i,o,a,s,u,l,c=w.css(e,"position"),f=w(e),p={};"static"===c&&(e.style.position="relative"),s=f.offset(),o=w.css(e,"top"),u=w.css(e,"left"),(l=("absolute"===c||"fixed"===c)&&(o+u).indexOf("auto")>-1)?(a=(r=f.position()).top,i=r.left):(a=parseFloat(o)||0,i=parseFloat(u)||0),g(t)&&(t=t.call(e,n,w.extend({},s))),null!=t.top&&(p.top=t.top-s.top+a),null!=t.left&&(p.left=t.left-s.left+i),"using"in t?t.using.call(e,p):f.css(p)}},w.fn.extend({offset:function(e){if(arguments.length)return void 0===e?this:this.each(function(t){w.offset.setOffset(this,e,t)});var t,n,r=this[0];if(r)return r.getClientRects().length?(t=r.getBoundingClientRect(),n=r.ownerDocument.defaultView,{top:t.top+n.pageYOffset,left:t.left+n.pageXOffset}):{top:0,left:0}},position:function(){if(this[0]){var e,t,n,r=this[0],i={top:0,left:0};if("fixed"===w.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"===w.css(e,"position"))e=e.parentNode;e&&e!==r&&1===e.nodeType&&((i=w(e).offset()).top+=w.css(e,"borderTopWidth",!0),i.left+=w.css(e,"borderLeftWidth",!0))}return{top:t.top-i.top-w.css(r,"marginTop",!0),left:t.left-i.left-w.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent;while(e&&"static"===w.css(e,"position"))e=e.offsetParent;return e||be})}}),w.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,t){var n="pageYOffset"===t;w.fn[e]=function(r){return z(this,function(e,r,i){var o;if(y(e)?o=e:9===e.nodeType&&(o=e.defaultView),void 0===i)return o?o[t]:e[r];o?o.scrollTo(n?o.pageXOffset:i,n?i:o.pageYOffset):e[r]=i},e,r,arguments.length)}}),w.each(["top","left"],function(e,t){w.cssHooks[t]=_e(h.pixelPosition,function(e,n){if(n)return n=Fe(e,t),We.test(n)?w(e).position()[t]+"px":n})}),w.each({Height:"height",Width:"width"},function(e,t){w.each({padding:"inner"+e,content:t,"":"outer"+e},function(n,r){w.fn[r]=function(i,o){var a=arguments.length&&(n||"boolean"!=typeof i),s=n||(!0===i||!0===o?"margin":"border");return z(this,function(t,n,i){var o;return y(t)?0===r.indexOf("outer")?t["inner"+e]:t.document.documentElement["client"+e]:9===t.nodeType?(o=t.documentElement,Math.max(t.body["scroll"+e],o["scroll"+e],t.body["offset"+e],o["offset"+e],o["client"+e])):void 0===i?w.css(t,n,s):w.style(t,n,i,s)},t,a?i:void 0,a)}})}),w.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,t){w.fn[t]=function(e,n){return arguments.length>0?this.on(t,null,e,n):this.trigger(t)}}),w.fn.extend({hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),w.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)}}),w.proxy=function(e,t){var n,r,i;if("string"==typeof t&&(n=e[t],t=e,e=n),g(e))return r=o.call(arguments,2),i=function(){return e.apply(t||this,r.concat(o.call(arguments)))},i.guid=e.guid=e.guid||w.guid++,i},w.holdReady=function(e){e?w.readyWait++:w.ready(!0)},w.isArray=Array.isArray,w.parseJSON=JSON.parse,w.nodeName=N,w.isFunction=g,w.isWindow=y,w.camelCase=G,w.type=x,w.now=Date.now,w.isNumeric=function(e){var t=w.type(e);return("number"===t||"string"===t)&&!isNaN(e-parseFloat(e))},"function"==typeof define&&define.amd&&define("jquery",[],function(){return w});var Jt=e.jQuery,Kt=e.$;return w.noConflict=function(t){return e.$===w&&(e.$=Kt),t&&e.jQuery===w&&(e.jQuery=Jt),w},t||(e.jQuery=e.$=w),w});
vendor: 6,134 bytes, lines 10-20
10
11
12/* End Include jquery-3.3.1.min */
13
14/* Include jquery-ui-1.12.1.min */
15/*! jQuery UI - v1.12.1 - 2016-09-14
16* http://jqueryui.com
17* Includes: widget.js, position.js, data.js, disable-selection.js, effect.js, effects/effect-blind.js, effects/effect-bounce.js, effects/effect-clip.js, effects/effect-drop.js, effects/effect-explode.js, effects/effect-fade.js, effects/effect-fold.js, effects/effect-highlight.js, effects/effect-puff.js, effects/effect-pulsate.js, effects/effect-scale.js, effects/effect-shake.js, effects/effect-size.js, effects/effect-slide.js, effects/effect-transfer.js, focusable.js, form-reset-mixin.js, jquery-1-7.js, keycode.js, labels.js, scroll-parent.js, tabbable.js, unique-id.js, widgets/accordion.js, widgets/autocomplete.js, widgets/button.js, widgets/checkboxradio.js, widgets/controlgroup.js, widgets/datepicker.js, widgets/dialog.js, widgets/draggable.js, widgets/droppable.js, widgets/menu.js, widgets/mouse.js, widgets/progressbar.js, widgets/resizable.js, widgets/selectable.js, widgets/selectmenu.js, widgets/slider.js, widgets/sortable.js, widgets/spinner.js, widgets/tabs.js, widgets/tooltip.js
18* Copyright jQuery Foundation and other contributors; Licensed MIT */
19
20(function(t){"function"==typeof define&&define.amd?define(["jquery"],t):t(jQuery)})(function(t){function e(t){for(var e=t.css("visibility");"inherit"===e;)t=t.parent(),e=t.css("visibility");return"hidden"!==e}function i(t){for(var e,i;t.length&&t[0]!==document;){if(e=t.css("position"),("absolute"===e||"relative"===e||"fixed"===e)&&(i=parseInt(t.css("zIndex"),10),!isNaN(i)&&0!==i))return i;t=t.parent()}return 0}function s(){this._curInst=null,this._keyEvent=!1,this._disabledInputs=[],this._datepickerShowing=!1,this._inDialog=!1,this._mainDivId="ui-datepicker-div",this._inlineClass="ui-datepicker-inline",this._appendClass="ui-datepicker-append",this._triggerClass="ui-datepicker-trigger",this._dialogClass="ui-datepicker-dialog",this._disableClass="ui-datepicker-disabled",this._unselectableClass="ui-datepicker-unselectable",this._currentClass="ui-datepicker-current-day",this._dayOverClass="ui-datepicker-days-cell-over",this.regional=[],this.regional[""]={closeText:"Done",prevText:"Prev",nextText:"Next",currentText:"Today",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],weekHeader:"Wk",dateFormat:"mm/dd/yy",firstDay:0,isRTL:!1,showMonthAfterYear:!1,yearSuffix:""},this._defaults={showOn:"focus",showAnim:"fadeIn",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:!1,hideIfNoPrevNext:!1,navigationAsDateFormat:!1,gotoCurrent:!1,changeMonth:!1,changeYear:!1,yearRange:"c-10:c+10",showOtherMonths:!1,selectOtherMonths:!1,showWeek:!1,calculateWeek:this.iso8601Week,shortYearCutoff:"+10",minDate:null,maxDate:null,duration:"fast",beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:"",altFormat:"",constrainInput:!0,showButtonPanel:!1,autoSize:!1,disabled:!1},t.extend(this._defaults,this.regional[""]),this.regional.en=t.extend(!0,{},this.regional[""]),this.regional["en-US"]=t.extend(!0,{},this.regional.en),this.dpDiv=n(t("<div id='"+this._mainDivId+"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>"))}function n(e){var i="button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";return e.on("mouseout",i,function(){t(this).removeClass("ui-state-hover"),-1!==this.className.indexOf("ui-datepicker-prev")&&t(this).removeClass("ui-datepicker-prev-hover"),-1!==this.className.indexOf("ui-datepicker-next")&&t(this).removeClass("ui-datepicker-next-hover")}).on("mouseover",i,o)}function o(){t.datepicker._isDisabledDatepicker(m.inline?m.dpDiv.parent()[0]:m.input[0])||(t(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover"),t(this).addClass("ui-state-hover"),-1!==this.className.indexOf("ui-datepicker-prev")&&t(this).addClass("ui-datepicker-prev-hover"),-1!==this.className.indexOf("ui-datepicker-next")&&t(this).addClass("ui-datepicker-next-hover"))}function a(e,i){t.extend(e,i);for(var s in i)null==i[s]&&(e[s]=i[s]);return e}function r(t){return function(){var e=this.element.val();t.apply(this,arguments),this._refresh(),e!==this.element.val()&&this._trigger("change")}}t.ui=t.ui||{},t.ui.version="1.12.1";var h=0,l=Array.prototype.slice;t.cleanData=function(e){return function(i){var s,n,o;for(o=0;null!=(n=i[o]);o++)try{s=t._data(n,"events"),s&&s.remove&&t(n).triggerHandler("remove")}catch(a){}e(i)}}(t.cleanData),t.widget=function(e,i,s){var n,o,a,r={},h=e.split(".")[0];e=e.split(".")[1];var l=h+"-"+e;return s||(s=i,i=t.Widget),t.isArray(s)&&(s=t.extend.apply(null,[{}].concat(s))),t.expr.pseudos[l.toLowerCase()]=function(e){return!!t.data(e,l)},t[h]=t[h]||{},n=t[h][e],o=t[h][e]=function(t,e){return this._createWidget?(arguments.length&&this._createWidget(t,e),void 0):new o(t,e)},t.extend(o,n,{version:s.version,_proto:t.extend({},s),_childConstructors:[]}),a=new i,a.options=t.widget.extend({},a.options),t.each(s,function(e,s){return t.isFunction(s)?(r[e]=function(){function t(){return i.prototype[e].apply(this,arguments)}function n(t){return i.prototype[e].apply(this,t)}return function(){var e,i=this._super,o=this._superApply;return this._super=t,this._superApply=n,e=s.apply(this,arguments),this._super=i,this._superApply=o,e}}(),void 0):(r[e]=s,void 0)}),o.prototype=t.widget.extend(a,{widgetEventPrefix:n?a.widgetEventPrefix||e:e},r,{constructor:o,namespace:h,widgetName:e,widgetFullName:l}),n?(t.each(n._childConstructors,function(e,i){var s=i.prototype;t.widget(s.namespace+"."+s.widgetName,o,i._proto)}),delete n._childConstructors):i._childConstructors.push(o),t.widget.bridge(e,o),o}
vendor: 3,686 bytes, line 20
20,t.widget.extend=function(e){for(var i,s,n=l.call(arguments,1),o=0,a=n.length;a>o;o++)for(i in n[o])s=n[o][i],n[o].hasOwnProperty(i)&&void 0!==s&&(e[i]=t.isPlainObject(s)?t.isPlainObject(e[i])?t.widget.extend({},e[i],s):t.widget.extend({},s):s);return e},t.widget.bridge=function(e,i){var s=i.prototype.widgetFullName||e;t.fn[e]=function(n){var o="string"==typeof n,a=l.call(arguments,1),r=this;return o?this.length||"instance"!==n?this.each(function(){var i,o=t.data(this,s);return"instance"===n?(r=o,!1):o?t.isFunction(o[n])&&"_"!==n.charAt(0)?(i=o[n].apply(o,a),i!==o&&void 0!==i?(r=i&&i.jquery?r.pushStack(i.get()):i,!1):void 0):t.error("no such method '"+n+"' for "+e+" widget instance"):t.error("cannot call methods on "+e+" prior to initialization; "+"attempted to call method '"+n+"'")}):r=void 0:(a.length&&(n=t.widget.extend.apply(null,[n].concat(a))),this.each(function(){var e=t.data(this,s);e?(e.option(n||{}),e._init&&e._init()):t.data(this,s,new i(n,this))})),r}},t.Widget=function(){},t.Widget._childConstructors=[],t.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{classes:{},disabled:!1,create:null},_createWidget:function(e,i){i=t(i||this.defaultElement||this)[0],this.element=t(i),this.uuid=h++,this.eventNamespace="."+this.widgetName+this.uuid,this.bindings=t(),this.hoverable=t(),this.focusable=t(),this.classesElementLookup={},i!==this&&(t.data(i,this.widgetFullName,this),this._on(!0,this.element,{remove:function(t){t.target===i&&this.destroy()}}),this.document=t(i.style?i.ownerDocument:i.document||i),this.window=t(this.document[0].defaultView||this.document[0].parentWindow)),this.options=t.widget.extend({},this.options,this._getCreateOptions(),e),this._create(),this.options.disabled&&this._setOptionDisabled(this.options.disabled),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:function(){return{}},_getCreateEventData:t.noop,_create:t.noop,_init:t.noop,destroy:function(){var e=this;this._destroy(),t.each(this.classesElementLookup,function(t,i){e._removeClass(i,t)}),this.element.off(this.eventNamespace).removeData(this.widgetFullName),this.widget().off(this.eventNamespace).removeAttr("aria-disabled"),this.bindings.off(this.eventNamespace)},_destroy:t.noop,widget:function(){return this.element},option:function(e,i){var s,n,o,a=e;if(0===arguments.length)return t.widget.extend({},this.options);if("string"==typeof e)if(a={},s=e.split("."),e=s.shift(),s.length){for(n=a[e]=t.widget.extend({},this.options[e]),o=0;s.length-1>o;o++)n[s[o]]=n[s[o]]||{},n=n[s[o]];if(e=s.pop(),1===arguments.length)return void 0===n[e]?null:n[e];n[e]=i}else{if(1===arguments.length)return void 0===this.options[e]?null:this.options[e];a[e]=i}return this._setOptions(a),this},_setOptions:function(t){var e;for(e in t)this._setOption(e,t[e]);return this},_setOption:function(t,e){return"classes"===t&&this._setOptionClasses(e),this.options[t]=e,"disabled"===t&&this._setOptionDisabled(e),this},_setOptionClasses:function(e){var i,s,n;for(i in e)n=this.classesElementLookup[i],e[i]!==this.options.classes[i]&&n&&n.length&&(s=t(n.get()),this._removeClass(n,i),s.addClass(this._classes({element:s,keys:i,classes:e,add:!0})))},_setOptionDisabled:function(t){this._toggleClass(this.widget(),this.widgetFullName+"-disabled",null,!!t),t&&(this._removeClass(this.hoverable,null,"ui-state-hover"),this._removeClass(this.focusable,null,"ui-state-focus"))},enable:function(){return this._setOptions({disabled:!1})},disable:function(){return this._setOptions({disabled:!0})},_classes:function(e){function i(i,o){var a,r;for(r=0;i.length>r;r++)a=n.classesElementLookup[i[r]]||t(),a=e.add?t(t.uniqueSort
vendor: 8,573 bytes, line 20
20(a.get().concat(e.element.get()))):t(a.not(e.element).get()),n.classesElementLookup[i[r]]=a,s.push(i[r]),o&&e.classes[i[r]]&&s.push(e.classes[i[r]])}var s=[],n=this;return e=t.extend({element:this.element,classes:this.options.classes||{}},e),this._on(e.element,{remove:"_untrackClassesElement"}),e.keys&&i(e.keys.match(/\S+/g)||[],!0),e.extra&&i(e.extra.match(/\S+/g)||[]),s.join(" ")},_untrackClassesElement:function(e){var i=this;t.each(i.classesElementLookup,function(s,n){-1!==t.inArray(e.target,n)&&(i.classesElementLookup[s]=t(n.not(e.target).get()))})},_removeClass:function(t,e,i){return this._toggleClass(t,e,i,!1)},_addClass:function(t,e,i){return this._toggleClass(t,e,i,!0)},_toggleClass:function(t,e,i,s){s="boolean"==typeof s?s:i;var n="string"==typeof t||null===t,o={extra:n?e:i,keys:n?t:e,element:n?this.element:t,add:s};return o.element.toggleClass(this._classes(o),s),this},_on:function(e,i,s){var n,o=this;"boolean"!=typeof e&&(s=i,i=e,e=!1),s?(i=n=t(i),this.bindings=this.bindings.add(i)):(s=i,i=this.element,n=this.widget()),t.each(s,function(s,a){function r(){return e||o.options.disabled!==!0&&!t(this).hasClass("ui-state-disabled")?("string"==typeof a?o[a]:a).apply(o,arguments):void 0}"string"!=typeof a&&(r.guid=a.guid=a.guid||r.guid||t.guid++);var h=s.match(/^([\w:-]*)\s*(.*)$/),l=h[1]+o.eventNamespace,c=h[2];c?n.on(l,c,r):i.on(l,r)})},_off:function(e,i){i=(i||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,e.off(i).off(i),this.bindings=t(this.bindings.not(e).get()),this.focusable=t(this.focusable.not(e).get()),this.hoverable=t(this.hoverable.not(e).get())},_delay:function(t,e){function i(){return("string"==typeof t?s[t]:t).apply(s,arguments)}var s=this;return setTimeout(i,e||0)},_hoverable:function(e){this.hoverable=this.hoverable.add(e),this._on(e,{mouseenter:function(e){this._addClass(t(e.currentTarget),null,"ui-state-hover")},mouseleave:function(e){this._removeClass(t(e.currentTarget),null,"ui-state-hover")}})},_focusable:function(e){this.focusable=this.focusable.add(e),this._on(e,{focusin:function(e){this._addClass(t(e.currentTarget),null,"ui-state-focus")},focusout:function(e){this._removeClass(t(e.currentTarget),null,"ui-state-focus")}})},_trigger:function(e,i,s){var n,o,a=this.options[e];if(s=s||{},i=t.Event(i),i.type=(e===this.widgetEventPrefix?e:this.widgetEventPrefix+e).toLowerCase(),i.target=this.element[0],o=i.originalEvent)for(n in o)n in i||(i[n]=o[n]);return this.element.trigger(i,s),!(t.isFunction(a)&&a.apply(this.element[0],[i].concat(s))===!1||i.isDefaultPrevented())}},t.each({show:"fadeIn",hide:"fadeOut"},function(e,i){t.Widget.prototype["_"+e]=function(s,n,o){"string"==typeof n&&(n={effect:n});var a,r=n?n===!0||"number"==typeof n?i:n.effect||i:e;n=n||{},"number"==typeof n&&(n={duration:n}),a=!t.isEmptyObject(n),n.complete=o,n.delay&&s.delay(n.delay),a&&t.effects&&t.effects.effect[r]?s[e](n):r!==e&&s[r]?s[r](n.duration,n.easing,o):s.queue(function(i){t(this)[e](),o&&o.call(s[0]),i()})}}),t.widget,function(){function e(t,e,i){return[parseFloat(t[0])*(u.test(t[0])?e/100:1),parseFloat(t[1])*(u.test(t[1])?i/100:1)]}function i(e,i){return parseInt(t.css(e,i),10)||0}function s(e){var i=e[0];return 9===i.nodeType?{width:e.width(),height:e.height(),offset:{top:0,left:0}}:t.isWindow(i)?{width:e.width(),height:e.height(),offset:{top:e.scrollTop(),left:e.scrollLeft()}}:i.preventDefault?{width:0,height:0,offset:{top:i.pageY,left:i.pageX}}:{width:e.outerWidth(),height:e.outerHeight(),offset:e.offset()}}var n,o=Math.max,a=Math.abs,r=/left|center|right/,h=/top|center|bottom/,l=/[\+\-]\d+(\.[\d]+)?%?/,c=/^\w+/,u=/%$/,d=t.fn.position;t.position={scrollbarWidth:function(){if(void 0!==n)return n;var e,i,s=t("<div style='display:block;position:absolute;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>"),o=s.children()[0];return t("body").append(s),e=o.offsetWidth,s.css("overflow","scroll"),i=o.offsetWidth,e===i&&(i=s[0].clientWidth),s.remove(),n=e-i},getScrollInfo:function(e){var i=e.isWindow||e.isDocument?"":e.element.css("overflow-x"),s=e.isWindow||e.isDocument?"":e.element.css("overflow-y"),n="scroll"===i||"auto"===i&&e.width<e.element[0].scrollWidth,o="scroll"===s||"auto"===s&&e.height<e.element[0].scrollHeight;return{width:o?t.position.scrollbarWidth():0,height:n?t.position.scrollbarWidth():0}},getWithinInfo:function(e){var i=t(e||window),s=t.isWindow(i[0]),n=!!i[0]&&9===i[0].nodeType,o=!s&&!n;return{element:i,isWindow:s,isDocument:n,offset:o?t(e).offset():{left:0,top:0},scrollLeft:i.scrollLeft(),scrollTop:i.scrollTop(),width:i.outerWidth(),height:i.outerHeight()}}},t.fn.position=function(n){if(!n||!n.of)return d.apply(this,arguments);n=t.extend({},n);var u,p,f,g,m,_,v=t(n.of),b=t.position.getWithinInfo(n.within),y=t.position.getScrollInfo(b),w=(n.collision||"flip").split(" "),k={};return _=s(v),v[0].preventDefault&&(n.at="left top"),p=_.width,f=_.height,g=_.offset,m=t.extend({},g),t.each(["my","at"],function(){var t,e,i=(n[this]||"").split(" ");1===i.length&&(i=r.test(i[0])?i.concat(["center"]):h.test(i[0])?["center"].concat(i):["center","center"]),i[0]=r.test(i[0])?i[0]:"center",i[1]=h.test(i[1])?i[1]:"center",t=l.exec(i[0]),e=l.exec(i[1]),k[this]=[t?t[0]:0,e?e[0]:0],n[this]=[c.exec(i[0])[0],c.exec(i[1])[0]]}),1===w.length&&(w[1]=w[0]),"right"===n.at[0]?m.left+=p:"center"===n.at[0]&&(m.left+=p/2),"bottom"===n.at[1]?m.top+=f:"center"===n.at[1]&&(m.top+=f/2),u=e(k.at,p,f),m.left+=u[0],m.top+=u[1],this.each(function(){var s,r,h=t(this),l=h.outerWidth(),c=h.outerHeight(),d=i(this,"marginLeft"),_=i(this,"marginTop"),x=l+d+i(this,"marginRight")+y.width,C=c+_+i(this,"marginBottom")+y.height,D=t.extend({},m),I=e(k.my,h.outerWidth(),h.outerHeight());"right"===n.my[0]?D.left-=l:"center"===n.my[0]&&(D.left-=l/2),"bottom"===n.my[1]?D.top-=c:"center"===n.my[1]&&(D.top-=c/2),D.left+=I[0],D.top+=I[1],s={marginLeft:d,marginTop:_},t.each(["left","top"],function(e,i){t.ui.position[w[e]]&&t.ui.position[w[e]][i](D,{targetWidth:p,targetHeight:f,elemWidth:l,elemHeight:c,collisionPosition:s,collisionWidth:x,collisionHeight:C,offset:[u[0]+I[0],u[1]+I[1]],my:n.my,at:n.at,within:b,elem:h})}),n.using&&(r=function(t){var e=g.left-D.left,i=e+p-l,s=g.top-D.top,r=s+f-c,u={target:{element:v,left:g.left,top:g.top,width:p,height:f},element:{element:h,left:D.left,top:D.top,width:l,height:c},horizontal:0>i?"left":e>0?"right":"center",vertical:0>r?"top":s>0?"bottom":"middle"};l>p&&p>a(e+i)&&(u.horizontal="center"),c>f&&f>a(s+r)&&(u.vertical="middle"),u.important=o(a(e),a(i))>o(a(s),a(r))?"horizontal":"vertical",n.using.call(this,t,u)}),h.offset(t.extend(D,{using:r}))})},t.ui.position={fit:{left:function(t,e){var i,s=e.within,n=s.isWindow?s.scrollLeft:s.offset.left,a=s.width,r=t.left-e.collisionPosition.marginLeft,h=n-r,l=r+e.collisionWidth-a-n;e.collisionWidth>a?h>0&&0>=l?(i=t.left+h+e.collisionWidth-a-n,t.left+=h-i):t.left=l>0&&0>=h?n:h>l?n+a-e.collisionWidth:n:h>0?t.left+=h:l>0?t.left-=l:t.left=o(t.left-r,t.left)},top:function(t,e){var i,s=e.within,n=s.isWindow?s.scrollTop:s.offset.top,a=e.within.height,r=t.top-e.collisionPosition.marginTop,h=n-r,l=r+e.collisionHeight-a-n;e.collisionHeight>a?h>0&&0>=l?(i=t.top+h+e.collisionHeight-a-n,t.top+=h-i):t.top=l>0&&0>=h?n:h>l?n+a-e.collisionHeight:n:h>0?t.top+=h:l>0?t.top-=l:t.top=o(t.top-r,t.top)}},flip:{left:function(t,e){var i,s,n=e.within,o=n.offset.left+n.scrollLeft,r=n.width,h=n.isWindow?n.scrollLeft:n.offset.left,l=t.left-e.collisionPosition.marginLeft,c=l-h,u=l+e.collisionWidth-r-h,d="left"===e.my[0]?-e.elemWidth:"right"===e.my[0]?e.elemWidth:0,p="left"===e.at[0]?e.targetWidth:"right"===e.at[0]?-e.targetWidth:0,f=-2*e.offset[0];0>c?(i=t.left+d+p+f+e.collisionWidth-r-o,(0>i||a(c)>i)&&(t.left+=d+p+f)):u>0&&(s=t.left-e.collisionPosition.marginLeft+d+p+f-h,(s>0||u>a(s))&&(t.left+=d+p+f))},top:function(t,e){var i,s,n=e.within,o=n.offset.top+n.scrollTop,r=n.height,h=n.isWindow?n.scrollTop:n.offset.top,l=t.top-e.collisionPosition.marginTop,c=l-h,u=l+e.collisionHeight-r-h,d="top"===e.my[1],p=d?-e.elemHeight:"bottom"===e.my[1]?e.elemHeight:0,f="top"===e.at[1]?e.targetHeight:"bottom"===e.at[1]?-e.targetHeight:0,g=-2*e.offset[1];0>c?(s=t.top+p+f+g+e.collisionHeight-r-o,(0>s||a(c)>s)&&(t.top+=p+f+g)):u>0&&(i=t.top-e.collisionPosition.marginTop+p+f+g-h,(i>0||u>a(i))&&(t.top+=p+f+g))}},flipfit:{left:function(){t.ui.position.flip.left.apply(this,arguments),t.ui.position.fit.left.apply(this,arguments)},top:function(){t.ui.position.flip.top.apply(this,arguments),t.ui.position.fit.top.apply(this,arguments)}}}}(),t.ui.position,t.extend(t.expr
20.pseudos
vendor: 10,183 bytes, line 20
20,{data:t.expr.createPseudo?t.expr.createPseudo(function(e){return function(i){return!!t.data(i,e)}}):function(e,i,s){return!!t.data(e,s[3])}}),t.fn.extend({disableSelection:function(){var t="onselectstart"in document.createElement("div")?"selectstart":"mousedown";return function(){return this.on(t+".ui-disableSelection",function(t){t.preventDefault()})}}(),enableSelection:function(){return this.off(".ui-disableSelection")}});var c="ui-effects-",u="ui-effects-style",d="ui-effects-animated",p=t;t.effects={effect:{}},function(t,e){function i(t,e,i){var s=u[e.type]||{};return null==t?i||!e.def?null:e.def:(t=s.floor?~~t:parseFloat(t),isNaN(t)?e.def:s.mod?(t+s.mod)%s.mod:0>t?0:t>s.max?s.max:t)}function s(i){var s=l(),n=s._rgba=[];return i=i.toLowerCase(),f(h,function(t,o){var a,r=o.re.exec(i),h=r&&o.parse(r),l=o.space||"rgba";return h?(a=s[l](h),s[c[l].cache]=a[c[l].cache],n=s._rgba=a._rgba,!1):e}),n.length?("0,0,0,0"===n.join()&&t.extend(n,o.transparent),s):o[i]}function n(t,e,i){return i=(i+1)%1,1>6*i?t+6*(e-t)*i:1>2*i?e:2>3*i?t+6*(e-t)*(2/3-i):t}var o,a="backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor",r=/^([\-+])=\s*(\d+\.?\d*)/,h=[{re:/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(t){return[t[1],t[2],t[3],t[4]]}},{re:/rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(t){return[2.55*t[1],2.55*t[2],2.55*t[3],t[4]]}},{re:/#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/,parse:function(t){return[parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16)]}},{re:/#([a-f0-9])([a-f0-9])([a-f0-9])/,parse:function(t){return[parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16)]}},{re:/hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,space:"hsla",parse:function(t){return[t[1],t[2]/100,t[3]/100,t[4]]}}],l=t.Color=function(e,i,s,n){return new t.Color.fn.parse(e,i,s,n)},c={rgba:{props:{red:{idx:0,type:"byte"},green:{idx:1,type:"byte"},blue:{idx:2,type:"byte"}}},hsla:{props:{hue:{idx:0,type:"degrees"},saturation:{idx:1,type:"percent"},lightness:{idx:2,type:"percent"}}}},u={"byte":{floor:!0,max:255},percent:{max:1},degrees:{mod:360,floor:!0}},d=l.support={},p=t("<p>")[0],f=t.each;p.style.cssText="background-color:rgba(1,1,1,.5)",d.rgba=p.style.backgroundColor.indexOf("rgba")>-1,f(c,function(t,e){e.cache="_"+t,e.props.alpha={idx:3,type:"percent",def:1}}),l.fn=t.extend(l.prototype,{parse:function(n,a,r,h){if(n===e)return this._rgba=[null,null,null,null],this;(n.jquery||n.nodeType)&&(n=t(n).css(a),a=e);var u=this,d=t.type(n),p=this._rgba=[];return a!==e&&(n=[n,a,r,h],d="array"),"string"===d?this.parse(s(n)||o._default):"array"===d?(f(c.rgba.props,function(t,e){p[e.idx]=i(n[e.idx],e)}),this):"object"===d?(n instanceof l?f(c,function(t,e){n[e.cache]&&(u[e.cache]=n[e.cache].slice())}):f(c,function(e,s){var o=s.cache;f(s.props,function(t,e){if(!u[o]&&s.to){if("alpha"===t||null==n[t])return;u[o]=s.to(u._rgba)}u[o][e.idx]=i(n[t],e,!0)}),u[o]&&0>t.inArray(null,u[o].slice(0,3))&&(u[o][3]=1,s.from&&(u._rgba=s.from(u[o])))}),this):e},is:function(t){var i=l(t),s=!0,n=this;return f(c,function(t,o){var a,r=i[o.cache];return r&&(a=n[o.cache]||o.to&&o.to(n._rgba)||[],f(o.props,function(t,i){return null!=r[i.idx]?s=r[i.idx]===a[i.idx]:e})),s}),s},_space:function(){var t=[],e=this;return f(c,function(i,s){e[s.cache]&&t.push(i)}),t.pop()},transition:function(t,e){var s=l(t),n=s._space(),o=c[n],a=0===this.alpha()?l("transparent"):this,r=a[o.cache]||o.to(a._rgba),h=r.slice();return s=s[o.cache],f(o.props,function(t,n){var o=n.idx,a=r[o],l=s[o],c=u[n.type]||{};null!==l&&(null===a?h[o]=l:(c.mod&&(l-a>c.mod/2?a+=c.mod:a-l>c.mod/2&&(a-=c.mod)),h[o]=i((l-a)*e+a,n)))}),this[n](h)},blend:function(e){if(1===this._rgba[3])return this;var i=this._rgba.slice(),s=i.pop(),n=l(e)._rgba;return l(t.map(i,function(t,e){return(1-s)*n[e]+s*t}))},toRgbaString:function(){var e="rgba(",i=t.map(this._rgba,function(t,e){return null==t?e>2?1:0:t});return 1===i[3]&&(i.pop(),e="rgb("),e+i.join()+")"},toHslaString:function(){var e="hsla(",i=t.map(this.hsla(),function(t,e){return null==t&&(t=e>2?1:0),e&&3>e&&(t=Math.round(100*t)+"%"),t});return 1===i[3]&&(i.pop(),e="hsl("),e+i.join()+")"},toHexString:function(e){var i=this._rgba.slice(),s=i.pop();return e&&i.push(~~(255*s)),"#"+t.map(i,function(t){return t=(t||0).toString(16),1===t.length?"0"+t:t}).join("")},toString:function(){return 0===this._rgba[3]?"transparent":this.toRgbaString()}}),l.fn.parse.prototype=l.fn,c.hsla.to=function(t){if(null==t[0]||null==t[1]||null==t[2])return[null,null,null,t[3]];var e,i,s=t[0]/255,n=t[1]/255,o=t[2]/255,a=t[3],r=Math.max(s,n,o),h=Math.min(s,n,o),l=r-h,c=r+h,u=.5*c;return e=h===r?0:s===r?60*(n-o)/l+360:n===r?60*(o-s)/l+120:60*(s-n)/l+240,i=0===l?0:.5>=u?l/c:l/(2-c),[Math.round(e)%360,i,u,null==a?1:a]},c.hsla.from=function(t){if(null==t[0]||null==t[1]||null==t[2])return[null,null,null,t[3]];var e=t[0]/360,i=t[1],s=t[2],o=t[3],a=.5>=s?s*(1+i):s+i-s*i,r=2*s-a;return[Math.round(255*n(r,a,e+1/3)),Math.round(255*n(r,a,e)),Math.round(255*n(r,a,e-1/3)),o]},f(c,function(s,n){var o=n.props,a=n.cache,h=n.to,c=n.from;l.fn[s]=function(s){if(h&&!this[a]&&(this[a]=h(this._rgba)),s===e)return this[a].slice();var n,r=t.type(s),u="array"===r||"object"===r?s:arguments,d=this[a].slice();return f(o,function(t,e){var s=u["object"===r?t:e.idx];null==s&&(s=d[e.idx]),d[e.idx]=i(s,e)}),c?(n=l(c(d)),n[a]=d,n):l(d)},f(o,function(e,i){l.fn[e]||(l.fn[e]=function(n){var o,a=t.type(n),h="alpha"===e?this._hsla?"hsla":"rgba":s,l=this[h](),c=l[i.idx];return"undefined"===a?c:("function"===a&&(n=n.call(this,c),a=t.type(n)),null==n&&i.empty?this:("string"===a&&(o=r.exec(n),o&&(n=c+parseFloat(o[2])*("+"===o[1]?1:-1))),l[i.idx]=n,this[h](l)))})})}),l.hook=function(e){var i=e.split(" ");f(i,function(e,i){t.cssHooks[i]={set:function(e,n){var o,a,r="";if("transparent"!==n&&("string"!==t.type(n)||(o=s(n)))){if(n=l(o||n),!d.rgba&&1!==n._rgba[3]){for(a="backgroundColor"===i?e.parentNode:e;(""===r||"transparent"===r)&&a&&a.style;)try{r=t.css(a,"backgroundColor"),a=a.parentNode}catch(h){}n=n.blend(r&&"transparent"!==r?r:"_default")}n=n.toRgbaString()}try{e.style[i]=n}catch(h){}}},t.fx.step[i]=function(e){e.colorInit||(e.start=l(e.elem,i),e.end=l(e.end),e.colorInit=!0),t.cssHooks[i].set(e.elem,e.start.transition(e.end,e.pos))}})},l.hook(a),t.cssHooks.borderColor={expand:function(t){var e={};return f(["Top","Right","Bottom","Left"],function(i,s){e["border"+s+"Color"]=t}),e}},o=t.Color.names={aqua:"#00ffff",black:"#000000",blue:"#0000ff",fuchsia:"#ff00ff",gray:"#808080",green:"#008000",lime:"#00ff00",maroon:"#800000",navy:"#000080",olive:"#808000",purple:"#800080",red:"#ff0000",silver:"#c0c0c0",teal:"#008080",white:"#ffffff",yellow:"#ffff00",transparent:[null,null,null,0],_default:"#ffffff"}}(p),function(){function e(e){var i,s,n=e.ownerDocument.defaultView?e.ownerDocument.defaultView.getComputedStyle(e,null):e.currentStyle,o={};if(n&&n.length&&n[0]&&n[n[0]])for(s=n.length;s--;)i=n[s],"string"==typeof n[i]&&(o[t.camelCase(i)]=n[i]);else for(i in n)"string"==typeof n[i]&&(o[i]=n[i]);return o}function i(e,i){var s,o,a={};for(s in i)o=i[s],e[s]!==o&&(n[s]||(t.fx.step[s]||!isNaN(parseFloat(o)))&&(a[s]=o));return a}var s=["add","remove","toggle"],n={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};t.each(["borderLeftStyle","borderRightStyle","borderBottomStyle","borderTopStyle"],function(e,i){t.fx.step[i]=function(t){("none"!==t.end&&!t.setAttr||1===t.pos&&!t.setAttr)&&(p.style(t.elem,i,t.end),t.setAttr=!0)}}),t.fn.addBack||(t.fn.addBack=function(t){return this.add(null==t?this.prevObject:this.prevObject.filter(t))}),t.effects.animateClass=function(n,o,a,r){var h=t.speed(o,a,r);return this.queue(function(){var o,a=t(this),r=a.attr("class")||"",l=h.children?a.find("*").addBack():a;l=l.map(function(){var i=t(this);return{el:i,start:e(this)}}),o=function(){t.each(s,function(t,e){n[e]&&a[e+"Class"](n[e])})},o(),l=l.map(function(){return this.end=e(this.el[0]),this.diff=i(this.start,this.end),this}),a.attr("class",r),l=l.map(function(){var e=this,i=t.Deferred(),s=t.extend({},h,{queue:!1,complete:function(){i.resolve(e)}});return this.el.animate(this.diff,s),i.promise()}),t.when.apply(t,l.get()).done(function(){o(),t.each(arguments,function(){var e=this.el;t.each(this.diff,function(t){e.css(t,"")})}),h.complete.call(a[0])})})},t.fn.extend({addClass:function(e){return function(i,s,n,o){return s?t.effects.animateClass.call(this,{add:i},s,n,o):e.apply(this,arguments)}}(t.fn.addClass),removeClass:function(e){return function(i,s,n,o){return arguments.length>1?t.effects.animateClass.call(this,{remove:i},s,n,o):e.apply(this,arguments)}}(t.fn.removeClass),toggleClass:function(e){return function(i,s,n,o,a){return"boolean"==typeof s||void 0===s?n?t.effects.animateClass.call(this,s?{add:i}:{remove:i},n,o,a):e.apply(this,arguments):t.effects.animateClass.call(this,{toggle:i},s,n,o)}}(t.fn.toggleClass),switchClass:function(e,i,s,n,o){return t.effects.animateClass.call(this,{add:i,remove:e},s,n,o)}})}(),function(){function e(e,i,s,n){return t.isPlainObject(e)&&(i=e,e=e.effect),e={effect:e},null==i&&(i={}),t.isFunction(i)&&(n=i,s=null,i={}),("number"==typeof i||t.fx.speeds[i])&&(n=s,s=i,i={}),t.isFunction(s)&&(n=s,s=null),i&&t.extend(e,i),s=s||i.duration,e.duration=t.fx.off?0:"number"==typeof s?s:s in t.fx.speeds?t.fx.speeds[s]:t.fx.speeds._default,e.complete=n||i.complete,e}function i(e){return!e||"number"==typeof e||t.fx.speeds[e]?!0:"string"!=typeof e||t.effects.effect[e]?t.isFunction(e)?!0:"object"!=typeof e||e.effect?!1:!0:!0}function s(t,e){var i=e.outerWidth(),s=e.outerHeight(),n=/^rect\((-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto)\)$/,o=n.exec(t)||["",0,i,s,0];return{top:parseFloat(o[1])||0,right:"auto"===o[2]?i:parseFloat(o[2]),bottom:"auto"===o[3]?s:parseFloat(o[3]),left:parseFloat(o[4])||0}}t.expr&&t.expr.
vendor: 4,642 bytes, line 20
20pseudos&&t.expr.pseudos.animated&&(t.expr.pseudos.animated=function(e){return function(i){return!!t(i).data(d)||e(i)}}(t.expr.pseudos.animated)),t.uiBackCompat!==!1&&t.extend(t.effects,{save:function(t,e){for(var i=0,s=e.length;s>i;i++)null!==e[i]&&t.data(c+e[i],t[0].style[e[i]])},restore:function(t,e){for(var i,s=0,n=e.length;n>s;s++)null!==e[s]&&(i=t.data(c+e[s]),t.css(e[s],i))},setMode:function(t,e){return"toggle"===e&&(e=t.is(":hidden")?"show":"hide"),e},createWrapper:function(e){if(e.parent().is(".ui-effects-wrapper"))return e.parent();var i={width:e.outerWidth(!0),height:e.outerHeight(!0),"float":e.css("float")},s=t("<div></div>").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}),n={width:e.width(),height:e.height()},o=document.activeElement;try{o.id}catch(a){o=document.body}return e.wrap(s),(e[0]===o||t.contains(e[0],o))&&t(o).trigger("focus"),s=e.parent(),"static"===e.css("position")?(s.css({position:"relative"}),e.css({position:"relative"})):(t.extend(i,{position:e.css("position"),zIndex:e.css("z-index")}),t.each(["top","left","bottom","right"],function(t,s){i[s]=e.css(s),isNaN(parseInt(i[s],10))&&(i[s]="auto")}),e.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})),e.css(n),s.css(i).show()},removeWrapper:function(e){var i=document.activeElement;return e.parent().is(".ui-effects-wrapper")&&(e.parent().replaceWith(e),(e[0]===i||t.contains(e[0],i))&&t(i).trigger("focus")),e}}),t.extend(t.effects,{version:"1.12.1",define:function(e,i,s){return s||(s=i,i="effect"),t.effects.effect[e]=s,t.effects.effect[e].mode=i,s},scaledDimensions:function(t,e,i){if(0===e)return{height:0,width:0,outerHeight:0,outerWidth:0};var s="horizontal"!==i?(e||100)/100:1,n="vertical"!==i?(e||100)/100:1;return{height:t.height()*n,width:t.width()*s,outerHeight:t.outerHeight()*n,outerWidth:t.outerWidth()*s}},clipToBox:function(t){return{width:t.clip.right-t.clip.left,height:t.clip.bottom-t.clip.top,left:t.clip.left,top:t.clip.top}},unshift:function(t,e,i){var s=t.queue();e>1&&s.splice.apply(s,[1,0].concat(s.splice(e,i))),t.dequeue()},saveStyle:function(t){t.data(u,t[0].style.cssText)},restoreStyle:function(t){t[0].style.cssText=t.data(u)||"",t.removeData(u)},mode:function(t,e){var i=t.is(":hidden");return"toggle"===e&&(e=i?"show":"hide"),(i?"hide"===e:"show"===e)&&(e="none"),e},getBaseline:function(t,e){var i,s;switch(t[0]){case"top":i=0;break;case"middle":i=.5;break;case"bottom":i=1;break;default:i=t[0]/e.height}switch(t[1]){case"left":s=0;break;case"center":s=.5;break;case"right":s=1;break;default:s=t[1]/e.width}return{x:s,y:i}},createPlaceholder:function(e){var i,s=e.css("position"),n=e.position();return e.css({marginTop:e.css("marginTop"),marginBottom:e.css("marginBottom"),marginLeft:e.css("marginLeft"),marginRight:e.css("marginRight")}).outerWidth(e.outerWidth()).outerHeight(e.outerHeight()),/^(static|relative)/.test(s)&&(s="absolute",i=t("<"+e[0].nodeName+">").insertAfter(e).css({display:/^(inline|ruby)/.test(e.css("display"))?"inline-block":"block",visibility:"hidden",marginTop:e.css("marginTop"),marginBottom:e.css("marginBottom"),marginLeft:e.css("marginLeft"),marginRight:e.css("marginRight"),"float":e.css("float")}).outerWidth(e.outerWidth()).outerHeight(e.outerHeight()).addClass("ui-effects-placeholder"),e.data(c+"placeholder",i)),e.css({position:s,left:n.left,top:n.top}),i},removePlaceholder:function(t){var e=c+"placeholder",i=t.data(e);i&&(i.remove(),t.removeData(e))},cleanUp:function(e){t.effects.restoreStyle(e),t.effects.removePlaceholder(e)},setTransition:function(e,i,s,n){return n=n||{},t.each(i,function(t,i){var o=e.cssUnit(i);o[0]>0&&(n[i]=o[0]*s+o[1])}),n}}),t.fn.extend({effect:function(){function i(e){function i(){r.removeData(d),t.effects.cleanUp(r),"hide"===s.mode&&r.hide(),a()}function a(){t.isFunction(h)&&h.call(r[0]),t.isFunction(e)&&e()}var r=t(this);s.mode=c.shift(),t.uiBackCompat===!1||o?"none"===s.mode?(r[l](),a()):n.call(r[0],s,i):(r.is(":hidden")?"hide"===l:"show"===l)?(r[l](),a()):n.call(r[0],s,a)}var s=e.apply(this,arguments),n=t.effects.effect[s.effect],o=n.mode,a=s.queue,r=a||"fx",h=s.complete,l=s.mode,c=[],u=function(e){var i=t(this),s=t.effects.mode(i,l)||o;i.data(d,!0),c.push(s),o&&("show"===s||s===o&&"hide"===s)&&i.show(),o&&"none"===s||t.effects.saveStyle(i),t.isFunction(e)&&e()};return t.fx.off||!n?l?this[l](s.duration,h):this.each(function(){h&&h.call(this)}):a===!1?this.each(u).each(i):this.queue(r,u).queue(r,i)},show:function(t){return function(s){if(i(s))return t.apply(this,arguments);var n=e.apply(this,arguments);return n.mode="show",this.effect.call(this,n)�
vendor: 10,784 bytes, lines 20-21
20
21}}(t.fn.show),hide:function(t){return function(s){if(i(s))return t.apply(this,arguments);var n=e.apply(this,arguments);return n.mode="hide",this.effect.call(this,n)}}(t.fn.hide),toggle:function(t){return function(s){if(i(s)||"boolean"==typeof s)return t.apply(this,arguments);var n=e.apply(this,arguments);return n.mode="toggle",this.effect.call(this,n)}}(t.fn.toggle),cssUnit:function(e){var i=this.css(e),s=[];return t.each(["em","px","%","pt"],function(t,e){i.indexOf(e)>0&&(s=[parseFloat(i),e])}),s},cssClip:function(t){return t?this.css("clip","rect("+t.top+"px "+t.right+"px "+t.bottom+"px "+t.left+"px)"):s(this.css("clip"),this)},transfer:function(e,i){var s=t(this),n=t(e.to),o="fixed"===n.css("position"),a=t("body"),r=o?a.scrollTop():0,h=o?a.scrollLeft():0,l=n.offset(),c={top:l.top-r,left:l.left-h,height:n.innerHeight(),width:n.innerWidth()},u=s.offset(),d=t("<div class='ui-effects-transfer'></div>").appendTo("body").addClass(e.className).css({top:u.top-r,left:u.left-h,height:s.innerHeight(),width:s.innerWidth(),position:o?"fixed":"absolute"}).animate(c,e.duration,e.easing,function(){d.remove(),t.isFunction(i)&&i()})}}),t.fx.step.clip=function(e){e.clipInit||(e.start=t(e.elem).cssClip(),"string"==typeof e.end&&(e.end=s(e.end,e.elem)),e.clipInit=!0),t(e.elem).cssClip({top:e.pos*(e.end.top-e.start.top)+e.start.top,right:e.pos*(e.end.right-e.start.right)+e.start.right,bottom:e.pos*(e.end.bottom-e.start.bottom)+e.start.bottom,left:e.pos*(e.end.left-e.start.left)+e.start.left})}}(),function(){var e={};t.each(["Quad","Cubic","Quart","Quint","Expo"],function(t,i){e[i]=function(e){return Math.pow(e,t+2)}}),t.extend(e,{Sine:function(t){return 1-Math.cos(t*Math.PI/2)},Circ:function(t){return 1-Math.sqrt(1-t*t)},Elastic:function(t){return 0===t||1===t?t:-Math.pow(2,8*(t-1))*Math.sin((80*(t-1)-7.5)*Math.PI/15)},Back:function(t){return t*t*(3*t-2)},Bounce:function(t){for(var e,i=4;((e=Math.pow(2,--i))-1)/11>t;);return 1/Math.pow(4,3-i)-7.5625*Math.pow((3*e-2)/22-t,2)}}),t.each(e,function(e,i){t.easing["easeIn"+e]=i,t.easing["easeOut"+e]=function(t){return 1-i(1-t)},t.easing["easeInOut"+e]=function(t){return.5>t?i(2*t)/2:1-i(-2*t+2)/2}})}();var f=t.effects;t.effects.define("blind","hide",function(e,i){var s={up:["bottom","top"],vertical:["bottom","top"],down:["top","bottom"],left:["right","left"],horizontal:["right","left"],right:["left","right"]},n=t(this),o=e.direction||"up",a=n.cssClip(),r={clip:t.extend({},a)},h=t.effects.createPlaceholder(n);r.clip[s[o][0]]=r.clip[s[o][1]],"show"===e.mode&&(n.cssClip(r.clip),h&&h.css(t.effects.clipToBox(r)),r.clip=a),h&&h.animate(t.effects.clipToBox(r),e.duration,e.easing),n.animate(r,{queue:!1,duration:e.duration,easing:e.easing,complete:i})}),t.effects.define("bounce",function(e,i){var s,n,o,a=t(this),r=e.mode,h="hide"===r,l="show"===r,c=e.direction||"up",u=e.distance,d=e.times||5,p=2*d+(l||h?1:0),f=e.duration/p,g=e.easing,m="up"===c||"down"===c?"top":"left",_="up"===c||"left"===c,v=0,b=a.queue().length;for(t.effects.createPlaceholder(a),o=a.css(m),u||(u=a["top"===m?"outerHeight":"outerWidth"]()/3),l&&(n={opacity:1},n[m]=o,a.css("opacity",0).css(m,_?2*-u:2*u).animate(n,f,g)),h&&(u/=Math.pow(2,d-1)),n={},n[m]=o;d>v;v++)s={},s[m]=(_?"-=":"+=")+u,a.animate(s,f,g).animate(n,f,g),u=h?2*u:u/2;h&&(s={opacity:0},s[m]=(_?"-=":"+=")+u,a.animate(s,f,g)),a.queue(i),t.effects.unshift(a,b,p+1)}),t.effects.define("clip","hide",function(e,i){var s,n={},o=t(this),a=e.direction||"vertical",r="both"===a,h=r||"horizontal"===a,l=r||"vertical"===a;s=o.cssClip(),n.clip={top:l?(s.bottom-s.top)/2:s.top,right:h?(s.right-s.left)/2:s.right,bottom:l?(s.bottom-s.top)/2:s.bottom,left:h?(s.right-s.left)/2:s.left},t.effects.createPlaceholder(o),"show"===e.mode&&(o.cssClip(n.clip),n.clip=s),o.animate(n,{queue:!1,duration:e.duration,easing:e.easing,complete:i})}),t.effects.define("drop","hide",function(e,i){var s,n=t(this),o=e.mode,a="show"===o,r=e.direction||"left",h="up"===r||"down"===r?"top":"left",l="up"===r||"left"===r?"-=":"+=",c="+="===l?"-=":"+=",u={opacity:0};t.effects.createPlaceholder(n),s=e.distance||n["top"===h?"outerHeight":"outerWidth"](!0)/2,u[h]=l+s,a&&(n.css(u),u[h]=c+s,u.opacity=1),n.animate(u,{queue:!1,duration:e.duration,easing:e.easing,complete:i})}),t.effects.define("explode","hide",function(e,i){function s(){b.push(this),b.length===u*d&&n()}function n(){p.css({visibility:"visible"}),t(b).remove(),i()}var o,a,r,h,l,c,u=e.pieces?Math.round(Math.sqrt(e.pieces)):3,d=u,p=t(this),f=e.mode,g="show"===f,m=p.show().css("visibility","hidden").offset(),_=Math.ceil(p.outerWidth()/d),v=Math.ceil(p.outerHeight()/u),b=[];for(o=0;u>o;o++)for(h=m.top+o*v,c=o-(u-1)/2,a=0;d>a;a++)r=m.left+a*_,l=a-(d-1)/2,p.clone().appendTo("body").wrap("<div></div>").css({position:"absolute",visibility:"visible",left:-a*_,top:-o*v}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:_,height:v,left:r+(g?l*_:0),top:h+(g?c*v:0),opacity:g?0:1}).animate({left:r+(g?0:l*_),top:h+(g?0:c*v),opacity:g?1:0},e.duration||500,e.easing,s)}),t.effects.define("fade","toggle",function(e,i){var s="show"===e.mode;t(this).css("opacity",s?0:1).animate({opacity:s?1:0},{queue:!1,duration:e.duration,easing:e.easing,complete:i})}),t.effects.define("fold","hide",function(e,i){var s=t(this),n=e.mode,o="show"===n,a="hide"===n,r=e.size||15,h=/([0-9]+)%/.exec(r),l=!!e.horizFirst,c=l?["right","bottom"]:["bottom","right"],u=e.duration/2,d=t.effects.createPlaceholder(s),p=s.cssClip(),f={clip:t.extend({},p)},g={clip:t.extend({},p)},m=[p[c[0]],p[c[1]]],_=s.queue().length;h&&(r=parseInt(h[1],10)/100*m[a?0:1]),f.clip[c[0]]=r,g.clip[c[0]]=r,g.clip[c[1]]=0,o&&(s.cssClip(g.clip),d&&d.css(t.effects.clipToBox(g)),g.clip=p),s.queue(function(i){d&&d.animate(t.effects.clipToBox(f),u,e.easing).animate(t.effects.clipToBox(g),u,e.easing),i()}).animate(f,u,e.easing).animate(g,u,e.easing).queue(i),t.effects.unshift(s,_,4)}),t.effects.define("highlight","show",function(e,i){var s=t(this),n={backgroundColor:s.css("backgroundColor")};"hide"===e.mode&&(n.opacity=0),t.effects.saveStyle(s),s.css({backgroundImage:"none",backgroundColor:e.color||"#ffff99"}).animate(n,{queue:!1,duration:e.duration,easing:e.easing,complete:i})}),t.effects.define("size",function(e,i){var s,n,o,a=t(this),r=["fontSize"],h=["borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],l=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"],c=e.mode,u="effect"!==c,d=e.scale||"both",p=e.origin||["middle","center"],f=a.css("position"),g=a.position(),m=t.effects.scaledDimensions(a),_=e.from||m,v=e.to||t.effects.scaledDimensions(a,0);t.effects.createPlaceholder(a),"show"===c&&(o=_,_=v,v=o),n={from:{y:_.height/m.height,x:_.width/m.width},to:{y:v.height/m.height,x:v.width/m.width}},("box"===d||"both"===d)&&(n.from.y!==n.to.y&&(_=t.effects.setTransition(a,h,n.from.y,_),v=t.effects.setTransition(a,h,n.to.y,v)),n.from.x!==n.to.x&&(_=t.effects.setTransition(a,l,n.from.x,_),v=t.effects.setTransition(a,l,n.to.x,v))),("content"===d||"both"===d)&&n.from.y!==n.to.y&&(_=t.effects.setTransition(a,r,n.from.y,_),v=t.effects.setTransition(a,r,n.to.y,v)),p&&(s=t.effects.getBaseline(p,m),_.top=(m.outerHeight-_.outerHeight)*s.y+g.top,_.left=(m.outerWidth-_.outerWidth)*s.x+g.left,v.top=(m.outerHeight-v.outerHeight)*s.y+g.top,v.left=(m.outerWidth-v.outerWidth)*s.x+g.left),a.css(_),("content"===d||"both"===d)&&(h=h.concat(["marginTop","marginBottom"]).concat(r),l=l.concat(["marginLeft","marginRight"]),a.find("*[width]").each(function(){var i=t(this),s=t.effects.scaledDimensions(i),o={height:s.height*n.from.y,width:s.width*n.from.x,outerHeight:s.outerHeight*n.from.y,outerWidth:s.outerWidth*n.from.x},a={height:s.height*n.to.y,width:s.width*n.to.x,outerHeight:s.height*n.to.y,outerWidth:s.width*n.to.x};n.from.y!==n.to.y&&(o=t.effects.setTransition(i,h,n.from.y,o),a=t.effects.setTransition(i,h,n.to.y,a)),n.from.x!==n.to.x&&(o=t.effects.setTransition(i,l,n.from.x,o),a=t.effects.setTransition(i,l,n.to.x,a)),u&&t.effects.saveStyle(i),i.css(o),i.animate(a,e.duration,e.easing,function(){u&&t.effects.restoreStyle(i)})})),a.animate(v,{queue:!1,duration:e.duration,easing:e.easing,complete:function(){var e=a.offset();0===v.opacity&&a.css("opacity",_.opacity),u||(a.css("position","static"===f?"relative":f).offset(e),t.effects.saveStyle(a)),i()}})}),t.effects.define("scale",function(e,i){var s=t(this),n=e.mode,o=parseInt(e.percent,10)||(0===parseInt(e.percent,10)?0:"effect"!==n?0:100),a=t.extend(!0,{from:t.effects.scaledDimensions(s),to:t.effects.scaledDimensions(s,o,e.direction||"both"),origin:e.origin||["middle","center"]},e);e.fade&&(a.from.opacity=1,a.to.opacity=0),t.effects.effect.size.call(this,a,i)}),t.effects.define("puff","hide",function(e,i){var s=t.extend(!0,{},e,{fade:!0,percent:parseInt(e.percent,10)||150});t.effects.effect.scale.call(this,s,i)}),t.effects.define("pulsate","show",function(e,i){var s=t(this),n=e.mode,o="show"===n,a="hide"===n,r=o||a,h=2*(e.times||5)+(r?1:0),l=e.duration/h,c=0,u=1,d=s.queue().length;for((o||!s.is(":visible"))&&(s.css("opacity",0).show(),c=1);h>u;u++)s.animate({opacity:c},l,e.easing),c=1-c;s.animate({opacity:c},l,e.easing),s.queue(i),t.effects.unshift(s,d,h+1)}),t.effects.define("shake",function(e,i){var s=1,n=t(this),o=e.direction||"left",a=e.distance||20,r=e.times||3,h=2*r+1,l=Math.round(e.duration/h),c="up"===o||"down"===o?"top":"left",u="up"===o||"left"===o,d={},p={},f={},g=n.queue().length;for(t.effects.createPlaceholder(n),d[c]=(u?"-=":"+=")+a,p[c]=(u?"+=":"-=")+2*a,f[c]=(u?"-=":"+=")+2*a,n.animate(d,l,e.easing);r>s;s++)n.animate(p,l,e.easing).animate(f,l,e.easing);n.animate(p,l,e.easing).animate(d,l/2,e.easing).queue(i),t.effects.unshift(n,g,h+1)}),t.effects.define("slide","show",function(e,i){var s,n,o=t(this),a={up:["bottom","top"],down:["top","bottom"],left:["right","left"],right:["left","right"]},r=e.mode,h=e.direction||"left",l="up"===h||"down"===h?"top":"left",c="up"===h||"left"===h,u=e.distance||o["top"===l?"outerHeight":"outerWidth"](!0),d={};t.effects.createPlaceholder(o),s=o.cssClip(),n=o.position()[l],d[l]=(c?-1:1)*u+n,d.clip=o.cssClip(),d.clip[a[h][1]]=d.clip[a[h][0]],"show"===r&&(o.cssClip(d.clip),o.css(l,d[l]),d.clip=s,d[l]=n),o.animate(d,{queue:!1,duration:e.duration,easing:e.easing,complete:i})});var f;t.uiBackCompat!==!1&&(f=t.effects.define("transfer",function(e,i){t(this).transfer(e,i)})),t.ui.focusable=function(i,s){var n,o,a,r,h,l=i.nodeName.toLowerCase();return"area"===l?(n=i.parentNode,o=n.name,i.href&&o&&"map"===n.nodeName.toLowerCase()?(a=t("img[usemap='#"+o+"']"),a.length>0&&a.is(":visible")):!1):(/^(input|select|textarea|button|object)$/.test(l)?(r=!i.disabled,r&&(h=t(i).closest("fieldset")[0],h&&(r=!h.disabled))):r="a"===l?i.href||s:s,r&&t(i).is(":visible")&&e(t(i)))},t.extend(t.expr
vendor: 2,705 bytes, line 21
21.pseudos,{focusable:function(e){return t.ui.focusable(e,null!=t.attr(e,"tabindex"))}}),t.ui.focusable,t.fn.form=function(){return"string"==typeof this[0].form?this.closest("form"):t(this[0].form)},t.ui.formResetMixin={_formResetHandler:function(){var e=t(this);setTimeout(function(){var i=e.data("ui-form-reset-instances");t.each(i,function(){this.refresh()})})},_bindFormResetHandler:function(){if(this.form=this.element.form(),this.form.length){var t=this.form.data("ui-form-reset-instances")||[];t.length||this.form.on("reset.ui-form-reset",this._formResetHandler),t.push(this),this.form.data("ui-form-reset-instances",t)}},_unbindFormResetHandler:function(){if(this.form.length){var e=this.form.data("ui-form-reset-instances");e.splice(t.inArray(this,e),1),e.length?this.form.data("ui-form-reset-instances",e):this.form.removeData("ui-form-reset-instances").off("reset.ui-form-reset")}}},"1.7"===t.fn.jquery.substring(0,3)&&(t.each(["Width","Height"],function(e,i){function s(e,i,s,o){return t.each(n,function(){i-=parseFloat(t.css(e,"padding"+this))||0,s&&(i-=parseFloat(t.css(e,"border"+this+"Width"))||0),o&&(i-=parseFloat(t.css(e,"margin"+this))||0)}),i}var n="Width"===i?["Left","Right"]:["Top","Bottom"],o=i.toLowerCase(),a={innerWidth:t.fn.innerWidth,innerHeight:t.fn.innerHeight,outerWidth:t.fn.outerWidth,outerHeight:t.fn.outerHeight};t.fn["inner"+i]=function(e){return void 0===e?a["inner"+i].call(this):this.each(function(){t(this).css(o,s(this,e)+"px")})},t.fn["outer"+i]=function(e,n){return"number"!=typeof e?a["outer"+i].call(this,e):this.each(function(){t(this).css(o,s(this,e,!0,n)+"px")})}}),t.fn.addBack=function(t){return this.add(null==t?this.prevObject:this.prevObject.filter(t))}),t.ui.keyCode={BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38},t.ui.escapeSelector=function(){var t=/([!"#$%&'()*+,.\/:;<=>?@[\]^`{|}~])/g;return function(e){return e.replace(t,"\\$1")}}(),t.fn.labels=function(){var e,i,s,n,o;return this[0].labels&&this[0].labels.length?this.pushStack(this[0].labels):(n=this.eq(0).parents("label"),s=this.attr("id"),s&&(e=this.eq(0).parents().last(),o=e.add(e.length?e.siblings():this.siblings()),i="label[for='"+t.ui.escapeSelector(s)+"']",n=n.add(o.find(i).addBack(i))),this.pushStack(n))},t.fn.scrollParent=function(e){var i=this.css("position"),s="absolute"===i,n=e?/(auto|scroll|hidden)/:/(auto|scroll)/,o=this.parents().filter(function(){var e=t(this);return s&&"static"===e.css("position")?!1:n.test(e.css("overflow")+e.css("overflow-y")+e.css("overflow-x"))}).eq(0);return"fixed"!==i&&o.length?o:t(this[0].ownerDocument||document)},t.extend(t.expr.pseudos
vendor: 18,592 bytes, line 21
21,{tabbable:function(e){var i=t.attr(e,"tabindex"),s=null!=i;return(!s||i>=0)&&t.ui.focusable(e,s)}}),t.fn.extend({uniqueId:function(){var t=0;return function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++t)})}}(),removeUniqueId:function(){return this.each(function(){/^ui-id-\d+$/.test(this.id)&&t(this).removeAttr("id")})}}),t.widget("ui.accordion",{version:"1.12.1",options:{active:0,animate:{},classes:{"ui-accordion-header":"ui-corner-top","ui-accordion-header-collapsed":"ui-corner-all","ui-accordion-content":"ui-corner-bottom"},collapsible:!1,event:"click",header:"> li > :first-child, > :not(li):even",heightStyle:"auto",icons:{activeHeader:"ui-icon-triangle-1-s",header:"ui-icon-triangle-1-e"},activate:null,beforeActivate:null},hideProps:{borderTopWidth:"hide",borderBottomWidth:"hide",paddingTop:"hide",paddingBottom:"hide",height:"hide"},showProps:{borderTopWidth:"show",borderBottomWidth:"show",paddingTop:"show",paddingBottom:"show",height:"show"},_create:function(){var e=this.options;this.prevShow=this.prevHide=t(),this._addClass("ui-accordion","ui-widget ui-helper-reset"),this.element.attr("role","tablist"),e.collapsible||e.active!==!1&&null!=e.active||(e.active=0),this._processPanels(),0>e.active&&(e.active+=this.headers.length),this._refresh()},_getCreateEventData:function(){return{header:this.active,panel:this.active.length?this.active.next():t()}},_createIcons:function(){var e,i,s=this.options.icons;s&&(e=t("<span>"),this._addClass(e,"ui-accordion-header-icon","ui-icon "+s.header),e.prependTo(this.headers),i=this.active.children(".ui-accordion-header-icon"),this._removeClass(i,s.header)._addClass(i,null,s.activeHeader)._addClass(this.headers,"ui-accordion-icons"))},_destroyIcons:function(){this._removeClass(this.headers,"ui-accordion-icons"),this.headers.children(".ui-accordion-header-icon").remove()},_destroy:function(){var t;this.element.removeAttr("role"),this.headers.removeAttr("role aria-expanded aria-selected aria-controls tabIndex").removeUniqueId(),this._destroyIcons(),t=this.headers.next().css("display","").removeAttr("role aria-hidden aria-labelledby").removeUniqueId(),"content"!==this.options.heightStyle&&t.css("height","")},_setOption:function(t,e){return"active"===t?(this._activate(e),void 0):("event"===t&&(this.options.event&&this._off(this.headers,this.options.event),this._setupEvents(e)),this._super(t,e),"collapsible"!==t||e||this.options.active!==!1||this._activate(0),"icons"===t&&(this._destroyIcons(),e&&this._createIcons()),void 0)},_setOptionDisabled:function(t){this._super(t),this.element.attr("aria-disabled",t),this._toggleClass(null,"ui-state-disabled",!!t),this._toggleClass(this.headers.add(this.headers.next()),null,"ui-state-disabled",!!t)},_keydown:function(e){if(!e.altKey&&!e.ctrlKey){var i=t.ui.keyCode,s=this.headers.length,n=this.headers.index(e.target),o=!1;switch(e.keyCode){case i.RIGHT:case i.DOWN:o=this.headers[(n+1)%s];break;case i.LEFT:case i.UP:o=this.headers[(n-1+s)%s];break;case i.SPACE:case i.ENTER:this._eventHandler(e);break;case i.HOME:o=this.headers[0];break;case i.END:o=this.headers[s-1]}o&&(t(e.target).attr("tabIndex",-1),t(o).attr("tabIndex",0),t(o).trigger("focus"),e.preventDefault())}},_panelKeyDown:function(e){e.keyCode===t.ui.keyCode.UP&&e.ctrlKey&&t(e.currentTarget).prev().trigger("focus")},refresh:function(){var e=this.options;this._processPanels(),e.active===!1&&e.collapsible===!0||!this.headers.length?(e.active=!1,this.active=t()):e.active===!1?this._activate(0):this.active.length&&!t.contains(this.element[0],this.active[0])?this.headers.length===this.headers.find(".ui-state-disabled").length?(e.active=!1,this.active=t()):this._activate(Math.max(0,e.active-1)):e.active=this.headers.index(this.active),this._destroyIcons(),this._refresh()},_processPanels:function(){var t=this.headers,e=this.panels;this.headers=this.element.find(this.options.header),this._addClass(this.headers,"ui-accordion-header ui-accordion-header-collapsed","ui-state-default"),this.panels=this.headers.next().filter(":not(.ui-accordion-content-active)").hide(),this._addClass(this.panels,"ui-accordion-content","ui-helper-reset ui-widget-content"),e&&(this._off(t.not(this.headers)),this._off(e.not(this.panels)))},_refresh:function(){var e,i=this.options,s=i.heightStyle,n=this.element.parent();this.active=this._findActive(i.active),this._addClass(this.active,"ui-accordion-header-active","ui-state-active")._removeClass(this.active,"ui-accordion-header-collapsed"),this._addClass(this.active.next(),"ui-accordion-content-active"),this.active.next().show(),this.headers.attr("role","tab").each(function(){var e=t(this),i=e.uniqueId().attr("id"),s=e.next(),n=s.uniqueId().attr("id");e.attr("aria-controls",n),s.attr("aria-labelledby",i)}).next().attr("role","tabpanel"),this.headers.not(this.active).attr({"aria-selected":"false","aria-expanded":"false",tabIndex:-1}).next().attr({"aria-hidden":"true"}).hide(),this.active.length?this.active.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0}).next().attr({"aria-hidden":"false"}):this.headers.eq(0).attr("tabIndex",0),this._createIcons(),this._setupEvents(i.event),"fill"===s?(e=n.height(),this.element.siblings(":visible").each(function(){var i=t(this),s=i.css("position");"absolute"!==s&&"fixed"!==s&&(e-=i.outerHeight(!0))}),this.headers.each(function(){e-=t(this).outerHeight(!0)}),this.headers.next().each(function(){t(this).height(Math.max(0,e-t(this).innerHeight()+t(this).height()))}).css("overflow","auto")):"auto"===s&&(e=0,this.headers.next().each(function(){var i=t(this).is(":visible");i||t(this).show(),e=Math.max(e,t(this).css("height","").height()),i||t(this).hide()}).height(e))},_activate:function(e){var i=this._findActive(e)[0];i!==this.active[0]&&(i=i||this.active[0],this._eventHandler({target:i,currentTarget:i,preventDefault:t.noop}))},_findActive:function(e){return"number"==typeof e?this.headers.eq(e):t()},_setupEvents:function(e){var i={keydown:"_keydown"};e&&t.each(e.split(" "),function(t,e){i[e]="_eventHandler"}),this._off(this.headers.add(this.headers.next())),this._on(this.headers,i),this._on(this.headers.next(),{keydown:"_panelKeyDown"}),this._hoverable(this.headers),this._focusable(this.headers)},_eventHandler:function(e){var i,s,n=this.options,o=this.active,a=t(e.currentTarget),r=a[0]===o[0],h=r&&n.collapsible,l=h?t():a.next(),c=o.next(),u={oldHeader:o,oldPanel:c,newHeader:h?t():a,newPanel:l};e.preventDefault(),r&&!n.collapsible||this._trigger("beforeActivate",e,u)===!1||(n.active=h?!1:this.headers.index(a),this.active=r?t():a,this._toggle(u),this._removeClass(o,"ui-accordion-header-active","ui-state-active"),n.icons&&(i=o.children(".ui-accordion-header-icon"),this._removeClass(i,null,n.icons.activeHeader)._addClass(i,null,n.icons.header)),r||(this._removeClass(a,"ui-accordion-header-collapsed")._addClass(a,"ui-accordion-header-active","ui-state-active"),n.icons&&(s=a.children(".ui-accordion-header-icon"),this._removeClass(s,null,n.icons.header)._addClass(s,null,n.icons.activeHeader)),this._addClass(a.next(),"ui-accordion-content-active")))},_toggle:function(e){var i=e.newPanel,s=this.prevShow.length?this.prevShow:e.oldPanel;this.prevShow.add(this.prevHide).stop(!0,!0),this.prevShow=i,this.prevHide=s,this.options.animate?this._animate(i,s,e):(s.hide(),i.show(),this._toggleComplete(e)),s.attr({"aria-hidden":"true"}),s.prev().attr({"aria-selected":"false","aria-expanded":"false"}),i.length&&s.length?s.prev().attr({tabIndex:-1,"aria-expanded":"false"}):i.length&&this.headers.filter(function(){return 0===parseInt(t(this).attr("tabIndex"),10)}).attr("tabIndex",-1),i.attr("aria-hidden","false").prev().attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0})},_animate:function(t,e,i){var s,n,o,a=this,r=0,h=t.css("box-sizing"),l=t.length&&(!e.length||t.index()<e.index()),c=this.options.animate||{},u=l&&c.down||c,d=function(){a._toggleComplete(i)};return"number"==typeof u&&(o=u),"string"==typeof u&&(n=u),n=n||u.easing||c.easing,o=o||u.duration||c.duration,e.length?t.length?(s=t.show().outerHeight(),e.animate(this.hideProps,{duration:o,easing:n,step:function(t,e){e.now=Math.round(t)}}),t.hide().animate(this.showProps,{duration:o,easing:n,complete:d,step:function(t,i){i.now=Math.round(t),"height"!==i.prop?"content-box"===h&&(r+=i.now):"content"!==a.options.heightStyle&&(i.now=Math.round(s-e.outerHeight()-r),r=0)}}),void 0):e.animate(this.hideProps,o,n,d):t.animate(this.showProps,o,n,d)},_toggleComplete:function(t){var e=t.oldPanel,i=e.prev();this._removeClass(e,"ui-accordion-content-active"),this._removeClass(i,"ui-accordion-header-active")._addClass(i,"ui-accordion-header-collapsed"),e.length&&(e.parent()[0].className=e.parent()[0].className),this._trigger("activate",null,t)}}),t.ui.safeActiveElement=function(t){var e;try{e=t.activeElement}catch(i){e=t.body}return e||(e=t.body),e.nodeName||(e=t.body),e},t.widget("ui.menu",{version:"1.12.1",defaultElement:"<ul>",delay:300,options:{icons:{submenu:"ui-icon-caret-1-e"},items:"> *",menus:"ul",position:{my:"left top",at:"right top"},role:"menu",blur:null,focus:null,select:null},_create:function(){this.activeMenu=this.element,this.mouseHandled=!1,this.element.uniqueId().attr({role:this.options.role,tabIndex:0}),this._addClass("ui-menu","ui-widget ui-widget-content"),this._on({"mousedown .ui-menu-item":function(t){t.preventDefault()},"click .ui-menu-item":function(e){var i=t(e.target),s=t(t.ui.safeActiveElement(this.document[0]));!this.mouseHandled&&i.not(".ui-state-disabled").length&&(this.select(e),e.isPropagationStopped()||(this.mouseHandled=!0),i.has(".ui-menu").length?this.expand(e):!this.element.is(":focus")&&s.closest(".ui-menu").length&&(this.element.trigger("focus",[!0]),this.active&&1===this.active.parents(".ui-menu").length&&clearTimeout(this.timer)))},"mouseenter .ui-menu-item":function(e){if(!this.previousFilter){var i=t(e.target).closest(".ui-menu-item"),s=t(e.currentTarget);i[0]===s[0]&&(this._removeClass(s.siblings().children(".ui-state-active"),null,"ui-state-active"),this.focus(e,s))}},mouseleave:"collapseAll","mouseleave .ui-menu":"collapseAll",focus:function(t,e){var i=this.active||this.element.find(this.options.items).eq(0);e||this.focus(t,i)},blur:function(e){this._delay(function(){var i=!t.contains(this.element[0],t.ui.safeActiveElement(this.document[0]));i&&this.collapseAll(e)})},keydown:"_keydown"}),this.refresh(),this._on(this.document,{click:function(t){this._closeOnDocumentClick(t)&&this.collapseAll(t),this.mouseHandled=!1}})},_destroy:function(){var e=this.element.find(".ui-menu-item").removeAttr("role aria-disabled"),i=e.children(".ui-menu-item-wrapper").removeUniqueId().removeAttr("tabIndex role aria-haspopup");this.element.removeAttr("aria-activedescendant").find(".ui-menu").addBack().removeAttr("role aria-labelledby aria-expanded aria-hidden aria-disabled tabIndex").removeUniqueId().show(),i.children().each(function(){var e=t(this);e.data("ui-menu-submenu-caret")&&e.remove()})},_keydown:function(e){var i,s,n,o,a=!0;switch(e.keyCode){case t.ui.keyCode.PAGE_UP:this.previousPage(e);break;case t.ui.keyCode.PAGE_DOWN:this.nextPage(e);break;case t.ui.keyCode.HOME:this._move("first","first",e);break;case t.ui.keyCode.END:this._move("last","last",e);break;case t.ui.keyCode.UP:this.previous(e);break;case t.ui.keyCode.DOWN:this.next(e);break;case t.ui.keyCode.LEFT:this.collapse(e);break;case t.ui.keyCode.RIGHT:this.active&&!this.active.is(".ui-state-disabled")&&this.expand(e);break;case t.ui.keyCode.ENTER:case t.ui.keyCode.SPACE:this._activate(e);break;case t.ui.keyCode.ESCAPE:this.collapse(e);break;default:a=!1,s=this.previousFilter||"",o=!1,n=e.keyCode>=96&&105>=e.keyCode?""+(e.keyCode-96):String.fromCharCode(e.keyCode),clearTimeout(this.filterTimer),n===s?o=!0:n=s+n,i=this._filterMenuItems(n),i=o&&-1!==i.index(this.active.next())?this.active.nextAll(".ui-menu-item"):i,i.length||(n=String.fromCharCode(e.keyCode),i=this._filterMenuItems(n)),i.length?(this.focus(e,i),this.previousFilter=n,this.filterTimer=this._delay(function(){delete this.previousFilter},1e3)):delete this.previousFilter}a&&e.preventDefault()},_activate:function(t){this.active&&!this.active.is(".ui-state-disabled")&&(this.active.children("[aria-haspopup='true']").length?this.expand(t):this.select(t))},refresh:function(){var e,i,s,n,o,a=this,r=this.options.icons.submenu,h=this.element.find(this.options.menus);this._toggleClass("ui-menu-icons",null,!!this.element.find(".ui-icon").length),s=h.filter(":not(.ui-menu)").hide().attr({role:this.options.role,"aria-hidden":"true","aria-expanded":"false"}).each(function(){var e=t(this),i=e.prev(),s=t("<span>").data("ui-menu-submenu-caret",!0);a._addClass(s,"ui-menu-icon","ui-icon "+r),i.attr("aria-haspopup","true").prepend(s),e.attr("aria-labelledby",i.attr("id"))}),this._addClass(s,"ui-menu","ui-widget ui-widget-content ui-front"),e=h.add(this.element),i=e.find(this.options.items),i.not(".ui-menu-item").each(function(){var e=t(this);a._isDivider(e)&&a._addClass(e,"ui-menu-divider","ui-widget-content")}),n=i.not(".ui-menu-item, .ui-menu-divider"),o=n.children().not(".ui-menu").uniqueId().attr({tabIndex:-1,role:this._itemRole()}),this._addClass(n,"ui-menu-item")._addClass(o,"ui-menu-item-wrapper"),i.filter(".ui-state-disabled").attr("aria-disabled","true"),this.active&&!t.contains(this.element[0],this.active[0])&&this.blur()},_itemRole:function(){return{menu:"menuitem",listbox:"option"}[this.options.role]},_setOption:function(t,e){if("icons"===t){var i=this.element.find(".ui-menu-icon");this._removeClass(i,null,this.options.icons.submenu)._addClass(i,null,e.submenu)}this._super(t,e)},_setOptionDisabled:function(t){this._super(t),this.element.attr("aria-disabled",t+""),this._toggleClass(null,"ui-state-disabled",!!t)},focus:function(t,e){var i,s,n;this.blur(t,t&&"focus"===t.type),this._scrollIntoView(e),this.active=e.first(),s=this.active.children(".ui-menu-item-wrapper"),this._addClass(s,null,"ui-state-active"),this.options.role&&this.element.attr("aria-activedescendant",s.attr("id")),n=this.active.parent().closest(".ui-menu-item").children(".ui-menu-item-wrapper"),this._addClass(n,null,"ui-state-active"),t&&"keydown"===t.type?this._close():this.timer=this._delay(function(){this._close()},this.delay),i=e.children(".ui-menu"),i.length&&t&&/^mouse/.test(t.type)&&this._startOpening(i),this.activeMenu=e.parent(),this._trigger("focus",t,{item:e})},_scrollIntoView:function(e){var i,s,n,o,a,r;this._hasScroll()&&(i=parseFloat(t.css(this.activeMenu[0],"borderTopWidth"))||0,s=parseFloat(t.css(this.activeMenu[0],"paddingTop"))||0,n=e.offset().top-this.activeMenu.offset().top-i-s,o=this.activeMenu.scrollTop(),a=this.activeMenu.height(),r=e.outerHeight(),0>n?this.activeMenu.scrollTop(o+n):n+r>a&&this.activeMenu.scrollTop(o+n-a+r))},blur:function(t,e){e||clearTimeout(this.timer),this.active&&(this._removeClass(this.active.children(".ui-menu-item-wrapper"),null,"ui-state-active"),this._trigger("blur",t,{item:this.active}),this.active=null)},_startOpening:function(t){clearTimeout(this.timer),"true"===t.attr("aria-hidden")&&(this.timer=this._delay(function(){this._close(),this._open(t)},this.delay))},_open:function(e){var i=t.extend({of:this.active},this.options.position);clearTimeout(this.timer),this.element.find(".ui-menu").not(e.parents(".ui-menu")).hide().attr("aria-hidden","true"),e.show().removeAttr("aria-hidden").attr("aria-expanded","true").position(i)},collapseAll:function(e,i){clearTimeout(this.timer),this.timer=this._delay(function(){var s=i?this.element:t(e&&e.target).closest(this.element.find(".ui-menu"));s.length||(s=this.element),this._close(s),this.blur(e),this._removeClass(s.find(".ui-state-active"),null,"ui-state-active"),this.activeMenu=s},this.delay)},_close:function(t){t||(t=this.active?this.active.parent():this.element),t.find(".ui-menu").hide().attr("aria-hidden","true").attr("aria-expanded","false")},_closeOnDocumentClick:function(e){return!t(e.target).closest(".ui-menu").length},_isDivider:function(t){return!/[^\-\u2014\u2013\s]/.test(t.text())},collapse:function(t){var e=this.active&&this.active.parent().closest(".ui-menu-item",this.element);e&&e.length&&(this._close(),this.focus(t,e))},expand:function(t){var e=this.active&&this.active.children(".ui-menu ").find(this.options.items).first();e&&e.length&&(this._open(e.parent()),this._delay(function(){this.focus(t,e)}))},next:function(t){this._move("next","first",t)},previous:function(t){this._move("prev","last",t)},isFirstItem:function(){return this.active&&!this.active.prevAll(".ui-menu-item").length},isLastItem:function(){return this.active&&!this.active.nextAll(".ui-menu-item").length},_move:function(t,e,i){var s;this.active&&(s="first"===t||"last"===t?this.active["first"===t?"prevAll":"nextAll"](".ui-menu-item").eq(-1):this.active[t+"All"](".ui-menu-item").eq(0)),s&&s.length&&this.active||(s=this.activeMenu.find(this.options.items)[e]()),this.focus(i,s)},nextPage:function(e){var i,s,n;return this.active?(this.isLastItem()||(this._hasScroll()?(s=this.active.offset().top,n=this.element.height(),this.active.nextAll(".ui-menu-item").each(function(){return i=t(this),0>i.offset().top-s-n}),this.focus(e,i)):this.focus(e,this.activeMenu.find(this.options.items)[this.active?"last":"first"]())),void 0):(this.next(e),void 0)},previousPage:function(e){var i,s,n;return this.active?(this.isFirstItem()||(this._hasScroll()?(s=this.active.offset().top,n=this.element.height(),this.active.prevAll(".ui-menu-item").each(function(){return i=t(this),i.offset().top-s+n>0}),this.focus(e,i)):this.focus(e,this.activeMenu.find(this.options.items).first())),void 0):(this.next(e),void 0)},_hasScroll:function(){return this.element.outerHeight()<this.element.prop("scrollHeight")},select:function(e){this.active=this.active||t(e.target).closest(".ui-menu-item");var i={item:this.active};this.active.has(".ui-menu").length||this.collapseAll(e,!0),this._trigger("select",e,i)},_filterMenuItems:function(e){var i=e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&"),s=RegExp("^"+i,"i");return this.activeMenu.find(this.options.items).filter(".ui-menu-item").filter(function(){return s.test(t.trim(t(this).children(".ui-menu-item-wrapper").text()))})}}),t.widget("ui.autocomplete",{version:"1.12.1",defaultElement:"<input>",options:{appendTo:null,autoFocus:!1,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null,change:null,close:null,focus:null,open:null,response:null,search:null,select:null},requestIndex:0,pending:0,_create:function(){var e,i,s,n=this.element[0].nodeName.toLowerCase(),o="textarea"===n,a="input"===n;
vendor: 5,520 bytes, lines 21-22
21
22this.isMultiLine=o||!a&&this._isContentEditable(this.element),this.valueMethod=this.element[o||a?"val":"text"],this.isNewMenu=!0,this._addClass("ui-autocomplete-input"),this.element.attr("autocomplete","off"),this._on(this.element,{keydown:function(n){if(this.element.prop("readOnly"))return e=!0,s=!0,i=!0,void 0;e=!1,s=!1,i=!1;var o=t.ui.keyCode;switch(n.keyCode){case o.PAGE_UP:e=!0,this._move("previousPage",n);break;case o.PAGE_DOWN:e=!0,this._move("nextPage",n);break;case o.UP:e=!0,this._keyEvent("previous",n);break;case o.DOWN:e=!0,this._keyEvent("next",n);break;case o.ENTER:this.menu.active&&(e=!0,n.preventDefault(),this.menu.select(n));break;case o.TAB:this.menu.active&&this.menu.select(n);break;case o.ESCAPE:this.menu.element.is(":visible")&&(this.isMultiLine||this._value(this.term),this.close(n),n.preventDefault());break;default:i=!0,this._searchTimeout(n)}},keypress:function(s){if(e)return e=!1,(!this.isMultiLine||this.menu.element.is(":visible"))&&s.preventDefault(),void 0;if(!i){var n=t.ui.keyCode;switch(s.keyCode){case n.PAGE_UP:this._move("previousPage",s);break;case n.PAGE_DOWN:this._move("nextPage",s);break;case n.UP:this._keyEvent("previous",s);break;case n.DOWN:this._keyEvent("next",s)}}},input:function(t){return s?(s=!1,t.preventDefault(),void 0):(this._searchTimeout(t),void 0)},focus:function(){this.selectedItem=null,this.previous=this._value()},blur:function(t){return this.cancelBlur?(delete this.cancelBlur,void 0):(clearTimeout(this.searching),this.close(t),this._change(t),void 0)}}),this._initSource(),this.menu=t("<ul>").appendTo(this._appendTo()).menu({role:null}).hide().menu("instance"),this._addClass(this.menu.element,"ui-autocomplete","ui-front"),this._on(this.menu.element,{mousedown:function(e){e.preventDefault(),this.cancelBlur=!0,this._delay(function(){delete this.cancelBlur,this.element[0]!==t.ui.safeActiveElement(this.document[0])&&this.element.trigger("focus")})},menufocus:function(e,i){var s,n;return this.isNewMenu&&(this.isNewMenu=!1,e.originalEvent&&/^mouse/.test(e.originalEvent.type))?(this.menu.blur(),this.document.one("mousemove",function(){t(e.target).trigger(e.originalEvent)}),void 0):(n=i.item.data("ui-autocomplete-item"),n&&!1!==this._trigger("focus",e,{item:n})&&e.originalEvent&&/^key/.test(e.originalEvent.type)&&this._value(n.value),s=i.item.attr("aria-label")||(n?n.value:null),s&&t.trim(s).length&&(this.liveRegion.children().hide(),t("<div>").text(s).appendTo(this.liveRegion)),void 0)},menuselect:function(e,i){var s=i.item.data("ui-autocomplete-item"),n=this.previous;this.element[0]!==t.ui.safeActiveElement(this.document[0])&&(this.element.trigger("focus"),this.previous=n,this._delay(function(){this.previous=n,this.selectedItem=s})),!1!==this._trigger("select",e,{item:s})&&this._value(s.value),this.term=this._value(),this.close(e),this.selectedItem=s}}),this.liveRegion=t("<div>",{role:"status","aria-live":"assertive","aria-relevant":"additions"}).appendTo(this.document[0].body),this._addClass(this.liveRegion,null,"ui-helper-hidden-accessible"),this._on(this.window,{beforeunload:function(){this.element.removeAttr("autocomplete")}})},_destroy:function(){clearTimeout(this.searching),this.element.removeAttr("autocomplete"),this.menu.element.remove(),this.liveRegion.remove()},_setOption:function(t,e){this._super(t,e),"source"===t&&this._initSource(),"appendTo"===t&&this.menu.element.appendTo(this._appendTo()),"disabled"===t&&e&&this.xhr&&this.xhr.abort()},_isEventTargetInWidget:function(e){var i=this.menu.element[0];return e.target===this.element[0]||e.target===i||t.contains(i,e.target)},_closeOnClickOutside:function(t){this._isEventTargetInWidget(t)||this.close()},_appendTo:function(){var e=this.options.appendTo;return e&&(e=e.jquery||e.nodeType?t(e):this.document.find(e).eq(0)),e&&e[0]||(e=this.element.closest(".ui-front, dialog")),e.length||(e=this.document[0].body),e},_initSource:function(){var e,i,s=this;t.isArray(this.options.source)?(e=this.options.source,this.source=function(i,s){s(t.ui.autocomplete.filter(e,i.term))}):"string"==typeof this.options.source?(i=this.options.source,this.source=function(e,n){s.xhr&&s.xhr.abort(),s.xhr=t.ajax({url:i,data:e,dataType:"json",success:function(t){n(t)},error:function(){n([])}})}):this.source=this.options.source},_searchTimeout:function(t){clearTimeout(this.searching),this.searching=this._delay(function(){var e=this.term===this._value(),i=this.menu.element.is(":visible"),s=t.altKey||t.ctrlKey||t.metaKey||t.shiftKey;(!e||e&&!i&&!s)&&(this.selectedItem=null,this.search(null,t))},this.options.delay)},search:function(t,e){return t=null!=t?t:this._value(),this.term=this._value(),t.length<this.options.minLength?this.close(e):this._trigger("search",e)!==!1?this._search(t):void 0},_search:function(t){this.pending++,this._addClass("ui-autocomplete-loading"),this.cancelSearch=!1,this.source({term:t},this._response())},_response:function(){var e=++this.requestIndex;return t.proxy(function(t){e===this.requestIndex&&this.__response(t),this.pending--,this.pending||this._removeClass("ui-autocomplete-loading")},this)},__response:function(t){t&&(t=this._normalize(t)),this._trigger("response",null,{content:t}),!this.options.disabled&&t&&t.length&&!this.cancelSearch?(this._suggest(t),this._trigger("open")):this._close()},close:function(t){this.cancelSearch=!0,this._close(t)},_close:function(t){this._off(this.document,"mousedown"),this.menu.element.is(":visible")&&(this.menu.element.hide(),this.menu.blur(),this.isNewMenu=!0,this._trigger("close",t))}
vendor: 4,054 bytes, line 22
22,_change:function(t){this.previous!==this._value()&&this._trigger("change",t,{item:this.selectedItem})},_normalize:function(e){return e.length&&e[0].label&&e[0].value?e:t.map(e,function(e){return"string"==typeof e?{label:e,value:e}:t.extend({},e,{label:e.label||e.value,value:e.value||e.label})})},_suggest:function(e){var i=this.menu.element.empty();this._renderMenu(i,e),this.isNewMenu=!0,this.menu.refresh(),i.show(),this._resizeMenu(),i.position(t.extend({of:this.element},this.options.position)),this.options.autoFocus&&this.menu.next(),this._on(this.document,{mousedown:"_closeOnClickOutside"})},_resizeMenu:function(){var t=this.menu.element;t.outerWidth(Math.max(t.width("").outerWidth()+1,this.element.outerWidth()))},_renderMenu:function(e,i){var s=this;t.each(i,function(t,i){s._renderItemData(e,i)})},_renderItemData:function(t,e){return this._renderItem(t,e).data("ui-autocomplete-item",e)},_renderItem:function(e,i){return t("<li>").append(t("<div>").text(i.label)).appendTo(e)},_move:function(t,e){return this.menu.element.is(":visible")?this.menu.isFirstItem()&&/^previous/.test(t)||this.menu.isLastItem()&&/^next/.test(t)?(this.isMultiLine||this._value(this.term),this.menu.blur(),void 0):(this.menu[t](e),void 0):(this.search(null,e),void 0)},widget:function(){return this.menu.element},_value:function(){return this.valueMethod.apply(this.element,arguments)},_keyEvent:function(t,e){(!this.isMultiLine||this.menu.element.is(":visible"))&&(this._move(t,e),e.preventDefault())},_isContentEditable:function(t){if(!t.length)return!1;var e=t.prop("contentEditable");return"inherit"===e?this._isContentEditable(t.parent()):"true"===e}}),t.extend(t.ui.autocomplete,{escapeRegex:function(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")},filter:function(e,i){var s=RegExp(t.ui.autocomplete.escapeRegex(i),"i");return t.grep(e,function(t){return s.test(t.label||t.value||t)})}}),t.widget("ui.autocomplete",t.ui.autocomplete,{options:{messages:{noResults:"No search results.",results:function(t){return t+(t>1?" results are":" result is")+" available, use up and down arrow keys to navigate."}}},__response:function(e){var i;this._superApply(arguments),this.options.disabled||this.cancelSearch||(i=e&&e.length?this.options.messages.results(e.length):this.options.messages.noResults,this.liveRegion.children().hide(),t("<div>").text(i).appendTo(this.liveRegion))}}),t.ui.autocomplete;var g=/ui-corner-([a-z]){2,6}/g;t.widget("ui.controlgroup",{version:"1.12.1",defaultElement:"<div>",options:{direction:"horizontal",disabled:null,onlyVisible:!0,items:{button:"input[type=button], input[type=submit], input[type=reset], button, a",controlgroupLabel:".ui-controlgroup-label",checkboxradio:"input[type='checkbox'], input[type='radio']",selectmenu:"select",spinner:".ui-spinner-input"}},_create:function(){this._enhance()},_enhance:function(){this.element.attr("role","toolbar"),this.refresh()},_destroy:function(){this._callChildMethod("destroy"),this.childWidgets.removeData("ui-controlgroup-data"),this.element.removeAttr("role"),this.options.items.controlgroupLabel&&this.element.find(this.options.items.controlgroupLabel).find(".ui-controlgroup-label-contents").contents().unwrap()},_initWidgets:function(){var e=this,i=[];t.each(this.options.items,function(s,n){var o,a={};return n?"controlgroupLabel"===s?(o=e.element.find(n),o.each(function(){var e=t(this);e.children(".ui-controlgroup-label-contents").length||e.contents().wrapAll("<span class='ui-controlgroup-label-contents'></span>")}),e._addClass(o,null,"ui-widget ui-widget-content ui-state-default"),i=i.concat(o.get()),void 0):(t.fn[s]&&(a=e["_"+s+"Options"]?e["_"+s+"Options"]("middle"):{classes:{}},e.element.find(n).each(function(){var n=t(this),o=n[s]("instance"),r=t.widget.extend({},a);if("button"!==s||!n.parent(".ui-spinner").length){o||(o=n[s]()[s]("instance")),o&&(r.classes=e._resolveClassesValues(r.classes,o)),n[s](r);var h=n[s]("widget");t.data(h[0],"ui-controlgroup-data",o?o:n[s]("instance")),i.push(h[0])}})),void 0):void 0}),this.childWidgets=t(t.uniqueSort
vendor: 21,713 bytes, line 22
22(i)),this._addClass(this.childWidgets,"ui-controlgroup-item")},_callChildMethod:function(e){this.childWidgets.each(function(){var i=t(this),s=i.data("ui-controlgroup-data");s&&s[e]&&s[e]()})},_updateCornerClass:function(t,e){var i="ui-corner-top ui-corner-bottom ui-corner-left ui-corner-right ui-corner-all",s=this._buildSimpleOptions(e,"label").classes.label;this._removeClass(t,null,i),this._addClass(t,null,s)},_buildSimpleOptions:function(t,e){var i="vertical"===this.options.direction,s={classes:{}};return s.classes[e]={middle:"",first:"ui-corner-"+(i?"top":"left"),last:"ui-corner-"+(i?"bottom":"right"),only:"ui-corner-all"}[t],s},_spinnerOptions:function(t){var e=this._buildSimpleOptions(t,"ui-spinner");return e.classes["ui-spinner-up"]="",e.classes["ui-spinner-down"]="",e},_buttonOptions:function(t){return this._buildSimpleOptions(t,"ui-button")},_checkboxradioOptions:function(t){return this._buildSimpleOptions(t,"ui-checkboxradio-label")},_selectmenuOptions:function(t){var e="vertical"===this.options.direction;return{width:e?"auto":!1,classes:{middle:{"ui-selectmenu-button-open":"","ui-selectmenu-button-closed":""},first:{"ui-selectmenu-button-open":"ui-corner-"+(e?"top":"tl"),"ui-selectmenu-button-closed":"ui-corner-"+(e?"top":"left")},last:{"ui-selectmenu-button-open":e?"":"ui-corner-tr","ui-selectmenu-button-closed":"ui-corner-"+(e?"bottom":"right")},only:{"ui-selectmenu-button-open":"ui-corner-top","ui-selectmenu-button-closed":"ui-corner-all"}}[t]}},_resolveClassesValues:function(e,i){var s={};return t.each(e,function(n){var o=i.options.classes[n]||"";o=t.trim(o.replace(g,"")),s[n]=(o+" "+e[n]).replace(/\s+/g," ")}),s},_setOption:function(t,e){return"direction"===t&&this._removeClass("ui-controlgroup-"+this.options.direction),this._super(t,e),"disabled"===t?(this._callChildMethod(e?"disable":"enable"),void 0):(this.refresh(),void 0)},refresh:function(){var e,i=this;this._addClass("ui-controlgroup ui-controlgroup-"+this.options.direction),"horizontal"===this.options.direction&&this._addClass(null,"ui-helper-clearfix"),this._initWidgets(),e=this.childWidgets,this.options.onlyVisible&&(e=e.filter(":visible")),e.length&&(t.each(["first","last"],function(t,s){var n=e[s]().data("ui-controlgroup-data");if(n&&i["_"+n.widgetName+"Options"]){var o=i["_"+n.widgetName+"Options"](1===e.length?"only":s);o.classes=i._resolveClassesValues(o.classes,n),n.element[n.widgetName](o)}else i._updateCornerClass(e[s](),s)}),this._callChildMethod("refresh"))}}),t.widget("ui.checkboxradio",[t.ui.formResetMixin,{version:"1.12.1",options:{disabled:null,label:null,icon:!0,classes:{"ui-checkboxradio-label":"ui-corner-all","ui-checkboxradio-icon":"ui-corner-all"}},_getCreateOptions:function(){var e,i,s=this,n=this._super()||{};return this._readType(),i=this.element.labels(),this.label=t(i[i.length-1]),this.label.length||t.error("No label found for checkboxradio widget"),this.originalLabel="",this.label.contents().not(this.element[0]).each(function(){s.originalLabel+=3===this.nodeType?t(this).text():this.outerHTML}),this.originalLabel&&(n.label=this.originalLabel),e=this.element[0].disabled,null!=e&&(n.disabled=e),n},_create:function(){var t=this.element[0].checked;this._bindFormResetHandler(),null==this.options.disabled&&(this.options.disabled=this.element[0].disabled),this._setOption("disabled",this.options.disabled),this._addClass("ui-checkboxradio","ui-helper-hidden-accessible"),this._addClass(this.label,"ui-checkboxradio-label","ui-button ui-widget"),"radio"===this.type&&this._addClass(this.label,"ui-checkboxradio-radio-label"),this.options.label&&this.options.label!==this.originalLabel?this._updateLabel():this.originalLabel&&(this.options.label=this.originalLabel),this._enhance(),t&&(this._addClass(this.label,"ui-checkboxradio-checked","ui-state-active"),this.icon&&this._addClass(this.icon,null,"ui-state-hover")),this._on({change:"_toggleClasses",focus:function(){this._addClass(this.label,null,"ui-state-focus ui-visual-focus")},blur:function(){this._removeClass(this.label,null,"ui-state-focus ui-visual-focus")}})},_readType:function(){var e=this.element[0].nodeName.toLowerCase();this.type=this.element[0].type,"input"===e&&/radio|checkbox/.test(this.type)||t.error("Can't create checkboxradio on element.nodeName="+e+" and element.type="+this.type)},_enhance:function(){this._updateIcon(this.element[0].checked)},widget:function(){return this.label},_getRadioGroup:function(){var e,i=this.element[0].name,s="input[name='"+t.ui.escapeSelector(i)+"']";return i?(e=this.form.length?t(this.form[0].elements).filter(s):t(s).filter(function(){return 0===t(this).form().length}),e.not(this.element)):t([])},_toggleClasses:function(){var e=this.element[0].checked;this._toggleClass(this.label,"ui-checkboxradio-checked","ui-state-active",e),this.options.icon&&"checkbox"===this.type&&this._toggleClass(this.icon,null,"ui-icon-check ui-state-checked",e)._toggleClass(this.icon,null,"ui-icon-blank",!e),"radio"===this.type&&this._getRadioGroup().each(function(){var e=t(this).checkboxradio("instance");e&&e._removeClass(e.label,"ui-checkboxradio-checked","ui-state-active")})},_destroy:function(){this._unbindFormResetHandler(),this.icon&&(this.icon.remove(),this.iconSpace.remove())},_setOption:function(t,e){return"label"!==t||e?(this._super(t,e),"disabled"===t?(this._toggleClass(this.label,null,"ui-state-disabled",e),this.element[0].disabled=e,void 0):(this.refresh(),void 0)):void 0},_updateIcon:function(e){var i="ui-icon ui-icon-background ";this.options.icon?(this.icon||(this.icon=t("<span>"),this.iconSpace=t("<span> </span>"),this._addClass(this.iconSpace,"ui-checkboxradio-icon-space")),"checkbox"===this.type?(i+=e?"ui-icon-check ui-state-checked":"ui-icon-blank",this._removeClass(this.icon,null,e?"ui-icon-blank":"ui-icon-check")):i+="ui-icon-blank",this._addClass(this.icon,"ui-checkboxradio-icon",i),e||this._removeClass(this.icon,null,"ui-icon-check ui-state-checked"),this.icon.prependTo(this.label).after(this.iconSpace)):void 0!==this.icon&&(this.icon.remove(),this.iconSpace.remove(),delete this.icon)},_updateLabel:function(){var t=this.label.contents().not(this.element[0]);this.icon&&(t=t.not(this.icon[0])),this.iconSpace&&(t=t.not(this.iconSpace[0])),t.remove(),this.label.append(this.options.label)},refresh:function(){var t=this.element[0].checked,e=this.element[0].disabled;this._updateIcon(t),this._toggleClass(this.label,"ui-checkboxradio-checked","ui-state-active",t),null!==this.options.label&&this._updateLabel(),e!==this.options.disabled&&this._setOptions({disabled:e})}}]),t.ui.checkboxradio,t.widget("ui.button",{version:"1.12.1",defaultElement:"<button>",options:{classes:{"ui-button":"ui-corner-all"},disabled:null,icon:null,iconPosition:"beginning",label:null,showLabel:!0},_getCreateOptions:function(){var t,e=this._super()||{};return this.isInput=this.element.is("input"),t=this.element[0].disabled,null!=t&&(e.disabled=t),this.originalLabel=this.isInput?this.element.val():this.element.html(),this.originalLabel&&(e.label=this.originalLabel),e},_create:function(){!this.option.showLabel&!this.options.icon&&(this.options.showLabel=!0),null==this.options.disabled&&(this.options.disabled=this.element[0].disabled||!1),this.hasTitle=!!this.element.attr("title"),this.options.label&&this.options.label!==this.originalLabel&&(this.isInput?this.element.val(this.options.label):this.element.html(this.options.label)),this._addClass("ui-button","ui-widget"),this._setOption("disabled",this.options.disabled),this._enhance(),this.element.is("a")&&this._on({keyup:function(e){e.keyCode===t.ui.keyCode.SPACE&&(e.preventDefault(),this.element[0].click?this.element[0].click():this.element.trigger("click"))}})},_enhance:function(){this.element.is("button")||this.element.attr("role","button"),this.options.icon&&(this._updateIcon("icon",this.options.icon),this._updateTooltip())},_updateTooltip:function(){this.title=this.element.attr("title"),this.options.showLabel||this.title||this.element.attr("title",this.options.label)},_updateIcon:function(e,i){var s="iconPosition"!==e,n=s?this.options.iconPosition:i,o="top"===n||"bottom"===n;this.icon?s&&this._removeClass(this.icon,null,this.options.icon):(this.icon=t("<span>"),this._addClass(this.icon,"ui-button-icon","ui-icon"),this.options.showLabel||this._addClass("ui-button-icon-only")),s&&this._addClass(this.icon,null,i),this._attachIcon(n),o?(this._addClass(this.icon,null,"ui-widget-icon-block"),this.iconSpace&&this.iconSpace.remove()):(this.iconSpace||(this.iconSpace=t("<span> </span>"),this._addClass(this.iconSpace,"ui-button-icon-space")),this._removeClass(this.icon,null,"ui-wiget-icon-block"),this._attachIconSpace(n))},_destroy:function(){this.element.removeAttr("role"),this.icon&&this.icon.remove(),this.iconSpace&&this.iconSpace.remove(),this.hasTitle||this.element.removeAttr("title")},_attachIconSpace:function(t){this.icon[/^(?:end|bottom)/.test(t)?"before":"after"](this.iconSpace)},_attachIcon:function(t){this.element[/^(?:end|bottom)/.test(t)?"append":"prepend"](this.icon)},_setOptions:function(t){var e=void 0===t.showLabel?this.options.showLabel:t.showLabel,i=void 0===t.icon?this.options.icon:t.icon;e||i||(t.showLabel=!0),this._super(t)},_setOption:function(t,e){"icon"===t&&(e?this._updateIcon(t,e):this.icon&&(this.icon.remove(),this.iconSpace&&this.iconSpace.remove())),"iconPosition"===t&&this._updateIcon(t,e),"showLabel"===t&&(this._toggleClass("ui-button-icon-only",null,!e),this._updateTooltip()),"label"===t&&(this.isInput?this.element.val(e):(this.element.html(e),this.icon&&(this._attachIcon(this.options.iconPosition),this._attachIconSpace(this.options.iconPosition)))),this._super(t,e),"disabled"===t&&(this._toggleClass(null,"ui-state-disabled",e),this.element[0].disabled=e,e&&this.element.blur())},refresh:function(){var t=this.element.is("input, button")?this.element[0].disabled:this.element.hasClass("ui-button-disabled");t!==this.options.disabled&&this._setOptions({disabled:t}),this._updateTooltip()}}),t.uiBackCompat!==!1&&(t.widget("ui.button",t.ui.button,{options:{text:!0,icons:{primary:null,secondary:null}},_create:function(){this.options.showLabel&&!this.options.text&&(this.options.showLabel=this.options.text),!this.options.showLabel&&this.options.text&&(this.options.text=this.options.showLabel),this.options.icon||!this.options.icons.primary&&!this.options.icons.secondary?this.options.icon&&(this.options.icons.primary=this.options.icon):this.options.icons.primary?this.options.icon=this.options.icons.primary:(this.options.icon=this.options.icons.secondary,this.options.iconPosition="end"),this._super()},_setOption:function(t,e){return"text"===t?(this._super("showLabel",e),void 0):("showLabel"===t&&(this.options.text=e),"icon"===t&&(this.options.icons.primary=e),"icons"===t&&(e.primary?(this._super("icon",e.primary),this._super("iconPosition","beginning")):e.secondary&&(this._super("icon",e.secondary),this._super("iconPosition","end"))),this._superApply(arguments),void 0)}}),t.fn.button=function(e){return function(){return!this.length||this.length&&"INPUT"!==this[0].tagName||this.length&&"INPUT"===this[0].tagName&&"checkbox"!==this.attr("type")&&"radio"!==this.attr("type")?e.apply(this,arguments):(t.ui.checkboxradio||t.error("Checkboxradio widget missing"),0===arguments.length?this.checkboxradio({icon:!1}):this.checkboxradio.apply(this,arguments))}}(t.fn.button),t.fn.buttonset=function(){return t.ui.controlgroup||t.error("Controlgroup widget missing"),"option"===arguments[0]&&"items"===arguments[1]&&arguments[2]?this.controlgroup.apply(this,[arguments[0],"items.button",arguments[2]]):"option"===arguments[0]&&"items"===arguments[1]?this.controlgroup.apply(this,[arguments[0],"items.button"]):("object"==typeof arguments[0]&&arguments[0].items&&(arguments[0].items={button:arguments[0].items}),this.controlgroup.apply(this,arguments))}),t.ui.button,t.extend(t.ui,{datepicker:{version:"1.12.1"}});var m;t.extend(s.prototype,{markerClassName:"hasDatepicker",maxRows:4,_widgetDatepicker:function(){return this.dpDiv},setDefaults:function(t){return a(this._defaults,t||{}),this},_attachDatepicker:function(e,i){var s,n,o;s=e.nodeName.toLowerCase(),n="div"===s||"span"===s,e.id||(this.uuid+=1,e.id="dp"+this.uuid),o=this._newInst(t(e),n),o.settings=t.extend({},i||{}),"input"===s?this._connectDatepicker(e,o):n&&this._inlineDatepicker(e,o)},_newInst:function(e,i){var s=e[0].id.replace(/([^A-Za-z0-9_\-])/g,"\\\\$1");return{id:s,input:e,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:i,dpDiv:i?n(t("<div class='"+this._inlineClass+" ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>")):this.dpDiv}},_connectDatepicker:function(e,i){var s=t(e);i.append=t([]),i.trigger=t([]),s.hasClass(this.markerClassName)||(this._attachments(s,i),s.addClass(this.markerClassName).on("keydown",this._doKeyDown).on("keypress",this._doKeyPress).on("keyup",this._doKeyUp),this._autoSize(i),t.data(e,"datepicker",i),i.settings.disabled&&this._disableDatepicker(e))},_attachments:function(e,i){var s,n,o,a=this._get(i,"appendText"),r=this._get(i,"isRTL");i.append&&i.append.remove(),a&&(i.append=t("<span class='"+this._appendClass+"'>"+a+"</span>"),e[r?"before":"after"](i.append)),e.off("focus",this._showDatepicker),i.trigger&&i.trigger.remove(),s=this._get(i,"showOn"),("focus"===s||"both"===s)&&e.on("focus",this._showDatepicker),("button"===s||"both"===s)&&(n=this._get(i,"buttonText"),o=this._get(i,"buttonImage"),i.trigger=t(this._get(i,"buttonImageOnly")?t("<img/>").addClass(this._triggerClass).attr({src:o,alt:n,title:n}):t("<button type='button'></button>").addClass(this._triggerClass).html(o?t("<img/>").attr({src:o,alt:n,title:n}):n)),e[r?"before":"after"](i.trigger),i.trigger.on("click",function(){return t.datepicker._datepickerShowing&&t.datepicker._lastInput===e[0]?t.datepicker._hideDatepicker():t.datepicker._datepickerShowing&&t.datepicker._lastInput!==e[0]?(t.datepicker._hideDatepicker(),t.datepicker._showDatepicker(e[0])):t.datepicker._showDatepicker(e[0]),!1}))},_autoSize:function(t){if(this._get(t,"autoSize")&&!t.inline){var e,i,s,n,o=new Date(2009,11,20),a=this._get(t,"dateFormat");a.match(/[DM]/)&&(e=function(t){for(i=0,s=0,n=0;t.length>n;n++)t[n].length>i&&(i=t[n].length,s=n);return s},o.setMonth(e(this._get(t,a.match(/MM/)?"monthNames":"monthNamesShort"))),o.setDate(e(this._get(t,a.match(/DD/)?"dayNames":"dayNamesShort"))+20-o.getDay())),t.input.attr("size",this._formatDate(t,o).length)}},_inlineDatepicker:function(e,i){var s=t(e);s.hasClass(this.markerClassName)||(s.addClass(this.markerClassName).append(i.dpDiv),t.data(e,"datepicker",i),this._setDate(i,this._getDefaultDate(i),!0),this._updateDatepicker(i),this._updateAlternate(i),i.settings.disabled&&this._disableDatepicker(e),i.dpDiv.css("display","block"))},_dialogDatepicker:function(e,i,s,n,o){var r,h,l,c,u,d=this._dialogInst;return d||(this.uuid+=1,r="dp"+this.uuid,this._dialogInput=t("<input type='text' id='"+r+"' style='position: absolute; top: -100px; width: 0px;'/>"),this._dialogInput.on("keydown",this._doKeyDown),t("body").append(this._dialogInput),d=this._dialogInst=this._newInst(this._dialogInput,!1),d.settings={},t.data(this._dialogInput[0],"datepicker",d)),a(d.settings,n||{}),i=i&&i.constructor===Date?this._formatDate(d,i):i,this._dialogInput.val(i),this._pos=o?o.length?o:[o.pageX,o.pageY]:null,this._pos||(h=document.documentElement.clientWidth,l=document.documentElement.clientHeight,c=document.documentElement.scrollLeft||document.body.scrollLeft,u=document.documentElement.scrollTop||document.body.scrollTop,this._pos=[h/2-100+c,l/2-150+u]),this._dialogInput.css("left",this._pos[0]+20+"px").css("top",this._pos[1]+"px"),d.settings.onSelect=s,this._inDialog=!0,this.dpDiv.addClass(this._dialogClass),this._showDatepicker(this._dialogInput[0]),t.blockUI&&t.blockUI(this.dpDiv),t.data(this._dialogInput[0],"datepicker",d),this},_destroyDatepicker:function(e){var i,s=t(e),n=t.data(e,"datepicker");s.hasClass(this.markerClassName)&&(i=e.nodeName.toLowerCase(),t.removeData(e,"datepicker"),"input"===i?(n.append.remove(),n.trigger.remove(),s.removeClass(this.markerClassName).off("focus",this._showDatepicker).off("keydown",this._doKeyDown).off("keypress",this._doKeyPress).off("keyup",this._doKeyUp)):("div"===i||"span"===i)&&s.removeClass(this.markerClassName).empty(),m===n&&(m=null))},_enableDatepicker:function(e){var i,s,n=t(e),o=t.data(e,"datepicker");n.hasClass(this.markerClassName)&&(i=e.nodeName.toLowerCase(),"input"===i?(e.disabled=!1,o.trigger.filter("button").each(function(){this.disabled=!1}).end().filter("img").css({opacity:"1.0",cursor:""})):("div"===i||"span"===i)&&(s=n.children("."+this._inlineClass),s.children().removeClass("ui-state-disabled"),s.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!1)),this._disabledInputs=t.map(this._disabledInputs,function(t){return t===e?null:t}))},_disableDatepicker:function(e){var i,s,n=t(e),o=t.data(e,"datepicker");n.hasClass(this.markerClassName)&&(i=e.nodeName.toLowerCase(),"input"===i?(e.disabled=!0,o.trigger.filter("button").each(function(){this.disabled=!0}).end().filter("img").css({opacity:"0.5",cursor:"default"})):("div"===i||"span"===i)&&(s=n.children("."+this._inlineClass),s.children().addClass("ui-state-disabled"),s.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!0)),this._disabledInputs=t.map(this._disabledInputs,function(t){return t===e?null:t}),this._disabledInputs[this._disabledInputs.length]=e)},_isDisabledDatepicker:function(t){if(!t)return!1;for(var e=0;this._disabledInputs.length>e;e++)if(this._disabledInputs[e]===t)return!0;return!1},_getInst:function(e){try{return t.data(e,"datepicker")}catch(i){throw"Missing instance data for this datepicker"}},_optionDatepicker:function(e,i,s){var n,o,r,h,l=this._getInst(e);return 2===arguments.length&&"string"==typeof i?"defaults"===i?t.extend({},t.datepicker._defaults):l?"all"===i?t.extend({},l.settings):this._get(l,i):null:(n=i||{},"string"==typeof i&&(n={},n[i]=s),l&&(this._curInst===l&&this._hideDatepicker(),o=this._getDateDatepicker(e,!0),r=this._getMinMaxDate(l,"min"),h=this._getMinMaxDate(l,"max"),a(l.settings,n),null!==r&&void 0!==n.dateFormat&&void 0===n.minDate&&(l.settings.minDate=this._formatDate(l,r)),null!==h&&void 0!==n.dateFormat&&void 0===n.maxDate&&(l.settings.maxDate=this._formatDate(l,h)),"disabled"in n&&(n.disabled?this._disableDatepicker(e):this._enableDatepicker(e)),this._attachments(t(e),l),this._autoSize(l),this._setDate(l,o),this._updateAlternate(l),this._updateDatepicker(l)),void 0)},_changeDatepicker:function(t,e,i){this._optionDatepicker(t,e,i)},_refreshDatepicker:function(t){var e=this._getInst(t);e&&this._updateDatepicker(e)},_setDateDatepicker:function(t,e){var i=this._getInst(t);i&&(this._setDate(i,e),this._updateDatepicker(i),this._updateAlternate(i))},_getDateDatepicker:function(t,e){var i=this._getInst(t);return i&&!i.inline&&this._setDateFromField(i,e),i?this._getDate(i):null},_doKeyDown:function(e){var i,s,n,o=t.datepicker._getInst(e.target),a=!0,r=o.dpDiv.is(".ui-datepicker-rtl");if(o._keyEvent=!0,t.datepicker._datepickerShowing)switch(e.keyCode){case 9:t.datepicker._hideDatepicker(),a=!1;break;case 13:return n=t("td."+t.datepicker._dayOverClass+":not(."+t.datepicker._currentClass+")",o.dpDiv),n[0]&&t.datepicker._selectDay(e.target,o.selectedMonth,o.selectedYear,n[0]),i=t.datepicker._get(o,"onSelect"),i?(s=t.datepicker._formatDate(o),i.apply(o.input?o.input[0]:null,[s,o])):t.datepicker._hideDatepicker(),!1;case 27:t.datepicker._hideDatepicker();break;case 33:t.datepicker._adjustDate(e.target,e.ctrlKey?-t.datepicker._get(o,"stepBigMonths"):-t.datepicker._get(o,"stepMonths"),"M");break;case 34:t.datepicker._adjustDate(e.target,e.ctrlKey?+t.datepicker._get(o,"stepBigMonths"):+t.datepicker._get(o,"stepMonths"),"M");break;case 35:(e.ctrlKey||e.metaKey)&&t.datepicker._clearDate(e.target),a=e.ctrlKey||e.metaKey;break;case 36:(e.ctrlKey||e.metaKey)&&t.datepicker._gotoToday(e.target),a=e.ctrlKey||e.metaKey;break;case 37:(e.ctrlKey||e.metaKey)&&t.datepicker._adjustDate(e.target,r?1:-1,"D"),a=e.ctrlKey||e.metaKey,e.originalEvent.altKey&&t.datepicker._adjustDate(e.target,e.ctrlKey?-t.datepicker._get(o,"stepBigMonths"):-t.datepicker._get(o,"stepMonths"),"M");break;case 38:(e.ctrlKey||e.metaKey)&&t.datepicker._adjustDate(e.target,-7,"D"),a=e.ctrlKey||e.metaKey;break;case 39:(e.ctrlKey||e.metaKey)&&t.datepicker._adjustDate(e.target,r?-1:1,"D"),a=e.ctrlKey||e.metaKey,e.originalEvent.altKey&&t.datepicker._adjustDate(e.target,e.ctrlKey?+t.datepicker._get(o,"stepBigMonths"):+t.datepicker._get(o,"stepMonths"),"M");break;case 40:(e.ctrlKey||e.metaKey)&&t.datepicker._adjustDate(e.target,7,"D"),a=e.ctrlKey||e.metaKey;break;default:a=!1}else 36===e.keyCode&&e.ctrlKey?t.datepicker._showDatepicker(this):a=!1;a&&(e.preventDefault(),e.stopPropagation())},_doKeyPress:function(e){var i,s,n=t.datepicker._getInst(e.target);return t.datepicker._get(n,"constrainInput")?(i=t.datepicker._possibleChars(t.datepicker._get(n,"dateFormat")),s=String.fromCharCode(null==e.charCode?e.keyCode:e.charCode),e.ctrlKey||e.metaKey||" ">s||!i||i.indexOf(s)>-1):void 0},_doKeyUp:function(e){var i,s=t.datepicker._getInst(e.target);if(s.input.val()!==s.lastVal)try{i=t.datepicker.parseDate(t.datepicker._get(s,"dateFormat"),s.input?s.input.val():null,t.datepicker._getFormatConfig(s)),i&&(t.datepicker._setDateFromField(s),t.datepicker._updateAlternate(s),t.datepicker._updateDatepicker(s))}catch(n){}return!0},_showDatepicker:function(e){if(e=e.target||e,"input"!==e.nodeName.toLowerCase()&&(e=t("input",e.parentNode)[0]),!t.datepicker._isDisabledDatepicker(e)&&t.datepicker._lastInput!==e
vendor: 3,057 bytes, lines 22-23
22&&e&&e.nodeName&&t(e).is(":visible")){var s,n,o,r,h,l,c;s=t.datepicker._getInst(e),t.datepicker._curInst&&t.datepicker._curInst!==s&&(t.datepicker._curInst.dpDiv.stop(!0,!0),s&&t.datepicker._datepickerShowing&&t.datepicker._hideDatepicker(t.datepicker._curInst.input[0])),n=t.datepicker._get(s,"beforeShow"),o=n?n.apply(e,[e,s]):{},o!==!1&&(a(s.settings,o),s.lastVal=null,t.datepicker._lastInput=e,t.datepicker._setDateFromField(s),t.datepicker._inDialog&&(e.value=""),t.datepicker._pos||(t.datepicker._pos=t.datepicker._findPos(e),t.datepicker._pos[1]+=e.offsetHeight),r=!1,t(e).parents().each(function(){return r|="fixed"===t(this).css("position"),!r}),h={left:t.datepicker._pos[0],top:t.datepicker._pos[1]},t.datepicker._pos=null,s.dpDiv.empty(),s.dpDiv.css({position:"absolute",display:"block",top:"-1000px"}),t.datepicker._updateDatepicker(s),h=t.datepicker._checkOffset(s,h,r),s.dpDiv.css({position:t.datepicker._inDialog&&t.blockUI?"static":r?"fixed":"absolute",display:"none",left:h.left+"px",top:h.top+"px"}),s.inline||(l=t.datepicker._get(s,"showAnim"),c=t.datepicker._get(s,"duration"),s.dpDiv.css("z-index",i(t(e))+1),t.datepicker._datepickerShowing=!0,t.effects&&t.effects.effect[l]?s.dpDiv.show(l,t.datepicker._get(s,"showOptions"),c):s.dpDiv[l||"show"](l?c:null),t.datepicker._shouldFocusInput(s)&&s.input.trigger("focus"),t.datepicker._curInst=s))
23}},_updateDatepicker:function(e){this.maxRows=4,m=e,e.dpDiv.empty().append(this._generateHTML(e)),this._attachHandlers(e);var i,s=this._getNumberOfMonths(e),n=s[1],a=17,r=e.dpDiv.find("."+this._dayOverClass+" a");r.length>0&&o.apply(r.get(0)),e.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width(""),n>1&&e.dpDiv.addClass("ui-datepicker-multi-"+n).css("width",a*n+"em"),e.dpDiv[(1!==s[0]||1!==s[1]?"add":"remove")+"Class"]("ui-datepicker-multi"),e.dpDiv[(this._get(e,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl"),e===t.datepicker._curInst&&t.datepicker._datepickerShowing&&t.datepicker._shouldFocusInput(e)&&e.input.trigger("focus"),e.yearshtml&&(i=e.yearshtml,setTimeout(function(){i===e.yearshtml&&e.yearshtml&&e.dpDiv.find("select.ui-datepicker-year:first").replaceWith(e.yearshtml),i=e.yearshtml=null},0))},_shouldFocusInput:function(t){return t.input&&t.input.is(":visible")&&!t.input.is(":disabled")&&!t.input.is(":focus")},_checkOffset:function(e,i,s){var n=e.dpDiv.outerWidth(),o=e.dpDiv.outerHeight(),a=e.input?e.input.outerWidth():0,r=e.input?e.input.outerHeight():0,h=document.documentElement.clientWidth+(s?0:t(document).scrollLeft()),l=document.documentElement.clientHeight+(s?0:t(document).scrollTop());return i.left-=this._get(e,"isRTL")?n-a:0,i.left-=s&&i.left===e.input.offset().left?t(document).scrollLeft():0,i.top-=s&&i.top===e.input.offset().top+r?t(document).scrollTop():0,i.left-=Math.min(i.left,i.left+n>h&&h>n?Math.abs(i.left+n-h):0),i.top-=Math.min(i.top,i.top+o>l&&l>o?Math.abs(o+r):0),i},_findPos:function(e){for(var i,s=this._getInst(e),n=this._get(s,"isRTL");e&&("hidden"===e.type||1!==e.nodeType||t.expr.pseudo
vendor: 20,236 bytes, line 23
23s.hidden(e));)e=e[n?"previousSibling":"nextSibling"];return i=t(e).offset(),[i.left,i.top]},_hideDatepicker:function(e){var i,s,n,o,a=this._curInst;!a||e&&a!==t.data(e,"datepicker")||this._datepickerShowing&&(i=this._get(a,"showAnim"),s=this._get(a,"duration"),n=function(){t.datepicker._tidyDialog(a)},t.effects&&(t.effects.effect[i]||t.effects[i])?a.dpDiv.hide(i,t.datepicker._get(a,"showOptions"),s,n):a.dpDiv["slideDown"===i?"slideUp":"fadeIn"===i?"fadeOut":"hide"](i?s:null,n),i||n(),this._datepickerShowing=!1,o=this._get(a,"onClose"),o&&o.apply(a.input?a.input[0]:null,[a.input?a.input.val():"",a]),this._lastInput=null,this._inDialog&&(this._dialogInput.css({position:"absolute",left:"0",top:"-100px"}),t.blockUI&&(t.unblockUI(),t("body").append(this.dpDiv))),this._inDialog=!1)},_tidyDialog:function(t){t.dpDiv.removeClass(this._dialogClass).off(".ui-datepicker-calendar")},_checkExternalClick:function(e){if(t.datepicker._curInst){var i=t(e.target),s=t.datepicker._getInst(i[0]);(i[0].id!==t.datepicker._mainDivId&&0===i.parents("#"+t.datepicker._mainDivId).length&&!i.hasClass(t.datepicker.markerClassName)&&!i.closest("."+t.datepicker._triggerClass).length&&t.datepicker._datepickerShowing&&(!t.datepicker._inDialog||!t.blockUI)||i.hasClass(t.datepicker.markerClassName)&&t.datepicker._curInst!==s)&&t.datepicker._hideDatepicker()}},_adjustDate:function(e,i,s){var n=t(e),o=this._getInst(n[0]);this._isDisabledDatepicker(n[0])||(this._adjustInstDate(o,i+("M"===s?this._get(o,"showCurrentAtPos"):0),s),this._updateDatepicker(o))},_gotoToday:function(e){var i,s=t(e),n=this._getInst(s[0]);this._get(n,"gotoCurrent")&&n.currentDay?(n.selectedDay=n.currentDay,n.drawMonth=n.selectedMonth=n.currentMonth,n.drawYear=n.selectedYear=n.currentYear):(i=new Date,n.selectedDay=i.getDate(),n.drawMonth=n.selectedMonth=i.getMonth(),n.drawYear=n.selectedYear=i.getFullYear()),this._notifyChange(n),this._adjustDate(s)},_selectMonthYear:function(e,i,s){var n=t(e),o=this._getInst(n[0]);o["selected"+("M"===s?"Month":"Year")]=o["draw"+("M"===s?"Month":"Year")]=parseInt(i.options[i.selectedIndex].value,10),this._notifyChange(o),this._adjustDate(n)},_selectDay:function(e,i,s,n){var o,a=t(e);t(n).hasClass(this._unselectableClass)||this._isDisabledDatepicker(a[0])||(o=this._getInst(a[0]),o.selectedDay=o.currentDay=t("a",n).html(),o.selectedMonth=o.currentMonth=i,o.selectedYear=o.currentYear=s,this._selectDate(e,this._formatDate(o,o.currentDay,o.currentMonth,o.currentYear)))},_clearDate:function(e){var i=t(e);this._selectDate(i,"")},_selectDate:function(e,i){var s,n=t(e),o=this._getInst(n[0]);i=null!=i?i:this._formatDate(o),o.input&&o.input.val(i),this._updateAlternate(o),s=this._get(o,"onSelect"),s?s.apply(o.input?o.input[0]:null,[i,o]):o.input&&o.input.trigger("change"),o.inline?this._updateDatepicker(o):(this._hideDatepicker(),this._lastInput=o.input[0],"object"!=typeof o.input[0]&&o.input.trigger("focus"),this._lastInput=null)},_updateAlternate:function(e){var i,s,n,o=this._get(e,"altField");o&&(i=this._get(e,"altFormat")||this._get(e,"dateFormat"),s=this._getDate(e),n=this.formatDate(i,s,this._getFormatConfig(e)),t(o).val(n))},noWeekends:function(t){var e=t.getDay();return[e>0&&6>e,""]},iso8601Week:function(t){var e,i=new Date(t.getTime());return i.setDate(i.getDate()+4-(i.getDay()||7)),e=i.getTime(),i.setMonth(0),i.setDate(1),Math.floor(Math.round((e-i)/864e5)/7)+1},parseDate:function(e,i,s){if(null==e||null==i)throw"Invalid arguments";if(i="object"==typeof i?""+i:i+"",""===i)return null;var n,o,a,r,h=0,l=(s?s.shortYearCutoff:null)||this._defaults.shortYearCutoff,c="string"!=typeof l?l:(new Date).getFullYear()%100+parseInt(l,10),u=(s?s.dayNamesShort:null)||this._defaults.dayNamesShort,d=(s?s.dayNames:null)||this._defaults.dayNames,p=(s?s.monthNamesShort:null)||this._defaults.monthNamesShort,f=(s?s.monthNames:null)||this._defaults.monthNames,g=-1,m=-1,_=-1,v=-1,b=!1,y=function(t){var i=e.length>n+1&&e.charAt(n+1)===t;return i&&n++,i},w=function(t){var e=y(t),s="@"===t?14:"!"===t?20:"y"===t&&e?4:"o"===t?3:2,n="y"===t?s:1,o=RegExp("^\\d{"+n+","+s+"}"),a=i.substring(h).match(o);if(!a)throw"Missing number at position "+h;return h+=a[0].length,parseInt(a[0],10)},k=function(e,s,n){var o=-1,a=t.map(y(e)?n:s,function(t,e){return[[e,t]]}).sort(function(t,e){return-(t[1].length-e[1].length)});if(t.each(a,function(t,e){var s=e[1];return i.substr(h,s.length).toLowerCase()===s.toLowerCase()?(o=e[0],h+=s.length,!1):void 0}),-1!==o)return o+1;throw"Unknown name at position "+h},x=function(){if(i.charAt(h)!==e.charAt(n))throw"Unexpected literal at position "+h;h++};for(n=0;e.length>n;n++)if(b)"'"!==e.charAt(n)||y("'")?x():b=!1;else switch(e.charAt(n)){case"d":_=w("d");break;case"D":k("D",u,d);break;case"o":v=w("o");break;case"m":m=w("m");break;case"M":m=k("M",p,f);break;case"y":g=w("y");break;case"@":r=new Date(w("@")),g=r.getFullYear(),m=r.getMonth()+1,_=r.getDate();break;case"!":r=new Date((w("!")-this._ticksTo1970)/1e4),g=r.getFullYear(),m=r.getMonth()+1,_=r.getDate();break;case"'":y("'")?x():b=!0;break;default:x()}if(i.length>h&&(a=i.substr(h),!/^\s+/.test(a)))throw"Extra/unparsed characters found in date: "+a;if(-1===g?g=(new Date).getFullYear():100>g&&(g+=(new Date).getFullYear()-(new Date).getFullYear()%100+(c>=g?0:-100)),v>-1)for(m=1,_=v;;){if(o=this._getDaysInMonth(g,m-1),o>=_)break;m++,_-=o}if(r=this._daylightSavingAdjust(new Date(g,m-1,_)),r.getFullYear()!==g||r.getMonth()+1!==m||r.getDate()!==_)throw"Invalid date";return r},ATOM:"yy-mm-dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TICKS:"!",TIMESTAMP:"@",W3C:"yy-mm-dd",_ticksTo1970:1e7*60*60*24*(718685+Math.floor(492.5)-Math.floor(19.7)+Math.floor(4.925)),formatDate:function(t,e,i){if(!e)return"";var s,n=(i?i.dayNamesShort:null)||this._defaults.dayNamesShort,o=(i?i.dayNames:null)||this._defaults.dayNames,a=(i?i.monthNamesShort:null)||this._defaults.monthNamesShort,r=(i?i.monthNames:null)||this._defaults.monthNames,h=function(e){var i=t.length>s+1&&t.charAt(s+1)===e;return i&&s++,i},l=function(t,e,i){var s=""+e;if(h(t))for(;i>s.length;)s="0"+s;return s},c=function(t,e,i,s){return h(t)?s[e]:i[e]},u="",d=!1;if(e)for(s=0;t.length>s;s++)if(d)"'"!==t.charAt(s)||h("'")?u+=t.charAt(s):d=!1;else switch(t.charAt(s)){case"d":u+=l("d",e.getDate(),2);break;case"D":u+=c("D",e.getDay(),n,o);break;case"o":u+=l("o",Math.round((new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime()-new Date(e.getFullYear(),0,0).getTime())/864e5),3);break;case"m":u+=l("m",e.getMonth()+1,2);break;case"M":u+=c("M",e.getMonth(),a,r);break;case"y":u+=h("y")?e.getFullYear():(10>e.getFullYear()%100?"0":"")+e.getFullYear()%100;break;case"@":u+=e.getTime();break;case"!":u+=1e4*e.getTime()+this._ticksTo1970;break;case"'":h("'")?u+="'":d=!0;break;default:u+=t.charAt(s)}return u},_possibleChars:function(t){var e,i="",s=!1,n=function(i){var s=t.length>e+1&&t.charAt(e+1)===i;return s&&e++,s};for(e=0;t.length>e;e++)if(s)"'"!==t.charAt(e)||n("'")?i+=t.charAt(e):s=!1;else switch(t.charAt(e)){case"d":case"m":case"y":case"@":i+="0123456789";break;case"D":case"M":return null;case"'":n("'")?i+="'":s=!0;break;default:i+=t.charAt(e)}return i},_get:function(t,e){return void 0!==t.settings[e]?t.settings[e]:this._defaults[e]},_setDateFromField:function(t,e){if(t.input.val()!==t.lastVal){var i=this._get(t,"dateFormat"),s=t.lastVal=t.input?t.input.val():null,n=this._getDefaultDate(t),o=n,a=this._getFormatConfig(t);try{o=this.parseDate(i,s,a)||n}catch(r){s=e?"":s}t.selectedDay=o.getDate(),t.drawMonth=t.selectedMonth=o.getMonth(),t.drawYear=t.selectedYear=o.getFullYear(),t.currentDay=s?o.getDate():0,t.currentMonth=s?o.getMonth():0,t.currentYear=s?o.getFullYear():0,this._adjustInstDate(t)}},_getDefaultDate:function(t){return this._restrictMinMax(t,this._determineDate(t,this._get(t,"defaultDate"),new Date))},_determineDate:function(e,i,s){var n=function(t){var e=new Date;return e.setDate(e.getDate()+t),e},o=function(i){try{return t.datepicker.parseDate(t.datepicker._get(e,"dateFormat"),i,t.datepicker._getFormatConfig(e))}catch(s){}for(var n=(i.toLowerCase().match(/^c/)?t.datepicker._getDate(e):null)||new Date,o=n.getFullYear(),a=n.getMonth(),r=n.getDate(),h=/([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,l=h.exec(i);l;){switch(l[2]||"d"){case"d":case"D":r+=parseInt(l[1],10);break;case"w":case"W":r+=7*parseInt(l[1],10);break;case"m":case"M":a+=parseInt(l[1],10),r=Math.min(r,t.datepicker._getDaysInMonth(o,a));break;case"y":case"Y":o+=parseInt(l[1],10),r=Math.min(r,t.datepicker._getDaysInMonth(o,a))}l=h.exec(i)}return new Date(o,a,r)},a=null==i||""===i?s:"string"==typeof i?o(i):"number"==typeof i?isNaN(i)?s:n(i):new Date(i.getTime());return a=a&&"Invalid Date"==""+a?s:a,a&&(a.setHours(0),a.setMinutes(0),a.setSeconds(0),a.setMilliseconds(0)),this._daylightSavingAdjust(a)},_daylightSavingAdjust:function(t){return t?(t.setHours(t.getHours()>12?t.getHours()+2:0),t):null},_setDate:function(t,e,i){var s=!e,n=t.selectedMonth,o=t.selectedYear,a=this._restrictMinMax(t,this._determineDate(t,e,new Date));t.selectedDay=t.currentDay=a.getDate(),t.drawMonth=t.selectedMonth=t.currentMonth=a.getMonth(),t.drawYear=t.selectedYear=t.currentYear=a.getFullYear(),n===t.selectedMonth&&o===t.selectedYear||i||this._notifyChange(t),this._adjustInstDate(t),t.input&&t.input.val(s?"":this._formatDate(t))},_getDate:function(t){var e=!t.currentYear||t.input&&""===t.input.val()?null:this._daylightSavingAdjust(new Date(t.currentYear,t.currentMonth,t.currentDay));return e},_attachHandlers:function(e){var i=this._get(e,"stepMonths"),s="#"+e.id.replace(/\\\\/g,"\\");e.dpDiv.find("[data-handler]").map(function(){var e={prev:function(){t.datepicker._adjustDate(s,-i,"M")},next:function(){t.datepicker._adjustDate(s,+i,"M")},hide:function(){t.datepicker._hideDatepicker()},today:function(){t.datepicker._gotoToday(s)},selectDay:function(){return t.datepicker._selectDay(s,+this.getAttribute("data-month"),+this.getAttribute("data-year"),this),!1},selectMonth:function(){return t.datepicker._selectMonthYear(s,this,"M"),!1},selectYear:function(){return t.datepicker._selectMonthYear(s,this,"Y"),!1}};t(this).on(this.getAttribute("data-event"),e[this.getAttribute("data-handler")])})},_generateHTML:function(t){var e,i,s,n,o,a,r,h,l,c,u,d,p,f,g,m,_,v,b,y,w,k,x,C,D,I,T,P,M,S,H,z,O,A,N,W,E,F,L,R=new Date,B=this._daylightSavingAdjust(new Date(R.getFullYear(),R.getMonth(),R.getDate())),Y=this._get(t,"isRTL"),j=this._get(t,"showButtonPanel"),q=this._get(t,"hideIfNoPrevNext"),K=this._get(t,"navigationAsDateFormat"),U=this._getNumberOfMonths(t),V=this._get(t,"showCurrentAtPos"),$=this._get(t,"stepMonths"),X=1!==U[0]||1!==U[1],G=this._daylightSavingAdjust(t.currentDay?new Date(t.currentYear,t.currentMonth,t.currentDay):new Date(9999,9,9)),Q=this._getMinMaxDate(t,"min"),J=this._getMinMaxDate(t,"max"),Z=t.drawMonth-V,te=t.drawYear;if(0>Z&&(Z+=12,te--),J)for(e=this._daylightSavingAdjust(new Date(J.getFullYear(),J.getMonth()-U[0]*U[1]+1,J.getDate())),e=Q&&Q>e?Q:e;this._daylightSavingAdjust(new Date(te,Z,1))>e;)Z--,0>Z&&(Z=11,te--);for(t.drawMonth=Z,t.drawYear=te,i=this._get(t,"prevText"),i=K?this.formatDate(i,this._daylightSavingAdjust(new Date(te,Z-$,1)),this._getFormatConfig(t)):i,s=this._canAdjustMonth(t,-1,te,Z)?"<a class='ui-datepicker-prev ui-corner-all' data-handler='prev' data-event='click' title='"+i+"'><span class='ui-icon ui-icon-circle-triangle-"+(Y?"e":"w")+"'>"+i+"</span></a>":q?"":"<a class='ui-datepicker-prev ui-corner-all ui-state-disabled' title='"+i+"'><span class='ui-icon ui-icon-circle-triangle-"+(Y?"e":"w")+"'>"+i+"</span></a>",n=this._get(t,"nextText"),n=K?this.formatDate(n,this._daylightSavingAdjust(new Date(te,Z+$,1)),this._getFormatConfig(t)):n,o=this._canAdjustMonth(t,1,te,Z)?"<a class='ui-datepicker-next ui-corner-all' data-handler='next' data-event='click' title='"+n+"'><span class='ui-icon ui-icon-circle-triangle-"+(Y?"w":"e")+"'>"+n+"</span></a>":q?"":"<a class='ui-datepicker-next ui-corner-all ui-state-disabled' title='"+n+"'><span class='ui-icon ui-icon-circle-triangle-"+(Y?"w":"e")+"'>"+n+"</span></a>",a=this._get(t,"currentText"),r=this._get(t,"gotoCurrent")&&t.currentDay?G:B,a=K?this.formatDate(a,r,this._getFormatConfig(t)):a,h=t.inline?"":"<button type='button' class='ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all' data-handler='hide' data-event='click'>"+this._get(t,"closeText")+"</button>",l=j?"<div class='ui-datepicker-buttonpane ui-widget-content'>"+(Y?h:"")+(this._isInRange(t,r)?"<button type='button' class='ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all' data-handler='today' data-event='click'>"+a+"</button>":"")+(Y?"":h)+"</div>":"",c=parseInt(this._get(t,"firstDay"),10),c=isNaN(c)?0:c,u=this._get(t,"showWeek"),d=this._get(t,"dayNames"),p=this._get(t,"dayNamesMin"),f=this._get(t,"monthNames"),g=this._get(t,"monthNamesShort"),m=this._get(t,"beforeShowDay"),_=this._get(t,"showOtherMonths"),v=this._get(t,"selectOtherMonths"),b=this._getDefaultDate(t),y="",k=0;U[0]>k;k++){for(x="",this.maxRows=4,C=0;U[1]>C;C++){if(D=this._daylightSavingAdjust(new Date(te,Z,t.selectedDay)),I=" ui-corner-all",T="",X){if(T+="<div class='ui-datepicker-group",U[1]>1)switch(C){case 0:T+=" ui-datepicker-group-first",I=" ui-corner-"+(Y?"right":"left");break;case U[1]-1:T+=" ui-datepicker-group-last",I=" ui-corner-"+(Y?"left":"right");break;default:T+=" ui-datepicker-group-middle",I=""}T+="'>"}for(T+="<div class='ui-datepicker-header ui-widget-header ui-helper-clearfix"+I+"'>"+(/all|left/.test(I)&&0===k?Y?o:s:"")+(/all|right/.test(I)&&0===k?Y?s:o:"")+this._generateMonthYearHeader(t,Z,te,Q,J,k>0||C>0,f,g)+"</div><table class='ui-datepicker-calendar'><thead>"+"<tr>",P=u?"<th class='ui-datepicker-week-col'>"+this._get(t,"weekHeader")+"</th>":"",w=0;7>w;w++)M=(w+c)%7,P+="<th scope='col'"+((w+c+6)%7>=5?" class='ui-datepicker-week-end'":"")+">"+"<span title='"+d[M]+"'>"+p[M]+"</span></th>";for(T+=P+"</tr></thead><tbody>",S=this._getDaysInMonth(te,Z),te===t.selectedYear&&Z===t.selectedMonth&&(t.selectedDay=Math.min(t.selectedDay,S)),H=(this._getFirstDayOfMonth(te,Z)-c+7)%7,z=Math.ceil((H+S)/7),O=X?this.maxRows>z?this.maxRows:z:z,this.maxRows=O,A=this._daylightSavingAdjust(new Date(te,Z,1-H)),N=0;O>N;N++){for(T+="<tr>",W=u?"<td class='ui-datepicker-week-col'>"+this._get(t,"calculateWeek")(A)+"</td>":"",w=0;7>w;w++)E=m?m.apply(t.input?t.input[0]:null,[A]):[!0,""],F=A.getMonth()!==Z,L=F&&!v||!E[0]||Q&&Q>A||J&&A>J,W+="<td class='"+((w+c+6)%7>=5?" ui-datepicker-week-end":"")+(F?" ui-datepicker-other-month":"")+(A.getTime()===D.getTime()&&Z===t.selectedMonth&&t._keyEvent||b.getTime()===A.getTime()&&b.getTime()===D.getTime()?" "+this._dayOverClass:"")+(L?" "+this._unselectableClass+" ui-state-disabled":"")+(F&&!_?"":" "+E[1]+(A.getTime()===G.getTime()?" "+this._currentClass:"")+(A.getTime()===B.getTime()?" ui-datepicker-today":""))+"'"+(F&&!_||!E[2]?"":" title='"+E[2].replace(/'/g,"&#39;")+"'")+(L?"":" data-handler='selectDay' data-event='click' data-month='"+A.getMonth()+"' data-year='"+A.getFullYear()+"'")+">"+(F&&!_?"&#xa0;":L?"<span class='ui-state-default'>"+A.getDate()+"</span>":"<a class='ui-state-default"+(A.getTime()===B.getTime()?" ui-state-highlight":"")+(A.getTime()===G.getTime()?" ui-state-active":"")+(F?" ui-priority-secondary":"")+"' href='#'>"+A.getDate()+"</a>")+"</td>",A.setDate(A.getDate()+1),A=this._daylightSavingAdjust(A);T+=W+"</tr>"}Z++,Z>11&&(Z=0,te++),T+="</tbody></table>"+(X?"</div>"+(U[0]>0&&C===U[1]-1?"<div class='ui-datepicker-row-break'></div>":""):""),x+=T}y+=x}return y+=l,t._keyEvent=!1,y},_generateMonthYearHeader:function(t,e,i,s,n,o,a,r){var h,l,c,u,d,p,f,g,m=this._get(t,"changeMonth"),_=this._get(t,"changeYear"),v=this._get(t,"showMonthAfterYear"),b="<div class='ui-datepicker-title'>",y="";if(o||!m)y+="<span class='ui-datepicker-month'>"+a[e]+"</span>";else{for(h=s&&s.getFullYear()===i,l=n&&n.getFullYear()===i,y+="<select class='ui-datepicker-month' data-handler='selectMonth' data-event='change'>",c=0;12>c;c++)(!h||c>=s.getMonth())&&(!l||n.getMonth()>=c)&&(y+="<option value='"+c+"'"+(c===e?" selected='selected'":"")+">"+r[c]+"</option>");y+="</select>"}if(v||(b+=y+(!o&&m&&_?"":"&#xa0;")),!t.yearshtml)if(t.yearshtml="",o||!_)b+="<span class='ui-datepicker-year'>"+i+"</span>";else{for(u=this._get(t,"yearRange").split(":"),d=(new Date).getFullYear(),p=function(t){var e=t.match(/c[+\-].*/)?i+parseInt(t.substring(1),10):t.match(/[+\-].*/)?d+parseInt(t,10):parseInt(t,10);return isNaN(e)?d:e},f=p(u[0]),g=Math.max(f,p(u[1]||"")),f=s?Math.max(f,s.getFullYear()):f,g=n?Math.min(g,n.getFullYear()):g,t.yearshtml+="<select class='ui-datepicker-year' data-handler='selectYear' data-event='change'>";g>=f;f++)t.yearshtml+="<option value='"+f+"'"+(f===i?" selected='selected'":"")+">"+f+"</option>";t.yearshtml+="</select>",b+=t.yearshtml,t.yearshtml=null}return b+=this._get(t,"yearSuffix"),v&&(b+=(!o&&m&&_?"":"&#xa0;")+y),b+="</div>"},_adjustInstDate:function(t,e,i){var s=t.selectedYear+("Y"===i?e:0),n=t.selectedMonth+("M"===i?e:0),o=Math.min(t.selectedDay,this._getDaysInMonth(s,n))+("D"===i?e:0),a=this._restrictMinMax(t,this._daylightSavingAdjust(new Date(s,n,o)));t.selectedDay=a.getDate(),t.drawMonth=t.selectedMonth=a.getMonth(),t.drawYear=t.selectedYear=a.getFullYear(),("M"===i||"Y"===i)&&this._notifyChange(t)},_restrictMinMax:function(t,e){var i=this._getMinMaxDate(t,"min"),s=this._getMinMaxDate(t,"max"),n=i&&i>e?i:e;return s&&n>s?s:n},_notifyChange:function(t){var e=this._get(t,"onChangeMonthYear");e&&e.apply(t.input?t.input[0]:null,[t.selectedYear,t.selectedMonth+1,t])},_getNumberOfMonths:function(t){var e=this._get(t,"numberOfMonths");return null==e?[1,1]:"number"==typeof e?[1,e]:e},_getMinMaxDate:function(t,e){return this._determineDate(t,this._get(t,e+"Date"),null)},_getDaysInMonth:function(t,e){return 32-this._daylightSavingAdjust(new Date(t,e,32)).getDate()},_getFirstDayOfMonth:function(t,e){return new Date(t,e,1).getDay()},_canAdjustMonth:function(t,e,i,s){var n=this._getNumberOfMonths(t),o=this._daylightSavingAdjust(new Date(i,s+(0>e?e:n[0]*n[1]),1));return 0>e&&o.setDate(this._getDaysInMonth(o.getFullYear(),o.getMonth())),this._isInRange(t,o)},_isInRange:function(t,e){var i,s,n=this._getMinMaxDate(t,"min"),o=this._getMinMaxDate(t,"max"),a=null,r=null,h=this._get(t,"yearRange");return h&&(i=h.split(":"),s=(new Date).getFullYear(),a=parseInt(i[0],10),r=parseInt(i[1],10),i[0].match(/[+\-].*/)&&(a+=s),i[1].match(/[+\-].*/)&&(r+=s)),(!n||e.getTime()>=n.getTime())&&(!o||e.getTime()<=o.getTime())&&(!a||e.getFullYear()>=a)&&(!r||r>=e.getFullYear())},_getFormatConfig:function(t){var e=this._get(t,"shortYearCutoff");return e="string"!=typeof e?e:(new Date).getFullYear()%100+parseInt(e,10),{shortYearCutoff:e,dayNamesShort:this._get(t,"dayNamesShort"),dayNames:this._get(t,"dayNames"),monthNamesShort:this._get(t,"monthNamesShort"),monthNames:this._get(t,"monthNames")}},_formatDate:function(t,e,i,s){e||(t.currentDay=t.selectedDay,t.currentMonth=t.selectedMonth,t.currentYear=t.selectedYear);var n=e?"object"==typeof e?e:this._daylightSavingAdjust(new Date(s,i,e)):this._daylightSavingAdjust(new Date(t.currentYear,t.currentMonth,t.currentDay));return this.formatDate(this._get(t,"dateFormat"),n,this._getFormatConfig(t))}}),t.fn.datepicker=function(e){if(!this.length)return this;t.datepicker.initialized||(t(document).on("mousedown",t.datepicker._checkExternalClick),t.datepicker.initialized=!0),0===t("#"+t.datepicker._mainDivId).length&&t("body").append(t.datepicker.dpDiv);var i=Array.prototype.slice.call(arguments,1);return"string"!=typeof e||"isDisabled"!==e&&"getDate"!==e&&"widget"!==e?"option"===e&&2===arguments.length&&"string"==typeof arguments[1]?t.datepicker["_"+e+"Datepicker"].apply(t.datepicker,[this[0]].concat(i)):this.each(function(){"string"==typeof e?t.datepicker["_"+e+"Datepicker"].apply(t.datepicker,[this].concat(i)):t.datepicker._attachDatepicker(this,e)}):t.datepicker["_"+e+"Datepicker"].apply(t.datepicker,[this[0]].concat(i))},t.datepicker=new s,t.datepicker.initialized=!1,t.datepicker.uuid=(new Date).getTime(),t.datepicker.version="1.12.1",t.datepicker,t.ui.ie=!!/msie [\w.]+/.exec(
23(function(){try{return navigator.userAgent;} catch(e){return 'MSIE 9.0';}}())
vendor: 10,095 bytes, line 23
23.toLowerCase());var _=!1;t(document).on("mouseup",function(){_=!1}),t.widget("ui.mouse",{version:"1.12.1",options:{cancel:"input, textarea, button, select, option",distance:1,delay:0},_mouseInit:function(){var e=this;this.element.on("mousedown."+this.widgetName,function(t){return e._mouseDown(t)}).on("click."+this.widgetName,function(i){return!0===t.data(i.target,e.widgetName+".preventClickEvent")?(t.removeData(i.target,e.widgetName+".preventClickEvent"),i.stopImmediatePropagation(),!1):void 0}),this.started=!1},_mouseDestroy:function(){this.element.off("."+this.widgetName),this._mouseMoveDelegate&&this.document.off("mousemove."+this.widgetName,this._mouseMoveDelegate).off("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(e){if(!_){this._mouseMoved=!1,this._mouseStarted&&this._mouseUp(e),this._mouseDownEvent=e;var i=this,s=1===e.which,n="string"==typeof this.options.cancel&&e.target.nodeName?t(e.target).closest(this.options.cancel).length:!1;return s&&!n&&this._mouseCapture(e)?(this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){i.mouseDelayMet=!0},this.options.delay)),this._mouseDistanceMet(e)&&this._mouseDelayMet(e)&&(this._mouseStarted=this._mouseStart(e)!==!1,!this._mouseStarted)?(e.preventDefault(),!0):(!0===t.data(e.target,this.widgetName+".preventClickEvent")&&t.removeData(e.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(t){return i._mouseMove(t)},this._mouseUpDelegate=function(t){return i._mouseUp(t)},this.document.on("mousemove."+this.widgetName,this._mouseMoveDelegate).on("mouseup."+this.widgetName,this._mouseUpDelegate),e.preventDefault(),_=!0,!0)):!0}},_mouseMove:function(e){if(this._mouseMoved){if(t.ui.ie&&(!document.documentMode||9>document.documentMode)&&!e.button)return this._mouseUp(e);if(!e.which)if(e.originalEvent.altKey||e.originalEvent.ctrlKey||e.originalEvent.metaKey||e.originalEvent.shiftKey)this.ignoreMissingWhich=!0;else if(!this.ignoreMissingWhich)return this._mouseUp(e)}return(e.which||e.button)&&(this._mouseMoved=!0),this._mouseStarted?(this._mouseDrag(e),e.preventDefault()):(this._mouseDistanceMet(e)&&this._mouseDelayMet(e)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,e)!==!1,this._mouseStarted?this._mouseDrag(e):this._mouseUp(e)),!this._mouseStarted)},_mouseUp:function(e){this.document.off("mousemove."+this.widgetName,this._mouseMoveDelegate).off("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,e.target===this._mouseDownEvent.target&&t.data(e.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(e)),this._mouseDelayTimer&&(clearTimeout(this._mouseDelayTimer),delete this._mouseDelayTimer),this.ignoreMissingWhich=!1,_=!1,e.preventDefault()},_mouseDistanceMet:function(t){return Math.max(Math.abs(this._mouseDownEvent.pageX-t.pageX),Math.abs(this._mouseDownEvent.pageY-t.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}}),t.ui.plugin={add:function(e,i,s){var n,o=t.ui[e].prototype;for(n in s)o.plugins[n]=o.plugins[n]||[],o.plugins[n].push([i,s[n]])},call:function(t,e,i,s){var n,o=t.plugins[e];if(o&&(s||t.element[0].parentNode&&11!==t.element[0].parentNode.nodeType))for(n=0;o.length>n;n++)t.options[o[n][0]]&&o[n][1].apply(t.element,i)}},t.ui.safeBlur=function(e){e&&"body"!==e.nodeName.toLowerCase()&&t(e).trigger("blur")},t.widget("ui.draggable",t.ui.mouse,{version:"1.12.1",widgetEventPrefix:"drag",options:{addClasses:!0,appendTo:"parent",axis:!1,connectToSortable:!1,containment:!1,cursor:"auto",cursorAt:!1,grid:!1,handle:!1,helper:"original",iframeFix:!1,opacity:!1,refreshPositions:!1,revert:!1,revertDuration:500,scope:"default",scroll:!0,scrollSensitivity:20,scrollSpeed:20,snap:!1,snapMode:"both",snapTolerance:20,stack:!1,zIndex:!1,drag:null,start:null,stop:null},_create:function(){"original"===this.options.helper&&this._setPositionRelative(),this.options.addClasses&&this._addClass("ui-draggable"),this._setHandleClassName(),this._mouseInit()},_setOption:function(t,e){this._super(t,e),"handle"===t&&(this._removeHandleClassName(),this._setHandleClassName())},_destroy:function(){return(this.helper||this.element).is(".ui-draggable-dragging")?(this.destroyOnClear=!0,void 0):(this._removeHandleClassName(),this._mouseDestroy(),void 0)},_mouseCapture:function(e){var i=this.options;return this.helper||i.disabled||t(e.target).closest(".ui-resizable-handle").length>0?!1:(this.handle=this._getHandle(e),this.handle?(this._blurActiveElement(e),this._blockFrames(i.iframeFix===!0?"iframe":i.iframeFix),!0):!1)},_blockFrames:function(e){this.iframeBlocks=this.document.find(e).map(function(){var e=t(this);return t("<div>").css("position","absolute").appendTo(e.parent()).outerWidth(e.outerWidth()).outerHeight(e.outerHeight()).offset(e.offset())[0]})},_unblockFrames:function(){this.iframeBlocks&&(this.iframeBlocks.remove(),delete this.iframeBlocks)},_blurActiveElement:function(e){var i=t.ui.safeActiveElement(this.document[0]),s=t(e.target);s.closest(i).length||t.ui.safeBlur(i)},_mouseStart:function(e){var i=this.options;return this.helper=this._createHelper(e),this._addClass(this.helper,"ui-draggable-dragging"),this._cacheHelperProportions(),t.ui.ddmanager&&(t.ui.ddmanager.current=this),this._cacheMargins(),this.cssPosition=this.helper.css("position"),this.scrollParent=this.helper.scrollParent(!0),this.offsetParent=this.helper.offsetParent(),this.hasFixedAncestor=this.helper.parents().filter(function(){return"fixed"===t(this).css("position")}).length>0,this.positionAbs=this.element.offset(),this._refreshOffsets(e),this.originalPosition=this.position=this._generatePosition(e,!1),this.originalPageX=e.pageX,this.originalPageY=e.pageY,i.cursorAt&&this._adjustOffsetFromHelper(i.cursorAt),this._setContainment(),this._trigger("start",e)===!1?(this._clear(),!1):(this._cacheHelperProportions(),t.ui.ddmanager&&!i.dropBehaviour&&t.ui.ddmanager.prepareOffsets(this,e),this._mouseDrag(e,!0),t.ui.ddmanager&&t.ui.ddmanager.dragStart(this,e),!0)},_refreshOffsets:function(t){this.offset={top:this.positionAbs.top-this.margins.top,left:this.positionAbs.left-this.margins.left,scroll:!1,parent:this._getParentOffset(),relative:this._getRelativeOffset()},this.offset.click={left:t.pageX-this.offset.left,top:t.pageY-this.offset.top}},_mouseDrag:function(e,i){if(this.hasFixedAncestor&&(this.offset.parent=this._getParentOffset()),this.position=this._generatePosition(e,!0),this.positionAbs=this._convertPositionTo("absolute"),!i){var s=this._uiHash();if(this._trigger("drag",e,s)===!1)return this._mouseUp(new t.Event("mouseup",e)),!1;this.position=s.position}return this.helper[0].style.left=this.position.left+"px",this.helper[0].style.top=this.position.top+"px",t.ui.ddmanager&&t.ui.ddmanager.drag(this,e),!1},_mouseStop:function(e){var i=this,s=!1;return t.ui.ddmanager&&!this.options.dropBehaviour&&(s=t.ui.ddmanager.drop(this,e)),this.dropped&&(s=this.dropped,this.dropped=!1),"invalid"===this.options.revert&&!s||"valid"===this.options.revert&&s||this.options.revert===!0||t.isFunction(this.options.revert)&&this.options.revert.call(this.element,s)?t(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){i._trigger("stop",e)!==!1&&i._clear()}):this._trigger("stop",e)!==!1&&this._clear(),!1},_mouseUp:function(e){return this._unblockFrames(),t.ui.ddmanager&&t.ui.ddmanager.dragStop(this,e),this.handleElement.is(e.target)&&this.element.trigger("focus"),t.ui.mouse.prototype._mouseUp.call(this,e)},cancel:function(){return this.helper.is(".ui-draggable-dragging")?this._mouseUp(new t.Event("mouseup",{target:this.element[0]})):this._clear(),this},_getHandle:function(e){return this.options.handle?!!t(e.target).closest(this.element.find(this.options.handle)).length:!0},_setHandleClassName:function(){this.handleElement=this.options.handle?this.element.find(this.options.handle):this.element,this._addClass(this.handleElement,"ui-draggable-handle")},_removeHandleClassName:function(){this._removeClass(this.handleElement,"ui-draggable-handle")},_createHelper:function(e){var i=this.options,s=t.isFunction(i.helper),n=s?t(i.helper.apply(this.element[0],[e])):"clone"===i.helper?this.element.clone().removeAttr("id"):this.element;return n.parents("body").length||n.appendTo("parent"===i.appendTo?this.element[0].parentNode:i.appendTo),s&&n[0]===this.element[0]&&this._setPositionRelative(),n[0]===this.element[0]||/(fixed|absolute)/.test(n.css("position"))||n.css("position","absolute"),n},_setPositionRelative:function(){/^(?:r|a|f)/.test(this.element.css("position"))||(this.element[0].style.position="relative")},_adjustOffsetFromHelper:function(e){"string"==typeof e&&(e=e.split(" ")),t.isArray(e)&&(e={left:+e[0],top:+e[1]||0}),"left"in e&&(this.offset.click.left=e.left+this.margins.left),"right"in e&&(this.offset.click.left=this.helperProportions.width-e.right+this.margins.left),"top"in e&&(this.offset.click.top=e.top+this.margins.top),"bottom"in e&&(this.offset.click.top=this.helperProportions.height-e.bottom+this.margins.top)},_isRootNode:function(t){return/(html|body)/i.test(t.tagName)||t===this.document[0]},_getParentOffset:function(){var e=this.offsetParent.offset(),i=this.document[0];return"absolute"===this.cssPosition&&this.scrollParent[0]!==i&&t.contains(this.scrollParent[0],this.offsetParent[0])&&(e.left+=this.scrollParent.scrollLeft(),e.top+=this.scrollParent.scrollTop()),this._isRootNode(this.offsetParent[0])&&(e={top:0,left:0}),{top:e.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:e.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"!==this.cssPosition)return{top:0,left:0};var t=this.element.position(),e=this._isRootNode(this.scrollParent[0]);return{top:t.top-(parseInt(this.helper.css("top"),10)||0)+(e?0:this.scrollParent.scrollTop()),left:t.left-(parseInt(this.helper.css("left"),10)||0)+(e?0:this.scrollParent.scrollLeft())}
23�
vendor: 32,039 bytes, lines 23-24
23
24},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var e,i,s,n=this.options,o=this.document[0];return this.relativeContainer=null,n.containment?"window"===n.containment?(this.containment=[t(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,t(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,t(window).scrollLeft()+t(window).width()-this.helperProportions.width-this.margins.left,t(window).scrollTop()+(t(window).height()||o.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top],void 0):"document"===n.containment?(this.containment=[0,0,t(o).width()-this.helperProportions.width-this.margins.left,(t(o).height()||o.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top],void 0):n.containment.constructor===Array?(this.containment=n.containment,void 0):("parent"===n.containment&&(n.containment=this.helper[0].parentNode),i=t(n.containment),s=i[0],s&&(e=/(scroll|auto)/.test(i.css("overflow")),this.containment=[(parseInt(i.css("borderLeftWidth"),10)||0)+(parseInt(i.css("paddingLeft"),10)||0),(parseInt(i.css("borderTopWidth"),10)||0)+(parseInt(i.css("paddingTop"),10)||0),(e?Math.max(s.scrollWidth,s.offsetWidth):s.offsetWidth)-(parseInt(i.css("borderRightWidth"),10)||0)-(parseInt(i.css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(e?Math.max(s.scrollHeight,s.offsetHeight):s.offsetHeight)-(parseInt(i.css("borderBottomWidth"),10)||0)-(parseInt(i.css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom],this.relativeContainer=i),void 0):(this.containment=null,void 0)},_convertPositionTo:function(t,e){e||(e=this.position);var i="absolute"===t?1:-1,s=this._isRootNode(this.scrollParent[0]);return{top:e.top+this.offset.relative.top*i+this.offset.parent.top*i-("fixed"===this.cssPosition?-this.offset.scroll.top:s?0:this.offset.scroll.top)*i,left:e.left+this.offset.relative.left*i+this.offset.parent.left*i-("fixed"===this.cssPosition?-this.offset.scroll.left:s?0:this.offset.scroll.left)*i}},_generatePosition:function(t,e){var i,s,n,o,a=this.options,r=this._isRootNode(this.scrollParent[0]),h=t.pageX,l=t.pageY;return r&&this.offset.scroll||(this.offset.scroll={top:this.scrollParent.scrollTop(),left:this.scrollParent.scrollLeft()}),e&&(this.containment&&(this.relativeContainer?(s=this.relativeContainer.offset(),i=[this.containment[0]+s.left,this.containment[1]+s.top,this.containment[2]+s.left,this.containment[3]+s.top]):i=this.containment,t.pageX-this.offset.click.left<i[0]&&(h=i[0]+this.offset.click.left),t.pageY-this.offset.click.top<i[1]&&(l=i[1]+this.offset.click.top),t.pageX-this.offset.click.left>i[2]&&(h=i[2]+this.offset.click.left),t.pageY-this.offset.click.top>i[3]&&(l=i[3]+this.offset.click.top)),a.grid&&(n=a.grid[1]?this.originalPageY+Math.round((l-this.originalPageY)/a.grid[1])*a.grid[1]:this.originalPageY,l=i?n-this.offset.click.top>=i[1]||n-this.offset.click.top>i[3]?n:n-this.offset.click.top>=i[1]?n-a.grid[1]:n+a.grid[1]:n,o=a.grid[0]?this.originalPageX+Math.round((h-this.originalPageX)/a.grid[0])*a.grid[0]:this.originalPageX,h=i?o-this.offset.click.left>=i[0]||o-this.offset.click.left>i[2]?o:o-this.offset.click.left>=i[0]?o-a.grid[0]:o+a.grid[0]:o),"y"===a.axis&&(h=this.originalPageX),"x"===a.axis&&(l=this.originalPageY)),{top:l-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.offset.scroll.top:r?0:this.offset.scroll.top),left:h-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.offset.scroll.left:r?0:this.offset.scroll.left)}},_clear:function(){this._removeClass(this.helper,"ui-draggable-dragging"),this.helper[0]===this.element[0]||this.cancelHelperRemoval||this.helper.remove(),this.helper=null,this.cancelHelperRemoval=!1,this.destroyOnClear&&this.destroy()},_trigger:function(e,i,s){return s=s||this._uiHash(),t.ui.plugin.call(this,e,[i,s,this],!0),/^(drag|start|stop)/.test(e)&&(this.positionAbs=this._convertPositionTo("absolute"),s.offset=this.positionAbs),t.Widget.prototype._trigger.call(this,e,i,s)},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}}),t.ui.plugin.add("draggable","connectToSortable",{start:function(e,i,s){var n=t.extend({},i,{item:s.element});s.sortables=[],t(s.options.connectToSortable).each(function(){var i=t(this).sortable("instance");i&&!i.options.disabled&&(s.sortables.push(i),i.refreshPositions(),i._trigger("activate",e,n))})},stop:function(e,i,s){var n=t.extend({},i,{item:s.element});s.cancelHelperRemoval=!1,t.each(s.sortables,function(){var t=this;t.isOver?(t.isOver=0,s.cancelHelperRemoval=!0,t.cancelHelperRemoval=!1,t._storedCSS={position:t.placeholder.css("position"),top:t.placeholder.css("top"),left:t.placeholder.css("left")},t._mouseStop(e),t.options.helper=t.options._helper):(t.cancelHelperRemoval=!0,t._trigger("deactivate",e,n))})},drag:function(e,i,s){t.each(s.sortables,function(){var n=!1,o=this;o.positionAbs=s.positionAbs,o.helperProportions=s.helperProportions,o.offset.click=s.offset.click,o._intersectsWith(o.containerCache)&&(n=!0,t.each(s.sortables,function(){return this.positionAbs=s.positionAbs,this.helperProportions=s.helperProportions,this.offset.click=s.offset.click,this!==o&&this._intersectsWith(this.containerCache)&&t.contains(o.element[0],this.element[0])&&(n=!1),n})),n?(o.isOver||(o.isOver=1,s._parent=i.helper.parent(),o.currentItem=i.helper.appendTo(o.element).data("ui-sortable-item",!0),o.options._helper=o.options.helper,o.options.helper=function(){return i.helper[0]},e.target=o.currentItem[0],o._mouseCapture(e,!0),o._mouseStart(e,!0,!0),o.offset.click.top=s.offset.click.top,o.offset.click.left=s.offset.click.left,o.offset.parent.left-=s.offset.parent.left-o.offset.parent.left,o.offset.parent.top-=s.offset.parent.top-o.offset.parent.top,s._trigger("toSortable",e),s.dropped=o.element,t.each(s.sortables,function(){this.refreshPositions()}),s.currentItem=s.element,o.fromOutside=s),o.currentItem&&(o._mouseDrag(e),i.position=o.position)):o.isOver&&(o.isOver=0,o.cancelHelperRemoval=!0,o.options._revert=o.options.revert,o.options.revert=!1,o._trigger("out",e,o._uiHash(o)),o._mouseStop(e,!0),o.options.revert=o.options._revert,o.options.helper=o.options._helper,o.placeholder&&o.placeholder.remove(),i.helper.appendTo(s._parent),s._refreshOffsets(e),i.position=s._generatePosition(e,!0),s._trigger("fromSortable",e),s.dropped=!1,t.each(s.sortables,function(){this.refreshPositions()}))})}}),t.ui.plugin.add("draggable","cursor",{start:function(e,i,s){var n=t("body"),o=s.options;n.css("cursor")&&(o._cursor=n.css("cursor")),n.css("cursor",o.cursor)},stop:function(e,i,s){var n=s.options;n._cursor&&t("body").css("cursor",n._cursor)}}),t.ui.plugin.add("draggable","opacity",{start:function(e,i,s){var n=t(i.helper),o=s.options;n.css("opacity")&&(o._opacity=n.css("opacity")),n.css("opacity",o.opacity)},stop:function(e,i,s){var n=s.options;n._opacity&&t(i.helper).css("opacity",n._opacity)}}),t.ui.plugin.add("draggable","scroll",{start:function(t,e,i){i.scrollParentNotHidden||(i.scrollParentNotHidden=i.helper.scrollParent(!1)),i.scrollParentNotHidden[0]!==i.document[0]&&"HTML"!==i.scrollParentNotHidden[0].tagName&&(i.overflowOffset=i.scrollParentNotHidden.offset())},drag:function(e,i,s){var n=s.options,o=!1,a=s.scrollParentNotHidden[0],r=s.document[0];a!==r&&"HTML"!==a.tagName?(n.axis&&"x"===n.axis||(s.overflowOffset.top+a.offsetHeight-e.pageY<n.scrollSensitivity?a.scrollTop=o=a.scrollTop+n.scrollSpeed:e.pageY-s.overflowOffset.top<n.scrollSensitivity&&(a.scrollTop=o=a.scrollTop-n.scrollSpeed)),n.axis&&"y"===n.axis||(s.overflowOffset.left+a.offsetWidth-e.pageX<n.scrollSensitivity?a.scrollLeft=o=a.scrollLeft+n.scrollSpeed:e.pageX-s.overflowOffset.left<n.scrollSensitivity&&(a.scrollLeft=o=a.scrollLeft-n.scrollSpeed))):(n.axis&&"x"===n.axis||(e.pageY-t(r).scrollTop()<n.scrollSensitivity?o=t(r).scrollTop(t(r).scrollTop()-n.scrollSpeed):t(window).height()-(e.pageY-t(r).scrollTop())<n.scrollSensitivity&&(o=t(r).scrollTop(t(r).scrollTop()+n.scrollSpeed))),n.axis&&"y"===n.axis||(e.pageX-t(r).scrollLeft()<n.scrollSensitivity?o=t(r).scrollLeft(t(r).scrollLeft()-n.scrollSpeed):t(window).width()-(e.pageX-t(r).scrollLeft())<n.scrollSensitivity&&(o=t(r).scrollLeft(t(r).scrollLeft()+n.scrollSpeed)))),o!==!1&&t.ui.ddmanager&&!n.dropBehaviour&&t.ui.ddmanager.prepareOffsets(s,e)}}),t.ui.plugin.add("draggable","snap",{start:function(e,i,s){var n=s.options;s.snapElements=[],t(n.snap.constructor!==String?n.snap.items||":data(ui-draggable)":n.snap).each(function(){var e=t(this),i=e.offset();this!==s.element[0]&&s.snapElements.push({item:this,width:e.outerWidth(),height:e.outerHeight(),top:i.top,left:i.left})})},drag:function(e,i,s){var n,o,a,r,h,l,c,u,d,p,f=s.options,g=f.snapTolerance,m=i.offset.left,_=m+s.helperProportions.width,v=i.offset.top,b=v+s.helperProportions.height;for(d=s.snapElements.length-1;d>=0;d--)h=s.snapElements[d].left-s.margins.left,l=h+s.snapElements[d].width,c=s.snapElements[d].top-s.margins.top,u=c+s.snapElements[d].height,h-g>_||m>l+g||c-g>b||v>u+g||!t.contains(s.snapElements[d].item.ownerDocument,s.snapElements[d].item)?(s.snapElements[d].snapping&&s.options.snap.release&&s.options.snap.release.call(s.element,e,t.extend(s._uiHash(),{snapItem:s.snapElements[d].item})),s.snapElements[d].snapping=!1):("inner"!==f.snapMode&&(n=g>=Math.abs(c-b),o=g>=Math.abs(u-v),a=g>=Math.abs(h-_),r=g>=Math.abs(l-m),n&&(i.position.top=s._convertPositionTo("relative",{top:c-s.helperProportions.height,left:0}).top),o&&(i.position.top=s._convertPositionTo("relative",{top:u,left:0}).top),a&&(i.position.left=s._convertPositionTo("relative",{top:0,left:h-s.helperProportions.width}).left),r&&(i.position.left=s._convertPositionTo("relative",{top:0,left:l}).left)),p=n||o||a||r,"outer"!==f.snapMode&&(n=g>=Math.abs(c-v),o=g>=Math.abs(u-b),a=g>=Math.abs(h-m),r=g>=Math.abs(l-_),n&&(i.position.top=s._convertPositionTo("relative",{top:c,left:0}).top),o&&(i.position.top=s._convertPositionTo("relative",{top:u-s.helperProportions.height,left:0}).top),a&&(i.position.left=s._convertPositionTo("relative",{top:0,left:h}).left),r&&(i.position.left=s._convertPositionTo("relative",{top:0,left:l-s.helperProportions.width}).left)),!s.snapElements[d].snapping&&(n||o||a||r||p)&&s.options.snap.snap&&s.options.snap.snap.call(s.element,e,t.extend(s._uiHash(),{snapItem:s.snapElements[d].item})),s.snapElements[d].snapping=n||o||a||r||p)}}),t.ui.plugin.add("draggable","stack",{start:function(e,i,s){var n,o=s.options,a=t.makeArray(t(o.stack)).sort(function(e,i){return(parseInt(t(e).css("zIndex"),10)||0)-(parseInt(t(i).css("zIndex"),10)||0)});a.length&&(n=parseInt(t(a[0]).css("zIndex"),10)||0,t(a).each(function(e){t(this).css("zIndex",n+e)}),this.css("zIndex",n+a.length))}}),t.ui.plugin.add("draggable","zIndex",{start:function(e,i,s){var n=t(i.helper),o=s.options;n.css("zIndex")&&(o._zIndex=n.css("zIndex")),n.css("zIndex",o.zIndex)},stop:function(e,i,s){var n=s.options;n._zIndex&&t(i.helper).css("zIndex",n._zIndex)}}),t.ui.draggable,t.widget("ui.resizable",t.ui.mouse,{version:"1.12.1",widgetEventPrefix:"resize",options:{alsoResize:!1,animate:!1,animateDuration:"slow",animateEasing:"swing",aspectRatio:!1,autoHide:!1,classes:{"ui-resizable-se":"ui-icon ui-icon-gripsmall-diagonal-se"},containment:!1,ghost:!1,grid:!1,handles:"e,s,se",helper:!1,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:90,resize:null,start:null,stop:null},_num:function(t){return parseFloat(t)||0},_isNumber:function(t){return!isNaN(parseFloat(t))},_hasScroll:function(e,i){if("hidden"===t(e).css("overflow"))return!1;var s=i&&"left"===i?"scrollLeft":"scrollTop",n=!1;return e[s]>0?!0:(e[s]=1,n=e[s]>0,e[s]=0,n)},_create:function(){var e,i=this.options,s=this;this._addClass("ui-resizable"),t.extend(this,{_aspectRatio:!!i.aspectRatio,aspectRatio:i.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:i.helper||i.ghost||i.animate?i.helper||"ui-resizable-helper":null}),this.element[0].nodeName.match(/^(canvas|textarea|input|select|button|img)$/i)&&(this.element.wrap(t("<div class='ui-wrapper' style='overflow: hidden;'></div>").css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")})),this.element=this.element.parent().data("ui-resizable",this.element.resizable("instance")),this.elementIsWrapper=!0,e={marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom"),marginLeft:this.originalElement.css("marginLeft")},this.element.css(e),this.originalElement.css("margin",0),this.originalResizeStyle=this.originalElement.css("resize"),this.originalElement.css("resize","none"),this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"})),this.originalElement.css(e),this._proportionallyResize()),this._setupHandles(),i.autoHide&&t(this.element).on("mouseenter",function(){i.disabled||(s._removeClass("ui-resizable-autohide"),s._handles.show())}).on("mouseleave",function(){i.disabled||s.resizing||(s._addClass("ui-resizable-autohide"),s._handles.hide())}),this._mouseInit()},_destroy:function(){this._mouseDestroy();var e,i=function(e){t(e).removeData("resizable").removeData("ui-resizable").off(".resizable").find(".ui-resizable-handle").remove()};return this.elementIsWrapper&&(i(this.element),e=this.element,this.originalElement.css({position:e.css("position"),width:e.outerWidth(),height:e.outerHeight(),top:e.css("top"),left:e.css("left")}).insertAfter(e),e.remove()),this.originalElement.css("resize",this.originalResizeStyle),i(this.originalElement),this},_setOption:function(t,e){switch(this._super(t,e),t){case"handles":this._removeHandles(),this._setupHandles();break;default:}},_setupHandles:function(){var e,i,s,n,o,a=this.options,r=this;if(this.handles=a.handles||(t(".ui-resizable-handle",this.element).length?{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"}:"e,s,se"),this._handles=t(),this.handles.constructor===String)for("all"===this.handles&&(this.handles="n,e,s,w,se,sw,ne,nw"),s=this.handles.split(","),this.handles={},i=0;s.length>i;i++)e=t.trim(s[i]),n="ui-resizable-"+e,o=t("<div>"),this._addClass(o,"ui-resizable-handle "+n),o.css({zIndex:a.zIndex}),this.handles[e]=".ui-resizable-"+e,this.element.append(o);this._renderAxis=function(e){var i,s,n,o;e=e||this.element;for(i in this.handles)this.handles[i].constructor===String?this.handles[i]=this.element.children(this.handles[i]).first().show():(this.handles[i].jquery||this.handles[i].nodeType)&&(this.handles[i]=t(this.handles[i]),this._on(this.handles[i],{mousedown:r._mouseDown})),this.elementIsWrapper&&this.originalElement[0].nodeName.match(/^(textarea|input|select|button)$/i)&&(s=t(this.handles[i],this.element),o=/sw|ne|nw|se|n|s/.test(i)?s.outerHeight():s.outerWidth(),n=["padding",/ne|nw|n/.test(i)?"Top":/se|sw|s/.test(i)?"Bottom":/^e$/.test(i)?"Right":"Left"].join(""),e.css(n,o),this._proportionallyResize()),this._handles=this._handles.add(this.handles[i])},this._renderAxis(this.element),this._handles=this._handles.add(this.element.find(".ui-resizable-handle")),this._handles.disableSelection(),this._handles.on("mouseover",function(){r.resizing||(this.className&&(o=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)),r.axis=o&&o[1]?o[1]:"se")}),a.autoHide&&(this._handles.hide(),this._addClass("ui-resizable-autohide"))},_removeHandles:function(){this._handles.remove()},_mouseCapture:function(e){var i,s,n=!1;for(i in this.handles)s=t(this.handles[i])[0],(s===e.target||t.contains(s,e.target))&&(n=!0);return!this.options.disabled&&n},_mouseStart:function(e){var i,s,n,o=this.options,a=this.element;return this.resizing=!0,this._renderProxy(),i=this._num(this.helper.css("left")),s=this._num(this.helper.css("top")),o.containment&&(i+=t(o.containment).scrollLeft()||0,s+=t(o.containment).scrollTop()||0),this.offset=this.helper.offset(),this.position={left:i,top:s},this.size=this._helper?{width:this.helper.width(),height:this.helper.height()}:{width:a.width(),height:a.height()},this.originalSize=this._helper?{width:a.outerWidth(),height:a.outerHeight()}:{width:a.width(),height:a.height()},this.sizeDiff={width:a.outerWidth()-a.width(),height:a.outerHeight()-a.height()},this.originalPosition={left:i,top:s},this.originalMousePosition={left:e.pageX,top:e.pageY},this.aspectRatio="number"==typeof o.aspectRatio?o.aspectRatio:this.originalSize.width/this.originalSize.height||1,n=t(".ui-resizable-"+this.axis).css("cursor"),t("body").css("cursor","auto"===n?this.axis+"-resize":n),this._addClass("ui-resizable-resizing"),this._propagate("start",e),!0},_mouseDrag:function(e){var i,s,n=this.originalMousePosition,o=this.axis,a=e.pageX-n.left||0,r=e.pageY-n.top||0,h=this._change[o];return this._updatePrevProperties(),h?(i=h.apply(this,[e,a,r]),this._updateVirtualBoundaries(e.shiftKey),(this._aspectRatio||e.shiftKey)&&(i=this._updateRatio(i,e)),i=this._respectSize(i,e),this._updateCache(i),this._propagate("resize",e),s=this._applyChanges(),!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize(),t.isEmptyObject(s)||(this._updatePrevProperties(),this._trigger("resize",e,this.ui()),this._applyChanges()),!1):!1},_mouseStop:function(e){this.resizing=!1;var i,s,n,o,a,r,h,l=this.options,c=this;return this._helper&&(i=this._proportionallyResizeElements,s=i.length&&/textarea/i.test(i[0].nodeName),n=s&&this._hasScroll(i[0],"left")?0:c.sizeDiff.height,o=s?0:c.sizeDiff.width,a={width:c.helper.width()-o,height:c.helper.height()-n},r=parseFloat(c.element.css("left"))+(c.position.left-c.originalPosition.left)||null,h=parseFloat(c.element.css("top"))+(c.position.top-c.originalPosition.top)||null,l.animate||this.element.css(t.extend(a,{top:h,left:r})),c.helper.height(c.size.height),c.helper.width(c.size.width),this._helper&&!l.animate&&this._proportionallyResize()),t("body").css("cursor","auto"),this._removeClass("ui-resizable-resizing"),this._propagate("stop",e),this._helper&&this.helper.remove(),!1},_updatePrevProperties:function(){this.prevPosition={top:this.position.top,left:this.position.left},this.prevSize={width:this.size.width,height:this.size.height}},_applyChanges:function(){var t={};return this.position.top!==this.prevPosition.top&&(t.top=this.position.top+"px"),this.position.left!==this.prevPosition.left&&(t.left=this.position.left+"px"),this.size.width!==this.prevSize.width&&(t.width=this.size.width+"px"),this.size.height!==this.prevSize.height&&(t.height=this.size.height+"px"),this.helper.css(t),t},_updateVirtualBoundaries:function(t){var e,i,s,n,o,a=this.options;o={minWidth:this._isNumber(a.minWidth)?a.minWidth:0,maxWidth:this._isNumber(a.maxWidth)?a.maxWidth:1/0,minHeight:this._isNumber(a.minHeight)?a.minHeight:0,maxHeight:this._isNumber(a.maxHeight)?a.maxHeight:1/0},(this._aspectRatio||t)&&(e=o.minHeight*this.aspectRatio,s=o.minWidth/this.aspectRatio,i=o.maxHeight*this.aspectRatio,n=o.maxWidth/this.aspectRatio,e>o.minWidth&&(o.minWidth=e),s>o.minHeight&&(o.minHeight=s),o.maxWidth>i&&(o.maxWidth=i),o.maxHeight>n&&(o.maxHeight=n)),this._vBoundaries=o},_updateCache:function(t){this.offset=this.helper.offset(),this._isNumber(t.left)&&(this.position.left=t.left),this._isNumber(t.top)&&(this.position.top=t.top),this._isNumber(t.height)&&(this.size.height=t.height),this._isNumber(t.width)&&(this.size.width=t.width)},_updateRatio:function(t){var e=this.position,i=this.size,s=this.axis;return this._isNumber(t.height)?t.width=t.height*this.aspectRatio:this._isNumber(t.width)&&(t.height=t.width/this.aspectRatio),"sw"===s&&(t.left=e.left+(i.width-t.width),t.top=null),"nw"===s&&(t.top=e.top+(i.height-t.height),t.left=e.left+(i.width-t.width)),t},_respectSize:function(t){var e=this._vBoundaries,i=this.axis,s=this._isNumber(t.width)&&e.maxWidth&&e.maxWidth<t.width,n=this._isNumber(t.height)&&e.maxHeight&&e.maxHeight<t.height,o=this._isNumber(t.width)&&e.minWidth&&e.minWidth>t.width,a=this._isNumber(t.height)&&e.minHeight&&e.minHeight>t.height,r=this.originalPosition.left+this.originalSize.width,h=this.originalPosition.top+this.originalSize.height,l=/sw|nw|w/.test(i),c=/nw|ne|n/.test(i);return o&&(t.width=e.minWidth),a&&(t.height=e.minHeight),s&&(t.width=e.maxWidth),n&&(t.height=e.maxHeight),o&&l&&(t.left=r-e.minWidth),s&&l&&(t.left=r-e.maxWidth),a&&c&&(t.top=h-e.minHeight),n&&c&&(t.top=h-e.maxHeight),t.width||t.height||t.left||!t.top?t.width||t.height||t.top||!t.left||(t.left=null):t.top=null,t},_getPaddingPlusBorderDimensions:function(t){for(var e=0,i=[],s=[t.css("borderTopWidth"),t.css("borderRightWidth"),t.css("borderBottomWidth"),t.css("borderLeftWidth")],n=[t.css("paddingTop"),t.css("paddingRight"),t.css("paddingBottom"),t.css("paddingLeft")];4>e;e++)i[e]=parseFloat(s[e])||0,i[e]+=parseFloat(n[e])||0;return{height:i[0]+i[2],width:i[1]+i[3]}},_proportionallyResize:function(){if(this._proportionallyResizeElements.length)for(var t,e=0,i=this.helper||this.element;this._proportionallyResizeElements.length>e;e++)t=this._proportionallyResizeElements[e],this.outerDimensions||(this.outerDimensions=this._getPaddingPlusBorderDimensions(t)),t.css({height:i.height()-this.outerDimensions.height||0,width:i.width()-this.outerDimensions.width||0})},_renderProxy:function(){var e=this.element,i=this.options;this.elementOffset=e.offset(),this._helper?(this.helper=this.helper||t("<div style='overflow:hidden;'></div>"),this._addClass(this.helper,this._helper),this.helper.css({width:this.element.outerWidth(),height:this.element.outerHeight(),position:"absolute",left:this.elementOffset.left+"px",top:this.elementOffset.top+"px",zIndex:++i.zIndex}),this.helper.appendTo("body").disableSelection()):this.helper=this.element},_change:{e:function(t,e){return{width:this.originalSize.width+e}},w:function(t,e){var i=this.originalSize,s=this.originalPosition;return{left:s.left+e,width:i.width-e}},n:function(t,e,i){var s=this.originalSize,n=this.originalPosition;return{top:n.top+i,height:s.height-i}},s:function(t,e,i){return{height:this.originalSize.height+i}},se:function(e,i,s){return t.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[e,i,s]))},sw:function(e,i,s){return t.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[e,i,s]))},ne:function(e,i,s){return t.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[e,i,s]))},nw:function(e,i,s){return t.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[e,i,s]))}},_propagate:function(e,i){t.ui.plugin.call(this,e,[i,this.ui()]),"resize"!==e&&this._trigger(e,i,this.ui())},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}}),t.ui.plugin.add("resizable","animate",{stop:function(e){var i=t(this).resizable("instance"),s=i.options,n=i._proportionallyResizeElements,o=n.length&&/textarea/i.test(n[0].nodeName),a=o&&i._hasScroll(n[0],"left")?0:i.sizeDiff.height,r=o?0:i.sizeDiff.width,h={width:i.size.width-r,height:i.size.height-a},l=parseFloat(i.element.css("left"))+(i.position.left-i.originalPosition.left)||null,c=parseFloat(i.element.css("top"))+(i.position.top-i.originalPosition.top)||null;i.element.animate(t.extend(h,c&&l?{top:c,left:l}:{}),{duration:s.animateDuration,easing:s.animateEasing,step:function(){var s={width:parseFloat(i.element.css("width")),height:parseFloat(i.element.css("height")),top:parseFloat(i.element.css("top")),left:parseFloat(i.element.css("left"))};n&&n.length&&t(n[0]).css({width:s.width,height:s.height}),i._updateCache(s),i._propagate("resize",e)}})}}),t.ui.plugin.add("resizable","containment",{start:function(){var e,i,s,n,o,a,r,h=t(this).resizable("instance"),l=h.options,c=h.element,u=l.containment,d=u instanceof t?u.get(0):/parent/.test(u)?c.parent().get(0):u;d&&(h.containerElement=t(d),/document/.test(u)||u===document?(h.containerOffset={left:0,top:0},h.containerPosition={left:0,top:0},h.parentData={element:t(document),left:0,top:0,width:t(document).width(),height:t(document).height()||document.body.parentNode.scrollHeight}):(e=t(d),i=[],t(["Top","Right","Left","Bottom"]).each(function(t,s){i[t]=h._num(e.css("padding"+s))}),h.containerOffset=e.offset(),h.containerPosition=e.position(),h.containerSize={height:e.innerHeight()-i[3],width:e.innerWidth()-i[1]},s=h.containerOffset,n=h.containerSize.height,o=h.containerSize.width,a=h._hasScroll(d,"left")?d.scrollWidth:o,r=h._hasScroll(d)?d.scrollHeight:n,h.parentData={element:d,left:s.left,top:s.top,width:a,height:r}))},resize:function(e){var i,s,n,o,a=t(this).resizable("instance"),r=a.options,h=a.containerOffset,l=a.position,c=a._aspectRatio||e.shiftKey,u={top:0,left:0},d=a.containerElement,p=!0;d[0]!==document&&/static/.test(d.css("position"))&&(u=h),l.left<(a._helper?h.left:0)&&(a.size.width=a.size.width+(a._helper?a.position.left-h.left:a.position.left-u.left),c&&(a.size.height=a.size.width/a.aspectRatio,p=!1),a.position.left=r.helper?h.left:0),l.top<(a._helper?h.top:0)&&(a.size.height=a.size.height+(a._helper?a.position.top-h.top:a.position.top),c&&(a.size.width=a.size.height*a.aspectRatio,p=!1),a.position.top=a._helper?h.top:0),n=a.containerElement.get(0)===a.element.parent().get(0),o=/relative|absolute/.test(a.containerElement.css("position")),n&&o?(a.offset.left=a.parentData.left+a.position.left,a.offset.top=a.parentData.top+a.position.top):(a.offset.left=a.element.offset().left,a.offset.top=a.element.offset().top),i=Math.abs(a.sizeDiff.width+(a._helper?a.offset.left-u.left:a.offset.left-h.left)),s=Math.abs(a.sizeDiff.height+(a._helper?a.offset.top-u.top:a.offset.top-h.top)),i+a.size.width>=a.parentData.width&&(a.size.width=a.parentData.width-i,c&&(a.size.height=a.size.width/a.aspectRatio,p=!1)),s+a.size.height>=a.parentData.height&&(a.size.height=a.parentData.height-s,c&&(a.size.width=a.size.height*a.aspectRatio,p=!1)),p||(a.position.left=a.prevPosition.left,a.position.top=a.prevPosition.top,a.size.width=a.prevSize.width,a.size.height=a.prevSize.height)},stop:function(){var e=t(this).resizable("instance"),i=e.options,s=e.containerOffset,n=e.containerPosition,o=e.containerElement,a=t(e.helper),r=a.offset(),h=a.outerWidth()-e.sizeDiff.width,l=a.outerHeight()-e.sizeDiff.height;e._helper&&!i.animate&&/relative/.test(o.css("position"))&&t(this).css({left:r.left-n.left-s.left,width:h,height:l}),e._helper&&!i.animate&&/static/.test(o.css("position"))&&t(this).css({left:r.left-n.left-s.left,width:h,height:l})}}),t.ui.plugin.add("resizable","alsoResize",{start:function(){var e=t(this).resizable("instance"),i=e.options;t(i.alsoResize).each(function(){var e=t(this);e.data("ui-resizable-alsoresize",{width:parseFloat(e.width()),height:parseFloat(e.height()),left:parseFloat(e.css("left")),top:parseFloat(e.css("top"))})})},resize:function(e,i){var s=t(this).resizable("instance"),n=s.options,o=s.originalSize,a=s.originalPosition,r={height:s.size.height-o.height||0,width:s.size.width-o.width||0,top:s.position.top-a.top||0,left:s.position.left-a.left||0};t(n.alsoResize).each(function(){var e=t(this),s=t(this).data("ui-resizable-alsoresize"),n={},o=e.parents(i.originalElement[0]).length?["width","height"]:["width","height","top","left"];t.each(o,function(t,e){var i=(s[e]||0)+(r[e]||0);i&&i>=0&&(n[e]=i||null)}),e.css(n)})},stop:function(){t(this).removeData("ui-resizable-alsoresize")}}),t.ui.plugin.add("resizable","ghost",{start:function(){var e=t(this).resizable("instance"),i=e.size;e.ghost=e.originalElement.clone(),e.ghost.css({opacity:.25,display:"block",position:"relative",height:i.height,width:i.width,margin:0,left:0,top:0}),e._addClass(e.ghost,"ui-resizable-ghost"),t.uiBackCompat!==!1&&"string"==typeof e.options.ghost&&e.ghost.addClass(this.options.ghost),e.ghost.appendTo(e.helper)},resize:function(){var e=t(this).resizable("instance");e.ghost&&e.ghost.css({position:"relative",height:e.size.height,width:e.size.width})},stop:function(){var e=t(this).resizable("instance");e.ghost&&e.helper&&e.helper.get(0).removeChild(e.ghost.get(0))}}),t.ui.plugin.add("resizable","grid",{resize:function(){var e,i=t(this).resizable("instance"),s=i.options,n=i.size,o=i.originalSize,a=i.originalPosition,r=i.axis,h="number"==typeof s.grid?[s.grid,s.grid]:s.grid,l=h[0]||1,c=h[1]||1,u=Math.round((n.width-o.width)/l)*l,d=Math.round((n.height-o.height)/c)*c,p=o.width+u,f=o.height+d,g=s.maxWidth&&p>s.maxWidth,m=s.maxHeight&&f>s.maxHeight,_=s.minWidth&&s.minWidth>p,v=s.minHeight&&s.minHeight>f;s.grid=h,_&&(p+=l),v&&(f+=c),g&&(p-=l),m&&(f-=c),/^(se|s|e)$/.test(r)?(i.size.width=p,i.size.height=f):/^(ne)$/.test(r)?(i.size.width=p,i.size.height=f,i.position.top=a.top-d):/^(sw)$/.test(r)?(i.size.width=p,i.size.height=f,i.position.left=a.left-u):((0>=f-c||0>=p-l)&&(e=i._getPaddingPlusBorderDimensions(this)),f-c>0?(i.size.height=f,i.position.top=a.top-d):(f=c-e.height,i.size.height=f,i.position.top=a.top+o.height-f),p-l>0?(i.size.width=p,i.position.left=a.left-u):(p=l-e.width,i.size.width=p,i.position.left=a.left+o.width-p))}}),t.ui.resizable,t.widget("ui.dialog",{version:"1.12.1",options:{appendTo:"body",autoOpen:!0,buttons:[],classes:{"ui-dialog":"ui-corner-all","ui-dialog-titlebar":"ui-corner-all"},closeOnEscape:!0,closeText:"Close",draggable:!0,hide:null,height:"auto",maxHeight:null,maxWidth:null,minHeight:150,minWidth:150,modal:!1,position:{my:"center",at:"center",of:window,collision:"fit",using:function(e){var i=t(this).css(e).offset().top;0>i&&t(this).css("top",e.top-i)}},resizable:!0,show:null,title:null,width:300,beforeClose:null,close:null,drag:null,dragStart:null,dragStop:null,focus:null,open:null,resize:null,resizeStart:null,resizeStop:null},sizeRelatedOptions:{buttons:!0,height:!0,maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0,width:!0},resizableRelatedOptions:{maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0},_create:function(){this.originalCss={display:this.element[0].style.display,width:this.element[0].style.width,minHeight:this.element[0].style.minHeight,maxHeight:this.element[0].style.maxHeight,height:this.element[0].style.height},this.originalPosition={parent:this.element.parent(),index:this.element.parent().children().index(this.element)},this.originalTitle=this.element.attr("title"),null==this.options.title&&null!=this.originalTitle&&(this.options.title=this.originalTitle),this.options.disabled&&(this.options.disabled=!1),this._createWrapper(),this.element.show().removeAttr("title").appendTo(this.uiDialog),this._addClass("ui-dialog-content","ui-widget-content"),this._createTitlebar(),this._createButtonPane(),this.options.draggable&&t.fn.draggable&&this._makeDraggable(),this.options.resizable&&t.fn.resizable&&this._makeResizable(),this._isOpen=!1,this._trackFocus()},_init:function(){this.options.autoOpen&&this.open()},_appendTo:function(){var e=this.options.appendTo;return e&&(e.jquery||e.nodeType)?t(e):this.document.find(e||"body").eq(0)},_destroy:function(){var t,e=this.originalPosition;this._untrackInstance(),this._destroyOverlay(),this.element.removeUniqueId().css(this.originalCss).detach(),this.uiDialog.remove(),this.originalTitle&&this.element.attr("title",this.originalTitle),t=e.parent.children().eq(e.index),t.length&&t[0]!==this.element[0]?t.before(this.element):e.parent.append(this.element)},widget:function(){return this.uiDialog
vendor: 3,501 bytes, lines 24-25
24
25},disable:t.noop,enable:t.noop,close:function(e){var i=this;this._isOpen&&this._trigger("beforeClose",e)!==!1&&(this._isOpen=!1,this._focusedElement=null,this._destroyOverlay(),this._untrackInstance(),this.opener.filter(":focusable").trigger("focus").length||t.ui.safeBlur(t.ui.safeActiveElement(this.document[0])),this._hide(this.uiDialog,this.options.hide,function(){i._trigger("close",e)}))},isOpen:function(){return this._isOpen},moveToTop:function(){this._moveToTop()},_moveToTop:function(e,i){var s=!1,n=this.uiDialog.siblings(".ui-front:visible").map(function(){return+t(this).css("z-index")}).get(),o=Math.max.apply(null,n);return o>=+this.uiDialog.css("z-index")&&(this.uiDialog.css("z-index",o+1),s=!0),s&&!i&&this._trigger("focus",e),s},open:function(){var e=this;return this._isOpen?(this._moveToTop()&&this._focusTabbable(),void 0):(this._isOpen=!0,this.opener=t(t.ui.safeActiveElement(this.document[0])),this._size(),this._position(),this._createOverlay(),this._moveToTop(null,!0),this.overlay&&this.overlay.css("z-index",this.uiDialog.css("z-index")-1),this._show(this.uiDialog,this.options.show,function(){e._focusTabbable(),e._trigger("focus")}),this._makeFocusTarget(),this._trigger("open"),void 0)},_focusTabbable:function(){var t=this._focusedElement;t||(t=this.element.find("[autofocus]")),t.length||(t=this.element.find(":tabbable")),t.length||(t=this.uiDialogButtonPane.find(":tabbable")),t.length||(t=this.uiDialogTitlebarClose.filter(":tabbable")),t.length||(t=this.uiDialog),t.eq(0).trigger("focus")},_keepFocus:function(e){function i(){var e=t.ui.safeActiveElement(this.document[0]),i=this.uiDialog[0]===e||t.contains(this.uiDialog[0],e);i||this._focusTabbable()}e.preventDefault(),i.call(this),this._delay(i)},_createWrapper:function(){this.uiDialog=t("<div>").hide().attr({tabIndex:-1,role:"dialog"}).appendTo(this._appendTo()),this._addClass(this.uiDialog,"ui-dialog","ui-widget ui-widget-content ui-front"),this._on(this.uiDialog,{keydown:function(e){if(this.options.closeOnEscape&&!e.isDefaultPrevented()&&e.keyCode&&e.keyCode===t.ui.keyCode.ESCAPE)return e.preventDefault(),this.close(e),void 0;if(e.keyCode===t.ui.keyCode.TAB&&!e.isDefaultPrevented()){var i=this.uiDialog.find(":tabbable"),s=i.filter(":first"),n=i.filter(":last");e.target!==n[0]&&e.target!==this.uiDialog[0]||e.shiftKey?e.target!==s[0]&&e.target!==this.uiDialog[0]||!e.shiftKey||(this._delay(function(){n.trigger("focus")}),e.preventDefault()):(this._delay(function(){s.trigger("focus")}),e.preventDefault())}},mousedown:function(t){this._moveToTop(t)&&this._focusTabbable()}}),this.element.find("[aria-describedby]").length||this.uiDialog.attr({"aria-describedby":this.element.uniqueId().attr("id")})},_createTitlebar:function(){var e;this.uiDialogTitlebar=t("<div>"),this._addClass(this.uiDialogTitlebar,"ui-dialog-titlebar","ui-widget-header ui-helper-clearfix"),this._on(this.uiDialogTitlebar,{mousedown:function(e){t(e.target).closest(".ui-dialog-titlebar-close")||this.uiDialog.trigger("focus")}}),this.uiDialogTitlebarClose=t("<button type='button'></button>").button({label:t("<a>").text(this.options.closeText).html(),icon:"ui-icon-closethick",showLabel:!1}).appendTo(this.uiDialogTitlebar),this._addClass(this.uiDialogTitlebarClose,"ui-dialog-titlebar-close"),this._on(this.uiDialogTitlebarClose,{click:function(t){t.preventDefault(),this.close(t)}}),e=t("<span>").uniqueId().prependTo(this.uiDialogTitlebar),this._addClass(e,"ui-dialog-title"),this._title(e),this.uiDialogTitlebar.prepe
vendor: 5,900 bytes, line 25
25ndTo(this.uiDialog),this.uiDialog.attr({"aria-labelledby":e.attr("id")})},_title:function(t){this.options.title?t.text(this.options.title):t.html("&#160;")},_createButtonPane:function(){this.uiDialogButtonPane=t("<div>"),this._addClass(this.uiDialogButtonPane,"ui-dialog-buttonpane","ui-widget-content ui-helper-clearfix"),this.uiButtonSet=t("<div>").appendTo(this.uiDialogButtonPane),this._addClass(this.uiButtonSet,"ui-dialog-buttonset"),this._createButtons()},_createButtons:function(){var e=this,i=this.options.buttons;return this.uiDialogButtonPane.remove(),this.uiButtonSet.empty(),t.isEmptyObject(i)||t.isArray(i)&&!i.length?(this._removeClass(this.uiDialog,"ui-dialog-buttons"),void 0):(t.each(i,function(i,s){var n,o;s=t.isFunction(s)?{click:s,text:i}:s,s=t.extend({type:"button"},s),n=s.click,o={icon:s.icon,iconPosition:s.iconPosition,showLabel:s.showLabel,icons:s.icons,text:s.text},delete s.click,delete s.icon,delete s.iconPosition,delete s.showLabel,delete s.icons,"boolean"==typeof s.text&&delete s.text,t("<button></button>",s).button(o).appendTo(e.uiButtonSet).on("click",function(){n.apply(e.element[0],arguments)})}),this._addClass(this.uiDialog,"ui-dialog-buttons"),this.uiDialogButtonPane.appendTo(this.uiDialog),void 0)},_makeDraggable:function(){function e(t){return{position:t.position,offset:t.offset}}var i=this,s=this.options;this.uiDialog.draggable({cancel:".ui-dialog-content, .ui-dialog-titlebar-close",handle:".ui-dialog-titlebar",containment:"document",start:function(s,n){i._addClass(t(this),"ui-dialog-dragging"),i._blockFrames(),i._trigger("dragStart",s,e(n))},drag:function(t,s){i._trigger("drag",t,e(s))},stop:function(n,o){var a=o.offset.left-i.document.scrollLeft(),r=o.offset.top-i.document.scrollTop();s.position={my:"left top",at:"left"+(a>=0?"+":"")+a+" "+"top"+(r>=0?"+":"")+r,of:i.window},i._removeClass(t(this),"ui-dialog-dragging"),i._unblockFrames(),i._trigger("dragStop",n,e(o))}})},_makeResizable:function(){function e(t){return{originalPosition:t.originalPosition,originalSize:t.originalSize,position:t.position,size:t.size}}var i=this,s=this.options,n=s.resizable,o=this.uiDialog.css("position"),a="string"==typeof n?n:"n,e,s,w,se,sw,ne,nw";this.uiDialog.resizable({cancel:".ui-dialog-content",containment:"document",alsoResize:this.element,maxWidth:s.maxWidth,maxHeight:s.maxHeight,minWidth:s.minWidth,minHeight:this._minHeight(),handles:a,start:function(s,n){i._addClass(t(this),"ui-dialog-resizing"),i._blockFrames(),i._trigger("resizeStart",s,e(n))},resize:function(t,s){i._trigger("resize",t,e(s))},stop:function(n,o){var a=i.uiDialog.offset(),r=a.left-i.document.scrollLeft(),h=a.top-i.document.scrollTop();s.height=i.uiDialog.height(),s.width=i.uiDialog.width(),s.position={my:"left top",at:"left"+(r>=0?"+":"")+r+" "+"top"+(h>=0?"+":"")+h,of:i.window},i._removeClass(t(this),"ui-dialog-resizing"),i._unblockFrames(),i._trigger("resizeStop",n,e(o))}}).css("position",o)},_trackFocus:function(){this._on(this.widget(),{focusin:function(e){this._makeFocusTarget(),this._focusedElement=t(e.target)}})},_makeFocusTarget:function(){this._untrackInstance(),this._trackingInstances().unshift(this)},_untrackInstance:function(){var e=this._trackingInstances(),i=t.inArray(this,e);-1!==i&&e.splice(i,1)},_trackingInstances:function(){var t=this.document.data("ui-dialog-instances");return t||(t=[],this.document.data("ui-dialog-instances",t)),t},_minHeight:function(){var t=this.options;return"auto"===t.height?t.minHeight:Math.min(t.minHeight,t.height)},_position:function(){var t=this.uiDialog.is(":visible");t||this.uiDialog.show(),this.uiDialog.position(this.options.position),t||this.uiDialog.hide()},_setOptions:function(e){var i=this,s=!1,n={};t.each(e,function(t,e){i._setOption(t,e),t in i.sizeRelatedOptions&&(s=!0),t in i.resizableRelatedOptions&&(n[t]=e)}),s&&(this._size(),this._position()),this.uiDialog.is(":data(ui-resizable)")&&this.uiDialog.resizable("option",n)},_setOption:function(e,i){var s,n,o=this.uiDialog;"disabled"!==e&&(this._super(e,i),"appendTo"===e&&this.uiDialog.appendTo(this._appendTo()),"buttons"===e&&this._createButtons(),"closeText"===e&&this.uiDialogTitlebarClose.button({label:t("<a>").text(""+this.options.closeText).html()}),"draggable"===e&&(s=o.is(":data(ui-draggable)"),s&&!i&&o.draggable("destroy"),!s&&i&&this._makeDraggable()),"position"===e&&this._position(),"resizable"===e&&(n=o.is(":data(ui-resizable)"),n&&!i&&o.resizable("destroy"),n&&"string"==typeof i&&o.resizable("option","handles",i),n||i===!1||this._makeResizable()),"title"===e&&this._title(this.uiDialogTitlebar.find(".ui-dialog-title")))},_size:function(){var t,e,i,s=this.options;this.element.show().css({width:"auto",minHeight:0,maxHeight:"none",height:0}),s.minWidth>s.width&&(s.width=s.minWidth),t=this.uiDialog.css({height:"auto",width:s.width}).outerHeight(),e=Math.max(0,s.minHeight-t),i="number"==typeof s.maxHeight?Math.max(0,s.maxHeight-t):"none","auto"===s.height?this.element.css({minHeight:e,maxHeight:i,height:"auto"}):this.element.height(Math.max(0,s.height-t)),this.uiDialog.is(":data(ui-resizable)")&&this.uiDialog.resizable("option","minHeight",this._minHeight())},_blockFrames:function(){this.iframeBlocks=this.document.find("iframe").map(function(){var e=t(this);return t("<div>").css({position:"absolute",width:e.outerWidth(),height:e.outerHeight()}).appendTo(e.parent()).offset(e.offset())[0]})},_unblockFrames:function(){this.iframeBlocks&&(this.iframeBlocks.remove(),delete this.iframeBlocks)},_allowInteraction:function(e){return t(e.target).closest(".ui-dialog").length?!0:!!t(e.target).closest(".ui-datepicker").length},_createOverlay:function(){if(this.options.modal){var e=!0;this._delay(function(){e=!1}),this.document.data("ui-dialog-overlays")||this._on(this.document,{focusin:function(t){var ti;e||this._allowInteraction(t)||(t.preventDefault(),ti = this._trackingInstances(),(ti||ti[0]._focusTabbable()
vendor: 23,240 bytes, line 25
25))}}),this.overlay=t("<div>").appendTo(this._appendTo()),this._addClass(this.overlay,null,"ui-widget-overlay ui-front"),this._on(this.overlay,{mousedown:"_keepFocus"}),this.document.data("ui-dialog-overlays",(this.document.data("ui-dialog-overlays")||0)+1)}},_destroyOverlay:function(){if(this.options.modal&&this.overlay){var t=this.document.data("ui-dialog-overlays")-1;t?this.document.data("ui-dialog-overlays",t):(this._off(this.document,"focusin"),this.document.removeData("ui-dialog-overlays")),this.overlay.remove(),this.overlay=null}}}),t.uiBackCompat!==!1&&t.widget("ui.dialog",t.ui.dialog,{options:{dialogClass:""},_createWrapper:function(){this._super(),this.uiDialog.addClass(this.options.dialogClass)},_setOption:function(t,e){"dialogClass"===t&&this.uiDialog.removeClass(this.options.dialogClass).addClass(e),this._superApply(arguments)}}),t.ui.dialog,t.widget("ui.droppable",{version:"1.12.1",widgetEventPrefix:"drop",options:{accept:"*",addClasses:!0,greedy:!1,scope:"default",tolerance:"intersect",activate:null,deactivate:null,drop:null,out:null,over:null},_create:function(){var e,i=this.options,s=i.accept;this.isover=!1,this.isout=!0,this.accept=t.isFunction(s)?s:function(t){return t.is(s)},this.proportions=function(){return arguments.length?(e=arguments[0],void 0):e?e:e={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight}},this._addToManager(i.scope),i.addClasses&&this._addClass("ui-droppable")},_addToManager:function(e){t.ui.ddmanager.droppables[e]=t.ui.ddmanager.droppables[e]||[],t.ui.ddmanager.droppables[e].push(this)},_splice:function(t){for(var e=0;t.length>e;e++)t[e]===this&&t.splice(e,1)},_destroy:function(){var e=t.ui.ddmanager.droppables[this.options.scope];this._splice(e)},_setOption:function(e,i){if("accept"===e)this.accept=t.isFunction(i)?i:function(t){return t.is(i)};else if("scope"===e){var s=t.ui.ddmanager.droppables[this.options.scope];this._splice(s),this._addToManager(i)}this._super(e,i)},_activate:function(e){var i=t.ui.ddmanager.current;this._addActiveClass(),i&&this._trigger("activate",e,this.ui(i))},_deactivate:function(e){var i=t.ui.ddmanager.current;this._removeActiveClass(),i&&this._trigger("deactivate",e,this.ui(i))},_over:function(e){var i=t.ui.ddmanager.current;i&&(i.currentItem||i.element)[0]!==this.element[0]&&this.accept.call(this.element[0],i.currentItem||i.element)&&(this._addHoverClass(),this._trigger("over",e,this.ui(i)))},_out:function(e){var i=t.ui.ddmanager.current;i&&(i.currentItem||i.element)[0]!==this.element[0]&&this.accept.call(this.element[0],i.currentItem||i.element)&&(this._removeHoverClass(),this._trigger("out",e,this.ui(i)))},_drop:function(e,i){var s=i||t.ui.ddmanager.current,n=!1;return s&&(s.currentItem||s.element)[0]!==this.element[0]?(this.element.find(":data(ui-droppable)").not(".ui-draggable-dragging").each(function(){var i=t(this).droppable("instance");return i.options.greedy&&!i.options.disabled&&i.options.scope===s.options.scope&&i.accept.call(i.element[0],s.currentItem||s.element)&&v(s,t.extend(i,{offset:i.element.offset()}),i.options.tolerance,e)?(n=!0,!1):void 0}),n?!1:this.accept.call(this.element[0],s.currentItem||s.element)?(this._removeActiveClass(),this._removeHoverClass(),this._trigger("drop",e,this.ui(s)),this.element):!1):!1},ui:function(t){return{draggable:t.currentItem||t.element,helper:t.helper,position:t.position,offset:t.positionAbs}},_addHoverClass:function(){this._addClass("ui-droppable-hover")},_removeHoverClass:function(){this._removeClass("ui-droppable-hover")},_addActiveClass:function(){this._addClass("ui-droppable-active")},_removeActiveClass:function(){this._removeClass("ui-droppable-active")}});var v=t.ui.intersect=function(){function t(t,e,i){return t>=e&&e+i>t}return function(e,i,s,n){if(!i.offset)return!1;var o=(e.positionAbs||e.position.absolute).left+e.margins.left,a=(e.positionAbs||e.position.absolute).top+e.margins.top,r=o+e.helperProportions.width,h=a+e.helperProportions.height,l=i.offset.left,c=i.offset.top,u=l+i.proportions().width,d=c+i.proportions().height;switch(s){case"fit":return o>=l&&u>=r&&a>=c&&d>=h;case"intersect":return o+e.helperProportions.width/2>l&&u>r-e.helperProportions.width/2&&a+e.helperProportions.height/2>c&&d>h-e.helperProportions.height/2;case"pointer":return t(n.pageY,c,i.proportions().height)&&t(n.pageX,l,i.proportions().width);case"touch":return(a>=c&&d>=a||h>=c&&d>=h||c>a&&h>d)&&(o>=l&&u>=o||r>=l&&u>=r||l>o&&r>u);default:return!1}}}();t.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(e,i){var s,n,o=t.ui.ddmanager.droppables[e.options.scope]||[],a=i?i.type:null,r=(e.currentItem||e.element).find(":data(ui-droppable)").addBack();t:for(s=0;o.length>s;s++)if(!(o[s].options.disabled||e&&!o[s].accept.call(o[s].element[0],e.currentItem||e.element))){for(n=0;r.length>n;n++)if(r[n]===o[s].element[0]){o[s].proportions().height=0;continue t}o[s].visible="none"!==o[s].element.css("display"),o[s].visible&&("mousedown"===a&&o[s]._activate.call(o[s],i),o[s].offset=o[s].element.offset(),o[s].proportions({width:o[s].element[0].offsetWidth,height:o[s].element[0].offsetHeight}))}},drop:function(e,i){var s=!1;return t.each((t.ui.ddmanager.droppables[e.options.scope]||[]).slice(),function(){this.options&&(!this.options.disabled&&this.visible&&v(e,this,this.options.tolerance,i)&&(s=this._drop.call(this,i)||s),!this.options.disabled&&this.visible&&this.accept.call(this.element[0],e.currentItem||e.element)&&(this.isout=!0,this.isover=!1,this._deactivate.call(this,i)))}),s},dragStart:function(e,i){e.element.parentsUntil("body").on("scroll.droppable",function(){e.options.refreshPositions||t.ui.ddmanager.prepareOffsets(e,i)})},drag:function(e,i){e.options.refreshPositions&&t.ui.ddmanager.prepareOffsets(e,i),t.each(t.ui.ddmanager.droppables[e.options.scope]||[],function(){if(!this.options.disabled&&!this.greedyChild&&this.visible){var s,n,o,a=v(e,this,this.options.tolerance,i),r=!a&&this.isover?"isout":a&&!this.isover?"isover":null;r&&(this.options.greedy&&(n=this.options.scope,o=this.element.parents(":data(ui-droppable)").filter(function(){return t(this).droppable("instance").options.scope===n}),o.length&&(s=t(o[0]).droppable("instance"),s.greedyChild="isover"===r)),s&&"isover"===r&&(s.isover=!1,s.isout=!0,s._out.call(s,i)),this[r]=!0,this["isout"===r?"isover":"isout"]=!1,this["isover"===r?"_over":"_out"].call(this,i),s&&"isout"===r&&(s.isout=!1,s.isover=!0,s._over.call(s,i)))}})},dragStop:function(e,i){e.element.parentsUntil("body").off("scroll.droppable"),e.options.refreshPositions||t.ui.ddmanager.prepareOffsets(e,i)}},t.uiBackCompat!==!1&&t.widget("ui.droppable",t.ui.droppable,{options:{hoverClass:!1,activeClass:!1},_addActiveClass:function(){this._super(),this.options.activeClass&&this.element.addClass(this.options.activeClass)},_removeActiveClass:function(){this._super(),this.options.activeClass&&this.element.removeClass(this.options.activeClass)},_addHoverClass:function(){this._super(),this.options.hoverClass&&this.element.addClass(this.options.hoverClass)},_removeHoverClass:function(){this._super(),this.options.hoverClass&&this.element.removeClass(this.options.hoverClass)}}),t.ui.droppable,t.widget("ui.progressbar",{version:"1.12.1",options:{classes:{"ui-progressbar":"ui-corner-all","ui-progressbar-value":"ui-corner-left","ui-progressbar-complete":"ui-corner-right"},max:100,value:0,change:null,complete:null},min:0,_create:function(){this.oldValue=this.options.value=this._constrainedValue(),this.element.attr({role:"progressbar","aria-valuemin":this.min}),this._addClass("ui-progressbar","ui-widget ui-widget-content"),this.valueDiv=t("<div>").appendTo(this.element),this._addClass(this.valueDiv,"ui-progressbar-value","ui-widget-header"),this._refreshValue()},_destroy:function(){this.element.removeAttr("role aria-valuemin aria-valuemax aria-valuenow"),this.valueDiv.remove()},value:function(t){return void 0===t?this.options.value:(this.options.value=this._constrainedValue(t),this._refreshValue(),void 0)},_constrainedValue:function(t){return void 0===t&&(t=this.options.value),this.indeterminate=t===!1,"number"!=typeof t&&(t=0),this.indeterminate?!1:Math.min(this.options.max,Math.max(this.min,t))},_setOptions:function(t){var e=t.value;delete t.value,this._super(t),this.options.value=this._constrainedValue(e),this._refreshValue()},_setOption:function(t,e){"max"===t&&(e=Math.max(this.min,e)),this._super(t,e)},_setOptionDisabled:function(t){this._super(t),this.element.attr("aria-disabled",t),this._toggleClass(null,"ui-state-disabled",!!t)},_percentage:function(){return this.indeterminate?100:100*(this.options.value-this.min)/(this.options.max-this.min)},_refreshValue:function(){var e=this.options.value,i=this._percentage();this.valueDiv.toggle(this.indeterminate||e>this.min).width(i.toFixed(0)+"%"),this._toggleClass(this.valueDiv,"ui-progressbar-complete",null,e===this.options.max)._toggleClass("ui-progressbar-indeterminate",null,this.indeterminate),this.indeterminate?(this.element.removeAttr("aria-valuenow"),this.overlayDiv||(this.overlayDiv=t("<div>").appendTo(this.valueDiv),this._addClass(this.overlayDiv,"ui-progressbar-overlay"))):(this.element.attr({"aria-valuemax":this.options.max,"aria-valuenow":e}),this.overlayDiv&&(this.overlayDiv.remove(),this.overlayDiv=null)),this.oldValue!==e&&(this.oldValue=e,this._trigger("change")),e===this.options.max&&this._trigger("complete")}}),t.widget("ui.selectable",t.ui.mouse,{version:"1.12.1",options:{appendTo:"body",autoRefresh:!0,distance:0,filter:"*",tolerance:"touch",selected:null,selecting:null,start:null,stop:null,unselected:null,unselecting:null},_create:function(){var e=this;this._addClass("ui-selectable"),this.dragged=!1,this.refresh=function(){e.elementPos=t(e.element[0]).offset(),e.selectees=t(e.options.filter,e.element[0]),e._addClass(e.selectees,"ui-selectee"),e.selectees.each(function(){var i=t(this),s=i.offset(),n={left:s.left-e.elementPos.left,top:s.top-e.elementPos.top};t.data(this,"selectable-item",{element:this,$element:i,left:n.left,top:n.top,right:n.left+i.outerWidth(),bottom:n.top+i.outerHeight(),startselected:!1,selected:i.hasClass("ui-selected"),selecting:i.hasClass("ui-selecting"),unselecting:i.hasClass("ui-unselecting")})})},this.refresh(),this._mouseInit(),this.helper=t("<div>"),this._addClass(this.helper,"ui-selectable-helper")},_destroy:function(){this.selectees.removeData("selectable-item"),this._mouseDestroy()},_mouseStart:function(e){var i=this,s=this.options;this.opos=[e.pageX,e.pageY],this.elementPos=t(this.element[0]).offset(),this.options.disabled||(this.selectees=t(s.filter,this.element[0]),this._trigger("start",e),t(s.appendTo).append(this.helper),this.helper.css({left:e.pageX,top:e.pageY,width:0,height:0}),s.autoRefresh&&this.refresh(),this.selectees.filter(".ui-selected").each(function(){var s=t.data(this,"selectable-item");s.startselected=!0,e.metaKey||e.ctrlKey||(i._removeClass(s.$element,"ui-selected"),s.selected=!1,i._addClass(s.$element,"ui-unselecting"),s.unselecting=!0,i._trigger("unselecting",e,{unselecting:s.element}))}),t(e.target).parents().addBack().each(function(){var s,n=t.data(this,"selectable-item");return n?(s=!e.metaKey&&!e.ctrlKey||!n.$element.hasClass("ui-selected"),i._removeClass(n.$element,s?"ui-unselecting":"ui-selected")._addClass(n.$element,s?"ui-selecting":"ui-unselecting"),n.unselecting=!s,n.selecting=s,n.selected=s,s?i._trigger("selecting",e,{selecting:n.element}):i._trigger("unselecting",e,{unselecting:n.element}),!1):void 0}))},_mouseDrag:function(e){if(this.dragged=!0,!this.options.disabled){var i,s=this,n=this.options,o=this.opos[0],a=this.opos[1],r=e.pageX,h=e.pageY;return o>r&&(i=r,r=o,o=i),a>h&&(i=h,h=a,a=i),this.helper.css({left:o,top:a,width:r-o,height:h-a}),this.selectees.each(function(){var i=t.data(this,"selectable-item"),l=!1,c={};i&&i.element!==s.element[0]&&(c.left=i.left+s.elementPos.left,c.right=i.right+s.elementPos.left,c.top=i.top+s.elementPos.top,c.bottom=i.bottom+s.elementPos.top,"touch"===n.tolerance?l=!(c.left>r||o>c.right||c.top>h||a>c.bottom):"fit"===n.tolerance&&(l=c.left>o&&r>c.right&&c.top>a&&h>c.bottom),l?(i.selected&&(s._removeClass(i.$element,"ui-selected"),i.selected=!1),i.unselecting&&(s._removeClass(i.$element,"ui-unselecting"),i.unselecting=!1),i.selecting||(s._addClass(i.$element,"ui-selecting"),i.selecting=!0,s._trigger("selecting",e,{selecting:i.element}))):(i.selecting&&((e.metaKey||e.ctrlKey)&&i.startselected?(s._removeClass(i.$element,"ui-selecting"),i.selecting=!1,s._addClass(i.$element,"ui-selected"),i.selected=!0):(s._removeClass(i.$element,"ui-selecting"),i.selecting=!1,i.startselected&&(s._addClass(i.$element,"ui-unselecting"),i.unselecting=!0),s._trigger("unselecting",e,{unselecting:i.element}))),i.selected&&(e.metaKey||e.ctrlKey||i.startselected||(s._removeClass(i.$element,"ui-selected"),i.selected=!1,s._addClass(i.$element,"ui-unselecting"),i.unselecting=!0,s._trigger("unselecting",e,{unselecting:i.element})))))}),!1}},_mouseStop:function(e){var i=this;return this.dragged=!1,t(".ui-unselecting",this.element[0]).each(function(){var s=t.data(this,"selectable-item");i._removeClass(s.$element,"ui-unselecting"),s.unselecting=!1,s.startselected=!1,i._trigger("unselected",e,{unselected:s.element})}),t(".ui-selecting",this.element[0]).each(function(){var s=t.data(this,"selectable-item");i._removeClass(s.$element,"ui-selecting")._addClass(s.$element,"ui-selected"),s.selecting=!1,s.selected=!0,s.startselected=!0,i._trigger("selected",e,{selected:s.element})}),this._trigger("stop",e),this.helper.remove(),!1}}),t.widget("ui.selectmenu",[t.ui.formResetMixin,{version:"1.12.1",defaultElement:"<select>",options:{appendTo:null,classes:{"ui-selectmenu-button-open":"ui-corner-top","ui-selectmenu-button-closed":"ui-corner-all"},disabled:null,icons:{button:"ui-icon-triangle-1-s"},position:{my:"left top",at:"left bottom",collision:"none"},width:!1,change:null,close:null,focus:null,open:null,select:null},_create:function(){var e=this.element.uniqueId().attr("id");this.ids={element:e,button:e+"-button",menu:e+"-menu"},this._drawButton(),this._drawMenu(),this._bindFormResetHandler(),this._rendered=!1,this.menuItems=t()},_drawButton:function(){var e,i=this,s=this._parseOption(this.element.find("option:selected"),this.element[0].selectedIndex);this.labels=this.element.labels().attr("for",this.ids.button),this._on(this.labels,{click:function(t){this.button.focus(),t.preventDefault()}}),this.element.hide(),this.button=t("<span>",{tabindex:this.options.disabled?-1:0,id:this.ids.button,role:"combobox","aria-expanded":"false","aria-autocomplete":"list","aria-owns":this.ids.menu,"aria-haspopup":"true",title:this.element.attr("title")}).insertAfter(this.element),this._addClass(this.button,"ui-selectmenu-button ui-selectmenu-button-closed","ui-button ui-widget"),e=t("<span>").appendTo(this.button),this._addClass(e,"ui-selectmenu-icon","ui-icon "+this.options.icons.button),this.buttonItem=this._renderButtonItem(s).appendTo(this.button),this.options.width!==!1&&this._resizeButton(),this._on(this.button,this._buttonEvents),this.button.one("focusin",function(){i._rendered||i._refreshMenu()})},_drawMenu:function(){var e=this;this.menu=t("<ul>",{"aria-hidden":"true","aria-labelledby":this.ids.button,id:this.ids.menu}),this.menuWrap=t("<div>").append(this.menu),this._addClass(this.menuWrap,"ui-selectmenu-menu","ui-front"),this.menuWrap.appendTo(this._appendTo()),this.menuInstance=this.menu.menu({classes:{"ui-menu":"ui-corner-bottom"},role:"listbox",select:function(t,i){t.preventDefault(),e._setSelection(),e._select(i.item.data("ui-selectmenu-item"),t)},focus:function(t,i){var s=i.item.data("ui-selectmenu-item");null!=e.focusIndex&&s.index!==e.focusIndex&&(e._trigger("focus",t,{item:s}),e.isOpen||e._select(s,t)),e.focusIndex=s.index,e.button.attr("aria-activedescendant",e.menuItems.eq(s.index).attr("id"))}}).menu("instance"),this.menuInstance._off(this.menu,"mouseleave"),this.menuInstance._closeOnDocumentClick=function(){return!1},this.menuInstance._isDivider=function(){return!1}},refresh:function(){this._refreshMenu(),this.buttonItem.replaceWith(this.buttonItem=this._renderButtonItem(this._getSelectedItem().data("ui-selectmenu-item")||{})),null===this.options.width&&this._resizeButton()},_refreshMenu:function(){var t,e=this.element.find("option");this.menu.empty(),this._parseOptions(e),this._renderMenu(this.menu,this.items),this.menuInstance.refresh(),this.menuItems=this.menu.find("li").not(".ui-selectmenu-optgroup").find(".ui-menu-item-wrapper"),this._rendered=!0,e.length&&(t=this._getSelectedItem(),this.menuInstance.focus(null,t),this._setAria(t.data("ui-selectmenu-item")),this._setOption("disabled",this.element.prop("disabled")))},open:function(t){this.options.disabled||(this._rendered?(this._removeClass(this.menu.find(".ui-state-active"),null,"ui-state-active"),this.menuInstance.focus(null,this._getSelectedItem())):this._refreshMenu(),this.menuItems.length&&(this.isOpen=!0,this._toggleAttr(),this._resizeMenu(),this._position(),this._on(this.document,this._documentClick),this._trigger("open",t)))},_position:function(){this.menuWrap.position(t.extend({of:this.button},this.options.position))},close:function(t){this.isOpen&&(this.isOpen=!1,this._toggleAttr(),this.range=null,this._off(this.document),this._trigger("close",t))},widget:function(){return this.button},menuWidget:function(){return this.menu},_renderButtonItem:function(e){var i=t("<span>");return this._setText(i,e.label),this._addClass(i,"ui-selectmenu-text"),i},_renderMenu:function(e,i){var s=this,n="";t.each(i,function(i,o){var a;o.optgroup!==n&&(a=t("<li>",{text:o.optgroup}),s._addClass(a,"ui-selectmenu-optgroup","ui-menu-divider"+(o.element.parent("optgroup").prop("disabled")?" ui-state-disabled":"")),a.appendTo(e),n=o.optgroup),s._renderItemData(e,o)})},_renderItemData:function(t,e){return this._renderItem(t,e).data("ui-selectmenu-item",e)},_renderItem:function(e,i){var s=t("<li>"),n=t("<div>",{title:i.element.attr("title")});return i.disabled&&this._addClass(s,null,"ui-state-disabled"),this._setText(n,i.label),s.append(n).appendTo(e)},_setText:function(t,e){e?t.text(e):t.html("&#160;")},_move:function(t,e){var i,s,n=".ui-menu-item";this.isOpen?i=this.menuItems.eq(this.focusIndex).parent("li"):(i=this.menuItems.eq(this.element[0].selectedIndex).parent("li"),n+=":not(.ui-state-disabled)"),s="first"===t||"last"===t?i["first"===t?"prevAll":"nextAll"](n).eq(-1):i[t+"All"](n).eq(0),s.length&&this.menuInstance.focus(e,s)},_getSelectedItem:function(){return this.menuItems.eq(this.element[0].selectedIndex).parent("li")},_toggle:function(t){this[this.isOpen?"close":"open"](t)},_setSelection:function(){var t;this.range&&(window.getSelection?(t=window.getSelection(),t.removeAllRanges(),t.addRange(this.range)):this.range.select(),this.button.focus())},_documentClick:{mousedown:function(e){this.isOpen&&(t(e.target).closest(".ui-selectmenu-menu, #"+t.ui.escapeSelector(this.ids.button)).length||this.close(e))}},_buttonEvents:{mousedown:function(){var t;window.getSelection?(t=window.getSelection(),t.rangeCount&&(this.range=t.getRangeAt(0))):this.range=document.selection.createRange()},click:function(t){this._setSelection(),this._toggle(t)},keydown:function(e){var i=!0;switch(e.keyCode){case t.ui.keyCode.TAB:case t.ui.keyCode.ESCAPE:this.close(e),i=!1;break;case t.ui.keyCode.ENTER:this.isOpen&&this._selectFocusedItem(e);break;case t.ui.keyCode.UP:e.altKey?this._toggle(e):this._move("prev",e);break;case t.ui.keyCode.DOWN:e.altKey?this._toggle(e):this._move("next",e);break;case t.ui.keyCode.SPACE:this.isOpen?this._selectFocusedItem(e):this._toggle(e);break;case t.ui.keyCode.LEFT:this._move("prev",e);break;case t.ui.keyCode.RIGHT:this._move("next",e);break;case t.ui.keyCode.HOME:case t.ui.keyCode.PAGE_UP:this._move("first",e);break;case t.ui.keyCode.END:case t.ui.keyCode.PAGE_DOWN:this._move("last",e);break;default:this.menu.trigger(e),i=!1}i&&e.preventDefault()}},_selectFocusedItem:function(t){var e=this.menuItems.eq(this.focusIndex).parent("li");e.hasClass("ui-state-disabled")||this._select(e.data("ui-selectmenu-item"),t)},_select:function(t,e){var i=this.element[0].selectedIndex;this.element[0].selectedIndex=t.index,this.buttonItem.replaceWith(this.buttonItem=this._renderButtonItem(t)),this._setAria(t),this._trigger("select",e,{item:t}),t.index!==i&&this._trigger("change",e,{item:t}),this.close(e)},_setAria:function(t){var e=this.menuItems.eq(t.index).attr("id");this.button.attr({"aria-labelledby":e,"aria-activedescendant":e}),this.menu.attr("aria-activedescendant",e)},_setOption:function(t,e){if("icons"===t){var i=this.button.find("span.ui-icon");this._removeClass(i,null,this.options.icons.button)._addClass(i,null,e.button)}this._super(t,e),"appendTo"===t&&this.menuWrap.appendTo(this._appendTo()),"width"===t&&this._resizeButton()},_setOptionDisabled:function(t){this._super(t),this.menuInstance.option("disabled",t),this.button.attr("aria-disabled",t),this._toggleClass(this.button,null,"ui-state-disabled",t),this.element.prop("disabled",t),t?(this.button.attr("tabindex",-1),this.close()):this.button.attr("tabindex",0)},_appendTo:function(){var e=this.options.appendTo;return e&&(e=e.jquery||e.nodeType?t(e):this.document.find(e).eq(0)),e&&e[0]||(e=this.element.closest(".ui-front, dialog")),e.length||(e=this.document[0].body),e},_toggleAttr:function(){this.button.attr("aria-expanded",this.isOpen),this._removeClass(this.button,"ui-selectmenu-button-"+(this.isOpen?"closed":"open"))._addClass(this.button,"ui-selectmenu-button-"+(this.isOpen?"open":"closed"))._toggleClass(this.menuWrap,"ui-selectmenu-open",null,this.isOpen),this.menu.attr("aria-hidden",!this.isOpen)},_resizeButton:function(){var t=this.options.width;return t===!1?(this.button.css("width",""),void 0):(null===t&&(t=this.element.show().outerWidth(),this.element.hide()),this.button.outerWidth(t),void 0)},_resizeMenu:function(){this.menu.outerWidth(Math.max(this.button.outerWidth(),this.menu.width("").outerWidth()+1))},_getCreateOptions:function(){var t=this._super();return t.disabled=this.element.prop("disabled"),t},_parseOptions:function(e){var i=this,s=[];e.each(function(e,n){s.push(i._parseOption(t(n),e))}),this.items=s},_parseOption:function(t,e){var i=t.parent("optgroup");return{element:t,index:e,value:t.val(),label:t.text(),optgroup:i.attr("label")||"",disabled:i.prop("disabled")||t.prop("disabled")}},_destroy:function(){this._unbindFormResetHandler(),this.menuWrap.remove(),this.button.remove(),this.element.show(),this.element.removeUniqueId(),this.labels.attr("for",this.ids.element)}}]),t.widget("ui.slider",t.ui.mouse,{version:"1.12.1",widgetEventPrefix:"slide",options:{animate:!1,classes:{"ui-slider":"ui-corner-all","ui-slider-handle":"ui-corner-all","ui-slider-range":"ui-corner-all ui-widget-header"},distance:0,max:100,min:0,orientation:"horizontal",range:!1,step:1,value:0,values:null,change:null,slide:null,start:null,stop:null},numPages:5,_create:function(){this._keySliding=!1,this._mouseSliding=!1,this._animateOff=!0,this._handleIndex=null,this._detectOrientation(),this._mouseInit(),this._calculateNewMax(),this._addClass("ui-slider ui-slider-"+this.orientation,"ui-widget ui-widget-content"),this._refresh(),this._animateOff=!1
25�
vendor: 32,006 bytes, lines 25-26
25
26},_refresh:function(){this._createRange(),this._createHandles(),this._setupEvents(),this._refreshValue()},_createHandles:function(){var e,i,s=this.options,n=this.element.find(".ui-slider-handle"),o="<span tabindex='0'></span>",a=[];for(i=s.values&&s.values.length||1,n.length>i&&(n.slice(i).remove(),n=n.slice(0,i)),e=n.length;i>e;e++)a.push(o);this.handles=n.add(t(a.join("")).appendTo(this.element)),this._addClass(this.handles,"ui-slider-handle","ui-state-default"),this.handle=this.handles.eq(0),this.handles.each(function(e){t(this).data("ui-slider-handle-index",e).attr("tabIndex",0)})},_createRange:function(){var e=this.options;e.range?(e.range===!0&&(e.values?e.values.length&&2!==e.values.length?e.values=[e.values[0],e.values[0]]:t.isArray(e.values)&&(e.values=e.values.slice(0)):e.values=[this._valueMin(),this._valueMin()]),this.range&&this.range.length?(this._removeClass(this.range,"ui-slider-range-min ui-slider-range-max"),this.range.css({left:"",bottom:""})):(this.range=t("<div>").appendTo(this.element),this._addClass(this.range,"ui-slider-range")),("min"===e.range||"max"===e.range)&&this._addClass(this.range,"ui-slider-range-"+e.range)):(this.range&&this.range.remove(),this.range=null)},_setupEvents:function(){this._off(this.handles),this._on(this.handles,this._handleEvents),this._hoverable(this.handles),this._focusable(this.handles)},_destroy:function(){this.handles.remove(),this.range&&this.range.remove(),this._mouseDestroy()},_mouseCapture:function(e){var i,s,n,o,a,r,h,l,c=this,u=this.options;return u.disabled?!1:(this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()},this.elementOffset=this.element.offset(),i={x:e.pageX,y:e.pageY},s=this._normValueFromMouse(i),n=this._valueMax()-this._valueMin()+1,this.handles.each(function(e){var i=Math.abs(s-c.values(e));(n>i||n===i&&(e===c._lastChangedValue||c.values(e)===u.min))&&(n=i,o=t(this),a=e)}),r=this._start(e,a),r===!1?!1:(this._mouseSliding=!0,this._handleIndex=a,this._addClass(o,null,"ui-state-active"),o.trigger("focus"),h=o.offset(),l=!t(e.target).parents().addBack().is(".ui-slider-handle"),this._clickOffset=l?{left:0,top:0}:{left:e.pageX-h.left-o.width()/2,top:e.pageY-h.top-o.height()/2-(parseInt(o.css("borderTopWidth"),10)||0)-(parseInt(o.css("borderBottomWidth"),10)||0)+(parseInt(o.css("marginTop"),10)||0)},this.handles.hasClass("ui-state-hover")||this._slide(e,a,s),this._animateOff=!0,!0))},_mouseStart:function(){return!0},_mouseDrag:function(t){var e={x:t.pageX,y:t.pageY},i=this._normValueFromMouse(e);return this._slide(t,this._handleIndex,i),!1},_mouseStop:function(t){return this._removeClass(this.handles,null,"ui-state-active"),this._mouseSliding=!1,this._stop(t,this._handleIndex),this._change(t,this._handleIndex),this._handleIndex=null,this._clickOffset=null,this._animateOff=!1,!1},_detectOrientation:function(){this.orientation="vertical"===this.options.orientation?"vertical":"horizontal"},_normValueFromMouse:function(t){var e,i,s,n,o;return"horizontal"===this.orientation?(e=this.elementSize.width,i=t.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)):(e=this.elementSize.height,i=t.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)),s=i/e,s>1&&(s=1),0>s&&(s=0),"vertical"===this.orientation&&(s=1-s),n=this._valueMax()-this._valueMin(),o=this._valueMin()+s*n,this._trimAlignValue(o)},_uiHash:function(t,e,i){var s={handle:this.handles[t],handleIndex:t,value:void 0!==e?e:this.value()};return this._hasMultipleValues()&&(s.value=void 0!==e?e:this.values(t),s.values=i||this.values()),s},_hasMultipleValues:function(){return this.options.values&&this.options.values.length},_start:function(t,e){return this._trigger("start",t,this._uiHash(e))},_slide:function(t,e,i){var s,n,o=this.value(),a=this.values();this._hasMultipleValues()&&(n=this.values(e?0:1),o=this.values(e),2===this.options.values.length&&this.options.range===!0&&(i=0===e?Math.min(n,i):Math.max(n,i)),a[e]=i),i!==o&&(s=this._trigger("slide",t,this._uiHash(e,i,a)),s!==!1&&(this._hasMultipleValues()?this.values(e,i):this.value(i)))},_stop:function(t,e){this._trigger("stop",t,this._uiHash(e))},_change:function(t,e){this._keySliding||this._mouseSliding||(this._lastChangedValue=e,this._trigger("change",t,this._uiHash(e)))},value:function(t){return arguments.length?(this.options.value=this._trimAlignValue(t),this._refreshValue(),this._change(null,0),void 0):this._value()},values:function(e,i){var s,n,o;if(arguments.length>1)return this.options.values[e]=this._trimAlignValue(i),this._refreshValue(),this._change(null,e),void 0;if(!arguments.length)return this._values();if(!t.isArray(arguments[0]))return this._hasMultipleValues()?this._values(e):this.value();for(s=this.options.values,n=arguments[0],o=0;s.length>o;o+=1)s[o]=this._trimAlignValue(n[o]),this._change(null,o);this._refreshValue()},_setOption:function(e,i){var s,n=0;switch("range"===e&&this.options.range===!0&&("min"===i?(this.options.value=this._values(0),this.options.values=null):"max"===i&&(this.options.value=this._values(this.options.values.length-1),this.options.values=null)),t.isArray(this.options.values)&&(n=this.options.values.length),this._super(e,i),e){case"orientation":this._detectOrientation(),this._removeClass("ui-slider-horizontal ui-slider-vertical")._addClass("ui-slider-"+this.orientation),this._refreshValue(),this.options.range&&this._refreshRange(i),this.handles.css("horizontal"===i?"bottom":"left","");break;case"value":this._animateOff=!0,this._refreshValue(),this._change(null,0),this._animateOff=!1;break;case"values":for(this._animateOff=!0,this._refreshValue(),s=n-1;s>=0;s--)this._change(null,s);this._animateOff=!1;break;case"step":case"min":case"max":this._animateOff=!0,this._calculateNewMax(),this._refreshValue(),this._animateOff=!1;break;case"range":this._animateOff=!0,this._refresh(),this._animateOff=!1}},_setOptionDisabled:function(t){this._super(t),this._toggleClass(null,"ui-state-disabled",!!t)},_value:function(){var t=this.options.value;return t=this._trimAlignValue(t)},_values:function(t){var e,i,s;if(arguments.length)return e=this.options.values[t],e=this._trimAlignValue(e);if(this._hasMultipleValues()){for(i=this.options.values.slice(),s=0;i.length>s;s+=1)i[s]=this._trimAlignValue(i[s]);return i}return[]},_trimAlignValue:function(t){if(this._valueMin()>=t)return this._valueMin();if(t>=this._valueMax())return this._valueMax();var e=this.options.step>0?this.options.step:1,i=(t-this._valueMin())%e,s=t-i;return 2*Math.abs(i)>=e&&(s+=i>0?e:-e),parseFloat(s.toFixed(5))},_calculateNewMax:function(){var t=this.options.max,e=this._valueMin(),i=this.options.step,s=Math.round((t-e)/i)*i;t=s+e,t>this.options.max&&(t-=i),this.max=parseFloat(t.toFixed(this._precision()))},_precision:function(){var t=this._precisionOf(this.options.step);return null!==this.options.min&&(t=Math.max(t,this._precisionOf(this.options.min))),t},_precisionOf:function(t){var e=""+t,i=e.indexOf(".");return-1===i?0:e.length-i-1},_valueMin:function(){return this.options.min},_valueMax:function(){return this.max},_refreshRange:function(t){"vertical"===t&&this.range.css({width:"",left:""}),"horizontal"===t&&this.range.css({height:"",bottom:""})},_refreshValue:function(){var e,i,s,n,o,a=this.options.range,r=this.options,h=this,l=this._animateOff?!1:r.animate,c={};this._hasMultipleValues()?this.handles.each(function(s){i=100*((h.values(s)-h._valueMin())/(h._valueMax()-h._valueMin())),c["horizontal"===h.orientation?"left":"bottom"]=i+"%",t(this).stop(1,1)[l?"animate":"css"](c,r.animate),h.options.range===!0&&("horizontal"===h.orientation?(0===s&&h.range.stop(1,1)[l?"animate":"css"]({left:i+"%"},r.animate),1===s&&h.range[l?"animate":"css"]({width:i-e+"%"},{queue:!1,duration:r.animate})):(0===s&&h.range.stop(1,1)[l?"animate":"css"]({bottom:i+"%"},r.animate),1===s&&h.range[l?"animate":"css"]({height:i-e+"%"},{queue:!1,duration:r.animate}))),e=i}):(s=this.value(),n=this._valueMin(),o=this._valueMax(),i=o!==n?100*((s-n)/(o-n)):0,c["horizontal"===this.orientation?"left":"bottom"]=i+"%",this.handle.stop(1,1)[l?"animate":"css"](c,r.animate),"min"===a&&"horizontal"===this.orientation&&this.range.stop(1,1)[l?"animate":"css"]({width:i+"%"},r.animate),"max"===a&&"horizontal"===this.orientation&&this.range.stop(1,1)[l?"animate":"css"]({width:100-i+"%"},r.animate),"min"===a&&"vertical"===this.orientation&&this.range.stop(1,1)[l?"animate":"css"]({height:i+"%"},r.animate),"max"===a&&"vertical"===this.orientation&&this.range.stop(1,1)[l?"animate":"css"]({height:100-i+"%"},r.animate))},_handleEvents:{keydown:function(e){var i,s,n,o,a=t(e.target).data("ui-slider-handle-index");switch(e.keyCode){case t.ui.keyCode.HOME:case t.ui.keyCode.END:case t.ui.keyCode.PAGE_UP:case t.ui.keyCode.PAGE_DOWN:case t.ui.keyCode.UP:case t.ui.keyCode.RIGHT:case t.ui.keyCode.DOWN:case t.ui.keyCode.LEFT:if(e.preventDefault(),!this._keySliding&&(this._keySliding=!0,this._addClass(t(e.target),null,"ui-state-active"),i=this._start(e,a),i===!1))return}switch(o=this.options.step,s=n=this._hasMultipleValues()?this.values(a):this.value(),e.keyCode){case t.ui.keyCode.HOME:n=this._valueMin();break;case t.ui.keyCode.END:n=this._valueMax();break;case t.ui.keyCode.PAGE_UP:n=this._trimAlignValue(s+(this._valueMax()-this._valueMin())/this.numPages);break;case t.ui.keyCode.PAGE_DOWN:n=this._trimAlignValue(s-(this._valueMax()-this._valueMin())/this.numPages);break;case t.ui.keyCode.UP:case t.ui.keyCode.RIGHT:if(s===this._valueMax())return;n=this._trimAlignValue(s+o);break;case t.ui.keyCode.DOWN:case t.ui.keyCode.LEFT:if(s===this._valueMin())return;n=this._trimAlignValue(s-o)}this._slide(e,a,n)},keyup:function(e){var i=t(e.target).data("ui-slider-handle-index");this._keySliding&&(this._keySliding=!1,this._stop(e,i),this._change(e,i),this._removeClass(t(e.target),null,"ui-state-active"))}}}),t.widget("ui.sortable",t.ui.mouse,{version:"1.12.1",widgetEventPrefix:"sort",ready:!1,options:{appendTo:"parent",axis:!1,connectWith:!1,containment:!1,cursor:"auto",cursorAt:!1,dropOnEmpty:!0,forcePlaceholderSize:!1,forceHelperSize:!1,grid:!1,handle:!1,helper:"original",items:"> *",opacity:!1,placeholder:!1,revert:!1,scroll:!0,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1e3,activate:null,beforeStop:null,change:null,deactivate:null,out:null,over:null,receive:null,remove:null,sort:null,start:null,stop:null,update:null},_isOverAxis:function(t,e,i){return t>=e&&e+i>t},_isFloating:function(t){return/left|right/.test(t.css("float"))||/inline|table-cell/.test(t.css("display"))},_create:function(){this.containerCache={},this._addClass("ui-sortable"),this.refresh(),this.offset=this.element.offset(),this._mouseInit(),this._setHandleClassName(),this.ready=!0},_setOption:function(t,e){this._super(t,e),"handle"===t&&this._setHandleClassName()},_setHandleClassName:function(){var e=this;this._removeClass(this.element.find(".ui-sortable-handle"),"ui-sortable-handle"),t.each(this.items,function(){e._addClass(this.instance.options.handle?this.item.find(this.instance.options.handle):this.item,"ui-sortable-handle")})},_destroy:function(){this._mouseDestroy();for(var t=this.items.length-1;t>=0;t--)this.items[t].item.removeData(this.widgetName+"-item");return this},_mouseCapture:function(e,i){var s=null,n=!1,o=this;return this.reverting?!1:this.options.disabled||"static"===this.options.type?!1:(this._refreshItems(e),t(e.target).parents().each(function(){return t.data(this,o.widgetName+"-item")===o?(s=t(this),!1):void 0}),t.data(e.target,o.widgetName+"-item")===o&&(s=t(e.target)),s?!this.options.handle||i||(t(this.options.handle,s).find("*").addBack().each(function(){this===e.target&&(n=!0)}),n)?(this.currentItem=s,this._removeCurrentsFromItems(),!0):!1:!1)},_mouseStart:function(e,i,s){var n,o,a=this.options;if(this.currentContainer=this,this.refreshPositions(),this.helper=this._createHelper(e),this._cacheHelperProportions(),this._cacheMargins(),this.scrollParent=this.helper.scrollParent(),this.offset=this.currentItem.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},t.extend(this.offset,{click:{left:e.pageX-this.offset.left,top:e.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.helper.css("position","absolute"),this.cssPosition=this.helper.css("position"),this.originalPosition=this._generatePosition(e),this.originalPageX=e.pageX,this.originalPageY=e.pageY,a.cursorAt&&this._adjustOffsetFromHelper(a.cursorAt),this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]},this.helper[0]!==this.currentItem[0]&&this.currentItem.hide(),this._createPlaceholder(),a.containment&&this._setContainment(),a.cursor&&"auto"!==a.cursor&&(o=this.document.find("body"),this.storedCursor=o.css("cursor"),o.css("cursor",a.cursor),this.storedStylesheet=t("<style>*{ cursor: "+a.cursor+" !important; }</style>").appendTo(o)),a.opacity&&(this.helper.css("opacity")&&(this._storedOpacity=this.helper.css("opacity")),this.helper.css("opacity",a.opacity)),a.zIndex&&(this.helper.css("zIndex")&&(this._storedZIndex=this.helper.css("zIndex")),this.helper.css("zIndex",a.zIndex)),this.scrollParent[0]!==this.document[0]&&"HTML"!==this.scrollParent[0].tagName&&(this.overflowOffset=this.scrollParent.offset()),this._trigger("start",e,this._uiHash()),this._preserveHelperProportions||this._cacheHelperProportions(),!s)for(n=this.containers.length-1;n>=0;n--)this.containers[n]._trigger("activate",e,this._uiHash(this));return t.ui.ddmanager&&(t.ui.ddmanager.current=this),t.ui.ddmanager&&!a.dropBehaviour&&t.ui.ddmanager.prepareOffsets(this,e),this.dragging=!0,this._addClass(this.helper,"ui-sortable-helper"),this._mouseDrag(e),!0},_mouseDrag:function(e){var i,s,n,o,a=this.options,r=!1;for(this.position=this._generatePosition(e),this.positionAbs=this._convertPositionTo("absolute"),this.lastPositionAbs||(this.lastPositionAbs=this.positionAbs),this.options.scroll&&(this.scrollParent[0]!==this.document[0]&&"HTML"!==this.scrollParent[0].tagName?(this.overflowOffset.top+this.scrollParent[0].offsetHeight-e.pageY<a.scrollSensitivity?this.scrollParent[0].scrollTop=r=this.scrollParent[0].scrollTop+a.scrollSpeed:e.pageY-this.overflowOffset.top<a.scrollSensitivity&&(this.scrollParent[0].scrollTop=r=this.scrollParent[0].scrollTop-a.scrollSpeed),this.overflowOffset.left+this.scrollParent[0].offsetWidth-e.pageX<a.scrollSensitivity?this.scrollParent[0].scrollLeft=r=this.scrollParent[0].scrollLeft+a.scrollSpeed:e.pageX-this.overflowOffset.left<a.scrollSensitivity&&(this.scrollParent[0].scrollLeft=r=this.scrollParent[0].scrollLeft-a.scrollSpeed)):(e.pageY-this.document.scrollTop()<a.scrollSensitivity?r=this.document.scrollTop(this.document.scrollTop()-a.scrollSpeed):this.window.height()-(e.pageY-this.document.scrollTop())<a.scrollSensitivity&&(r=this.document.scrollTop(this.document.scrollTop()+a.scrollSpeed)),e.pageX-this.document.scrollLeft()<a.scrollSensitivity?r=this.document.scrollLeft(this.document.scrollLeft()-a.scrollSpeed):this.window.width()-(e.pageX-this.document.scrollLeft())<a.scrollSensitivity&&(r=this.document.scrollLeft(this.document.scrollLeft()+a.scrollSpeed))),r!==!1&&t.ui.ddmanager&&!a.dropBehaviour&&t.ui.ddmanager.prepareOffsets(this,e)),this.positionAbs=this._convertPositionTo("absolute"),this.options.axis&&"y"===this.options.axis||(this.helper[0].style.left=this.position.left+"px"),this.options.axis&&"x"===this.options.axis||(this.helper[0].style.top=this.position.top+"px"),i=this.items.length-1;i>=0;i--)if(s=this.items[i],n=s.item[0],o=this._intersectsWithPointer(s),o&&s.instance===this.currentContainer&&n!==this.currentItem[0]&&this.placeholder[1===o?"next":"prev"]()[0]!==n&&!t.contains(this.placeholder[0],n)&&("semi-dynamic"===this.options.type?!t.contains(this.element[0],n):!0)){if(this.direction=1===o?"down":"up","pointer"!==this.options.tolerance&&!this._intersectsWithSides(s))break;this._rearrange(e,s),this._trigger("change",e,this._uiHash());break}return this._contactContainers(e),t.ui.ddmanager&&t.ui.ddmanager.drag(this,e),this._trigger("sort",e,this._uiHash()),this.lastPositionAbs=this.positionAbs,!1},_mouseStop:function(e,i){if(e){if(t.ui.ddmanager&&!this.options.dropBehaviour&&t.ui.ddmanager.drop(this,e),this.options.revert){var s=this,n=this.placeholder.offset(),o=this.options.axis,a={};o&&"x"!==o||(a.left=n.left-this.offset.parent.left-this.margins.left+(this.offsetParent[0]===this.document[0].body?0:this.offsetParent[0].scrollLeft)),o&&"y"!==o||(a.top=n.top-this.offset.parent.top-this.margins.top+(this.offsetParent[0]===this.document[0].body?0:this.offsetParent[0].scrollTop)),this.reverting=!0,t(this.helper).animate(a,parseInt(this.options.revert,10)||500,function(){s._clear(e)})}else this._clear(e,i);return!1}},cancel:function(){if(this.dragging){this._mouseUp(new t.Event("mouseup",{target:null})),"original"===this.options.helper?(this.currentItem.css(this._storedCSS),this._removeClass(this.currentItem,"ui-sortable-helper")):this.currentItem.show();for(var e=this.containers.length-1;e>=0;e--)this.containers[e]._trigger("deactivate",null,this._uiHash(this)),this.containers[e].containerCache.over&&(this.containers[e]._trigger("out",null,this._uiHash(this)),this.containers[e].containerCache.over=0)}return this.placeholder&&(this.placeholder[0].parentNode&&this.placeholder[0].parentNode.removeChild(this.placeholder[0]),"original"!==this.options.helper&&this.helper&&this.helper[0].parentNode&&this.helper.remove(),t.extend(this,{helper:null,dragging:!1,reverting:!1,_noFinalSort:null}),this.domPosition.prev?t(this.domPosition.prev).after(this.currentItem):t(this.domPosition.parent).prepend(this.currentItem)),this},serialize:function(e){var i=this._getItemsAsjQuery(e&&e.connected),s=[];return e=e||{},t(i).each(function(){var i=(t(e.item||this).attr(e.attribute||"id")||"").match(e.expression||/(.+)[\-=_](.+)/);i&&s.push((e.key||i[1]+"[]")+"="+(e.key&&e.expression?i[1]:i[2]))}),!s.length&&e.key&&s.push(e.key+"="),s.join("&")},toArray:function(e){var i=this._getItemsAsjQuery(e&&e.connected),s=[];return e=e||{},i.each(function(){s.push(t(e.item||this).attr(e.attribute||"id")||"")}),s},_intersectsWith:function(t){var e=this.positionAbs.left,i=e+this.helperProportions.width,s=this.positionAbs.top,n=s+this.helperProportions.height,o=t.left,a=o+t.width,r=t.top,h=r+t.height,l=this.offset.click.top,c=this.offset.click.left,u="x"===this.options.axis||s+l>r&&h>s+l,d="y"===this.options.axis||e+c>o&&a>e+c,p=u&&d;return"pointer"===this.options.tolerance||this.options.forcePointerForContainers||"pointer"!==this.options.tolerance&&this.helperProportions[this.floating?"width":"height"]>t[this.floating?"width":"height"]?p:e+this.helperProportions.width/2>o&&a>i-this.helperProportions.width/2&&s+this.helperProportions.height/2>r&&h>n-this.helperProportions.height/2},_intersectsWithPointer:function(t){var e,i,s="x"===this.options.axis||this._isOverAxis(this.positionAbs.top+this.offset.click.top,t.top,t.height),n="y"===this.options.axis||this._isOverAxis(this.positionAbs.left+this.offset.click.left,t.left,t.width),o=s&&n;return o?(e=this._getDragVerticalDirection(),i=this._getDragHorizontalDirection(),this.floating?"right"===i||"down"===e?2:1:e&&("down"===e?2:1)):!1},_intersectsWithSides:function(t){var e=this._isOverAxis(this.positionAbs.top+this.offset.click.top,t.top+t.height/2,t.height),i=this._isOverAxis(this.positionAbs.left+this.offset.click.left,t.left+t.width/2,t.width),s=this._getDragVerticalDirection(),n=this._getDragHorizontalDirection();return this.floating&&n?"right"===n&&i||"left"===n&&!i:s&&("down"===s&&e||"up"===s&&!e)},_getDragVerticalDirection:function(){var t=this.positionAbs.top-this.lastPositionAbs.top;return 0!==t&&(t>0?"down":"up")},_getDragHorizontalDirection:function(){var t=this.positionAbs.left-this.lastPositionAbs.left;return 0!==t&&(t>0?"right":"left")},refresh:function(t){return this._refreshItems(t),this._setHandleClassName(),this.refreshPositions(),this},_connectWith:function(){var t=this.options;return t.connectWith.constructor===String?[t.connectWith]:t.connectWith},_getItemsAsjQuery:function(e){function i(){r.push(this)}var s,n,o,a,r=[],h=[],l=this._connectWith();if(l&&e)for(s=l.length-1;s>=0;s--)for(o=t(l[s],this.document[0]),n=o.length-1;n>=0;n--)a=t.data(o[n],this.widgetFullName),a&&a!==this&&!a.options.disabled&&h.push([t.isFunction(a.options.items)?a.options.items.call(a.element):t(a.options.items,a.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),a]);for(h.push([t.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):t(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),this]),s=h.length-1;s>=0;s--)h[s][0].each(i);return t(r)},_removeCurrentsFromItems:function(){var e=this.currentItem.find(":data("+this.widgetName+"-item)");this.items=t.grep(this.items,function(t){for(var i=0;e.length>i;i++)if(e[i]===t.item[0])return!1;return!0})},_refreshItems:function(e){this.items=[],this.containers=[this];var i,s,n,o,a,r,h,l,c=this.items,u=[[t.isFunction(this.options.items)?this.options.items.call(this.element[0],e,{item:this.currentItem}):t(this.options.items,this.element),this]],d=this._connectWith();if(d&&this.ready)for(i=d.length-1;i>=0;i--)for(n=t(d[i],this.document[0]),s=n.length-1;s>=0;s--)o=t.data(n[s],this.widgetFullName),o&&o!==this&&!o.options.disabled&&(u.push([t.isFunction(o.options.items)?o.options.items.call(o.element[0],e,{item:this.currentItem}):t(o.options.items,o.element),o]),this.containers.push(o));for(i=u.length-1;i>=0;i--)for(a=u[i][1],r=u[i][0],s=0,l=r.length;l>s;s++)h=t(r[s]),h.data(this.widgetName+"-item",a),c.push({item:h,instance:a,width:0,height:0,left:0,top:0})},refreshPositions:function(e){this.floating=this.items.length?"x"===this.options.axis||this._isFloating(this.items[0].item):!1,this.offsetParent&&this.helper&&(this.offset.parent=this._getParentOffset());var i,s,n,o;for(i=this.items.length-1;i>=0;i--)s=this.items[i],s.instance!==this.currentContainer&&this.currentContainer&&s.item[0]!==this.currentItem[0]||(n=this.options.toleranceElement?t(this.options.toleranceElement,s.item):s.item,e||(s.width=n.outerWidth(),s.height=n.outerHeight()),o=n.offset(),s.left=o.left,s.top=o.top);if(this.options.custom&&this.options.custom.refreshContainers)this.options.custom.refreshContainers.call(this);else for(i=this.containers.length-1;i>=0;i--)o=this.containers[i].element.offset(),this.containers[i].containerCache.left=o.left,this.containers[i].containerCache.top=o.top,this.containers[i].containerCache.width=this.containers[i].element.outerWidth(),this.containers[i].containerCache.height=this.containers[i].element.outerHeight();return this},_createPlaceholder:function(e){e=e||this;var i,s=e.options;s.placeholder&&s.placeholder.constructor!==String||(i=s.placeholder,s.placeholder={element:function(){var s=e.currentItem[0].nodeName.toLowerCase(),n=t("<"+s+">",e.document[0]);return e._addClass(n,"ui-sortable-placeholder",i||e.currentItem[0].className)._removeClass(n,"ui-sortable-helper"),"tbody"===s?e._createTrPlaceholder(e.currentItem.find("tr").eq(0),t("<tr>",e.document[0]).appendTo(n)):"tr"===s?e._createTrPlaceholder(e.currentItem,n):"img"===s&&n.attr("src",e.currentItem.attr("src")),i||n.css("visibility","hidden"),n},update:function(t,n){(!i||s.forcePlaceholderSize)&&(n.height()||n.height(e.currentItem.innerHeight()-parseInt(e.currentItem.css("paddingTop")||0,10)-parseInt(e.currentItem.css("paddingBottom")||0,10)),n.width()||n.width(e.currentItem.innerWidth()-parseInt(e.currentItem.css("paddingLeft")||0,10)-parseInt(e.currentItem.css("paddingRight")||0,10)))}}),e.placeholder=t(s.placeholder.element.call(e.element,e.currentItem)),e.currentItem.after(e.placeholder),s.placeholder.update(e,e.placeholder)},_createTrPlaceholder:function(e,i){var s=this;e.children().each(function(){t("<td>&#160;</td>",s.document[0]).attr("colspan",t(this).attr("colspan")||1).appendTo(i)})},_contactContainers:function(e){var i,s,n,o,a,r,h,l,c,u,d=null,p=null;for(i=this.containers.length-1;i>=0;i--)if(!t.contains(this.currentItem[0],this.containers[i].element[0]))if(this._intersectsWith(this.containers[i].containerCache)){if(d&&t.contains(this.containers[i].element[0],d.element[0]))continue;d=this.containers[i],p=i}else this.containers[i].containerCache.over&&(this.containers[i]._trigger("out",e,this._uiHash(this)),this.containers[i].containerCache.over=0);if(d)if(1===this.containers.length)this.containers[p].containerCache.over||(this.containers[p]._trigger("over",e,this._uiHash(this)),this.containers[p].containerCache.over=1);else{for(n=1e4,o=null,c=d.floating||this._isFloating(this.currentItem),a=c?"left":"top",r=c?"width":"height",u=c?"pageX":"pageY",s=this.items.length-1;s>=0;s--)t.contains(this.containers[p].element[0],this.items[s].item[0])&&this.items[s].item[0]!==this.currentItem[0]&&(h=this.items[s].item.offset()[a],l=!1,e[u]-h>this.items[s][r]/2&&(l=!0),n>Math.abs(e[u]-h)&&(n=Math.abs(e[u]-h),o=this.items[s],this.direction=l?"up":"down"));if(!o&&!this.options.dropOnEmpty)return;if(this.currentContainer===this.containers[p])return this.currentContainer.containerCache.over||(this.containers[p]._trigger("over",e,this._uiHash()),this.currentContainer.containerCache.over=1),void 0;o?this._rearrange(e,o,null,!0):this._rearrange(e,null,this.containers[p].element,!0),this._trigger("change",e,this._uiHash()),this.containers[p]._trigger("change",e,this._uiHash(this)),this.currentContainer=this.containers[p],this.options.placeholder.update(this.currentContainer,this.placeholder),this.containers[p]._trigger("over",e,this._uiHash(this)),this.containers[p].containerCache.over=1}},_createHelper:function(e){var i=this.options,s=t.isFunction(i.helper)?t(i.helper.apply(this.element[0],[e,this.currentItem])):"clone"===i.helper?this.currentItem.clone():this.currentItem;return s.parents("body").length||t("parent"!==i.appendTo?i.appendTo:this.currentItem[0].parentNode)[0].appendChild(s[0]),s[0]===this.currentItem[0]&&(this._storedCSS={width:this.currentItem[0].style.width,height:this.currentItem[0].style.height,position:this.currentItem.css("position"),top:this.currentItem.css("top"),left:this.currentItem.css("left")}),(!s[0].style.width||i.forceHelperSize)&&s.width(this.currentItem.width()),(!s[0].style.height||i.forceHelperSize)&&s.height(this.currentItem.height()),s},_adjustOffsetFromHelper:function(e){"string"==typeof e&&(e=e.split(" ")),t.isArray(e)&&(e={left:+e[0],top:+e[1]||0}),"left"in e&&(this.offset.click.left=e.left+this.margins.left),"right"in e&&(this.offset.click.left=this.helperProportions.width-e.right+this.margins.left),"top"in e&&(this.offset.click.top=e.top+this.margins.top),"bottom"in e&&(this.offset.click.top=this.helperProportions.height-e.bottom+this.margins.top)},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var e=this.offsetParent.offset();return"absolute"===this.cssPosition&&this.scrollParent[0]!==this.document[0]&&t.contains(this.scrollParent[0],this.offsetParent[0])&&(e.left+=this.scrollParent.scrollLeft(),e.top+=this.scrollParent.scrollTop()),(this.offsetParent[0]===this.document[0].body||this.offsetParent[0].tagName&&"html"===this.offsetParent[0].tagName.toLowerCase()&&t.ui.ie)&&(e={top:0,left:0}),{top:e.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:e.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"===this.cssPosition){var t=this.currentItem.position();return{top:t.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:t.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.currentItem.css("marginLeft"),10)||0,top:parseInt(this.currentItem.css("marginTop"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var e,i,s,n=this.options;"parent"===n.containment&&(n.containment=this.helper[0].parentNode),("document"===n.containment||"window"===n.containment)&&(this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,"document"===n.containment?this.document.width():this.window.width()-this.helperProportions.width-this.margins.left,("document"===n.containment?this.document.height()||document.body.parentNode.scrollHeight:this.window.height()||this.document[0].body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]),/^(document|window|parent)$/.test(n.containment)||(e=t(n.containment)[0],i=t(n.containment).offset(),s="hidden"!==t(e).css("overflow"),this.containment=[i.left+(parseInt(t(e).css("borderLeftWidth"),10)||0)+(parseInt(t(e).css("paddingLeft"),10)||0)-this.margins.left,i.top+(parseInt(t(e).css("borderTopWidth"),10)||0)+(parseInt(t(e).css("paddingTop"),10)||0)-this.margins.top,i.left+(s?Math.max(e.scrollWidth,e.offsetWidth):e.offsetWidth)-(parseInt(t(e).css("borderLeftWidth"),10)||0)-(parseInt(t(e).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,i.top+(s?Math.max(e.scrollHeight,e.offsetHeight):e.offsetHeight)-(parseInt(t(e).css("borderTopWidth"),10)||0)-(parseInt(t(e).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top])},_convertPositionTo:function(e,i){i||(i=this.position);var s="absolute"===e?1:-1,n="absolute"!==this.cssPosition||this.scrollParent[0]!==this.document[0]&&t.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,o=/(html|body)/i.test(n[0].tagName);return{top:i.top+this.offset.relative.top*s+this.offset.parent.top*s-("fixed"===this.cssPosition?-this.scrollParent.scrollTop():o?0:n.scrollTop())*s,left:i.left+this.offset.relative.left*s+this.offset.parent.left*s-("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():o?0:n.scrollLeft())*s}},_generatePosition:function(e){var i,s,n=this.options,o=e.pageX,a=e.pageY,r="absolute"!==this.cssPosition||this.scrollParent[0]!==this.document[0]&&t.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,h=/(html|body)/i.test(r[0].tagName);return"relative"!==this.cssPosition||this.scrollParent[0]!==this.document[0]&&this.scrollParent[0]!==this.offsetParent[0]||(this.offset.relative=this._getRelativeOffset()),this.originalPosition&&(this.containment&&(e.pageX-this.offset.click.left<this.containment[0]&&(o=this.containment[0]+this.offset.click.left),e.pageY-this.offset.click.top<this.containment[1]&&(a=this.containment[1]+this.offset.click.top),e.pageX-this.offset.click.left>this.containment[2]&&(o=this.containment[2]+this.offset.click.left),e.pageY-this.offset.click.top>this.containment[3]&&(a=this.containment[3]+this.offset.click.top)),n.grid&&(i=this.originalPageY+Math.round((a-this.originalPageY)/n.grid[1])*n.grid[1],a=this.containment?i-this.offset.click.top>=this.containment[1]&&i-this.offset.click.top<=this.containment[3]?i:i-this.offset.click.top>=this.containment[1]?i-n.grid[1]:i+n.grid[1]:i,s=this.originalPageX+Math.round((o-this.originalPageX)/n.grid[0])*n.grid[0],o=this.containment?s-this.offset.click.left>=this.containment[0]&&s-this.offset.click.left<=this.containment[2]?s:s-this.offset.click.left>=this.containment[0]?s-n.grid[0]:s+n.grid[0]:s)),{top:a-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.scrollParent.scrollTop():h?0:r.scrollTop()),left:o-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():h?0:r.scrollLeft())}},_rearrange:function(t,e,i,s){i?i[0].appendChild(this.placeholder[0]):e.item[0].parentNode.insertBefore(this.placeholder[0],"down"===this.direction?e.item[0]:e.item[0].nextSibling),this.counter=this.counter?++this.counter:1;var n=this.counter;
26�
vendor: 27,154 bytes, lines 26-27
26
27this._delay(function(){n===this.counter&&this.refreshPositions(!s)})},_clear:function(t,e){function i(t,e,i){return function(s){i._trigger(t,s,e._uiHash(e))}}this.reverting=!1;var s,n=[];if(!this._noFinalSort&&this.currentItem.parent().length&&this.placeholder.before(this.currentItem),this._noFinalSort=null,this.helper[0]===this.currentItem[0]){for(s in this._storedCSS)("auto"===this._storedCSS[s]||"static"===this._storedCSS[s])&&(this._storedCSS[s]="");this.currentItem.css(this._storedCSS),this._removeClass(this.currentItem,"ui-sortable-helper")}else this.currentItem.show();for(this.fromOutside&&!e&&n.push(function(t){this._trigger("receive",t,this._uiHash(this.fromOutside))}),!this.fromOutside&&this.domPosition.prev===this.currentItem.prev().not(".ui-sortable-helper")[0]&&this.domPosition.parent===this.currentItem.parent()[0]||e||n.push(function(t){this._trigger("update",t,this._uiHash())}),this!==this.currentContainer&&(e||(n.push(function(t){this._trigger("remove",t,this._uiHash())}),n.push(function(t){return function(e){t._trigger("receive",e,this._uiHash(this))}}.call(this,this.currentContainer)),n.push(function(t){return function(e){t._trigger("update",e,this._uiHash(this))}}.call(this,this.currentContainer)))),s=this.containers.length-1;s>=0;s--)e||n.push(i("deactivate",this,this.containers[s])),this.containers[s].containerCache.over&&(n.push(i("out",this,this.containers[s])),this.containers[s].containerCache.over=0);if(this.storedCursor&&(this.document.find("body").css("cursor",this.storedCursor),this.storedStylesheet.remove()),this._storedOpacity&&this.helper.css("opacity",this._storedOpacity),this._storedZIndex&&this.helper.css("zIndex","auto"===this._storedZIndex?"":this._storedZIndex),this.dragging=!1,e||this._trigger("beforeStop",t,this._uiHash()),this.placeholder[0].parentNode.removeChild(this.placeholder[0]),this.cancelHelperRemoval||(this.helper[0]!==this.currentItem[0]&&this.helper.remove(),this.helper=null),!e){for(s=0;n.length>s;s++)n[s].call(this,t);this._trigger("stop",t,this._uiHash())}return this.fromOutside=!1,!this.cancelHelperRemoval},_trigger:function(){t.Widget.prototype._trigger.apply(this,arguments)===!1&&this.cancel()},_uiHash:function(e){var i=e||this;return{helper:i.helper,placeholder:i.placeholder||t([]),position:i.position,originalPosition:i.originalPosition,offset:i.positionAbs,item:i.currentItem,sender:e?e.element:null}}}),t.widget("ui.spinner",{version:"1.12.1",defaultElement:"<input>",widgetEventPrefix:"spin",options:{classes:{"ui-spinner":"ui-corner-all","ui-spinner-down":"ui-corner-br","ui-spinner-up":"ui-corner-tr"},culture:null,icons:{down:"ui-icon-triangle-1-s",up:"ui-icon-triangle-1-n"},incremental:!0,max:null,min:null,numberFormat:null,page:10,step:1,change:null,spin:null,start:null,stop:null},_create:function(){this._setOption("max",this.options.max),this._setOption("min",this.options.min),this._setOption("step",this.options.step),""!==this.value()&&this._value(this.element.val(),!0),this._draw(),this._on(this._events),this._refresh(),this._on(this.window,{beforeunload:function(){this.element.removeAttr("autocomplete")}})},_getCreateOptions:function(){var e=this._super(),i=this.element;return t.each(["min","max","step"],function(t,s){var n=i.attr(s);null!=n&&n.length&&(e[s]=n)}),e},_events:{keydown:function(t){this._start(t)&&this._keydown(t)&&t.preventDefault()},keyup:"_stop",focus:function(){this.previous=this.element.val()},blur:function(t){return this.cancelBlur?(delete this.cancelBlur,void 0):(this._stop(),this._refresh(),this.previous!==this.element.val()&&this._trigger("change",t),void 0)},mousewheel:function(t,e){if(e){if(!this.spinning&&!this._start(t))return!1;this._spin((e>0?1:-1)*this.options.step,t),clearTimeout(this.mousewheelTimer),this.mousewheelTimer=this._delay(function(){this.spinning&&this._stop(t)},100),t.preventDefault()}},"mousedown .ui-spinner-button":function(e){function i(){var e=this.element[0]===t.ui.safeActiveElement(this.document[0]);e||(this.element.trigger("focus"),this.previous=s,this._delay(function(){this.previous=s}))}var s;s=this.element[0]===t.ui.safeActiveElement(this.document[0])?this.previous:this.element.val(),e.preventDefault(),i.call(this),this.cancelBlur=!0,this._delay(function(){delete this.cancelBlur,i.call(this)}),this._start(e)!==!1&&this._repeat(null,t(e.currentTarget).hasClass("ui-spinner-up")?1:-1,e)},"mouseup .ui-spinner-button":"_stop","mouseenter .ui-spinner-button":function(e){return t(e.currentTarget).hasClass("ui-state-active")?this._start(e)===!1?!1:(this._repeat(null,t(e.currentTarget).hasClass("ui-spinner-up")?1:-1,e),void 0):void 0},"mouseleave .ui-spinner-button":"_stop"},_enhance:function(){this.uiSpinner=this.element.attr("autocomplete","off").wrap("<span>").parent().append("<a></a><a></a>")},_draw:function(){this._enhance(),this._addClass(this.uiSpinner,"ui-spinner","ui-widget ui-widget-content"),this._addClass("ui-spinner-input"),this.element.attr("role","spinbutton"),this.buttons=this.uiSpinner.children("a").attr("tabIndex",-1).attr("aria-hidden",!0).button({classes:{"ui-button":""}}),this._removeClass(this.buttons,"ui-corner-all"),this._addClass(this.buttons.first(),"ui-spinner-button ui-spinner-up"),this._addClass(this.buttons.last(),"ui-spinner-button ui-spinner-down"),this.buttons.first().button({icon:this.options.icons.up,showLabel:!1}),this.buttons.last().button({icon:this.options.icons.down,showLabel:!1}),this.buttons.height()>Math.ceil(.5*this.uiSpinner.height())&&this.uiSpinner.height()>0&&this.uiSpinner.height(this.uiSpinner.height())},_keydown:function(e){var i=this.options,s=t.ui.keyCode;switch(e.keyCode){case s.UP:return this._repeat(null,1,e),!0;case s.DOWN:return this._repeat(null,-1,e),!0;case s.PAGE_UP:return this._repeat(null,i.page,e),!0;case s.PAGE_DOWN:return this._repeat(null,-i.page,e),!0}return!1},_start:function(t){return this.spinning||this._trigger("start",t)!==!1?(this.counter||(this.counter=1),this.spinning=!0,!0):!1},_repeat:function(t,e,i){t=t||500,clearTimeout(this.timer),this.timer=this._delay(function(){this._repeat(40,e,i)},t),this._spin(e*this.options.step,i)},_spin:function(t,e){var i=this.value()||0;this.counter||(this.counter=1),i=this._adjustValue(i+t*this._increment(this.counter)),this.spinning&&this._trigger("spin",e,{value:i})===!1||(this._value(i),this.counter++)},_increment:function(e){var i=this.options.incremental;return i?t.isFunction(i)?i(e):Math.floor(e*e*e/5e4-e*e/500+17*e/200+1):1},_precision:function(){var t=this._precisionOf(this.options.step);return null!==this.options.min&&(t=Math.max(t,this._precisionOf(this.options.min))),t},_precisionOf:function(t){var e=""+t,i=e.indexOf(".");return-1===i?0:e.length-i-1},_adjustValue:function(t){var e,i,s=this.options;return e=null!==s.min?s.min:0,i=t-e,i=Math.round(i/s.step)*s.step,t=e+i,t=parseFloat(t.toFixed(this._precision())),null!==s.max&&t>s.max?s.max:null!==s.min&&s.min>t?s.min:t},_stop:function(t){this.spinning&&(clearTimeout(this.timer),clearTimeout(this.mousewheelTimer),this.counter=0,this.spinning=!1,this._trigger("stop",t))},_setOption:function(t,e){var i,s,n;return"culture"===t||"numberFormat"===t?(i=this._parse(this.element.val()),this.options[t]=e,this.element.val(this._format(i)),void 0):(("max"===t||"min"===t||"step"===t)&&"string"==typeof e&&(e=this._parse(e)),"icons"===t&&(s=this.buttons.first().find(".ui-icon"),this._removeClass(s,null,this.options.icons.up),this._addClass(s,null,e.up),n=this.buttons.last().find(".ui-icon"),this._removeClass(n,null,this.options.icons.down),this._addClass(n,null,e.down)),this._super(t,e),void 0)},_setOptionDisabled:function(t){this._super(t),this._toggleClass(this.uiSpinner,null,"ui-state-disabled",!!t),this.element.prop("disabled",!!t),this.buttons.button(t?"disable":"enable")},_setOptions:r(function(t){this._super(t)}),_parse:function(t){return"string"==typeof t&&""!==t&&(t=window.Globalize&&this.options.numberFormat?Globalize.parseFloat(t,10,this.options.culture):+t),""===t||isNaN(t)?null:t},_format:function(t){return""===t?"":window.Globalize&&this.options.numberFormat?Globalize.format(t,this.options.numberFormat,this.options.culture):t},_refresh:function(){this.element.attr({"aria-valuemin":this.options.min,"aria-valuemax":this.options.max,"aria-valuenow":this._parse(this.element.val())})},isValid:function(){var t=this.value();return null===t?!1:t===this._adjustValue(t)},_value:function(t,e){var i;""!==t&&(i=this._parse(t),null!==i&&(e||(i=this._adjustValue(i)),t=this._format(i))),this.element.val(t),this._refresh()},_destroy:function(){this.element.prop("disabled",!1).removeAttr("autocomplete role aria-valuemin aria-valuemax aria-valuenow"),this.uiSpinner.replaceWith(this.element)},stepUp:r(function(t){this._stepUp(t)}),_stepUp:function(t){this._start()&&(this._spin((t||1)*this.options.step),this._stop())},stepDown:r(function(t){this._stepDown(t)}),_stepDown:function(t){this._start()&&(this._spin((t||1)*-this.options.step),this._stop())},pageUp:r(function(t){this._stepUp((t||1)*this.options.page)}),pageDown:r(function(t){this._stepDown((t||1)*this.options.page)}),value:function(t){return arguments.length?(r(this._value).call(this,t),void 0):this._parse(this.element.val())},widget:function(){return this.uiSpinner}}),t.uiBackCompat!==!1&&t.widget("ui.spinner",t.ui.spinner,{_enhance:function(){this.uiSpinner=this.element.attr("autocomplete","off").wrap(this._uiSpinnerHtml()).parent().append(this._buttonHtml())},_uiSpinnerHtml:function(){return"<span>"},_buttonHtml:function(){return"<a></a><a></a>"}}),t.ui.spinner,t.widget("ui.tabs",{version:"1.12.1",delay:300,options:{active:null,classes:{"ui-tabs":"ui-corner-all","ui-tabs-nav":"ui-corner-all","ui-tabs-panel":"ui-corner-bottom","ui-tabs-tab":"ui-corner-top"},collapsible:!1,event:"click",heightStyle:"content",hide:null,show:null,activate:null,beforeActivate:null,beforeLoad:null,load:null},_isLocal:function(){var t=/#.*$/;return function(e){var i,s;i=e.href.replace(t,""),s=location.href.replace(t,"");try{i=decodeURIComponent(i)}catch(n){}try{s=decodeURIComponent(s)}catch(n){}return e.hash.length>1&&i===s}}(),_create:function(){var e=this,i=this.options;this.running=!1,this._addClass("ui-tabs","ui-widget ui-widget-content"),this._toggleClass("ui-tabs-collapsible",null,i.collapsible),this._processTabs(),i.active=this._initialActive(),t.isArray(i.disabled)&&(i.disabled=t.unique(i.disabled.concat(t.map(this.tabs.filter(".ui-state-disabled"),function(t){return e.tabs.index(t)}))).sort()),this.active=this.options.active!==!1&&this.anchors.length?this._findActive(i.active):t(),this._refresh(),this.active.length&&this.load(i.active)},_initialActive:function(){var e=this.options.active,i=this.options.collapsible,s=location.hash.substring(1);return null===e&&(s&&this.tabs.each(function(i,n){return t(n).attr("aria-controls")===s?(e=i,!1):void 0}),null===e&&(e=this.tabs.index(this.tabs.filter(".ui-tabs-active"))),(null===e||-1===e)&&(e=this.tabs.length?0:!1)),e!==!1&&(e=this.tabs.index(this.tabs.eq(e)),-1===e&&(e=i?!1:0)),!i&&e===!1&&this.anchors.length&&(e=0),e},_getCreateEventData:function(){return{tab:this.active,panel:this.active.length?this._getPanelForTab(this.active):t()}},_tabKeydown:function(e){var i=t(t.ui.safeActiveElement(this.document[0])).closest("li"),s=this.tabs.index(i),n=!0;if(!this._handlePageNav(e)){switch(e.keyCode){case t.ui.keyCode.RIGHT:case t.ui.keyCode.DOWN:s++;break;case t.ui.keyCode.UP:case t.ui.keyCode.LEFT:n=!1,s--;break;case t.ui.keyCode.END:s=this.anchors.length-1;break;case t.ui.keyCode.HOME:s=0;break;case t.ui.keyCode.SPACE:return e.preventDefault(),clearTimeout(this.activating),this._activate(s),void 0;case t.ui.keyCode.ENTER:return e.preventDefault(),clearTimeout(this.activating),this._activate(s===this.options.active?!1:s),void 0;default:return}e.preventDefault(),clearTimeout(this.activating),s=this._focusNextTab(s,n),e.ctrlKey||e.metaKey||(i.attr("aria-selected","false"),this.tabs.eq(s).attr("aria-selected","true"),this.activating=this._delay(function(){this.option("active",s)},this.delay))}},_panelKeydown:function(e){this._handlePageNav(e)||e.ctrlKey&&e.keyCode===t.ui.keyCode.UP&&(e.preventDefault(),this.active.trigger("focus"))},_handlePageNav:function(e){return e.altKey&&e.keyCode===t.ui.keyCode.PAGE_UP?(this._activate(this._focusNextTab(this.options.active-1,!1)),!0):e.altKey&&e.keyCode===t.ui.keyCode.PAGE_DOWN?(this._activate(this._focusNextTab(this.options.active+1,!0)),!0):void 0},_findNextTab:function(e,i){function s(){return e>n&&(e=0),0>e&&(e=n),e}for(var n=this.tabs.length-1;-1!==t.inArray(s(),this.options.disabled);)e=i?e+1:e-1;return e},_focusNextTab:function(t,e){return t=this._findNextTab(t,e),this.tabs.eq(t).trigger("focus"),t},_setOption:function(t,e){return"active"===t?(this._activate(e),void 0):(this._super(t,e),"collapsible"===t&&(this._toggleClass("ui-tabs-collapsible",null,e),e||this.options.active!==!1||this._activate(0)),"event"===t&&this._setupEvents(e),"heightStyle"===t&&this._setupHeightStyle(e),void 0)},_sanitizeSelector:function(t){return t?t.replace(/[!"$%&'()*+,.\/:;<=>?@\[\]\^`{|}~]/g,"\\$&"):""},refresh:function(){var e=this.options,i=this.tablist.children(":has(a[href])");e.disabled=t.map(i.filter(".ui-state-disabled"),function(t){return i.index(t)}),this._processTabs(),e.active!==!1&&this.anchors.length?this.active.length&&!t.contains(this.tablist[0],this.active[0])?this.tabs.length===e.disabled.length?(e.active=!1,this.active=t()):this._activate(this._findNextTab(Math.max(0,e.active-1),!1)):e.active=this.tabs.index(this.active):(e.active=!1,this.active=t()),this._refresh()},_refresh:function(){this._setOptionDisabled(this.options.disabled),this._setupEvents(this.options.event),this._setupHeightStyle(this.options.heightStyle),this.tabs.not(this.active).attr({"aria-selected":"false","aria-expanded":"false",tabIndex:-1}),this.panels.not(this._getPanelForTab(this.active)).hide().attr({"aria-hidden":"true"}),this.active.length?(this.active.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0}),this._addClass(this.active,"ui-tabs-active","ui-state-active"),this._getPanelForTab(this.active).show().attr({"aria-hidden":"false"})):this.tabs.eq(0).attr("tabIndex",0)},_processTabs:function(){var e=this,i=this.tabs,s=this.anchors,n=this.panels;this.tablist=this._getList().attr("role","tablist"),this._addClass(this.tablist,"ui-tabs-nav","ui-helper-reset ui-helper-clearfix ui-widget-header"),this.tablist.on("mousedown"+this.eventNamespace,"> li",function(e){t(this).is(".ui-state-disabled")&&e.preventDefault()}).on("focus"+this.eventNamespace,".ui-tabs-anchor",function(){t(this).closest("li").is(".ui-state-disabled")&&this.blur()}),this.tabs=this.tablist.find("> li:has(a[href])").attr({role:"tab",tabIndex:-1}),this._addClass(this.tabs,"ui-tabs-tab","ui-state-default"),this.anchors=this.tabs.map(function(){return t("a",this)[0]}).attr({role:"presentation",tabIndex:-1}),this._addClass(this.anchors,"ui-tabs-anchor"),this.panels=t(),this.anchors.each(function(i,s){var n,o,a,r=t(s).uniqueId().attr("id"),h=t(s).closest("li"),l=h.attr("aria-controls");e._isLocal(s)?(n=s.hash,a=n.substring(1),o=e.element.find(e._sanitizeSelector(n))):(a=h.attr("aria-controls")||t({}).uniqueId()[0].id,n="#"+a,o=e.element.find(n),o.length||(o=e._createPanel(a),o.insertAfter(e.panels[i-1]||e.tablist)),o.attr("aria-live","polite")),o.length&&(e.panels=e.panels.add(o)),l&&h.data("ui-tabs-aria-controls",l),h.attr({"aria-controls":a,"aria-labelledby":r}),o.attr("aria-labelledby",r)}),this.panels.attr("role","tabpanel"),this._addClass(this.panels,"ui-tabs-panel","ui-widget-content"),i&&(this._off(i.not(this.tabs)),this._off(s.not(this.anchors)),this._off(n.not(this.panels)))},_getList:function(){return this.tablist||this.element.find("ol, ul").eq(0)},_createPanel:function(e){return t("<div>").attr("id",e).data("ui-tabs-destroy",!0)},_setOptionDisabled:function(e){var i,s,n;for(t.isArray(e)&&(e.length?e.length===this.anchors.length&&(e=!0):e=!1),n=0;s=this.tabs[n];n++)i=t(s),e===!0||-1!==t.inArray(n,e)?(i.attr("aria-disabled","true"),this._addClass(i,null,"ui-state-disabled")):(i.removeAttr("aria-disabled"),this._removeClass(i,null,"ui-state-disabled"));this.options.disabled=e,this._toggleClass(this.widget(),this.widgetFullName+"-disabled",null,e===!0)},_setupEvents:function(e){var i={};e&&t.each(e.split(" "),function(t,e){i[e]="_eventHandler"}),this._off(this.anchors.add(this.tabs).add(this.panels)),this._on(!0,this.anchors,{click:function(t){t.preventDefault()}}),this._on(this.anchors,i),this._on(this.tabs,{keydown:"_tabKeydown"}),this._on(this.panels,{keydown:"_panelKeydown"}),this._focusable(this.tabs),this._hoverable(this.tabs)},_setupHeightStyle:function(e){var i,s=this.element.parent();"fill"===e?(i=s.height(),i-=this.element.outerHeight()-this.element.height(),this.element.siblings(":visible").each(function(){var e=t(this),s=e.css("position");"absolute"!==s&&"fixed"!==s&&(i-=e.outerHeight(!0))}),this.element.children().not(this.panels).each(function(){i-=t(this).outerHeight(!0)}),this.panels.each(function(){t(this).height(Math.max(0,i-t(this).innerHeight()+t(this).height()))}).css("overflow","auto")):"auto"===e&&(i=0,this.panels.each(function(){i=Math.max(i,t(this).height("").height())}).height(i))},_eventHandler:function(e){var i=this.options,s=this.active,n=t(e.currentTarget),o=n.closest("li"),a=o[0]===s[0],r=a&&i.collapsible,h=r?t():this._getPanelForTab(o),l=s.length?this._getPanelForTab(s):t(),c={oldTab:s,oldPanel:l,newTab:r?t():o,newPanel:h};e.preventDefault(),o.hasClass("ui-state-disabled")||o.hasClass("ui-tabs-loading")||this.running||a&&!i.collapsible||this._trigger("beforeActivate",e,c)===!1||(i.active=r?!1:this.tabs.index(o),this.active=a?t():o,this.xhr&&this.xhr.abort(),l.length||h.length||t.error("jQuery UI Tabs: Mismatching fragment identifier."),h.length&&this.load(this.tabs.index(o),e),this._toggle(e,c))},_toggle:function(e,i){function s(){o.running=!1,o._trigger("activate",e,i)}function n(){o._addClass(i.newTab.closest("li"),"ui-tabs-active","ui-state-active"),a.length&&o.options.show?o._show(a,o.options.show,s):(a.show(),s())}var o=this,a=i.newPanel,r=i.oldPanel;this.running=!0,r.length&&this.options.hide?this._hide(r,this.options.hide,function(){o._removeClass(i.oldTab.closest("li"),"ui-tabs-active","ui-state-active"),n()}):(this._removeClass(i.oldTab.closest("li"),"ui-tabs-active","ui-state-active"),r.hide(),n()),r.attr("aria-hidden","true"),i.oldTab.attr({"aria-selected":"false","aria-expanded":"false"}),a.length&&r.length?i.oldTab.attr("tabIndex",-1):a.length&&this.tabs.filter(function(){return 0===t(this).attr("tabIndex")}).attr("tabIndex",-1),a.attr("aria-hidden","false"),i.newTab.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0})},_activate:function(e){var i,s=this._findActive(e);s[0]!==this.active[0]&&(s.length||(s=this.active),i=s.find(".ui-tabs-anchor")[0],this._eventHandler({target:i,currentTarget:i,preventDefault:t.noop}))},_findActive:function(e){return e===!1?t():this.tabs.eq(e)},_getIndex:function(e){return"string"==typeof e&&(e=this.anchors.index(this.anchors.filter("[href$='"+t.ui.escapeSelector(e)+"']"))),e},_destroy:function(){this.xhr&&this.xhr.abort(),this.tablist.removeAttr("role").off(this.eventNamespace),this.anchors.removeAttr("role tabIndex").removeUniqueId(),this.tabs.add(this.panels).each(function(){t.data(this,"ui-tabs-destroy")?t(this).remove():t(this).removeAttr("role tabIndex aria-live aria-busy aria-selected aria-labelledby aria-hidden aria-expanded")}),this.tabs.each(function(){var e=t(this),i=e.data("ui-tabs-aria-controls");i?e.attr("aria-controls",i).removeData("ui-tabs-aria-controls"):e.removeAttr("aria-controls")}),this.panels.show(),"content"!==this.options.heightStyle&&this.panels.css("height","")},enable:function(e){var i=this.options.disabled;i!==!1&&(void 0===e?i=!1:(e=this._getIndex(e),i=t.isArray(i)?t.map(i,function(t){return t!==e?t:null}):t.map(this.tabs,function(t,i){return i!==e?i:null})),this._setOptionDisabled(i))},disable:function(e){var i=this.options.disabled;if(i!==!0){if(void 0===e)i=!0;else{if(e=this._getIndex(e),-1!==t.inArray(e,i))return;i=t.isArray(i)?t.merge([e],i).sort():[e]}this._setOptionDisabled(i)}},load:function(e,i){e=this._getIndex(e);var s=this,n=this.tabs.eq(e),o=n.find(".ui-tabs-anchor"),a=this._getPanelForTab(n),r={tab:n,panel:a},h=function(t,e){"abort"===e&&s.panels.stop(!1,!0),s._removeClass(n,"ui-tabs-loading"),a.removeAttr("aria-busy"),t===s.xhr&&delete s.xhr};this._isLocal(o[0])||(this.xhr=t.ajax(this._ajaxSettings(o,i,r)),this.xhr&&"canceled"!==this.xhr.statusText&&(this._addClass(n,"ui-tabs-loading"),a.attr("aria-busy","true"),this.xhr.done(function(t,e,n){setTimeout(function(){a.html(t),s._trigger("load",i,r),h(n,e)},1)}).fail(function(t,e){setTimeout(function(){h(t,e)},1)})))},_ajaxSettings:function(e,i,s){var n=this;return{url:e.attr("href").replace(/#.*$/,""),beforeSend:function(e,o){return n._trigger("beforeLoad",i,t.extend({jqXHR:e,ajaxSettings:o},s))}}},_getPanelForTab:function(e){var i=t(e).attr("aria-controls");return this.element.find(this._sanitizeSelector("#"+i))}}),t.uiBackCompat!==!1&&t.widget("ui.tabs",t.ui.tabs,{_processTabs:function(){this._superApply(arguments),this._addClass(this.tabs,"ui-tab")}}),t.ui.tabs,t.widget("ui.tooltip",{version:"1.12.1",options:{classes:{"ui-tooltip":"ui-corner-all ui-widget-shadow"},content:function(){var e=t(this).attr("title")||"";return t("<a>").text(e).html()},hide:!0,items:"[title]:not([disabled])",position:{my:"left top+15",at:"left bottom",collision:"flipfit flip"},show:!0,track:!1,close:null,open:null},_addDescribedBy:function(e,i){var s=(e.attr("aria-describedby")||"").split(/\s+/);s.push(i),e.data("ui-tooltip-id",i).attr("aria-describedby",t.trim(s.join(" ")))},_removeDescribedBy:function(e){var i=e.data("ui-tooltip-id"),s=(e.attr("aria-describedby")||"").split(/\s+/),n=t.inArray(i,s);-1!==n&&s.splice(n,1),e.removeData("ui-tooltip-id"),s=t.trim(s.join(" ")),s?e.attr("aria-describedby",s):e.removeAttr("aria-describedby")},_create:function(){this._on({mouseover:"open",focusin:"open"}),this.tooltips={},this.parents={},this.liveRegion=t("<div>").attr({role:"log","aria-live":"assertive","aria-relevant":"additions"}).appendTo(this.document[0].body),this._addClass(this.liveRegion,null,"ui-helper-hidden-accessible"),this.disabledTitles=t([])},_setOption:function(e,i){var s=this;this._super(e,i),"content"===e&&t.each(this.tooltips,function(t,e){s._updateContent(e.element)})},_setOptionDisabled:function(t){this[t?"_disable":"_enable"]()},_disable:function(){var e=this;t.each(this.tooltips,function(i,s){var n=t.Event("blur");n.target=n.currentTarget=s.element[0],e.close(n,!0)}),this.disabledTitles=this.disabledTitles.add(this.element.find(this.options.items).addBack().filter(function(){var e=t(this);return e.is("[title]")?e.data("ui-tooltip-title",e.attr("title")).removeAttr("title"):void 0}))},_enable:function(){this.disabledTitles.each(function(){var e=t(this);e.data("ui-tooltip-title")&&e.attr("title",e.data("ui-tooltip-title"))}),this.disabledTitles=t([])},open:function(e){var i=this,s=t(e?e.target:this.element).closest(this.options.items);s.length&&!s.data("ui-tooltip-id")&&(s.attr("title")&&s.data("ui-tooltip-title",s.attr("title")),s.data("ui-tooltip-open",!0),e&&"mouseover"===e.type&&s.parents().each(function(){var e,s=t(this);s.data("ui-tooltip-open")&&(e=t.Event("blur"),e.target=e.currentTarget=this,i.close(e,!0)),s.attr("title")&&(s.uniqueId(),i.parents[this.id]={element:this,title:s.attr("title")},s.attr("title",""))}),this._registerCloseHandlers(e,s),this._updateContent(s,e))},_updateContent:function(t,e){var i,s=this.options.content,n=this,o=e?e.type:null;return"string"==typeof s||s.nodeType||s.jquery?this._open(e,t,s):(i=s.call(t[0],function(i){n._delay(function(){t.data("ui-tooltip-open")&&(e&&(e.type=o),this._open(e,t,i))})}),i&&this._open(e,t,i),void 0)},_open:function(e,i,s){function n(t){l.of=t,a.is(":hidden")||a.position(l)}var o,a,r,h,l=t.extend({},this.options.position);if(s){if(o=this._find(i))return o.tooltip.find(".ui-tooltip-content").html(s),void 0;i.is("[title]")&&(e&&"mouseover"===e.type?i.attr("title",""):i.removeAttr("title")),o=this._tooltip(i),a=o.tooltip,this._addDescribedBy(i,a.attr("id")),a.find(".ui-tooltip-content").html(s),this.liveRegion.children().hide(),h=t("<div>").html(a.find(".ui-tooltip-content").html()),h.removeAttr("name").find("[name]").removeAttr("name"),h.removeAttr("id").find("[id]").removeAttr("id"),h.appendTo(this.liveRegion),this.options.track&&e&&/^mouse/.test(e.type)?(this._on(this.document,{mousemove:n}),n(e)):a.position(t.extend({of:i},this.options.position)),a.hide(),this._show(a,this.options.show),this.options.track&&this.options.show&&this.options.show.delay&&(r=this.delayedShow=setInterval(function(){a.is(":visible")&&(n(l.of),clearInterval(r))},t.fx.interval)),this._trigger("open",e,{tooltip:a})}},_registerCloseHandlers:function(e,i){var s={keyup:function(e){if(e.keyCode===t.ui.keyCode.ESCAPE){var s=t.Event(e);s.currentTarget=i[0],this.close(s,!0)}}};i[0]!==this.element[0]&&(s.remove=function(){this._removeTooltip(this._find(i).tooltip)}),e&&"mouseover"!==e.type||(s.mouseleave="close"),e&&"focusin"!==e.type||(s.focusout="close"),this._on(!0,i,s)},close:function(e){var i,s=this,n=t(e?e.currentTarget:this.element),o=this._find(n);return o?(i=o.tooltip,o.closing||(clearInterval(this.delayedShow),n.data("ui-tooltip-title")&&!n.attr("title")&&n.attr("title",n.data("ui-tooltip-title")),this._removeDescribedBy(n),o.hiding=!0,i.stop(!0),this._hide(i,this.options.hide,function(){s._removeTooltip(t(this))}),n.removeData("ui-tooltip-open"),this._off(n,"mouseleave focusout keyup"),n[0]!==this.element[0]&&this._off(n,"remove"),this._off(this.document,"mousemove"),e&&"mouseleave"===e.type&&t.each(this.parents,function(e,i){t(i.element).attr("title",i.title),delete s.parents[e]}),o.closing=!0,this._trigger("close",e,{tooltip:i}),o.hiding||(o.closing=!1)),void 0):(n.removeData("ui-tooltip-open"),void 0)},_tooltip:function(e){var i=t("<div>").attr("role","tooltip"),s=t("<div>").appendTo(i),n=i.uniqueId().attr("id");return this._addClass(s,"ui-tooltip-content"),this._addClass(i,"ui-tooltip","ui-widget ui-widget-content"),i.appendTo(this._appendTo(e)),this.tooltips[n]={element:e,tooltip:i}},_find:function(t){var e=t.data("ui-tooltip-id");return e?this.tooltips[e]:null},_removeTooltip:function(t){t.remove(),delete this.tooltips[t.attr("id")]},_appendTo:function(t){var e=t.closest(".ui-front, dialog");return e.length||(e=this.document[0].body),e},_destroy:function(){var e=this;t.each(this.tooltips,function(i,s){var n=t.Event("blur"),o=s.element;n.target=n.currentTarget=o[0],e.close(n,!0),t("#"+i).remove(),o.data("ui-tooltip-title")&&(o.attr("title")||o.attr("title",o.data("ui-tooltip-title")),o.removeData("ui-tooltip-title"))}),this.liveRegion.remove()}}),t.uiBackCompat!==!1&&t.widget("ui.tooltip",t.ui.tooltip,{options:{tooltipClass:null},_tooltip:function(){var t=this._superApply(arguments);return this.options.tooltipClass&&t.tooltip.addClass(this.options.tooltipClass),t}}),t.ui.tooltip});
27
28
29/* End Include jquery-ui-1.12.1.min */
30
31/* Include cssua.min */
32var cssua=function(n,l,p){var q=/\s*([\-\w ]+)[\s\/\:]([\d_]+\b(?:[\-\._\/]\w+)*)/,r=/([\w\-\.]+[\s\/][v]?[\d_]+\b(?:[\-\._\/]\w+)*)/g,s=/\b(?:(blackberry\w*|bb10)|(rim tablet os))(?:\/(\d+\.\d+(?:\.\w+)*))?/,t=/\bsilk-accelerated=true\b/,u=/\bfluidapp\b/,v=/(\bwindows\b|\bmacintosh\b|\blinux\b|\bunix\b|\bcros\b)/,w=/(\bandroid\b|\bipad\b|\bipod\b|\bwindows phone\b|\bwpdesktop\b|\bxblwp7\b|\bzunewp7\b|\bwindows ce\b|\bblackberry\w*|\bbb10\b|\brim tablet os\b|\bmeego|\bwebos\b|\bpalm|\bsymbian|\bj2me\b|\bdocomo\b|\bpda\b|\bchtml\b|\bmidp\b|\bcldc\b|\w*?mobile\w*?|\w*?phone\w*?)/,
33ww=/\bandroid\b.*\bversion\/([0-9\.]+)\ chrome\b/,x=/(\bxbox\b|\bplaystation\b|\bnintendo\s+\w+)/,k={parse:function(b,d){var a={};d&&(a.standalone=d);b=(""+b).toLowerCase();if(!b)return a;for(var c,e,g=b.split(/[()]/),f=0,k=g.length;f<k;f++)if(f%2){var m=g[f].split(";");c=0;for(e=m.length;c<e;c++)if(q.exec(m[c])){var h=RegExp.$1.split(" ").join("_"),l=RegExp.$2;if(!a[h]||parseFloat(a[h])<parseFloat(l))a[h]=l}}else if(m=g[f].match(r))for(c=0,e=m.length;c<e;c++)h=m[c].split(/[\/\s]+/),h.length&&"mozilla"!==h[0]&&(a[h[0].split(" ").join("_")]=h.slice(1).join("-"));
34w.exec(b)?(a.mobile=RegExp.$1,s.exec(b)&&(delete a[a.mobile],a.blackberry=a.version||RegExp.$3||RegExp.$2||RegExp.$1,RegExp.$1?a.mobile="blackberry":"0.0.1"===a.version&&(a.blackberry="7.1.0.0")),ww.exec(b)&&(a.android_browser=RegExp.$1)):v.exec(b)?a.desktop=RegExp.$1:x.exec(b)&&(a.game=RegExp.$1,c=a.game.split(" ").join("_"),a.version&&!a[c]&&(a[c]=a.version));a.intel_mac_os_x?(a.mac_os_x=a.intel_mac_os_x.split("_").join("."),delete a.intel_mac_os_x):a.cpu_iphone_os?(a.ios=a.cpu_iphone_os.split("_").join("."),delete a.cpu_iphone_os):a.cpu_os?
35(a.ios=a.cpu_os.split("_").join("."),delete a.cpu_os):"iphone"!==a.mobile||a.ios||(a.ios="1");a.opera&&a.version?(a.opera=a.version,delete a.blackberry):t.exec(b)?a.silk_accelerated=!0:u.exec(b)&&(a.fluidapp=a.version);if(a.applewebkit)a.webkit=a.applewebkit,delete a.applewebkit,a.opr&&(a.opera=a.opr,delete a.opr,delete a.chrome),a.safari&&(a.chrome||a.crios||a.opera||a.silk||a.fluidapp||a.phantomjs||a.mobile&&!a.ios?delete a.safari:a.safari=a.version&&!a.rim_tablet_os?a.version:{419:"2.0.4",417:"2.0.3",
36416:"2.0.2",412:"2.0",312:"1.3",125:"1.2",85:"1.0"}[parseInt(a.safari,10)]||a.safari);else if(a.msie||a.trident)if(a.opera||(a.ie=a.msie||a.rv),delete a.msie,a.windows_phone_os)a.windows_phone=a.windows_phone_os,delete a.windows_phone_os;else{if("wpdesktop"===a.mobile||"xblwp7"===a.mobile||"zunewp7"===a.mobile)a.mobile="windows desktop",a.windows_phone=9>+a.ie?"7.0":10>+a.ie?"7.5":"8.0",delete a.windows_nt}else if(a.gecko||a.firefox)a.gecko=a.rv;a.rv&&delete a.rv;a.version&&delete a.version;return a},
37format:function(b){var d="",a;for(a in b)if(a&&b.hasOwnProperty(a)){var c=a,e=b[a],c=c.split(".").join("-"),g=" ua-"+c;if("string"===typeof e){for(var e=e.split(" ").join("_").split(".").join("-"),f=e.indexOf("-");0<f;)g+=" ua-"+c+"-"+e.substring(0,f),f=e.indexOf("-",f+1);g+=" ua-"+c+"-"+e}d+=g}return d},encode:function(b){var d="",a;for(a in b)a&&b.hasOwnProperty(a)&&(d&&(d+="\x26"),d+=encodeURIComponent(a)+"\x3d"+encodeURIComponent(b[a]));return d}};k.userAgent=k.ua=k.parse(l,p);l=k.format(k.ua)+
38" js";if(n){n.className=n.className?n.className.replace(/\bno-js\b/g,"")+l:l.substr(1);}return k}(document.documentElement,navigator.userAgent,navigator.standalone);
39
40/* End Include cssua.min */
41
42/* Include queryString */
43/** The general utility namespace. Other files can add to this. */
44var Sequiter = Sequiter || {};
45Sequiter.QueryString = Sequiter.QueryString || {};
46(function (QueryString) {
47	// Constants that are exported for unit tests
48	var CONSTANTS = {
49		// Important query string values that should be kept between pages.
50		PERSISTED_QUERY_STRING_KEYS: [
51			"code",
52			"file",
53			"l",
54			"webuser_data_id",
55			"loc",
56			"legacyESign"
57		]
58	};
59
60	/**
61	 * Gets the value of the specified key in the given queryString, optionally if decode is set to true, then the
62	 * value is decoded. If the queryString is not provided, the current page's queryString is used.
63	 * @param {string} key The key to look for in the query string.
64	 * @param {boolean?} [decode=false] If a found value should be decoded.
65	 * @param {string?} [queryString] The query string to search. If left empty uses the current page's query string.
66	 * @returns The value found, or nothing if no value is found.
67	 */
68	function GetQueryStringValue(key, decode, queryString) {
69		decode = typeof (decode) === "boolean" ? decode : false;
70		queryString = typeof (queryString) === "string" ? queryString : location.search;
71		var re = new RegExp('(?:\\?|&)' + decodeURIComponent(key) + '=(.*?)(?=&|$)', 'gi');
72		var m = re.exec(queryString);
73		if (m) return decode ? decodeURIComponent(m[1]) : m[1];
74		return;
75	}
76
77	/**
78	 * Gets additional query string parameters that should be preserved when moving between dcs pages
79	 * @param {Object} [settings] - Any settings for what to add
80	 * @param {string[]} [settings.ignoredValues=[]] - Values that normally would be persisted but shouldn't be here.
81	 * @return {string} Either a blank string if no extra parameters were specified, or a valid query string partial starting with '&'
82	 */
83	function GetPersistedQueryStringValues(settings) {
84		var set = $.extend({
85			ignoredValues: []
86		}, settings);
87
88		var persistedQString = "";
89		for (var i = 0; i < CONSTANTS.PERSISTED_QUERY_STRING_KEYS.length; ++i) {
90			if (!set.ignoredValues.some(function (val) { return val === CONSTANTS.PERSISTED_QUERY_STRING_KEYS[i]; })) {
91				var val = GetQueryStringValue(CONSTANTS.PERSISTED_QUERY_STRING_KEYS[i]);
92				if (val) persistedQString += "&" + CONSTANTS.PERSISTED_QUERY_STRING_KEYS[i] + "=" + val;
93			}
94		}
95
96		return persistedQString;
97	}
98
99	/**
100	 * Combines query strings but makes sure no keys are duplicated. 
101	 * If there are duplicated keys the values from the later strings in the array are used
102	 * @param {string[]} queryStrings The query strings to combine.
103	 * @returns The combined query string.
104	 */
105	function CombineQueryStrings(queryStrings) {
106		if (!Array.isArray(queryStrings)) return "";
107		var qStringValues = {};
108		for (var i = 0; i < queryStrings.length; ++i) {
109			var currentQString = queryStrings[i];
110			if (typeof (currentQString) === "string" && currentQString.length > 0) {
111				// If the first character is a ? or &, remove it.
112				if (currentQString[0] === "?" || currentQString[0] === "&")
113					currentQString = currentQString.substring(1);
114
115				// Split on &s and handle each value.
116				var qStringSplit = currentQString.split('&');
117				for (var j = 0; j < qStringSplit.length; ++j) {
118					var valSplit = qStringSplit[j].split('=');
119					if (valSplit.length === 2 && valSplit[0] !== '') {
120						qStringValues[valSplit[0]] = valSplit[1];
121					}
122				}
123			}
124		}
125
126		// Combine the values.
127		var combinedString = "";
128		for (var key in qStringValues) {
129			if (combinedString !== "") combinedString += "&";
130			combinedString += key + "=" + qStringValues[key];
131		}
132		return combinedString;
133	}
134
135	/**
136	 * Add persisted query string values to a url.
137	 * @param {string} url - The url to modify. It can be relative or absolute, but MUST already contain a '?' query string delimiter.
138	 * @param {Object} [settings] - Any settings for what to add
139	 * @param {string[]} [settings.ignoredValues=[]] - Values that normally would be persisted but shouldn't be here.
140	 * @returns The modified url.
141	 */
142	function AddPersistedQueryStringValuesToUrl(url, settings) {
143		if (typeof (url) === "string") {
144			var set = $.extend({
145				ignoredValues: []
146			}, settings);
147
148			var qStringStart = url.indexOf('?');
149			var beforeQString = url.substring(0, qStringStart);
150			var qString = url.substring(qStringStart + 1);
151			var combined = CombineQueryStrings([GetPersistedQueryStringValues(set), qString]);
152			return beforeQString + (combined ? "?" + combined : "");
153		}
154		return url;
155	}
156	// Add persisted query string values to the "hiddenform" form if it exists when the document is finished loading
157	document.addEventListener("DOMContentLoaded", function () {
158		if (document.forms && document.forms["hiddenform"]) {
159			var form = document.forms["hiddenform"];
160			if (typeof (form.action) === "string") {
161				form.action = AddPersistedQueryStringValuesToUrl(form.action);
162			}
163		}
164	})
165
166	// Export public members for website use.
167	$.extend(QueryString, {
168		GetQueryStringValue: GetQueryStringValue,
169		GetPersistedQueryStringValues: GetPersistedQueryStringValues,
170		CombineQueryStrings: CombineQueryStrings,
171		AddPersistedQueryStringValuesToUrl: AddPersistedQueryStringValuesToUrl
172	});
173
174	// Exports for unit testing.
175	if (typeof exports !== "undefined") {
176		exports.QueryString = QueryString;
177		exports.CONSTANTS = CONSTANTS;
178	}
179})(Sequiter.QueryString);
180/* End Include queryString */
181
182/* Include addThis */
183/* AddThis Module Code */
184function getUrlVars() {
185	var vars = {};
186	var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) {
187		vars[key] = value;
188	});
189	return vars;
190}
191
192function getLocCode(){
193	var countryCode = "";
194	var loc = getCookie("L");
195	var contentStr="";
196	if(loc && loc.length >= 2)
197		countryCode = loc.substring(0, 2).toUpperCase();
198	
199	if(countryCode === undefined || countryCode =="")
200		countryCode = getUrlVars()["loc"];
201
202	return countryCode;
203}
204
205var shareUrl = window.location.protocol +"//"+ window.location.hostname + window.location.pathname;
206if(getLocCode() != ""){
207	shareUrl+= "?loc=" + getLocCode();
208}
209
210var shareUrlFilterList = ['pid', 's_kwcid', 'gclid'];
211
212function scrollToQuestions(){
213	closeAllOpenDialogs();
214	$('html, body').animate({scrollTop: $("#wrapper").offset().top}, 750);
215}
216function hideFaqContent(){
217	$('#expFaqContent').hide();
218}
219function showFaqContent(){
220	$('#expFaqContent').show();
221}
222
223function addThisEventHandler(evt){
224	if (evt.type == 'addthis.menu.share') { 
225		upgradedModalShow('thankShareBox');
226	} else if (evt.type == 'addthis.ready'){
227	}
228}
229function upgradedModalShow(elemId){
230	$("#"+elemId).show();
231	$("#"+elemId).parent().append('<div id="modalMask" class="modalDialogGreyMask"></div>');
232	$("#modalMask").on('click', function() { upgradedModalHide(elemId); });
233	
234	/*Get the screen height and width*/
235	var maskHeight = $(document).height();
236	var maskWidth = $(window).width();
237	
238	/*Set height and width to mask to fill up the whole screen*/
239	$('#modalMask').css({'width':maskWidth,'height':maskHeight,'position':"fixed"});
240	/*Get the window height and width*/
241	var winH = $(window).height();
242	var winW = $(window).width();
243	
244	/*Set the popup window to center*/
245	$("#"+elemId).css('position', 'fixed');
246	$("#"+elemId).css('top', winH/2-$($("#"+elemId)).height()/2);
247	$("#"+elemId).css('left', winW/2-$($("#"+elemId)).width()/2);
248} 
249
250function upgradedModalHide(elemId){
251	$('#modalMask').remove();
252	$("#"+elemId).hide();
253}
254			
255function stickyScroll(){
256   if($('#scroll-wrapper').length && (!cssua.ua.mobile || !(typeof(fullMobileSupport) == "function" && fullMobileSupport()))){
257      scrollTop = $('#scroll-wrapper').offset().top-20;	
258      var y = $(this).scrollTop();
259      
260      if (y >= scrollTop && !$('html').hasClass('sm') && $('.firstPage').length) {
261        $('body').addClass('stickyFixed');
262      } else {
263        $('body').removeClass('stickyFixed');
264      }
265   }
266}
267if(typeof($) == "function")
268{
269	$(window).on("scroll", function (event) {
270		stickyScroll();
271	});
272}
273			
274/* End AddThis Module */
275
276/* End Include addThis */
277
278/* Include banner */
279/*  Truncate the username dropdown */
280function truncateUsernameDropdown() {
281	if(typeof(jQuery) != "undefined") {
282		var dropdownText = $(".account_menu .account:not(.notruncate) .username");
283		const USERNAME_OFFSET = 57;
284		for(var i=0; i<dropdownText.length; i++) {
285			if($(dropdownText[i]).is(":visible")) {
286				var username = $(dropdownText[i]).html();
287				var measure = $("<span></span>")
288					.css("display", "inline-block")
289					.css("visibility", "hidden")
290					.css("font-size", "13px")
291					.css("font-family", "Verdana,Arial,Helvetica,sans-serif")
292					.css("white-space", "nowrap")
293					.html(username)
294					.addClass("usernameMeasure")
295					.appendTo($(document.body));
296				while((measure.width() + USERNAME_OFFSET) > $(dropdownText[i]).width() && username.length > 0) {
297					username = username.substring(0, username.length - 1);
298					measure.html(username+"&hellip;");
299				}
300				$(document.body).remove(".usernameMeasure");
301				if(username != $(dropdownText[i]).html()) {
302					$(dropdownText[i]).html(username+"&hellip;");
303				}
304			}
305		}
306	}
307	else {
308		var divs = getElementsByTagAndClassName(document.getElementById('banner'), 'DIV', 'account_menu');
309		for(var i=0; i<divs.length; i++) {
310			var dds = getElementsByTagAndClassName(divs[i], 'DIV', 'account');
311			for(var j=0; j<dds.length; j++) {
312            var acctClasses = dds[j].className.split(' ');
313            if(acctClasses.indexOf('notruncate') >= 0) continue;
314				var uns = getElementsByTagAndClassName(dds[j], 'SPAN', 'username');
315				for(var k=0; k<uns.length; k++) {
316					var dropdownText = uns[k];
317					var username = dropdownText.innerHTML;
318					var measure = document.createElement('SPAN');
319					measure.style.display = "inline-block";
320					measure.style.visibility = "hidden";
321					measure.style.fontSize = "13px";
322					measure.style.fontFamily = "Verdana,Arial,Helvetica,sans-serif";
323					measure.style.whiteSpace = "nowrap";
324					measure.className = "usernameMeasure";
325					measure.innerHTML = username;
326					document.body.appendChild(measure);
327					while(measure.clientWidth >= dropdownText.clientWidth-5 && username.length > 0) {
328						username = username.substring(0, username.length - 1);
329						measure.innerHTML = username + "&hellip;";
330					}
331					document.body.removeChild(measure);
332					if(username != dropdownText.innerHTML) {
333						dropdownText.innerHTML = username + "&hellip;";
334					}
335				}
336			}
337		}
338	}
339}
340if (window.attachEvent) window.attachEvent("onload", truncateUsernameDropdown);
341else if (document.addEventListener) document.addEventListener("DOMContentLoaded", truncateUsernameDropdown, false);
342
343function submitSearch(txtSearchID) {
344   if(typeof(txtSearchID) == "undefined") txtSearchID = "txtSearch";
345	clearInitText(document.getElementById(txtSearchID));
346
347	var searchPage="searchzoom";
348	if (getServerName().search("legalcontracts.org") != -1) {searchPage="searchzoomLCO";}
349	else if (getServerName().search("legalcontracts")!=-1 ) {searchPage="searchzoomLC";}
350	else if (getServerName().search("legalcomplete")!= -1) {searchPage="searchzoomLCM";}
351	else if (getServerName().search("completelegal")!=-1) {searchPage="searchzoomCL";}
352	else if (getServerName().search("legalcontract") != -1) {searchPage="searchzoomLCT";}
353
354	var txtSearchVal = document.getElementById(txtSearchID).value.trim();
355	if(typeof(availableContracts) != "undefined" && availableContracts && document.getElementById(txtSearchID) && txtSearchVal.length >0)
356	{
357		if(txtSearchVal.length >0)
358		{
359			txtSearchVal = txtSearchVal.toLowerCase();
360			var txtSearchValFolded = foldSearchText(txtSearchVal);
361			for(var q=0;q <availableContracts.length;q++)
362			{
363				if(foldSearchText(availableContracts[q].label) == txtSearchValFolded)
364				{
365					location =availableContracts[q].value;
366					return false;
367				}
368			}
369		}
370	}
371	if(validateSearch(txtSearchID)){
372		location = "/"+searchPage+"/?zoom_per_page=10&zoom_and=0&zoom_query=" + encodeURI(txtSearchVal);
373	}
374
375}
376if(typeof($) == "function"){
377   $(function(){
378      /* Check if banner searchbar exists */
379      if ($(".search_input").length) {
380         $(".search_input").on("keydown", function(event){
381            var code = getKeyCode(event);
382            /* Intercept TAB key */
383            if (code === 9) {
384               /* If Shift + TAB pretend UP arrow hit */
385               if (event.shiftKey) {
386                  code = 38;
387               }
388               /* Else pretend DOWN arrow */
389               else {
390                  code = 40;
391               }
392            }
393         }).on("keypress", function(event) {
394            if(getKeyCode(event) == 13) { /* Enter key */
395               submitSearch($(this).attr("id"));
396               event.preventDefault();
397               event.stopPropagation();
398               return false;
399            }
400         }).on("focus", function() {
401            setFocus(this);
402            clearInitText(this);
403         }).on("blur", function() {
404            unsetFocus(this);
405            resetInitText(this);
406         });
407         $(".search_submit").on("click", function() {
408            submitSearch($(this).siblings(".search_input").attr("id"));
409         });
410		 var appendToselector =null;
411		 var intViewportWidth = window.innerWidth;
412		 var intViewportHeight = window.innerHeight;
413		 if(typeof(fluidLayout) != "undefined" && fluidLayout){
414
415			if(typeof(supportsMobile) != "undefined" && supportsMobile){
416				rE(window, "load", function(){
417				 $(".menu-container, .searchDocs .searchBox .ui-autocomplete").css({"width": parseInt($(".searchBox").outerWidth()) + "px"});
418				 $(".menu-container, .searchDocs .searchBox .ui-autocomplete").css({"max-width": parseInt($(".searchBox").outerWidth()) + "px"});
419				 });
420				 $(window).on("resize", function(){
421					$(".menu-container, .searchDocs .searchBox .ui-autocomplete").css({"width": parseInt($("#tag").outerWidth()) + "px"});
422					$(".mobileOnly #search_menu .ui-autocomplete").css({"width": parseInt($(".mobileOnly #search_menu #txtSearchMobile").outerWidth()) + "px"});
423					$(".mobileOnly #search_menu .ui-autocomplete").css({"left": "10px"});
424					$(".menu-container, .searchDocs .searchBox .ui-autocomplete").css({"max-width": parseInt($("#tag").outerWidth()) + "px"});
425				});
426				 if (intViewportWidth <= 736) {
427					appendToselector = '.mobileOnly #search_menu';
428				 }
429				 else{
430					 appendToselector = 'body';
431				 }
432			}else{
433				 appendToselector = 'body';
434			}
435		 }else{
436			if(isPhone() && (typeof(supportsMobile) != "undefined" && supportsMobile)){
437				$(window).on("resize", function(){
438					$(".searchBox .menu-container, .searchBox .ui-autocomplete").css({"width": parseInt($(".searchBox #tag").innerWidth()) + "px"});
439					$(".mobileOnly #header_search .ui-autocomplete").css({"width": parseInt($(".mobileOnly #header_search #txtSearchMobile").outerWidth()) + "px"});
440					$(".mobileOnly #header_search .ui-autocomplete").css({"left": "10px"});
441				});
442				appendToselector = '.mobileOnly #header_search';
443			 }
444			 else{
445				appendToselector = 'body';
446			 }
447		 }
448
449         var autocomplete = $(".search_input").autocomplete({
450            source: function(request, response){
451				if ($(".algolia-search").length) {
452					//ajax GET request with withCredentials set to true
453					$.ajax({
454						url: Sequiter.SiteConfig.GetConfigValue('algoliaSearchUrl'),
455						type: 'GET',
456						dataType: 'json',
457						data: {
458							query: request.term,
459							countryCode: getCookie("L"),
460						},
461						xhrFields: {
462							withCredentials: true
463						},
464						crossDomain: true,
465						success: function(algoliaResponse) {
466							let searchItems = [];
467							for(let i = 0; i < algoliaResponse.length; i++) {
468								searchItems.push({
469									label: algoliaResponse[i].productNameHighlight,
470									value: algoliaResponse[i].productUrl,
471									objectId: algoliaResponse[i].indexHitMetadata.objectId,
472									index: algoliaResponse[i].indexHitMetadata.index,
473									position: algoliaResponse[i].indexHitMetadata.position,
474									queryId: algoliaResponse[i].indexHitMetadata.queryId,
475								});
476						}
477						response(searchItems);
478						}
479					})
480				}
481				else {
482               		arr=resortContractList(request.term);
483               		response(arr);
484				}
485            },
486			minLength: ($(".algolia-search").length ? Sequiter.SiteConfig.GetConfigValue('minCharsForAutocomplete', 1) : 0),
487			delay: ($(".algolia-search").length ? 250 : 0),
488            select: function(event, ui) {
489               var selectedObj = ui.item;
490			   if ($(".algolia-search").length) {
491					$.ajax({
492						type: "POST",
493						url: Sequiter.SiteConfig.GetConfigValue('algoliaClickEventUrl'),
494						data: JSON.stringify({
495							objectId: selectedObj.objectId,
496							index: selectedObj.index,
497							position: selectedObj.position,
498							queryId: selectedObj.queryId,
499						}),
500						contentType: "application/json; charset=utf-8",
501						dataType: "json",
502						xhrFields: {
503							withCredentials: true
504						},
505					});
506				}
507               location = selectedObj.value;
508               return false;
509            },
510            open: function(event) {
511				if((typeof(fluidLayout) != "undefined" && fluidLayout) || $('#banner .navRedesignWrapper').length){
512					if($('html body, html form').hasClass('Slate')){
513						$('.ui-menu').css('overflow','auto');
514					}
515					else{
516						if($('html').hasClass('ua-desktop') && intViewportWidth > 736 ){
517							$('.ui-menu').width(Math.min(350, screen.width - 20));
518						}
519						if ($('html').hasClass('ua-desktop') && intViewportWidth > 1060) {
520							$('.membersV2body .ui-menu').width($('#txtSearch').width() + 20);
521						}
522					}
523					$('.ui-menu').position({my: "right top", at: "right bottom", of: "#" + event.target.id});
524				}else{
525					if($('html').hasClass('ua-desktop')){
526						if($('html body, html form').hasClass('Slate')){
527							var listSize = $('#txtSearch').outerWidth() - 2;
528
529								$('.ui-menu').width(listSize);
530
531						}
532
533					}
534						$('.ui-menu').position({my: "right top", at: "right bottom", of: "#" + event.target.id});
535				}
536				$('.ui-menu').addClass("search_dropdown");
537				$(".LD.ua-desktop .Slate #banner .SignInOut ul").hide();
538				if( typeof(cssua) != "undefined" && cssua.ua.ios ){
539					$('.ui-autocomplete').off('menufocus hover mouseover mouseenter');
540				}
541            } ,
542            focus:function(event,ui){
543               event.preventDefault();
544            },
545            search:function(event,ui){
546				var valueItem = $(event.target).val();
547				var newItem = $.trim(valueItem.replace(/\s+/g, ' '));
548	           	if(valueItem != newItem && event.target == event.currentTarget) {
549	              event.preventDefault();
550	              event.stopPropagation();
551	              $(event.target).autocomplete("search", newItem);
552	           	}
553					$('.ui-menu').position({my: "right top", at: "right bottom", of: "#" + event.target.id});
554			},
555			appendTo:appendToselector
556         });
557         var dataSelector = autocomplete.data("ui-autocomplete") ? "ui-autocomplete" : (autocomplete.data("autocomplete") ? "autocomplete" : null);
558			if(dataSelector) {
559				autocomplete.each(function(index, item) {
560               $(item).data(dataSelector)
561                  ._renderItem = function (ul, item) {
562                  	var newTerm = $.trim(this.term.replace(/\s+/g, ' '));
563					var newText = item.label.value;
564					if (!$(".algolia-search").length) {
565						newText = highlightSearchMatches(item.label, newTerm);
566					}
567                     return $("<li><\/li>")
568                        .data("item.autocomplete", item)
569                        .append("<a>" + newText + "<\/a>")
570                        .appendTo(ul);
571                  };
572            });
573			}
574      }
575      $('#help_top,.help_top, .countryNav').on("mouseenter", function(){
576         $('.ui-autocomplete').hide();
577      });
578      $( window ).on("resize", function() {
579      	$('.ui-autocomplete').hide();
580      });
581   });
582}
583
584async function getExperiment(experimentName, countryCode, productCode = null) {
585    const cacheKey = "foundation_experiments";
586    const foundationExperiments = JSON.parse(localStorage.getItem(cacheKey));
587    const cachedExperiment = (() => {
588        for (const experiment of foundationExperiments?.value ?? []) {
589            if (experiment.name === experimentName) {
590                return {
591                    experimentName,
592                    variationName: experiment.variation,
593                };
594            }
595        }
596
597        return undefined;
598    })();
599
600    const promise = fetch("/api/foundation/user-account-management/v1/user-experiment", {
601        method: 'POST',
602        headers: {
603            'Accept': 'application/json',
604            'Content-Type': 'application/json',
605        },
606        body: JSON.stringify({
607            countryCode,
608            experimentName,
609			productCode
610        })
611    }).then(async (response) => {
612        return response?.json()
613            .then((data) => {
614                if (data?.succeeded) {
615                    const newExperiment = { name: data.result.experimentName, variation: data.result.variationName };
616
617                    const newValue = {
618                        value: foundationExperiments?.value?.filter((e) => e.name !== newExperiment.name)?.concat([newExperiment]) ?? [newExperiment],
619                        expiryDate: foundationExperiments?.expiryDate ?? (() => {
620                            const date = new Date();
621                            date.setMonth(date.getMonth() + 1);
622                            return date;
623                        })()
624                    };
625
626                    localStorage.setItem(cacheKey, JSON.stringify(newValue));
627
628                    return data.result;
629                } else {
630                    return undefined;
631                }
632            });
633    });
634
635    if (cachedExperiment) {
636        return cachedExperiment;
637    }
638
639    return promise;
640}
641
642function getCountryCode() {
643    const location = getCookie("L");
644    if (!location) {
645        return undefined;
646    }
647
648    return location.length >= 2 ? location.slice(0, 2).toUpperCase() : undefined;
649}
650
651function getSiteFamily() {
652    return Sequiter.SiteConfig.GetConfigValue("site_family", "").toString();
653}
654
655let useSearchPrioritization = null;
656let _promise = null;
657async function getSearchPrioritizationExperiment() {
658    if (useSearchPrioritization !== null) {
659        return useSearchPrioritization;
660    }
661    if (_promise) {
662        return _promise;
663    }
664
665    const siteFamily = getSiteFamily();
666    const countryCode = getCountryCode();
667    if (countryCode !== "CA" || siteFamily !== "LawDepot") {
668        useSearchPrioritization = false;
669        return useSearchPrioritization;
670    }
671
672    _promise = getExperiment("PL_SearchWeighting_LD_CA_25_09", "CA");
673    const exp = await _promise.finally(() => {
674        _promise = null;
675    });
676
677    useSearchPrioritization = exp?.variationName === "N";
678    return useSearchPrioritization;
679}
680
681/* Fold a string for search comparisons: strip diacritics (NFD combining marks) and
682   soft hyphens, then lowercase. Every search comparison must fold BOTH sides or
683   accented product names stop matching unaccented input (AB-179591). */
684function foldSearchText(str) {
685	if (typeof str !== "string") return "";
686	if (typeof str.normalize === "function") {
687		str = str.normalize("NFD").replace(/[\u0300-\u036f]/g, "");
688	}
689	return str.replace(/\u00AD/g, "").toLowerCase();
690}
691
692/* Wrap every accent-insensitive match of term inside displayText with the
693   autocomplete highlight span. Index mapping is only safe while folding keeps the
694   string length unchanged (soft hyphens are stripped from the display copy first);
695   otherwise the text is returned unhighlighted. */
696function highlightSearchMatches(displayText, term) {
697	displayText = String(displayText).replace(/\u00AD/g, "");
698	var foldedText = foldSearchText(displayText);
699	var foldedTerm = foldSearchText(term);
700	if (foldedTerm.length === 0 || foldedText.length !== displayText.length) {
701		return displayText;
702	}
703	var ret = "";
704	var pos = 0;
705	var idx = foldedText.indexOf(foldedTerm, pos);
706	while (idx !== -1) {
707		ret += displayText.substring(pos, idx) + "<span class='ui-state-highlight'>" + displayText.substring(idx, idx + foldedTerm.length) + "<\/span>";
708		pos = idx + foldedTerm.length;
709		idx = foldedText.indexOf(foldedTerm, pos);
710	}
711	return ret + displayText.substring(pos);
712}
713
714function resortContractList(sTerm, searchPrioritization){
715	if(typeof(availableContracts) != "undefined") {
716		var contArr = availableContracts.slice(0);
717		var sTermFolded = foldSearchText(sTerm);
718		var specialVals = new Array();
719        var specialTerms = new Array();
720
721		/* Add temporary tracking code for number of search result queries. - Chris Poirier - Nov 16, 2022 */
722		submitInternalEventV2("search", "autocomplete", "query", sTerm, 1);
723
724		/* move terms that start to the front of the list */
725        if (searchPrioritization) {
726            for(i=0;i<contArr.length;i++){
727                if(contArr[i].terms.some((t) => foldSearchText(t).substring(0,sTermFolded.length) === sTermFolded)){
728                    specialTerms.push(contArr[i]);
729                    contArr.splice(i,1);
730                    i--;
731                }
732                else if(foldSearchText(contArr[i].label).substring(0,sTermFolded.length) === sTermFolded){
733                    specialVals.push(contArr[i]);
734                    contArr.splice(i,1);
735                    i--;
736                }
737            }
738            for(i=(specialVals.length-1);i>=0;i--){
739                contArr.unshift(specialVals[i]);
740            }
741            for(i=(specialTerms.length-1);i>=0;i--){
742                contArr.unshift(specialTerms[i]);
743            }
744        } else {
745            for(i=0;i<contArr.length;i++){
746                if(foldSearchText(contArr[i].label).substring(0,sTermFolded.length) === sTermFolded){
747                    specialVals.push(contArr[i]);
748                    contArr.splice(i,1);
749                    i--;
750                }
751            }
752            for(i=(specialVals.length-1);i>=0;i--){
753                contArr.unshift(specialVals[i]);
754            }
755        }
756
757        var productNamesAlreadyAdded = [];
758
759        if (searchPrioritization) {
760            return $.grep(contArr, function (value) {
761                if (foldSearchText(value.label || value.value || value).indexOf(sTermFolded) !== -1 || (value.terms && value.terms.some((term) => foldSearchText(term).substring(0,sTermFolded.length) === sTermFolded))) {
762                    //Check to make sure product names are not duplicated in the list
763                    if (productNamesAlreadyAdded.indexOf(value.label) === -1) {
764                        productNamesAlreadyAdded.push(value.label);
765                        return true;
766                    }
767                }
768                return false;
769            });
770        }
771
772        return $.grep(contArr, function (value) {
773            if (foldSearchText(value.label || value.value || value).indexOf(sTermFolded) !== -1) {
774                //Check to make sure product names are not duplicated in the list
775                if (productNamesAlreadyAdded.indexOf(value.label) === -1) {
776                    productNamesAlreadyAdded.push(value.label);
777                    return true;
778                }
779            }
780            return false;
781        });
782	}
783}
784function clearInitText(textbox) {
785   if(!textbox) return;
786	var classes = textbox.className ? textbox.className.split(' ') : [];
787	var newClass = '';
788	for(var i=0; i<classes.length; i++) {
789		if(classes[i] == 'init') {
790			textbox.setAttribute('data-inittext', textbox.value);
791			textbox.value = '';
792		}
793		else {
794			newClass += ' '+classes[i];
795		}
796	}
797	textbox.className = newClass;
798}
799function resetInitText(textbox) {
800   if(!textbox) return;
801	if(textbox.value == '') {
802		textbox.value = textbox.getAttribute('data-inittext');
803		textbox.className += ' init';
804	}
805}
806function setFocus(element) {
807   if(!element) return;
808	element.className += " focus";
809}
810function unsetFocus(element) {
811   if(!element) return;
812	var classes = element.className ? element.className.split(' ') : [];
813	var newClass = '';
814	for(var i=0; i<classes.length; i++) {
815		if(classes[i] != 'focus') {
816			newClass += ' '+classes[i];
817		}
818	}
819	element.className = newClass;
820}
821/* Enable the banner search once the page has loaded. */
822function enableTxtSearch() {
823   if(typeof($) == "function"){
824      $(".search_input").prop("disabled", false);
825   }
826   else if(document.getElementById("txtSearch")) {
827		document.getElementById("txtSearch").removeAttribute("disabled");
828	}
829}
830rE(window, "load", enableTxtSearch);
831
832/*Set hover for banner Help, Country and Account
833	CSS hover gives problem in mobile device*/
834function setupBannerHovers() {
835	if(!cssua.ua.mobile){
836		$("#banner .help").on("mouseenter", function(){
837			$("#banner .help ul").css("display","block");
838		}).on("mouseleave", function(){
839			$("#banner .help ul").css("display","none");
840		});
841
842		$("#banner .mydocuments").on("mouseenter", function(){
843			$("#banner .mydocuments ul").css("display","block");
844		}).on("mouseleave", function(){
845			$("#banner .mydocuments ul").css("display","none");
846		});
847
848		$("#banner .select_country").on("mouseenter", function(){
849			$("#banner .select_country .countryNavInner ul").css("display","block");
850		}).on("mouseleave", function(){
851			$("#banner .select_country .countryNavInner ul").css("display","none");
852		});
853
854		$(".countryNavInner li, .countryNavInner a").on("click", function() {
855			$(".countryNavInner ul").css("display","none");
856		});
857
858		$("#banner .account").on("mouseenter", function(){
859			$("#banner .account ul").css("display","block");
860		}).on("mouseleave", function(){
861			if($(this).find(".tour-ed").hasClass("tour-step-backdrop")){
862				return false;
863			}
864			$("#banner .account ul").css("display","none");
865		});
866	}
867}
868if(typeof($) == "function"){
869	$(setupBannerHovers);
870}
871else{
872	rE(window, "load", setupBannerHovers);
873}
874/*End Set hover for banner Help, Country and Account*/
875/*Validates the search input*/
876function validateSearch(txtSearchID){
877   if(!$("#"+txtSearchID).length) return true;
878
879	var searchInput = $("#"+txtSearchID).val().trim();
880	if(searchInput.search("@") >= 0){
881      alert("You\'ve entered an invalid character. Please try again or <a class=\'alertSignIn\' href=\'/SignIn/\'>sign in to your account</a>.", {title: "Error"});
882      return false;
883	}
884		return true;
885	}
886
887
888$( window ).on("resize", function() {
889	if($("form.Slate,body.Slate").length > 0){
890	if($("body").is(".menuOpen, .searchOpen")){
891		var wrapperHeightPotrait
892		if($('.Slate #banner .mobileOnly').css('display') == 'block'){
893
894			if($( "body" ).hasClass( "searchOpen" )){
895				var searchBannerHeight = $("#bannerSearchWrapper").height() + 250;
896				$("#wrapper").css({
897				    'height': searchBannerHeight+'px',
898				});
899			}
900			else{
901				var menuHeight = $("#banner").height() + $("#banner #bannerNavContents").height();
902			    $("#wrapper").css({
903				    'height': menuHeight+'px',
904				});
905			}
906				if( $( "body" ).hasClass("SlateDesktop") ) {
907					$( "body" ).removeClass("SlateDesktop");
908				}
909		}
910		else{
911		    $("#wrapper").css({
912		       'height': ''
913		    });
914			    $( "body" ).addClass("SlateDesktop");
915		}
916	}
917	}
918});
919
920function hideFloatingChat() {
921    const chatContainer = document.getElementById('chatFloatContainer');
922	const minimizeBtn = document.getElementById('minimizeBtn');
923
924    if (chatContainer) {
925        chatContainer.style.display = 'none';
926		minimizeBtn.style.display = 'none';
927    }
928}
929
930function showFloatingChat() {
931    const chatContainer = document.getElementById('chatFloatContainer');
932    const minimizeBtn = document.getElementById('minimizeBtn');
933
934    if (chatContainer) {
935        chatContainer.style.display = 'flex';
936        minimizeBtn.style.display = 'flex';
937    }
938}
939
940
941function openLiveHelp(liveHelpUrl){
942     window.open(liveHelpUrl, 'unique', 'scrollbars=no,menubar=no,resizable=0,location=no,screenX=50,screenY=100,width=460,height=750');
943}
944
945function openLiveChat(five9URL, five9IntegrationId, five9ChatDeploymentId){
946  // Check if script already exists (prevents multiple loads)
947  if (!window.F9 || !window.F9.Chat) {
948    initializeFive9Script(five9URL, five9IntegrationId, five9ChatDeploymentId);
949  } else {
950    window.F9.Chat.Wrapper.init({
951      cdn: "prod",
952      integrationId: five9IntegrationId,
953      chatDeploymentId: five9ChatDeploymentId,
954    });
955	showFloatingChat();
956  }
957}
958
959function initializeFive9Script(five9URL, five9IntegrationId, five9ChatDeploymentId) {
960	const script = document.createElement("script");
961    script.src = five9URL;
962    script.async = true;
963
964    script.onload = function () {
965      window.F9.Chat.Wrapper.init({
966        cdn: "prod",
967        integrationId: five9IntegrationId,
968        chatDeploymentId: five9ChatDeploymentId,
969      });
970	  showFloatingChat();
971    };
972
973    document.head.appendChild(script);
974}
975
976/* Chrome ignore the autocomplete attribute, initializing the value to some random string, will disable autocomplete */
977$(function() {
978	if(cssua.ua.chrome || cssua.ua.webkit) $('#txtSearch').attr('autocomplete', 'site-search');
979});
980
981function toggleRecentDocument(config)
982{
983	var timeout = (config && config.action && config.action =='show' ? 2000:0);
984	setTimeout(function()
985	{
986		if(!config)
987			config = new Object();
988		else if(!config.action)
989			config.action ='hide';
990
991		if (!config.id){
992			config.id = 'most_recent_doc';
993		}
994
995		if($('#' + config.id).length >0)
996		{
997			if(config.action =='show')
998			{
999				$('#' + config.id).slideDown('slow');
1000			}
1001			else
1002			{
1003				$('#' + config.id).slideUp('slow');
1004			}
1005		}
1006	},timeout);
1007}
1008toggleRecentDocument({id: "woahBarUpsell", action: "show"});
1009
1010function closeWoahBar(){
1011	markWoahBarAsClosed();
1012	toggleRecentDocument({id: "woahBarUpsell", action: "hide"});
1013}
1014
1015function markWoahBarAsClosed() {
1016	setCookie("wasWoahBarClosed","true");
1017}
1018
1019$(document).ready(function() {
1020    $(".woahBarLink.largeProceedButton").on("click",function() {
1021		markWoahBarAsClosed();
1022    });
1023});
1024
1025
1026/* End Include banner */
1027
1028/* Include tracking */
1029
1030var productLists = { 'ACTWAIVMUQESIGN':{'ACTWAIV':'','ESIGN':''},'ALLACCESS':{'AOEXEC':'','CPROXY':'','ASSIGN':'','GPRTAS':'','ITMASS':'','ITNASS':'','MPRTNR':'','BOS':'','CINCUM':'','CPEXEC':'','COHAB':'','COMLSE':'','COMPEN':'','RSUBCM':'','CONFID':'','CONSNT':'','CCONDR':'','RCNSTA':'','RCNSTS':'','GDEMND':'','CDRRES':'','EMPEVL':'','EMPLOY':'','REQUIP':'','CAMEND':'','GTERM':'','LGUART':'','HEALTH':'','CINCRP':'','RINSPR':'','GJTVTR':'','RAMEND':'','RASSIG':'','BLOAN':'','NOTICE':'','OFFER':'','GPRTNR':'','GPRTAM':'','GPRTWT':'','MPERFR':'','RPPPTY':'','PWRATT':'','PRENUP':'','PROMIS':'','SQUIT':'','SREALT':'','RELEAS':'','RESLSE':'','RRAPP':'','RSUBRS':'','ROOMAG':'','SALES':'','SERVAG':'','CSHLDR':'','CSHLN':'','CSHPUR':'','CSHREP':'','CSHRES':'','CSHSUB':'','TERM':'','SWDEED':'','WILL':'','BDTRUS':'','BMORT':'','BMORTS':'','BDRECN':'','CBUSPS':'','CBYLAW':'','CMBRIN':'','CODICL':'','GFINST':'','ISWLIC':'','RCRAPP':'','RMOTVH':'','ROFFLE':'','MRECOR':'','SINVCE':'','LETINT':'','SPORDR':'','SSURVD':'','SOFFPU':'','BCDEED':'','CSHAPP':'','SEPAGR':'','REVPOA':'','MDCNST':'','PRIEMP':'','NOTUKC':'','CEASE':'','LLCOPR':'','AMSCHD':'','GFDEED':'','SRVCAT':'','SRVCHL':'','SRVCLN':'','SRVCMP':'','SRVCON':'','MODRLS':'','CINCDM':'','CINCIM':'','CINCSM':'','NOTUKR':'','MEDRLS':'','PETAGR':'','BUSPLN':'','INDEMN':'','EMPWRN':'','LLCAOO':'','AFFGEN':'','LIVTRS':'','COMPLT':'','SRVIC':'','NONDIS':'','NOTTEN':'','RESUME':'','CONFIDQC':'','PWRATTQC':'','EMPLOYQC':'','SEPAGRQC':'','BOSQC':'','PROMISQC':'','RENTRECPT':'','ENTERNOTICE':'','SRVWRK':'','RESIGN':'','REFLIST':'','CSHMIN':'','RECOMM':'','COVER':'','ENDPLN':'','NONCOM':'','CARRECEIPT':'','SALESRECEIPT':'','POWILL':'','GMBH':'','UG':'','CHVIST':'','NOTCOM':'','SHRLST':'','DRCTOR':'','CONPUR':'','PCARE':'','MANDPROTQC':'','MINIAV':'','BFAV':'','NONDISQC':'','SERVAGQC':'','SRVICQC':'','JICASE':'','SRVCONQC':'','RINSPRQC':'','RENTINC':'','WILLQC':'','CONSNTQC':'','RESLSEWHG':'','BLOANQC':'','COMLSEQC':'','ROOMAGQC':'','GDEMNDQC':'','RESLSEEINL':'','COHABQC':'','PRENUPQC':'','AFFGENQC':'','MIDIAV':'','VOLLAV':'','TEILAV':'','RESLSEZI':'','RSUBRSQC':'','PARENTALQC':'','RESLSEHAUS':'','PRIVACYQC':'','TERMSQC':'','RSUBCMQC':'','SALESQC':'','KUENNE':'','ESTATEBUNDLE':'','RESLSESUB':'','PROPSL':'','SEASONALQC':'','DIMGLIC':'','EMPLAN':'','MECHLIEN':'','KUENGE':'','LWILLDE':'','LIENRLS':'','PRIVACY':'','IMAGEQC':'','BRANDQC':'','CPYRGHTQC':'','POSTNUP':'','ENDLSEQC':'','TERMS':'','GVOLLM':'','DATAPROT':'','SINGLEWILL':'','RESLSEFEWO':'','VOLLM':'','PWRATTCHILD':'','VORSORGEDE':'','2UQRRAPP':'','BERLINWILL':'','BCARTS':'','WILLDE':'','HANDVOLLM':'','OFFICELSEDE':'','PROXYDE':'','MUTUALTERMEMPLOYDE':'','WEBSITEQC':'','SEPAGRDE':'','ACTWAIV':'','1PBUSPLN':'','SORGEDE':'','CSHLDRQC':'','BANKVOLLM':'','IMPRESSUM':'','AFFGENDE':'','RESLSESP':'','BOSSP':'','PROMISSP':'','BLOANSP':'','SERVAGSP':'','SRVCLNSP':'','SRVCATSP':'','SRVCHLSP':'','SRVICSP':'','SRVCMPSP':'','SRVCONSP':'','WILLSP':'','NONDISSP':'','MARRIAGEDE':'','HANDELLSEDE':'','MDCNSTSP':'','CONFIDSP':'','RAMENDQC':'','EMPLOYHANDBOOK':'','MUTUALTERMEMPLOYQC':'','NOTICESP':'','EMPLOYSP':'','ONEMBRLLCOPR':'','RAMENDSP':'','VISALETTER':'','SALESSP':'','GFDEEDDE':'','COMLSEDE':'','PWRATTSP':'','NEWHIRE':'','REQUIPSP':'','SWOT':'','RSKMGT':'','LETINTQC':'','RESIGNQC':'','REGAG'
1030:'','RENTGUARTDE':'','EMPLOYPROOFDE':'','SHORTRESLSE':'','LICENSE':'','MEDRSLSDE':'','ARTICLESGBRDE':'','SOCMEDPOL':'','AFFMARRIAGE':'','REFERRAL':'','MARKETINGCNT':'','INFLUENCERCNT':'','ESTPLNES':'','VISALETTERDE':'','VENDORCNT':'','CONSIGNAGMT':'','REMOTEWRKPOL':'','TRAVELDE':'','EMPLOYREMOTDE':'','TUTORCNT':'','DSCPLNPOL':'','ASSIGNCOPYRIGHT':'','EVENTCNT':'','PROOFINCOME':'','ARTICLESeGBRDE':'','COMMNAGMT':'','SERVTHRPY':'','TODDEED':'','BUSPLNSP':'','BUSPLNES':'','RESTPLNES':'','HARASSMENTPOL':'','PACHTLSEDE':'','LAWYER':'','AIASSISTANT':'','VOLRESIGNSP':'','AFFGENSP':'','CAREDIRECTIVEDE':'','LETINTSP':'','ARTICLESASSOCDE':'','SEPAGRSP':'','RFP':'','CONSNTSP':'','GPRTNRSP':'','AFFRESIDENCY':'','AFFHEIRSHIP':'','SREALTSP':'','EMPLOYWARNINGDE':'','AFFCORRECT':'','RRAPPSP':'','CANCELDE':'','CSHPURQC':'','PRODUCTIONCNT':'','RECOMMDE':'','RECOMMSP':'','COMLSESP':'','BUSPLNDE':'','LETINTDE':'','INTERNSHIPDE':'','ESIGN':'','BOSVEHDE':'','INCORGEN':'','TRMREG':'','BUSPLNQC':'','USFORM':'','SALESVEHSP':'','WRKINR':'','DEBTSETTLE':'','OFFERQC':'','BTHPLN':'','RESLSEWHGNEUBAUAT':'','RENTINCSP':'','GDEMNDSP':'','CHURCHWITHDRAWDE':'','COVERSP':'','PROBTERMQC':'','STARTUPCALC':'','HOABMT':'','RESLSEWHGABGBAT':'','RENTRECPTSP':'','MAINTREQUEST':''},'ALLLAW':{'AOEXEC':'','CPROXY':'','ASSIGN':'','GPRTAS':'','ITMASS':'','ITNASS':'','MPRTNR':'','BOS':'','CINCUM':'','CPEXEC':'','COHAB':'','COMLSE':'','COMPEN':'','RSUBCM':'','CONFID':'','CONSNT':'','CCONDR':'','RCNSTA':'','RCNSTS':'','GDEMND':'','CDRRES':'','EMPEVL':'','EMPLOY':'','REQUIP':'','CAMEND':'','GTERM':'','LGUART':'','HEALTH':'','CINCRP':'','RINSPR':'','GJTVTR':'','RAMEND':'','RASSIG':'','BLOAN':'','NOTICE':'','OFFER':'','GPRTNR':'','GPRTAM':'','GPRTWT':'','MPERFR':'','RPPPTY':'','PWRATT':'','PRENUP':'','PROMIS':'','SQUIT':'','SREALT':'','RELEAS':'','RESLSE':'','RRAPP':'','RSUBRS':'','ROOMAG':'','SALES':'','SERVAG':'','CSHLDR':'','CSHLN':'','CSHPUR':'','CSHREP':'','CSHRES':'','CSHSUB':'','TERM':'','SWDEED':'','WILL':'','COMLSI':'','RESLSI':'','SALEI':'','AFFIDF':'','BDTRUS':'','BMORT':'','BMORTS':'','BDRECN':'','CBUSPS':'','CBYLAW':'','CLLC':'','CMBRIN':'','CODICL':'','GFINST':'','COPAPP':'','ICRASS':'','IPTASS':'','IPTSAL':'','ISWLIC':'','ITMLIC':'','ITNSAL':'','PARDON':'','RCRAPP':'','RLDLSE':'','RLTOWN':'','RMOTVH':'','ROFFLE':'','RRULES':'','MRECOR':'','SCLAIM':'','SINVCE':'','LETINT':'','SPORDR':'','SSURVD':'','STRNFR':'','SOFFPU':'','TRDMRK':'','BCDEED':'','AFF864':'','CSHAPP':'','SEPAGR':'','REVPOA':'','MDCNST':'','PRIEMP':'','NOTUKC':'','CEASE':'','LLCOPR':'','AMSCHD':'','GFDEED':'','SRVCAT':'','SRVCHL':'','SRVCLN':'','SRVCMP':'','SRVCON':'','MODRLS':'','CINCDM':'','CINCIM':'','CINCSM':'','NOTUKR':'','MEDRLS':'','PETAGR':'','BUSPLN':'','INDEMN':'','EMPWRN':'','LLCAOO':'','AFFGEN':'','LIVTRS':'','COMPLT':'','SRVIC':'','NONDIS':'','NOTTEN':'','RESUME':'','CONFIDQC':'','PWRATTQC':'','EMPLOYQC':'','SEPAGRQC':'','BOSQC':'','PROMISQC':'','PACS':'','SARL':'','RENTRECPT':'','ENTERNOTICE':'','SRVWRK':'','RESIGN':'','REFLIST':'','CSHMIN':'','RECOMM':'','COVER':'','ENDPLN':'','NONCOM':'','CARRECEIPT':'','SALESRECEIPT':'','POWILL':'','GMBH':'','UG':'','CHVIST':'','NOTCOM':'','SHRLST':'','DRCTOR':'','CONPUR':'','PCARE':'','MANDPROTQC':'','MINIAV':'','BFAV':'','NONDISQC':'','SERVAGQC':'','SRVICQC':'','JICASE':'','SRVCONQC':'','RINSPRQC':'','RENTINC':'','WILLQC':'','CONSNTQC':'','RESLSEWHG':'','BLOANQC':'','COMLSEQC':'','ROOMAGQC':'','GDEMNDQC':'','RESLSEEINL':'','COHABQC':'','PRENUPQC':'','AFFGENQC':'','MIDIAV':'','VOLLAV':'','TEILAV':'','RESLSEZI':'','RSUBRSQC':'','PARENTALQC':'','RESLSEHAUS':'','PRIVACYQC':'','TERMSQC':'','RSUBCMQC':'','SALESQC':'','KUENNE':'','ESTATEBUNDLE':'','RESLSESUB':'','PROPSL':'','SEASONALQC':'','DIMGLIC':'','EMPLAN':'','EURLRESQC':'','BUSINTROQC':'','MECHLIEN':'','SARLRESQC':'','KUENGE':'','SCIQC':'','LWILLDE':'','LIENRLS':'','SASUQC':'','PRIVACY':'','IMAGEQC':'','BRANDQC':'','CPYRGHTQC':'','POSTNUP':'','DISTRAGQC':'','ENDLSEQC':'','TERMS':'','GVOLLM':'','DATAPROT':'','SINGLEWILL':'','STATUTSQC':'','RESLSEFEWO':'','VOLLM':'','ASNRESQC':'','PWRATTCHILD':'','VORSORGEDE':'','2UQRRAPP':'','BERLINWILL':'','BCARTS':'','BENEFITQC':'','WILLDE':'','HANDVOLLM':'','OFFICELSEDE':'','PROXYDE':'','MUTUALTERMEMPLOYDE':'','WEBSITEQC':'','SEPAGRDE':'','ASNQC':'','ACTWAIV':'','1PBUSPLN':'','SORGEDE':'','CSHLDRQC':'','PROFLSEQC':'','BANKVOLLM':'','IMPRESSUM':'','CONDOQC':'','AFFGENDE':'','RESLSESP':'','BOSSP':'','PROMISSP':'','BLOANSP':'','SERVAGSP':'','SRVCLNSP':'','SRVCATSP':'','SRVCHLSP':'','SRVICSP':'','SRVCMPSP':'','SRVCONSP':'','WILLSP':'','NONDISSP':'','MARRIAGEDE':'','HANDELLSEDE':'','MDCNSTSP':'','CONFIDSP':'','RAMENDQC':'','EMPLOYHANDBOOK':'','MUTUALTERMEMPLOYQC':'','NOTICESP':'','EMPLOYSP':'','ONEMBRLLCOPR':'','RAMENDSP':'','VISALETTER':'','SALESSP':'','GFDEEDDE':'','COMLSEDE':'','PWRATTSP':'','NEWHIRE':'','REQUIPSP':'','SWOT':'','RSKMGT':'','LETINTQC':'','RESIGNQC':'','REGAG'
1030:'','RENTGUARTDE':'','RESLSEWHGAT':'','EMPLOYPROOFDE':'','SHORTRESLSE':'','LICENSE':'','MEDRSLSDE':'','ARTICLESGBRDE':'','SOCMEDPOL':'','AFFMARRIAGE':'','REFERRAL':'','MARKETINGCNT':'','INFLUENCERCNT':'','ESTPLNES':'','VISALETTERDE':'','VENDORCNT':'','CONSIGNAGMT':'','REMOTEWRKPOL':'','TRAVELDE':'','EMPLOYREMOTDE':'','TUTORCNT':'','DSCPLNPOL':'','ASSIGNCOPYRIGHT':'','EVENTCNT':'','PROOFINCOME':'','ARTICLESeGBRDE':'','BERLINWILLAT':'','COMMNAGMT':'','EARNESTSP':'','SERVTHRPY':'','TODDEED':'','BUSPLNSP':'','BUSPLNES':'','RESTPLNES':'','SINGLEWILLAT':'','HARASSMENTPOL':'','PACHTLSEDE':'','LAWYER':'','AIASSISTANT':'','VOLRESIGNSP':'','AFFGENSP':'','CAREDIRECTIVEDE':'','LETINTSP':'','ARTICLESASSOCDE':'','SEPAGRSP':'','WILLAT':'','RFP':'','CONSNTSP':'','GPRTNRSP':'','AFFRESIDENCY':'','AFFHEIRSHIP':'','SREALTSP':'','RASSIGQC':'','EMPLOYWARNINGDE':'','AFFCORRECT':'','RRAPPSP':'','CANCELDE':'','CSHPURQC':'','PRODUCTIONCNT':'','RECOMMDE':'','RECOMMSP':'','COMLSESP':'','BUSPLNDE':'','LETINTDE':'','RESLSEWHGALTBAUAT':'','INTERNSHIPDE':'','ESIGN':'','BOSVEHDE':'','INCORGEN':'','TRMREG':'','BUSPLNQC':'','USFORM':'','SALESVEHSP':'','WRKINR':'','DEBTSETTLE':'','OFFERQC':'','BTHPLN':'','RESLSEWHGNEUBAUAT':'','RENTINCSP':'','GDEMNDSP':'','CHURCHWITHDRAWDE':'','COVERSP':'','PROBTERMQC':'','STARTUPCALC':'','HOABMT':'','RESLSEWHGABGBAT':'','RENTRECPTSP':'','MAINTREQUEST':''},'BUSPLNES':{'CPROXY':'','ASSIGN':'','GPRTAS':'','ITMASS':'','ITNASS':'','MPRTNR':'','BOS':'','CINCUM':'','COMPEN':'','CONFID':'','CCONDR':'','GDEMND':'','CDRRES':'','EMPEVL':'','EMPLOY':'','GTERM':'','LGUART':'','CINCRP':'','GJTVTR':'','BLOAN':'','OFFER':'','GPRTNR':'','GPRTAM':'','GPRTWT':'','MPERFR':'','PROMIS':'','SALES':'','SERVAG':'','CSHLDR':'','CSHLN':'','CSHPUR':'','CSHREP':'','CSHRES':'','CSHSUB':'','TERM':'','BMORT':'','BMORTS':'','CBUSPS':'','CBYLAW':'','CMBRIN':'','GFINST':'','ISWLIC':'','MRECOR':'','SINVCE':'','LETINT':'','CSHAPP':'','PRIEMP':'','CEASE':'','LLCOPR':'','AMSCHD':'','SRVCAT':'','SRVCHL':'','SRVCLN':'','SRVCMP':'','SRVCON':'','MODRLS':'','CINCDM':'','CINCIM':'','CINCSM':'','BUSPLN':'','INDEMN':'','EMPWRN':'','LLCAOO':'','COMPLT':'','SRVIC':'','NONDIS':'','RESUME':'','CONFIDQC':'','EMPLOYQC':'','SEPAGRQC':'','BOSQC':'','PROMISQC':'','SRVWRK':'','RESIGN':'','REFLIST':'','CSHMIN':'','RECOMM':'','COVER':'','NONCOM':'','GMBH':'','UG':'','SHRLST':'','DRCTOR':'','MINIAV':'','BFAV':'','NONDISQC':'','SERVAGQC':'','SRVICQC':'','SRVCONQC':'','BLOANQC':'','GDEMNDQC':'','MIDIAV':'','VOLLAV':'','TEILAV':'','PRIVACYQC':'','TERMSQC':'','SALESQC':'','KUENNE':'','PROPSL':'','DIMGLIC':'','MECHLIEN':'','KUENGE':'','LIENRLS':'','PRIVACY':'','IMAGEQC':'','BRANDQC':'','CPYRGHTQC':'','TERMS':'','DATAPROT':'','BCARTS':'','HANDVOLLM':'','PROXYDE':'','MUTUALTERMEMPLOYDE':'','WEBSITEQC':'','ACTWAIV':'','1PBUSPLN':'','CSHLDRQC':'','IMPRESSUM':'','AFFGENDE':'','BOSSP':'','PROMISSP':'','BLOANSP':'','SERVAGSP':'','SRVCLNSP':'','SRVCATSP':'','SRVCHLSP':'','SRVICSP':'','SRVCMPSP':'','SRVCONSP':'','NONDISSP':'','CONFIDSP':'','EMPLOYHANDBOOK':'','MUTUALTERMEMPLOYQC':'','EMPLOYSP':'','ONEMBRLLCOPR':'','SALESSP':'','NEWHIRE':'','SWOT':'','RSKMGT':'','RESIGNQC':'','EMPLOYPROOFDE':'','LICENSE':'','MEDRSLSDE':'','ARTICLESGBRDE':'','SOCMEDPOL':'','REFERRAL':'','MARKETINGCNT':'','INFLUENCERCNT':'','VISALETTERDE':'','VENDORCNT':'','CONSIGNAGMT':'','REMOTEWRKPOL':'','EMPLOYREMOTDE':'','TUTORCNT':'','DSCPLNPOL':'','ASSIGNCOPYRIGHT':'','EVENTCNT':'','PROOFINCOME':'','ARTICLESeGBRDE':'','COMMNAGMT':'','SERVTHRPY':'','BUSPLNSP':'','HARASSMENTPOL':'','VOLRESIGNSP':'','LETINTSP':'','ARTICLESASSOCDE':'','RFP':'','GPRTNRSP':'','EMPLOYWARNINGDE':'','AFFCORRECT':'','CANCELDE':'','CSHPURQC':'','PRODUCTIONCNT':'','RECOMMDE':'','RECOMMSP':'','BUSPLNDE':'','LETINTDE':'','INTERNSHIPDE':'','BOSVEHDE':'','SALESVEHSP':'','WRKINR':'','DEBTSETTLE':'','CHURCHWITHDRAWDE':'','COVERSP':'','STARTUPCALC':''},'ESTATEBUNDLE':{'HEALTH':'','PWRATT':'','WILL':'','LIVTRS':'','ENDPLN':'','POWILL':'','PCARE':'','JICASE':''},'ESTPLNES':{'AOEXEC':'','CPEXEC':'','COHAB':'','CONSNT':'','CAMEND':'','HEALTH':'','PWRATT':'','PRENUP':'','WILL':'','CODICL':'','SEPAGR':'','REVPOA':'','MDCNST':'','GFDEED':'','MEDRLS':'','PETAGR':'','AFFGEN':'','LIVTRS':'','PWRATTQC':'','SEPAGRQC':'','ENDPLN':'','POWILL':'','CHVIST':'','PCARE':'','MANDPROTQC':'','JICASE':'','WILLQC':'','CONSNTQC':'','COHABQC':'','PRENUPQC':'','AFFGENQC':'','PARENTALQC':'','EMPLAN':'','LWILLDE':'','POSTNUP':'','GVOLLM':'','SINGLEWILL':'','VOLLM':'','PWRATTCHILD':'','VORSORGEDE':'','BERLINWILL':'','WILLDE':'','SEPAGRDE':'','SORGEDE':'','BANKVOLLM':'','AFFGENDE':'','WILLSP':'','MARRIAGEDE':'','MDCNSTSP':'','VISALETTER':'','GFDEEDDE':'','PWRATTSP':'','AFFMARRIAGE':'','TRAVELDE':'','TODDEED':'','AFFGENSP':'','CAREDIRECTIVEDE':'','SEPAGRSP':'','CONSNTSP':'','AFFHEIRSHIP':'','BTHPLN':''},'G-BUS':{'AOEXEC':'','ASSIGN':'','GPRTAS':'','ITMASS':'','ITNASS':'','MPRTNR':'','CPEXEC':'','COMPEN':'','CONFID':'','EMPLOY':'','CAMEND':'','GTERM':'','GJTVTR':'','OFFER':'','GPRTNR':'','GPRTAM':'','GPRTWT':'','MPERFR':'','RELEAS':'','SERVAG':'','TERM':'','MRECOR':'','LETINT':'','GCORP':'','BUSPLN':'','INDEMN':'','EMPWRN':''},'G-FAM':{'COHAB':'','PRENUP':'','ROOMAG':''},'G-LEAS':{'COMLSE':'','RCNSTA':'','RCNSTS':'','REQUIP':'','RINSPR':'','RAMEND':'','RASSIG':'','NOTICE':'','RPPPTY':'','SQUIT':'','SREALT':'','RESLSE':'','RRAPP':'','RSUBRS':'','SWDEED':'','BMORTS':'','BDRECN':'','RCRAPP':'','ROFFLE':'','NOTTEN':''},'G-MISC':{'AOEXEC':'','ASSIGN':'','MPRTNR':'','CPEXEC':'','CONSNT':'','CAMEND':'','GTERM':'','MPERFR':'','RELEAS':'','MRECOR':'','MDCNST':'','INDEMN':''},'G-SALE':{'BOS':'','GDEMND':'','LGUART':'','BLOAN':'','PROMIS':'','SQUIT':'','RELEAS':'','SALES':'','CSHLN':'','SWDEED':'','SINVCE':'','SPORDR':'','INDEMN':''},'G-WPOA':{'HEALTH':'','PWRATT':'','WILL':'','CODICL':'','REVPOA':'','LIVTRS':''}
1030,'GCORP':{'CPROXY':'','CINCUM':'','CCONDR':'','CDRRES':'','CSHLDR':'','CSHPUR':'','CSHRES':'','CSHSUB':'','CMBRIN':'','CSHAPP':''},'HEALTHBONUS':{'HEALTH':'','PWRATT':''},'INCORP':{'AINCOR':'','ONTCOR':'','BCINC':'','FEDINC':'','SSKCOR':'','FEDINC2':'','SSKCOR2':'','INCORAB':'','INCORSK':'','INCORCA':'','INCORBC':'','INCORON':''},'NOTICEBONUS':{'NOTICE':'','RESLSE':''},'RESTPLNES':{'COMLSE':'','RSUBCM':'','RCNSTA':'','RCNSTS':'','REQUIP':'','RINSPR':'','RAMEND':'','RASSIG':'','NOTICE':'','RPPPTY':'','SQUIT':'','SREALT':'','RELEAS':'','RESLSE':'','RRAPP':'','RSUBRS':'','ROOMAG':'','SWDEED':'','BDTRUS':'','BDRECN':'','RCRAPP':'','RMOTVH':'','ROFFLE':'','SPORDR':'','SSURVD':'','SOFFPU':'','BCDEED':'','NOTUKC':'','NOTUKR':'','NOTTEN':'','RENTRECPT':'','ENTERNOTICE':'','NOTCOM':'','RINSPRQC':'','RENTINC':'','RESLSEWHG':'','COMLSEQC':'','ROOMAGQC':'','RESLSEEINL':'','COHABQC':'','RESLSEZI':'','RSUBRSQC':'','RESLSEHAUS':'','RSUBCMQC':'','RESLSESUB':'','SEASONALQC':'','ENDLSEQC':'','RESLSEFEWO':'','2UQRRAPP':'','OFFICELSEDE':'','CONDOQC':'','RESLSESP':'','HANDELLSEDE':'','RAMENDQC':'','NOTICESP':'','RAMENDSP':'','COMLSEDE':'','REQUIPSP':'','LETINTQC':'','RENTGUARTDE':'','SHORTRESLSE':'','PACHTLSEDE':'','AFFRESIDENCY':'','SREALTSP':'','RASSIGQC':'','RRAPPSP':'','COMLSESP':'','RENTINCSP':'','HOABMT':'','RENTRECPTSP':'','MAINTREQUEST':''},'SUBPER':{'AOEXEC':'','BOS':'','COHAB':'','CONSNT':'','RCNSTA':'','RCNSTS':'','GDEMND':'','REQUIP':'','CAMEND':'','GTERM':'','LGUART':'','HEALTH':'','RINSPR':'','RAMEND':'','RASSIG':'','BLOAN':'','NOTICE':'','MPERFR':'','RPPPTY':'','PWRATT':'','PRENUP':'','PROMIS':'','SQUIT':'','SREALT':'','RELEAS':'','RESLSE':'','RRAPP':'','RSUBRS':'','ROOMAG':'','SALES':'','SERVAG':'','CSHLDR':'','SWDEED':'','WILL':'','BDTRUS':'','BMORT':'','BMORTS':'','BDRECN':'','CODICL':'','GFINST':'','RLDLSE':'','RMOTVH':'','LETINT':'','SSURVD':'','SOFFPU':'','BCDEED':'','SEPAGR':'','REVPOA':'','MDCNST':'','CEASE':'','AMSCHD':'','GFDEED':'','SRVCAT':'','SRVCHL':'','SRVCLN':'','SRVCMP':'','SRVCON':'','NOTUKR':'','MEDRLS':'','PETAGR':'','LIVTRS':'','COMPLT':'','SRVIC':'','NOTTEN':'','SRVWRK':''}};
1031
1032  window.dataLayer = window.dataLayer || [];
1033  function gtag(){dataLayer.push(arguments);}
1034
1035  class CookieConsentStore {
1036	constructor(cookieConsentStorageKey = "cookie_consent") {
1037		this.cookieConsentStorageKey = cookieConsentStorageKey;
1038
1039		this.setCookieConsent = this.setCookieConsent.bind(this);
1040		this.getCookieConsent = this.getCookieConsent.bind(this);
1041	}
1042
1043	setCookieConsent(cookieConsent) {
1044		localStorage.setItem(this.cookieConsentStorageKey, JSON.stringify(cookieConsent));
1045	}
1046
1047	getCookieConsent() {
1048		return JSON.parse(localStorage.getItem(this.cookieConsentStorageKey));
1049	}
1050}
1051
1052class CookieConsentRequirementChecker {
1053	constructor(applicableCountries = ['DE', 'ES', 'FR', 'IE', 'GB', 'AT']) {
1054		this.applicableCountries = applicableCountries;
1055
1056		this.isCookieConsentRequired = this.isCookieConsentRequired.bind(this);
1057	}
1058
1059	isCookieConsentRequired() {
1060		// Get the location from the cookie
1061		const location = getCookieValue("L");
1062
1063		if (!location) return false;
1064
1065		return this.applicableCountries.some(c => location.startsWith(c));
1066	}
1067}
1068
1069class TrackingCallConsentQueue {
1070	constructor(cookieConsentRequirementChecker, cookieConsentRequirementCheckerBing) {
1071		this.queue = []; // To store queued function calls
1072		this.cookieConsentStore = new CookieConsentStore();
1073		this.consentStatus = this.cookieConsentStore.getCookieConsent();
1074		this.processQueueTimeoutMs = 30000;
1075
1076		this.cookieConsentRequirementChecker = cookieConsentRequirementChecker;
1077		this.cookieConsentRequirementCheckerBing = cookieConsentRequirementCheckerBing;
1078
1079		if(!this.cookieConsentRequirementChecker.isCookieConsentRequired() || this.consentStatus)
1080			this.immediate = true;
1081		else
1082			this.immediate = false;
1083
1084		if(!this.cookieConsentRequirementCheckerBing.isCookieConsentRequired() || this.consentStatus)
1085			this.immediateBing = true;
1086		else
1087			this.immediateBing = false;
1088
1089		if (this.consentStatus != null) {
1090			this.updateGtagConsent();
1091			this.updateBingConsent();
1092		}
1093		else if(this.cookieConsentRequirementChecker.isCookieConsentRequired())
1094		{
1095			this.detectStatusUpdated();
1096		}
1097
1098		this.consentStatusTimeout();
1099
1100		this.consentStatusTimeout = this.consentStatusTimeout.bind(this);
1101		this.updateGtagConsent = this.updateGtagConsent.bind(this);
1102		this.updateBingConsent = this.updateBingConsent.bind(this);
1103		this.consentStatusUpdated = this.consentStatusUpdated.bind(this);
1104		this.enqueue = this.enqueue.bind(this);
1105		this.processQueue = this.processQueue.bind(this);
1106		this.detectStatusUpdated = this.detectStatusUpdated.bind(this);
1107		this.updateClarityConsent = this.updateClarityConsent.bind(this);
1108	}
1109
1110	detectStatusUpdated(){
1111		const detectionId = setInterval(()=> {
1112			if(this.cookieConsentStore.getCookieConsent() != null)
1113			{
1114				this.consentStatusUpdated();
1115				clearInterval(detectionId);
1116			}
1117		}, 1000);
1118	}
1119
1120	//ensures all calls eventually get made(even if anonymized)
1121	consentStatusTimeout() {
1122		if(this.cookieConsentRequirementChecker.isCookieConsentRequired() && this.consentStatus == null)
1123		{
1124			setTimeout(() => {
1125				submitInternalEventV2(null, "TrackingCallConsentQueue", "timeout", null, null);
1126				this.processQueue();
1127			}, this.processQueueTimeoutMs);
1128		}
1129	}
1130
1131	//update the consent status with Google
1132	updateGtagConsent() {
1133		gtag("consent", "default", {
1134			ad_storage: "denied",
1135			ad_user_data: "denied",
1136			ad_personalization: "denied",
1137			analytics_storage: "denied",
1138			'region': this.cookieConsentRequirementChecker.applicableCountries,
1139		});
1140
1141		gtag("consent", "update", {
1142			ad_storage: this.consentStatus.marketing ? "granted" : "denied",
1143			ad_user_data: this.consentStatus.marketing ? "granted" : "denied",
1144			ad_personalization: this.consentStatus.marketing
1145				? "granted"
1146				: "denied",
1147			analytics_storage: this.consentStatus.performance
1148				? "granted"
1149				: "denied",
1150		});
1151	}
1152
1153	updateBingConsent() {
1154		window.uetq = window.uetq || [];
1155		window.uetq.push('consent', 'default', {
1156			'ad_storage': 'denied'
1157			});
1158
1159		window.uetq.push('consent', 'update', {
1160			'ad_storage': this.consentStatus.marketing ? 'granted' : 'denied'
1161			});
1162	}
1163
1164	updateClarityConsent() {
1165		if(this.cookieConsentRequirementCheckerBing.isCookieConsentRequired())
1166		{
1167			const clarityIntervalId = setInterval(()=> {
1168				if(typeof window.clarity == "function")
1169				{
1170					if(this.consentStatus.performance)
1171						window.clarity('consent');
1172					else
1173						window.clarity('consent', false);
1174					clearInterval(clarityIntervalId);
1175				}
1176			}, 1000);
1177		}
1178	}
1179
1180	//function to be called by consent banner when the consent status changes
1181	consentStatusUpdated() {
1182		this.consentStatus = this.cookieConsentStore.getCookieConsent();
1183		this.updateGtagConsent();
1184		this.updateBingConsent();
1185		this.updateClarityConsent();
1186
1187		this.processQueue();
1188	}
1189
1190	// Method to add a function call to the queue or execute immediately
1191	enqueue(call, bingQueue = false) {
1192		if (
1193			(!bingQueue && this.immediate) || (bingQueue && this.immediateBing)
1194		) {
1195			call(); // Call immediately if the condition is met
1196		} else {
1197			this.queue.push(call); // Otherwise, add to the queue
1198		}
1199	}
1200
1201	// Method to process and clear the queue
1202	processQueue() {
1203		this.immediate = true;
1204		while (this.queue.length > 0) {
1205			const call = this.queue.shift(); // Remove the first item from the queue
1206			call(); // And call it
1207		}
1208	}
1209}
1210
1211const PrivacyOptOut = (function() {
1212		const GPC_COVERED_LOCATIONS = ['US','USCA','USCO','USCT','USDE','USIN','USMD','USMN','USMT','USNE','USNH','USNJ','USOR','USTX'];
1213	const WEBSITE_TOGGLE_COVERED_LOCATIONS = ['US','USCA','USCO','USCT','USDE','USIN','USIA','USKY','USMD','USMN','USMT','USNE','USNH','USNJ','USOR','USRI','USTN','USTX','USUT','USVA'];
1214
1215	const WEBSITE_TOGGLE_COOKIE_NAME = 'DataSharingOptedOut';
1216	const GEO_REGION_COOKIE_NAME = 'GeoRegion';
1217
1218		function applies()
1219	{
1220		return (isVisitorInLocation(GPC_COVERED_LOCATIONS) && isGpcSignalPresent())
1221		    || (isVisitorInLocation(WEBSITE_TOGGLE_COVERED_LOCATIONS) && isWebsiteToggleOptOut());
1222	}
1223
1224	function isVisitorInLocation(coveredLocations)
1225	{
1226				var location = (getCookie(GEO_REGION_COOKIE_NAME) || "").toUpperCase();
1227		if(!location) return true;
1228
1229		return coveredLocations.indexOf(location) != -1;
1230	}
1231
1232	function isGpcSignalPresent()
1233	{
1234		return navigator.globalPrivacyControl === true;
1235	}
1236
1237	function isWebsiteToggleOptOut()
1238	{
1239				var value = (getCookie(WEBSITE_TOGGLE_COOKIE_NAME) || "").toLowerCase();
1240		return value === "1";
1241	}
1242
1243		function runIfAllowed(callback)
1244	{
1245		if(!applies()) callback();
1246	}
1247
1248		function injectMarkupIfAllowed(template)
1249	{
1250		if(!template || applies()) return;
1251
1252		var fragment = template.content.cloneNode(true);
1253		var scripts = fragment.querySelectorAll("script");
1254		for(var i = 0; i < scripts.length; i++)
1255		{
1256			var original = scripts[i];
1257			var executable = document.createElement("script");
1258			for(var a = 0; a < original.attributes.length; a++)
1259				executable.setAttribute(original.attributes[a].name, original.attributes[a].value);
1260			executable.text = original.textContent;
1261			original.parentNode.replaceChild(executable, original);
1262		}
1263		document.body.appendChild(fragment);
1264	}
1265
1266	return { applies, runIfAllowed, injectMarkupIfAllowed };
1267})();
1268
1269window.PrivacyOptOut = PrivacyOptOut;
1270
1271function maintainAdID(queryStringId, consentRequired)
1272{
1273	const cookieConsentStore = new CookieConsentStore();
1274	const cookieConsent = cookieConsentStore.getCookieConsent();
1275
1276	if(consentRequired && (!cookieConsent || !cookieConsent.marketing || !cookieConsent.performance))
1277	{
1278		processId(queryStringId)
1279	}
1280
1281	function processId(id){
1282		const localStorageId = getIdFromLocalStorage(id);
1283		const urlId = getIdFromUrl(id);
1284		if(urlId && urlId != localStorageId)
1285		{
1286			setIdInLocalStorage(id, urlId);
1287		}
1288		else if(!urlId && localStorageId)
1289		{
1290			setIdInUrl(id, localStorageId);
1291		}
1292	}
1293
1294	function getIdFromUrl(id){
1295		const urlParams = new URLSearchParams(window.location.search);
1296		return urlParams.get(id);
1297	}
1298
1299	function setIdInUrl(id, value){
1300		const urlParams = new URLSearchParams(window.location.search);
1301		urlParams.set(id, value);
1302		let newUrl = window.location.pathname + "?" + urlParams.toString();
1303		if(window.location.hash)
1304			newUrl += window.location.hash;
1305		window.history.replaceState(window.history.state, "", newUrl);
1306	}
1307
1308	function setIdInLocalStorage(id, value){
1309		localStorage.setItem(id, value);
1310	}
1311
1312	function getIdFromLocalStorage(id){
1313		return localStorage.getItem(id);
1314	}
1315}
1316
1317  const cookieConsentRequirementChecker = new CookieConsentRequirementChecker();
1318  const cookieConsentRequirementCheckerBing = new CookieConsentRequirementChecker();
1319
1320  maintainAdID("gclid", cookieConsentRequirementChecker.isCookieConsentRequired());
1321  maintainAdID("MSCLKID", cookieConsentRequirementCheckerBing.isCookieConsentRequired());
1322
1323  const trackingCallConsentQueue = new TrackingCallConsentQueue(cookieConsentRequirementChecker, cookieConsentRequirementCheckerBing);
1324
1325  registerEvent(window, "beforeunload", trackingCallConsentQueue.processQueue);
1326
1327  const TrackingPermissionChecker = (function() {
1328    const TRACKING_ENABLED_KEY = "trackingEnabled";
1329
1330	//External code to this file should not call this function, instead trackingEnabled() should be called
1331    function isTrackingEnabled() {
1332        return isLiveEnvironment() ||
1333            isTrackingForcefullyEnabledInQueryString() ||
1334            isTrackingForcefullySetInLocalStorage();
1335    }
1336
1337    function isLiveEnvironment() {
1338        return window.location.hostname.startsWith('www.');
1339    }
1340
1341    function isTrackingForcefullyEnabledInQueryString() {
1342        const queryValue = new URLSearchParams(window.location.search).get(TRACKING_ENABLED_KEY);
1343        // Correctly use the actual retrieved queryValue instead of the undefined variable.
1344        if (queryValue === undefined) return undefined;
1345        if (/true/i.test(queryValue)) return true;
1346        if (/false/i.test(queryValue)) return false;
1347
1348        return undefined;
1349    }
1350
1351    function isTrackingForcefullySetInLocalStorage() {
1352        const isTrackingEnabledString = window.localStorage.getItem(TRACKING_ENABLED_KEY);
1353        return isTrackingEnabledString
1354        ? isTrackingEnabledString.toLowerCase() === "true"
1355        : undefined;
1356    }
1357
1358    // Return an object with the public methods
1359    return {
1360        isTrackingEnabled,
1361        isLiveEnvironment,
1362        isTrackingForcefullyEnabledInQueryString,
1363        isTrackingForcefullySetInLocalStorage
1364    };
1365})();
1366
1367  var bingTrackingCode = null;
1368  var gtagCodes = new Array();
1369  var AWConversionCodes = new Array();
1370  var ga4Code = null;
1371  var googleAdsConversionPrimaryConversion = null;
1372  var googleAdsConversionSecondaryConversion = null;
1373  var googleAdsMicroConversionPrimaryConversion = null;
1374  var googleAdsMicroConversionSecondaryConversion = null;
1375  var googleAdsConversion = null;
1376
1377googleAdsConversion = {"primary":"AW-857210040/GKEDCLjV4nEQuPnfmAM","secondary":"AW-857210040/qq1sCLaH5KkaELj535gD","microPrimary":null,"microSecondary":{"Product Selection":"AW-857210040/W-dWCI6S5KkaELj535gD","Preview":"AW-857210040/1eTaCJCZkcwaELj535gD"}};
1378bingTrackingCode = "4018410";
1379ga4Code = "G-QTW4JD7Q4H";
1380gtagCodes = ["AW-857210040"];
1381AWConversionCodes = ["AW-857210040/GKEDCLjV4nEQuPnfmAM"];
1382googleAdsConversionPrimaryConversion = "AW-857210040/GKEDCLjV4nEQuPnfmAM";
1383googleAdsConversionSecondaryConversion = "AW-857210040/qq1sCLaH5KkaELj535gD";
1384googleAdsMicroConversionSecondaryConversion = "AW-857210040/W-dWCI6S5KkaELj535gD";
1385
1386var gaDisabledSectionPageviews = new Array();
1387
1388function setGACustomVars()
1389{
1390
1391}
1392
1393//Determine if the user is licensed for the current product to be used with analytics
1394function analyticsUserIsLicensed()
1395{
1396	if (isLoggedIn())
1397	{
1398		var licensedProducts = getCookieValue("product_licenses_for_analytics");
1399		var currentProductCode = getCurrentProductCode();
1400		var loc = getCookieValue("L");
1401		var nowDate = new Date();
1402		var expiryDate = null;
1403		var countryCode = "";
1404		if(loc && loc.length >= 2)
1405			countryCode = loc.substring(0, 2).toUpperCase();
1406		if(licensedProducts.length > 0 && currentProductCode.length > 0 && countryCode.length > 0)
1407		{
1408			var licensedProductsArray = licensedProducts.split(";");
1409			var licensedProductArray = null;
1410			for(var i = 0; i < licensedProductsArray.length; i++)
1411			{
1412				if(licensedProductsArray[i].length > 0 && licensedProductsArray[i].indexOf(":") != -1)
1413				{
1414					licensedProductArray = licensedProductsArray[i].split(",");
1415					expiryDateStr = licensedProductArray[2];
1416					var patt = new RegExp('[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}');
1417					if(patt.test(expiryDateStr))
1418					{
1419						var expiryDate = new Date(Date.UTC(expiryDateStr.substr(0,4),expiryDateStr.substr(5,2) -1,expiryDateStr.substr(8,2),expiryDateStr.substr(11,2),expiryDateStr.substr(14,2) ));
1420						if(expiryDate > nowDate && licensedProductArray[1] == countryCode && (licensedProductArray[0] == currentProductCode || typeof productLists[licensedProductArray[0]] != "undefined" && typeof productLists[licensedProductArray[0]][currentProductCode] != "undefined" )  )
1421							return true;
1422					}
1423				}
1424			}
1425		}
1426	}
1427	else
1428	{
1429      deleteCookie("product_licenses_for_analytics");
1430	}
1431	return false;
1432}
1433
1434//recpatcha code begin-----------------------------------
1435var reCAPTCHA_site_key = '';
1436
1437onJsReady(function () {
1438	rE(window, 'load', function () {
1439		$(function () {
1440			orderServiceRequestForKey("/StoredCard.asmx/GetRecaptchaKey")
1441				.then(function (response) {
1442					if (response && response.lastChild && response.lastChild.childNodes[0]) {
1443						var recpatchaJson = JSON.parse(response.lastChild.childNodes[0].data);
1444						if (recpatchaJson) {
1445							reCAPTCHA_site_key = recpatchaJson.SiteKey;
1446							if (reCAPTCHA_site_key && reCAPTCHA_site_key != '')
1447								$.getScript('https://www.google.com/recaptcha/api.js?onload=recaptchaOnLoad&render=' + reCAPTCHA_site_key);
1448						}
1449					}
1450				}).catch(function (message) {
1451
1452				});
1453		});
1454	});
1455});
1456
1457function recaptchaOnLoad() {
1458	$('.grecaptcha-badge').css("visibility", "hidden");
1459	$('.recaptchaDisclaimer').show()
1460}
1461
1462function orderServiceRequestForKey(endpoint) {
1463	return new Promise(function (resolve, reject) {
1464		$.ajax({
1465			async: true,
1466			type: "GET",
1467			url: "/OrderService" + endpoint,
1468			headers: {
1469				"x-client-url": location.href
1470			},
1471			success: function (response) {
1472				if (response) {
1473					resolve(response);
1474				} else {
1475					resolve();
1476				}
1477				if (typeof (adyenPage) != 'undefined' && adyenPage && (getCountry() == 'DE' || getCountry() == 'AT')) {
1478					removeDropInListSelect();
1479				}
1480			},
1481			error: function (jqXHR, textStatus, errorThrown) {
1482				console.log(jqXHR);
1483				console.log(textStatus);
1484				console.log(errorThrown);
1485				if (typeof (adyenPage) != 'undefined' && adyenPage && (getCountry() == 'DE' || getCountry() == 'AT')) {
1486					removeDropInListSelect();
1487				}
1488			}
1489		});
1490	});
1491}
1492
1493//recpatcha code ends-----------------------------------
1494
1495var trackingEnabledVar;
1496var internalTrackingEnabledVar;
1497
1498//Whether tracking data we send to third parties should be enabled
1499function trackingEnabled()
1500{
1501	if(typeof trackingEnabledVar == 'undefined')
1502	{
1503		if(piiExistsInQueryString() || !internalTrackingEnabled() || !TrackingPermissionChecker.isTrackingEnabled())
1504			trackingEnabledVar = false;
1505		else
1506			trackingEnabledVar = true;
1507	}
1508	return trackingEnabledVar;
1509}
1510
1511//Whether tracking data that we send to our own servers should be enabled
1512function internalTrackingEnabled()
1513{
1514	if(typeof internalTrackingEnabledVar == 'undefined')
1515	{
1516		if(getCookieValue('brand').indexOf('library') != -1)
1517			internalTrackingEnabledVar = false;
1518		else
1519			internalTrackingEnabledVar = true;
1520	}
1521	return internalTrackingEnabledVar;
1522}
1523
1524/*Determines whether Personally Identifiable Information(PII) exists in query string.
1525Used by trackingEnabled() as we don't want to enable tracking as the third party resources that get loaded
1526can read the referrer and harvest that data*/
1527function piiExistsInQueryString()
1528{
1529	var username = window.UID;
1530	if(location.search.indexOf("@") != -1 ||
1531		location.search.indexOf("%40") != -1 || //encoded @
1532		location.search.indexOf("%2540") != -1 || //double encoded @
1533		//some of the filtering the ticket center(employee view) uses could include PII so just don't do any tracking on that page if we see a lawdepot email address.
1534		location.pathname.indexOf("/tickets/") != -1 && username != null && username.indexOf('@lawdepot.com') != -1)
1535	{
1536		return true;
1537	}
1538	else
1539	{
1540		return false;
1541	}
1542}
1543
1544//Begin Bing Universal Event Tracking
1545
1546function initBingTracking()
1547{
1548	trackingCallConsentQueue.enqueue(()=>{
1549	(function(w,d,t,r,u){var f,n,i;w[u]=w[u]||[],f=function(){var o={ti:bingTrackingCode, cookieFlags: "SameSite=None;Secure"};o.q=w[u],w[u]=new UET(o),w[u].push("pageLoad")},n=d.createElement(t),n.src=r,n.async=1,n.onload=n.onreadystatechange=function(){var s=this.readyState;s&&s!=="loaded"&&s!=="complete"||(f(),n.onload=n.onreadystatechange=null)},i=d.getElementsByTagName(t)[0],!i||i.parentNode.insertBefore(n,i)})(window,document,"script","//bat.bing.com/bat.js","uetq");
1550		if(PrivacyOptOut.applies())
1551	{
1552		window.uetq = window.uetq || [];
1553		window.uetq.push('consent', 'update', { 'ad_storage': 'denied' });
1554
1555		window.clarity = window.clarity || function () { 
1556    	(window.clarity.q = window.clarity.q || []).push(arguments);};
1557		window.clarity('consentv2', { ad_Storage: 'denied', analytics_Storage: 'denied' });
1558	}
1559	}, true);
1560}
1561
1562if(bingTrackingCode != null && trackingEnabled())
1563{
1564	registerEvent(window, "load", initBingTracking);
1565}
1566
1567//End Bing Universal Event Tracking
1568
1569//Facebook Remarketing Pixel
1570var fbTrackingCodes = new Object();
1571
1572function initFacebookRemarketingPixel() {
1573   if(typeof(window.fbq) != "function") {
1574      !function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod?
1575      n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n;
1576      n.push=n;n.loaded=!0;n.version="2.0";n.queue=[];t=b.createElement(e);t.async=!0;
1577      t.src=v;s=b.getElementsByTagName(e)[0];!s||s.parentNode.insertBefore(t,s)}(window,
1578      document,"script","https://connect.facebook.net/en_US/fbevents.js");
1579           if(PrivacyOptOut.applies())
1580         fbq("dataProcessingOptions", ["LDU"]);
1581      fbq("init", fbTrackingCodes[window.location.hostname]);
1582      fbq("track", "PageView");
1583
1584      var pageType = "Unknown";
1585      var pageName = getGAPageName();
1586      if(pageName != null)
1587      {
1588         if(pageName.indexOf("Preview") != -1 || pageName.indexOf("Index") != -1)
1589         {
1590            pageType = "Product";
1591         }
1592         else if(pageName.indexOf("Product Selection") != -1)
1593         {
1594            pageType = "Selection";
1595         }
1596			else if(pageName.indexOf("Payment") != -1)
1597         {
1598				pageType = "Payment";
1599         }
1600      }
1601
1602      if(pageType == "Product") {
1603         fbq("track", "ViewContent", {content_name: pageName});
1604      }
1605      else if(pageType == "Selection") {
1606         fbq("track", "InitiateCheckout", {content_name: pageName});
1607      }
1608      else if(pageType == "Payment") {
1609         fbq("track", "AddToCart", {content_name: pageName});
1610      }
1611   }
1612}
1613function trackFacebookRemarketingPurchase(value, currency) {
1614   if(typeof fbTrackingCodes[window.location.hostname] != "undefined" && trackingEnabled() && typeof(value) != "undefined" && typeof(currency) != "undefined") {
1615      initFacebookRemarketingPixel();
1616      fbq("track", "Purchase", {value: value, currency: currency});
1617   }
1618}
1619if(typeof fbTrackingCodes[window.location.hostname] != "undefined" && trackingEnabled())
1620{
1621	registerEvent(window, "load", initFacebookRemarketingPixel);
1622}
1623//End Facebook Remarketing Pixel
1624
1625//Begin Pinterest Tag (LawDepot)
1626class PinterestTracker {
1627	constructor(tagId) {
1628		this.tagId = tagId;
1629		this.initPromise = null;
1630
1631		this.normalizeEmailForHash = this.normalizeEmailForHash.bind(this);
1632		this.sha256Hex = this.sha256Hex.bind(this);
1633		this.getTrackingEmail = this.getTrackingEmail.bind(this);
1634		this.ensureInitialized = this.ensureInitialized.bind(this);
1635		this.trackCheckout = this.trackCheckout.bind(this);
1636		this.init = this.init.bind(this);
1637	}
1638
1639	normalizeEmailForHash(email) {
1640		if(email == null)
1641			return null;
1642		// lower case + remove *all* whitespace
1643		return ("" + email).toLowerCase().replace(/\s+/g, "");
1644	}
1645
1646	sha256Hex(text) {
1647		try
1648		{
1649			if(!window.crypto || !window.crypto.subtle || typeof TextEncoder === "undefined")
1650				return Promise.resolve(null);
1651
1652			var encoded = new TextEncoder().encode(text);
1653			return window.crypto.subtle.digest("SHA-256", encoded).then(function(hashBuffer){
1654				var hashArray = Array.prototype.slice.call(new Uint8Array(hashBuffer));
1655				return hashArray.map(function(b){ return ("00" + b.toString(16)).slice(-2); }).join("");
1656			}).catch(function(){
1657				return null;
1658			});
1659		}
1660		catch(e)
1661		{
1662			return Promise.resolve(null);
1663		}
1664	}
1665
1666	getTrackingEmail() {
1667		// Prefer the logged-in username if present (used elsewhere in this file for PII checks)
1668		// but only if it looks like an email.
1669		if(typeof window.UID == "string" && window.UID.indexOf("@") != -1)
1670			return window.UID;
1671		return null;
1672	}
1673
1674	ensureInitialized() {
1675		if(this.initPromise)
1676			return this.initPromise;
1677
1678		if(typeof window.pintrk != "function")
1679		{
1680			!function(e){if(!window.pintrk){window.pintrk=function(){window.pintrk.queue.push(Array.prototype.slice.call(arguments))};var n=window.pintrk;n.queue=[],n.version="3.0";var t=document.createElement("script");t.async=!0,t.src=e;var r=document.getElementsByTagName("script")[0];r.parentNode.insertBefore(t,r)}}("https://s.pinimg.com/ct/core.js");
1681		}
1682
1683		var email = this.getTrackingEmail();
1684		var normalized = this.normalizeEmailForHash(email);
1685		if(normalized)
1686		{
1687			this.initPromise = this.sha256Hex(normalized).then(function(hashed){
1688				try
1689				{
1690					if(hashed)
1691						pintrk('load', this.tagId, { em: hashed });
1692					else
1693						pintrk('load', this.tagId);
1694					pintrk('page');
1695				}
1696				catch(e)
1697				{
1698					// swallow
1699				}
1700			}.bind(this));
1701		}
1702		else
1703		{
1704			try
1705			{
1706				pintrk('load', this.tagId);
1707				pintrk('page');
1708			}
1709			catch(e)
1710			{
1711				// swallow
1712			}
1713			this.initPromise = Promise.resolve();
1714		}
1715
1716		return this.initPromise;
1717	}
1718
1719	trackCheckout(conversionData) {
1720		if(!this.tagId || !trackingEnabled() || PrivacyOptOut.applies())
1721			return;
1722
1723		this.ensureInitialized().then(function(){
1724			try {
1725				pintrk('track', 'checkout', conversionData);
1726			} catch(e) {
1727				// swallow
1728			}
1729		});
1730	}
1731
1732	init() {
1733				if(!this.tagId || !trackingEnabled() || PrivacyOptOut.applies())
1734			return;
1735
1736		this.ensureInitialized();
1737	}
1738}
1739
1740var pinterestTagId = null;
1741
1742var pinterestTracker = null;
1743if(pinterestTagId != null && trackingEnabled())
1744{
1745	pinterestTracker = new PinterestTracker(pinterestTagId);
1746	registerEvent(window, "load", pinterestTracker.init);
1747}
1748//End Pinterest Tag (LawDepot)
1749
1750//Madrivo Tracking
1751var madrivoAffiliateCode = "KN393KC5HB";
1752function addMadrivoClickIdCookie() {
1753   if("live" == "live" && getAffiliateCode() == madrivoAffiliateCode) {
1754      var clickId = getQueryStringValue("k");
1755      if(clickId) {
1756         setCookie("madrivoClickId", clickId, 365, false);
1757      }
1758   }
1759}
1760if(trackingEnabled())
1761{
1762	registerEvent(window, "load", addMadrivoClickIdCookie);
1763}
1764//End Madrivo Tracking
1765function getGACustomVars()
1766{
1767	var locVal = typeof getCookieValue("L") == "undefined"? "" : getCookieValue("L");
1768	var file = getQueryStringValue("file");
1769	var analyticsLicensed = "0";
1770	if(analyticsUserIsLicensed())
1771		analyticsLicensed = "1";
1772
1773	var expzVal = typeof getCookieValue("expz") == "undefined" || getCookieValue("expz") == null? "" : getCookieValue("expz");
1774	var dcsExp = typeof getCookieValue("dcsExp") == "undefined" || getCookieValue("dcsExp") == null? "" : getCookieValue("dcsExp");
1775
1776	var doNotTrack = "0";
1777	if(navigator.doNotTrack == "1" || navigator.doNotTrack == "yes" || navigator.msDoNotTrack == "1" || window.doNotTrack == "1")
1778		doNotTrack = "1";
1779
1780	if(dcsExp.length > 0)
1781	{
1782		if(expzVal.length == 0)
1783		{
1784			expzVal = dcsExp;
1785		}
1786		else
1787		{
1788			if(expzVal.slice(-1) != ";")
1789				expzVal += ";";
1790			dcsExpSplit = dcsExp.split(";");
1791			for(var i=0;dcsExpSplit.length > i; i++)
1792			{
1793				if(dcsExpSplit[i].length > 0 && expzVal.indexOf(dcsExpSplit[i]) == -1)
1794					expzVal += dcsExpSplit[i] + ";";
1795			}
1796		}
1797	}
1798	if(expzVal.length > 0 && expzVal.slice(-1) == ";")
1799		expzVal = expzVal.substring(0, expzVal.length -1);
1800
1801	if(expzVal.length > 116)
1802		expzVal = expzVal.substring(0, 116);
1803
1804	//if they have an experiment set but we can't access the LID there's likely some sort of issue(it's not set or it's in the wrong format)
1805	//we want to keep track of this because the LID will get reported to Google Analytics as the user id but if it's reported in varied formats
1806	//the user data will get fragmented
1807	var LIDIssue = false;
1808	if(dcsExp.length > 0 && typeof window.LID != "string")
1809	{
1810		LIDIssue = true;
1811	}
1812
1813	var customVars = {
1814		exp: expzVal,
1815		loc: locVal,
1816		file: file,
1817		licensed: analyticsLicensed,
1818		productCode: getCurrentProductCode(),
1819		doNotTrack: doNotTrack,
1820		LIDIssue: LIDIssue,
1821		titleTag: document.title
1822	};
1823	return customVars;
1824}
1825
1826//Determine the page name and trigger trackPageView
1827function setGAPageName(pageName, urlFragment, isSectionView)
1828{
1829	if(getQueryStringValue('g') == 'checklist' && getQueryStringValue('framed') == '1')
1830		return;
1831	var finalGaPageName = null;
1832	if(typeof pageName == "string" && pageName.length>0)
1833		finalGaPageName = pageName;
1834	else
1835		finalGaPageName = getGAPageName();
1836
1837	var urlPageName = window.location.pathname + window.location.search;
1838	if(typeof urlFragment == "string")
1839		urlPageName += urlFragment;
1840
1841	//GA rejects the page name if it doesn't start with a slash
1842	if(finalGaPageName != null && !finalGaPageName.startsWith("/"))
1843		finalGaPageName = "/" + finalGaPageName;
1844
1845	//we only want to submit a section page view if the host is not in gaDisabledSectionPageviews
1846	if(typeof isSectionView == "undefined" || !isSectionView || typeof gaDisabledSectionPageviews != "object" || gaDisabledSectionPageviews.indexOf(window.location.hostname) == -1)
1847	{
1848		sendGA4PageView(finalGaPageName);
1849	}
1850}
1851
1852function sendGA4PageView(finalGaPageName)
1853{
1854	customVars = getGACustomVars();
1855	customVars.page_title = ga4PageNameFallback(finalGaPageName);
1856	trackingCallConsentQueue.enqueue(()=>{gtag('event', 'page_view', customVars);});
1857}
1858
1859function getGAPageName(includeForwardSlash)
1860{
1861	var finalGaPageName = null;
1862	if(typeof s != "undefined" && typeof s.pageName != "undefined")
1863		finalGaPageName = s.pageName;
1864	else if(typeof analyticsPageName != "undefined")
1865		finalGaPageName = analyticsPageName;
1866	else if(document.location.pathname == '/contracts/orders/index.aspx')
1867		finalGaPageName = 'Payment';
1868	else
1869	{
1870		var analyticsProductCode = getCurrentProductCode();
1871		if(analyticsProductCode.length > 0)
1872		{
1873			if(window.location.pathname.indexOf("preview") != -1)
1874				finalGaPageName = analyticsProductCode + " Preview";
1875			else
1876				finalGaPageName = analyticsProductCode + " Index";
1877		}
1878	}
1879	if(finalGaPageName == 'Payment' && $('div.ImportantInfoDialog').length > 0 && $('div.ImportantInfoDialog').text().indexOf("You already") != -1)
1880	{
1881		finalGaPageName += " Already Purchased";
1882	}
1883
1884	//we started reporting product selection page differently, revert the name to what it was previously
1885	if(finalGaPageName != null && finalGaPageName.indexOf("Product Selection") != -1)
1886		finalGaPageName = "Product Selection";
1887
1888	//treat blank as null
1889	if(finalGaPageName == "")
1890		finalGaPageName = null;
1891
1892	if(typeof includeForwardSlash != "undefined" && includeForwardSlash && finalGaPageName != null && !finalGaPageName.startsWith("/"))
1893		finalGaPageName = "/" + finalGaPageName;
1894
1895	return finalGaPageName;
1896}
1897
1898//Begin Spotify tag code
1899var spotifyCode = null;
1900
1901if(spotifyCode) PrivacyOptOut.runIfAllowed(function()
1902{
1903  // Installation script generated by Ad Analytics
1904  (function(w, d){
1905    var id='spdt-capture', n='script';
1906    if (!d.getElementById(id)) {
1907      w.spdt =
1908        w.spdt ||
1909        function() {
1910          (w.spdt.q = w.spdt.q || []).push(arguments);
1911        };
1912      var e = d.createElement(n); e.id = id; e.async=1;
1913      e.src = 'https://pixel.byspotify.com/ping.min.js';
1914      var s = d.getElementsByTagName(n)[0];
1915      s.parentNode.insertBefore(e, s);
1916    }
1917    w.spdt('conf', { key: spotifyCode });
1918    w.spdt('view');
1919  })(window, document);
1920});
1921
1922//End Spotify tag code
1923
1924//Begin Reddit tag code
1925var redditCode = null;
1926
1927if(redditCode) PrivacyOptOut.runIfAllowed(function()
1928{
1929	window.onload = () => {
1930		!function(w,d){if(!w.rdt){var p=w.rdt=function(){p.sendEvent?p.sendEvent.apply(p,arguments):p.callQueue.push(arguments)};p.callQueue=[];var t=d.createElement("script");t.src="https://www.redditstatic.com/ads/pixel.js",t.async=!0;var s=d.getElementsByTagName("script")[0];s.parentNode.insertBefore(t,s)}}(window,document);rdt('init', redditCode, {"optOut":false,"useDecimalCurrencyValues":true});rdt('track', 'PageVisit');
1931	}
1932});
1933//End Reddit tag code
1934
1935//Begin OpenAI tag code
1936var openaiPixelId = null;
1937
1938if(openaiPixelId && trackingEnabled()) PrivacyOptOut.runIfAllowed(function()
1939{
1940	!function(w, d, s, u) {
1941		if (w.oaiq) return;
1942		var q = function() { q.q.push(arguments); };
1943		q.q = [];
1944		w.oaiq = q;
1945		var j = d.createElement(s);
1946		j.async = 1;
1947		j.src = u;
1948		var f = d.getElementsByTagName(s)[0];
1949		f.parentNode.insertBefore(j, f);
1950	}(window, document, "script", "https://bzrcdn.openai.com/sdk/oaiq.min.js");
1951	oaiq("init", { pixelId: openaiPixelId, debug: false });
1952});
1953//End OpenAI tag code
1954
1955//Begin Linkedin tag code
1956var linkedinCode = null;
1957
1958var linkedinConversionCodes = new Array();
1959
1960
1961
1962if(linkedinCode) PrivacyOptOut.runIfAllowed(function()
1963{
1964	_linkedin_partner_id = linkedinCode;
1965	window._linkedin_data_partner_ids = window._linkedin_data_partner_ids || [];
1966	window._linkedin_data_partner_ids.push(_linkedin_partner_id);
1967	(function(l) {
1968	if (!l){window.lintrk = function(a,b){window.lintrk.q.push([a,b])};
1969	window.lintrk.q=[]}
1970	var s = document.getElementsByTagName("script")[0];
1971	var b = document.createElement("script");
1972	b.type = "text/javascript";b.async = true;
1973	b.src = "https://snap.licdn.com/li.lms-analytics/insight.min.js";
1974	s.parentNode.insertBefore(b, s);})(window.lintrk);
1975});
1976//End Linkedin tag code
1977
1978//Begin Google Global Site Tag Code
1979
1980
1981// "AW-857210040" is the gtag code for Legal Contracts
1982// Google Tag Manager is causing problems in the LC MyDocuments Iframe
1983// disable Google Tag Manager in LC MyDocuments Iframe
1984// documentslegaux also uses LC MyDocuments and needs to be disabled too
1985var isLCMyDocumentsIframe = (gtagCodes[0] === "AW-857210040" || gtagCodes[0] === "AW-878912275") && window.self !== window.top && window.self.name === "ifMyDocuments";
1986if (isLCMyDocumentsIframe) {
1987	gtagCodes = [];
1988}
1989
1990if(gtagCodes.length > 0 && trackingEnabled())
1991{
1992	var gtmUrl = "/gmetrics/";
1993	trackingCallConsentQueue.enqueue(()=>{
1994		(function(i,s,o,g,r,a,m){i['GTAGObject']=r;i[r]=i[r]||function(){
1995		(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
1996		m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;!m||m.parentNode.insertBefore(a,m)
1997		})(window,document,'script', gtmUrl,'ga');
1998
1999	gtag('js', new Date());
2000
2001	
2002		if(PrivacyOptOut.applies())
2003		gtag('set', 'restricted_data_processing', true);
2004
2005	for(var i = 0; i < gtagCodes.length; i++)
2006	{
2007		gtag('config', gtagCodes[i], {'send_page_view': false, 'groups': 'GoogleAds'});
2008	}
2009
2010	if(ga4Code)
2011		gtag('config', ga4Code, {
2012			send_page_view: false
2013		});
2014	});
2015}
2016//End Google Global Site Tag Code
2017
2018function getAnalyticsPageTypeByName(pageName)
2019{
2020	var pageType = "Unknown";
2021	if(pageName != null)
2022	{
2023		if(pageName.indexOf('Preview') != -1)
2024			pageType = 'Preview';
2025		else if(pageName.indexOf('Index') != -1)
2026			pageType = 'Question';
2027		else if(pageName.indexOf('Product Selection') != -1)
2028			pageType = 'Product Selection';
2029		else if(pageName.indexOf('Payment') != -1)
2030			pageType = 'Payment';
2031	}
2032	return pageType;
2033}
2034
2035function remarketingView()
2036{
2037	//Remarketing tracking
2038	//Remarketing tags may not be associated with personally identifiable information or placed on pages related to sensitive categories. See more information and instructions on how to setup the tag on: http://google.com/ads/remarketingsetup
2039	if(gtagCodes.length > 0 && trackingEnabled())
2040	{
2041		var pageName = getGAPageName();
2042		var pageType = getAnalyticsPageTypeByName(pageName);
2043
2044		var prodid = getCurrentProductCode();
2045		var dynx_itemid = prodid;
2046		if(dynx_itemid.length == 0)
2047		{
2048			if(pageName != null)
2049				dynx_itemid = pageName;
2050			else
2051				dynx_itemid = window.location.pathname + window.location.search;
2052		}
2053
2054		var ldcnStr = getCookie('ldcn');
2055		var currentLdcn = "";
2056
2057		if(typeof ldcnStr == "string")
2058		{
2059			var ldcnArray = ldcnStr.split('&');
2060			for(var i = 0; i < ldcnArray.length; i++)
2061			{
2062				if(prodid.length > 0 && ldcnArray[i].indexOf(prodid) != -1 && ldcnArray[i].indexOf('=') != -1)
2063				{
2064					currentLdcn = ldcnArray[i].substring(ldcnArray[i].indexOf('=')+1);
2065					break;
2066				}
2067			}
2068		}
2069
2070		trackingCallConsentQueue.enqueue(()=>{
2071		gtag('event', 'page_view', {
2072			prodid: prodid,
2073			pagetype: pageType,
2074			pname: pageName,
2075			dynx_itemid: dynx_itemid,
2076			dynx_itemid2: currentLdcn,
2077			dynx_pagetype: pageType,
2078			send_to: 'GoogleAds'
2079		});});
2080	}
2081}
2082
2083class MicroConversionHelper{
2084	constructor()
2085	{
2086		this.MICRO_CONVERSION_EXPIRY_DAYS = 30;
2087		this.LOCAL_STORAGE_KEY = "MicroConversionPID:";
2088		this.QUERY_STRING_COOKIE_NAME = "cb_QueryStringLast";
2089		this.ORIGINAL_MICRO_CONVERSION_PAGE_NAME = "Product Selection";
2090
2091		this.getAdgroupData = this.getAdgroupData.bind(this);
2092		this.handleMicroConversion = this.handleMicroConversion.bind(this);
2093		this.setPIDConversionExpiry = this.setPIDConversionExpiry.bind(this);
2094		this.getPIDConversionExpiry = this.getPIDConversionExpiry.bind(this);
2095		this.getPIDPartialFromCookie = this.getPIDPartialFromCookie.bind(this);
2096		this.isSupportedSource = this.isSupportedSource.bind(this);
2097
2098		this.supportedSources = ["googleppc", "googleads", "googlerm", "googledsk", "ggrmlct", "googlefrance", "ggde"];
2099
2100		this.adgroupValues = [
2101		{
2102						primaryConversionPIDs: ["googleppc-179811903554", "googleppc-179811903354", "googleppc-179811903994", "googleppc-179811903754", "googleppc-179811903314", "googleppc-179811904074"],
2103			secondaryConversionPIDs: ["googleppc-69878390134", "googleppc-69878389814", "googleppc-69878391054", "googleppc-125095985896", "googleppc-69878390334", "googleppc-69878390054", "googleppc-69878391254", "googleppc-69878390094", "googleppc-69878389894", "googleppc-69878391094", "googleppc-193695047", "googleppc-6728319", "googleppc-6697479", "googleppc-6697639", "googleppc-6697579", "googleppc-6697179", "googleppc-6551339", "googleppc-6697139", "googleppc-193692467", "googleppc-110386167268", "googleppc-202066607", "googleppc-110386167308", "googleppc-16405606033", "googleppc-15314412793", "googleppc-39173266934", "googleppc-193691747", "googleppc-69878390294", "googleppc-69878389854", "googleppc-69878391294", "googleppc-179811903594", "googleppc-179811903274", "googleppc-179811903834", "googleppc-179811904314", "googleppc-179811903794", "googleppc-179811903514", "googleppc-179811904034", "googleppc-179811904234", "googleppc-179811902874", "googleppc-179811904274", "googleppc-179811903074", "googleppc-179811903034", "googleppc-179811903114"],
2104			value:18.5
2105		},
2106		{
2107						primaryConversionPIDs: ["googleppc-180322616561", "googleppc-180322617321", "googleppc-180322617721", "googleppc-18032261704
21071", "googleppc-180322616801", "googleppc-180322617801", "googleppc-180322615801", "googleppc-180322616521", "googleppc-180322616121"],
2108			secondaryConversionPIDs: ["googleppc-17491695923", "googleppc-69870789565", "googleppc-69870790685", "googleppc-386003843", "googleppc-15825600083", "googleppc-15926924123", "googleppc-62959390212", "googleppc-62959390252", "googleppc-62959390292", "googleppc-244964933", "googleppc-9777933443", "googleppc-15825600323", "googleppc-79511823014", "googleppc-62959390012", "googleppc-62959389972", "googleppc-62959390052", "googleppc-125493438395", "googleppc-15926924243", "googleppc-206789633", "googleppc-15926924363", "googleppc-15825600203", "googleppc-69870790485", "googleppc-69870790525", "googleppc-69870788765", "googleppc-69870789525", "googleppc-69870788605", "googleppc-69870789725", "googleppc-180322615881", "googleppc-180322616081", "googleppc-180322616321", "googleppc-180322616841", "googleppc-180322617001", "googleppc-180322615841", "googleppc-180322616041", "googleppc-180322616281", "googleppc-180322617761", "googleppc-180322616761", "googleppc-180322616601", "googleppc-180322616361", "googleppc-180322617521", "googleppc-180322617561", "googleppc-180322617241", "googleppc-180322617281", "googleppc-180322617081", "googleppc-180322617481"],
2109			value:29.55
2110		},
2111		{
2112						primaryConversionPIDs: ["googleppc-179221575040", "googleppc-179221574560", "googleppc-179221574520", "googleppc-179221574600", "googleppc-179221572160", "googleppc-179221572200", "googleppc-179221572120", "googleppc-179221570920", "googleppc-179221571200"],
2113			secondaryConversionPIDs: ["googleppc-801998123", "googleppc-16081802543", "googleppc-78978326591", "googleppc-75486396479", "googleppc-75486396919", "googleppc-43860404621", "googleppc-51612625364", "googleppc-31132407503", "googleppc-31374119543", "googleppc-44461588296", "googleppc-801998033", "googleppc-18212523503", "googleppc-8776522703", "googleppc-27408876743", "googleppc-32041560937", "googleppc-801997943", "googleppc-160137390646", "googleppc-1641422903", "googleppc-16103529503", "googleppc-801997763", "googleppc-15495387983", "googleppc-847806413", "googleppc-20958320063", "googleppc-160137390926", "googleppc-160137391086", "googleppc-160137391126", "googleppc-44461588496", "googleppc-44461588456", "googleppc-44461588536", "googleppc-46401672659", "googleppc-78978326631", "googleppc-75486396639", "googleppc-75486396959", "googleppc-921528293", "googleppc-160137390686", "googleppc-160137390846", "googleppc-16013739088
21136", "googleppc-140104700347", "googleppc-140104700307", "googleppc-140104700387", "googleppc-78978326791", "googleppc-75486396679", "googleppc-75486397119", "googleppc-20958319823", "googleppc-21434271623", "googleppc-81847675371", "googleppc-48548666874", "googleppc-48548667034", "googleppc-48548666834", "googleppc-801997853", "googleppc-22076320583", "googleppc-27699356783", "googleppc-20958319943", "googleppc-111391873671", "googleppc-58615982628", "googleppc-111391873831", "googleppc-58615982788", "googleppc-111391873871", "googleppc-58615982828", "googleppc-75486396879", "googleppc-78978326391", "googleppc-75486396439", "googleppc-21405979823", "googleppc-30697262783", "googleppc-56840407128", "googleppc-50549965839", "googleppc-81847675411", "googleppc-51212903208", "googleppc-27408876863", "googleppc-26048440343", "googleppc-28970515463", "googleppc-78978326551", "googleppc-75486396719", "googleppc-75486396399", "googleppc-179221569720", "googleppc-179221570200", "googleppc-179221573840", "googleppc-179221573080", "googleppc-179221573400", "googleppc-179221571640", "googleppc-179221572440", "googleppc-179221571400", "googleppc-179221571440", "googleppc-179221571680", "googleppc-179221569560", "googleppc-179221570280", "googleppc-179221570000", "googleppc-179221570960", "googleppc-179221571480", "googleppc-179221569520", "googleppc-179221574760", "googleppc-179221569960", "googleppc-179221570240", "googleppc-179221569320", "googleppc-179221570040", "googleppc-179221569760", "googleppc-179221570520", "googleppc-179221575080", "googleppc-179221575240", "googleppc-179221571880", "googleppc-179221571720", "googleppc-179221571920", "googleppc-179221571960", "googleppc-179221573880", "googleppc-179221573120", "googleppc-179221573560", "googleppc-179221569800", "googleppc-179221574800", "googleppc-179221574840", "googleppc-179221575000", "googleppc-179221574040", "googleppc-179221573160", "googleppc-179221573600", "googleppc-179221570440", "googleppc-179221570720", "googleppc-179221574080", "googleppc-179221569480", "googleppc-179221570760", "googleppc-179221571160", "googleppc-179221570480", "googleppc-179221574280", "googleppc-179221572640", "googleppc-179221574320", "googleppc-179221572680", "googleppc-179221574360", "googleppc-179221572840", "googleppc-179221573360", "googleppc-179221573640", "googleppc-179221572920", "googleppc-179221570680", "googleppc-179221571240", "googleppc-179221572600", "googleppc-179221572360", "googleppc-179221574120", "googleppc-179221572400", "googleppc-179221571000", "googleppc-179221573800", "googleppc-179221573320", "googleppc-179221572880"],
2114			value:14.38
2115		}
2116		];
2117	}
2118
2119	handleMicroConversion()
2120	{
2121		const pageName = getGAPageName();
2122		const pageType = getAnalyticsPageTypeByName(pageName);
2123
2124		if(googleAdsConversion &&
2125			googleAdsConversion.microSecondary &&
2126			googleAdsConversion.microSecondary[pageType]
2127		)
2128		{
2129			const pidPartial = this.getPIDPartialFromCookie();
2130			const pidConversionExpiry = this.getPIDConversionExpiry(pidPartial, pageType);
2131			if(this.isSupportedSource(pidPartial) && pidPartial != null && (pidConversionExpiry == null || pidConversionExpiry < new Date()))
2132			{
2133				const adgroupData = this.getAdgroupData(pidPartial);
2134				let value = 0;
2135				if(adgroupData != null)
2136				{
2137					value = adgroupData.value;
2138
2139					if(adgroupData.isPrimary && googleAdsMicroConversionPrimaryConversion)
2140						submitGoogleAdsConversion(value, googleAdsMicroConversionPrimaryConversion);
2141				}
2142
2143				submitGoogleAdsConversion(value, googleAdsConversion.microSecondary[pageType]);
2144
2145				this.setPIDConversionExpiry(pidPartial, pageType);
2146			}
2147		}
2148	}
2149
2150	isSupportedSource(pidPartial)
2151	{
2152		if(pidPartial != null && typeof pidPartial == "string")
2153		{
2154			const pidParts = pidPartial.split("-");
2155			return this.supportedSources.some(source => pidParts[0].startsWith(source));
2156		}
2157		return false;
2158	}
2159
2160		skipConversionPrimaryConversion()
2161	{
2162		const pageName = getGAPageName();
2163		const pageType = getAnalyticsPageTypeByName(pageName);
2164
2165		const pidPartial = this.getPIDPartialFromCookie();
2166		const pidConversionExpiry = this.getPIDConversionExpiry(pidPartial, pageType);
2167		const adgroupData = this.getAdgroupData(pidPartial);
2168
2169		if(pidConversionExpiry != null && pidConversionExpiry > new Date() && adgroupData != null && adgroupData.isPrimary)
2170			return true;
2171		else
2172			return false;
2173	}
2174
2175	getAdgroupData(pidPartial)
2176	{
2177		const adgroup = this.adgroupValues.find(({ primaryConversionPIDs, secondaryConversionPIDs }) =>
2178			primaryConversionPIDs.includes(pidPartial) || secondaryConversionPIDs.includes(pidPartial)
2179		);
2180
2181		if (!adgroup) return null;
2182
2183		const isPrimary = adgroup.primaryConversionPIDs.includes(pidPartial);
2184
2185		return { value: adgroup.value, isPrimary: isPrimary };
2186	}
2187
2188	setPIDConversionExpiry(pidPartial, pageType)
2189	{
2190		const expiryDate = new Date();
2191		expiryDate.setDate(expiryDate.getDate() + this.MICRO_CONVERSION_EXPIRY_DAYS);
2192
2193		localStorage.setItem(this.LOCAL_STORAGE_KEY + pageType + ":" + pidPartial, expiryDate);
2194	}
2195
2196	getPIDConversionExpiry(pidPartial, pageType)
2197	{
2198		const expiryDateStrNoPageType = localStorage.getItem(this.LOCAL_STORAGE_KEY + pidPartial);
2199		const expiryDateStrWithPageType = localStorage.getItem(this.LOCAL_STORAGE_KEY + pageType + ":" + pidPartial);
2200
2201		const expiryDateStr = pageType == this.ORIGINAL_MICRO_CONVERSION_PAGE_NAME && expiryDateStrNoPageType ? expiryDateStrNoPageType : expiryDateStrWithPageType;
2202
2203		if(!expiryDateStr)
2204			return null;
2205		else
2206			return new Date(expiryDateStr);
2207	}
2208
2209	getPIDPartialFromCookie(onlyFirstSection)
2210	{
2211		const queryStringLast = getCookieValue(this.QUERY_STRING_COOKIE_NAME);
2212		const pid = getQueryStringValue("pid", false, queryStringLast);
2213		if(typeof pid == "string")
2214		{
2215			const pidParts = pid.split("-");
2216			if(pidParts.length > 1)
2217			{
2218				return pidParts[0] + "-" + pidParts[1];
2219			}
2220		}
2221		return null;
2222	}
2223}
2224
2225const microConversionHelper = new MicroConversionHelper();
2226
2227registerEvent(window, "load", microConversionHelper.handleMicroConversion);
2228
2229function submitGoogleAdsConversion(value, conversionAction, invoiceNo)
2230{
2231	trackingCallConsentQueue.enqueue(()=>{
2232		const conversionObject = {
2233			'send_to': conversionAction,
2234			'currency': 'USD',
2235			'value': value
2236		};
2237		if(invoiceNo)
2238			conversionObject.transaction_id = invoiceNo;
2239
2240		gtag('event', 'conversion', conversionObject);
2241	});
2242}
2243
2244
2245registerEvent(window, "load", remarketingView);
2246registerEvent(window, "load", setGAPageName);
2247
2248function submitInternalPageview()
2249{
2250	if(internalTrackingEnabled())
2251	{
2252		var tempGAPageName = getGAPageName();
2253		if(tempGAPageName == "Receipt" || tempGAPageName == "Product Selection" || (typeof tempGAPageName == "string" && tempGAPageName.indexOf("Payment") == 0) )
2254		{
2255			submitSectionTracking(tempGAPageName, tempGAPageName);
2256		}
2257	}
2258}
2259registerEvent(window, "load", submitInternalPageview);
2260
2261//deprecated
2262function submitTrackedEvent(action, label, name, category, nonInteraction)
2263{
2264	submitTrackedEventV2(category, name, action, null, label, null, nonInteraction);
2265}
2266
2267/*
2268submitTrackedEventV2 - Submits events to both Google Analytics(GA) and our internal event tracking
2269* section 	- the section within the app where the usage occurred.
2270* component - the control that can be interacted with on the page. Preview page examples: Print, Download etc.
2271* action 	- text field. type of action. ex: click/view/key presses. If clicking the control multiple
2272times has a different affect the affect should be used instead of click. ex: Expand/Collapse, Check/Unchecked etc.
2273* extra 	- Extra information about the event. Could be used for what the control is targeting/referring to.
2274* label 	- GA only. text field. If nothing is set the page name is used. Context/grouping for the action
2275* Count 	- a count of the event. ex: key presses
2276
2277http://internalwiki.lawdepot.com/index.php?title=Event_Tracking_Technical_Documentation
2278
2279* Notes:
2280** You can call submitInternalEventV2 instead of this function if you only want to submit the event internally.
2281*** For example to avoid sending too much data to Google Analytics
2282** Experiment data is automatically included(pulled from dcsExp cookie)
2283** The page name is always included in internal event tracking
2284*/
2285function submitTrackedEventV2(section, component, action, extra, label, count, nonInteraction)
2286{
2287	submitGAEvent(action, label, component, section, nonInteraction);
2288	submitInternalEventV2(section, component, action, extra, count);
2289}
2290
2291function submitGAEvent(action, label, name, category, nonInteraction)
2292{
2293	if(trackingEnabled())
2294	{
2295		if(typeof label == "undefined" || !label)
2296			label = getGAPageName();
2297		if(typeof nonInteraction == "undefined")
2298			nonInteraction = false;
2299
2300		customVars = getGACustomVars();
2301		customVars.page_title = ga4PageNameFallback(getGAPageName(true));
2302		customVars.event_label = label;
2303		customVars.event_category = category;
2304		trackingCallConsentQueue.enqueue(()=> {gtag('event', action, customVars);});
2305	}
2306}
2307
2308//if the page name is null fall back to the path
2309function ga4PageNameFallback(pageName)
2310{
2311	if(pageName == null)
2312		pageName = window.location.pathname + window.location.search;
2313	return pageName;
2314}
2315
2316//deprecated
2317function submitInternalEvent(action, name, category)
2318{
2319	submitInternalEventV2(category, name, action);
2320}
2321
2322/*
2323submitInternalEventV2 - Submits an event to our internal event tracking
2324* section 	- the section within the app where the usage occurred.
2325* component - the control that can be interacted with on the page. Preview page examples: Print, Download etc.
2326* action 	- text field. type of action. ex: click/view/key presses. If clicking the control multiple
2327times has a different affect the affect should be used instead of click. ex: Expand/Collapse, Check/Unchecked etc.
2328* extra 	- Extra information about the event. Could be used for what the control is targeting/referring to.
2329* Count 	- a count of the event. ex: key presses
2330
2331http://internalwiki.lawdepot.com/index.php?title=Event_Tracking_Technical_Documentation
2332
2333* Notes:
2334** You can call submitTrackedEventV2 instead of this function if you want to submit this event internally and to GA
2335** Experiment data is automatically included(pulled from dcsExp cookie)
2336** The page name is always included in internal event tracking
2337*/
2338function submitInternalEventV2(section, component, action, extra, count)
2339{
2340	if(internalTrackingEnabled())
2341	{
2342		var pageName = getGAPageName();
2343		var licensed = analyticsUserIsLicensed();
2344		var productCode = getCurrentProductCode();
2345		var urlPath = window.location.pathname + window.location.search;
2346
2347		if(pageName == null)
2348			pageName = "";
2349		if(section == null)
2350			section = "";
2351		if(component == null)
2352			component = "";
2353		if(action == null)
2354			action = "";
2355		if(extra == null)
2356			extra = "";
2357		if(count == null)
2358			count = "";
2359		var querystring = "lc=" + licensed +
2360		"&pc=" + productCode +
2361		"&pt=" + url_escape(urlPath) +
2362		"&pn=" + url_escape(pageName) +
2363		"&en=" + url_escape(component) +
2364		"&ec=" + url_escape(section) +
2365		"&ea=" + url_escape(action) +
2366		"&ee=" + url_escape(extra) +
2367		"&ect=" + url_escape(count) +
2368		"&r=" + Math.floor(Math.random() * 9999) + 1
2369		;
2370
2371		const evtUrl = "/evt.gif?" + querystring;
2372
2373		if (navigator && navigator.sendBeacon)
2374		{
2375			navigator.sendBeacon(evtUrl);
2376		}
2377		else
2378		{
2379			const img = new Image(1, 1);
2380			img.src = evtUrl;
2381		}
2382	}
2383}
2384
2385function addSiteCatalystEvent(eventName){
2386   if(typeof(s) != 'undefined'){
2387      if(s.events.indexOf(eventName)<0){
2388         if(s.events != ""){
2389            s.events += ",";
2390         }
2391         s.events+=eventName;
2392         s.t();
2393      }
2394   }
2395}
2396//function (object) for analytics tracking between contract groups/sections
2397function sectiontracker ()
2398{
2399	//initialization values
2400	this.currentQS = null;
2401	this.currentQG = null;
2402	this.previousQS = null;
2403	this.previousQG = null;
2404
2405	//primary method
2406	this.track = function(newQS, newQG)
2407	{
2408		if(internalTrackingEnabled())
2409		{
2410			this.previousQS = this.currentQS;
2411			this.previousQG = this.currentQG;
2412			this.currentQS = newQS;
2413			this.currentQG = newQG;
2414
2415			/* If we're navigating to the exact same section and group don't bother tracking anything.
2416				There exists a bug where one call will be made properly then a second call with matching previous and current.
2417				Also if a user just clicks the section they're currently on it will call a track but nothing actually happened
2418				so we don't need to track that. */
2419			if(this.previousQS == this.currentQS && this.previousQG == this.currentQG)
2420				return;
2421
2422			/* If we're on the preview page don't report anything but 'preview' views
2423			There is one bug where landing page views get reported
2424			Another bug where the checklist gets reported */
2425			if(document.location.pathname.toLowerCase().indexOf('preview.') != -1 && (this.currentQS.toLowerCase() != 'preview' && this.currentQG.toLowerCase() != 'preview'))
2426				return;
2427
2428			var tempGAPageName = null
2429			if(typeof getGAPageName == "function")
2430				tempGAPageName = getGAPageName();
2431			//We don't want to submit a pageview on these pages because it happens in m.js
2432			if(tempGAPageName == "Receipt" || tempGAPageName == "Product Selection" || tempGAPageName == "Payment")
2433				return;
2434
2435			sendSectionImageRequest(this.previousQS, this.previousQG, this.currentQS, this.currentQG);
2436		}
2437	}
2438}
2439
2440/*
2441section - the high level part of the app.
2442group - the lower level part of the app(optional).
2443
2444Example:On Notary when going through device check process for Microphone, Camera etc. you might make the following calls:
2445* submitSectionTracking('Device Check', 'Microphone');
2446* submitSectionTracking('Device Check', 'Camera');
2447*/
2448function submitSectionTracking(section, group)
2449{
2450	sendSectionImageRequest(null, null, section, group);
2451}
2452
2453function sendSectionImageRequest(previousQS, previousQG, currentQS, currentQG)
2454{
2455	var licensed = analyticsUserIsLicensed(); //m.js
2456	var productcode = getCurrentProductCode(); //m.js
2457
2458	var querystring = "ps=" + nullToEmpty(previousQS) +
2459	"&pg=" + nullToEmpty(previousQG) +
2460	"&cs=" + nullToEmpty(currentQS) +
2461	"&cg=" + nullToEmpty(currentQG) +
2462	"&lc=" + licensed +
2463	"&pc=" + nullToEmpty(productcode) +
2464	"&r=" + Math.floor(Math.random() * 9999) + 1
2465	;
2466	var myimage = new Image(1,1);
2467	myimage.src = "/t.gif?" + querystring;
2468}
2469
2470st = new sectiontracker();
2471
2472function submitInternalPreviewPageview()
2473{
2474	if(window.location.pathname.indexOf('preview.aspx') != -1)
2475		st.track('preview','preview');
2476}
2477
2478registerEvent(window, "load", submitInternalPreviewPageview);
2479
2480
2481function ChecklistTracker(){
2482	this.attach = function ()
2483	{
2484		if(typeof $ != "undefined")
2485		{
2486			if(getQueryStringValue('g') == 'checklist' && getQueryStringValue('framed') == '1')
2487			{
2488			  var checkboxes = $('input[type="checkbox"]');
2489			  checkboxes.on('click', function(){checklistTracker.checkClickDelay(this)});
2490			  setTimeout(checklistTracker.attachLinks, 150);
2491			}
2492
2493			if(window.location.pathname.indexOf('preview.aspx') != -1)
2494			{
2495				$('a[href="#tabChecklist"]').on('click', function(){submitTrackedEvent('click',false, 'Checklist Tab', 'Preview Checklist')});
2496			}
2497		}
2498	}
2499
2500	this.attachLinks = function ()
2501	{
2502		  var links = $('a');
2503		  links.on('click', function(){checklistTracker.linkClick(this)});
2504	}
2505
2506	this.checkClick = function(checkboxElement)
2507	{
2508	   if(checkboxElement.parentNode != null && checkboxElement.parentNode.classList.length > 0)
2509	   {
2510	   var classList = checkboxElement.parentNode.classList;
2511	   var checkClass = classList[classList.length-1];
2512	   var action = "checked";
2513	   if(!checkboxElement.checked)
2514		  action = "unchecked";
2515	   action += ":" + $('.sprogChecklist').text().trim();
2516	   submitTrackedEvent(action,false, checkClass, 'Preview Checklist', true);
2517	}
2518	}
2519
2520	this.checkClickDelay = function(checkboxElement)
2521	{
2522	   setTimeout(function(){checklistTracker.checkClick(checkboxElement);}, 500);
2523	}
2524
2525	this.linkClick = function(linkElement)
2526	{
2527		if(typeof linkElement.href == "string" &&
2528			linkElement.href != "" &&
2529			linkElement.href.indexOf('javascript:') == -1 &&
2530			linkElement.parentNode != null &&
2531			linkElement.parentNode.parentNode != null &&
2532			linkElement.parentNode.parentNode.parentNode != null &&
2533			linkElement.parentNode.parentNode.parentNode.parentNode != null &&
2534			linkElement.parentNode.parentNode.parentNode.parentNode.classList.length > 0
2535			)
2536		{
2537			var classList = linkElement.parentNode.parentNode.parentNode.parentNode.classList;
2538			var checkClass = classList[classList.length-1];
2539			var action = "linkClick:" + linkElement.href;
2540			submitTrackedEvent(action,false, checkClass, 'Preview Checklist');
2541		}
2542	}
2543}
2544
2545var checklistTracker = new ChecklistTracker();
2546
2547registerEvent(window, "load", checklistTracker.attach);
2548
2549function trackSignedEvent(){
2550   submitTrackedEvent("signed", undefined, WebuserDataInfo.id, "esignature", false);
2551}
2552
2553//Tracking Share application LD
2554function trackSharingEvent(){
2555	submitTrackedEvent("share", undefined, WebuserDataInfo.id, "sharing", false);
2556}
2557
2558function clearLocalStorageLicenses() {
2559	try {
2560		if (typeof localStorage != "undefined") {
2561			var localStorageKeys = Object.keys(localStorage);
2562			for (var i = 0; i < localStorageKeys.length; i++) {
2563				var key = localStorageKeys[i];
2564				if (key.startsWith("foundation_user_licenses_")) {
2565					localStorage.removeItem(key);
2566				}
2567			}
2568		}
2569	}
2570	catch (err) {
2571		logErrorMessage("Error clearing local storage licenses:" + err.message, url_escape(location.href), null, url_escape(location.href), "clearLocalStorageLicenses.log");
2572	}
2573}
2574
2575function removeLandingFree()
2576{
2577	var loc = getCookieValue("L");
2578	if(loc && !loc.startsWith("GB") &&
2579		(window.location.hostname.indexOf('lawdepot') != -1 ||
2580		window.location.hostname.indexOf('legalcontracts') != -1)
2581	)
2582	{
2583		const elementsToCheck = document.querySelectorAll("h1:not(#ctrlSignInForm_cSignInTitle):not(#ctrlSignInForm_cCreateTitle):not(#ctrlSignInForm_cForgotTitle), h2, h3, #scroll-segment .scrollSegmentText, #seo-content .bottom-text p, #expFaqContent .rShareText");
2584		const point1 = document.querySelector('.landingPage .point1');
2585		const point2 = document.querySelector('.landingPage .point2');
2586		const point3 = document.querySelector('.landingPage .point3');
2587
2588		for (var i = 0; i < elementsToCheck.length; i++) {
2589			removeFreeWordFromElement(elementsToCheck[i]);
2590		}
2591
2592		[point1, point2, point3].forEach((point, index) => {
2593			if (point && containsFreeWord(point.innerText)) {
2594				point.innerText = removeFreeFromLandingProp(point.innerText, (index + 1).toString());
2595			}
2596		});
2597	}
2598}
2599
2600function removeFreeWordFromElement(element)
2601{
2602	if (element && element.children.length == 0 && containsFreeWord(element.innerText)) {
2603		element.innerText = removeFreeWord(element.innerText);
2604	}
2605}
2606
2607function containsFreeWord(text) {
2608	if (!text) return false;
2609	const regex = /\b(free|gratuit|gratuite|gratuits|gratuites|gratis|gratuito|gratuita|gratuitas|gratuitos)\b/i;
2610	return regex.test(text);
2611}
2612
2613function removeFreeWord(text) {
2614	if (!text) return text;
2615	text = text.replace(/\b(free|gratuit|gratuite|gratuits|gratuites|gratis|gratuito|gratuita|gratuitas|gratuitos)\b/gi, '');
2616	return text.replace(/\s{2,}/g, ' ').trim();
2617}
2618
2619var valuePropFreePigReplaced = false;
2620
2621
2622function removeFreeFromLandingProp(text, propNum) {
2623    if (text === "Free legal documents\nin minutes") {
2624        if (!valuePropFreePigReplaced) {
2625            valuePropFreePigReplaced = true;
2626            var newURL = "/images/sprites/LdslateSprite.png?v=3";
2627            var styleTag = document.createElement("style");
2628
2629            styleTag.textContent =
2630                "  /*\n" +
2631                "    Because this style block is appended last,\n" +
2632                "    and because we use !important, it beats the original:\n" +
2633                "  */\n" +
2634                "  span.point" + propNum + "::before {\n" +
2635                "    content: \"\" !important;\n" +
2636                "    background: url(\"" + newURL + "\") -162px -121px no-repeat !important;\n" +
2637                "    background-size: 430px 489px !important;\n" +
2638                "    position: absolute !important;\n" +
2639                "    top: 7px !important;\n" +
2640                "    left: 0 !important;\n" +
2641                "  }\n";
2642
2643            document.head.appendChild(styleTag);
2644        }
2645        return "Legal documents\nin minutes";
2646    }
2647	else {
2648		const regex = /\b(free|gratuit|gratuite|gratuits|gratuites|gratis|gratuito|gratuita|gratuitas|gratuitos)\b/i;
2649		if (regex.test(text)) {
2650			return text.replace(regex, '').replace(/\s{2,}/g, ' ').trim();
2651		}
2652		return text;
2653	}
2654}
2655
2656
2657function removeLandingFreeContinuous() {
2658	const interval = setInterval(() => {
2659		removeLandingFree();
2660	}, 50);
2661}
2662
2663removeLandingFreeContinuous();
2664/* End Include F:\lawdepot_com\pubroot\common\tracking-codes\trackingCodes.legalcontracts.com.txt */
2665
2666/* Include storage */
2667/**
2668 * storage.js
2669 * Methods for interacting with the local storage of the browser
2670 */
2671Sequiter = Sequiter || {};
2672Sequiter.storage = Sequiter.storage || {};
2673
2674function tryIsInDialog(includeFramed) {
2675	if (typeof(isInDialog) !== "function") return false;
2676	return isInDialog(includeFramed);
2677}
2678
2679function SupportsStorage() {
2680	return typeof (Storage) != "undefined";
2681}
2682
2683function GetCrypto() {
2684	if (typeof (crypto) != "undefined") return crypto;
2685	else if (typeof (msCrypto) != "undefined") return msCrypto;
2686}
2687
2688function uuidv4() {
2689	return ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, function (c) {
2690		return (c ^ GetCrypto().getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16);
2691	});
2692}
2693
2694var WindowID;
2695
2696/**
2697 * Gets a uuid associated with this tab. This will be unique except for in a case where users use browser 'tab duplication' functionality - as that duplicates the window id
2698 * @return {string} A uuid
2699 */
2700function GetWindowID() {
2701	if (!WindowID) {
2702		if (sessionStorage) {
2703			if (!sessionStorage.getItem("WindowID")) sessionStorage.setItem("WindowID", uuidv4());
2704			WindowID = sessionStorage.getItem("WindowID");
2705		} else WindowID = uuidv4();
2706	}
2707	return WindowID;
2708}
2709
2710var ignoreLocalStorage = [];
2711
2712/**
2713 * Updates the product code cache to identify what the last opened document was for a given product code
2714 * @param {string}
2714 productCode The product code to store information about
2715 * @param {bool} [isLoad=false] If this is being called during the initial load of the page
2716 * @deprecated use SetLocalStorageAnswerSet instead
2717 */
2718function SetAnswerChangeLocalStorage(productCode, isLoad) {
2719	if (typeof (isLoad) == "undefined") isLoad = false;
2720	SetLocalStorage(productCode, {
2721		id: WebuserDataInfo.id,
2722		time: Date(),
2723		shareHash: (WebuserDataInfo.shared ? getQueryStringValue("l") : null),
2724		isLoad: isLoad
2725	});
2726}
2727
2728/**
2729 * Updates the specified local storage key with the specified value
2730 * @param key {string} The local storage key
2731 * @param value {string} The value to store.
2732 */
2733function SetLocalStorage(key, value){
2734   if(tryIsInDialog()) {
2735      parent.SetLocalStorage(key, value);
2736   }
2737   else{
2738      if(typeof(value) == "undefined") value = Date();
2739      try{
2740         if(cssua.ua.ie || cssua.ua.iemobile) { 
2741             /* IE incorrectly triggers local storage events in the same tab that triggered them. This will make it ignore the next event. */
2742            ignoreLocalStorage.push(key);
2743         }
2744         if(value == null){
2745            localStorage.removeItem(key);
2746         }
2747         else{
2748				var obj = new Object();
2749				obj.value = value;
2750				obj.from = GetWindowID(); /* It seems like Safari sometimes triggers local storage events from the same tab. So if we generate a unique ID for each window then ignore events caused by the current window it shouldn't cause any issues. */
2751   	      localStorage.setItem(key, JSON.stringify(obj));
2752         }
2753	   }catch(e){}
2754   }
2755}
2756
2757var showingReloadMessage = false;
2758
2759/**
2760 * Reload the page due to a storage event. Informs the user that the reason for the reload is because the answers have updated.
2761 */
2762function reloadPage() {
2763	if (!tryIsInDialog() && location.href.indexOf("AccountDeleted.php") < 0) { /* Don't reload dialogs since their parent page should be reloading. Account Deleted has the side effect of logging out the current user so we don't want to reload that page */
2764		setSave(false);
2765		saveReq = false;
2766		var code = getCurrentProductCode();
2767		if (pageVariesWithAnswers()) {
2768			if (!showingReloadMessage) {
2769				showingReloadMessage = true;
2770				alert("<div class='updateAlert'><p>This page was changed in a different location.</p><p>It will automatically update to the most recent version.</p></div>", {
2771					title: "Page Update",
2772					includeParagraph: false,
2773					closeOnEscape: false,
2774					callback: reloadWithoutLoc,
2775				});
2776			}
2777		} else {
2778			reloadWithoutLoc();
2779		}
2780	}
2781}
2782
2783/**
2784 * Reloads the page, but without the 'loc' query string parameter if it exists
2785 */
2786function reloadWithoutLoc() {
2787	var newQString = updateQueryStringParameter(location.search, "loc", null);
2788	if (newQString != location.search) {
2789		window.location = window.location.origin + window.location.pathname + (newQString.length > 1 ? newQString : "") + (window.location.hash.length > 0 ? window.location.hash : "");
2790	} else {
2791		window.location.reload();
2792	}
2793}
2794
2795/**
2796 * Determines if the current page can change it's content based on what answers the user has supplied to the current document
2797 * @return {boolean}
2798 */
2799function pageVariesWithAnswers() {
2800	var code = getCurrentProductCode();
2801	var pageName = getGAPageName();
2802	return typeof (code) != "undefined" 
2803		&& code != null 
2804		&& code != "" 
2805		&& pageName != "Payment"
2806		&& pageName != "Product Selection" 
2807		&& pageName != "LawDepot Editor" 
2808		&& pageName != "EstateDashboardError";
2809}
2810
2811(function(storage){
2812	var webuserDataIdStoragePrefix = "webuserDataId-"
2813	/**
2814	 * Updates the local storage cache to identify that a document is open in a tab
2815	 * @param {string} webuserDataId The id of the document to store the key of
2816	 * @param {string} [shareHash=null] The current website link hash being used to access this document. null if there is none
2817	 * @param {bool} [isLoad=false] Whether or not this is the initial load
2818	 */
2819	function SetLocalStorageAnswerSet(webuserDataId, shareHash, isLoad){
2820		if (typeof isLoad == "undefined") isLoad = false;
2821		if (typeof shareHash == "undefined") shareHash = null;
2822
2823		SetLocalStorage(webuserDataIdStoragePrefix+webuserDataId, {
2824			time: Date(),
2825			shareHash: shareHash,
2826			isLoad: isLoad
2827		});
2828	}
2829
2830	/**
2831	 * Handles the 'storage' event when local storage is altered by another page (not the current one)
2832	 * @param {Event} event The original browser event
2833	 */
2834	function StorageHandler(event) {
2835		var key = event.key;
2836		var info = event.newValue;
2837		try {
2838			info = JSON.parse(info);
2839		} catch (e) {
2840		}
2841		var value;
2842		if (info && typeof (info.value) != "undefined") {
2843			value = info.value;
2844			// IE 11 fires the storage event in the originating window as well. However newer browsers are capabable of duplicating tabs
2845			// which also duplicates the window id and breaks different window detection. Only fire this handler in tabs other than
2846			// the originating tab on ie only to prevent this.
2847			if (cssua && cssua.ua.ie && info.from == GetWindowID()) return;
2848		} else value = info;
2849	
2850		if (ignoreLocalStorage.indexOf(key) < 0) {
2851			switch (key) {
2852				case "mobileMyDocGotoSignIn":
2853					MobileMyDocGotoSignInHandler();
2854					break;
2855				case "mobileMyDoc":
2856					MobileMyDocHandler(value);
2857					break;
2858				case "SecureID":
2859					// A sign in or out has caused the secure id to change
2860					reloadPage();
2861					break;
2862				case "DeletedDocumentIds":
2863					handleWebuserDataIdsChange(value)
2864					break;
2865				case "ReloadMyDocuments":
2866					reloadMyDocuments();
2867					break;
2868				case "ReloadEstateDashboard":
2869					relaodEstateDashboard();
2870					break;
2871			}
2872	
2873			// Old product code way of caching document answers
2874			var code = getCurrentProductCode();
2875			/*
2876			 If this is a specific product getting changed only reload if:
2877				- the share hash is equal (or absent from both the origin and this tab) 
2878					- and if the webuser data id is equal 
2879					- and this isn't an initial load or this is an initial load and the id isn't the same 
2880			 */
2881			if (code == key && pageVariesWithAnswers() && value.shareHash == getQueryStringValue("l") && ((value.id == WebuserDataInfo.id) != value.isLoad)) {
2882				reloadPage();
2883			}
2884			
2885			// New caching method by webuser data id 
2886			// webuserDataID is the old php variable, and is type checked to prevent errors in IE11 on new document pages
2887			// More recent js will have the webuser data id in the query string
2888			var documentId = WebuserDataInfo.id || (typeof webuserDataID != 'undefined' ? webuserDataID : null) || getQueryStringValue("webuser_data_id");
2889			var documentKey = (webuserDataIdStoragePrefix + documentId);
2890			
2891			/*
2892			 If this event is because this exact document has opened on another tab getting changed only reload if:
2893				- the share hash is equal (or absent from both the origin and this tab) 
2894				- and if the webuser data id is equal 
2895				- and this isn't an initial load (as the answers probably have not changed on an initial load)
2896			 */
2897			if (documentId !== null && documentKey === key && pageVariesWithAnswers() && value != null && value.shareHash == getQueryStringValue("l") && !value.isLoad) {
2898				reloadPage();
2899			}
2900		} else {
2901			ignoreLocalStorage.splice(ignoreLocalStorage.indexOf(key));
2902		}
2903	}
2904	
2905
2906	// Attach storage event listener
2907	if (SupportsStorage()) {
2908		if (window.addEventListener) {
2909			/*  Normal browsers */
2910			window.addEventListener("storage", StorageHandler, false);
2911		} else {
2912			/*  for IE */
2913			window.attachEvent("onstorage", StorageHandler);
2914		}
2915	}
2916	
2917	// Namespace exports
2918	$.extend(storage, {
2919		SetLocalStorageAnswerSet: SetLocalStorageAnswerSet,
2920		StorageHandler: StorageHandler
2921	});
2922	
2923	// Backwards compatibility global exports
2924	window.StorageHandler = Sequiter.storage.StorageHandler;
2925})(Sequiter.storage);
2926
2927function relaodEstateDashboard() {
2928	if (typeof isEsateDashboardPage !== "undefined" && isEsateDashboardPage)
2929		window.location.reload();
2930}
2931
2932function reloadMyDocuments() {
2933	if (typeof isMyDocumentsPage !== "undefined" && isMyDocumentsPage)
2934		window.location.reload();
2935}
2936
2937function handleWebuserDataIdsChange(webuserDataIds) {
2938	if (WebuserDataInfo && WebuserDataInfo.id && webuserDataIds) {
2939		var modWebuserDataIds = webuserDataIds.toString().split(",");
2940		modWebuserDataIds.forEach(function (ele) {
2941			if (ele.trim() == WebuserDataInfo.id) {
2942				if (qnh) qnh.GotoQuestions();
2943			}
2944		});
2945	}
2946}
2947/* End Include storage */
2948
2949/* Include localization */
2950var countries = {
2951   'CA':{'false':'Canada','true':'Canada'},
2952   'AU':{'false':'Australia','true':'Australia'},
2953   'GB':{'false':'United Kingdom','true':'United Kingdom of Great Britain and Northern Ireland'},
2954   'US':{'false':'United States','true':'United States of America'}
2955}
2956function gCN(cc,longName){
2957   if(typeof(longName) == 'undefined') longName = false;
2958   if(cc in countries) return countries[cc][longName?'true':'false'];
2959   return cc;
2960}
2961function gC(){
2962   return vh.G('__CountryCode');
2963}
2964function sC(cc){
2965   var val = cc;
2966   if(val == "sel") val = "";
2967   setCookie("L", val + gR());
2968   vh.S('__CountryCode', val);
2969}
2970function gR(){
2971   return vh.G('__RegionCode');
2972}
2973function sR(rc){
2974   var val = rc;
2975   if(val == "sel") val = "";
2976   setCookie("L", gC() + val);
2977   $('#locCode').val(gC() + val);
2978   vh.S('__RegionCode', val);
2979}
2980onJsReady(function () {
2981    registerOnLoadScript(registerCurrentRegionUpdate);
2982})
2983function registerCurrentRegionUpdate(){
2984   vh.R('__RegionCode', '__CurrentRegionName', updateRegionNames, 'change', false);
2985}
2986function updateRegionNames(){
2987   var regionName = gRN(gC(), gR());
2988   $('.regionNameCurrent').text(regionName);
2989   $('.regionNameCurrentUpper').text(regionName.toUpperCase());
2990   $('.regionNameCurrentLower').text(regionName.toLowerCase());
2991   regionName = gRN(gC(), gR(), true);
2992   $('.regionNameCurrentShort').text(regionName);
2993   $('.regionNameCurrentShortUpper').text(regionName.toUpperCase());
2994   $('.regionNameCurrentShortLower').text(regionName.toLowerCase());
2995}
2996var regions = {
2997'AR':{'BA':['Buenos Aires', ''],'CA':['Catamarca', ''],'CB':['Córdoba', ''],'CH':['Chaco', ''],'CR':['Corrientes', ''],'CT':['Chubut', ''],'ER':['Entre Ríos', ''],'FO':['Formosa', ''],'JY':['Jujuy', ''],'LP':['La Pampa', ''],'LR':['La Rioja', ''],'MI':['Misiones', ''],'MZ':['Mendoza', ''],'NQ':['Neuquén', ''],'RN':['Río Negro', ''],'SA':['Salta', ''],'SC':['Santa Cruz', ''],'SE':['Santiago del Estero', ''],'SF':['Santa Fe', ''],'SJ':['San Juan', ''],'SL':['San Luis', ''],'TF':['Tierra del Fuego', ''],'TU':['Tucumán', '']},
2998'AT':{'AT1':['Burgenland', ''],'AT2':['Kärnten', ''],'AT3':['Niederösterreich', ''],'AT4':['Oberösterreich', ''],'AT5':['Salzburg', ''],'AT6':['Steiermark', ''],'AT7':['Tirol', ''],'AT8':['Vorarlberg', ''],'AT9':['Wien', '']},
2999'AU':{'ACT':['Australian Capital Territory', 'ACT'],'NSW':['New South Wales', 'NSW'],'NT':['Northern Territory', 'NT'],'QLD':['Queensland', ''],'SA':['South Australia', ''],'TAS':['Tasmania', ''],'VIC':['Victoria', ''],'WA':['Western Australia', 'WA']},
3000'CA':{'AB':['Alberta', ''],'BC':['British Columbia', ''],'MB':['Manitoba', ''],'NB':['New Brunswick', ''],'NF':['Newfoundland and Labrador', 'NFLD'],'NS':['Nova Scotia', ''],'NT':['Northwest Territories', 'NWT'],'NU':['Nunavut', ''],'ON':['Ontario', ''],'PE':['Prince Edward Island', 'PEI'],'QC':['Quebec', ''],'SK':['Saskatchewan', ''],'YT':['Yukon Territory', '']},
3001'CL':{'AI':['Aysén del General Carlos Ibáñez del Campo', ''],'AN':['Antofagasta', ''],'AP':['Arica y Parinacota', ''],'AR':['La Araucanía', ''],'AT':['Atacama', ''],'BI':['Biobío', ''],'CO':['Coquimbo', ''],'LI':['Libertador General Bernardo O\'Higgins', ''],'LL':['Los Lagos', ''],'LR':['Los Ríos', ''],'MA':['Magallanes y de la Antártica Chilena', ''],'ML':['Maule', ''],'NB':['Ñuble', ''],'RM':['Metropolitana de Santiago', ''],'TA':['Tarapacá', ''],'VA':['Valparaíso', '']},
3002'DE':{'BB':['Brandenburg', ''],'BE':['Berlin', ''],'BW':['Baden-Württemberg', ''],'BY':['Freistaat Bayern', ''],'HB':['Freie Hansestadt Bremen', ''],'HE':['Hessen', ''],'HH':['Freie und Hansestadt Hamburg', ''],'MV':['Mecklenburg-Vorpommern', ''],'NI':['Niedersachsen', ''],'NW':['Nordrhein-Westfalen', ''],'RP':['Rheinland-Pfalz', ''],'SH':['Schleswig-Holstein', ''],'SL':['Saarland', ''],'SN':['Freistaat Sachsen', ''],'ST':['Sachsen-Anhalt', ''],'TH':['Freistaat Thüringen', '']},
3003'ES':{'AN':['Andalucia', ''],'AR':['Aragón', ''],'AS':['Principado de Asturias', ''],'CB':['Cantabria', ''],'CE':['Ciudad Autónoma de Ceuta', ''],'CL':['Castilla y León', ''],'CM':['Castilla La Mancha', ''],'CN':['Islas Canarias', ''],'CT':['Cataluña', ''],'EX':['Extremadura', ''],'GA':['Galicia', ''],'IB':['Islas Baleares', ''],'MC':['Región de Murcia', ''],'MD':['Comunidad de Madrid', ''],'ME':['Ciudad Autónoma de Melilla', ''],'NC':['Comunidad Foral de Navarra', ''],'PV':['País Vasco', ''],'RI':['La Rioja', ''],'VC':['Comunidad Valenciana', '']},
3004'FR':{'AC':['Aquitaine-Limousin-Poitou-Charentes', ''],'AO':['Alsace-Champagne-Ardenne-Lorraine', ''],'AR':['Auvergne-Rhône-Alpes', ''],'BF':['Bourgogne-Franche-Comté', ''],'BT':['Bretagne', ''],'CE':['Corse', ''],'CN':['Centre-Val de Loire', ''],'IF':['Île-de
3004-France', ''],'LP':['Occitanie', ''],'NC':['Nord-Pas-de-Calais-Picardie', ''],'ND':['Normandie', ''],'PL':['Pays de la Loire', ''],'PR':['Provence-Alpes-Côte d\'Azur', '']},
3005'GB':{'ENG':['England', ''],'NIR':['Northern Ireland', ''],'SCT':['Scotland', ''],'WLS':['Wales', '']},
3006'IE':{'CE':['Clare', ''],'CN':['Cavan', ''],'CO':['Cork', ''],'CW':['Carlow', ''],'D':['Dublin', ''],'D1':['Dublin 1', ''],'D10':['Dublin 10', ''],'D11':['Dublin 11', ''],'D12':['Dublin 12', ''],'D13':['Dublin 13', ''],'D14':['Dublin 14', ''],'D15':['Dublin 15', ''],'D16':['Dublin 16', ''],'D17':['Dublin 17', ''],'D18':['Dublin 18', ''],'D2':['Dublin 2', ''],'D20':['Dublin 20', ''],'D22':['Dublin 22', ''],'D24':['Dublin 24', ''],'D3':['Dublin 3', ''],'D4':['Dublin 4', ''],'D5':['Dublin 5', ''],'D6':['Dublin 6', ''],'D6W':['Dublin 6W', ''],'D7':['Dublin 7', ''],'D8':['Dublin 8', ''],'D9':['Dublin 9', ''],'DL':['Donegal', ''],'G':['Galway', ''],'KE':['Kildare', ''],'KK':['Kilkenny', ''],'KY':['Kerry', ''],'LD':['Longford', ''],'LH':['Louth', ''],'LK':['Limerick', ''],'LM':['Leitrim', ''],'LS':['Laois', ''],'MH':['Meath', ''],'MN':['Monaghan', ''],'MO':['Mayo', ''],'OY':['Offaly', ''],'RN':['Roscommon', ''],'SO':['Sligo', ''],'TA':['Tipperary', ''],'WD':['Waterford', ''],'WH':['Westmeath', ''],'WW':['Wicklow', ''],'WX':['Wexford', '']},
3007'IN':{'AN':['Andaman and Nicobar Islands', ''],'AP':['Andhra Pradesh', ''],'AR':['Arunachal Pradesh', ''],'AS':['Assam', ''],'BR':['Bihar', ''],'CH':['Chandigarh', ''],'CT':['Chhattisgarh', ''],'DH':['Dadra and Nagar Haveli and Daman and Diu', ''],'DL':['National Capital Territory of Delhi', ''],'GA':['Goa', ''],'GJ':['Gujarat', ''],'HP':['Himachal Pradesh', ''],'HR':['Haryana', ''],'JH':['Jharkhand', ''],'JK':['Jammu and Kashmir', ''],'KA':['Karnataka', ''],'KL':['Kerala', ''],'LA':['Ladakh', ''],'LD':['Lakshadweep', ''],'MH':['Maharashtra', ''],'ML':['Meghalaya', ''],'MN':['Manipur', ''],'MP':['Madhya Pradesh', ''],'MZ':['Mizoram', ''],'NL':['Nagaland', ''],'OD':['Odisha', ''],'OR':['Odisha', ''],'PB':['Punjab', ''],'PY':['Puducherry', ''],'RJ':['Rajasthan', ''],'SK':['Sikkim', ''],'TG':['Telangana', ''],'TN':['Tamil Nadu', ''],'TR':['Tripura', ''],'TS':['Telangana', ''],'UP':['Uttar Pradesh', ''],'UT':['Uttarakhand', ''],'WB':['West Bengal', '']},
3008'MX':{'AG':['Aguascalientes', ''],'BC':['Baja California', ''],'BS':['Baja California Sur', ''],'CH':['Chihuahua', ''],'CL':['Colima', ''],'CM':['Campeche', ''],'CO':['Coahuila de Zaragoza', ''],'CS':['Chiapas', ''],'CX':['Ciudad de México', ''],'DG':['Durango', ''],'EM':['México', ''],'GR':['Guerrero', ''],'GT':['Guanajuato', ''],'HG':['Hidalgo', ''],'JC':['Jalisco', ''],'MI':['Michoacán', ''],'MO':['Morelos', ''],'NA':['Nayarit', ''],'NL':['Nuevo León', ''],'OA':['Oaxaca', ''],'PU':['Puebla', ''],'QR':['Quintana Roo', ''],'QT':['Querétaro', ''],'SI':['Sinaloa', ''],'SL':['San Luis Potosí', ''],'SO':['Sonora', ''],'TB':['Tabasco', ''],'TL':['Tlaxcala', ''],'TM':['Tamaulipas', ''],'VE':['Veracruz', ''],'YU':['Yucatán', ''],'ZA':['Zacatecas', '']},
3009'NG':{'AB':['Abia', ''],'AD':['Adamawa', ''],'AK':['Akwa', ''],'AN':['Anambra', ''],'BA':['Bauchi', ''],'BE':['Benue', ''],'BO':['Borno', ''],'BY':['Bayelsa', ''],'CR':['Cross', ''],'DE':['Delta', ''],'EB':['Ebonyi', ''],'ED':['Edo', ''],'EK':['Ekiti', ''],'EN':['Enugu', ''],'FC':['Abuja', ''],'GO':['Gombe', ''],'IM':['Imo', ''],'JI':['Jigawa', ''],'KD':['Kaduna', ''],'KE':['Kebbi', ''],'KN':['Kano', ''],'KO':['Kogi', ''],'KT':['Katsina', ''],'KW':['Kwara', ''],'LA':['Lagos', ''],'NA':['Nasarawa', ''],'NI':['Niger', ''],'OG':['Ogun', ''],'ON':['Ondo', ''],'OS':['Osun', ''],'OY':['Oyo', ''],'PL':['Plateau', ''],'RI':['Rivers', ''],'SO':['Sokoto', ''],'TA':['Taraba', ''],'YO':['Yobe', ''],'ZA':['Zamfara', '']},
3010'NZ':{'NZ':['New Zealand', '']},
3011'SG':{'01':['Central Singapore', ''],'02':['North East', ''],'03':['North West', ''],'04':['South East', ''],'05':['South West', '']},
3012'US':{'AK':['Alaska', ''],'AL':['Alabama', ''],'AR':['Arkansas', ''],'AZ':['Arizona', ''],'CA':['California', ''],'CO':['Colorado', ''],'CT':['Connecticut', ''],'DC':['District of Columbia', 'DC'],'DE':['Delaware', ''],'FL':['Florida', ''],'GA':['Georgia', ''],'GU':['Guam', ''],'HI':['Hawaii', ''],'IA':['Iowa', ''],'ID':['Idaho', ''],'IL':['Illinois', ''],'IN':['Indiana', ''],'KS':['Kansas', ''],'KY':['Kentucky', ''],'LA':['Louisiana', ''],'MA':['Massachusetts', ''],'MD':['Maryland', ''],'ME':['Maine', ''],'MI':['Michigan', ''],'MN':['Minne
3012sota', ''],'MO':['Missouri', ''],'MS':['Mississippi', ''],'MT':['Montana', ''],'NC':['North Carolina', ''],'ND':['North Dakota', ''],'NE':['Nebraska', ''],'NH':['New Hampshire', ''],'NJ':['New Jersey', ''],'NM':['New Mexico', ''],'NV':['Nevada', ''],'NY':['New York', ''],'OH':['Ohio', ''],'OK':['Oklahoma', ''],'OR':['Oregon', ''],'PA':['Pennsylvania', ''],'PR':['Puerto Rico', ''],'RI':['Rhode Island', ''],'SC':['South Carolina', ''],'SD':['South Dakota', ''],'TN':['Tennessee', ''],'TX':['Texas', ''],'UT':['Utah', ''],'VA':['Virginia', ''],'VI':['U.S. Virgin Islands', ''],'VT':['Vermont', ''],'WA':['Washington', ''],'WI':['Wisconsin', ''],'WV':['West Virginia', ''],'WY':['Wyoming', '']}};
3013
3014function gRN(cc, rc, useShort){
3015if(cc in regions && rc in regions[cc]) {
3016   if(useShort && regions[cc][rc][1] != ''){
3017      return regions[cc][rc][1];
3018   }
3019   return regions[cc][rc][0];
3020}else if(cc .toUpperCase() =='CA'&& rc && rc.toUpperCase()=='FED'){
3021    return "the federal laws of Canada";
3022}
3023else return "";
3024}
3025function gFJ(cc, rc){
3026   n = gRN(cc, rc);
3027   switch (cc.toUpperCase()){
3028      case "US":
3029         switch (rc.toUpperCase()){
3030            case "KY":
3031            case "MA":
3032            case "PA":
3033            case "PR":
3034            case "VA":
3035               return "The Commonwealth of " + n;
3036            case "DC":
3037               return "The " + n;
3038            case "GU":
3039               return "The Territory of " + n;
3040            case "VI":
3041               return "The Territory of the " + n;
3042            default:
3043               return "The State of " + n;
3044         }
3045      case "CA":
3046          switch (rc.toUpperCase()){
3047              case "YT":
3048              case "NT":
3049                  return "The " + n;
3050              case "NU":
3051                  return "The Territory of " + n;
3052              default:
3053                  return "The Province of " + n;
3054          }
3055      case "AU":
3056          switch (rc.toUpperCase())
3057          {
3058              case "ACT":
3059              case "NT":
3060                  return "The " + n;
3061              default:
3062                  return "The State of " + n;
3063          }
3064      case "GB":
3065          return "The Country of " + n;
3066      default:
3067          return "The State of " + n;
3068   }
3069}
3070function gJ(cc, rc)
3071{
3072    switch (cc.toUpperCase())
3073    {
3074        case "US":
3075            switch (rc.toUpperCase())
3076            {
3077                case "KY":
3078                case "MA":
3079                case "PA":
3080                case "PR":
3081                case "VA":
3082                    return "Commonwealth";
3083                case "DC":
3084                    return "District";
3085                case "GU":
3086                case "VI":
3087                    return "Territory";
3088                default:
3089                    return "State";
3090            }
3091        case "CA":
3092            switch (rc.toUpperCase())
3093            {
3094                case "YT":
3095                case "NT":
3096                case "NU":
3097                    return "Territory";
3098                default:
3099                    return "Province";
3100            }
3101        case "AU":
3102            switch (rc.toUpperCase())
3103            {
3104                case "ACT":
3105                case "NT":
3106                    return "Territory";
3107                default:
3108                    return "State";
3109            }
3110        case "GB":
3111            return "Country";
3112        default:
3113            return "State";
3114    }
3115}
3116function gS(cc, rc){
3117   var val = "Share";
3118   if (cc == "US"){
3119      switch (rc){
3120         case "DE":
3121         case "KS":
3122         case "MA":
3123            val = "Stock";
3124            break;
3125      }
3126   }
3127   return val;
3128}
3129function sLC(id,country,region){
3130   var obj = $("#" + id);
3131   if(obj.length == 0) return;
3132   var currentClass = obj.attr('class');
3133   var currentLocStart = currentClass.indexOf("loc-");
3134   if(currentLocStart == 0 || currentClass[currentLocStart - 1] == " "){
3135      var currentLocEnd = currentClass.indexOf(" ", currentLocStart);
3136      if(currentLocEnd < 0) currentLocEnd = currentClass.length;
3137      var currentLoc = currentClass.substring(currentLocStart, currentLocEnd);
3138      obj.removeClass(currentLoc);
3139   }
3140   obj.addClass("loc-"+country+region);
3141   var imgTag = $("#"+id+" img");
3142   if(imgTag.length > 0){
3143      var useCountryOnly = region == null || region == "sel" || region == "GU" || region == "PR" || region == "VI";
3144      var imgSrc = '/contracts/DCSDefinitions/Images/RegionImages/' + country + '/' + country + (useCountryOnly?"":region) + '.png';
3145      imgSrc = imgSrc;
3146      imgTag.attr("src", imgSrc);
3147   }
3148}
3149var postalMaskOptions = {
3150   onKeyPress: function(val, e, field, options){
3151      field.mask(postalMask.apply({}, arguments), options);
3152   }
3153}
3154function postalMask(val){
3155   var countryCode = getCountry();
3156   if (countryCode == 'CA'){
3157       return "S0S 0S0"
3158   }
3159   else if (countryCode == "GB"){
3160       if (val.match(/^[A-Za-z][0-9][A-Za-z]/)){
3161           return 'S0S 0SS';
3162       }
3163       else if (val.match(/^[A-Za-z][0-9][ ]|^[A-Za-z][0-9][0-9][A-Za-z]/)){
3164           return 'S0 0SS';
3165       }
3166       else if (val.match(/^[A-Za-z][0-9][0-9][ ]|^[A-Za-z][0-9][0-9][0-9]/)){
3167           return 'S00 0SS';
3168       }
3169       else if (val.match(/^[A-Za-z][A-Za-z][0-9][A-Za-z]/)){
3170           return 'SS0S 0SS';
3171       }
3172       else if (val.match(/^[A-Za-z][A-Za-z][0-9][ ]|^[A-Za-z][A-Za-z][0-9][0-9][A-Za-z]/)){
3173           return 'SS0 0SS';
3174       }
3175       else if (val.match(/^[A-Za-z][A-Za-z][0-9][0-9][0-9]|^[A-Za-z][A-Za-z][0-9][0-9][ ]/)){
3176           return 'SS00 0SS';
3177       }
3178       else {
3179           return "SL09L 0SS";
3180       }
3181   }
3182   else if (countryCode == "AU" || countryCode == "NZ"){
3183       return "0000";
3184   }
3185   else if (countryCode == "US"){
3186       return "00000-0000";
3187   }
3188   else if (countryCode == "IE"){
3189       return "AAA AAAA";
3190   }
3191   else if (countryCode == "FR"){
3192       return "00000";
3193   }
3194   else if (countryCode == "SG"){
3195      return "000000";
3196   }
3197   else if (countryCode == "NG"){
3198      return "000000";
3199   }
3200   return 'AAAAAAAAA';
3201}
3202/* End Include localization */
3203
3204/* Include tabHandler */
3205/* Tab Handler */
3206function TabHandler(){
3207   this.Info = new Array();
3208   this.Current = "";
3209   this.Init = function (name){
3210      if(typeof(this.Info[name]) == "undefined"){
3211         this.Info[name] = new Array();
3212         this.Info[name].tabs = new Array();
3213         this.Info[name].sections = new Array();
3214      }
3215   }
3216   this.A = function(name, tab, sectionID){
3217      this.AT(name, tab);
3218      this.AS(name, sectionID);
3219   }
3220   this.AT = function (name, tab){
3221      this.Init(name);
3222      for(var i = 0; i < this.Info[name].tabs.length; ++i){
3223         if(this.Info[name].tabs[i] == tab){
3224            return;
3225         }
3226      }
3227      this.Info[name].tabs.push(tab);
3228   }
3229   this.AS = function (name, sectionID){
3230      this.Init(name);
3231      for(var i = 0; i < this.Info[name].sections.length; ++i){
3232         if(this.Info[name].sections[i] == sectionID){
3233            return;
3234         }
3235      }
3236      this.Info[name].sections.push(sectionID);
3237   }
3238   this.ST = function(name, forcePostBack, formName){
3239      if(!ajaxInProgress && cV(false) && this.Info[name] != null && this.Info[this.Current] != null){
3240         if(forcePostBack === undefined){
3241            forcePostBack = false;
3242         }
3243         for(var i=0; i<this.Info[this.Current].tabs.length; ++i){
3244            this.Info[this.Current].tabs[i].className=this.Info[this.Current].tabs[i].className.replace( /(?:^|\s)selected(?!\S)/ , '' );
3245         }
3246         for(var i=0; i<this.Info[name].tabs.length; ++i){
3247            this.Info[name].tabs[i].className += " selected";
3248         }
3249         var exists = true;
3250         for(var i=0; i<this.Info[name].sections.length; ++i){
3251            var temp = gI(this.Info[name].sections[i]);
3252            if(temp == null){
3253               exists = false;
3254            }
3255         }
3256         if(exists){
3257            for(var i=0; i<this.Info[this.Current].sections.length; ++i){
3258               sD(this.Info[this.Current].sections[i], false);
3259            }
3260            for(var i=0; i<this.Info[name].sections.length; ++i){
3261               sD(this.Info[name].sections[i], true);
3262            }
3263            this.Current = name;
3264            window.location.hash="";
3265            window.location.hash="_questions";
3266            if(!forcePostBack && typeof(formName) == 'string'){
3267               saveASPAJAX(formName, true, true, true);
3268               vh.CC();
3269            }
3270            return forcePostBack;
3271         }
3272         else{
3273            setSave(false);
3274            AjaxWait();
3275         }
3276         window.location.hash="";
3277         window.location.hash="_questions";
3278      }
3279      else{
3280         return false;
3281      }
3282      return true;
3283   }
3284   this.SS = function(name){
3285      setSave(true);
3286      if(name != this.Current){
3287         for(var i=0; i<this.Info[this.Current].sections.length; ++i){
3288            sD(this.Info[this.Current].sections[i], false);
3289         }
3290         this.Current = name;
3291      }
3292   }
3293}
3294var th = new TabHandler();
3295/* End Tab Handler */
3296/* End Include tabHandler */
3297
3298/* Include dialogs */
3299function tryIsInDialog(includeFramed) {
3300	if (typeof(isInDialog) !== "function") return false;
3301	return isInDialog(includeFramed);
3302}
3303
3304function getDialogIDFromFrameID(frameID){
3305   return $('#'+frameID).parent().prop("id");
3306}
3307function getDialogCenterPosition() {
3308   return {my: "center", at: "center", of: window, collision: "fit", within: document};
3309}
3310function reCenterDialog(dialogID){
3311   if(typeof(dialogID) == "undefined") dialogID = "divDialog";
3312   $('#'+dialogID).dialog('option', 'position', getDialogCenterPosition());
3313}
3314function setDialogTitle(title, id){
3315   if(typeof(id) == "undefined" || id == null) id = "divDialog";
3316   $('#'+id).dialog("option", 'title', title);
3317}
3318
3319function setDialogContentHeight(height, dialogID, iFrameID){
3320	if(height != null) {
3321      if(!dialogID && iFrameID) dialogID = getDialogIDFromFrameID(iFrameID);
3322		if(typeof(dialogID) == "undefined" || !dialogID) dialogID = "divDialog";
3323      var dialog = $("#"+dialogID);
3324      if(!dialog.length || !dialog.is(":ui-dialog")) return;
3325
3326      var dialogHeight = dialog.dialog('option', 'height');
3327      if(!isNaN(dialogHeight)){
3328		var isSetFullScreen = $(dialog).parent().hasClass("fullScreenDialogContainer");
3329		var isFullScreen = window.innerWidth < 768;
3330		if (isSetFullScreen && !isFullScreen)
3331			dialog.dialog('option', 'height', dialogHeight);
3332		else {
3333			var heightDiff = dialogHeight - dialog.height();
3334			var newHeight = (height + heightDiff)< 0 ? height: (height + heightDiff);
3335			dialog.dialog('option', 'height', newHeight);
3336		}
3337      }
3338
3339      if(fullMobileSupport()){
3340   		if(typeof(iFrameID) == "undefined" || !iFrameID) iFrameID = "ifMyDocuments";
3341   		/* If its My Document and is Phone the don't set the height, let it be 100%. Otherwise it will give a height problem in Phone when expanding folder */
3342	   	if(!($( ".ui-dialog" ).hasClass( "newmydocumentDialog") && isPhone()))
3343         	$('#'+iFrameID).height(height);
3344      }
3345	}
3346}
3347
3348function setDialogWidth(width, dialogID){
3349   if(typeof(dialogID) == "undefined") dialogID = "divDialog";
3350   $('#'+dialogID).dialog('option', 'width', width);
3351   resizeDialogToFitContents();
3352}
3353function showGenericErrorDialog(){
3354   $("html, body").scrollTop(0); /* Scroll to the top before displaying the error dialog as there can be various issues with positioning the dialog if we don't. */
3355   showInlineDialog("<p>There was an error loading this page. Try reloading the page. If the error persists, you can contact us for support.</p><div><a class=\"largeInactiveButton\" href=\"/help/\">Contact Us</a><a class=\"largeActiveButton\" onclick=\"location.reload(true);\">Reload</a></div>", "Error", null, {cssClass:"errorDialog alertDialog"});
3356}
3357function showFooterDialog(title, href){
3358   showDialog(title, href, null, null, null, null, null, null, {effect:"slide", direction:"right", origin:["bottom","center"], duration:400});
3359}
3360function initInlineFooterDialog(id, title, width, height, cssClass, isChildDialog){
3361   if(typeof(isChildDialog) == "undefined") isChildDialog = false;
3362
3363   var dialogObj = null;
3364   if(typeof(id) == 'string'){
3365      dialogObj = $("#" + id);
3366      if(dialogObj.length == 1){
3367         dialogObj.dialog({
3368            autoOpen: false,
3369            width:width,
3370            height:height,
3371            closeText : "Close",
3372            draggable: false,
3373            resizable: false,
3374            modal: true,
3375            title: title,
3376            dialogClass: cssClass + " inlineFooterDialog",
3377            close: function(ev, ui) {
3378               try {dialogObj.dialog("destroy");} catch(e) {}
3379               _InlineFooterDialog = undefined;
3380               $("#divInlineFooterDialog").hide();
3381            },
3382            open: function(event, ui) {
3383               OnDialogOpen();
3384            },
3385            beforeClose: function(event, ui) {
3386               OnDialogClose(undefined, undefined, isChildDialog);
3387            }
3388         });
3389      }
3390   }
3391   return dialogObj;
3392}
3393var _InlineFooterDialog;
3394function showInlineFooterDialog(title, href, width, height, cssClass, overlayOpacity, clickClose, noResize, animation, isChildDialog) {
3395   if(tryIsInDialog() && typeof(parent.showInlineFooterDialog) == "function") {
3396      parent.showInlineFooterDialog(title, href, width, height, cssClass, overlayOpacity, clickClose, noResize, animation, true);
3397      return;
3398   }
3399
3400   if (VueWebsitePolicyDialogPresenter.tryShowWebsitePolicyDialog(href)) return;
3401
3402   if(typeof(isChildDialog) == "undefined") isChildDialog = false;
3403
3404   if(typeof(_InlineFooterDialog) == 'undefined'){
3405      if(!$("#divInlineFooterDialog").length) {
3406   		$('body').append('<div id="divInlineFooterDialog"></div>');
3407      }
3408      _InlineFooterDialog = initInlineFooterDialog("divInlineFooterDialog", title, width, height, cssClass, isChildDialog);
3409	} else {
3410      _InlineFooterDialog.dialog("option", {
3411         title: title,
3412         width: width,
3413         height: height,
3414         dialogClass: cssClass
3415      });
3416   }
3417
3418	if(typeof(HideBodyToolTips) == "function") {
3419		HideBodyToolTips();
3420	}
3421   if(animation && animation.duration){
3422      _InlineFooterDialog.dialog('option', 'show', animation);
3423      _InlineFooterDialog.dialog('option', 'hide', animation);
3424	} else {
3425      _InlineFooterDialog.dialog('option', 'show', null);
3426      _InlineFooterDialog.dialog('option', 'hide', null);
3427   }
3428	_InlineFooterDialog.dialog('open');
3429	if(typeof(cssua) != "undefined" && cssua.ua.mobile && typeof(scrollToEl) == "function") {
3430		scrollToEl("body > .ui-dialog[aria-describedby='divInlineFooterDialog']");
3431		$('html,body').animate({scrollTop: $(window).scrollTop()-30}, 0);
3432	}
3433   overlayOpacity = 0.3;
3434   var overlay = $(".ui-widget-overlay");
3435   overlay.css("opacity", overlayOpacity);
3436   overlay.css("filter", "Alpha(Opacity=" + overlayOpacity * 100 + ")");
3437   if(clickClose){
3438		overlay.on('click', function() {
3439			if(_InlineFooterDialog)_InlineFooterDialog.dialog('close');
3440		});
3441   }
3442
3443   _InlineFooterDialog.empty();
3444   _InlineFooterDialog.append("<table id='tblLoaderInlineFooter' class='slate-loader'>"+$("#tblLoader").html()+"</table>");
3445   showFullScreenDialog(_InlineFooterDialog, null, null, animation);
3446   if(!$("html").hasClass("ua-mobile-iphone")){
3447		$(window).on("resize", function() {
3448         if(typeof(_InlineFooterDialog) != "undefined") {
3449   			_InlineFooterDialog.dialog("option", "position", getDialogCenterPosition());
3450         }
3451		});
3452	}
3453
3454	/* Safari Browser, closing footer dialog displays blank page , Added scroll top to change the default behavior of the Address bar */
3455	if(cssua.ua.safari && cssua.ua.mobile) {
3456		$(window).scrollTop(1);
3457	}
3458
3459   $.ajax({
3460      type: "GET",
3461      url: href,
3462      success: function(result) {
3463         var resultParsed = $.parseHTML(result, true);
3464         var innerResult = null;
3465         $.each(resultParsed, function(index, item) {
3466            if($(item).is("div[id^='contentTopInner']")) {
3467               innerResult = $(item).html();
3468            }
3469         });
3470         $("#tblLoaderInlineFooter").hide().parent().append(innerResult);
3471         _InlineFooterDialog.dialog("option", "position", getDialogCenterPosition());
3472		 $('.secondDialog #divInlineFooterDialog').css('height', '438px');
3473      },
3474      error: function(result) {
3475         var redirectHref = href.replace(/[\&]?dialog=true/i, "");
3476         if(redirectHref.indexOf("?") == redirectHref.length - 1) {
3477            redirectHref = redirectHref.substring(0, redirectHref.length-1);
3478         }
3479         top.location = redirectHref;
3480         return;
3481      }
3482   });
3483}
3484function popUp(url, width, height){
3485   return window.open(url, 'newWindow', 'width=' + width + ',height=' + height + ',scrollbars=yes,resizable=yes');
3486}
3487
3488const VueWebsitePolicyDialogPresenter = (function() {
3489   const DEFAULT_POLICIES_CONTROLLER = {
3490      showTermsOfUse: () => {},
3491      showPrivacyPolicy: () => {},
3492      showEmailPolicy: () => {},
3493      showEditorialPolicy: () => {},
3494      showCookiePolicy: () => {},
3495      showDisclaimer: () => {},
3496   };
3497
3498   const getPoliciesController = () => {
3499      return window.VueWebsitePoliciesController
3500         ? window.VueWebsitePoliciesController
3501         : DEFAULT_POLICIES_CONTROLLER;
3502   }
3503
3504   const POLICY_DIALOG_PRESENTER_BY_PATHNAME_MAP = {
3505	  // Terms
3506	  "/terms.php": () => getPoliciesController().showTermsOfUse(),
3507	  "/terms": () => getPoliciesController().showTermsOfUse(),
3508	  "/terms/": () => getPoliciesController().showTermsOfUse(),
3509      "/conditionsgenerales/": () => getPoliciesController().showTermsOfUse(),
3510	  // Privacly
3511      "/privacy": () => getPoliciesController().showPrivacyPolicy(),
3512	  "/privacy/": () => getPoliciesController().showPrivacyPolicy(),
3513      "/privee/": () => getPoliciesController().showPrivacyPolicy(),
3514	  "/privacy.php": () => getPoliciesController().showPrivacyPolicy(),
3515	  // Cookies
3516      "/cookies/": () => getPoliciesController().showCookiePolicy(),
3517	  "/cookies": () => getPoliciesController().showCookiePolicy(),
3518	  "/cookiesUK.php": () => getPoliciesController().showCookiePolicy(),
3519	  // Disclaimer
3520      "/disclaimer": () => getPoliciesController().showDisclaimer(),
3521	  "/disclaimer/": () => getPoliciesController().showDisclaimer(),
3522	  "/disclaimer.php": () => getPoliciesController().showDisclaimer(),
3523      "/mise-en-garde/": () => getPoliciesController().showDisclaimer(),
3524	  // Email Policy
3525	  "/email-policy/": () => getPoliciesController().showEmailPolicy(),
3526      "/politique-de-messagerie/": () => getPoliciesController().showEmailPolicy(),
3527	  // Editorial policy
3528	  "/editorial-policy/": () => getPoliciesController().showEditorialPolicy(),
3529	  "/redaktionelle-leitlinien/": () => getPoliciesController().showEditorialPolicy(),
3530	  "/at/redaktionelle-leitlinien/": () => getPoliciesController().showEditorialPolicy(),
3531	  "/politique-editoriale/": () => getPoliciesController().showEditorialPolicy()
3532   };
3533
3534   const getTypedUrl = (url) => {
3535      if (!url) return undefined;
3536
3537      try {
3538         const isAbsoluteUrl = url.startsWith(window.location.protocol);
3539         return isAbsoluteUrl
3540            ? new URL(url)
3541            : new URL(url, window.location.origin);
3542      } catch {
3543         return undefined;
3544      }
3545   }
3546
3547   const getPathnameFromUrl = (url) => {
3548      const typedUrl = getTypedUrl(url);
3549      return typedUrl ? typedUrl.pathname : undefined;
3550   }
3551
3552   /**
3553    * Extracts a section id from a URL hash fragment.
3554    * Tolerates legacy DCS links that append a query after the hash
3555    * (e.g. "#Widerrufsbelehrung?dialog=true").
3556    */
3557   const getSectionIdFromUrl = (url) => {
3558      const typedUrl = getTypedUrl(url);
3559      if (!typedUrl || !typedUrl.hash) return undefined;
3560
3561      const fragmentWithoutHashSign = typedUrl.hash.slice(1);
3562      const sectionId = fragmentWithoutHashSign.split("?")[0];
3563      if (!sectionId) return undefined;
3564
3565      try {
3566         return decodeURIComponent(sectionId);
3567      } catch {
3568         return sectionId;
3569      }
3570   }
3571
3572   const findPolicySectionElement = (sectionId) => {
3573      const contentRoots = document.querySelectorAll(
3574         ".policy-content-text.non-pdf-component, .policy-content-text.dialog"
3575      );
3576      for (const contentRoot of contentRoots) {
3577         const targetElement = Array.from(
3578            contentRoot.querySelectorAll("[id]")
3579         ).find((element) => element.id === sectionId);
3580         if (targetElement) {
3581            return targetElement;
3582         }
3583      }
3584      return undefined;
3585   }
3586
3587   /**
3588    * The Vue policy dialog loads content asynchronously and the host page
3589    * URL never receives the link's hash, so scroll to the section after
3590    * the dialog content appears.
3591    */
3592   const scrollPolicyDialogToSection = (sectionId) => {
3593      if (!sectionId) return;
3594
3595      const existingTarget = findPolicySectionElement(sectionId);
3596      if (existingTarget) {
3597         existingTarget.scrollIntoView();
3598         return;
3599      }
3600
3601      const observer = new MutationObserver(() => {
3602         const targetElement = findPolicySectionElement(sectionId);
3603         if (!targetElement) return;
3604
3605         observer.disconnect();
3606         targetElement.scrollIntoView();
3607      });
3608      observer.observe(document.body, { childList: true, subtree: true });
3609      setTimeout(() => observer.disconnect(), 10000);
3610   }
3611
3612   /**
3613    * Analyzes the given URL and tries to open a policy dialog.
3614    * Returns true if the dialog is opened; false otherwise.
3615    *
3616    * @param {string} url The URL to analyze.
3617    * @returns True or false.
3618    */
3619   const tryShowWebsitePolicyDialog = (url) => {
3620      let pathname = getPathnameFromUrl(url);
3621      if (!pathname) return false;
3622
3623      const countryCodeRegex = /^\/[a-zA-Z]{2}\//;
3624      pathname = pathname.replace(countryCodeRegex, '/');
3625
3626      const policyDialogPresenter = POLICY_DIALOG_PRESENTER_BY_PATHNAME_MAP[pathname];
3627      if (!policyDialogPresenter) return false;
3628
3629      policyDialogPresenter();
3630      scrollPolicyDialogToSection(getSectionIdFromUrl(url));
3631      return true;
3632   };
3633
3634   const executeWhenDialogWindowReady = (dialogWindow, action) => {
3635      dialogWindow.addEventListener("load", action);
3636   };
3637
3638   const openDialogInNewWindow = (pathname, windowWidth, windowHeight) => {
3639      const dialogUrl = pathname.endsWith("/")
3640         ? `${pathname}?dialog=true`
3641         : `${pathname}/?dialog=true`;
3642      return popUp(dialogUrl, windowWidth, windowHeight);
3643   }
3644
3645   const configureDialogWindowPadding = (dialogWindowDocument) => {
3646      dialogWindowDocument.body.style.setProperty('padding', '15px 20px 0 20px', 'important');
3647   }
3648
3649   const switchFullToDialogPolicyTextView = (dialogWindowDocument) => {
3650      const fullPolicyTextElements = dialogWindowDocument.getElementsByClassName("policy-content-text full");
3651      for (const fullPolicyTextElement of fullPolicyTextElements) {
3652         fullPolicyTextElement.classList.remove("full");
3653         fullPolicyTextElement.classList.add("dialog");
3654      }
3655   }
3656
3657   /**
3658    * Analyzes the given URL and tries to open a dialog in a new window.
3659    * Returns true if the dialog is opened in a new window; false otherwise.
3660    *
3661    * @param {string} url The URL to analyze.
3662    * @returns True or false.
3663    */
3664   const tryShowWebsitePolicyDialogInNewWindow = (url, windowWidth, windowHeight) => {
3665      const pathname = getPathnameFromUrl(url);
3666      if (!pathname) return false;
3667
3668      if (!POLICY_DIALOG_PRESENTER_BY_PATHNAME_MAP[pathname]) return false;
3669
3670      const policyDialogWindow = openDialogInNewWindow(pathname, windowWidth, windowHeight);
3671      if (!policyDialogWindow) return false;
3672
3673      executeWhenDialogWindowReady(policyDialogWindow, () => {
3674         const dialogWindowDocument = policyDialogWindow.document;
3675         configureDialogWindowPadding(dialogWindowDocument);
3676         switchFullToDialogPolicyTextView(dialogWindowDocument);
3677      });
3678
3679      return true;
3680   };
3681
3682   return {
3683      tryShowWebsitePolicyDialog,
3684      tryShowWebsitePolicyDialogInNewWindow,
3685   };
3686})();
3687
3688function showDialog(title, href, width, height, cssClass, overlayOpacity, clickClose, noResize, animation) {
3689   if (tryIsInDialog()) {
3690      if (!VueWebsitePolicyDialogPresenter.tryShowWebsitePolicyDialogInNewWindow(href, width, height)) {
3691         popUp(href, width, height);
3692      }
3693
3694      return;
3695   }
3696
3697   if (VueWebsitePolicyDialogPresenter.tryShowWebsitePolicyDialog(href)) return;
3698
3699    var target = /(.*)(#.*)(\?.*)/.exec(href);
3700         if (target != null && target.length == 4 )
3701            {
3702                  href = target[1]+target[3]+target[2];
3703               }
3704   /* Title fix for Sharing Application calling for old DCS*/
3705   if(href.indexOf('/sharing/?email=true')!=-1){
3706      title = "Email Document";
3707   }
3708
3709	/* Disable History for all mobile device */
3710   if(typeof(cssua) != "undefined" && cssua.ua.mobile && href.indexOf('/ChangeLog/index.aspx')>-1){
3711		alert("You must be on a desktop computer to view history");
3712		return false;
3713	}
3714
3715	if(href.indexOf('/MyDocuments/index.aspx')>-1){
3716            if(typeof(saveData) == "function"){
3717                  forceSave = true;
3718                  saveData();
3719                  forceSave = false;
3720               }else if(window.location.pathname.indexOf("preview.php") >= 0 || (window.location.pathname.indexOf("preview.aspx") >= 0)){
3721                        saveAllFrames();
3722                  }
3723		/* Temporary fix till all DCS get compiled */
3724		if (cssClass == undefined ){
3725		 cssClass = 'plainDialog newmydocumentDialog';
3726		 width = width >= 900? 500 : 400;
3727		 height = 339;
3728		}
3729
3730            if(typeof isSlate !="undefined" && isSlate()){
3731                  cssClass +=" isSlate";
3732            }
3733            //var isLawDepot = false;
3734            var isLawDepot = typeof isSlate === "undefined" ? false : isSlate();
3735            if(isLawDepot){
3736                  width =  href.indexOf('saveDoc') ==-1 ? 750: 500;
3737            }
3738
3739		/* for mobile device */
3740		if(!fullMobileSupport() && href.indexOf('saveDoc')==-1 && href.indexOf('save')==-1 && isPhone()){
3741         doMobileMyDoc = true;
3742         SetLocalStorage("mobileMyDoc", "");
3743			window.open(href,"_blank");
3744			return false;
3745		}
3746		/* If editor record is modified and User click My Document then ask for confirmation here
3747			  Don't show Confirmation message when user is trying to save */
3748		if(typeof isEditorPage !="undefined" && isEditorPage && href.indexOf("/MyDocuments/index.aspx?view=saveDoc") == -1){
3749			var isModified = getCookieValue("editor-value-modified");
3750			if(isModified == 'true' && href.indexOf("bypass")== -1 ){
3751				return false;
3752			}
3753		}
3754   }
3755	/* end My Documents */
3756
3757   var dialogObj = $('#divDialog');
3758
3759   /* Fix DCS1.95 issue with duplicate ID=divDialog */
3760   if(!dialogObj.hasClass("ui-dialog-content") && $("div[id='divDialog']").length>1){
3761      $("div[id='divDialog']").each(function(){
3762            if(!$(this).hasClass("ui-dialog-content")){
3763                $(this).remove();
3764                  return false;
3765            }
3766      });
3767      dialogObj = $('#divDialog');
3768   }
3769
3770   if(!dialogObj.length) return false;
3771
3772	if(width)
3773		dialogObj.dialog('option', 'width', width);
3774	if(height)
3775		dialogObj.dialog('option', 'height', height);
3776	dialogObj.dialog('option', 'title', title);
3777   if(typeof(cssClass) != "undefined"){
3778      dialogObj.dialog('option', 'dialogClass', cssClass);
3779	} else {
3780      dialogObj.dialog('option', 'dialogClass', '');
3781   }
3782
3783   	/* Set Opacity to .3 for all dialogs */
3784   overlayOpacity =0.3;
3785
3786
3787	if(typeof(HideBodyToolTips) == "function") {
3788		HideBodyToolTips();
3789	}
3790	var iframe = getDialogIframe();
3791   $(iframe).off("load");
3792   if(animation && animation.duration){
3793      dialogObj.dialog('option', 'show', animation);
3794      dialogObj.dialog('option', 'hide', animation);
3795	   dialogObj.dialog('open');
3796
3797		setTimeout(function() {
3798			iframe.contentWindow.location.replace(href);
3799			bindDialogIframeLoad(noResize);
3800		}, animation.duration + 10);
3801	} else {
3802      dialogObj.dialog('option', 'show', null);
3803      dialogObj.dialog('option', 'hide', null);
3804      iframe.contentWindow.location.replace(href);
3805	   dialogObj.dialog('open');
3806      bindDialogIframeLoad(noResize);
3807   }
3808
3809	if(typeof(cssua) != "undefined" && cssua.ua.mobile && typeof(scrollToEl) == "function") {
3810		scrollToEl("body > .ui-dialog[aria-describedby='divDialog']");
3811		$('html,body').animate({scrollTop: $(window).scrollTop()-30}, 0);
3812	}
3813
3814   var overlay = $(".ui-widget-overlay");
3815   overlay.css("opacity", overlayOpacity);
3816   overlay.css("filter", "Alpha(Opacity=" + overlayOpacity * 100 + ")");
3817
3818   if(clickClose){
3819		overlay.on('click', function() {
3820			dialogObj.dialog('close');
3821		});
3822   }
3823
3824   dialogObj.scrollTop(0);
3825
3826   toggleLoader(true);
3827
3828   if(href.indexOf('/MyDocuments/index.aspx')>-1){
3829	   /* This function only needed for hidding tooltip of mydocument when mouse is outside my document dialog */
3830		if(href.indexOf('saveDoc')==-1 && href.indexOf('save')==-1){
3831			iframe.onload = function(){
3832				CloseMyDocumentToolTip();
3833			};
3834		}
3835   }
3836	return false;
3837}
3838function bindDialogIframeLoad(noResize){
3839   $(getDialogIframe())
3840      .on("load", function(){dialogLoadComplete(noResize);})
3841      .on("slateInitComplete", function(){dialogSlateInitComplete(noResize, this); })
3842      .attr("scrolling", noResize ? "yes" : "no")
3843			.css("overflow", "hidden");
3844   }
3845
3846function CloseMyDocumentToolTip(){
3847   $('.ui-widget-overlay').on("mouseover", function(){
3848              var myDocIframe =	document.getElementById('ifMyDocuments');
3849      if(myDocIframe && !isCrossOriginFrame(myDocIframe)) {
3850				  var iframeContent = (myDocIframe.contentWindow || myDocIframe.contentDocument);
3851
3852			if(typeof iframeContent.HideCurrentTooltip != "undefined")
3853				iframeContent.HideCurrentTooltip();
3854			  }
3855	});
3856}
3857
3858function dialogSlateInitComplete(noResize, frame){
3859   dialogLoadComplete(noResize);
3860   $(frame).off("slateInitComplete");
3861}
3862
3863function dialogLoadComplete(noResize){
3864   if(typeof(noResize) == "undefined") noResize = false;
3865   var iframe = getDialogIframe();
3866   if(iframeHasContent(iframe)) {
3867      toggleLoader(false);
3868      autoFocusDialog();
3869      if(!noResize) {
3870      	resizeDialogToFitContents();
3871      }
3872      reCenterDialog();
3873      if(typeof(supportsMobile) != "undefined" && supportsMobile && typeof(fluidLayout) != "undefined" && fluidLayout) {
3874         var isFullScreen = window.innerWidth <= 767;
3875         if(!isCrossOriginFrame(iframe) && typeof(iframe.contentWindow.setInFullScreenDialog) == "function") {
3876            iframe.contentWindow.setInFullScreenDialog(isFullScreen);
3877         }
3878         $(iframe).closest(".ui-dialog").toggleClass("fullScreenDialogContainer", isFullScreen);
3879      }
3880      $(iframe).contents().find("html").removeClass(getAllResponsiveClasses());
3881      $(iframe).contents().find("html").addClass(getResponsiveSizeClasses() + ' dialogIframe');
3882      syncDialogScrollContainer(iframe);
3883      $(iframe).off("load");
3884   }
3885}
3886function setInFullScreenDialog(toggle) {
3887   if(tryIsInDialog()) {
3888      if(toggle) {
3889         $("html").addClass("fullScreenDialog");
3890		} else {
3891         $("html").removeClass("fullScreenDialog");
3892      }
3893   }
3894}
3895
3896/* Returns #contractsContainer when it is in the expected wrapper > content > contentTop hierarchy */
3897function getContractsScrollContainer(doc) {
3898   var container = doc.getElementById('contractsContainer');
3899   if (!container) return null;
3900
3901   var contentTop = doc.getElementById('contentTop');
3902   if (!contentTop || container.parentElement !== contentTop) return null;
3903
3904   var content = doc.getElementById('content');
3905   if (!content || !content.contains(contentTop)) return null;
3906
3907   var wrapper = doc.getElementById('wrapper');
3908   if (!wrapper || !wrapper.contains(content)) return null;
3909
3910   if (!doc.body.contains(wrapper)) return null;
3911
3912   return container;
3913}
3914
3915function hasVerticalOverflowScroll(el, win) {
3916   if (!el || !win) return false;
3917   var overflowY = win.getComputedStyle(el).overflowY;
3918   return overflowY === 'scroll' || overflowY === 'auto' || overflowY === 'overlay';
3919}
3920
3921/* Evaluates whether scrolling is done through the iframe or the dialog
3922   Adds an extra class indicating the scroll is handled through the iframe */
3923function syncDialogScrollContainer(iframe) {
3924   var divDialog = document.getElementById('divDialog');
3925   var doc = iframe && iframe.contentDocument;
3926   if (!divDialog || !doc || !doc.body) return;
3927
3928   var contractsContainer = getContractsScrollContainer(doc);
3929   var useIframeScroll = contractsContainer && hasVerticalOverflowScroll(contractsContainer, doc.defaultView);
3930
3931   divDialog.classList.toggle('dialogIframeScroll', useIframeScroll);
3932}
3933
3934/* To be called from inside a dialog, necessary for when the dialog is cross-domain, typically due to HTTPS */
3935function setDialogTitleParent(title, id){
3936   if(tryIsInDialog(false)){
3937      parentPostMessage("setDialogTitle:" + escapeForPostMessage(title) + (typeof(id) != "undefined" && id != null ? ":" + escapeForPostMessage(id) : ""));
3938   }
3939}
3940function resizeParent(){
3941   if(tryIsInDialog(false)){
3942      var height = Math.max($('html').height(), ($('#content').height() || 0));
3943	  if (typeof parent.setDialogContentHeight === "function") {
3944		parent.setDialogContentHeight(height, null, window.name);
3945	  }
3946   }
3947}
3948rE(window, "load", resizeParent);
3949
3950function resizeDialogToFitContents(){
3951   try{
3952   	var iframe = getDialogIframe();
3953	   if(iframe) {
3954         var contents = $(iframe).contents();
3955         var height = Math.max(contents.find('html').height(), contents.find('body').height());
3956         if(!isNaN(height) && height!=0)
3957	      setDialogContentHeight(height);
3958   	}
3959   }
3960	catch(err) {}
3961   }
3962
3963function autoFocusDialog(){
3964   try{
3965   	var iframe = getDialogIframe();
3966	   if(iframe && !isCrossOriginFrame(iframe)) {
3967         iframe.contentWindow.focusFirstElement();
3968      }
3969   }
3970   catch(err){
3971      postMessageToDialog("focusFirstElement");
3972   }
3973}
3974function focusFirstElement(){
3975	setTimeout(function() {
3976		$("input:text, input[type=email], textarea").first().trigger("focus");
3977	}, 0);
3978}
3979function closeDialogParent(){
3980   if(tryIsInDialog(false)){
3981      parentPostMessage("closeDialog");
3982   }
3983}
3984function closeDialog(id){
3985   if(typeof(id) == "undefined") id = "divDialog";
3986   $('#'+id).dialog('close');
3987}
3988function destoryDialog(id){
3989   closeDialog(id);
3990   $('#'+id).dialog('destroy');
3991}
3992function closeAllOpenDialogs() {
3993   $(".ui-dialog-content").each(function(index, item) {
3994      if(!$(item).is(":ui-dialog")) return;
3995      $(item).dialog("close");
3996   });
3997}
3998function toggleLoader(set) {
3999	if(set)
4000		$('#tblLoader').show();
4001	else
4002		$('#tblLoader').hide();
4003}
4004
4005function OnDialogOpen(isAlertDialog, useHistory, preserveAlertScroll) {
4006    if (typeof (useHistory) == "undefined") useHistory = true;
4007    if (fullMobileSupport() || (typeof isSlate != "undefined" && isSlate())) {
4008        checkWOAHBarMargins();
4009    }
4010	if (typeof isAlertDialog != "undefined" && isAlertDialog == true) {
4011        if (!isPhone() && (($(".wbTop").css('display') == 'block') || ($(".wbTop").css('display') == 'inline-block'))) {
4012            $(window).on("resize", function () {
4013                $('html').css('margin-top', '0');
4014            });
4015
4016            $('html').css('margin-top', '0');
4017        } else if (!isPhone() && $(".countryGB").length && $(".woahbar").length) {
4018            setTimeout(function () {
4019                $(window).on("resize", function () {
4020                    $('html').css('margin-top', '0');
4021                });
4022                $('html').css('margin-top', '0');
4023            }, 300);
4024        }
4025        $("body").addClass("alertDialogOpen");
4026        if(typeof(preserveAlertScroll) === "undefined" || !preserveAlertScroll) $("html, body").scrollTop(0);
4027    } else {
4028        if (!isPhone() && (($(".wbTop").css('display') == 'block') || ($(".wbTop").css('display') == 'inline-block'))) {
4029            $(window).on("resize", function () {
4030                $('html').css('margin-top', '0');
4031            });
4032
4033			$('html').css('margin-top','0');
4034		 }
4035         /* Add class to allow page scrolling */
4036         if($("#confirmDialog").length) {
4037            $("body").addClass("confirmDialogOpen");
4038        }
4039
4040        $("body").addClass("dialogOpen");
4041
4042    }
4043}
4044var afterDialogClose = null;
4045var onDialogCloseRefresh = false;
4046var dialogCloseAndRedirectTo = "";
4047
4048function clearDialogStyles(isChildDialog){
4049   if(!isChildDialog) {
4050	  if(!isPhone() && screen.width > 767 && !$('body.dialogOpen.alertDialogOpen').length && (($(".wbTop").css('display') == 'block' ) || ($(".wbTop").css('display') == 'inline-block' ))){
4051		$('html').css('margin-top',$(".wbTop").height());
4052	  }
4053      $(window).on("resize", function() {
4054         if(!isPhone() && screen.width > 767 && !$('body.dialogOpen.alertDialogOpen').length && (($(".wbTop").css('display') == 'block' ) || ($(".wbTop").css('display') == 'inline-block' )) && !$('.editor-dialog').length){
4055            $('html').css('margin-top',$(".wbTop").height());
4056         }
4057      });
4058
4059      $("body").removeClass("dialogOpen");
4060   }
4061   checkWOAHBarMargins();
4062}
4063function dialogsUseHistory(){
4064   return supportsHistory() && isStateTracker(window.history.state) && window.history.state.DialogOpen;
4065}
4066
4067function OnDialogClose(isAlertDialog, useHistory, isChildDialog) {
4068    if (typeof (isAlertDialog) == "undefined") isAlertDialog = false;
4069    if (typeof (useHistory) == "undefined") useHistory = true;
4070    if (typeof (isChildDialog) == "undefined") isChildDialog = false;
4071
4072    if (onDialogCloseRefresh == true) {
4073        if (!dialogCloseAndRedirectTo) {
4074            location.reload();
4075        } else {
4076            try {
4077                window.top.location = dialogCloseAndRedirectTo;
4078            } catch (DOMException) {
4079            }
4080        }
4081    } else {
4082        if (dialogsUseHistory() && useHistory) {
4083            if (fullMobileSupport() || (typeof isSlate != "undefined" && isSlate())) {
4084
4085                if (cssua.ua.ios && cssua.ua.safari)
4086                    clearDialogStyles(isChildDialog);
4087            }
4088        } else {
4089            clearDialogStyles(isChildDialog);
4090        }
4091        if (isAlertDialog) {
4092            $("body").removeClass("alertDialogOpen");
4093        }
4094    }
4095}
4096function initDialogs(){
4097	if(typeof($) == "function") {
4098		/* Added to have div outside Iframe */
4099		if(!$('#divDialogOutsideFrame').length) {
4100			$('body').append('<div id="divDialogOutsideFrame" style="display:none"><iframe id="ifChangeLog" name="ifChangeLog" src="" title="My Documents" width="100%" height="100%" marginWidth="0" marginHeight="0" frameBorder="0" scrolling="no" style="overflow:hidden"></iframe></div>');
4101		}
4102
4103      var loadingNode = '<div><img src="/common/jquery-ui/css/LegalContracts/images/ajax-loader.gif" alt="Loading ..." width="220" height="19" /><br /><span>Loading ...</span></div>';
4104		var isSlatePage = typeof(isSlate) == "function" && isSlate();
4105		var isDoculawPage = typeof(isDoculaw) == "function" && isDoculaw();
4106
4107		if(!$('#divDialog').length) {
4108			$('body').append('<div id="divDialog" style="display:none"><table style="width:100%;height:105%" id="tblLoader" class="slate-loader"><tr><td style="text-align:center">
4108'+ loadingNode +'</td></tr></table><iframe id="ifMyDocuments" name="ifMyDocuments" title="My Documents" width="100%" height="100%" marginWidth="0" marginHeight="0" frameBorder="0" scrolling="no" style="overflow:hidden"></iframe></div>');
4109		}
4110
4111		if($('#divDialog').length) {
4112			if(isSlatePage || isDoculawPage) {
4113				$("#tblLoader").addClass('slate-loader');
4114				$("#tblLoader td").html(loadingNode);
4115			}
4116      }
4117
4118		$('#divDialog').dialog({
4119			autoOpen: false,
4120			width:900,
4121			height:400,
4122			draggable: false,
4123			resizable: false,
4124			modal: true,
4125            closeText : "Close",
4126			close: function(ev, ui) {
4127				invalidateCache();
4128			},
4129			open: function(event, ui) {
4130            OnDialogOpen();
4131			 },
4132			 beforeClose: function(event, ui) {
4133             try{
4134                if(top.location.pathname.indexOf("LawDepotEditor")>=0){
4135                   OnDialogClose(false,false);
4136                }else{
4137                   OnDialogClose();
4138                }
4139
4140                $("body").removeClass("sharing-noscroll");
4141             }
4142				catch(exception) {
4143					OnDialogClose();
4144				}
4145          }
4146		});
4147		var iframe = getDialogIframe();
4148		if(iframe) {
4149			$(iframe).on("load", dialogLoadComplete);
4150		}
4151
4152      if($("#divTipDialog").length) {
4153		$('#divTipDialog').dialog({
4154			autoOpen: false,
4155			width:300,
4156			height:225,
4157			draggable: true,
4158			resizable: true,
4159			modal: true,
4160			close: function(ev, ui) {
4161				tipWindow_Callback(getObject('chkShow').checked);
4162				if(tipOpen) {
4163					closeTipWindow(false);
4164				}
4165			}
4166		});
4167      }
4168
4169      if(typeof(_previewDialogID) != "undefined"){
4170         _PreviewDialog = InitFullScreenDialog(_previewDialogID, "Document Preview");
4171      }
4172
4173      $(window).on("resize", function() {
4174                        var iframe = getDialogIframe();
4175                        if(iframe) {
4176                              try{
4177               if(iframe.contentWindow.location.href.indexOf("MyContacts") ==-1) resizeDialogToFitContents();
4178			}
4179            catch(err){
4180               resizeDialogToFitContents();
4181            }
4182         }else{
4183            resizeDialogToFitContents();
4184         }
4185         if(!isPhone() || typeof(supportsMobile) == "undefined" || !supportsMobile) {
4186            reCenterDialog();
4187
4188            /*History dialog from My Document*/
4189            if($("#divDialogOutsideFrame").hasClass('ui-dialog-content') && $("#divDialogOutsideFrame").dialog("isOpen")){
4190                  $('#divDialogOutsideFrame').dialog('option', 'position', getDialogCenterPosition());
4191                  var isLawDepot = false;
4192                  if(isLawDepot){
4193                        if (document.body.clientWidth <= 767) {
4194                              $('#divDialogOutsideFrame').dialog("close");
4195                        }
4196                  }
4197            }
4198         }
4199
4200		 if(typeof(supportsMobile) != "undefined" && supportsMobile && typeof(fluidLayout) != "undefined" && fluidLayout) {
4201            $(".plainDialog iframe,.signInDialog iframe").each(function(index, item) {
4202               if(isCrossOriginFrame(item)) return;
4203               var isFullScreen = window.innerWidth < 768;
4204               if(typeof(item.contentWindow.setInFullScreenDialog) == "function") {
4205                  item.contentWindow.setInFullScreenDialog(isFullScreen);
4206               }
4207               $(item).closest(".ui-dialog").toggleClass("fullScreenDialogContainer", isFullScreen);
4208            });
4209         }
4210		});
4211	}
4212}
4213
4214function InitFullScreenDialog(id, title, openCallbackFunc){
4215   var dialogObj = null;
4216   if(typeof(id) == 'string'){
4217      dialogObj = $("#" + id);
4218      if(dialogObj.length == 1){
4219         dialogObj.dialog({
4220            autoOpen:false,
4221            width:'auto',
4222            height:'auto',
4223            draggable:false,
4224            resizable:false,
4225            modal:true,
4226            title:title,
4227            dialogClass:"fullScreenDialog",
4228            position:'top left',
4229			   open: function(event, ui) {
4230               OnDialogOpen();
4231               if(typeof(openCallbackFunc) == "function") openCallbackFunc();
4232   			 },
4233	   		 beforeClose: function(event, ui) {
4234               OnDialogClose();
4235   			 }
4236         });
4237      }
4238   }
4239   return dialogObj;
4240}
4241
4242var _PreviewDialog, _InlineDialog;
4243function createAndShowInlineDialog(target, title, animation, config, openCallbackFunc){
4244   var configObj = $.extend({
4245   }, config);
4246
4247   var curInlineDialog = InitFullScreenDialog(target, null, openCallbackFunc);
4248
4249
4250   curInlineDialog.dialog({
4251      title: title,
4252      dialogClass: "divInlineDialog dialogInitial " + (typeof(configObj.cssClass) != "undefined" ? " " + configObj.cssClass : ""),
4253      width:  (typeof(configObj.width) != "undefined" ?  configObj.width + "px" : "auto"),
4254      height: (typeof(configObj.height) != "undefined" ? configObj.height + "px" : "auto"),
4255      position: getDialogCenterPosition()
4256   });
4257
4258   showFullScreenDialog(curInlineDialog, null, null, animation);
4259   reCenterDialog(target);
4260   $(window).on("resize", function() {
4261      if($("#" + target).hasClass("ui-dialog-content") && $("#" + target).dialog('isOpen'))
4262      	$("#" + target).dialog('option', 'position', getDialogCenterPosition());
4263   });
4264}
4265
4266/**
4267 * Displays a LawDepot styled dialog
4268 * @param content {string} The contents of the dialog
4269 * @param title {string} The contents of the title bar
4270 * @param animation {string} The jQueryUI animation that will be used for both show and hide
4271 * @param config {object} Additional configuration options
4272 * @param config.cssClass {string} Additional css classes that will be added to the dialog
4273 * @return The JQueryUI dialog object, which may have been created or reused.
4274 */
4275function showInlineDialog(content, title, animation, config){
4276   var configObj = $.extend({
4277   }, config);
4278   if(typeof(_InlineDialog) == 'undefined'){
4279		$('body').append('<div id="divInlineDialog" class="dialogInitial"></div>');
4280      _InlineDialog = InitFullScreenDialog("divInlineDialog", null);
4281      _InlineDialog.dialog("option", "position", getDialogCenterPosition());
4282   }
4283   _InlineDialog.dialog("option", "title", title);
4284   _InlineDialog.dialog("option", "dialogClass", (typeof(configObj.cssClass) != "undefined" ? " " + configObj.cssClass : ""));
4285   _InlineDialog.empty();
4286   _InlineDialog.append(content);
4287   showFullScreenDialog(_InlineDialog, null, null, animation);
4288   return _InlineDialog;
4289}
4290function showAboutDialog(){
4291   showInlineDialog("<div id='aboutDialog' autofocus>"+$('#leftDiv').html()+"</div>", 'About this Document', {effect:'slide', direction:'right', duration:500});
4292}
4293function showFAQDialog(helpID){
4294   showInlineDialog("<div id='faqDialog'>" + qnh.GetFAQContent() + "</div>", 'Question Help', {effect:'slide', direction:'left', duration:500}, {cssClass:"faqDialog"});
4295   var helpIndex = $('#faqDialog h3').index($('#' + helpID));
4296   if (helpIndex < 0) {helpIndex = false;}
4297   $('#faqDialog').accordion({icons:null, collapsible:true, active:helpIndex, heightStyle:"content"});
4298}
4299function showFullScreenPreviewDialog(triggerUpdateFunc){
4300   showFullScreenDialog(_PreviewDialog, "Loading Preview", triggerUpdateFunc, {effect:'slide', direction:'left', duration:500}, {cssClass:"fullScreenDialog previewDialog"});
4301}
4302 function showFullScreenDialog(dialogObj, loadingMessage, func, animation, config){
4303   var configObj = $.extend({
4304   }, config);
4305   if(dialogObj && dialogObj.length == 1){
4306      if(animation){
4307         dialogObj.dialog("option", "show", animation);
4308         dialogObj.dialog("option", "hide", animation);
4309		} else {
4310         dialogObj.dialog("option", "show", null);
4311         dialogObj.dialog("option", "hide", null);
4312      }
4313      var dialogClasses = dialogObj.dialog("option", "dialogClass");
4314      dialogObj.dialog("option", "dialogClass", (typeof(configObj.cssClass) != "undefined" ? " " + configObj.cssClass : "" + dialogClasses));
4315      dialogObj.dialog('open');
4316      if(typeof(loadingMessage) == "string"){
4317         showMessage(loadingMessage);
4318      }
4319      if(typeof(func) == 'function'){
4320         func();
4321      }
4322   }
4323}
4324if(typeof($) == "function"){
4325   $(function(){
4326		initDialogs();
4327		window.onpopstate = function(event) {
4328  			if($('body').hasClass("menuOpen") && $('body').hasClass("searchOpen")){
4329				$("#bannerNavWrapper").hide();
4330		      	$("#bannerNavOverlay").remove();
4331		      	$("#bannerNav").removeClass("open");
4332			}
4333		};
4334	});
4335} else {
4336   rE(window, "load", initDialogs);
4337}
4338
4339
4340function invalidateCache(callback) {
4341	if(typeof(callback) != "function") {
4342		callback = hidePopWin2;
4343	}
4344	var invalid = false;
4345	var iframe = getDialogIframe();
4346   try{
4347   	if(iframe && typeof(iframe.contentWindow.invalidateCache) == "function") {
4348	   	iframe.contentWindow.invalidateCache(callback);
4349		   invalid = true;
4350   	}
4351   }
4352	catch(err) {}
4353
4354   if(iframe) iframe.src = "";
4355	if(!invalid) {
4356		callback();
4357	}
4358}
4359function hidePopWin2() {
4360	var iframe = getDialogIframe();
4361	if(iframe) {
4362      try{
4363   		var framedoc = iframe.contentDocument || iframe.contentWindow.document;
4364	   	if(framedoc) {
4365		   	framedoc.removeChild(framedoc.documentElement);
4366   		}
4367      }
4368		catch(err) {}
4369      }
4370	}
4371
4372
4373
4374function tipWindow_Callback(arg) {
4375	 if(arg) {
4376        setCookie("HideSaveAnswersTip", "1", 365*3);
4377		  _show_tip = false;
4378	 }
4379}
4380function closeTipWindow(cont) {
4381	try {
4382		if(tipOpen) {
4383			tipOpen=false;
4384			$('#divTipDialog').dialog('close');
4385		}
4386	} catch (e) { }
4387	if(cont){
4388		let saveAnswersDialogWidth = isLoggedIn() ? 400 : 500;
4389		showSaveAnswersDialog("Save Answers", saveAnswersHref, saveAnswersDialogWidth, 339, "plainDialog newmydocumentDialog", 0.7);
4390	}
4391}
4392
4393function ShowDialogOutside(url, title){
4394	var ifChangeLog = parent.$("#ifChangeLog")[0];
4395	ifChangeLog.src = url;
4396
4397	parent.$("#divDialogOutsideFrame").dialog({
4398				 autoOpen: false,
4399				 draggable : false,
4400				 resizable: false,
4401				 modal: true,
4402				 width: 580,
4403				 height: 442,
4404				 title: title
4405			 });
4406	parent.$("#divDialogOutsideFrame").dialog('open');
4407}
4408
4409var doMobileMyDoc = false;
4410function MobileMyDocGotoSignInHandler(){
4411   if(!doMobileMyDoc) return;
4412
4413    var topWinLoc = window.top.location;
4414    var refUrl = topWinLoc.href;
4415
4416    if (topWinLoc.href.indexOf("LawDepotEditor") > 0) {
4417        if (typeof parent.myDocRedirectTo != "undefined" && parent.myDocRedirectTo != "") {
4418            refUrl = parent.myDocRedirectTo.replace("?ViewResults=true", "");
4419        } else {
4420            refUrl = topWinLoc.host;
4421        }
4422    }
4423    topWinLoc.href = topWinLoc.protocol + "//"+topWinLoc.host +"/Mydocuments/RedirecToSignin.aspx?signinUrl=" + escape(refUrl);
4424}
4425
4426function MobileMyDocHandler(value){
4427   if(!doMobileMyDoc) return;
4428	if(value == null || value =="" ) return;
4429	if (typeof(value) != "object"){
4430		value = JSON.parse(value);
4431	}
4432
4433	var fileType = value.fileType;
4434	var fileExtension = value.fileExtension;
4435	var fileName = value.fileName;
4436	var sourceProductCode = value.sourceProductCode;
4437	var productCode = value.productCode;
4438	var webuser_data_detail_id = value.webuser_data_detail_id;
4439	var contact_url = value.contact_url;
4440	var country_code = value.country_code;
4441	var webuser_data_id = value.webuser_data_id;
4442	var data_typeId = value.data_typeId;
4443	var invoice_no = value.invoice_no;
4444	var other = value.other;
4445	var is_service = value.is_service;
4446	var ldcn = value.ldcn;
4447	var hasLicense = value.hasLicense;
4448	var redirectUrl = value.redirectUrl;
4449	var path = value.path;
4450	var outputTemplate = value.outputTemplate;
4451
4452
4453   try {
4454		 if (is_service == 'True') {
4455                var newUrl = window.location.protocol + "//" + window.location.host + "/" + contact_url + "/?loc=" + country_code;
4456                window.top.location = newUrl;
4457		} else if (window.top.loadCommonAnswersRequest) {
4458      window.top.loadCommonAnswersRequest(
4459                        productCode,
4460				productCode, {
4461                            'webuser_data_detail_id': webuser_data_detail_id,
4462                            'contract_url': contact_url,
4463                            'country_code': country_code,
4464                            'webuser_data_id': webuser_data_id,
4465                            'data_type': data_typeId,
4466                            'invoice_no': invoice_no,
4467                            'other': other,
4468                            'is_service': is_service,
4469                            'ldcn': ldcn,
4470							'hasLicense': hasLicense,
4471            'path': path,
4472            'outputTemplate': outputTemplate
4473                        },
4474                        true,
4475						redirectUrl
4476                    );
4477                }
4478           }
4479   catch(DOMException){}
4480}
4481
4482/* Preview Dialog Button */
4483function initPreviewDialog(id, title) {
4484	$("#"+id).dialog({
4485		autoOpen:false,
4486		width:850,
4487		height:"auto",
4488		draggable:!cssua.ua.mobile,
4489		resizable:false,
4490		modal:true,
4491		title:title,
4492		position:getDialogCenterPosition(),
4493		dialogClass:"previewDialog"
4494	});
4495}
4496function showPreviewDialog(id) {
4497	$("#" + id).dialog("open");
4498	showMessage("Loading preview.", {
4499		id:'loadPreview',
4500		parentElementSelector:'.previewDialog'
4501	});
4502}
4503/* End Preview Dialog Button */
4504
4505$(window).on("resize", function() {
4506   if($('.ui-dialog').hasClass('faqDialog') && (typeof(fluidLayout) != "undefined" && fluidLayout) && $(window).width() > 767) {
4507      $('.faqDialog.ui-dialog .ui-dialog-content').dialog('close');
4508   }
4509   else if($('.ui-dialog').hasClass('previewDialog') && (typeof(fluidLayout) != "undefined" && fluidLayout) && $(window).width() > 767) {
4510      $('.previewDialog.ui-dialog .ui-dialog-content').dialog('close');
4511   }
4512});
4513
4514/* End Include dialogs */
4515
4516/* Include mobile */
4517function mobileInit() {
4518	setIsPhone();
4519	if (typeof ($) == "function") {
4520		var mobileContractMenu = $('#mobileContractMenu');
4521		if (mobileContractMenu.length > 0 && !mobileContractMenu.hasClass('ui-accordian')) {
4522			mobileContractMenu.accordion({
4523				icons: null, collapsible: true, active: false, heightStyle: "content",
4524				activate: function (event, ui) {
4525					$("#mobileContractMenu li ul").each(function () {
4526						if (!$(this).is(":visible")) {
4527							$(".username_dropdown").removeClass("username_dropdown_active", 300);
4528							$(".username_title").removeClass("username_title_active");
4529						}
4530					})
4531				}
4532			});
4533			$("#mobileContractMenu > li > a").removeAttr("href");
4534		}
4535		setTimeout(AddAriaHasPopup, 300);
4536	}
4537
4538	/* Prevent sub-menus from gaining inline style */
4539	$(window, document).on("load resize", function () {
4540		$("#mobileContractMenu ul.ui-accordion-content").css("height", "");
4541	});
4542	$("#mobileContractMenu .ui-accordion-header").on("click mousedown", function () {
4543		$("#mobileContractMenu ul.ui-accordion-content").css("height", "");
4544	});
4545}
4546
4547//This is a fix for windows_phone IE, for preview page menu (Download)
4548function AddAriaHasPopup() {
4549	if (cssua.ua.iemobile) {
4550		$(".previewHead .controls li.down").attr("aria-haspopup", true);
4551	}
4552}
4553
4554onJsReady(function () {
4555	if (typeof ($) == "function") {
4556		$(mobileInit);
4557	}
4558	else {
4559		rE(window, "load", mobileInit);
4560	}
4561});
4562
4563
4564function setIsPhone() {
4565	if (typeof (vh) != "undefined") {
4566		vh.S("__IsPhone", isFluidLayout() ? getCurrentScreenSize() == "sm" : isPhone());
4567	}
4568}
4569$(window).on("resize", setIsPhone);
4570/* Detect if the current device is a phone. */
4571function isPhone() {
4572	if (typeof (window._deviceType) != "undefined") {
4573		return window._deviceType == "Smartphone";
4574	}
4575
4576	/* Old method */
4577	try {
4578		return cssua.ua.mobile && (
4579			cssua.ua.mobile == "iphone" ||
4580			cssua.ua.mobile == "ipod" ||
4581			cssua.ua.windows_phone ||
4582			(cssua.ua.mobile == "android" && isKnownAndroidPhoneModel()) ||
4583			Math.max(screen.width, screen.height) <= 767 ||
4584			(cssua.ua.mobile == "mobile" && Math.max(top.document.documentElement.clientWidth, top.document.documentElement.clientHeight) <= 767)
4585		);
4586	}
4587	catch (e) {
4588		if (e.description && e.description.toLowerCase().indexOf('permission denied') !== -1) {
4589			return false; //IE permission denied, return false
4590		} else if (e.name.toLowerCase().indexOf('securityerror') !== -1) {
4591			return false; //Chrome
4592		} else if (e.message.toLowerCase().indexOf('permission denied') !== -1) {
4593			return false; //Firefox
4594		} else {
4595			throw e; //some other problem
4596		}
4597	}
4598}
4599function isSamsungDevice() {
4600	var agent = (function () { try { return navigator.userAgent; } catch (e) { return 'MSIE 9.0'; } }());
4601	return typeof (cssua) != "undefined" && cssua.ua.mobile && (cssua.ua.samsungbrowser ||
4602		(agent.match(/Android.*\ SM-/i) || agent.match(/Android.*\ GT-/i) || agent.match(/Android.*\ SGH-/i) || agent.match(/Android.*\ SC-/i))) ? true : false;
4603}
4604function registerDeviceClass() {
4605	if (typeof (window._deviceType) != "undefined" && window._deviceType) {
4606		document.documentElement.className += " device-" + window._deviceType.toLowerCase().replace(/\s+/g, '-');
4607	}
4608}
4609registerDeviceClass();
4610
4611function isKnownAndroidPhoneModel() {
4612	var agent = (function () { try { return navigator.userAgent; } catch (e) { return 'MSIE 9.0'; } }());
4613	return agent.match(/Android.*\+SGH-I747M/i) ? true : false;
4614}
4615function isPortrait() {
4616	return window.innerHeight > window.innerWidth;
4617}
4618function isLandscape() {
4619	return window.innerHeight < window.innerWidth;
4620}
4621function fullMobileSupport() {
4622	return (typeof (fluidLayout) != "undefined" && fluidLayout && $("html").hasClass("sm")) || (typeof (supportsM
4622obile) != "undefined" && supportsMobile && isPhone());
4623}
4624function usernameNavTitleSignedIn() {
4625	if ($(".username_title").hasClass("username_title_active")) {
4626		$(".username_dropdown").removeClass("username_dropdown_active", 300);
4627		$(".username_title").removeClass("username_title_active");
4628	}
4629
4630	else {
4631		$(".username_title").addClass('username_title_active');
4632		$(".username_dropdown").addClass('username_dropdown_active', 300);
4633
4634		if ($(".mydocuments_title").hasClass("mydocuments_title_active")) {
4635			$(".mydocuments_dropdown").removeClass("mydocuments_dropdown_active", 300);
4636			$(".mydocuments_title").removeClass("mydocuments_title_active");
4637		}
4638	}
4639	$("ul#mobileContractMenu li a").each(function () {
4640		if ($(this).hasClass("ui-accordion-header-active")) {
4641			$('ul#mobileContractMenu').accordion({
4642				active: false,
4643				collapsible: true
4644			});
4645		}
4646	});
4647	setTimeout(function () {
4648		var menuHeight = $("#banner").height() + $("#banner #bannerNavContents").height();
4649		$("#wrapper").css({
4650			'height': menuHeight + 'px'
4651		});
4652	}, 300);
4653}
4654
4655function mydocumentsNavTitleSignedIn() {
4656	if ($(".mydocuments_title").hasClass("mydocuments_title_active")) {
4657		$(".mydocuments_dropdown").removeClass("mydocuments_dropdown_active", 300);
4658		$(".mydocuments_title").removeClass("mydocuments_title_active");
4659	}
4660	else {
4661		$(".mydocuments_title").addClass('mydocuments_title_active');
4662		$(".mydocuments_dropdown").addClass('mydocuments_dropdown_active', 300);
4663		if ($(".username_title").hasClass("username_title_active")) {
4664			$(".username_dropdown").removeClass("username_dropdown_active", 300);
4665			$(".username_title").removeClass("username_title_active");
4666		}
4667	}
4668	$("ul#mobileContractMenu li a").each(function () {
4669		if ($(this).hasClass("ui-accordion-header-active")) {
4670			$('ul#mobileContractMenu').accordion({
4671				active: false,
4672				collapsible: true
4673			});
4674		}
4675	});
4676	setTimeout(function () {
4677		var menuHeight = $("#banner").height() + $("#banner #bannerNavContents").height();
4678		$("#wrapper").css({
4679			'height': menuHeight + 'px'
4680		});
4681	}, 300);
4682}
4683/**
4684 * Toggles the navigation menu in the banner, uses browser states so that in mobile
4685 * pressing the back button closes the menu rather than potentially navigating away from the website
4686 */
4687function toggleBannerNav() {
4688	if (supportsHistory()) {
4689		if ($("#bannerNav").hasClass('open')) {
4690			window.history.back();
4691		}
4692		else {
4693			pushState({ BannerNavOpen: true }, null);
4694		}
4695	}
4696	swapBannerNav();
4697}
4698function toggleBannerSearch() {
4699	$("#logo_search").addClass('hideBanner');
4700	if ($("#bannerNav").hasClass("open")) {
4701		$("#bannerNavWrapper").hide();
4702		$("#bannerNavOverlay").remove();
4703		$("#bannerNav").removeClass("open");
4704		$("#bannerNav").addClass("navOpen");
4705	}
4706	else {
4707		if ($("#bannerNav").hasClass("navOpen")) {
4708			$("#bannerNav").removeClass("navOpen");
4709		}
4710	}
4711	if (supportsHistory()) {
4712		if ($("#bannerSearch").hasClass('open')) {
4713			$("#bannerSearchWrapper").hide();
4714			$("#bannerSearchOverlay").remove();
4715			window.history.back();
4716		}
4717		else {
4718			pushState({ BannerSearchOpen: true }, null);
4719		}
4720	}
4721	swapBannerSearch();
4722}
4723$(function () {
4724	$("ul#mobileContractMenu:not(.multicategory_mobile)").accordion({
4725		activate: function (event, ui) {
4726			var menuHeight = $("#banner").height() + $("#banner #bannerNavContents").height();
4727			if ($("body").hasClass("menuOpen")) {
4728				$("#wrapper").height(menuHeight);
4729			}
4730			$("#bodyWrap").css('height', $("#banner").height());
4731		}
4732	});
4733	$("ul#mobileContractMenu .ui-accordion-header").on("click", function () {
4734		if ($(".username_title").hasClass("username_title_active")) {
4735			$(".username_dropdown").removeClass("username_dropdown_active", 300);
4736			$(".username_title").removeClass("username_title_active");
4737		}
4738		if ($(".mydocuments_title").hasClass("mydocuments_title_active")) {
4739			$(".mydocuments_dropdown").removeClass("mydocuments_dropdown_active", 300);
4740			$(".mydocuments_title").removeClass("mydocuments_title_active");
4741		}
4742	});
4743});
4744function swapBannerSearch(show) {
4745	if (typeof ($) == "function") {
4746		var bannerSearch = $("#bannerSearch");
4747		var wasOpen = bannerSearch.hasClass('open');
4748		if (typeof (show) == "undefined") {
4749			show = !wasOpen;
4750		}
4751		if (!show)
4752			clearInitText(document.getElementById("txtSearchMobile"));
4753		else
4754			resetInitText(document.getElementById("txtSearchMobile"));
4755
4756		if (!show) {
4757			bannerSearch.removeClass('open');
4758			$("#logo_search").removeClass('hideBanner');
4759		}
4760		else if (!wasOpen) bannerSearch.addClass('open');
4761
4762		var overlay = $('#bannerSearchOverlay');
4763		if (overlay.length == 0) {
4764			overlay = $("<div id='bannerSearchOverlay' onclick='toggleBannerSearch();'></div>");
4765			$("body").append(overlay);
4766
4767			if ($(".navRedesignWrapper").length) {
4768				$("#bannerSearchOverlay").addClass("navRedesignOverlay");
4769			}
4770		}
4771
4772		if (wasOpen != show) {
4773			var body = $("body");
4774			if (!show) {
4775				body.removeClass("searchOpen");
4776			}
4777			else {
4778				body.addClass("searchOpen");
4779				$('#wrapper,#bodyWrap').scrollTop(0);
4780			}
4781			checkWOAHBarMargins();
4782			var wrapper = $("#bannerSearchWrapper");
4783			$("#bannerSearchOverlay").toggle();
4784			var minHeightWrapperNoSearch = $("#wrapper").height();
4785			$("#bannerSearchWrapper").slideToggle(250, function () {
4786				if ($("body").hasClass("searchOpen")) {
4787					var searchBannerHeight = $("#bannerSearchWrapper").height() + 250;
4788					$("#wrapper").css({
4789						'height': searchBannerHeight + 'px',
4790						'min-height': 'calc(100vh)'
4791					});
4792				}
4793				else {
4794					$("#wrapper").css({
4795						'min-height': '',
4796						'height': ''
4797					});
4798					
4799					$("#bannerSearchWrapper").hide();
4800					$("#bannerSearchOverlay").remove();
4801				}
4802			});
4803			if (show) {
4804				wrapper.height(60);
4805				$("input#txtSearchMobile").trigger("focus");
4806			}
4807			return;
4808		}
4809	}
4810}
4811function swapBannerNav(show) {
4812	if (typeof ($) == "function") {
4813		var bannerNav = $("#bannerNav");
4814		var wasOpen = bannerNav.hasClass('open');
4815		$("input#txtSearchMobile").val('');
4816		if (typeof (show) == "undefined") {
4817			show = !wasOpen;
4818		}
4819		if (!show)
4820			clearInitText(document.getElementById("txtSearchMobile"));
4821		else
4822			resetInitText(document.getElementById("txtSearchMobile"));
4823
4824		if (!show) {
4825			bannerNav.removeClass('open');
4826			$("ul#mobileContractMenu li .ui-accordion-header").each(function () {
4827				if ($(this).hasClass("ui-accordion-header-active")) {
4828					$('ul#mobileContractMenu').accordion({
4829						active: false,
4830						collapsible: true
4831					});
4832				}
4833			});
4834			$("#wrapper").css('height', 'auto');
4835			$("#bodyWrap").css('height', 'auto');
4836		}
4837		else if (!wasOpen) bannerNav.addClass('open');
4838
4839		var overlay = $('#bannerNavOverlay');
4840		if (overlay.length == 0) {
4841			overlay = $("<div id='bannerNavOverlay' onclick='toggleBannerNav();'></div>");
4842			$("body").append(overlay);
4843
4844			if ($(".navRedesignWrapper").length) {
4845				$("#bannerNavOverlay").addClass("navRedesignOverlay");
4846			}
4847		}
4848
4849		if ($("#bannerSearch").hasClass("open")) {
4850			$("#bannerSearchWrapper").hide();
4851			$("#bannerSearchOverlay").remove();
4852			$("#bannerSearch").removeClass("open");
4853		}
4854
4855		if (wasOpen != show) {
4856			var body = $("body");
4857			if (!show) {
4858				body.removeClass("menuOpen");
4859			}
4860			else {
4861				body.addClass("menuOpen");
4862				$('#wrapper,#bodyWrap').scrollTop(0);
4863			}
4864			checkWOAHBarMargins();
4865			var wrapper = $("#bannerNavWrapper");
4866			$("#bannerNavOverlay").toggle();
4867			var minHeightWrapperNoMenu = $("#wrapper").height();
4868			$("#bannerNavWrapper").slideToggle(300, function () {
4869				if ($("body").hasClass("menuOpen")) {
4870					var menuHeight = $("#banner").height() + $("#banner #bannerNavContents").height();
4871					$("#wrapper").css({
4872						'height': menuHeight + 'px',
4873						'min-height': 'calc(100vh)'
4874					});
4875					$("#bodyWrap").css('height', $("#banner").height());
4876				}
4877				else {
4878					$("#wrapper").css({
4879						'min-height': '',
4880						'height': 'auto'
4881					});
4882					$("#bodyWrap").css('height', 'auto');
4883					$(".username_dropdown").removeClass("username_dropdown_active", 300);
4884					$(".username_title").removeClass("username_title_active");
4885				}
4886			});
4887
4888			/* DocuLaw Banner Responsive */
4889			$("ul.bannerLinks").slideToggle(300, function () {
4890				if ($("body").hasClass("menuOpen")) {
4891					var menuHeight = $("ul.bannerLinks").height() + $("#banner .innerBannerWrapper").height();
4892					$("#wrapper").css({
4893						'height': menuHeight + 'px',
4894						'min-height': 'calc(100vh)'
4895					});
4896				}
4897				else {
4898					$("#wrapper").css({
4899						'min-height': '',
4900						'height': 'auto'
4901					});
4902				}
4903			});
4904			/* DocuLaw Banner */
4905
4906			if (show) {
4907				wrapper.height(200)
4908			}
4909		}
4910	}
4911}
4912function toggleFooterCountries() {
4913	if (typeof ($) == "function") {
4914		var bannerNav = $("#footer .currentCountry, .footer-section .currentCountry");
4915		if (bannerNav.hasClass('active')) {
4916			bannerNav.removeClass('active');
4917		}
4918		else {
4919			bannerNav.addClass('active');
4920		}
4921		bannerNav.siblings(".countryNav").slideToggle(500);
4922	}
4923}
4924function toggleModalCountries() {
4925	if (typeof ($) == "function") {
4926		var modalNav = $("#selectedCountryNavLink");
4927		if (modalNav.hasClass('active')) {
4928			modalNav.removeClass('active');
4929		}
4930		else {
4931			modalNav.addClass('active');
4932		}
4933		modalNav.siblings(".countryNav").slideToggle(500);
4934	}
4935}
4936/* Change the hover menu interactions into touch menu interactions. */
4937function fixMobileHoverMenus() {
4938	if (isTouchDevice()) {
4939		if (typeof ($) == "function") {
4940			var allTouchablesSelector = ".bannerHoverMenu.touch,.groupNavigationMenu.touch,.contractPreview .controls > li.touch,.contractPreview .controls > li > ul > li.touch,#mm > li.touch,#mm > li li.touch, .countryNav.touch";
4941			/* Fix the banner/section hover menus. */
4942			$(".bannerHoverMenu:not(.touchable)").each(function (index, item) {
4943				$(item).addClass("touchable");
4944				attachMobileHoverTouch(item, $(item).find("ul"), $(item).find("a"), allTouchablesSelector, function (touchItem, actionItem) {
4945					$(touchItem).removeClass("touch");
4946				});
4947			});
4948			$(".countryNav:not(.touchable)").each(function (index, item) {
4949				$(item).addClass("touchable");
4950				attachMobileHoverTouch(item, $(item).find(".countryNavInner ul"), $(item).find(".countryNavInner a"), allTouchablesSelector, function (touchItem, actionItem) {
4951					$(touchItem).removeClass("touch");
4952				});
4953			});
4954			$(".groupNavigationMenu:not(.touchable)").each(function (index, item) {
4955				$(item).addClass("touchable");
4956				attachMobileHoverTouch(item, $(item).find("ul"), $(item).find("a"), allTouchablesSelector, function (touchItem, actionItem) {
4957					$(touchItem).removeClass("touch");
4958				}, function (touchItem) {
4959					scrollContainerToEl($(touchItem).find("ul"), $(touchItem).find(".current"));
4960				});
4961			});
4962
4963			/* Fix the contract menus */
4964			$("#mm > li:not(.touchable)").each(function (index, item) {
4965				$(item).addClass("touchable");
4966				if ($(item).find("ul:visible li a:not(:empty)").length) {
4967					$(item).children("a").removeAttr("href")
4968						.on("click", function (e) {
4969							e.stopPropagation();
4970							return false;
4971						});
4972				}
4973				attachMobileHoverTouch(item, $(item).children("ul"), $(item).children("ul").find("a"), allTouchablesSelector, function (touchItem, actionItem) {
4974					$(touchItem).removeClass("touch");
4975				});
4976
4977			});
4978			/* Close help, countryNav and account dropdowns on contract menu touchstart*/
4979			$("#mm > li li:not(.touchable)").each(function (index, item) {
4980				$(item).addClass("touchable");
4981				attachMobileHoverTouch(item);
4982			});
4983
4984			/* Fix the preview controls. */
4985			$(".contractPreview .controls > li:not(.touchable)").each(function (index, item) {
4986				$(item).addClass("touchable");
4987				var menus = $(item).children("ul");
4988				if (menus.length) {
4989					attachMobileHoverTouch(item, menus, menus.children("li").children("a"), allTouchablesSelector, function (touchItem, actionItem) {
4990						if (!$(actionItem).parent("li").children("ul").length) {
4991							$(touchItem).removeClass("touch");
4992							$(touchItem).find("li.touch").removeClass("touch");
4993						}
4994					});
4995				}
4996			});
4997			$(".contractPreview .controls > li > ul > li:not(.touchable)").each(function (index, item) {
4998				$(item).addClass("touchable");
4999				var menus = $(item).children("ul");
5000				if (menus.length) {
5001					attachMobileHoverTouch(item, menus, menus.children("li").children("a"), allTouchablesSelector, function (touchItem, actionItem) {
5002						$(touchItem).removeClass("touch");
5003						$(touchItem).parents("li.touch").removeClass("touch");
5004					});
5005				}
5006			});
5007
5008			/* Clear touch menus from the body. */
5009			if (!$(document.body).hasClass("bodyTouch")) {
5010				$(document.body).on("touchstart", function (e) {
5011					if (!$(allTouchablesSelector).has($(e.target)).length) {
5012						$(allTouchablesSelector).removeClass("touch");
5013					}
5014				}).on("touchmove", function (e) {
5015					e.stopPropagation();
5016				}).addClass("bodyTouch");
5017			}
5018		}
5019		else {
5020			setTimeout(fixMobileHoverMenus, 100);
5021		}
5022	}
5023}
5024/* Attach the touch events. 
5025 touchItem - The DOM element that is touchable.
5026 hoverItems - The items that are hoverable when touched.
5027 actionItems - The items within the hover that cause actions.
5028 allTouchablesSelector - The selector to get all touchable items.
5029 removeTouchOnActionFunc - The function to remove the touch classes when an actionItem is clicked.
5030 additionalTouchActionFunc - An additional function to call when the touchItem is touched.
5031*/
5032function attachMobileHoverTouch(touchItem, hoverItems, actionItems, allTouchablesSelector, removeTouchOnActionFunc, additionalTouchActionFunc) {
5033	if (touchItem) {
5034		$(touchItem).on("touchstart", function (e) {
5035			$(allTouchablesSelector).each(function (indexIn, itemIn) {
5036				if (itemIn != touchItem && (!$(touchItem).parents(".touch").length || itemIn != $(touchItem).parents(".touch")[0])) {
5037					$(itemIn).removeClass("touch");
5038				}
5039			});
5040
5041
5042			$(actionItems).css("pointer-events", "none");
5043			$(touchItem).toggleClass("touch", setTimeout(function () {
5044				$(actionItems).css("pointer-events", "auto");
5045			}, 300));
5046
5047			if (typeof (additionalTouchActionFunc) == "function") {
5048				additionalTouchActionFunc(touchItem);
5049			}
5050			e.stopPropagation();
5051		});
5052	}
5053	if (hoverItems && hoverItems.length) {
5054		hoverItems.on("touchstart", function (e) {
5055			e.stopPropagation();
5056		}).on("touchend", function (e) {
5057			e.stopPropagation();
5058		});
5059	}
5060	if (actionItems && actionItems.length && touchItem) {
5061		actionItems.on("click", function (e) {
5062			if (typeof (removeTouchOnActionFunc) == "function") {
5063				removeTouchOnActionFunc(touchItem, this);
5064			}
5065			e.stopPropagation();
5066		});
5067	}
5068}
5069if (typeof ($) == "function") {
5070	$(fixMobileHoverMenus);
5071}
5072else {
5073	rE(window, "load", fixMobileHoverMenus);
5074}
5075
5076/* Disable download as word on mobile, as Word editing doesn't work properly. */
5077function disableDownloadWord() {
5078	// if(typeof($) == "function" && typeof(cssua) != "undefined" && cssua.ua.mobile) {
5079	// $(".controls .save .comp .word > a:not(.disableDownloadWord),#navigation a[onclick^='saveAsWord']")
5080	// .removeAttr("onclick")
5081	// .unbind("click")
5082	// .click(function(e) {
5083	// alert("You must be on a desktop computer to download this document in Word format.");
5084	// e.preventDefault();
5085	// e.stopPropagation();
5086	// return false;
5087	// })
5088	// .addClass("disableDownloadWord");
5089	// }
5090}
5091rE(window, "load", disableDownloadWord);
5092
5093/* Fix the displaypdf.aspx links on PDF only contracts. */
5094function fixDisplayPDF() {
5095	if (typeof ($) == "function" && typeof (cssua) != "undefined" && cssua.ua.android) {
5096		var links = $("a[href*='displaypdf.aspx']");
5097		links.removeAttr("target");
5098		links.off('click');
5099		links.on('click', function (e) {
5100			window.open(this.href + (this.href.indexOf('?') >= 0 ? '&' : '?') + "save=true");
5101			e.preventDefault();
5102			e.stopPropagation();
5103			return false;
5104		});
5105	}
5106}
5107rE(window, "load", fixDisplayPDF);
5108
5109/* IOS Safari freezes when focusing on inputs. Add a legend to break the metadata scan. */
5110function fixIOSInputs() {
5111	if (typeof (cssua) != "undefined" && cssua.ua.safari && cssua.ua.mobile) {
5112		$("input:not(.legendFix)").before("<legend style=\"display:none\"></legend>").addClass("legendFix");
5113	}
5114}
5115rE(window, "load", fixIOSInputs);
5116
5117/* Make numeric inputs bring up the numeric keyboard. Don't select on focus. */
5118function fixMobileNumericInputs() {
5119	if (typeof (cssua) != "undefined" && cssua.ua.mobile) {
5120		if ($("input.telerikNumericInput").length) {
5121			/* Old Telerik numeric inputs */
5122			$("input.telerikNumericInput:not([pattern])").each(function (index, item) {
5123				$(item).attr("pattern", cssua.ua.mobile != "iphone" ? "[0-9]*" : null)
5124					.attr("inputmode", "numeric")
5125					.parents("form:not([novalidate])")
5126					.attr("novalidate", "novalidate");
5127			});
5128			if (cssua.ua.ios || cssua.ua.android) {
5129				$("input.telerikNumericInput").each(function (index, item) {
5130					if (item.control) {
5131						item.control.set_selectionOnFocus(Telerik.Web.UI.SelectionOnFocus.CaretToEnd);
5132					}
5133				});
5134				$("input.telerikInput:not(.telerikNumericInput)").each(function (index, item) {
5135					if (item.control) {
5136						item.control.set_selectionOnFocus(Telerik.Web.UI.SelectionOnFocus.CaretToBeginning);
5137					}
5138				});
5139			}
5140		}
5141		else if ($("div.numText input").length) {
5142			/* New jQuery numeric inputs */
5143			$("div.numText input:not([type='number'])").each(function (index, item) {
5144				if (!isSamsungDevice() || typeof ($(item).attr("min")) == "undefined" || parseFloat($(item).attr("min")) >= 0) {
5145					var curCult = window.languageCode;
5146					if (typeof curCult != "undefined" && curCult && curCult.substring(0, 2) == "en") {
5147						$(item).attr("type", "number");
5148					}
5149					$(item).attr("step", "0.00000001")
5150						.attr("inputmode", "numeric")
5151						.parents("form:not([novalidate])")
5152						.attr("novalidate", "novalidate");
5153				}
5154				else if (typeof (cssua) != "undefined" && cssua.ua.chrome && !cssua.ua.samsungbrowser && !isPhone()) {
5155					$(item).removeAttr("inputmode");
5156				}
5157			});
5158		}
5159		if ($(".phoneNumberContainer input").length) {
5160			/* ensure hidden inputs are included */
5161			$(".phoneNumberContainer input").show();
5162			/* phone keyboard init. */
5163			$(".phoneNumberContainer input:not([type='tel'])").each(function (index, item) {
5164				if (isPhone()) {
5165					$(item).attr("type", "tel");
5166				}
5167				else if (typeof (cssua) != "undefined" && cssua.ua.chrome && !cssua.ua.samsungbrowser && !isPhone()) {
5168					$(item).removeAttr("inputmode");
5169				}
5170			});
5171		}
5172	}
5173}
5174rE(window, "load", fixMobileNumericInputs);
5175
5176/* Make desktop date inputs use HTML5 dates, where supported, only on mobile. */
5177function fixMobileDateInputs() {
5178	var dateInput = document.createElement("input");
5179	dateInput.setAttribute("type", "date");
5180	if (typeof (cssua) != "undefined" && cssua.ua.mobile) {
5181		if (dateInput.type == "date" && !cssua.ua.iemobile && !cssua.ua.edge) {
5182			/* Telerik date picker */
5183			$(".RadPicker").each(function (index, item) {
5184				if ($(item).parent().siblings(".mobileDatePickerTelerik").length == 0) {
5185					var oldTextbox = $(item).find(".riTextBox");
5186					var hidden = $(item).children("input[type='text']");
5187					var telerikMinDate = new Date(1, 0, 1);
5188					telerikMinDate.setFullYear(1);
5189					var telerikMaxDate = new Date(9999, 11, 31);
5190					var minDate = null;
5191					var maxDate = null;
5192					if (typeof ($find) == "function") {
5193						var telerikCtrl = $find(hidden.attr("id"));
5194						if (!telerikCtrl) {
5195							if (typeof (Sys.Application) != "undefined") {
5196								Sys.Application.add_load(fixMobileDateInputs);
5197								return;
5198							}
5199						}
5200						else {
5201							telerikCtrl.add_popupOpening(function (sender, eventArgs) {
5202								eventArgs.set_cancel(true);
5203							});
5204							minDate = telerikCtrl.get_minDate();
5205							if (minDate - telerikMinDate == 0) minDate = null;
5206							maxDate = telerikCtrl.get_maxDate();
5207							if (maxDate - telerikMaxDate == 0) maxDate = null;
5208						}
5209					}
5210					var textbox = $("<input type='date'/>").attr("id", oldTextbox.attr("id") + "_date").attr("name", oldTextbox.attr("name") + "$date").val($(hidden).val()).attr("style", "width:" + (parseInt($(item).css("width")) + 20) + "px !important");
5211					if (minDate) textbox.attr("min", minDate.getFullYear() + "-" + (minDate.getMonth() + 1) + "-" + minDate.getDate());
5212					if (maxDate) textbox.attr("max", maxDate.getFullYear() + "-" + (maxDate.getMonth() + 1) + "-" + maxDate.getDate());
5213					var displayArea = $("<table class='mobileDateDisplayTelerik' cellspacing='0'></table>").append($("<tr></tr>")
5214						.append($("<td></td>").append($("<input type='text' readonly='readonly'>").attr("id", oldTextbox.attr("id") + "_display").attr("name", oldTextbox.attr("name") + "$display").css("width", $(item).css("width"))))
5215						.append($("<td><a></a></td>")));
5216					var wrapper = $("<span class='mobileDatePickerTelerik'></span>").append(textbox).append(displayArea).css("width", (parseInt($(item).css("width")) + 20) + "px");
5217					$(item).parent().hide();
5218					$(item).parent().after(wrapper);
5219					setMobileDatePickerDate(textbox);
5220
5221					textbox.on("change", function () {
5222						var newDate = $(this).val() ? new Date($(this).val()) : null;
5223						if (newDate) newDate.setMinutes(newDate.getTimezoneOffset());
5224						if (typeof ($find) == "function") {
5225							$find(hidden.attr("id")).set_selectedDate(newDate);
5226						}
5227						setMobileDatePickerDate(this);
5228						if ((minDate && newDate < minDate) || (maxDate && newDate > maxDate)) {
5229							var dateDisplay = $(this).siblings(".mobileDateDisplayTelerik").find("input");
5230							var oldStyle = dateDisplay.attr("style");
5231							dateDisplay.attr("style", oldStyle + ";border-color:#ff0000 !important");
5232							setTimeout(function () { dateDisplay.attr("style", oldStyle); }, 800);
5233						}
5234					});
5235				}
5236			});
5237			/* JQuery date picker */
5238			$(".datePickerWrapper").each(function (index, item) {
5239				if ($(item).children(".mobileDatePicker").length == 0) {
5240					var datePicker = $(item).find(".datePicker");
5241					var icon = $(datePicker).siblings(".datePickerIcon");
5242					var mobileDatePicker = $("<input type='date' />").attr("id", datePicker.attr("id") + "Picker").attr("name", datePicker.attr("name") + "Picker").addClass("mobileDatePicker" + (datePicker.hasClass("datePickerBorder") ? " datePickerBorder" : ""));
5243					mobileDatePicker.val($.datepicker.formatDate("yy-mm-dd", new Date(datePicker.val())));
5244					setMobileDatePickerWidth(mobileDatePicker, datePicker);
5245					if (datePicker.attr("data-mindate")) {
5246						mobileDatePicker.attr("min", datePicker.attr("data-mindate"));
5247					}
5248					if (datePicker.attr("data-maxdate")) {
5249						mobileDatePicker.attr("max", datePicker.attr("data-maxdate"));
5250					}
5251					$(item).prepend(mobileDatePicker);
5252					mobileDatePicker.on("change", function () {
5253						var newDate = $(this).val() ? new Date($(this).val()) : null;
5254						if (newDate) newDate.setMinutes(newDate.getTimezoneOffset());
5255						datePicker.datepicker("setDate", newDate);
5256						ensureValidDateSelected(datePicker);
5257						mobileDatePicker.val($.datepicker.formatDate("yy-mm-dd", datePicker.datepicker("getDate")));
5258						datePicker.trigger("change");
5259					});
5260					datePicker.on("touchstart focus", function (e) {
5261						e.preventDefault();
5262						e.stopPropagation();
5263					});
5264					datePicker.datepicker("disable");
5265					datePicker.prop("disabled", false);
5266					icon.removeAttr("onclick");
5267					var nativePickerOpenedAt = 0;
5268					icon.on("touchend", function (e) {
5269						e.preventDefault();
5270						e.stopPropagation();
5271						nativePickerOpenedAt = Date.now();
5272						openNativeDatePickerFromIcon(mobileDatePicker);
5273					});
5274					icon.on("click touchstart", function (e) {
5275						e.preventDefault();
5276						e.stopPropagation();
5277						if (Date.now() - nativePickerOpenedAt < 450) {
5278						 return;
5279					 }
5280					 if (typeof (cssua) != "undefined" && cssua.ua.android) {
5281							mobileDatePicker[0].click();
5282						} else {
5283							mobileDatePicker[0].focus();
5284						}
5285					 openNativeDatePickerFromIcon(mobileDatePicker);
5286					});
5287
5288					$("label[for='" + datePicker.attr("id") + "']").removeAttr("for");
5289				}
5290			});
5291		}
5292		else if (cssua.ua.iemobile || cssua.ua.edge) {
5293			$(".datePickerWrapper").each(function (index, item) {
5294
5295				var foundItem = $(item).find(".datePicker");
5296				foundItem.prop("readonly", true);
5297				foundItem.on('focus', function () {
5298					// store the element for use inside the position function
5299					var $target = $(this);
5300
5301					// get the elements datepicker widget object and set it's position based on the target element
5302					$target.datepicker('widget').position({
5303						my: 'left top',
5304						at: 'left bottom',
5305						of: $target
5306					});
5307				});
5308			});
5309		}
5310		else {
5311			$(".RadPicker .rcCalPopup").show();
5312		}
5313	}
5314}
5315function setMobileDatePickerDate(dateInput) {
5316	var oldTextbox = $(dateInput).parent().siblings(".telerikWrapper").find(".riTextBox");
5317	var oldTextboxDisplay = oldTextbox.siblings(".riDisplay");
5318	var newDateStr = oldTextboxDisplay.length ? oldTextboxDisplay.html() : oldTextbox.val();
5319	$(dateInput).siblings(".mobileDateDisplayTelerik").find("input").val(newDateStr);
5320}
5321function setMobileDatePickerWidth(mobileDatePicker, datePicker) {
5322	var icon = $(datePicker).siblings(".datePickerIcon");
5323	var iconMargin = icon.css("margin-left") ? parseInt(icon.css("margin-left")) : 0;
5324	var datePickerPadding = ($(datePicker).css("padding-left") ? parseInt($(datePicker).css("padding-left")) : 0) + ($(datePicker).css("padding-right") ? parseInt($(datePicker).css("padding-right")) : 0);
5325	var mobileDatePickerPaddingRight = $(mobileDatePicker).css("padding-right") ? parseInt($(datePicker).css("padding-right")) : 0;
5326	var datePickerMargin = ($(datePicker).css("margin-left") ? parseInt($(datePicker).css("margin-left")) : 0) + ($(datePicker).css("margin-right") ? parseInt($(datePicker).css("margin-right")) : 0);
5327	$(mobileDatePicker).attr("style", "padding-right:" + (mobileDatePickerPaddingRight + icon.width() + iconMargin + datePickerPadding + datePickerMargin) + "px");
5328}
5329/* Open the native date UI from the calendar icon; must run from a user gesture (tap). */
5330function openNativeDatePickerFromIcon(mobileDatePicker) {
5331	var el = mobileDatePicker && mobileDatePicker[0];
5332	if (!el) return;
5333	if (typeof el.showPicker === "function") {
5334		try {
5335			el.showPicker();
5336			return;
5337		} catch (ignore) { /* Some browsers throw if not user-activated or unsupported */ }
5338	}
5339	el.focus();
5340	if (typeof el.click === "function") {
5341		el.click();
5342	}
5343}
5344rE(window, "load", fixMobileDateInputs);
5345
5346/* Fix safari date issue with back button. */
5347if (window.addEventListener) {
5348	window.addEventListener("pageshow", function (e) {
5349		if (typeof (cssua) != "undefined" && cssua.ua.safari && cssua.ua.mobile && e.persisted && $(".mobileDatePickerTelerik").length) {
5350			setTimeout(function () {
5351				for (var picker in $(".mobileDatePickerTelerik")) {
5352					if ($(picker).find(".mobileDateDisplayTelerik input").val() == "") {
5353						location.reload();
5354						break;
5355					}
5356				}
5357			}, 100);
5358		}
5359	}, false);
5360}
5361
5362/* Fix Android Print button downloading. */
5363function fixAndroidPrintDownload() {
5364	if (typeof (cssua) != "undefined" && cssua.ua.android && (getGAPageName() == getCurrentProductCode() + " Preview" || getGAPageName() == getCurrentProductCode() + " Index")) {
5365		$("a[href*='displaypdf.aspx']").on("click", function (e) {
5366			postTo(this.href);
5367			e.preventDefault();
5368			return false;
5369		});
5370	}
5371}
5372if (typeof ($) != "undefined") {
5373	$(fixAndroidPrintDownload);
5374}
5375
5376/* Fix Android 1px borders. */
5377function fixAndroidBorders() {
5378	if (typeof (cssua) != "undefined" && cssua.ua.android) {
5379		$(".contract td,#outputPage td").each(function (index, item) {
5380			if ($(item).css("border-width") == "1px") {
5381				$(item).css("border-width", "2px");
5382			}
5383		});
5384	}
5385}
5386if (typeof ($) != "undefined") {
5387	$(fixAndroidBorders);
5388}
5389else {
5390	rE(window, "load", fixAndroidBorders);
5391}
5392
5393/* Fix Amortization Button */
5394function fixAmortizationButton() {
5395	if (typeof (cssua) != "undefined" && cssua.ua.mobile && typeof ($) == "function" && $(".printAmortizationButton").length && !$(".Spanish").length) {
5396		$(".printAmortizationButton").html("View Payment Schedule");
5397		if ($(".printAmortizationButton").attr("onclick")) {
5398			$(".printAmortizationButton").attr("onclick", $(".printAmortizationButton").attr("onclick").replace("View/Print", "View"));
5399		}
5400	}
5401}
5402if (typeof ($) != "undefined") {
5403	$(fixAmortizationButton);
5404}
5405
5406/* The code to run on AJAX responses to fix mobile issues. */
5407function fixMobileAjaxResponse() {
5408	fixMobileHoverMenus();
5409	disableDownloadWord();
5410	fixIOSInputs();
5411	fixMobileNumericInputs();
5412	fixMobileDateInputs();
5413	fixAndroidPrintDownload();
5414	fixAndroidBorders();
5415	fixAmortizationButton();
5416	fixMobileMaxLength();
5417}
5418
5419/* Fix maxlength issues for android 4.x and greater */
5420function fixMobileMaxLength() {
5421	if (typeof (cssua) != "undefined" && cssua.ua.mobile) {
5422		var idMaxLengthMap = {};
5423		/* loop through all input-text and textarea element */
5424		$.each($(':text, textarea, :password'), function () {
5425			var id = $(this).attr('id'),
5426				maxlength = $(this).attr('maxlength');
5427
5428			/* element should have id and maxlength attribute */
5429			if ((typeof id !== 'undefined') && (typeof maxlength !== 'undefined')) {
5430				idMaxLengthMap[id] = maxlength;
5431				/* replace maxlength attribute with onkeypress event */
5432				$(this).on('keypress', function () { if (this.value.length >= $(this).attr("maxlength")) return false; });
5433			}
5434		});
5435
5436		/* bind onchange & onkeyup events
5437			  These events prevents user from pasting text with length more then maxlength */
5438		$(':text, textarea, :password').on('change keyup', function () {
5439			var id = $(this).attr('id'),
5440				maxlength = '';
5441			if (typeof id !== 'undefined' && idMaxLengthMap.hasOwnProperty(id)) {
5442				maxlength = idMaxLengthMap[id];
5443				if ($(this).val().length > maxlength) {
5444					/* remove extra text which is more then maxlength */
5445					$(this).val($(this).val().slice(0, maxlength));
5446				}
5447			}
5448		});
5449	}
5450}
5451if(typeof($) == "function") $(fixMobileMaxLength);
5452
5453/* Make sure saving happens on IOS safari since it doesn't trigger the onbeforeunload event */
5454if (typeof ($) == "function") {
5455	$(function () {
5456		if (typeof (cssua) != "undefined" && cssua.ua.safari && cssua.ua.mobile && typeof (saveData) == "function") {
5457			$(window).on("pagehide", function () { saveData(); });
5458		}
5459	});
5460}
5461
5462
5463
5464if (typeof (cssua) != 'undefined' && cssua.ua.mobile) {
5465	/* Editor link alert for mobile device. For DCS fixes. */
5466	function BlockEditor() {
5467		var leftNavEditorLink = "#ctl00_Navigation_ctrlDocOptionsLeft_ctl00_Navigation_ctrlDocOptionsLeftlnkEditWords_lnkLink, #ctrlDocOptions_itemEdit_lnkLink, #contentTop .controls .editor";
5468		$(leftNavEditorLink).attr("style", "display: none");
5469		$("#contentTop .controls .share").attr("style", "border-radius:0 10px 10px 0");
5470		$("#ctl00_Content_ctrlDocOptionsBottom_ctl00_Content_ctrlDocOptionsBottomlnkEditWords_lnkLink").parent().css("display", "none");
5471		$("#ctrlDocOptionsDown_itemEdit_lnkLink").parent().css("display", "none");
5472
5473	}
5474	rE(window, "load", BlockEditor);
5475}
5476
5477 /*Sets mobile footer to be displayed at the bottom on shorter pages. Assumes that all displayed elements are within the #wrapper div when calculating heights.*/
5478function positionMobileFooter() {
5479	if (isPhone() && $('html').hasClass('supportsMobile')) {
5480		$('#content').css({ "min-height": "" });
5481		/*Lawdepot uses wrapper and legalcontracts uses bodywrap. If wrapper doesn't exists then use bodyWrap*/
5482		var wrapperHeight = $('#wrapper').length == 0 ? $('#bodyWrap').height() : $('#wrapper').height();
5483		var eH = wrapperHeight - $('#content').height();
5484		if (eH < 0) eH = 0;
5485
5486		var minH = $(window).outerHeight() - eH;
5487		$('#content').css({ "min-height": minH + "px" });
5488	}
5489}
5490
5491/*Sets the page height on ipads to allow users to zoom out and see entire page if the page would normally be too short*/
5492function iTabletHeightAdjust() {
5493	if (parent == self && $('html').hasClass('ua-mobile-ipad')) {
5494		$('body').css('height', '');
5495		var mVal = $(window).height() * Math.max($('body').width() / $(window).width(), 1);
5496		if ($('body').height() < mVal) {
5497			$('body').height(mVal);
5498		}
5499	}
5500}
5501
5502if (typeof ($) != 'undefined') {
5503	$(function () {
5504		positionMobileFooter();
5505		iTabletHeightAdjust();
5506	});
5507	$(window).on("orientationchange", function (event) {
5508		iTabletHeightAdjust();
5509	});
5510	if (isPhone() && $('html').hasClass('supportsMobile')) {
5511		$(window).on("resize", function () {
5512			positionMobileFooter();
5513		});
5514	}
5515}
5516
5517/*Check if it is touch device */
5518function isTouchDevice() {
5519	return (document.documentElement && "ontouchstart" in document.documentElement) || navigator.maxTouchPoints || navigator.msMaxTouchPoints;
5520}
5521
5522function fixViewport(){
5523	var viewport = document.getElementById("viewport");
5524	if(viewport != null && isPhone()) {
5525	   if(typeof(cssua) != "undefined" && (cssua.ua.android_browser || cssua.ua.samsungbrowser)) {
5526		  viewport.content += ", user-scalable=no";
5527	   }
5528	}
5529	else if(viewport != null) {
5530	   if(typeof(cssua) != "undefined" && (cssua.ua.android_browser || cssua.ua.samsungbrowser)) {
5531		  var width = "989";
5532		  var htmlMinWidth = getComputedStyle(document.querySelector("html"))["min-width"] ? parseInt(getComputedStyle(document.querySelector("html"))["min-width"]) : 0;
5533		  if(htmlMinWidth) {
5534			 width = htmlMinWidth + "";
5535		  }
5536		  viewport.content = "width="+width+", user-scalable=no";
5537	   }
5538	   else {
5539		  viewport.content="";
5540	   }
5541	}
5542	viewport = document.getElementById("viewportSlate");
5543	if(viewport != null && typeof(cssua) != "undefined" && cssua.ua.mobile) {
5544	   if((typeof(supportsMobile) != "undefined" && supportsMobile) || document.querySelector('html.supportsMobile')) {
5545		  if(cssua.ua.ios && !isPhone()) {
5546			 viewport.content = viewport.content.replace(/,\ user-scalable=no/i, "");
5547		  }
5548		  else {
5549			 viewport.content = "width=device-width";
5550			 if(typeof(cssua) != "undefined" && (cssua.ua.android_browser || cssua.ua.samsungbrowser)) {
5551				viewport.content += ", user-scalable=no";
5552			 }
5553		  }
5554	   }
5555	   else {
5556		  viewport.content = "";
5557	   }
5558	}
5559	else if(viewport != null && typeof(cssua) != "undefined" && !cssua.ua.mobile) {
5560	   viewport.content = "";
5561	}
5562 }
5563 fixViewport();
5564/* End Include mobile */
5565
5566/* Include webuserData */
5567/* Webuser Data */
5568/**
5569 * Class like object to store WebuserDataInfo from the server.
5570 * Properties are read-only.
5571 * @constructor
5572 */
5573function WebuserDataInfo(){}
5574(function(wd){
5575   wd.Events = [];
5576   wd.EventFuncs = {};
5577   wd.EventTriggers = {};
5578   wd.id = null;
5579   wd.shared = false;
5580   
5581   /**
5582    * Class like function for storing Multiuser information
5583    * @constructor
5584    */
5585   function Multiuser(){
5586      /**
5587       * Stores information about the invitations sent from this multiuser parent.
5588       * The server limits the counts for each of these properties to 10.
5589       * @type {{submitted: number, inProgress: number, notStarted: number}}
5590       */
5591      this.invitations = {
5592         notStarted: 0, // The number of invitations that have not yet been started.
5593         inProgress: 0, // The number of invitations where the document is started but not yet submitted
5594         submitted: 0, // The number of invitations where the document is submitted
5595      }
5596      /**
5597       * Stores the local appropriate string to describe the numbers in this.invitations
5598       * JS localization for all languages is only supported in C#, if this feature becomes available in JS, this object should be obsoleted.
5599       * @type {{submitted: string, inProgress: string, notStarted: string}}
5600       */
5601      this.invitationsLocalized = {
5602         notStarted: "Zero",
5603         inProgress: "Zero",
5604         submitted: "Zero",
5605      }
5606   }
5607
5608   /**
5609    * Sets up the Multiuser property with the Multiuser class
5610    * Calling this twice would remove any previously set Multiuser object and generate a warning as this should only be used during initial setup
5611    * @constructor
5612    */
5613   wd.CreateMultiuserInfo = function(){
5614      if(wd.Multiuser !== null) console.warn("CreateMultiuserInfo has been called twice, previous information will be overwritten.");
5615      wd.Multiuser = new Multiuser();
5616   }
5617   
5618   /**
5619    * Related multiuser information for this document if it is a multiuser parent. It will be null if not a multiuser parent.
5620    * Do not set properties of this object until CreateMultiuserInfo has been called.
5621    * @type {Multiuser}
5622    */
5623   wd.Multiuser = null;
5624   /**
5625    * If this document is a child document of a multiuser enabled parent.
5626    * @type {boolean}
5627    */
5628   wd.isMultiuserChildDocument = false;
5629   /**
5630    * Adds an event to the current webuserData. Assumes that the database successfully adds the event and immediately synchronizes
5631    * the client side representation of the event.
5632    * @param eventName {string} The event to add
5633    * @param allUsers {boolean} If the event is shared by all users, if false an event will be recorded for every distinct user on this document
5634    * @param [websiteLinkHash] {string} optional. A hash being used to authorize this request if the current user wouldn't otherwise have access to the document.  
5635    * @constructor
5636    */
5637   wd.AddEvent = function(eventName, allUsers, websiteLinkHash){
5638      if(typeof(allUsers) != "boolean") allUsers = false;
5639      // "" is the designated default value for null in the AddWebuserDataEvent method
5640      if(typeof(websiteLinkHash) != "string") websiteLinkHash = "";
5641      wd.Events.unshift({name:eventName, time:new Date()});
5642      if(typeof(wd.id) != "undefined" && wd.id) CallDataService("AddWebuserDataEvent", {
5643         webuserDataID:wd.id, 
5644         eventName:eventName, 
5645         allUsers:allUsers,
5646         websiteLinkHash: websiteLinkHash
5647      });
5648      wd.TriggerEvent(eventName);
5649   }
5650   wd.RegisterEvent = function(eventName, funcName, func, execOnlyOnEvent){
5651      if(!execOnlyOnEvent && (typeof(wd.EventFuncs[name]) == 'undefined' || wd.EventFuncs[name] != func)) func();
5652      wd.EventFuncs[funcName] = func;
5653      if(typeof(wd.EventTriggers[eventName]) == "undefined") wd.EventTriggers[eventName] = [];
5654      for(var i = 0; i < wd.EventTriggers[eventName].length; ++i){
5655         if(wd.EventTriggers[eventName][i] == funcName){
5656            return;
5657         }
5658      }
5659      wd.EventTriggers[eventName].push(funcName);
5660   }
5661   wd.TriggerEvent = function(eventName){
5662      if(typeof(wd.EventTriggers[eventName]) != "undefined"){
5663         for(var i=0; i < wd.EventTriggers[eventName].length; ++i){
5664            wd.EventFuncs[wd.EventTriggers[eventName][i]]();
5665         }
5666      }
5667   }
5668   wd.GetEventTime = function(eventName){
5669      for(var i=0; i<wd.Events.length; ++i){
5670         if(wd.Events[i].name == eventName) return wd.Events[i].time;
5671      }
5672		return new Date(-62135569568000); /* January 1, 0001. This is the minimum date for C# so we'll use that to keep them consistent. */
5673   }
5674   wd.GetEventOccurred = function(eventName){
5675      for(var i=0; i<wd.Events.length; ++i){
5676         if(wd.Events[i].name == eventName) return true;
5677      }
5678      return false;
5679   }
5680} (WebuserDataInfo));
5681/* End Include webuserData */
5682
5683/* Include cookies */
5684function setCookie(name, value, days, encodeValue) {
5685    if (days) {
5686        var date = new Date();
5687        date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
5688        var expires = "; expires=" + date.toGMTString();
5689    } else var expires = "";
5690    if(typeof encodeValue == "undefined" || encodeValue)
5691    	value = escape(value);
5692    document.cookie = escape(name) + "=" + value + expires + "; path=/; secure";
5693}
5694function getCookie(name){
5695   var cookies=document.cookie.split(";");
5696   var value = null;
5697   for (var i=0; i<cookies.length; i++){
5698      var cookieName = cookies[i].substr(0, cookies[i].indexOf("=")).replace(/^\s+|\s+$/g,"");
5699      if (cookieName == name){
5700         value = unescape(cookies[i].substr(cookies[i].indexOf("=")+1));
5701         break;
5702      }
5703   }
5704   return value;
5705}
5706function deleteCookie(name) {
5707   setCookie(name, "", -1, false);
5708}
5709
5710function getCookieValue(name){
5711   var cookie = getCookie(name);
5712	return typeof(cookie) != "undefined" && cookie != null ? cookie : "";
5713}
5714
5715function cookiesEnabled(){
5716   setCookie('cookieTest', 'testing');
5717   var success = getCookie('cookieTest') == 'testing';
5718   if(success) deleteCookie('cookieTest');
5719   return success;
5720}
5721/* End Include cookies */
5722
5723/* Include valueHandler */
5724/* Value Handler */
5725function ValueHandler() {
5726	/** 
5727	 * @typedef {object} ValueInfo Information stored in the Values object.
5728	 * @property {any} Value The value being tracked
5729	 * @property {Object.<string, string[]>} Events Array of change events for this value.
5730	 * The keys are the type of event (change, click, etc)
5731	 * Each change event is an array of the names functions to call when it is triggered. 
5732	 * The functions are contained in the UpdateFuncs array.
5733	 * @property {boolean} Edited If this value has been changed since the page loaded.
5734	 * @property {boolean} Viewed If the user has seen the input responsible for this value.
5735	 */
5736
5737	/** 
5738	 * Array of values. Each name has an object with several properties.
5739	 * @type {ValueInfo} 
5740	 */
5741	this.Values = {};
5742
5743	/**
5744	 *  @typedef {object} UpdateFunc An update function.
5745	 *  @property {function} Func The function itself
5746	 *  @property {boolean} ExecOnlyOnEvent If the function should only be executed when specific events happen and not on load.
5747	 */
5748
5749	/**
5750	 * An array of functions used for updates.
5751	 * The keys are the names of the functions.
5752	 * @type {Object.<string, UpdateFunc>}
5753	 */
5754	this.UpdateFuncs = {};
5755
5756	/**
5757	 * @typedef {object} AfterVisibilityObject An object that is affected by a visibilty change.
5758	 * @property {string} id The id of the object
5759	 * @property {boolean} readyToCall If this object is ready to be updated (?)
5760	 */
5761
5762	/**
5763	 * @typedef {object} AfterVisibilityFunc Information about functions to call after visibility changes
5764	 * @property {function} func The function itself
5765	 * @property {AfterVisibilityObject[]} objects An array of objects to be updated (?)
5766	 */
5767
5768	/**
5769	 * An array of object groups and functions to call when the visibility 
5770	 * of the object group changes.
5771	 * The keys are the javascript code being run (?)
5772	 * @type {Object.<string, AfterVisibilityFunc>}
5773	 */
5774	this.AfterVisibilityFuncs = {};
5775	this.VS = function () {
5776		var size = 0, key;
5777		for (key in this.Values) {
5778			if (this.Values.hasOwnProperty(key)) size++;
5779		}
5780		return size;
5781	}
5782	/**
5783	 * "Clear Changes" Sets the edited state to false for everything.
5784	 */
5785	this.CC = function () {
5786		for (var n in this.Values) {
5787			this.Values[n].Edited = false;
5788		}
5789	}
5790	/**
5791	 * "Has Changes" If any value on the page has been changed since it was loaded
5792	 * @return {boolean}
5793	 */
5794	this.HC = function () {
5795		for (var n in this.Values) {
5796			if (this.Values[n].Edited) {
5797				return true;
5798			}
5799		}
5800		return false;
5801	}
5802	this.C = function () {
5803		this.UpdateFuncs = new Object();
5804		for (var n in this.Values) {
5805			this.Values[n].Events = new Object();
5806		}
5807	}
5808	this.IA = function () {
5809		for (var n in this.Values) {
5810			for (var e in this.Values[n].Events) {
5811				if (typeof (this.Values[n].Events[e] != "function")) this.FireChange(n, e);
5812			}
5813		}
5814	}
5815	/**
5816	 * "Set" Sets the specified value.
5817	 * @param {string} name The name of the value to set.
5818	 * @param {any} value The value to set it to.
5819	 * @param {[string]} evt The event that triggered this.
5820	 * @param {[any]} valEnc The HTML encoded value.
5821	 * @param {[boolean]} [viewed] If the user has seen this value, default is false
5822	 */
5823	this.S = function (name, value, evt, valEnc, viewed) {
5824		this.InitEvent(name, evt);
5825		if (typeof (viewed) === 'boolean' && this.Values[name].Viewed === null) this.Values[name].Viewed = viewed;
5826		var changed = !oe(this.Values[name].Value, value);
5827		if (changed) {
5828			this.Values[name].Value = value;
5829			if (typeof (valEnc) !== 'undefined') this.Values[name].ValueEncoded = valEnc;
5830			else this.Values[name].ValueEncoded = null;
5831			var triggerChange = true;
5832			if (typeof (evt) !== 'undefined' && evt !== null) {
5833				this.Values[name].Edited = true;
5834			}
5835		}
5836
5837		if (typeof (evt) !== 'undefined' && evt !== null) {
5838			changed = !oe(this.Values[name].Events[evt.toLowerCase()].Value, value);
5839			this.Values[name].Events[evt.toLowerCase()].Value = value;
5840		}
5841		else {
5842			for (var evnt in this.Values[name].Events) {
5843				if (typeof (this.Values[name].Events[evnt]) != "function") {
5844					this.Values[name].Events[evnt].Value = value;
5845				}
5846			}
5847		}
5848		if (changed) {
5849			this.FireChange(name, evt);
5850
5851			/* Fire changes for any repeaters this is in. This needs to trigger a change for each level of nested repeaters. */
5852			var nameSplit = name.split(':');
5853			var repName = nameSplit[nameSplit.length - 1];
5854			for (var i = nameSplit.length - 2; i >= 0; --i) {
5855				if ($.isNumeric(nameSplit[i])) {
5856					repName = "0:" + repName;
5857					var fullName = repName;
5858					for (var j = i - 1; j >= 0; --j) {
5859						fullName = nameSplit[j] + ":" + fullName;
5860					}
5861					if (typeof (this.Values[fullName]) !== "undefined") {
5862						if (typeof (evt) !== 'undefined' && evt !== null) this.Values[fullName].Edited = true;
5863						this.FireChange(fullName, evt);
5864					}
5865				}
5866				else {
5867					repName = nameSplit[i] + ":" + repName;
5868				}
5869			}
5870		}
5871	}
5872	/**
5873	 * Gets the value of the question with the given name. If the name does not exist it will initialize that value
5874	 * for the value handler
5875	 * @param name
5876	 * @returns {*}
5877	 * @constructor
5878	 */
5879	this.G = function (name) {
5880		this.Init(name);
5881		return this.Values[name].Value;
5882	}
5883	/**
5884	 * Like this.G, but gets the HTML encoded value.
5885	 * @param name
5886	 * @returns {null|*}
5887	 * @constructor
5888	 */
5889	this.GE = function (name) {
5890		this.Init(name);
5891		if (this.Values[name].ValueEncoded != null) return this.Values[name].ValueEncoded;
5892		else return htmlEncode(this.Values[name].Value);
5893	}
5894	/**
5895	 * Sets the Viewed value for a specific name.
5896	 * @param {string} name The name to set the viewed value for.
5897	 * @param {boolean} viewed The value to set.
5898	 */
5899	this.SetViewed = function (name, viewed) {
5900		this.Init(name);
5901		this.Values[name].Viewed = viewed;
5902	}
5903	/**
5904	 * Alias for Viewed for backwards compatibility. Determines if the input for a value has been seen by the user.
5905	 * @param {string} name The name of the value to check.
5906	 * @returns {boolean} True if the user has seen the input. False otherwise.
5907	 */
5908	this.Saved = function (name) {
5909		return this.Viewed(name);
5910	}
5911	/**
5912	 * Determines if the input for a value has been seen by the user.
5913	 * @param {string} name The name of the value to check.
5914	 * @returns {boolean} True if the user has seen the input. False otherwise.
5915	 */
5916	this.Viewed = function (name) {
5917		this.Init(name);
5918		if (typeof (this.Values[name].Viewed) !== 'boolean') return false;
5919		return this.Values[name].Viewed;
5920	}
5921	/**
5922	 * Initialize a value in the array.
5923	 * @param {string} name The name of the value to initialize.
5924	 */
5925	this.Init = function (name) {
5926		if (typeof (this.Values[name]) === 'undefined') {
5927			this.Values[name] = new Object();
5928			this.Values[name].Edited = false;
5929			this.Values[name].Events = new Object();
5930			this.Values[name].Postback = new Object();
5931			this.Values[name].Value = "";
5932			this.Values[name].ValueEncoded = null;
5933			this.Values[name].Viewed = null;
5934		}
5935	}
5936	this.InitEvent = function (name, evt) {
5937		this.Init(name);
5938		if (typeof (evt) != 'undefined' && evt != null && typeof (this.Values[name].Events[evt.toLowerCase()]) == 'undefined') {
5939			var evtLower = evt.toLowerCase();
5940			this.Values[name].Events[evtLower] = new Object();
5941			this.Values[name].Events[evtLower].Functions = new Array();
5942			this.Values[name].Events[evtLower].Value = this.Values[name].Value;
5943		}
5944	}
5945	this.UA = function (excludeVals) {
5946		if (excludeVals === undefined) {
5947			excludeVals = false;
5948		}
5949		for (var n in this.UpdateFuncs) {
5950			if (!excludeVals || !this.UpdateFuncs[n].ExecOnlyOnEvent) {
5951				this.UpdateFuncs[n].Func();
5952			}
5953		}
5954	}
5955	/**
5956	 * Store a function into the UpdateFuncs dictionary.
5957	 * @param {string} name The key to store the function under
5958	 * @param {function} func The function itself
5959	 * @param {boolean} [execOnlyOnEvent=false] If false, will fire event immediately as well as store it.
5960	 */
5961	this.SF = function (name, func, execOnlyOnEvent) {
5962		if (execOnlyOnEvent === undefined) {
5963			execOnlyOnEvent = false;
5964		}
5965		if (!execOnlyOnEvent && (typeof (this.UpdateFuncs[name]) == 'undefined' || this.UpdateFuncs[name].Func != func)) {
5966			func();
5967		}
5968		this.UpdateFuncs[name] = new Object();
5969		this.UpdateFuncs[name].ExecOnlyOnEvent = execOnlyOnEvent;
5970		this.UpdateFuncs[name].Func = func;
5971	}
5972	/**
5973	 * Register an function to fire on a specific event
5974	 * @param {string} name The id of the control
5975	 * @param {string} funcName The name to register the function under
5976	 * @param {function} func The function to call.
5977	 * @param {string} evt The event name that will cause the function to be called.
5978	 * @param {boolean} execOnlyOnEvent If false, will fire event immediately as well as register it.
5979	 */
5980	this.R = function (name, funcName, func, evt, execOnlyOnEvent) {
5981		this.SF(funcName, func, execOnlyOnEvent);
5982		this.InitEvent(name, evt);
5983		for (var i = 0; i < this.Values[name].Events[evt.toLowerCase()].Functions.length; ++i) {
5984			if (this.Values[name].Events[evt.toLowerCase()].Functions[i] == funcName) {
5985				return;
5986			}
5987		}
5988		this.Values[name].Events[evt.toLowerCase()].Functions.push(funcName);
5989	}
5990	this.RP = function (name, funcName, func, evt) {
5991		this.SF(funcName, func, true);
5992		this.Init(name);
5993		this.Values[name].Postback[evt.toLowerCase()] = funcName;
5994	}
5995	this.RAV = function (id, funcName, visibilityCode, func) {
5996		if (!this.AfterVisibilityFuncs[visibilityCode]) {
5997			this.AfterVisibilityFuncs[visibilityCode] = {};
5998		}
5999		if (!this.AfterVisibilityFuncs[visibilityCode][funcName]) {
6000			this.AfterVisibilityFuncs[visibilityCode][funcName] = {
6001				objects: [{
6002					id: id,
6003					readyToCall: false
6004				}],
6005				func: func
6006			};
6007		}
6008		else {
6009			this.AfterVisibilityFuncs[visibilityCode][funcName].objects.push({
6010				id: id,
6011				readyToCall: false
6012			});
6013		}
6014	}
6015	this.OAV = function (id) {
6016		for (var visibilityCode in this.AfterVisibilityFuncs) {
6017			for (var funcName in this.AfterVisibilityFuncs[visibilityCode]) {
6018				var readyToCall = true;
6019				var containsId = false;
6020				for (var i = 0; i < this.AfterVisibilityFuncs[visibilityCode][funcName].objects.length; i++) {
6021					if (this.AfterVisibilityFuncs[visibilityCode][funcName].objects[i].id == id) {
6022						this.AfterVisibilityFuncs[visibilityCode][funcName].objects[i].readyToCall = true;
6023						containsId = true;
6024					}
6025					else if (!this.AfterVisibilityFuncs[visibilityCode][funcName].objects[i].readyToCall) {
6026						readyToCall = false;
6027					}
6028				}
6029				if (containsId && readyToCall) {
6030					this.AfterVisibilityFuncs[visibilityCode][funcName].func();
6031					for (var i = 0; i < this.AfterVisibilityFuncs[visibilityCode][funcName].objects.length; i++) {
6032						this.AfterVisibilityFuncs[visibilityCode][funcName].objects[i].readyToCall = false;
6033					}
6034				}
6035			}
6036		}
6037	}
6038	/**
6039	 * Triggers all appropriate actions when the named value is updated by the provided event type.
6040	 * @param {string} name The name of the value that was changed.
6041	 * @param {string} evt The type of triggering event, if not specified all events will be triggered.
6042	 */
6043	this.FireChange = function (name, evt) {
6044		if (typeof (this.Values[name]) != "undefined" && typeof (this.Values[name].Events) != "undefined") {
6045			if (typeof (evt) != "undefined" && evt != null) {
6046				var evtLower = evt.toLowerCase();
6047				var func;
6048				// Check for a postback function that should be triggered by this change.
6049				if (typeof (this.Values[name].Postback[evtLower]) != "undefined") {
6050					var func = this.UpdateFuncs[this.Values[name].Postback[evtLower]];
6051				}
6052				if (typeof (func) != "undefined" && typeof (func.Func) == "function") {
6053					// There is a valid postback function, if there isn't a group currently being preloaded run the postback function immediately.
6054					if (!qnh.PreloadGroups || qnh.PreloadGroupsState == "finished") {
6055						func.Func();
6056					}
6057					// If there is a group currently being preloaded run the postback after that group finishes loading.
6058					else if (!qnh.PreloadGroupsState) {
6059						qnh.PreloadGroupsState = "pausing";
6060						AjaxWait();
6061						qnh.AddAfterGroupLoaded(function () {
6062							func.Func();
6063						});
6064					}
6065				}
6066				else if (typeof (this.Values[name].Events[evtLower]) != "undefined") {
6067					// If there was no valid postback function, run non postback functions.
6068					// It is assumed that if there is a postback either the postback will update everything relevant 
6069					// or this change will be triggered again by the postback and these updates will run then.
6070					for (var i = 0; i < this.Values[name].Events[evtLower].Functions.length; ++i) {
6071						this.UpdateFuncs[this.Values[name].Events[evtLower].Functions[i]].Func();
6072						if (typeof (this.Values[name].Events) == "undefined") {
6073							break;
6074						}
6075					}
6076				}
6077			}
6078			else {
6079				// If no event is specified, trigger changes for all types of events.
6080				for (var evnt in this.Values[name].Events) {
6081					if (typeof (this.Values[name].Events[evnt]) != "function") {
6082						this.FireChange(name, evnt);
6083					}
6084				}
6085			}
6086		}
6087	}
6088}
6089var vh = new ValueHandler();
6090/* End Value Handler */
6091/* End Include valueHandler */
6092
6093/* Include date */
6094function maxDate() {
6095	var maxDate = null;
6096	for (var i = 0; i < arguments.length; ++i) {
6097		if (arguments[i] instanceof Date) {
6098			if (maxDate == null || arguments[i] > maxDate) maxDate = arguments[i];
6099		}
6100	}
6101	return maxDate;
6102}
6103function setDateRestriction(id, value, type) {
6104	var formattedDate = value;
6105	if (typeof (value) != "undefined" && value != null && typeof (value.ldformat) == "function") formattedDate = value.ldformat('yyyy-MM-dd');
6106	$('#' + id).datepicker("option", type + "Date", value);
6107	$('#' + id).attr('data-' + type + 'Date', formattedDate);
6108	$('#' + id + "Picker").attr(type + 'Date', formattedDate);
6109	$('#' + id).siblings('.mobileDatePicker').attr(type, formattedDate);
6110	$('#' + id).trigger('change');
6111}
6112function setMinDate(id, value) {
6113	setDateRestriction(id, value, 'min');
6114}
6115function setMaxDate(id, value) {
6116	setDateRestriction(id, value, 'max');
6117}
6118
6119function stringToDate(dateString) {
6120	var retDate = new Date();
6121	var month, day, year;
6122	month = dateString.substring(0, 2);
6123	day = dateString.substring(3, 5);
6124	year = dateString.substring(6);
6125	retDate.setFullYear(year, month - 1, day);
6126	retDate.setHours(0, 0, 0, 0);
6127	return retDate;
6128}
6129/* This script from The JavaScript Source : http://javascript.internet.com*/
6130/* Created by Oded Arbel : http://geek.co.il/wp */
6131Date.MONTH_NAMES=["January","February","March","April","May","June","July","August","September","October","November","December"];
6132Date.WEEKDAY_NAMES=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];
6133Date.prototype.clone=function(){return new Date(this.getTime());}
6134Date.prototype.clearTime = function () {
6135	this.setHours(0);
6136	this.setMinutes(0);
6137	this.setSeconds(0);
6138	this.setMilliseconds(0);
6139	return this;
6140}
6141Date.prototype.lastDay = function () {
6142	var tempDate = this.clone();
6143	tempDate.setMonth(tempDate.getMonth() + 1);
6144	tempDate.setDate(0);
6145	return tempDate.getDate();
6146}
6147Date.prototype.getYearDay = function () {
6148	var today = new Date(this);
6149	today.setHours(0);
6150	today.setMinutes(0);
6151	today.setSeconds(0);
6152	var tempDate = new Date(today);
6153	tempDate.setDate(1);
6154	tempDate.setMonth(0);
6155	return Math.round((today.getTime() - tempDate.getTime()) / 86400 / 1000) + 1;
6156}
6157Date.prototype.ldformat = function (formatString) {
6158	var out = new String();
6159	var token = "";
6160	for (var i = 0; i < formatString.length; i++) {
6161		if (formatString.charAt(i) == '\\') {
6162			out = out.concat(this.getDatePart(token));
6163			out = out.concat(formatString.charAt(i + 1));
6164			i++;
6165			token = "";
6166		}
6167		else {
6168			if (formatString.charAt(i) == token.charAt(0)) {
6169				token = token.concat(formatString.charAt(i));
6170				continue;
6171			}
6172
6173			out = out.concat(this.getDatePart(token));
6174			token = formatString.charAt(i);
6175		}
6176	}
6177	return out + this.getDatePart(token);
6178}
6179Date.prototype.getDatePart = function (str) {
6180	switch (str.charAt(0)) {
6181		case 'y':
6182			if (str.length > 2) return Date.zeroPad(this.getFullYear().toString(), str.length);
6183			return this.getFullYear().toString().substring(2);
6184		case 'd':
6185			if (str.length < 3) return Date.zeroPad(this.getDate(), str.length);
6186			else if (str.length == 3) return this.getShortDOWName();
6187			else if (str.length > 3) return this.getDOWName()
6188		case 'D':
6189			return this.getYearDay();
6190		case 't':
6191			return this.getHours() > 11 ? "PM" : "AM";
6192		case 'H':
6193			return Date.zeroPad(this.getHours(), str.length);
6194		case 'h': ;
6195			return Date.zeroPad(this.get12Hours(), str.length);
6196		case 'm':
6197			return Date.zeroPad(this.getMinutes(), 2);
6198		case 's':
6199			return Date.zeroPad(this.getSeconds(), 2);
6200		case 'S':
6201			return Date.zeroPad(this.getMilliseconds(), str.length);
6202		case 'x':
6203			return this.getTime();
6204		case 'Z':
6205			return (this.getTimezoneOffset() / 60) + ":" + Date.zeroPad(this.getTimezoneOffset() % 60, 2);
6206		case 'M':
6207			if (str.length > 3) return this.getFullMonthName();
6208			if (str.length > 2) return this.getShortMonthName();
6209			return Date.zeroPad(this.getMonth() + 1, str.length);
6210		case '#':
6211			if (this.getDate() % 10 == 1)
6212				return 'st';
6213			else if (this.getDate() % 10 == 2)
6214				return 'nd';
6215			else if (this.getDate() % 10 == 3)
6216				return 'rd';
6217			else
6218				return 'th';
6219		default:
6220			return str;
6221	}
6222}
6223Date.prototype.getFullMonthName = function () {
6224	return Date.MONTH_NAMES[this.getMonth()];
6225}
6226Date.prototype.getShortMonthName = function () {
6227	return Date.MONTH_NAMES[this.getMonth()].substring(0, 3);
6228}
6229Date.prototype.getDOWName = function () {
6230	return Date.WEEKDAY_NAMES[this.getDay()];
6231}
6232Date.prototype.getShortDOWName = function () {
6233	return Date.WEEKDAY_NAMES[this.getDay()].substring(0, 3);
6234}
6235Date.prototype.get12Hours = function () {
6236	return this.getHours() == 0 ? 12 : (this.getHours() > 12 ? this.getHours() - 12 : this.getHours());
6237}
6238Date.zeroPad = function (num, width) {
6239	num = num.toString();
6240	while (num.length < width)
6241		num = "0" + num;
6242	return num;
6243}
6244Date.prototype.addDays = function (num) {
6245	return new Date(this.getTime() + num * 1000 * 60 * 60 * 24);
6246}
6247Date.prototype.addMonths = function (num) {
6248	var t = new Date(this);
6249	t.setMonth(this.getMonth() + num);
6250	if (t.getMonth() != (this.getMonth() + num + 12) % 12) t.setDate(0);
6251	return t;
6252}
6253Date.prototype.addYears = function (num) {
6254	return this.clone().setYear(this.getFullYear() + num);
6255}
6256Date.prototype.getTimeShort = function () {
6257	return Math.round(this.getTime() / 1000) - (this.getTimezoneOffset() * 60);
6258}
6259
6260function DateControlSetTMSU(selVal, calCtrlId) {
6261	$("#" + calCtrlId).val(selVal);
6262}
6263
6264/* Used to created date object from all possible date input depending
6265on language. 
6266If there is any error on input, it will always return Today's date. */
6267function formatDate(langCode, dateIn) {
6268	moment.locale("EN");
6269	var monNameEng = moment.months();
6270	var date;
6271	try {
6272		date = euroFormat(dateIn)
6273		if (langCode == "de" && date) {
6274			/* test first for DD.MM.YYYY */
6275			return date;
6276		}
6277		var parsedDate = dateIn.match(/[A-z\u00C0-\u00FF]+/);
6278		var found = false;
6279		if (parsedDate != null) {
6280			var fndMonth = parsedDate[0];
6281			var regex = new RegExp('^' + fndMonth.toUpperCase() + '.?$');
6282			moment.locale(langCode);
6283			var monName = moment.months();
6284			var monNameSh = moment.monthsShort();
6285			for (var i = 0; i < monName.length; i++) {
6286				if (fndMonth.toUpperCase() == monName[i].toUpperCase()) {
6287					found = true;
6288					break;
6289				}
6290				if (monNameSh[i].toUpperCase().match(regex) != null) {
6291					found = true;
6292					break;
6293				}
6294			}
6295			if (fndMonth != monNameEng[i] || dateIn.indexOf('.') > -1) {
6296				dateIn = dateIn.replace(fndMonth, monNameEng[i]);
6297				dateIn = dateIn.replace('.', '');
6298			}
6299			date = Date.parse(dateIn + " 00:00:00");
6300		}
6301	}
6302	catch (ex) {
6303	}
6304	return date;
6305}
6306
6307/* Will return an object set with valid date and boolean value to indicate if the input 
6308was correct. Boolean value is used on front end to signify error */
6309/* If date < minDate value, the minDate is returned */
6310/* If date > maxDate value, the maxDate is returned */
6311/* Otherwise it returns the date, or, todays date if date is invalid */
6312function validateMinMax(date, minDate, maxDate) {
6313	var isInvalid = isNaN(date);
6314	var dateToSet = date;
6315	minDate = Date.parse(minDate + "T00:00:00Z");
6316	maxDate = Date.parse(maxDate + "T23:59:59Z");
6317	if (isInvalid) {
6318		dateToSet = Date.now();
6319		return { dateToSet: dateToSet, isInvalid: isInvalid };
6320	}
6321	if (!isNaN(minDate)) {
6322		isInvalid = date < minDate;
6323		if (isInvalid) {
6324			dateToSet = minDate;
6325		}
6326	}
6327	if (!isNaN(maxDate)) {
6328		isInvalid = date > maxDate;
6329		if (isInvalid) {
6330			dateToSet = maxDate;
6331		}
6332	}
6333	return { dateToSet: dateToSet, isInvalid: isInvalid };
6334}
6335
6336function ensureValidDateSelected(input) {
6337	var locAll = window.languageCode;
6338	var loc = getCookieValue("L").substring(0, 2);
6339	var langCode = "EN";
6340	var date;
6341	moment.locale(langCode);
6342	var monNameEng = moment.months();
6343	if (typeof locAll != "undefined") {
6344		var splitVal = locAll.split(",");
6345		langCode = splitVal[0].substring(0, 2);
6346	}
6347	/* Verify against all possible date formats */
6348	var dateIn = $(input);
6349	if (!(date = formatDate(langCode, dateIn.val()))) {
6350		var date_format = dateIn.datepicker('option', 'dateFormat');
6351		dateformat = date_format.replace(/d+/i, 'dd').replace(/m+/i, 'mm').replace(/y+/i, 'yyyy');
6352		var momVal = moment(dateIn, dateformat.toUpperCase());
6353		if (momVal.isValid())
6354			date = momVal.toDate();
6355		else
6356			date = moment(dateIn, "YYYY-MM-DD").toDate();
6357	}
6358
6359	var minDate = dateIn.attr("data-mindate");
6360	var maxdate = dateIn.attr("data-maxdate");
6361	var verifyDate = validateMinMax(date, minDate, maxDate);
6362
6363	if (verifyDate.isInvalid) {
6364		dateIn.addClass("date_warning");
6365		dateIn.datepicker("setDate", verifyDate.dateToSet);
6366		setTimeout(function () {
6367			dateIn.removeClass("date_warning");
6368		}, 800);
6369	}
6370	else {
6371		dateToSet = new Date(verifyDate.dateToSet);
6372		if (typeof (cssua) != "undefined" && cssua.ua.ie) dateIn.datepicker("disable");
6373		dateIn.datepicker("setDate", dateToSet);
6374		if (typeof (cssua) != "undefined" && cssua.ua.ie) dateIn.datepicker("enable");
6375	}
6376}
6377/* TimeSpan Object Definition */
6378function parseTimeSpan(input) {
6379	/* Check the format of the string.*/
6380	var reg = new RegExp("(\\d+)\\s*([^\\d]+)\\s*", "gi");
6381	var years = 0;
6382	var days = 0;
6383	var weeks = 0;
6384	var months = 0;
6385	var totalDays = 0;
6386	var matched;
6387	while ((matched = reg.exec(input)) != null) {
6388		var num = parseNum(matched[1]);
6389		var unit = matched[2].toLowerCase();
6390
6391		if (unit.charAt(0) == 'y') {
6392			years = num;
6393		}
6394		else if (unit.charAt(0) == 'm') {
6395			months = num;
6396		}
6397		else if (unit.charAt(0) == 'w') {
6398			weeks = num;
6399		}
6400		else if (unit.charAt(0) == 'd') {
6401			days = num;
6402		}
6403		else if (unit.charAt(0) == 't') {
6404			totalDays = num;
6405		}
6406	}
6407	return new TimeSpan(days, weeks, months, years, totalDays);
6408}
6409function DaysInMonth(year, month) {
6410	var dd = new Date(year, month + 1, 0);
6411	return dd.getDate();
6412}
6413/**
6414 * Gets the amount of time between two dates.
6415 * 
6416 * @param {Date} date1 The first date.
6417 * @param {Date} date2 The second date.
6418 * @returns A TimeSpan that is the amount of time between the two provided dates. If either date provided is not a valid date object the TimeSpan returned will have all values set to 0.
6419 */
6420function DateDiff(date1, date2) {
6421	var years = 0, months = 0, weeks = 0, days = 0;
6422	var sooner, later;
6423	var isNegative;
6424	if(!(date1 instanceof Date) || !(date2 instanceof Date)){
6425		return new TimeSpan(0, 0, 0, 0, 0);
6426	}
6427
6428	if (date1 > date2) {
6429		isNegative = false;
6430		later = date1;
6431		sooner = date2;
6432	}
6433	else {
6434		isNegative = true;
6435		later = date2;
6436		sooner = date1;
6437	}
6438	years = later.getFullYear() - sooner.getFullYear();
6439	months = later.getMonth() - sooner.getMonth();
6440	days = later.getDate() - sooner.getDate();
6441	if (days < 0) {
6442		--months;
6443		days += DaysInMonth(sooner.getFullYear(), sooner.getMonth());
6444	}
6445	if (months < 0) {
6446		--years;
6447		months += 12;
6448	}
6449	if (days > 7) {
6450		weeks = Math.floor(days / 7);
6451		days -= weeks * 7;
6452	}
6453	var totalDays = (later.getTime() - sooner.getTime()) / (1000 * 60 * 60 * 24);
6454	if (isNegative) {
6455		days *= -1;
6456		weeks *= -1;
6457		months *= -1;
6458		years *= -1;
6459		totalDays *= -1;
6460	}
6461	return new TimeSpan(days, weeks, months, years, totalDays);
6462}
6463
6464/**
6465 * 
6466 * @param days
6467 * @param weeks
6468 * @param months
6469 * @param years
6470 * @param totalDays
6471 * @constructor
6472 */
6473function TimeSpan(days, weeks, months, years, totalDays) {
6474	var cDays = days;
6475	var cWeeks = weeks;
6476	var cMonths = months;
6477	var cYears = years;
6478	var cTotalDays = totalDays;
6479
6480	this.GetDays = function () { return cDays; };
6481	this.SetDays = function (newDays) { cDays = newDays; };
6482	this.GetWeeks = function () { return cWeeks; };
6483	this.SetWeeks = function (newWeeks) { cWeeks = newWeeks; };
6484	this.GetMonths = function () { return cMonths; };
6485	this.SetMonths = function (newWeeks) { cMonths = newWeeks; };
6486	this.GetYears = function () { return cYears; };
6487	this.SetYears = function (newYears) { cYears = newYears; };
6488	this.GetTotalDays = function () { if (cTotalDays != 0) return cTotalDays; else return this.GetYears() * 365 + this.GetMonths() * 30 + this.GetWeeks() * 7 + this.GetDays(); };
6489	this.SetTotalDays = function (newTotalDays) { cTotals = newTotalDays; };
6490}
6491TimeSpan.prototype.GetPart=function(part){switch(part){case "days":return this.GetDays();case "weeks":return this.GetWeeks();case "months":return this.GetMonths();case "years":return this.GetYears();case "totalDays":return this.GetTotalDays();default:return 0;}};
6492TimeSpan.MINIMUM=new TimeSpan(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY);
6493TimeSpan.MAXIMUM=new TimeSpan(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY);
6494TimeSpan.AddToDate=function(d,ts){return new Date(d.addDays(ts.GetDays()+7*ts.GetWeeks()).addMonths(ts.GetMonths()).addYears(ts.GetYears()));};
6495TimeSpan.SubtractFromDate=function(d,ts){return new Date(d.addDays(-ts.GetDays()-7*ts.GetWeeks()).addMonths(-ts.GetMonths()).addYears(-ts.GetYears()));};
6496TimeSpan.Add=function(ts1,ts2){return new TimeSpan(ts1.GetDays()+ts2.GetDays(),ts1.GetWeeks()+ts2.GetWeeks(),ts1.GetMonths()+ts2.GetMonths(),ts1.GetYears()+ts2.GetYears(),ts1.GetTotalDays()+ts2.GetTotalDays());};
6497TimeSpan.Subtract=function(ts1,ts2){return new TimeSpan(ts1.GetDays()-ts2.GetDays(),ts1.GetWeeks()-ts2.GetWeeks(),ts1.GetMonths()-ts2.GetMonths(),ts1.GetYears()-ts2.GetYears(),ts1.GetTotalDays()-ts2.GetTotalDays());};
6498TimeSpan.Multiply=function(ts,num){return new TimeSpan(ts.GetDays()*num,ts.GetWeeks()*num,ts.GetMonths()*num,ts.GetYears()*num,ts.GetTotalDays()*num);};
6499TimeSpan.Divide=function(ts,num){return new TimeSpan(ts.GetDays()/num,ts.GetWeeks()/num,ts.GetMonths()/num,ts.GetYears()/num,ts.GetTotalDays()/num);};
6500TimeSpan.Max=function(ts1,ts2){if(ts1.GetTotalDays()>ts.GetTotalDays())return ts1;else return ts2;};
6501TimeSpan.Min=function(ts1,ts2){if(ts1.GetTotalDays()<ts.GetTotalDays())return ts1;else return ts2;};
6502TimeSpan.prototype.toString=function(){var str="";if(this.GetYears()!=0){str+=this.GetYears()+" Years";}if(this.GetMonths()!=0){if(str.length>0)str+=", ";str+=this.GetMonths()+" Months";}if(this.GetWeeks()!=0){if(str.length>0)str+=", ";str+=this.GetWeeks()+" Weeks";}if(this.GetDays()!=0){if(str.length>0)str+=", ";str+=this.GetDays()+" Days";str+=", ";str+=this.GetTotalDays()+" Total Days";}return str;};
6503
6504/* End TimeSpan */
6505
6506function fD(date, format) {
6507
6508	if (date != null && typeof (date.format) == "function") {
6509		var loc = getCookieValue("L");
6510		if (typeof loc != "undefined")
6511			loc = loc.substring(0, 2);
6512
6513		var retDate;
6514		if (loc == "FR") {
6515			retDate = moment(date).locale(loc).format(format);
6516		}
6517		else
6518			retDate = date.ldformat(format);
6519
6520		return retDate;
6521	}
6522	return null;
6523}
6524var monthArr = new Array( 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 );
6525function sDFM(monthID, dayID, leap) {
6526	var month = gI(monthID);
6527	var day = gI(dayID);
6528	if (month && day) {
6529		var maxDay = monthArr[month.value - 1];
6530		if (maxDay == 28 && leap) {
6531			maxDay = 29;
6532		}
6533		for (var i = day.options.length; i < maxDay; i++) {
6534			day.options[i] = new Option(i + 1, i + 1);
6535		}
6536		for (var i = day.options.length - 1; i >= maxDay; i = i - 1) {
6537			day.options[i] = null;
6538		}
6539	}
6540}
6541
6542function euroFormat(dateIn) {
6543	/* DD.MM.YYYY */
6544	var date_format = /^((?:[0-2]?[1-9])|(?:[1-3][0-2]))\.((?:[0]?[1-9])|(?:[1][0-2]))\.([1-9][0-9][0-9][0-9])$/;
6545	var date_result = dateIn.match(date_format);
6546	var date = null;
6547	if (date_result && date_result.length == 4) {
6548		var day = parseInt(date_result[1]);
6549		var month = parseInt(date_result[2]);
6550		var year = parseInt(date_result[3]);
6551		date = Date.parse(new Date(year, month - 1, day));
6552	}
6553	return date;
6554}
6555
6556/* We don't want the calendar to come up when you switch between tabs or windows, so make sure that the datepicker doesn't have focus when the window loses focus, this was originally done when the window gained focus but that didn't work properly in FireFox */
6557$(window).on("blur", function() {try{var el = $(document.activeElement); if(el.hasClass('hasDatepicker')) el.trigger("blur");}catch(error){}});
6558/* End Include date */
6559
6560/* Include questionNavigationHandler */
6561// Debugging messages for preloading. DO NOT MOVE LIVE WHILE TRUE!!
6562const DEBUG_PRELOAD = false;
6563/**
6564 * Logging function that only logs when DEBUG_PRELOAD is set true
6565 * @param msg
6566 * @private
6567 */
6568function _debugPreload(msg) {
6569	if (DEBUG_PRELOAD) console.log(msg);
6570}
6571
6572/* Question Group Repeater */
6573function QuestionGroupRepeater(sectionPosition, repID, visible, clientID, faqContent, groupName, helpVis, seen, numGroups, baseRepID, navTitle) {
6574	this.SectionPosition = sectionPosition;
6575	// All the groups contained in this repeater
6576	this.Groups = [];
6577	this.ID = repID;
6578	this.ClientID = clientID;
6579	this.Name = groupName;
6580	this.NavigationTitle = typeof (navTitle) != "function" ? groupName : navTitle;
6581	this.Visible = visible;
6582	this.FAQContent = faqContent;
6583	this.GroupName = groupName;
6584	this.HelpVis = helpVis;
6585	this.SeenInit = seen;
6586	this.NumGroups = numGroups;
6587	this.BaseRepID = baseRepID;
6588	this.Collection = null;
6589
6590	/**
6591	 * Returns the group that exists at the given index in this repeater's groups
6592	 * @param {int} i The idx of the group to get
6593	 * @return {*} A Group object. See this.CreateGroup.
6594	 */
6595	this.GetGroupAtPosition = function (i) {
6596		return this.Groups[i];
6597	}
6598	this.UpdateNum = function () {
6599		var num = this.NumGroups();
6600		var grp;
6601		var prevGrp = null;
6602		if (this.Groups.length > 0) prevGrp = this.Groups[this.Groups.length - 1];
6603		else if (this.Collection != null && this.Collection.IsComplete()) prevGrp = this.Collection.Get(this.Collection.GetStartPos(this) - 1);
6604		for (var i = this.Groups.length; i < num; ++i) {
6605			grp = this.CreateGroup(i);
6606			if (prevGrp != null) {
6607				$(".groupNavigationInner li[data-groupID='" + prevGrp.ID + "']").after('<li data-groupid="' + grp.ID + '"><a onclick="qnh.GotoGroup(\'' + grp.ID + '\');"><span class="text">' + grp.NavigationTitle() + '</span></a></li>');
6608				prevGrp = grp;
6609			}
6610		}
6611		while (this.Groups.length > num) {
6612			grp = this.Groups.pop();
6613			$(".groupNavigationInner li[data-groupID='" + grp.ID + "']").remove();
6614		}
6615		if (this.SeenInit != null && this.Groups.length == this.SeenInit.length) {
6616			for (var i = 0; i < seen.length; ++i) {
6617				this.Groups[i].Seen = seen[i];
6618			}
6619			this.SeenInit = null;
6620		}
6621	}
6622	this.GetFuncAtPos = function (i, func) {
6623		var prev = RepeaterHandler.Get(this.BaseRepID);
6624		RepeaterHandler.Set(this.BaseRepID, i + 1);
6625		var retVal = func();
6626		RepeaterHandler.Set(this.BaseRepID, prev);
6627		return retVal;
6628	}
6629	this.CreateGroup = function (i) {
6630		var grp = new Object();
6631		var self = this;
6632		grp.Name = function () { return self.GetFuncAtPos(i, self.GroupName); };
6633		grp.NavigationTitle = function () { return self.GetFuncAtPos(i, self.NavigationTitle); };
6634		grp.ID = this.ID + "-" + (i + 1);
6635		grp.SectionPosition = this.SectionPosition;
6636		grp.Visible = function () { return self.GetFuncAtPos(i, self.Visible); };
6637		grp.ClientID = this.ClientID + "_" + (i + 1);
6638		grp.Seen = false;
6639		grp.PreloadTrigger = null;
6640		grp.FAQContent = function () { return self.GetFuncAtPos(i, self.FAQContent); };
6641		grp.HelpVis = function () { return self.GetFuncAtPos(i, self.HelpVis); };
6642		grp.NumGroups = function () { return 1; };
6643		grp.GetGroupAtPosition = function () { return this; };
6644		this.Groups[i] = grp;
6645		return grp;
6646	}
6647	this.UpdateNum();
6648}
6649/* End Question Group Repeater */
6650
6651/**
6652 * @typedef Group
6653 * @property {string} ClientID the id of the html dom element containing this group
6654 * @property {QuestionGroupCollection} The collection containing this group
6655 * @property {function} FAQContent @todo unknown
6656 * @property {function} GetGroupAtPosition @todo unknown
6657 * @property {function} HelpVis @todo unkown
6658 * @property {string} ID The unique id from the xml document used to identify this group
6659 * @property {function: string} Name A function that returns the current name of the group
6660 * @property {function} NavigationTitle @todo unknown
6661 * @property {function} NumGroups @todo unknown
6662 * @property PreloadTrigger @todo unknown
6663 * @property {int} SectionPosition The position of the section this group belongs to
6664 * @property {boolean} Seen If the group has been visited by the user or not
6665 * @property {function: boolean} Visible Returns true if the group should be visible right now, false otherwise
6666 */
6667
6668/* Question Group Collection */
6669function QuestionGroupCollection() {
6670	/**
6671	 * The groups contained in this collection
6672	 * @type {Group[]}
6673	 */
6674	this.Groups = [];
6675	this.IsComplete = function () {
6676		for (var i = 0; i < this.Groups.length; ++i) {
6677			if (typeof (this.Groups[i]) == "undefined") return false;
6678		}
6679		return true;
6680	}
6681	this.GetLength = function () {
6682		var len = 0;
6683		for (var i = 0; i < this.Groups.length; ++i) {
6684			if (this.Groups[i])
6685				var num = this.Groups[i].NumGroups();
6686			if (typeof (num) != "number") num = parseNum(num);
6687			len += num;
6688		}
6689		return len;
6690	}
6691	/**
6692	 * Get a specific group by it's position relative to other groups
6693	 * @param {int} pos 
6694	 * @return {null|*} The group located at the given position
6695	 */
6696	this.Get = function (pos) {
6697		if (this.Groups.length == 0) return null;
6698		var curPos = 0;
6699		var posBefore = 0;
6700		var index = 0;
6701		while (curPos <= pos && index < this.Groups.length) {
6702			posBefore = curPos;
6703			if (this.Groups[index] != null && typeof (this.Groups[index].NumGroups) == "function") {
6704				curPos += this.Groups[index].NumGroups();
6705			}
6706			else {
6707				++curPos;
6708			}
6709			++index;
6710		}
6711		if (index == this.Groups.length && pos > curPos) return null;
6712		var groupHandler = this.Groups[index - 1];
6713		if (groupHandler) return groupHandler.GetGroupAtPosition(pos - posBefore);
6714		else return null;
6715	}
6716	this.GetStartPos = function (grp) {
6717		var pos = 0;
6718		var index = 0;
6719		while (index < this.Groups.length && this.Groups[index] != grp) {
6720			pos += this.Groups[index].NumGroups();
6721			++index;
6722		}
6723		return pos;
6724	}
6725	this.Set = function (index, value) {
6726		this.Groups[index] = value;
6727		value.Collection = this;
6728	}
6729	this.NumChanged = function (i) {
6730		var grp = this.Groups[i];
6731		if (grp && typeof (grp.UpdateNum) == "function") grp.UpdateNum();
6732	}
6733	this.GroupNavigationTitleChanged = function (pos) {
6734		var grp = this.Groups[pos];
6735		if (grp && typeof (grp.NumGroups) == "function") {
6736			for (var i = 0; i < grp.NumGroups(); ++i) {
6737				var grpSingle = grp.GetGroupAtPosition(i);
6738				if (typeof (grpSingle) != "undefined") $(".groupNavigationInner li[data-groupID='" + grpSingle.ID + "'] .text").html(grpSingle.NavigationTitle());
6739			}
6740		}
6741	}
6742	this.GroupNameChanged = function (pos) {
6743	}
6744	this.GroupVisChanged = function (pos) {
6745		var grp = this.Groups[pos];
6746		if (grp && typeof (grp.NumGroups) == "function") {
6747			for (var i = 0; i < grp.NumGroups(); ++i) {
6748				var grpSingle = grp.GetGroupAtPosition(i);
6749				if (typeof (grpSingle) != "undefined") $(".groupNavigationInner li[data-groupID='" + grpSingle.ID + "']").toggle(grpSingle.Visible());
6750			}
6751		}
6752	}
6753}
6754/* End Question Group Collection */
6755/* Question Navigation Handler */
6756function QuestionNavigationHandler() {
6757	/**
6758	 * @typedef {Object} Section
6759	 * @property {string} ID the unique id from the xml file that defines this section
6760	 * @property {boolean} InNavigation
6761	 * @property {function: bool} Visible returns if the section should be visible or not 
6762	 */
6763	
6764	/**
6765	 * 
6766	 * @type {Section[]}
6767	 */
6768	this.Sections = [];
6769	this.Groups = new QuestionGroupCollection();
6770	this.ProgressBars = new Array();
6771	this.WaitingForAJAX = false;
6772	this.PageID = "__Page";
6773	/**
6774	 * The index of the group currently in focus
6775	 * @type {number}
6776	 */
6777	this.SelectedGroup = 0;
6778	/**
6779	 * The index of the section currently in focus
6780	 * @type {number}
6781	 */
6782	this.SelectedSection = 0;	
6783	this.LastProgressValue = 0;
6784	this.LastProgressMax = 0;
6785	this.Initialized = false;
6786	this.NoSave = false;
6787	this.ValidateAfterNav = false;
6788	this.SkipPreview = false;
6789	this.NavigateGroupsClient = false;
6790	this.NavigateGroupsClientLandingPage = false;
6791	this.StartPreloadRegistered = false;
6792	this.PreloadGroups = false;
6793	this.PreloadGroupsState = 'init';
6794	this.LoadedGroups = {};
6795	this.CurrentlyLoadingGroup = null;
6796	this.AfterGroupLoaded = null;
6797	this.EnableClientGroupAnimation = true;
6798	this.IsAnimating = false;
6799	this.AnimateSectionHeightCalls = [];
6800	this.RestrictNavigation = false;
6801	this.RestrictNavigationFull = function () { return false; };
6802	this.Navigation = null;
6803	this.ReturnGroup = null;
6804	this.NextGroup = null;
6805	this.NextSecondGroup = null;
6806	this.ContinueURL = null;
6807	this.ContinueAction = null;
6808	this.ValueHandlerCurrentQuestionGroup = "__CurrentQuestionGroup";
6809	this.ValueHandlerCurrentQuestionGroupID = "__CurrentQuestionGroupID";
6810	this.ValueHandlerCurrentQuestionGroupName = "__CurrentQuestionGroupName";
6811	this.ValueHandlerCurrentSection = "__CurrentSection";
6812	this.ValueHandlerCurrentSectionID = "__CurrentSectionID";
6813	this.ValueHandlerIsFirstVisibleQuestionGroup = "__IsFirstVisibleQuestionGroup";
6814	this.ValueHandlerIsLastVisibleQuestionGroup = "__IsLastVisibleQuestionGroup";
6815	this.GroupVisChanged = function (pos) {
6816		this.Groups.GroupVisChanged(pos);
6817		this.SetFirstLastVisibleGroupInValueHandler();
6818	}
6819	this.GroupNavigationTitleChanged = function (pos) {
6820		this.Groups.GroupNavigationTitleChanged(pos);
6821	}
6822	this.GroupNameChanged = function (pos) {
6823		this.Groups.GroupNameChanged(pos);
6824	}
6825	this.NumChanged = function (pos) {
6826		this.Groups.NumChanged(pos);
6827		this.SetFirstLastVisibleGroupInValueHandler();
6828	}
6829	this.IsFirstPage = function () {
6830		return this.GetPreviousPosition() < 0;
6831	}
6832	this.IsLastPage = function () {
6833		return this.GetNextPosition() >= this.Groups.GetLength();
6834	}
6835	/**
6836	 * Returns true if the current page is a preview page, false otherwise.
6837	 * @return {boolean}
6838	 */
6839	this.IsPreview = function () {
6840		return location.href.indexOf("preview.aspx") >= 0 || location.href.indexOf("displayhtml.aspx") >= 0;
6841	}
6842	this.SetFirstLastVisibleGroupInValueHandler = function () {
6843		if (vh != null) {
6844			vh.S(this.ValueHandlerIsFirstVisibleQuestionGroup, this.IsFirstPage());
6845			vh.S(this.ValueHandlerIsLastVisibleQuestionGroup, this.IsLastPage());
6846		}
6847	}
6848	this.GetGroupFromValueHandler = function () {
6849		if (vh != null) {
6850			var val = vh.G(this.ValueHandlerCurrentQuestionGroup);
6851			if (val) return parseNum(val);
6852			return null;
6853		}
6854	}
6855	this.SetGroupInValueHandler = function (val) {
6856		if (vh != null) {
6857			vh.S(this.ValueHandlerCurrentQuestionGroup, val);
6858			var grp = this.Groups.Get(val);
6859			if (grp != null) {
6860				vh.S(this.ValueHandlerCurrentQuestionGroupID, grp.ID);
6861				if (typeof (grp.Name) == "function") vh.S(this.ValueHandlerCurrentQuestionGroupName, grp.Name());
6862			}
6863			this.SetFirstLastVisibleGroupInValueHandler();
6864		}
6865	}
6866	this.GetSectionFromValueHandler = function () {
6867		if (vh != null) {
6868			var val = vh.G(this.ValueHandlerCurrentSection);
6869			if (val) return parseNum(val);
6870			return null;
6871		}
6872	}
6873	this.SetSectionInValueHandler = function (val) {
6874		if (vh != null) {
6875			vh.S(this.ValueHandlerCurrentSection, val);
6876			if (this.Sections[val] != null) {
6877				vh.S(this.ValueHandlerCurrentSectionID, this.Sections[val].ID);
6878			}
6879		}
6880	}
6881	this.SetSelectedGroup = function (val) {
6882		this.SelectedGroup = val;
6883	}
6884	this.SetSelectedSection = function (val) {
6885		this.SelectedSection = val;
6886	}
6887	this.ValidatorVisible = function (val) {
6888		if (typeof (val.ID) != "undefined" && $("#" + val.ID).length < 1) return false;
6889		if (val.Group === undefined) {
6890			return true;
6891		}
6892		else if (this.Groups.GetLength() > 0) {
6893			return this.GetCurrentGroup() == val.Group
6894		}
6895		return isV(val.ID);
6896	}
6897	this.ValidatorSeen = function (val, beforeGroup) {
6898		if (val.Group === undefined) {
6899			return true;
6900		}
6901		var groupPos = this.GetGroupPosition(val.Group);
6902		if (this.Groups.GetLength() > 0 && groupPos !== -1) {
6903			if (beforeGroup !== undefined && groupPos > beforeGroup) return false;
6904			return this.Groups.Get(groupPos).Seen;
6905		}
6906		if (typeof (val.ID) != "undefined" && $("#" + val.ID).length < 1) return false;
6907		return isV(val.ID);
6908	}
6909	this.UpdatePreview = function (postbackFunc) {
6910		if (typeof (postbackFunc) == "function") {
6911			if (!this.PreloadGroups || this.PreloadGroupsState == "finished") {
6912				showMessage("Saving", {priority: 1});
6913				postbackFunc();
6914			}
6915			else if (!this.PreloadGroupsState) {
6916				this.PreloadGroupsState = "pausing";
6917				AjaxWait(true);
6918				this.AddAfterGroupLoaded(function () {
6919					postbackFunc();
6920				});
6921			}
6922		}
6923	}
6924	this.GetSectionPosition = function (id) {
6925		for (var i = 0; i < this.Sections.length; ++i) {
6926			var sec = this.Sections[i];
6927			if (sec && sec.ID == id) {
6928				return i;
6929			}
6930		}
6931		return -1;
6932	}
6933	this.GetSection = function (id) {
6934		var pos = this.GetSectionPosition(id);
6935		if (pos != -1) return this.Sections[pos];
6936		return null;
6937	}
6938	this.GetGroupPosition = function (id) {
6939		for (var i = 0; i < this.Groups.GetLength(); ++i) {
6940			var grp = this.Groups.Get(i);
6941			if (grp && grp.ID == id) {
6942				return i;
6943			}
6944		}
6945		return -1;
6946	}
6947	this.GetGroup = function (id) {
6948		var pos = this.GetGroupPosition(id);
6949		if (pos != -1) return this.Groups.Get(pos);
6950		return null;
6951	}
6952	this.GetGroupPositionByClientID = function (clientId) {
6953		for (var i = 0; i < this.Groups.GetLength(); i++) {
6954			var grp = this.Groups.Get(i);
6955			if (grp.ClientID == clientId) {
6956				return i;
6957			}
6958		}
6959		return null;
6960	}
6961	this.GetGroupByClientID = function (clientId) {
6962		for (var i = 0; i < this.Groups.GetLength(); i++) {
6963			var grp = this.Groups.Get(i);
6964			if (grp.ClientID == clientId) {
6965				return grp;
6966			}
6967		}
6968		return null;
6969	}
6970	this.GetURLGroup = function () {
6971		var val = null;
6972		var pos = this.GetLoadGroup();
6973		if (pos) {
6974			val = this.Groups.Get(pos).ID;
6975		}
6976		return val;
6977	}
6978	this.GetURLSection = function () {
6979		var section = null;
6980		var pos = this.GetLoadSection();
6981		if (pos) {
6982			section = this.Sections[pos].ID;
6983		}
6984		return section;
6985	}
6986	this.GetLoadSection = function () {
6987		var secID = getQueryStringValue("s");
6988		if (secID) {
6989			var pos = this.GetSectionPosition(secID);
6990			if (pos >= 0 && pos < this.Sections.length) {
6991				return pos;
6992			}
6993		}
6994		else {
6995			secID = getQueryStringValue("sectionName");
6996			if (secID) {
6997				var pos = this.GetSectionPosition(secID);
6998				if (pos >= 0 && pos < this.Sections.length) {
6999					return pos;
7000				}
7001			}
7002		}
7003		return null;
7004	}
7005	this.GetLoadGroup = function () {
7006		var ID = getQueryStringValue("g");
7007		if (ID) {
7008			var pos = this.GetGroupPosition(ID);
7009			if (pos >= 0 && pos < this.Groups.GetLength()) {
7010				return pos;
7011			}
7012		}
7013		return null;
7014	}
7015	/**
7016	 * Returns the ID of the section for the current location (page url)
7017	 * @private this could be different than the current section shown on the page if the chosen section has changed
7018	 * but the section has not yet been loaded. For general purpose use {@see GetSelectedSection} instead.
7019	 * @return {string}
7020	 */
7021	this.GetCurrentSection = function () {
7022		var group = this.GetCurrentGroup();
7023		if (group) {
7024			return this.Sections[this.GetGroup(group).SectionPosition].ID;
7025		}
7026		var section = this.GetURLSection();
7027		if (!section && typeof (this.Sections[0]) != "undefined") {
7028			section = this.Sections[0].ID;
7029		}
7030		return section;
7031	}
7032	/**
7033	 * Returns the ID of the group for the current location (page url)
7034	 * @private this could be different than the current group shown on the page if the chosen group has changed
7035	 * but the group has not yet been loaded. Instead prefer using {@see GetSelectedGroup}
7036	 * @return {null|string}
7037	 */
7038	this.GetCurrentGroup = function () {
7039		var group = this.GetURLGroup();
7040		if (!group) {
7041			var section = this.GetURLSection();
7042			if (section) {
7043				var temp = this.GetFirstGroupInSection(section);
7044				if (temp >= 0 && temp < this.Groups.GetLength()) {
7045					group = this.Groups.Get(temp).ID;
7046				}
7047			}
7048			var grp = this.Groups.Get(0);
7049			if (!group && grp != null) {
7050				group = grp.ID;
7051			}
7052		}
7053
7054		var groupPos = this.GetNextPosition(this.GetGroupPosition(group));
7055		if (groupPos >= this.Groups.GetLength()) {
7056			groupPos = this.GetPreviousPosition(this.GetGroupPosition(group));
7057		}
7058
7059		if (groupPos < 0) {
7060			return null;
7061		}
7062
7063		var grp = this.Groups.Get(groupPos);
7064		if (grp) return grp.ID;
7065		else return null;
7066	}
7067	this.InitSection = function (sectionPosition, sectionID, sectionInNavigation, sectionVis) {
7068		if (typeof (this.Sections[sectionPosition]) == "undefined") {
7069			this.Sections[sectionPosition] = new Object();
7070		}
7071		if (typeof (sectionInNavigation) == "undefined") {
7072			sectionInNavigation = true;
7073		}
7074		if (typeof (sectionVis) != "function") {
7075			sectionVis = function () { return true; };
7076		}
7077		this.Sections[sectionPosition].ID = sectionID;
7078		this.Sections[sectionPosition].InNavigation = sectionInNavigation;
7079		this.Sections[sectionPosition].Visible = sectionVis;
7080	}
7081	/**
7082	 * Register a group object that's already been created, this will also create the section if it doesn't exist already.
7083	 * @param {number} sectionPosition The position of the section this group is in within the Sections array.
7084	 * @param {string} sectionID The ID of the section this group is in.
7085	 * @param {boolean} sectionRequiresHttps (deprecated) If the section should force a redirect to https if the current request is on http. 
7086	 * This is deprecated as all pages now require https but remains as a parameter so parameter lists in old code work properly.
7087	 * @param {number} groupPosition The position of this group in the Groups array.
7088	 * @param {object} group The group object to be registered.
7089	 * @param {boolean} sectionInNavigation If the section should be included in the default navigation.
7090	 * @param {function} sectionVis A function indicating how to determine the visibility of the section.
7091	 */
7092	this.RGO = function (sectionPosition, sectionID, sectionRequiresHttps, groupPosition, group, sectionInNavigation, sectionVis) {
7093		this.InitSection(sectionPosition, sectionID, sectionInNavigation, sectionVis);
7094		this.Groups.Set(groupPosition, group);
7095	}
7096	/**
7097	 * Create a group object and register it. Also create the section if it doesn't exist already.
7098	 * @param {number} sectionPosition The position of the section this group is in within the Sections array.
7099	 * @param {string} sectionID The ID of the section this group is in.
7100	 * @param {number} groupPosition The position of the group in the Groups array.
7101	 * @param {string} groupID The CaseSensitiveID of the group.
7102	 * @param {function} visible The function to determine the visibility of the group.
7103	 * @param {string} clientId The full ID of the HTML element for the group.
7104	 * @param {boolean} sectionRequiresHttps (deprecated) If the section should force a redirect to https if the current request is on http.
7105	 * This is deprecated as all pages now require https but remains as a parameter so parameter lists in old code work properly.
7106	 * @param {boolean} seen If the user has seen this group yet.
7107	 * @param {string} preloadTrigger The ID of the control that can trigger preloading this group.
7108	 * @param {function} faqContent Function to determine the content of the FAQ section for this group.
7109	 * @param {function} groupName Function to determine the name of this group to be displayed when looking at the group.
7110	 * @param {function} helpVis Function that determines if this group's help section should be visible.
7111	 * @param {function} navigationTitle Function that generates the title to use for this group in navigation.
7112	 * @param {boolean} sectionInNavigation If the section should be included in the default navigation.
7113	 * @param {function} sectionVis Function to determine the visibility of the section.
7114	 */
7115	this.RG = function (sectionPosition, sectionID, groupPosition, groupID, visible, clientId, sectionRequiresHttps, seen, preloadTrigger, faqContent, groupName, helpVis, navigationTitle, sectionInNavigation, sectionVis) {
7116		this.InitSection(sectionPosition, sectionID, sectionInNavigation, sectionVis);
7117		if (typeof (seen) == "undefined") seen = false;
7118		if (typeof (preloadTrigger) == "undefined") preloadTrigger = null;
7119		if (typeof (faqContent) == "undefined") faqContent = false;
7120		if (typeof (helpVis) != "function") helpVis = function () { return true; };
7121		var grp = new Object();
7122		grp.Name = groupName;
7123		grp.NavigationTitle = navigationTitle;
7124		grp.ID = groupID;
7125		grp.SectionPosition = sectionPosition;
7126		grp.Visible = visible;
7127		grp.ClientID = clientId;
7128		grp.Seen = seen || groupPosition == 0;
7129		grp.PreloadTrigger = preloadTrigger;
7130		if (this.PreloadGroups && groupPosition == 0) {
7131			this.LoadedGroups[groupID] = clientId;
7132		}
7133		grp.FAQContent = faqContent;
7134		grp.HelpVis = helpVis;
7135		grp.NumGroups = function () { return 1; };
7136		grp.GetGroupAtPosition = function () { return this; };
7137		this.Groups.Set(groupPosition, grp);
7138	}
7139	this.RPB = function (ID) {
7140		this.ProgressBars.push(ID);
7141	}
7142	this.GetGroupSafe = function (group) {
7143		if (typeof (group) == "string") {
7144			group = this.GetGroupPosition(group);
7145		}
7146		if (typeof (group) != "number") {
7147			group = this.GetGroupPosition(this.GetCurrentGroup());
7148		}
7149		if (group < 0) {
7150			group = 0;
7151		}
7152		var len = this.Groups.GetLength();
7153		if (group >= len) {
7154			group = len - 1;
7155		}
7156		return this.Groups.Get(group);
7157	}
7158	this.SetFAQContentClass = function (group) {
7159		var groupObj = this.GetGroupSafe(group);
7160		var vis = !groupObj || ((typeof (groupObj.HelpVis) != "function" || groupObj.HelpVis()) && this.GetFAQContent());
7161		$('form').removeClass('hasFAQContent noFAQContent').addClass(vis ? 'hasFAQContent' : 'noFAQContent');
7162	}
7163	this.GetFAQContent = function (group) {
7164		var groupObj = this.GetGroupSafe(group);
7165		if (!groupObj) return null;
7166		if (typeof (groupObj.FAQContent) == "function") {
7167			return groupObj.FAQContent();
7168		}
7169		return groupObj.FAQContent;
7170	}
7171	/**
7172	 * Check if a group and the section it's contained in, if there is one, are visible.
7173	 * @param {object} group A group object
7174	 * @returns True if the group and the section it's contained in are visible.
7175	 */
7176	this.IsGroupAndSectionVisible = function (group) {
7177		return typeof (group) == "object" &&
7178			(
7179				// Check the visibility of the group.
7180				typeof (group.Visible) == "undefined" ||
7181				group.Visible()
7182			) &&
7183			(
7184				// Check if the section exists.
7185				typeof (group.SectionPosition) == "undefined" ||
7186				group.SectionPosition < 0 ||
7187				group.SectionPosition >= this.Sections.length ||
7188				(
7189					// If the section does exist, check its visibility.
7190					typeof (this.Sections[group.SectionPosition].Visible) == "undefined" ||
7191					this.Sections[group.SectionPosition].Visible()
7192				)
7193			);
7194	}
7195	/**
7196	 * Starting at the given group position inclusive and forward, begins searching for a group where
7197	 * - The group and section are visible
7198	 * If no group is found, it returns a number which is +1 the position of the last group
7199	 * @param {int} [start] The position to begin searching at, if not provided, the current group is used
7200	 * @return {number} The found groups position, or the length of the group array if none found
7201	 */
7202	this.GetNextPosition = function (start) {
7203		var pos = start;
7204		if (typeof (pos) != "number") {
7205			pos = this.GetGroupPosition(this.GetCurrentGroup()) + 1
7206		}
7207		var grp;
7208		while (pos < this.Groups.GetLength() && (grp = this.Groups.Get(pos)) != null && !this.IsGroupAndSectionVisible(grp)) {
7209			++pos;
7210		}
7211		return pos;
7212	}
7213	/**
7214	 * Starting at the given group position inclusive and backward, begins searching for a group where
7215	 * - The group and section are visible
7216	 * If no group is found, it returns -1
7217	 * @param {int} [start] The position to begin searching at, if not provided, the current group is used
7218	 * @return {number} The found groups position, or -1 if none found.
7219	 */
7220	this.GetPreviousPosition = function (start) {
7221		var pos = start;
7222		if (typeof (pos) != "number") {
7223			pos = this.GetGroupPosition(this.GetCurrentGroup()) - 1;
7224		}
7225		var grp;
7226		while (pos >= 0 && (grp = this.Groups.Get(pos)) != null && !this.IsGroupAndSectionVisible(grp)) {
7227			--pos;
7228		}
7229		return pos;
7230	}
7231	/**
7232	 * Go to the preview page from the questionnaire.
7233	 * On a multiuser document this will prompt users that aren't signed in to create an account.
7234	 **/
7235	this.GotoPreview = function () {
7236		showMessage("Saving", {priority: 1});
7237		if (!isLoggedIn() && WebuserDataInfo.isMultiuserChildDocument) {
7238			var currentThis = this;
7239			if (!showSignInDialog({
7240				callback: function () {
7241					currentThis.GotoPreviewFinal();
7242				},
7243				page: "create",
7244				directLink: false,
7245				leaving: true
7246			}))
7247				this.GotoPreviewFinal(); // If for some reason the sign in dialog isn't going to be shown go directly to the preview page
7248		}
7249		else {
7250			this.GotoPreviewFinal();
7251		}
7252	}
7253	/**
7254	 * Sends the user to the preview page.
7255	 * Used as a callback after all user interactions are done from GotoPreview.
7256	 **/
7257	this.GotoPreviewFinal = function () {
7258		var len = this.Groups.GetLength();
7259		var previousPos = this.GetPreviousPosition(len - 1);
7260		if (!this.IsAnimating && !(this.RestrictNavigation && this.GetNextPosition() < len && previousPos >= 0 && !this.Groups.Get(previousPos).Seen) && !this.RestrictNavigationFull()) {
7261			this.CheckLocationCookie();
7262			/* Due to how safari handles back/forward caching we can't have the loading message up when leaving the page otherwise it will be there when users back up. */
7263			if (typeof (hideMessage) == "function" && typeof (cssua) != "undefined" && cssua.ua.safari && (cssua.ua.ios || cssua.ua.mac_os_x)) {
7264				hideMessage();
7265			}
7266			if (vh.HC()) {
7267				Sequiter.storage.SetLocalStorageAnswerSet(WebuserDataInfo.id || getQueryStringValue("webuser_data_id"), (WebuserDataInfo.shared ? getQueryStringValue("l") : null));
7268			}
7269			if (TooltipHandler) TooltipHandler.FinishAnimation();
7270			if (!this.SkipPreview) {
7271				// Redirect to the preview page url. If that url cannot be determined, 
7272				// fallback to the old postback method (which does not preserve webuser_data_id and so may cause a redirect to the landing page)
7273				var previewPageUrl = Sequiter.previewPage.getPreviewPageUrl();
7274				if (previewPageUrl !== null) {
7275					// Ensure any changes to the user's answers are saved
7276					this.Save(true, true, function () {
7277						setSave(false);
7278						window.location = previewPageUrl;
7279					});
7280				} else {
7281					__doPostBack(this.PageID, '__Preview');
7282				}
7283			}
7284			else {
7285				__doPostBack(this.PageID, '__ProductSelection');
7286			}
7287		}
7288		else {
7289			hideMessage();
7290		}
7291	}
7292	/**
7293	 * Go forward a page. This is the same as the Next function execpt it tracks that the skip button was clicked.
7294	 * @param {Object} [settings={}] An object with some configuration settings.
7295	 * @param {function} [settings.confirmationFunction] A function to call to confirm anything that the user might not realize. The only parameter of this should accept a parameterless function.
7296	 */
7297	this.Skip = function (settings) {
7298		skipQuestionTracking('click');
7299		this.Next(settings);
7300	}
7301	/**
7302	 * Go forward a page
7303	 * @param {Object} [settings={}] An object with some configuration settings.
7304	 * @param {function} [settings.confirmationFunction] A function to call to confirm anything that the user might not realize. The only parameter of this should accept a parameterless function.
7305	 */
7306	this.Next = function (settings) {
7307		var continueAction = null;
7308		if (typeof (this.ContinueAction) === "function") continueAction = this.ContinueAction();
7309		if (continueAction && eval('(function() { ' + continueAction + '})()') === false) return;
7310		var continueURL = null;
7311		if (typeof (this.ContinueURL) === "function") continueURL = this.ContinueURL();
7312
7313		if (continueURL) {
7314			this.Save(true);
7315			showMessage("Saving", {priority: 1});
7316			location.href = continueURL;
7317		}
7318		else if (this.ReturnGroup !== null) {
7319			var nextGroupPos = this.GetNextPosition();
7320			if (this.NextGroup !== null && this.NextGroup === this.Groups.Get(nextGroupPos).ID) {
7321				this.GotoGroup(this.NextGroup, null, null, null, null, settings);
7322			}
7323			else if (this.NextSecondGroup !== null && this.NextSecondGroup === this.Groups.Get(nextGroupPos).ID) {
7324				this.GotoGroup(this.NextSecondGroup, null, null, null, null, settings);
7325			}
7326			else {
7327				this.GotoGroup(this.ReturnGroup, null, null, null, null, settings);
7328			}
7329		} else {
7330			this.GotoGroup(this.GetNextPosition(), null, null, null, null, settings);
7331		}
7332	}
7333	/**
7334	 * Go back a page.
7335	 * @param {Object} [settings={}] An object with some configuration settings.
7336	 * @param {function} [settings.confirmationFunction] A function to call to confirm anything that the user might not realize. The only parameter of this should accept a parameterless function.
7337	 */
7338	this.Previous = function (settings) {
7339		var pos = this.GetPreviousPosition();
7340		this.GotoGroup(pos, null, null, null, null, settings);
7341	}
7342	/**
7343	 * returnGroup, nextGroup and nextSecondGroup added for incorporation to jump on required question group and jump back to start point
7344	 * @param {string} group The id of the question group to go to
7345	 * @param replace
7346	 * @param returnGroup
7347	 * @param nextGroup
7348	 * @param nextSecondGroup
7349	 * @param {Object} [settings={}] An object with some configuration settings.
7350	 * @param {function} [settings.confirmationFunction] A function to call to confirm anything that the user might not realize. The only parameter of this should accept a parameterless function.
7351	 */
7352	this.GotoGroup = function (group, replace, returnGroup, nextGroup, nextSecondGroup, settings) {
7353		if (this.RestrictNavigationFull()) return;
7354
7355		var settingsExt = $.extend({
7356			confirmationFunction: null
7357		}, settings);
7358
7359		var currentThis = this;
7360		// What to do once it is determined that going to the specified group is allowed
7361		var postValidationCallback = null;
7362		if (typeof (replace) === "undefined") replace = false;
7363		if (group === currentThis.ReturnGroup) currentThis.ReturnGroup = null;
7364		if (group === currentThis.NextGroup) currentThis.NextGroup = null;
7365		if (group === currentThis.NextSecondGroup) currentThis.NextSecondGroup = null;
7366		if (typeof (returnGroup) !== "undefined" && returnGroup !== null) {
7367			currentThis.ReturnGroup = returnGroup;
7368		}
7369		if (typeof (nextGroup) !== "undefined" && nextGroup !== null) {
7370			currentThis.NextGroup = nextGroup;
7371		}
7372		if (typeof (nextSecondGroup) !== "undefined" && nextSecondGroup !== null) {
7373			currentThis.NextSecondGroup = nextSecondGroup;
7374		}
7375
7376		if (currentThis.Navigation !== null) {
7377			var navagation = currentThis.Navigation;
7378			currentThis.Navigation = null;
7379			navagation();
7380			/*Run Navigation event on group change*/
7381		}
7382
7383		if (!currentThis.IsAnimating) {
7384			if (typeof (group) === "string") {
7385				group = currentThis.GetGroupPosition(group);
7386			}
7387			if (group < 0) {
7388				group = 0;
7389			}
7390			var restricted = false;
7391			var previousPos = currentThis.GetPreviousPosition(group - 1);
7392
7393			if (currentThis.RestrictNavigation && group > currentThis.GetNextPosition() && previousPos >= 0 && !currentThis.Groups.Get(previousPos).Seen) {
7394				restricted = true;
7395			}
7396			var len = currentThis.Groups.GetLength();
7397			// If going past the end of the questionnaire, take them to the preview page
7398			if (group >= len) {
7399				if (!restricted && cV(true, false)) {
7400					postValidationCallback = function () {
7401						showMessage("Saving", {priority: 1});
7402						currentThis.GotoPreview();
7403					};
7404				}
7405			} else {
7406				var destGroup = currentThis.Groups.Get(group);
7407				var sectionSeen = destGroup.Seen;
7408				if (restricted) {
7409					var i = 0;
7410					while (!sectionSeen && i < len) {
7411						var grp = currentThis.Groups.Get(i);
7412						if (grp.SectionPosition === destGroup.SectionPosition && grp.Seen) {
7413							sectionSeen = true;
7414						}
7415						++i;
7416					}
7417				}
7418				if ((!restricted || sectionSeen) && (currentThis.ValidateAfterNav || cV(true, true, group))) {
7419					postValidationCallback = function () {
7420						currentThis.CheckLocationCookie();
7421						sectionID = currentThis.Sections[destGroup.SectionPosition].ID;
7422						groupID = destGroup.ID;
7423						newQString = updateQueryStringParameter(location.search, "s", sectionID);
7424						newQString = updateQueryStringParameter(newQString, "g", groupID);
7425						if (currentThis.IsPreview()) location.href = "./" + newQString;
7426						else {
7427							pushState({
7428								Section: sectionID,
7429								Group: groupID
7430							}, (typeof (destGroup.Name) === "function" ? destGroup.Name() : null), newQString, replace);
7431							currentThis.LoadGroupAndSection();
7432						}
7433					};
7434				}
7435				st.track(currentThis.Sections[destGroup.SectionPosition].ID, destGroup.ID);
7436			}
7437		}
7438
7439		if (postValidationCallback !== null) {
7440			var confirmationCallback = function () {
7441				if (WebuserDataInfo.Multiuser !== null) {
7442					checkActiveInvites(postValidationCallback);
7443				} else {
7444					postValidationCallback();
7445				}
7446			}
7447
7448			if (typeof (settingsExt.confirmationFunction) === "function") {
7449				settingsExt.confirmationFunction(confirmationCallback);
7450			} else {
7451				confirmationCallback();
7452			}
7453		}
7454
7455	}
7456	this.CheckLocationCookie = function () {
7457		var loc = gC() + gR();
7458		if (loc != getCookie("L")) {
7459			setCookie("L", loc, 365, true);
7460		}
7461	}
7462	/**
7463	 * Redirect the user to the questionnaire at the specified section and group. Currently only used on the preview page
7464	 * @param {string} section the id of the question section to redirect to
7465	 * @param {string} group the id of the question group to redirect to
7466	 */
7467	this.GotoQuestions = function (section, group) {
7468		var sectionPos = 0;
7469		if (typeof (section) == "string") {
7470			sectionPos = this.GetSectionPosition(section);
7471		}
7472		else if (this.Sections[section]) {
7473			sectionPos = section;
7474			section = this.Sections[sectionPos].ID;
7475		}
7476		if (typeof (group) == "undefined" || !group) {
7477			var pos = this.GetFirstGroupInSection(sectionPos);
7478			group = null;
7479			if (pos != -1) {
7480				group = this.Groups.Get(pos).ID;
7481			}
7482		}
7483		if (typeof (section) == "undefined") {
7484			if (group != null) {
7485				section = this.Sections[this.Groups.Get(this.GetGroupPosition(group)).SectionPosition].ID;
7486			}
7487			else if (this.Sections.length > 0) {
7488				section = this.Sections[sectionPos].ID;
7489			}
7490		}
7491		setSave(false);
7492		this.CheckLocationCookie();
7493		var baseUrl = window.location.pathname;
7494		// This postback can happen on pages other than the index page, if we are not on the index page, force it to the index page by removing the file name
7495		if (baseUrl.lastIndexOf("/") < baseUrl.length - 1) {
7496			baseUrl = baseUrl.substr(0, baseUrl.lastIndexOf("/") + 1);
7497		}
7498		//Only certain query string values are preserved across the redirect
7499		var queryString = "s=" + section + "&g=" + group;
7500		var preservedQueryParts = ["file", "l", "code", "webuser_data_id"];
7501		for (var i = 0; i < preservedQueryParts.length; i++) {
7502			var value = getQueryStringValue(preservedQueryParts[i]);
7503			if (value) {
7504				if (queryString !== "") {
7505					queryString += "&";
7506				}
7507				queryString += preservedQueryParts[i] + "=" + value;
7508			}
7509		}
7510		window.location.href = baseUrl + "?" + queryString;
7511	}
7512	this.GotoSection = function (section, replace) {
7513		if (!this.IsAnimating) {
7514			if (typeof (section) == "string") {
7515				section = this.GetSectionPosition(section);
7516			}
7517			var pos = this.GetFirstGroupInSection(section);
7518			if (pos != -1) {
7519				this.GotoGroup(pos, replace);
7520			}
7521		}
7522	}
7523	/**
7524	 * Function to go to a section in a contract like above.
7525	 * Also creates an internal event that a section link was clicked.
7526	 * @param {any} section the section to navigate to
7527	 * @param {any} replace
7528	 */
7529	this.GotoSectionWithInternalTracking = function (section, replace) {
7530		submitInternalEventV2(section, "Section Navigation", "click", getCurrentProductCode());
7531		this.GotoSection(section, replace);
7532	}
7533	this.GetFirstGroupInSection = function (section) {
7534		if (typeof (section) == "string") {
7535			section = this.GetSectionPosition(section);
7536		}
7537		for (var i = 0; i < this.Groups.GetLength(); ++i) {
7538			var grp = this.Groups.Get(i);
7539			if (grp && grp.SectionPosition == section && this.IsGroupAndSectionVisible(grp)) {
7540				return i;
7541			}
7542		}
7543		return -1;
7544	}
7545	/**
7546	 * Gets the index of
7547	 * - The selected group if visible, otherwise
7548	 * - The first group following the selected group that is visible, if not found then
7549	 * - The closest prior group to the selected group that is visible, if none found then
7550	 * - returns -1
7551	 * @return {number} A valid visible group position, or -1 if no groups are valid.
7552	 */
7553	this.GetSelectedGroupPosition = function () {
7554		// Search forward
7555		var groupPos = this.GetNextPosition(this.SelectedGroup);
7556		if (groupPos >= this.Groups.GetLength()) {
7557			// Search backward
7558			groupPos = this.GetPreviousPosition(this.SelectedGroup);
7559		}
7560
7561		return groupPos;
7562	}
7563	/**
7564	 * Returns the group object of the group that is currently in focus, null if none is is focus.
7565	 * @return {null|object}
7566	 */
7567	this.GetSelectedGroup = function () {
7568		var groupPos = this.GetSelectedGroupPosition();
7569		if (groupPos >= 0 && groupPos < this.Groups.GetLength()) {
7570			return this.Groups.Get(groupPos);
7571		}
7572		return null;
7573	}
7574	/**
7575	 * Gets the position of the section in focus
7576	 * @return {number} the position of the section in focus
7577	 */
7578	this.GetSelectedSectionPosition = function () {
7579		return this.SelectedSection;
7580	}
7581	/**
7582	 * Returns the section object of the currently in focus section, or null if no section is in focus
7583	 * @return {null|Section}
7584	 */
7585	this.GetSelectedSection = function () {
7586		var sectionPos = this.GetSelectedSectionPosition();
7587		if (sectionPos >= 0 && sectionPos < this.Sections.length) {
7588			return this.Sections[sectionPos];
7589		}
7590		return null;
7591	}
7592
7593	/**
7594	 * Saves all answers in the questionnaire, and marks the questionnaire as having saved answers stored for it by the user.
7595	 * @param quiet if true, progress messages to the user are not displayed
7596	 * @param async
7597	 * @param callback - Function to call when the save is done.
7598	 * @constructor
7599	 */
7600	this.Save = function (quiet, async, callback) {
7601		if (typeof (quiet) === "undefined") quiet = false;
7602		if (typeof (async) === "undefined") async = false;
7603		forceSave = true;
7604		setSave(true);
7605		if (!quiet) showMessage('Saving your answers. Please wait.');
7606		saveASPAJAX("aspnetForm", true, false, false, async, function () {
7607			if (!quiet) showMessage("Saved.", { id: "saved", timeout: 1000, fadeMessage: true, inlineImage: "/images/green_checkmark2x.png", inlineImageWidth: 28, inlineImageHeight: 28, topImage: null });
7608			vh.S("__HasSavedAnswers", true);
7609			vh.S("__HasSavedAnswersSpecific", true);
7610			if (typeof (callback) === "function") callback();
7611		});
7612	}
7613	this.CheckSectionNav = function () {
7614		var sectionPos = this.GetSelectedSectionPosition();
7615		if (sectionPos < 0 || sectionPos >= this.Sections.length) return;
7616		var section = this.Sections[sectionPos];
7617		var navSection = section.ID;
7618		if (!section.InNavigation) {
7619			navSection = null;
7620			if (sectionPos >= 0 && sectionPos < this.Sections.length) {
7621				var tempSection = this.Sections[sectionPos];
7622				if (!tempSection.InNavigation) {
7623					navSection = null;
7624					for (var i = sectionPos - 1; i >= 0; --i) {
7625						if (this.Sections[i].InNavigation && this.Sections[i].Visible()) {
7626							navSection = this.Sections[i].ID;
7627							break;
7628						}
7629					}
7630					if (navSection == null) {
7631						for (var i = sectionPos + 1; i < this.Sections.length; ++i) {
7632							if (this.Sections[i].InNavigation && this.Sections[i].Visible()) {
7633								navSection = this.Sections[i].ID;
7634								break;
7635							}
7636						}
7637					}
7638				}
7639			}
7640		}
7641		$('.sectionMenu .selected,.sectionMenuTop .selected').removeClass('selected');
7642		$('.sectionMenu .' + navSection + ',.sectionMenuTop .' + navSection).addClass('selected');
7643		$('.sectionMenu .unseen.' + navSection + ',.sectionMenuTop .unseen.' + navSection).removeClass('unseen').addClass('seen');
7644		if ($('.previewPage').length) {
7645			$('.sectionMenuTop .selected').removeClass('selected');
7646			$('.FinishTab').addClass('selected');
7647		}
7648	}
7649	this.SetGroupAsSeen = function (group) {
7650		if (!group.Seen) {
7651			group.Seen = true;
7652			var seen = $('#__Seen');
7653			seen.val(seen.val() + ',' + group.ID);
7654		}
7655	}
7656	/**
7657	 * Loads the group and section currently specified in the URL, updating the url and form if inconsistencies are
7658	 * found.
7659	 * @param {boolean} [noSave] If true, changed answers on the page will not be saved before navigating away. Default is false
7660	 */
7661	this.LoadGroupAndSection = function (noSave) {
7662		if (!this.Initialized || this.IsPreview()) return;
7663		
7664		// If the group and section are the same, there is no loading to be done, as they should already be loaded.
7665		if(this.GetCurrentSection() === this.GetSelectedSection().ID && this.GetCurrentGroup() === this.GetSelectedGroup().ID) return;
7666
7667		if (!noSave && typeof (showSignInDialogOnSignOut) == "function") {
7668			// If the splitGroupsClient class exists then this page is using client side page navigation.
7669			// In this case don't show the saving dialog since it will not close when the next page loads
7670			if ($(".splitGroupsClient").length == 0) {
7671				showMessage("Saving", {priority: 1});
7672			}
7673			showSignInDialogOnSignOut()
7674				.then(function (showingDialog) {
7675					qnh._doLoadGroupAndSection(false, showingDialog);
7676				});
7677		}
7678		else {
7679			this._doLoadGroupAndSection(noSave, false);
7680		}
7681	}
7682	/**
7683	 * Loads the group and section currently specified in the URL, updating the url and form if inconsistencies are 
7684	 * found.
7685	 * @param {boolean} noSave If true, changed answers on the page will not be saved before navigating away
7686	 * @param {boolean} showingDialog If a dialog is currently showing, which may cause this function to noop
7687	 * @private
7688	 */
7689	this._doLoadGroupAndSection = function (noSave, showingDialog) {
7690		if (!noSave && showingDialog) return;
7691
7692		/* Close any open calendars. */
7693		$(".hasDatepicker").each(function (index, item) {
7694			if (!$(item).data("datepicker")) return;
7695			$(item).datepicker("hide");
7696		});
7697
7698		var section = this.GetCurrentSection();
7699		var group = this.GetCurrentGroup();
7700		var inSameSection = true;
7701		var setDisabled = true;
7702		var skipPreload = false;
7703
7704		// If no webuser data id is specified for the current document, attempt to find out from the server what the new webuser data id is and then specify it
7705		if (window.location.search.toLowerCase().indexOf('webuser_data_id') === -1) {
7706			Sequiter.Contracts.updateWebuserDataId(PC);
7707		}
7708
7709		/* Make sure that the form action's query string matches the current question group and section */
7710		$("#aspnetForm").each(function (i, e) {
7711			var action = e.action;
7712			var qStringStart = action.indexOf('?');
7713			if (qStringStart >= 0) {
7714				var path = action.substring(0, qStringStart);
7715				var qString = action.substring(qStringStart);
7716				qString = updateQueryStringParameter(qString, "s", section);
7717				qString = updateQueryStringParameter(qString, "g", group);
7718				e.action = path + qString;
7719			}
7720		});
7721
7722		if (section) {
7723			var selectedSection = this.GetSelectedSection();
7724			var sectionPos = this.GetSectionPosition(section);
7725
7726			if (selectedSection == null || selectedSection.ID != section) {
7727				this.SetSelectedSection(sectionPos);
7728				inSameSection = false;
7729				this.CheckSectionNav();
7730			}
7731		}
7732		if (group) {
7733			var selectedGroup = this.GetSelectedGroup();
7734			if (selectedGroup == null || selectedGroup.ID != group) {
7735				var groupPos = this.GetGroupPosition(group);
7736				var nextPos = this.GetNextPosition(groupPos + 1);
7737				var destGroup = this.Groups.Get(groupPos);
7738				$(".groupNavigationInner .current").removeClass('current');
7739				$(".groupNavigationInner li[data-groupID='" + destGroup.ID + "']").addClass("current");
7740				this.SetGroupAsSeen(destGroup);
7741				if (nextPos < this.Groups.GetLength()) {
7742					var nextSectionPosition = this.Groups.Get(nextPos).SectionPosition;
7743					if (nextSectionPosition != selectedGroup.SectionPosition) {
7744						var nextSectionID = this.Sections[nextSectionPosition].ID;
7745						$('.sectionMenu .unseen.' + nextSectionID).removeClass('unseen').addClass('seen');
7746						$('.sectionMenuTop .unseen.' + nextSectionID).removeClass('unseen').addClass('seen');
7747					}
7748				} else {
7749					$('.sectionMenu .unseen.FinishTab').removeClass('unseen').addClass('seen');
7750					$('.sectionMenuTop .unseen.FinishTab').removeClass('unseen').addClass('seen');
7751				}
7752				if (this.PreloadGroups) {
7753					if (this.LoadedGroups[group]) {
7754						_debugPreload('"Navigate To Loaded Group: "+group');
7755						this.NavigateToGroupClient(groupPos);
7756					} else {
7757						if (!this.StartPreloadRegistered) {
7758							this.StartPreload();
7759						}
7760						showMessage("Saving", {priority: 1});
7761						if (this.CurrentlyLoadingGroup == group) {
7762							_debugPreload('"Wait to navigate To Currently Loading Group: "+group');
7763							this.AddAfterGroupLoaded(function () {
7764								_debugPreload('"Navigate To Currently Loading Group: "+group');
7765								hideMessage();
7766								qnh.NavigateToGroupClient(groupPos);
7767							});
7768						} else if (this.CurrentlyLoadingGroup || this.PreloadGroupsState == null) {
7769							_debugPreload('"Wait to navigate To Non-loading Group: "+group');
7770							this.AddAfterGroupLoaded(function () {
7771								_debugPreload('"Navigate To Non-loading Group: "+group');
7772								qnh.AddAfterGroupLoaded(function () {
7773									_debugPreload('"Navigate To Non-loaded Group after loading: "+group');
7774									hideMessage();
7775									qnh.NavigateToGroupClient(groupPos);
7776								});
7777								qnh.PreloadGroup(qnh.Groups.Get(groupPos));
7778							});
7779						} else {
7780							_debugPreload('"Wait to navigate To Non-loaded Group when Preloading Stopped: "+group+","+qnh.PreloadGroupsState');
7781							this.AddAfterGroupLoaded(function () {
7782								_debugPreload('"Navigate To Non-loaded Group when Preloading Stopped: "+group+","+qnh.PreloadGroupsState');
7783								hideMessage();
7784								qnh.NavigateToGroupClient(groupPos);
7785								qnh.PreloadGroupsState = null;
7786							});
7787							this.PreloadGroup(this.Groups.Get(groupPos));
7788						}
7789						skipPreload = true;
7790					}
7791				} else if (this.NavigateGroupsClient) {
7792					this.NavigateToGroupClient(groupPos);
7793				} else {
7794					showMessage("Saving", {priority: 1});
7795					if (noSave) this.NoSave = true;
7796					this.WaitingForAJAX = true;
7797					this.SetSelectedGroup(groupPos);
7798					/* For IE 11, the promise polyfill is causing an error in the Telerik code because it runs in strict mode. Using setTimeout runs it in a different context. */
7799					setTimeout(function () {
7800						getAjaxMan().ajaxRequest("action=groupNav&value=" + group);
7801					}, 0);
7802					var bar = this.GetProgressBar();
7803					if (bar) {
7804						this.LastProgressValue = bar.attr('value');
7805						this.LastProgressMax = bar.attr('max');
7806					}
7807				}
7808			}
7809			else if (selectedGroup != null) {
7810				// Make sure the current group is marked as seen.
7811				this.SetGroupAsSeen(selectedGroup);
7812			}
7813		}
7814		if (setDisabled && !this.IsPreview()) {
7815			if (this.GetPreviousPosition() < 0) {
7816				$(".previousButton").addClass("disabled");
7817			} else {
7818				$(".previousButton").prop("disabled", false);
7819				$(".previousButton").removeClass("disabled");
7820			}
7821		}
7822
7823		/*For new AddThis module/landing page*/
7824		if (typeof hideFaqContent == 'function') {
7825			if (this.GetPreviousPosition() < 0) {
7826				showFaqContent();
7827				stickyScroll();
7828			} else {
7829				hideFaqContent();
7830			}
7831		}
7832
7833		if (this.PreloadGroups && !skipPreload) {
7834			this.PreloadGroupsState = null;
7835			this.StartPreload();
7836		}
7837	}
7838	this.NavigateToGroupClient = function (groupPos) {
7839		var hasSavedAnswers = vh.G("__HasSavedAnswersSpecific");
7840		if (this.PreloadGroups && typeof (hasSavedAnswers) != "undefined" && !hasSavedAnswers) {
7841			setSave(true);
7842			this.Save(true, true);
7843		}
7844		this.AnimateGroupsNavigation(groupPos);
7845		this.SetTrackPageView();
7846		if (this.ValidateAfterNav) {
7847			cV();
7848			this.ValidateAfterNav = false;
7849		}
7850		if (isSmallScreen()) {
7851			if (typeof (resizeSelectBoxes) == "function") {
7852				resizeSelectBoxes($("#" + this.GetSelectedGroup().ClientID));
7853			}
7854			else {
7855				resizeSmallScreenSelectBoxes($("#" + this.GetSelectedGroup().ClientID));
7856			}
7857		}
7858	}
7859	this.AnimateGroupsNavigation = function (groupPos) {
7860		if (!this.IsAnimating || !this.EnableClientGroupAnimation) {
7861			if (typeof (groupPos) == "undefined") {
7862				groupPos = this.SelectedGroup;
7863			}
7864			var oldGroup = $(".groupLevel0:not(.notCurrentGroup)");
7865			var newGroup = $(".groupLevel0.s" + this.Groups.Get(groupPos).ID);
7866			var section = oldGroup.parents(".section");
7867			var reverse = this.SelectedGroup > groupPos;
7868			this.SetSelectedGroup(groupPos);
7869			this.SetGroupInValueHandler(groupPos);
7870			var oldHeight = oldGroup.outerHeight();
7871			var newHeight = newGroup.outerHeight();
7872			var marginAdditional = 0;
7873			var isLoad = oldGroup.hasClass("loadCurrentGroup");
7874
7875			if (this.EnableClientGroupAnimation) {
7876				var animationWidth = 943;
7877				var animationDuration = 800; /* Should be divisible by 2 */
7878
7879				setTimeout(function () {
7880					qnh.IsAnimating = true;
7881
7882					if (isLoad) {
7883						section.css({ height: section.css("height") });
7884					}
7885					if (newHeight > oldHeight) {
7886						section.animate({ height: (newHeight + marginAdditional) + "px" }, animationDuration / 2);
7887					}
7888					if (isLoad) {
7889						oldGroup.removeClass("loadCurrentGroup");
7890					}
7891					oldGroup.animate({ right: (reverse ? "-" : "") + animationWidth + "px" }, animationDuration, 'swing', function () {
7892						oldGroup.addClass("notCurrentGroup");
7893						oldGroup.css({ right: "0" });
7894					});
7895					newGroup.css({ right: (reverse ? "" : "-") + animationWidth + "px", visibility: "visible" });
7896					if (oldHeight > newHeight) {
7897						section.animate({ height: (newHeight + marginAdditional) + "px" }, animationDuration / 2);
7898					}
7899					qnh.CalculateProgress(animationDuration);
7900					newGroup.animate({ right: "0" }, animationDuration, "swing", function () {
7901						newGroup.css({ visibility: "" });
7902						newGroup.removeClass("notCurrentGroup");
7903						qnh.IsAnimating = false;
7904						setTimeout(function () { qnh.AnimateSectionHeight(undefined, 0); }, cssua.ua.firefox ? 200 : 20);
7905					});
7906					qnh.ScrollToTop();
7907				}, cssua.ua.firefox ? 10 : 0);
7908			}
7909			else {
7910				if (newHeight > oldHeight || isLoad) {
7911					section.css({ height: (newHeight + marginAdditional) + "px" });
7912				}
7913				if (isLoad) {
7914					oldGroup.removeClass("loadCurrentGroup");
7915				}
7916				oldGroup.addClass("notCurrentGroup");
7917				oldGroup.css({ right: "0" });
7918				if (oldHeight > newHeight) {
7919					section.css({ height: (newHeight + marginAdditional) + "px" });
7920				}
7921				this.CalculateProgress(animationDuration);
7922				newGroup.css({ visibility: "" });
7923				newGroup.removeClass("notCurrentGroup");
7924				setTimeout(function () { qnh.AnimateSectionHeight(undefined, 0); }, 200);
7925				this.ScrollToTop();
7926			}
7927		}
7928	}
7929	this.AnimateSectionHeight = function (groupID, animationDuration, requestGroupingTimeout) {
7930		if (!this.Groups.GetLength() || !isSmallScreen()) return;
7931		if (typeof (animationDuration) == "undefined") {
7932			animationDuration = 400;
7933		}
7934		if (typeof (groupID) == "undefined") {
7935			// if no group currently in focus, don't animate
7936			if (this.SelectedGroup < 0) return;
7937			groupID = this.Groups.Get(this.SelectedGroup).ID;
7938		}
7939		if (typeof (requestGroupingTimeout) == "undefined") {
7940			requestGroupingTimeout = 200;
7941		}
7942
7943		/* Don't animate if it's not the current group. */
7944		if ($(".s" + groupID + ".notCurrentGroup").length > 0) return;
7945		/* Don't animate if the heights are not different. */
7946		if ($(".s" + groupID).outerHeight() == parseInt($(".s" + groupID).parents(".section").css("height"))) return;
7947
7948		/*Combine calls to avoid multiple height update issues.*/
7949		if (animationDuration == 0 && this.AnimateSectionHeightCalls.length == 0) {
7950			this.DoAnimateSectionHeight(groupID, animationDuration);
7951		}
7952		else {
7953			this.AnimateSectionHeightCalls.push({ groupID: groupID, animationDuration: animationDuration });
7954			setTimeout(function () {
7955				var animationDurations = {};
7956				for (var i = 0; i < qnh.AnimateSectionHeightCalls.length; i++) {
7957					if (!(qnh.AnimateSectionHeightCalls[i].groupID in animationDurations) || animationDurations[qnh.AnimateSectionHeightCalls[i].groupID] < qnh.AnimateSectionHeightCalls[i].animationDuration) {
7958						animationDurations[qnh.AnimateSectionHeightCalls[i].groupID] = qnh.AnimateSectionHeightCalls[i].animationDuration;
7959					}
7960				}
7961				qnh.AnimateSectionHeightCalls = [];
7962				for (gID in animationDurations) {
7963					qnh.DoAnimateSectionHeight(gID, animationDurations[gID]);
7964					setTimeout(function () { qnh.DoAnimateSectionHeight(gID, 0); }, animationDurations[gID] + 60);
7965				}
7966			}, requestGroupingTimeout);
7967		}
7968	}
7969	this.DoAnimateSectionHeight = function (groupID, animationDuration) {
7970		var grp = this.Groups.Get(this.SelectedGroup);
7971		if (!this.IsAnimating && grp && groupID == grp.ID) {
7972			var group = $(".s" + groupID);
7973			var isLoad = group.hasClass("loadCurrentGroup");
7974			var section = group.parents(".section");
7975			if (isLoad) {
7976				section.css({ height: section.css("height") });
7977				group.removeClass("loadCurrentGroup");
7978			}
7979			var newHeight = group.outerHeight() + "px";
7980			if (animationDuration > 0) {
7981				section.animate({ height: newHeight }, animationDuration, "swing");
7982			}
7983			else {
7984				section.css("height", newHeight);
7985			}
7986		}
7987	}
7988	this.PreloadNextGroup = function () {
7989		if (!this.CurrentlyLoadingGroup && !this.PreloadGroupsState) {
7990			var curGroup = this.SelectedGroup;
7991			var groupCheck = 1;
7992			var groupCheckCount = 0;
7993			while (!this.Groups.Get(curGroup + groupCheck) || this.Groups.Get(curGroup + groupCheck).ID in this.LoadedGroups) {
7994				if (groupCheck < 0) {
7995					groupCheck = (-2 * groupCheck) + 1;
7996				}
7997				else if (groupCheck % 2 == 0 && curGroup - (groupCheck / 2) >= 0) {
7998					groupCheck = 0 - groupCheck / 2;
7999				}
8000				else {
8001					groupCheck++;
8002				}
8003				if (curGroup + groupCheck >= this.Groups.GetLength() || !this.Groups.Get(curGroup + groupCheck)) {
8004					if (groupCheckCount == this.Groups.GetLength() - 2) {
8005						this.PreloadGroupsState = "finished";
8006						break;
8007					}
8008					continue;
8009				}
8010				groupCheckCount++;
8011			}
8012			if (!this.PreloadGroupsState) {
8013				this.PreloadGroup(this.Groups.Get(curGroup + groupCheck));
8014			}
8015		}
8016	}
8017	this.PreloadGroup = function (group) {
8018		if (group.PreloadTrigger) {
8019			this.CurrentlyLoadingGroup = group.ID;
8020			getAjaxMan().ajaxRequestWithTarget(group.PreloadTrigger, "");
8021		}
8022	}
8023	this.LoadedGroup = function () {
8024		this.LoadedGroups[this.CurrentlyLoadingGroup] = this.Groups.Get(this.GetGroupPosition(this.CurrentlyLoadingGroup)).ClientID;
8025		if ($("#__PreloadedGroups").length) {
8026			$("#__PreloadedGroups").val($("#__PreloadedGroups").val() + "," + this.CurrentlyLoadingGroup);
8027		}
8028		this.CurrentlyLoadingGroup = null;
8029		if (this.PreloadGroupsState == "pausing") {
8030			this.PreloadGroupsState = "paused";
8031		}
8032	}
8033	this.StartPreload = function () {
8034		if (this.AfterGroupLoaded != null) {
8035			var afterGroupLoaded = this.AfterGroupLoaded;
8036			this.AfterGroupLoaded = null;
8037			afterGroupLoaded();
8038		}
8039		this.PreloadNextGroup();
8040		if (!this.StartPreloadRegistered) {
8041			this.StartPreloadRegistered = true;
8042			registerPostStartUpScript(function () { qnh.StartPreload(); });
8043		}
8044		if (DEBUG_PRELOAD) { setTimeout(function () { qnh.CheckPreloadErrors(); }, 30000); }
8045	}
8046	this.CheckPreloadErrors = function () {
8047		if (this.PreloadGroupsState != "finished") {
8048			throw "Preloading of groups is stuck for 30 seconds with a state of '" + this.PreloadGroupsState + "'.";
8049		}
8050	}
8051	this.AddAfterGroupLoaded = function (callback) {
8052		if (!this.AfterGroupLoaded) {
8053			this.AfterGroupLoaded = callback;
8054		}
8055		else {
8056			var oldCallback = this.AfterGroupLoaded;
8057			this.AfterGroupLoaded = function () {
8058				oldCallback();
8059				callback();
8060			};
8061		}
8062	}
8063	this.AddNavigation = function (callback) {
8064		if (!this.Navigation) {
8065			this.Navigation = callback;
8066		}
8067		else {
8068			var oldCallback = this.Navigation;
8069			this.Navigation = function () {
8070				oldCallback();
8071				callback();
8072			};
8073		}
8074	}
8075	this.AJAXCallBack = function () {
8076		if (this.WaitingForAJAX) {
8077			this.SetProgressBarToPrevious();
8078			var group = this.GetCurrentGroup();
8079			if (this.NavigateGroupsClient || this.NavigateGroupsClientLandingPage) {
8080				$(".groupLevel0.loadCurrentGroup").removeClass("loadCurrentGroup");
8081				$('.groupLevel0:not(.s' + group + ')').addClass("notCurrentGroup");
8082				$('.groupLevel0.s' + group).removeClass("notCurrentGroup");
8083				this.AnimateSectionHeight(group, 0);
8084			}
8085			else {
8086				$('.groupLevel0:not(.s' + group + ')').hide();
8087				$('.groupLevel0.s' + group).show();
8088			}
8089			var scrollToTop = this.Groups.GetLength() > 0;
8090			if (this.ValidateAfterNav) {
8091				scrollToTop = cV(true, group);
8092				this.ValidateAfterNav = false;
8093			}
8094			if (scrollToTop) {
8095				this.ScrollToTop();
8096			}
8097			this.SetTrackPageView();
8098			this.WaitingForAJAX = false;
8099			if (!this.IsFirstPage()) {
8100				if (!this.NoSave && vh.HC()) {
8101					Sequiter.storage.SetLocalStorageAnswerSet(WebuserDataInfo.id || getQueryStringValue("webuser_data_id"), (WebuserDataInfo.shared ? getQueryStringValue("l") : null));
8102				}
8103				this.NoSave = false;
8104			}
8105
8106			if (typeof initGroupHelpAccordion === "function")
8107				initGroupHelpAccordion();
8108		}
8109		else if (this.NavigateGroupsClient || this.NavigateGroupsClientLandingPage) {
8110			this.AnimateSectionHeight();
8111		}
8112	}
8113	this.ScrollToTop = function () {
8114		var page = $("html, body");
8115		var stopHandler = function () { page.stop() };
8116		setTimeout(function () {
8117			page.on("scroll mousedown wheel DOMMouseScroll mousewheel keyup touchmove", stopHandler).animate({ scrollTop: 0 }, 700, function () {
8118				page.off("scroll mousedown wheel DOMMouseScroll mousewheel keyup touchmove", stopHandler);
8119			})
8120		}, 0);
8121	}
8122	this.SetTrackPageView = function () {
8123		if (typeof getCurrentProductCode == "function") {
8124			var anaQS = this.trimQuestionAbbrev(this.GetCurrentSection());
8125			var anaQG = this.trimQuestionAbbrev(this.GetCurrentGroup());
8126			var combinedQSQG = "";
8127			var QSQGHash = "";
8128			if (typeof anaQS == "string" && anaQS.length > 0) {
8129				combinedQSQG = anaQS;
8130				QSQGHash = "s=" + anaQS;
8131			}
8132			if (typeof anaQG == "string" && anaQG.length > 0) {
8133				combinedQSQG += ":" + anaQG;
8134				if (QSQGHash.length > 0)
8135					QSQGHash += "&";
8136				QSQGHash += "g=" + anaQG;
8137			}
8138			if (combinedQSQG.length > 0)
8139				combinedQSQG = " " + combinedQSQG;
8140			if (QSQGHash.length > 0)
8141				QSQGHash = "#" + QSQGHash;
8142			setGAPageName(getCurrentProductCode() + " Index" + combinedQSQG, QSQGHash, true);
8143		}
8144	}
8145	this.Init = function () {
8146		/* Only do the initialization if some groups or sections are registered */
8147		if (this.Groups.GetLength() > 0 || this.Sections.length > 0) {
8148			var group = this.GetGroupPositionByClientID($(".groupLevel0:not(.notCurrentGroup)").attr("id"));
8149			if (group) {
8150				this.SetSelectedGroup(group);
8151				this.SetSelectedSection(this.Groups.Get(group).SectionPosition);
8152			}
8153			else {
8154				var section = this.GetSectionFromValueHandler();
8155				if (section) {
8156					this.SetSelectedSection(section);
8157					this.SetSelectedGroup(this.GetFirstGroupInSection(section));
8158				}
8159			}
8160			if (this.NavigateGroupsClient || this.NavigateGroupsClientLandingPage) {
8161				var loadGroup = this.GetGroupByClientID($(".groupLevel0.loadCurrentGroup").attr("id"));
8162				if (loadGroup) {
8163					this.AnimateSectionHeight(loadGroup.ID, 0);
8164				}
8165			}
8166			this.CheckSectionNav();
8167			this.CalculateProgress(this.Initialized ? null : 0, false);
8168
8169			var hashGroup = null;
8170			var hashSection = null;
8171			/* Check for the group and section in the hash to support old code */
8172			if (window.location.hash) {
8173				var hash = window.location.hash;
8174				if (hash.startsWith("#")) hash = hash.substring(1);
8175				var hashSplit = hash.split("&");
8176				for (var i = 0; i < hashSplit.length; ++i) {
8177					if (hashSplit[i].startsWith("s=")) {
8178						hashSection = hashSplit[i].substring(2);
8179					}
8180					else if (hashSplit[i].startsWith("g=")) {
8181						hashGroup = hashSplit[i].substring(2);
8182					}
8183				}
8184			}
8185
8186			if (hashGroup || hashSection) {
8187				/* If either was found, go to the found group or section, but replace the current state instead of pushing a new one. */
8188				if (hashGroup) this.GotoGroup(hashGroup, true);
8189				else this.GotoSection(hashSection, true);
8190			}
8191			else {
8192				/* If a hash exists we'll end up submitting a pageview there so only do it here if no hash exists so we don't submit two  */
8193				st.track(this.GetCurrentSection(), this.GetCurrentGroup());
8194			}
8195
8196			this.Initialized = true;
8197			Sequiter.storage.SetLocalStorageAnswerSet(WebuserDataInfo.id || getQueryStringValue("webuser_data_id"), (WebuserDataInfo.shared ? getQueryStringValue("l") : null), true);
8198			this.LoadGroupAndSection(true);
8199		}
8200	}
8201	this.trimQuestionAbbrev = function (strGroup) {
8202		if (typeof strGroup == "string" && strGroup.length > 2 &&
8203			(strGroup.indexOf("QS") == 0 || strGroup.indexOf("QG") == 0))
8204			return strGroup.substring(2);
8205		else
8206			return strGroup;
8207	}
8208	this.GetProgressBar = function () {
8209		var bar;
8210		if (this.ProgressBars.length > 0) {
8211			var select = "";
8212			for (var i = 0; i < this.ProgressBars.length; ++i) {
8213				if (select.length > 0) select += ", ";
8214				select += "#" + this.ProgressBars[i] + " progress";
8215			}
8216			bar = $(select);
8217			if (bar.is(":visible")) return bar;
8218		}
8219		/* If the progress bars aren't registered try to find them anyway, but don't mess with progress bars on the preview page */
8220		if (!this.IsPreview()) {
8221			bar = $(".progressBarWrapper progress");
8222			if (bar.length) return bar;
8223		}
8224		return null;
8225	}
8226	this.CalculateProgress = function (animationDuration, highlight) {
8227		var bar = this.GetProgressBar();
8228		if (bar != null) {
8229			if (typeof (animationDuration) == "undefined") {
8230				animationDuration = this.NavigateGroupsClient ? 0 : 400;
8231			}
8232			if (typeof (highlight) == "undefined") {
8233				highlight = false;
8234			}
8235			if (this.NavigateGroupsClient) {
8236				var totalGroups = 0;
8237				var currentGroup = -1;
8238				for (var i = 0; i < this.Groups.GetLength(); i++) {
8239					var groupObj = this.Groups.Get(i);
8240					if (groupObj && this.IsGroupAndSectionVisible(groupObj)) {
8241						if (i == this.SelectedGroup) {
8242							currentGroup = totalGroups;
8243						}
8244						totalGroups++;
8245					}
8246				}
8247				this.AnimateProgressBar(currentGroup, totalGroups, animationDuration, highlight);
8248			}
8249			else if ($(".sectionMenuTop").length) {
8250				if ($(".sectionMenuTop").is(":visible") && typeof (fluidLayout) != "undefined" && fluidLayout || typeof (supportsM
8250obile) != "undefined" && supportsMobile) {
8251					if ($('html').hasClass('sm')) {
8252						var totalGroups = 0;
8253						var currentGroup = -1;
8254						for (var i = 0; i < this.Groups.GetLength(); i++) {
8255							var groupObj = this.Groups.Get(i);
8256							if (groupObj && this.IsGroupAndSectionVisible(groupObj)) {
8257								if (i == this.SelectedGroup) {
8258									currentGroup = totalGroups;
8259								}
8260								totalGroups++;
8261							}
8262						}
8263						this.AnimateProgressBar(currentGroup, totalGroups, animationDuration, highlight);
8264					}
8265					else {
8266						var max = parseInt($(".sectionMenuTop").outerWidth());
8267						var value = 0;
8268						var currentSection = $(".sectionMenuTop li.selected").get(0);
8269						if (currentSection) {
8270							value = $(currentSection).position().left + Math.floor(parseInt($(currentSection).outerWidth()) / 2);
8271						}
8272						this.AnimateProgressBar(value, max, animationDuration, highlight);
8273					}
8274				}
8275				else if ($(".sectionMenuTop").is(":visible")) {
8276					var max = parseInt($(".sectionMenuTop").outerWidth());
8277					var value = 0;
8278					var currentSection = $(".sectionMenuTop li.selected").get(0);
8279					if (currentSection) {
8280						value = $(currentSection).position().left + Math.floor(parseInt($(currentSection).outerWidth()) / 2);
8281					}
8282					this.AnimateProgressBar(value, max, animationDuration, highlight);
8283				}
8284				else if (bar.is(":visible")) {
8285					var totalSections = 0;
8286					var currentSection = -1;
8287					for (var i = 0; i < this.Groups.GetLength(); i++) {
8288						var groupObj = this.Groups.Get(i);
8289						if (groupObj && this.IsGroupAndSectionVisible(groupObj)) {
8290							if (i == this.SelectedGroup) {
8291								currentSection = totalSections;
8292							}
8293							totalSections++;
8294						}
8295					}
8296					this.AnimateProgressBar(currentSection, totalSections, animationDuration, highlight);
8297				}
8298				else {
8299					$(".sectionMenuTop").off("visibilitychange");
8300					$(".sectionMenuTop").on("visibilitychange", function (visible) {
8301						if (visible) {
8302							qnh.CalculateProgress();
8303							$(".sectionMenuTop").off("visibilitychange");
8304						}
8305					});
8306				}
8307			}
8308		}
8309	}
8310	this.SetProgressBarToPrevious = function () {
8311		bar = this.GetProgressBar();
8312		if (bar && this.LastProgressMax != 0 && this.LastProgressValue != 0) {
8313			bar.hide();
8314			bar.attr('max', this.LastProgressMax);
8315			bar.attr('value', this.LastProgressValue);
8316			bar.show();
8317		}
8318	}
8319	this.AnimateProgressBar = function (value, max, animationDuration, highlight) {
8320		var bar = this.GetProgressBar();
8321		if (bar == null) return;
8322
8323		bar.each(function () { AnimateSingleProgressBar($(this), value, max, animationDuration, highlight); });
8324	}
8325}
8326var qnh = new QuestionNavigationHandler();
8327/* Keep this function to prevent errors on older contracts that still register it, but it's not actually in use */
8328function RegisterHashChange() { }
8329/* Initialize the question navigation handler */
8330if (!registerPostStartUpScript(function () { qnh.Init(); })) { registerOnLoadScript(function () { qnh.Init(); }); }
8331function AnimateSingleProgressBar(bar, value, max, animationDuration, highlight) {
8332	var highlightTimeout = 600;
8333	if (!isFinite(value) || value > max) value = max;
8334	if (!isFinite(max)) max = value;
8335	if (max == 0) max = 1;
8336
8337	/* Set progress on first page for Landing_Page_LC_US_2022 exp. Saved Answers*/
8338	if ($(".LC").length && $(".LandingPageUsExp").length) {
8339        value += 1;
8340    }
8341
8342	var changed = parseInt(bar.attr("value")) != value || parseInt(bar.attr("max")) != max;
8343	if (animationDuration == 0) { /* IE/Edge tries to animate unless the bar is hidden. */
8344		bar.hide();
8345		bar.attr('max', max);
8346		bar.attr('value', value);
8347		bar.show();
8348	}
8349	else if (parseInt(bar.attr("max")) != max) bar.animate({ max: max }, animationDuration, function () { bar.animate({ value: value }, animationDuration); });
8350	else bar.animate({ value: value }, animationDuration);
8351	bar.find(".progressBar span").animate({ width: ((value / max) * 100) + "%" }, animationDuration);
8352
8353	if (highlight && changed && value > 0) {
8354		var barParent = bar.parent();
8355		barParent.addClass("highlight");
8356		setTimeout(function () { barParent.removeClass("highlight") }, highlightTimeout);
8357	}
8358}
8359
8360$(window).on("resize", function () {
8361	if ($(".sectionMenuTop").is(":visible") && typeof (fluidLayout) != "undefined" && fluidLayout) {
8362		qnh.CalculateProgress(0);
8363	}
8364});
8365
8366/* Set progress on first page for Landing_Page_LC_US_2022 exp. No Saved Answers*/
8367rE(window, "load resize", function () {
8368    if ($(".LC").length && $(".LandingPageUsExp").length && $("progress").length) {
8369        var totalGroups = 0;
8370        var currentGroup = -1;
8371        for (var i = 0; i < qnh.Groups.GetLength(); i++) {
8372            var groupObj = qnh.Groups.Get(i);
8373            if (groupObj && qnh.IsGroupAndSectionVisible(groupObj)) {
8374                if (i == qnh.SelectedGroup) {
8375                    currentGroup = totalGroups;
8376                }
8377                totalGroups++;
8378            }
8379        }
8380        document.querySelector("progress").setAttribute("max", totalGroups);
8381        currentGroup += 1;
8382        document.querySelector("progress").setAttribute("value", currentGroup);
8383    }		
8384});
8385/* End Question Navigation Handler */
8386
8387/* End Include questionNavigationHandler */
8388
8389/* Include miscellaneous.utilities */
8390/**
8391 * Gets the value of the specified key in the given queryString. If the queryString is not provided, the current page's queryString is used.
8392 * @param {string} key the query string key to get the value of
8393 * @param {boolean} [decode=false] If true, the value will be automatically url decoded
8394 * @param {string} [queryString=location.search] If set, will search the provided string, otherwise the window.location.search string is used
8395 * @return {string|undefined} The value if it is found, undefined otherwise
8396 */
8397function getQueryStringValue(key, decode, queryString){
8398	return Sequiter.QueryString.GetQueryStringValue(key, decode, queryString);
8399}
8400
8401/* Determines if the current page is marked as a Payment page*/
8402function isPaymentPage() {
8403    return typeof(analyticsPageName) != "undefined" && analyticsPageName == "Payment";
8404}
8405/* End Include miscellaneous.utilities */
8406
8407/* Include miscellaneous */
8408/* Needed for DCS on IE. */
8409var countrySelsArray = new Array();
8410
8411/*  Attempt to fix "undefined" URL in Chrome - Chris Poirier, Aug 14, 2013 */
8412window.suggestmeyes_loaded = true;
8413
8414function getCountry() {
8415	var countryCode = "";
8416	if (typeof (vh) !== 'undefined') {
8417		countryCode = vh.G('__CountryCode');
8418	}
8419
8420	var loc = getCookie("L");
8421	if (countryCode == "" && loc && loc.length >= 2) {
8422		if (loc.length >= 2) {
8423			countryCode = loc.substring(0, 2);
8424		}
8425	}
8426	if (countryCode == null || countryCode == "") {
8427		re = /country([A-Z][A-Z])/;
8428		var arr = re.exec($('html').attr('class'));
8429		if (arr != null && arr.length > 1) {
8430			countryCode = arr[1];
8431		}
8432	}
8433	if (countryCode == null) return '';
8434	return countryCode;
8435}
8436
8437function getCountryLocale() {
8438	var country = getCountry();
8439	if (country == 'CA' && typeof getRegion === 'function' && getRegion() == 'QC')
8440		return 'fr-CA';
8441
8442	var locales = {
8443		DE: 'de-DE',
8444		AT: 'de-AT',
8445		GB: 'en-GB',
8446		US: 'en-US',
8447		ES: 'es-ES',
8448		FR: 'fr-FR',
8449		AU: 'en-AU',
8450		MX: 'es-MX',
8451		CA: 'en-US'
8452	};
8453	return locales[country] || 'en-US';
8454}
8455
8456function getRegion() {
8457	var regionCode = "";
8458	if (typeof (vh) != 'undefined') {
8459		regionCode = vh.G('__RegionCode');
8460	}
8461
8462	var loc = getCookie("L");
8463	if (regionCode == "" && loc && loc.length > 2) {
8464		regionCode = loc.substring(2);
8465	}
8466
8467	if (regionCode == null) regionCode = '';
8468	return regionCode;
8469}
8470function getCriteria() {
8471	var criteria = getQueryStringValue("ldcn");
8472	if (criteria == '' || typeof (criteria) === 'undefined') {
8473		var ldcn = getCookie('ldcn');
8474		if (typeof (ldcn) != 'undefined' && ldcn != null) {
8475			var ldcnSplit = ldcn.split('&');
8476			for (var i = 0; i < ldcnSplit.length; ++i) {
8477				var valSplit = ldcnSplit[i].split('=');
8478				if (valSplit[0] == getCurrentProductCode()) {
8479					return valSplit[1];
8480				}
8481			}
8482		}
8483		return '';
8484	}
8485	return criteria;
8486}
8487
8488function updateQueryStringParameter(queryString, key, value) {
8489	var re = new RegExp("([?&])" + key + "=.*?(&|$)", "i");
8490	var lastChar = queryString.charAt(queryString.length - 1);
8491	var separator = (lastChar === "?" || lastChar === "&" ? "" : queryString.indexOf('?') !== -1 ? "&" : "?");
8492	if (queryString.match(re)) {
8493		return queryString.replace(re, '$1' + (value != null ? key + "=" + value + '$2' : ''));
8494	}
8495	else if (value != null) {
8496		return queryString + separator + key + "=" + value;
8497	}
8498	else {
8499		return queryString;
8500	}
8501}
8502
8503function getCurrentProductCode() {
8504	if (typeof (PC) != "undefined") {
8505		return PC;
8506	}
8507	var productCode = null;
8508	productCode = getQueryStringValue("code");
8509	if (productCode != null)
8510		return productCode;
8511
8512	if (typeof productOrderURL == "string") {
8513		productCode = parseProductCodeFromURL(productOrderURL);
8514		if (typeof productCode == "string" && productCode.length > 0)
8515			return productCode;
8516	}
8517	for (var i = 0; i < document.forms.length; i++) {
8518		if (document.forms[i].name == 'editWordsForm') {
8519			productCode = parseProductCodeFromURL(document.forms[i].action);
8520			if (typeof productCode == "string" && productCode.length > 0)
8521				return productCode;
8522		}
8523	}
8524	var contactElement = document.getElementById('ctrlEntryNav_lnkContactus');
8525	if (contactElement != null && typeof contactElement.href == 'string') {
8526		var startIndex = contactElement.href.indexOf('?contract=');
8527		if (startIndex != -1) {
8528			startIndex += 10;
8529			endIndex = contactElement.href.substring(startIndex).indexOf('&');
8530			if (endIndex != -1)
8531				return contactElement.href.substring(startIndex, startIndex + endIndex);
8532			else
8533				return contactElement.href.substring(startIndex);
8534		}
8535	}
8536	if (location.href.indexOf('/articles-of-incorporation/') != -1) {
8537		return 'CINCRP';
8538	}
8539	return "";
8540}
8541
8542function parseProductCodeFromURL(url) {
8543	if (typeof url == "string" && url.length > 0) {
8544		var codeIndex = url.indexOf("code=");
8545		if (codeIndex != -1) {
8546			var ampersandIndex = url.indexOf("&", codeIndex);
8547			if (ampersandIndex != -1) {
8548				return url.substring(codeIndex + 5, ampersandIndex);
8549			}
8550			else {
8551				return url.substring(codeIndex + 5);
8552			}
8553		}
8554	}
8555	return "";
8556}
8557
8558function getElementsByTagAndClassName(parentElement, tagName, className) {
8559	var tags = parentElement.getElementsByTagName(tagName.toUpperCase());
8560	var elements = [];
8561	for (var i = 0; i < tags.length; i++) {
8562		var tag = tags[i];
8563		if (hasClassName(tag, className)) {
8564			elements[elements.length] = tag;
8565		}
8566	}
8567	return elements;
8568}
8569function findParentElementByTagAndClassName(childElement, tagName, className) {
8570	var parentElement = null;
8571	while (childElement.parentElement != null) {
8572		var tempParent = childElement.parentElement;
8573		if (tempParent.tagName.toUpperCase() == tagName.toUpperCase() && hasClassName(tempParent, className)) {
8574			parentElement = tempParent;
8575			break;
8576		}
8577		childElement = tempParent;
8578	}
8579	return parentElement;
8580}
8581function hasClassName(element, className) {
8582	var found = false;
8583	if (element.className) {
8584		var classes = element.className.split(" ");
8585		for (var j = 0; j < classes.length; j++) {
8586			if (classes[j] == className) {
8587				found = true;
8588				break;
8589			}
8590		}
8591	}
8592	return found;
8593}
8594
8595function scrollContainerToEl(container, el) {
8596	if (typeof ($) == "function" && $(el).length) {
8597		$(container).scrollTop($(el).offset().top - $(container).offset().top + $(container).scrollTop());
8598	}
8599}
8600function GetElementPosition(el) {
8601	var parent = null;
8602	var pos = { x: 0, y: 0 };
8603	var box;
8604	if (el.getBoundingClientRect) {
8605		// IE
8606		box = el.getBoundingClientRect();
8607		var scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
8608		var scrollLeft = document.documentElement.scrollLeft || document.body.scrollLeft;
8609		pos.x = box.left + scrollLeft - 2;
8610		pos.y = box.top + scrollTop - 2;
8611		return pos;
8612	} else if (document.getBoxObjectFor) {
8613		// gecko
8614		box = document.getBoxObjectFor(el);
8615		pos.x = box.x - 2;
8616		pos.y = box.y - 2;
8617	} else {
8618		// safari/opera
8619		pos.x = el.offsetLeft;
8620		pos.y = el.offsetTop;
8621		parent = el.offsetParent;
8622		if (parent != el) {
8623			while (parent) {
8624				pos.x += parent.offsetLeft;
8625				pos.y += parent.offsetTop;
8626				parent = parent.offsetParent;
8627			}
8628		}
8629	}
8630	if (window.opera) {
8631		parent = el.offsetParent;
8632		while (parent && parent.tagName != 'BODY' && parent.tagName != 'HTML') {
8633			pos.x -= parent.scrollLeft;
8634			pos.y -= parent.scrollTop;
8635			parent = parent.offsetParent;
8636		}
8637	} else {
8638		parent = el.parentNode;
8639		while (parent && parent.tagName != 'BODY' && parent.tagName != 'HTML') {
8640			pos.x -= parent.scrollLeft;
8641			pos.y -= parent.scrollTop;
8642			parent = parent.parentNode;
8643		}
8644	}
8645	return pos;
8646}
8647function scrollToEl(el) {
8648	if (typeof ($) == "function") {
8649		if ($(el).length > 0) {
8650			var curTop = $(el).offset().top;
8651			var curBottom = curTop + $(el).height();
8652			var topEl = curTop;
8653			var bottomEl = curBottom;
8654			var animationDuration = 0;
8655			var elementSpacing = 0;
8656			var i;
8657			for (i = 1; i < arguments.length; ++i) {
8658				if ((typeof (arguments[i]) == "string" || typeof (arguments[i]) == "object") && $(arguments[i]).length > 0) {
8659					curTop = $(arguments[i]).offset().top;
8660					curBottom = curTop + $(arguments[i]).height();
8661					topEl = Math.min(topEl, curTop);
8662					bottomEl = Math.max(bottomEl, curBottom);
8663				}
8664				else {
8665					break;
8666				}
8667			}
8668			if (i < arguments.length && typeof (arguments[i]) == "number") {
8669				animationDuration = arguments[i];
8670				i++;
8671			}
8672			if (i < arguments.length && typeof (arguments[i]) == "number") {
8673				elementSpacing = arguments[i];
8674				i++;
8675			}
8676			var windowTop = $(window).scrollTop();
8677			var windowBottom = windowTop + $(window).height();
8678			var scrollTo = null;
8679			if (topEl < windowTop) {
8680				scrollTo = topEl - elementSpacing;
8681				if (scrollTo < 0) scrollTo = 0;
8682			}
8683			else if (bottomEl > windowBottom) {
8684				scrollTo = bottomEl - $(window).height() + elementSpacing;
8685				if (scrollTo > topEl) {
8686					scrollTo = topEl;
8687				}
8688			}
8689
8690			if (scrollTo != null) {
8691				$('html,body').animate({ scrollTop: scrollTo }, animationDuration);
8692				return false;
8693			}
8694		}
8695	}
8696	else {
8697		var pos = GetElementPosition(el);
8698		window.scrollTo(pos.x, pos.y);
8699	}
8700}
8701/* Scroll the window to location of the element -- start of section will be head of viewport */
8702function scrollWindowToSection(el) {
8703	var position = GetElementPosition(document.querySelector(el));
8704	window.scrollTo(position.x, position.y);
8705}
8706
8707function getServerName() {
8708	var url = window.location.href;
8709	if (url.indexOf("https") == 0) {
8710		url = url.substring(8);
8711	}
8712	else {
8713		url = url.substring(7);
8714	}
8715	url = url.split("/");
8716	return url[0];
8717}
8718
8719function url_escape(str) {
8720	return escape(str).replace("//", "%2F%2F").replace("--", "%2D%2D")
8721		.replace("/*", "%2F%2A").replace("*/", "%2A%2F").replace("@@", "%40%40");
8722}
8723
8724function getWindowOrientation() {
8725	return window.innerHeight <= window.innerWidth ? 'landscape' : 'portrait';
8726}
8727
8728/* Dynamically include a javascript file.
8729 *   - url (string) must be absolute or root-relative.
8730 *   - useCDN (bool) defaults to true
8731*/
8732function dynamicLoadJS(url, useCDN) {
8733	if (!document.head) return false;
8734	if (typeof (useCDN) == "undefined") useCDN = true;
8735	var script = document.createElement("SCRIPT");
8736	script.type = "text/javascript";
8737	if (!useCDN || (url.length > 4 && url.substring(0, 4) == "http") || (url.length > 2 && url.substring(0, 2) == "//")) {
8738		script.src = url;
8739	}
8740	else {
8741		script.src = "//" + getScriptCDN() + url;
8742	}
8743	document.head.appendChild(script);
8744}
8745
8746/* Dynamically include a css file.
8747 *   - url (string) must be absolute or root-relative.
8748 *   - useCDN (bool) defaults to true
8749 *   - media (string) defaults to empty string
8750*/
8751function dynamicLoadCSS(url, useCDN, media) {
8752	if (!document.head) return false;
8753	if (typeof (useCDN) == "undefined") useCDN = true;
8754	if (typeof (media) == "undefined") media = "";
8755	var link = document.createElement("LINK");
8756	link.type = "text/css";
8757	link.rel = "stylesheet";
8758	if (!useCDN || (url.length > 4 && url.substring(0, 4) == "http") || (url.length > 2 && url.substring(0, 2) == "//")) {
8759		link.href = url;
8760	}
8761	else {
8762		link.href = "//" + getStyleCDN() + url;
8763	}
8764	if (media) {
8765		link.media = media;
8766	}
8767	document.head.appendChild(link);
8768}
8769function getScriptCDN() {
8770	return "www.legalcontracts.com";
8771}
8772function getStyleCDN() {
8773	return "www.legalcontracts.com";
8774}
8775
8776/*Gets the affiliate code from pid or cb_QueryStringLast cookie. based of code from copied from UserManagement.php(Aug16,2016)*/
8777function getAffiliateCode() {
8778	var query = "";
8779	var affcode = "";
8780	var start = "";
8781	query = getQueryStringValue("pid", true);
8782	if (query == null) {
8783		query = getCookieValue("cb_QueryStringLast");
8784	}
8785	if (query) {
8786		if (query.indexOf(";") > 0) {
8787			query = query.substring(0, query.indexOf(";") - 1);
8788		}
8789		if (query.indexOf("affiliate") >= 0 || query.indexOf("pg-") >= 0) {
8790			if (query.indexOf("affiliate_") >= 0) {
8791				start = "affiliate_";
8792			} else if (query.indexOf("affiliate-") >= 0) {
8793				start = "affiliate-";
8794			} else {
8795				start = "pg-"
8796			}
8797			var startpos = query.indexOf(start) + start.length;
8798			if (query.length >= startpos + 10) {
8799				affcode = query.substring(startpos, startpos + 10);
8800			}
8801		}
8802	}
8803	return affcode;
8804}
8805
8806function CallDataService(functionName, parameters, callback, errorCallback) {
8807	$.ajax({
8808		url: "/DataService/index.asmx/" + functionName,
8809		type: "POST",
8810		contentType: "application/json; charset=utf-8",
8811		dataType: "json",
8812		data: JSON.stringify(parameters),
8813		success: callback,
8814		error: errorCallback
8815	});
8816}
8817
8818/*Add form set form*/
8819function addFormAuotocompleteAttr() {
8820	if (typeof ($) == "function") {
8821		var pcode = getCurrentProductCode();
8822		var urlEndsWith = location.pathname.split("/");
8823		urlEndsWith = urlEndsWith[urlEndsWith.length - 1];
8824
8825		if (pcode != null && pcode != "" && (urlEndsWith == "" || urlEndsWith == "index.php" || urlEndsWith == "index.aspx")) {
8826			$("form[name!='hiddenform']:not([autocomplete])").attr("autocomplete", "off");
8827		}
8828	}
8829}
8830rE(window, "load", addFormAuotocompleteAttr);
8831
8832function getUserAgentString() {
8833	return (function () { try { return navigator.userAgent; } catch (e) { return 'MSIE 9.0'; } }());
8834}
8835
8836/**/
8837
8838$(document).on("mouseup", function (e) {
8839	var container = $(".footer_countries");
8840
8841	if (!container.is(e.target) // if the target of the click isn't the container...
8842		&& container.has(e.target).length === 0) // ... nor a descendant of the container
8843	{
8844		$('.countryNav').slideUp();
8845	}
8846});
8847/**/
8848
8849/* Fix an issue with drop down on edge. Edge has issues with document.activeElement being accessed in iframes, if this is one of those cases catch the error and just don't try to do anything. */
8850if (typeof ($) == "function") {
8851	if (typeof (cssua) != "undefined" && cssua.ua.edge) {
8852		$(window).on("resize", function () { try { var focused = document.activeElement; if (focused && focused.nodeName == "SELECT") { focused.blur(); focused.focus(); } } catch (ex) { } });
8853	}
8854}
8855
8856/* Duplicate watermarks until they fill their container */
8857$(window).on("load ajaxResponseEnd", function () {
8858	$('.watermarkContainer').each(function () {
8859		var watermark = $(this).find('.watermark').first();
8860		if (watermark.length > 0) {
8861			var compareElement = $(this).parent();
8862			var docContent = compareElement.find(".documentContent");
8863			if (docContent.length > 0) compareElement = docContent;
8864			var heightDiff = compareElement.height() - $(this).height();
8865			var prevHeightDiff;
8866			while (heightDiff > 0) {
8867				$(this).append(watermark.clone());
8868				prevHeightDiff = heightDiff;
8869				heightDiff = compareElement.height() - $(this).height();
8870				if (heightDiff >= prevHeightDiff) break;
8871			}
8872		}
8873	});
8874});
8875
8876function trimString(str) {
8877	return str.replace(/^\s+/g, '').replace(/\s+$/g, '');
8878}
8879
8880/* Determine if the element is attached to a document */
8881function elementHasDocument(elem) {
8882	if (!$(elem).length) return false;
8883	var realElem = $(elem).get(0);
8884	var docElem = (realElem.ownerDocument || window.document).documentElement;
8885	return docElem === realElem || jQuery.contains(docElem, realElem);
8886}
8887
8888/* Ensure that the progress element is valid */
8889document.createElement("progress");
8890
8891/* Register sticky item events */
8892rE(window, "load", function () {
8893	/* Sticky Social Share script */
8894	if ($(window).outerWidth() >= 1200 && $("form").hasClass("stickySocialShare") && $("form").hasClass("firstPage") && $("form").hasClass("noSavedAnswersSpecific")) {
8895		$(".addthis_button_facebook").attr("title", "Share on Facebook");
8896		$(".addthis_button_google_plusone_share").attr("title", "Share on Google Plus");
8897		$(".addthis_button_twitter").attr("title", "Share on Twitter");
8898		$(".addthis_button_linkedin").attr("title", "Share on LinkedIn");
8899
8900		if ($("form").hasClass("LandingPageNoPreview")) {
8901			TopPosition = $(".section .questionBox").offset().top;
8902		}
8903		else if ($("form").hasClass("LandingLocation") && $(".contractHead").css('display') === 'none' && $(".howItWorks").length) {
8904			if ($(window).height() < 700) {
8905				TopPosition = 500;
8906			} else {
8907				TopPosition = 604;
8908			}
8909
8910		}
8911		else if ($(".section .questionBox").find("h2").length) {
8912			TopPosition = $(".section .questionBox h2").offset().top + 10;
8913		}
8914		else if ($(".section .questionBox").find(".rbListContainerLarge").length) {
8915			TopPosition = $(".section .questionBox .que").offset().top + 10;
8916		}
8917		else {
8918			banner = $("#banner");
8919			if (!banner.length) {
8920				banner = $(".self-contained-banner")[0];
8921			}
8922			TopPosition = $(banner).height() + $(".contractHead").height() + 60;
8923		}
8924		$(".stickySocialShare.firstPage.noSavedAnswersSpecific #expFaqContent #rShare").css("top", TopPosition);
8925
8926		rE(window, "scroll", function () {
8927			let footer = $("#footer");
8928			if (!footer.length) {
8929				footer = $(".self-contained-footer")[0];
8930			}
8931			if ($(footer).position() == null) {
8932				return;
8933			}
8934			footTop = $(footer).position().top;
8935			stickyTop = $(document).scrollTop() + 250;
8936			diff = stickyTop - footTop;
8937			if (stickyTop > footTop) {
8938				$("#scroll-segment #rShare").css("margin-top", 0 - diff);
8939			} else {
8940				if ($(".wbTop").css("display") == "block") {
8941					$("#scroll-segment #rShare").css("margin-top", $(".wbTop").height());
8942				}
8943				else {
8944					$("#scroll-segment #rShare").css("margin-top", 0);
8945				}
8946			}
8947		});
8948	}
8949});
8950
8951rE(window, "load resize", function () {
8952	/* contract landing Page - Back to top button */
8953	if (isPhone() && $("html").hasClass("supportsMobile") && $("html").hasClass("LD") && $("form").hasClass("firstPage") && $("#expFaqContent").length && !isFluidLayout()) {
8954		if ($('#expFaqContent').find('.backToTop').length == 0) {
8955			$("#expFaqContent").append("<a onclick=\"$('html, body').animate({scrollTop: 0 }, 500);\" class=\"largeProceedButton backToTop\"><span class=\"icon\"></span><span class=\"text\">Back to Top</span></a>");
8956		}
8957	}
8958
8959	if($("html").hasClass("supportsMobile") && $("html").hasClass("LD") && $("form").hasClass("firstPage") && !$("#expFaqContent").length) {
8960	   $(".LD body form.firstPage.LandingPageNoPreview.showTrustLogos #wrapper #content .contractFoot .trustLogo").hide();
8961	}
8962
8963	if ($("html").is(".supportsMobile.sm") && $("html").hasClass("LD") && $("form").hasClass("firstPage") && $("#expFaqContent").length && isFluidLayout()) {
8964		if ($('#expFaqContent').find('.backToTop').length == 0) {
8965			$("#expFaqContent").append('<a onclick="$(\'html, body\').animate({scrollTop: 0 }, 500);" class="largeProceedButton backToTop" ><span class="icon"></span></a>');
8966		}
8967
8968		var scroll = $(window).scrollTop();
8969		if (scroll >= $('#expFaqContent').offset().top) {
8970			$("#expFaqContent").addClass("addBackToTop");
8971		}
8972		else {
8973			if ($("#expFaqContent").hasClass("addBackToTop")) {
8974				$("#expFaqContent").removeClass("addBackToTop");
8975			}
8976		}
8977		if ($(window).scrollTop() + $(window).height() < $(document).height() - $("#footer").height()) {
8978			$('.backToTop').css("position", "fixed");
8979			$('.backToTop').css("bottom", "15px");
8980		}
8981		if ($(window).scrollTop() + $(window).height() > $(document).height() - $("#footer").height()) {
8982			$('.backToTop').css("position", "absolute");
8983			$('.backToTop').css("bottom", "-55px");
8984		}
8985	}
8986
8987	/* Preview Page - Additional Documents button changes */
8988	if (isPhone() && $("html").hasClass("supportsMobile") && $("html").hasClass("LD") && $("form").hasClass("previewPage") && !isFluidLayout()) {
8989		if ($('.previewPage #content').find('.backToTop').length == 0) {
8990			$(".previewPage #content").append("<a onclick=\"$('html, body').animate({scrollTop: 0 }, 500);\" class=\"largeProceedButton backToTop\" style=\"display: none;\"><span class=\"icon\"></span><span class=\"text\">Back to Top</span></a>");
8991		}
8992		if ($("div.extraDocuments").length != 0) {
8993			$(".previewPage .previewHead ul.controls").append("<li class='additionalDocuments'><a onclick='$(\"html, body\").animate({scrollTop:$(\".extraDocuments\").offset().top}, 500);'><span class='icon'></span><span class='text'>Additional Documents</span></a></li>");
8994			if ($(".previewPage .selLicense").length != 0 && ($('.previewPage #content').find('.additionalDocuments').length == 0)) {
8995				$(".previewPage #content").append("<a onclick=\"$('html, body').animate({scrollTop:$('.extraDocuments').offset().top}, 500);\" class=\"largeProceedButton additionalDocuments\" style=\"display: none;\"><span class=\"icon\"></span><span class=\"text\">Additional Documents</span></a>");
8996			}
8997		}
8998	}
8999
9000	if ($("html").is(".supportsMobile.sm") && $("html").hasClass("LD") && $("form").hasClass("previewPage") && isFluidLayout()) {
9001		if ($('.previewPage #content').find('a.backToTop').length == 0) {
9002			$(".previewPage #content").append('<a onclick="$(\'html, body\').animate({scrollTop: 0 }, 500);" class="backToTop"></a>');
9003			if ($("html").is(".supportsMobile.sm") && $("html").hasClass("LD") && $("form").hasClass("previewPage") && isFluidLayout()) {
9004				if ($(window).scrollTop() + $("a.backToTop").height() + 402 > $('.contractPreviewWrapper').offset().top + $('.contractPreviewWrapper').height()) {
9005					$('a.backToTop').addClass("bottom");
9006					$('a.backToTop').removeClass("fixed");
9007				}
9008				else {
9009					$('a.backToTop').addClass("fixed");
9010					$('a.backToTop').removeClass("bottom");
9011				}
9012			}
9013		}
9014	}
9015});
9016
9017/*Landing_Page_LC_US_2022 exp. Testimonial Section - Slider functionality*/
9018rE(window, "load", function () {
9019	if($("html").hasClass("LC") && $("form").hasClass("testimonialLandingPageUsExp")){
9020		document.querySelectorAll(".testimonialCarousel").forEach(carousel => {
9021			const items = carousel.querySelectorAll(".testimonialCarouselItem ");
9022
9023			const buttons = carousel.querySelectorAll(".testimonialCarouselButton");
9024
9025			buttons.forEach((button, i) => {
9026				button.addEventListener("click", () => {
9027					// un-select all items
9028					items.forEach(item => item.classList.remove("testimonialCarouselItemSelected"));
9029					buttons.forEach(button => button.classList.remove("testimonialCarouselButtonSelected"));
9030
9031					// select correct items
9032					items[i].classList.add("testimonialCarouselItemSelected");
9033					button.classList.add("testimonialCarouselButtonSelected");
9034				});
9035			})
9036
9037			// select first item
9038			items[0].classList.add("testimonialCarouselItemSelected");
9039			buttons[0].classList.add("testimonialCarouselButtonSelected");
9040		});
9041	}
9042});
9043
9044if (typeof ($) == "function") {
9045	$(window).on("scroll resize", function (event) {
9046
9047		if (typeof (fullMobileSupport) == "function" && fullMobileSupport()) {
9048			if ((isPhone() || $("html").hasClass("sm")) && $(".selLicense").length && $("form.Preview2018").length == 0) {
9049				if ($('.selLicenseSticky').length == 0) {
9050					$(".selLicense").append($("<div class='selLicenseSticky'>").append($('.selLicense a').clone()));
9051				}
9052				var padding = parseNum($('.selLicenseSticky').css('padding-top'));
9053				var prePurchasePreviewHead = $('.selLicense>a');
9054				$('.selLicenseSticky').toggle((prePurchasePreviewHead.offset().top - padding < $(window).scrollTop()));
9055
9056				if (prePurchasePreviewHead.offset().top - padding < $(window).scrollTop()) {
9057					$('body').addClass('buttonsFixed');
9058				}
9059				else {
9060					$('body').removeClass('buttonsFixed');
9061				}
9062			}
9063
9064			if ($(".controls").length) {
9065				var previewHead = $('.previewHead');
9066				if (previewHead.offset().top + previewHead.outerHeight() < $(window).scrollTop()) {
9067					$('body').addClass('controlsFixed');
9068				}
9069				else {
9070					$('body').removeClass('controlsFixed');
9071				}
9072			}
9073
9074			if ($("html").hasClass("LD") && $("form").hasClass("previewPage") && $(".extraDocuments").length) {
9075				if ($(window).scrollTop() + window.innerHeight <= $(document).height() - $(".extraDocuments ul").height() - $("#footer").height()) {
9076					$('.additionalDocuments').removeClass('hideDocuments');
9077				}
9078				else {
9079					$('.additionalDocuments').addClass('hideDocuments');
9080				}
9081			}
9082			if (isPhone() && $("html").hasClass("supportsMobile") && $("html").hasClass("LD") && $("form").hasClass("firstPage") && $("#expFaqContent").length) {
9083				if ($(window).scrollTop() > $('#expFaqContent').offset().top - 100) {
9084					$('body').addClass('buttonsFixed controlsFixed');
9085				}
9086				else {
9087					$('body').removeClass('buttonsFixed controlsFixed');
9088				}
9089			}
9090		}
9091
9092		if (typeof (fluidLayout) != "undefined" && fluidLayout) {
9093			if ($("html").hasClass("md-lg-xl") && $(".selLicenseSticky").length) {
9094				$(".selLicenseSticky").css("display", "none");
9095			}
9096		}
9097	});
9098} /*keep this one!!!*/
9099
9100
9101/*  Displays: Your web browser may not be capable of accessing our site. Please go to our contact page and contact our technical support. */
9102function incompatible() {
9103	/**/
9104	var msg = "Your web browser may not be capable of accessing our site. Please go to our contact page and contact our technical support.";
9105	for (var i = 0; i < arguments.length; i++) {
9106		msg += "\n\n" + arguments[i];
9107	}
9108	alert(msg);
9109}
9110function getForm(formName) {
9111	if (document.forms) {
9112		var f;
9113		f = document.forms[formName];
9114		if (f) return f;
9115		else {
9116			var htmlOut = 'Please contact us and let us know what page you were on and let us know that "the form __CONFIG[sitebrand] was not found"';
9117			htmlOut = htmlOut.replace("__CONFIG[sitebrand]", formName);
9118			// incompatible("Please contact us and let us know what page you were on and let us know that \"the form '"+formName+"' was not found\"");
9119			incompatible(htmlOut);
9120			return false;
9121		}
9122	} else {
9123		alert("We are sorry. Your Browser may not support the features needed to use this site properly.");
9124		return false;
9125	}
9126}
9127function getFormObject(formName, objectId) {
9128	var obj;
9129	obj = getForm(formName);
9130	if (obj) obj = obj.elements[objectId];
9131	if (obj) return obj;
9132	else {
9133		if (arguments.length == 2 || arguments[2]) {
9134			var htmlOut = "Please contact us and let us know what page you were on and that we \"could not find [objectId]  in the form __CONFIG[sitebrand]\"";
9135			htmlOut = htmlOut.replace("[objectId]", objectId);
9136			htmlOut = htmlOut.replace("__CONFIG[sitebrand]", formName);
9137
9138			incompatible(htmlOut);
9139		}
9140		return false;
9141	}
9142}
9143function gFO(formName, objectID) {
9144	if (arguments.length > 2) {
9145		return getFormObject(formName, objectID, arguments[2]);
9146	}
9147	else {
9148		return getFormObject(formName, objectID);
9149	}
9150}
9151function htmlEncode(value) {
9152	if (typeof (value) != "string") return value;
9153	return $('<div/>').text(value).html();
9154}
9155function htmlDecode(value) {
9156	if (typeof (value) != "string") return value;
9157	return $('<div/>').html(value).text();
9158}
9159
9160/**
9161 * Alias for document.getElementById(objectId)
9162 * @param {string} objectId The id to look for
9163 * @return {HTMLElement | null} The element, if not found it will return null
9164 * @deprecated Use document.getElementById(objectId) instead
9165 */
9166function getObject(objectId) {
9167	return document.getElementById(objectId);
9168}
9169
9170/**
9171 * Alias for document.getElementById(id)
9172 * @param {string} id The id to look for
9173 * @return {HTMLElement | null} The element, or null if not found
9174 * @deprecated Use document.getElementById(id) instead
9175 */
9176function gI(id) { return document.getElementById(id); }
9177function toggleSubMenu(ctl) {
9178	if (supportsMobile && (isPhone() || (isFluidLayout() && $('html').hasClass('sm')))) {
9179		$(ctl).children("ul").slideToggle(500);
9180		$(ctl).toggleClass("active");
9181	}
9182}
9183if (typeof ($) == "function") {
9184	$.fn.oldshow = $.fn.show;
9185	$.fn.show = function () {
9186		var wasVisible = $(this).is(":visible");
9187		$(this).removeClass("hideByDefault");
9188		if (arguments.length > 0) {
9189			return this.oldshow.apply(this, arguments);
9190		}
9191		var retVal = this.oldshow();
9192		if (!wasVisible) {
9193			$(this).trigger("visibilitychange", { visible: true });
9194		}
9195		return retVal;
9196	}
9197	$.fn.oldhide = $.fn.hide;
9198	$.fn.hide = function () {
9199		var wasVisible = $(this).is(":visible");
9200		if (arguments.length > 0) {
9201			return this.oldhide.apply(this, arguments);
9202		}
9203		if (wasVisible) {
9204			$(this).trigger("visibilitychange", { visible: false });
9205		}
9206		return this.oldhide();
9207	}
9208}
9209
9210/***
9211 * Sets the visibility of the html element with the given ID using the 'display' css attribute
9212 * @param {string} objectId The id of the object to set the display for
9213 * @param {boolean} visible If true, the element will have it's display set to the value of the display parameter, if false, it will be set to none
9214 * @param {string} [display] The value of the 'display' css property to set if visible. Default is 'block'
9215 */
9216function setVis(objectId, visible, display) {
9217	if (typeof ($) == "function") {
9218		/* Using show/hide is necessary rather than using toggle, as toggle uses an
9219		   * animation in older versions of jquery and sometimes we have
9220		   * something that is hidden then shown again before the animation
9221		   * completes and it fails to show properly.*/
9222		var visObject = $("#" + objectId);
9223		if (visObject.parent(".questionRowCell").length) {
9224			if (visible) {
9225				visObject.parent(".questionRowCell").show();
9226			}
9227			else {
9228				visObject.parent(".questionRowCell").hide();
9229			}
9230		}
9231		if (visible) {
9232			visObject.show();
9233		}
9234		else {
9235			visObject.hide();
9236			/* If this is a radio button contianer, ensure that the radio
9237			   * button group still has a valid value selected.*/
9238			if (visObject.find("> input:checked[type='radio']").length) {
9239				var groupName = visObject.find("> input[type='radio']").attr("name");
9240				var radios = $("input[type='radio'][name='" + groupName + "']").prop("checked", false);
9241				for (var i = 0; i < radios.length; i++) {
9242					if ($(radios[i]).parent().css("display") != "none") {
9243						$(radios[i]).prop("checked", true);
9244						if ($(radios[i]).siblings(".rblCircle").length) {
9245							$(radios[i]).siblings(".rblCircle").trigger("click");
9246						}
9247						else {
9248							$(radios[i]).trigger("change");
9249						}
9250						break;
9251					}
9252				}
9253			}
9254		}
9255		return;
9256	}
9257	if (typeof (display) == "undefined") {
9258		display = "block";
9259	}
9260	var obj;
9261	if (document.getElementById && document.getElementById(objectId)) {
9262		obj = document.getElementById(objectId);
9263	} else if (document.all && document.all(objectId)) {
9264		obj = document.all(objectId);
9265	} else {
9266		incompatible();
9267		return;
9268	}
9269	if (visible && display == "inlineBlock") {
9270		try {
9271			obj.style.display = "-moz-inline-box";
9272		}
9273		catch (Exception) {
9274			obj.style.display = "inline-block";
9275		}
9276	}
9277	else if (visible && display == "tableCell") {
9278		try {
9279			obj.style.display = "table-cell";
9280		}
9281		catch (Exception) {
9282			obj.style.display = "block";
9283		}
9284	}
9285	else if (visible && display == "table") {
9286		try {
9287			obj.style.display = "table";
9288		}
9289		catch (Exception) {
9290			obj.style.display = "block";
9291		}
9292	}
9293	else {
9294		obj.style.display = visible ? display : "none";
9295	}
9296	obj = obj.parentNode;
9297	if (obj.tagName.toLowerCase() == "tr") {
9298		if (visible) {
9299			try {
9300				obj.style.display = "table-row";
9301			}
9302			catch (Exception) {
9303				obj.style.display = "block";
9304			}
9305		}
9306		else {
9307			var hide = true;
9308			for (var i = 0, cell; cell = obj.cells[i]; i++) {
9309				if (cell.style.display != "none") {
9310					hide = false;
9311					break;
9312				}
9313			}
9314			if (hide) {
9315				obj.style.display = "none";
9316			}
9317		}
9318	}
9319}
9320function oe(o1, o2) {
9321	if (o1 === null && o2 === null) return true;
9322	if (typeof (o1) !== typeof (o2)) return false;
9323	if (o1 === o2) return true;
9324	if (typeof (o1) != 'object') {
9325		return o1 === o2;
9326	}
9327	if (o1 instanceof Date) {
9328		return o2 instanceof Date && o1.valueOf() === o2.valueOf();
9329	}
9330	for (var p in o1) {
9331		if (!oe(o1[p], o2[p])) {
9332			return false;
9333		}
9334	}
9335	return true;
9336}
9337
9338/**
9339 * "Set Display" Minified alias for {@see setVis}
9340 * @param objectId
9341 * @param visible
9342 * @param display
9343 */
9344function sD(objectId, visible, display) { setVis(objectId, visible, display); }
9345function getVis(objectId) {
9346	return getStyleObject(objectId).display != "none";
9347}
9348function getStyleObject(objectId) {
9349	if (document.getElementById && document.getElementById(objectId)) {
9350		return document.getElementById(objectId).style;
9351	} else if (document.all && document.all(objectId)) {
9352		return document.all(objectId).style;
9353	} else {
9354		incompatible();
9355		return false;
9356	}
9357}
9358function setStatus(msg) {
9359	window.status = msg;
9360}
9361function bookmark() {
9362	window.external.AddFavorite(window.location.href, window.document.title);
9363}
9364function cf(action, newWindow) {
9365	var f = document.createElement("FORM");
9366	f.method = "POST";
9367	f.action = action;
9368	if (newWindow)
9369		f.target = '_blank';
9370	document.body.appendChild(f);
9371	return f;
9372}
9373function cfi(parentForm, name, value) {
9374	var i = document.createElement("INPUT");
9375	i.type = "hidden";
9376	i.name = name;
9377	i.value = value;
9378	parentForm.appendChild(i);
9379}
9380function postLink(a) {
9381	var SID;
9382	postTo(a.href, { "SID": SID });
9383}
9384function postToTarget(url, target) {
9385	var f = cf(url, arguments[3]);
9386	var v = arguments[2];
9387	for (var n in v) cfi(f, n, v[n]);
9388	f.target = target;
9389	f.submit();
9390	return false;
9391}
9392function postTo(url) {
9393	if (url != null && (url.toLowerCase().indexOf("payall.xml") >= 0 ||
9394		url.toLowerCase().indexOf("order") >= 0)) {
9395		setSave(false);
9396		url = Sequiter.QueryString.AddPersistedQueryStringValuesToUrl(url, { ignoredValues: ['code', 'file'] });
9397	}
9398	var f;
9399
9400	if (cssua && (cssua.ua.safari && cssua.ua.mac_os_x)) {
9401		f = cf(url, false);
9402		if (arguments[2]) {
9403			f.target = 'view';
9404			window.open('', 'view');
9405		}
9406	}
9407	else
9408		f = cf(url, arguments[2]);
9409
9410	var v = arguments[1];
9411	for (var n in v) cfi(f, n, v[n]);
9412	f.submit();
9413	return false;
9414}
9415function postToFinalOrderPage(url, productCode, options) {
9416	var productString = "code=" + productCode + ";license=";
9417	var selectedString = ";selected=";
9418	for (var i = 0; i < options.length; i++) {
9419		productString += (i > 0 ? "," : "") + options[i];
9420		selectedString += (i === 0 ? options[i] + ":::" : "");
9421	}
9422	var finalUrl = Sequiter.QueryString.AddPersistedQueryStringValuesToUrl(url);
9423	postTo(finalUrl, {
9424		products: productString + selectedString,
9425		sstring: "",
9426		from: "product_selection"
9427	});
9428}
9429function isInput(ctl) {
9430	return ctl.tagName == "INPUT" || ctl.tagName == "TEXTAREA" || ctl.tagName == "SELECT";
9431}
9432function findFirstInput(nodes) {
9433	for (i = 0; i < nodes.length; i++) {
9434		if (isInput(nodes[i])) {
9435			return nodes[i];
9436		}
9437		ctl = findFirstInput(nodes[i].childNodes);
9438		if (ctl != null) {
9439			return ctl;
9440		}
9441	}
9442	return null;
9443}
9444function r(c) {
9445	var d = "inline";
9446	if (arguments.length > 1) d = arguments[1];
9447	if (c.style.display != "none") {
9448		c.style.display = "none";
9449		c.style.display = d;
9450	}
9451}
9452function getFuncName(f) {
9453	return f.toString().match(/function ([^\(]+)/)[1];
9454}
9455
9456function getStyle(el, styleProp) {
9457	var y;
9458	if (el.currentStyle)
9459		y = el.currentStyle[styleProp];
9460	else if (window.getComputedStyle)
9461		y = document.defaultView.getComputedStyle(el, null).getPropertyValue(styleProp);
9462	return y;
9463}
9464/* takes an input and returns an empty string if the input is null. Otherwise, returns the input.*/
9465function nullToEmpty(inp) {
9466	if (inp === null) {
9467		return "";
9468	}
9469	else {
9470		return inp;
9471	}
9472}
9473/*Preload Images*/
9474var _preloadImages = [];
9475var _preloadedImages = [];
9476function preloadImages() {
9477	for (var i = 0; i < _preloadImages.length; i++) {
9478		var img = new Image();
9479		img.src = _preloadImages[i];
9480		_preloadedImages.push(img);
9481	}
9482	_preloadImages = [];
9483}
9484rE(window, "load", preloadImages);
9485/*End Preload Images*/
9486/* Repeaters and Accumulators */
9487function RepeaterHandler() { }
9488(function (rh) {
9489	/**
9490	 * Keeps track of what value position within repeaters is being considered.
9491	 * Keys are the id's of the repeaters, values are the position within the repeater, 1-indexed, as 0 is the special index indicating the repeater template instance
9492	 * See 'repeaterContext' in the c# code
9493	 * @type {Object.<string, int>}
9494	 */
9495	rh.Repeaters = {};
9496
9497	/**
9498	 * @typedef {object} AccumulatorInfo
9499	 * @property {string} ID the unique identifier of this accumulator
9500	 * @property {function} InitialValue @todo unknown
9501	 * @property {function} ChangeValue @todo unknown
9502	 */
9503
9504	/**
9505	 * @type {Object.<string, AccumulatorInfo>}
9506	 */
9507	rh.Accumulators = {};
9508	rh.Get = function (id) {
9509		var val = rh.Repeaters[id];
9510		if (val != null) return val;
9511		return 0;
9512	}
9513	rh.Set = function (id, val) {
9514		rh.Repeaters[id] = val;
9515	}
9516	rh.GetAccumulator = function (id) {
9517		return rh.Accumulators[id];
9518	}
9519	rh.SetAccumulator = function (id, val) {
9520		rh.Accumulators[id] = val;
9521	}
9522	rh.ChangeAccumulator = function (id, val) {
9523		rh.Accumulators[id] += val;
9524	}
9525	rh.InitAccumulators = function (accumInfo) {
9526		for (var i = 0; i < accumInfo.length; ++i) {
9527			rh.SetAccumulator(accumInfo[i].ID, accumInfo[i].InitialValue());
9528		}
9529	}
9530	rh.ChangeAccumulators = function (accumInfo) {
9531		for (var i = 0; i < accumInfo.length; ++i) {
9532			rh.ChangeAccumulator(accumInfo[i].ID, accumInfo[i].ChangeValue());
9533		}
9534	}
9535	rh.ClearAccumulators = function (accumInfo) {
9536		for (var i = 0; i < accumInfo.length; ++i) {
9537			rh.SetAccumulator(accumInfo[i].ID, null);
9538		}
9539	}
9540	/**
9541	 * Defines the possible data types for a CombinationInformation object
9542	 * @readonly
9543	 * @enum {string}
9544	 */
9545	var combinationInformationDataTypes = Object.freeze({
9546		NUMBER: "Number",
9547		DATE: "Date",
9548		TIMESPAN: "TimeSpan",
9549		STRING: "String",
9550		BOOLEAN: "Boolean"
9551	});
9552
9553	/**
9554	 * Defines the possible combination types for a CombinationInformation object
9555	 * @readonly
9556	 * @enum {string}
9557	 */
9558	var combinationInformationComboTypes = Object.freeze({
9559		SUM: "sum",
9560		MAX: "max",
9561		MIN: "min",
9562		/** The values will be multiplied together */
9563		PRODUCT: "product",
9564		AND: "and",
9565		OR: "or",
9566		/** The values are assumed to be strings, and they will be concatenated as a comma separated list */
9567		COMMA_SEPARATED: ", ",
9568	});
9569
9570
9571	/**
9572	 * @typedef {object} CombinationInformation
9573	 * @property {combinationInformationDataTypes} type The type to treat the data as
9574	 * @property {combinationInformationComboTypes} combination The type of combination operator to use.
9575	 * @property {string} finalSeparator
9576	 */
9577
9578	/**
9579	 * Gets the initial value to work with depending on the combination and data types from the combo info.
9580	 * For some ComboTypes, the DataType will be forced (e.g. product always returns a number), but for others, if the DataType is unsupported (e.g. max does not support string) the result will be null.
9581	 * @param {CombinationInformation} comboInfo The combination settings to use
9582	 * @return {string|TimeSpan|boolean|null|Date|number}
9583	 */
9584	rh.GetLoopInitialValue = function (comboInfo) {
9585		switch (comboInfo.combination) {
9586			case combinationInformationComboTypes.SUM:
9587				if (comboInfo.type === "Number") return 0;
9588				else if (comboInfo.type === "TimeSpan") return new TimeSpan(0, 0, 0, 0, 0);
9589				break;
9590			case combinationInformationComboTypes.MAX:
9591				if (comboInfo.type === "Number") return Number.NEGATIVE_INFINITY;
9592				else if (comboInfo.type === "Date") return new Date(-8640000000000000);
9593				else if (comboInfo.type === "TimeSpan") return TimeSpan.MINIMUM;
9594				break;
9595			case combinationInformationComboTypes.MIN:
9596				if (comboInfo.type === "Number") return Number.POSITIVE_INFINITY;
9597				else if (comboInfo.type === "Date") return new Date(8640000000000000);
9598				else if (comboInfo.type === "TimeSpan") return TimeSpan.MAXIMUM;
9599				break;
9600			case combinationInformationComboTypes.PRODUCT:
9601				return 1;
9602			case combinationInformationComboTypes.AND:
9603				return true;
9604			case combinationInformationComboTypes.OR:
9605				return false;
9606			default:
9607				return "";
9608		}
9609		return null;
9610	}
9611	/**
9612	 * Combine two values, interpreting their values and combining according to the information in the comboInfo object.
9613	 * If val1 or val 2 are null, the non-null value is returned as is.
9614	 * If both are null, null is always returned.
9615	 * @param {string|TimeSpan|boolean|null|Date|number} val1 The value to be combined into
9616	 * @param {string|TimeSpan|boolean|null|Date|number} val2 The second value to combine into the first
9617	 * @param {CombinationInformation} comboInfo The settings to use for this combination
9618	 * @param {boolean} isFinal If this is the last combination in a set of combinations
9619	 * @return {*|TimeSpan|Date|number}
9620	 */
9621	rh.Combine = function (val1, val2, comboInfo, isFinal) {
9622		if (val1 == null) return val2;
9623		if (val2 == null) return val1;
9624
9625		switch (comboInfo.combination) {
9626			case combinationInformationComboTypes.SUM:
9627				if (comboInfo.type === "Number") return val1 + val2;
9628				if (comboInfo.type === "TimeSpan") return TimeSpan.Add(val1, val2);
9629				break;
9630			case combinationInformationComboTypes.PRODUCT:
9631				return val1 * val2;
9632				break;
9633			case combinationInformationComboTypes.MAX:
9634				if (comboInfo.type === "Number") return Math.max(val1, val2);
9635				else if (comboInfo.type === "Date") return new Date(Math.max(val1, val2));
9636				else if (comboInfo.type === "TimeSpan") return TimeSpan.Max(val1, val2);
9637				break;
9638			case combinationInformationComboTypes.MIN:
9639				if (comboInfo.type === "Number") return Math.min(val1, val2);
9640				else if (comboInfo.type === "Date") return new Date(Math.min(val1, val2));
9641				else if (comboInfo.type === "TimeSpan") return TimeSpan.Min(val1, val2);
9642				break;
9643			case combinationInformationComboTypes.AND:
9644				return val1 && val2;
9645				break;
9646			case combinationInformationComboTypes.OR:
9647				return val1 || val2;
9648				break;
9649			default:
9650				return ((val1 !== "" && val1 !== 0) ? val1 + (isFinal ? comboInfo.finalSeparator : comboInfo.combination) + val2 : val2);
9651				break;
9652		}
9653	}
9654
9655	/**
9656	 * For the given data type, returns the default combo type that should be used for it
9657	 * @param {combinationInformationDataTypes} dataType The date type to get the default for
9658	 * @return {combinationInformationComboTypes}
9659	 */
9660	function getDefaultCombinationInformationComboType(dataType){
9661		if (dataType === "Boolean") return combinationInformationComboTypes.AND;
9662		else if (dataType === "Number") return combinationInformationComboTypes.SUM;
9663		else if (dataType === "TimeSpan" || dataType === "Date") return combinationInformationComboTypes.MAX;
9664		else return combinationInformationComboTypes.COMMA_SEPARATED;
9665	}
9666
9667	/**
9668	 *
9669	 * @param {string}
9669 repID The id of the repeater to loop through
9670	 * @param {int} max The number of instances to loop through (auto detection of instances is not supported, and so this value must be provided)
9671	 * @param {function} valueFunc The function that is called after the the 'target instance' of a repeater is set to refer the the instance we wish to get the value of. Should return the value of that instance. If it returns "" the value is ignored
9672	 * @param {CombinationInformation} [comboInfo] Settings for how values will be combined. If not provided, assumed to be a String data type, with the default string combo type
9673	 * @param {AccumulatorInfo} accumInfo @todo unknown
9674	 * @return {*}
9675	 */
9676	rh.Loop = function (repID, max, valueFunc, comboInfo, accumInfo) {
9677		var initPos;
9678		if (repID) initPos = rh.Get(repID);
9679		if (!accumInfo) accumInfo = [];
9680		if (typeof (comboInfo) != "object") comboInfo = {};
9681		if (!comboInfo.combination) {
9682			comboInfo.combination = getDefaultCombinationInformationComboType(comboInfo.type);
9683		}
9684		if (!comboInfo.finalSeparator) comboInfo.finalSeparator = comboInfo.combination;
9685		var vals = [];
9686		var valTemp;
9687		rh.InitAccumulators(accumInfo);
9688		for (var i = 1; i <= max; ++i) {
9689			if (repID) rh.Set(repID, i);
9690			rh.ChangeAccumulators(accumInfo);
9691			valTemp = valueFunc();
9692			if (valTemp !== "") vals.push(valTemp);
9693		}
9694		if (repID) rh.Set(repID, initPos);
9695		rh.ClearAccumulators(accumInfo);
9696		var retVal = rh.GetLoopInitialValue(comboInfo);
9697		for (var i = 0; i < vals.length; ++i) retVal = rh.Combine(retVal, vals[i], comboInfo, i === (vals.length - 1));
9698		return retVal;
9699	}
9700
9701}(RepeaterHandler))
9702/* End Repeaters and Accumulators */
9703
9704$(window).on("scroll", function () {
9705	if ($("html").is(".supportsMobile.sm") && $("html").hasClass("LD") && $("form").hasClass("firstPage") && $("#expFaqContent").length && isFluidLayout()) {
9706		var scroll = $(window).scrollTop();
9707		if (scroll >= $('#expFaqContent').offset().top) {
9708			$("#expFaqContent").addClass("addBackToTop");
9709		}
9710		else {
9711			if ($("#expFaqContent").hasClass("addBackToTop")) {
9712				$("#expFaqContent").removeClass("addBackToTop");
9713			}
9714		}
9715
9716		if ($(window).scrollTop() + $(window).height() < $(document).height() - $("#footer").height()) {
9717			$('.backToTop').css("position", "fixed");
9718			$('.backToTop').css("bottom", "15px");
9719		}
9720		if ($(window).scrollTop() + $(window).height() > $(document).height() - $("#footer").height()) {
9721			$('.backToTop').css("position", "absolute");
9722			$('.backToTop').css("bottom", "-55px");
9723
9724		}
9725	}
9726
9727	if ($("html").is(".supportsMobile.sm") && $("html").hasClass("LD") && $("form").hasClass("previewPage") && isFluidLayout()) {
9728		if ($(window).scrollTop() + $("a.backToTop").height() + 402 > $('.contractPreviewWrapper').offset().top + $('.contractPreviewWrapper').height()) {
9729			$('a.backToTop').addClass("bottom");
9730			$('a.backToTop').removeClass("fixed");
9731		}
9732		else {
9733			$('a.backToTop').addClass("fixed");
9734			$('a.backToTop').removeClass("bottom");
9735		}
9736	}
9737});
9738
9739$(function () {
9740	(document.body).oncopy = function (event) {
9741		if ($('.contractPreviewWrapper').length > 0 && $('.contractPreviewWrapper').is(":visible") && !$('.paymentPageLoaded').length > 0 && !$('.Selection').length > 0 && !$('.editor').length > 0 && $('.LD').length > 0 ||
9742         $('.LC').length > 0 && $('.unlicensed').length > 0 && $('.contractPreviewWrapper').length > 0 && $('.contractPreviewWrapper').is(":visible")) {
9743			if (cssua.ua.ie) {
9744				window.clipboardData.setData('Text', 'Copying Disabled!');
9745				event.preventDefault();
9746			}
9747
9748			else {
9749				var contractClass = typeof ($(".contract")[0]);
9750				var contractId = typeof ($("#contract")[0]);
9751				var contractClassCopied;
9752				var contractIdCopied;
9753
9754				if ((contractClass && contractId) !== "undefined") {
9755					contractClassCopied = window.getSelection().containsNode($(".contract")[0], true);
9756					contractIdCopied = window.getSelection().containsNode($("#contract")[0], true);
9757				}
9758				else if (contractClass !== "undefined") {
9759					contractClassCopied = window.getSelection().containsNode($(".contract")[0], true);
9760				}
9761				else {
9762					contractIdCopied = window.getSelection().containsNode($("#contract")[0], true);
9763				}
9764				if (contractClassCopied || contractIdCopied) {
9765					event.clipboardData.setData('text/plain', 'Copying Disabled!');
9766					event.preventDefault();
9767				}
9768			}
9769		}
9770	}
9771});
9772
9773/*Used in MyDocuments and EstateDashboard*/
9774function humanFileSize(size) {
9775	if (size == 0) {
9776		return '0 B';
9777	}
9778	var i = Math.floor(Math.log(size) / Math.log(1024));
9779	return (size / Math.pow(1024, i)).toFixed(2) * 1 + ' ' + ['B', 'KB', 'MB', 'GB', 'TB'][i];
9780};
9781
9782/* Some functions to support regular expression repeaters */
9783function regExMatch(regEx, check, caseSensitive, position) {
9784	if (position == 0) return '';
9785	let matches = check.match(new RegExp(regEx, (!caseSensitive ? 'i' : '') + 'g'));
9786	if (matches == null || position >
9786 matches.length) throw 'invalid position in regular expression matches';
9787	return matches[position - 1];
9788}
9789
9790function regExMatches(regEx, check, caseSensitive) {
9791	let val = '';
9792	let matches = check.match(new RegExp(regEx, (!caseSensitive ? 'i' : '') + 'g'));
9793	if (matches == null) return '';
9794	for (let i = 0; i < matches.length; ++i) {
9795		if (i > 0) val += ', ';
9796		val += matches[i];
9797	}
9798	return val;
9799}
9800/* End support for regular expression repeaters */
9801/* End Include miscellaneous */
9802
9803/* Include orderService */
9804function postToFinalOrderPage(url, productCode, options) {
9805	var productString = "code=" + productCode + ";license=";
9806	var selectedString = ";selected=";
9807	for (var i = 0; i < options.length; i++) {
9808		productString += (i > 0 ? "," : "") + options[i];
9809		selectedString += (i == 0 ? options[i] + ":::" : "");
9810	}
9811	postTo(url, {
9812		products: productString + selectedString,
9813		sstring: "",
9814		from: "product_selection"
9815	});
9816}
9817function submitOrderToPaymentPage(productCode, productName, contractId, buyOptionName, countryCode, regionCode) {
9818	if (countryCode === undefined)
9819		countryCode = null;
9820	if (regionCode === undefined)
9821		regionCode = null;
9822
9823	var parameters = {
9824		productCode: productCode,
9825		countryCode: countryCode,
9826		regionCode: regionCode
9827	};
9828
9829	$.ajax({
9830		url: '/OrderService/index.asmx/GetPaymentPageUrl',
9831		type: 'POST',
9832		contentType: "application/json; charset=utf-8",
9833		dataType: "json",
9834		data: JSON.stringify(parameters),
9835		success: function (data) {
9836			if (contractId === "")
9837				postToFinalOrderPage(data['d'], productName, buyOptionName);
9838			else
9839				postToYearlyUpgradePage(data['d'], contractId, productName, buyOptionName);
9840		},
9841		error: function (error) {
9842			var errorMsg = "Sorry, an error has occurred. Please refresh your browser or try again later.";
9843			alert(errorMsg, { title: "Error" })
9844		}
9845	});
9846}
9847
9848function postToYearlyUpgradePage(url, contractId, productCode, options) {
9849	var productString = "code=" + productCode + ";license=";
9850	var selectedString = ";selected=";
9851	for (var i = 0; i < options.length; i++) {
9852		productString += (i > 0 ? "," : "") + options[i];
9853		selectedString += (i == 0 ? options[i] + ":::" : "");
9854	}
9855	postTo(url, {
9856		upgradeSubscription: contractId,
9857		products: productString + selectedString,
9858		sstring: "",
9859		from: "product_selection"
9860	});
9861}
9862
9863/* End Include orderService */
9864
9865/* Include events */
9866/**
9867 * Register an function to fire on a given event. 
9868 * Alias for jQuery's $(s)on(evt, f)
9869 * Immediately executes the function if the load event has already fired and 'load' is any one of the listed events. 
9870 * If executed immediately for this reason, 'load' will be removed from the event list before registration.
9871 * For backwards compatibility, automatically removes 'on' prefix for only the FIRST listed event. You should not pass events with the 'on' prefix.
9872 * @param {HTMLElement} s A document node that will listen for the event
9873 * @param {string} evt The name of the event this function will be called on 
9874 * @param {function} f The function that will be called when the event is fired
9875 * @param {boolean} [ex] 'Immediately Execute', if true, the function is immediately executed after it is registered
9876 */
9877function registerEvent(s,evt,f,ex) {
9878   if(s) {
9879      var eventsNoPrefix=evt.replace(/^on(.+)/,"$1");
9880      var isRegisteringLoadEvent = false;
9881      var splitEvents = eventsNoPrefix.split(" ");
9882      if(!ex && s == window && loadEventFired()){
9883         var loadEventIndex = null;
9884         for(var i = 0; i < splitEvents.length; i++){
9885            if(splitEvents[i] === "load") {
9886               loadEventIndex = i;
9887               ex = true; 
9888               break;
9889            }
9890         }
9891         if(loadEventIndex !== null) splitEvents.splice(loadEventIndex, 1);
9892      }
9893      $(s).on(splitEvents.join(" "), f);
9894   }
9895   if(ex) f();
9896}
9897
9898/**
9899 * Minified alias for registerEvent(...).
9900 * Do not add additional logic here.
9901 * @param {Node} s A document node that will listen for the event
9902 * @param {string} evt The name of the event this function will be called on
9903 * @param {function} f The function that will be called when the event is fired
9904 * @param {boolean} [ex] 'Immediately Execute', if true, the function is immediately executed after it is registered
9905 */
9906function rE(s,evt,f,ex) { registerEvent(s,evt,f,ex); }
9907function loadEventFired() { return document.readyState == "complete" || document.readyState == "loaded"; }
9908function fE(s,evt){
9909   if(s){
9910      var ev=evt.replace(/^on(.+)/,"$1");
9911      if(typeof($) == "function"){
9912         $(s).trigger(ev);
9913      }
9914      else if(s.fireEvent){
9915         s.fireEvent('on'+ev);
9916      }
9917      else if(document.createEvent){
9918         var e=document.createEvent('Events');
9919         e.initEvent(ev,true,false);
9920         s.dispatchEvent(e);
9921      }
9922   }
9923}
9924function registerOnLoadScript(script){registerEvent(window,"load",script);}
9925function registerPostStartUpScript(script){if(typeof($)=="function"){$(window).on("postStartUp",script);return true;}return false;}
9926/* End Include events */
9927
9928/* Include utility */
9929var agent = (function () { try { return navigator.userAgent; } catch (e) { return 'MSIE 9.0'; } }()).toLowerCase();
9930function moveObject(objectId, newXCoordinate, newYCoordinate) {
9931	/* get a reference to the cross-browser style object and make sure the object exists*/
9932	var styleObject = getStyleObject(objectId);
9933	if (styleObject) {
9934		styleObject.left = newXCoordinate;
9935		styleObject.top = newYCoordinate;
9936		return true;
9937	} else {
9938		/* we couldn't find the object, so we can't very well move it*/
9939		return false;
9940	}
9941}
9942
9943function switchIfDone(the_form, this_div, next_div) {
9944
9945	var complete = true;
9946	for (var loop = 0; loop < the_form.elements.length; loop++) {
9947		if (the_form.elements[loop].value == "") {
9948			complete = false;
9949		}
9950	}
9951	if ((complete == true) && (next_div == "finished")) {
9952		submitTheInfo();
9953	}
9954	else if (complete == true) {
9955		switchDiv(this_div, next_div);
9956	} else {
9957		alert('please complete the form before moving on');
9958	}
9959}
9960
9961function switchDiv(this_div, next_div) {
9962	if (getStyleObject(this_div) && getStyleObject(next_div)) {
9963		setVisDisp(this_div, false);
9964		setVisDisp(next_div, true);
9965	}
9966}
9967
9968function escapeChars(theString) {
9969	var regexp = /&/g;
9970	var regexp2 = /#/g;
9971	var regexp3 = /\r\n/g;
9972	var regexp4 = /\n/g;
9973	var regexp5 = /\"/g;
9974	theString = theString.replace(regexp, "%^");
9975	theString = theString.replace(regexp2, "%*");
9976	theString = theString.replace(regexp3, "<br>");
9977	theString = theString.replace(regexp4, "<br>");
9978	theString = theString.replace(regexp5, "%)");
9979	return theString;
9980}
9981
9982function submitTheInfo() {
9983}
9984
9985
9986function hideAll(hidden_div) {
9987	setVisDisp("hidden_div", false);
9988}
9989
9990
9991function checkboxcheck(entry, HiddenDiv) {
9992	if (entry) {
9993		if (entry.checked) {
9994			setVisDisp(HiddenDiv, true);
9995		}
9996		else {
9997			setVisDisp(HiddenDiv, false);
9998		}
9999	}
10000}
10001
10002
10003function isNumber(inputVal) {
10004	oneDecimal = false;
10005	inputStr = inputVal.toString();
10006	for (var i = 0; i < inputStr.length; i++) {
10007		var oneChar = inputStr.charAt(i);
10008		if (oneChar == "." && !oneDecimal) {
10009			oneDecimal = true;
10010			continue;
10011		}
10012		if (oneChar < "0" || oneChar > "9") {
10013			if (oneChar != ",") {
10014				alert("Please make sure entries are numbers.");
10015				return false;
10016			}
10017		}
10018	}
10019	return true;
10020}
10021
10022/*
10023   * Restricts the onkeypress event of the textbox with the given id to only numeric input.
10024   * Optional 3rd, 4th and 5th arguments are the number of decimal places (0 - inf),
10025   * and the min and max values of the textbox, respectively. To leave these
10026   * unrestricted, either do not specify them, or specify them as "".
10027   */
10028function okpRestrictNumber(event, id) {
10029	var decimals = '', maxval = '', minval = '';
10030	var isIE = agent.indexOf("msie") > -1;
10031	if (typeof (arguments[2]) != "undefined")
10032		decimals = arguments[2];
10033	if (typeof (arguments[3]) != "undefined")
10034		minval = arguments[3];
10035	if (typeof (arguments[4]) != "undefined")
10036		maxval = arguments[4];
10037
10038	var iKeyCode = getKeyCode(event);
10039	var tbox = document.getElementById(id);
10040	var thisval = tbox.value;
10041
10042	var caretStart, caretEnd;
10043	if (isIE && document.selection) {
10044		tbox.selectionStart = Math.abs(document.selection.createRange().moveStart("character", -1000000));
10045		tbox.selectionEnd = Math.abs(document.selection.createRange().moveEnd("character", -1000000));
10046	}
10047	caretStart = tbox.selectionStart;
10048	caretEnd = tbox.selectionEnd;
10049
10050	var newval = '0';
10051	var dec = thisval.indexOf('.');
10052	var neg = thisval.indexOf('-');
10053
10054	if (decimals == 0) {
10055		if ((iKeyCode >= 32 && iKeyCode < 48 && (iKeyCode != 45 || neg != -1)) ||
10056			iKeyCode > 57 || iKeyCode == 36)
10057			return false;
10058	}
10059	else {
10060		if ((iKeyCode >= 41 && iKeyCode < 46 && (iKeyCode != 45 || neg != -1)) ||
10061			iKeyCode == 47 ||
10062			(iKeyCode >= 33 && iKeyCode < 41) ||
10063			iKeyCode > 57 ||
10064			(iKeyCode == 46 && dec > -1 && (dec < caretStart || dec >= caretEnd)))
10065			return false;
10066		if (decimals != '') {
10067			if (dec == -1 && thisval.length - caretEnd > decimals)
10068				return false;
10069			if (dec > -1 && thisval.length - dec > decimals
10070				&& iKeyCode >= 32 && (caretStart > dec && caretStart == caretEnd))
10071				return false;
10072		}
10073	}
10074	if (minval !== '' && minval >= 0 && iKeyCode == 45)
10075		return false;
10076
10077	if (iKeyCode - 48 >= 0)
10078		newval = thisval.substring(0, caretStart) + (iKeyCode - 48).toString() + thisval.substring(caretEnd, thisval.length);
10079	if (newval == '' || !isNumeric(newval))
10080		newval = '0';
10081	newval = parseFloat(newval);
10082	if (maxval != '') {
10083		if (newval > maxval)
10084			return false;
10085	}
10086	if (minval != '') {
10087		if (newval < minval && newval != '')
10088			return false;
10089	}
10090
10091	return true;
10092}
10093
10094/*
10095   * Returns true if inputVal is a number, false otherwise
10096   */
10097function isNumeric(inputVal) {
10098	oneDecimal = false;
10099	inputStr = inputVal.toString();
10100	for (var i = 0; i < inputStr.length; i++) {
10101		var oneChar = inputStr.charAt(i);
10102		if (oneChar == "." && !oneDecimal) {
10103			oneDecimal = true;
10104			continue;
10105		}
10106		if (oneChar < "0" || oneChar > "9") {
10107			if (oneChar != "," && oneChar != "-") {
10108				return false;
10109			}
10110		}
10111	}
10112	return true;
10113}
10114
10115function checkIt(inputvar) {
10116	inputStr = inputvar.value
10117	if (isNumber(inputStr)) {
10118	} else {
10119		inputvar.focus()
10120		inputvar.select()
10121	}
10122}
10123
10124function funcChangeDiv(inputvar, selectedvalue, HiddenDiv) {
10125	if (inputvar) {
10126		if (inputvar.selectedIndex == selectedvalue) {
10127			setVisDisp(HiddenDiv, true);
10128		} else {
10129			setVisDisp(HiddenDiv, false);
10130		}
10131	}
10132}
10133
10134function funcradChangeDiv(selectedvalue, HiddenDiv) {
10135	if (selectedvalue == "true") {
10136		setVisDisp(HiddenDiv, true);
10137	} else {
10138		setVisDisp(HiddenDiv, false);
10139	}
10140}
10141
10142function funcNotChangeDiv(inputvar, selectedvalue, HiddenDiv) {
10143	if (inputvar) {
10144		if (inputvar.selectedIndex != selectedvalue) {
10145			setVisDisp(HiddenDiv, true);
10146		} else {
10147			setVisDisp(HiddenDiv, false);
10148		}
10149	}
10150}
10151
10152function redisplay(db, openingornot, divname) {
10153	for (var i = 1; i < db.length; i++) {
10154		setVisDisp(db[i].divname, false);
10155	}
10156	if (openingornot == 'true') {
10157		setVisDisp(db[1].divname, true);
10158	}
10159	setVisDisp(divname, true);
10160}
10161
10162
10163function formatCurrency(num, dollarSign) {
10164	num = num.toString().replace(/\$|\,/g, '');
10165	if (isNaN(num)) {
10166		num = "0";
10167		return (num);
10168	} else {
10169		sign = (num == (num = Math.abs(num)));
10170		num = Math.floor(num * 100 + 0.50000000001);
10171		cents = num % 100;
10172		num = Math.floor(num / 100).toString();
10173		if (cents < 10) cents = "0" + cents;
10174		for (var i = 0; i < Math.floor((num.length - (1 + i)) / 3); i++) {
10175			num = num.substring(0, num.length - (4 * i + 3)) + ',' +
10176				num.substring(num.length - (4 * i + 3));
10177		}
10178		if (dollarSign == true) {
10179			return (((sign) ? '' : '-') + '$' + num + '.' + cents);
10180		} else {
10181			return (((sign) ? '' : '-') + num + '.' + cents);
10182		}
10183	}
10184}
10185function setStatus(msg) {
10186	status = msg;
10187}
10188function bookmark() {
10189	window.external.AddFavorite(window.location.href, window.document.title);
10190}
10191function printDocument() {
10192	if (window.print) {
10193		window.print();
10194	} else if (agent.indexOf("mac") != -1) {
10195		alert("Press Cmd-p to print your document.");
10196	} else {
10197		alert("Press Ctrl-p to print your document.");
10198	}
10199}
10200/* Gets the key code from the event object, if it's a keyboard event. */
10201function getKeyCode(event) {
10202	return event ? (event.which || event.keyCode || null) : null;
10203}
10204/* This function returns true if the event is a keypress of 0-9 or a .*/
10205function onlyNumeric(event) {
10206	var iKeyCode = getKeyCode(event);
10207	if ((iKeyCode >= 32 && iKeyCode <= 45) || iKeyCode == 47 || iKeyCode >= 58) {
10208		return false;
10209	}
10210	return true;
10211}
10212/* Only allow numeric characters and a single decimal. */
10213function onlyPercentage(event, id) {
10214	var iKeyCode = getKeyCode(event);
10215	var thisPercent = getObject(id).value;
10216	if ((iKeyCode >= 32 && iKeyCode < 46) || iKeyCode == 47 || iKeyCode > 57 ||
10217		(iKeyCode == 46 && thisPercent.indexOf('.') > -1)) {
10218		return false;
10219	}
10220	return true;
10221}
10222/* Only allow numeric characters and a single decimal.  Do not allow the user
10223	 to enter a value of zero (i.e. '0' is not allowed; '10' is) */
10224function onlyNonzeroPercentage(event, id) {
10225	var iKeyCode = getKeyCode(event);
10226	var thisPercent = getObject(id).value;
10227	/* Check for non-numeric characters */
10228	if ((iKeyCode >= 32 && iKeyCode < 46) || iKeyCode == 47 || iKeyCode > 57 ||
10229		(iKeyCode == 46 && thisPercent.indexOf('.') > -1)) {
10230		return false;
10231	}
10232	/* Check if a (leading) zero has been entered */
10233	if (iKeyCode == 48 && thisPercent.toString().length == 0) {
10234		return false;
10235	}
10236	return true;
10237}
10238/* Only allow alphabetical characters. */
10239function onlyAlpha(event) {
10240	var iKeyCode = getKeyCode(event);
10241	if ((iKeyCode >= 65 && iKeyCode <= 90) || (iKeyCode >= 97 && iKeyCode <= 122)
10242		|| iKeyCode == 8 || iKeyCode == 45 || iKeyCode == 46 || iKeyCode == 40 || iKeyCode == 41 || iKeyCode == 58 || iKeyCode == 44
10243		|| (iKeyCode >= 0 && iKeyCode <= 32)) {
10244		return true;
10245	}
10246	return false;
10247}
10248/* Only allow integer numeric values. */
10249function onlyInteger(event) {
10250	var iKeyCode = getKeyCode(event);
10251	if ((iKeyCode >= 32 && iKeyCode <= 43) || iKeyCode == 45 || iKeyCode == 47 || iKeyCode == 46 || iKeyCode >= 58) {
10252		return false;
10253	}
10254	return true;
10255}
10256function findPos(obj) {
10257	var curleft = curtop = 0;
10258	if (obj.offsetParent) {
10259		curleft = obj.offsetLeft
10260		curtop = obj.offsetTop
10261		while (obj = obj.offsetParent) {
10262			curleft += obj.offsetLeft
10263			curtop += obj.offsetTop
10264		}
10265	}
10266	return [curleft, curtop];
10267}
10268function changeFullCase(str, type) {
10269	if (type == "upperCase") return str.toUpperCase();
10270	else return str.toLowerCase();
10271}
10272
10273/**
10274 * Changes the case of letters in a string, depending on the requested change and type
10275 * @param {string} str The string to change the case of  
10276 * @param {string} type The type of change. If "upperCase" then the chosen characters will become uppercase, otherwise they will become lower case. 
10277 * @param {string} change The change to make.
10278 *    - "all" All characters will be affected
10279 *    - "first" Only the first character is affected
10280 *    - "sentence" The first letter of every sentence, determined as the first letter of the string then the first letter after each period
10281 *    - "word"(This is the expected value, but is really what happens for anything other than the above values) The first letter of every word
10282 * @return {string|*}
10283 */
10284function changeCase(str, type, change) {
10285	if (typeof (str) == "undefined" || str == null || str.length < 1) return "";
10286	if (change == "all") {
10287		return changeFullCase(str, type);
10288	}
10289	else if (change == "first") {
10290		return changeFullCase(str.substring(0, 1), type) + str.substring(1, str.length);
10291	}
10292	else {
10293		var val = "";
10294		var trimVal, start, words;
10295		if (change == "sentence") {
10296			words = str.split('.');
10297		}
10298		else {
10299			words = str.split(' ');
10300		}
10301		for (var c = 0; c < words.length; c++) {
10302			trimVal = words[c].replace(/^\s+/, "");
10303			start = words[c].length - trimVal.length;
10304			val += words[c].substring(0, start) + changeFullCase(words[c].substring(start, start + 1), type) + words[c].substring(start + 1, words[c].length);
10305			if (c != words.length - 1) {
10306				if (change == "sentence") {
10307					val += ".";
10308				}
10309				else {
10310					val += " ";
10311				}
10312			}
10313		}
10314		return val;
10315	}
10316}
10317/**
10318 * Parse a string into a number.
10319 * @param {string} input - The String to be parsed.
10320 * @param {number} [defaultVal=0] - The default number to use if the string can't be parsed.
10321 * @param {string} [decimalSeparator='.'] - The decimal separator
10322 */
10323function parseNum(input, defaultVal, decimalSeparator) {
10324	return Sequiter.Utility.ParseNum(input, { defaultVal: defaultVal, decimalSeparator: decimalSeparator });
10325}
10326
10327function entryTab(source, contentID) {
10328	var tabs = source.parentNode.parentNode.getElementsByTagName("A");
10329	for (var i = 0; i < tabs.length; i++) {
10330		if (tabs[i] == source) {
10331			tabs[i].setAttribute("class", "selected");
10332			tabs[i].setAttribute("className", "selected");
10333		} else {
10334			tabs[i].setAttribute("class", "");
10335			tabs[i].setAttribute("className", "");
10336		}
10337	}
10338	var divs = source.parentNode.parentNode.parentNode.getElementsByTagName("DIV");
10339	for (var i = 0; i < divs.length; i++) {
10340		if (divs[i].className == "entryTabPage") {
10341			if (divs[i].id == contentID) divs[i].style.display = "block";
10342			else divs[i].style.display = "none";
10343		}
10344	}
10345	source.blur();
10346	return false;
10347}
10348/*
10349   * Validate an email address.
10350   * Last Maintained: Oct 6, 2014 - Chris Poirier
10351   * Testing Page: http://test.lawdepot.com/temp/emailcheckV2.php
10352   * This is the preferred JS function. But for legacy purposes also update:
10353   * t:\pubroot\common\formvalidate.js: emailCheck
10354   * Other languages:
10355   *   PHP: t:\common\Email.php: validate_email
10356   *   .NET 2.0: $/VS2005/common/LawDepot/dev/LawDepot/Utility.cs: CheckEmail
10357   *   .NET 4.0: $/VS2005/common4/LawDepot/dev/LawDepot/Utility.cs: CheckEmail
10358   */
10359function checkEmail(emailStr) {
10360	/* Prepare the parameters*/
10361	emailStr = emailStr.toLowerCase();
10362	var output = (arguments.length == 2 && arguments[1]);
10363
10364	/* Special characters allowed in the user part*/
10365	var quotedUser = '"(\\\\"|[^"])+"';
10366	var atom = '([A-Za-z0-9!#%&`_=$\'*+?^|~.-])+';
10367	var word = "(" + atom + "|" + quotedUser + ")";
10368	var userPat = new RegExp("^" + word + "(\\." + word + ")*$");
10369
10370	/* Domain pattern (for IP addresses and named domains)*/
10371	var ipDomainPat = /^[\[]?(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})[\]]?$/;
10372	var domAtom = "[A-Za-z0-9-]+";
10373	var domainPat = new RegExp("^" + domAtom + "(\\." + domAtom + ")*$");
10374
10375	/* Ensure that the email is in the form <user>@<domain> and extract the user and domain parts.*/
10376	var emailPat = /^(.+)@(.+)$/;
10377	var matchArray = emailStr.match(emailPat);
10378	if (matchArray == null) {
10379		if (output) alert("This does not appear to be a valid email address, such as [email protected] (check @ and .).");
10380		return false;
10381	}
10382	var user = matchArray[1];
10383	var domain = matchArray[2];
10384
10385	/* Special characters (greater than 127 ascii code) are invalid.*/
10386	for (i = 0; i < user.length; i++) {
10387		if (user.charCodeAt(i) > 127) {
10388			if (output) alert("This does not appear to be a valid email address.  The user name (the part before the @ symbol) contains invalid characters.");
10389			return false;
10390		}
10391	}
10392
10393	/* User name cannot start or end with a dot*/
10394	if (user.charCodeAt(0) == 46 || user.charCodeAt(user.length - 1) == 46) {
10395		if (output) alert('This does not appear to be a valid email address.  The user name (the part before the @ symbol) cannot start or end with a dot.');
10396		return false;
10397	}
10398
10399	/* User name cannot contain 2 dots in a row*/
10400	if (user.indexOf('..') != -1) {
10401		if (output) alert('This does not appear to be a valid email address.  The user name (the part before the @ symbol) cannot contain 2 dots in a row.');
10402		return false;
10403	}
10404
10405	/* User name has a max of 64 characters*/
10406	if (user.length > 64) {
10407		if (output) alert("This does not appear to be a valid email address.  The user name (the part before the @ symbol) is longer than 64 characters.");
10408		return false;
10409	}
10410	/* The domain has a max of 253 characters*/
10411	if (domain.length > 253) {
10412		if (output) alert("This does not appear to be a valid email address.  The domain (the part after the @ symbol) is longer than 253 characters.");
10413		return false;
10414	}
10415	/* Check that the username has valid characters and is in the correct form*/
10416	if (user.match(userPat) == null) {
10417		if (output) alert("This does not appear to be a valid email address.  The user name (the part before the @ symbol) is not in the correct format or contains invali
10417d characters.");
10418		return false;
10419	}
10420
10421	/* Match IP domains and check that each part of the IP is between 0 and 255*/
10422	var IPArray = domain.match(ipDomainPat);
10423	if (IPArray != null) {
10424		for (var i = 0; i <= IPArray.length; i++) {
10425			if (IPArray[i] > 255 || IPArray[i] < 0) {
10426				if (output) alert("This does not appear to be a valid email address.  The IP address (the part after the @ symbol) is not valid.");
10427				return false;
10428			}
10429		}
10430		/* If we have an IP domain that got this far, then it is valid.*/
10431		return true;
10432	}
10433
10434	/* Split the domain into labels*/
10435	var domAtomPat = new RegExp("^" + domAtom + "$");
10436	var domArr = domain.split(".");
10437	var len = domArr.length;
10438
10439	/* Check that there are at least 2 labels in the domain*/
10440	if (len < 2) {
10441		if (output) alert("This does not appear to be a valid email address.  The domain name (the part after the @ symbol) must contain 2 parts, separated by dots.");
10442		return false;
10443	}
10444
10445	/* Check each label in the domain*/
10446	for (i = 0; i < len; i++) {
10447		/* Check that it contains only letters, numbers and hyphens*/
10448		if (domArr[i].search(domAtomPat) == -1) {
10449			if (output) alert("This does not appear to be a valid email address.  The domain name (the part after the @ symbol) contains invalid characters.");
10450			return false;
10451		}
10452		/* Each part of the domain has a max of 63 characters*/
10453		if (domArr[i].length > 63) {
10454			if (output) alert("This does not appear to be a valid email address.  Part of the domain name (the part after the @ symbol, separated by dots) is longer than 63 characters.");
10455			return false;
10456		}
10457		/* Hyphens cannot start or end a label in the domain name*/
10458		if (domArr[i].charCodeAt(0) == 45 || domArr[i].charCodeAt(domArr[i].length - 1) == 45) {
10459			if (output) alert("This does not appear to be a valid email address.  Part of the domain name (the part after the @ symbol, separated by dots) starts or ends with a hyphen (-).");
10460			return false;
10461		}
10462	}
10463
10464    /* Check the TLD */
10465    const tld = domArr[len - 1];
10466    if (tld.length < 2 || !/^[a-z]+$/i.test(tld)) {
10467        if (output) alert("This does not appear to be a valid email address.  The top-level domain (the last part of the domain) must be at least two letters and contain only letters.");
10468        return false;
10469    }
10470
10471
10472	/* If we got this far, the email address is valid. */
10473	return true;
10474}
10475function showItems(id, numToShow, totalNum) {
10476	for (var i = 0; i < totalNum; ++i) {
10477		sD(id + '__' + i, i < numToShow || numToShow <= 0);
10478	}
10479}
10480function HideBodyToolTips(evt) {
10481	if (typeof (Telerik) != 'undefined') {
10482		if (Telerik.Web.UI.RadToolTip != undefined) {
10483			var toolTip = Telerik.Web.UI.RadToolTip.getCurrent();
10484			if (toolTip != null) {
10485				HideToolTip(null, toolTip.get_targetControl(), false, evt);
10486			}
10487		}
10488	}
10489}
10490rE(window, "load", function () { if (typeof (Telerik) != 'undefined') { $('body').on('touchstart', HideBodyToolTips); } });
10491if (typeof ($) == 'function') {
10492	$(document).on("mousemove", function (evt) {
10493		currentMousePos.x = evt.pageX;
10494		currentMousePos.y = evt.pageY;
10495	});
10496}
10497var currentMousePos = { x: -1, y: -1 };
10498if (typeof (jQuery) == "function") {
10499	(function ($) {
10500		'use strict';
10501		$.widget('ui.tooltip', $.ui.tooltip, {
10502			_open: function (event, src) {
10503				var tooltip = TooltipHandler.FindTooltip(src);
10504				if (fullMobileSupport() && typeof (tooltip.HelpID) == "string") {
10505					if (typeof (cssua.ua.mobile) == "undefined" && event.type == "mouseover") {
10506						event.preventDefault();
10507						event.stopPropagation();
10508						return false;
10509					}
10510					else {
10511						$(src).trigger("blur");
10512						showFAQDialog(tooltip.HelpID);
10513					}
10514				}
10515				else {
10516					var orgPos = this.options.position;
10517					this.options.position = this._getPos(src);
10518					var res = this._superApply(arguments);
10519					this.options.position = orgPos;
10520				}
10521				return res;
10522			},
10523			_tooltip: function (src) {
10524				var res = this._superApply(arguments);
10525				if (cssua && cssua.ua && cssua.ua.mobile && cssua.ua.safari) $(document.activeElement).trigger("blur");
10526				var tooltip = TooltipHandler.FindTooltip(src);
10527				if (tooltip != null && typeof (tooltip.width) == "number" && !fullMobileSupport()) {
10528					res.tooltip.css("maxWidth", "none");
10529					res.tooltip.width(tooltip.width);
10530				}
10531				return res;
10532			},
10533			_show: function () {
10534				var res = this._superApply(arguments);
10535				$.each(this.tooltips, function (i, s) {
10536					if (cssua && cssua.ua && cssua.ua.mobile && cssua.ua.safari && elementHasDocument(s.tooltip)) {
10537						var offset = s.tooltip.offset();
10538						if (offset.top < 0 && elementHasDocument(s.element)) {
10539							offset.top = s.element.offset().top + s.element.outerHeight(true) + 15;
10540							s.tooltip.offset(offset);
10541						}
10542					}
10543				});
10544				return res;
10545			},
10546			repos: function () {
10547				var s = this;
10548				$.each(this.tooltips, function (t, e) { s._repos(e); });
10549			},
10550			_repos: function (e) {
10551				if (typeof (e) == "undefined" || e == null || typeof (e.tooltip) == "undefined" || e.tooltip == null) return;
10552				var docElem = (e.tooltip.ownerDocument || window.document).documentElement;
10553				if ($.contains(docElem, e.tooltip) && e.tooltip.is(":visible")) {
10554					e.tooltip.position($.extend({}, this._getPos(e.element), { of: e.element }));
10555				}
10556			},
10557			_getPos: function (e) {
10558				if (fullMobileSupport()) return { my: "left top+15", at: "left bottom", collision: "flipfit flip" };
10559				else {
10560					var tooltip = TooltipHandler.FindTooltip(e);
10561					if (tooltip != null && typeof (tooltip.position) == "object") {
10562						return $.extend({}, this.options.position, tooltip.position);
10563					}
10564				}
10565				return $.extend({}, this.options.position);
10566			}
10567		});
10568		var originalTooltip = $.fn.tooltip;
10569		$.fn.tooltip = function () {
10570			if (arguments.length > 1 && typeof (arguments[1]) == "string" && arguments[1].indexOf('ToolTipManager') >= 0) {
10571
10572				var content = arguments[0];
10573				var contentFunc;
10574				if (typeof (content) == "function") contentFunc = content;
10575				else contentFunc = function () { return content; };
10576
10577				var position = null;
10578				var atypos = "bottom";
10579				var atxpos = "right";
10580				var meypos = "top";
10581				var mexpos = "left";
10582				var width = null;
10583				if (arguments.length >= 3 && typeof (arguments[2]) == "string") {
10584					var pos = arguments[2].toLowerCase();
10585					if (pos.indexOf("top") >= 0) {
10586						atypos = "top";
10587						meypos = "bottom";
10588					}
10589					else if (pos.indexOf("bottom") >= 0) {
10590						atypos = "bottom";
10591						meypos = "top";
10592					}
10593					else {
10594						atypos = "center";
10595						meypos = "center";
10596					}
10597					if (pos.indexOf("left") >= 0) {
10598						atxpos = "left";
10599						mexpos = "right";
10600					}
10601					else if (pos.indexOf("right") >= 0) {
10602						atxpos = "right";
10603						mexpos = "left";
10604					}
10605					else {
10606						atxpos = "center";
10607						mexpos = "center";
10608					}
10609				}
10610				if (arguments.length >= 7 && arguments[6]) {
10611
10612					if (typeof (arguments[3]) == "number") {
10613						width = arguments[3];
10614					}
10615					if (typeof (arguments[4]) == "number") {
10616						if (arguments[4] > 0) mexpos += "+" + arguments[4];
10617						else if (arguments[4] < 0) mexpos += arguments[4];
10618					}
10619					if (typeof (arguments[5]) == "number") {
10620						if (arguments[5] > 0) meypos += "+" + arguments[5];
10621						else if (arguments[5] < 0) meypos += arguments[5];
10622					}
10623				}
10624				position = { my: mexpos + " " + meypos, at: atxpos + " " + atypos };
10625
10626				this.each(function () {
10627					var jqObj = $(this);
10628					var selector = "";
10629					while (jqObj.length > 0 && !jqObj.attr('id')) {
10630						selector = jqObj.prop("tagName") + (jqObj.attr('class') ? '.' + jqObj.attr('class').replace(/ /g, '.') : "") + " " + selector;
10631						jqObj = jqObj.parent();
10632					}
10633					if (jqObj.length > 0) selector = "#" + jqObj.attr('id') + " " + selector;
10634					TooltipHandler.Register(selector, { content: contentFunc, position: position, width: width });
10635				});
10636			}
10637			else {
10638				return originalTooltip.apply(this, arguments);
10639			}
10640		}
10641	}(jQuery));
10642}
10643
10644/* Android mobile tool-tip pop up window re-size fix */
10645$(window).on("resize", function () {
10646	if ($(".ua-mobile").length && (typeof isEsateDashboardPage !== "undefined" && !isEsateDashboardPage)) {
10647		hideAllToolTips();
10648	}
10649});
10650/* iPhone mobile tool-tip pop up carried-over to next page fix */
10651setTimeout(function () {
10652	$("body").on("mousedown", ".largeProceedButton", function () {
10653		if ($(".ua-mobile").length) {
10654			hideAllToolTips();
10655		}
10656	});
10657}, 0);
10658
10659function hideAllToolTips() {
10660	$(TooltipHandler.GetItems()).trigger("blur").trigger("mouseleave");
10661}
10662
10663function TooltipHandler() { }
10664(function (tt) {
10665	tt.Info = {};
10666	tt.Register = function (selector, tooltip) {
10667		tt.Info[selector] = tooltip;
10668		$(document).tooltip("option", "items", tt.GetItems());
10669	}
10670	tt.GetItems = function () {
10671		var items = "";
10672		for (var key in tt.Info) {
10673			if (items.length > 0) items += ",";
10674			items += key;
10675		}
10676		return items;
10677	}
10678	tt.FindTooltip = function (ele) {
10679		for (var key in tt.Info) {
10680			if (ele.is(key)) return tt.Info[key];
10681		}
10682		return null;
10683	}
10684	tt.Content = function (ele) {
10685		var tooltip = tt.FindTooltip(ele);
10686		if (tooltip != null) {
10687			if (typeof (tooltip.content) == "function") return tooltip.content();
10688			else return tooltip.content;
10689		}
10690		return "";
10691	}
10692	tt.Init = function () {
10693		$(document).tooltip({
10694			items: "",
10695			content: function () { return tt.Content($(this)); },
10696			close: tt.CloseHandler,
10697			open: function (event, ui) {
10698				if (typeof isSlateV3 == "function" && isSlateV3()) {
10699					var curTooltip = $(ui.tooltip);
10700					var trigerredByElement = event.originalEvent.target || event.originalEvent.srcElement;
10701					if (trigerredByElement.parentElement.classList.contains("groupHelp") || trigerredByElement.parentElement.parentElement.classList.contains("groupHelp")) {
10702						curTooltip.addClass("groupHelpTooltip");
10703						paginateTooltipContent(curTooltip);
10704					} else {
10705						if (cssua.ua.mobile) {
10706							displayMobileTooltip(curTooltip);
10707							return false;
10708						}
10709					}
10710
10711				}
10712			}
10713		});
10714	}
10715	tt.FinishAnimation = function () {
10716		$('.ui-tooltip').finish();
10717	}
10718	tt.CloseHandler = function (event, ui) {
10719		ui.tooltip.on("mouseenter",
10720			function () {
10721				$(this).stop(true).fadeTo(500, 1);
10722			}).on("mouseleave",
10723				function () {
10724					$(this).fadeOut(500, function () {
10725						$(this).remove();
10726					})
10727				}
10728			);
10729	}
10730	tt.Reposition = function () {
10731		if (!$(document).data("ui-tooltip")) return;
10732		$(document).tooltip("repos");
10733	}
10734	tt.Init();
10735	$(window).on("resize", tt.Reposition);
10736}(TooltipHandler))
10737
10738
10739function HideToolTip(toolTipManagerID, element, fromMouse, evt) {
10740	if (typeof (fromMouse) != 'boolean') {
10741		fromMouse = true;
10742	}
10743	var isTouch = isTouchDevice();
10744	if (fromMouse && isTouch && typeof (isPhone) == "function" && isPhone()) return;
10745	setTimeout(function () { CloseToolTip(toolTipManagerID, element, fromMouse, evt); }, 500);
10746}
10747function CloseToolTip(toolTipManagerID, element, fromMouse, evt) {
10748	if (typeof (fromMouse) != 'boolean') {
10749		fromMouse = true;
10750	}
10751	if (toolTipManagerID == null && typeof (toolTipMan) != 'undefined') {
10752		toolTipManagerID = toolTipMan;
10753	}
10754	var oToolTipManager = $find(toolTipManagerID);
10755	if (oToolTipManager) {
10756		var oToolTip = oToolTipManager.getToolTipByElement(element);
10757		if (oToolTip && oToolTip.isVisible()) {
10758			if (!OverTooltip(oToolTip, evt) || !fromMouse) {
10759				oToolTip.hide();
10760			}
10761			else if (fromMouse) {
10762				var contentEle = $(oToolTip.get_contentElement())
10763				if (!contentEle.data("mouseLeaveSet")) contentEle.on("mouseleave", function (evt) { HideToolTip(toolTipManagerID, element, true, evt); });
10764				contentEle.data("mouseLeaveSet", true);
10765			}
10766		}
10767	}
10768}
10769function OverTooltip(toolTip, evt) {
10770	if (typeof (evt) != 'undefined' || (currentMousePos.x > -1 && currentMousePos.y > -1)) {
10771		if (toolTip == null) return false;
10772		var posX = null;
10773		var posY = null;
10774		if (currentMousePos.x > -1 && currentMousePos.y > -1) {
10775			posX = currentMousePos.x;
10776			posY = currentMousePos.y;
10777		}
10778		else if (evt.type == 'touchstart' || evt.type == 'touchmove' || evt.type == 'touchend' || evt.type == 'touchcancel') {
10779			var touch = evt.originalEvent.touches[0] || evt.originalEvent.changedTouches[0];
10780			posX = touch.pageX;
10781			posY = touch.pageY;
10782		} else if (e.type == 'mousedown' || e.type == 'mouseup' || e.type == 'mousemove' || e.type == 'mouseover' || e.type == 'mouseout' || e.type == 'mouseenter' || e.type == 'mouseleave') {
10783			posX = evt.pageX;
10784			posY = evt.pageY;
10785		}
10786		return isOver(posX, posY, toolTip.get_contentElement()) || isOver(posX, posY, toolTip.get_targetControl());
10787	}
10788	else {
10789		return $(toolTip.get_contentElement()).data("hover") || $(toolTip.get_targetControl()).data("hover");
10790	}
10791}
10792function isOver(posX, posY, ele) {
10793	var obj = $(ele);
10794	if (!obj.is(":visible")) return false;
10795	var offset = obj.offset();
10796	if (cssua.ua.ie) { /* IE miscalculates the offsets if there is a top woahbar present. Subtracting the height of the woahbar from the offset fixes the issue */
10797		var wb = $('.wbTop');
10798		if (wb.length) offset.top -= wb.outerHeight();
10799	}
10800	return offset.left <= posX && offset.left + obj.outerWidth() > posX && offset.top <= posY && offset.top + obj.outerHeight() > posY;
10801}
10802var creatingToolTip = false;
10803function ShowToolTip(toolTipManagerID, content, element, position, width, horizOffset, vertOffset, overridePos, autoHide, fromMouse) {
10804	if (typeof (fromMouse) != 'boolean') {
10805		fromMouse = true;
10806	}
10807	var isTouch = isTouchDevice();
10808	if (toolTipManagerID == null && typeof (toolTipMan) != 'undefined') {
10809		toolTipManagerID = toolTipMan;
10810	}
10811	if (typeof (autoHide) == 'undefined' || autoHide == null) {
10812		autoHide = true;
10813	}
10814	/* Force any select box to lose focus, then get it right back so that the option elements don't show up over the hover help */
10815	var focused = $('select:focus');
10816	focused.trigger("blur");
10817	focused.trigger("focus");
10818	var oToolTipManager = $find(toolTipManagerID);
10819	if (oToolTipManager) {
10820		var oToolTip = oToolTipManager.getToolTipByElement(element);
10821		if (oToolTip == null) {
10822			if (!creatingToolTip) {
10823				oToolTip = oToolTipManager.createToolTip(element);
10824				if (overridePos) {
10825					oToolTip.set_width(width);
10826					oToolTip.set_offsetX(horizOffset);
10827					oToolTip.set_offsetY(vertOffset);
10828				}
10829				else {
10830					if (content.length < 100) {
10831						oToolTip.set_width(null);
10832					}
10833				}
10834				if (typeof ($(element).attr('onmouseout')) == 'undefined') {
10835					$(element).attr('onmouseout', 'HideToolTip(\'' + toolTipManagerID + '\', this, true);');
10836				}
10837				oToolTip.set_hideEvent(Telerik.Web.UI.ToolTipHideEvent.FromCode);
10838				$(oToolTip.get_contentElement()).on("mouseenter",
10839					function () { $.data(this, 'hover', true); })
10840					.on("mouseleave",
10841						function () { $.data(this, 'hover', false); }
10842					).data("hover", false);
10843				$(element).on("mouseenter",
10844					function () { $.data(this, 'hover', true); })
10845					.on("mouseleave",
10846						function () { $.data(this, 'hover', false); }
10847					).data("hover", true);
10848				oToolTip.set_position(GetToolTipPosition(position));
10849				oToolTip.set_content(content);
10850				oToolTip.show();
10851				var tableElement = oToolTip._tableElement
10852				if (tableElement && overridePos) {
10853					tableElement.style.width = width + "px";
10854				}
10855				if (isTouch) { oToolTip.show(); }
10856				else { creatingToolTip = true; setTimeout(function () { oToolTip.show(); creatingToolTip = false; }, 10); }
10857			}
10858		}
10859		else {
10860			oToolTip.set_content(content);
10861			if (isTouch) oToolTip.show();
10862		}
10863	}
10864}
10865function GetToolTipPosition(s) {
10866	sl = s.toLowerCase();
10867	retVal = 0;
10868	if (sl.indexOf("top") >= 0) {
10869		retVal += 10;
10870	}
10871	else if (sl.indexOf("bottom") >= 0) {
10872		retVal += 30;
10873	}
10874	else {
10875		retVal += 20;
10876	}
10877	if (sl.indexOf("left") >= 0) {
10878		retVal += 1;
10879	}
10880	else if (sl.indexOf("right") >= 0) {
10881		retVal += 3;
10882	}
10883	else {
10884		retVal += 2;
10885	}
10886	return retVal;
10887}
10888
10889function loadjscssfile(filename, filetype) {
10890	if (filetype == "js") { /*if filename is a external JavaScript file*/
10891		var fileref = document.createElement('script');
10892		fileref.setAttribute("type", "text/javascript");
10893		fileref.setAttribute("src", filename);
10894	}
10895	else if (filetype == "css") { /*if filename is an external CSS file*/
10896		var fileref = document.createElement("link");
10897		fileref.setAttribute("rel", "stylesheet");
10898		fileref.setAttribute("type", "text/css");
10899		fileref.setAttribute("href", filename);
10900	}
10901	if (typeof fileref != "undefined") {
10902		document.getElementsByTagName("head")[0].appendChild(fileref);
10903	}
10904}
10905
10906function paginateTooltipContent(tooltip) {
10907	var contentHeight = tooltip.contents(".ui-tooltip-content").height();
10908	var tooltipHeight = tooltip.height();
10909
10910	/* If content height is greater than tooltip then split the content to next page */
10911	if (contentHeight > tooltipHeight) {
10912
10913		/* Support for paging */
10914		var pagination = {
10915			parentCssClass: "",
10916			totalPages: 1,
10917			currentPage: 1,
10918			createNavigation: function () {
10919				/* Create Navigation */
10920				var tooltipWidth = tooltip.width();
10921				var tooltipContent = tooltip.contents(".ui-tooltip-content");
10922				var tooltipText = tooltipContent.html();
10923				/* Split word by space, and add space on concatenation */
10924				var splitVal = tooltipText.replace(/<br>/g, " <br>").split(' ');
10925
10926				tooltipContent.addClass("paginated");
10927				tooltipContent.text(''); /* Remove all the content of inside tooltip */
10928				/* Get template for DIV on each page. Add Index to ID e.g div1, div2 etc and append to tooltip  */
10929				var divTemplate = "<div id='div[Index]' class='page' style='height:" + tooltipHeight + ";
10929 width:" + tooltipWidth + ";'></div>";
10930				var newDiv = divTemplate.replace("[Index]", this.totalPages);
10931				tooltipContent.append(newDiv);
10932
10933				for (var i = 0; i < splitVal.length; i++) {
10934					var curPageDiv = tooltip.find("div#div" + this.totalPages);
10935					var divHeight = curPageDiv.height();
10936					/* If the div height is greater than tooltip, then                     
10937						 1. removed previously added word 
10938						 2. create a new div with incremented index
10939						 3. Add the previously removed word + current word in array                     
10940						*/
10941					if (divHeight > tooltipHeight) {
10942						var prevLastWord = splitVal[i - 1];
10943						curPageDiv.html(curPageDiv.html().substring(0, curPageDiv.html().length - prevLastWord.length));
10944
10945						/* Increment to create ID for new DIV and create next page with new Div*/
10946						++this.totalPages;
10947						newDiv = divTemplate.replace("[Index]", this.totalPages);
10948						tooltipContent.append(newDiv);
10949
10950						tooltip.find("div#div" + this.totalPages).append($.parseHTML(this.fixList(prevLastWord, false) + " " + this.fixList(splitVal[i], true)));
10951					} else {
10952						/* Append text to DIV */
10953
10954						curPageDiv.append($.parseHTML(" " + this.fixList(splitVal[i], true)));
10955					}
10956				}
10957
10958				/* Once div is created, then make it inactivePage for all DIV and make active for first page */
10959				$("div.page").addClass("inactivePage");
10960				$("div#div1").removeClass("inactivePage").addClass("activePage");
10961
10962				if (this.totalPages > 1) {
10963					/* Template for Pagination */
10964					var divPageControl = "<div class='pageControls'><div class='pages'><span class='active'>[Pages]</span>/<span class='totalpages'>[TotalPages]</span></div><div class='buttons'><a class='nav previous disabled' ><</a><a class='nav next'>></a></div></div>";
10965					divPageControl = divPageControl.replace("[Pages]", "1").replace("[TotalPages]", this.totalPages);
10966					tooltipContent.append(divPageControl);
10967
10968					var that = this;
10969					$("body").off("click", this.parentCssClass + " .pageControls .buttons .nav");
10970					this.navigator = $("body").on("click", this.parentCssClass + " .pageControls .buttons .nav", function () {
10971						var el = $(this);
10972						that.navigate(el);
10973					});
10974				}
10975			},
10976			fixList: function (value, newLine) {
10977				return value
10978					.replace("<ul><li>", "<span class='disc'></span>")
10979					.replace("</li><li>", (newLine ? "<br/>" : "") + "<span class='disc'></span>")
10980					.replace("</li></ul>", "");
10981
10982			},
10983			navigate: function (el) {
10984				/* For navigating each page, using Next and Previous */
10985				if (el.hasClass("next")) {
10986					$(this.parentCssClass + " .pageControls .buttons .previous").removeClass("disabled");
10987					this.currentPage++;
10988					if (this.currentPage > (this.totalPages))
10989						this.currentPage = (this.totalPages);
10990					if (this.currentPage == (this.totalPages))
10991						el.addClass("disabled"); /* If its the last page, then disable Next */
10992				} else {
10993					$(this.parentCssClass + " .pageControls .buttons .next").removeClass("disabled");
10994					this.currentPage--;
10995					if (this.currentPage < 1)
10996						this.currentPage = 1;
10997					if (this.currentPage == 1)
10998						el.addClass("disabled"); /* If its the first page, then disable Previous */
10999				}
11000				$(this.parentCssClass + " div.pageControls div.pages").find(".active").text(this.currentPage);
11001				this.showItem();
11002			},
11003			showItem: function () {
11004				/* Showing the page as per selected page index*/
11005				$(this.parentCssClass + " div.page").removeClass("activePage").addClass("inactivePage");
11006				$(this.parentCssClass + " div#div" + this.currentPage).removeClass("inactivePage").addClass("activePage");
11007			},
11008			init: function () {
11009				this.currentPage = 1;
11010				this.totalPages = 1;
11011				this.createNavigation();
11012			}
11013		};
11014		pagination.init();
11015	}
11016}
11017
11018function displayMobileTooltip(tooltip) {
11019
11020	var tooltipContent = tooltip.contents(".ui-tooltip-content");
11021	if (typeof isSlateV3 == "function" && isSlateV3())
11022		showInlineDialog(tooltipContent, 'Question Help', { effect: 'slide', direction: 'left', duration: 500 }, { cssClass: 'toolTip' });
11023	else
11024		showInlineDialog(tooltipContent);
11025
11026}
11027
11028if (typeof String.prototype.startsWith != 'function') {
11029	String.prototype.startsWith = function (str) {
11030		return this.slice(0, str.length) == str;
11031	};
11032}
11033/*Older DCS contracts do not properly define this function so the show help link breaks without it*/
11034if (typeof togglePrintHelp == "undefined") {
11035	var togglePrintHelp = function (showHideLink) {
11036		var printhelpimg = document.getElementById("print_help_img");
11037		var printhelpp = document.getElementById("print_help_p");
11038		if (!printhelpimg.style.display || printhelpimg.style.display == "block") {
11039			printhelpimg.style.display = "none";
11040			printhelpp.style.display = "none";
11041			showHideLink.innerHTML = "Show Help vv";
11042			setCookie("ShowPrintHelp", "0", 30);
11043		}
11044		else {
11045			printhelpimg.style.display = "block";
11046			printhelpp.style.display = "block";
11047			showHideLink.innerHTML = "Hide Help ^^";
11048			setCookie("ShowPrintHelp", "1", 30);
11049		}
11050	}
11051}
11052
11053if (!Array.prototype.indexOf) {
11054	Array.prototype.indexOf = function (elt) {
11055		var len = this.length >>> 0;
11056
11057		var from = Number(arguments[1]) || 0;
11058		from = (from < 0)
11059			? Math.ceil(from)
11060			: Math.floor(from);
11061		if (from < 0) {
11062			from += len;
11063		}
11064
11065		for (; from < len; from++) {
11066			if (from in this &&
11067				this[from] === elt)
11068				return from;
11069		}
11070		return -1;
11071	};
11072}
11073
11074function isTouchFunc() { return isTouchDevice(); }
11075function submitFirstButton(event, sender) {
11076	if (getKeyCode(event) == 13 && event.target.type != "textarea") {
11077		/* Trigger a click of the visible button */
11078		$(sender).find(".largeActiveButton:visible").trigger("click");
11079	}
11080}
11081function getExtraQString() {
11082	return Sequiter.QueryString.GetPersistedQueryStringValues();
11083}
11084function getIfInQString(name) {
11085	if (getQueryStringValue(name)) {
11086		return "&" + name + "=" + getQueryStringValue(name);
11087	}
11088	return "";
11089}
11090function redirectToSelectionPage() {
11091	if (isLoggedIn()) {
11092		CallDataService('GetPostSignInSelectionPage',
11093			{
11094				'productCode': getCurrentProductCode(),
11095				'countryCode': getCountry(),
11096				'regionCode': getRegion(),
11097				'secureId': window.SID
11098			}, function (response) {
11099				location.href = Sequiter.QueryString.AddPersistedQueryStringValuesToUrl(response.d);
11100				return;
11101			}, null);
11102	}
11103}
11104
11105/** The general utility namespace. Other files can add to this. */
11106var Sequiter = Sequiter || {};
11107Sequiter.Utility = Sequiter.Utility || {};
11108(function (util) {
11109	const DEFAULT_DECIMAL_SEPARATOR = '.';
11110
11111	/**
11112	 * Parse a string into a number.
11113	 * @param {string} value - The value to be parsed.
11114	 * @param {Object} settings - The settings.
11115	 * @param {number} [settings.defaultVal=0] - The default number to use if the string can't be parsed.
11116	 * @param {string} [settings.decimalSeparator='.'] - The decimal separator
11117	 */
11118	function ParseNum(value, settings) {
11119		// Provide default settings.
11120		var set = $.extend({
11121			defaultVal: 0,
11122			decimalSeparator: DEFAULT_DECIMAL_SEPARATOR
11123		}, settings);
11124		var numStr = new String(value);
11125		var regex = new RegExp('[^0-9-' + set.decimalSeparator + ']', 'g');
11126		numStr = numStr.replace(regex, '').replace(set.decimalSeparator, DEFAULT_DECIMAL_SEPARATOR);
11127
11128		var num = parseFloat(numStr);
11129		if (isNaN(num)) num = set.defaultVal;
11130		return num;
11131	}
11132
11133	// Export public members for website use.
11134	$.extend(util, {
11135		ParseNum: ParseNum
11136	});
11137	
11138	// Exports for unit testing.
11139	if (typeof exports !== "undefined") {
11140		exports.Utility = util;
11141	}
11142})(Sequiter.Utility);
11143/* End Include utility */
11144
11145/* Include controls */
11146function setGroupItemIcon(id, value){
11147	setIcon(id, value, "icon");
11148}
11149function setRadioButtonIcon(id, value){
11150	setIcon(id, value, "rblIcon");
11151}
11152function setIcon(id, value, iconClass){
11153	id = id+"_wrap";
11154	$("#" + id + " ." + iconClass).html(value);
11155	$("#" + id).toggleClass("hasIcon", value != "");
11156}
11157
11158function rV(formName, radioGroup){
11159   var group=gFO(formName, radioGroup);
11160   for (var i=0;i<group.length;++i){
11161      if(group[i].checked){
11162         return group[i].value;
11163      }
11164   }
11165   return null;
11166}
11167function sRV(formName, radioGroup, val, evt){
11168   var group=gFO(formName, radioGroup);
11169   for (var i=0;i<group.length;++i){
11170      group[i].checked = group[i].value == val;
11171      if(group[i].checked){
11172         fE(group[i], evt);
11173      }
11174   }
11175}
11176if(typeof($) == 'function'){
11177(function($) {    
11178  if ($.fn.setStyle) {
11179    return;
11180  }
11181
11182   /* The style function*/
11183   $.fn.setStyle = function(styleName, value, priority) {
11184      for(var i = 0; i < this.length; ++i){
11185         priority = typeof priority != 'undefined' ? priority : '';
11186         var nodeStyle = this[i].style;
11187         if(typeof(nodeStyle.setProperty) != 'undefined'){
11188            nodeStyle.setProperty(styleName, value, priority);
11189         }
11190         else{
11191            nodeStyle.setAttribute(styleName, value);
11192            if (priority != '') {
11193               /* Add priority manually*/
11194               var escape = function(text) {
11195                  return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
11196               };
11197               var rule = new RegExp(escape(styleName) + '\\s*:\\s*' + escape(value) + '(\\s*;)?', 'gmi');
11198               nodeStyle.cssText = nodeStyle.cssText.replace(rule, styleName + ': ' + value + ' !' + priority + ';');
11199            }
11200         }
11201      }
11202  };
11203})(jQuery);
11204}
11205function setLayout(id, layout){
11206   layout = layout.toLowerCase();
11207   layout = layout.charAt(0).toUpperCase() + layout.slice(1);
11208   var prefix = "layout";
11209   var el = gI(id);
11210   var classes = el.className.split(" ").filter(function(c) { return c.lastIndexOf(prefix, 0) !== 0; });
11211   el.className = $.trim(classes.join(" ")) + " " + prefix + layout;
11212}
11213function setFocusValidator(source) {
11214   ctl = gI(source.controltovalidate);
11215   if(ctl != null){
11216      if(!isInput(ctl)){
11217         ctl = findFirstInput(ctl.childNodes);
11218      }
11219
11220      if(ctl != null && ctl.focus){
11221         try{
11222         ctl.focus();
11223         }catch(e){
11224         }
11225      }
11226   }
11227}
11228function sLD(id,v,fn,g){
11229   var wasChecked = false;
11230   var o=gI(id);
11231   if(o != null){
11232      wasChecked = o.checked;
11233   }
11234   if(gI(id+'_wrap') != null){
11235      sD(id + '_wrap', v, 'inline');
11236   }
11237   else{
11238   sD(id, v, "inline");
11239   sD(id+"_lb", v, "inline");
11240   }
11241   if(wasChecked && !v){
11242      var gr=gFO(fn,g);
11243      for (var i=0;i<gr.length;++i){
11244         var obj = $("#" + gr[i].id + "_wrap");
11245         if (obj.length == 0) obj = $(gr[i]);
11246         if(obj.css("display") != "none"){
11247            gr[i].checked=true;
11248            fE(gr[i], 'click');
11249            break;
11250         }
11251      }
11252   }
11253}
11254/* Array used for storing drop down values */
11255var ddh = new Array();
11256function sDD(arr, id){
11257   var o=gI(id);
11258	if(o) {
11259		var v=o.value;
11260		o.options.length=0;
11261		var i=0;
11262		for(var item in arr){
11263			if(arr[item]["visible"]){
11264				var opt = new Option(arr[item]["text"], arr[item]["value"]);
11265				opt.id = item;
11266				o.options[i] = opt;
11267				++i;
11268				if(arr[item]["value"] == v){
11269					o.value = v;
11270				}
11271			}
11272		}
11273		if(isSmallScreen()) {
11274			resizeSmallScreenSelectBox(o);
11275		}
11276		fE(o, 'change');
11277	}
11278}
11279function uDD(id){
11280   var wrapper = $("#"+id).parent();
11281   var selected = wrapper.find("option:selected");
11282   if(selected.hasClass("placeholder")){
11283      wrapper.addClass("placeholder");
11284   }
11285   else{
11286      wrapper.removeClass("placeholder");
11287   }
11288   wrapper.find("span").text(selected.text());
11289}
11290function sMM(s,max,min){
11291   if(s == null) return;
11292   var val = s.value;
11293   s.options.length=0;
11294   for(var i=min;i<=max;++i){
11295      s.options[i-min] = new Option(i.toString(), i.toString());
11296   }
11297   if(val < min){
11298      s.value = min;
11299      fE(s, 'change');
11300   }
11301   else if (val > max){
11302      s.value = max;
11303      fE(s, 'change');
11304   }
11305   else{
11306      s.value = val;
11307   }
11308}
11309function gMV(textBox){
11310   if(typeof(textBox) == 'undefined' || textBox == null || textBox.get_value() == '') return '';
11311   return textBox.get_valueWithLiterals();
11312}
11313function gPC(textBox){
11314   if(typeof(textBox) == 'undefined' || textBox == null || textBox.get_value() == '') return '';
11315   var val = textBox.get_valueWithLiterals();
11316   if(val.indexOf("-")==val.length-1) return textBox.get_value();
11317   return val;
11318}
11319/* Disable Text Selection on Contract */
11320if(typeof($) != "undefined"){
11321   $(function(){
11322	   $.extend($.fn.disableTextSelect = function() {
11323		   return this.each(function(){
11324   			if(typeof(cssua) != "undefined" && cssua.ua.firefox){
11325	   			$(this).css('MozUserSelect','none');
11326		   	}
11327            else if(typeof(cssua) != "undefined" && cssua.ua.ie){
11328			   	$(this).on('selectstart',function(){return false;});
11329   			}
11330            else{
11331	   			$(this).on("mousedown", function(){return false;});
11332		   	}
11333   		});
11334	   });
11335   	$(".unlicensed .contractPreviewWrapper:not(.contractSamplePreview) .contract,.unlicensed .contractPreviewWrapper:not(.contractSamplePreview) #contract").disableTextSelect();
11336      if(typeof(cssua) != "undefined" && cssua.ua.ie && parseInt(cssua.ua.ie.split(".")[0]) < 10) {
11337   	   $(".contractSamplePreview .contract,.contractSamplePreview #contract").disableTextSelect();
11338      }
11339   });
11340}
11341/* function for Legal Contracts preview border color change on focus */
11342if (typeof($) == "function") {
11343	$(function() {
11344		$('#expFaqContent .lp-content-contract-preview').on("focusin", function() {
11345			$(this).css('border-color','#2ca05a');
11346		});
11347		$('#expFaqContent .lp-content-contract-preview').on("focusout", function() {
11348			$(this).css('border-color','#bfc1c0');
11349		});
11350	});
11351}
11352/*Add skip this question link*/
11353var skipIgnoredProducts = ["ONTCOR", "AINCOR", "GENCOR", "BCINC", "FEDINC", "LLCINC", "TXINC", "COMLSE", "PRENUP"];
11354var skipViewTracked = false;
11355function addSkipQuestion(){
11356   if(typeof(PC) != "undefined" && skipIgnoredProducts.indexOf(PC) == -1){
11357      if(!skipViewTracked){
11358         skipViewTracked = true;
11359         skipQuestionTracking('view');
11360      }
11361   	var hasSavedAnswers = vh.G("__HasSavedAnswersSpecific");
11362      if(typeof($) == "function" && (typeof(dcsVersion) == "undefined" || (!isNaN(dcsVersion) && dcsVersion < 2.58)) && $(".skipButton").length == 0 && typeof(hasSavedAnswers) != "undefined" && hasSavedAnswers && !$('.DLAW').length){
11363         $(".groupNavigationButtons").append("<a class='skipButton' onclick='qnh.Skip();return false;' href='#'><span class='content'>Skip this step for now</span></a>");
11364      }
11365      else{
11366         vh.R("__HasSavedAnswersSpecific", "addSkipQuestion", addSkipQuestion, "change", true);
11367      }
11368   }
11369}
11370onJsReady(function(){
11371    rE(window, "load", addSkipQuestion);
11372});
11373function skipQuestionTracking(actionVal)
11374{
11375   submitInternalEventV2(null, "SkipQuestion", actionVal);
11376}
11377/*End skip this question link*/
11378function prepForEmail(link, prodCode){
11379   var xmlReq = getXmlHttpRequestObject();
11380   showMessage("Preparing Document");
11381   xmlReq.open("GET", "displaypdf.aspx?saveForEmail=true&code=" + prodCode, false);
11382   xmlReq.send();
11383   if(xmlReq.readyState == 4 && xmlReq.status == 200 && xmlReq.responseText != null){
11384      link.href = link.href.replace("%3chash%3e", xmlReq.responseText);
11385   }
11386   hideMessage();
11387}
11388function displayFullSample(ele){
11389   var lightboxID = ele.id + "_lightbox";
11390   var lb = $("#" + lightboxID);
11391   if(lb.length == 0){
11392      lb = $("<div id='" + lightboxID + "'><img id='" + lightboxID + "_img'/></div>");
11393      $("body").append(lb);
11394   }
11395   var src = $(ele).data("fullimg");
11396   if(!src) src = ele.src;
11397   lb.find("img").attr('src', src);
11398   lightbox(lightboxID, null, 'templateSample');
11399}
11400function lightbox(elemId, resizeElem, additionalClass){	
11401	if(resizeElem){
11402		var origWidth = $('#'+resizeElem).width();
11403		var origHeight = $('#'+resizeElem).height();
11404
11405		if(origWidth > $(window).width()){
11406         if( $("html").hasClass("LD") && $("html").hasClass("ua-mobile") ){
11407           $('#'+resizeElem).width($(window).width());
11408           $('#'+resizeElem).height(origHeight * ($(window).width()) / origWidth);
11409         }
11410         else{
11411           $('#'+resizeElem).width($(window).width()-40);
11412           $('#'+resizeElem).height(origHeight * ($(window).width()-40) / origWidth);
11413         }
11414		}
11415		var resizeHandler = function() {
11416			if(origWidth > $(window).width()){
11417			   if( $("html").hasClass("LD") && $("html").hasClass("ua-mobile") ){
11418               $('#'+resizeElem).width($(window).width());
11419               $('#'+resizeElem).height(origHeight * ($(window).width()) / origWidth);
11420            }
11421            else{
11422               $('#'+resizeElem).width($(window).width()-40);
11423               $('#'+resizeElem).height(origHeight * ($(window).width()-40) / origWidth);
11424            }
11425			}
11426			else{
11427				$('#'+resizeElem).width(origWidth);
11428				$('#'+resizeElem).height(origHeight);
11429			}
11430			var leftMargin = ($(window).width() - $('#'+resizeElem).width() - 40)/2;
11431			$('#'+elemId).parent().css('left', leftMargin+'px');
11432			$('#'+elemId).css('height', $(window).height() - 80);
11433
11434         reCenterDialog(elemId);
11435	   };
11436	   $(window).on("resize", resizeHandler);
11437   }	
11438	
11439
11440
11441	$("#"+elemId).dialog({
11442		autoOpen: true,
11443		modal: true,
11444		width: "auto",
11445		maxHeight: !isPhone() ? $(window).innerHeight() - 80 : "none",
11446		resizable: false,
11447		draggable: false,
11448		dialogClass: "lightbox" + (additionalClass ? " " + additionalClass : ""),
11449      position: getDialogCenterPosition(),
11450		create: function(event, ui) {
11451			$(event.target).parent().css('position', 'fixed');			
11452		},
11453		open: function(event, ui) {
11454      OnDialogOpen(false, false);
11455		},
11456		close: function(event, ui) {
11457			if(resizeElem){
11458				$('#'+resizeElem).width(origWidth);
11459				$('#'+resizeElem).height(origHeight);
11460				$(window).off("resize", resizeHandler);
11461			}
11462      	OnDialogClose(false, false);
11463		}
11464	});
11465	$(".ui-widget-overlay").on("click", function() {
11466		$("#"+elemId).dialog("close");
11467	});
11468
11469	$("#"+elemId).on("click", function() {
11470		$("#"+elemId).dialog("close");
11471	});
11472	
11473}
11474
11475/* Textbox Max multiline */
11476 function getCaret(el) {
11477    if (el.selectionStart) {
11478        return el.selectionStart;
11479    } else if (document.selection) {
11480        el.focus();
11481
11482        var r = document.selection.createRange();
11483        if (r == null) {
11484            return 0;
11485        }
11486
11487        var re = el.createTextRange(),
11488            rc = re.duplicate();
11489        re.moveToBookmark(r.getBookmark());
11490        rc.setEndPoint('EndToStart', re);
11491
11492        return rc.text.length;
11493    }
11494    return 0;
11495}
11496
11497function resetCursor(txtElement, currentPos) {
11498    if (txtElement.setSelectionRange) {
11499        txtElement.focus();
11500        txtElement.setSelectionRange(currentPos, currentPos);
11501    } else if (txtElement.createTextRange) {
11502        var range = txtElement.createTextRange();
11503        range.moveStart('character', currentPos);
11504        range.select();
11505    }
11506}
11507
11508function getSelectionText(txtArea) {
11509    var length = "";
11510    if (window.getSelection) {
11511        var tArea = $(txtArea).get(0);
11512        length = tArea.value.substring(tArea.selectionStart, tArea.selectionEnd).length;
11513
11514    } else if (document.selection && document.selection.type != "Control") {
11515        length = document.selection.createRange().text.length;
11516    }
11517    return length;
11518}
11519        
11520function fixTextboxMaxMultiLine() {
11521    var curDoc = $(document);
11522    var curTbVal ="";
11523    var truncat = true;
11524        curDoc.on('keydown', 'textarea[data-maxlines]', function (e) {
11525            var curTxtArea = $(this);
11526            curTxtArea.siblings('.data-maxlines').removeClass('err');   
11527
11528            var keyEvent = getKeyCode(e);                 
11529            if (keyEvent <= 45 && keyEvent != 8 && keyEvent != 13 && keyEvent != 32) return true;
11530            if (e.ctrlKey || e.metaKey) return true;
11531                        
11532                var curLength = curTxtArea.val().length;
11533                if(curTxtArea.attr("maxlength") !== undefined){
11534                    var maxlength = curTxtArea.attr("maxlength");
11535                    if(curLength == maxlength)
11536                        curTxtArea.siblings('.data-maxlines').addClass('err');                                                       
11537                }
11538
11539             if(cssua.ua.mobile && isSlate()) {
11540            var curTxtArea = $(this);
11541            curTxtArea.siblings('.data-maxlines').removeClass('err');
11542
11543            var keyEvent = getKeyCode(e);
11544                     if(keyEvent == 8 || keyEvent == 46){ 
11545                         return true;
11546                     }
11547                     else {
11548            var curLength = curTxtArea.val().length;
11549            if(curTxtArea.attr("maxlength") !== undefined){
11550                var maxlength = curTxtArea.attr("maxlength");
11551                if(curLength == maxlength)
11552                    curTxtArea.siblings('.data-maxlines').addClass('err');                                                                            
11553             }
11554                     }
11555             }
11556
11557            if (curTxtArea.prop('scrollHeight') >= curTxtArea.prop('clientHeight')) {
11558
11559                var ctrl = curTxtArea[0];
11560                var currentPos = getCaret(ctrl);
11561                var text = $(ctrl).val();
11562                var addTempVal;
11563                var selectionLength = getSelectionText(this);
11564              
11565                if (keyEvent == 8 && !cssua.ua.mobile) {
11566                    if (selectionLength == 0) {
11567                        if(currentPos > text.length) currentPos = text.length;
11568                        addTempVal = text.substr(0, currentPos - 1) + text.substr(currentPos, text.length);
11569                    } else {
11570                        var delLength = selectionLength > 0 ? (selectionLength - 1) : 0;
11571                        addTempVal = text.substr(0, currentPos) + text.substr(currentPos + selectionLength, text.length);
11572                    }
11573
11574                }
11575                else if (keyEvent == 46 && !cssua.ua.mobile) {
11576                    if (selectionLength == 0) {
11577                        addTempVal = text.substr(0, currentPos) + text.substr(currentPos + 1, text.length);
11578                    } else {
11579                        addTempVal = text.substr(0, currentPos) + text.substr(currentPos + selectionLength, text.length);
11580                    }
11581                }
11582                else if (keyEvent == 13) {
11583                    if (selectionLength == 0) {
11584                        addTempVal = text.substr(0, currentPos) + String.fromCharCode(13, 10) + text.substr(currentPos, text.length);
11585                    } else {
11586                        addTempVal = text.substr(0, currentPos) + String.fromCharCode(13, 10) + text.substr(currentPos + selectionLength, text.length);
11587                    }
11588                } else {
11589                    if (selectionLength == 0)
11590                        addTempVal = text.substr(0, currentPos) + String.fromCharCode(keyEvent) + text.substr(currentPos, text.length);
11591                    else
11592                        addTempVal = text.substr(0, currentPos) + String.fromCharCode(keyEvent) + text.substr(currentPos + selectionLength, text.length);
11593                }
11594
11595                curTxtArea.val(addTempVal);
11596
11597                var modVal;
11598                if (curTxtArea.prop('scrollHeight') > curTxtArea.prop('clientHeight') && truncat==true) {
11599                   var endVal = text.substr(currentPos, text.length);
11600                   if(endVal.length == 1 && endVal.match(/\n/g)){                      
11601                        modVal = text.substr(0, currentPos) + endVal;       
11602                        currentPos++;                                                                 
11603                   }else{
11604                        curTxtArea.siblings('.data-maxlines').addClass('err');
11605                        modVal = text.substr(0, currentPos) + endVal;                   
11606                   }
11607                                       
11608                    $(ctrl).val(modVal);
11609                    resetCursor(ctrl, currentPos);
11610                   
11611                    setTimeout(function() {
11612                        curTxtArea.siblings('.data-maxlines').removeClass('err');
11613                    }, 200);
11614                    return false;
11615                } else {
11616
11617                    if(curTxtArea.prop('scrollHeight') <= curTxtArea.prop('clientHeight') && truncat == false){
11618                        truncat = true;
11619                        var height = $(this).height();
11620                        var curStyles = $(this).attr("style").replace(/ /g,'');;
11621                        curStyles = curStyles.replace("overflow-y:auto;","overflow-y:hidden;").replace(/height:[0-9]+px;/i,"");
11622                        if(!(curStyles) || curStyles.indexOf("height")==-1){
11623                            if(cssua.ua.mobile) 
11624                                $(this).attr("style","height:"+(height + 8)+"px; " + (curStyles?curStyles:""));
11625                            else
11626                                $(this).attr("style","height:"+(height + 3)+"px; " + (curStyles?curStyles:""));
11627                        }                        
11628                    }else{
11629                        if(truncat == false) curTxtArea.siblings('.data-maxlines').addClass('err');
11630                    }
11631
11632                    if (keyEvent == 8 && !cssua.ua.mobile) {
11633                        if (selectionLength > 0)
11634                            resetCursor(ctrl, currentPos);
11635                        else
11636                            resetCursor(ctrl, currentPos - 1);
11637                        
11638                    } else if (keyEvent == 46 && !cssua.ua.mobile) {
11639                        resetCursor(ctrl, currentPos);
11640
11641                    } else if(keyEvent ==13){
11642                        resetCursor(ctrl, currentPos + 1);
11643                    }
11644                    else {
11645                        if (selectionLength == 0)
11646                                $(ctrl).val(text);
11647                            else
11648                            {
11649                                $(ctrl).val(text.substr(0, currentPos) +  text.substr(currentPos + selectionLength, text.length));
11650                            }
11651                            resetCursor(ctrl, currentPos);
11652                        return true;
11653                    }                   
11654
11655                    return false;
11656                }
11657            }
11658        });
11659   curDoc.on('paste', 'textarea[data-maxlines]', function (e) {
11660        
11661        if(truncat){        
11662            var curTxtArea = $(this);
11663            var currentPos = getCaret(curTxtArea[0]);
11664            var oldVal = curTxtArea.val();
11665            var textLength = oldVal.length;
11666            var maxLoop = 2000;
11667            if(curTxtArea.attr("maxlength") !== undefined){
11668                maxLoop = curTxtArea.attr("maxlength");
11669            }
11670
11671            var pastedText = "";
11672            
11673            if (window.clipboardData && window.clipboardData.getData) { // IE
11674                pastedText = window.clipboardData.getData('Text');
11675            }
11676            else if (e.originalEvent.clipboardData && e.originalEvent.clipboardData.getData) { // other browsers
11677                pastedText = e.originalEvent.clipboardData.getData('text/plain');
11678            }
11679                        
11680            var pastedTextLen = pastedText.length; 
11681            if(pastedTextLen > maxLoop) pastedTextLen = maxLoop;
11682            var selLength = getSelectionText(curTxtArea);
11683            var useEnd = false;
11684            if(selLength > 0){
11685               var endPosSel = curTxtArea.get(0).selectionEnd;
11686               if(endPosSel == textLength) useEnd = true;
11687            }
11688            var carPos ="END";            
11689            if( textLength != 0 && currentPos >= 0 && !useEnd && textLength != currentPos) {
11690                if(currentPos == 0)
11691                    carPos ="START";
11692                else 
11693                    carPos ="MIDDLE";                
11694            }            
11695
11696            setTimeout(function () {
11697                if(curTxtArea.val().match(/\n$/g)){
11698                    curTxtArea.val(curTxtArea.val().replace(/\n+$/g,""));
11699                }
11700              
11701                var afterPasteVal = curTxtArea.val();                                
11702                if(oldVal == afterPasteVal) return true;                                           
11703                var beforeCursorVal = oldVal.substr(0, currentPos);
11704                var afterCursorVal = oldVal.substr(currentPos + selLength, oldVal.length);
11705                
11706
11707                var ctr = 0;
11708                var relocCursor = false;
11709                while (true) {
11710                    if(ctr > maxLoop) break;
11711                    ctr++;
11712
11713                    if (curTxtArea.prop('scrollHeight') > curTxtArea.prop('clientHeight')) {                      
11714                        relocCursor = true;
11715                        if(truncat == true){
11716                            pastedText = pastedText.substr(0, pastedTextLen-1); 
11717                            switch(carPos){
11718                                case "START":                                                                       
11719                                    if(selLength == textLength)
11720                                        curTxtArea.val(pastedText);
11721                                    else
11722                                        curTxtArea.val(pastedText + afterCursorVal);                                    
11723                                break;
11724
11725                                case "MIDDLE":                                    
11726                                    curTxtArea.val(beforeCursorVal + pastedText + afterCursorVal);                                    
11727                                break;
11728
11729                                case "END":                                                                        
11730                                    curTxtArea.val(beforeCursorVal + pastedText);
11731                                break;
11732                            }                       
11733                            pastedTextLen--;
11734                        }else{
11735                            curTxtArea.siblings('.data-maxlines').addClass('err');
11736                            break;
11737                        }
11738        
11739                    } else {
11740                        curTxtArea.siblings('.data-maxlines').removeClass('err');
11741                        break;
11742                    }
11743                }
11744
11745                if(relocCursor)
11746                    resetCursor(curTxtArea[0], currentPos + pastedTextLen);
11747                
11748            }, 0);
11749        }
11750
11751    })
11752    .on("blur", 'textarea[data-maxlines]', function (e) {
11753        var curTxtArea = $(this); 
11754        while (true) {
11755            if (curTxtArea.prop('scrollHeight') > curTxtArea.prop('clientHeight')) {
11756                if(truncat == true){
11757                    var lastSpace = curTxtArea.val().length;
11758                    curTxtArea.val(curTxtArea.val().substr(0, lastSpace - 1));
11759                }else{
11760                    curTxtArea.siblings('.data-maxlines').addClass('err');
11761                    break;
11762                }
11763
11764            } else {
11765                curTxtArea.siblings('.data-maxlines').removeClass('err');
11766                break;
11767            }
11768        } 
11769    })
11770    .on("focus",'textarea[data-maxlines]',function(e){
11771        var curTxtArea = $(this);
11772        var curStyles = $(this).attr("style").replace(/ /g,'');;
11773
11774        if(cssua.ua.ie || cssua.ua.edge)
11775            hasScroll = (curTxtArea.prop('scrollHeight')-2) > curTxtArea.prop('clientHeight');
11776        else
11777            hasScroll= curTxtArea.prop('scrollHeight') > curTxtArea.prop('clientHeight');
11778
11779        if (hasScroll) { 
11780            truncat = false;            
11781        }else{
11782            if(cssua.ua.ie)
11783                curStyles = curStyles.replace("-ms-overflow-y:auto;","-ms-overflow-y:hidden;");
11784            else
11785                curStyles = curStyles.replace("overflow-y:auto;","overflow-y:hidden;");
11786        }       
11787
11788      if(curStyles && curStyles.indexOf("height:auto;") !==-1){
11789            var height = $(this).height();
11790           curStyles = curStyles.replace("height:auto;","");
11791           if(cssua.ua.mobile) 
11792                $(this).attr("style","height:"+(height + 8)+"px; " + (curStyles?curStyles:""));
11793            else
11794                $(this).attr("style","height:"+(height + 3)+"px;" + (curStyles?curStyles:"") );
11795       }
11796    });
11797   if(typeof(Sys) != "undefined") {
11798      var prm = Sys.WebForms.PageRequestManager.getInstance();    
11799      prm.add_endRequest(function(sender, args) {
11800         $("textarea[data-maxlines]").each(function(index,item){
11801            var curTxtArea = $(this);
11802            if(curTxtArea.attr("maxlength") !== undefined){
11803               var maxLength = curTxtArea.attr("maxlength");
11804               var dataMaxlines = curTxtArea.attr("data-maxlines");
11805               var msg = "Maximum [Numlines] lines (or maximum [MaxCharacters] characters)".replace("[Numlines]",dataMaxlines).replace("[MaxCharacters]", maxLength);
11806               curTxtArea.siblings(".data-maxlines").text(msg);
11807
11808            }
11809
11810            curTxtArea.attr("style","overflow-y:hidden; height:auto; resize:none;"); 
11811            if(cssua.ua.ie || cssua.ua.edge)
11812               hasScroll = (curTxtArea.prop('scrollHeight')-2) > curTxtArea.prop('clientHeight');
11813            else
11814               hasScroll= curTxtArea.prop('scrollHeight') > curTxtArea.prop('clientHeight');
11815
11816            if (hasScroll) {             
11817               curTxtArea.siblings('.data-maxlines').addClass('err');
11818               curTxtArea.attr("style","overflow-y:auto; height:auto; resize:none;");
11819            }   
11820         });  
11821      });
11822   }
11823   $(function(){
11824        $("textarea[data-maxlines]").each(function(index,item){
11825            var curTxtArea = $(this);
11826
11827            if(curTxtArea.attr("maxlength") !== undefined){
11828                var maxLength = curTxtArea.attr("maxlength");
11829                var dataMaxlines = curTxtArea.attr("data-maxlines");
11830                var msg = "Maximum [Numlines] lines (or maximum [MaxCharacters] characters)".replace("[Numlines]",dataMaxlines).replace("[MaxCharacters]", maxLength);
11831                curTxtArea.siblings(".data-maxlines").text(msg);
11832
11833            }
11834
11835            curTxtArea.attr("style","overflow-y:hidden; height:auto; resize:none;");
11836            var hasScroll;
11837
11838            if(cssua.ua.ie || cssua.ua.edge)
11839                hasScroll = (curTxtArea.prop('scrollHeight')-2) > curTxtArea.prop('clientHeight');
11840            else
11841                hasScroll= curTxtArea.prop('scrollHeight') > curTxtArea.prop('clientHeight');
11842
11843            if (hasScroll) {            
11844                curTxtArea.siblings('.data-maxlines').addClass('err');
11845                curTxtArea.attr("style","overflow-y:auto; height:auto; resize:none;");
11846            }  
11847        });    
11848   });
11849}
11850/* End of Textbox Max multiline */
11851
11852/* Make textareas respect the maxlength on IE9. */
11853function fixTextareaMaxlength() {
11854   if(typeof(cssua) != "undefined" && cssua.ua.ie == "9.0") {
11855      $("textarea[maxlength]").on("keypress", function(e){
11856         var k = getKeyCode(e);
11857         if(k==8 || k==37 || k==39 || k==46) return true;
11858         var text      = $(this).val();
11859         var maxlength = $(this).attr("maxlength");
11860         if(text.length >= maxlength) {
11861             return false;   
11862         }
11863         return true;
11864      }).on("change", function() {
11865         var text = $(this).val();
11866         var maxlength = $(this).attr("maxlength");
11867         if(text.length > maxlength) {
11868            $(this).val(text.substr(0,maxlength));
11869         }
11870      });
11871   }
11872}
11873if(typeof($) == "function"){
11874	$(fixTextareaMaxlength);
11875   $(fixTextboxMaxMultiLine);
11876}
11877else{
11878   rE(window, "load", fixTextareaMaxlength);
11879   rE(window, "load", fixTextboxMaxMultiLine);
11880}
11881
11882/* Google Places Support */
11883if(typeof(jQuery) == "function"){
11884   (function($) {
11885      var sessionToken = null;
11886      function getSessionToken(){
11887         if(sessionToken == null && typeof(google) != "undefined") sessionToken = new google.maps.places.AutocompleteSessionToken();
11888         return sessionToken;
11889      }
11890      var googleMapsService = null;
11891      function getGoogleMapsService(){
11892         if(googleMapsService == null && typeof(google) != "undefined"){
11893            googleMapsService = new google.maps.places.AutocompleteService();
11894         }
11895         return googleMapsService;
11896      }
11897      var geocoder = null;
11898      function getGeocoder(){
11899         if(geocoder == null && typeof(google) != "undefined"){
11900            geocoder = new google.maps.Geocoder();
11901         }
11902         return geocoder;
11903      }
11904      var googlePlacesService = null;
11905      var serviceHelper = null;
11906      function getPlacesService(){
11907         if(googlePlacesService == null && typeof(google) != "undefined"){
11908            googlePlacesService = new google.maps.places.PlacesService(serviceHelper);
11909         }
11910         return googlePlacesService;
11911      }
11912      function getPlaceDetails(placeID, callback){
11913         var placesService = getPlacesService();
11914         if(placesService != null) {
11915            placesService.getDetails({placeId:placeID, fields:["formatted_address"], sessionToken:getSessionToken()}, callback);
11916            sessionToken = null; /* From what I can determine the expectation is that actually selecting a place should end a session and a new one needs to be started, otherwise we'll end up charged by request */
11917         }
11918      }
11919      function fixBounds(options){
11920         options.bounds = getBounds(options.latitude, options.longitude, options.radius);
11921         options.latitude = null;
11922         options.longitude = null;
11923         options.radius = null;
11924      }
11925      function getBounds(lat, lng, radius){
11926         if(lat != null && lng != null && radius != null && typeof(google) != "undefined"){
11927            return new google.maps.Circle({
11928               center:{
11929                  lat:lat, 
11930                  lng:lng
11931               }, 
11932               radius:radius
11933            }).getBounds();
11934         }
11935         return null;
11936      }
11937      function SourceCallback(predictions, status, response, inputVal){
11938         if (status != google.maps.places.PlacesServiceStatus.OK) {
11939            response([]);
11940         }
11941         else{
11942            var data = new Array();
11943            var includeInput = true;
11944            for(var i = 0; i < predictions.length; ++i){
11945               if(predictions[i].description == inputVal) includeInput = false;
11946               data.push({label: predictions[i].description, value: predictions[i].place_id});
11947            }
11948            if(includeInput){
11949               data.unshift({label: inputVal, value:inputVal});
11950            }
11951            response(data);
11952         }
11953      }
11954      function AutoCompleteSource(request, response, options){
11955         var gms = getGoogleMapsService();
11956         if(gms != null) gms.getPlacePredictions($.extend({ input:request.term, sessionToken:getSessionToken() }, options), function(predictions, status){ SourceCallback(predictions, status, response, request.term); });
11957      }
11958      function RenderWithHighlight(ul, item) {
11959		var newText = String(item.label).replace(
11960			new RegExp($.ui.autocomplete.escapeRegex(this.term), `gi`),
11961			`<span class='ui-state-highlight'>$&</span>`
11962		);
11963		var li = $(`<li></li>`)
11964			.data(`item.autocomplete`, item)
11965			.append(`<a>` + newText + `</a>`);
11966		return li.appendTo(ul);
11967	  }
11968      function SetAutoCompleteValue(result, status, element){
11969         if(status == google.maps.places.PlacesServiceStatus.OK && typeof(result) == "object" && result != null && typeof(result.formatted_address) == "string"){
11970            element.value = result.formatted_address;
11971         }
11972      }
11973      function AutoCompleteFocus(e, ui){
11974         this.value = ui.item.label;
11975         e.preventDefault();
11976      }
11977      function AutoCompleteSelected(e, ui){
11978         this.value = ui.item.label; /* Temporary while waiting for the callback results */
11979         var ele = this;
11980         getPlaceDetails(ui.item.value, function (result, status){SetAutoCompleteValue(result, status, ele); });
11981         e.preventDefault();
11982      }
11983      var methods = {
11984         init : function(serviceOptions, autoCompleteOptions){
11985            var googleOptions = $.extend({
11986               types: ["geocode"],  
11987            }, serviceOptions);
11988            fixBounds(googleOptions);
11989            this.autocomplete($.extend({
11990               source: function (request, response) {AutoCompleteSource(request, response, googleOptions); },
11991               minLength: 3,
11992               select: AutoCompleteSelected,
11993               focus: AutoCompleteFocus 
11994            }, autoCompleteOptions)).data("ui-autocomplete")._renderItem = RenderWithHighlight;
11995            this.autocomplete("widget").addClass("address");
11996            this.parent().append('<div class="placesServiceHelper"></div>');
11997            serviceHelper = this.parent().find(".placesServiceHelper").get(0);
11998            return this;
11999         }
12000      }
12001      $.fn.address = function(optionsOrMethod){
12002         if(methods[optionsOrMethod]){
12003            return methods[optionsOrMethod].apply(this, Array.prototype.slice.call( arguments, 1 ));
12004         }
12005         else{
12006            return methods.init.apply(this, arguments);
12007         }
12008      }
12009   } ( jQuery ));
12010}
12011/* End Google Places Support */
12012/* Placeholder support where not supported in HTML 5 */
12013function registerPlaceholderBehaviour() {
12014   var i=document.createElement("input");
12015   var t=document.createElement("textarea");
12016   if(!("placeholder" in i) && typeof($) != "undefined"){
12017      $("input[placeholder]").each(function(index, item) {
12018         if(!$(item).val()) {
12019            $(item).addClass("placeholder");
12020            $(item).val($(item).attr("placeholder"));
12021         }
12022      });
12023      $("input[placeholder]").on("focus", function(){
12024         if($(this).hasClass("placeholder")) {
12025            $(this).removeClass("placeholder");
12026            $(this).val("");
12027         }
12028      });
12029      $("input[placeholder]").on("blur", function(){
12030         if($(this).val() == "") {
12031            $(this).addClass("placeholder");
12032            $(this).val($(this).attr("placeholder"));
12033         }
12034      });
12035   }
12036   if(!("placeholder" in t) && typeof($) != "undefined"){
12037      $("textarea[placeholder]").each(function(index, item) {
12038         if(!$(item).html()) {
12039            $(item).addClass("placeholder");
12040            $(item).html($(item).attr("placeholder"));
12041         }
12042      });
12043      $("textarea[placeholder]").on("focus", function(){
12044         if($(this).hasClass("placeholder")) {
12045            $(this).removeClass("placeholder");
12046            $(this).html("");
12047         }
12048      });
12049      $("textarea[placeholder]").on("blur", function(){
12050         if($(this).val() == "") {
12051            $(this).addClass("placeholder");
12052            $(this).html($(this).attr("placeholder"));
12053         }
12054      });
12055   }
12056   if(!window.clearPlaceholders) {
12057      var oldPostBack = __doPostBack;
12058      __doPostBack = function(eventTarget, eventArgument) {
12059         if(typeof(window.clearPlaceholders)=="function") {
12060            window.clearPlaceholders();
12061         }
12062         oldPostBack(eventTarget, eventArgument);
12063      };
12064      window.clearPlaceholders=function(){
12065         if(!("placeholder" in i)){
12066            $("input.placeholder[placeholder]").val("");
12067         }
12068         if(!("placeholder" in t)){
12069            $("textarea.placeholder[placeholder]").html("");
12070         }
12071      }
12072      window.resetPlaceholders=function(){
12073         if(!("placeholder" in i)){
12074            $("input.placeholder[placeholder]").each(function(index,item){
12075               $(item).val($(item).attr("placeholder"));
12076            });
12077         }
12078         if(!("placeholder" in t)){
12079            $("textarea.placeholder[placeholder]").each(function(index,item){
12080               $(item).html($(item).attr("placeholder"));
12081            });
12082         }
12083      }
12084   }
12085}
12086if(typeof(jQuery) == "function"){
12087   var i=document.createElement("input");
12088   var t=document.createElement("textarea");
12089   if((!("placeholder" in i) || !("placeholder" in t)) && typeof($) != "undefined"){
12090      $(function() {
12091         if(typeof(Sys) == "undefined") return;
12092         Sys.Application.add_load(registerPlaceholderBehaviour);
12093      });
12094   }
12095}
12096/* End Placeholder support */
12097/* Large Radio Button Support */
12098var inRadioButtonLargeClick = false;
12099function registerRadioButtonLargeBehaviour() {
12100   $(".radioButtonLarge").on("click", function(e){
12101      if(!inRadioButtonLargeClick) {
12102         inRadioButtonLargeClick = true;
12103         var input = $(this).find("input");
12104         if(!input.prop("disabled")) {
12105            input.prop("checked", true);
12106            /* Remove the checked attribute from other radio buttons for compatibility with old DCS versions < 2.74. */
12107            $(".radioButtonLarge input[name='"+input.attr("name")+"']:not([id='"+input.attr("id")+"'])").each(function(index,item) {
12108               item.removeAttribute("checked");
12109            });
12110            input.trigger("click");
12111            input.trigger("change");
12112            input.trigger("referencechange");
12113         }
12114         inRadioButtonLargeClick=false;
12115      }
12116   });
12117   $(".radioButtonLarge input").on("change", function() {
12118      $("input[name='" + $(this).attr("name") + "']").each(function(index, item) {
12119         if($(item).prop("disabled")) {
12120            $(item).parent(".radioButtonLarge").addClass("disabled");
12121         }
12122         else {
12123            $(item).parent(".radioButtonLarge").removeClass("disabled");
12124         }
12125         if($(item).prop("checked")) {
12126            $(item).parent(".radioButtonLarge").addClass("selected");
12127         }
12128         else {
12129            $(item).parent(".radioButtonLarge").removeClass("selected");
12130         }
12131      });
12132   });
12133   $(".rblCircle").each(function(index, item) {
12134      if(!$(item).parents(".radioButtonLarge").length) {
12135         $(item).off("click").on("click", function(e) {
12136            if(!inRadioButtonLargeClick) {
12137               inRadioButtonLargeClick = true;
12138               var input = $(this).siblings("input");
12139               if(!input.prop("disabled")) {
12140                  input.prop("checked", true);
12141                  /* Remove the checked attribute from other radio buttons for compatibility with old DCS versions < 2.74. */
12142                  $(item).closest(".ansRB").find("input[name='"+input.attr("name")+"']:not([id='"+input.attr("id")+"'])").each(function(index,item) {
12143                     item.removeAttribute("checked");
12144                  });
12145                  input.trigger("click");
12146                  input.trigger("change");
12147                  input.trigger("referencechange");
12148               }
12149               inRadioButtonLargeClick=false;
12150            }
12151            e.stopPropagation();
12152            e.preventDefault();
12153         });
12154      }
12155   });
12156}
12157if(typeof(jQuery) == "function"){
12158   $( function() {
12159      if(typeof(Sys) == "undefined") return;
12160      Sys.Application.add_load(registerRadioButtonLargeBehaviour);
12161      if(Sys.Application._loaded) registerRadioButtonLargeBehaviour();
12162   });
12163}
12164/* End Large Radio Button Support */
12165/* Large CheckBox Support */
12166if(typeof($) != "undefined") {
12167   $(function() {
12168      registerPostStartUpScript(function() {
12169         /* Remove all click events for checkBoxLarge, as they interfere with the default label functionality. */
12170         $(".checkBoxLarge").off("click");
12171         /* Backwards compatibility for code contained in DCSMain < 2.92 */
12172         $(".checkBoxLarge").on("click", function() {
12173            var input = $(this).find("input");
12174            if(!input.length) return;
12175            if(input.prop("checked")) {
12176               input.get(0).setAttribute("checked", "checked");
12177            }
12178            else {
12179               input.get(0).removeAttribute("checked");
12180            }
12181         });
12182      });
12183   });
12184}
12185function registerCheckBoxLargeBehaviour() {
12186   $(".checkBoxLarge input").on("change", function() {
12187       if($(this).prop("disabled")) {
12188         $(this).parent(".checkBoxLarge").addClass("disabled");
12189      }
12190      else {
12191         $(this).parent(".checkBoxLarge").removeClass("disabled");
12192      }
12193      if($(this).prop("checked")) {
12194         $(this).parent(".checkBoxLarge").addClass("selected");
12195      }
12196      else {
12197         $(this).parent(".checkBoxLarge").removeClass("selected");
12198      }
12199      /* Make sure the "attr" is set appropriately, in Edge it hasn't been changed yet when this event triggers and older versions of DCS still register javascript that checks that instead of "prop" */
12200      $(this).attr("checked", $(this).prop("checked") ? "checked" : null);
12201      $(this).attr("disabled", $(this).prop("disabled") ? "disabled" : null);
12202   });
12203}
12204if(typeof(jQuery) == "function"){
12205   $( function() {
12206      if(typeof(Sys) == "undefined") return;
12207      Sys.Application.add_load(registerCheckBoxLargeBehaviour);
12208      if(Sys.Application._loaded) registerCheckBoxLargeBehaviour();
12209   });
12210}
12211/* End Large CheckBox Support */
12212/* Tabs */
12213var framesLoaded = new Array();
12214var currentTabLoadingID = null;
12215$(initTabs);
12216function initTabs(){
12217   $('.tabs').tabs({
12218      activate: showTabLoading,
12219      create: showTabLoading
12220   });
12221}
12222function showTabLoading(event, ui){
12223   if(currentTabLoadingID != null) hideMessage(currentTabLoadingID);
12224   var panel = ui.panel;
12225   if(!panel) panel = ui.newPanel;
12226   var frame = panel.find("iframe");
12227   if(frame.length > 0){
12228      var frameID = frame.get(0).id;
12229      if($.inArray(frameID, framesLoaded) < 0){
12230         currentTabLoadingID = frameID+'Loading';
12231         showMessage('Loading', {id:currentTabLoadingID, overElementID:frameID});
12232      }
12233   }
12234}
12235if(typeof(jQuery) != "undefined" && typeof(getQueryStringValue) == "function" && getQueryStringValue("framed") == 1){
12236   $(parentFrameLoadComplete);
12237}
12238function parentFrameLoadComplete(){
12239   try{
12240      var id = null;
12241      if(frameElement) id = frameElement.id;
12242      if(typeof(top.frameLoadComplete) == "function") top.frameLoadComplete(id);
12243      return;
12244   }
12245   catch(e){
12246      parentPostMessage("frameLoadComplete:" + escapeForPostMessage(id));
12247      return;
12248   }
12249}
12250function frameLoadComplete(frameID){
12251   if(frameID != null){
12252      framesLoaded.push(frameID);
12253      hideMessage(frameID + "Loading");
12254   }
12255   else{
12256      hideMessage(); /* The frame element didn't work for some reason, just hide all messages so users aren't locked out. */
12257   }
12258}
12259/* End Tabs */
12260/* Begin Inline Paragraph Questions */
12261function resizeInlineParagraphQuestion(input, displayText) {
12262	if(typeof(displayText) == "undefined") displayText=null;
12263	var origWidth = $(input).attr("data-originalWidth") ? parseInt($(input).attr("data-originalWidth")) : 0;
12264	var ipqMeasure = $("#content > .ipqMeasure");
12265   var inputValue = $(input).val();
12266   var inputPlaceholder = $(input).attr("placeholder");
12267	ipqMeasure.html(displayText ? displayText : (inputValue ? inputValue : inputPlaceholder));
12268   if($(input).parents(".datePickerWrapper").length) {
12269      $(ipqMeasure).addClass("ipqMeasureDatePicker");
12270      var ipqWidth = ipqMeasure.outerWidth();
12271      if(ipqWidth > origWidth) {
12272         $(input).css({width: ipqWidth+"px"});
12273         $(input).siblings(".mobileDatePicker").css("width", ipqWidth+"px");
12274      }
12275      else {
12276         $(input).css({width: origWidth+"px"});		
12277         $(input).siblings(".mobileDatePicker").css("width", origWidth+"px");
12278      }
12279      $(ipqMeasure).removeClass("ipqMeasureDatePicker");
12280   }
12281   else {
12282      var ipqWidth = ipqMeasure.outerWidth();
12283      if(ipqWidth > origWidth) {
12284         $(input).css({width: ipqWidth+"px"});
12285      }
12286      else {
12287         $(input).css({width: origWidth+"px"});		
12288      }
12289   }
12290   qnh.AnimateSectionHeight(undefined, 200, 1);
12291}
12292function initializeInlineParagraphQuestions() {
12293   if(!$("#content > .ipqMeasure").length) $('<span class="ipqMeasure"></span>').appendTo($("#content"));
12294	$("#content .ipq input[type='text'],#content .ipq input[type='number'],#content .ipq input:not(type)").on("keyup", function() {
12295		resizeInlineParagraphQuestion(this);
12296	});
12297	$("#content .ipq .datePickerWrapper input").on("change", function() {
12298		resizeInlineParagraphQuestion(this);
12299	});
12300	$("#content .ipq input[type='text'],#content .ipq input[type='number'],#content .ipq input:not(type)").each(function(index, item) {
12301      var isSlatePage = typeof(isSlate) == "function" && isSlate();
12302      if(!isSlatePage) $(item).attr("data-originalWidth", $(item).outerWidth());
12303		resizeInlineParagraphQuestion(item, $(item).siblings(".numericFormat").length ? $(item).siblings(".numericFormat").html() : null);
12304	});
12305	$("#content .ipq .datePickerWrapper input[readonly]").on("click", function() {
12306      $(this).datepicker("show");
12307   });
12308}
12309if(typeof($) == "function") {
12310	$(function() {
12311		initializeInlineParagraphQuestions();
12312	});
12313	rE(window, "load", function() {
12314		$("#content .ipq input[type='text'],#content .ipq input[type='number'],#content .ipq input:not(type)").each(function(index, item) {
12315			resizeInlineParagraphQuestion(item, $(item).siblings(".numericFormat").length ? $(item).siblings(".numericFormat").html() : null);
12316		});
12317	});
12318}
12319/* End Inline Paragraph Questions */
12320
12321/* Initialize a region name autocomplete control */
12322function initDropdownAutoComplete(inputID, controlID, autoCompleteSource, clientValId, selCssClass){
12323   var input = $("#" + inputID);
12324
12325   if(input.length == 0) return;
12326   var wasOpen = false;   
12327    
12328   input.autocomplete({
12329            source: autoCompleteSource,
12330            minLength: 0,
12331            select : function(event, ui){
12332                            event.preventDefault();
12333                            $("#"+ inputID).val(ui.item.label);
12334                            $("#" + controlID +"_hidKey").val(ui.item.value);
12335                            $("#" + controlID +"_hidVal").val(ui.item.label);
12336            },
12337            close: function(event,ui){
12338                        event.preventDefault();                               
12339                        if(clientValId)                    
12340                            vh.S(clientValId,  $("#" + controlID +"_hidKey").val(),null,null);
12341            },
12342            focus : function(event,ui){
12343                    event.preventDefault();                    
12344            },
12345            delay: 0
12346        })
12347        .on("focus", function(e){        
12348            if (navigator.userAgent.match(/Edge/) ) {
12349                return setTimeout( e.target.select.bind( e.target ), 10)
12350            }
12351            e.target.select();
12352            input.autocomplete("search","");
12353        })
12354        .on("blur", function(e){
12355            var value = $(this).val();
12356            var prevValue = $("#" + controlID +"_hidVal").val(); 
12357            if(value =="" || value != prevValue){                    
12358                input.val(prevValue);
12359            }
12360        });
12361
12362   input.data("ui-autocomplete")._renderItem = function(ul, item) {
12363      if(item.value) {
12364         if(item.value == "sel" && selCssClass){
12365                return $("<li class='"+selCssClass+"'>")
12366                .append("<a>"+item.label+"</a>")
12367                .appendTo(ul);
12368         }else
12369                return $("<li>")
12370                    .append("<a>"+item.label+"</a>")
12371                    .appendTo(ul);
12372      }
12373      else {
12374         return $("<li>")
12375            .addClass("newOption")
12376            .append("<a>"+item.label+"</a>")
12377            .appendTo(ul);
12378      }
12379   };
12380
12381   $("#" + controlID + "_in_dropdown")
12382      .button({
12383         icons: {
12384            primary: "ui-icon-triangle-1-s"
12385         },
12386         text: false
12387      })
12388      .removeClass("ui-corner-all")
12389      .addClass("ui-corner-right ui-combobox-toggle dd-autocomplete")
12390      .on("mousedown", function() {
12391         wasOpen = $("#" + inputID).autocomplete("widget").is(":visible");
12392      })
12393      .on("click", function() {
12394         $("#" + inputID).trigger("focus");
12395         if(wasOpen) {
12396            return;
12397         }
12398         $("#" + inputID).autocomplete("search", "");
12399      });
12400
12401      if(typeof(cssua) != "undefined" && cssua.ua.chrome)
12402        input.attr("autocomplete","new-password");
12403      else
12404        input.attr("autocomplete","false");
12405      
12406      if(clientValId) vh.S(clientValId,  $("#" + controlID +"_hidKey").val(),null,null);
12407
12408}
12409/* Output Template Handling */
12410function TemplateUpdate(name){
12411   if(outputTemplate != name){
12412      var elements = $(".templated");
12413      elements.removeClass("template_"+outputTemplate).addClass("template_"+name);
12414      outputTemplate = name;
12415      $("#outputTemplate").val(name);
12416   
12417      if (typeof(qnh) != "undefined" && qnh.IsPreview()){
12418         if(typeof(scrollToEl) == "function") scrollToEl($('#contract').first(), 1000);
12419         if(typeof(wdid) != "undefined") CallDataService("UpdateTemplate", { "webuserDataID": wdid, "template":name });
12420      }
12421   }
12422}
12423(function($){
12424   $.fn.DocumentTools = function() {
12425      this.each(function() {
12426         var jqObj = $(this);
12427         var toolSelect = jqObj.find(".ToolSelection");
12428         var openTemplatePicker = jqObj.find(".templatePickerOpen");
12429         var closeTemplatePicker = jqObj.find(".templatePickerClose");
12430         var templatePicker = jqObj.find(".templatePicker");
12431         var animationDuration = 500;
12432         initTemplatePicker(templatePicker);
12433         openTemplatePicker.on("click", function(ev) {
12434            recalcSlick(templatePicker); /* This is necessary because it seems like slick will sometimes recalculate itself while hidden and end up wrong. This quickly shows it, recalculates then hides it and allow for it to be properly shown via an animation. */
12435            toolSelect.hide(animationDuration); 
12436            templatePicker.show(animationDuration);
12437            ev.preventDefault();
12438         });
12439         closeTemplatePicker.on("click", function(ev) {
12440            toolSelect.show(animationDuration);
12441            templatePicker.hide(animationDuration);
12442            ev.preventDefault();
12443         });
12444         jqObj.find("input").on("click", function() {TemplateUpdate(this.value);});
12445      });
12446      function setCloneHighlight(ev){
12447         var target = $(ev.target);
12448         var val = target.val();
12449         var templates = target.closest('.templates');
12450         templates.find('.highlight').removeClass('highlight');
12451         templates.find('.slick-cloned input[value="' + val + '"]').parent().addClass('highlight');
12452      }
12453      function initTemplatePicker(templatePicker){
12454         var templates = templatePicker.find(".templates .ansRB .ansRB");
12455         var switchFilter = templates.find(".switchFilter");
12456         if(!templates.hasClass('slick-initialized') && templates.children().length > 4 + switchFilter.length){
12457            templatePicker.show();
12458            /* Detach the switchFilter while the slick carousel is being applied so it doesn't try to include it in the carousel */
12459            switchFilter.detach();
12460            var sel = templates.find("input:checked");
12461            var selID = sel.attr('id');
12462            templates.slick({
12463               slidesToShow:3,
12464               slidesToScroll:3,
12465               initialSlide: Math.floor(sel.parent().index() / 3) * 3
12466            });
12467            if(switchFilter.length > 0){
12468               switchFilter.appendTo(templates.find('.slick-track'));
12469               positionSlateSwitch(sel.parent(), 0);
12470            }
12471            templates.find("input").on("click", setCloneHighlight); 
12472            sel.trigger('click');
12473            console.log('hide');
12474            templatePicker.hide();
12475         }
12476      }
12477      function recalcSlick(templatePicker){
12478         templatePicker.show();
12479         templatePicker.find('.slick-initialized').slick('setPosition');
12480         templatePicker.hide();
12481      }
12482   }
12483}(jQuery));
12484$(function(){$('.DocumentTools').DocumentTools();});
12485/* End Output Template Handling */
12486
12487function initGroupHelpAccordion(){
12488      $("#groupHelpAccordion").accordion({
12489         header: "> div > h3",
12490         active: false,
12491         autoHeight: false,
12492         heightStyle: "content",
12493         collapsible: true
12494   });
12495}
12496
12497$(function(){
12498   initGroupHelpAccordion();
12499});
12500
12501/* User Defined Document names do not respect multiple white space
12501s
12502   - On Landing Page, Preview Page and Editor Page
12503   - Get the Document Title Node, Trim all the existing white space and append the node with css (white-space: pre-wrap)
12504*/
12505$(function () {
12506	// Determine node that will have the document title in it depending on which page you are on
12507   var titleSelector;
12508   if($('.previewPage').length) {
12509	   titleSelector = '.previewHead .titleBar .webuserDataName';
12510
12511	   // Newer preview pages on lawdepot do not require trimming, as the .webuserDataName will contain an editable input
12512	   if($(titleSelector + " input").length) return;
12513   }
12514   else if(typeof(usingLDEditor) !== 'undefined') titleSelector = '.editor-head .title-bar > span';
12515   else titleSelector = '.contractPreviewWrapper .previewHead > h3';
12516	
12517
12518   var titles = [];
12519   $.each($(titleSelector), function (i, val) { 
12520       titles.push(val);
12521   });
12522
12523   if(titles.length > 0) {
12524      titles.map(function(title) {
12525         $(title).text($(title).text().trim()).css('white-space','pre-wrap');
12526      });  
12527   }  
12528});
12529/* End Include controls */
12530
12531/* Include ajax */
12532var ajaxMan;
12533var ajaxInProgress = false;
12534function getAjaxMan(){
12535   if(typeof(ajaxMan) == "string"){
12536      ajaxMan = $find(ajaxMan);
12537   }
12538   return ajaxMan;
12539}
12540/**
12541 * Displays a loading message.
12542 * @param {boolean} full - no longer used, kept here for legacy reasons.
12543 * @param {boolean} [closeMessages=true] - if already open messages should be forcibly closed before creating the new message. All messages will be closed regardless of message priority.
12544 */
12545function AjaxWait(full, closeMessages){
12546	if(closeMessages === undefined){
12547		//default to true
12548		closeMessages = true;
12549	}
12550	if(closeMessages){
12551		hideMessage();
12552	}
12553	showMessage("Loading");
12554}
12555function AjaxSecureLoad(callback){} /* AjaxSecureLoad is deprecated and can be removed once all contracts are DCSMain3.22+ */
12556function AjaxRequestStart(){
12557	if(!qnh.PreloadGroups) {
12558		vh.C();
12559	}
12560   ajaxInProgress = true;
12561}
12562/* Disable scroll position updates when preloading. */
12563if(typeof($) == "function") {
12564	$(function() {
12565		if(typeof(Sys) != "undefined") {
12566			var prm = Sys.WebForms.PageRequestManager.getInstance();
12567			prm.add_beginRequest(function() {
12568				if(qnh.PreloadGroups && !qnh.PreloadGroupsState) {
12569					prm._scrollPosition = null;
12570				}
12571			});
12572		}
12573	});
12574}
12575function AjaxResponseEnd(){
12576	if(qnh.PreloadGroups && qnh.CurrentlyLoadingGroup && qnh.PreloadGroupsState != "paused") {
12577		qnh.LoadedGroup();
12578	}
12579	else {
12580		if(qnh.PreloadGroupsState == "paused" || qnh.PreloadGroupsState == "pausing") {
12581			qnh.PreloadGroupsState = null;
12582		}
12583		registerCurrentRegionUpdate();
12584      var requestFromQnh = qnh.WaitingForAJAX;
12585		qnh.AJAXCallBack();
12586		if(typeof(resizeSelectBoxes) == "undefined" && isSmallScreen()) {
12587			initializeSmallScreenSelectBoxes();
12588		}
12589		if(typeof(fixMobileAjaxResponse) == "function") {
12590			fixMobileAjaxResponse();
12591		}
12592      if(typeof(addSkipQuestion) == "function"){
12593         addSkipQuestion();
12594      }
12595      if(typeof(showSignInDialogOnSignOut) == "function" && !requestFromQnh) { /* qnh does it's own call to showSignInDialogOnSignOut before navigating */
12596         showSignInDialogOnSignOut();
12597      }
12598      if(typeof(fixTextareaMaxlength) == "function") {
12599         fixTextareaMaxlength();
12600      }
12601      $(window).trigger("ajaxResponseEnd");
12602		hideMessage();
12603      setSave(true);
12604	}
12605   ajaxInProgress = false;
12606   setTimeout(initializeInlineParagraphQuestions, 0); /* This seems to get incorrect original widths sometimes when just run directly. When run using setTimeout the widths appear to be correct. */
12607}
12608var ajaxError = false;
12609function EndRequestHandler(sender, args){
12610   if(args.get_error() != undefined) {
12611		var error = args.get_error();
12612		if(error.httpStatusCode == '500' || error.name == "Sys.WebForms.PageRequestManagerParserErrorException") {
12613         ajaxError = true;
12614			if(typeof(window.onerror == "function")) {
12615				window.onerror(error.message, error.fileName, error.lineNumber);
12616			}
12617         showGenericErrorDialog();
12618   	   args.set_errorHandled(true);
12619   	}
12620		else if(error.httpStatusCode == '0') {
12621   	   args.set_errorHandled(true);
12622		}
12623	}
12624}
12625
12626/* End Include ajax */
12627
12628/* Include moment.min */
vendor: 53,324 bytes, line 12629
12629!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.moment=t()}(this,function(){"use strict";var e,i;function c(){return e.apply(null,arguments)}function o(e){return e instanceof Array||"[object Array]"===Object.prototype.toString.call(e)}function u(e){return null!=e&&"[object Object]"===Object.prototype.toString.call(e)}function l(e){return void 0===e}function h(e){return"number"==typeof e||"[object Number]"===Object.prototype.toString.call(e)}function d(e){return e instanceof Date||"[object Date]"===Object.prototype.toString.call(e)}function f(e,t){var n,s=[];for(n=0;n<e.length;++n)s.push(t(e[n],n));return s}function m(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function _(e,t){for(var n in t)m(t,n)&&(e[n]=t[n]);return m(t,"toString")&&(e.toString=t.toString),m(t,"valueOf")&&(e.valueOf=t.valueOf),e}function y(e,t,n,s){return Tt(e,t,n,s,!0).utc()}function g(e){return null==e._pf&&(e._pf={empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1,parsedDateParts:[],meridiem:null,rfc2822:!1,weekdayMismatch:!1}),e._pf}function v(e){if(null==e._isValid){var t=g(e),n=i.call(t.parsedDateParts,function(e){return null!=e}),s=!isNaN(e._d.getTime())&&t.overflow<0&&!t.empty&&!t.invalidMonth&&!t.invalidWeekday&&!t.weekdayMismatch&&!t.nullInput&&!t.invalidFormat&&!t.userInvalidated&&(!t.meridiem||t.meridiem&&n);if(e._strict&&(s=s&&0===t.charsLeftOver&&0===t.unusedTokens.length&&void 0===t.bigHour),null!=Object.isFrozen&&Object.isFrozen(e))return s;e._isValid=s}return e._isValid}function p(e){var t=y(NaN);return null!=e?_(g(t),e):g(t).userInvalidated=!0,t}i=Array.prototype.some?Array.prototype.some:function(e){for(var t=Object(this),n=t.length>>>0,s=0;s<n;s++)if(s in t&&e.call(this,t[s],s,t))return!0;return!1};var r=c.momentProperties=[];function w(e,t){var n,s,i;if(l(t._isAMomentObject)||(e._isAMomentObject=t._isAMomentObject),l(t._i)||(e._i=t._i),l(t._f)||(e._f=t._f),l(t._l)||(e._l=t._l),l(t._strict)||(e._strict=t._strict),l(t._tzm)||(e._tzm=t._tzm),l(t._isUTC)||(e._isUTC=t._isUTC),l(t._offset)||(e._offset=t._offset),l(t._pf)||(e._pf=g(t)),l(t._locale)||(e._locale=t._locale),0<r.length)for(n=0;n<r.length;n++)l(i=t[s=r[n]])||(e[s]=i);return e}var t=!1;function M(e){w(this,e),this._d=new Date(null!=e._d?e._d.getTime():NaN),this.isValid()||(this._d=new Date(NaN)),!1===t&&(t=!0,c.updateOffset(this),t=!1)}function k(e){return e instanceof M||null!=e&&null!=e._isAMomentObject}function S(e){return e<0?Math.ceil(e)||0:Math.floor(e)}function D(e){var t=+e,n=0;return 0!==t&&isFinite(t)&&(n=S(t)),n}function a(e,t,n){var s,i=Math.min(e.length,t.length),r=Math.abs(e.length-t.length),a=0;for(s=0;s<i;s++)(n&&e[s]!==t[s]||!n&&D(e[s])!==D(t[s]))&&a++;return a+r}function Y(e){!1===c.suppressDeprecationWarnings&&"undefined"!=typeof console&&console.warn&&console.warn("Deprecation warning: "+e)}function n(i,r){var a=!0;return _(function(){if(null!=c.deprecationHandler&&c.deprecationHandler(null,i),a){for(var e,t=[],n=0;n<arguments.length;n++){if(e="","object"==typeof arguments[n]){for(var s in e+="\n["+n+"] ",arguments[0])e+=s+": "+arguments[0][s]+", ";e=e.slice(0,-2)}else e=arguments[n];t.push(e)}Y(i+"\nArguments: "+Array.prototype.slice.call(t).join("")+"\n"+(new Error).stack),a=!1}return r.apply(this,arguments)},r)}var s,O={};function T(e,t){null!=c.deprecationHandler&&c.deprecationHandler(e,t),O[e]||(Y(t),O[e]=!0)}function b(e){return e instanceof Function||"[object Function]"===Object.prototype.toString.call(e)}function x(e,t){var n,s=_({},e);for(n in t)m(t,n)&&(u(e[n])&&u(t[n])?(s[n]={},_(s[n],e[n]),_(s[n],t[n])):null!=t[n]?s[n]=t[n]:delete s[n]);for(n in e)m(e,n)&&!m(t,n)&&u(e[n])&&(s[n]=_({},s[n]));return s}function P(e){null!=e&&this.set(e)}c.suppressDeprecationWarnings=!1,c.deprecationHandler=null,s=Object.keys?Object.keys:function(e){var t,n=[];for(t in e)m(e,t)&&n.push(t);return n};var W={};function C(e,t){var n=e.toLowerCase();W[n]=W[n+"s"]=W[t]=e}function H(e){return"string"==typeof e?W[e]||W[e.toLowerCase()]:void 0}function R(e){var t,n,s={};for(n in e)m(e,n)&&(t=H(n))&&(s[t]=e[n]);return s}var U={};function F(e,t){U[e]=t}function L(e,t,n){var s=""+Math.abs(e),i=t-s.length;return(0<=e?n?"+":"":"-")+Math.pow(10,Math.max(0,i)).toString().substr(1)+s}var N=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,G=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,V={},E={};function I(e,t,n,s){var i=s;"string"==typeof s&&(i=function(){return this[s]()}),e&&(E[e]=i),t&&(E[t[0]]=function(){return L(i.apply(this,arguments),t[1],t[2])}),n&&(E[n]=function(){return this.localeData().ordinal(i.apply(this,arguments),e)})}function A(e,t){return e.isValid()?(t=j(t,e.localeData()),V[t]=V[t]||function(s){var e,i,t,r=s.match(N);for(e=0,i=r.length;e<i;e++)E[r[e]]?r[e]=E[r[e]]:r[e]=(t=r[e]).match(/\[[\s\S]/)?t.replace(/^\[|\]$/g,""):t.replace(/\\/g,"");return function(e){var t,n="";for(t=0;t<i;t++)n+=b(r[t])?r[t].call(e,s):r[t];return n}}(t),V[t](e)):e.localeData().invalidDate()}function j(e,t){var n=5;function s(e){return t.longDateFormat(e)||e}for(G.lastIndex=0;0<=n&&G.test(e);)e=e.replace(G,s),G.lastIndex=0,n-=1;return e}var Z=/\d/,z=/\d\d/,$=/\d{3}/,q=/\d{4}/,J=/[+-]?\d{6}/,B=/\d\d?/,Q=/\d\d\d\d?/,X=/\d\d\d\d\d\d?/,K=/\d{1,3}/,ee=/\d{1,4}/,te=/[+-]?\d{1,6}/,ne=/\d+/,se=/[+-]?\d+/,ie=/Z|[+-]\d\d:?\d\d/gi,re=/Z|[+-]\d\d(?::?\d\d)?/gi,ae=/[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i,oe={};function ue(e,n,s){oe[e]=b(n)?n:function(e,t){return e&&s?s:n}}function le(e,t){return m(oe,e)?oe[e](t._strict,t._locale):new RegExp(he(e.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(e,t,n,s,i){return t||n||s||i})))}function he(e){return e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}var de={};function ce(e,n){var t,s=n;for("string"==typeof e&&(e=[e]),h(n)&&(s=function(e,t){t[n]=D(e)}),t=0;t<e.length;t++)de[e[t]]=s}function fe(e,i){ce(e,function(e,t,n,s){n._w=n._w||{},i(e,n._w,n,s)})}var me=0,_e=1,ye=2,ge=3,ve=4,pe=5,we=6,Me=7,ke=8;function Se(e){return De(e)?366:365}function De(e){return e%4==0&&e%100!=0||e%400==0}I("Y",0,0,function(){var e=this.year();return e<=9999?""+e:"+"+e}),I(0,["YY",2],0,function(){return this.year()%100}),I(0,["YYYY",4],0,"year"),I(0,["YYYYY",5],0,"year"),I(0,["YYYYYY",6,!0],0,"year"),C("year","y"),F("year",1),ue("Y",se),ue("YY",B,z),ue("YYYY",ee,q),ue("YYYYY",te,J),ue("YYYYYY",te,J),ce(["YYYYY","YYYYYY"],me),ce("YYYY",function(e,t){t[me]=2===e.length?c.parseTwoDigitYear(e):D(e)}),ce("YY",function(e,t){t[me]=c.parseTwoDigitYear(e)}),ce("Y",function(e,t){t[me]=parseInt(e,10)}),c.parseTwoDigitYear=function(e){return D(e)+(68<D(e)?1900:2e3)};var Ye,Oe=Te("FullYear",!0);function Te(t,n){return function(e){return null!=e?(xe(this,t,e),c.updateOffset(this,n),this):be(this,t)}}function be(e,t){return e.isValid()?e._d["get"+(e._isUTC?"UTC":"")+t]():NaN}function xe(e,t,n){e.isValid()&&!isNaN(n)&&("FullYear"===t&&De(e.year())&&1===e.month()&&29===e.date()?e._d["set"+(e._isUTC?"UTC":"")+t](n,e.month(),Pe(n,e.month())):e._d["set"+(e._isUTC?"UTC":"")+t](n))}function Pe(e,t){if(isNaN(e)||isNaN(t))return NaN;var n,s=(t%(n=12)+n)%n;return e+=(t-s)/12,1===s?De(e)?29:28:31-s%7%2}Ye=Array.prototype.indexOf?Array.prototype.indexOf:function(e){var t;for(t=0;t<this.length;++t)if(this[t]===e)return t;return-1},I("M",["MM",2],"Mo",function(){return this.month()+1}),I("MMM",0,0,function(e){return this.localeData().monthsShort(this,e)}),I("MMMM",0,0,function(e){return this.localeData().months(this,e)}),C("month","M"),F("month",8),ue("M",B),ue("MM",B,z),ue("MMM",function(e,t){return t.monthsShortRegex(e)}),ue("MMMM",function(e,t){return t.monthsRegex(e)}),ce(["M","MM"],function(e,t){t[_e]=D(e)-1}),ce(["MMM","MMMM"],function(e,t,n,s){var i=n._locale.monthsParse(e,s,n._strict);null!=i?t[_e]=i:g(n).invalidMonth=e});var We=/D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/,Ce="January_February_March_April_May_June_July_August_September_October_November_December".split("_");var He="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_");function Re(e,t){var n;if(!e.isValid())return e;if("string"==typeof t)if(/^\d+$/.test(t))t=D(t);else if(!h(t=e.localeData().monthsParse(t)))return e;return n=Math.min(e.date(),Pe(e.year(),t)),e._d["set"+(e._isUTC?"UTC":"")+"Month"](t,n),e}function Ue(e){return null!=e?(Re(this,e),c.updateOffset(this,!0),this):be(this,"Month")}var Fe=ae;var Le=ae;function Ne(){function e(e,t){return t.length-e.length}var t,n,s=[],i=[],r=[];for(t=0;t<12;t++)n=y([2e3,t]),s.push(this.monthsShort(n,"")),i.push(this.months(n,"")),r.push(this.months(n,"")),r.push(this.monthsShort(n,""));for(s.sort(e),i.sort(e),r.sort(e),t=0;t<12;t++)s[t]=he(s[t]),i[t]=he(i[t]);for(t=0;t<24;t++)r[t]=he(r[t]);this._monthsRegex=new RegExp("^("+r.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=new RegExp("^("+i.join("|")+")","i"),this._monthsShortStrictRegex=new RegExp("^("+s.join("|")+")","i")}function Ge(e){var t;if(e<100&&0<=e){var n=Array.prototype.slice.call(arguments);n[0]=e+400,t=new Date(Date.UTC.apply(null,n)),isFinite(t.getUTCFullYear())&&t.setUTCFullYear(e)}else t=new Date(Date.UTC.apply(null,arguments));return t}function Ve(e,t,n){var s=7+t-n;return-((7+Ge(e,0,s).getUTCDay()-t)%7)+s-1}function Ee(e,t,n,s,i){var r,a,o=1+7*(t-1)+(7+n-s)%7+Ve(e,s,i);return a=o<=0?Se(r=e-1)+o:o>Se(e)?(r=e+1,o-Se(e)):(r=e,o),{year:r,dayOfYear:a}}function Ie(e,t,n){var s,i,r=Ve(e.year(),t,n),a=Math.floor((e.dayOfYear()-r-1)/7)+1;return a<1?s=a+Ae(i=e.year()-1,t,n):a>Ae(e.year(),t,n)?(s=a-Ae(e.year(),t,n),i=e.year()+1):(i=e.year(),s=a),{week:s,year:i}}function Ae(e,t,n){var s=Ve(e,t,n),i=Ve(e+1,t,n);return(Se(e)-s+i)/7}I("w",["ww",2],"wo","week"),I("W",["WW",2],"Wo","isoWeek"),C("week","w"),C("isoWeek","W"),F("week",5),F("isoWeek",5),ue("w",B),ue("ww",B,z),ue("W",B),ue("WW",B,z),fe(["w","ww","W","WW"],function(e,t,n,s){t[s.substr(0,1)]=D(e)});function je(e,t){return e.slice(t,7).concat(e.slice(0,t))}I("d",0,"do","day"),I("dd",0,0,function(e){return this.localeData().weekdaysMin(this,e)}),I("ddd",0,0,function(e){return this.localeData().weekdaysShort(this,e)}),I("dddd",0,0,function(e){return this.localeData().weekdays(this,e)}),I("e",0,0,"weekday"),I("E",0,0,"isoWeekday"),C("day","d"),C("weekday","e"),C("isoWeekday","E"),F("day",11),F("weekday",11),F("isoWeekday",11),ue("d",B),ue("e",B),ue("E",B),ue("dd",function(e,t){return t.weekdaysMinRegex(e)}),ue("ddd",function(e,t){return t.weekdaysShortRegex(e)}),ue("dddd",function(e,t){return t.weekdaysRegex(e)}),fe(["dd","ddd","dddd"],function(e,t,n,s){var i=n._locale.weekdaysParse(e,s,n._strict);null!=i?t.d=i:g(n).invalidWeekday=e}),fe(["d","e","E"],function(e,t,n,s){t[s]=D(e)});var Ze="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_");var ze="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_");var $e="Su_Mo_Tu_We_Th_Fr_Sa".split("_");var qe=ae;var Je=ae;var Be=ae;function Qe(){function e(e,t){return t.length-e.length}var t,n,s,i,r,a=[],o=[],u=[],l=[];for(t=0;t<7;t++)n=y([2e3,1]).day(t),s=this.weekdaysMin(n,""),i=this.weekdaysShort(n,""),r=this.weekdays(n,""),a.push(s),o.push(i),u.push(r),l.push(s),l.push(i),l.push(r);for(a.sort(e),o.sort(e),u.sort(e),l.sort(e),t=0;t<7;t++)o[t]=he(o[t]),u[t]=he(u[t]),l[t]=he(l[t]);this._weekdaysRegex=new RegExp("^("+l.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+u.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+o.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+a.join("|")+")","i")}function Xe(){return this.hours()%12||12}function Ke(e,t){I(e,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),t)})}function et(e,t){return t._meridiemParse}I("H",["HH",2],0,"hour"),I("h",["hh",2],0,Xe),I("k",["kk",2],0,function(){return this.hours()||24}),I("hmm",0,0,function(){return""+Xe.apply(this)+L(this.minutes(),2)}),I("hmmss",0,0,function(){return""+Xe.apply(this)+L(this.minutes(),2)+L(this.seconds(),2)}),I("Hmm",0,0,function(){return""+this.hours()+L(this.minutes(),2)}),I("Hmmss",0,0,function(){return""+this.hours()+L(this.minutes(),2)+L(this.seconds(),2)}),Ke("a",!0),Ke("A",!1),C("hour","h"),F("hour",13),ue("a",et),ue("A",et),ue("H",B),ue("h",B),ue("k",B),ue("HH",B,z),ue("hh",B,z),ue("kk",B,z),ue("hmm",Q),ue("hmmss",X),ue("Hmm",Q),ue("Hmmss",X),ce(["H","HH"],ge),ce(["k","kk"],function(e,t,n){var s=D(e);t[ge]=24===s?0:s}),ce(["a","A"],function(e,t,n){n._isPm=n._locale.isPM(e),n._meridiem=e}),ce(["h","hh"],function(e,t,n){t[ge]=D(e),g(n).bigHour=!0}),ce("hmm",function(e,t,n){var s=e.length-2;t[ge]=D(e.substr(0,s)),t[ve]=D(e.substr(s)),g(n).bigHour=!0}),ce("hmmss",function(e,t,n){var s=e.length-4,i=e.length-2;t[ge]=D(e.substr(0,s)),t[ve]=D(e.substr(s,2)),t[pe]=D(e.substr(i)),g(n).bigHour=!0}),ce("Hmm",function(e,t,n){var s=e.length-2;t[ge]=D(e.substr(0,s)),t[ve]=D(e.substr(s))}),ce("Hmmss",function(e,t,n){var s=e.length-4,i=e.length-2;t[ge]=D(e.substr(0,s)),t[ve]=D(e.substr(s,2)),t[pe]=D(e.substr(i))});var tt,nt=Te("Hours",!0),st={calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},longDateFormat:{LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},invalidDate:"Invalid date",ordinal:"%d",dayOfMonthOrdinalParse:/\d{1,2}/,relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},months:Ce,monthsShort:He,week:{dow:0,doy:6},weekdays:Ze,weekdaysMin:$e,weekdaysShort:ze,meridiemParse:/[ap]\.?m?\.?/i},it={},rt={};function at(e){return e?e.toLowerCase().replace("_","-"):e}function ot(e){var t=null;if(!it[e]&&"undefined"!=typeof module&&module&&module.exports)try{t=tt._abbr,require("./locale/"+e),ut(t)}catch(e){}return it[e]}function ut(e,t){var n;return e&&((n=l(t)?ht(e):lt(e,t))?tt=n:"undefined"!=typeof console&&console.warn&&console.warn("Locale "+e+" not found. Did you forget to load it?")),tt._abbr}function lt(e,t){if(null===t)return delete it[e],null;var n,s=st;if(t.abbr=e,null!=it[e])T("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),s=it[e]._config;else if(null!=t.parentLocale)if(null!=it[t.parentLocale])s=it[t.parentLocale]._config;else{if(null==(n=ot(t.parentLocale)))return rt[t.parentLocale]||(rt[t.parentLocale]=[]),rt[t.parentLocale].push({name:e,config:t}),null;s=n._config}return it[e]=new P(x(s,t)),rt[e]&&rt[e].forEach(function(e){lt(e.name,e.config)}),ut(e),it[e]}function ht(e){var t;if(e&&e._locale&&e._locale._abbr&&(e=e._locale._abbr),!e)return tt;if(!o(e)){if(t=ot(e))return t;e=[e]}return function(e){for(var t,n,s,i,r=0;r<e.length;){for(t=(i=at(e[r]).split("-")).length,n=(n=at(e[r+1]))?n.split("-"):null;0<t;){if(s=ot(i.slice(0,t).join("-")))return s;if(n&&n.length>=t&&a(i,n,!0)>=t-1)break;t--}r++}return tt}(e)}function dt(e){var t,n=e._a;return n&&-2===g(e).overflow&&(t=n[_e]<0||11<n[_e]?_e:n[ye]<1||n[ye]>Pe(n[me],n[_e])?ye:n[ge]<0||24<n[ge]||24===n[ge]&&(0!==n[ve]||0!==n[pe]||0!==n[we])?ge:n[ve]<0||59<n[ve]?ve:n[pe]<0||59<n[pe]?pe:n[we]<0||999<n[we]?we:-1,g(e)._overflowDayOfYear&&(t<me||ye<t)&&(t=ye),g(e)._overflowWeeks&&-1===t&&(t=Me),g(e)._overflowWeekday&&-1===t&&(t=ke),g(e).overflow=t),e}function ct(e,t,n){return null!=e?e:null!=t?t:n}function ft(e){var t,n,s,i,r,a=[];if(!e._d){var o,u;for(o=e,u=new Date(c.now()),s=o._useUTC?[u.getUTCFullYear(),u.getUTCMonth(),u.getUTCDate()]:[u.getFullYear(),u.getMonth(),u.getDate()],e._w&&null==e._a[ye]&&null==e._a[_e]&&function(e){var t,n,s,i,r,a,o,u;if(null!=(t=e._w).GG||null!=t.W||null!=t.E)r=1,a=4,n=ct(t.GG,e._a[me],Ie(bt(),1,4).year),s=ct(t.W,1),((i=ct(t.E,1))<1||7<i)&&(u=!0);else{r=e._locale._week.dow,a=e._locale._week.doy;var l=Ie(bt(),r,a);n=ct(t.gg,e._a[me],l.year),s=ct(t.w,l.week),null!=t.d?((i=t.d)<0||6<i)&&(u=!0):null!=t.e?(i=t.e+r,(t.e<0||6<t.e)&&(u=!0)):i=r}s<1||s>Ae(n,r,a)?g(e)._overflowWeeks=!0:null!=u?g(e)._overflowWeekday=!0:(o=Ee(n,s,i,r,a),e._a[me]=o.year,e._dayOfYear=o.dayOfYear)}(e),null!=e._dayOfYear&&(r=ct(e._a[me],s[me]),(e._dayOfYear>Se(r)||0===e._dayOfYear)&&(g(e)._overflowDayOfYear=!0),n=Ge(r,0,e._dayOfYear),e._a[_e]=n.getUTCMonth(),e._a[ye]=n.getUTCDate()),t=0;t<3&&null==e._a[t];++t)e._a[t]=a[t]=s[t];for(;t<7;t++)e._a[t]=a[t]=null==e._a[t]?2===t?1:0:e._a[t];24===e._a[ge]&&0===e._a[ve]&&0===e._a[pe]&&0===e._a[we]&&(e._nextDay=!0,e._a[ge]=0),e._d=(e._useUTC?Ge:function(e,t,n,s,i,r,a){var o;return e<100&&0<=e?(o=new Date(e+400,t,n,s,i,r,a),isFinite(o.getFullYear())&&o.setFullYear(e)):o=new Date(e,t,n,s,i,r,a),o}).apply(null,a),i=e._useUTC?e._d.getUTCDay():e._d.getDay(),null!=e._tzm&&e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),e._nextDay&&(e._a[ge]=24),e._w&&void 0!==e._w.d&&e._w.d!==i&&(g(e).weekdayMismatch=!0)}}var mt=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,_t=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,yt=/Z|[+-]\d\d(?::?\d\d)?/,gt=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/]],vt=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],pt=/^\/?Date\((\-?\d+)/i;function wt(e){var t,n,s,i,r,a,o=e._i,u=mt.exec(o)||_t.exec(o);if(u){for(g(e).iso=!0,t=0,n=gt.length;t<n;t++)if(gt[t][1].exec(u[1])){i=gt[t][0],s=!1!==gt[t][2];break}if(null==i)return void(e._isValid=!1);if(u[3]){for(t=0,n=vt.length;t<n;t++)if(vt[t][1].exec(u[3])){r=(u[2]||" ")+vt[t][0];break}if(null==r)return void(e._isValid=!1)}if(!s&&null!=r)return void(e._isValid=!1);if(u[4]){if(!yt.exec(u[4]))return void(e._isValid=!1);a="Z"}e._f=i+(r||"")+(a||""),Yt(e)}else e._isValid=!1}var Mt=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/;function kt(e,t,n,s,i,r){var a=[function(e){var t=parseInt(e,10);{if(t<=49)return 2e3+t;if(t<=999)return 1900+t}return t}(e),He.indexOf(t),parseInt(n,10),parseInt(s,10),parseInt(i,10)];return r&&a.push(parseInt(r,10)),a}var St={UT:0,GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function Dt(e){var t,n,s,i=Mt.exec(e._i.replace(/\([^)]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").replace(/^\s\s*/,"").replace(/\s\s*$/,""));if(i){var r=kt(i[4],i[3],i[2],i[5],i[6],i[7]);if(t=i[1],n=r,s=e,t&&ze.indexOf(t)!==new Date(n[0],n[1],n[2]).getDay()&&(g(s).weekdayMismatch=!0,!(s._isValid=!1)))return;e._a=r,e._tzm=function(e,t,n){if(e)return St[e];if(t)return 0;var s=parseInt(n,10),i=s%100;return(s-i)/100*60+i}(i[8],i[9],i[10]),e._d=Ge.apply(null,e._a),e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),g(e).rfc2822=!0}else e._isValid=!1}function Yt(e){if(e._f!==c.ISO_8601)if(e._f!==c.RFC_2822){e._a=[],g(e).empty=!0;var t,n,s,i,r,a,o,u,l=""+e._i,h=l.length,d=0;for(s=j(e._f,e._locale).match(N)||[],t=0;t<s.length;t++)i=s[t],(n=(l.match(le(i,e))||[])[0])&&(0<(r=l.substr(0,l.indexOf(n))).length&&g(e).unusedInput.push(r),l=l.slice(l.indexOf(n)+n.length),d+=n.length),E[i]?(n?g(e).empty=!1:g(e).unusedTokens.push(i),a=i,u=e,null!=(o=n)&&m(de,a)&&de[a](o,u._a,u,a)):e._strict&&!n&&g(e).unusedTokens.push(i);g(e).charsLeftOver=h-d,0<l.length&&g(e).unusedInput.push(l),e._a[ge]<=12&&!0===g(e).bigHour&&0<e._a[ge]&&(g(e).bigHour=void 0),g(e).parsedDateParts=e._a.slice(0),g(e).meridiem=e._meridiem,e._a[ge]=function(e,t,n){var s;if(null==n)return t;return null!=e.meridiemHour?e.meridiemHour(t,n):(null!=e.isPM&&((s=e.isPM(n))&&t<12&&(t+=12),s||12!==t||(t=0)),t)}(e._locale,e._a[ge],e._meridiem),ft(e),dt(e)}else Dt(e);else wt(e)}function Ot(e){var t,n,s,i,r=e._i,a=e._f;return e._locale=e._locale||ht(e._l),null===r||void 0===a&&""===r?p({nullInput:!0}):("string"==typeof r&&(e._i=r=e._locale.preparse(r)),k(r)?new M(dt(r)):(d(r)?e._d=r:o(a)?function(e){var t,n,s,i,r;if(0===e._f.length)return g(e).invalidFormat=!0,e._d=new Date(NaN);for(i=0;i<e._f.length;i++)r=0,t=w({},e),null!=e._useUTC&&(t._useUTC=e._useUTC),t._f=e._f[i],Yt(t),v(t)&&(r+=g(t).charsLeftOver,r+=10*g(t).unusedTokens.length,g(t).score=r,(null==s||r<s)&&(s=r,n=t));_(e,n||t)}(e):a?Yt(e):l(n=(t=e)._i)?t._d=new Date(c.now()):d(n)?t._d=new Date(n.valueOf()):"string"==typeof n?(s=t,null===(i=pt.exec(s._i))?(wt(s),!1===s._isValid&&(delete s._isValid,Dt(s),!1===s._isValid&&(delete s._isValid,c.createFromInputFallback(s)))):s._d=new Date(+i[1])):o(n)?(t._a=f(n.slice(0),function(e){return parseInt(e,10)}),ft(t)):u(n)?function(e){if(!e._d){var t=R(e._i);e._a=f([t.year,t.month,t.day||t.date,t.hour,t.minute,t.second,t.millisecond],function(e){return e&&parseInt(e,10)}),ft(e)}}(t):h(n)?t._d=new Date(n):c.createFromInputFallback(t),v(e)||(e._d=null),e))}function Tt(e,t,n,s,i){var r,a={};return!0!==n&&!1!==n||(s=n,n=void 0),(u(e)&&function(e){if(Object.getOwnPropertyNames)return 0===Object.getOwnPropertyNames(e).length;var t;for(t in e)if(e.hasOwnProperty(t))return!1;return!0}(e)||o(e)&&0===e.length)&&(e=void 0),a._isAMomentObject=!0,a._useUTC=a._isUTC=i,a._l=n,a._i=e,a._f=t,a._strict=s,(r=new M(dt(Ot(a))))._nextDay&&(r.add(1,"d"),r._nextDay=void 0),r}function bt(e,t,n,s){return Tt(e,t,n,s,!1)}c.createFromInputFallback=n("value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged and will be removed in an upcoming major release. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.",function(e){e._d=new Date(e._i+(e._useUTC?" UTC":""))}),c.ISO_8601=function(){},c.RFC_2822=function(){};var xt=n("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var e=bt.apply(null,arguments);return this.isValid()&&e.isValid()?e<this?this:e:p()}),Pt=n("moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var e=bt.apply(null,arguments);return this.isValid()&&e.isValid()?this<e?this:e:p()});function Wt(e,t){var n,s;if(1===t.length&&o(t[0])&&(t=t[0]),!t.length)return bt();for(n=t[0],s=1;s<t.length;++s)t[s].isValid()&&!t[s][e](n)||(n=t[s]);return n}var Ct=["year","quarter","month","week","day","hour","minute","second","millisecond"];function Ht(e){var t=R(e),n=t.year||0,s=t.quarter||0,i=t.month||0,r=t.week||t.isoWeek||0,a=t.day||0,o=t.hour||0,u=t.minute||0,l=t.second||0,h=t.millisecond||0;this._isValid=function(e){for(var t in e)if(-1===Ye.call(Ct,t)||null!=e[t]&&isNaN(e[t]))return!1;for(var n=!1,s=0;s<Ct.length;++s)if(e[Ct[s]]){if(n)return!1;parseFloat(e[Ct[s]])!==D(e[Ct[s]])&&(n=!0)}return!0}(t),this._milliseconds=+h+1e3*l+6e4*u+1e3*o*60*60,this._days=+a+7*r,this._months=+i+3*s+12*n,this._data={},this._locale=ht(),this._bubble()}function Rt(e){return e instanceof Ht}function Ut(e){return e<0?-1*Math.round(-1*e):Math.round(e)}function Ft(e,n){I(e,0,0,function(){var e=this.utcOffset(),t="+";return e<0&&(e=-e,t="-"),t+L(~~(e/60),2)+n+L(~~e%60,2)})}Ft("Z",":"),Ft("ZZ",""),ue("Z",re),ue("ZZ",re),ce(["Z","ZZ"],function(e,t,n){n._useUTC=!0,n._tzm=Nt(re,e)});var Lt=/([\+\-]|\d\d)/gi;function Nt(e,t){var n=(t||"").match(e);if(null===n)return null;var s=((n[n.length-1]||[])+"").match(Lt)||["-",0,0],i=60*s[1]+D(s[2]);return 0===i?0:"+"===s[0]?i:-i}function Gt(e,t){var n,s;return t._isUTC?(n=t.clone(),s=(k(e)||d(e)?e.valueOf():bt(e).valueOf())-n.valueOf(),n._d.setTime(n._d.valueOf()+s),c.updateOffset(n,!1),n):bt(e).local()}function Vt(e){return 15*-Math.round(e._d.getTimezoneOffset()/15)}function Et(){return!!this.isValid()&&(this._isUTC&&0===this._offset)}c.updateOffset=function(){};var It=/^(\-|\+)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)(\.\d*)?)?$/,At=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function jt(e,t){var n,s,i,r=e,a=null;return Rt(e)?r={ms:e._milliseconds,d:e._days,M:e._months}:h(e)?(r={},t?r[t]=e:r.milliseconds=e):(a=It.exec(e))?(n="-"===a[1]?-1:1,r={y:0,d:D(a[ye])*n,h:D(a[ge])*n,m:D(a[ve])*n,s:D(a[pe])*n,ms:D(Ut(1e3*a[we]))*n}):(a=At.exec(e))?(n="-"===a[1]?-1:1,r={y:Zt(a[2],n),M:Zt(a[3],n),w:Zt(a[4],n),d:Zt(a[5],n),h:Zt(a[6],n),m:Zt(a[7],n),s:Zt(a[8],n)}):null==r?r={}:"object"==typeof r&&("from"in r||"to"in r)&&(i=function(e,t){var n;if(!e.isValid()||!t.isValid())return{milliseconds:0,months:0};t=Gt(t,e),e.isBefore(t)?n=zt(e,t):((n=zt(t,e)).milliseconds=-n.milliseconds,n.months=-n.months);return n}(bt(r.from),bt(r.to)),(r={}).ms=i.milliseconds,r.M=i.months),s=new Ht(r),Rt(e)&&m(e,"_locale")&&(s._locale=e._locale),s}function Zt(e,t){var n=e&&parseFloat(e.replace(",","."));return(isNaN(n)?0:n)*t}function zt(e,t){var n={};return n.months=t.month()-e.month()+12*(t.year()-e.year()),e.clone().add(n.months,"M").isAfter(t)&&--n.months,n.milliseconds=+t-+e.clone().add(n.months,"M"),n}function $t(s,i){return function(e,t){var n;return null===t||isNaN(+t)||(T(i,"moment()."+i+"(period, number) is deprecated. Please use moment()."+i+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),n=e,e=t,t=n),qt(this,jt(e="string"==typeof e?+e:e,t),s),this}}function qt(e,t,n,s){var i=t._milliseconds,r=Ut(t._days),a=Ut(t._months);e.isValid()&&(s=null==s||s,a&&Re(e,be(e,"Month")+a*n),r&&xe(e,"Date",be(e,"Date")+r*n),i&&e._d.setTime(e._d.valueOf()+i*n),s&&c.updateOffset(e,r||a))}jt.fn=Ht.prototype,jt.invalid=function(){return jt(NaN)};var Jt=$t(1,"add"),Bt=$t(-1,"subtract");function Qt(e,t){var n=12*(t.year()-e.year())+(t.month()-e.month()),s=e.clone().add(n,"months");return-(n+(t-s<0?(t-s)/(s-e.clone().add(n-1,"months")):(t-s)/(e.clone().add(n+1,"months")-s)))||0}function Xt(e){var t;return void 0===e?this._locale._abbr:(null!=(t=ht(e))&&(this._locale=t),this)}c.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",c.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";var Kt=n("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(e){return void 0===e?this.localeData():this.locale(e)});function en(){return this._locale}var tn=126227808e5;function nn(e,t){return(e%t+t)%t}function sn(e,t,n){return e<100&&0<=e?new Date(e+400,t,n)-tn:new Date(e,t,n).valueOf()}function rn(e,t,n){return e<100&&0<=e?Date.UTC(e+400,t,n)-tn:Date.UTC(e,t,n)}function an(e,t){I(0,[e,e.length],0,t)}function on(e,t,n,s,i){var r;return null==e?Ie(this,s,i).year:((r=Ae(e,s,i))<t&&(t=r),function(e,t,n,s,i){var r=Ee(e,t,n,s,i),a=Ge(r.year,0,r.dayOfYear);return this.year(a.getUTCFullYear()),this.month(a.getUTCMonth()),this.date(a.getUTCDate()),this}.call(this,e,t,n,s,i))}I(0,["gg",2],0,function(){return this.weekYear()%100}),I(0,["GG",2],0,function(){return this.isoWeekYear()%100}),an("gggg","weekYear"),an("ggggg","weekYear"),an("GGGG","isoWeekYear"),an("GGGGG","isoWeekYear"),C("weekYear","gg"),C("isoWeekYear","GG"),F("weekYear",1),F("isoWeekYear",1),ue("G",se),ue("g",se),ue("GG",B,z),ue("gg",B,z),ue("GGGG",ee,q),ue("gggg",ee,q),ue("GGGGG",te,J),ue("ggggg",te,J),fe(["gggg","ggggg","GGGG","GGGGG"],function(e,t,n,s){t[s.substr(0,2)]=D(e)}),fe(["gg","GG"],function(e,t,n,s){t[s]=c.parseTwoDigitYear(e)}),I("Q",0,"Qo","quarter"),C("quarter","Q"),F("quarter",7),ue("Q",Z),ce("Q",function(e,t){t[_e]=3*(D(e)-1)}),I("D",["DD",2],"Do","date"),C("date","D"),F("date",9),ue("D",B),ue("DD",B,z),ue("Do",function(e,t){return e?t._dayOfMonthOrdinalParse||t._ordinalParse:t._dayOfMonthOrdinalParseLenient}),ce(["D","DD"],ye),ce("Do",function(e,t){t[ye]=D(e.match(B)[0])});var un=Te("Date",!0);I("DDD",["DDDD",3],"DDDo","dayOfYear"),C("dayOfYear","DDD"),F("dayOfYear",4),ue("DDD",K),ue("DDDD",$),ce(["DDD","DDDD"],function(e,t,n){n._dayOfYear=D(e)}),I("m",["mm",2],0,"minute"),C("minute","m"),F("minute",14),ue("m",B),ue("mm",B,z),ce(["m","mm"],ve);var ln=Te("Minutes",!1);I("s",["ss",2],0,"second"),C("second","s"),F("second",15),ue("s",B),ue("ss",B,z),ce(["s","ss"],pe);var hn,dn=Te("Seconds",!1);for(I("S",0,0,function(){return~~(this.millisecond()/100)}),I(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),I(0,["SSS",3],0,"millisecond"),I(0,["SSSS",4],0,function(){return 10*this.millisecond()}),I(0,["SSSSS",5],0,function(){return 100*this.millisecond()}),I(0,["SSSSSS",6],0,function(){return 1e3*this.millisecond()}),I(0,["SSSSSSS",7],0,function(){return 1e4*this.millisecond()}),I(0,["SSSSSSSS",8],0,function(){return 1e5*this.millisecond()}),I(0,["SSSSSSSSS",9],0,function(){return 1e6*this.millisecond()}),C("millisecond","ms"),F("millisecond",16),ue("S",K,Z),ue("SS",K,z),ue("SSS",K,$),hn="SSSS";hn.length<=9;hn+="S")ue(hn,ne);function cn(e,t){t[we]=D(1e3*("0."+e))}for(hn="S";hn.length<=9;hn+="S")ce(hn,cn);var fn=Te("Milliseconds",!1);I("z",0,0,"zoneAbbr"),I("zz",0,0,"zoneName");var mn=M.prototype;function _n(e){return e}mn.add=Jt,mn.calendar=function(e,t){var n=e||bt(),s=Gt(n,this).startOf("day"),i=c.calendarFormat(this,s)||"sameElse",r=t&&(b(t[i])?t[i].call(this,n):t[i]);return this.format(r||this.localeData().calendar(i,this,bt(n)))},mn.clone=function(){return new M(this)},mn.diff=function(e,t,n){var s,i,r;if(!this.isValid())return NaN;if(!(s=Gt(e,this)).isValid())return NaN;switch(i=6e4*(s.utcOffset()-this.utcOffset()),t=H(t)){case"year":r=Qt(this,s)/12;break;case"month":r=Qt(this,s);break;case"quarter":r=Qt(this,s)/3;break;case"second":r=(this-s)/1e3;break;case"minute":r=(this-s)/6e4;break;case"hour":r=(this-s)/36e5;break;case"day":r=(this-s-i)/864e5;break;case"week":r=(this-s-i)/6048e5;break;default:r=this-s}return n?r:S(r)},mn.endOf=function(e){var t;if(void 0===(e=H(e))||"millisecond"===e||!this.isValid())return this;var n=this._isUTC?rn:sn;switch(e){case"year":t=n(this.year()+1,0,1)-1;break;case"quarter":t=n(this.year(),this.month()-this.month()%3+3,1)-1;break;case"month":t=n(this.year(),this.month()+1,1)-1;break;case"week":t=n(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case"isoWeek":t=n(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case"day":case"date":t=n(this.year(),this.month(),this.date()+1)-1;break;case"hour":t=this._d.valueOf(),t+=36e5-nn(t+(this._isUTC?0:6e4*this.utcOffset()),36e5)-1;break;case"minute":t=this._d.valueOf(),t+=6e4-nn(t,6e4)-1;break;case"second":t=this._d.valueOf(),t+=1e3-nn(t,1e3)-1;break}return this._d.setTime(t),c.updateOffset(this,!0),this},mn.format=function(e){e||(e=this.isUtc()?c.defaultFormatUtc:c.defaultFormat);var t=A(this,e);return this.localeData().postformat(t)},mn.from=function(e,t){return this.isValid()&&(k(e)&&e.isValid()||bt(e).isValid())?jt({to:this,from:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()},mn.fromNow=function(e){return this.from(bt(),e)},mn.to=function(e,t){return this.isValid()&&(k(e)&&e.isValid()||bt(e).isValid())?jt({from:this,to:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()},mn.toNow=function(e){return this.to(bt(),e)},mn.get=function(e){return b(this[e=H(e)])?this[e]():this},mn.invalidAt=function(){return g(this).overflow},mn.isAfter=function(e,t){var n=k(e)?e:bt(e);return!(!this.isValid()||!n.isValid())&&("millisecond"===(t=H(t)||"millisecond")?this.valueOf()>n.valueOf():n.valueOf()<this.clone().startOf(t).valueOf())},mn.isBefore=function(e,t){var n=k(e)?e:bt(e);return!(!this.isValid()||!n.isValid())&&("millisecond"===(t=H(t)||"millisecond")?this.valueOf()<n.valueOf():this.clone().endOf(t).valueOf()<n.valueOf())},mn.isBetween=function(e,t,n,s){var i=k(e)?e:bt(e),r=k(t)?t:bt(t);return!!(this.isValid()&&i.isValid()&&r.isValid())&&("("===(s=s||"()")[0]?this.isAfter(i,n):!this.isBefore(i,n))&&(")"===s[1]?this.isBefore(r,n):!this.isAfter(r,n))},mn.isSame=function(e,t){var n,s=k(e)?e:bt(e);return!(!this.isValid()||!s.isValid())&&("millisecond"===(t=H(t)||"millisecond")?this.valueOf()===s.valueOf():(n=s.valueOf(),this.clone().startOf(t).valueOf()<=n&&n<=this.clone().endOf(t).valueOf()))},mn.isSameOrAfter=function(e,t){return this.isSame(e,t)||this.isAfter(e,t)},mn.isSameOrBefore=function(e,t){return this.isSame(e,t)||this.isBefore(e,t)},mn.isValid=function(){return v(this)},mn.lang=Kt,mn.locale=Xt,mn.localeData=en,mn.max=Pt,mn.min=xt,mn.parsingFlags=function(){return _({},g(this))},mn.set=function(e,t){if("object"==typeof e)for(var n=function(e){var t=[];for(var n in e)t.push({unit:n,priority:U[n]});return t.sort(function(e,t){return e.priority-t.priority}),t}(e=R(e)),s=0;s<n.length;s++)this[n[s].unit](e[n[s].unit]);else if(b(this[e=H(e)]))return this[e](t);return this},mn.startOf=function(e){var t;if(void 0===(e=H(e))||"millisecond"===e||!this.isValid())return this;var n=this._isUTC?rn:sn;switch(e){case"year":t=n(this.year(),0,1);break;case"quarter":t=n(this.year(),this.month()-this.month()%3,1);break;case"month":t=n(this.year(),this.month(),1);break;case"week":t=n(this.year(),this.month(),this.date()-this.weekday());break;case"isoWeek":t=n(this.year(),this.month(),this.date()-(this.isoWeekday()-1));break;case"day":case"date":t=n(this.year(),this.month(),this.date());break;case"hour":t=this._d.valueOf(),t-=nn(t+(this._isUTC?0:6e4*this.utcOffset()),36e5);break;case"minute":t=this._d.valueOf(),t-=nn(t,6e4);break;case"second":t=this._d.valueOf(),t-=nn(t,1e3);break}return this._d.setTime(t),c.updateOffset(this,!0),this},mn.subtract=Bt,mn.toArray=function(){var e=this;return[e.year(),e.month(),e.date(),e.hour(),e.minute(),e.second(),e.millisecond()]},mn.toObject=function(){var e=this;return{years:e.year(),months:e.month(),date:e.date(),hours:e.hours(),minutes:e.minutes(),seconds:e.seconds(),milliseconds:e.milliseconds()}},mn.toDate=function(){return new Date(this.valueOf())},mn.toISOString=function(e){if(!this.isValid())return null;var t=!0!==e,n=t?this.clone().utc():this;return n.year()<0||9999<n.year()?A(n,t?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):b(Date.prototype.toISOString)?t?this.toDate().toISOString():new Date(this.valueOf()+60*this.utcOffset()*1e3).toISOString().replace("Z",A(n,"Z")):A(n,t?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")},mn.inspect=function(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var e="moment",t="";this.isLocal()||(e=0===this.utcOffset()?"moment.utc":"moment.parseZone",t="Z");var n="["+e+'("]',s=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",i=t+'[")]';return this.format(n+s+"-MM-DD[T]HH:mm:ss.SSS"+i)},mn.toJSON=function(){return this.isValid()?this.toISOString():null},mn.toString=function(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")},mn.unix=function(){return Math.floor(this.valueOf()/1e3)},mn.valueOf=function(){return this._d.valueOf()-6e4*(this._offset||0)},mn.creationData=function(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}},mn.year=Oe,mn.isLeapYear=function(){return De(this.year())},mn.weekYear=function(e){return on.call(this,e,this.week(),this.weekday(),this.localeData()._week.dow,this.localeData()._week.doy)},mn.isoWeekYear=function(e){return on.call(this,e,this.isoWeek(),this.isoWeekday(),1,4)},mn.quarter=mn.quarters=function(e){return null==e?Math.ceil((this.month()+1)/3):this.month(3*(e-1)+this.month()%3)},mn.month=Ue,mn.daysInMonth=function(){return Pe(this.year(),this.month())},mn.week=mn.weeks=function(e){var t=this.localeData().week(this);return null==e?t:this.add(7*(e-t),"d")},mn.isoWeek=mn.isoWeeks=function(e){var t=Ie(this,1,4).week;return null==e?t:this.add(7*(e-t),"d")},mn.weeksInYear=function(){var e=this.localeData()._week;return Ae(this.year(),e.dow,e.doy)},mn.isoWeeksInYear=function(){return Ae(this.year(),1,4)},mn.date=un,mn.day=mn.days=function(e){if(!this.isValid())return null!=e?this:NaN;var t,n,s=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=e?(t=e,n=this.localeData(),e="string"!=typeof t?t:isNaN(t)?"number"==typeof(t=n.weekdaysParse(t))?t:null:parseInt(t,10),this.add(e-s,"d")):s},mn.weekday=function(e){if(!this.isValid())return null!=e?this:NaN;var t=(this.day()+7-this.localeData()._week.dow)%7;return null==e?t:this.add(e-t,"d")},mn.isoWeekday=function(e){if(!this.isValid())return null!=e?this:NaN;if(null==e)return this.day()||7;var t,n,s=(t=e,n=this.localeData(),"string"==typeof t?n.weekdaysParse(t)%7||7:isNaN(t)?null:t);return this.day(this.day()%7?s:s-7)},mn.dayOfYear=function(e){var t=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return null==e?t:this.add(e-t,"d")},mn.hour=mn.hours=nt,mn.minute=mn.minutes=ln,mn.second=mn.seconds=dn,mn.millisecond=mn.milliseconds=fn,mn.utcOffset=function(e,t,n){var s,i=this._offset||0;if(!this.isValid())return null!=e?this:NaN;if(null==e)return this._isUTC?i:Vt(this);if("string"==typeof e){if(null===(e=Nt(re,e)))return this}else Math.abs(e)<16&&!n&&(e*=60);return!this._isUTC&&t&&(s=Vt(this)),this._offset=e,this._isUTC=!0,null!=s&&this.add(s,"m"),i!==e&&(!t||this._changeInProgress?qt(this,jt(e-i,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,c.updateOffset(this,!0),this._changeInProgress=null)),this},mn.utc=function(e){return this.utcOffset(0,e)},mn.local=function(e){return this._isUTC&&(this.utcOffset(0,e),this._isUTC=!1,e&&this.subtract(Vt(this),"m")),this},mn.parseZone=function(){if(null!=this._tzm)this.utcOffset(this._tzm,!1,!0);else if("string"==typeof this._i){var e=Nt(ie,this._i);null!=e?this.utcOffset(e):this.utcOffset(0,!0)}return this},mn.hasAlignedHourOffset=function(e){return!!this.isValid()&&(e=e?bt(e).utcOffset():0,(this.utcOffset()-e)%60==0)},mn.isDST=function(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()},mn.isLocal=function(){return!!this.isValid()&&!this._isUTC},mn.isUtcOffset=function(){return!!this.isValid()&&this._isUTC},mn.isUtc=Et,mn.isUTC=Et,mn.zoneAbbr=function(){return this._isUTC?"UTC":""},mn.zoneName=function(){return this._isUTC?"Coordinated Universal Time":""},mn.dates=n("dates accessor is deprecated. Use date instead.",un),mn.months=n("months accessor is deprecated. Use month instead",Ue),mn.years=n("years accessor is deprecated. Use year instead",Oe),mn.zone=n("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",function(e,t){return null!=e?("string"!=typeof e&&(e=-e),this.utcOffset(e,t),this):-this.utcOffset()}),mn.isDSTShifted=n("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",function(){if(!l(this._isDSTShifted))return this._isDSTShifted;var e={};if(w(e,this),(e=Ot(e))._a){var t=e._isUTC?y(e._a):bt(e._a);this._isDSTShifted=this.isValid()&&0<a(e._a,t.toArray())}else this._isDSTShifted=!1;return this._isDSTShifted});var yn=P.prototype;function gn(e,t,n,s){var i=ht(),r=y().set(s,t);return i[n](r,e)}function vn(e,t,n){if(h(e)&&(t=e,e=void 0),e=e||"",null!=t)return gn(e,t,n,"month");var s,i=[];for(s=0;s<12;s++)i[s]=gn(e,s,n,"month");return i}function pn(e,t,n,s){t=("boolean"==typeof e?h(t)&&(n=t,t=void 0):(t=e,e=!1,h(n=t)&&(n=t,t=void 0)),t||"");var i,r=ht(),a=e?r._week.dow:0;if(null!=n)return gn(t,(n+a)%7,s,"day");var o=[];for(i=0;i<7;i++)o[i]=gn(t,(i+a)%7,s,"day");return o}yn.calendar=function(e,t,n){var s=this._calendar[e]||this._calendar.sameElse;return b(s)?s.call(t,n):s},yn.longDateFormat=function(e){var t=this._longDateFormat[e],n=this._longDateFormat[e.toUpperCase()];return t||!n?t:(this._longDateFormat[e]=n.replace(/MMMM|MM|DD|dddd/g,function(e){return e.slice(1)}),this._longDateFormat[e])},yn.invalidDate=function(){return this._invalidDate},yn.ordinal=function(e){return this._ordinal.replace("%d",e)},yn.preparse=_n,yn.postformat=_n,yn.relativeTime=function(e,t,n,s){var i=this._relativeTime[n];return b(i)?i(e,t,n,s):i.replace(/%d/i,e)},yn.pastFuture=function(e,t){var n=this._relativeTime[0<e?"future":"past"];return b(n)?n(t):n.replace(/%s/i,t)},yn.set=function(e){var t,n;for(n in e)b(t=e[n])?this[n]=t:this["_"+n]=t;this._config=e,this._dayOfMonthOrdinalParseLenient=new RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+"|"+/\d{1,2}/.source)},yn.months=function(e,t){return e?o(this._months)?this._months[e.month()]:this._months[(this._months.isFormat||We).test(t)?"format":"standalone"][e.month()]:o(this._months)?this._months:this._months.standalone},yn.monthsShort=function(e,t){return e?o(this._monthsShort)?this._monthsShort[e.month()]:this._monthsShort[We.test(t)?"format":"standalone"][e.month()]:o(this._monthsShort)?this._monthsShort:this._monthsShort.standalone},yn.monthsParse=function(e,t,n){var s,i,r;if(this._monthsParseExact)return function(e,t,n){var s,i,r,a=e.toLocaleLowerCase();if(!this._monthsParse)for(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[],s=0;s<12;++s)r=y([2e3,s]),this._shortMonthsParse[s]=this.monthsShort(r,"").toLocaleLowerCase(),this._longMonthsParse[s]=this.months(r,"").toLocaleLowerCase();return n?"MMM"===t?-1!==(i=Ye.call(this._shortMonthsParse,a))?i:null:-1!==(i=Ye.call(this._longMonthsParse,a))?i:null:"MMM"===t?-1!==(i=Ye.call(this._shortMonthsParse,a))?i:-1!==(i=Ye.call(this._longMonthsParse,a))?i:null:-1!==(i=Ye.call(this._longMonthsParse,a))?i:-1!==(i=Ye.call(this._shortMonthsParse,a))?i:null}.call(this,e,t,n);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),s=0;s<12;s++){if(i=y([2e3,s]),n&&!this._longMonthsParse[s]&&(this._longMonthsParse[s]=new RegExp("^"+this.months(i,"").replace(".","")+"$","i"),this._shortMonthsParse[s]=new RegExp("^"+this.monthsShort(i,"").replace(".","")+"$","i")),n||this._monthsParse[s]||(r="^"+this.months(i,"")+"|^"+this.monthsShort(i,""),this._monthsParse[s]=new RegExp(r.replace(".",""),"i")),n&&"MMMM"===t&&this._longMonthsParse[s].test(e))return s;if(n&&"MMM"===t&&this._shortMonthsParse[s].test(e))return s;if(!n&&this._monthsParse[s].test(e))return s}},yn.monthsRegex=function(e){return this._monthsParseExact?(m(this,"_monthsRegex")||Ne.call(this),e?this._monthsStrictRegex:this._monthsRegex):(m(this,"_monthsRegex")||(this._monthsRegex=Le),this._monthsStrictRegex&&e?this._monthsStrictRegex:this._monthsRegex)},yn.monthsShortRegex=function(e){return this._monthsParseExact?(m(this,"_monthsRegex")||Ne.call(this),e?this._monthsShortStrictRegex:this._monthsShortRegex):(m(this,"_monthsShortRegex")||(this._monthsShortRegex=Fe),this._monthsShortStrictRegex&&e?this._monthsShortStrictRegex:this._monthsShortRegex)},yn.week=function(e){return Ie(e,this._week.dow,this._week.doy).week},yn.firstDayOfYear=function(){return this._week.doy},yn.firstDayOfWeek=function(){return this._week.dow},yn.weekdays=function(e,t){var n=o(this._weekdays)?this._weekdays:this._weekdays[e&&!0!==e&&this._weekdays.isFormat.test(t)?"format":"standalone"];return!0===e?je(n,this._week.dow):e?n[e.day()]:n},yn.weekdaysMin=function(e){return!0===e?je(this._weekdaysMin,this._week.dow):e?this._weekdaysMin[e.day()]:this._weekdaysMin},yn.weekdaysShort=function(e){return!0===e?je(this._weekdaysShort,this._week.dow):e?this._weekdaysShort[e.day()]:this._weekdaysShort},yn.weekdaysParse=function(e,t,n){var s,i,r;if(this._weekdaysParseExact)return function(e,t,n){var s,i,r,a=e.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],s=0;s<7;++s)r=y([2e3,1]).day(s),this._minWeekdaysParse[s]=this.weekdaysMin(r,"").toLocaleLowerCase(),this._shortWeekdaysParse[s]=this.weekdaysShort(r,"").toLocaleLowerCase(),this._weekdaysParse[s]=this.weekdays(r,"").toLocaleLowerCase();return n?"dddd"===t?-1!==(i=Ye.call(this._weekdaysParse,a))?i:null:"ddd"===t?-1!==(i=Ye.call(this._shortWeekdaysParse,a))?i:null:-1!==(i=Ye.call(this._minWeekdaysParse,a))?i:null:"dddd"===t?-1!==(i=Ye.call(this._weekdaysParse,a))?i:-1!==(i=Ye.call(this._shortWeekdaysParse,a))?i:-1!==(i=Ye.call(this._minWeekdaysParse,a))?i:null:"ddd"===t?-1!==(i=Ye.call(this._shortWeekdaysParse,a))?i:-1!==(i=Ye.call(this._weekdaysParse,a))?i:-1!==(i=Ye.call(this._minWeekdaysParse,a))?i:null:-1!==(i=Ye.call(this._minWeekdaysParse,a))?i:-1!==(i=Ye.call(this._weekdaysParse,a))?i:-1!==(i=Ye.call(this._shortWeekdaysParse,a))?i:null}.call(this,e,t,n);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),s=0;s<7;s++){if(i=y([2e3,1]).day(s),n&&!this._fullWeekdaysParse[s]&&(this._fullWeekdaysParse[s]=new RegExp("^"+this.weekdays(i,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[s]=new RegExp("^"+this.weekdaysShort(i,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[s]=new RegExp("^"+this.weekdaysMin(i,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[s]||(r="^"+this.weekdays(i,"")+"|^"+this.weekdaysShort(i,"")+"|^"+this.weekdaysMin(i,""),this._weekdaysParse[s]=new RegExp(r.replace(".",""),"i")),n&&"dddd"===t&&this._fullWeekdaysParse[s].test(e))return s;if(n&&"ddd"===t&&this._shortWeekdaysParse[s].test(e))return s;if(n&&"dd"===t&&this._minWeekdaysParse[s].test(e))return s;if(!n&&this._weekdaysParse[s].test(e))return s}},yn.weekdaysRegex=function(e){return this._weekdaysParseExact?(m(this,"_weekdaysRegex")||Qe.call(this),e?this._weekdaysStrictRegex:this._weekdaysRegex):(m(this,"_weekdaysRegex")||(this._weekdaysRegex=qe),this._weekdaysStrictRegex&&e?this._weekdaysStrictRegex:this._weekdaysRegex)},yn.weekdaysShortRegex=function(e){return this._weekdaysParseExact?(m(this,"_weekdaysRegex")||Qe.call(this),e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(m(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=Je),this._weekdaysShortStrictRegex&&e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)},yn.weekdaysMinRegex=function(e){return this._weekdaysParseExact?(m(this,"_weekdaysRegex")||Qe.call(this),e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(m(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=Be),this._weekdaysMinStrictRegex&&e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)},yn.isPM=function(e){return"p"===(e+"").toLowerCase().charAt(0)},yn.meridiem=function(e,t,n){return 11<e?n?"pm":"PM":n?"am":"AM"},ut("en",{dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(e){var t=e%10;return e+(1===D(e%100/10)?"th":1===t?"st":2===t?"nd":3===t?"rd":"th")}}),c.lang=n("moment.lang is deprecated. Use moment.locale instead.",ut),c.langData=n("moment.langData is deprecated. Use moment.localeData instead.",ht);var wn=Math.abs;function Mn(e,t,n,s){var i=jt(t,n);return e._milliseconds+=s*i._milliseconds,e._days+=s*i._days,e._months+=s*i._months,e._bubble()}function kn(e){return e<0?Math.floor(e):Math.ceil(e)}function Sn(e){return 4800*e/146097}function Dn(e){return 146097*e/4800}function Yn(e){return function(){return this.as(e)}}var On=Yn("ms"),Tn=Yn("s"),bn=Yn("m"),xn=Yn("h"),Pn=Yn("d"),Wn=Yn("w"),Cn=Yn("M"),Hn=Yn("Q"),Rn=Yn("y");function Un(e){return function(){return this.isValid()?this._data[e]:NaN}}var Fn=Un("milliseconds"),Ln=Un("seconds"),Nn=Un("minutes"),Gn=Un("hours"),Vn=Un("days"),En=Un("months"),In=Un("years");var An=Math.round,jn={ss:44,s:45,m:45,h:22,d:26,M:11};var Zn=Math.abs;function zn(e){return(0<e)-(e<0)||+e}function $n(){if(!this.isValid())return this.localeData().invalidDate();var e,t,n=Zn(this._milliseconds)/1e3,s=Zn(this._days),i=Zn(this._months);t=S((e=S(n/60))/60),n%=60,e%=60;var r=S(i/12),a=i%=12,o=s,u=t,l=e,h=n?n.toFixed(3).replace(/\.?0+$/,""):"",d=this.asSeconds();if(!d)return"P0D";var c=d<0?"-":"",f=zn(this._months)!==zn(d)?"-":"",m=zn(this._days)!==zn(d)?"-":"",_=zn(this._milliseconds)!==zn(d)?"-":"";return c+"P"+(r?f+r+"Y":"")+(a?f+a+"M":"")+(o?m+o+"D":"")+(u||l||h?"T":"")+(u?_+u+"H":"")+(l?_+l+"M":"")+(h?_+h+"S":"")}var qn=Ht.prototype;return qn.isValid=function(){return this._isValid},qn.abs=function(){var e=this._data;return this._milliseconds=wn(this._milliseconds),this._days=wn(this._days),this._months=wn(this._months),e.milliseconds=wn(e.milliseconds),e.seconds=wn(e.seconds),e.minutes=wn(e.minutes),e.hours=wn(e.hours),e.months=wn(e.months),e.years=wn(e.years),this},qn.add=function(e,t){return Mn(this,e,t,1)},qn.subtract=function(e,t){return Mn(this,e,t,-1)},qn.as=function(e){if(!this.isValid())return NaN;var t,n,s=this._milliseconds;if("month"===(e=H(e))||"quarter"===e||"year"===e)switch(t=this._days+s/864e5,n=this._months+Sn(t),e){case"month":return n;case"quarter":return n/3;case"year":return n/12}else switch(t=this._days+Math.round(Dn(this._months)),e){case"week":return t/7+s/6048e5;case"day":return t+s/864e5;case"hour":return 24*t+s/36e5;case"minute":return 1440*t+s/6e4;case"second":return 86400*t+s/1e3;case"millisecond":return Math.floor(864e5*t)+s;default:throw new Error("Unknown unit "+e)}},qn.asMilliseconds=On,qn.asSeconds=Tn,qn.asMinutes=bn,qn.asHours=xn,qn.asDays=Pn,qn.asWeeks=Wn,qn.asMonths=Cn,qn.asQuarters=Hn,qn.asYears=Rn,qn.valueOf=function(){return this.isValid()?this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*D(this._months/12):NaN},qn._bubble=function(){var e,t,n,s,i,r=this._milliseconds,a=this._days,o=this._months,u=this._data;return 0<=r&&0<=a&&0<=o||r<=0&&a<=0&&o<=0||(r+=864e5*kn(Dn(o)+a),o=a=0),u.milliseconds=r%1e3,e=S(r/1e3),u.seconds=e%60,t=S(e/60),u.minutes=t%60,n=S(t/60),u.hours=n%24,o+=i=S(Sn(a+=S(n/24))),a-=kn(Dn(i)),s=S(o/12),o%=12,u.days=a,u.months=o,u.years=s,this},qn.clone=function(){return jt(this)},qn.get=function(e){return e=H(e),this.isValid()?this[e+"s"]():NaN},qn.milliseconds=Fn,qn.seconds=Ln,qn.minutes=Nn,qn.hours=Gn,qn.days=Vn,qn.weeks=function(){return S(this.days()/7)},qn.months=En,qn.years=In,qn.humanize=function(e){if(!this.isValid())return this.localeData().invalidDate();var t,n,s,i,r,a,o,u,l,h,d,c=this.localeData(),f=(n=!e,s=c,i=jt(t=this).abs(),r=An(i.as("s")),a=An(i.as("m")),o=An(i.as("h")),u=An(i.as("d")),l=An(i.as("M")),h=An(i.as("y")),(d=r<=jn.ss&&["s",r]||r<jn.s&&["ss",r]||a<=1&&["m"]||a<jn.m&&["mm",a]||o<=1&&["h"]||o<jn.h&&["hh",o]||u<=1&&["d"]||u<jn.d&&["dd",u]||l<=1&&["M"]||l<jn.M&&["MM",l]||h<=1&&["y"]||["yy",h])[2]=n,d[3]=0<+t,d[4]=s,function(e,t,n,s,i){return i.relativeTime(t||1,!!n,e,s)}.apply(null,d));return e&&(f=c.pastFuture(+this,f)),c.postformat(f)},qn.toISOString=$n,qn.toString=$n,qn.toJSON=$n,qn.locale=Xt,qn.localeData=en,qn.toIsoString=n("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",$n),qn.lang=Kt,I("X",0,0,"unix"),I("x",0,0,"valueOf"),ue("x",se),ue("X",/[+-]?\d+(\.\d{1,3})?/),ce("X",function(e,t,n){n._d=new Date(1e3*parseFloat(e,10))}),ce("x",function(e,t,n){n._d=new Date(D(e))}),c.version="2.24.0",e=bt,c.fn=mn,c.min=function(){return Wt("isBefore",[].slice.call(arguments,0))},c.max=function(){return Wt("isAfter",[].slice.call(arguments,0))},c.now=function(){return Date.now?Date.now():+new Date},c.utc=y,c.unix=function(e){return bt(1e3*e)},c.months=function(e,t){return vn(e,t,"months")},c.isDate=d,c.locale=ut,c.invalid=p,c.duration=jt,c.isMoment=k,c.weekdays=function(e,t,n){return pn(e,t,n,"weekdays")},c.parseZone=function(){return bt.apply(null,arguments).parseZone()},c.localeData=ht,c.isDuration=Rt,c.monthsShort=function(e,t){return vn(e,t,"monthsShort")},c.weekdaysMin=function(e,t,n){return pn(e,t,n,"weekdaysMin")},c.defineLocale=lt,c.updateLocale=function(e,t){if(null!=t){var n,s,i=st;null!=(s=ot(e))&&(i=s._config),(n=new P(t=x(i,t))).parentLocale=it[e],it[e]=n,ut(e)}else null!=it[e]&&(null!=it[e].parentLocale?it[e]=it[e].parentLocale:null!=it[e]&&delete it[e]);return it[e]},c.locales=function(){return s(it)},c.weekdaysShort=function(e,t,n){return pn(e,t,n,"weekdaysShort")},c.normalizeUnits=H,c.relativeTimeRounding=function(e){return void 0===e?An:"function"==typeof e&&(An=e,!0)},c.relativeTimeThreshold=function(e,t){return void 0!==jn[e]&&(void 0===t?jn[e]:(jn[e]=t,"s"===e&&(jn.ss=t-1),!0))},c.calendarFormat=function(e,t){var n=e.diff(t,"days",!0);return n<-6?"sameElse":n<-1?"lastWeek":n<0?"lastDay":n<1?"sameDay":n<2?"nextDay":n<7?"nextWeek":"sameElse"},c.prototype=mn,c.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"GGGG-[W]WW",MONTH:"YYYY-MM"},c});
12629
12630/* End Include moment.min */
12631
12632/* Include doculaw */
12633if(typeof(jQuery) != "undefined") {
12634	$(function() {
12635		/* Only run this code on Doculaw pages. */
12636		if(!isDoculaw()) return;
12637
12638		if(typeof(Sys) != "undefined") {
12639			Sys.Application.add_load(doculawInit);
12640			if(Sys.Application.get_isInitialized()) {
12641				doculawInit();
12642			}
12643		}
12644		else {
12645			doculawInit();
12646		}
12647	});
12648}
12649
12650function isDoculaw() {
12651	return $(".DLAW").length > 0;
12652}
12653
12654function doculawInit() {
12655	/* Numbered Inputs */
12656	$(".numText input").on("focus", function(){
12657		$(this).parents().siblings(".hint").addClass("focus");
12658	}).on("blur", function(){
12659		$(this).parents().siblings(".hint").removeClass("focus");
12660	});
12661	var numInputs=$(".numText input");
12662	var i;
12663	for(i=0;i<numInputs.length;i++){
12664		numInputs[i].onkeypress=function(e){if(e.key=="Enter"){e.preventDefault(); e.target.blur();}};
12665	}
12666 
12667 	/* Date Picker */
12668	registerPostStartUpScript(function() {
12669		$(".datePicker").datepicker("option", {
12670			monthNamesShort: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "
12670November", "December"],
12671		});
12672	});
12673
12674	/* Payment Page */
12675	if ($(".bannerOrderPage").length) {
12676		DLAWpay();
12677	}
12678
12679	/* Post-Purchase Preview Back to Top */
12680	if ($('.previewPage.licensed').length) {
12681		backToTop();
12682	}
12683
12684	/* mobile drop-down lists */
12685	mobileMenu();
12686
12687	/* Keep Footer at the bottom of the page */
12688	footer();
12689
12690	
12691} /*end of doculawInit()*/
12692
12693function backToTop() {
12694	$(window).on("touchstart scroll resize", function(event) {
12695		var previewHead = $('.previewHead');
12696		if ($(".controls").length) {
12697			if (previewHead.offset().top + previewHead.outerHeight() < $(window).scrollTop()) {
12698				$('body').addClass('controlsFixed');
12699			}else {
12700				$('body').removeClass('controlsFixed');
12701			}
12702		}
12703		var footerHeight = $("#footer").height();
12704		var extraDocumentsHeight = $(".extraDocuments").outerHeight(true);
12705		if (($(window).scrollTop() + $(window).height()) > ($(document).height() - extraDocumentsHeight - footerHeight)) {
12706			$('.backToTop').addClass('bottom');
12707		}else {
12708			$('.backToTop').removeClass('bottom');
12709		}
12710
12711		if ($('#contract, .contract').next('.backToTop').length == 0) {
12712			$("#contract, .contract").after('<a onclick="$(\'html, body\').animate({scrollTop: 0 }, 500);" class="backToTop" ></a>');
12713		}
12714	});
12715}
12716
12717function DLAWpay() {
12718	/* Move element positions */
12719	$("#groupHelpAccordion").insertAfter($(".smain_table"));		
12720	$(".CCRow .lblMainText").insertBefore($(".CCRow > Input"));
12721	$(".newPaymentMethod").insertAfter($(".savedCards"));
12722	setTimeout(function() {
12723		if ($(".savedCards").is(":visible")) {
12724			var FAQposition = $(".savedCards").offset().top - $(".savedCards").position().top;
12725			if (cssua.ua.ie || cssua.ua.firefox || cssua.ua.edge) {
12726				var FAQposition = $(".savedCards").position().top;
12727			}
12728			$(".spaymentButton-order-new, .termsOfUseText").css("float", "left");				
12729		}else {
12730			$(".spaymentButton-order-new, .termsOfUseText").css("float", "right");
12731		}
12732		$("#groupHelpAccordion").css("top", FAQposition);
12733	}, 20);
12734	/* Set orange radio dot */
12735		$(".cardSelection input:checked").closest("label").addClass("selectedPaymentType");
12736	$(".cardSelection label").on("click", function() {
12737		$(".cardSelection label").removeClass("selectedPaymentType");
12738		$(this).addClass("selectedPaymentType");
12739	});
12740	/* AMEX text overlap fix */
12741	if ($(".cardEnding").width() >= 300) {
12742		$(".savedCards .lblMainText").css("font-size", "20px");	
12743	}
12744	/* Fade-in page */
12745	$(".qdLeft").addClass("fadeEffect");	
12746
12747	/* Prevent New Payment section from staying hidden */
12748	$(".newPaymentMethod").on("click", function() {
12749		if ($(".cardSelection").css("display") == "none") {
12750			$(".cardSelection, .creditCardEntry").show();
12751			$(".CCRow").trigger("click");
12752		}
12753	});
12754
12755	/* Saved credit card - ensure chosen option & hide New Payment section */
12756	$(".savedCard .paymentInput input").on("focus", function() {
12757		$(this).closest(".savedCard").find("input").prop("checked", true).trigger("change");
12758		$("tr.current").removeClass("current");
12759		$(this).closest("tr").addClass("current");
12760
12761		if ($(this).closest("tr").hasClass("current")) {
12762			$(".savedCard .paymentInput input").val("");
12763		}
12764	});
12765	var currentCard = $(".savedCard.current");
12766	$(currentCard).closest("tr").addClass("current");
12767
12768	$(".savedCards tr").on("click", function() {
12769		$(this).find("td label .paymentInput input").trigger("focus");
12770		$(".cardSelection, .creditCardEntry").hide();
12771	});
12772
12773	/* Hide re-purchase elements for new user */
12774	if ($(".savedCards").css("display") == "none") {
12775		$(".loggedInTextContainer, .newPaymentMethod").hide();
12776	}
12777
12778	/* New Payment Click */
12779	$(".newPaymentMethod").on("click", function() {
12780		if((".savedCards").length) {
12781			$("tr.current").removeClass("current");
12782			$(".cardSelection, .creditCardEntry").addClass("current");
12783		}
12784		$(".savedCard .paymentInput input").val("");
12785		setTimeout(function() {
12786			$(".creditCardEntry .stxtCardNumber input").trigger("focus");
12787		},0);
12788	});
12789
12790	/* Border highlights when Saved Cards present */
12791	$(".PPRow").on("click", function() {
12792		if ($(".savedCards").is(":visible") && $(".PPRow input").val() == "rdoPayPal") {
12793			$(".cardSelection").css({borderBottom: "2px solid #df6c14"});
12794		}
12795	});
12796	$(".CCRow").on("click", function(){
12797		$(".cardSelection").css({borderBottom: ""});
12798	});
12799
12800	/* Terms of use text alignment */
12801	var paymentButton=$(".spaymentButton-order-new input");
12802	if(paymentButton.length>0){
12803		var buttonWidth = paymentButton[0].offsetWidth;
12804		$(".termsOfUseText").css("max-width", buttonWidth);
12805	}
12806	$(".buyOptionContainer").on("click", function() {
12807		var paymentButton=$(".spaymentButton-order-new input");
12808		if(paymentButton.length>0){
12809			var buttonWidth = paymentButton[0].offsetWidth;
12810			$(".termsOfUseText").css("max-width", buttonWidth);
12811		}
12812	});
12813
12814	/* Check store card cvv when click the payment button */		
12815	$(".paymentButton").on("click", function () {
12816		var securityCodeInput = document.getElementsByClassName("savedSecurityCodeInput");
12817		for(var i = 0; i < securityCodeInput.length; i++) {
12818			if(securityCodeInput[i].value == "") {
12819				var num = i+1;
12820				const securityCodeClass = 'svalSecurityCode' + num.toString();
12821				var securityCode = document.getElementsByClassName(securityCodeClass);
12822				if ($(securityCode[0]).closest("tr").hasClass("current")) {
12823					securityCode[0].style.display = "block";
12824				}
12825			}
12826		}
12827	});	
12828}
12829
12830function mobileMenu() {
12831	/* Mobile Dropdown menu */
12832	$(".dropdownLink .bannerLink").on("click", function() {
12833		if (window.innerWidth <= 990) {
12834		  if ($(this).parent(".dropdownLink").hasClass("open")) {
12835				$(this).parent(".dropdownLink").removeClass("open");
12836				$(this).next(".listDropdown").slideUp();
12837			}else {
12838				if ($(".dropdownLink").hasClass("open")) {
12839					$(".dropdownLink").removeClass("open");
12840					$(".listDropdown").slideUp();
12841				}
12842				$(this).parent(".dropdownLink").addClass("open");
12843				$(this).next(".listDropdown").slideToggle();
12844			}
12845		}
12846	});
12847}
12848
12849function footer() {
12850	$(document).ready(function () {
12851		var footerElement = $('#footer');
12852		var contentElement = $('#content');
12853		var expFaqContentElement = $('#expFaqContent');
12854
12855		if (footerElement) {
12856			var bottomPaddingForFooter = footerElement.outerHeight() + 'px';
12857			if (expFaqContentElement && expFaqContentElement.is(':visible')) {
12858				expFaqContentElement.css('padding-bottom', bottomPaddingForFooter);
12859			} else if (contentElement) {
12860				contentElement.css('padding-bottom', bottomPaddingForFooter);
12861			}
12862		}
12863	});
12864}
12865
12866/* End Include doculaw */
12867
12868/* Include messages */
12869function tryIsInDialog(includeFramed) {
12870	if (typeof(isInDialog) !== "function") return false;
12871	return isInDialog(includeFramed);
12872}
12873
12874var messageDivs = {};
12875/**
12876 * Creates and returns a div containing a dialog for displaying messages. If a message already exists it will return this existing div.
12877 * If the message can't be created it will return false.
12878 * @param {object}
12878 options - an object containing optional parameters for how the message behaves.
12879 * @param {string} [options.id] - the id of the message
12880 * @param {string} [options.parentElementSelector] - a selector to identify which element this message should be added as a child of
12881 * @param {number} [options.width] - the width of the message in pixels
12882 * @param {number} [options.height] - the height of the message in pixels
12883 * @param {object} [options.fadeMessage] - used as the hide parameter of the created dialog
12884 * @param {string} [options.dialogClass] - the class applied to the message dialog
12885 * @param {string} [options.overElementID] - the id of an element which this message will display underneath
12886 * @param {number} [options.priority] -
12887 * 			How important the dialog is, the higher the more important.
12888 *			When creating a new message it will only override existing messages with an equal or a lower priority.
12889 * 			This allows important messages to be displayed without being accidently overriden by less important messages.
12890 * @returns {(HTMLElement|boolean)} The div containing the message dialog or false
12891 */
12892function createMessageDiv(options){
12893	if(typeof($) != "undefined" && options) {
12894		var messageDiv;
12895		if (typeof(messageDivs[options.id]) == "undefined" || !$(messageDivs[options.id]).length || typeof(messageDivs[options.id].dialog) != "function"){
12896			messageDiv = document.createElement("div");
12897			messageDiv.style.textAlign = "center";
12898			if(!$(options.parentElementSelector).length) options.parentElementSelector = "body";
12899			$(options.parentElementSelector).append(messageDiv);
12900			messageDiv = $(messageDiv);
12901			messageDiv.dialog({
12902				autoOpen: false,
12903				width:options.width,
12904				height:options.height,
12905				closeOnEscape: false,
12906				draggable: false,
12907				resizable: false,
12908				modal: !options.overElementID,
12909				dialogClass: "noTitle messageDialog "+options.dialogClass,
12910				appendTo: options.parentElementSelector,
12911				hide: options.fadeMessage,
12912				position: {my:"center", at:"center", of: window}
12913			});
12914			messageDivs[options.id] = messageDiv;
12915		}
12916		else {
12917			messageDiv = messageDivs[options.id];
12918			var dialogCont = messageDiv.parent(); /* Makes sure that this message div is the last item in the parent, done to make sure that this doesn't cause other dialogs to be recreated */
12919			dialogCont.parent().append(dialogCont);
12920			// If the current dialog is open and is a higher priority than this one then return false to prevent overriding it.
12921			if(isMessageOpen(options.id) && messageDiv.priority > options.priority){
12922				return false;
12923			}
12924		}
12925		// Attach the priority to the messageDiv so it can be referenced later
12926		messageDiv.priority = options.priority;
12927		return messageDiv;
12928	}
12929	return false;
12930}
12931function calculateDialogPadding(dialog) {
12932	var dialogPaddingTop = dialog.parent().css("paddingTop");
12933	var dialogPaddingBottom = dialog.parent().css("paddingBottom");
12934	dialogPaddingTop = parseFloat(dialogPaddingTop.substring(0, dialogPaddingTop.length-2));
12935	dialogPaddingBottom = parseFloat(dialogPaddingBottom.substring(0, dialogPaddingBottom.length-2));
12936	var dialogBorderTop = dialog.parent().css("borderTopWidth");
12937	var dialogBorderBottom = dialog.parent().css("borderBottomWidth");
12938	dialogBorderTop = parseFloat(dialogBorderTop.substring(0, dialogBorderTop.length-2));
12939	dialogBorderBottom = parseFloat(dialogBorderBottom.substring(0, dialogBorderBottom.length-2));
12940	var dialogContentPaddingTop = dialog.css("paddingTop");
12941	var dialogContentPaddingBottom = dialog.css("paddingBottom");
12942	dialogContentPaddingTop = parseFloat(dialogContentPaddingTop.substring(0, dialogContentPaddingTop.length-2));
12943	dialogContentPaddingBottom = parseFloat(dialogContentPaddingBottom.substring(0, dialogContentPaddingBottom.length-2));
12944	return Math.ceil(dialogPaddingTop + dialogPaddingBottom + dialogBorderTop + dialogBorderBottom + dialogContentPaddingTop + dialogContentPaddingBottom);
12945}
12946/**
12947 * Displays a message to the user as a small dialog. Messages cannot be closed by the user and may block user action until they have been closed.
12948 * @param {string} message - the messsage to show.
12949 * @param {object}
12949 optionsIn - an object containing optional parameters for how the message behaves.
12950 * @param {string} [optionsIn.id=""] - the id of the message
12951 * @param {string} [optionsIn.parentElementSelector="body"] - a selector to identify which element this message should be added as a child of
12952 * @param {string} [optionsIn.topImage="/common/jquery-ui/css/LegalContracts/images/ajax-loader.gif"] - the image displayed at the top of the message (by default a loading bar)
12953 * @param {number} [optionsIn.topImageWidth=220] - the width of the top image in pixels
12954 * @param {number} [optionsIn.topImageHeight=19] - the height of the top image in pixels
12955 * @param {string} [optionsIn.inlineImage] - an optional image displayed over the text
12956 * @param {number} [optionsIn.inlineImageWidth] - the width of the inline image in pixels
12957 * @param {number} [optionsIn.inlineImageHeight] - the height of the inline image in pixels
12958 * @param {number} [optionsIn.width=280] - the width of the message in pixels
12959 * @param {number} [optionsIn.height=120] - the height of the message in pixels
12960 * @param {number} [optionsIn.timeout=-1] - the number of milliseconds before the message closes, if -1 it will never close itself
12961 * @param {object} [optionsIn.fadeMessage=false] - used as the hide parameter of the created dialog
12962 * @param {boolean} [optionsIn.hideMessage=true] - if hideMessage should be called before creating the new dialog
12963 * @param {string} [optionsIn.dialogClass=""] - the class applied to the message dialog
12964 * @param {function} [optionsIn.timeoutCallback] - a callback when the message closes due to timeout, if no timeout this will be called instantly
12965 * @param {string} [optionsIn.overElementID] - the id of an element which this message will display underneath
12966 * @param {number} [optionsIn.priority=0] -
12967 * 			How important the dialog is, the higher the more important.
12968 *			When creating a new message it will only override existing messages with an equal or a lower priority.
12969 * 			This allows important messages to be displayed without being accidently overriden by less important messages.
12970 */
12971function showMessage(message, optionsIn){
12972	if(tryIsInDialog()){
12973		try{
12974			/* This will potentially fail if this is a dialog on a different domain, most likely https instead of http */
12975			top.showMessage(message, optionsIn);
12976			return;
12977		}
12978		catch(e){
12979			parentPostMessage("showMessage:" + escapeForPostMessage(message) + (typeof(optionsIn) != "undefined" ? ":" + stringifyForPostMessage(optionsIn) : ""));
12980			return;
12981		}
12982	}
12983	if(typeof($) != "undefined") {
12984		var options = {
12985			id: "",
12986			parentElementSelector: "body",
12987			topImage: "/common/jquery-ui/css/LegalContracts/images/ajax-loader.gif",
12988			topImageWidth: 220,
12989			topImageHeight: 19,
12990			inlineImage: null,
12991			inlineImageWidth: null,
12992			inlineImageHeight: null,
12993			width: 280,
12994			height: 120,
12995			timeout: -1,
12996			fadeMessage: false,
12997			hideMessage: true,
12998			dialogClass:"",
12999			timeoutCallback:null,
13000			overElementID:null,
13001			priority: 0
13002		};
13003		if(typeof(optionsIn) != "undefined") {
13004			$.extend(options, optionsIn);
13005		}
13006		var messageDiv = createMessageDiv(options);
13007		if(messageDiv && messageDiv.length){
13008			var topImg = options.topImage;
13009			var inlineImg = options.inlineImage;
13010			/* We get issues with the image not displaying properly and the whole thing looking poor if this happens beforeunload, so just don't display an image. */
13011			if(typeof(window.event) != "undefined" && window.event.type == "beforeunload"){
13012				topImg = null;
13013				inlineImg = null;
13014			}
13015
13016			var messageHtml = "";
13017			var messageRowHeight = options.height - calculateDialogPadding(messageDiv);
13018			if(topImg) {
13019				var widthHeight = "";
13020				if(options.topImageWidth) {
13021					widthHeight += " width=\"" + options.topImageWidth + "\"";
13022				}
13023				if(options.topImageHeight) {
13024					widthHeight += " height=\"" + options.topImageHeight + "\"";
13025				}
13026				messageHtml += "<div class=\"topImage\" style=\"height:" + options.topImageHeight + "px\"><img src=\"" + topImg + "\" alt=\"" + message + "\"" + widthHeight + " /></div>";
13027				messageRowHeight -= options.topImageHeight;
13028			}
13029			messageHtml += "<div class=\"messageRow\" style=\"height:" + messageRowHeight + "px\">";
13030			if(inlineImg) {
13031				var widthHeight = "";
13032				if(options.topImageWidth) {
13033					widthHeight += " width=\"" + options.inlineImageWidth + "\"";
13034				}
13035				if(options.topImageHeight) {
13036					widthHeight += " height=\"" + options.inlineImageHeight + "\"";
13037				}
13038				messageHtml += "<span class=\"inlineImage\"><img src=\"" + inlineImg + "\" alt=\"" + message + "\"" + widthHeight + " /></span>";
13039			}
13040			messageHtml += "<span class=\"message\">"+message+"</span>";
13041			messageHtml += "</div>";
13042			messageDiv.get(0).innerHTML = messageHtml;
13043			if(options.hideMessage) {
13044				hideMessage();
13045			}
13046			if(options.overElementID && elementHasDocument($("#" + options.overElementID))){
13047				messageDiv.dialog("option", "position", {my:"center", at:"center", of: $("#" + options.overElementID).get(0)});
13048			}
13049			messageDiv.dialog("open");
13050		}
13051
13052		if(options.timeout >= 0) {
13053			setTimeout(function(){if(typeof(options.timeoutCallback)=="function"){options.timeoutCallback();}if(options.hideMessage){hideMessage(options.id);}}, options.timeout);
13054		}
13055		else if(typeof(options.timeoutCallback)=="function") {
13056			options.timeoutCallback();
13057		}
13058	}
13059}
13060if(typeof(jQuery) != "undefined") {
13061	$(function() {
13062		if(typeof(_preloadImages) != "undefined") {
13063			_preloadImages.push("/common/jquery-ui/css/LegalContracts/images/ajax-loader.gif");
13064		}
13065	});
13066}
13067function hideMessage(id){
13068	if(tryIsInDialog()){
13069		try{
13070			/* This will potentially fail if this is a dialog on a different domain, most likely https instead of http */
13071			top.hideMessage(id);
13072			return;
13073		}
13074		catch(e){
13075			parentPostMessage("hideMessage" + (typeof(id) != "undefined" ? ":" + escapeForPostMessage(id):""));
13076			return;
13077		}
13078	}
13079	if(typeof(id) != "undefined" && id && typeof(messageDivs[id]) != "undefined" && typeof(messageDivs[id].dialog) == "function"){
13080		/* For some reason closing the dialog can cause the scroll position to*/
13081		/* change, make sure it's preserved.*/
13082		var scrollTop = $(window).scrollTop();
13083		var scrollLeft = $(window).scrollLeft();
13084		messageDivs[id].dialog("close");
13085		$(window).scrollTop(scrollTop);
13086		$(window).scrollLeft(scrollLeft);
13087	}
13088	else {
13089		for(var dialogId in messageDivs) {
13090			var messageDiv = messageDivs[dialogId];
13091			if(typeof(messageDiv) != "undefined" && typeof(messageDiv.dialog) == "function"){
13092				/* For some reason closing the dialog can cause the scroll position to*/
13093				/* change, make sure it's preserved.*/
13094				var scrollTop = $(window).scrollTop();
13095				var scrollLeft = $(window).scrollLeft();
13096				try{ /* IE9 seems to have an issue if several different messages are hidden/shown quickly. Wrapping this in a try/catch seems to resolve the issue */
13097					messageDiv.dialog("close");
13098				}
13099				catch(e){}
13100				$(window).scrollTop(scrollTop);
13101				$(window).scrollLeft(scrollLeft);
13102			}
13103		}
13104	}
13105}
13106function isMessageOpen(id) {
13107	var isOpen = false;
13108	if(typeof(id) != "undefined" && id && typeof(messageDivs[id]) != "undefined" && typeof(messageDivs[id].dialog) == "function"){
13109		isOpen = messageDivs[id].dialog("isOpen");
13110	}
13111	else {
13112		for(var dialogId in messageDivs) {
13113			isOpen = messageDivs[dialogId].dialog("isOpen");
13114			if(isOpen) break;
13115		}
13116	}
13117	return isOpen;
13118}
13119/* End Include messages */
13120
13121/* Include slick.min */
13122/*
13123     _ _      _       _
13124 ___| (_) ___| | __  (_)___
13125/ __| | |/ __| |/ /  | / __|
13126\__ \ | | (__|   < _ | \__ \
13127|___/_|_|\___|_|\_(_)/ |___/
13128                   |__/
13129
13130 Version: 1.9.0
13131  Author: Ken Wheeler
13132 Website: http://kenwheeler.github.io
13133    Docs: http://kenwheeler.github.io/slick
13134    Repo: http://github.com/kenwheeler/slick
13135  Issues: http://github.com/kenwheeler/slick/issues
13136
13137 */�
vendor: 32,027 bytes, lines 13137-13138
13137
13138(function(i){"use strict";"function"==typeof define&&define.amd?define(["jquery"],i):"undefined"!=typeof exports?module.exports=i(require("jquery")):i(jQuery)})(function(i){"use strict";var e=window.Slick||{};e=function(){function e(e,o){var s,n=this;n.defaults={accessibility:!0,adaptiveHeight:!1,appendArrows:i(e),appendDots:i(e),arrows:!0,asNavFor:null,prevArrow:'<button class="slick-prev" aria-label="Previous" type="button">Previous</button>',nextArrow:'<button class="slick-next" aria-label="Next" type="button">Next</button>',autoplay:!1,autoplaySpeed:3e3,centerMode:!1,centerPadding:"50px",cssEase:"ease",customPaging:function(e,t){return i('<button type="button" />').text(t+1)},dots:!1,dotsClass:"slick-dots",draggable:!0,easing:"linear",edgeFriction:.35,fade:!1,focusOnSelect:!1,focusOnChange:!1,infinite:!0,initialSlide:0,lazyLoad:"ondemand",mobileFirst:!1,pauseOnHover:!0,pauseOnFocus:!0,pauseOnDotsHover:!1,respondTo:"window",responsive:null,rows:1,rtl:!1,slide:"",slidesPerRow:1,slidesToShow:1,slidesToScroll:1,speed:500,swipe:!0,swipeToSlide:!1,touchMove:!0,touchThreshold:5,useCSS:!0,useTransform:!0,variableWidth:!1,vertical:!1,verticalSwiping:!1,waitForAnimate:!0,zIndex:1e3},n.initials={animating:!1,dragging:!1,autoPlayTimer:null,currentDirection:0,currentLeft:null,currentSlide:0,direction:1,$dots:null,listWidth:null,listHeight:null,loadIndex:0,$nextArrow:null,$prevArrow:null,scrolling:!1,slideCount:null,slideWidth:null,$slideTrack:null,$slides:null,sliding:!1,slideOffset:0,swipeLeft:null,swiping:!1,$list:null,touchObject:{},transformsEnabled:!1,unslicked:!1},i.extend(n,n.initials),n.activeBreakpoint=null,n.animType=null,n.animProp=null,n.breakpoints=[],n.breakpointSettings=[],n.cssTransitions=!1,n.focussed=!1,n.interrupted=!1,n.hidden="hidden",n.paused=!0,n.positionProp=null,n.respondTo=null,n.rowCount=1,n.shouldClick=!0,n.$slider=i(e),n.$slidesCache=null,n.transformType=null,n.transitionType=null,n.visibilityChange="visibilitychange",n.windowWidth=0,n.windowTimer=null,s=i(e).data("slick")||{},n.options=i.extend({},n.defaults,o,s),n.currentSlide=n.options.initialSlide,n.originalSettings=n.options,"undefined"!=typeof document.mozHidden?(n.hidden="mozHidden",n.visibilityChange="mozvisibilitychange"):"undefined"!=typeof document.webkitHidden&&(n.hidden="webkitHidden",n.visibilityChange="webkitvisibilitychange"),n.autoPlay=i.proxy(n.autoPlay,n),n.autoPlayClear=i.proxy(n.autoPlayClear,n),n.autoPlayIterator=i.proxy(n.autoPlayIterator,n),n.changeSlide=i.proxy(n.changeSlide,n),n.clickHandler=i.proxy(n.clickHandler,n),n.selectHandler=i.proxy(n.selectHandler,n),n.setPosition=i.proxy(n.setPosition,n),n.swipeHandler=i.proxy(n.swipeHandler,n),n.dragHandler=i.proxy(n.dragHandler,n),n.keyHandler=i.proxy(n.keyHandler,n),n.instanceUid=t++,n.htmlExpr=/^(?:\s*(<[\w\W]+>)[^>]*)$/,n.registerBreakpoints(),n.init(!0)}var t=0;return e}(),e.prototype.activateADA=function(){var i=this;i.$slideTrack.find(".slick-active").attr({"aria-hidden":"false"}).find("a, input, button, select").attr({tabindex:"0"})},e.prototype.addSlide=e.prototype.slickAdd=function(e,t,o){var s=this;if("boolean"==typeof t)o=t,t=null;else if(t<0||t>=s.slideCount)return!1;s.unload(),"number"==typeof t?0===t&&0===s.$slides.length?i(e).appendTo(s.$slideTrack):o?i(e).insertBefore(s.$slides.eq(t)):i(e).insertAfter(s.$slides.eq(t)):o===!0?i(e).prependTo(s.$slideTrack):i(e).appendTo(s.$slideTrack),s.$slides=s.$slideTrack.children(this.options.slide),s.$slideTrack.children(this.options.slide).detach(),s.$slideTrack.append(s.$slides),s.$slides.each(function(e,t){i(t).attr("data-slick-index",e)}),s.$slidesCache=s.$slides,s.reinit()},e.prototype.animateHeight=function(){var i=this;if(1===i.options.slidesToShow&&i.options.adaptiveHeight===!0&&i.options.vertical===!1){var e=i.$slides.eq(i.currentSlide).outerHeight(!0);i.$list.animate({height:e},i.options.speed)}},e.prototype.animateSlide=function(e,t){var o={},s=this;s.animateHeight(),s.options.rtl===!0&&s.options.vertical===!1&&(e=-e),s.transformsEnabled===!1?s.options.vertical===!1?s.$slideTrack.animate({left:e},s.options.speed,s.options.easing,t):s.$slideTrack.animate({top:e},s.options.speed,s.options.easing,t):s.cssTransitions===!1?(s.options.rtl===!0&&(s.currentLeft=-s.currentLeft),i({animStart:s.currentLeft}).animate({animStart:e},{duration:s.options.speed,easing:s.options.easing,step:function(i){i=Math.ceil(i),s.options.vertical===!1?(o[s.animType]="translate("+i+"px, 0px)",s.$slideTrack.css(o)):(o[s.animType]="translate(0px,"+i+"px)",s.$slideTrack.css(o))},complete:function(){t&&t.call()}})):(s.applyTransition(),e=Math.ceil(e),s.options.vertical===!1?o[s.animType]="translate3d("+e+"px, 0px, 0px)":o[s.animType]="translate3d(0px,"+e+"px, 0px)",s.$slideTrack.css(o),t&&setTimeout(function(){s.disableTransition(),t.call()},s.options.speed))},e.prototype.getNavTarget=function(){var e=this,t=e.options.asNavFor;return t&&null!==t&&(t=i(t).not(e.$slider)),t},e.prototype.asNavFor=function(e){var t=this,o=t.getNavTarget();null!==o&&"object"==typeof o&&o.each(function(){var t=i(this).slick("getSlick");t.unslicked||t.slideHandler(e,!0)})},e.prototype.applyTransition=function(i){var e=this,t={};e.options.fade===!1?t[e.transitionType]=e.transformType+" "+e.options.speed+"ms "+e.options.cssEase:t[e.transitionType]="opacity "+e.options.speed+"ms "+e.options.cssEase,e.options.fade===!1?e.$slideTrack.css(t):e.$slides.eq(i).css(t)},e.prototype.autoPlay=function(){var i=this;i.autoPlayClear(),i.slideCount>i.options.slidesToShow&&(i.autoPlayTimer=setInterval(i.autoPlayIterator,i.options.autoplaySpeed))},e.prototype.autoPlayClear=function(){var i=this;i.autoPlayTimer&&clearInterval(i.autoPlayTimer)},e.prototype.autoPlayIterator=function(){var i=this,e=i.currentSlide+i.options.slidesToScroll;i.paused||i.interrupted||i.focussed||(i.options.infinite===!1&&(1===i.direction&&i.currentSlide+1===i.slideCount-1?i.direction=0:0===i.direction&&(e=i.currentSlide-i.options.slidesToScroll,i.currentSlide-1===0&&(i.direction=1))),i.slideHandler(e))},e.prototype.buildArrows=function(){var e=this;e.options.arrows===!0&&(e.$prevArrow=i(e.options.prevArrow).addClass("slick-arrow"),e.$nextArrow=i(e.options.nextArrow).addClass("slick-arrow"),e.slideCount>e.options.slidesToShow?(e.$prevArrow.removeClass("slick-hidden").removeAttr("aria-hidden tabindex"),e.$nextArrow.removeClass("slick-hidden").removeAttr("aria-hidden tabindex"),e.htmlExpr.test(e.options.prevArrow)&&e.$prevArrow.prependTo(e.options.appendArrows),e.htmlExpr.test(e.options.nextArrow)&&e.$nextArrow.appendTo(e.options.appendArrows),e.options.infinite!==!0&&e.$prevArrow.addClass("slick-disabled").attr("aria-disabled","true")):e.$prevArrow.add(e.$nextArrow).addClass("slick-hidden").attr({"aria-disabled":"true",tabindex:"-1"}))},e.prototype.buildDots=function(){var e,t,o=this;if(o.options.dots===!0&&o.slideCount>o.options.slidesToShow){for(o.$slider.addClass("slick-dotted"),t=i("<ul />").addClass(o.options.dotsClass),e=0;e<=o.getDotCount();e+=1)t.append(i("<li />").append(o.options.customPaging.call(this,o,e)));o.$dots=t.appendTo(o.options.appendDots),o.$dots.find("li").first().addClass("slick-active")}},e.prototype.buildOut=function(){var e=this;e.$slides=e.$slider.children(e.options.slide+":not(.slick-cloned)").addClass("slick-slide"),e.slideCount=e.$slides.length,e.$slides.each(function(e,t){i(t).attr("data-slick-index",e).data("originalStyling",i(t).attr("style")||"")}),e.$slider.addClass("slick-slider"),e.$slideTrack=0===e.slideCount?i('<div class="slick-track"/>').appendTo(e.$slider):e.$slides.wrapAll('<div class="slick-track"/>').parent(),e.$list=e.$slideTrack.wrap('<div class="slick-list"/>').parent(),e.$slideTrack.css("opacity",0),e.options.centerMode!==!0&&e.options.swipeToSlide!==!0||(e.options.slidesToScroll=1),i("img[data-lazy]",e.$slider).not("[src]").addClass("slick-loading"),e.setupInfinite(),e.buildArrows(),e.buildDots(),e.updateDots(),e.setSlideClasses("number"==typeof e.currentSlide?e.currentSlide:0),e.options.draggable===!0&&e.$list.addClass("draggable")},e.prototype.buildRows=function(){var i,e,t,o,s,n,r,l=this;if(o=document.createDocumentFragment(),n=l.$slider.children(),l.options.rows>0){for(r=l.options.slidesPerRow*l.options.rows,s=Math.ceil(n.length/r),i=0;i<s;i++){var d=document.createElement("div");for(e=0;e<l.options.rows;e++){var a=document.createElement("div");for(t=0;t<l.options.slidesPerRow;t++){var c=i*r+(e*l.options.slidesPerRow+t);n.get(c)&&a.appendChild(n.get(c))}d.appendChild(a)}o.appendChild(d)}l.$slider.empty().append(o),l.$slider.children().children().children().css({width:100/l.options.slidesPerRow+"%",display:"inline-block"})}},e.prototype.checkResponsive=function(e,t){var o,s,n,r=this,l=!1,d=r.$slider.width(),a=window.innerWidth||i(window).width();if("window"===r.respondTo?n=a:"slider"===r.respondTo?n=d:"min"===r.respondTo&&(n=Math.min(a,d)),r.options.responsive&&r.options.responsive.length&&null!==r.options.responsive){s=null;for(o in r.breakpoints)r.breakpoints.hasOwnProperty(o)&&(r.originalSettings.mobileFirst===!1?n<r.breakpoints[o]&&(s=r.breakpoints[o]):n>r.breakpoints[o]&&(s=r.breakpoints[o]));null!==s?null!==r.activeBreakpoint?(s!==r.activeBreakpoint||t)&&(r.activeBreakpoint=s,"unslick"===r.breakpointSettings[s]?r.unslick(s):(r.options=i.extend({},r.originalSettings,r.breakpointSettings[s]),e===!0&&(r.currentSlide=r.options.initialSlide),r.refresh(e)),l=s):(r.activeBreakpoint=s,"unslick"===r.breakpointSettings[s]?r.unslick(s):(r.options=i.extend({},r.originalSettings,r.breakpointSettings[s]),e===!0&&(r.currentSlide=r.options.initialSlide),r.refresh(e)),l=s):null!==r.activeBreakpoint&&(r.activeBreakpoint=null,r.options=r.originalSettings,e===!0&&(r.currentSlide=r.options.initialSlide),r.refresh(e),l=s),e||l===!1||r.$slider.trigger("breakpoint",[r,l])}},e.prototype.changeSlide=function(e,t){var o,s,n,r=this,l=i(e.currentTarget);switch(l.is("a")&&e.preventDefault(),l.is("li")||(l=l.closest("li")),n=r.slideCount%r.options.slidesToScroll!==0,o=n?0:(r.slideCount-r.currentSlide)%r.options.slidesToScroll,e.data.message){case"previous":s=0===o?r.options.slidesToScroll:r.options.slidesToShow-o,r.slideCount>r.options.slidesToShow&&r.slideHandler(r.currentSlide-s,!1,t);break;case"next":s=0===o?r.options.slidesToScroll:o,r.slideCount>r.options.slidesToShow&&r.slideHandler(r.currentSlide+s,!1,t);break;case"index":var d=0===e.data.index?0:e.data.index||l.index()*r.options.slidesToScroll;r.slideHandler(r.checkNavigable(d),!1,t),l.children().trigger("focus");break;default:return}},e.prototype.checkNavigable=function(i){var e,t,o=this;if(e=o.getNavigableIndexes(),t=0,i>e[e.length-1])i=e[e.length-1];else for(var s in e){if(i<e[s]){i=t;break}t=e[s]}return i},e.prototype.cleanUpEvents=function(){var e=this;e.options.dots&&null!==e.$dots&&(i("li",e.$dots).off("click.slick",e.changeSlide).off("mouseenter.slick",i.proxy(e.interrupt,e,!0)).off("mouseleave.slick",i.proxy(e.interrupt,e,!1)),e.options.accessibility===!0&&e.$dots.off("keydown.slick",e.keyHandler)),e.$slider.off("focus.slick blur.slick"),e.options.arrows===!0&&e.slideCount>e.options.slidesToShow&&(e.$prevArrow&&e.$prevArrow.off("click.slick",e.changeSlide),e.$nextArrow&&e.$nextArrow.off("click.slick",e.changeSlide),e.options.accessibility===!0&&(e.$prevArrow&&e.$prevArrow.off("keydown.slick",e.keyHandler),e.$nextArrow&&e.$nextArrow.off("keydown.slick",e.keyHandler))),e.$list.off("touchstart.slick mousedown.slick",e.swipeHandler),e.$list.off("touchmove.slick mousemove.slick",e.swipeHandler),e.$list.off("touchend.slick mouseup.slick",e.swipeHandler),e.$list.off("touchcancel.slick mouseleave.slick",e.swipeHandler),e.$list.off("click.slick",e.clickHandler),i(document).off(e.visibilityChange,e.visibility),e.cleanUpSlideEvents(),e.options.accessibility===!0&&e.$list.off("keydown.slick",e.keyHandler),e.options.focusOnSelect===!0&&i(e.$slideTrack).children().off("click.slick",e.selectHandler),i(window).off("orientationchange.slick.slick-"+e.instanceUid,e.orientationChange),i(window).off("resize.slick.slick-"+e.instanceUid,e.resize),i("[draggable!=true]",e.$slideTrack).off("dragstart",e.preventDefault),i(window).off("load.slick.slick-"+e.instanceUid,e.setPosition)},e.prototype.cleanUpSlideEvents=function(){var e=this;e.$list.off("mouseenter.slick",i.proxy(e.interrupt,e,!0)),e.$list.off("mouseleave.slick",i.proxy(e.interrupt,e,!1))},e.prototype.cleanUpRows=function(){var i,e=this;e.options.rows>0&&(i=e.$slides.children().children(),i.removeAttr("style"),e.$slider.empty().append(i))},e.prototype.clickHandler=function(i){var e=this;e.shouldClick===!1&&(i.stopImmediatePropagation(),i.stopPropagation(),i.preventDefault())},e.prototype.destroy=function(e){var t=this;t.autoPlayClear(),t.touchObject={},t.cleanUpEvents(),i(".slick-cloned",t.$slider).detach(),t.$dots&&t.$dots.remove(),t.$prevArrow&&t.$prevArrow.length&&(t.$prevArrow.removeClass("slick-disabled slick-arrow slick-hidden").removeAttr("aria-hidden aria-disabled tabindex").css("display",""),t.htmlExpr.test(t.options.prevArrow)&&t.$prevArrow.remove()),t.$nextArrow&&t.$nextArrow.length&&(t.$nextArrow.removeClass("slick-disabled slick-arrow slick-hidden").removeAttr("aria-hidden aria-disabled tabindex").css("display",""),t.htmlExpr.test(t.options.nextArrow)&&t.$nextArrow.remove()),t.$slides&&(t.$slides.removeClass("slick-slide slick-active slick-center slick-visible slick-current").removeAttr("aria-hidden").removeAttr("data-slick-index").each(function(){i(this).attr("style",i(this).data("originalStyling"))}),t.$slideTrack.children(this.options.slide).detach(),t.$slideTrack.detach(),t.$list.detach(),t.$slider.append(t.$slides)),t.cleanUpRows(),t.$slider.removeClass("slick-slider"),t.$slider.removeClass("slick-initialized"),t.$slider.removeClass("slick-dotted"),t.unslicked=!0,e||t.$slider.trigger("destroy",[t])},e.prototype.disableTransition=function(i){var e=this,t={};t[e.transitionType]="",e.options.fade===!1?e.$slideTrack.css(t):e.$slides.eq(i).css(t)},e.prototype.fadeSlide=function(i,e){var t=this;t.cssTransitions===!1?(t.$slides.eq(i).css({zIndex:t.options.zIndex}),t.$slides.eq(i).animate({opacity:1},t.options.speed,t.options.easing,e)):(t.applyTransition(i),t.$slides.eq(i).css({opacity:1,zIndex:t.options.zIndex}),e&&setTimeout(function(){t.disableTransition(i),e.call()},t.options.speed))},e.prototype.fadeSlideOut=function(i){var e=this;e.cssTransitions===!1?e.$slides.eq(i).animate({opacity:0,zIndex:e.options.zIndex-2},e.options.speed,e.options.easing):(e.applyTransition(i),e.$slides.eq(i).css({opacity:0,zIndex:e.options.zIndex-2}))},e.prototype.filterSlides=e.prototype.slickFilter=function(i){var e=this;null!==i&&(e.$slidesCache=e.$slides,e.unload(),e.$slideTrack.children(this.options.slide).detach(),e.$slidesCache.filter(i).appendTo(e.$slideTrack),e.reinit())},e.prototype.focusHandler=function(){var e=this;e.$slider.off("focus.slick blur.slick").on("focus.slick","*",function(t){var o=i(this);setTimeout(function(){e.options.pauseOnFocus&&o.is(":focus")&&(e.focussed=!0,e.autoPlay())},0)}).on("blur.slick","*",function(t){i(this);e.options.pauseOnFocus&&(e.focussed=!1,e.autoPlay())})},e.prototype.getCurrent=e.prototype.slickCurrentSlide=function(){var i=this;return i.currentSlide},e.prototype.getDotCount=function(){var i=this,e=0,t=0,o=0;if(i.options.infinite===!0)if(i.slideCount<=i.options.slidesToShow)++o;else for(;e<i.slideCount;)++o,e=t+i.options.slidesToScroll,t+=i.options.slidesToScroll<=i.options.slidesToShow?i.options.slidesToScroll:i.options.slidesToShow;else if(i.options.centerMode===!0)o=i.slideCount;else if(i.options.asNavFor)for(;e<i.slideCount;)++o,e=t+i.options.slidesToScroll,t+=i.options.slidesToScroll<=i.options.slidesToShow?i.options.slidesToScroll:i.options.slidesToShow;else o=1+Math.ceil((i.slideCount-i.options.slidesToShow)/i.options.slidesToScroll);return o-1},e.prototype.getLeft=function(i){var e,t,o,s,n=this,r=0;return n.slideOffset=0,t=n.$slides.first().outerHeight(!0),n.options.infinite===!0?(n.slideCount>n.options.slidesToShow&&(n.slideOffset=n.slideWidth*n.options.slidesToShow*-1,s=-1,n.options.vertical===!0&&n.options.centerMode===!0&&(2===n.options.slidesToShow?s=-1.5:1===n.options.slidesToShow&&(s=-2)),r=t*n.options.slidesToShow*s),n.slideCount%n.options.slidesToScroll!==0&&i+n.options.slidesToScroll>n.slideCount&&n.slideCount>n.options.slidesToShow&&(i>n.slideCount?(n.slideOffset=(n.options.slidesToShow-(i-n.slideCount))*n.slideWidth*-1,r=(n.options.slidesToShow-(i-n.slideCount))*t*-1):(n.slideOffset=n.slideCount%n.options.slidesToScroll*n.slideWidth*-1,r=n.slideCount%n.options.slidesToScroll*t*-1))):i+n.options.slidesToShow>n.slideCount&&(n.slideOffset=(i+n.options.slidesToShow-n.slideCount)*n.slideWidth,r=(i+n.options.slidesToShow-n.slideCount)*t),n.slideCount<=n.options.slidesToShow&&(n.slideOffset=0,r=0),n.options.centerMode===!0&&n.slideCount<=n.options.slidesToShow?n.slideOffset=n.slideWidth*Math.floor(n.options.slidesToShow)/2-n.slideWidth*n.slideCount/2:n.options.centerMode===!0&&n.options.infinite===!0?n.slideOffset+=n.slideWidth*Math.floor(n.options.slidesToShow/2)-n.slideWidth:n.options.centerMode===!0&&(n.slideOffset=0,n.slideOffset+=n.slideWidth*Math.floor(n.options.slidesToShow/2)),e=n.options.vertical===!1?i*n.slideWidth*-1+n.slideOffset:i*t*-1+r,n.options.variableWidth===!0&&(o=n.slideCount<=n.options.slidesToShow||n.options.infinite===!1?n.$slideTrack.children(".slick-slide").eq(i):n.$slideTrack.children(".slick-slide").eq(i+n.options.slidesToShow),e=n.options.rtl===!0?o[0]?(n.$slideTrack.width()-o[0].offsetLeft-o.width())*-1:0:o[0]?o[0].offsetLeft*-1:0,n.options.centerMode===!0&&(o=n.slideCount<=n.options.slidesToShow||n.options.infinite===!1?n.$slideTrack.children(".slick-slide").eq(i):n.$slideTrack.children(".slick-slide").eq(i+n.options.slidesToShow+1),e=n.options.rtl===!0?o[0]?(n.$slideTrack.width()-o[0].offsetLeft-o.width())*-1:0:o[0]?o[0].offsetLeft*-1:0,e+=(n.$list.width()-o.outerWidth())/2)),e},e.prototype.getOption=e.prototype.slickGetOption=function(i){var e=this;return e.options[i]},e.prototype.getNavigableIndexes=function(){var i,e=this,t=0,o=0,s=[];for(e.options.infinite===!1?i=e.slideCount:(t=e.options.slidesToScroll*-1,o=e.options.slidesToScroll*-1,i=2*e.slideCount);t<i;)s.push(t),t=o+e.options.slidesToScroll,o+=e.options.slidesToScroll<=e.options.slidesToShow?e.options.slidesToScroll:e.options.slidesToShow;return s},e.prototype.getSlick=function(){return this},e.prototype.getSlideCount=function(){var e,t,o,s,n=this;return s=n.options.centerMode===!0?Math.floor(n.$list.width()/2):0,o=n.swipeLeft*-1+s,n.options.swipeToSlide===!0?(n.$slideTrack.find(".slick-slide").each(function(e,s){var r,l,d;if(r=i(s).outerWidth(),l=s.offsetLeft,n.options.centerMode!==!0&&(l+=r/2),d=l+r,o<d)return t=s,!1}),e=Math.abs(i(t).attr("data-slick-index")-n.currentSlide)||1):n.options.slidesToScroll},e.prototype.goTo=e.prototype.slickGoTo=function(i,e){var t=this;t.changeSlide({data:{message:"index",index:parseInt(i)}},e)},e.prototype.init=function(e){var t=this;i(t.$slider).hasClass("slick-initialized")||(i(t.$slider).addClass("slick-initialized"),t.buildRows(),t.buildOut(),t.setProps(),t.startLoad(),t.loadSlider(),t.initializeEvents(),t.updateArrows(),t.updateDots(),t.checkResponsive(!0),t.focusHandler()),e&&t.$slider.trigger("init",[t]),t.options.accessibility===!0&&t.initADA(),t.options.autoplay&&(t.paused=!1,t.autoPlay())},e.prototype.initADA=function(){var e=this,t=Math.ceil(e.slideCount/e.options.slidesToShow),o=e.getNavigableIndexes().filter(function(i){return i>=0&&i<e.slideCount});e.$slides.add(e.$slideTrack.find(".slick-cloned")).attr({"aria-hidden":"true",tabindex:"-1"}).find("a, input, button, select").attr({tabindex:"-1"}),null!==e.$dots&&(e.$slides.not(e.$slideTrack.find(".slick-cloned")).each(function(t){var s=o.indexOf(t);if(i(this).attr({role:"tabpanel",id:"slick-slide"+e.instanceUid+t,tabindex:-1}),s!==-1){var n="slick-slide-control"+e.instanceUid+s;i("#"+n).length&&i(this).attr({"aria-describedby":n})}}),e.$dots.attr("role","tablist").find("li").each(function(s){var n=o[s];i(this).attr({role:"presentation"}),i(this).find("button").first().attr({role:"tab",id:"slick-slide-control"+e.instanceUid+s,"aria-controls":"slick-slide"+e.instanceUid+n,"aria-label":s+1+" of "+t,"aria-selected":null,tabindex:"-1"})}).eq(e.currentSlide).find("button").attr({"aria-selected":"true",tabindex:"0"}).end());for(var s=e.currentSlide,n=s+e.options.slidesToShow;s<n;s++)e.options.focusOnChange?e.$slides.eq(s).attr({tabindex:"0"}):e.$slides.eq(s).removeAttr("tabindex");e.activateADA()},e.prototype.initArrowEvents=function(){var i=this;i.options.arrows===!0&&i.slideCount>i.options.slidesToShow&&(i.$prevArrow.off("click.slick").on("click.slick",{message:"previous"},i.changeSlide),i.$nextArrow.off("click.slick").on("click.slick",{message:"next"},i.changeSlide),i.options.accessibility===!0&&(i.$prevArrow.on("keydown.slick",i.keyHandler),i.$nextArrow.on("keydown.slick",i.keyHandler)))},e.prototype.initDotEvents=function(){var e=this;e.options.dots===!0&&e.slideCount>e.options.slidesToShow&&(i("li",e.$dots).on("click.slick",{message:"index"},e.changeSlide),e.options.accessibility===!0&&e.$dots.on("keydown.slick",e.keyHandler)),e.options.dots===!0&&e.options.pauseOnDotsHover===!0&&e.slideCount>e.options.slidesToShow&&i("li",e.$dots).on("mouseenter.slick",i.proxy(e.interrupt,e,!0)).on("mouseleave.slick",i.proxy(e.interrupt,e,!1))},e.prototype.initSlideEvents=function(){var e=this;e.options.pauseOnHover&&(e.$list.on("mouseenter.slick",i.proxy(e.interrupt,e,!0)),e.$list.on("mouseleave.slick",i.proxy(e.interrupt,e,!1)))},e.prototype.initializeEvents=function(){var e=this;e.initArrowEvents(),e.initDotEvents(),e.initSlideEvents(),e.$list.on("touchstart.slick mousedown.slick",{action:"start"},e.swipeHandler),e.$list.on("touchmove.slick mousemove.slick",{action:"move"},e.swipeHandler),e.$list.on("touchend.slick mouseup.slick",{action:"end"},e.swipeHandler),e.$list.on("touchcancel.slick mouseleave.slick",{action:"end"},e.swipeHandler),e.$list.on("click.slick",e.clickHandler),i(document).on(e.visibilityChange,i.proxy(e.visibility,e)),e.options.accessibility===!0&&e.$list.on("keydown.slick",e.keyHandler),e.options.focusOnSelect===!0&&i(e.$slideTrack).children().on("click.slick",e.selectHandler),i(window).on("orientationchange.slick.slick-"+e.instanceUid,i.proxy(e.orientationChange,e)),i(window).on("resize.slick.slick-"+e.instanceUid,i.proxy(e.resize,e)),i("[draggable!=true]",e.$slideTrack).on("dragstart",e.preventDefault),i(window).on("load.slick.slick-"+e.instanceUid,e.setPosition),i(e.setPosition)},e.prototype.initUI=function(){var i=this;i.options.arrows===!0&&i.slideCount>i.options.slidesToShow&&(i.$prevArrow.show(),i.$nextArrow.show()),i.options.dots===!0&&i.slideCount>i.options.slidesToShow&&i.$dots.show()},e.prototype.keyHandler=function(i){var e=this;i.target.tagName.match("TEXTAREA|INPUT|SELECT")||(37===i.keyCode&&e.options.accessibility===!0?e.changeSlide({data:{message:e.options.rtl===!0?"next":"previous"}}):39===i.keyCode&&e.options.accessibility===!0&&e.changeSlide({data:{message:e.options.rtl===!0?"previous":"next"}}))},e.prototype.lazyLoad=function(){function e(e){i("img[data-lazy]",e).each(function(){var e=i(this),t=i(this).attr("data-lazy"),o=i(this).attr("data-srcset"),s=i(this).attr("data-sizes")||r.$slider.attr("data-sizes"),n=document.createElement("img");n.onload=function(){e.animate({opacity:0},100,function(){o&&(e.attr("srcset",o),s&&e.attr("sizes",s)),e.attr("src",t).animate({opacity:1},200,function(){e.removeAttr("data-lazy data-srcset data-sizes").removeClass("slick-loading")}),r.$slider.trigger("lazyLoaded",[r,e,t])})},n.onerror=function(){e.removeAttr("data-lazy").removeClass("slick-loading").addClass("slick-lazyload-error"),r.$slider.trigger("lazyLoadError",[r,e,t])},n.src=t})}var t,o,s,n,r=this;if(r.options.centerMode===!0?r.options.infinite===!0?(s=r.currentSlide+(r.options.slidesToShow/2+1),n=s+r.options.slidesToShow+2):(s=Math.max(0,r.currentSlide-(r.options.slidesToShow/2+1)),n=2+(r.options.slidesToShow/2+1)+r.currentSlide):(s=r.options.infinite?r.options.slidesToShow+r.currentSlide:r.currentSlide,n=Math.ceil(s+r.options.slidesToShow),r.options.fade===!0&&(s>0&&s--,n<=r.slideCount&&n++)),t=r.$slider.find(".slick-slide").slice(s,n),"anticipated"===r.options.lazyLoad)for(var l=s-1,d=n,a=r.$slider.find(".slick-slide"),c=0;c<r.options.slidesToScroll;c++)l<0&&(l=r.slideCount-1),t=t.add(a.eq(l)),t=t.add(a.eq(d)),l--,d++;e(t),r.slideCount<=r.options.slidesToShow?(o=r.$slider.find(".slick-slide"),e(o)):r.currentSlide>=r.slideCount-r.options.slidesToShow?(o=r.$slider.find(".slick-cloned").slice(0,r.options.slidesToShow),e(o)):0===r.currentSlide&&(o=r.$slider.find(".slick-cloned").slice(r.options.slidesToShow*-1),e(o))},e.prototype.loadSlider=function(){var i=this;i.setPosition(),i.$slideTrack.css({opacity:1}),i.$slider.removeClass("slick-loading"),i.initUI(),"progressive"===i.options.lazyLoad&&i.progressiveLazyLoad()},e.prototype.next=e.prototype.slickNext=function(){var i=this;i.changeSlide({data:{message:"next"}})},e.prototype.orientationChange=function(){var i=this;i.checkResponsive(),i.setPosition()},e.prototype.pause=e.prototype.slickPause=function(){var i=this;i.autoPlayClear(),i.paused=!0},e.prototype.play=e.prototype.slickPlay=function(){var i=this;i.autoPlay(),i.options.autoplay=!0,i.paused=!1,i.focussed=!1,i.interrupted=!1},e.prototype.postSlide=function(e){var t=this;if(!t.unslicked&&(t.$slider.trigger("afterChange",[t,e]),t.animating=!1,t.slideCount>t.options.slidesToShow&&t.setPosition(),t.swipeLeft=null,t.options.autoplay&&t.autoPlay(),t.options.accessibility===!0&&(t.initADA(),t.options.focusOnChange))){var o=i(t.$slides.get(t.currentSlide));o.attr("tabindex",0).focus()}},e.prototype.prev=e.prototype.slickPrev=function(){var i=this;i.changeSlide({data:{message:"previous"}})},e.prototype.preventDefault=function(i){i.preventDefault()},e.prototype.progressiveLazyLoad=function(e){e=e||1;var t,o,s,n,r,l=this,d=i("img[data-lazy]",l.$slider);d.length?(t=d.first(),o=t.attr("data-lazy"),s=t.attr("data-srcset"),n=t.attr("data-sizes")||l.$slider.attr("data-sizes"),r=document.createElement("img"),r.onload=function(){s&&(t.attr("srcset",s),n&&t.attr("sizes",n)),t.attr("src",o).removeAttr("data-lazy data-srcset data-sizes").removeClass("slick-loading"),l.options.adaptiveHeight===!0&&l.setPosition(),l.$slider.trigger("lazyLoaded",[l,t,o]),l.progressiveLazyLoad()},r.onerror=function(){e<3?setTimeout(function(){l.progressiveLazyLoad(e+1)},500):(t.removeAttr("data-lazy").removeClass("slick-loading").addClass("slick-lazyload-error"),l.$slider.trigger("lazyLoadError",[l,t,o]),l.progressiveLazyLoad())},r.src=o):l.$slider.trigger("allImagesLoaded",[l])},e.prototype.refresh=function(e){var t,o,s=this;o=s.slideCount-s.options.slidesToShow,!s.options.infinite&&s.currentSlide>o&&(s.currentSlide=o),s.slideCount<=s.options.slidesToShow&&(s.currentSlide=0),t=s.currentSlide,s.destroy(!0),i.extend(s,s.initials,{currentSlide:t}),s.init(),e||s.changeSlide({data:{message:"index",index:t}},!1)},e.prototype.registerBreakpoints=function(){var e,t,o,s=this,n=s.options.responsive||null;if("array"===i.type(n)&&n.length){s.respondTo=s.options.respondTo||"window";for(e in n)if(o=s.breakpoints.length-1,n.hasOwnProperty(e)){for(t=n[e].breakpoint;o>=0;)s.breakpoints[o]&&s.breakpoints[o]===t&&s.breakpoints.splice(o,1),o--;s.breakpoints.push(t),s.breakpointSettings[t]=n[e].settings}s.breakpoints.sort(function(i,e){return s.options.mobileFirst?i-e:e-i})}},e.prototype.reinit=function(){var e=this;e.$slides=e.$slideTrack.children(e.options.slide).addClass("slick-slide"),e.slideCount=e.$slides.length,e.currentSlide>=e.slideCount&&0!==e.currentSlide&&(e.currentSlide=e.currentSlide-e.options.slidesToScroll),e.slideCount<=e.options.slidesToShow&&(e.currentSlide=0),e.registerBreakpoints(),e.setProps(),e.setupInfinite(),e.buildArrows(),e.updateArrows(),e.initArrowEvents(),e.buildDots(),e.updateDots(),e.initDotEvents(),e.cleanUpSlideEvents(),e.initSlideEvents(),e.checkResponsive(!1,!0),e.options.focusOnSelect===!0&&i(e.$slideTrack).children().on("click.slick",e.selectHandler),e.setSlideClasses("number"==typeof e.currentSlide?e.currentSlide:0),e.setPosition(),e.focusHandler(),e.paused=!e.options.autoplay,e.autoPlay(),e.$slider.trigger("reInit",[e])},e.prototype.resize=function(){var e=this;i(window).width()!==e.windowWidth&&(clearTimeout(e.windowDelay),e.windowDelay=window.setTimeout(function(){e.windowWidth=i(window).width(),e.checkResponsive(),e.unslicked||e.setPosition()},50))},e.prototype.removeSlide=e.prototype.slickRemove=function(i,e,t){var o=this;return"boolean"==typeof i?(e=i,i=e===!0?0:o.slideCount-1):i=e===!0?--i:i,!(o.slideCount<1||i<0||i>o.slideCount-1)&&(o.unload(),t===!0?o.$slideTrack.children().remove():o.$slideTrack.children(this.options.slide).eq(i).remove(),o.$slides=o.$slideTrack.children(this.options.slide),o.$slideTrack.children(this.options.slide).detach(),o.$slideTrack.append(o.$slides),o.$slidesCache=o.$slides,void o.reinit())},e.prototype.setCSS=function(i){var e,t,o=this,s={};o.options.rtl===!0&&(i=-i),e="left"==o.positionProp?Math.ceil(i)+"px":"0px",t="top"==o.positionProp?Math.ceil(i)+"px":"0px",s[o.positionProp]=i,o.transformsEnabled===!1?o.$slideTrack.css(s):(s={},o.cssTransitions===!1?(s[o.animType]="translate("+e+", "+t+")",o.$slideTrack.css(s)):(s[o.animType]="translate3d("+e+", "+t+", 0px)",o.$slideTrack.css(s)))},e.prototype.setDimensions=function(){var i=this;i.options.vertical===!1?i.options.centerMode===!0&&i.$list.css({padding:"0px "+i.options.centerPadding}):(i.$list.height(i.$slides.first().outerHeight(!0)*i.options.slidesToShow),i.options.centerMode===!0&&i.$list.css({padding:i.options.centerPadding+" 0px"})),i.listWidth=i.$list.width(),i.listHeight=i.$list.height(),i.options.vertical===!1&&i.options.variableWidth===!1?(i.slideWidth=Math.ceil(i.listWidth/i.options.slidesToShow),i.$slideTrack.width(Math.ceil(i.slideWidth*i.$slideTrack.children(".slick-slide").length))):i.options.variableWidth===!0?i.$slideTrack.width(5e3*i.slideCount):(i.slideWidth=Math.ceil(i.listWidth),i.$slideTrack.height(Math.ceil(i.$slides.first().outerHeight(!0)*i.$slideTrack.children(".slick-slide").length)));var e=i.$slides.first().outerWidth(!0)-i.$slides.first().width();i.options.variableWidth===!1&&i.$slideTrack.children(".slick-slide").width(i.slideWidth-e)},e.prototype.setFade=function(){var e,t=this;t.$slides.each(function(o,s){e=t.slideWidth*o*-1,t.options.rtl===!0?i(s).css({position:"relative",right:e,top:0,zIndex:t.options.zIndex-2,opacity:0}):i(s).css({position:"relative",left:e,top:0,zIndex:t.options.zIndex-2,opacity:0})}),t.$slides.eq(t.currentSlide).css({zIndex:t.options.zIndex-1,opacity:1})},e.prototype.setHeight=function(){var i=this;if(1===i.options.slidesToShow&&i.options.adaptiveHeight===!0&&i.options.vertical===!1){var e=i.$slides.eq(i.currentSlide).outerHeight(!0);i.$list.css("height",e)}},e.prototype.setOption=e.prototype.slickSetOption=function(){var e,t,o,s,n,r=this,l=!1;if("object"===i.type(arguments[0])?(o=arguments[0],l=arguments[1],n="multiple"):"string"===i.type(arguments[0])&&(o=arguments[0],s=arguments[1],l=arguments[2],"responsive"===arguments[0]&&"array"===i.type(arguments[1])?n="responsive":"undefined"!=typeof arguments[1]&&(n="single")),"single"===n)r.options[o]=s;else if("multiple"===n)i.each(o,function(i,e){r.options[i]=e});else if("responsive"===n)for(t in s)if("array"!==i.type(r.options.responsive))r.options.responsive=[s[t]];else{for(e=r.options.responsive.length-1;e>=0;)r.options.responsive[e].breakpoint===s[t].breakpoint&&r.options.responsive.splice(e,1),e--;r.options.responsive.push(s[t])}l&&(r.unload(),r.reinit())},e.prototype.setPosition=function(){var i=this;i.setDimensions(),i.setHeight(),i.options.fade===!1?i.setCSS(i.getLeft(i.currentSlide)):i.setFade(),i.$slider.trigger("setPosition",[i])},e.prototype.setProps=function(){var i=this,e=document.body.style;i.positionProp=i.options.vertical===!0?"top":"left",
13138�
vendor: 11,466 bytes, lines 13138-13139
13138
13139"top"===i.positionProp?i.$slider.addClass("slick-vertical"):i.$slider.removeClass("slick-vertical"),void 0===e.WebkitTransition&&void 0===e.MozTransition&&void 0===e.msTransition||i.options.useCSS===!0&&(i.cssTransitions=!0),i.options.fade&&("number"==typeof i.options.zIndex?i.options.zIndex<3&&(i.options.zIndex=3):i.options.zIndex=i.defaults.zIndex),void 0!==e.OTransform&&(i.animType="OTransform",i.transformType="-o-transform",i.transitionType="OTransition",void 0===e.perspectiveProperty&&void 0===e.webkitPerspective&&(i.animType=!1)),void 0!==e.MozTransform&&(i.animType="MozTransform",i.transformType="-moz-transform",i.transitionType="MozTransition",void 0===e.perspectiveProperty&&void 0===e.MozPerspective&&(i.animType=!1)),void 0!==e.webkitTransform&&(i.animType="webkitTransform",i.transformType="-webkit-transform",i.transitionType="webkitTransition",void 0===e.perspectiveProperty&&void 0===e.webkitPerspective&&(i.animType=!1)),void 0!==e.msTransform&&(i.animType="msTransform",i.transformType="-ms-transform",i.transitionType="msTransition",void 0===e.msTransform&&(i.animType=!1)),void 0!==e.transform&&i.animType!==!1&&(i.animType="transform",i.transformType="transform",i.transitionType="transition"),i.transformsEnabled=i.options.useTransform&&null!==i.animType&&i.animType!==!1},e.prototype.setSlideClasses=function(i){var e,t,o,s,n=this;if(t=n.$slider.find(".slick-slide").removeClass("slick-active slick-center slick-current").attr("aria-hidden","true"),n.$slides.eq(i).addClass("slick-current"),n.options.centerMode===!0){var r=n.options.slidesToShow%2===0?1:0;e=Math.floor(n.options.slidesToShow/2),n.options.infinite===!0&&(i>=e&&i<=n.slideCount-1-e?n.$slides.slice(i-e+r,i+e+1).addClass("slick-active").attr("aria-hidden","false"):(o=n.options.slidesToShow+i,t.slice(o-e+1+r,o+e+2).addClass("slick-active").attr("aria-hidden","false")),0===i?t.eq(t.length-1-n.options.slidesToShow).addClass("slick-center"):i===n.slideCount-1&&t.eq(n.options.slidesToShow).addClass("slick-center")),n.$slides.eq(i).addClass("slick-center")}else i>=0&&i<=n.slideCount-n.options.slidesToShow?n.$slides.slice(i,i+n.options.slidesToShow).addClass("slick-active").attr("aria-hidden","false"):t.length<=n.options.slidesToShow?t.addClass("slick-active").attr("aria-hidden","false"):(s=n.slideCount%n.options.slidesToShow,o=n.options.infinite===!0?n.options.slidesToShow+i:i,n.options.slidesToShow==n.options.slidesToScroll&&n.slideCount-i<n.options.slidesToShow?t.slice(o-(n.options.slidesToShow-s),o+s).addClass("slick-active").attr("aria-hidden","false"):t.slice(o,o+n.options.slidesToShow).addClass("slick-active").attr("aria-hidden","false"));"ondemand"!==n.options.lazyLoad&&"anticipated"!==n.options.lazyLoad||n.lazyLoad()},e.prototype.setupInfinite=function(){var e,t,o,s=this;if(s.options.fade===!0&&(s.options.centerMode=!1),s.options.infinite===!0&&s.options.fade===!1&&(t=null,s.slideCount>s.options.slidesToShow)){for(o=s.options.centerMode===!0?s.options.slidesToShow+1:s.options.slidesToShow,e=s.slideCount;e>s.slideCount-o;e-=1)t=e-1,i(s.$slides[t]).clone(!0).attr("id","").attr("data-slick-index",t-s.slideCount).prependTo(s.$slideTrack).addClass("slick-cloned");for(e=0;e<o+s.slideCount;e+=1)t=e,i(s.$slides[t]).clone(!0).attr("id","").attr("data-slick-index",t+s.slideCount).appendTo(s.$slideTrack).addClass("slick-cloned");s.$slideTrack.find(".slick-cloned").find("[id]").each(function(){i(this).attr("id","")})}},e.prototype.interrupt=function(i){var e=this;i||e.autoPlay(),e.interrupted=i},e.prototype.selectHandler=function(e){var t=this,o=i(e.target).is(".slick-slide")?i(e.target):i(e.target).parents(".slick-slide"),s=parseInt(o.attr("data-slick-index"));return s||(s=0),t.slideCount<=t.options.slidesToShow?void t.slideHandler(s,!1,!0):void t.slideHandler(s)},e.prototype.slideHandler=function(i,e,t){var o,s,n,r,l,d=null,a=this;if(e=e||!1,!(a.animating===!0&&a.options.waitForAnimate===!0||a.options.fade===!0&&a.currentSlide===i))return e===!1&&a.asNavFor(i),o=i,d=a.getLeft(o),r=a.getLeft(a.currentSlide),a.currentLeft=null===a.swipeLeft?r:a.swipeLeft,a.options.infinite===!1&&a.options.centerMode===!1&&(i<0||i>a.getDotCount()*a.options.slidesToScroll)?void(a.options.fade===!1&&(o=a.currentSlide,t!==!0&&a.slideCount>a.options.slidesToShow?a.animateSlide(r,function(){a.postSlide(o)}):a.postSlide(o))):a.options.infinite===!1&&a.options.centerMode===!0&&(i<0||i>a.slideCount-a.options.slidesToScroll)?void(a.options.fade===!1&&(o=a.currentSlide,t!==!0&&a.slideCount>a.options.slidesToShow?a.animateSlide(r,function(){a.postSlide(o)}):a.postSlide(o))):(a.options.autoplay&&clearInterval(a.autoPlayTimer),s=o<0?a.slideCount%a.options.slidesToScroll!==0?a.slideCount-a.slideCount%a.options.slidesToScroll:a.slideCount+o:o>=a.slideCount?a.slideCount%a.options.slidesToScroll!==0?0:o-a.slideCount:o,a.animating=!0,a.$slider.trigger("beforeChange",[a,a.currentSlide,s]),n=a.currentSlide,a.currentSlide=s,a.setSlideClasses(a.currentSlide),a.options.asNavFor&&(l=a.getNavTarget(),l=l.slick("getSlick"),l.slideCount<=l.options.slidesToShow&&l.setSlideClasses(a.currentSlide)),a.updateDots(),a.updateArrows(),a.options.fade===!0?(t!==!0?(a.fadeSlideOut(n),a.fadeSlide(s,function(){a.postSlide(s)})):a.postSlide(s),void a.animateHeight()):void(t!==!0&&a.slideCount>a.options.slidesToShow?a.animateSlide(d,function(){a.postSlide(s)}):a.postSlide(s)))},e.prototype.startLoad=function(){var i=this;i.options.arrows===!0&&i.slideCount>i.options.slidesToShow&&(i.$prevArrow.hide(),i.$nextArrow.hide()),i.options.dots===!0&&i.slideCount>i.options.slidesToShow&&i.$dots.hide(),i.$slider.addClass("slick-loading")},e.prototype.swipeDirection=function(){var i,e,t,o,s=this;return i=s.touchObject.startX-s.touchObject.curX,e=s.touchObject.startY-s.touchObject.curY,t=Math.atan2(e,i),o=Math.round(180*t/Math.PI),o<0&&(o=360-Math.abs(o)),o<=45&&o>=0?s.options.rtl===!1?"left":"right":o<=360&&o>=315?s.options.rtl===!1?"left":"right":o>=135&&o<=225?s.options.rtl===!1?"right":"left":s.options.verticalSwiping===!0?o>=35&&o<=135?"down":"up":"vertical"},e.prototype.swipeEnd=function(i){var e,t,o=this;if(o.dragging=!1,o.swiping=!1,o.scrolling)return o.scrolling=!1,!1;if(o.interrupted=!1,o.shouldClick=!(o.touchObject.swipeLength>10),void 0===o.touchObject.curX)return!1;if(o.touchObject.edgeHit===!0&&o.$slider.trigger("edge",[o,o.swipeDirection()]),o.touchObject.swipeLength>=o.touchObject.minSwipe){switch(t=o.swipeDirection()){case"left":case"down":e=o.options.swipeToSlide?o.checkNavigable(o.currentSlide+o.getSlideCount()):o.currentSlide+o.getSlideCount(),o.currentDirection=0;break;case"right":case"up":e=o.options.swipeToSlide?o.checkNavigable(o.currentSlide-o.getSlideCount()):o.currentSlide-o.getSlideCount(),o.currentDirection=1}"vertical"!=t&&(o.slideHandler(e),o.touchObject={},o.$slider.trigger("swipe",[o,t]))}else o.touchObject.startX!==o.touchObject.curX&&(o.slideHandler(o.currentSlide),o.touchObject={})},e.prototype.swipeHandler=function(i){var e=this;if(!(e.options.swipe===!1||"ontouchend"in document&&e.options.swipe===!1||e.options.draggable===!1&&i.type.indexOf("mouse")!==-1))switch(e.touchObject.fingerCount=i.originalEvent&&void 0!==i.originalEvent.touches?i.originalEvent.touches.length:1,e.touchObject.minSwipe=e.listWidth/e.options.touchThreshold,e.options.verticalSwiping===!0&&(e.touchObject.minSwipe=e.listHeight/e.options.touchThreshold),i.data.action){case"start":e.swipeStart(i);break;case"move":e.swipeMove(i);break;case"end":e.swipeEnd(i)}},e.prototype.swipeMove=function(i){var e,t,o,s,n,r,l=this;return n=void 0!==i.originalEvent?i.originalEvent.touches:null,!(!l.dragging||l.scrolling||n&&1!==n.length)&&(e=l.getLeft(l.currentSlide),l.touchObject.curX=void 0!==n?n[0].pageX:i.clientX,l.touchObject.curY=void 0!==n?n[0].pageY:i.clientY,l.touchObject.swipeLength=Math.round(Math.sqrt(Math.pow(l.touchObject.curX-l.touchObject.startX,2))),r=Math.round(Math.sqrt(Math.pow(l.touchObject.curY-l.touchObject.startY,2))),!l.options.verticalSwiping&&!l.swiping&&r>4?(l.scrolling=!0,!1):(l.options.verticalSwiping===!0&&(l.touchObject.swipeLength=r),t=l.swipeDirection(),void 0!==i.originalEvent&&l.touchObject.swipeLength>4&&(l.swiping=!0,i.preventDefault()),s=(l.options.rtl===!1?1:-1)*(l.touchObject.curX>l.touchObject.startX?1:-1),l.options.verticalSwiping===!0&&(s=l.touchObject.curY>l.touchObject.startY?1:-1),o=l.touchObject.swipeLength,l.touchObject.edgeHit=!1,l.options.infinite===!1&&(0===l.currentSlide&&"right"===t||l.currentSlide>=l.getDotCount()&&"left"===t)&&(o=l.touchObject.swipeLength*l.options.edgeFriction,l.touchObject.edgeHit=!0),l.options.vertical===!1?l.swipeLeft=e+o*s:l.swipeLeft=e+o*(l.$list.height()/l.listWidth)*s,l.options.verticalSwiping===!0&&(l.swipeLeft=e+o*s),l.options.fade!==!0&&l.options.touchMove!==!1&&(l.animating===!0?(l.swipeLeft=null,!1):void l.setCSS(l.swipeLeft))))},e.prototype.swipeStart=function(i){var e,t=this;return t.interrupted=!0,1!==t.touchObject.fingerCount||t.slideCount<=t.options.slidesToShow?(t.touchObject={},!1):(void 0!==i.originalEvent&&void 0!==i.originalEvent.touches&&(e=i.originalEvent.touches[0]),t.touchObject.startX=t.touchObject.curX=void 0!==e?e.pageX:i.clientX,t.touchObject.startY=t.touchObject.curY=void 0!==e?e.pageY:i.clientY,void(t.dragging=!0))},e.prototype.unfilterSlides=e.prototype.slickUnfilter=function(){var i=this;null!==i.$slidesCache&&(i.unload(),i.$slideTrack.children(this.options.slide).detach(),i.$slidesCache.appendTo(i.$slideTrack),i.reinit())},e.prototype.unload=function(){var e=this;i(".slick-cloned",e.$slider).remove(),e.$dots&&e.$dots.remove(),e.$prevArrow&&e.htmlExpr.test(e.options.prevArrow)&&e.$prevArrow.remove(),e.$nextArrow&&e.htmlExpr.test(e.options.nextArrow)&&e.$nextArrow.remove(),e.$slides.removeClass("slick-slide slick-active slick-visible slick-current").attr("aria-hidden","true").css("width","")},e.prototype.unslick=function(i){var e=this;e.$slider.trigger("unslick",[e,i]),e.destroy()},e.prototype.updateArrows=function(){var i,e=this;i=Math.floor(e.options.slidesToShow/2),e.options.arrows===!0&&e.slideCount>e.options.slidesToShow&&!e.options.infinite&&(e.$prevArrow.removeClass("slick-disabled").attr("aria-disabled","false"),e.$nextArrow.removeClass("slick-disabled").attr("aria-disabled","false"),0===e.currentSlide?(e.$prevArrow.addClass("slick-disabled").attr("aria-disabled","true"),e.$nextArrow.removeClass("slick-disabled").attr("aria-disabled","false")):e.currentSlide>=e.slideCount-e.options.slidesToShow&&e.options.centerMode===!1?(e.$nextArrow.addClass("slick-disabled").attr("aria-disabled","true"),e.$prevArrow.removeClass("slick-disabled").attr("aria-disabled","false")):e.currentSlide>=e.slideCount-1&&e.options.centerMode===!0&&(e.$nextArrow.addClass("slick-disabled").attr("aria-disabled","true"),e.$prevArrow.removeClass("slick-disabled").attr("aria-disabled","false")))},e.prototype.updateDots=function(){var i=this;null!==i.$dots&&(i.$dots.find("li").removeClass("slick-active").end(),i.$dots.find("li").eq(Math.floor(i.currentSlide/i.options.slidesToScroll)).addClass("slick-active"))},e.prototype.visibility=function(){var i=this;i.options.autoplay&&(document[i.hidden]?i.interrupted=!0:i.interrupted=!1)},i.fn.slick=function(){var i,t,o=this,s=arguments[0],n=Array.prototype.slice.call(arguments,1),r=o.length;for(i=0;i<r;i++)if("object"==typeof s||"undefined"==typeof s?o[i].slick=new e(o[i],s):t=o[i].slick[s].apply(o[i].slick,n),"undefined"!=typeof t)return t;return o}});
13139
13140/* End Include slick.min */
13141
13142/* Include moment.min */
13143!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(
vendor: 18,994 bytes, line 13143
13143t):e.moment=t()}(this,function(){"use strict";var e,i;function c(){return e.apply(null,arguments)}function o(e){return e instanceof Array||"[object Array]"===Object.prototype.toString.call(e)}function u(e){return null!=e&&"[object Object]"===Object.prototype.toString.call(e)}function l(e){return void 0===e}function h(e){return"number"==typeof e||"[object Number]"===Object.prototype.toString.call(e)}function d(e){return e instanceof Date||"[object Date]"===Object.prototype.toString.call(e)}function f(e,t){var n,s=[];for(n=0;n<e.length;++n)s.push(t(e[n],n));return s}function m(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function _(e,t){for(var n in t)m(t,n)&&(e[n]=t[n]);return m(t,"toString")&&(e.toString=t.toString),m(t,"valueOf")&&(e.valueOf=t.valueOf),e}function y(e,t,n,s){return Tt(e,t,n,s,!0).utc()}function g(e){return null==e._pf&&(e._pf={empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1,parsedDateParts:[],meridiem:null,rfc2822:!1,weekdayMismatch:!1}),e._pf}function v(e){if(null==e._isValid){var t=g(e),n=i.call(t.parsedDateParts,function(e){return null!=e}),s=!isNaN(e._d.getTime())&&t.overflow<0&&!t.empty&&!t.invalidMonth&&!t.invalidWeekday&&!t.weekdayMismatch&&!t.nullInput&&!t.invalidFormat&&!t.userInvalidated&&(!t.meridiem||t.meridiem&&n);if(e._strict&&(s=s&&0===t.charsLeftOver&&0===t.unusedTokens.length&&void 0===t.bigHour),null!=Object.isFrozen&&Object.isFrozen(e))return s;e._isValid=s}return e._isValid}function p(e){var t=y(NaN);return null!=e?_(g(t),e):g(t).userInvalidated=!0,t}i=Array.prototype.some?Array.prototype.some:function(e){for(var t=Object(this),n=t.length>>>0,s=0;s<n;s++)if(s in t&&e.call(this,t[s],s,t))return!0;return!1};var r=c.momentProperties=[];function w(e,t){var n,s,i;if(l(t._isAMomentObject)||(e._isAMomentObject=t._isAMomentObject),l(t._i)||(e._i=t._i),l(t._f)||(e._f=t._f),l(t._l)||(e._l=t._l),l(t._strict)||(e._strict=t._strict),l(t._tzm)||(e._tzm=t._tzm),l(t._isUTC)||(e._isUTC=t._isUTC),l(t._offset)||(e._offset=t._offset),l(t._pf)||(e._pf=g(t)),l(t._locale)||(e._locale=t._locale),0<r.length)for(n=0;n<r.length;n++)l(i=t[s=r[n]])||(e[s]=i);return e}var t=!1;function M(e){w(this,e),this._d=new Date(null!=e._d?e._d.getTime():NaN),this.isValid()||(this._d=new Date(NaN)),!1===t&&(t=!0,c.updateOffset(this),t=!1)}function k(e){return e instanceof M||null!=e&&null!=e._isAMomentObject}function S(e){return e<0?Math.ceil(e)||0:Math.floor(e)}function D(e){var t=+e,n=0;return 0!==t&&isFinite(t)&&(n=S(t)),n}function a(e,t,n){var s,i=Math.min(e.length,t.length),r=Math.abs(e.length-t.length),a=0;for(s=0;s<i;s++)(n&&e[s]!==t[s]||!n&&D(e[s])!==D(t[s]))&&a++;return a+r}function Y(e){!1===c.suppressDeprecationWarnings&&"undefined"!=typeof console&&console.warn&&console.warn("Deprecation warning: "+e)}function n(i,r){var a=!0;return _(function(){if(null!=c.deprecationHandler&&c.deprecationHandler(null,i),a){for(var e,t=[],n=0;n<arguments.length;n++){if(e="","object"==typeof arguments[n]){for(var s in e+="\n["+n+"] ",arguments[0])e+=s+": "+arguments[0][s]+", ";e=e.slice(0,-2)}else e=arguments[n];t.push(e)}Y(i+"\nArguments: "+Array.prototype.slice.call(t).join("")+"\n"+(new Error).stack),a=!1}return r.apply(this,arguments)},r)}var s,O={};function T(e,t){null!=c.deprecationHandler&&c.deprecationHandler(e,t),O[e]||(Y(t),O[e]=!0)}function b(e){return e instanceof Function||"[object Function]"===Object.prototype.toString.call(e)}function x(e,t){var n,s=_({},e);for(n in t)m(t,n)&&(u(e[n])&&u(t[n])?(s[n]={},_(s[n],e[n]),_(s[n],t[n])):null!=t[n]?s[n]=t[n]:delete s[n]);for(n in e)m(e,n)&&!m(t,n)&&u(e[n])&&(s[n]=_({},s[n]));return s}function P(e){null!=e&&this.set(e)}c.suppressDeprecationWarnings=!1,c.deprecationHandler=null,s=Object.keys?Object.keys:function(e){var t,n=[];for(t in e)m(e,t)&&n.push(t);return n};var W={};function C(e,t){var n=e.toLowerCase();W[n]=W[n+"s"]=W[t]=e}function H(e){return"string"==typeof e?W[e]||W[e.toLowerCase()]:void 0}function R(e){var t,n,s={};for(n in e)m(e,n)&&(t=H(n))&&(s[t]=e[n]);return s}var U={};function F(e,t){U[e]=t}function L(e,t,n){var s=""+Math.abs(e),i=t-s.length;return(0<=e?n?"+":"":"-")+Math.pow(10,Math.max(0,i)).toString().substr(1)+s}var N=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,G=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,V={},E={};function I(e,t,n,s){var i=s;"string"==typeof s&&(i=function(){return this[s]()}),e&&(E[e]=i),t&&(E[t[0]]=function(){return L(i.apply(this,arguments),t[1],t[2])}),n&&(E[n]=function(){return this.localeData().ordinal(i.apply(this,arguments),e)})}function A(e,t){return e.isValid()?(t=j(t,e.localeData()),V[t]=V[t]||function(s){var e,i,t,r=s.match(N);for(e=0,i=r.length;e<i;e++)E[r[e]]?r[e]=E[r[e]]:r[e]=(t=r[e]).match(/\[[\s\S]/)?t.replace(/^\[|\]$/g,""):t.replace(/\\/g,"");return function(e){var t,n="";for(t=0;t<i;t++)n+=b(r[t])?r[t].call(e,s):r[t];return n}}(t),V[t](e)):e.localeData().invalidDate()}function j(e,t){var n=5;function s(e){return t.longDateFormat(e)||e}for(G.lastIndex=0;0<=n&&G.test(e);)e=e.replace(G,s),G.lastIndex=0,n-=1;return e}var Z=/\d/,z=/\d\d/,$=/\d{3}/,q=/\d{4}/,J=/[+-]?\d{6}/,B=/\d\d?/,Q=/\d\d\d\d?/,X=/\d\d\d\d\d\d?/,K=/\d{1,3}/,ee=/\d{1,4}/,te=/[+-]?\d{1,6}/,ne=/\d+/,se=/[+-]?\d+/,ie=/Z|[+-]\d\d:?\d\d/gi,re=/Z|[+-]\d\d(?::?\d\d)?/gi,ae=/[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i,oe={};function ue(e,n,s){oe[e]=b(n)?n:function(e,t){return e&&s?s:n}}function le(e,t){return m(oe,e)?oe[e](t._strict,t._locale):new RegExp(he(e.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(e,t,n,s,i){return t||n||s||i})))}function he(e){return e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}var de={};function ce(e,n){var t,s=n;for("string"==typeof e&&(e=[e]),h(n)&&(s=function(e,t){t[n]=D(e)}),t=0;t<e.length;t++)de[e[t]]=s}function fe(e,i){ce(e,function(e,t,n,s){n._w=n._w||{},i(e,n._w,n,s)})}var me=0,_e=1,ye=2,ge=3,ve=4,pe=5,we=6,Me=7,ke=8;function Se(e){return De(e)?366:365}function De(e){return e%4==0&&e%100!=0||e%400==0}I("Y",0,0,function(){var e=this.year();return e<=9999?""+e:"+"+e}),I(0,["YY",2],0,function(){return this.year()%100}),I(0,["YYYY",4],0,"year"),I(0,["YYYYY",5],0,"year"),I(0,["YYYYYY",6,!0],0,"year"),C("year","y"),F("year",1),ue("Y",se),ue("YY",B,z),ue("YYYY",ee,q),ue("YYYYY",te,J),ue("YYYYYY",te,J),ce(["YYYYY","YYYYYY"],me),ce("YYYY",function(e,t){t[me]=2===e.length?c.parseTwoDigitYear(e):D(e)}),ce("YY",function(e,t){t[me]=c.parseTwoDigitYear(e)}),ce("Y",function(e,t){t[me]=parseInt(e,10)}),c.parseTwoDigitYear=function(e){return D(e)+(68<D(e)?1900:2e3)};var Ye,Oe=Te("FullYear",!0);function Te(t,n){return function(e){return null!=e?(xe(this,t,e),c.updateOffset(this,n),this):be(this,t)}}function be(e,t){return e.isValid()?e._d["get"+(e._isUTC?"UTC":"")+t]():NaN}function xe(e,t,n){e.isValid()&&!isNaN(n)&&("FullYear"===t&&De(e.year())&&1===e.month()&&29===e.date()?e._d["set"+(e._isUTC?"UTC":"")+t](n,e.month(),Pe(n,e.month())):e._d["set"+(e._isUTC?"UTC":"")+t](n))}function Pe(e,t){if(isNaN(e)||isNaN(t))return NaN;var n,s=(t%(n=12)+n)%n;return e+=(t-s)/12,1===s?De(e)?29:28:31-s%7%2}Ye=Array.prototype.indexOf?Array.prototype.indexOf:function(e){var t;for(t=0;t<this.length;++t)if(this[t]===e)return t;return-1},I("M",["MM",2],"Mo",function(){return this.month()+1}),I("MMM",0,0,function(e){return this.localeData().monthsShort(this,e)}),I("MMMM",0,0,function(e){return this.localeData().months(this,e)}),C("month","M"),F("month",8),ue("M",B),ue("MM",B,z),ue("MMM",function(e,t){return t.monthsShortRegex(e)}),ue("MMMM",function(e,t){return t.monthsRegex(e)}),ce(["M","MM"],function(e,t){t[_e]=D(e)-1}),ce(["MMM","MMMM"],function(e,t,n,s){var i=n._locale.monthsParse(e,s,n._strict);null!=i?t[_e]=i:g(n).invalidMonth=e});var We=/D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/,Ce="January_February_March_April_May_June_July_August_September_October_November_December".split("_");var He="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_");function Re(e,t){var n;if(!e.isValid())return e;if("string"==typeof t)if(/^\d+$/.test(t))t=D(t);else if(!h(t=e.localeData().monthsParse(t)))return e;return n=Math.min(e.date(),Pe(e.year(),t)),e._d["set"+(e._isUTC?"UTC":"")+"Month"](t,n),e}function Ue(e){return null!=e?(Re(this,e),c.updateOffset(this,!0),this):be(this,"Month")}var Fe=ae;var Le=ae;function Ne(){function e(e,t){return t.length-e.length}var t,n,s=[],i=[],r=[];for(t=0;t<12;t++)n=y([2e3,t]),s.push(this.monthsShort(n,"")),i.push(this.months(n,"")),r.push(this.months(n,"")),r.push(this.monthsShort(n,""));for(s.sort(e),i.sort(e),r.sort(e),t=0;t<12;t++)s[t]=he(s[t]),i[t]=he(i[t]);for(t=0;t<24;t++)r[t]=he(r[t]);this._monthsRegex=new RegExp("^("+r.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=new RegExp("^("+i.join("|")+")","i"),this._monthsShortStrictRegex=new RegExp("^("+s.join("|")+")","i")}function Ge(e){var t;if(e<100&&0<=e){var n=Array.prototype.slice.call(arguments);n[0]=e+400,t=new Date(Date.UTC.apply(null,n)),isFinite(t.getUTCFullYear())&&t.setUTCFullYear(e)}else t=new Date(Date.UTC.apply(null,arguments));return t}function Ve(e,t,n){var s=7+t-n;return-((7+Ge(e,0,s).getUTCDay()-t)%7)+s-1}function Ee(e,t,n,s,i){var r,a,o=1+7*(t-1)+(7+n-s)%7+Ve(e,s,i);return a=o<=0?Se(r=e-1)+o:o>Se(e)?(r=e+1,o-Se(e)):(r=e,o),{year:r,dayOfYear:a}}function Ie(e,t,n){var s,i,r=Ve(e.year(),t,n),a=Math.floor((e.dayOfYear()-r-1)/7)+1;return a<1?s=a+Ae(i=e.year()-1,t,n):a>Ae(e.year(),t,n)?(s=a-Ae(e.year(),t,n),i=e.year()+1):(i=e.year(),s=a),{week:s,year:i}}function Ae(e,t,n){var s=Ve(e,t,n),i=Ve(e+1,t,n);return(Se(e)-s+i)/7}I("w",["ww",2],"wo","week"),I("W",["WW",2],"Wo","isoWeek"),C("week","w"),C("isoWeek","W"),F("week",5),F("isoWeek",5),ue("w",B),ue("ww",B,z),ue("W",B),ue("WW",B,z),fe(["w","ww","W","WW"],function(e,t,n,s){t[s.substr(0,1)]=D(e)});function je(e,t){return e.slice(t,7).concat(e.slice(0,t))}I("d",0,"do","day"),I("dd",0,0,function(e){return this.localeData().weekdaysMin(this,e)}),I("ddd",0,0,function(e){return this.localeData().weekdaysShort(this,e)}),I("dddd",0,0,function(e){return this.localeData().weekdays(this,e)}),I("e",0,0,"weekday"),I("E",0,0,"isoWeekday"),C("day","d"),C("weekday","e"),C("isoWeekday","E"),F("day",11),F("weekday",11),F("isoWeekday",11),ue("d",B),ue("e",B),ue("E",B),ue("dd",function(e,t){return t.weekdaysMinRegex(e)}),ue("ddd",function(e,t){return t.weekdaysShortRegex(e)}),ue("dddd",function(e,t){return t.weekdaysRegex(e)}),fe(["dd","ddd","dddd"],function(e,t,n,s){var i=n._locale.weekdaysParse(e,s,n._strict);null!=i?t.d=i:g(n).invalidWeekday=e}),fe(["d","e","E"],function(e,t,n,s){t[s]=D(e)});var Ze="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_");var ze="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_");var $e="Su_Mo_Tu_We_Th_Fr_Sa".split("_");var qe=ae;var Je=ae;var Be=ae;function Qe(){function e(e,t){return t.length-e.length}var t,n,s,i,r,a=[],o=[],u=[],l=[];for(t=0;t<7;t++)n=y([2e3,1]).day(t),s=this.weekdaysMin(n,""),i=this.weekdaysShort(n,""),r=this.weekdays(n,""),a.push(s),o.push(i),u.push(r),l.push(s),l.push(i),l.push(r);for(a.sort(e),o.sort(e),u.sort(e),l.sort(e),t=0;t<7;t++)o[t]=he(o[t]),u[t]=he(u[t]),l[t]=he(l[t]);this._weekdaysRegex=new RegExp("^("+l.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+u.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+o.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+a.join("|")+")","i")}function Xe(){return this.hours()%12||12}function Ke(e,t){I(e,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),t)})}function et(e,t){return t._meridiemParse}I("H",["HH",2],0,"hour"),I("h",["hh",2],0,Xe),I("k",["kk",2],0,function(){return this.hours()||24}),I("hmm",0,0,function(){return""+Xe.apply(this)+L(this.minutes(),2)}),I("hmmss",0,0,function(){return""+Xe.apply(this)+L(this.minutes(),2)+L(this.seconds(),2)}),I("Hmm",0,0,function(){return""+this.hours()+L(this.minutes(),2)}),I("Hmmss",0,0,function(){return""+this.hours()+L(this.minutes(),2)+L(this.seconds(),2)}),Ke("a",!0),Ke("A",!1),C("hour","h"),F("hour",13),ue("a",et),ue("A",et),ue("H",B),ue("h",B),ue("k",B),ue("HH",B,z),ue("hh",B,z),ue("kk",B,z),ue("hmm",Q),ue("hmmss",X),ue("Hmm",Q),ue("Hmmss",X),ce(["H","HH"],ge),ce(["k","kk"],function(e,t,n){var s=D(e);t[ge]=24===s?0:s}),ce(["a","A"],function(e,t,n){n._isPm=n._locale.isPM(e),n._meridiem=e}),ce(["h","hh"],function(e,t,n){t[ge]=D(e),g(n).bigHour=!0}),ce("hmm",function(e,t,n){var s=e.length-2;t[ge]=D(e.substr(0,s)),t[ve]=D(e.substr(s)),g(n).bigHour=!0}),ce("hmmss",function(e,t,n){var s=e.length-4,i=e.length-2;t[ge]=D(e.substr(0,s)),t[ve]=D(e.substr(s,2)),t[pe]=D(e.substr(i)),g(n).bigHour=!0}),ce("Hmm",function(e,t,n){var s=e.length-2;t[ge]=D(e.substr(0,s)),t[ve]=D(e.substr(s))}),ce("Hmmss",function(e,t,n){var s=e.length-4,i=e.length-2;t[ge]=D(e.substr(0,s)),t[ve]=D(e.substr(s,2)),t[pe]=D(e.substr(i))});var tt,nt=Te("Hours",!0),st={calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},longDateFormat:{LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},invalidDate:"Invalid date",ordinal:"%d",dayOfMonthOrdinalParse:/\d{1,2}/,relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},months:Ce,monthsShort:He,week:{dow:0,doy:6},weekdays:Ze,weekdaysMin:$e,weekdaysShort:ze,meridiemParse:/[ap]\.?m?\.?/i},it={},rt={};function at(e){return e?e.toLowerCase().replace("_","-"):e}function ot(e){var t=null;if(!it[e]&&"undefined"!=typeof module&&module&&module.exports)try{t=tt._abbr,require("./locale/"+e),ut(t)}catch(e){}return it[e]}function ut(e,t){var n;return e&&((n=l(t)?ht(e):lt(e,t))?tt=n:"undefined"!=typeof console&&console.warn&&console.warn("Locale "+e+" not found. Did you forget to load it?")),tt._abbr}function lt(e,t){if(null===t)return delete it[e],null;var n,s=st;if(t.abbr=e,null!=it[e])T("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),s=it[e]._config;else if(null!=t.parentLocale)if(null!=it[t.parentLocale])s=it[t.parentLocale]._config;else{if(null==(n=ot(t.parentLocale)))return rt[t.parentLocale]||(rt[t.parentLocale]=[]),rt[t.parentLocale].push({name:e,config:t}),null;s=n._config}return it[e]=new P(x(s,t)),rt[e]&&rt[e].forEach(function(e){lt(e.name,e.config)}),ut(e),it[e]}function ht(e){var t;if(e&&e._locale&&e._locale._abbr&&(e=e._locale._abbr),!e)return tt;if(!o(e)){if(t=ot(e))return t;e=[e]}return function(e){for(var t,n,s,i,r=0;r<e.length;){for(t=(i=at(e[r]).split("-")).length,n=(n=at(e[r+1]))?n.split("-"):null;0<t;){if(s=ot(i.slice(0,t).join("-")))return s;if(n&&n.length>=t&&a(i,n,!0)>=t-1)break;t--}r++}return tt}(e)}function dt(e){var t,n=e._a;return n&&-2===g(e).overflow&&(t=n[_e]<0||11<n[_e]?_e:n[ye]<1||n[ye]>Pe(n[me],n[_e])?ye:n[ge]<0||24<n[ge]||24===n[ge]&&(0!==n[ve]||0!==n[pe]||0!==n[we])?ge:n[ve]<0||59<n[ve]?ve:n[pe]<0||59<n[pe]?pe:n[we]<0||999<n[we]?we:-1,g(e)._overflowDayOfYear&&(t<me||ye<t)&&(t=ye),g(e)._overflowWeeks&&-1===t&&(t=Me),g(e)._overflowWeekday&&-1===t&&(t=ke),g(e).overflow=t),e}function ct(e,t,n){return null!=e?e:null!=t?t:n}function ft(e){var t,n,s,i,r,a=[];if(!e._d){var o,u;for(o=e,u=new Date(c.now()),s=o._useUTC?[u.getUTCFullYear(),u.getUTCMonth(),u.getUTCDate()]:[u.getFullYear(),u.getMonth(),u.getDate()],e._w&&null==e._a[ye]&&null==e._a[_e]&&function(e){var t,n,s,i,r,a,o,u;if(null!=(t=e._w).GG||null!=t.W||null!=t.E)r=1,a=4,n=ct(t.GG,e._a[me],Ie(bt(),1,4).year),s=ct(t.W,1),((i=ct(t.E,1))<1||7<i)&&(u=!0);else{r=e._locale._week.dow,a=e._locale._week.doy;var l=Ie(bt(),r,a);n=ct(t.gg,e._a[me],l.year),s=ct(t.w,l.week),null!=t.d?((i=t.d)<0||6<i)&&(u=!0):null!=t.e?(i=t.e+r,(t.e<0||6<t.e)&&(u=!0)):i=r}s<1||s>Ae(n,r,a)?g(e)._overflowWeeks=!0:null!=u?g(e)._overflowWeekday=!0:(o=Ee(n,s,i,r,a),e._a[me]=o.year,e._dayOfYear=o.dayOfYear)}(e),null!=e._dayOfYear&&(r=ct(e._a[me],s[me]),(e._dayOfYear>Se(r)||0===e._dayOfYear)&&(g(e)._overflowDayOfYear=!0),n=Ge(r,0,e._dayOfYear),e._a[_e]=n.getUTCMonth(),e._a[ye]=n.getUTCDate()),t=0;t<3&&null==e._a[t];++t)e._a[t]=a[t]=s[t];for(;t<7;t++)e._a[t]=a[t]=null==e._a[t]?2===t?1:0:e._a[t];24===e._a[ge]&&0===e._a[ve]&&0===e._a[pe]&&0===e._a[we]&&(e._nextDay=!0,e._a[ge]=0),e._d=(e._useUTC?Ge:function(e,t,n,s,i,r,a){var o;return e<100&&0<=e?(o=new Date(e+400,t,n,s,i,r,a),isFinite(o.getFullYear())&&o.setFullYear(e)):o=new Date(e,t,n,s,i,r,a),o}).apply(null,a),i=e._useUTC?e._d.getUTCDay():e._d.getDay(),null!=e._tzm&&e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),e._nextDay&&(e._a[ge]=24),e._w&&void 0!==e._w.d&&e._w.d!==i&&(g(e).weekdayMismatch=!0)}}var mt=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,_t=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,yt=/Z|[+-]\d\d(?::?\d\d)?/,gt=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/]],vt=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],pt=/^\/?Date\((\-?\d+)/i;function wt(e){var t,n,s,i,r,a,o=e._i,u=mt.exec(o)||_t.exec(o);if(u){for(g(e).iso=!0,t=0,n=gt.length;t<n;t++)if(gt[t][1].exec(u[1])){i=gt[t][0],s=!1!==gt[t][2];break}if(null==i)return void(e._isValid=!1);if(u[3]){for(t=0,n=vt.length;t<n;t++)if(vt[t][1].exec(u[3])){r=(u[2]||" ")+vt[t][0];break}if(null==r)return void(e._isValid=!1)}if(!s&&null!=r)return void(e._isValid=!1);if(u[4]){if(!yt.exec(u[4]))return void(e._isValid=!1);a="Z"}e._f=i+(r||"")+(a||""),Yt(e)}else e._isValid=!1}var Mt=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/;function kt(e,t,n,s,i,r){var a=[function(e){var t=parseInt(e,10);
vendor: 34,198 bytes, line 13143
13143{if(t<=49)return 2e3+t;if(t<=999)return 1900+t}return t}(e),He.indexOf(t),parseInt(n,10),parseInt(s,10),parseInt(i,10)];return r&&a.push(parseInt(r,10)),a}var St={UT:0,GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function Dt(e){var t,n,s,i=Mt.exec(e._i.replace(/\([^)]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").replace(/^\s\s*/,"").replace(/\s\s*$/,""));if(i){var r=kt(i[4],i[3],i[2],i[5],i[6],i[7]);if(t=i[1],n=r,s=e,t&&ze.indexOf(t)!==new Date(n[0],n[1],n[2]).getDay()&&(g(s).weekdayMismatch=!0,!(s._isValid=!1)))return;e._a=r,e._tzm=function(e,t,n){if(e)return St[e];if(t)return 0;var s=parseInt(n,10),i=s%100;return(s-i)/100*60+i}(i[8],i[9],i[10]),e._d=Ge.apply(null,e._a),e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),g(e).rfc2822=!0}else e._isValid=!1}function Yt(e){if(e._f!==c.ISO_8601)if(e._f!==c.RFC_2822){e._a=[],g(e).empty=!0;var t,n,s,i,r,a,o,u,l=""+e._i,h=l.length,d=0;for(s=j(e._f,e._locale).match(N)||[],t=0;t<s.length;t++)i=s[t],(n=(l.match(le(i,e))||[])[0])&&(0<(r=l.substr(0,l.indexOf(n))).length&&g(e).unusedInput.push(r),l=l.slice(l.indexOf(n)+n.length),d+=n.length),E[i]?(n?g(e).empty=!1:g(e).unusedTokens.push(i),a=i,u=e,null!=(o=n)&&m(de,a)&&de[a](o,u._a,u,a)):e._strict&&!n&&g(e).unusedTokens.push(i);g(e).charsLeftOver=h-d,0<l.length&&g(e).unusedInput.push(l),e._a[ge]<=12&&!0===g(e).bigHour&&0<e._a[ge]&&(g(e).bigHour=void 0),g(e).parsedDateParts=e._a.slice(0),g(e).meridiem=e._meridiem,e._a[ge]=function(e,t,n){var s;if(null==n)return t;return null!=e.meridiemHour?e.meridiemHour(t,n):(null!=e.isPM&&((s=e.isPM(n))&&t<12&&(t+=12),s||12!==t||(t=0)),t)}(e._locale,e._a[ge],e._meridiem),ft(e),dt(e)}else Dt(e);else wt(e)}function Ot(e){var t,n,s,i,r=e._i,a=e._f;return e._locale=e._locale||ht(e._l),null===r||void 0===a&&""===r?p({nullInput:!0}):("string"==typeof r&&(e._i=r=e._locale.preparse(r)),k(r)?new M(dt(r)):(d(r)?e._d=r:o(a)?function(e){var t,n,s,i,r;if(0===e._f.length)return g(e).invalidFormat=!0,e._d=new Date(NaN);for(i=0;i<e._f.length;i++)r=0,t=w({},e),null!=e._useUTC&&(t._useUTC=e._useUTC),t._f=e._f[i],Yt(t),v(t)&&(r+=g(t).charsLeftOver,r+=10*g(t).unusedTokens.length,g(t).score=r,(null==s||r<s)&&(s=r,n=t));_(e,n||t)}(e):a?Yt(e):l(n=(t=e)._i)?t._d=new Date(c.now()):d(n)?t._d=new Date(n.valueOf()):"string"==typeof n?(s=t,null===(i=pt.exec(s._i))?(wt(s),!1===s._isValid&&(delete s._isValid,Dt(s),!1===s._isValid&&(delete s._isValid,c.createFromInputFallback(s)))):s._d=new Date(+i[1])):o(n)?(t._a=f(n.slice(0),function(e){return parseInt(e,10)}),ft(t)):u(n)?function(e){if(!e._d){var t=R(e._i);e._a=f([t.year,t.month,t.day||t.date,t.hour,t.minute,t.second,t.millisecond],function(e){return e&&parseInt(e,10)}),ft(e)}}(t):h(n)?t._d=new Date(n):c.createFromInputFallback(t),v(e)||(e._d=null),e))}function Tt(e,t,n,s,i){var r,a={};return!0!==n&&!1!==n||(s=n,n=void 0),(u(e)&&function(e){if(Object.getOwnPropertyNames)return 0===Object.getOwnPropertyNames(e).length;var t;for(t in e)if(e.hasOwnProperty(t))return!1;return!0}(e)||o(e)&&0===e.length)&&(e=void 0),a._isAMomentObject=!0,a._useUTC=a._isUTC=i,a._l=n,a._i=e,a._f=t,a._strict=s,(r=new M(dt(Ot(a))))._nextDay&&(r.add(1,"d"),r._nextDay=void 0),r}function bt(e,t,n,s){return Tt(e,t,n,s,!1)}c.createFromInputFallback=n("value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged and will be removed in an upcoming major release. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.",function(e){e._d=new Date(e._i+(e._useUTC?" UTC":""))}),c.ISO_8601=function(){},c.RFC_2822=function(){};var xt=n("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var e=bt.apply(null,arguments);return this.isValid()&&e.isValid()?e<this?this:e:p()}),Pt=n("moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var e=bt.apply(null,arguments);return this.isValid()&&e.isValid()?this<e?this:e:p()});function Wt(e,t){var n,s;if(1===t.length&&o(t[0])&&(t=t[0]),!t.length)return bt();for(n=t[0],s=1;s<t.length;++s)t[s].isValid()&&!t[s][e](n)||(n=t[s]);return n}var Ct=["year","quarter","month","week","day","hour","minute","second","millisecond"];function Ht(e){var t=R(e),n=t.year||0,s=t.quarter||0,i=t.month||0,r=t.week||t.isoWeek||0,a=t.day||0,o=t.hour||0,u=t.minute||0,l=t.second||0,h=t.millisecond||0;this._isValid=function(e){for(var t in e)if(-1===Ye.call(Ct,t)||null!=e[t]&&isNaN(e[t]))return!1;for(var n=!1,s=0;s<Ct.length;++s)if(e[Ct[s]]){if(n)return!1;parseFloat(e[Ct[s]])!==D(e[Ct[s]])&&(n=!0)}return!0}(t),this._milliseconds=+h+1e3*l+6e4*u+1e3*o*60*60,this._days=+a+7*r,this._months=+i+3*s+12*n,this._data={},this._locale=ht(),this._bubble()}function Rt(e){return e instanceof Ht}function Ut(e){return e<0?-1*Math.round(-1*e):Math.round(e)}function Ft(e,n){I(e,0,0,function(){var e=this.utcOffset(),t="+";return e<0&&(e=-e,t="-"),t+L(~~(e/60),2)+n+L(~~e%60,2)})}Ft("Z",":"),Ft("ZZ",""),ue("Z",re),ue("ZZ",re),ce(["Z","ZZ"],function(e,t,n){n._useUTC=!0,n._tzm=Nt(re,e)});var Lt=/([\+\-]|\d\d)/gi;function Nt(e,t){var n=(t||"").match(e);if(null===n)return null;var s=((n[n.length-1]||[])+"").match(Lt)||["-",0,0],i=60*s[1]+D(s[2]);return 0===i?0:"+"===s[0]?i:-i}function Gt(e,t){var n,s;return t._isUTC?(n=t.clone(),s=(k(e)||d(e)?e.valueOf():bt(e).valueOf())-n.valueOf(),n._d.setTime(n._d.valueOf()+s),c.updateOffset(n,!1),n):bt(e).local()}function Vt(e){return 15*-Math.round(e._d.getTimezoneOffset()/15)}function Et(){return!!this.isValid()&&(this._isUTC&&0===this._offset)}c.updateOffset=function(){};var It=/^(\-|\+)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)(\.\d*)?)?$/,At=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function jt(e,t){var n,s,i,r=e,a=null;return Rt(e)?r={ms:e._milliseconds,d:e._days,M:e._months}:h(e)?(r={},t?r[t]=e:r.milliseconds=e):(a=It.exec(e))?(n="-"===a[1]?-1:1,r={y:0,d:D(a[ye])*n,h:D(a[ge])*n,m:D(a[ve])*n,s:D(a[pe])*n,ms:D(Ut(1e3*a[we]))*n}):(a=At.exec(e))?(n="-"===a[1]?-1:1,r={y:Zt(a[2],n),M:Zt(a[3],n),w:Zt(a[4],n),d:Zt(a[5],n),h:Zt(a[6],n),m:Zt(a[7],n),s:Zt(a[8],n)}):null==r?r={}:"object"==typeof r&&("from"in r||"to"in r)&&(i=function(e,t){var n;if(!e.isValid()||!t.isValid())return{milliseconds:0,months:0};t=Gt(t,e),e.isBefore(t)?n=zt(e,t):((n=zt(t,e)).milliseconds=-n.milliseconds,n.months=-n.months);return n}(bt(r.from),bt(r.to)),(r={}).ms=i.milliseconds,r.M=i.months),s=new Ht(r),Rt(e)&&m(e,"_locale")&&(s._locale=e._locale),s}function Zt(e,t){var n=e&&parseFloat(e.replace(",","."));return(isNaN(n)?0:n)*t}function zt(e,t){var n={};return n.months=t.month()-e.month()+12*(t.year()-e.year()),e.clone().add(n.months,"M").isAfter(t)&&--n.months,n.milliseconds=+t-+e.clone().add(n.months,"M"),n}function $t(s,i){return function(e,t){var n;return null===t||isNaN(+t)||(T(i,"moment()."+i+"(period, number) is deprecated. Please use moment()."+i+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),n=e,e=t,t=n),qt(this,jt(e="string"==typeof e?+e:e,t),s),this}}function qt(e,t,n,s){var i=t._milliseconds,r=Ut(t._days),a=Ut(t._months);e.isValid()&&(s=null==s||s,a&&Re(e,be(e,"Month")+a*n),r&&xe(e,"Date",be(e,"Date")+r*n),i&&e._d.setTime(e._d.valueOf()+i*n),s&&c.updateOffset(e,r||a))}jt.fn=Ht.prototype,jt.invalid=function(){return jt(NaN)};var Jt=$t(1,"add"),Bt=$t(-1,"subtract");function Qt(e,t){var n=12*(t.year()-e.year())+(t.month()-e.month()),s=e.clone().add(n,"months");return-(n+(t-s<0?(t-s)/(s-e.clone().add(n-1,"months")):(t-s)/(e.clone().add(n+1,"months")-s)))||0}function Xt(e){var t;return void 0===e?this._locale._abbr:(null!=(t=ht(e))&&(this._locale=t),this)}c.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",c.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";var Kt=n("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(e){return void 0===e?this.localeData():this.locale(e)});function en(){return this._locale}var tn=126227808e5;function nn(e,t){return(e%t+t)%t}function sn(e,t,n){return e<100&&0<=e?new Date(e+400,t,n)-tn:new Date(e,t,n).valueOf()}function rn(e,t,n){return e<100&&0<=e?Date.UTC(e+400,t,n)-tn:Date.UTC(e,t,n)}function an(e,t){I(0,[e,e.length],0,t)}function on(e,t,n,s,i){var r;return null==e?Ie(this,s,i).year:((r=Ae(e,s,i))<t&&(t=r),function(e,t,n,s,i){var r=Ee(e,t,n,s,i),a=Ge(r.year,0,r.dayOfYear);return this.year(a.getUTCFullYear()),this.month(a.getUTCMonth()),this.date(a.getUTCDate()),this}.call(this,e,t,n,s,i))}I(0,["gg",2],0,function(){return this.weekYear()%100}),I(0,["GG",2],0,function(){return this.isoWeekYear()%100}),an("gggg","weekYear"),an("ggggg","weekYear"),an("GGGG","isoWeekYear"),an("GGGGG","isoWeekYear"),C("weekYear","gg"),C("isoWeekYear","GG"),F("weekYear",1),F("isoWeekYear",1),ue("G",se),ue("g",se),ue("GG",B,z),ue("gg",B,z),ue("GGGG",ee,q),ue("gggg",ee,q),ue("GGGGG",te,J),ue("ggggg",te,J),fe(["gggg","ggggg","GGGG","GGGGG"],function(e,t,n,s){t[s.substr(0,2)]=D(e)}),fe(["gg","GG"],function(e,t,n,s){t[s]=c.parseTwoDigitYear(e)}),I("Q",0,"Qo","quarter"),C("quarter","Q"),F("quarter",7),ue("Q",Z),ce("Q",function(e,t){t[_e]=3*(D(e)-1)}),I("D",["DD",2],"Do","date"),C("date","D"),F("date",9),ue("D",B),ue("DD",B,z),ue("Do",function(e,t){return e?t._dayOfMonthOrdinalParse||t._ordinalParse:t._dayOfMonthOrdinalParseLenient}),ce(["D","DD"],ye),ce("Do",function(e,t){t[ye]=D(e.match(B)[0])});var un=Te("Date",!0);I("DDD",["DDDD",3],"DDDo","dayOfYear"),C("dayOfYear","DDD"),F("dayOfYear",4),ue("DDD",K),ue("DDDD",$),ce(["DDD","DDDD"],function(e,t,n){n._dayOfYear=D(e)}),I("m",["mm",2],0,"minute"),C("minute","m"),F("minute",14),ue("m",B),ue("mm",B,z),ce(["m","mm"],ve);var ln=Te("Minutes",!1);I("s",["ss",2],0,"second"),C("second","s"),F("second",15),ue("s",B),ue("ss",B,z),ce(["s","ss"],pe);var hn,dn=Te("Seconds",!1);for(I("S",0,0,function(){return~~(this.millisecond()/100)}),I(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),I(0,["SSS",3],0,"millisecond"),I(0,["SSSS",4],0,function(){return 10*this.millisecond()}),I(0,["SSSSS",5],0,function(){return 100*this.millisecond()}),I(0,["SSSSSS",6],0,function(){return 1e3*this.millisecond()}),I(0,["SSSSSSS",7],0,function(){return 1e4*this.millisecond()}),I(0,["SSSSSSSS",8],0,function(){return 1e5*this.millisecond()}),I(0,["SSSSSSSSS",9],0,function(){return 1e6*this.millisecond()}),C("millisecond","ms"),F("millisecond",16),ue("S",K,Z),ue("SS",K,z),ue("SSS",K,$),hn="SSSS";hn.length<=9;hn+="S")ue(hn,ne);function cn(e,t){t[we]=D(1e3*("0."+e))}for(hn="S";hn.length<=9;hn+="S")ce(hn,cn);var fn=Te("Milliseconds",!1);I("z",0,0,"zoneAbbr"),I("zz",0,0,"zoneName");var mn=M.prototype;function _n(e){return e}mn.add=Jt,mn.calendar=function(e,t){var n=e||bt(),s=Gt(n,this).startOf("day"),i=c.calendarFormat(this,s)||"sameElse",r=t&&(b(t[i])?t[i].call(this,n):t[i]);return this.format(r||this.localeData().calendar(i,this,bt(n)))},mn.clone=function(){return new M(this)},mn.diff=function(e,t,n){var s,i,r;if(!this.isValid())return NaN;if(!(s=Gt(e,this)).isValid())return NaN;switch(i=6e4*(s.utcOffset()-this.utcOffset()),t=H(t)){case"year":r=Qt(this,s)/12;break;case"month":r=Qt(this,s);break;case"quarter":r=Qt(this,s)/3;break;case"second":r=(this-s)/1e3;break;case"minute":r=(this-s)/6e4;break;case"hour":r=(this-s)/36e5;break;case"day":r=(this-s-i)/864e5;break;case"week":r=(this-s-i)/6048e5;break;default:r=this-s}return n?r:S(r)},mn.endOf=function(e){var t;if(void 0===(e=H(e))||"millisecond"===e||!this.isValid())return this;var n=this._isUTC?rn:sn;switch(e){case"year":t=n(this.year()+1,0,1)-1;break;case"quarter":t=n(this.year(),this.month()-this.month()%3+3,1)-1;break;case"month":t=n(this.year(),this.month()+1,1)-1;break;case"week":t=n(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case"isoWeek":t=n(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case"day":case"date":t=n(this.year(),this.month(),this.date()+1)-1;break;case"hour":t=this._d.valueOf(),t+=36e5-nn(t+(this._isUTC?0:6e4*this.utcOffset()),36e5)-1;break;case"minute":t=this._d.valueOf(),t+=6e4-nn(t,6e4)-1;break;case"second":t=this._d.valueOf(),t+=1e3-nn(t,1e3)-1;break}return this._d.setTime(t),c.updateOffset(this,!0),this},mn.format=function(e){e||(e=this.isUtc()?c.defaultFormatUtc:c.defaultFormat);var t=A(this,e);return this.localeData().postformat(t)},mn.from=function(e,t){return this.isValid()&&(k(e)&&e.isValid()||bt(e).isValid())?jt({to:this,from:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()},mn.fromNow=function(e){return this.from(bt(),e)},mn.to=function(e,t){return this.isValid()&&(k(e)&&e.isValid()||bt(e).isValid())?jt({from:this,to:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()},mn.toNow=function(e){return this.to(bt(),e)},mn.get=function(e){return b(this[e=H(e)])?this[e]():this},mn.invalidAt=function(){return g(this).overflow},mn.isAfter=function(e,t){var n=k(e)?e:bt(e);return!(!this.isValid()||!n.isValid())&&("millisecond"===(t=H(t)||"millisecond")?this.valueOf()>n.valueOf():n.valueOf()<this.clone().startOf(t).valueOf())},mn.isBefore=function(e,t){var n=k(e)?e:bt(e);return!(!this.isValid()||!n.isValid())&&("millisecond"===(t=H(t)||"millisecond")?this.valueOf()<n.valueOf():this.clone().endOf(t).valueOf()<n.valueOf())},mn.isBetween=function(e,t,n,s){var i=k(e)?e:bt(e),r=k(t)?t:bt(t);return!!(this.isValid()&&i.isValid()&&r.isValid())&&("("===(s=s||"()")[0]?this.isAfter(i,n):!this.isBefore(i,n))&&(")"===s[1]?this.isBefore(r,n):!this.isAfter(r,n))},mn.isSame=function(e,t){var n,s=k(e)?e:bt(e);return!(!this.isValid()||!s.isValid())&&("millisecond"===(t=H(t)||"millisecond")?this.valueOf()===s.valueOf():(n=s.valueOf(),this.clone().startOf(t).valueOf()<=n&&n<=this.clone().endOf(t).valueOf()))},mn.isSameOrAfter=function(e,t){return this.isSame(e,t)||this.isAfter(e,t)},mn.isSameOrBefore=function(e,t){return this.isSame(e,t)||this.isBefore(e,t)},mn.isValid=function(){return v(this)},mn.lang=Kt,mn.locale=Xt,mn.localeData=en,mn.max=Pt,mn.min=xt,mn.parsingFlags=function(){return _({},g(this))},mn.set=function(e,t){if("object"==typeof e)for(var n=function(e){var t=[];for(var n in e)t.push({unit:n,priority:U[n]});return t.sort(function(e,t){return e.priority-t.priority}),t}(e=R(e)),s=0;s<n.length;s++)this[n[s].unit](e[n[s].unit]);else if(b(this[e=H(e)]))return this[e](t);return this},mn.startOf=function(e){var t;if(void 0===(e=H(e))||"millisecond"===e||!this.isValid())return this;var n=this._isUTC?rn:sn;switch(e){case"year":t=n(this.year(),0,1);break;case"quarter":t=n(this.year(),this.month()-this.month()%3,1);break;case"month":t=n(this.year(),this.month(),1);break;case"week":t=n(this.year(),this.month(),this.date()-this.weekday());break;case"isoWeek":t=n(this.year(),this.month(),this.date()-(this.isoWeekday()-1));break;case"day":case"date":t=n(this.year(),this.month(),this.date());break;case"hour":t=this._d.valueOf(),t-=nn(t+(this._isUTC?0:6e4*this.utcOffset()),36e5);break;case"minute":t=this._d.valueOf(),t-=nn(t,6e4);break;case"second":t=this._d.valueOf(),t-=nn(t,1e3);break}return this._d.setTime(t),c.updateOffset(this,!0),this},mn.subtract=Bt,mn.toArray=function(){var e=this;return[e.year(),e.month(),e.date(),e.hour(),e.minute(),e.second(),e.millisecond()]},mn.toObject=function(){var e=this;return{years:e.year(),months:e.month(),date:e.date(),hours:e.hours(),minutes:e.minutes(),seconds:e.seconds(),milliseconds:e.milliseconds()}},mn.toDate=function(){return new Date(this.valueOf())},mn.toISOString=function(e){if(!this.isValid())return null;var t=!0!==e,n=t?this.clone().utc():this;return n.year()<0||9999<n.year()?A(n,t?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):b(Date.prototype.toISOString)?t?this.toDate().toISOString():new Date(this.valueOf()+60*this.utcOffset()*1e3).toISOString().replace("Z",A(n,"Z")):A(n,t?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")},mn.inspect=function(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var e="moment",t="";this.isLocal()||(e=0===this.utcOffset()?"moment.utc":"moment.parseZone",t="Z");var n="["+e+'("]',s=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",i=t+'[")]';return this.format(n+s+"-MM-DD[T]HH:mm:ss.SSS"+i)},mn.toJSON=function(){return this.isValid()?this.toISOString():null},mn.toString=function(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")},mn.unix=function(){return Math.floor(this.valueOf()/1e3)},mn.valueOf=function(){return this._d.valueOf()-6e4*(this._offset||0)},mn.creationData=function(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}},mn.year=Oe,mn.isLeapYear=function(){return De(this.year())},mn.weekYear=function(e){return on.call(this,e,this.week(),this.weekday(),this.localeData()._week.dow,this.localeData()._week.doy)},mn.isoWeekYear=function(e){return on.call(this,e,this.isoWeek(),this.isoWeekday(),1,4)},mn.quarter=mn.quarters=function(e){return null==e?Math.ceil((this.month()+1)/3):this.month(3*(e-1)+this.month()%3)},mn.month=Ue,mn.daysInMonth=function(){return Pe(this.year(),this.month())},mn.week=mn.weeks=function(e){var t=this.localeData().week(this);return null==e?t:this.add(7*(e-t),"d")},mn.isoWeek=mn.isoWeeks=function(e){var t=Ie(this,1,4).week;return null==e?t:this.add(7*(e-t),"d")},mn.weeksInYear=function(){var e=this.localeData()._week;return Ae(this.year(),e.dow,e.doy)},mn.isoWeeksInYear=function(){return Ae(this.year(),1,4)},mn.date=un,mn.day=mn.days=function(e){if(!this.isValid())return null!=e?this:NaN;var t,n,s=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=e?(t=e,n=this.localeData(),e="string"!=typeof t?t:isNaN(t)?"number"==typeof(t=n.weekdaysParse(t))?t:null:parseInt(t,10),this.add(e-s,"d")):s},mn.weekday=function(e){if(!this.isValid())return null!=e?this:NaN;var t=(this.day()+7-this.localeData()._week.dow)%7;return null==e?t:this.add(e-t,"d")},mn.isoWeekday=function(e){if(!this.isValid())return null!=e?this:NaN;if(null==e)return this.day()||7;var t,n,s=(t=e,n=this.localeData(),"string"==typeof t?n.weekdaysParse(t)%7||7:isNaN(t)?null:t);return this.day(this.day()%7?s:s-7)},mn.dayOfYear=function(e){var t=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return null==e?t:this.add(e-t,"d")},mn.hour=mn.hours=nt,mn.minute=mn.minutes=ln,mn.second=mn.seconds=dn,mn.millisecond=mn.milliseconds=fn,mn.utcOffset=function(e,t,n){var s,i=this._offset||0;if(!this.isValid())return null!=e?this:NaN;if(null==e)return this._isUTC?i:Vt(this);if("string"==typeof e){if(null===(e=Nt(re,e)))return this}else Math.abs(e)<16&&!n&&(e*=60);return!this._isUTC&&t&&(s=Vt(this)),this._offset=e,this._isUTC=!0,null!=s&&this.add(s,"m"),i!==e&&(!t||this._changeInProgress?qt(this,jt(e-i,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,c.updateOffset(this,!0),this._changeInProgress=null)),this},mn.utc=function(e){return this.utcOffset(0,e)},mn.local=function(e){return this._isUTC&&(this.utcOffset(0,e),this._isUTC=!1,e&&this.subtract(Vt(this),"m")),this},mn.parseZone=function(){if(null!=this._tzm)this.utcOffset(this._tzm,!1,!0);else if("string"==typeof this._i){var e=Nt(ie,this._i);null!=e?this.utcOffset(e):this.utcOffset(0,!0)}return this},mn.hasAlignedHourOffset=function(e){return!!this.isValid()&&(e=e?bt(e).utcOffset():0,(this.utcOffset()-e)%60==0)},mn.isDST=function(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()},mn.isLocal=function(){return!!this.isValid()&&!this._isUTC},mn.isUtcOffset=function(){return!!this.isValid()&&this._isUTC},mn.isUtc=Et,mn.isUTC=Et,mn.zoneAbbr=function(){return this._isUTC?"UTC":""},mn.zoneName=function(){return this._isUTC?"Coordinated Universal Time":""},mn.dates=n("dates accessor is deprecated. Use date instead.",un),mn.months=n("months accessor is deprecated. Use month instead",Ue),mn.years=n("years accessor is deprecated. Use year instead",Oe),mn.zone=n("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",function(e,t){return null!=e?("string"!=typeof e&&(e=-e),this.utcOffset(e,t),this):-this.utcOffset()}),mn.isDSTShifted=n("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",function(){if(!l(this._isDSTShifted))return this._isDSTShifted;var e={};if(w(e,this),(e=Ot(e))._a){var t=e._isUTC?y(e._a):bt(e._a);this._isDSTShifted=this.isValid()&&0<a(e._a,t.toArray())}else this._isDSTShifted=!1;return this._isDSTShifted});var yn=P.prototype;function gn(e,t,n,s){var i=ht(),r=y().set(s,t);return i[n](r,e)}function vn(e,t,n){if(h(e)&&(t=e,e=void 0),e=e||"",null!=t)return gn(e,t,n,"month");var s,i=[];for(s=0;s<12;s++)i[s]=gn(e,s,n,"month");return i}function pn(e,t,n,s){t=("boolean"==typeof e?h(t)&&(n=t,t=void 0):(t=e,e=!1,h(n=t)&&(n=t,t=void 0)),t||"");var i,r=ht(),a=e?r._week.dow:0;if(null!=n)return gn(t,(n+a)%7,s,"day");var o=[];for(i=0;i<7;i++)o[i]=gn(t,(i+a)%7,s,"day");return o}yn.calendar=function(e,t,n){var s=this._calendar[e]||this._calendar.sameElse;return b(s)?s.call(t,n):s},yn.longDateFormat=function(e){var t=this._longDateFormat[e],n=this._longDateFormat[e.toUpperCase()];return t||!n?t:(this._longDateFormat[e]=n.replace(/MMMM|MM|DD|dddd/g,function(e){return e.slice(1)}),this._longDateFormat[e])},yn.invalidDate=function(){return this._invalidDate},yn.ordinal=function(e){return this._ordinal.replace("%d",e)},yn.preparse=_n,yn.postformat=_n,yn.relativeTime=function(e,t,n,s){var i=this._relativeTime[n];return b(i)?i(e,t,n,s):i.replace(/%d/i,e)},yn.pastFuture=function(e,t){var n=this._relativeTime[0<e?"future":"past"];return b(n)?n(t):n.replace(/%s/i,t)},yn.set=function(e){var t,n;for(n in e)b(t=e[n])?this[n]=t:this["_"+n]=t;this._config=e,this._dayOfMonthOrdinalParseLenient=new RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+"|"+/\d{1,2}/.source)},yn.months=function(e,t){return e?o(this._months)?this._months[e.month()]:this._months[(this._months.isFormat||We).test(t)?"format":"standalone"][e.month()]:o(this._months)?this._months:this._months.standalone},yn.monthsShort=function(e,t){return e?o(this._monthsShort)?this._monthsShort[e.month()]:this._monthsShort[We.test(t)?"format":"standalone"][e.month()]:o(this._monthsShort)?this._monthsShort:this._monthsShort.standalone},yn.monthsParse=function(e,t,n){var s,i,r;if(this._monthsParseExact)return function(e,t,n){var s,i,r,a=e.toLocaleLowerCase();if(!this._monthsParse)for(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[],s=0;s<12;++s)r=y([2e3,s]),this._shortMonthsParse[s]=this.monthsShort(r,"").toLocaleLowerCase(),this._longMonthsParse[s]=this.months(r,"").toLocaleLowerCase();return n?"MMM"===t?-1!==(i=Ye.call(this._shortMonthsParse,a))?i:null:-1!==(i=Ye.call(this._longMonthsParse,a))?i:null:"MMM"===t?-1!==(i=Ye.call(this._shortMonthsParse,a))?i:-1!==(i=Ye.call(this._longMonthsParse,a))?i:null:-1!==(i=Ye.call(this._longMonthsParse,a))?i:-1!==(i=Ye.call(this._shortMonthsParse,a))?i:null}.call(this,e,t,n);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),s=0;s<12;s++){if(i=y([2e3,s]),n&&!this._longMonthsParse[s]&&(this._longMonthsParse[s]=new RegExp("^"+this.months(i,"").replace(".","")+"$","i"),this._shortMonthsParse[s]=new RegExp("^"+this.monthsShort(i,"").replace(".","")+"$","i")),n||this._monthsParse[s]||(r="^"+this.months(i,"")+"|^"+this.monthsShort(i,""),this._monthsParse[s]=new RegExp(r.replace(".",""),"i")),n&&"MMMM"===t&&this._longMonthsParse[s].test(e))return s;if(n&&"MMM"===t&&this._shortMonthsParse[s].test(e))return s;if(!n&&this._monthsParse[s].test(e))return s}},yn.monthsRegex=function(e){return this._monthsParseExact?(m(this,"_monthsRegex")||Ne.call(this),e?this._monthsStrictRegex:this._monthsRegex):(m(this,"_monthsRegex")||(this._monthsRegex=Le),this._monthsStrictRegex&&e?this._monthsStrictRegex:this._monthsRegex)},yn.monthsShortRegex=function(e){return this._monthsParseExact?(m(this,"_monthsRegex")||Ne.call(this),e?this._monthsShortStrictRegex:this._monthsShortRegex):(m(this,"_monthsShortRegex")||(this._monthsShortRegex=Fe),this._monthsShortStrictRegex&&e?this._monthsShortStrictRegex:this._monthsShortRegex)},yn.week=function(e){return Ie(e,this._week.dow,this._week.doy).week},yn.firstDayOfYear=function(){return this._week.doy},yn.firstDayOfWeek=function(){return this._week.dow},yn.weekdays=function(e,t){var n=o(this._weekdays)?this._weekdays:this._weekdays[e&&!0!==e&&this._weekdays.isFormat.test(t)?"format":"standalone"];return!0===e?je(n,this._week.dow):e?n[e.day()]:n},yn.weekdaysMin=function(e){return!0===e?je(this._weekdaysMin,this._week.dow):e?this._weekdaysMin[e.day()]:this._weekdaysMin},yn.weekdaysShort=function(e){return!0===e?je(this._weekdaysShort,this._week.dow):e?this._weekdaysShort[e.day()]:this._weekdaysShort},yn.weekdaysParse=function(e,t,n){var s,i,r;if(this._weekdaysParseExact)return function(e,t,n){var s,i,r,a=e.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],s=0;s<7;++s)r=y([2e3,1]).day(s),this._minWeekdaysParse[s]=this.weekdaysMin(r,"").toLocaleLowerCase(),this._shortWeekdaysParse[s]=this.weekdaysShort(r,"").toLocaleLowerCase(),this._weekdaysParse[s]=this.weekdays(r,"").toLocaleLowerCase();return n?"dddd"===t?-1!==(i=Ye.call(this._weekdaysParse,a))?i:null:"ddd"===t?-1!==(i=Ye.call(this._shortWeekdaysParse,a))?i:null:-1!==(i=Ye.call(this._minWeekdaysParse,a))?i:null:"dddd"===t?-1!==(i=Ye.call(this._weekdaysParse,a))?i:-1!==(i=Ye.call(this._shortWeekdaysParse,a))?i:-1!==(i=Ye.call(this._minWeekdaysParse,a))?i:null:"ddd"===t?-1!==(i=Ye.call(this._shortWeekdaysParse,a))?i:-1!==(i=Ye.call(this._weekdaysParse,a))?i:-1!==(i=Ye.call(this._minWeekdaysParse,a))?i:null:-1!==(i=Ye.call(this._minWeekdaysParse,a))?i:-1!==(i=Ye.call(this._weekdaysParse,a))?i:-1!==(i=Ye.call(this._shortWeekdaysParse,a))?i:null}.call(this,e,t,n);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),s=0;s<7;s++){if(i=y([2e3,1]).day(s),n&&!this._fullWeekdaysParse[s]&&(this._fullWeekdaysParse[s]=new RegExp("^"+this.weekdays(i,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[s]=new RegExp("^"+this.weekdaysShort(i,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[s]=new RegExp("^"+this.weekdaysMin(i,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[s]||(r="^"+this.weekdays(i,"")+"|^"+this.weekdaysShort(i,"")+"|^"+this.weekdaysMin(i,""),this._weekdaysParse[s]=new RegExp(r.replace(".",""),"i")),n&&"dddd"===t&&this._fullWeekdaysParse[s].test(e))return s;if(n&&"ddd"===t&&this._shortWeekdaysParse[s].test(e))return s;if(n&&"dd"===t&&this._minWeekdaysParse[s].test(e))return s;if(!n&&this._weekdaysParse[s].test(e))return s}},yn.weekdaysRegex=function(e){return this._weekdaysParseExact?(m(this,"_weekdaysRegex")||Qe.call(this),e?this._weekdaysStrictRegex:this._weekdaysRegex):(m(this,"_weekdaysRegex")||(this._weekdaysRegex=qe),this._weekdaysStrictRegex&&e?this._weekdaysStrictRegex:this._weekdaysRegex)},yn.weekdaysShortRegex=function(e){return this._weekdaysParseExact?(m(this,"_weekdaysRegex")||Qe.call(this),e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(m(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=Je),this._weekdaysShortStrictRegex&&e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)},yn.weekdaysMinRegex=function(e){return this._weekdaysParseExact?(m(this,"_weekdaysRegex")||Qe.call(this),e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(m(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=Be),this._weekdaysMinStrictRegex&&e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)},yn.isPM=function(e){return"p"===(e+"").toLowerCase().charAt(0)},yn.meridiem=function(e,t,n){return 11<e?n?"pm":"PM":n?"am":"AM"},ut("en",{dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(e){var t=e%10;return e+(1===D(e%100/10)?"th":1===t?"st":2===t?"nd":3===t?"rd":"th")}}),c.lang=n("moment.lang is deprecated. Use moment.locale instead.",ut),c.langData=n("moment.langData is deprecated. Use moment.localeData instead.",ht);var wn=Math.abs;function Mn(e,t,n,s){var i=jt(t,n);return e._milliseconds+=s*i._milliseconds,e._days+=s*i._days,e._months+=s*i._months,e._bubble()}function kn(e){return e<0?Math.floor(e):Math.ceil(e)}function Sn(e){return 4800*e/146097}function Dn(e){return 146097*e/4800}function Yn(e){return function(){return this.as(e)}}var On=Yn("ms"),Tn=Yn("s"),bn=Yn("m"),xn=Yn("h"),Pn=Yn("d"),Wn=Yn("w"),Cn=Yn("M"),Hn=Yn("Q"),Rn=Yn("y");function Un(e){return function(){return this.isValid()?this._data[e]:NaN}}var Fn=Un("milliseconds"),Ln=Un("seconds"),Nn=Un("minutes"),Gn=Un("hours"),Vn=Un("days"),En=Un("months"),In=Un("years");var An=Math.round,jn={ss:44,s:45,m:45,h:22,d:26,M:11};var Zn=Math.abs;function zn(e){return(0<e)-(e<0)||+e}function $n(){if(!this.isValid())return this.localeData().invalidDate();var e,t,n=Zn(this._milliseconds)/1e3,s=Zn(this._days),i=Zn(this._months);t=S((e=S(n/60))/60),n%=60,e%=60;var r=S(i/12),a=i%=12,o=s,u=t,l=e,h=n?n.toFixed(3).replace(/\.?0+$/,""):"",d=this.asSeconds();if(!d)return"P0D";var c=d<0?"-":"",f=zn(this._months)!==zn(d)?"-":"",m=zn(this._days)!==zn(d)?"-":"",_=zn(this._milliseconds)!==zn(d)?"-":"";return c+"P"+(r?f+r+"Y":"")+(a?f+a+"M":"")+(o?m+o+"D":"")+(u||l||h?"T":"")+(u?_+u+"H":"")+(l?_+l+"M":"")+(h?_+h+"S":"")}var qn=Ht.prototype;return qn.isValid=function(){return this._isValid},qn.abs=function(){var e=this._data;return this._milliseconds=wn(this._milliseconds),this._days=wn(this._days),this._months=wn(this._months),e.milliseconds=wn(e.milliseconds),e.seconds=wn(e.seconds),e.minutes=wn(e.minutes),e.hours=wn(e.hours),e.months=wn(e.months),e.years=wn(e.years),this},qn.add=function(e,t){return Mn(this,e,t,1)},qn.subtract=function(e,t){return Mn(this,e,t,-1)},qn.as=function(e){if(!this.isValid())return NaN;var t,n,s=this._milliseconds;if("month"===(e=H(e))||"quarter"===e||"year"===e)switch(t=this._days+s/864e5,n=this._months+Sn(t),e){case"month":return n;case"quarter":return n/3;case"year":return n/12}else switch(t=this._days+Math.round(Dn(this._months)),e){case"week":return t/7+s/6048e5;case"day":return t+s/864e5;case"hour":return 24*t+s/36e5;case"minute":return 1440*t+s/6e4;case"second":return 86400*t+s/1e3;case"millisecond":return Math.floor(864e5*t)+s;default:throw new Error("Unknown unit "+e)}},qn.asMilliseconds=On,qn.asSeconds=Tn,qn.asMinutes=bn,qn.asHours=xn,qn.asDays=Pn,qn.asWeeks=Wn,qn.asMonths=Cn,qn.asQuarters=Hn,qn.asYears=Rn,qn.valueOf=function(){return this.isValid()?this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*D(this._months/12):NaN},qn._bubble=function(){var e,t,n,s,i,r=this._milliseconds,a=this._days,o=this._months,u=this._data;return 0<=r&&0<=a&&0<=o||r<=0&&a<=0&&o<=0||(r+=864e5*kn(Dn(o)+a),o=a=0),u.milliseconds=r%1e3,e=S(r/1e3),u.seconds=e%60,t=S(e/60),u.minutes=t%60,n=S(t/60),u.hours=n%24,o+=i=S(Sn(a+=S(n/24))),a-=kn(Dn(i)),s=S(o/12),o%=12,u.days=a,u.months=o,u.years=s,this},qn.clone=function(){return jt(this)},qn.get=function(e){return e=H(e),this.isValid()?this[e+"s"]():NaN},qn.milliseconds=Fn,qn.seconds=Ln,qn.minutes=Nn,qn.hours=Gn,qn.days=Vn,qn.weeks=function(){return S(this.days()/7)},qn.months=En,qn.years=In,qn.humanize=function(e){if(!this.isValid())return this.localeData().invalidDate();var t,n,s,i,r,a,o,u,l,h,d,c=this.localeData(),f=(n=!e,s=c,i=jt(t=this).abs(),r=An(i.as("s")),a=An(i.as("m")),o=An(i.as("h")),u=An(i.as("d")),l=An(i.as("M")),h=An(i.as("y")),(d=r<=jn.ss&&["s",r]||r<jn.s&&["ss",r]||a<=1&&["m"]||a<jn.m&&["mm",a]||o<=1&&["h"]||o<jn.h&&["hh",o]||u<=1&&["d"]||u<jn.d&&["dd",u]||l<=1&&["M"]||l<jn.M&&["MM",l]||h<=1&&["y"]||["yy",h])[2]=n,d[3]=0<+t,d[4]=s,function(e,t,n,s,i){return i.relativeTime(t||1,!!n,e,s)}.apply(null,d));return e&&(f=c.pastFuture(+this,f)),c.postformat(f)},qn.toISOString=$n,qn.toString=$n,qn.toJSON=$n,qn.locale=Xt,qn.localeData=en,qn.toIsoString=n("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",$n),qn.lang=Kt,I("X",0,0,"unix"),I("x",0,0,"valueOf"),ue("x",se),ue("X",/[+-]?\d+(\.\d{1,3})?/),ce("X",function(e,t,n){n._d=new Date(1e3*parseFloat(e,10))}),ce("x",function(e,t,n){n._d=new Date(D(e))}),c.version="2.24.0",e=bt,c.fn=mn,c.min=function(){return Wt("isBefore",[].slice.call(arguments,0))},c.max=function(){return Wt("isAfter",[].slice.call(arguments,0))},c.now=function(){return Date.now?Date.now():+new Date},c.utc=y,c.unix=function(e){return bt(1e3*e)},c.months=function(e,t){return vn(e,t,"months")},c.isDate=d,c.locale=ut,c.invalid=p,c.duration=jt,c.isMoment=k,c.weekdays=function(e,t,n){return pn(e,t,n,"weekdays")},c.parseZone=function(){return bt.apply(null,arguments).parseZone()},c.localeData=ht,c.isDuration=Rt,c.monthsShort=function(e,t){return vn(e,t,"monthsShort")},c.weekdaysMin=function(e,t,n){return pn(e,t,n,"weekdaysMin")},c.defineLocale=lt,c.updateLocale=function(e,t){if(null!=t){var n,s,i=st;null!=(s=ot(e))&&(i=s._config),(n=new P(t=x(i,t))).parentLocale=it[e],it[e]=n,ut(e)}else null!=it[e]&&(null!=it[e].parentLocale?it[e]=it[e].parentLocale:null!=it[e]&&delete it[e]);return it[e]},c.locales=function(){return s(it)},c.weekdaysShort=function(e,t,n){return pn(e,t,n,"weekdaysShort")},c.normalizeUnits=H,c.relativeTimeRounding=function(e){return void 0===e?An:"function"==typeof e&&(An=e,!0)},c.relativeTimeThreshold=function(e,t){return void 0!==jn[e]&&(void 0===t?jn[e]:(jn[e]=t,"s"===e&&(jn.ss=t-1),!0))},c.calendarFormat=function(e,t){var n=e.diff(t,"days",!0);return n<-6?"sameElse":n<-1?"lastWeek":n<0?"lastDay":n<1?"sameDay":n<2?"nextDay":n<7?"nextWeek":"sameElse"},c.prototype=mn,c.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"GGGG-[W]WW",MONTH:"YYYY-MM"},c});
13143
13144/* End Include moment.min */
13145
13146/* Include validation */
13147/*
13148This file is for code related to validation within the questionnaire. General purpose validation code should go alongside other code related to the information it is validating.
13149 */
13150
13151var vals=new Object();
13152var focusVal=false;
13153var previousFocusPriority = 1;
13154
13155/**
13156 * Initialize validators
13157 * @param f
13158 * @param name
13159 * @param group
13160 * @param focus
13161 * @param id
13162 * @param cid
13163 */
13164function iV(f, name, group, focus, id, cid){
13165   if(name === undefined){
13166      name = getFuncName(f);
13167   }
13168   vals[name] = new Object();
13169   vals[name].Valid = f;
13170   vals[name].Group = group;
13171   vals[name].Focus = focus;
13172   vals[name].ID = id;
13173   vals[name].ControlID = cid;
13174   vals[name].IsValid = true;
13175   vals[name].enabled = true;
13176   vals[name].focusPriority = 1;
13177}
13178
13179var __oldAnswers=false;
13180
13181/**
13182 * Checks if all initialized validators evaluate to true
13183 * @param over
13184 * @param currentVisible
13185 * @param beforeGroup
13186 * @returns {boolean}
13187 */
13188function cV(over, currentVisible, beforeGroup) {
13189	if (typeof (skipNotaryPayment) != 'undefined' && skipNotaryPayment == true)
13190		return true;
13191
13192   if(over === undefined){
13193      over = true;
13194   }
13195   if(currentVisible === undefined){
13196      currentVisible = true;
13197   }
13198   var valid=true;
13199   focusVal=true;
13200   previousFocusPriority = Number.MAX_SAFE_INTEGER;
13201   var focusGroup = null;
13202   for(var key in vals){
13203      if((!currentVisible || qnh.ValidatorSeen(vals[key], beforeGroup)) && !vals[key].Valid()){
13204         if(vals[key].ID !== undefined){
13205            if(qnh.ValidatorVisible(vals[key])){
13206               validate(key);
13207               focusVal=false;
13208            }
13209            else if(focusGroup == null || focusGroup > vals[key].Group){
13210               focusGroup = vals[key].Group;
13211            }
13212         }
13213         valid=false;
13214      }
13215   }
13216
13217
13218	if (typeof (adyenPage) != 'undefined' && adyenPage &&  (getCountry() == 'AT' || getCountry() == 'DE')) {
13219		if (CheckAndDisplayTermscheckBoxError() && CheckSecurityCode() && CheckPaymentInfoValidation() && CheckInvalidEmail()) {
13220			valid = true;
13221		}
13222		else
13223			valid = false;
13224	}
13225
13226	if (typeof (adyenPage) != 'undefined'  && adyenPage && (getCountry() == 'US')) {
13227		if (typeof (otherPaymentmethods) != 'undefined' && otherPaymentmethods) {
13228			if (CheckInvalidEmail()) {
13229				valid = true;
13230			}
13231			else
13232				valid = false;
13233		}
13234		else if (typeof (otherPaymentmethods) === 'undefined' || !otherPaymentmethods) {
13235			if (CheckSecurityCode() && CheckPaymentInfoValidation() && CheckInvalidEmail()) {
13236				valid = true;
13237			}
13238			else
13239				valid = false;
13240		}
13241		else
13242			valid = false;
13243	}
13244
13245   if(focusGroup != null && focusVal){
13246      qnh.ValidateAfterNav = true;
13247      qnh.GotoGroup(focusGroup);
13248      return false;
13249   }
13250   focusVal=false;
13251   if(valid && __oldAnswers && over){
13252		/* Use the browser confirm here, as it would be too much work to refactor this. */
13253      valid = _browserConfirm('This will overwrite the answers stored for the old version.');
13254		if(valid) {
13255			__oldAnswers = false;
13256		}
13257   }
13258
13259   return valid;
13260}
13261function validate(name){
13262   var validator = vals[name];
13263   if(validator !== undefined && (!validator.hasOwnProperty("enabled") || validator.enabled != false)){
13264	   var val=true;
13265	   validator.IsValid = val;
13266	   if(typeof(validator.Valid) == "function") val = validator.Valid();
13267	   if(typeof(validator.ID) == "string") $("#" + validator.ID).toggle(!val);
13268	   if(typeof(qnh) != "undefined" && (qnh.NavigateGroupsClient || qnh.NavigateGroupsClientLandingPage)) qnh.AnimateSectionHeight();
13269	   if(typeof(validator.Focus) == "function" && (focusVal || validator.focusPriority < previousFocusPriority) && !val) { validator.Focus(); previousFocusPriority = validator.focusPriority;}
13270	   if(typeof(validator.ControlID) == "string"){ $("#" + validator.ControlID).toggleClass("errorInput", !val); }
13271   }
13272}
13273function isV(el){
13274   var p=gI(el);
13275   if(p == null){
13276      return false;
13277   }
13278   p = p.parentNode;
13279   do {
13280      var display=getStyle(p, 'display');
13281      if(display != null && display.toLowerCase()=='none') return false;
13282      p=p.parentNode;
13283   } while(p!=null && p.parentNode != null);
13284   return true;
13285}
13286
13287function updateValidDisplay(name){
13288    var validator = vals[name];
13289	if(typeof(validator.ID) == "string") $("#" + validator.ID).toggle(!validator.IsValid);
13290	if(typeof(validator.ControlID) == "string"){ $("#" + validator.ControlID).toggleClass("errorInput", !validator.IsValid); }
13291}
13292
13293function setValidStatic(name, isValid){
13294    vals[name].IsValid = isValid;    
13295}
13296function isValidStatic(name){
13297    return vals[name].IsValid;
13298}
13299function enableValidator(name, enable) {
13300	validator = vals[name];
13301	validator.enabled = enable;
13302	validate(name);
13303}
13304function ValidateWithoutFiring(name, enable) {
13305	validator = vals[name];
13306	validator.enabled = enable;
13307	updateValidDisplay(name);
13308}
13309function resetVal(name) {
13310	validator = vals[name];
13311	var txtInput = $('#' + validator.ControlID);
13312
13313	if (isNaN(txtInput.val()) && txtInput.val() != txtInput.prop('defaultValue')) {
13314		setValidStatic(name, false);
13315	}
13316	else {
13317		setValidStatic(name, true)
13318	}
13319	updateValidDisplay(name);
13320}
13321/* End Include validation */
13322
13323/* Include services/globalServices */
13324/*
13325This file defines the global services object. Services may register themselves to this object for convenience.
13326 */
13327var Sequiter = Sequiter || {};
13328Sequiter.Services = Sequiter.Services || {};
13329/* End Include services/globalServices */
13330
13331/* Include services/MultiuserService */
13332/* Set up the namespaces */
13333var Sequiter = Sequiter || {};
13334Sequiter.Services = Sequiter.Services || {};
13335Sequiter.Services.MultiuserService = Sequiter.Services.MultiuserService || {};
13336(function (MultiuserService) {
13337	// The Prefix for api calls
13338	const API_PREFIX = "/contracts/MultiuserService/Recipient/";
13339
13340	/**
13341	 * Makes a request to the api, handles prefixing the location.
13342	 * @param action {string} the API action
13343	 * @param id {int} The id relevant to the action being performed.
13344	 * @param [data] {Object} dictionary of data to include in the request
13345	 * @returns {Promise<Response>} A promise with the response from the request.
13346	 */
13347	function ApiRequest(action, id, data) {
13348		return fetch(API_PREFIX + action + "/" + id,
13349			{
13350				method: "POST",
13351				mode: "same-origin",
13352				headers: {
13353					"Content-Type": "application/json;charset=UTF-8"
13354				},
13355				body: JSON.stringify(data)
13356			}
13357		);
13358	}
13359
13360	/**
13361	 * Submits a given webuserDataId.
13362	 * @param webuserDataId {int} the document to submit
13363	 * @param websiteLinkHash {string} the hash to use to authorize this submit
13364	 * @returns {Promise<Response>} A promise with the response
13365	 */
13366	function Submit(webuserDataId, websiteLinkHash) {
13367		return ApiRequest("Submit", webuserDataId, websiteLinkHash);
13368	}
13369
13370	/**
13371	 * @typedef {Object} WebuserDataEvent
13372	 * @property {string} Name The name of the event.
13373	 * @property {string} LocalTime The date and time localized for the user.
13374	 */
13375
13376	/**
13377	 * @typedef {Object} RecipientResult
13378	 * @property {number} MultiuserRecipientId The id of this recipient.
13379	 * @property {string} Name The name of this recipient.
13380	 * @property {string} Email The recipient's email address.
13381	 * @property {[string]} ConfirmationCode The recipients confirmation code.
13382	 * @property {[number]} WebuserDataCopyId The webuser data id of the copy of the original for this recipient.
13383	 * @property {boolean} FromSpecificInvite If this recipient was specifically invited or followed an open link.
13384	 * @property {string} ProductName The name of the product.
13385	 * @property {string} ProductUrl The canonical url for the product.
13386	 * @property {boolean} Deleted If this recipient has been deleted.
13387	 * @property {number} EsignatureStatus The current esignature status of the copy for this recipient.
13388	 * @property {[number]} EsignaturesSignedCount The number of esignatures that have been applied to the copy.
13389	 * @property {[number]} EsignatureTotalCount The total number of esignatures expected on the copy.
13390	 * @property {boolean} OwnerHasSigned If the owner has signed the copy.
13391	 * @property {number} OwnerResponsibleEsignatureCount The number of esignatures on the copy that the owner is responsible for.
13392	 * @property {WebuserDataEvent[]} Events Array of events on the copy.
13393	 */
13394
13395	/**
13396	 * @typedef {Object} ListRecipientsResult
13397	 * @property {RecipientResult[]} Array of recipient information.
13398	 * @property {number} TotalRecipients The total number of recipients when applying this filter.
13399	 * @property {number} TotalRecipientsNoFilter The total number of recipients if no filter is applied.
13400	 */
13401
13402	/**
13403	 * Gets data about all recipients for a given webuserDataId
13404	 * @param {int} webuserDataId the document to get recipient data for
13405	 * @param {object} filterOptions various searching and filtering options
13406	 * @param {string} filterOptions.SearchString A string to search for recipients with similar meta data
13407	 * @param {boolean} filterOptions.FilterCompleted If true, recipients that have completed their document will be filtered out
13408	 * @param {int} filterOptions.PageSize The number of recipients to get information for, starting from the offset
13409	 * @param {int}
13409 filterOptions.Offset The number of recipients to skip when getting results
13410	 * @returns {Promise<ListRecipientsResult>} A promise with the list of recipients and the total number of recipients with and without the filter
13411	 */
13412	function ListRecipients(webuserDataId, filterOptions) {
13413		return ApiRequest("ListRecipients", webuserDataId, filterOptions)
13414			.then(function (response) { return response.json(); });
13415	}
13416
13417	/**
13418	 * Invalidates in-progress recipients and resends an up to date invitation
13419	 * @param {int} webuserDataId the document to get recipient data for
13420	 * @param {function} callback A callback that will be provided a bool indicating if the result was successful
13421	 * @returns {Promise<Response>} A promise with the results of the response.
13422	 */
13423	function InvalidateInProgress(webuserDataId) {
13424		return ApiRequest("InvalidateInProgress", webuserDataId);
13425	}
13426
13427	/**
13428	 * Get the open link hash for a specific webuser data id.
13429	 * @param {number} webuserDataId The webuser data id to get the open link hash for.
13430	 * @returns {Promise<string>} A promise with the open link hash.	
13431	 */
13432	function FetchOpenLinkHash(webuserDataId) {
13433		return ApiRequest("FetchOpenLinkHash", webuserDataId)
13434			.then(function (response) { return response.json(); });
13435	}
13436
13437	/**
13438	 * @typedef {Object} Recipient
13439	 * @property {string} Name The name of the recipient
13440	 * @property {string} Email The email of the recipient.
13441	 */
13442
13443	/**
13444	 * @typedef {Object} AddRecipientResult
13445	 * @property {boolean} Success If adding the recipients was successful or not.
13446	 * @property {string} Message Any message associated with the result.
13447	 */
13448
13449	/**
13450	 * Add recipients to a multiuser document.
13451	 * @param {number} webuserDataId The webuser data to add the recipients to.
13452	 * @param {Recipient[]} recipients The recipients to add
13453	 * @param {string} inviteMessage The personalized invitation message.
13454	 * @returns {Promise<AddRecipientResult>} A promise with the result of trying to add the recipients.
13455	 */
13456	function AddRecipients(webuserDataId, recipients, inviteMessage) {
13457		return ApiRequest("Add", webuserDataId, {
13458			Recipients: recipients,
13459			InviteMessage: inviteMessage
13460		})
13461			.then(function (response) { return response.json(); });
13462	}
13463
13464	/**
13465	 * Delete a multiuser recipient
13466	 * @param {number} recipientId The id of the recipient to be deleted.
13467	 * @returns {Promise<boolean>} Promise indicating if the recipient was successfully deleted.
13468	 */
13469	function RemoveRecipient(recipientId) {
13470		return ApiRequest("Remove", recipientId)
13471			.then(function (response) {
13472				if (!response.ok)
13473					throw response.statusText;
13474				else
13475					return response.json();
13476			});
13477	}
13478
13479	/**
13480	 * Send a reminder to the specified recipient.
13481	 * @param {number} recipientId
13482	 * @returns {Promise<boolean>} Promise indicating if the reminder was sent successfully.
13483	 */
13484	function SendReminder(recipientId) {
13485		return ApiRequest("SendReminder", recipientId)
13486			.then(function (response) {
13487				return response.ok;
13488			});
13489	}
13490
13491	// Export public members for website use.
13492	$.extend(MultiuserService, {
13493		Submit: Submit,
13494		ListRecipients: ListRecipients,
13495		InvalidateInProgress: InvalidateInProgress,
13496		FetchOpenLinkHash: FetchOpenLinkHash,
13497		AddRecipients: AddRecipients,
13498		RemoveRecipient: RemoveRecipient,
13499		SendReminder: SendReminder
13500	});
13501})(Sequiter.Services.MultiuserService)
13502/* End Include services/MultiuserService */
13503
13504/* Include services/data */
13505/**
13506 * JS functions for the DataService.
13507 */
13508var Services = Services || {};
13509Services.Data = Services.Data || {};
13510
13511(function (dataService) {
13512	/**
13513	 * Returns a promise resolving to a URI that links to the Azure Blob Storage File matching the provided parameters
13514	 * @param {string} fileIdentifier uuid identifier of the file to get the shared access signature for
13515	 * @param {string} containerName uuid identifier of the container the file resides in
13516	 * @param {string} filename human readable name of the file
13517	 * @return {Promise<string>} The promise which resolves to a URI.
13518	 */
13519	function getSharedAccessSignatureFriendly(fileIdentifier, containerName, filename) {
13520		return new Promise(function (resolve, reject) {
13521			CallDataService("GetSharedAccessSignatureFriendly", { "secureID": window.SID, "fileIdentifier": fileIdentifier, "containerName": containerName, "filename": filename },
13522				function (data) {
13523					resolve(data.d);
13524				},
13525				function (error) {
13526					reject(error);
13527				}
13528			);
13529		});
13530	}
13531
13532	// Export public members for website use.
13533	$.extend(dataService, {
13534		getSharedAccessSignatureFriendly: getSharedAccessSignatureFriendly,
13535	});
13536
13537	// Exports for unit testing.
13538	if (typeof exports !== "undefined") {
13539		exports.dataService = dataService;
13540	}
13541})(Services.Data);
13542/* End Include services/data */
13543
13544/* Include services/fileStore */
13545/**
13546 * JS functions for the DataService.
13547 */
13548var Services = Services || {};
13549Services.FileStore = Services.FileStore || {};
13550
13551(function (fileStoreService) {
13552	const SERVICE_ROOT_URL = Sequiter.SiteConfig.GetConfigValue("fileStoreService", "/api/foundation/file-storage/");
13553
13554	/**
13555	 * Uploads a file.
13556	 *
13557	 * @param {File} file - the file to upload
13558	 * @param {object} [settings={}] An object with settings on how to upload the file.
13559	 * @param {boolean} [settings.hidden=false] If the file should be hidden when listing files.
13560	 * @returns {Promise<object>} A promise that will return the Utility.Utility.Blob object of the uploaded file
13561	 */
13562	function create(file, settings) {
13563		var settingsFinal = $.extend({
13564			hidden: false
13565		}, settings);
13566		var formData = new FormData();
13567		formData.append('FileName', file.name);
13568		formData.append('File', file, file.name); // Append the file object itself
13569		formData.append('ProcessingOptions', settingsFinal.hidden ? "IsHidden" : "None");
13570		// Display a message while waiting for the upload.
13571		AjaxWait();
13572		return fetch(SERVICE_ROOT_URL + "v1/files/",
13573			{
13574				method: 'POST',
13575				body: formData
13576			})
13577			.then(function (response) { return response.json(); })
13578			.then(function (responseParsed) {
13579				if (responseParsed.succeeded) {
13580					let blob = responseParsed.result;
13581                    blob.WebuserFileID = blob.webuserFileId; //Added in for backwards compatibility with older DCS versions
13582					return blob;
13583                }
13584				else
13585					throw "File could not be uploaded";
13586			}).
13587			finally(function () {
13588				hideMessage(); // Always hide the message.
13589			});
13590	}
13591
13592	/**
13593	 * Deletes a file.
13594	 * @param {number} webuserFileId The id of the file to delete.
13595	 * @returns {Promise<boolean>} A promise that indicates if the delete was successful or not.
13596	 */
13597	function deleteFile(webuserFileId) {
13598		// Display a message while waiting for the delete results.
13599		AjaxWait();
13600		return fetch(SERVICE_ROOT_URL + "v1/files/" + webuserFileId,
13601			{
13602				method: 'DELETE',
13603				headers: {
13604					'Content-Type': 'application/json'
13605				}
13606			})
13607			.then(function() { return true; });
13608	}
13609
13610	// Export public members for website use.
13611	$.extend(fileStoreService, {
13612		create: create,
13613		deleteFile: deleteFile
13614	});
13615
13616	// Exports for unit testing.
13617	if (typeof exports !== "undefined") {
13618		exports.fileStoreService = fileStoreService;
13619	}
13620})(Services.FileStore);
13621/* End Include services/fileStore */
13622
13623/* Include randomUUIDPolyfill */
13624if(!Crypto.prototype.randomUUID){Crypto.prototype.randomUUID=function(){return([1e7]+ -1e3+ -4e3+ -8e3+ -1e11).replaceAll(/[018]/g,c=>(Number(c)^((globalThis.crypto.getRandomValues(new Uint8Array(1))[0]&15)>>(Number(c)/4))).toString(16));};}
13625/* End Include randomUUIDPolyfill */
13626
13627/* Include lcBanner */
13628$(function() {
13629   var active = false;
13630   $("#btnSearch").on("click", function(event) {
13631      if (!active) {
13632         $("#txtSearch").addClass("txtSearchFocus");
13633         $("#txtSearch").attr("placeholder", "Search...");
13634         if (typeof(cssua) == "undefined" || !cssua.ua.ie) {
13635            $("#txtSearch").trigger("focus");
13636         }
13637         $("#btnSearch").addClass("btnSearchFocus");
13638         $("body").addClass("bannerSearchFocus");
13639         active = true;
13640         event.stopPropagation();
13641      }
13642      else {
13643         submitSearch();
13644         active = false;
13645      }
13646   });
13647   $(document).on("click", function(event) {
13648      if (active && event.currentTarget.activeElement.className.indexOf("search_input") == -1) {
13649         $("#txtSearch").removeClass("txtSearchFocus");
13650         $("#txtSearch").attr("placeholder", "");
13651         $("#btnSearch").removeClass("btnSearchFocus");
13652         $("#txtSearch").val("");
13653         $("body").removeClass("bannerSearchFocus");
13654         active = false;
13655      }
13656   });
13657});
13658/* End Include lcBanner */
13659
13660/* Include enNumberFormatter */
13661/*
13662 * Copyright (C) 2006 Baron Schwartz <baron at sequent dot org>
13663 *
13664 * Permission is hereby granted, free of charge, to any person obtaining a copy
13665 * of this software and associated documentation files (the "Software"), to deal
13666 * in the Software without restriction, including without limitation the rights
13667 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13668 * copies of the Software, and to permit persons to whom the Software is
13669 * furnished to do so, subject to the following conditions:
13670 *
13671 * The above copyright notice and this permission notice shall be included in
13672 * all copies or substantial portions of the Software.
13673 *
13674 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13675 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13676 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
13677 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
13678 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
13679 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
13680 * THE SOFTWARE.
13681 */
13682
13683/* Abbreviations: LODP = Left Of Decimal Point, RODP = Right Of Decimal Point*/
13684Number.formatFunctions = {count:0};
13685
13686/* Constants useful for controlling the format of numbers in special cases.*/
13687Number.prototype.NaNstring   = 'NaN';
13688Number.prototype.posInfinity = 'Infinity';
13689Number.prototype.negInfinity = '-Infinity';
13690Number.prototype.conditionRE = /\[(>
13690=|<=|=|>|<)([0-9\.]+)\]/;
13691
13692Number.prototype.numberFormat = function(format, context) {
13693    if (isNaN(this) ) {
13694        return Number.prototype.NaNstring;
13695    }
13696    else if (this == +Infinity ) {
13697        return Number.prototype.posInfinity;
13698    }
13699    else if ( this == -Infinity) {
13700        return Number.prototype.negInfinity;
13701    }
13702    else if (Number.formatFunctions[format] == null) {
13703        Number.createNewFormat(format);
13704    }
13705    return this[Number.formatFunctions[format]](context);
13706};
13707
13708Number.createNewFormat = function(format) {
13709    var funcName = "format" + Number.formatFunctions.count++;
13710    Number.formatFunctions[format] = funcName;
13711    var code = "Number.prototype." + funcName + " = function(context){\n";
13712
13713    var formats = format.split(";");      // identify individual rules
13714
13715    var equalConditionsCode = '';         // pull out equal conditions in front of the rest
13716    var otherConditionsCode = '';         // overlaping conditions (>= 1000 and <= 2000 etc. are handled left to right)
13717    var rulesWithoutConditionsCount = 0;  // up to 3 rules can have no conditions defined, they will be treated as [>0], [<0] and [=0] respectively
13718    var defaultRuleFormat = '###.##';     // use this if there are multiple rules but none or only one is without a custom condition
13719
13720    if (formats.length < 2 && format.match(Number.prototype.conditionRE)==null) {
13721        code += Number.createTerminalFormat(format);
13722    } else {
13723        
13724        for (var i=0,format; format=formats[i]; i++){
13725            if ((result = format.match(Number.prototype.conditionRE))!==null) { // custom condition block
13726                var newFormat = format.replace(result[0],'');
13727                if (result[1]=='=') {
13728                    equalConditionsCode += Number.createConditionCode(result[1], result[2], newFormat);
13729                } else {
13730                    otherConditionsCode += Number.createConditionCode(result[1], result[2], newFormat);
13731                }
13732            } else { // this block has no custom condition
13733                switch (rulesWithoutConditionsCount) {
13734                    case 0: // positive condition
13735                        defaultRuleFormat = format; // see var defaultRuleFormat above
13736                        otherConditionsCode += Number.createConditionCode('>=', 0, format);
13737                        break;
13738                    case 1: // negative condition
13739                        otherConditionsCode += Number.createConditionCode('<', 0, format);
13740                        break;
13741                    case 2: // zero condition
13742                        equalConditionsCode += Number.createConditionCode('=', 0, format);
13743                        break;
13744                    default:
13745                        equalConditionsCode = "throw 'Too many semicolons in format string';" + equalConditionsCode;
13746                        break;
13747                }
13748                rulesWithoutConditionsCount++;
13749            }
13750        };
13751
13752        if (rulesWithoutConditionsCount==1) { // we just have the default component, let's use it as a generic component instead of positive
13753            otherConditionsCode += Number.createConditionCode('<', 0, defaultRuleFormat);
13754        } else if (rulesWithoutConditionsCount==0) {  // no default component is present, use the default ###.## format for "all else"
13755            otherConditionsCode += Number.createConditionCode('all', 0, defaultRuleFormat);
13756        }
13757
13758        code += equalConditionsCode + otherConditionsCode;
13759
13760    }
13761
13762    code += "}";
13763
13764    eval(code);
13765};
13766
13767Number.createConditionCode = function(condition, conditionNumber, format) {
13768    var conditionStr = '';
13769    
13770    if (condition == 'all') {
13771        return "\n"+"return this.numberFormat('" + String.escape(format)+ "', 1);";
13772    } else {
13773        switch(condition) {
13774            case '=':
13775                conditionStr = '==';
13776                break;
13777            case '>':
13778                conditionStr = '> ';
13779                break;
13780            case '<':
13781                conditionStr = '< ';
13782                break;
13783            case '>=':
13784                conditionStr = '>=';
13785                break;
13786            case '<=':
13787                conditionStr = '<=';
13788                break;
13789            default:
13790                throw 'Error! Unrecognized condition format!';
13791                break;
13792        }
13793    
13794        return "\n"+
13795            'if (this '+conditionStr+' '+parseFloat(conditionNumber,10)+') {'+
13796                "return this.numberFormat('" + String.escape(format)+ "', 1);"+
13797            '}';
13798    }
13799};
13800
13801
13802Number.createTerminalFormat = function(format) {
13803    /* If there is no work to do, just return the literal value*/
13804    if (format.length > 0 && format.search(/[0#?]/) == -1) {
13805        return "return '" + String.escape(format) + "';\n";
13806    }
13807    /* Negative values are always displayed without a minus sign when section separators are used.*/
13808    var code = "var val = (context == null) ? new Number(this) : Math.abs(this);\n";
13809    var groupSize = 0;
13810    var lodp = format;
13811    var rodp = "";
13812    var ldigits = 0;
13813    var rdigits = 0;
13814    var scidigits = 0;
13815    var scishowsign = false;
13816    var sciletter = "";
13817    /* Look for (and remove) scientific notation instructions, which can be anywhere*/
13818    m = format.match(/\..*(e)([+-]?)(0+)/i);
13819    if (m) {
13820        sciletter = m[1];
13821        scishowsign = (m[2] == "+");
13822        scidigits = m[3].length;
13823        format = format.replace(/(e)([+-]?)(0+)/i, "");
13824    }
13825    /* Split around the decimal point*/
13826    var m = format.match(/^([^.]*)\.(.*)$/);
13827    if (m) {
13828        lodp = m[1].replace(/\./g, "");
13829        rodp = m[2].replace(/\./g, "");
13830    }
13831    else{
13832       lodp = format;
13833       rodp = '';
13834    }
13835    /* Look for %*/
13836    if (format.indexOf('%') >= 0) {
13837        code += "val *= 100;\n";
13838    }
13839    /* Look for comma-scaling to the left of the decimal point*/
13840    m = lodp.match(/(,+)(?:$|[^0#?,])/);
13841    if (m) {
13842        code += "val /= " + Math.pow(1000, m[1].length) + "\n;";
13843    }
13844    /* Look for comma-separators*/
13845    m = /[0#],([0#]*)/.exec(lodp);
13846    if (m && m.length >= 2) {
13847        groupSize = m[1].length;
13848    }
13849    /* Nuke any extraneous commas*/
13850    if ((m) || groupSize > 0) {
13851        lodp = lodp.replace(/,/g, "");
13852    }
13853    /* Figure out how many digits to the l/r of the decimal place*/
13854    m = lodp.match(/0[0#?]*/);
13855    if (m) {
13856        ldigits = m[0].length;
13857    }
13858    m = rodp.match(/[0#?]*/);
13859    if (m) {
13860        rdigits = m[0].length;
13861    }
13862    /* Scientific notation takes precedence over rounding etc*/
13863    if (scidigits > 0) {
13864        code += "var sci = Number.toScientific(val,"
13865            + ldigits + ", " + rdigits + ", " + scidigits + ", " + scishowsign + ");\n"
13866            + "var arr = [sci.l, sci.r];\n";
13867    }
13868    else {
13869        /* If there is no decimal point, round to nearest integer*/
13870        /* rounding half AWAY from zero, as in Excel (as opposed to Math.round())*/
13871        /* Hint: if context is present, we're always working with absolute values, so no adjustments are necessary*/
13872        if (format.indexOf('.') < 0) {
13873            code += "var sign = (this < 0 && context == null) ? -1 : 1;\n";
13874            code += "val = Math.round(val*sign)*sign;\n";
13875        }
13876        /* Numbers are rounded to the correct number of digits to the right of the decimal*/
13877        code += "var arr = val.round(" + rdigits + ").toString().split('.');\n";
13878        /* There are at least "ldigits" digits to the left of the decimal, so add zeros if needed.*/
13879        code += "arr[0] = (val < 0 ? '-' : '') + String.leftPad((val < 0 ? arr[0].substring(1) : arr[0]), "
13880            + ldigits + ", '0');\n";
13881    }
13882    /* Add group separators*/
13883    if (groupSize > 0) {
13884        code += "arr[0] = Number.addSeparators(arr[0], " + groupSize + ");\n";
13885    }
13886    /* Insert the digits into the formatting string.  On the LHS, extra digits are copied*/
13887    /* into the result.  On the RHS, rounding has chopped them off.*/
13888    code += "arr[0] = Number.injectIntoFormat(arr[0].reverse(), '"
13889        + String.escape(lodp.reverse()) + "', true).reverse();\n";
13890    if (rdigits > 0) {
13891        code += "arr[1] = Number.injectIntoFormat(arr[1], '" + String.escape(rodp) + "', false);\n";
13892    }
13893    if (scidigits > 0) {
13894        code += "arr[1] = arr[1].replace(/(\\d{" + rdigits + "})/, '$1" + sciletter + "' + sci.s);\n";
13895    }
13896    return code + "return (typeof(arr[1]) != 'undefined' && arr[1].length > 0 ? arr.join('.') : arr[0]);\n";
13897};
13898
13899Number.toScientific = function(val, ldigits, rdigits, scidigits, showsign) {
13900    var result = {l:"", r:"", s:""};
13901    var ex = "";
13902    /* Make ldigits + rdigits significant figures*/
13903    var before = Math.abs(val).toFixed(ldigits + rdigits + 1).trim('0');
13904    /* Move the decimal point to the right of all digits we want to keep,*/
13905    /* and round the resulting value off*/
13906    var after = Math.round(new Number(before.replace(".", "").replace(
13907        new RegExp("(\\d{" + (ldigits + rdigits) + "})(.*)"), "$1.$2"))).toFixed(0);
13908    /* Place the decimal point in the new string*/
13909    if (after.length >= ldigits) {
13910        after = after.substring(0, ldigits) + "." + after.substring(ldigits);
13911    }
13912    else {
13913        after += '.';
13914    }
13915    /* Find how much the decimal point moved.  This is #places to LODP in the original*/
13916    /* number, minus the #places in the new number.  There are no left-padded zeroe
13916s in*/
13917    /* the new number, so the calculation for it is simpler than for the old number.*/
13918    result.s = (before.indexOf(".") - before.search(/[1-9]/)) - after.indexOf(".");
13919    /* The exponent is off by 1 when it gets moved to the left.*/
13920    if (result.s < 0) {
13921        result.s++;
13922    }
13923    /* Split the value around the decimal point and pad the parts appropriately.*/
13924    result.l = (val < 0 ? '-' : '') + String.leftPad(after.substring(0, after.indexOf(".")), ldigits, "0");
13925    result.r = after.substring(after.indexOf(".") + 1);
13926    if (result.s < 0) {
13927        ex = "-";
13928    }
13929    else if (showsign) {
13930        ex = "+";
13931    }
13932    result.s = ex + String.leftPad(Math.abs(result.s).toFixed(0), scidigits, "0");
13933    return result;
13934};
13935
13936Number.prototype.round = function(decimals) {
13937    if (decimals > 0) {
13938        /* decimalPrecision variable is an ugly hack to limit toFixed() parameter to 20, which is ECMAScript maximum supported range*/
13939        /* numbers like 0.54999999999999999, with #.# format, will still be rounded to 0.6, since there is simply not enough precision*/
13940        decimalPrecision = Math.min(decimals + 10,20);
13941        var m = this.toFixed(decimalPrecision).match(
13942            new RegExp("(-?\\d*)\.(\\d{" + decimals + "})(\\d)\\d*$"));
13943        if (m && m.length) {
13944            var carryover = (m[1].charAt(0) == '-') ? -1 : 1; // negative number carryovers need to be negative, too
13945            var s = String.leftPad(Math.round(m[2] + "." + m[3]), decimals, "0");
13946            return (s.length > decimals) ? new Number(m[1]) + carryover : new Number(m[1] + "." + s);
13947        }
13948    }
13949    else if(decimals == 0){
13950       return new Number(Math.round(this));
13951    }
13952    return this;
13953};
13954
13955Number.injectIntoFormat = function(val, format, stuffExtras) {
13956    var i = 0;
13957    var j = 0;
13958    if(typeof(val) == "undefined" || val == null) val = "";
13959    var result = "";
13960    var revneg = false;
13961    if(val.length > 0) revneg = val.charAt(val.length - 1) == '-';
13962    if ( revneg ) {
13963       val = val.substring(0, val.length - 1);
13964    }
13965    while (i < format.length && j < val.length && format.substring(i).search(/[0#?]/) >= 0) {
13966        if (format.charAt(i).match(/[0#?]/)) {
13967            /* It's a formatting character; copy the corresponding character*/
13968            /* in the value to the result*/
13969            if (val.charAt(j) != '-') {
13970                result += val.charAt(j);
13971            }
13972            else {
13973                result += "0";
13974            }
13975            j++;
13976        }
13977        else {
13978            result += format.charAt(i);
13979        }
13980        ++i;
13981    }
13982    if ( revneg && j == val.length ) {
13983        result += '-';
13984    }
13985    if (j < val.length) {
13986        if (stuffExtras) {
13987            result += val.substring(j);
13988        }
13989        if ( revneg ) {
13990             result += '-';
13991        }
13992    }
13993    if (i < format.length) {
13994        result += format.substring(i);
13995    }
13996    return result.replace(/#/g, "").replace(/\?/g, " ");
13997};
13998
13999Number.addSeparators = function(val, size) {
14000   if(typeof(size) == "undefined") size = 3;
14001   var re = new RegExp("(\\d{" + size + "})", "g");
14002    return val.reverse().replace(re, "$1,").reverse().replace(/^(-)?,/, "$1");
14003};
14004/* End Copyright */
14005/* End Include enNumberFormatter */
14006
14007/* Include localeFormatter */
14008(function( localeNumberFormatter, $ ) {
14009    //Public Method
14010    localeNumberFormatter.Format = function(number, format, locale) {
14011        var decimalFormat = getDecimalFormat(format);
14012        var numberOfDecimalPlaces = decimalFormat.length;
14013        number = parseFloat(number).toFixed(numberOfDecimalPlaces);
14014        numberOfDecimalPlaces = getNumberOfDecimalsToKeep(number, format);
14015        var formattedNumber = parseFloat(number).toLocaleString(locale, {minimumFractionDigits: numberOfDecimalPlaces, maximumFractionDigits: numberOfDecimalPlaces});
14016        if (format.indexOf(',') < 0){
14017            formattedNumber = formattedNumber.replace(/,/g, '');
14018        }
14019        formattedNumber = formatWithCurrencySymbol(format, formattedNumber);
14020        if (format.indexOf())
14021        return formattedNumber;
14022    };
14023
14024    var currencySymbols = ['$', '€', '₹', '£', '¥', '₩'];
14025
14026    function getDecimalFormat(format){
14027        if(typeof(format) == "string"){
14028            var formatSplit = format.split('.');
14029            if(formatSplit.length > 1 && formatSplit[1].length > 0){
14030                return formatSplit[1].replace(/[^0-9,.#]/g, "");
14031            }
14032        }
14033        return "";
14034    }
14035
14036    function formatWithCurrencySymbol(format, formattedNumber){
14037        var firstCharacter = format.substring(0,1);
14038        if (currencySymbols.indexOf(firstCharacter) >= 0){
14039            formattedNumber = firstCharacter + formattedNumber;
14040        }
14041        var lastCharacter = format[format.length -1];
14042        if (currencySymbols.indexOf(lastCharacter) >= 0){
14043            formattedNumber = formattedNumber + lastCharacter;
14044        }
14045        return formattedNumber;
14046    }
14047
14048    function getNumberOfDecimalsToKeep(number, decimalFormat){
14049        decimalFormat = decimalFormat.replace(/[^0-9,.#]/g,"");
14050        var numberString = number.toString();
14051        numberSplit = numberString.split('.');
14052        if (numberSplit.length > 1){
14053            var decimalPart = numberSplit[1];
14054            var numberOfDecimalsToKeep = decimalPart.length;
14055            for(var i = 1; i <= decimalPart.length; i++){
14056                if (decimalPart[decimalPart.length - i] == "0" && decimalFormat[decimalFormat.length - i] == "#") {
14057                    numberOfDecimalsToKeep--;
14058                }
14059                else if (decimalPart != "0"){
14060                    break;
14061                }
14062            }
14063            return numberOfDecimalsToKeep;
14064        }
14065        return 0;
14066    }
14067}( window.localeNumberFormatter = window.localeNumberFormatter || {}, jQuery ));
14068/* End Include localeFormatter */
14069
14070/* Include esignature */
14071const { 
14072	startESignatureTrack,
14073	startESignature,
14074	warnBlankPartiesESignature,
14075	warnSubscriptionESignatureStart,
14076	startESignatureParty,
14077	backToDocument,
14078	setESignatureFormClass,
14079	updateSignaturePreview,
14080	Sign,
14081	requestESignatures,
14082	creatorSignDocument,
14083	viewESignatureStatuses,
14084	cancelESignature,
14085	displayESignatureRequestedDialog,
14086	animateESignatureLoading,
14087	showESignatureInvitedAlert,
14088	cancelESignatureRequest,
14089	markESignaturePaper,
14090	clearESignatureNotification,
14091	showESignatureError,
14092	showPendingESignatureSubscriptionConfirm,
14093	confirmESignatureMarkAsComplete,
14094	doneESignatureMarkAsComplete,
14095	confirmESignatureDelete,
14096	showESignatureChangedError,
14097	showESignatureAccessError,
14098	isLegacyESign,
14099} = (() => {
14100	/**
14101	 * Track an event and go to the legacy e-signature process.
14102	 * 
14103	 * This is mostly used only within this file but is also used from multiUserQuestionnaire.js when starting the esign process for a MUQ document.
14104	 * 
14105	 * @param {string} evt The name of the tracked event.
14106	 */
14107	function startESignatureTrack(evt){
14108		submitTrackedEvent(evt, undefined, WebuserDataInfo.id, "esignature", false);
14109		goToESignature();
14110	}
14111
14112	/**
14113	 * Start the e-sign process as the document owner.
14114	 * If new esign is supported send the user there.
14115	 * If not it will start the legacy esign process.
14116	 * 
14117	 * This function is set as an onclick action for contract menu buttons in DCS. See https://dev.azure.com/LawDepot/LawDepot/_git/Nuget.Contracts.Controls?path=/Control
14117s/Preview/ContractMenu.cs&version=GCacc0526185ad13835b246f19357669528e98eebf&line=278&lineEnd=279&lineStartColumn=1&lineEndColumn=1&lineStyle=plain&_a=contents
14118	 */
14119	function startESignature(){
14120		if(isNewEsignSupported()) {
14121			goToNewESign();
14122			return;
14123		}
14124		startESignatureTrack("start");
14125	}
14126
14127	/**
14128	 * Another function that can start the e-sign process as the document owner. This one is called if there are any parties that do not have names entered in the questionnaire.
14129	 * If new e-sign is supported the user will be sent directly there.
14130	 * Otherwise, this creates a dialog warning the user that some party names may not be filled, and offers to take the user to the page of the questionnaire
14131	 * that would let them fill out that those party names.
14132	 * 
14133	 * This function is set as an onclick action for contract menu buttons in DCS. See https://dev.azure.com/LawDepot/LawDepot/_git/Nuget.Contracts.Controls?path=/Controls/Preview/ContractMenu.cs&version=GCacc0526185ad13835b246f19357669528e98eebf&line=276&lineEnd=277&lineStartColumn=1&lineEndColumn=1&lineStyle=plain&_a=contents
14134	 * 
14135	 * @param {int} numParties The number of parties that are still blank
14136	 * @param {string} firstQuestionGroup The id of the first question group that has blank esignature information
14137	 */
14138	function warnBlankPartiesESignature(numParties, firstQuestionGroup){
14139		if(isNewEsignSupported()) {
14140			goToNewESign();
14141			return;
14142		}
14143		var text;
14144		var fillInText;
14145		var title;
14146		if(numParties == 1){
14147			text = "Your document is missing the name of 1 party. Your document might appear incomplete with a missing name. Are you sure you want to proceed with <span class=\"noWrap\">E-Signature</span>?";
14148			fillInText = "Enter Party Name";
14149			title = "Missing Name";
14150		}
14151		else {
14152			text = "Your document is missing the names of [numParties] parties. Your document might appear incomplete with missing names. Are you sure you want to proceed with <span class=\"noWrap\">E-Signature</span>?".replace("[numParties]", numParties.toString());
14153			fillInText = "Enter Party Names";
14154			title = "Missing Names";
14155		}
14156		confirmDialog(text, {
14157			yesText:fillInText, 
14158			noText:"Proceed with <span class=\"noWrap\">E-Signature</span>", 
14159			title:title, 
14160			callback:function(val){ warnBlankPartiesESignatureCallback(val, firstQuestionGroup); },
14161			cssClass: "ESignatureMissingNames"
14162		});
14163	}
14164
14165	/**
14166	 * Callback for warnBlankPartiesESignature, redirects if callbackVal is true, otherwise begins the legacy esignature process.
14167	 * 
14168	 * @param {bool} callbackVal true if redirecting, otherwise start esignature
14169	 * @param {string} firstQuestionGroup id of the group to redirect to if callbackVal is true
14170	 */
14171	function warnBlankPartiesESignatureCallback(callbackVal, firstQuestionGroup){
14172		if(callbackVal) {
14173			qnh.GotoGroup(firstQuestionGroup);
14174		}
14175		else {
14176			startESignature();
14177		}
14178	}
14179
14180	/**
14181	 * Another function that can start the e-sign process as the document owner. This one is called if the user has a subscription that will expire soon.
14182	 * If new e-sign is supported, send the user there without doing anything else.
14183	 * If not, the user will be warned that their subscription will expire soon and be prompted to either proceed or reactive their subscription.
14184	 * This takes priority over warnBlankPartiesESignature and will call that function when the user chooses to proceed if there are any parties without names specified.
14185	 * 
14186	 * This function is set as an onclick action for contract menu buttons in DCS. See https://dev.azure.com/LawDepot/LawDepot/_git/Nuget.Contracts.Controls?path=/Controls/Preview/ContractMenu.cs&version=GCacc0526185ad13835b246f19357669528e98eebf&line=270&lineEnd=271&lineStartColumn=1&lineEndColumn=1&lineStyle=plain&_a=contents
14187	 * 
14188	 * @param {string} expiryDate The date the subscription will expire as an already formatted string.
14189	 * @param {number} subscriptionID The id of the subscription.
14190	 * @param {boolean} subscriptionCanReactivate If it is possible to reactive the subscription.
14191	 * @param {number} numParties The number of signing parties that do not have names specified in the questionnaire.
14192	 * @param {string} firstQuestionGroup The id of the first question group that has a signing party missing a name.
14193	 */
14194	function warnSubscriptionESignatureStart(expiryDate, subscriptionID, subscriptionCanReactivate, numParties, firstQuestionGroup){
14195		if(isNewEsignSupported()) {
14196			goToNewESign();
14197			return;
14198		}
14199		var proceed;
14200		if(numParties > 0) {
14201			proceed = function() { warnBlankPartiesESignature(numParties, firstQuestionGroup); };
14202		}
14203		else {
14204			proceed = startESignature;
14205		}
14206		confirmDialog(
14207			("<p>You canceled your subscription and your access will expire on <strong class=\"noWrap\">{0}</strong>. If your <span class=\"noWrap\">E-Signature</span> process is not completed by this date, it will be canceled.</p><p class=\"question\">Do you wish to proceed or reactivate your subscription?</p>").replace("{0}", expiryDate),
14208			{
14209				yesText : "Reactivate Subscription",
14210				noText : "Proceed with <span class=\"noWrap\">E-Signature</span>",
14211				title: "Subscription Canceled",
14212				includeParagraph:false,
14213				cssClass: "ESignatureReactivatePrompt",
14214				callback: function(res) { 
14215					if(res) {
14216						if(subscriptionCanReactivate) {
14217							showMessage("Please Wait ...");
14218							$.ajax({
14219								type: "POST",
14220								url: "/MyAccount/Index.aspx/ReactivateSubscription",
14221								contentType: "application/json; charset=utf-8",
14222								dataType: "json",
14223								data: JSON.stringify({secureId: window.SID, subsId: subscriptionID, invNum: 0}),
14224								success: function (response) {
14225									var result = response.d;
14226									hideMessage();
14227									$.each(result, function (key, val) {
14228										if (key == "SUCCESS") {
14229											proceed();
14230										}
14231										else {
14232											alert(val);
14233										}
14234									});
14235								}
14236							});
14237						}
14238						else { 
14239							window.location.href = '/contracts/order-yudox/?code=ALLLAW';
14240						}
14241					}
14242					else {
14243						proceed();
14244					}
14245				}
14246			}
14247		);
14248	}
14249
14250	/**
14251	 * Start applying a signature to a document that has already started the legacy e-sign process.
14252	 * This function is only called for documents that have already started the legacy e-sign process so does not ever send the user to the new e-sign process.
14253	 * 
14254	 * This function is set as an onclick action for contract menu buttons in DCS. See https://dev.azure.com/LawDepot/LawDepot/_git/Nuget.Contracts.Controls?path=/Controls/Preview/ContractMenu.cs&version=GCacc0526185ad13835b246f19357669528e98eebf&line=290&lineEnd=291&lineStartColumn=1&lineEndColumn=1&lineStyle=plain&_a=contents
14255	 */
14256	function startESignatureParty(){
14257		startESignatureTrack("start-party");
14258	}
14259
14260	/**
14261	 * Identifies the preview page toolbar as the origin of an e-sign bundle. The ingest
14262	 * endpoint stores it as the utm_source, so it is a fixed value per calling location rather
14263	 * than something read off the page.
14264	 */
14265	const ESIGN_UTM_SOURCE = "PPToolbar";
14266
14267	/**
14268	 * Appends the product and tracking metadata that the e-sign ingest endpoint accepts
14269	 * alongside the file.
14270	 *
14271	 * Without these the bundle is stored with a null product_code. That failure is silent -
14272	 * ingest still succeeds and the user still signs - but the document cannot be attributed
14273	 * to a product afterwards.
14274	 *
14275	 * Values are only appended when we actually have them: product_code is length validated
14276	 * server side, so posting an empty one would fail the request and leave the user unable to
14277	 * start e-signing at all.
14278	 *
14279	 * @param {FormData} formData The form data being posted to the ingest endpoint.
14280	 */
14281	function appendESignIngestMetadata(formData) {
14282		formData.append("utm_source", ESIGN_UTM_SOURCE);
14283
14284		var productCode = typeof getCurrentProductCode === "function" ? getCurrentProductCode() : null;
14285		if (productCode) {
14286			formData.append("product_code", productCode);
14287		}
14288
14289		// Lets the e-sign API resolve product details from the web user data record server
14290		// side, independently of what this page can see.
14291		var webUserDataId = getESignWebUserDataId();
14292		if (webUserDataId !== null) {
14293			formData.append("web_user_data_id", webUserDataId);
14294		}
14295	}
14296
14297	/**
14298	 * Resolves the web user data id for the current document.
14299	 *
14300	 * WebuserDataInfo.id is null when the user has no saved answers, and DCS pages older than
14301	 * 3.02 expose the value as a webuserDataID global instead, so all three known sources are
14302	 * tried in the order already used by yanswersp.js and storage.js.
14303	 *
14304	 * The result is coerced to a positive integer because the ingest endpoint validates the
14305	 * field as one. Posting a non-numeric value would fail the whole request and leave the
14306	 * user unable to e-sign, so anything unparseable is dropped instead.
14307	 *
14308	 * @returns {?number} The web user data id, or null when it cannot be resolved.
14309	 */
14310	function getESignWebUserDataId() {
14311		var candidate;
14312
14313		if (typeof WebuserDataInfo !== "undefined" && WebuserDataInfo && WebuserDataInfo.id) {
14314			candidate = WebuserDataInfo.id;
14315		}
14316		// The old PHP page variable, for DCS versions that predate WebuserDataInfo.
14317		else if (typeof webuserDataID !== "undefined" && webuserDataID) {
14318			candidate = webuserDataID;
14319		}
14320		else {
14321			candidate = getQueryStringValue("webuser_data_id");
14322		}
14323
14324		var parsed = parseInt(candidate, 10);
14325		return isNaN(parsed) || parsed <= 0 ? null : parsed;
14326	}
14327
14328	/**
14329	 * Navigates to the new Esignature process.
14330	 * @param {Blob} pdfData the Pdf data of the contract to be signed.
14331	 * @param {string} fileName the file name for the pdf.
14332	 */
14333	function navigateToNewESignature(pdfData, fileName) {
14334		var formData = new FormData();
14335		formData.append("file", new Blob([pdfData], { type: "application/pdf" }), fileName);
14336		appendESignIngestMetadata(formData);
14337		$.ajax({
14338			url: "/api/esign/v1/esign/ingest",
14339			type: "POST",
14340			data: formData,
14341			processData: false,
14342			contentType: false,
14343			success: function (result) {
14344				window.location.href = result.result;
14345			},
14346			error: function (xhr) {
14347				logErrorMessage("Esign injest request failed with status: " + xhr.status + " error: " + xhr.responseText, url_escape(location.href), null, url_escape(location.href), 'javascript_error.log');
14348			}
14349		});
14350	}
14351
14352	/**
14353	 * Gets the file name from the response header.
14354	 * @param {string} contentDisposition response header.
14355	 */
14356	function getPdfFileNameFromResponseHeaders(contentDisposition) {
14357		var matches = contentDisposition.match(/filename\s*=\s*(["']*)([^"']*)\1/);
14358		return matches && matches[2] ? matches[2] : "document.pdf";
14359	}
14360
14361	/**
14362	 * @typedef {Object} PdfDetails
14363	 * @property {Blob} pdf - The PDF content.
14364	 * @property {string} fileName - The file name.
14365	 */
14366
14367	/**
14368	 * @returns {PdfDetails} The pdf file and a file name for it.
14369	 */
14370	async function getPdfForESignature() {
14371		const response = await fetch('displaypdf.aspx?save=false' + getExtraQString(), {
14372			credentials: 'include'
14373		});
14374		if (!response.ok) {
14375			throw new Error(`Request for esignature pdf error: ${response.status}`);
14376		}
14377		const pdf = await response.blob();
14378		const fileName = getPdfFileNameFromResponseHeaders(response.headers.get('Content-Disposition'));
14379		return {pdf, fileName};
14380	}
14381
14382	/**
14383	 * @returns {boolean} True if the new esign is supported for this country, false otherwise.
14384	 */
14385	function isNewEsignSupported() {
14386		const validCountryCodes = ["US", "CA", "GB", "AU", "IN"];
14387		const countryCode = getCountry();
14388		return validCountryCodes.includes(countryCode);
14389	}
14390
14391	/**
14392	 * Generates a PDF then sends the user to the new esign with that PDF.
14393	 */
14394	async function goToNewESign() {
14395		try{
14396			submitTrackedEvent("start", undefined, WebuserDataInfo.id, "esignature", false);
14397			var pdfDetails = await getPdfForESignature();
14398			navigateToNewESignature(pdfDetails.pdf, pdfDetails.fileName);
14399		} catch (error) {
14400			logErrorMessage(error.message, url_escape(location.href), null, url_escape(location.href), 'javascript_error.log');
14401			showGenericErrorDialog();
14402		}
14403	}
14404
14405	/**
14406	 * Go to legacy e-sign.
14407	 */
14408	function goToESignature() {
14409		location.href = "esignature.aspx?" + getExtraQString();
14410	}
14411
14412	/**
14413	 * Go from the e-sign process back to the page showing the document.
14414	 * 
14415	 * This function is set as an onclick action for some buttons by DCS. See https://dev.azure.com/LawDepot/LawDepot/_git/FrameworkWebApplication.DocumentCreation.DCSMain?path=/DCSMain/esignature.aspx&version=GCc67bbb87616da51099365b26645e52f24ea01485&line=23&lineEnd=24&lineStartColumn=1&lineEndColumn=1&lineStyle=plain&_a=contents
14416	 */
14417	function backToDocument(){
14418		location.href = "preview.aspx?" + getExtraQString();
14419	}
14420
14421	/**
14422	 * Removes any classes on the form that start with ESignature then applies the newly specified class.
14423	 * 
14424	 * Used by DCS to adjust styling based on the current e-sign state. See https://dev.azure.com/LawDepot/LawDepot/_git/FrameworkWebApplication.DocumentCreation.DCSMain?path=/DCSMain/esignature.aspx.cs&version=GCc67bbb87616da51099365b26645e52f24ea01485&line=739&lineEnd=740&lineStartColumn=1&lineEndColumn=1&lineStyle=plain&_a=contents
14425	 * 
14426	 * @param {string} cssClass The class to apply.
14427	 */
14428	function setESignatureFormClass(cssClass){
14429		$('form').removeClass(function(index,classes){
14430			var matches = classes.match(/\bESignature\S+/ig);
14431			return (matches) ? matches.join(' ') : '';
14432		});
14433		if(cssClass) $('form').addClass(cssClass);
14434	}
14435
14436	/**
14437	 * Update the text of a signature being previewed.
14438	 * 
14439	 * Used by DCS, see https://dev.azure.com/LawDepot/LawDepot/_git/Nuget.Contracts.Controls?path=/Controls/Content/SignaturePreview.cs&version=GCacc0526185ad13835b246f19357669528e98eebf&line=85&lineEnd=86&lineStartColumn=1&lineEndColumn=1&lineStyle=plain&_a=contents
14440	 * 
14441	 * @param {string} newValue The text of the signature.
14442	 * @param {string} id The id of the signature preview element.
14443	 */
14444	function updateSignaturePreview(newValue, id){
14445		$("#" + id + " .signaturePreviewDisplay").text(newValue);
14446	}
14447
14448	/**
14449	 * Creates confirmation dialog to sign a document as a given party.
14450	 * 
14451	 * Used by DCS, see https://dev.azure.com/LawDepot/LawDepot/_git/FrameworkWebApplication.DocumentCreation.DCSMain?path=/DCSMain/esignature.aspx.cs&version=GCc67bbb87616da51099365b26645e52f24ea01485&line=935&lineEnd=936&lineStartColumn=1&lineEndColumn=1&lineStyle=plain&_a=contents
14452	 * 
14453	 * @param {object} params The information about the potential signatory
14454	 * @param {bool} isInviter If the signature is for an inviter, or just a regular signature
14455	 * @param {string} partyName What party the user is attempting to sign as
14456	 */
14457	function Sign(params, isInviter, partyName){
14458		var text = "<div class=\"eSignatureConfirmIcon\"></div>";
14459		if(typeof(partyName) != "undefined" && partyName != null) text += "<div><p>Your name on the contract is listed as:</p><p>" + partyName + "</p></div>";
14460		text += "<div><p>Your signature is:</p><p>" + params.fullName + "</p></div><p>Your signature will be final after you confirm.</p>";
14461		confirmDialog(text, 
14462		{
14463			callback:function(result) {if(result) SignConfirmed(params, isInviter);},
14464			yesText:"Confirm",
14465			noText:"Cancel",
14466			title:"Confirm Signature",
14467			cssClass:"ESignatureConfirm ESignatureConfirmSignature",
14468			includeParagraph:false
14469		});
14470	}
14471
14472	/**
14473	 * Callback for when a signer has confirmed they are signing the document.
14474	 * 
14475	 * @param {object} params The information about the signatory
14476	 * @param {bool} isInviter If the signature is for an inviter, or just a regular signature
14477	 */
14478	function SignConfirmed(params, isInviter){
14479		AjaxWait();
14480		$.ajax({
14481			type: "POST",
14482			url: 'esignature.aspx/' + (isInviter ? 'CreatorSign' : 'PartySign'),
14483			data: JSON.stringify(params),
14484			contentType: "application/json",
14485			dataType: 'json',
14486			success: function(data, textStatus, req) {SignSuccess(data, textStatus, req, isInviter);},
14487			error: SignError
14488		});
14489	}
14490
14491	/**
14492	 * Callback for when a user has signed a document and the serer responded successfully.
14493	 * 
14494	 * @param data Data from the server.
14495	 * @param textStatus The request status.
14496	 * @param req The request.
14497	 * @param {bool} isInviter If the signature is for an inviter, or just a regular signature
14498	 */
14499	function SignSuccess(data, textStatus, req, isInviter){
14500		hideMessage();
14501		if(data.d.Success){
14502			var options = {
14503				cssClass:"ESignatureAlert",
14504				includeParagraph:false
14505			};
14506			var func = alert;
14507			if(isInviter && data.d.AnyToInvite){
14508				options = $.extend({
14509					callback:CreatorSignSuccessCallback,
14510					yesText:"Invite Others to Sign",
14511					noText:"I will invite others later",
14512					noClass:""
14513				}, options);
14514				func = confirmDialog;
14515			}
14516			else{
14517				options.callback = backToDocument;
14518			}
14519			var message = "You successfully signed the document.";
14520			if(data.d.AlreadySigned) message = "You have already signed the document.";
14521			else trackSignedEvent();
14522			func('<div class="eSignatureSuccessIcon"></div><p>' + message + '</p>', options); 
14523		}
14524		else{
14525			if(data.d.ErrorMessage) showESignatureError(data.d.ErrorMessage, window.location.href);
14526			else showGenericErrorDialog();
14527		}
14528	}
14529
14530	/**
14531	 * A callback for the prompt after an inviter signs asking if they will invite other people to sign immediately.
14532	 * 
14533	 * @param {boolean} result True if they have said they will invite other immediately.
14534	 */
14535	function CreatorSignSuccessCallback(result){
14536		if(result){
14537			AjaxWait();
14538			requestESignatures();
14539		}
14540		else backToDocument();
14541	}
14542
14543	/**
14544	 * The callback if there is an error when the user tries to sign a document.
14545	 * 
14546	 * @param {*} req The request.
14547	 * @param {*} textStatus The status of the response.
14548	 * @param {*} error The error message from the response.
14549	 */
14550	function SignError(req, textStatus, error){
14551		showGenericErrorDialog();
14552	}
14553
14554	/**
14555	 * @returns {boolean} True if the current page is a part of the legacy e-sign process.
14556	 */
14557	function isESignaturePage(){
14558		return window.location.pathname.search(/esignature\.aspx$/) >= 0;
14559	}
14560
14561	/**
14562	 * Checks if the current page is a legacy e-sign page
14563	 * 
14564	 * The legacyESign query string parameter is set by ACS pages when redirecting to a legacy e-sign page.
14565	 * 
14566	 * @returns {boolean} True if the current page is a legacy e-sign page, false otherwise
14567	 */
14568	function isLegacyESign() {
14569		return getQueryStringValue("legacyESign") === "true";
14570	}
14571
14572	/**
14573	 * Go to a particular part of the legacy e-sign process.
14574	 * 
14575	 * @param {string} viewName The page to view.
14576	 * @param {string} party The name of the relevant party, if any.
14577	 */
14578	function setESignatureView(viewName, party){
14579		AjaxWait();
14580		var partyInc = typeof(party) != "undefined" && party;
14581		if(isESignaturePage()) {
14582			if (partyInc) $('#hidParty').val(party);
14583			__doPostBack(qnh.PageID, "__" + viewName);
14584		}
14585		else postTo('esignature.aspx?PageView=' + viewName + (partyInc ? "&party=" + party : "") + getExtraQString());
14586	}
14587
14588	/**
14589	 * Send the user to the page for them to request esignatures.
14590	 * 
14591	 * This function is used by DCS, see
14592	 * - https://dev.azure.com/LawDepot/LawDepot/_git/Nuget.Contracts.Controls?path=/Controls/Preview/ContractMenu.cs&version=GCacc0526185ad13835b246f19357669528e98eebf&line=357&lineEnd=358&lineStartColumn=1&lineEndColumn=1&lineStyle=plain&_a=contents
14593	 * - https://dev.azure.com/LawDepot/LawDepot/_git/Nuget.Contracts.Controls?path=/Controls/Content/ESignaturePartyStatus.cs&version=GCacc0526185ad13835b246f19357669528e98eebf&line=46&lineEnd=47&lineStartColumn=1&lineEndColumn=1&lineStyle=plain&_a=contents
14594	 * 
14595	 * @param {string} party The party requesting e-signatures
14596	 */
14597	function requestESignatures(party){
14598		setESignatureView('ESignatureRequest', party);
14599	}
14600
14601	/**
14602	 * Send the user to sign the document as the creator.
14603	 * 
14604	 * This function is used by DCS, see
14605	 * - https://dev.azure.com/LawDepot/LawDepot/_git/Nuget.Contracts.Controls?path=/Control
14605s/Preview/ContractMenu.cs&version=GCacc0526185ad13835b246f19357669528e98eebf&line=330&lineEnd=331&lineStartColumn=1&lineEndColumn=1&lineStyle=plain&_a=contents
14606	 * - https://dev.azure.com/LawDepot/LawDepot/_git/Nuget.Contracts.Controls?path=/Controls/Content/ESignaturePartyStatus.cs&version=GCacc0526185ad13835b246f19357669528e98eebf&line=45&lineEnd=46&lineStartColumn=1&lineEndColumn=1&lineStyle=plain&_a=contents
14607	 */
14608	function creatorSignDocument(){
14609		setESignatureView('ESignatureCreatorSign');
14610	}
14611
14612	/**
14613	 * Send the user to the page that lets them see the details of the current e-signature process.
14614	 * 
14615	 * This function is used by DCS, see
14616	 * - https://dev.azure.com/LawDepot/LawDepot/_git/Nuget.Contracts.Controls?path=/Controls/Preview/ContractMenu.cs&version=GCacc0526185ad13835b246f19357669528e98eebf&line=342&lineEnd=343&lineStartColumn=1&lineEndColumn=1&lineStyle=plain&_a=contents
14617	 */
14618	function viewESignatureStatuses(){
14619		setESignatureView('ESignatureStatuses');
14620	}
14621
14622	/**
14623	 * Cancel an in progress e-signature on a document.
14624	 * 
14625	 * This function is used by DCS, see
14626	 * - https://dev.azure.com/LawDepot/LawDepot/_git/Nuget.Contracts.Controls?path=/Controls/Preview/ContractMenu.cs&version=GCacc0526185ad13835b246f19357669528e98eebf&line=385&lineEnd=386&lineStartColumn=1&lineEndColumn=1&lineStyle=plain&_a=contents
14627	 */
14628	function cancelESignature(){
14629		var dialogText;
14630		// Cancelling esign on a child document does not allow you to edit your submitted document. Inform accordingly.
14631		if(WebuserDataInfo.isMultiuserChildDocument){
14632			dialogText = "Cancelling the <span class=\'noWrap\'>E-Signature</span> Process will remove all electronic signatures.";
14633		}
14634		else {
14635			dialogText = "Cancelling the <span class=\'noWrap\'>E-Signature</span> Process will remove all electronic signatures and allow you to edit this document.";
14636		}
14637		confirmDialog("<div class=\"eSignatureCancelIcon\"></div><p>"+ dialogText +"</p><p>Do you wish to Cancel the <span class=\"noWrap\">E-Signature</span> Process?</p>", 
14638			{
14639				callback:cancelESignatureCallback,
14640				yesText:"Cancel <span class=\"noWrap\">E-Signature</span> Process",
14641				noText:"Do Not Cancel <span class=\"noWrap\">E-Signature</span> Process",
14642				title:"Notice",
14643				cssClass:"ESignatureConfirm",
14644				includeParagraph:false
14645			}
14646		);
14647	}
14648
14649	/**
14650	 * The callback after the user has been prompted to confirm cancelling the e-signature process.
14651	 * 
14652	 * @param {boolean} result True if the user confirmed they want to cancel their e-signature process.
14653	 */
14654	function cancelESignatureCallback(result){
14655		if(result){
14656			AjaxWait();
14657			submitTrackedEvent("cancel", undefined, WebuserDataInfo.id, "esignature", false);
14658			__doPostBack(qnh.PageID, "__CancelESignature");
14659		}
14660	}
14661
14662	/**
14663	 * Redirects the user to the ACS page from a legacy e-sign page if they are not on a in progress e-sign session.
14664	 * 
14665	 * This function assumes that the ACS page is at the canonical url for the product. If no canonical url is found, the function does nothing.
14666	 * 
14667	 * @returns {Promise<void>} A promise that resolves when the redirect is complete.
14668	 */
14669	async function redirectToAcsFromLegacyESign(){
14670		if(!isLegacyESign() || isInProgressLegacyESign()) {
14671			return;
14672		}
14673		// The Sequiter.Contracts.getCanonicalProductUrl is created via an IIFE that may not have run yet on page load, so we need to wait until it is defined.
14674		await waitUntil(() => Sequiter && Sequiter.Contracts && Sequiter.Contracts.getCanonicalProductUrl);
14675		const canonicalProductUrl = await Sequiter.Contracts.getCanonicalProductUrl(getCurrentProductCode(), getCountry());
14676		if(canonicalProductUrl){
14677			window.location.href = canonicalProductUrl;
14678		}
14679	}
14680	rE(window, "load", redirectToAcsFromLegacyESign);
14681
14682	/**
14683	 * Creates a promise that resolves when the condition function returns true.
14684	 * 
14685	 * @param {() => boolean} conditionFn A function that returns true when the condition is met.
14686	 * @param {Number} timeout The timeout in milliseconds.
14687	 * @param {Number} interval The interval in milliseconds.
14688	 * @returns {Promise<void>} A promise that resolves when the condition function returns true.
14689	 */
14690	function waitUntil(conditionFn, timeout = 1000, interval = 10) {
14691		return new Promise((resolve, reject) => {
14692			const intervalId = setInterval(() => {
14693				if (conditionFn()) {
14694					clearInterval(intervalId);
14695					resolve(true);
14696				}
14697			}, interval);
14698	  
14699			setTimeout(() => {
14700				clearInterval(intervalId);
14701				reject(new Error('Wait condition timed out'));
14702			}, timeout);
14703		});
14704	}  
14705
14706	/**
14707	 * @returns {boolean} True if the user is on a page with an active legacy e-sign process.
14708	 */
14709	function isInProgressLegacyESign(){
14710		return isESignaturePage() || isPreviewPageWithActiveESignature();
14711	}
14712
14713	/**
14714	 * @returns {boolean} True if the user is on a preview page with an active e-sign process.
14715	 */
14716	function isPreviewPageWithActiveESignature(){
14717		return window.location.pathname.indexOf("preview.aspx") >= 0
14718			// An invited signer will not have a change answers button at all.
14719			// The original user will have a disabled change answers button if e-sign is in progress, and an enabled one if it is not.
14720			// So as long as there is no enabled change answers button, we are on a preview page with an active e-sign process.
14721			&& $(".changeAnswers:not(.disabled)").length === 0;
14722	}
14723
14724	/**
14725	 * To be called on page load, this function removes the query string parameter indicating the the specific e-sign view to load.
14726	 * This is so that refreshing or bookmarking the page won't try to go to a view that may no longer be val
14726id.
14727	 */
14728	function clearESignatureViewQString(){
14729		if(isESignaturePage() && typeof(getQueryStringValue("PageView")) != "undefined" ){
14730			pushState({}, null, updateQueryStringParameter(location.search, "PageView", null), true);
14731		}
14732	}
14733	rE(window, "load", clearESignatureViewQString);
14734
14735	/**
14736	 * Displays a dialog indicating that people were successfully invited to sign a document.
14737	 * 
14738	 * This function is used by DCS, see
14739	 * - https://dev.azure.com/LawDepot/LawDepot/_git/FrameworkWebApplication.DocumentCreation.DCSMain?path=/DCSMain/esignature.aspx.cs&version=GCc67bbb87616da51099365b26645e52f24ea01485&line=1163&lineEnd=1164&lineStartColumn=1&lineEndColumn=1&lineStyle=plain&_a=contents
14740	 * 
14741	 * @param {*} parties The parties that were invited.
14742	 */
14743	function displayESignatureRequestedDialog(parties){
14744		var listItems = "";
14745		for(var i = 0; i < parties.length; ++i){
14746			listItems += "<li><span class=\"name\">" + parties[i].name + "</span><span class=\"email\">" + parties[i].email + "</span></li>";
14747		}
14748   		alert("<div class=\"eSignatureRequestedIcon icon\"></div><p>An Electronic Signature request has been sent to:</p><ul class=\"eSignatureRequestedParties\">" + listItems + "</ul>",
14749			{
14750				callback:backToDocument,
14751				includeParagraph: false,
14752				cssClass: "ESignatureRequested InvitesSentDialog"
14753			}
14754		);
14755	}
14756
14757	/**
14758	 * Animates the loading bar on the e-signature landing page.
14759	 * Used by PTS, see https://dev.azure.com/LawDepot/LawDepot/_git/MonetizeContent.PageTemplates?path=/ESignatureLoading.json&version=GC61b1b24cefc541e7a83541bf03a7dc247e0f95e2&line=14&lineEnd=15&lineStartColumn=1&lineEndColumn=1&lineStyle=plain&_a=contents
14760	 */
14761	function animateESignatureLoading(){
14762		$(".progressInner").animate({width:"100%"}, 6000, animateESignatureLoadingDone);
14763	}
14764
14765	/**
14766	 * The callback that is run once the e-signature loading animation is done.
14767	 */
14768	function animateESignatureLoadingDone(){
14769		var dest = getQueryStringValue("loadURL");
14770		location.href = dest ? decodeURIComponent(dest) : '/esignature/error/';
14771	}
14772
14773	/**
14774	 * Shows a dialog to users that have been invited to sign a document explaining the process to them.
14775	 * 
14776	 * This function is used by DCS, see
14777	 * - https://dev.azure.com/LawDepot/LawDepot/_git/Nuget.Contracts.Controls?path=/Controls/BaseProductPage.cs&version=GCacc0526185ad13835b246f19357669528e98eebf&line=958&lineEnd=959&lineStartColumn=1&lineEndColumn=1&lineStyle=plain&_a=contents
14778	 * 
14779	 * @param {string} message  An additional message for this particular situation, if any.
14780	 */
14781	function showESignatureInvitedAlert(message){
14782		if(typeof(message) != "undefined" && message) message = "<p>" + message + "</p>";
14783		alert("<div class=\"eSignatureRequestedIcon\"></div>" + message + "<p>With LegalContracts you can review the document below and sign it electronically by clicking on the <span class=\"noWrap\">E-Signature</span> button.</p>",
14784			{
14785				cssClass: "ESignatureAlert ESignaturePartyLandingAlert",
14786				title: "Welcome!",
14787				includeParagraph: false
14788			}
14789		);
14790	}
14791
14792	/**
14793	 * Display a confirmation dialog styled for use with e-signature.
14794	 * 
14795	 * @param {string} content The text to display in the dialog.
14796	 * @param {string} iconClass The class that will select the icon to use.
14797	 * @param {string} title The dialog title.
14798	 * @param {Function} action The action to take if the confirmation is affirmative.
14799	 * @param {string} yesText The text on the affirmative button.
14800	 * @param {string} noText The text on the negative button.
14801	 */
14802	function confirmESignature(content, iconClass, title, action, yesText, noText){
14803		confirmDialog("<div class=\"" + iconClass + "\"></div>" + content, 
14804			{
14805				callback: function(result) { if(result) { AjaxWait();action(); }},
14806				yesText: yesText,
14807				noText:noText,
14808				title:title,
14809				cssClass:"ESignatureConfirm",
14810				includeParagraph:false
14811			}
14812		);
14813	}
14814
14815	/**
14816	 * Display a dialog to confirm a change of some sort to the status of the e-sign process.
14817	 * 
14818	 * @param {string} partyName A party name, if applicable.
14819	 * @param {Function} action The action to take if the confirmation is affirmative.
14820	 * @param {string} iconClass The class that will select the icon to use.
14821	 * @param {string} title The dialog title.
14822	 * @param {string} text The text to display. An instances of "{0}" will be replaced with the partyName.
14823	 */
14824	function confirmESignatureStatusChange(partyName, action, iconClass, title, text){
14825		confirmESignature("<p>" + text.replace("{0}", partyName) + "</p>", iconClass, title, action, "Yes, Continue", "No, Go Back");
14826	}
14827
14828	/**
14829	 * Cancel a request for a person to sign as a particular party.
14830	 * 
14831	 * This function is used by DCS, see:
14832	 * - https://dev.azure.com/LawDepot/LawDepot/_git/Nuget.Contracts.Controls?path=/Control
14832s/Content/ESignaturePartyStatus.cs&version=GCacc0526185ad13835b246f19357669528e98eebf&line=43&lineEnd=44&lineStartColumn=1&lineEndColumn=1&lineStyle=plain&_a=contents
14833	 * 
14834	 * @param {string} partyName The party they were invited to sign as.
14835	 * @param {Function} action The action to take in order to cancel the request.
14836	 */
14837	function cancelESignatureRequest(partyName, action){
14838		confirmESignatureStatusChange(partyName, action, "eSignatureCancelRequestIcon", "Cancel E-Signature Request", "Do you wish to cancel the <span class=\"noWrap\">E-Signature</span> request to: <strong>{0}</strong>");
14839	}
14840
14841	/**
14842	 * Mark a party that will not be signing electronically.
14843	 * 
14844	 * @deprecated This function does not appear to be in use. Logging was added in March 2026. If revisiting this after at least March 2027 check for any instances of these logs and if none are found this can be safely removed.
14845	 * 
14846	 * @param {string} partyName The party that will not be signing electronically.
14847	 * @param {Function} action The action to take in order to complete marking the party this way.
14848	 */
14849	function markESignaturePaper(partyName, action){
14850		logErrorMessage("Deprecated function markESignaturePaper was called", "javascript_error.log");
14851		confirmESignatureStatusChange(partyName, action, "eSignaturePaperIcon", "Notice", "You are about to mark <strong>{0}</strong> as \'Signing on Paper\'. Do you want to proceed?");
14852	}
14853
14854	/**
14855	 * Clears the notification for a user that something has changed about the e-signature status for a document.
14856	 * 
14857	 * This function is used by DCS, see:
14858	 * - https://dev.azure.com/LawDepot/LawDepot/_git/Nuget.Contracts.Controls?path=/Controls/Preview/ContractMenu.cs&version=GCacc0526185ad13835b246f19357669528e98eebf&line=254&lineEnd=255&lineStartColumn=1&lineEndColumn=1&lineStyle=plain&_a=contents
14859	 * 
14860	 * @param {Date} date The date and time they are clearing the notification.
14861	 * @param {boolean} removeClass If the eSignatureNotification class should be removed, when false instead the "cleared" class is added.
14862	 */
14863	function clearESignatureNotification(date, removeClass){
14864		if(typeof(removeClass) != "boolean") removeClass = true;
14865		var li = $('.controls li.eSignature');
14866		if(li.hasClass('eSignatureNotification') && !li.hasClass('cleared')){
14867			if(removeClass) li.removeClass('eSignatureNotification');
14868			else li.addClass('cleared');
14869			CallDataService("ClearESignatureNotification", { webuserDataID: WebuserDataInfo.id, websiteLinkHash: getWebsiteLinkHash(), date: date });
14870		}
14871	}
14872
14873	/**
14874	 * @returns The website link hash from the query string, if there is one.
14875	 */
14876	function getWebsiteLinkHash(){
14877		var val = getQueryStringValue("l");
14878		return (typeof(val) != "undefined" ? val : null);
14879	}
14880
14881	/**
14882	 * Display an error related to the e-signature process.
14883	 * 
14884	 * This function is used by DCS, see:
14885	 * - https://dev.azure.com/LawDepot/LawDepot/_git/Nuget.Contracts.Controls?path=/Controls/BaseProductPage.cs&version=GCacc0526185ad13835b246f19357669528e98eebf&line=958&lineEnd=959&lineStartColumn=1&lineEndColumn=1&lineStyle=plain&_a=contents
14886	 * 
14887	 * @param {string} message The error to be displayed.
14888	 * @param {string} redirect The location to send the user when the acknowledge the error, if any.
14889	 */
14890	function showESignatureError(message, redirect){
14891		if(typeof(redirect) == "undefined") redirect = null;
14892		alert(message, {title:"Error", callback: function(){ if(redirect != null) location.href = redirect; }});
14893	}
14894
14895	/**
14896	 * Display a warning to a user about to cancel their subscription if that they have pending e-signature sessions.
14897	 * 
14898	 * This is used by MyAccount, see:
14899	 * - https://dev.azure.com/LawDepot/LawDepot/_git/FrameworkWebApplication.Accounts.MyAccount?path=/MyAccount/Content/Scripts/SubscriptionControl.js&version=GC73e1ad48b2554a0d5dfe9c5528bed7150fb1e732&line=313&lineEnd=314&lineStartColumn=1&lineEndColumn=1&lineStyle=plain&_a=contents
14900	 * 
14901	 * @param {boolean} immediate If this cancellation will be immediate.
14902	 * @param {string} endDate The date the subscription will be cancelled, already formatted for display to the user.
14903	 * @param {{Name: string}[]} pendingESignatures The pending e-signature sessions.
14904	 * @param {Function} callback The function to run if the user confirms they want to continue anyway.
14905	 */
14906	function showPendingESignatureSubscriptionConfirm(immediate, endDate, pendingESignatures, callback){
14907		var dialogContent = "<div class=\"eSignatureSubscriptionCancelIcon\"></div><p>";
14908		if(immediate) {
14909			dialogContent += "If you end your subscription now, your pending <span class=\"noWrap\">E-Signature</span> requests will be canceled.";
14910		}
14911		else {
14912			dialogContent += "You have until <strong>{0}</strong> to complete your pending <span class=\"noWrap\">E-Signatures</span>. If not complete by <strong>{0}</strong>, they will be canceled automatically.".replace(new RegExp("\\{0\\}", "g"), endDate);
14913		}
14914		dialogContent += "</p><ul class=\"pendingESignatures\">";
14915		for(var i = 0; i < pendingESignatures.length; ++i) {
14916			dialogContent += "<li><span class=\"name\">" + pendingESignatures[i].Name + "</span> <span class=\"status noWrap\"><span class=\"noWrap\">E-Signatures</span> Pending</span></li>";
14917		}
14918		dialogContent += "</ul><p class=\"question\">Do you still want to cancel?</p>";
14919		confirmDialog(dialogContent,
14920			{
14921				callback: callback,
14922				title: "Before You Go",
14923				cssClass: "ESignatureSubscriptionCancelWarning",
14924				includeParagraph:false,
14925				noText: "Do not Cancel Subscription",
14926				yesText: "Cancel Subscription",
14927				yesClass: "largeInactiveButton"
14928			}
14929		);
14930	}
14931
14932	/**
14933	 * Show a confirmation dialog to the user if they indicate they want to mark a document as complete.
14934	 * 
14935	 * This function is used by DCS, see:
14936	 * - https://dev.azure.com/LawDepot/LawDepot/_git/Nuget.Contracts.Controls?path=/Control
14936s/Preview/ContractMenu.cs&version=GCacc0526185ad13835b246f19357669528e98eebf&line=373&lineEnd=374&lineStartColumn=1&lineEndColumn=1&lineStyle=plain&_a=contents
14937	 * 
14938	 * @param {Function} action The action to take if the users confirms they want to continue.
14939	 */
14940	function confirmESignatureMarkAsComplete(action){
14941		confirmESignature(
14942			"<p>Once you mark as complete, you won\'t be able to send any further electronic signature requests. You will still be able to download and print the document and have the remaining parties sign by hand.</p><p class=\"question\">Do you wish to mark as complete?</p>",
14943			"eSignatureCompleteConfirmIcon",
14944			"Notice",
14945			action,
14946			"Yes, Mark as Complete",
14947			"No, Go Back"
14948		); 
14949	}
14950
14951	/**
14952	 * Displays a messaged to the user indicating they've successfully marked their document as complete.
14953	 * 
14954	 * This function is used by DCS, see:
14955	 * - https://dev.azure.com/LawDepot/LawDepot/_git/Nuget.Contracts.Controls?path=/Controls/BaseProductPage.cs&version=GCacc0526185ad13835b246f19357669528e98eebf&line=2321&lineEnd=2322&lineStartColumn=1&lineEndColumn=1&lineStyle=plain&_a=contents
14956	 */
14957	function doneESignatureMarkAsComplete(){
14958		alert("<div class=\"eSignatureCompleteAlertIcon\"></div><p>You successfully marked the document as complete!</p>",
14959			{
14960				cssClass: "ESignatureAlert",
14961				includeParagraph: false
14962			}
14963		);
14964	}
14965
14966	/**
14967	 * Warn a user that is attempting to delete a document that they have the e-signature process started or completed with that document.
14968	 * 
14969	 * This function is used by MyDocuments, see:
14970	 * - https://dev.azure.com/LawDepot/LawDepot/_git/FrameworkWebApplication.DocumentManagement.MyDocuments-LC?path=/MyDocuments-LC/Content/Scripts/mydocument.js&version=GC82e3c3002e7a96b02a2328a977bb8cb78fd267b7&line=857&lineEnd=858&lineStartColumn=1&lineEndColumn=1&lineStyle=plain&_a=contents
14971	 * 
14972	 * @param {Function} confirmedCallback The function to run if the user confirms they want to continue.
14973	 * @param {number} eSignStatus 
14974	 */
14975	function confirmESignatureDelete(confirmedCallback, eSignStatus){
14976		var text;
14977		if(eSignStatus == 1){
14978			text = "You have started an <span class=\"noWrap\">E-Signature</span> process for this document. If you delete this document, any E-Signature requests will be cancelled.";
14979		}
14980		else {
14981			text = "This document contains <span class=\"noWrap\">E-Signatures</span>. If you delete this document, you will delete all <span class=\"noWrap\">E-Signature</span> information associated with it."
14982		}
14983		confirmDialog("<div class=\"eSignatureDeleteIcon\"></div><p>" + text + "<p><p class=\"question\">Are you sure you want to delete this document?</p>",
14984			{
14985				callback: function(result) { if(result) confirmedCallback(); },
14986				title: "Before You Delete",
14987				cssClass: "ESignatureDeleteWarning",
14988				includeParagraph:false,
14989				yesText: "Delete",
14990				yesClass: "largeInactiveButton",
14991				noText: "Do Not Delete"
14992			}
14993		);
14994	}
14995
14996	/**
14997	 * Display an error dialog for when something has changed about the esignature making the attempted action not work.
14998	 * 
14999	 * This function is used by DCS, see:
15000	 * - https://dev.azure.com/LawDepot/LawDepot/_git/FrameworkWebApplication.DocumentCreation.DCSMain?path=/DCSMain/esignature.aspx.cs&version=GCc67bbb87616da51099365b26645e52f24ea01485&line=179&lineEnd=180&lineStartColumn=1&lineEndColumn=1&lineStyle=plain&_a=contents
15001	 * 
15002	 * @param {boolean} reload 
15003	 */
15004	function showESignatureChangedError(reload){
15005		if(typeof(reload) == "undefined") reload = false;
15006		var next = "You have been sent to an appropriate page to continue.";
15007		if(reload) next = "The page will be reloaded.";
15008		showESignatureError("This <span class=\"noWrap\">E-Signature</span> has been changed and you can no longer complete the action you attempted. " + next, reload ? window.location.href : null);
15009	}
15010
15011	/**
15012	 * Display an error dialog telling the user their access to perform an e-signature action has been removed.
15013	 * 
15014	 * This function is used by DCS, see:
15015	 * - https://dev.azure.com/LawDepot/LawDepot/_git/Nuget.Contracts.Controls?path=/Control
15015s/BaseProductPage.cs&version=GCacc0526185ad13835b246f19357669528e98eebf&line=985&lineEnd=986&lineStartColumn=1&lineEndColumn=1&lineStyle=plain&_a=contents
15016	 */
15017	function showESignatureAccessError(){
15018		showESignatureError("Your access to this page has changed and you can no longer complete the action you attempted. The page will be reloaded.", window.location.href);
15019	}
15020
15021	return { 
15022		startESignatureTrack, 
15023		startESignature, 
15024		warnSubscriptionESignatureStart,
15025		warnBlankPartiesESignature,
15026		startESignatureParty,
15027		backToDocument,
15028		setESignatureFormClass,
15029		updateSignaturePreview,
15030		Sign,
15031		requestESignatures,
15032		creatorSignDocument,
15033		viewESignatureStatuses,
15034		cancelESignature,
15035		displayESignatureRequestedDialog,
15036		animateESignatureLoading,
15037		showESignatureInvitedAlert,
15038		cancelESignatureRequest,
15039		markESignaturePaper,
15040		clearESignatureNotification,
15041		showESignatureError,
15042		showPendingESignatureSubscriptionConfirm,
15043		confirmESignatureMarkAsComplete,
15044		doneESignatureMarkAsComplete,
15045		confirmESignatureDelete,
15046		showESignatureChangedError,
15047		showESignatureAccessError,
15048		isLegacyESign,
15049	};
15050})();
15051
15052/**
15053 * @deprecated This variable has no apparent purpose. Logging was added in March 2026. If revisiting this after at least March 2027 check for any instances of these logs and if none are found this can be safely removed.
15054 */
15055var eSignPartyInfo;
15056
15057addEventListener("beforeunload", () => {
15058	if(eSignPartyInfo !== undefined) {
15059		logErrorMessage("Deprecated variable eSignPartyInfo was modified.");
15060	}
15061});
15062/* End Include esignature */
15063
15064/* Include affiliateWholesale */
15065/**********************************************
15066 * START ConnectedInvestors(affiliate site) Hacks. 
15067***********************************************/
15068if(typeof($) == "function"){ 
15069	if((window.location.hostname == 'affiliate' || window.location.hostname == 'qcaffiliate.lawdepot.com' || window.location.hostname == 'affiliate.lawdepot.com')
15070		&& getAffiliateCode() == '5QFHOMOOFB'
15071	) {
15072	   $(function(){
15073			if(typeof($) == 'function'){
15074				wholesaleRemoveFreeText();
15075				
15076				wholesaleChangeZoomResultsTo("ConnectedInvestors");
15077				
15078				wholesaleChangeBrandNameTo("ConnectedInvestors");
15079				
15080				wholesaleAddLogoTip('Click here to view all the legal documents you have created');
15081				
15082				wholesaleAlterPreviewText();
15083				
15084				wholesaleWarningHide();
15085
15086				wholesaleAlertWarningHide();
15087
15088				iFrameResizerDownsizeFix();
15089			}
15090		});
15091	}
15092}
15093/**********************************************
15094 * END ConnectedInvestors(affiliate site) Hacks. 
15095***********************************************/
15096
15097/**********************************************
15098 * START InvestForward Hacks. 
15099***********************************************/
15100if(typeof($) == "function"){ 
15101	if((window.location.hostname == 'affiliate' || window.location.hostname == 'qcaffiliate.lawdepot.com' || window.location.hostname == 'affiliate.lawdepot.com')
15102		&& getAffiliateCode() == 'PC1D6DMGPQ'
15103	) {
15104	   $(function(){
15105			if(typeof($) == 'function'){
15106				wholesaleRemoveFreeText();
15107				
15108				wholesaleChangeZoomResultsTo("Invest Forward");
15109				
15110				wholesaleChangeBrandNameTo("Invest Forward");
15111				
15112				wholesaleAddLogoTip('Click here to view all the legal documents you have created');
15113				
15114				wholesaleAlterPreviewText();
15115				
15116				wholesaleWarningHide();
15117			}
15118		});
15119	}
15120}
15121/**********************************************
15122 * END InvestForward Hacks. 
15123***********************************************/
15124
15125/**********************************************
15126 * START Tuque Inc Hacks. 
15127***********************************************/
15128if(typeof($) == "function"){ 
15129	if((window.location.hostname == 'affiliate' || window.location.hostname == 'qcaffiliate.lawdepot.com' || window.location.hostname == 'affiliate.lawdepot.com')
15130		&& getAffiliateCode() == '2ZT6CEUJXF'
15131	) {
15132	   $(function(){
15133			if(typeof($) == 'function'){
15134				wholesaleRemoveFreeText();
15135				
15136				wholesaleChangeZoomResultsTo("Tuque Inc.");
15137				
15138				wholesaleChangeBrandNameTo("Tuque Inc.");
15139				
15140				wholesaleAddLogoTip('Click here to view all the legal documents you have created');
15141				
15142				wholesaleAlterPreviewText();
15143				
15144				wholesaleWarningHide();
15145			}
15146		});
15147	}
15148}
15149/**********************************************
15150 * END ConnectedInvestors(affiliate site) Hacks. 
15151***********************************************/
15152
15153/**********************************************
15154 * START Zuby hacks. 
15155***********************************************/
15156if(typeof($) == "function"){ 
15157	if((window.location.hostname == 'affiliate' || window.location.hostname == 'qcaffiliate.lawdepot.com' || window.location.hostname == 'affiliate.lawdepot.com')
15158		&& getAffiliateCode() == 'LW77NCG3ZB'
15159	) {
15160	   $(function(){
15161			if(typeof($) == 'function'){
15162				$('html').addClass('zubyTheme');
15163				
15164				wholesaleRemoveFreeText();
15165				
15166				wholesaleChangeZoomResultsTo("Zuby");
15167				
15168				wholesaleChangeBrandNameTo("Zuby");
15169				
15170				wholesaleAddLogoTip('Click here to view all the legal documents you have created');
15171				
15172				wholesaleAlterPreviewText();
15173				
15174				wholesaleWarningHide();
15175			}
15176		});
15177	}
15178}
15179/**********************************************
15180 * END Zuby Hacks. 
15181***********************************************/
15182	   
15183/**********************************************
15184 * START ARAG hacks. 
15185***********************************************/
15186if(typeof($) == "function"){ 
15187	if((window.location.hostname == 'affiliate' || window.location.hostname == 'qcaffiliate.lawdepot.com' || window.location.hostname == 'affiliate.lawdepot.com')
15188		&& getAffiliateCode() == 'UC4WHHN8IH'
15189	) {
15190	   $(function(){
15191			if(typeof($) == 'function'){
15192				$('html').addClass('aragTheme');
15193				wholesaleRemoveFreeText();
15194				wholesaleChangeZoomResultsTo("ARAG");
15195				wholesaleChangeBrandNameTo("ARAG");
15196				wholesaleAddLogoTip('Click here to view all the legal documents you have created', {my: "left+15 center", at: "right bottom"});
15197				wholesaleAlterPreviewText();
15198				wholesaleWarningHide();
15199			}
15200		});
15201	}
15202}
15203/**********************************************
15204 * END ARAG Hacks. 
15205***********************************************/
15206
15207/**********************************************
15208 * START AAOA 
15209***********************************************/
15210if(typeof($) == "function"){ 
15211	if((window.location.hostname == 'affiliate' || window.location.hostname == 'qcaffiliate.lawdepot.com' || window.location.hostname == 'affiliate.lawdepot.com')
15212		&& getAffiliateCode() == 'EGFKUG7VK6'
15213	) {
15214	   $(function(){
15215			if(typeof($) == 'function'){
15216				$('html').addClass('aaoaTheme');
15217				wholesaleRemoveFreeText();
15218				wholesaleChangeZoomResultsTo("AAOA");
15219				wholesaleChangeBrandNameTo("AAOA");
15220				wholesaleAlterPreviewText();
15221				$("#logo_link a").attr("href", "https://www.american-apartment-owners-association.org/");
15222				
15223				/*Inject 'My Documents' button into the titleBar. Button should open My Documents dialog*/
15224				var myDocsButton ="<div class=\"bannerMyDocContainer\">";
15225				myDocsButton += "<a href='/MyDocuments/index.aspx' class=\"smallProceedButton\">";
15226				myDocsButton += "<span class=\"text\">My Documents</span>";
15227				myDocsButton += "</a></div>";
15228				$('#banner .desktopOnly .LDTopMenu').append(myDocsButton);
15229				
15230				wholesaleWarningHide();
15231
15232				removeNestedMenuItems([/Online Notary/,/Estate Vault™/,/Rental Property Hub/,/Sales & Loans Hub/,/Business Planning Hub/,/Parent & Guardian Hub/]);
15233			}
15234		});
15235	}
15236}
15237/**********************************************
15238 * END AAOA 
15239***********************************************/
15240
15241/**********************************************
15242 * START Assistenza 
15243***********************************************/
15244if(typeof($) == "function"){ 
15245	if((window.location.hostname == 'affiliate' || window.location.hostname == 'qcaffiliate.lawdepot.com' || window.location.hostname == 'affiliate.lawdepot.com')
15246		&& getAffiliateCode() == 'BNITNLKZP8'
15247	) {
15248	   $(function(){
15249			if(typeof($) == 'function'){
15250				$('html').addClass('assistenzaTheme');
15251				wholesaleRemoveFreeText();
15252				wholesaleChangeZoomResultsTo("Assistenza");
15253				wholesaleChangeBrandNameTo("Assistenza");
15254				wholesaleAddLogoTip('Click here to view all the legal documents you have created');
15255				wholesaleAlterPreviewText();
15256				
15257				var libraryButton ="";
15258				libraryButton += "<div class=\"affFooterLinkContainer\"><a class=\"affFooterLink\" href=\"/law-library/\">Law Library</a></div>";
15259				$('#footer').append(libraryButton);
15260				
15261				wholesaleWarningHide();
15262			}
15263		});
15264	}
15265}
15266/**********************************************
15267 * END Assistenza 
15268***********************************************/
15269
15270/**********************************************
15271 * START Infinite Financial  
15272***********************************************/
15273if(typeof($) == "function"){ 
15274	if((window.location.hostname == 'affiliate' || window.location.hostname == 'qcaffiliate.lawdepot.com' || window.location.hostname == 'affiliate.lawdepot.com')
15275		&& getAffiliateCode() == 'PM764T6G8J'
15276	) {
15277	   $(function(){
15278			if(typeof($) == 'function'){
15279				$('html').addClass('infiniteTheme');
15280				wholesaleRemoveFreeText();
15281				wholesaleChangeZoomResultsTo("Infinite Financial Inc.");
15282				wholesaleChangeBrandNameTo("Infinite Financial Inc.");
15283				wholesaleAddLogoTip('Click here to view all the legal documents you have created');
15284				wholesaleAlterPreviewText();
15285				wholesaleWarningHide();
15286			}
15287		});
15288	}
15289}
15290
15291/**********************************************
15292 * START DG Institute  
15293***********************************************/
15294if(typeof($) == "function"){ 
15295	if((window.location.hostname == 'affiliate' || window.location.hostname == 'qcaffiliate.lawdepot.com' || window.location.hostname == 'affiliate.lawdepot.com')
15296		&& getAffiliateCode() == 'STKGDG9SPA'
15297	) {
15298	   $(function(){
15299			if(typeof($) == 'function'){
15300				$('html').addClass('dgTheme');
15301				wholesaleRemoveFreeText();
15302				wholesaleChangeZoomResultsTo("DG Institute");
15303				wholesaleChangeBrandNameTo("DG Institute");
15304				wholesaleAddLogoTip('Click here to view all the legal documents you have created');
15305				wholesaleAlterPreviewText();
15306				wholesaleWarningHide();
15307			}
15308		});
15309	}
15310}
15311
15312/**********************************************
15313 * START Furnished Finder hacks. 
15314***********************************************/
15315if(typeof($) == "function"){ 
15316	if((window.location.hostname == 'affiliate' || window.location.hostname == 'qcaffiliate.lawdepot.com' || window.location.hostname == 'affiliate.lawdepot.com')
15317		&& getAffiliateCode() == 'AY28HLG49R'
15318	) {
15319	   $(function(){
15320			if(typeof($) == 'function'){
15321				$('html').addClass('ffTheme');
15322				wholesaleRemoveFreeText();
15323				wholesaleChangeZoomResultsTo("Furnished Finder");
15324				wholesaleChangeBrandNameTo("Furnished Finder");
15325				wholesaleAlterPreviewText();
15326				wholesaleWarningHide();
15327			}
15328		});
15329	}
15330}
15331
15332/**********************************************
15333 * START Honcho
15334***********************************************/
15335if(typeof($) == "function"){ 
15336	if((window.location.hostname == 'affiliate' || window.location.hostname == 'qcaffiliate.lawdepot.com' || window.location.hostname == 'affiliate.lawdepot.com')
15337		&& getAffiliateCode() == 'JBSR7TGA1F'
15338	) {
15339	   $(function(){
15340			if(typeof($) == 'function'){
15341				$('html').addClass('honchoTheme');
15342				wholesaleRemoveFreeText();
15343				wholesaleChangeZoomResultsTo("Honcho");
15344				wholesaleChangeBrandNameTo("Honcho");
15345				wholesaleAddLogoTip('Click here to view all the legal documents you have created');
15346				wholesaleAlterPreviewText();
15347				wholesaleWarningHide();
15348			}
15349		});
15350	}
15351}
15352
15353/**********************************************
15354 * START Bennett & Bennett Lawyers 
15355***********************************************/
15356if(typeof($) == "function"){ 
15357	if((window.location.hostname == 'affiliate' || window.location.hostname == 'qcaffiliate.lawdepot.com' || window.location.hostname == 'affiliate.lawdepot.com')
15358		&& getAffiliateCode() == 'MEFR73MVJW'
15359	) {
15360	   $(function(){
15361			if(typeof($) == 'function'){
15362				$('html').addClass('bbTheme');
15363				wholesaleRemoveFreeText();
15364				wholesaleChangeZoomResultsTo("Bennett & Bennett Lawyers");
15365				wholesaleChangeBrandNameTo("Bennett & Bennett Lawyers");
15366				wholesaleAddLogoTip('Click here to view all the legal documents you have created');
15367				wholesaleAlterPreviewText();
15368				wholesaleWarningHide();
15369			}
15370		});
15371	}
15372}
15373/**********************************************
15374 * END Bennett & Bennett Lawyers
15375***********************************************/
15376
15377/**********************************************
15378 * START LawPassport
15379***********************************************/
15380if(typeof($) == "function"){ 
15381	if((window.location.hostname == 'affiliate' || window.location.hostname == 'qcaffiliate.lawdepot.com' || window.location.hostname == 'affiliate.lawdepot.com')
15382		&& getAffiliateCode() == 'CH89KM1WQ3'
15383	) {
15384	   $(function(){
15385			if(typeof($) == 'function'){
15386				$('html').addClass('lawpassportTheme');
15387				wholesaleRemoveFreeText();
15388				wholesaleChangeZoomResultsTo("Law Passport");
15389				wholesaleChangeBrandNameTo("Law Passport");
15390				wholesaleAddLogoTip('Click here to view all the legal documents you have created');
15391				wholesaleAlterPreviewText();
15392				wholesaleWarningHide();
15393			}
15394		});
15395	}
15396}
15397/**********************************************
15398 * END LawPassport 
15399***********************************************/
15400
15401/**********************************************
15402 * START RentRisk
15403***********************************************/
15404if(typeof($) == "function"){ 
15405	if((window.location.hostname == 'affiliate' || window.location.hostname == 'qcaffiliate.lawdepot.com' || window.location.hostname == 'affiliate.lawdepot.com')
15406		&& getAffiliateCode() == 'UWVCF8ZLCG'
15407	) {
15408	   $(function(){
15409			if(typeof($) == 'function'){
15410				$('html').addClass('rentRiskTheme');
15411				wholesaleRemoveFreeText();
15412				wholesaleChangeZoomResultsTo("Rent Risk");
15413				wholesaleChangeBrandNameTo("Rent Risk");
15414				wholesaleAddLogoTip('Click here to view all the legal documents you have created');
15415				wholesaleAlterPreviewText();
15416
15417				var myDocsButton ="<div class=\"bannerMyDocContainer\">";
15418				myDocsButton += "<a href='/MyDocuments/index.aspx' class=\"smallProceedButton\">";
15419				myDocsButton += "<span class=\"text\">My Documents</span>";
15420				myDocsButton += "</a></div>";
15421				$('#banner .desktopOnly .LDTopMenu').append(myDocsButton);
15422
15423				wholesaleWarningHide();
15424				wholesaleAlertWarningHide();
15425
15426				removeNestedMenuItems([/Estate Vault™/, /Rental Property Hub/, /Commercial Lease Agreement/, /Quitclaim Deed/, new RegExp('Contract for Deed/Land Contract'), /More >>/]);
15427			}
15428		});
15429	}
15430}
15431/**********************************************
15432 * END RentRisk 
15433***********************************************/
15434
15435/**********************************************
15436 * START Affiliate prototype page 
15437***********************************************/
15438if(typeof($) == "function"){
15439	if((window.location.hostname == 'affiliate' || window.location.hostname == 'qcaffiliate.lawdepot.com' || window.location.hostname == 'affiliate.lawdepot.com')
15440		&& getAffiliateCode() == '43KMTLS3AJ'
15441	) {
15442	   $(function(){
15443			if(typeof($) == 'function'){
15444				wholesaleRemoveFreeText();
15445				wholesaleChangeZoomResultsTo("AffiliatePrototype");
15446				wholesaleChangeBrandNameTo("AffiliatePrototype");
15447				wholesaleAddLogoTip('Click here to view all the legal documents you have created');
15448				wholesaleAlterPreviewText();
15449				wholesaleWarningHide();
15450			}
15451		});
15452		$(function(){
15453			/*Inject 'My Documents' button into the titleBar. Button should open My Documents dialog*/
15454			var myDocsButton ="";
15455			myDocsButton += "<a href='/MyDocuments/index.aspx' class=\"smallProceedButton\">";
15456			myDocsButton += "<span class=\"text\">My Documents</span>";
15457			myDocsButton += "</a>";
15458			$('.contractPreviewWrapper .previewHead').prepend(myDocsButton);
15459		});
15460	}
15461}
15462/**********************************************
15463 * END Affiliate prototype Hacks. 
15464***********************************************/
15465
15466
15467/**********************************************
15468 * General Wholesale JS functions used by the above hacks 
15469***********************************************/
15470/*This removes mention of 'Free' from page text*/
15471function wholesaleRemoveFreeText(){
15472	$('#topIntroText').each(function() {
15473		var text = $(this).text();
15474		if(text.trim().match(/ for free.$/)){
15475			text = text.trim().substring(0, text.length-10);
15476			if(text.length > 0)
15477				text = text + ".";
15478			$(this).text(text);
15479		}			
15480	});
15481	$('.headerSimple > h1').each(function() {
15482		var text = $(this).text();
15483		text = text.trim().replace(/free/gi,'');
15484		$(this).parent().parent().prepend("<h1 class='lsTitle'>"+text+"</h1>");
15485		/*
15486			The reason the above line is the way it is is because the headers commonly use the value handler, which will overwrite any
15487			direct text changes to the h1s.  So instead we create a new header which is not using the value handler, and just hide the
15488			other headers through css.
15489		*/
15490	});
15491	/*Slate header replacement requires fewer parent nesting*/
15492	$('.inner-headerSlate > h1').each(function() {
15493		var text = $(this).text();
15494		text = text.trim().replace(/free/gi,'');
15495		$(this).parent().parent().parent().prepend("<h1 class='lsTitle'>"+text+"</h1>");
15496	});
15497}
15498
15499/*Replaces the LawDepot title*/ 
15500function wholesaleChangeZoomResultsTo(newTitle){
15501	$('#tblZoomResults .href_result_title').each(function() {
15502		var text = $(this).text();
15503		if(text.match(/LawDepot/)){
15504			text = text.replace("LawDepot", newTitle);
15505			$(this).text(text);
15506		}				
15507	});
15508}
15509
15510/*Changes the default affiliate.lawdepot 'AffiliateBrand' sitebrand string to appropriate sitebrand for the site*/
15511function wholesaleChangeBrandNameTo(sitebrand){
15512	$('.page_title, #about_link, #contentTopInnerTerms li, #contentTopInnerDisclaimer p, .ld_about h2, .ld_about span, #bannerNavAll').each(function() {
15513		var text = $(this).text();
15514		if(text.match(/AffiliateBrand/)){
15515			text = text.replace(/AffiliateBrand/g, sitebrand);
15516			$(this).text(text);
15517		}				
15518	});
15519}
15520
15521function wholesaleAddLogoTip(tipContent, posValues){
15522	if(typeof(posValues)==='undefined'){
15523		posValues = { my: "left center", at: "right center" };
15524	}
15525	if(cssua && cssua.ua && !cssua.ua.mobile){
15526		$('#logo_search').tooltip({
15527			items: '#logo_search',
15528			content:tipContent,
15529			show: null, 
15530			position: posValues
15531		});
15532	}
15533}
15534
15535/*Alters the purchase license text on preview page and removes the purchase button*/
15536function wholesaleAlterPreviewText(){
15537	$('.selLicense').empty();
15538	$('.selLicense').append('Your subscription access has expired.<br/>To download and print, you must renew your subscription.');
15539}
15540
15541/*JS to hide the cookie warnings. Remove after contracts are updated to newer DCS version.*/
15542function wholesaleWarningHide(){
15543	$('html').append("<style type='text/css'>div.SevereWarningDialog{display:none}</style>");
15544}
15545
15546/*JS to hide the cookie warning in an alert dialog.*/
15547function wholesaleAlertWarningHide(){
15548	$('html').append("<style type='text/css'>div.alertDialog{display:none}</style>");
15549}
15550
15551/*Remove min-height: 100vh on the contract wrapper to allow iframeResizer to downsize the iframe.*/
15552function iFrameResizerDownsizeFix(){
15553	$('html').append("<style type='text/css'>#wrapper{min-height:unset}</style>");
15554}
15555
15556/*Removes specific nested menu items from menu*/
15557function removeNestedMenuItems(nestedMenuItems) {
15558	$('li > a').each(function() {
15559		for (var i = 0; i < nestedMenuItems.length; i++) {
15560			if ($(this).text().match(nestedMenuItems[i])) {
15561				$(this).remove();
15562			}
15563		}
15564	});
15565}
15566/**********************************************
15567 * END General Wholesale JS functions 
15568***********************************************/
15569
15570/**********************************************
15571FOR Iframe Resizer on affiliate site
15572*************************************************/
15573
15574/* End Include affiliateWholesale */
15575
15576/* Include ajax2.0 */
15577// Determines if the current page needs to try and save before you leave it
15578var needSave = true;
15579var getVS = null;
15580var forceSave = false;
15581var forceSyncSave = false;
15582
15583/**
15584 * Setter for needSave
15585 * Bubbles up to parent windows if the current context is an iframe
15586 */
15587function setSave(val) {
15588	needSave = val;
15589	if (parent !== self) {
15590		try {
15591			if (typeof (parent.setSave) === "function") parent.setSave(val);
15592		}
15593		catch (e) {
15594		}
15595	}
15596}
15597function checkSave() {
15598	if (parent !== self) {
15599		try {
15600			if (typeof (parent.checkSave) === "function") return needSave && parent.checkSave();
15601		}
15602		catch (e) {
15603			// The expected exception here is that the parent is inaccessible, in that case just catch the exception and do nothing.
15604		}
15605	}
15606	return needSave;
15607}
15608
15609/**
15610 * 
15611 * @param {string} formName The id of the form to save the information of
15612 * @param {boolean} [save=true]
15613 * @param {boolean} [message=true]
15614 * @param {boolean} [forceSync=false]
15615 * @param {boolean} [forceAsync=false]
15616 * @param {httpRequestCallbackType} [callback] A function to call when the save request is fulfilled. 
15617 * @return {null}
15618 */
15619function saveASPAJAX(formName, save, message, forceSync, forceAsync, callback) {
15620	if (save === undefined) {
15621		save = true;
15622	}
15623	if (message === undefined) {
15624		message = true;
15625	}
15626	if (forceSync === undefined) {
15627		forceSync = false;
15628	}
15629	if (forceAsync === undefined) {
15630		forceAsync = false;
15631	}
15632	if (checkSave() || (!message && getVS === null)) {
15633		var form = gI(formName);
15634		if (forceSave || isModified(form) || (!message && getVS === null)) {
15635			var data = '';
15636			if (typeof ($) !== 'undefined') {
15637				if (typeof (window.clearPlaceholders) === "function") {
15638					window.clearPlaceholders();
15639				}
15640				data = $(form).serialize();
15641				if (typeof (window.resetPlaceholders) === "function") {
15642					window.resetPlaceholders();
15643				}
15644			}
15645			else {
15646				var eName = '';
15647				var type = '';
15648				for (var i = 0; i < form.length; i++) {
15649					eName = form.elements[i].name;
15650					type = form.elements[i].type;
15651
15652					if (eName && eName !== '' && eName !== '__EVENTTARGET' && eName !== '__EVENTARGUMENT' && type !== 'submit' && type !== 'clear' && type !== 'button' && ((type !== 'checkbox' && type !== 'radio') || form.elements[i].checked)) {
15653						data = data + escape(eName) + '=' + escape(form.elements[i].value).replace(new RegExp('\\+', 'g'), '%2b');
15654						if (i !== form.elements.length - 1) data = data + '&';
15655					}
15656				}
15657			}
15658
15659			var confirmRet = true;
15660			var async = forceAsync || (!forceSave && !forceSync && !isLoggedIn() && !forceSyncSave);
15661			if (save && checkSave() && __oldAnswers) {
15662				if (async) {
15663					//You have answers saved for an old version, but have made modifications on the new version. Saving these changes will over
15663write your answers for the old version. Would you like to save?
15664					confirmDialog("You have answers saved for an old version, but have made modifications on the new version. Saving these changes will overwrite your answers for the old version. Would you like to save?", {
15665						callback: function (value) {
15666							confirmRet = value;
15667							if (confirmRet) {
15668								__oldAnswers = false;
15669							}
15670							getVS = doSaveASPAJAX(data, message && confirmRet && !async, save && checkSave() && confirmRet, async, form, callback);
15671						}
15672					});
15673					return null;
15674				}
15675				else {
15676					/* Use the browser confirm when called synchronously, as it would be too much work to refactor this. */
15677					//You have answers saved for an old version, but have made modifications on the new version. Saving these changes will overwrite your answers for the old version. Would you like to save?
15678					confirmRet = _browserConfirm("You have answers saved for an old version, but have made modifications on the new version. Saving these changes will overwrite your answers for the old version. Would you like to save?");
15679					if (confirmRet) {
15680						__oldAnswers = false;
15681					}
15682				}
15683			}
15684			getVS = doSaveASPAJAX(data, (message && confirmRet && !async), (save && checkSave() && confirmRet), async, form, callback);
15685		}
15686	}
15687	return getVS;
15688}
15689
15690/**
15691 * Function that makes a request to the server to save data.
15692 * @param {string} data The data to save.
15693 * @param {boolean} showMessages If a message should be shown by this function.
15694 * @param {boolean} doSave If this is false instead of saving this just retreives a variable string from the server
15695 * @param {boolean} async If the save request should be asynchronous
15696 * @param {object} form The form element.
15697 * @param {httpRequestCallbackType} callback A function to call after the save is done.
15698 * @return {string}
15699 */
15700function doSaveASPAJAX(data, showMessages, doSave, async, form, callback) {
15701	var vs = '';
15702	data = "getVariableStringAjax=true&" + (doSave ? "doAjaxSave=true&" : "") + data;
15703	var action = form.action;
15704	if (action === '') action = window.location.href;
15705	var siteFamily = Sequiter.SiteConfig.GetConfigValue("site_family", "").toString();
15706
15707	if (async === false && !forceSyncSave && "sendBeacon" in navigator) {
15708
15709		if (showMessages) {
15710			showMessage('Saving your answers. Please wait.');
15711		}
15712
15713		var blob = new Blob([data], { type: "application/x-www-form-urlencoded" });
15714		var sent = navigator.sendBeacon(form.action, blob);
15715
15716		if (showMessages) {
15717			hideMessage();
15718		}
15719
15720		if (typeof (callback) === "function") {
15721			callback(null, null, sent);
15722		}
15723	} else {
15724		var xmlReq = getXmlHttpRequestObject();
15725
15726		xmlReq.onreadystatechange = function () {
15727			httpRequestCallback(xmlReq, function (req, success) {
15728				if (typeof (callback) === "function") {
15729					callback(req, null, success);
15730				}
15731				if (success && typeof (vh) !== "undefined") {
15732					vh.CC();
15733				}
15734			});
15735		};
15736
15737		if (showMessages) {
15738			showMessage('Saving your answers. Please wait.');
15739		}
15740
15741		xmlReq.open("POST", action, async);
15742		xmlReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
15743		xmlReq.send(data);
15744		if (typeof (__inputDefaultsSet) === 'function') {
15745			__inputDefaultsSet();
15746		}
15747
15748		if (showMessages) {
15749			hideMessage();
15750		}
15751
15752		if (xmlReq.readyState === 4 && xmlReq.status === 200 && xmlReq.responseText !== null) {
15753			vs = xmlReq.responseText;
15754		}
15755	}
15756
15757	if (async === false && !forceSyncSave && siteFamily === "LegalContracts") {
15758		var xmlReq = getXmlHttpRequestObject();
15759
15760		xmlReq.onreadystatechange = function () {
15761			httpRequestCallback(xmlReq, function (req, success) {
15762				if (typeof (callback) === "function") {
15763					callback(req, null, success);
15764				}
15765				if (success && typeof (vh) !== "undefined") {
15766					vh.CC();
15767				}
15768			});
15769		};
15770
15771		if (showMessages) {
15772			showMessage('Saving your answers. Please wait.');
15773		}
15774
15775		xmlReq.open("POST", action, async);
15776		xmlReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
15777		xmlReq.send(data);
15778		if (typeof (__inputDefaultsSet) === 'function') {
15779			__inputDefaultsSet();
15780		}
15781
15782		if (showMessages) {
15783			hideMessage();
15784		}
15785
15786		if (xmlReq.readyState === 4 && xmlReq.status === 200 && xmlReq.responseText !== null) {
15787			vs = xmlReq.responseText;
15788		}
15789	}
15790	return vs;
15791}
15792function encodeHTML(html) {
15793	encodedHtml = escape(html);
15794	return encodedHtml;
15795}
15796/**
15797 * If the current form elements on the page differ from what has been specified as the default value returns True,
15798 otherwise false. Since default values are set on page load and respect the users past answers for a question, this can
15799 only tell you if the answers differ from the most recent answer set, not if they differ from the DCS def default answers.
15800 * @param oForm
15801 * @param ignoreVH
15802 * @returns {boolean|*}
15803 */
15804function isModified(oForm, ignoreVH) {
15805	if (document.activeElement !== document.body) {
15806		$(document.activeElement).trigger("blur");
15807	}
15808	if (ignoreVH === undefined) {
15809		ignoreVH = false;
15810	}
15811	if (typeof (vh) !== "undefined" && vh !== null && vh.VS() > 0 && !ignoreVH) {
15812		return vh.HC();
15813	}
15814	else if (typeof (__inputDefaultsCheck) === 'function') {
15815		return __inputDefaultsCheck();
15816	}
15817	else if (typeof (oForm) !== "undefined") {
15818		var el, opt, hasDefault, i = 0, j;
15819		while ((el = oForm.elements[i++])) {
15820			switch (el.type) {
15821				case 'text':
15822				case 'textarea':
15823				case 'hidden':
15824					if (!/^\s*$/.test(el.value) && el.value !== el.defaultValue) return true;
15825					break;
15826				case 'checkbox':
15827				case 'radio':
15828					if (el.checked !== el.defaultChecked) return true;
15829					break;
15830				case 'select-one':
15831				case 'select-multiple':
15832					j = 0, hasDefault = false;
15833					while ((opt = el.options[j++]))
15834						if (opt.defaultSelected) hasDefault = true;
15835					j = hasDefault ? 0 : 1;
15836					while ((opt = el.options[j++]))
15837						if (opt.selected !== opt.defaultSelected) return true;
15838					break;
15839			}
15840		}
15841	}
15842	else {
15843		return true;
15844	}
15845	return false;
15846}
15847/**
15848 * In Internet Explorer, to create the object using new ActiveXObject("Msxml2.XMLHTTP") 
15849 * or new ActiveXObject("Microsoft.XMLHTTP")
15850 * depending on the version of MSXML installed. 
15851 * In Mozilla and Safari, you use new XMLHttpRequest()
15852 */
15853function getXmlHttpRequestObject() {
15854	if (window.XMLHttpRequest) {
15855		return new XMLHttpRequest();
15856	} else if (window.ActiveXObject) {
15857		return new ActiveXObject("Microsoft.XMLHTTP")
15858	} else {
15859		alert("can't make xmlhttprequest");
15860	}
15861}
15862/**
15863 * xmlData: xml data
15864 *   < ?xml version="1.0" encoding="UTF-8"? >
15865 *   <request>
15866 *      <command>save|load</command> 
15867 *      <SID>SecureID</SID> 
15868 *      <CID>contractIdentifier</CID>
15869 *      <saveName>name for this save</saveName>
15870 *      <section>what sort of info</section>
15871 *      <other>additional metadata</other>
15872 *      <html (or data)>
15873 *         Data to save (make sure it is escaped: you can use encodeHTML())
15874 *      </html (or data)>
15875 *   </request>
15876 * 
15877 * destinationURL: where to post data to.
15878 * 
15879 * statusIndicatorParent: parent of where you want the status indicator to go.
15880 *   It will be added using insertBefore() and you should dispose of it.
15881 * statusIndicatorParent is no longer used.
15882 *
15883 * statusText: what text you want in the status indicator.
15884 *
15885 * callbackFunc: what function needs to be called when the request is
15886 *   answered. The parameters are the request object followed by the status
15887 *   indicator object.
15888 *
15889 *   If passed in as null (false), it will initiate a synchronous httprequest
15890 */
15891function httpRequest(xmlData, destinationURL, statusIndicatorParent, statusText, callbackFunc, usePost, requireSID) {
15892	if (!requireSID || SID !== false) {
15893
15894		if (statusIndicatorParent && statusText)
15895			showMessage(statusText);
15896		var req = getXmlHttpRequestObject();
15897		// only required if last open param is missing or true
15898		if (typeof (callbackFunc) === "function") {
15899			if (statusIndicatorParent && statusText)
15900				hideMessage();
15901			req.onreadystatechange = function () { httpRequestCallback(req, callbackFunc); };
15902		}
15903		if (destinationURL) {
15904			req.open("POST", destinationURL, callbackFunc !== false);
15905			//POST variables to php code only
15906			if (typeof (usePost) === 'undefined' || usePost) {
15907				req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
15908
15909				if (cssua && cssua.ua && (cssua.ua.ie || cssua.ua.edge)) {
15910					req.setRequestHeader('Content-Length', xmlData.length);
15911					req.setRequestHeader('Connection', 'close');
15912				}
15913			}
15914			req.send(xmlData);
15915		}
15916		// If no destinationURL provided, log an error.
15917		// October 6, 2011 - Chris Poirier
15918		else {
15919			var date = new Date();
15920			var userData = '(SID="' + SID + '"';
15921			if (IP) userData += ', IP=' + IP;
15922			userData += ')';
15923			var postDataErr = 'log_file=' + escape('ajaxURL.err') + '&logged_data=' + escape('[' + date.toGMTString() + '] ' + userData + ' Destination URL empty in /common/scripts/m.js-includes/ajax2.0.js.');
15924			httpRequest(postDataErr, '/log_service.php', null, '', _donothing, true);
15925		}
15926	} else {
15927		alert("There was a problem reading your user ID. Please go to our contact page and notify technical support.");
15928	}
15929}
15930
15931/**
15932 * noop
15933 * @private
15934 * @deprecated use an empty function, or refactor consuming code to accept undefined as a noop callback
15935 */
15936function _donothing() { }
15937
15938/**
15939 * noop
15940 * @deprecated use an empty function, or refactor consuming code to accept undefined as a noop callback
15941 */
15942function checkSaveBlank() { }
15943
15944/**
15945 * @callback httpRequestCallbackType
15946 * @param {XMLHttpRequest} req
15947 * @param {null} _ this parameter is always null, and cannot be used for backwards compatibility
15948 * @param {boolean} success True if the request was successful (code===200). False otherwise
15949 */
15950/**
15951 * A convenience function to use as the callback for an xmlhttprequest (ajax) callback.
15952 * @param req
15953 * @param {httpRequestCallbackType} callbackFunc
15954 */
15955function httpRequestCallback(req, callbackFunc) {
15956	if (req && req.readyState === 4) {
15957		if (req && req.status === 200) {
15958			callbackFunc(req, null, true);
15959		} else {
15960			//alert("There was a problem transfering information ("+req.status+": "+req.statusText+")");
15961			callbackFunc(req, null, false);
15962		}
15963	}
15964}
15965function str2XML(str) {
15966	var xml;
15967	if (window.ActiveXObject) {
15968		xml = new ActiveXObject("MSXML2.DOMDocument");
15969		xml.loadXML(str);
15970		xml.setProperty("SelectionLanguage", "XPath");
15971	} else {
15972		xml = (new DOMParser).parseFromString(str, "text/xml");
15973	}
15974	return xml;
15975}
15976function FormToString(formID) {
15977	str = ''
15978
15979	var myForm = getForm(formID);
15980	var el = myForm.elements;
15981
15982	for (var elems = 0; elems < myForm.length; elems++) {
15983		if (el[elems].name !== "") {
15984			str += escape(el[elems].name) + '=';
15985			if (el[elems].type === "checkbox") {
15986				str += el[elems].checked;
15987			}
15988			else if (el[elems].type === "radio") {
15989				var radiogroup = el[el[elems].name];
15990				for (var j = 0; j < radiogroup.length; ++j) {
15991					if (radiogroup[j].checked) {
15992						str += radiogroup[j].value;
15993					}
15994				}
15995				elems = elems + radiogroup.length - 1;
15996			} else {
15997				str += escape(el[elems].value);
15998			}
15999			str += '&';
16000		}
16001	}
16002	return str;
16003}
16004/* End Include ajax2.0 */
16005
16006/* Include alert */
16007/* Alerts/Confirms */
16008function tryIsInDialog(includeFramed) {
16009	if (typeof(isInDialog) !== "function") return false;
16010	return isInDialog(includeFramed);
16011}
16012
16013var _browserAlert = window.alert;
16014/**
16015 * window.alert
16016 *  - Opens a jQuery alert dialog to display information to the user.
16017 *  - If jQuery is not availble, this uses the regular browser alert dialog.
16018 * @param {string}		text - The text to display
16019 * 
16020 * @param {Object}		[config={}] - An object with some configuration options
16021 * @param {string}		[config.buttonText="OK"] - The text to display in the button.
16022 *							- This is ignored if using the browser alert dialog.
16023 * @param {string}		[config.buttonClass="largeActiveButton"] - The CSS class to use for the button.
16024 *							- This is ignored if using the browser alert dialog.
16025 * @param {string}		[config.cssClass] - The additional CSS classes to apply to the entire dialog. 
16026 * 							- 'alertDialog' is always added	
16027 * @param {boolean}		[config.closeOnEscape=true] - If the dialog should close when the Escape key is pressed.
16028 *							- This is ignored if using the browser alert dialog.
16029 * @param {function}	[config.callback] - A function to call when the dialog is closed.
16030 * @param {bool}		[config.includeParagraph=true] - If paragraph tags should be included around the text.
16031 * @param {string}		[config.title="Success!"] - The header to use for the dialog window
16032 *							- Ignored if using the browser window dialog
16033 * @param {string}		[config.iconClass] - If set, a div will be prepended before the paragraph with this class set.
16034 * 							- The class should set styles/backgrounds/etc. for making an icon
16035 * @param {boolean}		[config.preserveScroll=false] - If set to true this will try to preserve the current scroll position 
16036 *							rather than opening the alert at the top of the page
16037 */
16038 window.alert = function (text, config) {
16039	/* Ensure this is called on the top window. */
16040	if (tryIsInDialog()) {
16041		parentPostMessage('alert:' + escapeForPostMessage(text) + (config ? ':' + stringifyForPostMessage(config) : ''));
16042	} else if (typeof ($) == "function") {
16043		var configObj = $.extend({
16044			buttonText: "OK",
16045			buttonClass: "largeActiveButton",
16046			closeOnEscape: true,
16047			callback: null,
16048			includeParagraph: true,
16049			title: "Success!",
16050			iconClass: null,
16051			preserveScroll: false
16052		}, config);
16053		var id = "alertDialog";
16054		if ($("#" + id).length) {
16055			var idX = 1;
16056			while ($("#" + id + idX).length) {
16057				idX++;
16058			}
16059			id += idX;
16060		}
16061		var dialogContent = "<div id='" + id + "'>" +
16062			(configObj.iconClass ? "<div class='" + configObj.iconClass + "'></div>" : "") +
16063			(configObj.includeParagraph ? "<p>" : "") +
16064			text +
16065			(configObj.includeParagraph ? "</p>" : "") +
16066			"<div><a class='" + configObj.buttonClass + "'>" +
16067			configObj.buttonText + "</a></div></div>";
16068		$(dialogContent)
16069			.dialog({
16070				draggable: false,
16071				resizable: false,
16072				modal: true,
16073				dialogClass: "alertDialog" + (configObj.preserveScroll ? " preserveScroll" : "") + (typeof (configObj.cssClass) != "undefined" ? " " + configObj.cssClass : ""),
16074				height: configObj.height ? configObj.height : "auto",
16075				width: configObj.width ? configObj.width : "auto",
16076				closeOnEscape: configObj.closeOnEscape,
16077				title: configObj.title ? configObj.title : null,
16078				close: function () {
16079					$(this).remove();
16080					OnDialogClose(true, false);
16081				},
16082				open: function () {
16083					OnDialogOpen(true, false, configObj.preserveScroll);
16084
16085					if ($("#alertDialog").closest(".alertDialog").hasClass("sharing-alert")) {
16086						resizeAlertDialogToFitContents();
16087					}
16088				}
16089			})
16090			.find("> div > a").on("click", function () {
16091				$("#" + id).dialog("close");
16092				if (typeof (configObj.callback) == "function") {
16093					configObj.callback();
16094				}
16095			})
16096			.parents(".ui-dialog-content")
16097			.css("max-height", "")
16098			.css("width", "");
16099	} else {
16100		_browserAlert(text);
16101		if (typeof (configObj.callback) == "function") {
16102			configObj.callback();
16103		}
16104	}
16105}
16106var _browserConfirm = window.confirm;
16107/* Log a message when the browser confirm function is used. */
16108window.confirm = function (text) {
16109	return _browserConfirm(text);
16110}
16111/**
16112 * - Opens a jQuery confirm dialog to present the user with a message and
16113 *   two or more buttons to choose from. It uses a callback function to
16114 *   pass the value clicked back to the code.
16115 * - If jQuery is not available, this uses the regular browser confirm dialog.
16116 * 
16117 * *** == Ignored if using the browser default confirm dialog
16118 * @param {string} text The text to display.
16119 * @param {object} config A configuration object
16120 * @param {string} [config.yesText] *** The text to display in the yes button. (default "Yes")
16121 * @param {string} [config.yesClass] *** The CSS class to use for the yes button. (default "largeActiveButton")
16122 * @param {string} [config.yesValue] *** The value of the yes button. (default true)
16123 * @param {string} [config.noText] *** The text to display in the no button. (default "No")
16124 * @param {string} [config.noClass] *** The CSS class to use for the no button. (default "largeInactiveButton")
16125 * @param {string} [config.noValue] *** The value of the no button. (default false)
16126 * @param {string} [config.width] *** The width of the dialog. (default auto)
16127 * @param {string} [config.title] *** The text to display as the header to the dialog box (default Success * @param {string} [config.cssClass] additional CSS classes to add to the dialog.
16128 * @param {array} [config.buttons] *** A list of buttons to override the default yes/no buttons. (default none)
16129 *  Each button is specified as an object with the following format
16130 *  { 
16131 * 		text - The text of the button.
16132 * 		value - The value of the button.
16133 * 		className - The CSS class of the button.
16134 *  }
16135 * @param {function} [config.callback] A function to call when the dialog is closed. (default none)
16136 * 	Will be used as callback(chosenValue), where chosenValue is the value of the option picked. 
16137 * 	If the value specified for that option is either "true" or "false", it will automatically be converted into a boolean. Otherwise it remains as a string
16138 * @param {boolean} [config.includeParagraph] If true, the text will be automatically wrapped in a paragraph tag. If false you should provide the tag yourself to appropriately identify the main text in the body. (default true)
16139 * @param {boolean}	[config.preserveScroll=false] - If set to true this will try to preserve the current scroll position rather than opening the alert at the top of the page
16140 */
16141window.confirmDialog = function (text, config) {
16142	/* Ensure this is called on the top window. */
16143	if (tryIsInDialog() && typeof (parent.confirmDialog) == "function") {
16144		parent.confirmDialog(text, config);
16145	}
16146	else if (typeof ($) == "function") {
16147		var configObj = $.extend({
16148			yesText: "Yes",
16149			yesClass: "largeActiveButton",
16150			yesValue: true,
16151			noText: "No",
16152			noClass: "largeInactiveButton",
16153			noValue: false,
16154			width: "auto",
16155			buttons: null,
16156			callback: null,
16157			includeParagraph: true,
16158			title: "Success!",
16159			cssClass: "",
16160			preserveScroll: false
16161		}, config);
16162		var id = "confirmDialog";
16163		if ($("#" + id).length) {
16164			var idX = 1;
16165			while ($("#" + id + idX).length) {
16166				idX++;
16167			}
16168			id += idX;
16169		}
16170		var buttons;
16171		if (configObj.buttons) {
16172			buttons = "";
16173			for (var i = 0; i < configObj.buttons.length; i++) {
16174				buttons += "<a class='" + configObj.buttons[i].className + "' data-value='" + configObj.buttons[i].value + "'>" + configObj.buttons[i].text + "</a>";
16175			}
16176		}
16177		else {
16178			buttons = "<a class='" + configObj.yesClass + "' data-value='" + configObj.yesValue + "'>" + configObj.yesText + "</a>"
16179				+ "<a class='" + configObj.noClass + "' data-value='" + configObj.noValue + "'>" + configObj.noText + "</a>";
16180		}
16181		$("<div id='" + id + "'>" + (configObj.includeParagraph ? "<p>" : "") + text + (configObj.includeParagraph ? "</p>" : "") + "<div class='buttons'>" + buttons + "</div></div>")
16182			.dialog({
16183				draggable: false,
16184				resizable: false,
16185				modal: true,
16186				dialogClass: "alertDialog confirmDialog" + (configObj.preserveScroll ? " preserveScroll" : "") + (typeof (configObj.cssClass) != "undefined" ? " " + configObj.cssClass : ""),
16187				height: "auto",
16188				width: configObj.width,
16189				closeOnEscape: false,
16190				title: configObj.title ? configObj.title : null,
16191				close: function () {
16192					$(this).remove();
16193					OnDialogClose(false, false);
16194				},
16195				open: function () {
16196					OnDialogOpen(false, false, configObj.preserveScroll);
16197				}
16198			})
16199			.find("> div > a")
16200			.on("click", function () {
16201				$("#" + id).dialog("close");
16202				if (typeof (configObj.callback) == "function") {
16203					var callbackValue = $(this).attr("data-value");
16204					if (callbackValue === "true") callbackValue = true;
16205					else if (callbackValue === "false") callbackValue = false;
16206					configObj.callback(callbackValue);
16207				}
16208			})
16209			.parents(".ui-dialog-content")
16210			.css("max-width", configObj.width == "auto" ? null : parseInt(configObj.width) + "px")
16211			.css("max-height", "")
16212			.css("width", "");
16213	}
16214	else {
16215		var conf = _browserConfirm(text);
16216		if (typeof (config.callback) == "function") {
16217			config.callback(conf);
16218		}
16219	}
16220}
16221
16222function resizeAlertDialogToFitContents() {
16223	try {
16224		var alertDialogHeight = $("#alertDialog").height() + 107;
16225		var windowHeight = $(window).height();
16226
16227		if (windowHeight < alertDialogHeight) {
16228			alertDialogHeight = windowHeight - 107;
16229			$("#alertDialog").css({ "height": alertDialogHeight, "max-height": alertDialogHeight, "overflow-y": "auto" });
16230			$("#alertDialog").addClass("fix-bottomspace");
16231		} else {
16232			$("#alertDialog").css({ "height": "auto", "max-height": "" });
16233			$("#alertDialog").removeClass("fix-bottomspace");
16234		}
16235
16236	}
16237	catch (err) {
16238	}
16239}
16240
16241$(window).on("resize", function () {
16242	if ($("#alertDialog").closest(".alertDialog").hasClass("sharing-alert")) {
16243		resizeAlertDialogToFitContents();
16244	}
16245});
16246/* End Alerts/Confirms */
16247
16248/* End Include alert */
16249
16250/* Include calloutBanner */
16251function Callouts(){}
16252(function(c){
16253   c.BannerContainers = {};
16254   c.RegisterBanner = function(containerName, containerID, position, bannerName, bannerID, visible){
16255      if(typeof(c.BannerContainers[containerName]) == "undefined") {
16256         c.BannerContainers[containerName] = {
16257            ID: containerID,
16258            Banners: []
16259         };
16260      }
16261      c.BannerContainers[containerName].Banners[position] = {
16262         Name: bannerName, 
16263         ID: bannerID,
16264         Visible: typeof(visible) == "function" ? visible : function() { return visibile; }
16265      };
16266   }
16267   c.UpdateAll = function(){
16268      for(var container in c.BannerContainers){
16269         c.Update(container, 0);
16270      }
16271   }
16272   c.Update = function(containerName, fadeTime, fadeEasing){
16273      /* Hide everything except for the first banner where visible is true */
16274      var toShow;
16275      var banners = c.BannerContainers[containerName].Banners;
16276      for(var i = 0; i < banners.length; ++i){
16277         if(banners[i] && banners[i].Visible()){
16278            toShow = banners[i].ID;
16279            break;
16280         }
16281      }
16282      if(typeof(fadeTime) == "undefined") fadeTime = 400;
16283      if(typeof(fadeEasing) == "undefined") fadeEasing = 'swing';
16284      var showFunc = function(){ $('#' + toShow).fadeIn(fadeTime, fadeEasing); };
16285      var current = $('#' + c.BannerContainers[containerName].ID + '>*:not(#' + toShow + ')').filter(":visible");
16286      if(current.length > 0) current.fadeOut(fadeTime, fadeEasing, showFunc);
16287      else showFunc();
16288   }
16289} (Callouts));
16290if(!registerPostStartUpScript(function(){Callouts.UpdateAll();})){registerOnLoadScript(function(){Callouts.UpdateAll();});}
16291/* End Include calloutBanner */
16292
16293/* Include ChangeLog */
16294/* Javascript support for loading a version from the change log.
16295 * This works for both questions and preview pages.
16296 * 
16297 * Last Modified: Dec 12, 2013 - Chris Poirier
16298 */
16299var _redirect_data = null;
16300var _redirect_dataItem = null;
16301function loadVersionRequest(dataItem) {
16302	if(dataItem) {
16303		var contractdetailsDiv=document.getElementById("contract");
16304		if(!contractdetailsDiv) {
16305			contractdetailsDiv = document.getElementById("contractdetails");
16306		}
16307		var callback = loadVersionCallback;
16308		_redirect_dataItem = dataItem;
16309
16310		var postData='change_id='+dataItem.change_id;
16311		httpRequest(postData,'/DataService/index.asmx/LoadChangeData',contractdetailsDiv,"Loading Version ...",callback,true);
16312   }
16313}
16314
16315function loadVersionCallback(req, statusInd, success){
16316	var contractdetailsDiv=document.getElementById("contract");
16317	var isPreviewPage = true;
16318	if(!contractdetailsDiv) {
16319		contractdetailsDiv = document.getElementById("contractdetails");
16320		isPreviewPage = false;
16321	}	
16322
16323	if(success) {
16324		if(req.responseText.length>0) {
16325			var respText = req.responseText;
16326			var start = respText.indexOf('<string');
16327			start = respText.indexOf('>', start);
16328			respText = respText.substring(start+1, respText.length-9).replace(/&amp;/ig, '&');
16329			_redirect_data = trimString(respText);
16330			var loc = _redirect_dataItem.country_code;
16331			if(_redirect_dataItem.contract_url == 'divorce' && _redirect_dataItem.other)
16332				loc += _redirect_dataItem.other;
16333
16334			var pathOrContract = _redirect_dataItem.path!=""? _redirect_dataItem.path :"contracts";
16335			var redirectURL = '/'+ pathOrContract +'/'+ _redirect_dataItem.contract_url + '/' + 
16336				(_redirect_dataItem.contract_url == 'divorce' ? 'index.aspx' : '') + 
16337				'?' + (isPreviewPage ? 'ViewResults=true&' : '') + 'loc='+loc;
16338			//postVersion(redirectURL, _redirect_data);
16339			//hidePopWin(false);
16340		    //return;
16341			checkOldUrlHistory(redirectURL, _redirect_data);
16342		}
16343	}
16344	else {
16345      alert("We are sorry, there was a problem loading your information from our server.\nPlease try refreshing the page.");
16346	}
16347	hidePopWin(false);
16348}
16349
16350//Redirect to old url
16351function checkOldUrlHistory(url, vs) {
16352    saveCurrentAnswers();
16353    var isOldUrl = url.search(new RegExp('/contracts/(.+?)-old/')) != -1;
16354    var isYudox = vs.indexOf("ver=yudox") != -1;
16355    if (isYudox) {
16356        if (isOldUrl)
16357            url = url.replace(new RegExp('/contracts/(.+?)-old/'), '/contracts/$1/');
16358        hidePopWin(false);
16359		postVersion(url, vs);
16360        
16361    }
16362    else {
16363        if (!isOldUrl) {
16364            _vs = vs;
16365            _url = url;
16366            _old_url = url.replace(new RegExp('/contracts/(.+?)/'), '/contracts/$1-old/');
16367            httpRequest("", _old_url, null, "", checkOldUrlCallbackHistory, true);
16368        }
16369        else {
16370            hidePopWin(false);
16371			postVersion(url, vs);            
16372        }
16373    }
16374}
16375
16376function checkOldUrlCallbackHistory(req, statusInd, success) {
16377    if (req.status == 200) {
16378        postVersion(_old_url, _vs);
16379    }
16380    else {
16381        postVersion(_url, _vs);
16382    }
16383    hidePopWin(false);
16384}
16385//---
16386
16387
16388function postVersion(url, vs) {
16389	var form = document.createElement('form');
16390	form.setAttribute('method', 'post');
16391	form.setAttribute('action', url);
16392
16393	var webuser_data_id = document.createElement('input');
16394	webuser_data_id.setAttribute('name', 'webuser_data_id');
16395	webuser_data_id.setAttribute('type', 'hidden');
16396	webuser_data_id.setAttribute('value', '');
16397	form.appendChild(webuser_data_id);
16398
16399	var data_type = document.createElement('input');
16400	data_type.setAttribute('name', 'dataType');
16401	data_type.setAttribute('type', 'hidden');
16402	data_type.setAttribute('value', '');
16403	form.appendChild(data_type);
16404
16405	var invoice_no = document.createElement('input');
16406	invoice_no.setAttribute('name', 'invoiceNo');
16407	invoice_no.setAttribute('type', 'hidden');
16408	invoice_no.setAttribute('value', '');
16409	form.appendChild(invoice_no);
16410
16411	var varstring = document.createElement('input');
16412	varstring.setAttribute('name', 'variablestring');
16413	varstring.setAttribute('type', 'hidden');
16414	varstring.setAttribute('value', vs.replace(/\&amp;/g, '&'));
16415	form.appendChild(varstring);
16416	
16417	var secure_id = document.createElement('input');
16418	secure_id.setAttribute('name', 'SID');
16419	secure_id.setAttribute('type', 'hidden');
16420	secure_id.setAttribute('value', SID);
16421	form.appendChild(secure_id);
16422
16423	document.body.appendChild(form);
16424	setLocationCookieBeforePostCL();
16425	form.submit();
16426}
16427
16428function setLocationCookieBeforePostCL() {
16429	var curLoc = getCookie("L");
16430	
16431	if(curLoc.substring(0,2) != _redirect_dataItem.country_code) {
16432		var loc = _redirect_dataItem.country_code;
16433		if(loc && _redirect_dataItem.other)
16434			loc += _redirect_dataItem.other;
16435		if(loc) {
16436         setCookie("L", loc, 365, true);
16437		}
16438	}
16439}
16440/* End Include ChangeLog */
16441
16442/* Include commonAnswerSharing */
16443/* Javascript support for loading answers from the current contract or a common
16444 * answer sharing contract. This works on both the questions and preview pages.
16445 *
16446 * Last Modified: Dec 5, 2013 - Chris Poirier
16447 */
16448var _redirect_PC = null;
16449var _redirect_data = null;
16450var _redirect_dataItem = null;
16451var _vs = null;
16452var _url = null;
16453var _old_url = null;
16454var _is_common_answers_load = false;
16455var gotoFirstTab = false;
16456var redirectToUrl
16457function loadCommonAnswersRequest(baseProductCode, targetProductCode, dataItem, isFirstTab, redirectUrl) {
16458    //always redirect to first tab from My document
16459    isFirstTab = isFirstTab || false;	
16460    gotoFirstTab = isFirstTab;
16461
16462	redirectUrl = redirectUrl ||"";
16463	redirectToUrl = redirectUrl;
16464
16465	if(baseProductCode && targetProductCode && dataItem) {
16466		var contractdetailsDiv=document.getElementById("contract");
16467		var isPreviewPage = true;
16468		if(!contractdetailsDiv) {
16469			contractdetailsDiv = document.getElementById("contractdetails");
16470			isPreviewPage = false;		
16471		}
16472		var isEditorPage = typeof(usingLDEditor) !== "undefined" && usingLDEditor ? true : false;
16473		
16474		var callback = loadCommonAnswersCallback;
16475		if(typeof(PC) == "undefined" || !PC || targetProductCode != PC || (dataItem.country_code != null && dataItem.country_code != dbcountry) || isPreviewPage || isEditorPage) {
16476			callback = loadCommonAnswersRedirect;
16477			_redirect_PC = targetProductCode;
16478		}
16479		_redirect_dataItem = dataItem;
16480
16481		if(baseProductCode != targetProductCode) {
16482			_is_common_answers_load = true;
16483			var postData='baseProductCode='+baseProductCode+'&targetProductCode='+targetProductCode+'&webuserDataDetailID='+dataItem.webuser_data_detail_id;
16484			httpRequest(postData,'/CommonAnswers/index.asmx/LoadCommonAnswers',contractdetailsDiv,"Loading Answers ...",callback,true);
16485		}
16486		else {
16487			var postData='webuser_data_id='+dataItem.webuser_data_id;
16488			httpRequest(postData,'/DataService/index.asmx/LoadAnswerVarstringComplete',contractdetailsDiv,"Loading Answers ...",callback,true);
16489		}
16490   }
16491}
16492
16493function loadCommonAnswersCallback(req, statusInd, success) {
16494    if (success) {
16495        if (req.responseText.length > 0) {
16496            var respText = req.responseText;
16497            var xml = str2XML(respText);
16498            if (xml.normalize)
16499                xml.normalize();
16500            var data = xml.getElementsByTagName("string")[0].firstChild;
16501            if (data) {
16502
16503                var url = top.location.href;
16504				
16505				//If license is present then go to preview page
16506				//Else go to first page
16507				var loadPreview = false				
16508				if (_redirect_dataItem.hasLicense && typeof _redirect_dataItem.hasLicense !== "undefined") {
16509					if(_redirect_dataItem.hasLicense == "True")
16510					{					
16511							loadPreview = true;		
16512							//URL to preview page	
16513							url = top.location.protocol +'//' + top.location.hostname + top.location.pathname + '?ViewResults=true';
16514					}
16515				}
16516				
16517				if(!loadPreview)
16518				{
16519					//Added to redirect to first tab for My document
16520					if (gotoFirstTab) {
16521						var tempUrl = url.split("#");
16522						if (tempUrl.length > 1) {
16523							url = tempUrl[0];
16524						}
16525					}
16526
16527					if (_redirect_dataItem.ldcn && typeof _redirect_dataItem.ldcn !== "undefined") {
16528						url += "&ldcn=" + _redirect_dataItem.ldcn;
16529					}
16530				}
16531				
16532				checkOldUrl(url, trimString(data.nodeValue));
16533			}
16534        }
16535    }
16536    else {
16537        alert("We are sorry, there was a problem loading your information from our server.\nPlease try refreshing the page.");
16538    }
16539    hidePopWin(false);
16540}
16541
16542//Used so we don't POST to .co.uk with a US country code and vice versea
16543function switchDomain(countryCode)
16544{
16545	if(redirectToUrl == "")
16546   {
16547		var host = location.hostname;
16548		var newHost = location.protocol + '//' + host;
16549		if(countryCode == 'GB')
16550		{
16551			if (host.indexOf('co.uk') == -1 && host.indexOf('.') != -1) 
16552         {
16553            newHost = location.protocol + '//' + host.substring(0, host.indexOf('.', host.indexOf('.') + 1) + 1) + 'co.uk';
16554         }
16555		}
16556		else if(host.indexOf('co.uk') != -1)
16557		{
16558         newHost = location.protocol + '//' + host.replace('co.uk', 'com');
16559		}		
16560	}
16561   else
16562   {
16563		newHost = location.protocol + '//' + redirectToUrl;
16564	}
16565
16566	return newHost;
16567}
16568
16569function loadCommonAnswersRedirect(req,statusInd,success){
16570	var contractdetailsDiv=document.getElementById("contract");
16571	var isPreviewPage = true;
16572	var usePreviewPage = false;
16573
16574	if(window.location.href.includes("incorporation-package-landing")){
16575		if(typeof _redirect_dataItem.is_service == "string" && _redirect_dataItem.is_service.toLowerCase() == "true" && _redirect_dataItem.invoice_no != "")
16576			usePreviewPage = true;
16577		if(!contractdetailsDiv) {
16578			contractdetailsDiv = document.getElementById("contractdetails");
16579			isPreviewPage = false;
16580		}	
16581	}
16582	else {usePreviewPage = true;}
16583   
16584	if(success) {
16585		if(req.responseText.length>0) {
16586			var respText = req.responseText;
16587			var xml = str2XML(respText);
16588			if(xml.normalize)
16589				xml.normalize();
16590			var data = xml.getElementsByTagName("string")[0].firstChild;
16591			if(data && _redirect_PC) {
16592				_redirect_data = trimString(data.nodeValue);
16593				var loc = _redirect_dataItem.country_code;
16594				if(_redirect_PC == 'DIVRCE' && _redirect_dataItem.other)
16595					loc += _redirect_dataItem.other;
16596				var host = switchDomain(_redirect_dataItem.country_code);
16597
16598				var ldcn = '';
16599				if (_redirect_dataItem.ldcn && typeof _redirect_dataItem.ldcn !== "undefined") {
16600				    ldcn = "&ldcn=" + _redirect_dataItem.ldcn;
16601				}
16602				
16603				if(window.location.href.includes("incorporation-package-landing")){
16604					//Set path for redirect to 'incorporation'
16605					_redirect_dataItem.path = _redirect_dataItem.path || "incorporation";
16606				}
16607
16608				var contractOrPath = !_redirect_dataItem.path?"/contracts/": "/" + _redirect_dataItem.path + "/";
16609				checkOldUrl(host + contractOrPath + _redirect_dataItem.contract_url + '/' + (_redirect_PC == 'DIVRCE' ? 'index.aspx' : '') + (pathContainsCountryCode(_redirect_dataItem.path) ? '' : '?loc=' + loc) + (isPreviewPage || usePreviewPage ? (pathContainsCountryCode(_redirect_dataItem.path) ? '?' : '&') + 'ViewResults=true' : '') + ldcn, _redirect_data);
16610			}
16611		}
16612	}
16613	else {
16614      alert("We are sorry, there was a problem loading your information from our server.\nPlease try refreshing the page.");
16615	}
16616	hidePopWin(false);
16617}
16618
16619function loadCommonAnswersRedirectCallback(req,statusInd,success){
16620	var contractdetailsDiv=document.getElementById("contract");
16621	var isPreviewPage = true;
16622	if(!contractdetailsDiv) {
16623		contractdetailsDiv = document.getElementById("contractdetails");
16624		isPreviewPage = false;
16625	}	
16626   
16627	if(success) {
16628		if(req.responseText.length>0) {
16629			var respText = req.responseText;
16630			var xml = str2XML(respText);
16631			if(xml.normalize)
16632				xml.normalize();
16633			var ci = xml.getElementsByTagName("string")[0].firstChild;
16634			if(ci && _redirect_data) {
16635				var loc = _redirect_dataItem.country_code;
16636				if(_redirect_PC == 'DIVRCE' && _redirect_dataItem.other)
16637					loc += _redirect_dataItem.other;
16638
16639				var contractOrPath = !_redirect_dataItem.path?"/contracts/": "/" + _redirect_dataItem.path + "/";
16640				checkOldUrl(contractOrPath + trimString(ci.nodeValue)+'/'+(_redirect_PC == 'DIVRCE' ? 'index.aspx' : '')+(pathContainsCountryCode(_redirect_dataItem.path) ? '' : '?loc=' + loc) +(isPreviewPage ? (pathContainsCountryCode(_redirect_dataItem.path) ? '?' : '&') + 'ViewResults=true' : ''), _redirect_data);
16641			}
16642		}
16643	}
16644	else {
16645      alert("We are sorry, there was a problem loading your information from our server.\nPlease try refreshing the page.");
16646	}
16647	hidePopWin(false);
16648}
16649
16650function checkOldUrl(url, vs)
16651{	
16652	saveCurrentAnswers();
16653	var isOldUrl = url.search(new RegExp('/contracts/(.+?)-old/')) != -1;
16654	var isYudox = vs.indexOf("ver=yudox") != -1;
16655	if(_is_common_answers_load)
16656	{
16657		postVariableString(url,vs);
16658	}
16659	else if(isYudox)
16660	{
16661		if(isOldUrl)
16662			url = url.replace(new RegExp('/contracts/(.+?)-old/'), '/contracts/$1/');			
16663			hidePopWin(false);
16664			postVariableString(url,vs);
16665					
16666	}
16667	else
16668	{
16669		if(!isOldUrl)
16670		{
16671			_vs = vs;
16672			_url = url;
16673			_old_url = url.replace(new RegExp('/contracts/(.+?)/'), '/contracts/$1-old/');
16674			if(_old_url.indexOf('?') != -1)
16675			{
16676				if(_old_url.substring(_old_url.length -1) != '?')
16677				{
16678					if(_old_url.substring(_old_url.length -1) != '&')
16679						_old_url += '&';
16680				}
16681			}
16682			else
16683			{
16684				_old_url += '?';
16685			}
16686			_old_url += 'oldContractCheck=true';
16687			var tempURL = _old_url;
16688			if(_old_url.indexOf('http') == 0 && _old_url.indexOf(location.host) == -1)
16689			{
16690				tempURL = location.protocol + '//' + location.host + '/urlStatusChecker.php?url=' + encodeURIComponent(tempURL);				
16691			}
16692			httpRequest("",tempURL,null,"",checkOldUrlCallback,true);
16693		}
16694		else
16695		{
16696			hidePopWin(false);
16697			postVariableString(url,vs);			
16698		}
16699	}
16700}
16701
16702function pathContainsCountryCode(path){
16703	if (typeof path !== 'undefined'){
16704		if (path.length == 2) return true;
16705		var pathSplit = path.split('-');
16706		if (pathSplit.length > 1){
16707			if (pathSplit[1].length == 2) return true;
16708		}
16709	}
16710	return false;
16711}
16712
16713function saveCurrentAnswers()
16714{
16715	if(typeof checkSave == 'function' && checkSave() && typeof saveData == 'function')
16716	{
16717		saveData();
16718		setSave(false);
16719	}
16720	else if(typeof saveReq == 'boolean' && saveReq && typeof contractIdentifier == 'string' && typeof saveWorkingAnswers == 'function')
16721	{
16722		saveWorkingAnswers(contractIdentifier);
16723		setSave(false);
16724	}
16725}
16726
16727function checkOldUrlCallback(req,statusInd,success)
16728{
16729	if(req.status == 200 && req.responseText.search(/^[0-9][0-9][0-9]/) == -1 || req.responseText == "200")
16730	{
16731		postVariableString(_old_url, _vs);
16732	}
16733	else
16734	{
16735		postVariableString(_url, _vs);
16736	}
16737	hidePopWin(false);
16738}
16739
16740function postVariableString(url, vs) {
16741	var form = document.createElement('form');
16742	form.setAttribute('method', 'post');
16743	form.setAttribute('action', url);
16744
16745	if(!_is_common_answers_load) {
16746		var webuser_data_id = document.createElement('input');
16747		webuser_data_id.setAttribute('name', 'webuser_data_id');
16748		webuser_data_id.setAttribute('type', 'hidden');
16749		webuser_data_id.setAttribute('value', _redirect_dataItem.webuser_data_id);
16750		form.appendChild(webuser_data_id);
16751
16752		var wdid = document.createElement('input');
16753		wdid.setAttribute('name', 'wdid');
16754		wdid.setAttribute('type', 'hidden');
16755		wdid.setAttribute('value', _redirect_dataItem.webuser_data_id);
16756		form.appendChild(wdid);
16757
16758		var data_type = document.createElement('input');
16759		data_type.setAttribute('name', 'dataType');
16760		data_type.setAttribute('type', 'hidden');
16761		data_type.setAttribute('value', _redirect_dataItem.data_type);
16762		form.appendChild(data_type);
16763
16764		var invoice_no = document.createElement('input');
16765		invoice_no.setAttribute('name', 'invoiceNo');
16766		invoice_no.setAttribute('type', 'hidden');
16767		invoice_no.setAttribute('value', _redirect_dataItem.invoice_no);
16768		form.appendChild(invoice_no);
16769	}
16770
16771	var varstring = document.createElement('input');
16772	varstring.setAttribute('name', 'variablestring');
16773	varstring.setAttribute('type', 'hidden');
16774	varstring.setAttribute('value', vs.replace(/\&amp;/g, '&'));
16775	form.appendChild(varstring);
16776	
16777	var secure_id = document.createElement('input');
16778	secure_id.setAttribute('name', 'SID');
16779	secure_id.setAttribute('type', 'hidden');
16780	secure_id.setAttribute('value', SID);
16781	form.appendChild(secure_id);
16782
16783	document.body.appendChild(form);	
16784	form.submit();
16785
16786	if(typeof(hideMessage) == "function" && typeof(cssua) != "undefined" && cssua.ua.safari && (cssua.ua.ios || cssua.ua.mac_os_x)){
16787		hideMessage();
16788	}
16789}
16790
16791function setLocationCookieBeforePost() {
16792	var curLoc = getCookie("L");
16793	
16794	if(curLoc.substring(0,2) != _redirect_dataItem.country_code) {
16795		var loc = _redirect_dataItem.country_code;
16796		if(loc && _redirect_dataItem.other)
16797			loc += _redirect_dataItem.other;
16798		if(loc) {
16799         setCookie("L", loc, 365, true);
16800		}
16801	}
16802}
16803/* End Include commonAnswerSharing */
16804
16805/* Include contacts */
16806/* The contacts for the user */
16807if(typeof(window._contactItems) == "undefined") {
16808   window._contactItems = {};
16809}
16810
16811/* Set the given control to the given contact */
16812function setContactInfo(contact_id, contact_control_id) {
16813   var contactFields = _contactFields[contact_control_id];
16814   if(contactFields) {
16815      var hiddenID = $("#"+contact_control_id+"_hidContactId");
16816      if(contact_id && _contactItems["c"+contact_id]) {
16817         if(hiddenID.length > 0) {
16818            hiddenID.val(contact_id);
16819         }
16820         var contact = _contactItems["c"+contact_id];
16821         for(var i=0; i<contactFields.length; i++) {
16822            var field = contactFields[i];
16823            var valueToSet = contact[field["dbFieldName"]];
16824            if(field["dbFieldName"] == "region") {
16825               var country=contact["country"];
16826               if(!country) {
16827                  country = (_forceCurrentCountry_C[contact_control_id] ? dbcountry : '');
16828               }
16829               setValue_RDDFI(field["id"], contact[field["dbFieldName"]], country, contact["region_name"]);
16830               setActiveCountry_RDDFI(field["id"], country);
16831            }
16832            else if(field["dbFieldName"] == "country" && !_forceCurrentCountry_C[contact_control_id]) {
16833               setValue_CDDFI(field["id"], contact[field["dbFieldName"]]);
16834            }
16835            else if(field["dbFieldName"] == "type" && _typeQuestionValues_C[contact_control_id]) {
16836               if(contact[field["dbFieldName"]] == "Corporation") {
16837                  $("*[name=\""+field["name"] + "\"]").val([_typeQuestionValues_C[contact_control_id].Corporation]);
16838                  valueToSet = _typeQuestionValues_C[contact_control_id].Corporation;
16839               }
16840               else {
16841                  $("*[name=\""+field["name"] + "\"]").val([value = _typeQuestionValues_C[contact_control_id].Individual]);
16842                  valueToSet = _typeQuestionValues_C[contact_control_id].Individual;
16843               }
16844            }
16845            else if($("#"+field["id"]).length > 0 && !($("#"+field["id"])[0].nodeName == "INPUT" && $("#"+field["id"])[0].type == "hidden")) {
16846               $("#"+field["id"]).val(contact[field["dbFieldName"]]);
16847            }
16848            vh.S(field["prefix"], valueToSet);
16849         }
16850         setSaveDisplayState(contact_control_id, "Update", false, false);
16851      }
16852      else {
16853         if(hiddenID.length > 0) {
16854            hiddenID.val("");
16855         }
16856         for(var i=0; i<contactFields.length; i++) {
16857            var field = contactFields[i];
16858            var valueToSet = field["defaultValue"];
16859            if(field["dbFieldName"] == "region") {
16860               var isPageRegion = _isPageRegion_RDDFI[field["id"]];
16861               var country=dbcountry;
16862               if(!_forceCurrentCountry_C[contact_control_id]) {
16863                  country = '';
16864               }
16865               setValue_RDDFI(field["id"], isPageRegion ? dbregion : field["defaultValue"], country, "");
16866               valueToSet = isPageRegion ? dbregion : field["defaultValue"];
16867               setActiveCountry_RDDFI(field["id"], country);
16868            }
16869            else if(field["dbFieldName"] == "country" && !_forceCurrentCountry_C[contact_control_id]) {
16870               setValue_CDDFI(field["id"], field["defaultValue"]);
16871            }
16872            else if($("#"+field["id"]).length > 0 && !($("#"+field["id"])[0].nodeName == "INPUT" && $("#"+field["id"])[0].type == "hidden")) {
16873               $("#"+field["id"]).val(field["defaultValue"]);
16874            }
16875            vh.S(field["prefix"], valueToSet);
16876         }
16877         setSaveDisplayState(contact_control_id, "Save", false, false);
16878      }
16879   }
16880}
16881
16882/* Check if the given control has been edited */
16883function setContactInfoEdited(contact_control_id) {
16884   var contactFields = _contactFields[contact_control_id];
16885   if(contactFields) {
16886      var hiddenID = $("#"+contact_control_id+"_hidContactId");
16887      if(hiddenID.length > 0 && hiddenID.val() && _contactItems["c"+hiddenID.val()]) {
16888         var contact = _contactItems["c"+hiddenID.val()];
16889         var contactEdited = false;
16890         var nameEdited = false;
16891         for(var i=0; i<contactFields.length; i++) {
16892            var field = contactFields[i];
16893            var value = vh.G(field["prefix"]);
16894            if(field["dbFieldName"] == "region") {
16895               var id = getID_RDDFI(field["id"]);
16896               var id_hid = getID_RDDFI(field["id"], null, true);
16897               value = $("#"+id).val();
16898               if(id != id_hid && value != contact["region_name"]) {
16899                  $("#"+id_hid).val("");
16900               }
16901               else if(id != id_hid) {
16902                  value = $("#"+id_hid).val();
16903               }
16904               if(value == "sel") {
16905                  value = "";
16906               }
16907            }
16908            else if(field["dbFieldName"] == "country" && !_forceCurrentCountry_C[contact_control_id]) {
16909               var id = getID_CDDFI(field["id"]);
16910               value = $("#"+id).val();
16911            }
16912            else if(field["dbFieldName"] == "type" && _typeQuestionValues_C[contact_control_id]) {
16913               if(value == _typeQuestionValues_C[contact_control_id].Corporation) {
16914                  value = "Corporation";
16915               }
16916               else {
16917                  value = "Individual";
16918               }
16919            }
16920            if(value != contact[field["dbFieldName"]]) {
16921               contactEdited = true;
16922               if(field["dbFieldName"] == "name") {
16923                  nameEdited = true;
16924               }
16925            }
16926         }
16927         if(contactEdited && nameEdited) {
16928            setSaveDisplayState(contact_control_id, "All", true, true);
16929         }
16930         else if(contactEdited) {
16931            setSaveDisplayState(contact_control_id, "Update", true, true);
16932         }
16933         else {
16934            setSaveDisplayState(contact_control_id, "Update", false, false);
16935         }
16936      }
16937      else {
16938         var nameEdited = false;
16939         for(var i=0; i<contactFields.length; i++) {
16940            var field = contactFields[i];
16941            var value = vh.G(field["prefix"]);
16942            if(value != "" && field["dbFieldName"] == "name") {
16943               nameEdited = true;
16944            }
16945         }
16946         if(nameEdited) {
16947            setSaveDisplayState(contact_control_id, "Save", true, true);
16948         }
16949         else {
16950            setSaveDisplayState(contact_control_id, "Save", false, false);
16951         }
16952      }
16953   }
16954}
16955
16956/* Register the event for setContactInfoEdited on a control */
16957function registerSetContactInfoEdited(input_id, contact_control_id) {
16958   if(input_id && $("#"+input_id).length > 0
16959         && ($("#"+input_id)[0].nodeName.toLowerCase() == "select" || $("#"+input_id)[0].nodeName.toLowerCase() == "input")) 
16960   {
16961      var input = $("#"+input_id);
16962      if(input[0].nodeName.toLowerCase() == "select") {
16963         input.on("change", function(){setContactInfoEdited(contact_control_id);});
16964      }
16965      else if(input[0].nodeName.toLowerCase() == "input") {
16966         input.on("blur", function(){setContactInfoEdited(contact_control_id);});
16967      }
16968   }
16969   else {
16970      var control_id = input_id.substring(0, input_id.lastIndexOf("_"));
16971      if($("#"+control_id).length > 0 && ($("#"+control_id+" input[type='text']").length > 0 || $("#"+control_id+" select").length > 0)) {
16972         var isRegion = false;
16973         if(typeof(_dropdownRegions_RDDFI) != "undefined" && typeof(_dropdownRegions_RDDFI[input_id]) != "undefined") {
16974            isRegion = true;
16975         }
16976         var ids = [];
16977         if(isRegion && typeof(getIDs_RDDFI) == "function") {
16978            ids = getIDs_RDDFI(input_id);
16979         }
16980         else if(typeof(getIDs_CDDFI) == "function") {
16981            ids = getIDs_CDDFI(input_id);
16982         }
16983         if(ids && ids.length > 0) {
16984            for(var i=0; i<ids.length; i++) {
16985               var input = $("#"+ids[i]);
16986               if(input.length > 0) {
16987                  if(input[0].nodeName.toLowerCase() == "select") {
16988                     input.on("change", function(){setContactInfoEdited(contact_control_id);});
16989                  }
16990                  else if(input[0].nodeName.toLowerCase() == "input") {
16991                     input.on("blur", function(){setContactInfoEdited(contact_control_id);});
16992                  }
16993               }
16994            }
16995         }
16996      }
16997   }
16998}
16999
17000/* Set the state (Save, Update or All), visibility and checked values for the save checkbox */
17001function setSaveDisplayState(contact_control_id, state, visible, checked) {
17002   var checkbox = $("#"+contact_control_id+"_chkSave");
17003   var checkboxDiv = $("#"+contact_control_id+"_pnlCheck");
17004   var radioList = $("#"+contact_control_id+"_rbSave");
17005   var radios = $("#"+contact_control_id+"_rbSave input[type='radio']");
17006   var radioDiv = $("#"+contact_control_id+"_pnlRadio");
17007   if(checkbox.length > 0 && radios.length > 0) {
17008      var hiddenState = $("#"+contact_control_id+"_hidSaveDisplayState");
17009      var radioSave = radioList.find("input[type='radio'][value='Save']").parents("#"+contact_control_id+"_rbSave tr");
17010
17011      if(typeof(state) != "undefined" && hiddenState.length > 0 && state) {
17012         if(state == "Save") {
17013            radioDiv.hide();
17014            radioSave.hide();
17015            checkboxDiv.show();
17016         }
17017         else if(state == "Update") {
17018            checkboxDiv.hide();
17019            radioSave.hide();
17020            radioDiv.show();
17021         }
17022         else if(state == "All") {
17023            checkboxDiv.hide();
17024            radioSave.show();
17025            radioDiv.show();
17026         }
17027         hiddenState.val(state);
17028      }
17029
17030      if(typeof(visible) != "undefined" && $("#"+contact_control_id+"_saveControls").length > 0 && visible != ($("#"+contact_control_id+"_saveControls").is(":visible"))) {
17031         if(visible) {
17032            $("#"+contact_control_id+"_saveControls").show();
17033         }
17034         else {
17035            $("#"+contact_control_id+"_saveControls").hide();
17036         }
17037      }
17038
17039      if(typeof(checked) != "undefined") {
17040         if(hiddenState.length == 0 || hiddenState.val() == "Save") {
17041            checkbox.prop("checked", checked);
17042         }
17043         else {
17044            if(checked && radioList.find("input[type='radio'][value='Update']").length > 0) {
17045               radioList.find("input[type='radio'][value='Update']").prop("checked", true);
17046            }
17047            else if(!checked && radioList.find("input[type='radio'][value='NoSave']").length > 0) {
17048               radioList.find("input[type='radio'][value='NoSave']").prop("checked", true);
17049            }
17050         }
17051      }
17052   }
17053}
17054
17055/* Return the list with the New option, if it doesn't already exist */
17056function addNewOption(list, name_question_id) {
17057   var newList = list;
17058   if(newList.length > 0) {
17059      var hasNew = false;
17060      for(var i=0; i<newList.length; i++) {
17061         if(newList[i].value == "") {
17062            hasNew = true;
17063            break;
17064         }
17065      }
17066      if(!hasNew) {
17067         var newText = "New";
17068         var widget = $("#"+name_question_id).autocomplete("widget");
17069         if(widget) {
17070            var newOptionLink = widget.find("li.newOption a");
17071            if(newOptionLink.length > 0) {
17072               newText = newOptionLink.html();
17073            }
17074         }
17075         newList.push({"value": "", "label": newText});
17076      }
17077   }
17078   return newList;
17079}
17080
17081/* Add or update the given contact item in the list */
17082function setContactItem(contact_item) {
17083   var c = getContactItemCount();
17084   _contactItems["c"+contact_item["contact_id"]] = contact_item;
17085   if(c == 0) {
17086      $(".ansAutoComplete").each(function(index, item) {
17087            $(item).siblings(".ansRight").children(".helpWrapper").show();
17088            $(item).find(".ui-combobox > a").css("visibility","visible");
17089            $(item).find(".ui-combobox > input").addClass("ui-combobox-input").autocomplete("enable");
17090            });
17091   }
17092}
17093
17094/* Delete the given contact id in the list */
17095function deleteContactItem(contact_id) {
17096   if(_contactItems["c"+contact_id]) {
17097      delete _contactItems["c"+contact_id];
17098   }
17099   $(".hidContactId[value='"+contact_id+"']").each(function(index, item) {
17100         $(item).val("");
17101         setContactInfoEdited($(item).parent().attr("id"));
17102         });
17103   if(getContactItemCount() == 0) {
17104      $(".ansAutoComplete").each(function(index, item) {
17105            $(item).find(".ui-combobox > input").autocomplete("disable").removeClass("ui-combobox-input");
17106            $(item).find(".ui-combobox > a").css("visibility","hidden");
17107            $(item).siblings(".ansRight").children(".helpWrapper").hide();
17108            });
17109   }
17110}
17111
17112/* Get the number of contact items. */
17113function getContactItemCount() {
17114   var c = 0;
17115   for(var index in _contactItems)c++;
17116   return c;
17117}
17118/* Returns true if the contact should be saved */
17119function doContactSave(contact_control_id) {
17120   var hiddenState = $("#"+contact_control_id+"_hidSaveDisplayState");
17121   if(hiddenState.length > 0 && (typeof(_alwaysSaveContact_C) == "undefined" || !_alwaysSaveContact_C[contact_control_id])) {
17122      var saveControls = $("#"+contact_control_id+"_saveControls");
17123      if(saveControls.length > 0 && saveControls.is(":visible")) {
17124         if(hiddenState.val() == "Save") {
17125            var checkbox = $("#"+contact_control_id+"_chkSave");
17126            var checkboxDiv = $("#"+contact_control_id+"_pnlCheck");
17127            if(checkbox.length > 0 && checkboxDiv.length > 0 && checkboxDiv.is(":visible")) {
17128               return checkbox.prop("checked");
17129            }
17130         }
17131         else {
17132            var radios = $("#"+contact_control_id+"_rbSave input[type='radio']");
17133            var radioDiv = $("#"+contact_control_id+"_pnlRadio");
17134            if(radios.length >= 2 && radioDiv.length > 0 && radioDiv.is(":visible")) {
17135               return radios[0].checked || radios[1].checked;
17136            }
17137         }
17138      }
17139   }
17140   return typeof(_alwaysSaveContact_C) != "undefined" ? _alwaysSaveContact_C[contact_control_id] : false;
17141}
17142/* Validation Functions */
17143function contactName_ClientValidationFunction(value, contact_control_id, alwaysSave) {
17144   var hiddenID = $("#"+contact_control_id+"_hidContactId");
17145   if(typeof(window.doContactSave) == "function" && window.doContactSave(contact_control_id) && ((hiddenID.length > 0 && hiddenID.val() && _contactItems["c"+hiddenID.val()]) || alwaysSave)) {
17146      return value != "";
17147   }
17148   return true;
17149}
17150function contactNameDuplicates_ClientValidationFunction(value, contact_control_id) {
17151   var valid = true;
17152   if(value && typeof(window.doContactSave) == "function" && window.doContactSave(contact_control_id)) {
17153      var myName = value;
17154      if(_contactItems) {
17155         var currentId = $("#"+contact_control_id+"_hidContactId").val();
17156         var names = [];
17157         for(var contactIdC in _contactItems) {
17158            var contact = _contactItems[contactIdC];
17159				if(contact) {
17160				   if(contact.contact_id == currentId) {
17161					   myName += contact.nickname ? " ("+contact.nickname+")" : "";
17162					}
17163					else {
17164						names.push(contact.name + (contact.nickname ? " ("+contact.nickname+")" : ""));
17165					}
17166				}
17167         }
17168         valid = names.indexOf(myName) < 0;
17169      }
17170   }
17171   return valid;
17172}
17173function contactNameUnique_ClientValidationFunction(value, contact_control_id) {
17174   var valid = true;
17175   if(value && typeof(window.doContactSave) == "function" && window.doContactSave(contact_control_id)) {
17176      var myName = value;
17177      if(_contactItems) {
17178         var contact = _contactItems["c"+$("#"+contact_control_id+"_hidContactId").val()];
17179         myName += contact && contact.nickname ? " ("+contact.nickname+")" : "";
17180      }
17181      if(_contactFields) {
17182         var names = [];
17183         for(var contactField in _contactFields) {
17184            if(contactField != contact_control_id && window.doContactSave(contactField)) {
17185               var name, nickname;
17186               var contact = _contactItems["c"+$("#"+contactField+"_hidContactId").val()];
17187               if(contact) {
17188                  name = contact.name;
17189                  nickname = contact.nickname;
17190               }
17191               for(var i=0; i<_contactFields[contactField].length; i++) {
17192                  if(_contactFields[contactField][i].dbFieldName == "name") {
17193                     name=$("#"+_contactFields[contactField][i].id).val();
17194                  }
17195                  if(_contactFields[contactField][i].dbFieldName == "nickname") {
17196                     nickname=$("#"+_contactFields[contactField][i].id).val();
17197                  }
17198               }
17199               names.push(name + (nickname ? " ("+nickname+")" : ""));
17200            }
17201         }
17202         valid = names.indexOf(myName) < 0;
17203      }
17204   }
17205   return valid;
17206}
17207function contactEmail_ClientValidationFunction(value, contact_control_id) {
17208   if(typeof(window.doContactSave) == "function" && window.doContactSave(contact_control_id) && value) {
17209      return checkEmail(value);
17210   }
17211   return true;
17212}
17213/* End Validation Functions */
17214/* Autocomplete Source Function */
17215function contactAutoCompleteSource(request, response){
17216   var respItems = [];
17217   if(typeof(_contactItems) != "undefined") {
17218      for(var cContactId in _contactItems) {
17219         var item = _contactItems[cContactId];
17220         var label = item["name"];
17221         if(label && item["nickname"]) {
17222            label += " <em>("+item["nickname"]+")</em>";
17223         }
17224         if(!label) {
17225            label = item["contact_email"];
17226         }
17227         if(!label) {
17228            label = "<em>Unnamed Contact</em>";
17229         }
17230         if(item["name"] && item["name"].toLowerCase().indexOf(request.term.toLowerCase()) >= 0) {
17231            respItems[respItems.length] = {value:item["contact_id"], label: label};
17232         }
17233         else if(item["nickname"] && item["nickname"].toLowerCase().indexOf(request.term.toLowerCase()) >= 0) {
17234            respItems[respItems.length] = {value:item["contact_id"], label: label};
17235         }
17236         else if(!item["name"] && !item["nickname"] && item["contact_email"] && item["contact_email"].toLowerCase().indexOf(request.term.toLowerCase()) >= 0) {
17237            respItems[respItems.length] = {value:item["contact_id"], label: label};
17238         }
17239         else if(!item["name"] && !item["nickname"] && !item["contact_email"]) {
17240            respItems[respItems.length] = {value:item["contact_id"], label: label};
17241         }
17242      }
17243      if(respItems.length > 0) {
17244         respItems.sort(function(a, b) {
17245               if(a.label < b.label) {
17246                  return -1;
17247               }
17248               else if(a.label > b.label) {
17249                  return 1;
17250               }
17251               return 0;
17252            });
17253      }
17254   }
17255   response(respItems);
17256}
17257/* Initialize a name autocomplete control */
17258function initContactNameAutoComplete(inputID, controlID, autoCompleteSource){
17259   var input = $("#" + inputID);
17260   if(input.length == 0) return;
17261   var wasOpen = false;
17262   input.autocomplete({
17263      source: autoCompleteSource,
17264      minLength: 0,
17265      delay: 0
17266   });
17267
17268   input.data("ui-autocomplete")._renderItem = function(ul, item) {
17269      if(item.value) {
17270         return $("<li>")
17271            .append("<a>"+item.label+"</a>")
17272            .appendTo(ul);
17273      }
17274      else {
17275         return $("<li>")
17276            .addClass("newOption")
17277            .append("<a>"+item.label+"</a>")
17278            .appendTo(ul);
17279      }
17280   };
17281
17282   $("#" + controlID + "_in_dropdown")
17283      .button({
17284         icons: {
17285            primary: "ui-icon-triangle-1-s"
17286         },
17287         text: false
17288      })
17289      .removeClass("ui-corner-all")
17290      .addClass("ui-corner-right ui-combobox-toggle")
17291      .on("mousedown", function() {
17292         wasOpen = $("#" + inputID).autocomplete("widget").is(":visible");
17293      })
17294      .on("click", function() {
17295         $("#" + inputID).trigger("focus");
17296         if(wasOpen) {
17297            return;
17298         }
17299         $("#" + inputID).autocomplete("search", "");
17300      });
17301}
17302/* Region Drop Downs */
17303/* Get the id of the control for the specified country, or the active control if no country */
17304function getID_RDDFI(client_id, country, useHidden, preferDropdown) {
17305   if(typeof(useHidden) == "undefined") {
17306      useHidden = false;
17307   }
17308   if(typeof(preferDropdown) == "undefined") {
17309      preferDropdown = false;
17310   }
17311   if(!country) {
17312      country = _countryCodeJS_RDDFI[client_id] ? eval(_countryCodeJS_RDDFI[client_id]) : "";
17313   }
17314   var id="";
17315   if(_useDropDowns_RDDFI[client_id] && $("#"+getControlID_RDDFI(client_id, "DropDownRegion", country)).length > 0) {
17316      id = getControlID_RDDFI(client_id, "DropDownRegion", country);
17317   }
17318   if(((!id || (!preferDropdown && $("#"+id).val() == "OT")) && _includeOther_RDDFI[client_id]) || !_useDropDowns_RDDFI[client_id]) {
17319      id = getControlID_RDDFI(client_id, "RegionOther");
17320      if(useHidden && !_useDropDowns_RDDFI[client_id] && $("#"+getControlID_RDDFI(client_id, "RegionConverted")).length > 0 && $("#"+getControlID_RDDFI(client_id, "RegionConverted")).val()) {
17321         id = getControlID_RDDFI(client_id, "RegionConverted");
17322      }
17323   }
17324   return id;
17325}
17326
17327/* Get the ids of all the controls */
17328function getIDs_RDDFI(client_id) {
17329   var ids = [];
17330   if(_useDropDowns_RDDFI[client_id]) {
17331      for(var i=0; i<_dropdownRegions_RDDFI[client_id].length; i++) {
17332         ids[i] = _dropdownRegions_RDDFI[client_id][i]["id"];
17333      }
17334   }
17335   if(_includeOther_RDDFI[client_id] || !_useDropDowns_RDDFI[client_id]) {
17336      ids[_dropdownRegions_RDDFI[client_id].length] = getControlID_RDDFI(client_id, "RegionOther");
17337   }
17338   return ids;
17339}
17340
17341/* Get the id of the control with the given name (RegionOther, RegionConverted, DropDownRegion, BRRegionOther) */
17342function getControlID_RDDFI(client_id, control, country) {
17343   if(control == "RegionOther") {
17344      return client_id+"_txtRegionOther";
17345   }
17346   else if(control == "RegionConverted") {
17347      return client_id+"_hidRegionConverted";
17348   }
17349   else if(control == "DropDownRegion" && typeof(country) != "undefined") {
17350      return client_id+"_ctrlRegion"+country;
17351   }
17352   else if(control == "BRRegionOther") {
17353      return client_id+"_brRegionOther";
17354   }
17355   return "";
17356}
17357
17358/* Set the value of the control */
17359function setValue_RDDFI(client_id, region, country, region_name) {
17360   if(!_useDropDowns_RDDFI[client_id]) {
17361      $("#"+getControlID_RDDFI(client_id, "RegionConverted")).val("");
17362   }
17363   var id = getID_RDDFI(client_id, country, false, true);
17364   var hasOption = false;
17365   var dd = $("#"+id);
17366   if(dd.length > 0) {
17367      hasOption = dd.find("option[value='"+(region ? (region != "OT" ? region : "") : "sel")+"']").length > 0;
17368   }
17369   if(hasOption) {
17370      dd.val(region ? region : "sel");
17371   }
17372   else {
17373      dd.val("OT");
17374      if(!_useDropDowns_RDDFI[client_id] && region_name) {
17375         $("#"+getControlID_RDDFI(client_id, "RegionOther")).val(region_name);
17376         $("#"+getControlID_RDDFI(client_id, "RegionConverted")).val(region);
17377      }
17378      else {
17379         $("#"+getControlID_RDDFI(client_id, "RegionOther")).val(region);
17380      }
17381      setOtherRegion_RDDFI(client_id, true);
17382   }
17383}
17384
17385/* Set the active country for the control */
17386function setActiveCountry_RDDFI(client_id, country) {
17387   var showOther = true;
17388   if(_useDropDowns_RDDFI[client_id]) {
17389      for(var i=0; i<_dropdownRegions_RDDFI[client_id].length; i++) {
17390         if(_dropdownRegions_RDDFI[client_id][i]["country"] == country) {
17391            $("#"+_dropdownRegions_RDDFI[client_id][i]["id"] + "Wrap").show();
17392            if($("#"+getControlID_RDDFI(client_id, "BRRegionOther")).length > 0) {
17393               $("#"+getControlID_RDDFI(client_id, "BRRegionOther")).show();
17394            }
17395            if($("#"+_dropdownRegions_RDDFI[client_id][i]["id"]).val() != "OT") {
17396               showOther = false;
17397            }
17398         }
17399         else {
17400            $("#"+_dropdownRegions_RDDFI[client_id][i]["id"] + "Wrap").hide();
17401            if($("#"+getControlID_RDDFI(client_id, "BRRegionOther")).length > 0) {
17402               $("#"+getControlID_RDDFI(client_id, "BRRegionOther")).hide();
17403            }
17404         }
17405      }
17406   }
17407   if(_includeOther_RDDFI[client_id] || !_useDropDowns_RDDFI[client_id]) {
17408      setOtherRegion_RDDFI(client_id, showOther);
17409   }
17410}
17411
17412/* Set the display of the Other textbox */
17413function setOtherRegion_RDDFI(client_id, show) {
17414   if(_includeOther_RDDFI[client_id] || !_useDropDowns_RDDFI[client_id]) {
17415      if(show || !_useDropDowns_RDDFI[client_id]) {
17416         $("#"+getControlID_RDDFI(client_id, "RegionOther")).show();
17417         if($("#"+client_id+"_brRegionOther").length > 0) {
17418            $("#"+client_id+"_brRegionOther").show();
17419         }
17420      }
17421      else {
17422         $("#"+getControlID_RDDFI(client_id, "RegionOther")).hide();
17423         if($("#"+client_id+"_brRegionOther").length > 0) {
17424            $("#"+client_id+"_brRegionOther").hide();
17425         }
17426      }
17427   }
17428}
17429
17430/* Get the current region value as the region name */
17431function getRegionName_RDDFI(client_id) {
17432   var id = getID_RDDFI(client_id);
17433   if(id && $("#"+id).length > 0) {
17434      var region = $("#"+id).val();
17435      var country = eval(_countryCodeJS_RDDFI[client_id]);
17436      if(country && country.length == 2 && region && (region.length == 2 || region.length == 3)) {
17437         var temp = gRN(country.toUpperCase(), region.toUpperCase()); 
17438         if(temp) {
17439            region = temp;
17440         }
17441      }
17442      return region;
17443   }
17444   return "";
17445}
17446/* End Region Drop Downs */
17447/* Country Drop Downs */
17448/* Get the id of the active control */ 
17449function getID_CDDFI(client_id) {
17450    var id = "";
17451    if(_allCountries_CDDFI[client_id]) {
17452        id = getControlID_CDDFI(client_id, "CountryFull");
17453    }
17454    else {
17455        id = getControlID_CDDFI(client_id, "Country");
17456    }
17457    if($("#"+id).val() == "OT" && _includeOther_CDDFI[client_id]) {
17458        id = getControlID_CDDFI(client_id, "CountryOther");
17459    }
17460    return id;
17461}
17462
17463/* Get the ids of all the controls */
17464function getIDs_CDDFI(client_id) {
17465    var ids = [];
17466    if(_allCountries_CDDFI[client_id]) {
17467        ids[0] = getControlID_CDDFI(client_id, "CountryFull");
17468    }
17469    else {
17470        ids[0] = getControlID_CDDFI(client_id, "Country");
17471    }
17472    if(_includeOther_CDDFI[client_id]) {
17473        ids[1] = getControlID_CDDFI(client_id, "CountryOther");
17474    }
17475    return ids;
17476}
17477
17478/* Get the id of the control with the given name (CountryOther, CountryFull, Country, BRCountryOther) */
17479function getControlID_CDDFI(client_id, control) {
17480    if(control == "CountryOther") {
17481        return client_id+"_txtCountryOther";
17482    }
17483    else if(control == "CountryFull") {
17484        return client_id+"_drpCountryFull";
17485    }
17486    else if(control == "Country") {
17487        return client_id+"_drpCountry";
17488    }
17489    else if(control == "BRCountryOther") {
17490        return client_id+"_brCountryOther";
17491    }
17492    return "";
17493}
17494
17495/* Set the value of the control */
17496function setValue_CDDFI(client_id, country) {
17497    var ids = getIDs_CDDFI(client_id);
17498    var hasOption = false;
17499    var dd = $("#"+ids[0]);
17500    if(country.length == 2 && country != "OT" && dd.length > 0) {
17501        hasOption = dd.find("option[value='"+country+"']").length > 0;
17502    }
17503    if(hasOption) {
17504        dd.val(country);
17505    }
17506    else {
17507        dd.val("OT");
17508        $("#"+ids[1]).val(country);
17509        setOtherCountry_CDDFI(client_id, true);
17510    }
17511}
17512
17513/* Set the display of the Other textbox */
17514function setOtherCountry_CDDFI(client_id, show) {
17515    if(_includeOther_CDDFI[client_id]) {
17516        if(show) {
17517            $("#"+getControlID_CDDFI(client_id, "CountryOther")).show();
17518            if($("#"+client_id+"_brCountryOther").length > 0) {
17519                $("#"+client_id+"_brCountryOther").show();
17520            }
17521        }
17522        else {
17523            $("#"+getControlID_CDDFI(client_id, "CountryOther")).hide();
17524            if($("#"+getControlID_CDDFI(client_id, "BRCountryOther")).length > 0) {
17525                $("#"+getControlID_CDDFI(client_id, "BRCountryOther")).hide();
17526            }
17527        }
17528    }
17529}
17530
17531/* Get the current country value as the country name */
17532function getCountryName_CDDFI(client_id) {
17533    var id = getID_CDDFI(client_id);
17534    if(id && $("#"+id).length > 0) {
17535        var country = $("#"+id).val();
17536        if(country && country.length == 2) {
17537            var temp = gCN(country.toUpperCase()); 
17538            if(temp) {
17539                country = temp;
17540            }
17541        }
17542        return country;
17543    }
17544    return "";
17545}
17546/* End Country Drop Downs */
17547/* End Include contacts */
17548
17549/* Include conversion */
17550function convertToBool(obj){
17551   if(typeof(obj) == "bool") return obj;
17552   var str = obj.toString();
17553   switch(str.toLowerCase().trim()){
17554      case "yes":
17555      case "true":
17556      case "1":
17557         return true;
17558      default:
17559         return false;
17560   }
17561}
17562function parseDate(obj){
17563   if(typeof(obj) == "Date") return obj;
17564   return new Date(obj.toString());
17565}
17566/* End Include conversion */
17567
17568/* Include cookiePreferenceDialog */
17569$(document).ready(function() {
17570	if (document.querySelector('[id^="base-application-footer"]')) return;
17571
17572	document.addEventListener('click', function(event) {
17573        if (event.target.classList.contains('cookie-preference-dialog-opener')) {
17574          // We need to close the cookie policy dialog first
17575          // Select the closest div with class of policy-dialog and click the close button
17576          if (event.target.closest) {
17577            // Find the closest dialog element with class "policy-dialog"
17578            const dialog = event.target.closest(".policy-dialog");
17579            // Ensure the dialog element and the close button exist
17580            if (dialog) {
17581              const closeButton = dialog.querySelector(".btn-close");
17582              if (closeButton) {
17583                // Simulate a click on the close button
17584                closeButton.click();
17585              }
17586            }
17587          }
17588
17589          event.preventDefault();
17590          showDialog(
17591            "Cookie Preferences",
17592            "/cookiePreferencePopupDialog.php" + "?dialog=true",
17593            750,
17594            null,
17595            "plainDialog footerDialog cookiePrefsDialog",
17596            0.5,
17597            true,
17598            true
17599          );
17600        }
17601    });
17602});
17603/* End Include cookiePreferenceDialog */
17604
17605/* Include crossDomainMessaging.utilities */
17606/* This file stored utilities related to cross domain messaging that do not depend on other internal LawDepot code */
17607
17608/* Sends a message to the parent host of the current window*/
17609function parentPostMessage(message){
17610    parent.postMessage(message, getParentHost());
17611}
17612/* Gets the host of the current window, if the referrer is set will prefer that information*/
17613function getParentHost(){
17614    if (document.referrer) {
17615        return document.referrer;
17616    }
17617    else{
17618        try{
17619            var host = parent.location.href;
17620            if(typeof(host) != "undefined") return host;
17621            return getSwappedProtocolHost();
17622        }
17623        catch(e){
17624            return getSwappedProtocolHost();
17625        }
17626    }
17627}
17628/* Gets a URI for the current hostname, but with the opposite security http protocol (eg. http <-> https)*/
17629function getSwappedProtocolHost(){
17630    var protocol;
17631    if(window.location.protocol == "http:"){
17632        protocol = "https:";
17633    }
17634    else{
17635        protocol = "http:";
17636    }
17637    return protocol + "//" + window.location.hostname;
17638}
17639
17640
17641function escapeForPostMessage(str){
17642    return str.replace(/:/g, "&colon;").replace(/\|/, "&vbar;");
17643}
17644function unEscapeForPostMessage(str){
17645    return str.replace(/&colon;/g, ":").replace(/&vbar;/, "|");
17646}
17647/* Stringifies and then escapes the given array for posting as a message*/
17648function stringifyForPostMessage(arr){
17649    return escapeForPostMessage(JSON.stringify(arr));
17650}
17651/* Unescapes and then parses the given string that should have been stringified and then escaped*/
17652function parseForPostMessage(str){
17653    return JSON.parse(unEscapeForPostMessage(str));
17654}
17655/* End Include crossDomainMessaging.utilities */
17656
17657/* Include crossDomainMessaging */
17658function handleMessages(e){
17659   var hostStart = window.location.hostname.replace(/\.+(co\.uk|com|ca)$/, '');
17660
17661   if(e.origin.indexOf("https://" + hostStart) == 0 || e.origin.indexOf("http://" + hostStart) == 0){
17662      var data = e.data;
17663      var dataSplit = [];
17664      if(typeof(data) == "string") dataSplit = data.split(':');
17665   	var action = '';
17666      var parameter = '';
17667      if(dataSplit.length > 0){
17668         action = dataSplit[0];
17669      }
17670      if(dataSplit.length > 1){
17671         parameter = dataSplit[1];
17672      }
17673      switch(action){
17674         case "setDialogTitle":
17675            setDialogTitle(unEscapeForPostMessage(parameter), (dataSplit.length > 2 ? unEscapeForPostMessage(dataSplit[2]) : null));
17676            break;
17677         case "setDialogContentHeight":
17678            var dialogID = null, iFrameID = null;
17679            if(dataSplit.length > 2) dialogID = dataSplit[2];
17680            if(dataSplit.length > 3) iFrameID = dataSplit[3];
17681            setDialogContentHeight(parameter * 1, dialogID, iFrameID);
17682            break;
17683         case "closeDialog":
17684            closeDialog();
17685            break;
17686         case "saveData":
17687            if(typeof(saveData) == "function"){
17688               var paramSplit = parameter.split('|');
17689               var paramForceSave = paramSplit.length > 0 && paramSplit[0] == "true";
17690               var paramForceSyncSave = paramSplit.length > 1 && paramSplit[1] == "true";
17691               if(paramForceSave) forceSave = true;
17692               if(paramForceSyncSave) forceSyncSave = true;
17693               saveData();
17694               if(paramForceSave) forceSave = false;
17695               if(paramForceSyncSave) forceSyncSave = false;
17696            }
17697            else if(typeof(saveWorkingAnswers) == "function") {
17698               if(!SID) SID = "1";
17699               saveWorkingAnswers(function(req, ind, suc) {
17700                  saveCallback(req, ind, suc);
17701                  if(suc) {
17702                     window.SID = req.responseXML.firstChild.textContent;
17703                  }
17704               });
17705            }
17706            if(dataSplit.length > 2){
17707               postMessageToDialog(dataSplit[2].replace("|", ":"));
17708            }
17709            break;
17710         case "signInDialogSuccess":
17711            signInDialogSuccess(parameter);
17712            break;
17713         case "focusFirstElement":
17714            focusFirstElement();
17715            break;
17716         case "signInService":
17717	   		if(dataSplit.length > 2){
17718		   		signInService(parseForPostMessage(dataSplit[2]), parameter, signInServicePostMessageCallback);
17719            } else {
17720				   subAction = parameter.split("|")[0]; /*For SigninDialog*/
17721				   subParameter = parameter.split("|")[1];
17722   				signInService(parseForPostMessage(subParameter), subAction, signInServiceInfo[subAction].success);
17723   			}
17724            break;
17725         case "signInServiceComplete":
17726            pmHandler.Callback(unEscapeForPostMessage(parameter), parseForPostMessage(dataSplit[2]));
17727            break;
17728         case "alert":
17729            if(dataSplit.length > 2){
17730               alert(unEscapeForPostMessage(parameter), parseForPostMessage(dataSplit[2]));
17731            }
17732            else{
17733               alert(unEscapeForPostMessage(parameter));
17734            }
17735            break;
17736         case "showMessage":
17737            showMessage(unEscapeForPostMessage(parameter), (dataSplit.length > 2 ? parseForPostMessage(dataSplit[2]) : null));
17738            break;
17739         case "hideMessage":
17740            hideMessage(unEscapeForPostMessage(parameter));
17741            break;
17742         case "SetLocalStorage":
17743            SetLocalStorage(unEscapeForPostMessage(parameter), (dataSplit.length > 2 ? unEscapeForPostMessage(dataSplit[2]) : null));
17744            break;
17745         case "frameLoadComplete":
17746            if(typeof(frameLoadComplete) == "function") frameLoadComplete(parameter);
17747            break;
17748      }
17749   }
17750}
17751function postMessageToFrame(frame, message, protocol){
17752   if(typeof(protocol) == "undefined") protocol = "https";
17753   if(frame && frame.contentWindow.postMessage){
17754      frame.contentWindow.postMessage(message, protocol + "://" + window.location.hostname);
17755   }
17756}
17757function postMessageToDialog(message, protocol) {
17758   postMessageToFrame(getDialogIframe(), message, protocol);
17759}
17760if(!window.addEventListener){
17761	window.attachEvent("onmessage", handleMessages); //for IE8
17762} else {
17763	window.addEventListener("message", handleMessages, false);
17764}
17765function saveAllFrames(){
17766   $('iframe').each(function(){
17767      try{
17768         if(typeof(this.contentWindow.saveData) == "function"){
17769            this.contentWindow.forceSave = true;
17770            this.contentWindow.saveData();
17771            this.contentWindow.forceSave = false;
17772         }
17773      }
17774      catch (e){
17775         postMessageToFrame(this, "saveData:true");
17776      }
17777   });
17778}
17779/* End Include crossDomainMessaging */
17780
17781/* Include errorHandler */
17782function testForOnErrorSupport() {
17783	var agent = getUserAgentString();
17784	if(/Chrome/i.test(agent) && /Safari/i.test(agent) && /Chrome\/(\d+)\./i.exec(agent)[1] < 13) {
17785		return false;
17786	}
17787	if(/Firefox/i.test(agent) && /Firefox\/(\d+)\./i.exec(agent)[1] < 6) {
17788		return false;
17789	}
17790	if(/MSIE\ /i.test(agent) && (/MSIE\ (\d+)\.(\d+)/i.exec(agent)[1] < 5 ||
17791		(/MSIE\ (\d+)\.(\d+)/i.exec(agent)[1] == 5 && /MSIE\ (\d+)\.(\d+)/i.exec(agent)[2] < 5))) {
17792		return false;
17793	}
17794	if(/Opera/i.test(agent) && /Version\//i.test(agent) && (/Version\/(\d+)\.(\d+)/i.exec(agent)[1] < 11 ||
17795		(/Version\/(\d+)\.(\d+)/i.exec(agent)[1] == 11 && /Version\/(\d+)\.(\d+)/i.exec(agent)[2] < 60))) {
17796		return false;
17797	}
17798	if(/Opera/i.test(agent) && !(/Version\//i.test(agent)) && (/Opera\ (\d+)\.(\d+)/i.exec(agent)[1] < 11 ||
17799		(/Opera\ (\d+)\.(\d+)/i.exec(agent)[1] == 11 && /Opera\ (\d+)\.(\d+)/i.exec(agent)[2] < 60))) {
17800		return false;
17801	}
17802	if(/Safari/i.test(agent) && !(/Chrome/i.test(agent)) && /Version\//i.test(agent) && (/Version\/(\d+)\.(\d+)/i.exec(agent)[1] < 5 ||
17803		(/Version\/(\d+)\.(\d+)/i.exec(agent)[1] == 5 && /Version\/(\d+)\.(\d+)/i.exec(agent)[2] < 1))) {
17804		return false;
17805	}
17806	return true;
17807}
17808
17809/*
17810 * This will log all javascript errors that occur on a page.
17811 * There are some errors that will not get logged, as they are not
17812 * related to the website (browser chrome errors, for example).
17813 *
17814 * Author: Chris Poirier
17815 * Last Modified: March 14, 2017 - Chris Poirier
17816 */
17817window._errors=[];
17818if(testForOnErrorSupport()) {
17819	window.onerror = function(errorMessage, url, line, column, errorObj) {
17820		/*  Prevent errors by sanitzing parameters */
17821		if(typeof(errorMessage) == "undefined") {
17822			errorMessage = '';
17823		}
17824		if(typeof(url) == "undefined") {
17825			url = '';
17826		}
17827		if(typeof(line) == "undefined") {
17828			line = '';
17829		}
17830
17831		var urlEscaped = url_escape(url);
17832		var parentUrlEscaped = url_escape(location.href);
17833		var lineEscaped = url_escape(line);
17834		var message = url_escape(errorMessage);
17835		window._errors.push(errorMessage);
17836      var stackTrace = null;
17837      if(typeof(errorObj) != "undefined" && errorObj != null){
17838         stackTrace = url_escape(errorObj.stack);
17839      }
17840		logErrorMessage(message, urlEscaped, lineEscaped, parentUrlEscaped, null, stackTrace);
17841	};
17842}
17843else if(window.Error) {
17844	var originalError = window.Error;
17845	window.Error = function() {
17846		if (arguments.length > 0) {
17847			/*  Truncate the error message if it will go over the configured query string length.
17848			      Query string limit = 2048
17849			      Length of query string variable names and delimiters: 47 */
17850			var urlEscaped = url_escape(location.href);
17851			var message = url_escape(arguments[0]);
17852			window._errors.push(arguments[0]);
17853
17854			logErrorMessage(message, urlEscaped, null, urlEscaped);
17855		}
17856		return originalError.apply(this, arguments);
17857	}
17858}
17859
17860/**
17861 * Trims given stack trace.
17862 * Preserves start and end of the stack trace while trimming middle part if the stack trace length exceeds 8192 bytes.
17863 *
17864 * @param {string} stackTrace
17865 * @returns {string} stackTrace
17866 */
17867function trimStackTrace(stackTrace) {
17868    const maxLength = 8192;
17869    if (stackTrace.length <= maxLength) return stackTrace;
17870
17871    const halfLength = Math.floor(maxLength / 2);
17872    return stackTrace.substring(0, halfLength - 5) + "\n...\n" + stackTrace.substring(stackTrace.length - halfLength);
17873}
17874
17875/* Log an error message from javascript. */
17876function logErrorMessage(message, url, line, parentUrl, logFileName, stackTrace) {
17877   var userAgent = getUserAgentString();
17878   if(!logFileName && shouldIgnoreError(message, url, line, stackTrace, userAgent)) return false;
17879   if(logFileName  == "jQueryMigrate.log" && shouldIgnoreMigrationWarning(message, url)) return false;
17880
17881   var loggerUrl = "/api/foundation/error-logger/v1/errors";
17882   var parameters = "Description=" + message
17883      + "&Url=" + url
17884      + "&Line=" + (line ? line : '')
17885      + "&ParentUrl=" + parentUrl
17886      + "&UserAgent=" + userAgent;
17887   if(logFileName) {
17888      parameters += "&FileName=" + logFileName;
17889   }
17890   if(stackTrace) {
17891      parameters += "&StackTrace=" + trimStackTrace(stackTrace);
17892   }
17893
17894   /** Send error to server */
17895   var xmlReq = null;
17896   if(window.XMLHttpRequest) {
17897      xmlReq = new XMLHttpRequest();
17898   } else if(window.ActiveXObject) {
17899      xmlReq = new ActiveXObject("Microsoft.XMLHTTP")
17900   }
17901
17902   if(xmlReq != null){
17903      xmlReq.open("POST", loggerUrl, true);
17904      xmlReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
17905      xmlReq.send(parameters);
17906   }
17907   else {
17908      /* This shouldn't happen, but if for some reason we can't get the XML HTTP object to send a POST then send this via a GET. The query string will be restricted to 2048 characters in this case. */
17909      new Image().src = loggerUrl + '?' + parameters.substring(0, 2048);
17910   }
17911}
17912/* If the error should be ignored. */
17913function shouldIgnoreError(description, url, line, stackTrace, userAgent) {
17914   var descriptionIgnore = description ? unescape(description.toLowerCase()).trim() : "";
17915   var urlIgnore = url ? unescape(url.toLowerCase()) : "";
17916   var lineIgnore = line ? line : 0;
17917   var stackTraceIgnore = stackTrace ? unescape(stackTrace.toLowerCase()) : "";
17918   var userAgentIgnore = userAgent ? unescape(userAgent.toLowerCase()) : "";
17919
17920   /* Case 1: Error or URL contains "chrome://"*/
17921	if(descriptionIgnore.indexOf("chrome://") >= 0 || urlIgnore.indexOf("chrome://") >= 0)
17922		return true;
17923	/* Case 2: url starts with "extensions/"*/
17924	if(urlIgnore.indexOf("extensions/") == 0)
17925		return true;
17926	/* Case 3: Error contains "NETWORK_ERR" or "NetworkError"*/
17927	if(descriptionIgnore.indexOf("network_err") >= 0 || descriptionIgnore == "networkerror")
17928		return true;
17929	/* Case 4: Error = "Uncaught TypeError: Object #<Object> has no method 't'"*/
17930	if(descriptionIgnore == "uncaught typeerror: object #<object> has no method \'t\'")
17931		return true;
17932	/* Case 5: Error = "'_events' is null or not an object"*/
17933	if(descriptionIgnore == "\'_events\' is null or not an object")
17934		return true;
17935	/* Case 6: Error on unfamiliar domain*/
17936	if(urlIgnore) {
17937		var domainsOK = ["www.legalcontracts.com", "www.legalcontracts.com"];
17938      var urlAnchor = document.createElement("A");
17939      urlAnchor.href = urlIgnore;
17940		if(domainsOK.indexOf(urlAnchor.hostname) < 0) {
17941			return true;
17942		}
17943	}
17944	/* Case 7: PageRequestManager Timeout Errors*/
17945	var prmErrors = ["sys.webforms.pagerequestmanagerparsererrorexception: the message received from the server could not be parsed.",
17946      "sys.webforms.pagerequestmanagerservererrorexception: an unknown error occurred while processing the request on the server.",
17947      "sys.webforms.pagerequestmanagertimeoutexception: sys.webforms.pagerequestmanagertimeoutexception: the server request timed out.",
17948      "sys.webforms.pagerequestmanagertimeoutexception: the server request timed out.",
17949      "uncaught sys.webforms.pagerequestmanagertimeoutexception: sys.webforms.pagerequestmanagertimeoutexception: the server request timed out.",
17950      "error: sys.webforms.pagerequestmanagertimeoutexception: the server request timed out.",
17951      "sys.webforms.pagerequestmanagerservererrorexception: sys.webforms.pagerequestmanagerservererrorexception: an unknown error occurred while processing the request on the server. the status code returned from the server was: 408",
17952      "sys.webforms.pagerequestmanagerservererrorexception: an unknown error occurred while processing the request on the server. the status code returned from the server was: 408",
17953      "uncaught sys.webforms.pagerequestmanagerservererrorexception: sys.webforms.pagerequestmanagerservererrorexception: an unknown error occurred while processing the request on the server. the status code returned from the server was: 408",
17954      "uncaught sys.webforms.pagerequestmanagerservererrorexception: sys.webforms.pagerequestmanagerservererrorexception: an unknown error occurred while processing the request on the server. the status code returned from the server was: 403"];
17955	if(prmErrors.indexOf(descriptionIgnore) >= 0) {
17956		return true;
17957	}
17958	/* Case 8: PIE.htc*/
17959	if(urlIgnore.indexOf("pie.htc") >= 0) {
17960		return true;
17961	}
17962	/* Case 9: url empty*/
17963	if(!urlIgnore) {
17964		return true;
17965	}
17966	/* Case 10: Invalid line, line = 0, or line > 1000000*/
17967	if(!lineIgnore || isNaN(parseFloat(lineIgnore)) || !isFinite(lineIgnore) || !parseInt(lineIgnore) || parseInt(lineIgnore) > 1000000) {
17968		return true;
17969	}
17970	/* Case 11: Undefined errors, cannot investigate*/
17971	var undefErrors = ["","script error.","script error","access is denied.","unspecified error.",":","exception thrown and not caught","ns_error_not_available:","could not complete the operation due to error 80020101.","permission denied"];
17972	if(undefErrors.indexOf(descriptionIgnore) >= 0) {
17973		return true;
17974	}
17975	/* Case 12: Browser Plugin/Add-On Errors*/
17976	var errorIndicators = ["conduitpage", "scapgloref", "fcapgloref", "getattribute",
17977		"papaddingxxpaddingpaddingxxpaddingpaddingxxpaddingpaddingxxpaddingpaddingxxpaddingpaddingx",
17978		"advblgloref", "admwl", "start_uii_diagnotic", "start_tld", "start_serp",
17979		"start_dummy_common", "bcapgloref", "youtube", "_tpihelper", "symcbfgetresourcefolder",
17980		"symcbfgetsafesearchvalues", "symcbfgettoolbarstatus"];
17981   for(var i=0; i<errorIndicators.length; i++) {
17982		if(descriptionIgnore.indexOf(errorIndicators[i]) >= 0) {
17983			return true;
17984		}
17985	}
17986	/* Case 13: Windows 8 Tablet "Not implemented"*/
17987	if(descriptionIgnore == "not implemented") {
17988		return true;
17989	}
17990	/* Case 14: Firefox: "SyntaxError: expected expression, got '%'"*/
17991	if(descriptionIgnore.indexOf("expected expression, got \'%\'") >= 0)
17992	{
17993		return true;
17994	}
17995	/* Case 15: Bot or plugin referencing "docs-homescreen-gb-container" */
17996	if(descriptionIgnore.indexOf("docs-homescreen-gb-container") >= 0)
17997	{
17998		return true;
17999	}
18000   /* Case 16: AddThis errors */
18001   if(descriptionIgnore.indexOf("addthis is not defined") >= 0 || descriptionIgnore.indexOf("can't find variable: addthis") >= 0 ||
18002      descriptionIgnore.indexOf("addthis.addeventlistener is not a function") >= 0 || descriptionIgnore.indexOf("'addthis' is not defined") >= 0||
18003      descriptionIgnore.indexOf("'addthis' is undefined") >= 0 || descriptionIgnore.indexOf("addthis_widget.js") >= 0 ||
18004      descriptionIgnore.match(/blocked a frame with origin.*from accessing a frame with origin.*https:\/\/.*\.addthis\.com/i))
18005	{
18006		return true;
18007	}
18008   /* Case 17: Telerik/Sys load errors */
18009   if(descriptionIgnore.indexOf("sys is not defined") >= 0 || descriptionIgnore.indexOf("'sys' is undefined") >= 0 ||
18010      descriptionIgnore.indexOf("can't find variable: sys") >= 0 || descriptionIgnore.indexOf("telerik is not defined") >= 0 ||
18011      descriptionIgnore.indexOf("'telerik' is undefined") >= 0 || descriptionIgnore.indexOf("can't find variable: telerik") >= 0 ||
18012      descriptionIgnore.indexOf("commonscripts is not defined") >= 0 || descriptionIgnore.indexOf("cannot read property 'pagerequestmanager' of undefined") >= 0 ||
18013      descriptionIgnore.indexOf("cannot read property 'add_load' of undefined") >= 0 || descriptionIgnore.indexOf("cannot read property 'add_init' of undefined") >= 0 ||
18014      descriptionIgnore.indexOf("cannot read property '_removehandler' of undefined") >= 0 || descriptionIgnore.indexOf("'$find' is undefined") >= 0 ||
18015      descriptionIgnore.indexOf("'sys' is not defined") >= 0 || descriptionIgnore.indexOf("$find is not defined") >= 0 ||
18016      descriptionIgnore.indexOf("undefined is not an object (evaluating 'sys.webforms.pagerequestmanager')") >= 0)
18017	{
18018		return true;
18019	}
18020   /* Case 19: Errors to ignore for bots */
18021   var botErrors = ["uncaught typeerror: cannot read property 'pagerequestmanager' of undefined",
18022      "unable to get property 'pagerequestmanager' of undefined or null reference",
18023      "uncaught typeerror: undefined is not a function"];
18024   if(botErrors.indexOf(descriptionIgnore) >= 0 &&
18025      (userAgentIgnore.match(/bot/i) || userAgentIgnore.match(/trident\/\d\.\d;[\ \+][\ \+]?trident\/\d\.\d/i)))
18026   {
18027      return true;
18028   }
18029   /* Case 20: Illegal Invocation on iOS */
18030   if(descriptionIgnore.indexOf("illegal invocation") >= 0 && typeof(cssua) != "undefined" && cssua.ua.ios)
18031   {
18032      return true;
18033   }
18034   /* Case 20A: Illegal Invocation on line 273 */
18035   if(descriptionIgnore.indexOf("illegal invocation") >= 0 && lineIgnore == 273)
18036   {
18037      return true;
18038   }
18039   /* Case 21: 'UET' is undefined */
18040   if(descriptionIgnore.indexOf("'uet' is undefined") >= 0 || descriptionIgnore.indexOf("uet is not defined") >= 0
18041      || descriptionIgnore.indexOf("'uet' is not defined") >= 0 || descriptionIgnore.indexOf("can't find variable: uet") >= 0)
18042   {
18043      return true;
18044   }
18045   /* Case 22: Null object errors on RadWindow, LawDepotEditor, coming from Safari */
18046   if(descriptionIgnore.indexOf("null is not an object (evaluating 'getradwindow()") >= 0 &&
18047      urlIgnore.indexOf("/lawdepoteditor/") >= 0 &&
18048      typeof(cssua) != "undefined" && cssua.ua.safari)
18049   {
18050      return true;
18051   }
18052   /* Case 23: file:// protocol */
18053   if(urlIgnore.indexOf("file://") >= 0)
18054   {
18055      return true;
18056   }
18057   /* Case 24: redefining user agent */
18058   if(descriptionIgnore.indexOf("can't redefine non-configurable property \"useragent\"") >= 0) {
18059      return true;
18060   }
18061   /* Case 25: remove night mode */
18062   if(descriptionIgnore.indexOf("removenightmode is not defined") >= 0) {
18063      return true;
18064   }
18065   /* Case 25: MoatMAK */
18066   if(descriptionIgnore.indexOf("can't find variable: moatmak") >= 0) {
18067      return true;
18068   }
18069   /* Case 26: Object does not exist (IE11-specific) */
18070   if(descriptionIgnore == "the requested object does not exist.") {
18071      return true;
18072   }
18073   /* Case 27: Accessing cross-origin frame doubleclick/facebook/file: */
18074   if(descriptionIgnore.indexOf("blocked") >= 0 && (descriptionIgnore.indexOf("bid.g.doubleclick.net") >= 0
18075      || descriptionIgnore.indexOf("staticxx.facebook.com") >= 0 || descriptionIgnore.indexOf("file://") >= 0)) {
18076      return true;
18077   }
18078   /* Case 28: DataCloneError executing postMessage */
18079   if(descriptionIgnore.indexOf("datacloneerror") >= 0 && descriptionIgnore.indexOf("could not be cloned") >= 0) {
18080      return true;
18081   }
18082   /* Case 29: iOS auto-fill errors */
18083   if(descriptionIgnore.indexOf("blocked a frame with origin") >= 0 && typeof(cssua) != "undefined" && cssua.ua.ios &&
18084      (stackTraceIgnore.indexOf("extractforms") >= 0 || stackTraceIgnore.indexOf("preparepasswordforms") >= 0 ||
18085      stackTraceIgnore.indexOf("haspasswordfield") >= 0 || stackTraceIgnore.indexOf("findpasswordforms") >= 0)) {
18086      return true;
18087   }
18088   /* Case 30: ****.data.indexOf is not a function */
18089   if(/[a-z0-9]+\.data\.indexof\ is\ not\ a\ function/i.test(descriptionIgnore) &&
18090      userAgentIgnore.indexOf("chrome") >= 0) {
18091      return true;
18092   }
18093   /* Case 31: InvalidCharacterError */
18094   if(descriptionIgnore.indexOf("invalidcharactererror") >= 0) {
18095      return true;
18096   }
18097   /* Case 32: a.apply is not a function */
18098   if(descriptionIgnore.indexOf("a.apply is not a function") >= 0) {
18099      return true;
18100   }
18101   /* Case 33: Cannot read property 'getBoundingClientRect' of null */
18102   if(descriptionIgnore.indexOf("cannot read property 'getboundingclientrect' of null") >= 0) {
18103      return true;
18104   }
18105   /* Case 34: navigator.sendBeacon is not a function */
18106   if(descriptionIgnore.indexOf("navigator.sendbeacon is not a function") >= 0) {
18107      return true;
18108   }
18109   /* Case 35: Unable to get property 'parse' of undefined or null reference. Stack trace: jsc.traffic-media.co.uk */
18110   if(descriptionIgnore.indexOf("unable to get property 'parse' of undefined or null reference") >= 0 &&
18111      stackTraceIgnore.indexOf("jsc.traffic-media.co.uk") >= 0) {
18112      return true;
18113   }
18114   /* Case 36: Stack trace contains "chrome-extension://" */
18115   if(stackTraceIgnore.indexOf("chrome-extension://") >= 0) {
18116      return true;
18117   }
18118   /* Case 37: Event is not defined (based on stack trace) */
18119   if(descriptionIgnore.indexOf("event is not defined") >= 0 && (stackTraceIgnore.indexOf("setupemulatorgamebanner") >= 0 ||
18120      /^[a-z0-9][a-z0-9][a-z0-9][a-z0-9]\/<@/i.test(stackTraceIgnore) || /^[a-z0-9][a-z0-9][a-z0-9][a-z0-9]?@/i.test(stackTraceIgnore))) {
18121      return true;
18122   }
18123   /* Case 38: androidInterface is not defined (Fillr plugin) */
18124   if(descriptionIgnore.indexOf("androidinterface is not defined") >= 0 && stackTraceIgnore.indexOf("fillr") >= 0) {
18125      return true;
18126   }
18127   /* Case 40: allocation size overflow from Incapsula */
18128   if(descriptionIgnore.indexOf("allocation size overflow") >= 0 && urlIgnore.indexOf("_incapsula_resource") >= 0) {
18129      return true;
18130   }
18131   /* Case 41: s2s is not defined */
18132   if(descriptionIgnore.indexOf("s2s is not defined") >= 0) {
18133      return true;
18134   }
18135   /* Case 42: Cannot find function getClientRects */
18136   if(descriptionIgnore.indexOf("Cannot find function getClientRects") >= 0 && stackTraceIgnore == "") {
18137      return true;
18138   }
18139   /* Case 43: Chrome bug __gCrWeb.autofill.extractForms on iOS Chrome */
18140   if(descriptionIgnore.indexOf("undefined is not an object (evaluating '__gcrweb.autofill.extractforms')") >= 0 && userAgentIgnore.indexOf("crios") >= 0) {
18141      return true;
18142   }
18143   /* Case 44: Headless Chrome */
18144   if(userAgentIgnore.indexOf("chrome headless") >= 0) {
18145      return true;
18146   }
18147   /* Case 45: keydown of undefined from Telerik */
18148   if(descriptionIgnore.indexOf("cannot read property 'keydown' of undefined") >= 0 && urlIgnore.indexOf("telerik.web.ui.webresource.axd") >= 0) {
18149      return true;
18150   }
18151   /* Case 46: error 800a025e from Telerik */
18152   if(descriptionIgnore.indexOf("could not complete the operation due to error 800a025e") >= 0 && urlIgnore.indexOf("telerik.web.ui.webresource.axd") >= 0) {
18153      return true;
18154   }
18155   /* Case 47: appendChild undefined on Mac Safari */
18156   if(descriptionIgnore.indexOf("undefined is not an object (evaluating 'document.getelementsbytagname('body')[0].appendchild')") >= 0 && userAgentIgnore.indexOf("safari") >= 0 &&
18157      (userAgentIgnore.indexOf("macos") >= 0 || userAgentIgnore.indexOf("os x") >= 0 ))
18158   {
18159      return true;
18160   }
18161   /* Case 48: g is not defined on Chrome */
18162   if(descriptionIgnore.indexOf("g is not defined") >= 0 && userAgentIgnore.indexOf("chrome") >= 0) {
18163      return true;
18164   }
18165   /* Case 49: c is null from progress indicator on Firefox */
18166   if(descriptionIgnore.indexOf("c is null") >= 0 && userAgentIgnore.indexOf("firefox") >
18166= 0 && stackTraceIgnore.indexOf("progressindicator") >= 0) {
18167      return true;
18168   }
18169   /* Case 50: keyCode of undefined from RadWindow */
18170   if(descriptionIgnore.indexOf("Cannot read property 'keyCode' of undefined") >= 0 && stackTraceIgnore.indexOf("radwindowprompt_detectenter") >= 0) {
18171      return true;
18172   }
18173   /* Case 51: Avast plugin */
18174   if(descriptionIgnore.indexOf("_avast_") >= 0) {
18175      return true;
18176   }
18177   /* Case 52: window.navigator.appName is undefined in Chrome 56 */
18178   if(descriptionIgnore.indexOf("window.navigator.appname") >= 0 && userAgentIgnore.indexOf("chrome/56") >= 0) {
18179      return true;
18180   }
18181   /* Case 53: s is null in Firefox on the LawDepotEditor */
18182   if(descriptionIgnore.indexOf("s is null") >= 0 && userAgentIgnore.indexOf("firefox") >= 0 && urlIgnore.indexOf("lawdepoteditor") >= 0) {
18183      return true;
18184   }
18185   /* Case 54: jQuery extension methods not callable */
18186   if(descriptionIgnore.indexOf("$(...).dialog is not a function") >= 0 || descriptionIgnore.indexOf("messagediv.dialog is not a function") >= 0 ||
18187      descriptionIgnore.indexOf("$(...).tabs is not a function") >= 0 || descriptionIgnore.indexOf("$(...).accordion is not a function") >= 0 ||
18188      descriptionIgnore.indexOf("$(...).autocomplete is not a function") >= 0 || descriptionIgnore.indexOf("mobilecontractmenu.accordion is not a function") >= 0 ||
18189      descriptionIgnore.indexOf("object doesn't support property or method 'accordion'") >= 0 || descriptionIgnore.indexOf("object doesn't support property or method 'dialog'") >= 0 ||
18190      descriptionIgnore.indexOf("dialogobj.dialog is not a function") >= 0 || descriptionIgnore.indexOf("object doesn't support property or method 'tabs'") >= 0 ||
18191      descriptionIgnore.indexOf("object doesn't support property or method 'autocomplete'") >= 0 || descriptionIgnore.indexOf("$(...).datepicker is not a function") >= 0 ||
18192      descriptionIgnore.indexOf("undefined is not a function (near '...messagediv.dialog...')") >= 0 || descriptionIgnore.indexOf("cannot read property 'autocomplete' of undefined") >= 0 ||
18193      descriptionIgnore.indexOf("$(...).documenttools is not a function") >= 0 || descriptionIgnore.indexOf("undefined is not a function (near '...$('#divdialog').dialog...')") >= 0 ||
18194      descriptionIgnore.indexOf("undefined is not a function (near '...$(\"ul#mobilecontractmenu\").accordion...')") >= 0 || descriptionIgnore.indexOf("$('#' dialogid).dialog is not a function") >= 0 ||
18195      descriptionIgnore.indexOf("$('.tabs').tabs is not a function") >= 0 || descriptionIgnore.indexOf("undefined is not a function (near '...$(\".search_input\").autocomplete...')") >= 0 ||
18196      descriptionIgnore.indexOf("undefined is not a function (near '...mobilecontractmenu.accordion...')") >= 0 || descriptionIgnore.indexOf("undefined is not an object (evaluating '$.ui.autocomplete')") >= 0 ||
18197      descriptionIgnore.indexOf("object doesn't support property or method 'documenttools'") >= 0)
18198   {
18199      return true;
18200   }
18201   /* Case 55: getClientRects */
18202   if(descriptionIgnore.indexOf("cannot find function getclientrects in object") >= 0) {
18203      return true;
18204	}
18205   /* Case 56: Undefined loading preference on Linux*/
18206   if (descriptionIgnore.indexOf("cannot read property style of undefined") >= 0) {
18207		return true;
18208	}
18209   /* Case 57: Undefined vungle */
18210   if(descriptionIgnore.indexOf("vungle") >= 0) {
18211      return true;
18212   }
18213   /* Case 58: Uncaught TypeError: Cannot read properties of undefined (reading 'split') */
18214   if (descriptionIgnore.indexOf("cannot read properties of undefined (reading 'split')") >= 0 &&
18215   	   stackTraceIgnore.indexOf("xmlhttprequest.<anonymous>") >= 0) {
18216      return true;
18217   }
18218
18219   /* Case ##:  * /
18220   if(descriptionIgnore.indexOf("") >= 0) {
18221      return true;
18222   }*/
18223
18224   return false;
18225}
18226
18227/* If the jQuery migration warning should be ignored. */
18228function shouldIgnoreMigrationWarning(description, url) {
18229   var descriptionIgnore = description ? unescape(description.toLowerCase()).trim() : "";
18230   var urlIgnore = url ? unescape(url.toLowerCase()) : "";
18231
18232   /* Case 1: quirks mode on /contracts */
18233   if(descriptionIgnore == "jquery is not compatible with quirks mode" && /\/contracts$/i.test(urlIgnore)) {
18234      return true;
18235   }
18236
18237   return false;
18238}
18239
18240/* End Include errorHandler */
18241
18242/* Include fixCountryClass */
18243function fixHtmlCountryClass() {
18244   var html = document.getElementsByTagName("HTML");
18245   if(!html || !html.length) return;
18246   html = html[0];
18247   var classes = html.className ? html.className.split(" ") : [];
18248   for(var i = 0; i < classes.length; i++) {
18249      if(/^country[A-Z][A-Z]$/.test(classes[i].trim())) {
18250         return;
18251      }
18252   }
18253   var countryCode = getCountry() || "US";
18254   html.className += (html.className ? " " : "") + "country" + countryCode;
18255}
18256fixHtmlCountryClass();
18257/* End Include fixCountryClass */
18258
18259/* Include history */
18260function supportsHistory(){
18261   return (window.history && window.history.pushState)
18262}
18263
18264/**
18265 * Push (back button will return to state before push) or replace (back button will skip over state before push) a new state to the page, which can update the query string.
18266 * @param {object} changes A state object used to track the current state
18267 * @param {string} name Unused in every browser except safari, pass an empty string to be safe. See https://developer.mozilla.org/en-US/docs/Web/API/History_API
18268 * @param {string} queryString The entire query string that will exist in the new state
18269 * @param {boolean} replace If true, will replace, otherwise will push
18270 */
18271function pushState(changes, name, queryString, replace){
18272   if(supportsHistory()){
18273      var stateTracker = getCurrentState();
18274      if(!isStateTracker(stateTracker)){
18275         /* Before pushing a new state make sure the current state can be backed up to properly by replacing it with a custom state. */
18276         setBaseState();
18277         stateTracker = getCurrentState();
18278      }
18279      var newStateTracker = new StateTracker(stateTracker);
18280      $.extend(newStateTracker, changes);
18281      if(typeof(queryString) == "undefined") queryString = null; /* This will append /undefined/ to the URL in IE and Edge if the queryString is undefined, but it's fine if it's null */
18282      if(replace){
18283         window.history.replaceState(newStateTracker, name, queryString);
18284      }
18285      else{
18286         window.history.pushState(newStateTracker, name, queryString);
18287      }
18288   }
18289}
18290function setBaseState(){
18291   window.history.replaceState(new StateTracker(getCurrentState(), false), null);
18292}
18293function initState(){
18294   if(supportsHistory() && parent == self && isStateTracker(getCurrentState())){
18295      setBaseState();
18296      loadState(getCurrentState());
18297   }
18298}
18299if(typeof($) == "function"){
18300   $(initState);
18301}
18302else{
18303   rE(window, "load", initState);
18304}
18305function getOriginalReferrer(){
18306   var state = getCurrentState();
18307   if(isStateTracker(state) && state.OriginalReferrer){
18308      return state.OriginalReferrer;
18309   }
18310   return document.referrer;
18311}
18312function StateTracker(otherTracker, fullCopy){
18313   if(typeof(fullCopy) == "undefined") fullCopy = true; 
18314   this.DialogOpen = false;
18315   this.BannerNavOpen = false;
18316   this.BannerSearchOpen = false;
18317   this.SignInMode = null;
18318   this.OriginalReferrer = document.referrer;
18319   this.Section = getQueryStringValue("s");
18320   this.Group = getQueryStringValue("g");
18321   this.MyDocumentsFolderId = null;
18322
18323   if(!this.Section && typeof(qnh) != "undefined" && qnh && qnh.Sections && qnh.Sections.length > 0) this.Section = qnh.Sections[0].ID;
18324   if(!this.Group && typeof(qnh) != "undefined" && qnh && qnh.Groups && qnh.Groups.GetLength() > 0) this.Group = qnh.Groups.Get(0).ID;
18325   
18326   if(typeof(otherTracker) != "undefined" && otherTracker != null){
18327      if(typeof(otherTracker.SignInMode) == "string"){
18328         this.SignInMode = otherTracker.SignInMode;
18329      }
18330      if(typeof(otherTracker.OriginalReferrer) == "string" && otherTracker.OriginalReferrer){
18331         this.OriginalReferrer = otherTracker.OriginalReferrer;
18332      }
18333      if(otherTracker.Section) this.Section = otherTracker.Section;
18334      if(otherTracker.Group) this.Group = otherTracker.Group;
18335
18336      if(typeof(otherTracker.MyDocumentsFolderId) == "number")
18337         this.MyDocumentsFolderId = otherTracker.MyDocumentsFolderId;
18338   }
18339
18340   if(this.SignInMode == null){
18341      this.SignInMode = getDefaultSignInMode();
18342   }
18343
18344   if(this.MyDocumentsFolderId == null && typeof(MyDocuments) !="undefined"){
18345      this.MyDocumentsFolderId = MyDocuments.getCurrentFolderId();
18346   }
18347
18348   if(fullCopy){
18349      if(typeof(otherTracker) != "undefined" && otherTracker != null && typeof(otherTracker.DialogOpen) == "boolean"){
18350         this.DialogOpen = otherTracker.DialogOpen;
18351      }
18352      if(typeof(otherTracker) != "undefined" && otherTracker != null && typeof(otherTracker.BannerNavOpen) == "boolean"){
18353         this.BannerNavOpen = otherTracker.BannerNavOpen;
18354      }
18355      if(typeof(otherTracker) != "undefined" && otherTracker != null && typeof(otherTracker.BannerSearchOpen) == "boolean"){
18356         this.BannerSearchOpen = otherTracker.BannerSearchOpen;
18357      }
18358   }
18359}
18360function loadState(stateObj){
18361   if(stateObj == null || !isStateTracker(stateObj)){
18362      stateObj = new StateTracker();
18362 /* Load a default state if the state tracker is null */
18363   }
18364   if(!stateObj.DialogOpen){
18365      closeAllOpenDialogs();
18366      /* There seems to be some issues with some thing running after this that causes odd behavior (known issue: showing alerts when closing sign in dialog it can scroll away from the alert). Using setTimeout seems to fix it, but may just be creating a race condition with some other unknown code. */
18367      setTimeout(function() { 
18368         if(afterDialogClose != null){ 
18369            afterDialogClose(); 
18370            afterDialogClose = null; 
18371         } 
18372      }, 0);
18373      clearDialogStyles();
18374   }
18375   if(typeof(swapBannerNav) == "function"){
18376      swapBannerNav(stateObj.BannerNavOpen);
18377   }
18378   if(typeof(swapBannerSearch) == "function"){
18379      swapBannerSearch(stateObj.BannerSearchOpen);
18380   }
18381   if(typeof(setSignInMode) == "function"){
18382      setSignInMode(stateObj.SignInMode);
18383   }
18384   if(typeof(MyDocuments) !="undefined" && typeof(MyDocuments.changeCurrentFolderId) == "function"){
18385      MyDocuments.changeCurrentFolderId(stateObj.MyDocumentsFolderId);
18386   }
18387
18388    if ((stateObj.Section || stateObj.Group)) qnh.LoadGroupAndSection();
18389}
18390
18391function isStateTracker(state){
18392   if(state != null && typeof(state.DialogOpen) == "boolean"){
18393      return true;
18394   }
18395   return false;
18396}
18397function getCurrentState(){
18398   return window.history.state;
18399}
18400if(typeof($) == "function"){
18401   $(window).on("popstate", popState);
18402}
18403function popState(ev){
18404   /* Close any open tooltips */
18405   $(".ui-tooltip").remove();
18406
18407   if(typeof isMyDocumentsPage !== "undefined" && isMyDocumentsPage && typeof(removeMyDocsToggleFunctionality) == "function"){
18408      removeMyDocsToggleFunctionality();
18409   }
18410   
18411   if(typeof(ev.originalEvent) != "undefined" && ev.originalEvent.state !== null){
18412      loadState(ev.originalEvent.state);
18413   }
18414}
18415/* End Include history */
18416
18417/* Include jQuery.XDomainRequest */
18418/*!
18419 * jQuery-ajaxTransport-XDomainRequest - v1.0.4 - 2015-03-05
18420 * https://github.com/MoonScript/jQuery-ajaxTransport-XDomainRequest
18421 * Copyright (c) 2015 Jason Moon (@JSONMOON)
18422 * Licensed MIT (/blob/master/LICENSE.txt)
18423 */
18424if(typeof(jQuery) != "undefined") {
18425   (function(factory) {
18426     if (typeof define === 'function' && define.amd) {
18427       // AMD. Register as anonymous module.
18428       define(['jquery'], factory);
18429     } else if (typeof exports === 'object') {
18430       // CommonJS
18431       module.exports = factory(require('jquery'));
18432     } else {
18433       // Browser globals.
18434       factory(jQuery);
18435     }
18436   }(function($) {
18437
18438   // Only continue if we're on IE8/IE9 with jQuery 1.5+ (contains the ajaxTransport function)
18439   if ($.support.cors || !$.ajaxTransport || !window.XDomainRequest) {
18440     return $;
18441   }
18442
18443   var httpRegEx = /^(https?:)?\/\//i;
18444   var getOrPostRegEx = /^get|post$/i;
18445   var sameSchemeRegEx = new RegExp('^(\/\/|' + location.protocol + ')', 'i');
18446
18447   // ajaxTransport exists in jQuery 1.5+
18448   $.ajaxTransport('* text html xml json', function(options, userOptions, jqXHR) {
18449
18450     // Only continue if the request is: asynchronous, uses GET or POST method, has HTTP or HTTPS protocol, and has the same scheme as the calling page
18451     if (!options.crossDomain || !options.async || !getOrPostRegEx.test(options.type) || !httpRegEx.test(options.url) || !sameSchemeRegEx.test(options.url)) {
18452       return;
18453     }
18454
18455     var xdr = null;
18456
18457     return {
18458       send: function(headers, complete) {
18459         var postData = '';
18460         var userType = (userOptions.dataType || '').toLowerCase();
18461
18462         xdr = new XDomainRequest();
18463         if (/^\d+$/.test(userOptions.timeout)) {
18464           xdr.timeout = userOptions.timeout;
18465         }
18466
18467         xdr.ontimeout = function() {
18468           complete(500, 'timeout');
18469         };
18470
18471         xdr.onload = function() {
18472           var allResponseHeaders = 'Content-Length: ' + xdr.responseText.length + '\r\nContent-Type: ' + xdr.contentType;
18473           var status = {
18474             code: 200,
18475             message: 'success'
18476           };
18477           var responses = {
18478             text: xdr.responseText
18479           };
18480           try {
18481             if (userType === 'html' || /text\/html/i.test(xdr.contentType)) {
18482               responses.html = xdr.responseText;
18483             } else if (userType === 'json' || (userType !== 'text' && /\/json/i.test(xdr.contentType))) {
18484               try {
18485                 responses.json = $.parseJSON(xdr.responseText);
18486               } catch(e) {
18487                 status.code = 500;
18488                 status.message = 'parseerror';
18489                 //throw 'Invalid JSON: ' + xdr.responseText;
18490               }
18491             } else if (userType === 'xml' || (userType !== 'text' && /\/xml/i.test(xdr.contentType))) {
18492               var doc = new ActiveXObject('Microsoft.XMLDOM');
18493               doc.async = false;
18494               try {
18495                 doc.loadXML(xdr.responseText);
18496               } catch(e) {
18497                 doc = undefined;
18498               }
18499               if (!doc || !doc.documentElement || doc.getElementsByTagName('parsererror').length) {
18500                 status.code = 500;
18501                 status.message = 'parseerror';
18502                 throw 'Invalid XML: ' + xdr.responseText;
18503               }
18504               responses.xml = doc;
18505             }
18506           } catch(parseMessage) {
18507             throw parseMessage;
18508           } finally {
18509             complete(status.code, status.message, responses, allResponseHeaders);
18510           }
18511         };
18512
18513         // set an empty handler for 'onprogress' so requests don't get aborted
18514         xdr.onprogress = function(){};
18515         xdr.onerror = function() {
18516           complete(500, 'error', {
18517             text: xdr.responseText
18518           });
18519         };
18520
18521         if (userOptions.data) {
18522           postData = ($.type(userOptions.data) === 'string') ? userOptions.data : $.param(userOptions.data);
18523         }
18524         xdr.open(options.type, options.url);
18525         xdr.send(postData);
18526       },
18527       abort: function() {
18528         if (xdr) {
18529           xdr.abort();
18530         }
18531       }
18532     };
18533   });
18534
18535   return $;
18536
18537   }));
18538}
18539
18540/* End Include jQuery.XDomainRequest */
18541
18542/* Include jQueryMigrate */
18543/*!
18544 * jQuery Migrate - v3.0.1 - 2017-09-26
18545 * Copyright jQuery Foundation and other contributors
18546 */
18547;( function( factory ) {
18548	if ( typeof define === "function" && define.amd ) {
18549
18550		// AMD. Register as an anonymous module.
18551		define( [ "jquery" ], window, factory );
18552	} else if ( typeof module === "object" && module.exports ) {
18553
18554		// Node/CommonJS
18555		// eslint-disable-next-line no-undef
18556		module.exports = factory( require( "jquery" ), window );
18557	} else {
18558
18559		// Browser globals
18560		factory( jQuery, window );
18561	}
18562} )( function( jQuery, window ) {
18563"use strict";
18564
18565
18566jQuery.migrateVersion = "3.0.1";
18567jQuery.migrateMute = true;
18568jQuery.migrateMuteAll = false;
18569
18570/* exported migrateWarn, migrateWarnFunc, migrateWarnProp */
18571
18572( function() {
18573
18574	var rbadVersions = /^[12]\./;
18575
18576	// Support: IE9 only
18577	// IE9 only creates console object when dev tools are first opened
18578	// IE9 console is a host object, callable but doesn't have .apply()
18579	if ( !window.console || !window.console.log ) {
18580		return;
18581	}
18582
18583	// Need jQuery 3.0.0+ and no older Migrate loaded
18584	if ( !jQuery || rbadVersions.test( jQuery.fn.jquery ) ) {
18585		window.console.log( "JQMIGRATE: jQuery 3.0.0+ REQUIRED" );
18586      logMigrateMessage("Old jQuery version detected.", false);
18587	}
18588	if ( jQuery.migrateWarnings ) {
18589		window.console.log( "JQMIGRATE: Migrate plugin loaded multiple times" );
18590	}
18591
18592	// Show a message on the console so devs know we're active
18593	jQuery.migrateMute || window.console.log( "JQMIGRATE: Migrate is installed" +
18594		( jQuery.migrateMute ? "" : " with logging active" ) +
18595		", version " + jQuery.migrateVersion );
18596
18597} )();
18598
18599var warnedAbout = {};
18600
18601// List of warnings already given; public read only
18602jQuery.migrateWarnings = [];
18603
18604// Set to false to disable traces that appear with warnings
18605if ( jQuery.migrateTrace === undefined ) {
18606	jQuery.migrateTrace = true;
18607}
18608
18609// Forget any warnings we've already given; public
18610jQuery.migrateReset = function() {
18611	warnedAbout = {};
18612	jQuery.migrateWarnings.length = 0;
18613};
18614
18615function migrateWarn( msg ) {
18616   if ( !jQuery.migrateMuteAll ) {
18617      var console = window.console;
18618      if ( !warnedAbout[ msg ] && !isIgnoredMigrateMessage(msg) ) {
18619         warnedAbout[ msg ] = true;
18620         jQuery.migrateWarnings.push( msg );
18621         if ( console && console.warn && !jQuery.migrateMute ) {
18622            console.warn( "JQMIGRATE: " + msg );
18623            if ( jQuery.migrateTrace && console.trace ) {
18624               console.trace();
18625            }
18626         }
18627         logMigrateMessage(msg, true);
18628      }
18629   }
18630}
18631
18632function logMigrateMessage(msg, useStack) {
18633   if(typeof(logErrorMessage) == "function" && typeof(url_escape) == "function") {
18634      var stack = "";
18635      if(useStack) try { var a = {}; a.debug(); } catch(ex) { stack = ex.stack; }
18636      logErrorMessage(url_escape(msg), url_escape(location.href), 0, url_escape(location.href), "jQueryMigrate.log", url_escape(stack));
18637   }
18638}
18639
18640function isIgnoredMigrateMessage(msg) {
18641   var userAgent = getUserAgentString();
18642   var stack = "";
18643   try { var a = {}; a.debug(); } catch(ex) { stack = ex.stack; }
18644   var url = location.href.toLowerCase();
18645
18646   if(userAgent.toLowerCase().indexOf("opera mini") >= 0) { /* Opera Mini has many issues, so ignore it, as it's not a supported browser. */
18647      return true;
18648   }
18649   if(msg == "'jQuery.easing.swing' should use only one argument") { /* Ignore until we can update Telerik */
18650      return true;
18651   }
18652   if((userAgent.toLowerCase().indexOf("opera") >= 0 || !userAgent) && msg == "jQuery.isNumeric() should not be called on constructed objects") { /* Opera has an issue with jQuery.isNumeric, so ignore this */
18653      return true;
18654   }
18655   if(userAgent.toLowerCase().indexOf("bot") >= 0 || !userAgent) { /* Bots are caching old versions of some files, so ignore warnings for bots */
18656      return true;
18657   }
18658   if(url.indexOf("file:") == 0 || url.indexOf("mhtml:") == 0 || url.indexOf("content:") == 0) { /* Ignore any warnings from people who opened a locally saved copy of the HTML */
18659      return true;
18660   }
18661   if(!jQuery.migrateMute && msg == "jQuery is not compatible with Quirks Mode") { /* Ignore quirks mode issues on test/qc, as these can be caused by code in development. */
18662      return true;
18663   }
18664   if(msg.toLowerCase().indexOf("jquery.fn.offset() requires an element connected to a document") >= 0 && stack.toLowerCase().indexOf("maps.googleapis.com") >= 0) { /* Ignore "offset() requires an element connected to a document" errors when running code from maps.googleapis.com */
18665      return true;
18666   }
18667   if(msg.toLowerCase().indexOf("jquery.fn.offset() requires a valid dom element: unknown") >= 0) { /* Ignore "offset requires a valid DOM element: unknown", as this is not fixable */
18668      return true;
18669   }
18670   /* Ignore offset issue on Linux Chrome */
18671   if(userAgent.toLowerCase().indexOf("x11; linux") >= 0 && userAgent.toLowerCase().indexOf("chrome") >= 0 && msg.toLowerCase().indexOf("jquery.fn.offset()") >= 0) 
18672   {
18673      return true;
18674   }
18675   /* Ignore load issue on Linux Chrome */
18676   if(userAgent.toLowerCase().indexOf("x11; linux") >= 0 && userAgent.toLowerCase().indexOf("chrome") >= 0 && msg.toLowerCase().indexOf("jquery(window).on('load'...)") >= 0) 
18677   {
18678      return true;
18679   }
18680   if(msg.indexOf("deprecated") >= 0) { /* Specific ignore rules for deprecated warnings. */
18681      if(msg.indexOf("jQuery.fx.interval") >= 0) { /* Ignore the interval warning, as this is coming from jQuery UI. */
18682         return true;
18683      }
18684
18685      /* Ignore some events from third party plugins. */
18686      if(stack.indexOf("clickintext") >= 0 || stack.indexOf("akamaihd") >= 0 || stack.indexOf("chrome-extension:") >= 0 || stack.indexOf("microsofttranslator") >= 0
18687         || stack.indexOf("davebestdeals") >= 0 || stack.indexOf("hwcdn.net") >= 0 || stack.indexOf("moz-extension:") >= 0 || stack.indexOf("phantomjs:") >= 0
18688         || stack.indexOf("haiphongorder") >
18688= 0 || stack.indexOf("inline.masterquizzes.com") >= 0 || stack.indexOf("inline.personalityask.com") >= 0
18689         || stack.indexOf("inline.playshort.com") >= 0 || stack.indexOf("inline.quizdestiny.com") >= 0 || stack.indexOf("marker.to") >= 0
18690         || stack.indexOf("prod.degreedcdn.com") >= 0 || stack.indexOf("safari-extension:") >= 0 || stack.indexOf("__puppeteer") >= 0 || stack.indexOf("killItWithFire") >= 0
18691         || stack.indexOf("inline.quizcent.com") >= 0)
18692      {
18693         return true;
18694      }
18695
18696      /* Ignore focus events from anonymous code i or l/< function */
18697      if(msg.indexOf("jQuery.fn.focus()") >= 0 && (stack.indexOf("i (<anonymous>") >= 0 || stack.indexOf("l/<@") >= 0 || stack.indexOf("i/<@") >= 0)) {
18698         return true;
18699      }
18700
18701      /* Ignore unbind events from anonymous code ats function */
18702      if(msg.indexOf("jQuery.fn.unbind()") >= 0 && (stack.indexOf("ats (<anonymous>") >= 0 || stack.indexOf("ats@javascript") >= 0)) {
18703         return true;
18704      }
18705
18706      /* Ignore select events from anonymous code */
18707      if(msg.indexOf("jQuery.fn.select()") >= 0 && stack.indexOf("<anonymous>:1") >= 0) {
18708         return true;
18709      }
18710
18711      /* Ignore some events from Telerik, as we have no control over this code, and this is still present in the latest version. */
18712      if(stack.indexOf("Telerik.Web.UI.WebResource.axd") >=0 && (msg.indexOf("jQuery.fn.bind()") >= 0 || msg.indexOf("jQuery.fn.unbind()") >= 0 || msg.indexOf("jQuery.fn.andSelf()") >= 0
18713         || msg.indexOf("jQuery.fn.focus()") >= 0)) 
18714      { 
18715         return true;
18716      }
18717
18718      /* Ignore some events from contracts until everything is using DCSMain2.92 or higher. */
18719      var isContractUrl = (url.indexOf("/contracts/") > 0 || url.indexOf("/real-estate/") > 0 || url.indexOf("/famille/") > 0 || url.indexOf("/commerce/") > 0
18720         || url.indexOf("/immobilier/") > 0 || url.indexOf("/vertraege/") > 0 || url.indexOf("/onlineforms/") > 0 || url.indexOf("/contract/") > 0 || url.indexOf("/legaltemplates/") > 0)
18721         || url.indexOf("/conracts/") > 0 || url.indexOf("/au/") > 0 || url.indexOf("/us/") > 0 || url.indexOf("/ca/") > 0 || url.indexOf("/ca-fr/") > 0 || url.indexOf("/in/") > 0
18722         || url.indexOf("/nz/") > 0 || url.indexOf("/ng/") > 0 || url.indexOf("/sg/") > 0 || url.indexOf("/ie/") > 0;
18723      if(((typeof(dcsVersion) != "undefined" && !isNaN(dcsVersion) && dcsVersion < 2.92) || isContractUrl) && 
18724         (msg.indexOf("jQuery.fn.bind()") >= 0 || msg.indexOf("jQuery.fn.change()") >= 0 || msg.indexOf("jQuery.fn.click()") >= 0 || msg.indexOf("jQuery.fn.focus()") >= 0
18725         || msg.indexOf("jQuery.fn.unbind()") >= 0)) 
18726      {
18727         return true;
18728      }
18729   }
18730   return false;
18731}
18732
18733function migrateWarnProp( obj, prop, value, msg ) {
18734	Object.defineProperty( obj, prop, {
18735		configurable: true,
18736		enumerable: true,
18737		get: function() {
18738			migrateWarn( msg );
18739			return value;
18740		},
18741		set: function( newValue ) {
18742			migrateWarn( msg );
18743			value = newValue;
18744		}
18745	} );
18746}
18747
18748function migrateWarnFunc( obj, prop, newFunc, msg ) {
18749	obj[ prop ] = function() {
18750		migrateWarn( msg );
18751		return newFunc.apply( this, arguments );
18752	};
18753}
18754
18755if ( window.document.compatMode === "BackCompat" ) {
18756
18757	// JQuery has never supported or tested Quirks Mode
18758	migrateWarn( "jQuery is not compatible with Quirks Mode" );
18759}
18760
18761
18762var oldInit = jQuery.fn.init,
18763	oldIsNumeric = jQuery.isNumeric,
18764	oldFind = jQuery.find,
18765	rattrHashTest = /\[(\s*[-\w]+\s*)([~|^$*]?=)\s*([-\w#]*?#[-\w#]*)\s*\]/,
18766	rattrHashGlob = /\[(\s*[-\w]+\s*)([~|^$*]?=)\s*([-\w#]*?#[-\w#]*)\s*\]/g;
18767
18768jQuery.fn.init = function( arg1 ) {
18769	var args = Array.prototype.slice.call( arguments );
18770
18771	if ( typeof arg1 === "string" && arg1 === "#" ) {
18772
18773		// JQuery( "#" ) is a bogus ID selector, but it returned an empty set before jQuery 3.0
18774		migrateWarn( "jQuery( '#' ) is not a valid selector" );
18775		args[ 0 ] = [];
18776	}
18777
18778	return oldInit.apply( this, args );
18779};
18780jQuery.fn.init.prototype = jQuery.fn;
18781
18782jQuery.find = function( selector ) {
18783	var args = Array.prototype.slice.call( arguments );
18784
18785	// Support: PhantomJS 1.x
18786	// String#match fails to match when used with a //g RegExp, only on some strings
18787	if ( typeof selector === "string" && rattrHashTest.test( selector ) ) {
18788
18789		// The nonstandard and undocumented unquoted-hash was removed in jQuery 1.12.0
18790		// First see if qS thinks it's a valid selector, if so avoid a false positive
18791		try {
18792			window.document.querySelector( selector );
18793		} catch ( err1 ) {
18794
18795			// Didn't *look* valid to qSA, warn and try quoting what we think is the value
18796			selector = selector.replace( rattrHashGlob, function( _, attr, op, value ) {
18797				return "[" + attr + op + "\"" + value + "\"]";
18798			} );
18799
18800			// If the regexp *may* have created an invalid selector, don't update it
18801			// Note that there may be false alarms if selector uses jQuery extensions
18802			try {
18803				window.document.querySelector( selector );
18804				migrateWarn( "Attribute selector with '#' must be quoted: " + args[ 0 ] );
18805				args[ 0 ] = selector;
18806			} catch ( err2 ) {
18807				migrateWarn( "Attribute selector with '#' was not fixed: " + args[ 0 ] );
18808			}
18809		}
18810	}
18811
18812	return oldFind.apply( this, args );
18813};
18814
18815// Copy properties attached to original jQuery.find method (e.g. .attr, .isXML)
18816var findProp;
18817for ( findProp in oldFind ) {
18818	if ( Object.prototype.hasOwnProperty.call( oldFind, findProp ) ) {
18819		jQuery.find[ findProp ] = oldFind[ findProp ];
18820	}
18821}
18822
18823// The number of elements contained in the matched element set
18824jQuery.fn.size = function() {
18825	migrateWarn( "jQuery.fn.size() is deprecated and removed; use the .length property" );
18826	return this.length;
18827};
18828
18829jQuery.parseJSON = function() {
18830	migrateWarn( "jQuery.parseJSON is deprecated; use JSON.parse" );
18831	return JSON.parse.apply( null, arguments );
18832};
18833
18834jQuery.isNumeric = function( val ) {
18835
18836	// The jQuery 2.2.3 implementation of isNumeric
18837	function isNumeric2( obj ) {
18838		var realStringObj = obj && obj.toString();
18839		return !jQuery.isArray( obj ) && ( realStringObj - parseFloat( realStringObj ) + 1 ) >= 0;
18840	}
18841
18842	var newValue = oldIsNumeric( val ),
18843		oldValue = isNumeric2( val );
18844
18845	if ( newValue !== oldValue ) {
18846		migrateWarn( "jQuery.isNumeric() should not be called on constructed objects" );
18847	}
18848
18849	return oldValue;
18850};
18851
18852migrateWarnFunc( jQuery, "holdReady", jQuery.holdReady,
18853	"jQuery.holdReady is deprecated" );
18854
18855migrateWarnFunc( jQuery, "unique", jQuery.uniqueSort,
18856	"jQuery.unique is deprecated; use jQuery.uniqueSort" );
18857
18858// Now jQuery.expr.pseudos is the standard incantation
18859migrateWarnProp( jQuery.expr, "filters", jQuery.expr.pseudos,
18860	"jQuery.expr.filters is deprecated; use jQuery.expr.pseudos" );
18861migrateWarnProp( jQuery.expr, ":", jQuery.expr.pseudos,
18862	"jQuery.expr[':'] is deprecated; use jQuery.expr.pseudos" );
18863
18864
18865var oldAjax = jQuery.ajax;
18866
18867jQuery.ajax = function( ) {
18868	var jQXHR = oldAjax.apply( this, arguments );
18869
18870	// Be sure we got a jQXHR (e.g., not sync)
18871	if ( jQXHR.promise ) {
18872		migrateWarnFunc( jQXHR, "success", jQXHR.done,
18873			"jQXHR.success is deprecated and removed" );
18874		migrateWarnFunc( jQXHR, "error", jQXHR.fail,
18875			"jQXHR.error is deprecated and removed" );
18876		migrateWarnFunc( jQXHR, "complete", jQXHR.always,
18877			"jQXHR.complete is deprecated and removed" );
18878	}
18879
18880	return jQXHR;
18881};
18882
18883
18884var oldRemoveAttr = jQuery.fn.removeAttr,
18885	oldToggleClass = jQuery.fn.toggleClass,
18886	rmatchNonSpace = /\S+/g;
18887
18888jQuery.fn.removeAttr = function( name ) {
18889	var self = this;
18890
18891	jQuery.each( name.match( rmatchNonSpace ), function( i, attr ) {
18892		if ( jQuery.expr.match.bool.test( attr ) ) {
18893			migrateWarn( "jQuery.fn.removeAttr no longer sets boolean properties: " + attr );
18894			self.prop( attr, false );
18895		}
18896	} );
18897
18898	return oldRemoveAttr.apply( this, arguments );
18899};
18900
18901jQuery.fn.toggleClass = function( state ) {
18902
18903	// Only deprecating no-args or single boolean arg
18904	if ( state !== undefined && typeof state !== "boolean" ) {
18905		return oldToggleClass.apply( this, arguments );
18906	}
18907
18908	migrateWarn( "jQuery.fn.toggleClass( boolean ) is deprecated" );
18909
18910	// Toggle entire class name of each element
18911	return this.each( function() {
18912		var className = this.getAttribute && this.getAttribute( "class" ) || "";
18913
18914		if ( className ) {
18915			jQuery.data( this, "__className__", className );
18916		}
18917
18918		// If the element has a class name or if we're passed `false`,
18919		// then remove the whole classname (if there was one, the above saved it).
18920		// Otherwise bring back whatever was previously saved (if anything),
18921		// falling back to the empty string if nothing was stored.
18922		if ( this.setAttribute ) {
18923			this.setAttribute( "class",
18924				className || state === false ?
18925				"" :
18926				jQuery.data( this, "__className__" ) || ""
18927			);
18928		}
18929	} );
18930};
18931
18932
18933var internalSwapCall = false;
18934
18935// If this version of jQuery has .swap(), don't false-alarm on internal uses
18936if ( jQuery.swap ) {
18937	jQuery.each( [ "height", "width", "reliableMarginRight" ], function( _, name ) {
18938		var oldHook = jQuery.cssHooks[ name ] && jQuery.cssHooks[ name ].get;
18939
18940		if ( oldHook ) {
18941			jQuery.cssHooks[ name ].get = function() {
18942				var ret;
18943
18944				internalSwapCall = true;
18945				ret = oldHook.apply( this, arguments );
18946				internalSwapCall = false;
18947				return ret;
18948			};
18949		}
18950	} );
18951}
18952
18953jQuery.swap = function( elem, options, callback, args ) {
18954	var ret, name,
18955		old = {};
18956
18957	if ( !internalSwapCall ) {
18958		migrateWarn( "jQuery.swap() is undocumented and deprecated" );
18959	}
18960
18961	// Remember the old values, and insert the new ones
18962	for ( name in options ) {
18963		old[ name ] = elem.style[ name ];
18964		elem.style[ name ] = options[ name ];
18965	}
18966
18967	ret = callback.apply( elem, args || [] );
18968
18969	// Revert the old values
18970	for ( name in options ) {
18971		elem.style[ name ] = old[ name ];
18972	}
18973
18974	return ret;
18975};
18976
18977var oldData = jQuery.data;
18978
18979jQuery.data = function( elem, name, value ) {
18980	var curData;
18981
18982	// Name can be an object, and each entry in the object is meant to be set as data
18983	if ( name && typeof name === "object" && arguments.length === 2 ) {
18984		curData = jQuery.hasData( elem ) && oldData.call( this, elem );
18985		var sameKeys = {};
18986		for ( var key in name ) {
18987			if ( key !== jQuery.camelCase( key ) ) {
18988				migrateWarn( "jQuery.data() always sets/gets camelCased names: " + key );
18989				curData[ key ] = name[ key ];
18990			} else {
18991				sameKeys[ key ] = name[ key ];
18992			}
18993		}
18994
18995		oldData.call( this, elem, sameKeys );
18996
18997		return name;
18998	}
18999
19000	// If the name is transformed, look for the un-transformed name in the data object
19001	if ( name && typeof name === "string" && name !== jQuery.camelCase( name ) ) {
19002		curData = jQuery.hasData( elem ) && oldData.call( this, elem );
19003		if ( curData && name in curData ) {
19004			migrateWarn( "jQuery.data() always sets/gets camelCased names: " + name );
19005			if ( arguments.length > 2 ) {
19006				curData[ name ] = value;
19007			}
19008			return curData[ name ];
19009		}
19010	}
19011
19012	return oldData.apply( this, arguments );
19013};
19014
19015var oldTweenRun = jQuery.Tween.prototype.run;
19016var linearEasing = function( pct ) {
19017		return pct;
19018	};
19019
19020jQuery.Tween.prototype.run = function( ) {
19021	if ( typeof(jQuery.easing[ this.easing ]) == "undefined" || !jQuery.easing[ this.easing ] ) {
19022		migrateWarn(
19023			"'jQuery.easing." + (typeof(this.easing) == "object" ? JSON.stringify(this.easing) : this.easing.toString()) + "' is not defined"
19024		);
19025
19026		jQuery.easing[ this.easing ] = linearEasing;
19027	}
19028	if ( jQuery.easing[ this.easing ].length > 1 ) {
19029		migrateWarn(
19030			"'jQuery.easing." + this.easing.toString() + "' should use only one argument"
19031		);
19032
19033		jQuery.easing[ this.easing ] = linearEasing;
19034	}
19035
19036   if(typeof(this.prop) == "undefined" || !this.prop) this.prop = "";
19037
19038	oldTweenRun.apply( this, arguments );
19039};
19040
19041jQuery.fx.interval = jQuery.fx.interval || 13;
19042
19043// Support: IE9, Android <=4.4
19044// Avoid false positives on browsers that lack rAF
19045if ( window.requestAnimationFrame ) {
19046	migrateWarnProp( jQuery.fx, "interval", jQuery.fx.interval,
19047		"jQuery.fx.interval is deprecated" );
19048}
19049
19050var oldLoad = jQuery.fn.load,
19051	oldEventAdd = jQuery.event.add,
19052	originalFix = jQuery.event.fix;
19053
19054jQuery.event.props = [];
19055jQuery.event.fixHooks = {};
19056
19057migrateWarnProp( jQuery.event.props, "concat", jQuery.event.props.concat,
19058	"jQuery.event.props.concat() is deprecated and removed" );
19059
19060jQuery.event.fix = function( originalEvent ) {
19061	var event,
19062		type = originalEvent.type,
19063		fixHook = this.fixHooks[ type ],
19064		props = jQuery.event.props;
19065
19066	if ( props.length ) {
19067		migrateWarn( "jQuery.event.props are deprecated and removed: " + props.join() );
19068		while ( props.length ) {
19069			jQuery.event.addProp( props.pop() );
19070		}
19071	}
19072
19073	if ( fixHook && !fixHook._migrated_ ) {
19074		fixHook._migrated_ = true;
19075		migrateWarn( "jQuery.event.fixHooks are deprecated and removed: " + type );
19076		if ( ( props = fixHook.props ) && props.length ) {
19077			while ( props.length ) {
19078				jQuery.event.addProp( props.pop() );
19079			}
19080		}
19081	}
19082
19083	event = originalFix.call( this, originalEvent );
19084
19085	return fixHook && fixHook.filter ? fixHook.filter( event, originalEvent ) : event;
19086};
19087
19088jQuery.event.add = function( elem, types ) {
19089
19090	// This misses the multiple-types case but that seems awfully rare
19091	if ( elem === window && types === "load" && window.document.readyState === "complete" ) {
19092		migrateWarn( "jQuery(window).on('load'...) called after load event occurred" );
19093	}
19094	return oldEventAdd.apply( this, arguments );
19095};
19096
19097jQuery.each( [ "load", "unload", "error" ], function( _, name ) {
19098
19099	jQuery.fn[ name ] = function() {
19100		var args = Array.prototype.slice.call( arguments, 0 );
19101
19102		// If this is an ajax load() the first arg should be the string URL;
19103		// technically this could also be the "Anything" arg of the event .load()
19104		// which just goes to show why this dumb signature has been deprecated!
19105		// jQuery custom builds that exclude the Ajax module justifiably die here.
19106		if ( name === "load" && typeof args[ 0 ] === "string" ) {
19107			return oldLoad.apply( this, args );
19108		}
19109
19110		migrateWarn( "jQuery.fn." + name + "() is deprecated" );
19111
19112		args.splice( 0, 0, name );
19113		if ( arguments.length ) {
19114			return this.on.apply( this, args );
19115		}
19116
19117		// Use .triggerHandler here because:
19118		// - load and unload events don't need to bubble, only applied to window or image
19119		// - error event should not bubble to window, although it does pre-1.7
19120		// See http://bugs.jquery.com/ticket/11820
19121		this.triggerHandler.apply( this, args );
19122		return this;
19123	};
19124
19125} );
19126
19127jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
19128	"mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
19129	"change select submit keydown keypress keyup contextmenu" ).split( " " ),
19130	function( i, name ) {
19131
19132	// Handle event binding
19133	jQuery.fn[ name ] = function( data, fn ) {
19134		migrateWarn( "jQuery.fn." + name + "() event shorthand is deprecated" );
19135		return arguments.length > 0 ?
19136			this.on( name, null, data, fn ) :
19137			this.trigger( name );
19138	};
19139} );
19140
19141// Trigger "ready" event only once, on document ready
19142jQuery( function() {
19143	jQuery( window.document ).triggerHandler( "ready" );
19144} );
19145
19146jQuery.event.special.ready = {
19147	setup: function() {
19148		if ( this === window.document ) {
19149			migrateWarn( "'ready' event is deprecated" );
19150		}
19151	}
19152};
19153
19154jQuery.fn.extend( {
19155
19156	bind: function( types, data, fn ) {
19157		migrateWarn( "jQuery.fn.bind() is deprecated" );
19158		return this.on( types, null, data, fn );
19159	},
19160	unbind: function( types, fn ) {
19161		migrateWarn( "jQuery.fn.unbind() is deprecated" );
19162		return this.off( types, null, fn );
19163	},
19164	delegate: function( selector, types, data, fn ) {
19165		migrateWarn( "jQuery.fn.delegate() is deprecated" );
19166		return this.on( types, selector, data, fn );
19167	},
19168	undelegate: function( selector, types, fn ) {
19169		migrateWarn( "jQuery.fn.undelegate() is deprecated" );
19170		return arguments.length === 1 ?
19171			this.off( selector, "**" ) :
19172			this.off( types, selector || "**", fn );
19173	},
19174	hover: function( fnOver, fnOut ) {
19175		migrateWarn( "jQuery.fn.hover() is deprecated" );
19176		return this.on( "mouseenter", fnOver ).on( "mouseleave", fnOut || fnOver );
19177	}
19178} );
19179
19180
19181var oldOffset = jQuery.fn.offset;
19182
19183jQuery.fn.offset = function() {
19184	var docElem,
19185		elem = this[ 0 ],
19186		origin = { top: 0, left: 0 };
19187
19188   var elemId = elem ? (elem.nodeName.toLowerCase() + (elem.id ? "#" + elem.id : "") + (elem.className ? "." + elem.className.replace(/\ +/g, ".") : "")) : "unknown";
19189
19190	if ( !elem || !elem.nodeType ) {
19191		migrateWarn( "jQuery.fn.offset() requires a valid DOM element: " + elemId);
19192		return origin;
19193	}
19194
19195	docElem = ( elem.ownerDocument || window.document ).documentElement;
19196	if ( docElem !== elem && !jQuery.contains( docElem, elem ) ) {
19197		migrateWarn( "jQuery.fn.offset() requires an element connected to a document: " + elemId);
19198		return origin;
19199	}
19200
19201	return oldOffset.apply( this, arguments );
19202};
19203
19204
19205var oldParam = jQuery.param;
19206
19207jQuery.param = function( data, traditional ) {
19208	var ajaxTraditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional;
19209
19210	if ( traditional === undefined && ajaxTraditional ) {
19211
19212		migrateWarn( "jQuery.param() no longer uses jQuery.ajaxSettings.traditional" );
19213		traditional = ajaxTraditional;
19214	}
19215
19216	return oldParam.call( this, data, traditional );
19217};
19218
19219var oldSelf = jQuery.fn.andSelf || jQuery.fn.addBack;
19220
19221jQuery.fn.andSelf = function() {
19222	migrateWarn( "jQuery.fn.andSelf() is deprecated and removed, use jQuery.fn.addBack()" );
19223	return oldSelf.apply( this, arguments );
19224};
19225
19226
19227var oldDeferred = jQuery.Deferred,
19228	tuples = [
19229
19230		// Action, add listener, callbacks, .then handlers, final state
19231		[ "resolve", "done", jQuery.Callbacks( "once memory" ),
19232			jQuery.Callbacks( "once memory" ), "resolved" ],
19233		[ "reject", "fail", jQuery.Callbacks( "once memory" ),
19234			jQuery.Callbacks( "once memory" ), "rejected" ],
19235		[ "notify", "progress", jQuery.Callbacks( "memory" ),
19236			jQuery.Callbacks( "memory" ) ]
19237	];
19238
19239jQuery.Deferred = function( func ) {
19240	var deferred = oldDeferred(),
19241		promise = deferred.promise();
19242
19243	deferred.pipe = promise.pipe = function( /* fnDone, fnFail, fnProgress */ ) {
19244		var fns = arguments;
19245
19246		migrateWarn( "deferred.pipe() is deprecated" );
19247
19248		return jQuery.Deferred( function( newDefer ) {
19249			jQuery.each( tuples, function( i, tuple ) {
19250				var fn = jQuery.isFunction( fns[ i ] ) && fns[ i ];
19251
19252				// Deferred.done(function() { bind to newDefer or newDefer.resolve })
19253				// deferred.fail(function() { bind to newDefer or newDefer.reject })
19254				// deferred.progress(function() { bind to newDefer or newDefer.notify })
19255				deferred[ tuple[ 1 ] ]( function() {
19256					var returned = fn && fn.apply( this, arguments );
19257					if ( returned && jQuery.isFunction( returned.promise ) ) {
19258						returned.promise()
19259							.done( newDefer.resolve )
19260							.fail( newDefer.reject )
19261							.progress( newDefer.notify );
19262					} else {
19263						newDefer[ tuple[ 0 ] + "With" ](
19264							this === promise ? newDefer.promise() : this,
19265							fn ? [ returned ] : arguments
19266						);
19267					}
19268				} );
19269			} );
19270			fns = null;
19271		} ).promise();
19272
19273	};
19274
19275	if ( func ) {
19276		func.call( deferred, deferred );
19277	}
19278
19279	return deferred;
19280};
19281
19282// Preserve handler of uncaught exceptions in promise chains
19283jQuery.Deferred.exceptionHook = oldDeferred.exceptionHook;
19284
19285return jQuery;
19286} );
19287
19288/* End Include jQueryMigrate */
19289
19290/* Include number */
19291var nums=new Array("one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen");
19292var numsOrdinal=new Array("first", "second", "third", "fourth", "fifth", "sixth", "seventh", "eighth", "ninth", "tenth", "eleventh", "twelfth", "thirteenth", "fourteenth", "fifteenth", "sixteenth", "seventeenth", "eighteenth", "nineteenth");
19293var numsTens=new Array("twenty", "thirty", "forty", "fifty", "sixty", "seventy", "eighty", "ninety");
19294var numsTensOrdinal = new Array("twentieth", "thirtieth", "fortieth", "fiftieth", "sixtieth", "seventieth", "eightieth", "ninetieth");
19295
19296/**
19297 * number To String
19298 * Function to convert a number to its string representation in English
19299 * @param {Number} num A whole number to convert
19300 * @param {boolean} zeroAsBlank If 0 should be converted to the empty string 
19301 * @param {boolean} ordinal If the string should be in ordinal (e.g. zeroth, first, etc.) or not (e.g. none, one, etc.)
19302 * @return {string} The string representation of the number in the requested format
19303 */
19304function nTS(num, zeroAsBlank, ordinal) {
19305	var numsInner;
19306	if (num == 0) {
19307		return (zeroAsBlank ? "" : (ordinal ? "zeroth" : "none"));
19308	}
19309	else if (num > 0 && num < 20) {
19310		if (ordinal) {
19311			numsInner = numsOrdinal;
19312		}
19313		else {
19314			numsInner = nums;
19315		}
19316		return numsInner[num - 1];
19317	}
19318	else if (num >= 20 && num < 100) {
19319		if (ordinal && num % 10 == 0) {
19320			numsInner = numsTensOrdinal;
19321		}
19322		else {
19323			numsInner = numsTens;
19324		}
19325		return numsInner[Math.floor(num / 10) - 2] + " " + nTS(num % 10, true, ordinal);
19326	}
19327	else if (num >= 100 && num < 1000) {
19328		if (ordinal && num % 100 == 0) {
19329			return nTS(Math.floor(num / 100), false, false) + " hundredth";
19330		}
19331		else {
19332			return nTS(Math.floor(num / 100), false, false) + " hundred " + nTS(num % 100, true, ordinal);
19333		}
19334	}
19335	else if (num >= 1000 && num < 1000000) {
19336		if (ordinal && num % 1000 == 0) {
19337			return nTS(Math.floor(num / 1000), false, false) + " thousandth";
19338		}
19339		else {
19340			return nTS(Math.floor(num / 1000), false) + " thousand " + nTS(num % 1000, true, ordinal);
19341		}
19342	}
19343	else if (num >= 1000000 && num < 1000000000) {
19344		if (ordinal && num % 1000000 == 0) {
19345			return nTS(Math.floor(num / 1000000), false, false) + " millionth";
19346		}
19347		else {
19348			return nTS(Math.floor(num / 1000000), false) + " million " + nTS(num % 1000000, true, ordinal);
19349		}
19350	}
19351	else if (num >= 1000000000) {
19352		if (ordinal && num % 1000000000 == 0) {
19353			return nTS(Math.floor(num / 1000000000), false, false) + " billionth";
19354		}
19355		else {
19356			return nTS(Math.floor(num / 1000000000), false) + " billion " + nTS(num % 1000000000, true, ordinal);
19357		}
19358	}
19359	else {
19360		return "";
19361	}
19362}
19363function r(num, decimals, method) {
19364	var change = Math.pow(10, decimals);
19365	switch (method) {
19366		case "floor":
19367			return Math.floor(num * change) / change;
19368		case "ceiling":
19369			return Math.ceil(num * change) / change;
19370		default:
19371			return Math.round(num * change) / change;
19372	}
19373}
19374function log(x) {
19375	if (arguments.length == 1) {
19376		return Math.log(x);
19377	}
19378	else {
19379		return Math.log(x) / Math.log(arguments[1]);
19380	}
19381}
19382
19383function SetMaxNumber(id, maxVal) {
19384	var rVal = r(maxVal, 2);
19385	var curItem = $('#' + id);
19386	curItem.attr('max', rVal);
19387	curItem.attr('maxlength', rVal.toString().length);
19388	var curVal = curItem.val();
19389	if (curVal != "" && curVal > rVal) {
19390		curItem.val(rVal);
19391		curItem.siblings('.numericFormat').text(rVal);
19392	}
19393}
19394
19395function SetMinNumber(id, minVal) {
19396	var rVal = r(minVal, 2);
19397	var curItem = $('#' + id);
19398	curItem.attr('min', rVal);
19399	var curVal = curItem.val();
19400	if (curVal != "" && curVal < rVal) {
19401		curItem.val(rVal);
19402		curItem.siblings('.numericFormat').text(rVal);
19403	}
19404}
19405
19406/* This is for setting up formatted numeric text inputs */
19407if (typeof (jQuery) == "function") {
19408	(function ($) {
19409		var maxMax = Number.MAX_SAFE_INTEGER; /* Numbers larger than this end up with various issues, this should be plenty large enough for our purposes. */
19410		function applyFormat(obj) {
19411			var formatted = fN(obj.value, obj.format);
19412			obj.formatSpan.text(formatted);
19413			/* Change the actual value to match the formatted value, but remove ,s */
19414			if (formatted == "") {
19415				obj.value = formatted;
19416			}
19417			else {
19418				obj.value = parseNum(formatted);
19419			}
19420			if ($(obj).parents(".ipq").length) {
19421				resizeInlineParagraphQuestion(obj, formatted);
19422			}
19423		}
19424		function setValue(obj, new_val) {
19425			/* Set the value of the input and the display without triggering an actual change event */
19426			obj.value = new_val;
19427			if ($.isNumeric(obj.value) === false) {
19428				obj.value = obj.value.replace(/[^0-9\.-]/g, ''); /* Remove everything that isn't a digit, decimal or negative sign */
19429				obj.value = obj.value.replace(/([^^])-/g, '$1'); /* Remove any negative signs that are not at the start of the string */
19430				obj.value = obj.value.replace(/^([^\.]*\.)(.*)$/, function (a, b, c) { return b + c.replace(/\./g, ''); }); /* Remove any decimals after the first one */
19431			}
19432
19433			/* If this still doesn't evaluate as a number or is an empty string, insert the default value */
19434			if (isNaN(obj.value)) obj.value = obj.defaultVal;
19435
19436			var allowEmptyText = obj.parentElement.parentElement.classList.contains("numericTextboxV2");
19437
19438			/* Apply max and min */
19439			var num = new Number(obj.value);
19440
19441			if (num > obj.max) obj.value = obj.max;
19442			if (num < obj.min) obj.value = obj.min;
19443
19444			if (obj.value == "" && !allowEmptyText) obj.value = 0;
19445			applyFormat(obj);
19446		}
19447		var methods = {
19448			init: function (format, max, min, defaultVal) {
19449				if (typeof (format) == "undefined") {
19450					format = "#,##0.00";
19451				}
19452				if (typeof (max) == "undefined" || max > maxMax) max = maxMax;
19453				if (typeof (min) == "undefined" || min < -1 * maxMax) min = -1 * maxMax;
19454				if (typeof (defaultVal) == "undefined") defaultVal = "";
19455				for (var i = 0; i < this.length; ++i) {
19456					if (!$(this[i]).parent(".inputWrap").length) {
19457						this[i].formatSpan = $("<span class='numericFormat'></span>");
19458						this[i].format = format;
19459						this[i].max = max;
19460						this[i].min = min;
19461						this[i].defaultVal = defaultVal;
19462						/* Get the number of possible decimal places from the format */
19463						var decimalPlaces = 0;
19464						if (typeof (format) == "string") {
19465							var formatSplit = format.split('.');
19466							if (formatSplit.length > 1 && formatSplit[1].length > 0) {
19467								decimalPlaces = formatSplit[1].length + 1; /* Add 1 for the actual decimal. */
19468							}
19469						}
19470						this[i].maxLength = Math.min(this[i].maxLength, Math.max(max.toString().length, min.toString().length) + decimalPlaces);
19471						var jQueryObj = $(this[i]);
19472						var cssClass = jQueryObj.attr('class')
19473						jQueryObj.wrap("<div class='inputWrap" + (typeof (cssClass) != "undefined" ? " " + cssClass : "") + "'></div>");
19474						jQueryObj.before(this[i].formatSpan);
19475						this[i].formatSpan.text(fN(this[i].value, this[i].format));
19476					}
19477				}
19478				this.on("keydown", function (event) {
19479					this.oldValue = this.value;
19480					if (this.type != "number") {
19481						this.oldSelectionStart = this.selectionStart;
19482						this.oldSelectionEnd = this.selectionEnd;
19483					}
19484				});
19485				this.on("input", function (event) {
19486					if (!/^-?[0-9]*\.?[0-9]*$/.test(this.value)) {
19487						this.value = this.oldValue;
19488						if (this.type != "number") {
19489							this.setSelectionRange(this.oldSelectionStart, this.oldSelectionEnd);
19490						}
19491					}
19492				});
19493				this.on("focus", function (event) {
19494					var _this = this;
19495					if (this.type != "number") {
19496						setTimeout(function () { _this.setSelectionRange(0, 9999); }, 0);  /* This is a timeout so that it happens at the end of the current event queue. Without this, some browsers will deselect the contents in the mouseup event */
19497					}
19498					if ($(this).parents(".ipq").length) {
19499						resizeInlineParagraphQuestion(this);
19500					}
19501				});
19502				this.on("blur", function (event) {
19503					setValue(this, this.value);
19504					/* Make sure that any change events reflect the actual value */
19505					$(this).trigger('change');
19506				});
19507				return this;
19508			},
19509			applyFormat: function () { return this.each(function () { applyFormat(this); }); },
19510			setValue: function (new_val) { return this.each(function () { setValue(this, new_val); }); }
19511		}
19512		$.fn.numeric = function (formatOrMethod) {
19513			if (methods[formatOrMethod]) {
19514				return methods[formatOrMethod].apply(this, Array.prototype.slice.call(arguments, 1));
19515			}
19516			else {
19517				return methods.init.apply(this, arguments);
19518			}
19519		}
19520	}(jQuery));
19521}
19522 /* Make sure there isn't still highlighted text in numeric inputs when focus is lost */
19523$(window).on("blur", function () {
19524	try {
19525		var el = $(document.activeElement);
19526		if (el.parent().hasClass('inputWrap')) {
19527			el.prop('selectionStart', 0);
19528			el.prop('selectionEnd', 0);
19529			el.trigger("blur");
19530		}
19531	} catch (error) { }
19532});
19533function fN(num, format) {
19534	if (num === "") return "";
19535	var curCult = window.languageCode;
19536	if (typeof (numbro) != "undefined") {
19537		/* ###.00€ gives problem in format. So if € exist then remove it, format the text and then append it at the end of text*/
19538		var formatLen = format.length;
19539		var curSymbol = "";
19540		if (formatLen > 1) {
19541			var tempFormat = format.substring(formatLen - 1, formatLen);
19542			if (tempFormat != "#" && tempFormat != "0") {
19543				curSymbol = tempFormat;
19544				format = format.substring(0, formatLen - 1);
19545			}
19546		}
19547		numbro.setCulture(curCult.replace("_", "-"));
19548		return numbro(num).format(format) + curSymbol;
19549	} else if (typeof curCult != "undefined" && curCult && curCult.substring(0, 5) == "en_IN") {
19550		return localeNumberFormatter.Format(num, format, 'en-IN');
19551	}
19552	else {
19553		return new Number(num).numberFormat(format, null);
19554	}
19555}
19556/* End Include number */
19557
19558/* Include oldlawdepot */
19559/* Old functions from lawdepot.js */
19560
19561/**
19562 * Set display property.
19563 * second parameter should be boolean
19564 * third parameter is display type to use for visible
19565 */
19566function setVisDisp(objectId,visible) {
19567   var type;
19568	var element;
19569   if(arguments.length==3) type=arguments[2];
19570   else type = "block";
19571
19572   if(document.getElementById && document.getElementById(objectId)) {
19573     element = document.getElementById(objectId);
19574	  element.style.display = 
19575         (visible)?type:"none";
19576   } else if (document.all && document.all(objectId)) {
19577      element = document.all(objectId);
19578		element.style.display =
19579         (visible)?type:"none";
19580   }
19581
19582	/* Resolves peculiar IE9 bug where ordered list items become zero-numbered.
19583	   Occurs if: the list is hidden and another div is displayed, then the list is displayed with the other div hidden.
19584	   https://connect.microsoft.com/IE/feedback/details/657695/ordered-list-numbering-changes-from-correct-to-0-0 */
19585	var list_pos = -1;
19586
19587	if( typeof element != 'undefined' )
19588		list_pos = element.innerHTML.indexOf('<ol');
19589
19590	if( visible && list_pos != -1 )
19591	{
19592		setTimeout( function() { 
19593			var lists = document.getElementsByTagName('ol');
19594			for( var i = 0; i < lists.length; i++ )
19595			{
19596					lists[i].style.counterReset = "item";
19597			}
19598		}, 1);
19599	}
19600}
19601function setVisInline(objectId,visible)
19602{
19603   setVisDisp(objectId,visible,"inline");
19604}
19605/**
19606 * Get display property.
19607 */
19608function getVisDisp(objectId) {
19609   if(document.getElementById && document.getElementById(objectId)) {
19610      return (document.getElementById(objectId).style.display != "none");
19611   } else if (document.all && document.all(objectId)) {
19612      return (document.all(objectId).style.display != "none");
19613   } else {
19614      return false;
19615   }
19616}
19617/* End Include oldlawdepot */
19618
19619/* Include ppcRetargeting */
19620//For PPC retargated AD
19621function ShowPPCAd(){
19622	 if(typeof(vh) != "undefined"){
19623	 	var url = window.location.href;
19624	 	var contractName = "last-will-and-testament";
19625	 	var isLawdepot = url.indexOf("lawdepot") != -1|| url.indexOf("localhost") != -1;
19626				
19627	 	//Check if its lawdepot and last-will-and-testament
19628	 	if( isLawdepot && url.indexOf(contractName)!=-1){			
19629	 		//Check if its last-will-and-testament-usa & country = US 
19630	 		var hasUsLink = (url.indexOf("last-will-and-testament-usa") != -1 || (typeof(getQueryStringValue("loc")) != "undefined" && getQueryStringValue("loc").toUpperCase() =="US" ));
19631	 		var hasSavedAnswer = vh.G('__HasSavedAnswersSpecific')	
19632	 		var s = getQueryStringValue("s");
19633	 		//Check if it hasUsLink and has saved Answers and its the start page or its start page isn't defined 		
19634	 		if(hasUsLink && hasSavedAnswer  && (s== null  || url.indexOf("#s=QSStart") != -1)){							
19635	 			var googlePId = getQueryStringValue("pid");
19636	 			if(typeof(googlePId) != 'undefined' && googlePId.indexOf("google")!=-1){	
19637					 
19638					 //Safari seems to load readerview so animate isn't working.
19639					 //In that case reload the page again
19640					 if(cssua.ua.safari && cssua.ua.mobile){
19641						window.onpageshow = function(event) {
19642								if (event.persisted) {
19643									window.location.reload() 
19644								}
19645							};
19646					 }
19647					 
19648					 //After the page load is complete just use animate to move to top 
19649					 //2 second is used to force google chrome to go to top of page instead of saved state
19650					 window.onload = function(){					
19651						$('body').animate({
19652												scrollTop: 0
19653											}, 2000);
19654					};
19655					 
19656					var message = " <span style='text-align:center; display: inline-block; width: 235px;'>WELCOME BACK!\n\nWe saved your Last Will and Testament so you can pick up where you left off.</span>";
19657	 				alert(message,{buttonText: "Got it, thanks!"});
19658				}	
19659	 		}
19660	 	}
19661	 }
19662}
19663
19664if(typeof($) != 'undefined'){
19665   $(function () {
19666	   ShowPPCAd();
19667   });
19668}
19669/* End Include ppcRetargeting */
19670
19671/* Include previewPage */
19672/*
19673Javascript required for the preview page to function properly
19674 */
19675// Setup namespace
19676Sequiter = Sequiter || {};
19677Sequiter.previewPage = Sequiter.previewPage || {};
19678
19679(function (previewPage) {
19680	// Cached selectors, initialized in setupDocumentNameInput
19681	var $documentNameInputContainer;
19682	var $documentNameInput;
19683	var $documentNameInputValidationMsg;
19684
19685	/**
19686	 * Attempts to rename the document, warning the user if there is a conflict
19687	 */
19688	function renameDocument(webuserDataId, name) {
19689		if (name === undefined || name.trim() === "" || name.trim() === $documentNameInput.data("extra-original-value")) {
19690			resetDocumentNameInput();
19691			return;
19692		}
19693		name = name.trim();
19694		if (!validateDocumentNameInput()) return;
19695
19696		function handleNameConflict(suggestedName) {
19697			confirmDialog("<p>You already have a document with that name. Do you want to rename to</p><p><b>\"" + suggestedName + "\"</b></p>", {
19698				title: "Name already exists",
19699				yesText: "Accept",
19700				noText: "Cancel",
19701				callback: function (acceptAlternative) {
19702					if (acceptAlternative) {
19703						renameDocument(webuserDataId, suggestedName);
19704					} else {
19705						resetDocumentNameInput();
19706						$documentNameInput.trigger("focus");
19707					}
19708				}
19709			})
19710		}
19711
19712		new DocumentTileService().Rename(
19713			webuserDataId,
19714			name,
19715			false,
19716			function (response) {
19717				// Manually check the response for failure (as it may have silently failed due to conflict)
19718				if (response.Status === "Failure") {
19719					handleNameConflict(response.SuggestedAlternativeName);
19720				} else {
19721					$documentNameInput
19722						.val(name) // As this could be a recursive call, ensure the accepted name is reflected in the input
19723						.data("extra-original-value", name)
19724						.trigger("input") // Trigger input so that the input resizes appropriately
19725						.trigger("blur"); // Prevent accidental additional input
19726				}
19727			},
19728			function (response) {
19729				resetDocumentNameInput();
19730				alert("Unable to rename document", { title: "Name Invalid" });
19731			}
19732		);
19733	}
19734	/**
19735	 * Returns the document name input to it's original value, undoing any user input
19736	 */
19737	function resetDocumentNameInput() {
19738		$documentNameInput
19739			.val($documentNameInput.data("extra-original-value"))
19740			.trigger("input") // Causes resize
19741			.trigger("blur"); // Prevent accidental further edits
19742		$documentNameInputValidationMsg.text("");
19743	}
19744
19745	/**
19746	 * Validates the document name input.
19747	 * @return {boolean} True if the validation succeeds, false otherwise
19748	 */
19749	function validateDocumentNameInput() {
19750		$documentNameInputValidationMsg.text("");
19751		var validationResult = Sequiter.Contracts.ValidateName($documentNameInput.val().trim());
19752		if (validationResult !== null) {
19753			$documentNameInputValidationMsg.text(validationResult);
19754			$documentNameInput.trigger('focus');
19755			return false;
19756		}
19757		return true;
19758	}
19759
19760	/**
19761	 * Sets the max-width of the $documentNameInputContainer to be the exact amount of space necessary to
19762	 * contain the text in the $documentNameInput (plus a bit of padding)
19763	 */
19764	function autoSizeDocumentNameInput() {
19765		if($documentNameInput === undefined) return;
19766		var inputCss = getComputedStyle($documentNameInput.get(0));
19767		// Using a hidden element with the same font css to measure the width of the text
19768		$('#--documentName--_measure')
19769			.text($documentNameInput.val())
19770			.css('font-size', inputCss['font-size'])
19771			.css('font-weight', inputCss['font-weight']);
19772		// Set the max size of the flexible container rather than the input itself, allows shrinking if needed
19773		$documentNameInputContainer.css("max-width", $('#--documentName--_measure').width() + 10); // 10px padding
19774	}
19775
19776	/**
19777	 * Executed by DCSMain to prepare the document name input. Must be called after the document is ready.
19778	 */
19779	function setupDocumentNameInput() {
19780		// Prepare cached selectors
19781		$documentNameInputContainer = $("#--documentName--");
19782		$documentNameInput = $("#--documentName--_in");
19783		$documentNameInputValidationMsg = $documentNameInputContainer.siblings('p.err');
19784
19785		// Create a hidden span that can be used to calculate the desired width of the document name input
19786		$("<span id='--documentName--_measure' style='display:none;white-space: pre'></span>").insertAfter("#--documentName--");
19787		autoSizeDocumentNameInput();
19788		$documentNameInput
19789			.on("change", function () {
19790				// Ask for confirmation to change dialog name when we detect edits are finished
19791				renameDocument(WebuserDataInfo.id, $documentNameInput.val());
19792			})
19793			.on("input", function () {
19794				// Resize the input to match the input characters
19795				autoSizeDocumentNameInput();
19796			})
19797			.on("keyup", function (e) {
19798				var valid = validateDocumentNameInput();
19799				if (e.keyCode === 27) { // escape key aborts changes
19800					resetDocumentNameInput();
19801				} else if (valid && e.keyCode === 13) { // enter key submits changes
19802					$documentNameInput.trigger('blur');
19803				}
19804			});
19805
19806		// Unhide the label now that everything is properly sized
19807		$documentNameInputContainer.siblings("label").css("visibility", "")
19808
19809		// Make sure the input resizes anytime the window changes size
19810		$(window).on('resize', function () {
19811			autoSizeDocumentNameInput();
19812		});
19813	}
19814
19815	/*
19816	Gets the url to go to the preview page for the current contract
19817	For dcs contracts, this should go to preview.aspx
19818	For php contracts, this should go to preview.php
19819	If the contract type cannot be determined, this will return null
19820	 */
19821	function getPreviewPageUrl() {
19822		var currentFilename = window.location.pathname.substring(window.location.pathname.lastIndexOf("/") + 1);
19823		var currentPath = window.location.pathname.substring(0, window.location.pathname.lastIndexOf("/"));
19824		var newFilename = "preview.";
19825
19826		if (currentFilename.indexOf("preview") !== -1) {
19827			// We are already on a preview page of some kind
19828			return window.location;
19829		} else if ((currentFilename === "" && typeof dcsVersion !== "undefined") || currentFilename.indexOf(".aspx") !== -1) {
19830			// Is a dcs contract page
19831			newFilename += "aspx"
19832		} else if ((currentFilename === "" && typeof webuserDataID !== "undefined") || currentFilename.indexOf(".php") !== -1) {
19833			// Is a php contract
19834			newFilename += "php";
19835		} else {
19836			// Indeterminate
19837			return null;
19838		}
19839
19840		return Sequiter.QueryString.AddPersistedQueryStringValuesToUrl(currentPath + "/" + newFilename + "?");
19841	}
19842
19843	// Export public functions
19844	$.extend(previewPage, {
19845		setupDocumentNameInput: setupDocumentNameInput,
19846		getPreviewPageUrl: getPreviewPageUrl
19847	})
19848})(Sequiter.previewPage)
19849
19850function shouldRebuildPreviewPage() {
19851	// This is a slightly awkward way of putting the PHP tags inside of a string but still getting a boolean value.
19852	// This is done so this file can be parsed as JS.
19853	return Boolean("");
19854}
19855function rebuildPreviewPage() {
19856	if (shouldRebuildPreviewPage()) {
19857		var form = $('form.previewPage:not(.previewsimple2):not(.previewsimple2018)');
19858		if (form && form.length > 0) {
19859			var controlMenu = $(".previewHead .controls.mm");
19860			if (controlMenu && controlMenu.length > 0) {
19861				var hadEditor = controlMenu.find(".editor").length > 0;
19862				var hadPDFDown = controlMenu.find(".comp .pdf").length > 0;
19863				var hadWordDown = controlMenu.find(".comp .word").length > 0;
19864				var hadHTMLDown = controlMenu.find(".comp .html").length > 0;
19865				var hadChecklist = controlMenu.find(".checklist").length > 0;
19866				var checklistClickEventVal = "";
19867				if (hadChecklist) {
19868					checklistClickEventVal = controlMenu.find(".checklist a").attr("onclick");
19869				}
19870				var tempControlMenu = controlMenu;
19871				controlMenu.empty();
19872				
19873				for(var i = 0; i< tempControlMenu.length; i++){
19874						
19875					controlMenu = tempControlMenu[i];
19876
19877					appendControlItem(controlMenu, "print startList", "Print", function () { printPDF(location.search.substr(1)); }, null);
19878
19879					if (hadWordDown || hadPDFDown || hadHTMLDown) {
19880						var down = appendControlItem(controlMenu, "down", "Download", null, null);
19881						var ul = document.createElement("UL");
19882
19883						if (hadWordDown) appendControlItem(ul, "word", "Download as Microsoft Word", function () { saveAsWord(false); }, null);
19884						if (hadPDFDown) appendControlItem(ul, "pdf", "Download as PDF", function () { saveAsPDF(false); }, null);
19885						if (hadHTMLDown) appendControlItem(ul, "html", "Download as HTML", function () { saveAsHTML(false); }, null);
19886
19887						down.appendChild(ul);
19888					}
19889
19890					appendControlItem(controlMenu, "changeAnswers", "Change Answers", function () { changeAnswers(location.search.substr(1)); }, "Return to the questionnaire to review and/or change your answers");
19891
19892					if (hadEditor) appendControlItem(controlMenu, "editor", "Editor", goToEditor, "Edit the exact wording and formatting of your document");
19893					if (hadChecklist && checklistClickEventVal !== "") {
19894						var event = new Function("event", checklistClickEventVal);
19895						appendControlItem(controlMenu, "checklist", "Checklist", event, "");
19896					}
19897
19898					appendControlItem(controlMenu, "new endList", "New", function () { newAnswerDialog(PC, 0, "", "yudox2"); }, "Create a new version of this document");
19899				}
19900			}
19901			form.addClass("previewsimple2");
19902		}
19903	}
19904}
19905function appendControlItem(controlMenu, className, textVal, clickEvent, tooltip) {
19906	var li = document.createElement("LI");
19907	li.className = className;
19908	var anchor = document.createElement("A");
19909	if (typeof (clickEvent) === "function") {
19910		anchor.onclick = clickEvent;
19911	}
19912	if (typeof (tooltip) === "string" && !cssua.ua.mobile) {
19913		anchor.ontouchstart = function () { ShowToolTip(null, tooltip, this, 'TopRight', 300, 0, 0, false, false, false); };
19914		anchor.onmouseover = function () { ShowToolTip(null, tooltip, this, 'TopRight', 300, 0, 0, false, false, true); };
19915		anchor.onmouseout = function () { HideToolTip(null, this, true); };
19916	}
19917	var icon = document.createElement("SPAN");
19918	icon.className = "icon";
19919	anchor.appendChild(icon);
19920	var text = document.createElement("SPAN");
19921	text.className = "text";
19922	text.innerHTML = textVal;
19923	anchor.appendChild(text);
19924	li.appendChild(anchor);
19925
19926	controlMenu.appendChild(li);
19927
19928	return li;
19929}
19930if (typeof ($) !== 'undefined') {
19931	$(rebuildPreviewPage);
19932}
19933else {
19934	rE(window, "load", rebuildPreviewPage);
19935}
19936function doPreviewCrossTabReload() {
19937	if ((
19938		window.location.pathname.indexOf("preview.php") >= 0
19939		|| (
19940			window.location.pathname.indexOf("preview.aspx") >= 0
19941			&& (
19942				typeof (qnh) === "undefined" || qnh.Groups.length === 0
19943			)
19944		)
19945	)
19946		&& getQueryStringValue("ViewResults") !== "true"
19947	) {
19948		Sequiter.storage.SetLocalStorageAnswerSet(WebuserDataInfo.id || getQueryStringValue("webuser_data_id"), (WebuserDataInfo.shared ? getQueryStringValue("l") : null));
19949	}
19950}
19951if (typeof ($) !== 'undefined') {
19952	$(doPreviewCrossTabReload);
19953}
19954else {
19955	rE(window, "load", doPreviewCrossTabReload);
19956}
19957/* End Include previewPage */
19958
19959/* Include progressIndicator */
19960if(typeof(jQuery) == "function"){
19961   (function($){
19962
19963      function tryIsInDialog(includeFramed) {
19964         if (typeof(isInDialog) !== "function") return false;
19965         return isInDialog(includeFramed);
19966      }
19967      
19968      function renderCircle (canvas, circle) {
19969         if(canvas.getContext){
19970            var context = canvas.getContext('2d');
19971   
19972            context.clearRect(0, 0, canvas.width, canvas.height);
19973            context.beginPath();
19974            context.arc(circle.x, circle.y, circle.radius, circle.startAngle, circle.endAngle, circle.anticlockwise);            
19975            context.strokeStyle = circle.color;            
19976            context.lineWidth = circle.lineWidth;
19977            context.stroke();
19978         }
19979      }
19980      function animateCircle (percent, pi) {
19981			percent = Math.round(percent);
19982
19983         function renderCircle (canvas, circle) {
19984            if(canvas.getContext){
19985               var context = canvas.getContext('2d');
19986
19987               //Create gradient           
19988               var gradient = context.createLinearGradient(150,0,0, 45);
19989               gradient.addColorStop(0, '#1277bc');
19990               gradient.addColorStop(1, '#44a156');          
19991               if(percent == 100){
19992                  gradient = "#669e9b"
19993               }
19994               context.clearRect(0, 0, canvas.width, canvas.height);
19995               context.beginPath();
19996               context.arc(circle.x, circle.y, circle.radius, circle.startAngle, circle.endAngle, circle.anticlockwise);
19997               if(isSlate()){
19998                 context.strokeStyle = gradient;
19999               }else{
20000                 context.strokeStyle = circle.color;
20001               }
20002               context.lineWidth = circle.lineWidth;
20003               context.stroke();
20004            }
20005         }
20006            var step = function() {
20007               var timestamp = Date.now(),
20008                  progress = Math.min((pi.options.duration - (end - timestamp)) / pi.options.duration, 1);
20009
20010               pi.options.percent = current + (distance * progress);
20011               $(pi).find('.pi-text').html(Math.round(pi.options.percent) + '%');
20012               pi.frontCircle.endAngle = pi.options.startAngle + (Math.PI * 2) * (pi.options.percent/100);
20013
20014               renderCircle(pi.frontCanvas, pi.frontCircle);
20015   
20016               if (progress < 1) {
20017                  requestAnimationFrame(step);
20018               } 
20019            }
20020            
20021      if(percent > 100) percent = 100;
20022      if(percent < 0) percent = 0;
20023      if(pi.options && percent != pi.options.percent){
20024         var start = Date.now(),
20025         current = pi.options.percent,
20026         end = start + pi.options.duration,
20027         distance = percent - current;
20028         
20029         rE(window, "load", step);
20030         }
20031      }
20032      var methods = {
20033         wheel : function(options){
20034            for(var i=0; i<this.length; ++i){
20035               var jQueryObj = $(this[i]);
20036               var height = jQueryObj.height();
20037               var colour = jQueryObj.find('.pi-text').css('color');
20038               if(height == 0) {
20039                  if(tryIsInDialog()){ /* Firefox doesn't seem to apply the styles while in a frame unless the frame is visible. Note: this will likely cause problems if there is more than one frame on the parent page */
20040                     var frameParent = parent.$('.inlineFrame').parent();
20041                     var previousCSS = frameParent.attr('style');
20042                     frameParent.css({position:'absolute', display:'block', visibility:'hidden', top:'-2000px'});
20043                     var height = jQueryObj.height();
20044                     var colour = jQueryObj.find('.pi-text').css('color');
20045                     frameParent.attr('style', previousCSS);
20046                  }
20047                  if(height == 0){ /* If somehow no height and colour have been found, use these as defaults. */
20048                     height = 100;
20049                     colour = '#10897d';
20050                  }
20051               }
20052               if(isSlate()){
20053                  
20054                  this[i].options = $.extend({
20055                  lineWidth: 10,
20056                  diameter: 150,
20057                  anticlockwise: false,
20058                  percent:0,
20059                  backColor: '#fafafa',
20060                  frontColor: colour,
20061                  duration:500,
20062                  startAngle: Math.PI * -1/2,
20063                  }, options);
20064
20065               this[i].backCanvas = $("<canvas class='back-canvas' width=" 
20065+ this[i].options.diameter + " height=" + this[i].options.diameter + "></canvas>")[0];
20066               this[i].frontCanvas = $("<canvas class='front-canvas' width=" + this[i].options.diameter + " height=" + this[i].options.diameter + "></canvas>")[0];
20067               jQueryObj.append(this[i].backCanvas);
20068               jQueryObj.append(this[i].frontCanvas);
20069               
20070               this[i].backCircle = {
20071                  lineWidth: this[i].options.lineWidth,
20072                  x: this[i].options.diameter/2,
20073                  y: this[i].options.diameter/2,
20074                  radius: this[i].options.diameter/2 - this[i].options.lineWidth,
20075                  startAngle: this[i].options.startAngle,
20076                  endAngle: this[i].options.startAngle + Math.PI * 2,
20077                  anticlockwise: this[i].options.anticlockwise,
20078                  color: this[i].options.backColor
20079               }
20080               // renderCircle(this[i].backCanvas, this[i].backCircle);
20081               }else{
20082                  this[i].options = $.extend({
20083                  lineWidth:height/10,
20084                  diameter:height,
20085                  anticlockwise: false,
20086                  percent:0,
20087                  backColor: '#fafafa',
20088                  frontColor: colour,
20089                  duration:500,
20090                  startAngle: Math.PI * -1/2,
20091                  }, options);
20092               
20093               this[i].backCanvas = $("<canvas class='back-canvas' width=" + this[i].options.diameter + " height=" + this[i].options.diameter + "></canvas>")[0];
20094               this[i].frontCanvas = $("<canvas class='front-canvas' width=" + this[i].options.diameter + " height=" + this[i].options.diameter + "></canvas>")[0];
20095               jQueryObj.append(this[i].backCanvas);
20096               jQueryObj.append(this[i].frontCanvas);
20097               
20098               this[i].backCircle = {
20099                  lineWidth: this[i].options.lineWidth,
20100                  x: this[i].options.diameter/2,
20101                  y: this[i].options.diameter/2,
20102                  radius: this[i].options.diameter/2 - this[i].options.lineWidth,
20103                  startAngle: this[i].options.startAngle,
20104                  endAngle: this[i].options.startAngle + Math.PI * 2,
20105                  anticlockwise: this[i].options.anticlockwise,
20106                  color: this[i].options.backColor
20107               }
20108               renderCircle(this[i].backCanvas, this[i].backCircle);
20109            }
20110               jQueryObj.find('.pi-text').html('0%');
20111
20112               this[i].frontCircle = {
20113                  lineWidth: this[i].options.lineWidth,
20114                  x: this[i].options.diameter/2,
20115                  y: this[i].options.diameter/2,
20116                  radius: this[i].options.diameter/2 - this[i].options.lineWidth,
20117                  startAngle: this[i].options.startAngle,
20118                  endAngle: this[i].options.startAngle,
20119                  anticlockwise: this[i].options.anticlockwise,
20120                  color: this[i].options.frontColor
20121               }
20122               var percent = this[i].options.percent;
20123               this[i].options.percent = 0;
20124               animateCircle(percent, this[i]);
20125            }
20126         },
20127         update : function(percent) {
20128            for(var i=0; i<this.length; ++i){
20129               animateCircle(percent, this[i]);
20130            }
20131         }
20132      }
20133      $.fn.progressIndicator = function(themeOrMethod){
20134         if(methods[themeOrMethod]){
20135            return methods[themeOrMethod].apply(this, Array.prototype.slice.call( arguments, 1 ));
20136         }
20137      }
20138} ( jQuery ));
20139}
20140/* End Include progressIndicator */
20141
20142/* Include questionReferences */
20143function getQuestionReferenceGroups(id) {
20144	var refGroups = [];
20145	for(var i=0; i<window._questionReferences.length; i++) {
20146		for(var j=0; j<window._questionReferences[i].length; j++) {
20147			if(window._questionReferences[i][j] == id) {
20148				refGroups.push(window._questionReferences[i]);
20149				break;
20150			}
20151		}
20152	}
20153	return refGroups;
20154}
20155function updateQuestionReferenceValue(id, value) {
20156	var refGroups = getQuestionReferenceGroups(id);
20157	var setAlready = [id];
20158	for(var i=0; i<refGroups.length; i++) {
20159		for(var j=0; j<refGroups[i].length; j++) {
20160			var refId = refGroups[i][j];
20161			if(setAlready.indexOf(refId) < 0 && $("#"+refId).length) {
20162				$("#"+refId).val(value);
20163				setAlready.push(refId);
20164			}
20165		}
20166	}
20167}
20168function updateQuestionReferenceTelerikValue(id, value) {
20169	var refGroups = getQuestionReferenceGroups(id);
20170	var setAlready = [id];
20171	for(var i=0; i<refGroups.length; i++) {
20172		for(var j=0; j<refGroups[i].length; j++) {
20173			var refId = refGroups[i][j];
20174			if(setAlready.indexOf(refId) < 0 && $find(refId)) {
20175				$find(refId).set_value(value);
20176				setAlready.push(refId);
20177			}
20178		}
20179	}
20180}
20181function updateQuestionReferenceDate(id, value) {
20182	var refGroups = getQuestionReferenceGroups(id);
20183	var setAlready = [id];
20184	for(var i=0; i<refGroups.length; i++) {
20185		for(var j=0; j<refGroups[i].length; j++) {
20186			var refId = refGroups[i][j];
20187			if(setAlready.indexOf(refId) < 0 && $("#"+refId).length) {
20188                $("#"+refId).datepicker("setDate", value);
20189				setAlready.push(refId);
20190			}
20191		}
20192	}
20193}
20194function updateQuestionReferenceNumeric(id, value) {
20195	var refGroups = getQuestionReferenceGroups(id);
20196	var setAlready = [id];
20197	for(var i=0; i<refGroups.length; i++) {
20198		for(var j=0; j<refGroups[i].length; j++) {
20199			var refId = refGroups[i][j];
20200			if(setAlready.indexOf(refId) < 0 && $("#"+refId).length) {
20201                $("#"+refId).numeric("setValue", value);
20202				setAlready.push(refId);
20203			}
20204		}
20205	}
20206}
20207function updateQuestionReferenceChecked(id, checked, triggerChangeEvent) {
20208	var refGroups = getQuestionReferenceGroups(id);
20209	var setAlready = [id];
20210	for(var i=0; i<refGroups.length; i++) {
20211		for(var j=0; j<refGroups[i].length; j++) {
20212			var refId = refGroups[i][j];
20213			if(setAlready.indexOf(refId) < 0 && $("#"+refId).length) {
20214				if(checked) {
20215					$("#"+refId).prop("checked", true);
20216					if(typeof(triggerChangeEvent) != "undefined" && triggerChangeEvent) {
20217						$("#"+refId).trigger("change");
20218					}
20219				}
20220				else {
20221					$("#"+refId).prop("checked", false);
20222					if(typeof(triggerChageEvent) != "undefined" && triggerChangeEvent) {
20223						$("#"+refId).trigger("change");
20224					}
20225				}
20226				setAlready.push(refId);
20227			}
20228		}
20229	}
20230}
20231function updateQuestionReferenceValueGroup(id, values) {
20232	var refGroups = getQuestionReferenceGroups(id);
20233	var setAlready = [id];
20234	for(var i=0; i<refGroups.length; i++) {
20235		for(var j=0; j<refGroups[i].length; j++) {
20236			var refId = refGroups[i][j];
20237			if(setAlready.indexOf(refId) < 0 && $("#"+refId).length) {
20238				$("#"+refId+" select,#"+refId+" input").each(function(index, item) {
20239					$(item).val(values[index]);
20240				});
20241				setAlready.push(refId);
20242			}
20243		}
20244	}
20245}
20246function updateQuestionReferenceCheckedGroup(id, checkedValue, triggerChangeEvent) {
20247	var refGroups = getQuestionReferenceGroups(id);
20248	var setAlready = [id];
20249	for(var i=0; i<refGroups.length; i++) {
20250		for(var j=0; j<refGroups[i].length; j++) {
20251			var refId = refGroups[i][j];
20252			if(setAlready.indexOf(refId) < 0 && $("#"+refId).length) {
20253				$("#"+refId+" input[value='"+checkedValue+"']").prop("checked", true);
20254				if(typeof(triggerChangeEvent) != "undefined" && triggerChangeEvent) {
20255					$("#"+refId+" input[value='"+checkedValue+"']").trigger("change");
20256				}
20257				setAlready.push(refId);
20258			}
20259		}
20260	}
20261}
20262/* End Include questionReferences */
20263
20264/* Include search */
20265var allAvailableContracts={"AT":[{"label":"Ehegattentestament","value":"\/contracts\/Ehegattentestament\/?loc=AT","brandExclude":null},{"label":"Testament (AT)","value":"\/contracts\/Testament-at\/?loc=AT","brandExclude":null},{"label":"Testament (Einzelperson)","value":"\/contracts\/testament-einzelperson-at\/?loc=AT","brandExclude":null},{"label":"Wohnungsmietvertrag","value":"\/contracts\/mietvertrag-fuer-wohnungen\/?loc=AT","brandExclude":null}],"AU":[{"label":"Residential Tenancy Agreement","value":"\/contracts\/residential-tenancy-agreement\/?loc=AU","brandExclude":null},{"label":"Promissory Note","value":"\/contracts\/promissory-note-forms\/?loc=AU","brandExclude":null},{"label":"Child Medical Consent","value":"\/contracts\/medical-consent-form\/?loc=AU","brandExclude":null},{"label":"Building Contract","value":"\/contracts\/service-contract\/?loc=AU&ldcn=building","brandExclude":null},{"label":"Construction Contract","value":"\/contracts\/service-contract\/?loc=AU&ldcn=construction","brandExclude":null},{"label":"Consulting Agreement","value":"\/contracts\/consulting-agreement\/?loc=AU&ldcn=consult","brandExclude":null},{"label":"Service Agreement","value":"\/contracts\/service-contract\/?loc=AU&ldcn=service","brandExclude":null},{"label":"Service Agreement (Building)","value":"\/contracts\/service-contract\/?loc=AU&ldcn=building_service","brandExclude":null},{"label":"Service Agreement (Construction)","value":"\/contracts\/service-contract\/?loc=AU&ldcn=construction_service","brandExclude":null},{"label":"Service Agreement (Consulting)","value":"\/contracts\/consulting-agreement\/?loc=AU&ldcn=service_consulting","brandExclude":null},{"label":"Service Agreement (General)","value":"\/contracts\/service-contract\/?loc=AU&ldcn=main_","brandExclude":null},{"label":"Service Agreement (Home)","value":"\/contracts\/service-contract\/?loc=AU&ldcn=home","brandExclude":null},{"label":"Service Agreement (Maintenance)","value":"\/contracts\/service-contract\/?loc=AU&ldcn=maintenance","brandExclude":null},{"label":"Service Agreement (Repair)","value":"\/contracts\/service-contract\/?loc=AU&ldcn=repair","brandExclude":null},{"label":"Service Agreement (Software\/IT)","value":"\/contracts\/computer-services-agreement\/?loc=AU&ldcn=software","brandExclude":null},{"label":"Talk to a Lawyer","value":"\/contracts\/talk-to-a-lawyer\/?loc=AU","brandExclude":null},{"label":"Trailer Bill of Sale","value":"\/contracts\/bill-of-sale\/?loc=AU&ldcn=trailer","brandExclude":null},{"label":"Vehicle Bill of Sale","value":"\/contracts\/bill-of-sale\/?loc=AU&ldcn=vehicle","brandExclude":null},{"label":"Will","value":"\/contracts\/last-will-and-testament-au\/?loc=AU&ldcn=will","brandExclude":null},{"label":"Service Agreement (Contractor)","value":"\/contracts\/independent-contractor-agreement\/?loc=AU&ldcn=service_contractor","brandExclude":null},{"label":"Revocation of Power of Attorney","value":"\/contracts\/revocation-of-power-of-attorney\/?loc=AU","brandExclude":null},{"label":"Separation \/ Divorce Papers","value":"\/contracts\/separation-agreement-australia-lc\/?loc=AU&ldcn=sdp","brandExclude":null},{"label":"Separation Agreement","value":"\/contracts\/separation-agreement-australia-lc\/?loc=AU","brandExclude":null},{"label":"Separation Agreement (Before Divorce)","value":"\/contracts\/separation-agreement-australia-lc\/?loc=AU&ldcn=sabd","brandExclude":null},{"label":"Demand Letter","value":"\/contracts\/demand-letter\/?loc=AU","brandExclude":null},{"label":"Directors' Resolution","value":"\/contracts\/corporate-resolution-lc\/?loc=AU&ldcn=resolution","brandExclude":null},{"label":"Employment Contract","value":"\/contracts\/employment-contract\/?loc=AU","brandExclude":null},{"label":"Purchase of Business Agreement","value":"\/contracts\/business-purchase-
20265agreement\/?loc=AU","brandExclude":null},{"label":"Release\/Waiver Agreement","value":"\/contracts\/release-of-liability\/?loc=AU","brandExclude":null},{"label":"Residential Rental Application","value":"\/contracts\/rental-application-form\/?loc=AU","brandExclude":null},{"label":"Residential Sublease Agreement","value":"\/contracts\/sublet-agreement\/?loc=AU","brandExclude":null},{"label":"Residential Sublet Agreement","value":"\/contracts\/sublet-agreement\/?loc=AU","brandExclude":null},{"label":"Financial Statement (Personal)","value":"\/contracts\/financial-statement\/?loc=AU","brandExclude":null},{"label":"Independent Contractor Agreement","value":"\/contracts\/independent-contractor-agreement\/?loc=AU&ldcn=contractor","brandExclude":null},{"label":"Last Will and Testament","value":"\/contracts\/last-will-and-testament-au\/?loc=AU","brandExclude":null},{"label":"Lease Assignment Agreement","value":"\/contracts\/lease-assignment\/?loc=AU","brandExclude":null},{"label":"Loan Agreement","value":"\/contracts\/loan-agreement-forms\/?loc=AU","brandExclude":null},{"label":"Model and Entertainment Release","value":"\/contracts\/model-release-form\/?loc=AU","brandExclude":null},{"label":"Non-Disclosure Agreement","value":"\/contracts\/non-disclosure-agreement\/?loc=AU","brandExclude":null},{"label":"Notice of Withdrawal from Partnership","value":"\/contracts\/partnership-withdrawal\/?loc=AU","brandExclude":null},{"label":"Performance Contract","value":"\/contracts\/performance-contract\/?loc=AU","brandExclude":null}
20265,{"label":"Power of Attorney","value":"\/contracts\/power-of-attorney-form\/?loc=AU","brandExclude":null},{"label":"Business Plan","value":"\/contracts\/business-plan\/?loc=AU&ldcn=partnership-and-joint-venture","brandExclude":null},{"label":"Child Travel Consent","value":"\/contracts\/child-travel-consent\/?loc=AU","brandExclude":null},{"label":"Cleaning Services Agreement","value":"\/contracts\/cleaning-agreement\/?loc=AU","brandExclude":null},{"label":"Commercial Lease Application","value":"\/contracts\/commercial-lease-rental-application\/?loc=AU","brandExclude":null},{"label":"Complaint Letter","value":"\/contracts\/customer-complaint-letter\/?loc=AU","brandExclude":null},{"label":"Computer Services Agreement","value":"\/contracts\/computer-services-agreement\/?loc=AU&ldcn=computer","brandExclude":null},{"label":"Confidentiality Agreement","value":"\/contracts\/confidentiality-agreement\/?loc=AU","brandExclude":null},{"label":"Amending Agreement","value":"\/contracts\/addendum\/?loc=AU","brandExclude":null},{"label":"Assignment","value":"\/contracts\/legal-assignment-form\/?loc=AU","brandExclude":null},{"label":"Assignment of Partnership Interest","value":"\/contracts\/assignment-of-partnership-interest\/?loc=AU","brandExclude":null},{"label":"Automobile Bill of Sale","value":"\/contracts\/bill-of-sale\/?loc=AU&ldcn=automobile","brandExclude":null},{"label":"Bill of Sale","value":"\/contracts\/bill-of-sale\/?loc=AU","brandExclude":null},{"label":"Boat Bill of Sale","value":"\/contracts\/bill-of-sale\/?loc=AU&ldcn=boat","brandExclude":null},{"label":"Car Bill of Sale","value":"\/contracts\/bill-of-sale\/?loc=AU&ldcn=car","brandExclude":null},{"label":"Catering Contract","value":"\/contracts\/catering-service-agreement\/?loc=AU","brandExclude":null},{"label":"Cancel Free Trial","value":"\/cancel\/signin.php?loc=AU","brandExclude":null},{"label":"Cancel Subscription","value":"\/cancel\/signin.php?loc=AU","brandExclude":null},{"label":"End Free Subscription","value":"\/cancel\/signin.php?loc=AU","brandExclude":null},{"label":"End Free Trial","value":"\/cancel\/signin.php?loc=AU","brandExclude":null}],"CA":[{"label":"Residential Lease","value":"\/\/www.legalcontracts.ca\/contracts\/lease-agreement-form\/?loc=CA","brandExclude":null},{"label":"Promissory Note","value":"\/\/www.legalcontracts.ca\/contracts\/promissory-note-forms\/?loc=CA","brandExclude":null},{"label":"Prenuptial Agreement","value":"\/\/www.legalcontracts.ca\/contracts\/prenup-agreement\/?loc=CA","brandExclude":null},{"label":"Will","value":"\/\/www.legalcontracts.ca\/contracts\/canada-last-will-and-testament\/?loc=CA&ldcn=will","brandExclude":null},{"label":"Last Will and Testament","value":"\/\/www.legalcontracts.ca\/contracts\/canada-last-will-and-testament\/?loc=CA","brandExclude":null},{"label":"Health Care Directive","value":"\/\/www.legalcontracts.ca\/contracts\/canadian-living-will-form\/?loc=CA&ldcn=healthdir","brandExclude":null},{"label":"Personal Directive","value":"\/\/www.legalcontracts.ca\/contracts\/canadian-living-will-form\/?loc=CA","brandExclude":null},{"label":"Living Will","value":"\/\/www.legalcontracts.ca\/contracts\/canadian-living-will-form\/?loc=CA&ldcn=livingwillca","brandExclude":null},{"label":"Child Medical Consent","value":"\/\/www.legalcontracts.ca\/contracts\/medical-consent-form\/?loc=CA","brandExclude":null},{"label":"Construction Contract","value":"\/\/www.legalcontracts.ca\/contracts\/service-contract\/?loc=CA&ldcn=construction","brandExclude":null},{"label":"Consulting Agreement","value":"\/\/www.legalcontracts.ca\/contracts\/consulting-agreement\/?loc=CA&ldcn=consult","brandExclude":null},{"label":"Building Contract","value":"\/\/www.legalcontracts.ca\/contracts\/service-contract\/?loc=CA&ldcn=building","brandExclude":null},{"label":"Service Agreement (General)","value":"\/\/www.legalcontracts.ca\/contracts\/service-contract\/?loc=CA&ldcn=main_","brandExclude":null},{"label":"Service Agreement (Home)","value":"\/\/www.legalcontracts.ca\/contracts\/service-contract\/?loc=CA&ldcn=home","brandExclude":null},{"label":"Service Agreement (Maintenance)","value":"\/\/www.legalcontracts.ca\/contracts\/service-contract\/?loc=CA&ldcn=maintenance","brandExclude":null},{"label":"Service Agreement (Repair)","value":"\/\/www.legalcontracts.ca\/contracts\/service-contract\/?loc=CA&ldcn=repair","brandExclude":null},{"label":"Service Agreement","value":"\/\/www.legalcontracts.ca\/contracts\/service-contract\/?loc=CA&ldcn=service","brandExclude":null},{"label":"Service Agreement (Building)","value":"\/\/www.legalcontracts.ca\/contracts\/service-contract\/?loc=CA&ldcn=building_service","brandExclude":null},{"label":"Service Agreement (Construction)","value":"\/\/www.legalcontracts.ca\/contracts\/service-contract\/?loc=CA&ldcn=construction_service","brandExclude":null},{"label":"Service Agreement (Consulting)","value":"\/\/www.legalcontracts.ca\/contracts\/consulting-agreement\/?loc=CA&ldcn=service_consulting","brandExclude":null},{"label":"Roommate Agreement","value":"\/\/www.legalcontracts.ca\/contracts\/roommate-agreement\/?loc=CA","brandExclude":null},{"label":"Joint Venture Agreement","value":"\/\/www.legalcontracts.ca\/contracts\/joint-venture-agreement\/?loc=CA","brandExclude":null},{"label":"Sales Agreement","value":"\/\/www.legalcontracts.ca\/financial\/sales-agreement-form\/?loc=CA&ldcn=sales","brandExclude":null},{"label":"Purchase Agreement","value":"\/\/www.legalcontracts.ca\/financial\/purchase-
20265agreement-form\/?loc=CA&ldcn=purchase","brandExclude":null},{"label":"Purchase of Business Agreement","value":"\/\/www.legalcontracts.ca\/contracts\/business-purchase-agreement\/?loc=CA","brandExclude":null},{"label":"Purchase Order","value":"\/\/www.legalcontracts.ca\/contracts\/purchase-order\/?loc=CA","brandExclude":null},{"label":"Release\/Waiver Agreement","value":"\/\/www.legalcontracts.ca\/contracts\/release-of-liability\/?loc=CA","brandExclude":null},{"label":"Rental Inspection Report","value":"\/\/www.legalcontracts.ca\/contracts\/rental-inspection-form\/?loc=CA","brandExclude":null},{"label":"Personal Property Rental Agreement","value":"\/\/www.legalcontracts.ca\/contracts\/personal-property-rental-agreement\/?loc=CA","brandExclude":null},{"label":"Personal\/Corporate Guarantee","value":"\/\/www.legalcontracts.ca\/contracts\/personal-guarantee-form\/?loc=CA","brandExclude":null},{"label":"Power of Attorney","value":"\/\/www.legalcontracts.ca\/contracts\/power-of-attorney-form\/?loc=CA","brandExclude":null},{"label":"Separation \/ Divorce Papers","value":"\/\/www.legalcontracts.ca\/contracts\/separation-agreement-canada\/?loc=CA&ldcn=sdp","brandExclude":null},{"label":"Separation Agreement","value":"\/\/www.legalcontracts.ca\/contracts\/separation-agreement-canada\/?loc=CA","brandExclude":null},{"label":"Separation Agreement (Before Divorce)","value":"\/\/www.legalcontracts.ca\/contracts\/separation-agreement-canada\/?loc=CA&ldcn=sabd","brandExclude":null},{"label":"Residential Rental Application","value":"\/\/www.legalcontracts.ca\/contracts\/rental-application-form\/?loc=CA&ldcn=rentalapp","brandExclude":null},{"label":"Residential Rental Inspection Report","value":"\/\/www.legalcontracts.ca\/contracts\/rental-inspection-form\/?loc=CA&ldcn=inspectionreport","brandExclude":null},{"label":"Residential Sublease Agreement","value":"\/\/www.legalcontracts.ca\/contracts\/sublet-agreement\/?loc=CA&ldcn=ressublease","brandExclude":null},{"label":"Revocation of Power of Attorney","value":"\/\/www.legalcontracts.ca\/contracts\/revocation-of-power-of-attorney\/?loc=CA","brandExclude":null},{"label":"Loan Agreement","value":"\/\/www.legalcontracts.ca\/contracts\/loan-agreement-forms\/?loc=CA","brandExclude":null},{"label":"Memorandum of Understanding","value":"\/\/www.legalcontracts.ca\/contracts\/letter-of-intent\/?loc=CA&ldcn=MOU","brandExclude":null},{"label":"Minutes of Directors' Meeting","value":"\/\/www.legalcontracts.ca\/contracts\/corporate-resolution-lc\/?loc=CA&ldcn=minutes","brandExclude":null},{"label":"Minutes of Shareholders' Meeting","value":"\/\/www.legalcontracts.ca\/contracts\/shareholders-minutes-of-meeting\/?loc=CA","brandExclude":null},{"label":"Model and Entertainment Release","value":"\/\/www.legalcontracts.ca\/contracts\/model-release-form\/?loc=CA","brandExclude":null},{"label":"Music Recording Contract","value":"\/\/www.legalcontracts.ca\/contracts\/music-recording-contract\/?loc=CA","brandExclude":null},{"label":"Non-Disclosure Agreement","value":"\/\/www.legalcontracts.ca\/contracts\/non-disclosure-agreement\/?loc=CA","brandExclude":null},{"label":"Notice of Lease Violation","value":"\/\/www.legalcontracts.ca\/contracts\/eviction-notice-landlord-forms\/?loc=CA&ldcn=leaseviolation","brandExclude":null},{"label":"Notice of Rent Increase","value":"\/\/www.legalcontracts.ca\/contracts\/eviction-notice-landlord-forms\/?loc=CA&ldcn=rentincrease","brandExclude":null},{"label":"Notice of Termination","value":"\/\/www.legalcontracts.ca\/contracts\/eviction-notice-landlord-forms\/?loc=CA&ldcn=landlordterm","brandExclude":null},{"label":"Notice of Withdrawal from Partnership","value":"\/\/www.legalcontracts.ca\/contracts\/partnership-withdrawal\/?loc=CA","brandExclude":null},{"label":"Notice to Pay Rent or Quit","value":"\/\/www.legalcontracts.ca\/contracts\/eviction-notice-landlord-forms\/?loc=CA&ldcn=nonpayment","brandExclude":null},{"label":"Notice to Quit","value":"\/\/www.legalcontracts.ca\/contracts\/eviction-notice-landlord-forms\/?loc=CA&ldcn=quit","brandExclude":null},{"label":"Offer to Lease","value":"\/\/www.legalcontracts.ca\/contracts\/offer-to-lease\/?loc=CA","brandExclude":null},{"label":"Partnership Amendment","value":"\/\/www.legalcontracts.ca\/contracts\/partnership-amendment\/?loc=CA","brandExclude":null},{"label":"Performance Agreement","value":"\/\/www.legalcontracts.ca\/contracts\/performance-contract\/?loc=CA","brandExclude":null},{"label":"Performance Contract","value":"\/\/www.legalcontracts.ca\/contracts\/performance-contract\/?loc=CA","brandExclude":null},{"label":"Landlord's Consent to Lease Assignment","value":"\/\/www.legalcontracts.ca\/contracts\/lease-assignment-consent\/?loc=CA","brandExclude":null},{"label":"Landlord's Consent to Sublease","value":"\/\/www.legalcontracts.ca\/contracts\/sublease-consent\/?loc=CA","brandExclude":null},{"label":"Lease Assignment Agreement","value":"\/\/www.legalcontracts.ca\/contracts\/lease-assignment\/?loc=CA","brandExclude":null},{"label":"Lease Notice","value":"\/\/www.legalcontracts.ca\/contracts\/eviction-notice-landlord-forms\/?loc=CA","brandExclude":null},{"label":"Letter of Intent","value":"\/\/www.legalcontracts.ca\/contracts\/letter-of-intent\/?loc=CA&ldcn=letter","brandExclude":null},{"label":"Hold-Harmless (Indemnity) Agreement","value":"\/\/www.legalcontracts.ca\/contracts\/hold-harmless-agreement\/?loc=CA&ldcn=long","brandExclude":null},{"label":"Indemnity Agreement","value":"\/\/www.legalcontracts.ca\/contracts\/hold-harmless-agreement\/?loc=CA&ldcn=indemnity","brandExclude":null},{"label":"Independent Contractor Agreement","value":"\/\/www.legalcontracts.ca\/contracts\/independent-contractor-agreement\/?loc=CA&ldcn=contractor","brandExclude":null},{"label":"Invoice Form","value":"\/\/www.legalcontracts.ca\/contracts\/invoice-form\/?loc=CA","brandExclude":null},{"label":"End User Licence Agreement","value":"\/\/www.legalcontracts.ca\/contracts\/software-license-agreement\/?loc=CA&ldcn=long","brandExclude":null},{"label":"End User Licence Agreement (EULA)","value":"\/\/www.legalcontracts.ca\/contracts\/software-license-agreement\/?loc=CA&ldcn=shortlong","brandExclude":null},{"label":"EULA","value":"\/\/www.legalcontracts.ca\/contracts\/software-license-agreement\/?loc=CA&ldcn=short","brandExclude":null},{"label":"Eviction Notice","value":"\/\/www.legalcontracts.ca\/contracts\/eviction-notice-landlord-forms\/?loc=CA&ldcn=eviction","brandExclude":null},{"label":"Financial Statement (Personal)","value":"\/\/www.legalcontracts.ca\/contracts\/financial-statement\/?loc=CA","brandExclude":null},{"label":"Gift Deed","value":"\/\/www.legalcontracts.ca\/contracts\/gift-deed\/?loc=CA","brandExclude":null},{"label":"Corporate Bylaws","value":"\/\/www.legalcontracts.ca\/contracts\/corporate-bylaws\/?loc=CA","brandExclude":null},{"label":"Demand Letter","value":"\/\/www.legalcontracts.ca\/contracts\/payment-demand-letter\/?loc=CA","brandExclude":null},{"label":"Directors' Resolution","value":"\/\/www.legalcontracts.ca\/contracts\/corporate-resolution-lc\/?loc=CA&ldcn=resolution","brandExclude":null},{"label":"Employee Warning Letter","value":"\/\/www.legalcontracts.ca\/contracts\/employee-warning-letter\/?loc=CA","brandExclude":null},{"label":"Employment Contract","value":"\/\/www.legalcontracts.ca\/contracts\/employment-contract\/?loc=CA","brandExclude":null},{"label":"Employment Offer Letter","value":"\/\/www.legalcontracts.ca\/contracts\/employment-offer-letter\/?loc=CA","brandExclude":null},{"label":"Employment Termination Letter","value":"\/\/www.legalcontracts.ca\/contracts\/employment-termination-letter\/?loc=CA","brandExclude":null},{"label":"Child Travel Consent","value":"\/\/www.legalcontracts.ca\/contracts\/child-travel-consent\/?loc=CA","brandExclude":null},{"label":"Cleaning Services Agreement","value":"\/\/www.legalcontracts.ca\/contracts\/cleaning-agreement\/?loc=CA","brandExclude":null},{"label":"Codicil","value":"\/\/www.legalcontracts.ca\/contracts\/codicil-to-will\/?loc=CA","brandExclude":null},{"label":"Cohabitation Agreement","value":"\/\/www.legalcontracts.ca\/contracts\/cohabitation-agreement\/?loc=CA&ldcn=cohab","brandExclude":null},{"label":"Commercial Lease","value":"\/\/www.legalcontracts.ca\/contracts\/commercial-lease-agreement\/?loc=CA","brandExclude":null},{"label":"Commercial Lease Application","value":"\/\/www.legalcontracts.ca\/contracts\/commercial-lease-rental-application\/?loc=CA&ldcn=commercialapp","brandExclude":null},{"label":"Commercial Sublease Agreement","value":"\/\/www.legalcontracts.ca\/contracts\/commercial-sublease-agreement\/?loc=CA","brandExclude":null},{"label":"Common Law Partner Agreement","value":"\/\/www.legalcontracts.ca\/contracts\/common-law-partner-agreement\/?loc=CA&ldcn=commonlaw","brandExclude":null},{"label":"Compensation Agreement","value":"\/\/www.legalcontracts.ca\/contracts\/compensation-agreement\/?loc=CA","brandExclude":null},{"label":"Complaint Letter","value":"\/\/www.legalcontracts.ca\/contracts\/customer-complaint-letter\/?loc=CA","brandExclude":null},{"label":"Computer Services Agreement","value":"\/\/www.legalcontracts.ca\/contracts\/computer-services-agreement\/?loc=CA&ldcn=computer","brandExclude":null},{"label":"Confidentiality Agreement","value":"\/\/www.legalcontracts.ca\/contracts\/confidentiality-agreement\/?loc=CA","brandExclude":null},{"label":"Consent to Action Without Meeting","value":"\/\/www.legalcontracts.ca\/contracts\/corporate-resolution-lc\/?loc=CA&ldcn=action","brandExclude":null},{"label":"Consent to be Director and Officer","value":"\/\/www.legalcontracts.ca\/contracts\/director-officer-consent-form\/?loc=CA","brandExclude":null},{"label":"Business Plan","value":"\/\/www.legalcontracts.ca\/contracts\/business-plan\/?loc=CA&ldcn=partnership-and-joint-venture","brandExclude":null},{"label":"Car Bill of Sale","value":"\/\/www.legalcontracts.ca\/contracts\/bill-of-sale\/?loc=CA&ldcn=car","brandExclude":null},{"label":"Catering Contract","value":"\/\/www.legalcontracts.ca\/contracts\/catering-service-agreement\/?loc=CA","brandExclude":null},{"label":"Cease & Desist Letter","value":"\/\/www.legalcontracts.ca\/contracts\/cease-and-desist-letter\/?loc=CA","brandExclude":null},{"label":"Certificate of Incumbency","value":"\/\/www.legalcontracts.ca\/contracts\/certificate-of-incumbency\/?loc=CA","brandExclude":null},{"label":"Child Care Services Agreement","value":"\/\/www.legalcontracts.ca\/contracts\/childcare-services-agreement\/?loc=CA","brandExclude":null},{"label":"Affidavit","value":"\/\/www.legalcontracts.ca\/contracts\/affidavit-form\/?loc=CA","brandExclude":null},{"label":"Affidavit of Execution","value":"\/\/www.legalcontracts.ca\/contracts\/affidavit-of-execution\/?loc=CA","brandExclude":null},{"label":"Amending Agreement","value":"\/\/www.legalcontracts.ca\/contracts\/addendum\/?loc=CA","brandExclude":null},{"label":"Assignment","value":"\/\/www.legalcontracts.ca\/contracts\/legal-assignment-form\/?loc=CA","brandExclude":null},{"label":"Assignment of Partnership Interest","value":"\/\/www.legalcontracts.ca\/contracts\/assignment-of-partnership-interest\/?loc=CA","brandExclude":null},{"label":"Assignment of Trade Name ","value":"\/\/www.legalcontracts.ca\/contracts\/trade-name-transfer\/?loc=CA","brandExclude":null},{"label":"Automobile Bill of Sale","value":"\/\/www.legalcontracts.ca\/contracts\/bill-of-sale\/?loc=CA&ldcn=automobile","brandExclude":null},{"label":"Band Partnership Agreement","value":"\/\/www.legalcontracts.ca\/contracts\/band-partnership-agreement\/?loc=CA","brandExclude":null},{"label":"Bill of Sale","value":"\/\/www.legalcontracts.ca\/contracts\/bill-of-sale\/?loc=CA","brandExclude":null},{"label":"Boat Bill of Sale","value":"\/\/www.legalcontracts.ca\/contracts\/bill-of-sale\/?loc=CA&ldcn=boat","brandExclude":null},{"label":"Service Agreement (Contractor)","value":"\/\/www.legalcontracts.ca\/contracts\/independent-contractor-agreement\/?loc=CA&ldcn=service_contractor","brandExclude":null},{"label":"Service Agreement (Software\/IT)","value":"\/\/www.legalcontracts.ca\/contracts\/computer-services-agreement\/?loc=CA&ldcn=software","brandExclude":null},{"label":"Share Purchase Agreement","value":"\/\/www.legalcontracts.ca\/contracts\/stock-purchase-contract\/?loc=CA","brandExclude":null},{"label":"Share Repurchase Agreement","value":"\/\/www.legalcontracts.ca\/contracts\/stock-repurchase-
20265agreement\/?loc=CA","brandExclude":null},{"label":"Share Subscription","value":"\/\/www.legalcontracts.ca\/contracts\/stock-subscription-agreement\/?loc=CA","brandExclude":null},{"label":"Shareholder Agreement","value":"\/\/www.legalcontracts.ca\/contracts\/shareholder-agreement\/?loc=CA","brandExclude":null},{"label":"Shareholder Loan Agreement","value":"\/\/www.legalcontracts.ca\/contracts\/shareholder-loan\/?loc=CA","brandExclude":null},{"label":"Shareholder Proxy","value":"\/\/www.legalcontracts.ca\/contracts\/shareholder-proxy-voting-form\/?loc=CA","brandExclude":null},{"label":"Shareholder's Appointment of Representative","value":"\/\/www.legalcontracts.ca\/contracts\/appoint-shareholder\/?loc=CA","brandExclude":null},{"label":"Shareholders' Resolution","value":"\/\/www.legalcontracts.ca\/contracts\/shareholders-resolution\/?loc=CA","brandExclude":null},{"label":"Termination Agreement","value":"\/\/www.legalcontracts.ca\/contracts\/contract-termination-agreement\/?loc=CA","brandExclude":null},{"label":"Trademark Assignment","value":"\/\/www.legalcontracts.ca\/contracts\/trademark-assignment\/?loc=CA&ldcn=trademark","brandExclude":null},{"label":"Trailer Bill of Sale","value":"\/\/www.legalcontracts.ca\/contracts\/bill-of-sale\/?loc=CA&ldcn=trailer","brandExclude":null},{"label":"Vehicle Bill of Sale","value":"\/\/www.legalcontracts.ca\/contracts\/bill-of-sale\/?loc=CA&ldcn=vehicle","brandExclude":null},{"label":"Cancel Free Trial","value":"\/\/www.legalcontracts.ca\/cancel\/signin.php?loc=CA","brandExclude":null},{"label":"Cancel Subscription","value":"\/\/www.legalcontracts.ca\/cancel\/signin.php?loc=CA","brandExclude":null},{"label":"End Free Subscription","value":"\/\/www.legalcontracts.ca\/cancel\/signin.php?loc=CA","brandExclude":null},{"label":"End Free Trial","value":"\/\/www.legalcontracts.ca\/cancel\/signin.php?loc=CA","brandExclude":null}],"DE":[{"label":"Werkvertrag","value":"\/contracts\/werkvertrag\/?loc=DE","brandExclude":null},{"label":"Beratungsvertrag","value":"\/contracts\/consulting-agreement\/?loc=DE","brandExclude":null},{"label":"Cateringvertrag","value":"\/contracts\/catering-service-agreement\/?loc=DE","brandExclude":null},{"label":"Ehevertrag","value":"\/contracts\/ehevertrag\/?loc=DE","brandExclude":null},{"label":"Einladungsschreiben f\u00fcr ein Visum","value":"\/contracts\/Einladungsschreiben-Visum\/?loc=DE","brandExclude":null},{"label":"Einverst\u00e4ndniserkl\u00e4rung (Minderj\u00e4hrige)","value":"\/contracts\/einverstaendniserklaerung-minderjaehrige\/?loc=DE","brandExclude":null},{"label":"Fremdgesch\u00e4ftsf\u00fchrer-Anstellungsvertrag","value":"\/contracts\/anstellungsvertrag\/?loc=DE","brandExclude":null},{"label":"GbR-Gesellschaftsvertrag","value":"\/contracts\/gbr-gesellschaftsvertrag\/?loc=DE","brandExclude":null},{"label":"Gesellschafterliste","value":"\/contracts\/gesellschafterliste\/?loc=DE","brandExclude":null},{"label":"Gesellschaftsvertrag f\u00fcr eGbR","value":"\/vertraege\/egbr-gesellschaftsvertrag\/?loc=DE","brandExclude":null},{"label":"GmbH-Gesellschaftsvertrag","value":"\/contracts\/gmbh\/?loc=DE","brandExclude":null},{"label":"IT-Dienstvertrag","value":"\/contracts\/computer-services-agreement\/?loc=DE","brandExclude":null},{"label":"Mietb\u00fcrgschaft","value":"\/contracts\/Mietbuergschaft\/?loc=DE","brandExclude":null},{"label":"Mietvertrag f\u00fcr ein Einzelhandelsgesch\u00e4ft","value":"\/contracts\/Mietvertrag-Einzelhandelsgeschaeft\/?loc=DE","brandExclude":null},{"label":"Nachweis eines Arbeitsverh\u00e4ltnisses","value":"\/contracts\/nachweis-eines-arbeitsverhaeltnisses\/?loc=DE","brandExclude":null},{"label":"Pachtvertrag","value":"\/wohnen-und-vermieten\/Pachtvertrag\/?loc=DE","brandExclude":null},{"label":"Reinigungsvertrag","value":"\/contracts\/cleaning-agreement\/?loc=DE","brandExclude":null},{"label":"Schenkungsvertrag","value":"\/contracts\/Schenkungsvertrag\/?loc=DE","brandExclude":null},{"label":"UG (haftungsbeschr\u00e4nkt) - Gesellschaftsvertrag","value":"\/contracts\/gesellschaftsvertrag-ug\/?loc=DE","brandExclude":null},{"label":"Vereinssatzung","value":"\/arbeit-und-hr\/vereinssatzung\/?loc=DE","brandExclude":null},{"label":"Vertrag \u00fcber freie Mitarbeit","value":"\/contracts\/independent-contractor-agreement\/?loc=DE","brandExclude":null},{"label":"Zusatzvereinbarung \u00fcber Telearbeit","value":"\/contracts\/zusatzvereinbarung-telearbeit\/?loc=DE","brandExclude":null}],"FR":[{"label":"Convention de PACS","value":"\/famille\/convention-de-pacs\/?loc=FR","brandExclude":null},{"label":"Pacte civile de solidarit\u00e9","value":"\/famille\/convention-de-pacs\/?loc=FR&ldcn=long","brandExclude":null},{"label":"Pacte de colocation","value":"\/contracts\/rm-agmt\/?loc=FR","brandExclude":null},{"label":"Soci\u00e9t\u00e9 \u00e0 responsabilit\u00e9 limit\u00e9e","value":"\/commerce\/SARL\/?loc=FR&ldcn=long","brandExclude":null},{"label":"Statuts d'une EURL","value":"\/contracts\/llc-operating-agreement\/?loc=FR","brandExclude":null},{"label":"Statuts d'une SARL","value":"\/commerce\/SARL\/?loc=FR","brandExclude":null},{"label":"Entreprise unipersonnelle \u00e0 responsabilit\u00e9 limit\u00e9e","value":"\/contracts\/llc-operating-agreement\/?loc=FR&ldcn=long","brandExclude":null},{"label":"Lettre de mise en demeure","value":"\/contracts\/payment-demand-letter\/?loc=FR","brandExclude":null},{"label":"Accord de non-divulgation","value":"\/contracts\/non-disclosure-agreement\/?loc=FR","brandExclude":null}],"GB":[{"label":"Tenancy Agreement","value":"\/\/www.legalcontracts.co.uk\/contracts\/tenancy-agreement-form\/?loc=GB","brandExclude":null},{"label":"Promissory Note","value":"\/\/www.legalcontracts.co.uk\/contracts\/promissory-note-forms\/?loc=GB","brandExclude":null},{"label":"Health Care Directive","value":"\/\/www.legalcontracts.co.uk\/contracts\/uk-living-will-form\/?loc=GB&ldcn=healthdiruk","brandExclude":null},{"label":"Living Will","value":"\/\/www.legalcontracts.co.uk\/contracts\/uk-living-will-form\/?loc=GB&ldcn=livingwilluk","brandExclude":null},{"label":"Advance Decision","value":"\/\/www.legalcontracts.co.uk\/contracts\/uk-living-will-form\/?loc=GB&ldcn=advancedecisionuk","brandExclude":null},{"label":"Child Medical Consent","value":"\/\/www.legalcontracts.co.uk\/contracts\/medical-consent-form\/?loc=GB","brandExclude":null},{"label":"Building Contract","value":"\/\/www.legalcontracts.co.uk\/contracts\/service-contract\/?loc=GB&ldcn=building","brandExclude":null},{"label":"Service Agreement","value":"\/\/www.legalcontracts.co.uk\/contracts\/service-contract\/?loc=GB&ldcn=service","brandExclude":null},{"label":"Service Agreement (Building)","value":"\/\/www.legalcontracts.co.uk\/contracts\/service-contract\/?loc=GB&ldcn=building_service","brandExclude":null},{"label":"Service Agreement (Construction)","value":"\/\/www.legalcontracts.co.uk\/contracts\/service-contract\/?loc=GB&ldcn=construction_service","brandExclude":null},{"label":"Service Agreement (Consulting)","value":"\/\/www.legalcontracts.co.uk\/contracts\/consulting-agreement\/?loc=GB&ldcn=service_consulting","brandExclude":null},{"label":"Service Agreement (General)","value":"\/\/www.legalcontracts.co.uk\/contracts\/service-contract\/?loc=GB&ldcn=main_","brandExclude":null},{"label":"Service Agreement (Home)","value":"\/\/www.legalcontracts.co.uk\/contracts\/service-contract\/?loc=GB&ldcn=home","brandExclude":null},{"label":"Service Agreement (Maintenance)","value":"\/\/www.legalcontracts.co.uk\/contracts\/service-contract\/?loc=GB&ldcn=maintenance","brandExclude":null},{"label":"Service Agreement (Repair)","value":"\/\/www.legalcontracts.co.uk\/contracts\/service-contract\/?loc=GB&ldcn=repair","brandExclude":null},{"label":"Construction Contract","value":"\/\/www.legalcontracts.co.uk\/contracts\/service-contract\/?loc=GB&ldcn=construction","brandExclude":null},{"label":"Consulting Agreement","value":"\/\/www.legalcontracts.co.uk\/contracts\/consulting-agreement\/?loc=GB&ldcn=consult","brandExclude":null},{"label":"Flatmate Agreement","value":"\/\/www.legalcontracts.co.uk\/contracts\/flatmate-agreement\/?loc=GB","brandExclude":null},{"label":"Joint Venture Agreement","value":"\/\/www.legalcontracts.co.uk\/contracts\/joint-venture-agreement\/?loc=GB","brandExclude":null},{"label":"Last Will and Testament","value":"\/\/www.legalcontracts.co.uk\/contracts\/last-will-and-testament-uk\/?loc=GB","brandExclude":null},{"label":"Lease Assignment Agreement","value":"\/\/www.legalcontracts.co.uk\/contracts\/lease-assignment\/?loc=GB","brandExclude":null},{"label":"Letter of Intent","value":"\/\/www.legalcontracts.co.uk\/contracts\/letter-of-intent\/?loc=GB&ldcn=letter","brandExclude":null},{"label":"Hold-Harmless (Indemnity) Agreement","value":"\/\/www.legalcontracts.co.uk\/contracts\/hold-harmless-agreement\/?loc=GB&ldcn=long","brandExclude":null},{"label":"Indemnity Agreement","value":"\/\/www.legalcontracts.co.uk\/contracts\/hold-harmless-agreement\/?loc=GB&ldcn=indemnity","brandExclude":null},{"label":"Independent Contractor Agreement","value":"\/\/www.legalcontracts.co.uk\/contracts\/independent-contractor-agreement\/?loc=GB&ldcn=contractor","brandExclude":null},{"label":"Demand Letter","value":"\/\/www.legalcontracts.co.uk\/contracts\/demand-letter-uk\/?loc=GB","brandExclude":null},{"label":"Directors' Resolution","value":"\/\/www.legalcontracts.co.uk\/contracts\/corporate-resolution-lc\/?loc=GB&ldcn=resolution","brandExclude":null},{"label":"Employment Contract","value":"\/\/www.legalcontracts.co.uk\/contracts\/employment-contract\/?loc=GB","brandExclude":null},{"label":"Equipment Hire Agreement","value":"\/\/www.legalcontracts.co.uk\/contracts\/equipment-rental\/?loc=GB","brandExclude":null},{"label":"Eviction and Renewal Notices (Commercial)","value":"\/\/www.legalcontracts.co.uk\/contracts\/lease-notice-forms\/?loc=GB","brandExclude":null},{"label":"Eviction Notices","value":"\/\/www.legalcontracts.co.uk\/contracts\/eviction-notice-forms\/?loc=GB&ldcn=eviction","brandExclude":null},{"label":"Eviction Notices (Residential)","value":"\/\/www.legalcontracts.co.uk\/contracts\/eviction-notice-forms\/?loc=GB","brandExclude":null},{"label":"Financial Statement (Personal)","value":"\/\/www.legalcontracts.co.uk\/contracts\/financial-statement\/?loc=GB","brandExclude":null},{"label":"Purchase of Business Agreement","value":"\/\/www.legalcontracts.co.uk\/contracts\/business-purchase-
20265agreement\/?loc=GB","brandExclude":null},{"label":"Release\/Waiver Agreement","value":"\/\/www.legalcontracts.co.uk\/contracts\/release-of-liability\/?loc=GB","brandExclude":null},{"label":"Rental Inspection Report","value":"\/\/www.legalcontracts.co.uk\/contracts\/rental-inspection-form\/?loc=GB","brandExclude":null},{"label":"Residential Eviction Notices","value":"\/\/www.legalcontracts.co.uk\/contracts\/eviction-notice-forms\/?loc=GB","brandExclude":null},{"label":"Residential Rental Application","value":"\/\/www.legalcontracts.co.uk\/contracts\/rental-application-form\/?loc=GB","brandExclude":null},{"label":"Residential Sublease Agreement","value":"\/\/www.legalcontracts.co.uk\/contracts\/sublet-agreement\/?loc=GB","brandExclude":null},{"label":"Residential Sublet Agreement","value":"\/\/www.legalcontracts.co.uk\/contracts\/sublet-agreement\/?loc=GB","brandExclude":null},{"label":"Residential Tenancy Application","value":"\/\/www.legalcontracts.co.uk\/contracts\/rental-application-form\/?loc=GB","brandExclude":null},{"label":"Revocation of Power of Attorney","value":"\/\/www.legalcontracts.co.uk\/contracts\/revocation-of-power-of-attorney\/?loc=GB","brandExclude":null},{"label":"Section 25 Notice","value":"\/\/www.legalcontracts.co.uk\/contracts\/section_25_notice\/?loc=GB&ldcn=landing25","brandExclude":null},{"label":"Section 26 Notice","value":"\/\/www.legalcontracts.co.uk\/contracts\/section_26_notice\/?loc=GB&ldcn=landing26","brandExclude":null},{"label":"Section 8 Notice","value":"\/\/www.legalcontracts.co.uk\/contracts\/section_8_notice\/?loc=GB&ldcn=landing8","brandExclude":null},{"label":"Separation \/ Divorce Papers","value":"\/\/www.legalcontracts.co.uk\/contracts\/separation-agreement-united-kingdom-lc\/?loc=GB&ldcn=sdp","brandExclude":null},{"label":"Separation Agreement","value":"\/\/www.legalcontracts.co.uk\/contracts\/separation-agreement-united-kingdom-lc\/?loc=GB","brandExclude":null},{"label":"Separation Agreement (Before Divorce)","value":"\/\/www.legalcontracts.co.uk\/contracts\/separation-agreement-united-kingdom-lc\/?loc=GB&ldcn=sabd","brandExclude":null},{"label":"Trailer Bill of Sale","value":"\/\/www.legalcontracts.co.uk\/contracts\/bill-of-sale\/?loc=GB&ldcn=trailer","brandExclude":null},{"label":"Vehicle Bill of Sale","value":"\/\/www.legalcontracts.co.uk\/contracts\/bill-of-sale\/?loc=GB&ldcn=vehicle","brandExclude":null},{"label":"Waiver\/Release Agreement","value":"\/\/www.legalcontracts.co.uk\/contracts\/release-of-liability\/?loc=GB","brandExclude":null},{"label":"Will","value":"\/\/www.legalcontracts.co.uk\/contracts\/last-will-and-testament-uk\/?loc=GB&ldcn=will","brandExclude":null},{"label":"Service Agreement (Software\/IT)","value":"\/\/www.legalcontracts.co.uk\/contracts\/computer-services-agreement\/?loc=GB&ldcn=software","brandExclude":null},{"label":"Talk to a Lawyer","value":"\/\/www.legalcontracts.co.uk\/contracts\/talk-to-a-lawyer\/?loc=GB","brandExclude":null},{"label":"Service Agreement (Contractor)","value":"\/\/www.legalcontracts.co.uk\/contracts\/independent-contractor-agreement\/?loc=GB&ldcn=service_contractor","brandExclude":null},{"label":"Loan Agreement","value":"\/\/www.legalcontracts.co.uk\/contracts\/loan-agreement-forms\/?loc=GB","brandExclude":null},{"label":"Memorandum of Understanding","value":"\/\/www.legalcontracts.co.uk\/contracts\/letter-of-intent\/?loc=GB&ldcn=MOU","brandExclude":null},{"label":"Non-Disclosure Agreement","value":"\/\/www.legalcontracts.co.uk\/contracts\/non-disclosure-agreement\/?loc=GB","brandExclude":null},{"label":"Notice of Withdrawal from Partnership","value":"\/\/www.legalcontracts.co.uk\/contracts\/partnership-withdrawal\/?loc=GB","brandExclude":null},{"label":"Pay Rise Agreement","value":"\/\/www.legalcontracts.co.uk\/contracts\/pay-rise-agreement\/?loc=GB","brandExclude":null},{"label":"Performance Contract","value":"\/\/www.legalcontracts.co.uk\/contracts\/performance-contract\/?loc=GB","brandExclude":null},{"label":"Power of Attorney","value":"\/\/www.legalcontracts.co.uk\/contracts\/p
20265ower-of-attorney-form\/?loc=GB","brandExclude":null},{"label":"Prenuptial Agreement","value":"\/\/www.legalcontracts.co.uk\/contracts\/prenuptial-agreement\/?loc=GB","brandExclude":null},{"label":"Business Plan","value":"\/\/www.legalcontracts.co.uk\/contracts\/business-plan\/?loc=GB&ldcn=partnership-and-joint-venture","brandExclude":null},{"label":"Car Bill of Sale","value":"\/\/www.legalcontracts.co.uk\/contracts\/bill-of-sale\/?loc=GB&ldcn=car","brandExclude":null},{"label":"Catering Contract","value":"\/\/www.legalcontracts.co.uk\/contracts\/catering-service-agreement\/?loc=GB","brandExclude":null},{"label":"Cease & Desist","value":"\/\/www.legalcontracts.co.uk\/contracts\/cease-and-desist-letter-UK\/?loc=GB","brandExclude":null},{"label":"Child Care Services Agreement","value":"\/\/www.legalcontracts.co.uk\/contracts\/childcare-services-agreement\/?loc=GB","brandExclude":null},{"label":"Child Travel Consent","value":"\/\/www.legalcontracts.co.uk\/contracts\/child-travel-consent\/?loc=GB","brandExclude":null},{"label":"Cleaning Services Agreement","value":"\/\/www.legalcontracts.co.uk\/contracts\/cleaning-agreement\/?loc=GB","brandExclude":null},{"label":"Commercial Eviction and Renewal Notices","value":"\/\/www.legalcontracts.co.uk\/contracts\/lease-notice-forms\/?loc=GB&ldcn=notice","brandExclude":null},{"label":"Commercial Lease Agreement","value":"\/\/www.legalcontracts.co.uk\/contracts\/commercial-lease-agreement-uk\/?loc=GB&ldcn=commercial","brandExclude":null},{"label":"Commercial Letting\/Business Lease","value":"\/\/www.legalcontracts.co.uk\/contracts\/commercial-lease-agreement-uk\/?loc=GB","brandExclude":null},{"label":"Commercial Sublease Agreement","value":"\/\/www.legalcontracts.co.uk\/contracts\/commercial-sublease-agreement\/?loc=GB","brandExclude":null},{"label":"Compensation Agreement","value":"\/\/www.legalcontracts.co.uk\/contracts\/compensation-agreement\/?loc=GB","brandExclude":null},{"label":"Complaint Letter","value":"\/\/www.legalcontracts.co.uk\/contracts\/customer-complaint-letter\/?loc=GB","brandExclude":null},{"label":"Computer Services Agreement","value":"\/\/www.legalcontracts.co.uk\/contracts\/computer-services-agreement\/?loc=GB&ldcn=computer","brandExclude":null},{"label":"Confidentiality Agreement","value":"\/\/www.legalcontracts.co.uk\/contracts\/confidentiality-agreement\/?loc=GB","brandExclude":null},{"label":"Amending Agreement","value":"\/\/www.legalcontracts.co.uk\/contracts\/addendum\/?loc=GB&ldcn=amendingagmt","brandExclude":null},{"label":"Assignment","value":"\/\/www.legalcontracts.co.uk\/contracts\/legal-assignment-form\/?loc=GB","brandExclude":null},{"label":"Assignment of Partnership Interest","value":"\/\/www.legalcontracts.co.uk\/contracts\/assignment-of-partnership-interest\/?loc=GB","brandExclude":null},{"label":"Automobile Bill of Sale","value":"\/\/www.legalcontracts.co.uk\/contracts\/bill-of-sale\/?loc=GB&ldcn=automobile","brandExclude":null},{"label":"Bill of Sale","value":"\/\/www.legalcontracts.co.uk\/contracts\/bill-of-sale\/?loc=GB","brandExclude":null},{"label":"Boat Bill of Sale","value":"\/\/www.legalcontracts.co.uk\/contracts\/bill-of-sale\/?loc=GB&ldcn=boat","brandExclude":null},{"label":"Cancel Free Trial","value":"\/\/www.legalcontracts.co.uk\/cancel\/signin.php?loc=GB","brandExclude":null},{"label":"Cancel Subscription","value":"\/\/www.legalcontracts.co.uk\/cancel\/signin.php?loc=GB","brandExclude":null},{"label":"End Free Subscription","value":"\/\/www.legalcontracts.co.uk\/cancel\/signin.php?loc=GB","brandExclude":null},{"label":"End Free Trial","value":"\/\/www.legalcontracts.co.uk\/cancel\/signin.php?loc=GB","brandExclude":null}],"IE":[{"label":"Tenancy Agreement","value":"\/contracts\/residential-tenancy-agreement\/?loc=IE","brandExclude":null},{"label":"Promissory Note","value":"\/contracts\/promissory-note-forms\/?loc=IE","brandExclude":null},{"label":"Separation \/ Divorce Papers","value":"\/family\/separation-agreement-form\/?loc=IE&ldcn=sdp","brandExclude":null},{"label":"Separation Agreement","value":"\/family\/separation-agreement-form\/?loc=IE","brandExclude":null},{"label":"Separation Agreement (Before Divorce)","value":"\/family\/separation-agreement-form\/?loc=IE&ldcn=sabd","brandExclude":null},{"label":"Last Will and Testament","value":"\/contracts\/last-will-and-testament\/?loc=IE","brandExclude":null},{"label":"Will","value":"\/contracts\/last-will-and-testament\/?loc=IE&ldcn=will","brandExclude":null},{"label":"Child Medical Consent","value":"\/contracts\/medical-consent-form\/?loc=IE","brandExclude":null},{"label":"Building Contract","value":"\/contracts\/service-contract\/?loc=IE&ldcn=building","brandExclude":null},{"label":"Service Agreement (General)","value":"\/contracts\/service-contract\/?loc=IE&ldcn=main_","brandExclude":null},{"label":"Service Agreement (Home)","value":"\/contracts\/service-contract\/?loc=IE&ldcn=home","brandExclude":null},{"label":"Service Agreement (Maintenance)","value":"\/contracts\/service-contract\/?loc=IE&ldcn=maintenance","brandExclude":null},{"label":"Service Agreement (Repair)","value":"\/contracts\/service-contract\/?loc=IE&ldcn=repair","brandExclude":null},{"label":"Construction Contract","value":"\/contracts\/service-contract\/?loc=IE&ldcn=construction","brandExclude":null},{"label":"Consulting Agreement","value":"\/contracts\/consulting-agreement\/?loc=IE&ldcn=consult","brandExclude":null},{"label":"Service Agreement","value":"\/contracts\/service-contract\/?loc=IE&ldcn=service","brandExclude":null},{"label":"Service Agreement (Building)","value":"\/contracts\/service-contract\/?loc=IE&ldcn=building_service","brandExclude":null},{"label":"Service Agreement (Construction)","value":"\/contracts\/service-contract\/?loc=IE&ldcn=construction_service","brandExclude":null},{"label":"Service Agreement (Consulting)","value":"\/contracts\/consulting-agreement\/?loc=IE&ldcn=service_consulting","brandExclude":null},{"label":"Service Agreement (Contractor)","value":"\/contracts\/independent-contractor-agreement\/?loc=IE&ldcn=service_contractor","brandExclude":null},{"label":"Demand Letter","value":"\/contracts\/payment-demand-letter\/?loc=IE","brandExclude":null},{"label":"Employment Contract","value":"\/contracts\/employment-contract\/?loc=IE","brandExclude":null},{"label":"Eviction Notice","value":"\/contracts\/evctn-ntce\/?loc=IE&ldcn=eviction","brandExclude":null},{"label":"Financial Statement (Personal)","value":"\/contracts\/financial-statement\/?loc=IE","brandExclude":null},{"label":"Independent Contractor Agreement","value":"\/contracts\/independent-contractor-agreement\/?loc=IE&ldcn=contractor","brandExclude":null},{"label":"Loan Agreement","value":"\/contracts\/loan-agreement-forms\/?loc=IE","brandExclude":null},{"label":"Non-Disclosure Agreement","value":"\/contracts\/non-disclosure-agreement\/?loc=IE","brandExclude":null},{"label":"Notice of Termination","value":"\/contracts\/evctn-ntce\/?loc=IE&ldcn=landlordterm","brandExclude":null},{"label":"Notice of Withdrawal from Partnership","value":"\/contracts\/partnership-withdrawal\/?loc=IE","brandExclude":null},{"label":"Performance Contract","value":"\/contracts\/performance-contract\/?loc=IE","brandExclude":null}
20265,{"label":"Power of Attorney","value":"\/contracts\/power-of-attorney-form\/?loc=IE","brandExclude":null},{"label":"Service Agreement (Software\/IT)","value":"\/contracts\/computer-services-agreement\/?loc=IE&ldcn=software","brandExclude":null},{"label":"Talk to a Lawyer","value":"\/contracts\/talk-to-a-lawyer\/?loc=IE","brandExclude":null},{"label":"Release\/Waiver Agreement","value":"\/contracts\/release-of-liability\/?loc=IE","brandExclude":null},{"label":"Residential Rental Application","value":"\/contracts\/rental-application-form\/?loc=IE","brandExclude":null},{"label":"Residential Tenancy Application","value":"\/contracts\/rental-application-form\/?loc=IE","brandExclude":null},{"label":"Catering Contract","value":"\/contracts\/catering-service-agreement\/?loc=IE","brandExclude":null},{"label":"Child Travel Consent","value":"\/contracts\/child-travel-consent\/?loc=IE","brandExclude":null},{"label":"Cleaning Services Agreement","value":"\/contracts\/cleaning-agreement\/?loc=IE","brandExclude":null},{"label":"Commercial Lease Agreement","value":"\/contracts\/commercial-lease-agreement\/?loc=IE","brandExclude":null},{"label":"Computer Services Agreement","value":"\/contracts\/computer-services-agreement\/?loc=IE&ldcn=computer","brandExclude":null},{"label":"Confidentiality Agreement","value":"\/contracts\/confidentiality-agreement\/?loc=IE","brandExclude":null},{"label":"Amending Agreement","value":"\/contracts\/addendum\/?loc=IE","brandExclude":null},{"label":"Assignment of Partnership Interest","value":"\/contracts\/assignment-of-partnership-interest\/?loc=IE","brandExclude":null},{"label":"Bill of Sale","value":"\/contracts\/bill-of-sale\/?loc=IE","brandExclude":null}],"IN":[{"label":"Promissory Note","value":"\/contracts\/promissory-note-forms\/?loc=IN","brandExclude":null},{"label":"Child Medical Consent","value":"\/contracts\/medical-consent-form\/?loc=IN","brandExclude":null},{"label":"Building Contract","value":"\/contracts\/service-contract\/?loc=IN&ldcn=building","brandExclude":null},{"label":"Service Agreement","value":"\/contracts\/service-contract\/?loc=IN&ldcn=service","brandExclude":null},{"label":"Service Agreement (Building)","value":"\/contracts\/service-contract\/?loc=IN&ldcn=building_service","brandExclude":null},{"label":"Service Agreement (Construction)","value":"\/contracts\/service-contract\/?loc=IN&ldcn=construction_service","brandExclude":null},{"label":"Service Agreement (Consulting)","value":"\/contracts\/consulting-agreement\/?loc=IN&ldcn=service_consulting","brandExclude":null},{"label":"Construction Contract","value":"\/contracts\/service-contract\/?loc=IN&ldcn=construction","brandExclude":null},{"label":"Consulting Agreement","value":"\/contracts\/consulting-agreement\/?loc=IN&ldcn=consult","brandExclude":null},{"label":"Service Agreement (General)","value":"\/contracts\/service-contract\/?loc=IN&ldcn=main_","brandExclude":null},{"label":"Service Agreement (Home)","value":"\/contracts\/service-contract\/?loc=IN&ldcn=home","brandExclude":null},{"label":"Service Agreement (Maintenance)","value":"\/contracts\/service-contract\/?loc=IN&ldcn=maintenance","brandExclude":null},{"label":"Service Agreement (Repair)","value":"\/contracts\/service-contract\/?loc=IN&ldcn=repair","brandExclude":null},{"label":"Service Agreement (Software\/IT)","value":"\/contracts\/computer-services-agreement\/?loc=IN&ldcn=software","brandExclude":null},{"label":"Transfer of Partnership Interest","value":"\/contracts\/transfer-of-partnership-interest\/?loc=IN","brandExclude":null},{"label":"Demand Letter","value":"\/contracts\/payment-demand-letter\/?loc=IN","brandExclude":null},{"label":"Employment Contract","value":"\/contracts\/employment-contract\/?loc=IN","brandExclude":null},{"label":"Financial Statement (Personal)","value":"\/contracts\/financial-statement\/?loc=IN","brandExclude":null},{"label":"Independent Contractor Agreement","value":"\/contracts\/independent-contractor-agreement\/?loc=IN&ldcn=contractor","brandExclude":null},{"label":"Loan Agreement","value":"\/contracts\/loan-agreement-forms\/?loc=IN","brandExclude":null},{"label":"Non-Disclosure Agreement","value":"\/contracts\/non-disclosure-agreement\/?loc=IN","brandExclude":null},{"label":"Notice of Withdrawal from Partnership","value":"\/contracts\/partnership-withdrawal\/?loc=IN","brandExclude":null},{"label":"Performance Contract","value":"\/contracts\/performance-contract\/?loc=IN","brandExclude":null},{"label":"Service Agreement (Contractor)","value":"\/contracts\/independent-contractor-agreement\/?loc=IN&ldcn=service_contractor","brandExclude":null},{"label":"Catering Contract","value":"\/contracts\/catering-service-agreement\/?loc=IN","brandExclude":null},{"label":"Release\/Waiver Agreement","value":"\/contracts\/release-
20265of-liability\/?loc=IN","brandExclude":null},{"label":"Residential Rental Application","value":"\/contracts\/rental-application-form\/?loc=IN","brandExclude":null},{"label":"Child Travel Consent","value":"\/contracts\/child-travel-consent\/?loc=IN","brandExclude":null},{"label":"Cleaning Services Agreement","value":"\/contracts\/cleaning-agreement\/?loc=IN","brandExclude":null},{"label":"Complaint Letter","value":"\/contracts\/customer-complaint-letter\/?loc=IN","brandExclude":null},{"label":"Computer Services Agreement","value":"\/contracts\/computer-services-agreement\/?loc=IN&ldcn=computer","brandExclude":null},{"label":"Confidentiality Agreement","value":"\/contracts\/confidentiality-agreement\/?loc=IN","brandExclude":null},{"label":"Amending Agreement","value":"\/contracts\/addendum\/?loc=IN","brandExclude":null},{"label":"Assignment of Partnership Interest","value":"\/contracts\/assignment-of-partnership-interest\/?loc=IN","brandExclude":null},{"label":"Bill of Sale","value":"\/contracts\/bill-of-sale\/?loc=IN","brandExclude":null}],"NZ":[{"label":"Promissory Note","value":"\/contracts\/promissory-note-forms\/?loc=NZ","brandExclude":null},{"label":"Separation \/ Divorce Papers","value":"\/family\/separation-agreement-form\/?loc=NZ&ldcn=sdp","brandExclude":null},{"label":"Separation Agreement","value":"\/family\/separation-agreement-form\/?loc=NZ","brandExclude":null},{"label":"Separation Agreement (Before Divorce)","value":"\/family\/separation-agreement-form\/?loc=NZ&ldcn=sabd","brandExclude":null},{"label":"Last Will and Testament","value":"\/contracts\/last-will-and-testament\/?loc=NZ","brandExclude":null},{"label":"Will","value":"\/contracts\/last-will-and-testament\/?loc=NZ&ldcn=will","brandExclude":null},{"label":"Child Medical Consent","value":"\/contracts\/medical-consent-form\/?loc=NZ","brandExclude":null},{"label":"Construction Contract","value":"\/contracts\/service-contract\/?loc=NZ&ldcn=construction","brandExclude":null},{"label":"Consulting Agreement","value":"\/contracts\/consulting-agreement\/?loc=NZ&ldcn=consult","brandExclude":null},{"label":"Service Agreement (General)","value":"\/contracts\/service-contract\/?loc=NZ&ldcn=main_","brandExclude":null},{"label":"Service Agreement (Home)","value":"\/contracts\/service-contract\/?loc=NZ&ldcn=home","brandExclude":null},{"label":"Service Agreement (Maintenance)","value":"\/contracts\/service-contract\/?loc=NZ&ldcn=maintenance","brandExclude":null},{"label":"Service Agreement (Repair)","value":"\/contracts\/service-contract\/?loc=NZ&ldcn=repair","brandExclude":null},{"label":"Building Contract","value":"\/contracts\/service-contract\/?loc=NZ&ldcn=building","brandExclude":null},{"label":"Service Agreement","value":"\/contracts\/service-contract\/?loc=NZ&ldcn=service","brandExclude":null},{"label":"Service Agreement (Building)","value":"\/contracts\/service-contract\/?loc=NZ&ldcn=building_service","brandExclude":null},{"label":"Service Agreement (Construction)","value":"\/contracts\/service-contract\/?loc=NZ&ldcn=construction_service","brandExclude":null},{"label":"Service Agreement (Consulting)","value":"\/contracts\/consulting-agreement\/?loc=NZ&ldcn=service_consulting","brandExclude":null},{"label":"Service Agreement (Contractor)","value":"\/contracts\/independent-contractor-agreement\/?loc=NZ&ldcn=service_contractor","brandExclude":null},{"label":"Catering Contract","value":"\/contracts\/catering-service-agreement\/?loc=NZ","brandExclude":null},{"label":"Release\/Waiver Agreement","value":"\/contracts\/release-of-liability\/?loc=NZ","brandExclude":null},{"label":"Residential Rental Application","value":"\/contracts\/rental-application-form\/?loc=NZ","brandExclude":null},{"label":"Loan Agreement","value":"\/contracts\/loan-agreement-forms\/?loc=NZ","brandExclude":null},{"label":"Non-Disclosure Agreement","value":"\/contracts\/non-disclosure-agreement\/?loc=NZ","brandExclude":null},{"label":"Notice of Withdrawal from Partnership","value":"\/contracts\/partnership-withdrawal\/?loc=NZ","brandExclude":null},{"label":"Performance Contract","value":"\/contracts\/performance-contract\/?loc=NZ","brandExclude":null}
20265,{"label":"Power of Attorney","value":"\/contracts\/power-of-attorney-form\/?loc=NZ","brandExclude":null},{"label":"Service Agreement (Software\/IT)","value":"\/contracts\/computer-services-agreement\/?loc=NZ&ldcn=software","brandExclude":null},{"label":"Talk to a Lawyer","value":"\/contracts\/talk-to-a-lawyer\/?loc=NZ","brandExclude":null},{"label":"Demand Letter","value":"\/contracts\/payment-demand-letter\/?loc=NZ","brandExclude":null},{"label":"Employment Agreement","value":"\/contracts\/employment-contract\/?loc=NZ","brandExclude":null},{"label":"Employment Contract","value":"\/contracts\/employment-contract\/?loc=NZ","brandExclude":null},{"label":"Financial Statement (Personal)","value":"\/contracts\/financial-statement\/?loc=NZ","brandExclude":null},{"label":"Independent Contractor Agreement","value":"\/contracts\/independent-contractor-agreement\/?loc=NZ&ldcn=contractor","brandExclude":null},{"label":"Cleaning Services Agreement","value":"\/contracts\/cleaning-agreement\/?loc=NZ","brandExclude":null},{"label":"Computer Services Agreement","value":"\/contracts\/computer-services-agreement\/?loc=NZ&ldcn=computer","brandExclude":null},{"label":"Confidentiality Agreement","value":"\/contracts\/confidentiality-agreement\/?loc=NZ","brandExclude":null},{"label":"Amending Agreement","value":"\/contracts\/addendum\/?loc=NZ","brandExclude":null},{"label":"Assignment of Partnership Interest","value":"\/contracts\/assignment-of-partnership-interest\/?loc=NZ","brandExclude":null},{"label":"Bill of Sale","value":"\/contracts\/bill-of-sale\/?loc=NZ","brandExclude":null}],"SG":[{"label":"Promissory Note","value":"\/contracts\/promissory-note-forms\/?loc=SG","brandExclude":null},{"label":"Last Will and Testament","value":"\/contracts\/last-will-and-testament\/?loc=SG","brandExclude":null},{"label":"Construction Contract","value":"\/contracts\/service-contract\/?loc=SG&ldcn=construction","brandExclude":null},{"label":"Consulting Agreement","value":"\/contracts\/consulting-agreement\/?loc=SG&ldcn=consult","brandExclude":null},{"label":"Building Contract","value":"\/contracts\/service-contract\/?loc=SG&ldcn=building","brandExclude":null},{"label":"Service Agreement","value":"\/contracts\/service-contract\/?loc=SG&ldcn=service","brandExclude":null},{"label":"Service Agreement (Building)","value":"\/contracts\/service-contract\/?loc=SG&ldcn=building_service","brandExclude":null},{"label":"Service Agreement (Construction)","value":"\/contracts\/service-contract\/?loc=SG&ldcn=construction_service","brandExclude":null},{"label":"Service Agreement (Consulting)","value":"\/contracts\/consulting-agreement\/?loc=SG&ldcn=service_consulting","brandExclude":null},{"label":"Service Agreement (General)","value":"\/contracts\/service-contract\/?loc=SG&ldcn=main_","brandExclude":null},{"label":"Service Agreement (Home)","value":"\/contracts\/service-contract\/?loc=SG&ldcn=home","brandExclude":null},{"label":"Service Agreement (Maintenance)","value":"\/contracts\/service-contract\/?loc=SG&ldcn=maintenance","brandExclude":null},{"label":"Service Agreement (Repair)","value":"\/contracts\/service-contract\/?loc=SG&ldcn=repair","brandExclude":null},{"label":"Service Agreement (Contractor)","value":"\/contracts\/independent-contractor-agreement\/?loc=SG&ldcn=service_contractor","brandExclude":null},{"label":"Confidentiality Agreement","value":"\/contracts\/confidentiality-agreement\/?loc=SG","brandExclude":null},{"label":"Bill of Sale","value":"\/contracts\/bill-of-sale\/?loc=SG","brandExclude":null},{"label":"Employment Contract","value":"\/contracts\/employment-contract\/?loc=SG","brandExclude":null},{"label":"Independent Contractor Agreement","value":"\/contracts\/independent-contractor-agreement\/?loc=SG&ldcn=contractor","brandExclude":null},{"label":"Loan Agreement","value":"\/contracts\/loan-agreement-forms\/?loc=SG","brandExclude":null},{"label":"Non-Disclosure Agreement","value":"\/contracts\/non-disclosure-agreement\/?loc=SG","brandExclude":null}
20265,{"label":"Power of Attorney","value":"\/contracts\/power-of-attorney-form\/?loc=SG","brandExclude":null}],"US":[{"label":"Residential Lease","value":"\/contracts\/lease-agreement-form\/?loc=US","brandExclude":null},{"label":"Promissory Note","value":"\/contracts\/promissory-note-forms\/?loc=US","brandExclude":null},{"label":"Prenuptial Agreement","value":"\/contracts\/prenup-agreement\/?loc=US","brandExclude":null},{"label":"Quitclaim Deed","value":"\/contracts\/quit-claim-deed-form\/?loc=US","brandExclude":null},{"label":"Child Medical Consent","value":"\/contracts\/medical-consent-form\/?loc=US","brandExclude":null},{"label":"Building Contract","value":"\/contracts\/service-contract\/?loc=US&ldcn=building","brandExclude":null},{"label":"Service Agreement","value":"\/contracts\/service-contract\/?loc=US&ldcn=service","brandExclude":null},{"label":"Service Agreement (Building)","value":"\/contracts\/service-contract\/?loc=US&ldcn=building_service","brandExclude":null},{"label":"Service Agreement (Construction)","value":"\/contracts\/service-contract\/?loc=US&ldcn=construction_service","brandExclude":null},{"label":"Service Agreement (Consulting)","value":"\/contracts\/consulting-agreement\/?loc=US&ldcn=service_consulting","brandExclude":null},{"label":"Service Agreement (General)","value":"\/contracts\/service-contract\/?loc=US&ldcn=main_","brandExclude":null},{"label":"Service Agreement (Home)","value":"\/contracts\/service-contract\/?loc=US&ldcn=home","brandExclude":null},{"label":"Service Agreement (Maintenance)","value":"\/contracts\/service-contract\/?loc=US&ldcn=maintenance","brandExclude":null},{"label":"Service Agreement (Repair)","value":"\/contracts\/service-contract\/?loc=US&ldcn=repair","brandExclude":null},{"label":"Construction Contract","value":"\/contracts\/service-contract\/?loc=US&ldcn=construction","brandExclude":null},{"label":"Consulting Agreement","value":"\/contracts\/consulting-agreement\/?loc=US&ldcn=consult","brandExclude":null},{"label":"Contract for Deed","value":"\/contracts\/contract-for-deed\/?loc=US&ldcn=deed","brandExclude":null},{"label":"Contract for Deed\/Land Contract","value":"\/contracts\/contract-for-deed\/?loc=US","brandExclude":null},{"label":"Land Contract","value":"\/contracts\/contract-for-deed\/?loc=US&ldcn=land","brandExclude":null},{"label":"Roommate Agreement","value":"\/contracts\/roommate-agreement\/?loc=US","brandExclude":null},{"label":"Joint Venture Agreement","value":"\/contracts\/joint-venture-agreement\/?loc=US","brandExclude":null},{"label":"Sales Agreement","value":"\/financial\/sales-agreement-form\/?loc=US&ldcn=sales","brandExclude":null},{"label":"Purchase Agreement","value":"\/financial\/purchase-agreement-form\/?loc=US&ldcn=purchase","brandExclude":null},{"label":"Purchase of Business Agreement","value":"\/contracts\/business-purchase-agreement\/?loc=US","brandExclude":null},{"label":"Purchase Order","value":"\/contracts\/purchase-order\/?loc=US","brandExclude":null},{"label":"Car Bill of Sale","value":"\/contracts\/bill-of-sale\/?loc=US&ldcn=car","brandExclude":null},{"label":"Catering Contract","value":"\/contracts\/catering-service-agreement\/?loc=US","brandExclude":null},{"label":"Cease & Desist Letter","value":"\/contracts\/cease-and-desist-letter\/?loc=US","brandExclude":null},{"label":"Certificate of Incumbency","value":"\/contracts\/certificate-of-incumbency\/?loc=US","brandExclude":null},{"label":"Certificate of Proof of Execution by a Subscribing Witness","value":"\/contracts\/proof-of-execution\/?loc=US","brandExclude":null},{"label":"Child Care Services Agreement","value":"\/contracts\/childcare-services-agreement\/?loc=US","brandExclude":null},{"label":"End User License Agreement","value":"\/contracts\/software-license-agreement\/?loc=US&ldcn=long","brandExclude":null},{"label":"End User License Agreement (EULA)","value":"\/contracts\/software-license-agreement\/?loc=US&ldcn=shortlong","brandExclude":null},{"label":"EULA","value":"\/contracts\/software-license-agreement\/?loc=US&ldcn=short","brandExclude":null},{"label":"Event Contract","value":"\/contracts\/event-contract\/?loc=US","brandExclude":null},{"label":"Eviction Notice","value":"\/contracts\/eviction-notice-landlord-forms\/?loc=US&ldcn=eviction","brandExclude":null},{"label":"Financial Statement (Personal)","value":"\/contracts\/financial-statement\/?loc=US","brandExclude":null},{"label":"Gift Deed","value":"\/contracts\/gift-deed\/?loc=US","brandExclude":null},{"label":"Health Care Directive","value":"\/contracts\/us-living-will-form\/?loc=US&ldcn=healthdir","brandExclude":null},{"label":"Hold-Harmless (Indemnity) Agreement","value":"\/contracts\/hold-harmless-agreement\/?loc=US&ldcn=long","brandExclude":null},{"label":"Incorporators' Organizational Meeting","value":"\/contracts\/incorporators-meeting\/?loc=US","brandExclude":null},{"label":"Indemnity Agreement","value":"\/contracts\/hold-harmless-agreement\/?loc=US&ldcn=indemnity","brandExclude":null},{"label":"Independent Contractor Agreement","value":"\/contracts\/independent-contractor-agreement\/?loc=US&ldcn=contractor","brandExclude":null},{"label":"Invoice Form","value":"\/contracts\/invoice-form\/?loc=US","brandExclude":null},{"label":"Corporate Bylaws","value":"\/contracts\/corporate-bylaws\/?loc=US","brandExclude":null},{"label":"Deed of Reconveyance","value":"\/contracts\/deed-of-reconveyance-form\/?loc=US","brandExclude":null},{"label":"Deed of Trust","value":"\/contracts\/deed-of-trust-form\/?loc=US","brandExclude":null},{"label":"Demand Letter","value":"\/contracts\/payment-demand-letter\/?loc=US","brandExclude":null},{"label":"Directors' Organizational Meeting","value":"\/contracts\/directors-meeting\/?loc=US","brandExclude":null},{"label":"Directors' Resolution","value":"\/contracts\/corporate-resolution-lc\/?loc=US&ldcn=resolution","brandExclude":null},{"label":"Employee Warning Letter","value":"\/contracts\/employee-warning-letter\/?loc=US","brandExclude":null},{"label":"Employment Contract","value":"\/contracts\/employment-contract\/?loc=US","brandExclude":null},{"label":"Employment Offer Letter","value":"\/contracts\/employment-offer-letter\/?loc=US","brandExclude":null},{"label":"Employment Termination Letter","value":"\/contracts\/employment-termination-letter\/?loc=US","brandExclude":null},{"label":"Landlord's Consent to Lease Assignment","value":"\/contracts\/lease-assignment-consent\/?loc=US","brandExclude":null},{"label":"Landlord's Consent to Sublease","value":"\/contracts\/sublease-consent\/?loc=US","brandExclude":null},{"label":"Last Will and Testament","value":"\/contracts\/last-will-and-testament-usa\/?loc=US","brandExclude":null},{"label":"LawDepot eSign","value":"\/contracts\/esign\/?loc=US","brandExclude":null},{"label":"Lease Application","value":"\/contracts\/rental-application-form\/?loc=US&ldcn=lease","brandExclude":null},{"label":"Lease Application (Commercial)","value":"\/contracts\/commercial-lease-rental-application\/?loc=US&ldcn=commercial","brandExclude":null},{"label":"Lease Assignment Agreement","value":"\/contracts\/lease-assignment\/?loc=US","brandExclude":null},{"label":"Lease Notice","value":"\/contracts\/eviction-notice-landlord-forms\/?loc=US","brandExclude":null},{"label":"Letter of Intent","value":"\/contracts\/letter-of-intent\/?loc=US&ldcn=letter","brandExclude":null},{"label":"Licensing Agreement","value":"\/contracts\/licensing-agreement\/?loc=US","brandExclude":null},{"label":"Living Will","value":"\/contracts\/us-living-will-form\/?loc=US&ldcn=livingwill","brandExclude":null},{"label":"LLC Articles of Organization (Texas)","value":"\/contracts\/llc-articles-of-organization\/?loc=US","brandExclude":null},{"label":"LLC Operating Agreement","value":"\/contracts\/llc-operating-agreement\/?loc=US","brandExclude":null},{"label":"Loan Agreement","value":"\/contracts\/loan-agreement-forms\/?loc=US","brandExclude":null},{"label":"Marketing Contract","value":"\/contracts\/marketing-contract\/?loc=US","brandExclude":null},{"label":"Medical Records Release","value":"\/contracts\/medical-records-release\/?loc=US","brandExclude":null},{"label":"Memorandum of Understanding","value":"\/contracts\/letter-of-intent\/?loc=US&ldcn=MOU","brandExclude":null},{"label":"Minutes of Directors' Meeting","value":"\/contracts\/corporate-resolution-lc\/?loc=US&ldcn=minutes","brandExclude":null},{"label":"Minutes of Shareholders' Meeting","value":"\/contracts\/shareholders-minutes-of-meeting\/?loc=US","brandExclude":null},{"label":"Model and Entertainment Release","value":"\/contracts\/model-release-form\/?loc=US","brandExclude":null},{"label":"Mortgage Agreement","value":"\/contracts\/mortgage-agreement\/?loc=US","brandExclude":null},{"label":"Music Recording Contract","value":"\/contracts\/music-recording-contract\/?loc=US","brandExclude":null},{"label":"Non-Disclosure Agreement","value":"\/contracts\/non-disclosure-agreement\/?loc=US","brandExclude":null},{"label":"Notice of Lease Violation","value":"\/contracts\/eviction-notice-landlord-forms\/?loc=US&ldcn=leaseviolation","brandExclude":null},{"label":"Notice of Rent Increase","value":"\/contracts\/eviction-notice-landlord-forms\/?loc=US&ldcn=rentincrease","brandExclude":null},{"label":"Notice of Termination","value":"\/contracts\/eviction-notice-landlord-forms\/?loc=US&ldcn=landlordterm","brandExclude":null},{"label":"Notice of Withdrawal from Partnership","value":"\/contracts\/partnership-withdrawal\/?loc=US","brandExclude":null},{"label":"Notice to Pay Rent or Quit","value":"\/contracts\/eviction-notice-landlord-forms\/?loc=US&ldcn=nonpayment","brandExclude":null},{"label":"Notice to Quit","value":"\/contracts\/eviction-notice-landlord-forms\/?loc=US&ldcn=quit","brandExclude":null},{"label":"Offer to Lease","value":"\/contracts\/offer-to-lease\/?loc=US","brandExclude":null},{"label":"Offer to Purchase Real Estate","value":"\/contracts\/real-estate-purchase-offer\/?loc=US","brandExclude":null},{"label":"Partnership Amendment","value":"\/contracts\/partnership-amendment\/?loc=US","brandExclude":null},{"label":"Performance Contract","value":"\/contracts\/performance-contract\/?loc=US","brandExclude":null},{"label":"Personal Property Rental Agreement","value":"\/contracts\/pers
20265onal-property-rental-agreement\/?loc=US","brandExclude":null},{"label":"Personal\/Corporate Guarantee","value":"\/contracts\/personal-guarantee-form\/?loc=US","brandExclude":null},{"label":"Pet Agreement","value":"\/contracts\/pet-agreement\/?loc=US","brandExclude":null},{"label":"Power of Attorney","value":"\/contracts\/power-of-attorney-form\/?loc=US","brandExclude":null},{"label":"Satisfaction of Mortgage","value":"\/contracts\/satisfaction-of-mortgage-form\/?loc=US","brandExclude":null},{"label":"Separation \/ Divorce Papers","value":"\/contracts\/separation-agreement\/?loc=US&ldcn=sdp","brandExclude":null},{"label":"Separation Agreement","value":"\/contracts\/separation-agreement\/?loc=US","brandExclude":null},{"label":"Separation Agreement (Before Divorce)","value":"\/contracts\/separation-agreement\/?loc=US&ldcn=sabd","brandExclude":null},{"label":"Service Agreement (Contractor)","value":"\/contracts\/independent-contractor-agreement\/?loc=US&ldcn=service_contractor","brandExclude":null},{"label":"Real Estate Purchase Agreement","value":"\/contracts\/real-estate-purchase-agreement\/?loc=US","brandExclude":null},{"label":"Release\/Waiver Agreement","value":"\/contracts\/release-of-liability\/?loc=US","brandExclude":null},{"label":"Rental Application","value":"\/contracts\/rental-application-form\/?loc=US","brandExclude":null},{"label":"Rental Inspection Report","value":"\/contracts\/rental-inspection-form\/?loc=US","brandExclude":null},{"label":"Residential Rental Application","value":"\/contracts\/rental-application-form\/?loc=US&ldcn=rentalapp","brandExclude":null},{"label":"Residential Rental Inspection Report","value":"\/contracts\/rental-inspection-form\/?loc=US&ldcn=inspectionreport","brandExclude":null},{"label":"Residential Sublease Agreement","value":"\/contracts\/sublet-agreement\/?loc=US&ldcn=ressublease","brandExclude":null},{"label":"Revocable Living Trust","value":"\/contracts\/living-trust\/?loc=US","brandExclude":null},{"label":"Revocation of Power of Attorney","value":"\/contracts\/revocation-of-power-of-attorney\/?loc=US","brandExclude":null},{"label":"Service Agreement (Software\/IT)","value":"\/contracts\/computer-services-agreement\/?loc=US&ldcn=software","brandExclude":null},{"label":"Share Purchase Agreement","value":"\/contracts\/stock-purchase-contract\/?loc=US","brandExclude":null},{"label":"Share Repurchase Agreement","value":"\/contracts\/stock-repurchase-agreement\/?loc=US","brandExclude":null},{"label":"Share Subscription","value":"\/contracts\/stock-subscription-agreement\/?loc=US","brandExclude":null},{"label":"Shareholder Agreement","value":"\/contracts\/shareholder-agreement\/?loc=US","brandExclude":null},{"label":"Shareholder Loan Agreement","value":"\/contracts\/shareholder-loan\/?loc=US","brandExclude":null},{"label":"Shareholder Proxy","value":"\/contracts\/shareholder-proxy-voting-form\/?loc=US","brandExclude":null},{"label":"Shareholder's Appointment of Representative","value":"\/contracts\/appoint-shareholder\/?loc=US","brandExclude":null},{"label":"Shareholders' Consent to Action Without Meeting","value":"\/contracts\/shareholder-consent-to-action\/?loc=US&ldcn=resolutions","brandExclude":null},{"label":"Shareholders' Organizational Meeting","value":"\/contracts\/shareholders-meeting\/?loc=US","brandExclude":null},{"label":"Stock Subscription","value":"\/contracts\/stock-subscription-agreement\/?loc=US","brandExclude":null},{"label":"Stockholder Proxy","value":"\/contracts\/shareholder-proxy-voting-form\/?loc=US","brandExclude":null},{"label":"Stockholder's Appointment of Representative","value":"\/contracts\/appoint-shareholder\/?loc=US","brandExclude":null},{"label":"Stockholders' Organizational Meeting","value":"\/contracts\/shareholders-meeting\/?loc=US","brandExclude":null},{"label":"Sublease Agreement","value":"\/contracts\/sublet-agreement\/?loc=US","brandExclude":null},{"label":"Survivorship Deed","value":"\/contracts\/survivorship-deed-forms\/?loc=US","brandExclude":null},{"label":"Talk to a Lawyer","value":"\/contracts\/talk-to-a-lawyer\/?loc=US","brandExclude":null},{"label":"Tenant Application","value":"\/contracts\/rental-application-form\/?loc=US&ldcn=tenant","brandExclude":null},{"label":"Termination Agreement","value":"\/contracts\/contract-termination-agreement\/?loc=US","brandExclude":null},{"label":"Trademark Assignment","value":"\/contracts\/trademark-assignment\/?loc=US","brandExclude":null},{"label":"Trailer Bill of Sale","value":"\/contracts\/bill-of-sale\/?loc=US&ldcn=trailer","brandExclude":null},{"label":"Vehicle Bill of Sale","value":"\/contracts\/bill-of-sale\/?loc=US&ldcn=vehicle","brandExclude":null},{"label":"Vehicle Leasing Agreement","value":"\/contracts\/vehicle-lease-agreement-form\/?loc=US","brandExclude":null},{"label":"Vendor Contract","value":"\/contracts\/vendor-contract\/?loc=US","brandExclude":null},{"label":"Warranty Deed","value":"\/contracts\/warranty-deed\/?loc=US","brandExclude":null},{"label":"Will","value":"\/contracts\/last-will-and-testament-usa\/?loc=US&ldcn=will","brandExclude":null},{"label":"Business Plan","value":"\/contracts\/business-plan\/?loc=US&ldcn=partnership-and-joint-venture","brandExclude":null},{"label":"Affidavit","value":"\/contracts\/affidavit\/?loc=US","brandExclude":null},{"label":"Amending Agreement","value":"\/contracts\/addendum\/?loc=US&ldcn=amendingagmt","brandExclude":null},{"label":"Assignment","value":"\/contracts\/legal-assignment-form\/?loc=US","brandExclude":null},{"label":"Assignment of Partnership Interest","value":"\/contracts\/assignment-of-partnership-interest\/?loc=US","brandExclude":null},{"label":"Assignment of Trade Name ","value":"\/contracts\/trade-name-transfer\/?loc=US","brandExclude":null},{"label":"Automobile Bill of Sale","value":"\/contracts\/bill-of-sale\/?loc=US&ldcn=automobile","brandExclude":null},{"label":"Band Partnership Agreement","value":"\/contracts\/band-partnership-agreement\/?loc=US","brandExclude":null},{"label":"Bill of Sale","value":"\/contracts\/bill-of-sale\/?loc=US","brandExclude":null},{"label":"Boat Bill of Sale","value":"\/contracts\/bill-of-sale\/?loc=US&ldcn=boat","brandExclude":null},{"label":"Child Travel Consent","value":"\/contracts\/child-travel-consent\/?loc=US","brandExclude":null},{"label":"Cleaning Services Agreement","value":"\/contracts\/cleaning-agreement\/?loc=US","brandExclude":null},{"label":"Codicil","value":"\/contracts\/codicil-to-will\/?loc=US","brandExclude":null},{"label":"Cohabitation Agreement","value":"\/contracts\/cohabitation-agreement\/?loc=US&ldcn=cohab","brandExclude":null},{"label":"Commercial Lease","value":"\/contracts\/commercial-lease-agreement\/?loc=US","brandExclude":null},{"label":"Commercial Lease Application","value":"\/contracts\/commercial-lease-rental-application\/?loc=US&ldcn=commercialapp","brandExclude":null},{"label":"Commercial Sublease Agreement","value":"\/contracts\/commercial-sublease-agreement\/?loc=US","brandExclude":null},{"label":"Common Law Partner Agreement","value":"\/contracts\/common-law-partner-agreement\/?loc=US&ldcn=commonlaw","brandExclude":null},{"label":"Compensation Agreement","value":"\/contracts\/compensation-agreement\/?loc=US","brandExclude":null},{"label":"Complaint Letter","value":"\/contracts\/customer-complaint-letter\/?loc=US","brandExclude":null},{"label":"Computer Services Agreement","value":"\/contracts\/computer-services-agreement\/?loc=US&ldcn=computer","brandExclude":null},{"label":"Confidentiality Agreement","value":"\/contracts\/confidentiality-agreement\/?loc=US","brandExclude":null},{"label":"Consent to Action Without Meeting","value":"\/contracts\/corporate-resolution-lc\/?loc=US&ldcn=action","brandExclude":null},{"label":"Consent to be Director and Officer","value":"\/contracts\/director-officer-consent-form\/?loc=US","brandExclude":null},{"label":"Consignment Agreement","value":"\/contracts\/consignment-agreement\/?loc=US","brandExclude":null},{"label":"Cancel Free Trial","value":"\/cancel\/signin.php?loc=US","brandExclude":null},{"label":"Cancel Subscription","value":"\/cancel\/signin.php?loc=US","brandExclude":null},{"label":"End Free Subscription","value":"\/cancel\/signin.php?loc=US","brandExclude":null},{"label":"End Free Trial","value":"\/cancel\/signin.php?loc=US","brandExclude":null}]};
20266var availableContracts;
20267
20268const caSearchTerms = {
20269    "Rental Lease Agreement": ["lease", "residential"],
20270    "Tenancy Agreement (Residential Lease Agreement)": ["agreement"],
20271    "Loan Agreement": ["loan"],
20272    "Incorporation Package (Alberta)": ["alberta"],
20273    "Incorporation Package (BC)": ["bc", "british"],
20274    "Incorporation Package (Ontario)": ["ont", "ontario"],
20275};
20276
20277/**
20278 * Adds country-specific search terms to contracts
20279 *
20280 * @param countryCode The country code to use for adding search terms.
20281 * @param availableContracts The available contracts list
20282 */
20283const addSearchTerms = (
20284    countryCode,
20285    availableContracts,
20286) => {
20287    const siteFamily = Sequiter.SiteConfig.GetConfigValue("site_family", "").toString();
20288    if (countryCode === "CA" && siteFamily === "LawDepot") {
20289        for (const contract of availableContracts) {
20290            contract.terms = caSearchTerms[contract.label] ?? [];
20291        }
20292    }
20293};
20294
20295function setAvailableContracts(){
20296   //the brand basically means an affiliate user eg brand = library if library user
20297   var brand = getCookie('brand');
20298   /*split the brand on the deliminators into an array*/
20299   var brandArray = (brand != null ? brand.split(/,|;/g) : []);
20300   var countryCode = getCountry();
20301   if(!(countryCode in allAvailableContracts)) countryCode = "US";
20302   if (typeof(allAvailableContracts[countryCode]) !== 'undefined'){
20303      availableContracts = allAvailableContracts[countryCode].filter(function (obj){ return checkBrandAvailable(obj, brandArray); });
20304      addSearchTerms(countryCode, availableContracts);
20305   }
20306}
20307//Will return true if result should show for cookie brand (brandArray), false otherwise
20308function checkBrandAvailable(item, brandArray){
20309	if (item.label === 'Talk to a Lawyer') {
20310		item.brandExclude = "library";
20311   }
20312   if (item.brandExclude != null && Array.isArray(brandArray)) {
20313      var brandExcludeArr = item.brandExclude.split(/,|;/g);
20314      return (brandArray.filter(function(value) {return brandExcludeArr.indexOf(value)>-1;}).length == 0);
20315   }
20316   return true;
20317}
20318
20319if(typeof($) == "function"){
20320	$(setAvailableContracts);
20321}
20322else{
20323   rE(window, "load", setAvailableContracts);
20324}
20325/* End Include search */
20326
20327/* Include selection-LD */
20328/*function called on click of mobile Details link*/
20329function showMobileLegalDetailsDialog() {
20330	showInlineDialog("<div id='mLegalDetDialog' autofocus>"+$('#mlegalDetails').html()+"</div>", 'Legal Guarantee', {});
20331}
20332/* End Include selection-LD */
20333
20334/* Include signin */
20335/***************************************************************************************************************
20336* Sign in Dialog
20337***************************************************************************************************************/
20338
20339function tryIsInDialog(includeFramed) {
20340	if (typeof(isInDialog) !== "function") return false;
20341	return isInDialog(includeFramed);
20342}
20343
20344function checkCookiesSignIn() {
20345	if (!cookiesEnabled()) {
20346		var cookieWarning;
20347		if (typeof (isSlate) === "function" && isSlate() && typeof (fluidLayout) !== "undefined" && fluidLayout) {
20348			cookieWarning = "<p>We have detected that you are blocking cookies from our site. Our site works best if cookies are enabled.<br><br>If possible, please do not block cookies from our site. Additional help on this topic can be found on our <a target='_blank' href='/help/'>help page</a>.</p>";
20349		}
20350		else {
20351			cookieWarning = "<h3>Please Enable Cookies</h3><p>We have detected that you are blocking cookies from our site. Our site works best if cookies are enabled.<br><br>If possible, please do not block cookies from our site. Additional help on this topic can be found on our <a target='_blank' href='/help/'>help page</a>.</p>";
20352		}
20353		alert(cookieWarning, { includeParagraph: false, title: "Please Enable Cookies" });
20354		return false;
20355	}
20356	return true;
20357}
20358
20359function showSignInDialogPrePurchase() {
20360	if (isLoggedIn()) {
20361		redirectToSelectionPage();
20362		return;
20363	}
20364	showSignInDialog({ page: "create", directLink: false, mode: "PrePurchaseDialog", callback: redirectToSelectionPage, doCallbackOnClose: true, recoveryReturnToProduct: true })
20365}
20366
20367function createSuccess() {
20368	if (isDoculaw()) {
20369		if (tryIsInDialog()) {
20370			winOrParent = parent;
20371		}
20372		winOrParent.hideMessage();
20373		winOrParent.alert("<div class='successCheck'><h1>Success!</h1><p>Your account has been created.</p></div>",
20374			{
20375				includeParagraph: false,
20376				cssClass: "signInSuccess",
20377				buttonText: "Continue",
20378				callback: signInServiceSuccess,
20379				closeOnEscape: false
20380			}
20381		);
20382
20383		return false;
20384	} else {
20385		signInServiceSuccess();
20386	}
20387}
20388
20389function tryShowCheckoutExitDialog(country, config) {
20390	if (country === "US") {
20391		const productCode = getCurrentProductCode();
20392		getExperiment("Checkout_Exit_Modal_LD_26_09", country)
20393			.then(async (result) => {
20394				if (result?.variationName === "N") {
20395					await openBaseApplicationSignInDialog(config, productCode);
20396					return;
20397				}
20398				redirectFromSignInDialog(config);
20399			})
20400			.catch((error) => {
20401				logErrorMessage(
20402					"Checkout exit modal experiment failed: " + (error?.message || error),
20403					url_escape(location.href),
20404					null,
20405					url_escape(location.href),
20406					"javascript_error.log"
20407				);
20408				redirectFromSignInDialog(config);
20409			});
20410		return true;
20411	}
20412	return false;
20413}
20414
20415var woahbarToShow = null;
20416var signInDialogLeaving = false;
20417var promptSave = true;
20418var signInDialogCallback = null;
20419function showSignInDialog(config, params) {
20420
20421	if (typeof (params) === "undefined" || params === null) params = {};
20422	if (!checkCookiesSignIn()) return;
20423
20424	/* Set default values */
20425	config = config || {};
20426	config.page = (typeof (config.page) === "undefined" || config.page === null || config.page === "") ? "signin" : config.page;
20427	config.directLink = typeof (config.directLink) === "undefined" ? true : config.directLink;
20428	config.force = typeof (config.force) === "undefined" ? true : config.force;
20429	config.url = typeof (config.url) === "undefined" ? null : config.url;
20430	config.mode = typeof (config.mode) === "undefined" ? (!config.directLink ? 'ExitDialog' : 'StandardDialog') : config.mode;
20431	config.callback = typeof (config.callback) === "undefined" ? null : config.callback;
20432	config.doCallbackOnClose = typeof (config.doCallbackOnClose) === "undefined" ? true : config.doCallbackOnClose;
20433	config.recoveryReturnToProduct = typeof (config.recoveryReturnToProduct) === "undefined" ? false : config.recoveryReturnToProduct;
20434	config.leaving = typeof (config.leaving) === "undefined" ? false : config.leaving;
20435
20436	var dialog = $("#divDialog");
20437	if (config.directLink && isLoggedIn() && !isReceiptPage()) { /* Normally we want to treat it like a successful sign in if they're already signed in. However on the receipt page we want to allow them to sign in to a different account. */
20438		signInDialogLeaving = false;
20439		signInDialogSuccess();
20440	}
20441	else if (shouldShowSignInDialog(config.directLink, config.force)) {
20442		const isCheckoutExitRequest = !config.directLink && config.page === "create" && LinkActions.isCheckoutPage();
20443		if (isCheckoutExitRequest) {
20444			const result = typeof (dbcountry) !== "undefined" && tryShowCheckoutExitDialog(dbcountry, config);
20445			if (!result) {
20446				redirectFromSignInDialog(config);
20447			}
20448			return true;
20449		}
20450        const productCode = getCurrentProductCode();
20451        const siteFamily = Sequiter.SiteConfig.GetConfigValue("site_family", "").toString();
20452		const isQuebec = getRegion() === "QC";
20453        if (!config.directLink && 
20454			siteFamily === "LawDepot" && 
20455			typeof (dbcountry) !== "undefined" && 
20456			!isReceiptPage() && 
20457			productCode
20458		) {
20459			if (
20460				(dbcountry === "CA" && !isQuebec) || 
20461				dbcountry === "GB" || 
20462				dbcountry === "AU" || 
20463				dbcountry === "NZ" || 
20464				dbcountry === "IE" || 
20465				dbcountry === "IN" || 
20466				dbcountry === "SG" || 
20467				dbcountry === "NG"
20468			) {
20469				getExperiment("SaveDocumentPopup_Redesign_English_Expansion_LD_CA_GB_AU_NZ_IE_IN_SG_NG_26_07", dbcountry)
20470					.then(async (result) => {
20471						if (result.variationName === "N") {
20472							await openBaseApplicationSignInDialog(config, productCode);
20473						} else {
20474							openLegacySignInDialog(config, dialog, productCode, params);
20475						}
20476					})
20477					.catch(() => {
20478						openLegacySignInDialog(config, dialog, productCode, params);
20479					});
20480			} else if (dbcountry === "US") {
20481				(async () => {
20482					await openBaseApplicationSignInDialog(config, productCode);
20483				})();
20484			} else {
20485				openLegacySignInDialog(config, dialog, productCode, params);
20486			}
20487        } else {
20488            openLegacySignInDialog(config, dialog, productCode, params);
20489        }
20490        return true;
20491	}
20492    return false;
20493}
20494
20495function getCurrentProductNameVariation() {
20496    const urlParams = new URLSearchParams(window.location.search);
20497    return urlParams.get("ldcn") ?? urlParams.get("name-variation");
20498}
20499
20500async function getCurrentProductName() {
20501    const nameFromVh = vh.G("questionsLayout--ProductName");
20502    if (nameFromVh) {
20503        return nameFromVh;
20504    }
20505
20506    const nameFromHtml = document.querySelector('.productName')?.innerHTML;
20507    if (nameFromHtml) {
20508        return nameFromHtml;
20509    }
20510
20511    const productCode = getCurrentProductCode();
20512    const nameVariation = getCurrentProductNameVariation();
20513
20514    let url = `/api/contracts/product/v2/name?ProductCode=${productCode}&CountryCode=${dbcountry}`;
20515    if (nameVariation) {
20516        url = `${url}&NameVariation=${nameVariation}`;
20517    }
20518
20519    return await fetch(url, {
20520        method: 'GET',
20521        headers: {
20522            'Accept': 'application/json',
20523            'Content-Type': 'application/json',
20524        },
20525    }).then(async (response) => {
20526        return response?.json()
20527            .then((data) => {
20528                if (data?.succeeded) {
20529                    return data.result.name;
20530                } else {
20531                    return undefined;
20532                }
20533            });
20534    });
20535}
20536
20537function redirectFromSignInDialog(config) {
20538	if (config.url) {
20539		if (document.location !== config.url) {
20540			document.location = config.url;
20541		} else {
20542			history.go(0);
20543		}
20544	} else if (config.callback && config.doCallbackOnClose) {
20545		signInDialogCallback = config.callback;
20546		doSignInDialogCallback();
20547	} else {
20548		window.open(config.url, "_self");
20549	}
20550}
20551
20552async function openBaseApplicationSignInDialog(config, productCode) {
20553    const productName = await getCurrentProductName() ?? "Document";
20554
20555    subscribeToEvent("@ado/base-application.show-sign-in-dialog", ({showSignInDialog}) => {
20556        if (!showSignInDialog) {
20557			redirectFromSignInDialog(config);
20558        }
20559    });
20560
20561    window.dispatchEvent(
20562        new CustomEvent("@ado/base-application.open-sign-in-dialog", {
20563            detail: {
20564                dialogType: "Create",
20565                productInfo: {productCode, productName},
20566                signInCompletionHandler: (userAuthInfo) => {
20567                    window.SID = userAuthInfo.secureID;
20568                    window.UID = userAuthInfo.username;
20569                }
20570            }
20571        }),
20572    );
20573}
20574
20575function openLegacySignInDialog(config, dialog, productCode, params) {
20576    if (config.url) {
20577        dialog.data("SignInNav", function () {
20578            promptSave = false;
20579            if (document.location !== config.url) {
20580                document.location = config.url;
20581            } else {
20582                history.go(0);
20583            }
20584        });
20585        dialog.on('dialogclose.Nav', dialog.data("SignInNav"));
20586        signInDialogLeaving = true;
20587    } else {
20588        signInDialogLeaving = config.leaving;
20589    }
20590    var path = window.location.pathname;
20591    var lastSlash = path.lastIndexOf('/');
20592    path = path.substring(0, lastSlash + 1) + window.location.search;
20593    var secure = window.location.protocol === "https:";
20594    if (config.callback) {
20595        signInDialogCallback = config.callback;
20596        if (config.doCallbackOnClose)
20597            dialog.on('dialogclose.SignInDialogCallback', doSignInDialogCallback);
20598    }
20599    if (productCode) {
20600        productCode = "&code=" + productCode;
20601    } else {
20602        productCode = "";
20603    }
20604    var tempAcc = "";
20605    if (params.tempSID) tempAcc = "&tempSID=" + params.tempSID;
20606    var dialogWidth = isDoculaw() ? 500 : 460;
20607    showDialog(getSignInDialogTitle(config.page), "https://" + location.hostname + "/SignIn/dialog.aspx?page=" + config.page + "&mode=" + config.mode + productCode + "&url=" + encodeURIComponent(path) + "&direct=" + config.directLink + "&parentSecure=" + secure + tempAcc + "&recoveryReturnToProduct=" + config.recoveryReturnToProduct, dialogWidth, 300, "signInDialog", 0.7);
20608    $("body").addClass("signInOpen");
20609    dialog.on('dialogclose', signInClose);
20610}
20611
20612function subscribeToEvent(
20613    eventType,
20614    eventHandler
20615) {
20616    const handler = (event) => {
20617        eventHandler(event.detail);
20618    };
20619
20620    window.addEventListener(eventType, handler);
20621
20622    return {
20623        unsubscribe: () => {
20624            window.removeEventListener(eventType, handler);
20625        },
20626    };
20627}
20628
20629function getSignInDialogTitle(page) {
20630	if (typeof (page) !== "undefined" && page !== null) {
20631		switch (page.toLowerCase()) {
20632			case "create":
20633				return "Create Account";
20634			case "forgot":
20635				return "Password Reset";
20636		}
20637	}
20638	return "Sign In";
20639}
20640function signInClose() {
20641	$("body").removeClass("signInOpen");
20642	$('#divDialog').off('dialogclose', signInClose);
20643}
20644function doSignInDialogCallback() {
20645	if (typeof (signInDialogCallback) === "function") {
20646		if (dialogsUseHistory()) afterDialogClose = signInDialogCallback;
20647		else signInDialogCallback();
20648	}
20649	$('#divDialog').off('dialogclose.SignInDialogCallback', doSignInDialogCallback);
20650	signInDialogCallback = null;
20651}
20652function isReceiptPage() {
20653	return window.location.href.indexOf('/contracts/receipt/') >= 0;
20654}
20655function isLoggedIn() {
20656	return typeof (window.UID) !== 'undefined' && window.UID !== null && window.UID !== '';
20657}
20658
20659/**
20660 * Determines if the sign in dialog is allowed to show in this particular instance.
20661 * @param directLink
20662 * @param {boolean} force if the dialog should show even if it has been seen before (deprecated, no longer has any effected)
20663 * @return {boolean|*|boolean} true if the dialog is allowed to show, false otherwise
20664 */
20665function shouldShowSignInDialog(directLink, force) {
20666	var secureID = window.SID;
20667
20668    // if contract page with no changes, don't show sign in dialog
20669    if (!directLink && !isLoggedIn() && LinkActions.isContractPage()) {
20670        const hasSavedAnswer = typeof(vh) != "undefined" && vh.G("__HasSavedAnswersSpecific");
20671        const hasModification = typeof (isModified) === "function" && isModified();
20672        if (!(hasSavedAnswer || hasModification)) {
20673            return false;
20674        }
20675    }
20676
20677	/*  Check this in case of multipage or the preview page. */
20678	var hasSavedInfo = false;
20679	if (typeof (vh) !== "undefined" && typeof (vh.G("__HasSavedAnswers")) === "boolean") {
20680		hasSavedInfo = vh.G("__HasSavedAnswers");
20681	}
20682	else {
20683		hasSavedInfo = secureID !== null && secureID !== '';
20684	}
20685
20686	/* Checkout exit intent prompt */
20687	if (!directLink && !isLoggedIn() && LinkActions.isCheckoutPage()) {
20688		return true;
20689	}
20690
20691	return ((!isLoggedIn() || isReceiptPage()) && (directLink || (typeof (checkSave) === "function" && checkSave() && promptSave && (hasSavedInfo || typeof (isModified) !== "function" || isModified()))) && (force || getCookie('seenSignIn') !== 'true'));
20692}
20693var beforeUnloadFunctions = new Array;
20694function addBeforeUnloadFunction(func) {
20695	beforeUnloadFunctions.push(func);
20696}
20697var suppressBeforeUnload = false;
20698function beforeUnloadFunction() {
20699	if (!suppressBeforeUnload) {
20700		var retVal = showSignInDialogUnload();
20701		if (!retVal) {
20702			for (var i = 0; i < beforeUnloadFunctions.length; ++i) {
20703				beforeUnloadFunctions[i]();
20704			}
20705		}
20706		return retVal;
20707	}
20708}
20709function showSignInDialogUnload() {
20710	if (typeof (saveData) === "function") {
20711		saveData();
20712	}
20713	var allowPreview = (window.location.pathname.indexOf("preview.aspx") >= 0 || window.location.pathname.indexOf("preview.php") >= 0) && (typeof (yudoxShowSignInOnUnload) === "undefined" || yudoxShowSignInOnUnload) && window.SID;
20714	var allowQuestionsPage = window.location.pathname.indexOf("preview.aspx") < 0 && window.location.pathname.indexOf("preview.p
20714hp") < 0 && (typeof (yudoxShowSignInOnUnload) !== "undefined" && yudoxShowSignInOnUnload);
20715	if (!invalidSecureIDCookieSet() && (allowPreview || allowQuestionsPage) && !WebuserDataInfo.shared && shouldShowSignInDialog(false, true)) {
20716		var func = function () { showSignInDialog({ page: "create", directLink: false }); }
20717		if (typeof (cssua) != "undefined" && cssua.ua.webkit) {
20718			setTimeout(func, 1);
20719		}
20720		else {
20721			func();
20722		}
20723		return "You haven't saved your data yet!\r\nCreate a free account to save your data before you go. It only takes a minute and you will be able to return and finish your document when you have time.";
20724	}
20725
20726}
20727/*If the user was signed in and is now signed out, show the sign in dialog.
20728	Returns true if the dialog gets shown, false otherwise.*/
20729function showSignInDialogOnSignOut() {
20730	return new Promise(function (resolve, reject) {
20731		if ($(".splitGroupsClient").length == 0) {
20732			AjaxWait(true, false);
20733		}
20734		GetCurrentUserInfo()
20735			.then(function (userInfo) {
20736				var cookieUID = userInfo ? userInfo.Username : "";
20737				var cookieSID = userInfo ? userInfo.SecureID : "";
20738
20739				var text = "You have been signed out. To continue your session, sign in.";
20740				var showDialog = (typeof (ajaxError) == "undefined" || !ajaxError) && isBannerSignedIn() && (!cookieUID || (window.SID && window.SID != cookieSID && window.UID)) && (getGAPageName() == getCurrentProductCode() + " Index" || getGAPageName() == getCurrentProductCode() + " Preview");
20741				/* Try to only show the confirm dialog once, even if this function gets called multiple times */
20742				if (showDialog && $("body :contains('" + text + "')").length == 0) {
20743					// Right now, not all PHP pages use GetHeaderContent, where pageResponseData is declared. Once they are fixed, we will no longer need this check
20744					if (typeof pageResponseData === 'object') {
20745						delete pageResponseData.cookies[invalidSecureIDCookieName];
20746					}
20747					var tempSID = window.SID;
20748					setWindowVariables({});
20749					hideMessage();
20750					confirmDialog(text, { title: "Signed Out", yesText: "Sign In", noText: "Don\'t Sign In", callback: function (val) { showSignInDialogOnSignOutCallback(val, tempSID); } });
20751				}
20752				return showDialog;
20753			}, function () {
20754				hideMessage();
20755			})
20756			.then(resolve, reject);
20757	});
20758}
20759
20760function showSignInDialogOnSignOutCallback(value, tempSID) {
20761	if (value) {
20762		showSignInDialog(
20763			{
20764				mode: "SignedOutDialog",
20765				directLink: false,
20766				callback: function () {
20767					/* If there's nothing in the UID cookie they didn't sign in. It will show the same prompt as before asking them to choose to sign in or not so we just don't do anything here. */
20768					if (isLoggedIn()) {
20769						alert("You have been signed in, please review your answers to make sure your work has been saved.",
20770							{
20771								title: "Signed In",
20772								callback: function () { signInDialogReload(true); }
20773							});
20774						}
20775					if (isBannerSignedIn()) {
20776						location.reload();
20777					}
20778				}
20779			},
20780			{ tempSID: tempSID }
20781		);
20782
20783	}
20784	else {
20785		location.href = '/';
20786	}
20787}
20788
20789function isBannerSignedIn() {
20790	return document.getElementById("bannerxml_isSignedIn") ||
20791		document.querySelector(".header-signed-in") ? true : false;
20792}
20793if (typeof ($) === "function") {
20794	$(initializeSignInDialog);
20795}
20796else {
20797	rE(window, "load", initializeSignInDialog);
20798}
20799
20800function isEDErrorPage() {
20801	return $('form').hasClass("EstateDashboardErrorPage");
20802}
20803function isSignInPage() {
20804	var pathLower = location.pathname.toLowerCase();
20805	return pathLower.indexOf("/signin/") === 0
20806}
20807
20808const VueWebsitePolicyAnchorTagDetector = function() {
20809	const POLICY_ROOT_TAG_CLASS_LIST = ["disclaimer", "disclaimer-container", "base-policy-dialog"];
20810	const POLICY_OPEN_DIALOG_BUTTON_CLASS = "open-dialog-button";
20811
20812	const doesWebsitePolicyRootTagExists = function(childTag) {
20813		let parentTag = childTag.parentElement;
20814		while (parentTag) {
20815			for (let i = 0; i < POLICY_ROOT_TAG_CLASS_LIST.length; i++) {
20816				if (parentTag.classList.contains(POLICY_ROOT_TAG_CLASS_LIST[i])) return true;
20817			}
20818
20819			parentTag = parentTag.parentElement;
20820		}
20821
20822		return false;
20823	};
20824
20825	const isWebsitePolicyAnchorTag = function(anchorTag) {
20826		const isPotentialPolicyAnchorTag = anchorTag.classList.contains(POLICY_OPEN_DIALOG_BUTTON_CLASS);
20827		return isPotentialPolicyAnchorTag && doesWebsitePolicyRootTagExists(anchorTag);
20828	};
20829
20830	return {
20831		isWebsitePolicyAnchorTag,
20832	}
20833}();
20834
20835var signInDialogInitialized = false;
20836function initializeSignInDialog() {
20837	if (typeof ($) === 'function' && !signInDialogInitialized) {
20838		if (isDoculaw()) {
20839			$(".signInForm .afterForm").prepend($(".signInForm .afterForm p.subMessage"));
20840		}
20841
20842		signInDialogInitialized = true;
20843		if ((!isSignInPage() && location.href.indexOf("AccountDeleted.php") < 0)) {
20844			var links = $('a' + ((!cssua.ua.ie && !cssua.ua.edge && !cssua.ua.firefox) ? ':not([href^="tel:"])' : '')); /* IE, Edge and Firefox trigger the unload event for tel: links where other browsers don't. We'll use this to set a flag before following the link to prevent the typical unload from happening since it never actually leaves the page */
20845			links = links.filter(function(_, link) { return !VueWebsitePolicyAnchorTagDetector.isWebsitePolicyAnchorTag(link); });
20846			// filter out sign in link from the self-contained-banner
20847			const selfContainedBannerSignInClasses = ["sign-in-link", "account-link", "category-nav-link"];
20848			links = links.filter(function(_, link) {
20849				for (let i = 0; i < selfContainedBannerSignInClasses.length; i++) {
20850					return !$(link).hasClass(selfContainedBannerSignInClasses[i]);
20851				}
20852				return true;
20853			});
20854			links.on("click", signInClick);
20855			for (var i = 0; i < links.length; ++i) {
20856				if (links[i].onclick !== null && typeof (links[i]._oldclick) === "undefined") {
20857					links[i]._oldclick = links[i].onclick;
20858					links[i].onclick = null;
20859				}
20860				if (links[i].href.indexOf("javascript:") === 0 && typeof (links[i]._oldhref) === "undefined") {
20861					links[i]._oldhref = links[i].href.substring(11);
20862				}
20863			}
20864
20865			var forms = $('form');
20866			forms.on("submit", formSubmit);
20867			for (i = 0; i < forms.length; ++i) {
20868				if (forms[i].onsubmit !== null && typeof (forms[i]._oldonsubmit) === "undefined") {
20869					forms[i]._oldonsubmit = forms[i].onsubmit;
20870					forms[i].onsubmit = null;
20871				}
20872				if (typeof (forms[i].submit) === "function" && typeof (forms[i]._oldsubmit) === "undefined") {
20873					forms[i]._oldsubmit = forms[i].submit;
20874					forms[i].submit = formSubmitTrigger;
20875				}
20876			}
20877
20878			$(window).on('beforeunload');
20879			$(window).on('beforeunload', beforeUnloadFunction);
20880			/*  Don't want to trigger the dialog if they're going to the order page. */
20881			if (typeof (submitTheInfo) === "function" && typeof (window._oldsubmitTheInfo) === "undefined") {
20882				window._oldsubmitTheInfo = submitTheInfo;
20883				submitTheInfo = function () { setSave(false); return window._oldsubmitTheInfo(); };
20884			}
20885			if (typeof (submittingfunc) === "function" && typeof (window._oldsubmittingfunc) === "undefined") {
20886				window._oldsubmittingfunc = submittingfunc;
20887				submittingfunc = function () { showMessage("Loading"); setSave(false); window._oldsubmittingfunc(); };
20888			}
20889			/*  Handling the new button on the preview page. */
20890			if (typeof (__doPostBack) === "function" && typeof (window._OldDoPostBack) === "undefined") {
20891				window._OldDoPostBack = __doPostBack;
20892				__doPostBack = function (eventTarget, eventArgument) { if (eventArgument === "new") setSave(false); window._OldDoPostBack(eventTarget, eventArgument); };
20893			}
20894
20895			if (typeof (postTo) === "function" && typeof (window._OldPostTo) === "undefined") {
20896				window._OldPostTo = postTo;
20897				postTo = function (url) { if (isNonSaveURL(url)) { setSave(false); } window._OldPostTo.apply(this, arguments); };
20898			}
20899		}
20900	}
20901}
20902function signInClick(e) {
20903	if (typeof (this._oldclick) === "function" && this._oldclick.call(this, e) === false) {
20904		e.preventDefault();
20905	}
20906	else if (typeof (this._oldhref) !== "undefined") {
20907		eval(this._oldhref);
20908		e.preventDefault();
20909	}
20910	else if (this.href.indexOf("tel:") === 0) {
20911		suppressBeforeUnload = true;
20912		window.location.href = this.href;
20913		e.preventDefault();
20914		setTimeout(function () { suppressBeforeUnload = false; }, 100);
20915	}
20916	else if (!isBackgroundSaveURL(this.href)) {
20917		if (/(signin\.php)|(\/signin\/)/i.test(this.href)) {
20918			e.preventDefault();
20919			var param = {};
20920			if (isDoculaw()) {
20921				var page = this.href.indexOf("?page=create") !== -1 ? "create" : null;
20922				param = { page: page };
20923			}
20924
20925			showSignInDialog(param);
20926		}
20927		else if (isNonSaveURL(this.href)) {
20928			if (!isNonNavigationURL(this.href)) {
20929				setSave(false);
20930			}
20931		}
20932		else if (!isNonNavigationURL(this.href) && (getGAPageName() === getCurrentProductCode() + " Index" || getGAPageName() === getCurrentProductCode() + " Preview") && this.target === "" && !WebuserDataInfo.shared && showSignInDialog({ page: "create", directLink: false, url: this.href })) {
20933			e.preventDefault();
20934		}
20935	}
20936	else {
20937		if (typeof (saveData) === "function") {
20938			saveData();
20939		}
20940		setSave(false);
20941	}
20942}
20943function formSubmitTrigger() {
20944	if (!this.submitting) {
20945		this.submitting = true;
20946		$(this).trigger("submit");
20947		this._oldsubmit();
20948		this.submitting = false;
20949	}
20950}
20951function formSubmit(e) {
20952	if (typeof (this._oldonsubmit) === "function" && this._oldonsubmit.call(this, e) === false) {
20953		e.preventDefault();
20954	}
20955	else if (isNonSaveURL(this.action) || isNonNavigationURL(this.action)) {
20956		setSave(false);
20957	}
20958}
20959
20960function isBackgroundSaveURL(url) {
20961	return isDoculaw() ? false : /((signin\.php)|(\/signin\/))\?\S*?[&]?(forgot|create)/i.test(url);
20962}
20963
20964function isNonSaveURL(url) {
20965	var path = window.location.pathname;
20966	var lastSlash = path.lastIndexOf('/');
20967	path = window.location.protocol + "//" + window.location.hostname + path.substring(0, lastSlash + 1);
20968	var urlLower = url.toLowerCase();
20969	var destCountry = getQueryStringValue("loc", true, url);
20970	if (typeof (dbcountry) !== "undefined" && typeof (destCountry) !== "undefined" && destCountry !== dbcountry) return false;
20971	return urlLower.indexOf("order") >= 0 || urlLower.indexOf("payall") >= 0 || url.indexOf("./") === 0 || url.indexOf("index") === 0 || url.indexOf("preview") === 0 ||
20972		url.indexOf(path + "index") === 0 || url.indexOf(path + "preview") === 0
20973		|| url.indexOf(path + "?") === 0 || url === path;
20974}
20975function isNonNavigationURL(url) {
20976	var currentURL = window.location.href;
20977	return !url || url === "" || url === currentURL ||
20978		url.indexOf("javascript:") === 0 ||
20979		url.indexOf("#") === 0 || url.indexOf(currentURL.replace(window.location.hash, '') + "#") === 0
20980}
20981
20982function signInDialogSuccess(message) {
20983	if (!signInDialogLeaving) {
20984		if (dialogsUseHistory()) { /* afterDialogClose relies on the history api, which doesn't work in IE 9, however the race condition this is addressing also doesn't seem to occur there so don't do this for IE 9 */
20985			afterDialogClose = signInDialogReload;
20986		}
20987		else {
20988			signInDialogReload();
20989		}
20990	}
20991	if (message) {
20992		var dialog = $("#divDialog");
20993		dialog.off('dialogclose.Nav');
20994		dialog.off('dialogclose.SignInDialogCallback', doSignInDialogCallback);;
20995		var showAlert;
20996
20997		showAlert = function () {
20998			alert(message, {
20999				includeParagraph: false,
21000				cssClass: (typeof (isDoculaw) === "function" && isDoculaw() ? "signInSuccess" : null),
21001				callback: function () {
21002					if (typeof (signInDialogCallback) === "function") signInDialogCallback();
21003					if (typeof (dialog.data("SignInNav")) === "function") dialog.data("SignInNav")();
21004				}
21005			});
21006		};
21007
21008		var useHistory = dialogsUseHistory();
21009		if (useHistory) afterDialogClose = showAlert;
21010		closeDialog();
21011		if (!useHistory) showAlert();
21012	}
21013}
21014
21015function signInDialogReload(goToFirstGroup) {
21016	if (typeof (goToFirstGroup) === "undefined") goToFirstGroup = false;
21017	setSave(false);
21018	if (typeof (showMessage) === "function") {
21019		showMessage("Loading" + "...");
21020	}
21021	if (goToFirstGroup) {
21022		var newHref = location.href;
21023		var hashLocation = newHref.indexOf("#");
21024		if (hashLocation >= 0) newHref = newHref.substring(0, hashLocation);
21025		newHref = updateQueryStringParameter(newHref, "s", null);
21026		newHref = updateQueryStringParameter(newHref, "g", null);
21027		location.href = newHref;
21028	}
21029	else {
21030		var onPaymentPage = (document.location.href).includes('PAYALL_slate');
21031		// For Payment_-_Existing_User_Sign_In_LD-US_19-07 experiment
21032		if (onPaymentPage) {
21033			var form = document.getElementById('aspnetForm');
21034			if(navigator.userAgent.includes("Firefox") && form){
21035				// Fix for fireFox Redirecting to SelectionPage after reload
21036                form.submit();
21037			}
21038			else
21039				window.location.reload();
21040		}
21041		else {
21042			if (document.location.hash) document.location.reload();
21043			else document.location = document.location;
21044		}
21045	}
21046}
21047/***************************************************************************************************************
21048 * End Sign in Dialog
21049 ***************************************************************************************************************/
21050
21051/* Sign In */
21052function signInAnalyticsSend(signInSource) {
21053	if (typeof ga !== 'undefined') {
21054		var gaPageName = getGAPageName();
21055		if (!gaPageName) {
21056			gaPageName = location.pathname;
21057		}
21058		setGACustomVars();
21059		ga('send', 'event', 'Sign in', 'Signed In', signInSource);
21060	}
21061}
21062var signInServiceInfo = {
21063	signIn: { message: "Signing In", routeName:"v1/session/", serviceFunc: "SignIn", success: null, successDefault: signInServiceSuccess, error: "sign you in", analyticsName: "Normal Sign In" },
21064	signInSecure: { message: "Signing In", routeName:"v1/session/",serviceFunc: "SecureSignIn", success: null, successDefault: signInServiceSuccess, error: "sign you in" },
21065	create: { message: "Creating Account", routeName:"v1/account/",serviceFunc: "CreateAccount", success: null, successDefault: createSuccess, error: "create your account" },
21066	forgot: { message: "Sending Recovery Email",routeName:"v1/password-recovery/", serviceFunc: "RecoverPassword", success: null, successDefault: forgotSuccess, error: "reset your password" },
21067	reset: { message: "Setting Password",routeName:"v1/reset-password/", serviceFunc: "ResetPassword", success: null, successDefault: resetPasswordSuccess, error: "set your password" },
21068	recover: { message: "Recovering Account", routeName:"v1/reset-password/",serviceFunc: "ResetPassword", success: null, successDefault: recoverAccountSuccess, error: "recover your account" },
21069	signOut: { message: "Signing Out", routeName:"v1/session/",serviceFunc: "SignOut", success: null, successDefault: signInServiceSuccessHome, error: "sign you out" },
21070	setAccount: { message: "Creating Account", routeName:"v1/account/",serviceFunc: "SetAccount", success: null, successDefault: signInServiceSuccess, error: "create your account" },
21071	InProgress: 0,
21072	TimeoutFunc: null,
21073	CurrentSuccessFunc: null
21074}
21075var signInMode;
21076var defaultSignInMode;
21077function ensureDefaultSignInMode() {
21078	if (!defaultSignInMode) defaultSignInMode = getSignInMode();
21079}
21080if (typeof ($) === "function") {
21081	$(ensureDefaultSignInMode);
21082}
21083else {
21084	rE(window, "load", ensureDefaultSignInMode);
21085}
21086function signInSubmit(event, sender) {
21087	if (getKeyCode(event) === 13) {
21088		/* Trigger a click of the visible button */
21089		$(sender).find(".largeActiveButton:visible").trigger("click");
21090	}
21091}
21092function toggleSignIn(mode) {
21093	setSignInMode(mode);
21094	/* Only add history entries if this is not in a dialog */
21095	if (!tryIsInDialog()) {
21096		var qString = null;
21097		/* Only set the query string if this is on the actual sign in page */
21098		const path = location.pathname.toLowerCase();
21099		const isSignInPath = /^\/([a-z]{2}\/)?signin\//.test(path);
21100		if (isSignInPath) qString = updateQueryStringParameter(location.search, "page", mode.toLowerCase());
21101		var currentState = getCurrentState();
21102		if (currentState && currentState.BannerNavOpen) {
21103			pushState({ SignInMode: mode, BannerNavOpen: false }, getSignInModeName(mode), qString, currentState.BannerNavOpen);
21104			swapBannerNav(false);
21105		}
21106		else {
21107			pushState({ SignInMode: mode }, getSignInModeName(mode), qString);
21108		}
21109	}
21110	if (fullMobileSupport()) {
21111		window.location.hash = '#content';
21112	}
21113}
21114function getSignInModeName(mode) {
21115	switch (mode.toLowerCase()) {
21116		case "signin":
21117			return "Sign In";
21118		case "forgot":
21119			return "Forgot Password";
21120		case "create":
21121			return "Create Account";
21122	}
21123	return "Sign In";
21124}
21125function capitalizeSignInMode(mode) {
21126	/* This is only necessary for the CSS classes to match properly, the mode should otherwise not be case sensitive */
21127	switch (mode) {
21128		case "signin":
21129			return "SignIn";
21130		case "forgot":
21131			return "Forgot";
21132		case "create":
21133			return "Create";
21134	}
21135	return mode;
21136}
21137function setSignInMode(mode) {
21138	var form = $('.signInForm');
21139	if (mode) {
21140		mode = mode.toLowerCase();
21141	}
21142	/* Default to sign in if no mode is actually provided */
21143	else {
21144		mode = getDefaultSignInMode();
21145	}
21146	if (form.length > 0 && mode !== getSignInMode().toLowerCase()) {
21147		$('.signInForm,form').removeClass("showSignIn").removeClass("showCreate").removeClass("showForgot").addClass("show" + capitalizeSignInMode(mode));
21148		$('.signInForm .err').text("");
21149		$('.signInForm .err').parent().removeClass("valid").removeClass("error");
21150		$('.signInHeader').hide();
21151		signInMode = mode;
21152		clearPassword();
21153		if (typeof (signInPageNames) !== "undefined" && typeof (signInPageNames[mode]) !== "undefined")
21154			setGAPageName(signInPageNames[mode]);
21155		resizeParent();
21156		setDialogTitleParent(getSignInDialogTitle(mode));
21157	}
21158	if (mode === "signin") {
21159		$('.signInHeader').show();
21160	}
21161}
21162function clearPassword() {
21163	doSignInValidation = false;
21164	$('.signInForm .password input, .signInForm .passwordConfirm input').val('').trigger('change');
21165	doSignInValidation = true;
21166}
21167function getDefaultSignInMode() {
21168	ensureDefaultSignInMode();
21169	return defaultSignInMode;
21170}
21171function getSignInMode() {
21172	if (typeof (signInMode) === "undefined") {
21173		var form = $('.signInForm');
21174		if (form.length > 0) {
21175			var cssClass = form.attr('class');
21176			if (cssClass) {
21177				var pos = cssClass.indexOf('show');
21178				if (pos >= 0) {
21179					var end = cssClass.indexOf(' ', pos);
21180					if (end < 0) end = cssClass.length;
21181					signInMode = cssClass.substring(pos + 4, end).toLowerCase();
21182				}
21183			}
21184		}
21185	}
21186	return signInMode;
21187}
21188function showSignInError(jQueryObj, errorMessage) {
21189	jQueryObj.stop(true, true);
21190	jQueryObj.text(errorMessage);
21191	if (isDoculaw()) {
21192		jQueryObj.parent().removeClass("valid").addClass("error");
21193	}
21194	jQueryObj.addClass("errorInput");
21195	jQueryObj.stop(true, true);
21196	jQueryObj.show();
21197	if (typeof (resizeParent) === "function") resizeParent();
21198}
21199function hideSignInError(jQueryObj) {
21200	jQueryObj.fadeOut(100, function () {
21201		if (isDoculaw()) {
21202			jQueryObj.parent().removeClass("error");
21203		}
21204		jQueryObj.text("").removeClass("errorInput").addClass("validInput"); resizeParent();
21205
21206	});
21207}
21208var doSignInValidation = true;
21209function validateSignInUsername(formID, focus) {
21210	if (!doSignInValidation) return true;
21211	if (typeof (focus) === "undefined") focus = false;
21212	var errorDisplay = $("#" + formID + " .username .err");
21213	var mode = getSignInMode();
21214	var input = $("#" + formID + " .username input").filter(":visible");
21215	if (input.length > 0) {
21216		var value = input.val().trim();
21217		/* Chrome's handling of spaces in email inputs makes this necessary to actually trim them out. */
21218		input.val("");
21219		input.val("NOTEMPTY");
21220		input.val(value);
21221		if (mode === "create" || mode === "forgot" || mode === "signin") {
21222			if (value.length >= 320) {
21223				showSignInError(errorDisplay, emailTooLongText );
21224				if (focus) input.trigger("focus");
21225				return false;
21226			}
21227			else if (typeof (checkEmail) === "function" && !checkEmail(value)) {
21228				showSignInError(errorDisplay, invalidEmailText);
21229				if (focus) input.trigger("focus");
21230				return false;
21231			}
21232		}
21233	}
21234	hideSignInError(errorDisplay);
21235	return true;
21236}
21237function validatePassword(password) {
21238	return /^.{6,30}$/.test(password)
21239}
21240function validatePasswordSignIn(password) { /* When validating a password being used to sign in instead of for creation we want to be slightly more lenient in case a password has been created with different restrictions in the past */
21241	return /^.{0,30}$/.test(password)
21242}
21243function validateSignInPassword(formID, focus) {
21244	if (!doSignInValidation) return true;
21245	if (typeof (focus) === "undefined") focus = false;
21246	var errorDisplay = $("#" + formID + " .password .err");
21247	var mode = getSignInMode().toLowerCase();
21248	var validatePassFunc = validatePasswordSignIn;
21249
21250	if (isDoculaw() && event.target.id.endsWith("cPassword")) {
21251		var divPassword = errorDisplay.parent(".password");
21252		var divPasswordConfirm = divPassword.next(".passwordConfirm");
21253		divPassword.removeClass("valid");
21254		divPasswordConfirm.removeClass("valid");
21255		divPasswordConfirm.find(".err").text("");
21256	}
21257
21258	if (mode === "create" || mode === "password" || mode === "recovery") validatePassFunc = validatePassword;
21259	var input = $("#" + formID + " .password input");
21260	var value = input.val();
21261	if (!validatePassFunc(value)) {
21262		showSignInError(errorDisplay, yourPasswordMustBeText);
21263		if (focus) input.trigger("focus");
21264		return false;
21265	}
21266	hideSignInError(errorDisplay);
21267	return true;
21268}
21269function validateSignInPasswordConfirm(formID, focus) {
21270	if (!doSignInValidation) return true;
21271	if (typeof (focus) === "undefined") focus = false;
21272	var errorDisplay = $("#" + formID + " .passwordConfirm").filter(":visible");
21273	if (errorDisplay.length > 0) {
21274
21275		if (isDoculaw() && event.target.id.endsWith("cPasswordConfirm")) {
21276			errorDisplay.prev(".password").removeClass("valid");
21277			errorDisplay.removeClass("valid");
21278		}
21279
21280		errorDisplay = errorDisplay.find(".err");
21281		var input = $("#" + formID + " .passwordConfirm input");
21282		var confirmVal = input.val();
21283		var passVal = $("#" + formID + " .password input").val();
21284		if (validatePassword(passVal) && confirmVal !== passVal) {
21285			showSignInError(errorDisplay, passwordMismatchText);
21286			if (focus) input.trigger("focus");
21287			return false;
21288		} else {
21289
21290			if (isDoculaw() && confirmVal === passVal) {
21291				var divPasswordConfirm = errorDisplay.parent("div.passwordConfirm");
21292				var divPassword = divPasswordConfirm.prev(".password");
21293				if (divPassword.find(".err").text().length === 0 && passVal.length > 0) {
21294					divPasswordConfirm.removeClass("error").addClass("valid");
21295					divPassword.removeClass("error").addClass("valid");
21296					errorDisplay.text("Passwords Match!").removeClass("errorInput").addClass("validInput").show();
21297					resizeParent();
21298					return true;
21299				}
21300			}
21301		}
21302	}
21303
21304	if (!isDoculaw())
21305		hideSignInError(errorDisplay);
21306
21307	return true;
21308}
21309function validateSignIn(formID) {
21310	return validateSignInPasswordConfirm(formID, true) & validateSignInPassword(formID, true) & validateSignInUsername(formID, true);
21311}
21312function signInServiceValidate(params, method, successFunc, validFunc, skipSave) {
21313	if (checkCookiesSignIn() && (typeof (params.formID) === "undefined" || validateSignIn(params.formID))) {
21314		var proceedFunc = function () {
21315			if (method === "signIn" && !ensurePasswordNotEmpty(params.password, params.formID))
21316				return;
21317
21318			if (skipSave) {
21319				signInService(params, method, successFunc);
21320			}
21321			else {
21322				signInServiceWithSave(params, method, successFunc);
21323			}
21324		}
21325		if (typeof (validFunc) === "function") {
21326			validFunc(params, proceedFunc);
21327		}
21328		else {
21329			proceedFunc();
21330		}
21331	}
21332}
21333function signOut(params, successFunc, skipSave) {
21334	if (typeof (params) === "undefined" || params === null) params = {};
21335	if (skipSave) {
21336		signInService(params, "signOut", successFunc);
21337	}
21338	else {
21339		/* Make sure that iFrames on the page also do a save, this should only be necessary for signing out as in other cases the page's typical unload should deal with this. Note: hidden frames should also have this triggered as we probably still want things users aren't currently looking at to save. */
21340		saveAllFrames();
21341		signInServiceWithSave(params, "signOut", successFunc);
21342	}
21343}
21344function signIn(params, successFunc, validFunc, skipSave) {
21345	signInServiceValidate(params, "signIn", successFunc, validFunc, skipSave);
21346}
21347function signInSecure(params, successFunc) {
21348	signInService(params, "signInSecure", successFunc);
21349}
21350function createAccount(params, successFunc, validFunc, skipSave) {
21351	signInServiceValidate(params, "create", successFunc, validFunc, skipSave);
21352}
21353function setAccount(params, successFunc, validFunc, skipSave) {
21354	signInServiceValidate(params, "setAccount", successFunc, validFunc, skipSave);
21355}
21356function forgotPassword(params, successFunc, validFunc, skipSave) {
21357	signInServiceValidate(params, "forgot", successFunc, validFunc, skipSave);
21358}
21359function resetPassword(params, successFunc, validFunc, skipSave) {
21360	signInServiceValidate(params, "reset", successFunc, validFunc, skipSave);
21361}
21362function recoverAccount(params, successFunc, validFunc, skipSave) {
21363	signInServiceValidate(params, "recover", successFunc, validFunc, skipSave);
21364}
21365
21366function GetCurrentUserInfo() {
21367	var url = "/api/foundation/user-account-management/v1/session/GetCurrentUserInfo";
21368	return new Promise(function (resolve, reject) {
21369		$.ajax({
21370			type: "POST",
21371			dataType: "json",
21372			url: url ,
21373			success: function (result) {
21374				resolve(result.GetCurrentUserInfoResult);
21375			},
21376			error: function (result) {
21377				reject(result);
21378			}
21379		});
21380	});
21381}
21382function preSignInServiceRequest(params, method, successFunc) {
21383	var message;
21384	if (params.message) message = params.message;
21385	else message = signInServiceInfo[method].message;
21386	showMessage(message);
21387	if (typeof (successFunc) !== "undefined") {
21388		signInServiceInfo[method].success = successFunc;
21389	}
21390	$("#" + params.formID + " .err").text("");
21391}
21392function signInServiceWithSave(params, method, successFunc) {
21393	preSignInServiceRequest(params, method, successFunc);
21394	if (tryIsInDialog()) {
21395		parentPostMessage("saveData:false|true:signInService|" + method + "|" + stringifyForPostMessage(params));
21396	}
21397	else {
21398		if (typeof (saveData) === "function") {
21399			forceSyncSave = true;
21400			saveData();
21401			forceSyncSave = false;
21402		}
21403		signInService(params, method, successFunc);
21404	}
21405}
21406
21407function PostMessageHandler() {
21408	this.Frames = {};
21409
21410	this.SendTo = function (url, message, callback) {
21411		if (typeof (this.Frames[url]) === "undefined") {
21412			this.Frames[url] = new Object();
21413			this.Frames[url].Loaded = false;
21414			this.Frames[url].ToSend = new Array();
21415			this.Frames[url].ToSend.push(message);
21416			this.Frames[url].Frame = $("<iframe src='" + url + "' onload='pmHandler.Loaded(\"" + url + "\");' style='display:none' />");
21417			this.Frames[url].Frame.prependTo('body');
21418			this.Frames[url].Callback = callback;
21419		}
21420		else if (!this.Frames[url].Loaded) {
21421			this.Frames[url].ToSend.push(message);
21422			this.Frames[url].Callback = callback;
21423		}
21424		else {
21425			this.Frames[url].Callback = callback;
21426			this.SendMessage(this.Frames[url].Frame, url, message);
21427		}
21428	}
21429
21430	this.Loaded = function (url) {
21431		this.Frames[url].Loaded = true;
21432		for (var i = 0; i < this.Frames[url].ToSend.length; ++i) {
21433			this.SendMessage(this.Frames[url].Frame, url, this.Frames[url].ToSend[i]);
21434		}
21435	}
21436
21437	this.SendMessage = function (frame, origin, message) {
21438		if (frame.length > 0 && frame[0].contentWindow.postMessage) {
21439			frame[0].contentWindow.postMessage(message, origin);
21440		}
21441	}
21442
21443	this.Callback = function (url, result) {
21444		if (typeof (this.Frames[url]) !== "undefined" && typeof (this.Frames[url].Callback) === "function") {
21445			this.Frames[url].Callback(result);
21446		}
21447	}
21448}
21449
21450var incorrectPasswordText = "Incorrect password.";
21451var yourPasswordMustBeText = "Your password must be 6-30 characters long.";
21452var passwordMismatchText = "Your confirmation password does not match your password."
21453var invalidEmailText = "Please enter a valid email address.";
21454var emailTooLongText = "Email is too long, must be less than 320 characters.";
21455var passwordEmailSentText = "Password Email Sent";
21456var emailedMsg = "If the email provided matches an existing account, instructions to reset your password will be sent to that email address.";
21457var openEmailText = "Open the email and follow the instructions to continue.";
21458var passwordResetDialogTitle = "Success!";
21459var passwordResetButtonText = "OK";
21460
21461window.addEventListener('load', function() {
21462	const productCode = getCurrentProductCode();
21463	const productCodeString = typeof productCode === 'string' ? productCode : '';
21464
21465	if (getCountry() == 'CA' && getRegion() == 'QC') {
21466		/*  */
21467		incorrectPasswordText = "Mot de passe incorrect.";
21468		yourPasswordMustBeText = "Votre mot de passe doit comporter entre 6 et 30 caractères.";
21469		passwordMismatchText = "Les deux mots de passe ne se correspondent pas."
21470		invalidEmailText = "Veuillez indiquer une adresse email valide.";
21471		emailTooLongText = "votre adresse email est plus long, il doit être mois que 320 caractères";
21472		passwordEmailSentText = "Un email concernant votre mot de passe a été envoyé";
21473		emailedMsg = "Si le courriel fourni correspond à un compte existant, des instructions pour réinitialiser votre mot de passe seront envoyées à cette adresse courriel.";
21474		openEmailText = "Vous devez ouvrir l'email et suivre les étapes pour continuer.";
21475		passwordResetDialogTitle = "Succès!";
21476		passwordResetButtonText = "D'accord";
21477		/* */
21478	}
21479});
21480
21481function ensurePasswordNotEmpty(password, formID) {
21482	if (password === " " || password.length === 0) {
21483		var errorDisplay = $("#" + formID + " .password .err");
21484		showSignInError(errorDisplay, incorrectPasswordText);
21485		var input = $("#" + formID + " .password input");
21486		input.trigger("focus");
21487		hideMessage();
21488		return false;
21489	}
21490	return true;
21491}
21492
21493var pmHandler = new PostMessageHandler();
21494function signInService(params, method, successFunc) {
21495	preSignInServiceRequest(params, method, successFunc);
21496	var formID = params.formID;
21497	var host = params.host;
21498	if (typeof (host) !== "string" || host === "") {
21499		host = location.host;
21500	}
21501	var isDifferentDomain = host !== location.host;
21502	var isSecure = location.protocol === 'https:';
21503	var isCrossDomain = isDifferentDomain || !isSecure;
21504	var stopCrossDomain = params.stopCrossDomain;
21505	if (typeof (stopCrossDomain) !== "boolean") {
21506		stopCrossDomain = false;
21507	}
21508	if (stopCrossDomain) {
21509		signInServiceInfo.InProgress = 1;
21510	}
21511
21512	if (isCrossDomain && typeof (window.XDomainRequest) !== "undefined") {
21513		params.stopCrossDomain = true;
21514		pmHandler.SendTo("https://" + host + "/SignInService/CrossDomainHelper.php", "signInService:" + method + ":" + stringifyForPostMessage(params), function (result) { signInServiceComplete(result, method, formID, !isDifferentDomain && !stopCrossDomain); });
21515	}
21516	else {
21517		var url = "https://" + host + "/api/foundation/user-account-management/"+ signInServiceInfo[method].routeName + signInServiceInfo[method].serviceFunc;
21518
21519		$.support.cors = true;
21520		$.ajax({
21521			type: "POST",
21522			url: url,
21523			data: JSON.stringify(params),
21524			contentType: "application/json",
21525			dataType: 'json',
21526			crossDomain: isCrossDomain,
21527			success: function (result) { signInServiceComplete(result, method, formID, !isDifferentDomain && !stopCrossDomain); },
21528			error: function (result) { signInServiceFail(result, method, !isDifferentDomain && !stopCrossDomain); },
21529			xhrFields: { withCredentials: true } /* Needed to set cookies on cross domain requests */
21530		});
21531	}
21532}
21533function signInServiceComplete(result, method, formID, doCrossDomain) { /* This just indicates that the request to the webservice succeeded, there could still be an issue with the sign in */
21534	var resultObject = result;
21535	if (typeof (result.Success) === "undefined") {
21536		resultObject = result[signInServiceInfo[method].serviceFunc + 'Result'];
21537	}
21538	if (resultObject.Success) { /* The service call was successful */
21539		if (method == "signIn" || method == "signOut") {
21540			clearLocalStorageLicenses(); //Clear Licenses stored in local storage for tracking purposes after a successful sign in/out
21541		}
21542		setWindowVariables(resultObject);
21543		var funcInner = signInServiceInfo[method].success;
21544		if (typeof (funcInner) !== "function") funcInner = signInServiceInfo[method].successDefault;
21545		var func = function () {
21546			if (resultObject.PostBackId) {
21547				__doPostBack(resultObject.PostBackId, '__DoSignOut');
21548			} else
21549				funcInner(resultObject);
21550		};
21551		if (doCrossDomain) { /* Only do anything extra if this is not a cross domain request */
21552			signInServiceInfo.CurrentSuccessFunc = func;
21553			if ($.isArray(resultObject.OtherHosts)) { /* Cross domain sign in/out */
21554				signInServiceInfo.InProgress = resultObject.OtherHosts.length;
21555				for (var i = 0; i < resultObject.OtherHosts.length; ++i) {
21556					if (resultObject.SecureID !== null && method != 'signOut') {
21557						signInSecure({ secureID: resultObject.SecureID, host: resultObject.OtherHosts[i] }, func);
21558					}
21559					else {
21560						signOut({ host: resultObject.OtherHosts[i] }, func, true);
21561					}
21562				}
21563				signInServiceInfo.TimeoutFunc = setTimeout(function () { signInServiceSuccessTimeout(); }, 5000); /* Timeout on cross domain sign in/out */
21564			}
21565			/* Track sign in usage */
21566			if (typeof (signInServiceInfo[method].analyticsName) !== "undefined") {
21567				signInAnalyticsSend(signInServiceInfo[method].analyticsName);
21568			}
21569		}
21570		else {
21571			signInServiceInfo.InProgress--;
21572		}
21573		/* Call the final success function */
21574		signInServiceSuccessCheck();
21575	}
21576	else {
21577		if (resultObject.TargetMode) toggleSignIn(resultObject.TargetMode);
21578		var errorPrefix = '#' + formID + ' .' + resultObject.Target;
21579		var error = $(errorPrefix + ' .err,' + errorPrefix + '.err');
21580		if (error.length > 0) {
21581			showSignInError(error, resultObject.Message);
21582		}
21583		else {
21584			alert(resultObject.Message, { title: "Error", callback: reloadPage });
21585		}
21586		error = $('#' + formID + ' .' + resultObject.Target + ' input');
21587		if (error.length > 0) error.trigger("focus");
21588		hideMessage();
21589	}
21590}
21591function setSignInLocalStorage() {
21592	SetLocalStorage("SecureID", window.SID);
21593}
21594function signInServiceSuccessTimeout() {
21595	signInServiceInfo.TimeoutFunc = null;
21596	if (typeof (signInServiceInfo.CurrentSuccessFunc) === "function" && signInServiceInfo.InProgress > 0) {
21597		signInServiceInfo.InProgress = 0;
21598		setSignInLocalStorage();
21599		var func = signInServiceInfo.CurrentSuccessFunc;
21600		signInServiceInfo.CurrentSuccessFunc = null;
21601		func();
21602	}
21603}
21604function signInServiceSuccessCheck() {
21605	if (typeof (signInServiceInfo.CurrentSuccessFunc) === "function" && signInServiceInfo.InProgress === 0) {
21606		if (signInServiceInfo.TimeoutFunc !== null) {
21607			clearTimeout(signInServiceInfo.TimeoutFunc);
21608			signInServiceInfo.TimeoutFunc = null;
21609		}
21610		setSignInLocalStorage();
21611		var func = signInServiceInfo.CurrentSuccessFunc;
21612		signInServiceInfo.CurrentSuccessFunc = null;
21613		func();
21614	}
21615}
21616
21617function forgotSuccess(resultObject) {
21618	if (isDoculaw()) {
21619		var winOrParent = window;
21620		if (tryIsInDialog()) {
21621			winOrParent = parent;
21622		}
21623		var callbackFunc = function () {
21624			winOrParent.closeDialog();
21625		};
21626		winOrParent.alert("<div class='successCheck'><h1>Success!</h1><p>An email has been sent with instructions and a link to reset your password.</p></div>",
21627			{
21628				includeParagraph: false,
21629				cssClass: "signInSuccess",
21630				buttonText: "Continue",
21631				callback: callbackFunc
21632			}
21633		);
21634		hideMessage();
21635	} else {
21636		toggleSignIn("SignIn");
21637		var email = "you";
21638		var link = "";
21639		if (typeof (resultObject) !== "undefined" && resultObject !== null && typeof (resultObject.Message) !== "undefined" && resultObject.Message !== null) {
21640			email = resultObject.Message;
21641			var pos = email.search('@');
21642			if (pos >= 0) {
21643				var domain = email.substring(pos + 1).toLowerCase();
21644				switch (domain) {
21645					case "gmail.com":
21646						link = "https://accounts.google.com/ServiceLogin?Email=" + email;
21647						break;
21648					case "hotmail.com":
21649					case "hotmail.ca":
21650					case "outlook.com":
21651						link = "https://login.live.com/?username=" + email;
21652						break;
21653					case "yahoo.com":
21654					case "yahoo.ca":
21655						link = "https://login.yahoo.com/config/login";
21656						break;
21657					case "aol.com":
21658						link = "https://my.screenname.aol.com/_cqr/login/login.psp";
21659						break;
21660				}
21661				if (link !== "") {
21662					link = "<p><a target='_blank' href='" + link + "'>Check your email now</a></p>";
21663				}
21664			}
21665		}
21666
21667		emailedMsg = emailedMsg.replace("[emailAdd]", email);
21668		alert("<div class='signInAlert'><h1>" + passwordEmailSentText + "</h1><p>" + emailedMsg + "</p><p>" + openEmailText + "</p>" + link + "</div>", { includeParagraph: false, cssClass: "passEmailSent", title: passwordResetDialogTitle, buttonText: passwordResetButtonText }); hideMessage();
21669	}
21670}
21671
21672function resetPasswordSuccess() {
21673	var hasReturnUrl = getQueryStringValue("returnUrl");
21674	var callbackFunc = hasReturnUrl ? signInServiceReturnUrl : signInServiceSuccessHome;
21675
21676	if (isDoculaw()) {
21677		alert("<div class='successCheck'><h1>Success!</h1><p>Password successfully updated.</p></div>" + (hasReturnUrl ? "<br/> Continue to Document" : ""),
21678			{
21679				includeParagraph: false,
21680				cssClass: "signInSuccess",
21681				buttonText: "Continue",
21682				callback: callbackFunc
21683			}
21684		);
21685	} else {
21686
21687		alert("<div class='signInSuccess'><p>Your password has been reset and you are now signed in.</p></div>", { includeParagraph: false, callback: callbackFunc });
21688	}
21689}
21690
21691function signInServiceReturnUrl() {
21692	window.location.href = getQueryStringValue("returnUrl");
21693}
21694
21695function recoverAccountSuccess() {
21696	alert("<div class='signInSuccess'><p>Your account was recovered successfully. You are now signed in.</p></div>", { includeParagraph: false, callback: signInServiceSuccessHome });
21697}
21698
21699function signInServicePostMessageCallback(resultObject) {
21700	parentPostMessage("signInServiceComplete:" + escapeForPostMessage(window.location.href) + ":" + stringifyForPostMessage(resultObject));
21701}
21702
21703function createAccountSuccessModal(message, callbackFunc) {
21704	var modalHtmlElement = "<div class='successCheck'><img src='/images/CreateFreeAccountModal_1x_Icon.png' alt=''><p>" + message + "</p></div>";
21705	window.hideMessage();
21706	window.alert(modalHtmlElement,
21707		{
21708			includeParagraph: false,
21709			cssClass: "signInSuccess",
21710			buttonText: "Continue",
21711			callback: callbackFunc,
21712			closeOnEscape: false
21713		}
21714	);
21715	return false;
21716}
21717
21718function accountCreatedSuccessReferrer(resultObject) {
21719	setSave(false);
21720
21721	if (typeof (resultObject) != "undefined" && resultObject.RedirectURL) {
21722		if (resultObject.Message && resultObject.Message.length > 0) {
21723			var callbackFunc = function () {
21724				document.location.href = resultObject.RedirectURL;
21725			}
21726			alert(resultObject.Message, { callback: callbackFunc });
21727		} else {
21728			document.location.href = resultObject.RedirectURL;
21729		}
21730	} else {
21731		var referURL = getQueryStringValue("ReferURL", true);
21732		createAccountSuccessModal("You are signed in to your new account.", function () {
21733			document.location.href = typeof (referURL) !== 'undefined' ? referURL : getOriginalReferrer();
21734		});
21735	}
21736}
21737
21738function signInServiceSuccessReferrer(resultObject) {
21739	setSave(false);
21740
21741	if (typeof (resultObject) !== "undefined" && resultObject.RedirectURL) {
21742		if (resultObject.Message && resultObject.Message.length > 0) {
21743			var callbackFunc = function () {
21744				document.location.href = resultObject.RedirectURL;
21745			}
21746			alert(resultObject.Message, { callback: callbackFunc });
21747		} else {
21748			document.location.href = resultObject.RedirectURL;
21749		}
21750	}
21751	else {
21752		var referURL = getQueryStringValue("ReferURL", true);
21753		if (!referURL) referURL = getQueryStringValue("redirect", true);
21754		if (referURL) {
21755			if (!referURL.startsWith("http") && !referURL.startsWith("/")) referURL = "/" + referURL;
21756			referURL = referURL.replace(/^http:/, 'https:');
21757			document.location.href = referURL;
21758		}
21759		else {
21760			var referrer = getOriginalReferrer();
21761			var refSameDomain = referrer.replace("http://", "").replace("https://", "").indexOf(document.location.host) === 0;
21762			if (referrer !== document.location.href && referrer.indexOf("AccountDeleted.php") < 0 && refSameDomain) document.location.href = referrer;
21763			else document.location.href = "/";
21764		}
21765	}
21766}
21767function signInServiceSuccess() {
21768	if (tryIsInDialog()) { /* In a dialog */
21769		parentPostMessage("signInDialogSuccess");
21770		closeDialogParent();
21771	}
21772	else {
21773		setSave(false);
21774		if (document.location.hash) document.location.reload();
21775		else document.location = document.location;
21776	}
21777}
21778function signInServiceSuccessHome() {
21779	setSave(false);
21780	document.location = '/';
21781}
21782function signInServiceFail(result, method, notCrossDomain) { /* This is if the request to the webservice failed, not if the sign in itself failed. */
21783	logErrorMessage("SignInService Failed while attempting " + method + " with status: " + result.status + ' ' + result.statusText, url_escape(location.href), null, url_escape(location.href), 'signInService.log');
21784	if (notCrossDomain) {
21785		var errorMsg = "Sorry, an error has occurred.";
21786		errorMsg = errorMsg.replace("[errorVal]", signInServiceInfo[method].error);
21787		alert(errorMsg + " " + "Please refresh your browser or try again later.", { title: "Error" });
21788	}
21789	if (!notCrossDomain) {
21790		signInServiceInfo.InProgress--;
21791		signInServiceSuccessCheck();
21792	}
21793	else {
21794		hideMessage();
21795	}
21796}
21797
21798/* Check if a user was signed out from a different device/browser */
21799const invalidSecureIDCookieName = "SecureIDInvalid";
21800const accountDeletionPerformedCookieName = "AccountDeletionPerformed";
21801function invalidSecureIDCookieSet() {
21802	return getCookieValue(invalidSecureIDCookieName) == '1';
21803}
21804function checkForInvalidSecureID() {
21805	const isAccountDeleted = getCookieValue(accountDeletionPerformedCookieName).length > 0;
21806	if (!invalidSecureIDException() && !tryIsInDialog() && invalidSecureIDCookieSet() && !isAccountDeleted) {
21807		if (!isSignInPage() && !isLoggedIn() && !isEDErrorPage()) {
21808			submitTrackedEvent("view", null, null, "Disable Simultaneous Sign In Dialog", false);
21809			let dialogContent, dialogTitle;
21810			if (typeof (B2BExpVar) != 'undefined' && B2BExpVar == 'N') {
21811									submitInternalEventV2('B2B Link', 'Modal Business Solutions Link', 'view', null, null);
21812				dialogContent = "<p>You signed in on too many devices. See our <a target=\'_blank\' href=\'/business-solutions/\' onclick=\"submitInternalEventV2(\'B2B Link\', \'Modal Business Solutions Link\', \'click\', null, null)\">Business Solutions</a> for additional accounts.</p><a class='largeActiveButton' onclick='showSignInDialog();$(this).closest(\".ui-dialog-content\").dialog(\"close\");'>Sign In</a>";
21813				dialogTitle = "You\'ve Been Signed Out";
21814			} else {
21815				dialogContent = "<p>You signed in on a different browser or device. For your security, we signed you out on this browser.</p><a class='largeActiveButton' onclick='showSignInDialog();$(this).closest(\".ui-dialog-content\").dialog(\"close\");'>Sign In</a>";
21816				dialogTitle = "You are signed out";
21817			}
21818
21819			showInlineDialog(dialogContent, dialogTitle, null, { cssClass: "generalDialog dialog-x-centered" });
21820			// Clear the cookie so that the dialog doesn't show up again
21821			setCookie(invalidSecureIDCookieName, '', -1);
21822		}
21823	}
21824}
21825$(checkForInvalidSecureID);
21826
21827/* Some exceptions that we can't find good general rules for */
21828function invalidSecureIDException() {
21829	var pathLower = location.pathname.toLowerCase();
21830	/* A postback (probably) to the tickets page */
21831	if (pathLower.indexOf("/tickets/") === 0 && location.href.indexOf(document.referrer) === 0) return true;
21832	/* My documents page */
21833	if (pathLower.indexOf("/mydocuments/") === 0) return true;
21834	/* Internal use pages */
21835	if (pathLower.indexOf("/util/") === 0) return true;
21836	return false;
21837}
21838
21839/* End Sign In */
21840
21841/*Set the SID and UID variables for the page.*/
21842function setUserInfoVariables() {
21843	if (typeof (window.SID) === "undefined" || typeof (window.LID) === "undefined" || typeof (window.UID) === "undefined") {
21844		GetCurrentUserInfo()
21845			.then(function (userInfo) {
21846				setWindowVariables(userInfo);
21847			});
21848	}
21849}
21850rE(window, "load", setUserInfoVariables);
21851
21852function setWindowVariables(resultObject) {
21853	if (!resultObject) return;
21854
21855	window.LID = resultObject.LoginIdHash;
21856	window.SID = resultObject.SecureID;
21857	window.UID = resultObject.Username;
21858	//Incase any of the IDs change clear the apiToken used to authenticate to the NotarizationServices so that it is regenerated on next call
21859	sessionStorage.removeItem("notarizationApiToken");
21860	if (tryIsInDialog()) {
21861		parent.LID = resultObject.LoginIdHash;
21862		parent.SID = resultObject.SecureID;
21863		parent.UID = resultObject.Username;
21864	}
21865}
21866function showHidePassword(sender) {
21867	var input = $(sender).siblings("input");
21868	if (input.length > 0) {
21869		if (input.attr("type") == "text") {
21870			$(sender).attr("src", "/images/signin/icon_show.svg");
21871			submitInternalEventV2("Signin showHidePassword", "hide", "click");
21872			input.attr("type", "password");
21873		} else {
21874			input.attr("type", "text");
21875			$(sender).attr("src", "/images/signin/icon_hide.svg");
21876			submitInternalEventV2("Signin showHidePassword", "show", "click");
21877		}
21878	}
21879}
21880/* End Include signin */
21881
21882/* Include smallScreen */
21883function isSmallScreen() {
21884	return $("form.smallScreen").length > 0;
21885}
21886/* Begin Small Screen Selects */
21887function resizeSmallScreenSelectBoxes(parentElement) {
21888	if(typeof(parentElement) == "undefined") {
21889		parentElement=$("#content");
21890	}
21891	var selectWidthMeasure = $('<span class="selectWidthMeasure"></span>');
21892	parentElement.append(selectWidthMeasure);
21893	parentElement.find("select").each(function(index, item) {
21894		resizeSmallScreenSelectBox(item, selectWidthMeasure);
21895	});
21896	$(".selectWidthMeasure").remove();
21897}
21898function resizeSmallScreenSelectBox(select, selectWidthMeasure) {
21899	var optionWidth = -1;
21900	var selectWrap = $(select).parent(".selectWrap");
21901	var removeMeasure = false;
21902	if(typeof(selectWidthMeasure) == "undefined") {
21903		selectWidthMeasure = $('<span class="selectWidthMeasure"></span>').appendTo($("#content"));
21904		removeMeasure = true;
21905	}
21906	if(selectWrap.parents(".ipq").length) {
21907		selectWidthMeasure.addClass("selectWidthInlineMeasure");
21908	}
21909	else {
21910		selectWidthMeasure.removeClass("selectWidthInlineMeasure");
21911	}
21912	var optionPaddingLeft = parseInt(selectWidthMeasure.css("paddingLeft"));
21913	selectWrap.find("option").each(function(indexInner, itemInner) {
21914		selectWidthMeasure.html($(itemInner)[0].text);
21915		var measureWidth = selectWidthMeasure.outerWidth();
21916		if(measureWidth > optionWidth) {
21917			optionWidth = measureWidth;
21918		}
21919	});
21920	selectWidthMeasure.html("");
21921	if(optionWidth < 0) optionWidth = 300;
21922   if(optionPaddingLeft < 0) optionPaddingLeft = 0;
21923	selectWrap.css({width: (optionWidth + optionPaddingLeft) + "px"});
21924	if(removeMeasure) {
21925		$(".selectWidthMeasure").remove();
21926	}
21927}
21928function initializeSmallScreenSelectBoxes() {
21929	$("#content select").each(function(index, item) {
21930		if($(this).parent(".selectWrap").length == 0) {
21931			$(this).wrap("<div class='selectWrap'></div>")
21932				.parent().append("<span class='selectInner'></span>")
21933				.find(".selectInner").text($("#content select:eq("+index+") option:selected").text());
21934			if($("#content select:eq("+index+") option:selected").hasClass("placeholder")) {
21935				$("#content .selectWrap:eq("+index+")").addClass("placeholder");
21936			}
21937			else {
21938				$("#content .selectWrap:eq("+index+")").removeClass("placeholder");
21939			}
21940		}
21941	});
21942/* Make selectbox wrapper focused on all browsers. */
21943
21944	$(".selectWrap").on("click", function(event){
21945        event.stopPropagation();
21946        $(this).toggleClass("open");
21947	});
21948   $("html").on("click", function () {
21949       $(".selectWrap").removeClass("open");
21950   });
21951	resizeSmallScreenSelectBoxes();
21952	$("#content select").on("change", function() {
21953		var index = $(this).index("#content select");
21954		if($("#content select:eq("+index+") option:selected").hasClass("placeholder")) {
21955			$("#content .selectWrap:eq("+index+")").addClass("placeholder");
21956		}
21957		else {
21958			$("#content .selectWrap:eq("+index+")").removeClass("placeholder");
21959		}
21960		$("#content .selectInner:eq("+index+")").text($("#content select:eq("+index+") option:selected").text());
21961	});
21962	$("form.smallScreen").addClass("contentLoaded");
21963}
21964rE(window, "load", function(){
21965   if(typeof(resizeSelectBoxes) == "undefined" && isSmallScreen()) {
21966      initializeSmallScreenSelectBoxes();
21967   }
21968});
21969/* End Small Screen Selects */
21970/* Small Screen Textareas */
21971function smallScreenTextareaResize() {
21972   if(isSmallScreen()) {
21973      $("textarea").each(function(index, item) {
21974         $(item).data("y", $(item).outerHeight());
21975      });
21976      $(window).on("mouseup", function() {
21977         $("textarea").each(function(index, item) {
21978            if(parseInt($(item).outerHeight()) != parseInt($(item).data("y"))) {
21979               qnh.AnimateSectionHeight();
21980            }
21981            $(item).data("y", $(item).outerHeight());
21982         });
21983      });
21984   }
21985}
21986rE(window, "load", smallScreenTextareaResize);
21987
21988/* End Small Screen Textareas */
21989/* Fix Large Checkboxes for Small Screen (not Colour) */
21990if(typeof($) != "undefined") {
21991   $(function() {
21992      if($("form.smallScreen").length && !$("head link[href$='_small_b.css']").length) {
21993         registerPostStartUpScript(function() {
21994            $(".checkBoxLarge:not([data-widthFixed])").each(function(index, item) {
21995               $(item).attr("data-widthFixed", "true");
21996               var label = $(item).find(".cblLabel");
21997               label.css({
21998                  width: (parseInt(label.css("width"))+95) + "px"
21999               });
22000            });
22001         });
22002      }
22003   });
22004}
22005/* End Fix Large Checkboxes for Small Screen (not Colour) */
22006/* End Include smallScreen */
22007
22008/* Include string */
22009String.prototype.reverse = function() {
22010    var res = "";
22011    for (var i = this.length; i > 0; --i) {
22012        res += this.charAt(i - 1);
22013    }
22014    return res;
22015};
22016
22017String.prototype.trim = function(ch) {
22018    // By default use the JS standard library trim regex: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/trim
22019    if (!ch) ch = '[\\s\uFEFF\xA0]';
22020    return this.replace(new RegExp("^" + ch + "+|" + ch + "+$", "g"), "");
22021};
22022
22023String.leftPad = function (val, size, ch) {
22024    var result = new String(val);
22025    if (ch == null) {
22026        ch = " ";
22027    }
22028    while (result.length < size) {
22029        result = ch + result;
22030    }
22031    return result;
22032};
22033
22034String.escape = function(string) {
22035    return string.replace(/(')/g, "\\$1").replace(/[\r\n]/g, '');
22036};
22037
22038function bSL(sep, finalSep){
22039   var strings=new Array();
22040	strings.push({sep:sep, finalSep:finalSep})
22041   for(var i=2; i<arguments.length;++i){ 
22042      if(arguments[i] != ""){
22043         strings.push(arguments[i]);
22044      }
22045   }
22046	return BuildStringList.apply(null, strings);
22047}
22048function BuildStringList(options){
22049   var strings=new Array();
22050   for(var i=1; i<arguments.length;++i){ 
22051      if(arguments[i] != ""){
22052         strings.push(arguments[i]);
22053      }
22054   }
22055	var opts = $.extend({
22056			sep:", ",
22057			finalSep:", ",
22058			prefix: null
22059		}, options);
22060   var retVal="";
22061   for(var i=0;i<strings.length;++i){
22062		if(i>0){
22063			if(i==strings.length-1) retVal += opts.finalSep;
22064	      else retVal += opts.sep;
22065		}
22066      retVal += GetStringListPrefix(opts.prefix, i) + strings[i];
22067   }
22068   return retVal;
22069}
22070function GetStringListPrefix(prefix, i){
22071	if (typeof(prefix) != "string" || prefix == null || prefix == "") return "";
22072	var str = "";
22073	var iStr = "" + (i + 1);
22074
22075	for (var pos = 0; pos < prefix.length; ++pos){
22076		if (prefix[pos] == '#' && (pos == 0 || prefix[pos - 1] != '\\')) str += iStr;
22077		else if (pos == prefix.Length - 1 || prefix[pos] != '\\' || prefix[pos + 1] != '#') str += prefix[pos];
22078	}
22079	return str;
22080}
22081function eP(str){
22082   if(str == null || typeof(str) == 'undefined') return '.';
22083   str = str.trim();
22084   if(!str.match(/[.,:!?_]$/)) return str + ".";
22085   return str;
22086}
22087function formatString(format){
22088	var args = arguments;
22089   return format.replace(/{(\d+)}/g, function(match, number) { 
22090		var num = parseNum(number) + 1;
22091      return typeof args[num] != 'undefined'
22092        ? args[num]
22093        : match
22094      ;
22095    });
22096}
22097
22098if(typeof exports != "undefined"){
22099  exports.formatString = formatString;
22100}
22101
22102/* End Include string */
22103
22104/* Include WOAHbar */
22105var WOAHbar = function(el, params) {
22106	this.elements = {};
22107	this.element = null;
22108	this.namespace = "woahbar";
22109	this.options = {
22110		location: "bottom",
22111		close: "close",
22112		rememberClosedState: 0,
22113		stub: null,
22114		duration: 600,
22115		easing: "swing",
22116		animationShow: "slide",
22117		animationShowOptions: {times: 2, distance: 0},
22118		animationHide: "slide",
22119		animationHideOptions: {},
22120		definitionId: null,
22121		viewConversionEvents: null,
22122		showTimeout: 3,
22123		append: "append", /* values append, prepend, none */
22124		onNotShowing: null, /* Callback for when hidden or not shown */
22125		cancelOnNavigation: false, /*If true then cancels the timeout to show to the bar. No effect if bar already showing*/
22126		variant: "default" // cookieConsent will store cookie preferences in local storage and the database
22127	};
22128	this.selectors = {
22129		body: "body",
22130		window: window
22131	};
22132	this.stubShowing = false;
22133	this.barShowing = false;
22134	this.initialShow = true;
22135
22136	this.initialize(el, params);
22137};
22138
22139/* Define the behaviour */
22140(function($, window, undefined) {
22141
22142	/* Show the bar */
22143	WOAHbar.prototype.showBar = function() {
22144		var self = this;
22145		var showThisTime = true;
22146
22147		/* Remember the state, if necessary */
22148		if(self.initialShow && self.options.rememberClosedState > 0) {
22149			var close = self.stateStorage();
22150			showThisTime = !close;
22151		}
22152		if(self.initialShow && self.options.viewConversionEvents) {
22153			for(var i=0; i<self.options.viewConversionEvents.length; i++) {
22154				pushMarketingBarConversion(self.options.viewConversionEvents[i], 'View');
22155			}
22156		}
22157
22158		var TimeoutToShowBar;
22159		TimeoutToShowBar = window.setTimeout(function() {
22160			if(showThisTime) {
22161				/* Hide the stub, if showing */
22162				if(self.stubShowing && self.options.close == "minimize" && self.options.stub) {
22163					$(self.options.stub).hide(self.getAnimationOptions(self.options.animationHide, self.options.animationHideOptions, function() {
22164						self.showBarElement();
22165					}, self.options.duration));
22166					self.stubShowing = false;
22167				}
22168				else {
22169					self.showBarElement();
22170				}
22171
22172				if(self.options.rememberClosedState > 0) {
22173					self.stateStorage(false);
22174				}
22175			}
22176			else {
22177				self.hideBar(self.options.close);
22178			}
22179		}, self.initialShow ? self.options.showTimeout * 1000 : 0);
22180
22181		self.initialShow = false;
22182        
22183		if(self.options.cancelOnNavigation){
22184			/*make sure qnh is setup*/
22185			if(typeof(qnh)!='undefined'){
22186				qnh.AddNavigation(function(){
22187					clearTimeout(TimeoutToShowBar);
22188				});
22189			}
22190		}
22191
22192		/*For sand experiment */
22193		var windowWidth = parseInt($(window).width());
22194		var newLeft = (windowWidth / 2) - (parseInt($('.woahbar_sand').width()) / 2);
22195		$('.woahbar_sand').css('left', newLeft + 'px');
22196	};
22197
22198	/* Hide the bar 
22199	 * @param close: string
22200	 * @param temp?: boolean
22201	 * @param cookiePreferences?: { performance: boolean, marketing: boolean }
22202	*/
22203	WOAHbar.prototype.hideBar = function(close, temp, cookiePreferences) {
22204		var self = this;
22205        if(typeof(temp) == "undefined") temp == false;
22206		if(typeof(cookiePreferences) == "undefined") {
22207			cookiePreferences = {
22208				performance: true,
22209				marketing: true
22210			};
22211		}
22212		
22213		/* Hide the bar */
22214		if(this.barShowing) {
22215			$(self.element).hide(self.getAnimationOptions(self.options.animationHide, self.options.animationHideOptions, function() {
22216				self.showStubElement();
22217				self.barShowing = false;
22218			}, self.options.duration)); 
22219		}
22220		else {
22221			self.showStubElement();
22222		}
22223		
22224		if(!temp && self.options.rememberClosedState > 0) {
22225			self.stateStorage(true, cookiePreferences);
22226		}
22227
22228		self.removeContentSpacing(true);
22229
22230		if(!temp && self.options.onNotShowing) {
22231			self.options.onNotShowing();
22232		}
22233	};
22234
22235	WOAHbar.prototype.showBarElement = function() {
22236		var self = this;
22237		/* Show the bar */
22238		$(self.element).show(self.getAnimationOptions(self.options.animationShow, self.options.animationShowOptions, function() {
22239			self.barShowing = true;
22240			self.setContentSpacing(true);
22241		}, self.options.duration));
22242	};
22243
22244	WOAHbar.prototype.showStubElement = function() {
22245		/* Show the stub, if minimize */
22246		if(this.options.close == "minimize" && this.options.stub) {
22247			$(this.options.stub).show(this.getAnimationOptions(this.options.animationShow, this.options.animationShowOptions, null, this.options.duration));
22248			this.stubShowing = true;
22249		}
22250	};
22251
22252	WOAHbar.prototype.placeBottom = function(isResize) {
22253		$(this.element).css('bottom', "0px");
22254		if(this.options.stub) {
22255			var topPosStub = parseInt($(this.elements.window).height()) - parseInt($(this.options.stub).outerHeight()) + 3;
22256			topPosStub = this.adjustBottomMobile(topPosStub, isResize);
22257			$(this.options.stub).css('top', topPosStub + "px");
22258		}
22259	};
22260
22261	WOAHbar.prototype.adjustBottomMobile = function(topPos, isResize) {
22262		var isMobile = typeof(cssua) != "undefined" && cssua.ua.mobile;
22263		if(isMobile) {
22264			var orientation = typeof(getWindowOrientation) == "function" ? getWindowOrientation() : "";
22265			if(orientation == "landscape" && !isResize) {
22266				topPos -= 20;
22267			}
22268			else if(orientation == "landscape") {
22269				topPos -= 7;
22270			}
22271			else if(isResize) {
22272				topPos += 12;
22273			}
22274		}
22275		return topPos;
22276	}
22277
22278	WOAHbar.prototype.setContentSpacing = function(animate) {
22279      if($(this.element).filter(":visible").length > 0){
22280         if(this.options.location == "top") {
22281            var height = $(this.element).outerHeight();
22282            if(animate) {
22283               if(!isPhone()){
22284                  if (screen.width > 767) {
22285						if(!($('body').hasClass('dialogOpen')) && !($('body').hasClass('alertDialogOpen')) && !($('body').hasClass('welcomeTourDialogOpen'))){
22286                     $("html").animate({"margin-top": height+"px"}, {duration:this.options.duration, complete:function(){
22287                        if(typeof(fixViewHeight) == "function") fixViewHeight();
22288                     }});
22289                  }
22290	               		$("#allFixTop.fixed").animate({"margin-top": height+"px"}, {duration:this.options.duration });
22291               }
22292               else{
22293                  $("html").animate({"margin-top": "0"}, {duration:this.options.duration, complete:function() {
22294                     if(typeof(fixViewHeight) == "function") fixViewHeight();
22295                  }});
22296               }
22297            }
22298			}
22299            else {
22300               if(!isPhone()){
22301                  if (screen.width > 767) {
22302	   					if(!($('body').hasClass('dialogOpen')) && !($('body').hasClass('alertDialogOpen')) && !($('body').hasClass('welcomeTourDialogOpen'))){
22303                        $("html").css("margin-top", height+"px");
22304                        if(typeof(fixViewHeight) == "function") fixViewHeight();
22305                     }
22306						$("#allFixTop.fixed").css("margin-top", height+"px");
22307                  }
22308                  else{
22309                     $("html").css("margin-top", "0");
22310                     if(typeof(fixViewHeight) == "function") fixViewHeight();
22311                  }
22312               }
22313            }
22314
22315         }
22316         else {			
22317            var additionalPadding = 25;
22318            if($("form.footerSimpleV2").length) {
22319	   			additionalPadding = 50;
22320		   	}
22321			
22322			var isLcColour = $(".smallscreen_ver_b").length > 0 || ($("html.LC").length > 0 && $("#footer_fluid").length > 0);
22323
22324			if(isLcColour && this.options.location =='bottom')
22325			{
22326				var woahbarHeight = ($('#woahbar_chat').length ? $('#woahbar_chat').outerHeight():0);
22327				if(woahbarHeight ==0 && $('#woahbar_reviewUpsellBar').length)
22328					woahbarHeight = $('#woahbar_reviewUpsellBar').outerHeight();
22329				
22330				if(woahbarHeight >0)
22331					woahbarHeight = parseInt(woahbarHeight+15);
22332				
22333				$('#footer').css({'margin-bottom':parseInt(woahbarHeight)+'px'});
22334				$('#footer_fluid').css({'margin-bottom':parseInt(woahbarHeight)+'px'});
22335				
22336			}
22337			//			
22338   			if(animate) {
22339				if(isLcColour)
22340				{
22341					$('#footer').css({'margin-bottom':parseInt(woahbarHeight)+'px'});					
22342					$('#footer_fluid').css({'margin-bottom':parseInt(woahbarHeight)+'px'});
22343				}
22344				else
22345				{
22346					$("body").animate({"margin-bottom": ($(this.element).outerHeight())}, {duration:this.options.duration, complete:function() {
22347						if(typeof(fixViewHeight) == "function") fixViewHeight();
22348					}});
22349					$(".ua-ie body, .ua-edge body").css("height","auto");
22350				}
22351				
22352				
22353		   	}
22354		   else {	
22355				if(isLcColour)
22356				{
22357					$('#footer').css({'margin-bottom':parseInt(woahbarHeight)+'px'});				
22358					$('#footer_fluid').css({'margin-bottom':parseInt(woahbarHeight)+'px'});
22359					
22360				}
22361				else
22362				{
22363					$("body").css("margin-bottom", ($(this.element).outerHeight()));
22364					if(typeof(fixViewHeight) == "function") fixViewHeight();
22365					$(".ua-ie body, .ua-edge body").css("height","auto");
22366				}
22367				
22368	   		}
22369		   }
22370      }
22371	};
22372
22373	WOAHbar.prototype.removeContentSpacing = function(animate) {
22374		if(this.options.location == "top") {
22375			if(animate) {
22376			   if(!isPhone() && screen.width > 767){
22377				   $("html").animate({"margin-top": "0"}, {duration:this.options.duration, complete:function() {
22378	               	if(typeof(fixViewHeight) == "function") fixViewHeight();
22379	               }});
22380	               
22381	                $("#allFixTop").animate({"margin-top": "0"}, {duration:this.options.duration, complete:function() {
22382	               	if(typeof(fixViewHeight) == "function") fixViewHeight();
22383	               }});
22384	              
22385			   }
22386			}
22387			else {
22388				if(!isPhone() && screen.width > 767){
22389					$("html").css("margin-top", "0");
22390					if(typeof(fixViewHeight) == "function") fixViewHeight();
22391					$("#allFixTop").css("margin-top", "0");
22392				}
22393            }
22394
22395		}
22396		else {
22397			var isLcColour = $(".smallscreen_ver_b").length > 0 || ($("html.LC").length > 0 && $("#footer_fluid").length > 0);
22398			var woahbarHeight = ($('#woahbar_chat').length ? $('#woahbar_chat').outerHeight():0);
22399			if(woahbarHeight ==0 && $('#woahbar_reviewUpsellBar').length)
22400				woahbarHeight = $('#woahbar_reviewUpsellBar').outerHeight();
22401			
22402			if(animate) {
22403				if(isLcColour)
22404				{
22405					$("#footer").css({"margin-bottom":"0"});
22406					$('#footer_fluid').css({'margin-bottom':"0"});
22407				}
22408				else{
22409					$("body").animate({"margin-bottom": "0"}, {duration:this.options.duration, complete:function() {
22410						if(typeof(fixViewHeight) == "function") fixViewHeight();
22411					}});
22412					$(".ua-ie body, .ua-edge body").css("height","100%");
22413				}
22414			}
22415			else {
22416				if(isLcColour)
22417				{
22418					$("#footer").css({"margin-bottom":"0"});
22419					$('#footer_fluid').css({'margin-bottom':"0"});
22420				}
22421				else{
22422					$("body").css("margin-bottom", "0");
22423					if(typeof(fixViewHeight) == "function") fixViewHeight();
22424					$(".ua-ie body, .ua-edge body").css("height","100%");
22425				}
22426			}
22427		}
22428	};
22429
22430	WOAHbar.prototype.stateStorage = function(closed, cookiePreferences) {
22431		var isCookieConsent = this.options.variant == "cookieConsent";
22432		return isCookieConsent 
22433			? this.stateCookieConsentStorage(closed, cookiePreferences)
22434			: this.stateCookie(closed);
22435	};
22436
22437	/*
22438	 * @param closed: boolean
22439	 * @param cookiePreferences?: { performance: boolean, marketing: boolean }
22440	 * @return boolean
22441	*/
22442	WOAHbar.prototype.stateCookieConsentStorage = function(closed, cookiePreferences) {
22443		/* Set the value, if specified and not already saved */
22444		var cookieConsentStore = new CookieConsentStore();
22445		var cookieConsent = cookieConsentStore.getCookieConsent();
22446		if (cookieConsent == null && cookiePreferences != null) {
22447			cookieConsentStore.setCookieConsent(cookiePreferences);
22448			// save cookie preferences to database
22449			postCookiePreferences(cookiePreferences);
22450			// update consent status in tracking call consent queue
22451			trackingCallConsentQueue.consentStatusUpdated();
22452			return closed;
22453		}
22454		else {
22455			return cookieConsent == null ? false : true;
22456		}
22457	};
22458
22459	WOAHbar.prototype.stateCookie = function(closed) {
22460		/* Set the value, if specified */
22461		if(typeof(closed) != "undefined") {
22462         setCookie("mb_"+this.options.definitionId, closed?"1":"0", this.options.rememberClosedState/(60*24));
22463			return closed;
22464		}
22465		else {
22466         return getCookie("mb_"+this.options.definitionId) == "1" ? true : false;
22467		}
22468	};
22469
22470	WOAHbar.prototype.getAnimationOptions = function(animation, animationOptions, complete, duration) {
22471		var options = $.extend({}, animationOptions, {
22472         direction: this.options.location == "top" ? "up" : "down", 
22473         effect: animation,
22474         duration: duration,
22475         easing: "swing"
22476      });
22477		if(typeof(complete) == "function") {
22478			options = $.extend(options, {complete: complete});
22479		}
22480		return options;
22481	};
22482
22483	/* Event binding */
22484	WOAHbar.prototype._bindEvents = function() {
22485		var self = this;
22486		$(self.elements.window).on("resize", function() {
22487			/* If bottom location, move the bar */
22488			if(self.options.location == "bottom") {
22489				self.placeBottom(true);
22490                                                
22491                                /*For sand experiment */
22492                                var windowWidth = parseInt($(window).width());
22493                                var newLeft = (windowWidth / 2) - (parseInt($('.woahbar_sand').width()) / 2);
22494                                $('.woahbar_sand').css('left', newLeft + 'px');
22495			}
22496			/* Redo content spacing for new height */
22497			if(self.barShowing) {
22498				self.setContentSpacing(false);
22499			}
22500		});
22501	};
22502
22503	/* Build additional elements/classes/etc. */
22504	WOAHbar.prototype._build = function() {
22505		if(this.options.append != "none") {
22506			/* Remove the woahbar and move it to the very end of the body */
22507			this.element.parentElement.parentElement.removeChild(this.element.parentElement);
22508			if(this.options.append == "append") {
22509				$(this.elements.body).append(this.element.parentElement);
22510			}
22511			else if(this.options.prepend == "prepend") {
22512				$(this.elements.body).prepend(this.element.parentElement);	
22513			}
22514		}
22515
22516		/* If postion bottom, place at the bottom */
22517		if(this.options.location == "bottom") {
22518			this.placeBottom();
22519		}
22520		
22521		/* Set the slide direction based on the location of the bar */
22522		this.options.direction = (this.options.location == "top" ? "up" : "down");
22523	};
22524
22525	/* Extended jQuery getElements function */
22526	WOAHbar.prototype._getElements = function(selectors, context) {
22527		var elements = {};
22528		var self = this;
22529		var $context = $(context || 'html');
22530
22531		$.each( selectors, function(key, value) {
22532			if($.isPlainObject(value)) {
22533				elements[key] = elements[key] || {};
22534				$.each(value, function(key2, value2) {
22535					elements[key][key2] = $(value2, $context);
22536				});
22537			} else {
22538				elements[key] = $(value, $context);
22539			}
22540		});
22541
22542		return elements;
22543	};
22544
22545	/* Run actions on the bar */
22546	WOAHbar.prototype._run = function() {
22547		var arguments_array = [];
22548		for(var i = 0; i < arguments.length; i++) {
22549			arguments_array.push(arguments[i]);
22550		}
22551
22552		var action = arguments_array[0];
22553		var args = arguments_array.length > 1 ? arguments_array.slice(1) : [];
22554
22555		if(typeof(this[action]) == 'function') {
22556			/* Execute and return the function's response */
22557			return this[action].apply(this, args);
22558		} else if(typeof(this[action]) != 'undefined') {
22559			/* Set properties */
22560			if(args.length > 0) this[action] = args[0];
22561
22562			/* Return property value */
22563			return this[action];
22564		}
22565	};
22566
22567	/* Initialize the bar */
22568	WOAHbar.prototype.initialize = function(el, options) {
22569		/* Merge options for this instance with defaults */
22570		this.options = $.extend(this.options, arguments[1][0] || {}, $(el).data());
22571
22572		/* Store the element */
22573		this.element = el;
22574
22575		/* Cache elements used by this instance */
22576		this.elements = this._getElements( this.selectors );
22577
22578		/* Build elements */
22579		this._build();
22580
22581		/* Bind events */
22582		this._bindEvents();
22583	};
22584
22585	/* Get/set an option */
22586	WOAHbar.prototype.option = function(key, val) {
22587		if( val !== undefined ) {
22588			this.options[key] = val;
22589		}
22590		return this.options[key];
22591	};
22592
22593	/* Extend jQuery with the plugin */
22594	$.extend($.fn, {
22595		woahbar: function() {
22596			var options = action = arguments;
22597			var _return = this;
22598
22599			this.each(function(ind) {
22600				/* Look up if an instance already exists */
22601				var _WOAHbar = $.data(this, 'WOAHbar');
22602
22603				/* Else create one and store it */
22604				if(!_WOAHbar) {
22605					_WOAHbar = new WOAHbar(this, options);
22606					$.data(this, 'WOAHbar', _WOAHbar);
22607				}
22608
22609				/* Act upon it */
22610				if(action.length > 0) {
22611					var _do = _WOAHbar._run.apply(_WOAHbar, action);
22612					if(typeof(_do) != 'undefined') {
22613						_return = _do;
22614					}
22615				}
22616			});
22617
22618			return _return;
22619		}
22620	});
22621
22622} )( jQuery, window, null );
22623
22624/* Submit the given purchase to the given order url next (payment page url) */
22625function submitPurchase(buyOptionName, productCode, countryCode, regionCode, orderUrlNext, productUrl) {
22626	$('<form/>').attr({'method': 'post', 'action': 'https://'+location.host+orderUrlNext+'loc='+countryCode+regionCode+'&contract='+productUrl})
22627		.append($('<input/>').attr({'type':'hidden', 'name':'sstring', 'value':''}))
22628		.append($('<input/>').attr({'type':'hidden', 'name':'from', 'value':'marketingBar'}))
22629		.append($('<input/>').attr({'type':'hidden', 'name':'referURL', 'value':location}))
22630		.append($('<input/>').attr({'type':'hidden', 'name':'products', 'value':'code='+productCode+';license='+buyOptionName+';selected='+buyOptionName+':::'}))
22631		.appendTo($(document.body))
22632		.submit();
22633}
22634
22635/* Push the marketing bar conversion to Google Analytics */
22636function pushMarketingBarConversion(eventName, eventType) {
22637	if(typeof(_gaq) != "undefined") {
22638		if(typeof(getGAPageName) == "function") {
22639			_gaq.push(['_trackEvent', eventName, eventType, getGAPageName(), undefined, true]);
22640		}
22641		else {
22642			_gaq.push(['_trackEvent', eventName, eventType, undefined, undefined, true]);
22643		}
22644	}
22645}
22646
22647function displayUserFeedback() {
22648    $('.wbMessage #wbFeedback').css('display','block');
22649    $('.woahbar').css('height', '183px');
22650    $('.woahbar').woahbar('placeBottom', true);
22651}
22652
22653function submitUserFeedback(productCode, countryCode) {
22654    $('#wbSubmit').attr('disabled', 'disabed');
22655    var user_rating = $('input[name="feedback"]:checked').val();
22656    
22657    $.post("/common/UserFeedback.php", {rating: user_rating}, function(data) {
22658        $('#wbFeedback').remove();
22659        $('.wbMessage').replaceWith("Thank you!");
22660        $('.woahbar').css('height', '40px');
22661        $('.woahbar').woahbar('placeBottom', true);
22662        setTimeout(function() {
22663            $('.woahbar').woahbar('hideBar', true);
22664        }, 3000);
22665
22666    });
22667    
22668}
22669
22670function postCookiePreferences(cookiePreferences) {
22671	var url = "/api/foundation/user-account-management/v2/cookie-preferences";
22672	return new Promise(function (resolve, reject) {
22673		$.ajax({
22674			type: "POST",
22675			data: JSON.stringify(cookiePreferences),
22676			contentType: "application/json; charset=utf-8",
22677			dataType: "json",
22678			url: url ,
22679			success: function (result) {
22680				resolve(result);
22681			},
22682			error: function (result) {
22683				reject(result);
22684			}
22685		});
22686	});
22687}
22688
22689
22690/* End Include WOAHbar */
22691
22692/* Include warningWOAHbars */
22693var _warningBar = {
22694	showing: null,
22695	showNext: null
22696};
22697
22698function tempHideCookieConsentBar() {
22699	$(".wbUKCookies.cookieConsent").woahbar("hideBar", undefined, true);
22700	_warningBar.showing = null;
22701}
22702
22703function updateConsentStatus() {
22704	// update consent status in tracking call consent queue
22705	trackingCallConsentQueue.consentStatusUpdated();
22706}
22707
22708function appendWarningWOAHbar(definitionId, barClass, messageHtml, firstButtonMessage, secondButtonMessage, buttonClass, rememberClosedState, variant) {
22709	var logEvents = definitionId == "ukCookies";
22710	var eventComponent = "UK Cookie banner";
22711	var isCookieConsent = variant == "cookieConsent";
22712	if(typeof(jQuery) != "function") return;
22713	if(!($('body').hasClass('dialog'))){
22714		if(!_warningBar.showing) {
22715			($("<div>")
22716				.addClass("woahbar wbTop "+barClass+" "+variant)
22717				.css("display", "none")
22718				.append($("<div>")
22719					.addClass("wbContent")
22720					.append($("<div>")
22721						.addClass("wbMessage")
22722						.html(messageHtml)
22723					)
22724					.append(firstButtonMessage ? ($("<div>")
22725						.addClass("wbButtonsRight")
22726						.append($("<a>")
22727							.addClass(buttonClass)
22728							.text(firstButtonMessage)
22729						.on("click", function() {
22730								$("."+barClass).woahbar("hideBar", true);
22731								if(logEvents)
22732									submitInternalEventV2(null, eventComponent, "OK", null, null);
22733								return false;
22734							})
22735						))
22736	               : ""
22737					)
22738					.append(secondButtonMessage ? ($("<div>")
22739						.addClass("wbButtonsRight")
22740						.append($("<a>")
22741							.addClass(buttonClass)
22742							.text(secondButtonMessage)
22743						.on("click", function() {
22744								let url = window.location.origin;
22745								const index = url.indexOf('?');
22746								if (index !== -1) {
22747								url = url.substring(0, index);
22748								}
22749								const cookiesPolicyURL = Sequiter.SiteConfig.GetConfigValue("cookiesPolicyURL", "/cookiesUK.php");
22750								window.location.href = url + cookiesPolicyURL + window.location.search;
22751								return false;
22752							})
22753						))
22754	               : ""
22755					)
22756				)
22757			)
22758			.prependTo(document.body);
22759
22760			$(".cookie-prefs").on("click", function() {
22761				showDialog("Cookie Preferences", '/cookiePreferencePopupDialog.php' + '?dialog=true', 750, null, 'plainDialog footerDialog cookiePrefsDialog', 0.5, true, true);
22762				return false;
22763			});
22764
22765			var timeoutSeconds = 1;
22766
22767			$("."+barClass).woahbar({
22768				location: "top",
22769				close: "none",
22770				rememberClosedState: rememberClosedState,
22771				definitionId: definitionId,
22772				showTimeout: timeoutSeconds,
22773				append: "none",
22774				onNotShowing: showNextWarningWOAHbar,
22775				variant: variant ?? "default"
22776			});
22777
22778			// If this is the cookie consent bar, and it's been more than 24 hours since they were first shown it
22779			// auto-accept the cookie preferences and don't show the bar
22780			if (isCookieConsent && autoAcceptCookieConsent()) {
22781				// will save the cookie preferences as true if the user doesn't have them saved
22782				$("." + barClass).woahbar("hideBar", true);
22783				return;
22784			}
22785
22786			$("."+barClass).woahbar("showBar");
22787
22788			var submitViewEvent = function() {
22789				if(isCookieConsent) {
22790					var cookieConsentStore = new CookieConsentStore();
22791					var cookieConsent = cookieConsentStore.getCookieConsent();
22792					return !cookieConsent && logEvents;
22793				} else {
22794					return getCookieValue("mb_ukCookies") != 1 && logEvents;
22795				}
22796			}
22797
22798			if(submitViewEvent())
22799			{
22800				setTimeout(()=>{submitInternalEventV2(null, eventComponent, "view", null, null);}, timeoutSeconds * 1000);
22801			}
22802
22803			_warningBar.showing = definitionId;
22804		}
22805		else {
22806			_warningBar.showNext = function(){appendWarningWOAHbar(definitionId, barClass, messageHtml, firstButtonMessage, secondButtonMessage, buttonClass, rememberClosedState);};
22807
22808		}
22809	}
22810
22811	function autoAcceptCookieConsent() {
22812		const initialDisplayDateKey = "initialCookieDisplayDate";
22813		const storedDate = localStorage.getItem(initialDisplayDateKey);
22814
22815		if (!storedDate) {
22816			localStorage.setItem(initialDisplayDateKey, new Date().toISOString());
22817			return false;
22818		}
22819
22820		const firstDisplayDate = new Date(storedDate);
22821		const now = new Date();
22822		const msElapsed = now - firstDisplayDate;
22823		const autoAcceptDelayMs = 3 * 60 * 60 * 1000;
22824
22825		return msElapsed > autoAcceptDelayMs;
22826	}
22827}
22828
22829function showNextWarningWOAHbar() {
22830	_warningBar.showing = null;
22831	if(_warningBar.showNext) {
22832		var showNext = _warningBar.showNext;
22833		_warningBar.showNext = null;
22834		showNext();
22835	}
22836}
22837/* UK Cookies Warning WOAHbar */
22838function showUKCookiesWarning() {
22839	if(window == top) {
22840		const hasVueBanner = document.querySelector('[id^="base-application-banner"]');
22841		if (cookieConsentRequirementChecker.isCookieConsentRequired() && !hasVueBanner) {
22842			appendCookieConsentBanner();
22843		}
22844	}
22845}
22846
22847// cookie consent bar that stores closed state in local storage and the database
22848function appendCookieConsentBanner() {
22849	const bannerHidingDurationInMinutes = 525960; /* 1 year */
22850	// Displays: This website uses cookies to improve your experience. By clicking OK, you agree that we can store and access cookies on your device. For more information, see our [cookiesLinkStart]Cookies Policy[cookiesLinkEnd] or customize your [cookiePrefsStart]cookie settings[cookiePrefsEnd].
22851	/* 	 */
22852	appendWarningWOAHbar("ukCookies", "wbUKCookies", "This website uses cookies to improve your experience, and to personalise content and ads. For more information, see our <a href=\"/cookies/\" target=\"_blank\">Cookies Policy</a> or customize your <span class=\"cookie-prefs\">cookie settings</span>.",
22853	"Accept", null,  "largeActiveButton", bannerHidingDurationInMinutes, "cookieConsent");
22854}
22855
22856// cookie warning bar that stores closed state in a cookie
22857function appendUKCookiesWarning() {
22858	const countryCode = getCountry();
22859	const isSpanishCountry = countryCode === "MX" || countryCode === "ES";
22860	const secondButtonMessage = isSpanishCountry ? "More" : null;
22861	const bannerHidingDurationInMinutes = 525960; /* 1 year */
22862	// Displays: This site uses cookies to improve your experience. By using this site, you agree that we may store and access cookies on your device. [cookiesLinkStart]View Our Cookie Policy[cookiesLinkEnd]
22863	/* 	 */
22864	appendWarningWOAHbar("ukCookies", "wbUKCookies", "This site uses co
22864okies to improve your experience. By using this site, you agree that we may store and access cookies on your device. <a href=\"/cookies/\" target=\"_blank\">View Our Cookie Policy</a>",
22865	"Accept", secondButtonMessage, "largeActiveButton", bannerHidingDurationInMinutes);
22866}
22867
22868$(document).ready(function() {
22869    showUKCookiesWarning();
22870});
22871/* Maintenance Warning WOAHbar */
22872function showMaintenanceWarning() {
22873	if(window != top || typeof(jQuery) == "undefined") return;
22874   if(typeof(_maintenanceWarning) == "undefined") {
22875		dynamicLoadJS("/common/scripts/maintenanceWarningSettings.js?country="+getCountry()+"&vr="+Math.floor((Math.random() * 100) + 1), false);
22876   }
22877   else if(_maintenanceWarning.enabled && new Date(_maintenanceWarning.warningStart.date + _maintenanceWarning.warningStart.timezone) < new Date() &&  new Date(_maintenanceWarning.warningEnd.date + _maintenanceWarning.warningEnd.timezone) > new Date()) {
22878	  const enableMaintenanceBar = localStorage.getItem("enableMaintenanceBar");
22879	  if (enableMaintenanceBar !== "false") {
22880		 appendMaintenanceWarning();
22881	  }
22882   }
22883}
22884if(typeof(jQuery) != "undefined") {
22885   $(showMaintenanceWarning);
22886}
22887else {
22888   rE(window, "load", showMaintenanceWarning);
22889}
22890function appendMaintenanceWarning() {
22891	var maintenanceStartDate = formatMaintenanceWarningDate(new Date(_maintenanceWarning.maintenanceStart.date), _maintenanceWarning.dateFormat);
22892	var maintenanceStartTime = formatMaintenanceWarningTime(new Date(_maintenanceWarning.maintenanceStart.date), _maintenanceWarning.is24HourFormat);
22893	var maintenanceEndTime = formatMaintenanceWarningTime(new Date(_maintenanceWarning.maintenanceEnd.date), _maintenanceWarning.is24HourFormat);
22894   /*__CONFIG[sitebrand] will be down for scheduled maintenance on [maintenanceStartDate] between [maintenanceStartTime] and [maintenanceEndTime] [timezoneAbbr]."*/
22895   var htmlOut = "LegalContracts will be down for scheduled maintenance on [maintenanceStartDate] between [maintenanceStartTime] and [maintenanceEndTime] [timezoneAbbr].";
22896   htmlOut = htmlOut.replace("[maintenanceStartDate]",maintenanceStartDate);
22897   htmlOut = htmlOut.replace("[maintenanceStartTime]",maintenanceStartTime);
22898   htmlOut = htmlOut.replace("[maintenanceEndTime]",maintenanceEndTime);
22899   htmlOut = htmlOut.replace("[timezoneAbbr]",_maintenanceWarning.timezoneAbbr ? " " + _maintenanceWarning.timezoneAbbr : "");
22900	appendWarningWOAHbar("maintenance", "wbMaintenance", htmlOut, null, null, null, null);
22901}
22902function formatMaintenanceWarningDate(date, dateFormat) {
22903	if(typeof(jQuery) == "function") {
22904      		   return $.datepicker.formatDate(dateFormat ? dateFormat : "MM d, yy", date);
22905      	}
22906	else {
22907		return date.toDateString();
22908	}
22909}
22910function formatMaintenanceWarningTime(date, is24HourFormat) {
22911	var hours = date.getHours();
22912	var ampm = hours >= 12 ? "PM" : "AM";
22913   if(!is24HourFormat) {
22914   	hours = hours == 0 ? 12 : (hours > 12 ? hours - 12 : hours);
22915   }
22916	var minutes = date.getMinutes()+"";
22917	minutes = minutes.length == 1 ? "0"+minutes : minutes;
22918   var country = getCountry();
22919	return hours + (country == "FR" ? "h" : ":") + minutes + (!is24HourFormat ? ampm : "");
22920}
22921
22922/* Adjusts the margin-top upon menu/search open/close for desktop/tablets */
22923function checkWOAHBarMargins(){
22924   if(_warningBar.showing){
22925     if(!isPhone() && screen.width > 767 && window.innerWidth <= 991 && typeof(fluidLayout) != "undefined" && fluidLayout){
22926			$("html").css({"margin-top": $('.woahbar.wbTop').height()});
22927		}
22928   }
22929}
22930/* End Include warningWOAHbars */
22931
22932/* Include yanswers */
22933/**/
22934
22935var moptions = new Array('loadAnswersDesc', 'saveAnswersDesc', 'downloadAnswersDesc', 'saveAnswersDescHTML', 'saveAnswersDescPDF', 'saveAnswersDescWord', 'downloadAnswersDescHTML', 'downloadAnswersDescPDF', 'downloadAnswersDescWord', 'help', 'contact', 'results', 'questions', 'printing', 'editing', 'historyDesc', 'sharingDesc');
22936var mOptStatus = new Array();
22937var tipOpen = false;
22938var _show_tip = true;
22939
22940
22941
22942function postToTarget(url, target) {
22943	if (url != null && (url.toLowerCase().indexOf("payall.xml") >= 0 ||
22944		url.toLowerCase().indexOf("order") >= 0)) {
22945		setSave(false);
22946	}
22947	var f = cf(url, arguments[3]);
22948	var v = arguments[2];
22949	for (var n in v) cfi(f, n, v[n]);
22950	f.target = target;
22951	f.submit();
22952	return false;
22953}
22954
22955
22956function so(o, so) {
22957	mOptStatus[o] = true;
22958	getStyleObject(o).top = (findPosY(so) - 67) + "px";
22959	getStyleObject(o).left = "140px";
22960	for (var i = 0; i < moptions.length; i++) {
22961		setVis(moptions[i], moptions[i] == o);
22962	}
22963	return true;
22964}
22965function ho(o) {
22966	mOptStatus[o] = false;
22967	setTimeout('if(mOptStatus["' + o + '"]!=true) setVis("' + o + '",false)', 400);
22968	return true;
22969}
22970function findPosY(obj) {
22971	var top = 0;
22972	if (obj.offsetParent) {
22973		while (obj.offsetParent) {
22974			top += obj.offsetTop
22975			obj = obj.offsetParent;
22976		}
22977		return top;
22978	} else if (obj.y) return obj.y;
22979}
22980
22981function hidePopWin() {
22982	logMyDocsActivity("Parent: Closing dialog (1).");
22983	$('#divDialog').dialog('close');
22984}
22985
22986function tipWindow(cssClass) {
22987	$('#divTipDialog').dialog('option', 'title', "Saving Answers");
22988	if (typeof (cssClass) != "undefined") $('#divTipDialog').dialog('option', 'dialogClass', cssClass);
22989	$('#divTipDialog').dialog('open');
22990	tipOpen = true;
22991	return false;
22992}
22993var saveAnswersHref = '';
22994function outputOnly(html) {
22995	var htmldom = document.createElement('div');
22996	htmldom.innerHTML = html;
22997	var output = findChildWithID(htmldom, 'outputPage');
22998	if (output)
22999		return replaceCopyright(output.innerHTML);
23000	else
23001		return html;
23002}
23003function replaceCopyright(html) {
23004	if (html.search(/\x0a\xa9/i) > 0)
23005		html = html.replace(/\x0a\xa9/ig, '&copy;');
23006	if (html.search(/\xa9/i) > 0)
23007		html = html.replace(/\xa9/ig, '&copy;');
23008
23009	if (html.search(/\x0a\xa3/i) > 0)
23010		html = html.replace(/\x0a\xa3/ig, '&pound;');
23011	if (html.search(/\xa3/i) > 0)
23012		html = html.replace(/\xa3/ig, '&pound;');
23013
23014	while (html.search(String.fromCharCode(8482)) > 0) {
23015		html = html.replace(String.fromCharCode(8482), '&trade;');
23016	}
23017	/*
23018	if(html.search(String.fromCharCode(8482)) > 0)
23019	html = html.replace(String.fromCharCode(8482), '&trade;');
23020	*/
23021
23022	if (html.search(/\x0a\xa2/i) > 0)
23023		html = html.replace(/\x0a\xa2/ig, '&cent;');
23024	if (html.search(/\xa2/i) > 0)
23025		html = html.replace(/\xa2/ig, '&cent;');
23026
23027
23028	if (html.search(/\x0a\xa5/i) > 0)
23029		html = html.replace(/\x0a\xa5/ig, '&yen;');
23030	if (html.search(/\xa5/i) > 0)
23031		html = html.replace(/\xa5/ig, '&yen;');
23032
23033
23034	if (html.search(/\x0a\xa4/i) > 0)
23035		html = html.replace(/\x0a\xa4/ig, '&curren;');
23036	if (html.search(/\xa4/i) > 0)
23037		html = html.replace(/\xa4/ig, '&curren;');
23038
23039	if (html.search(/\x0a\xae/i) > 0)
23040		html = html.replace(/\x0a\xae/ig, '&reg;');
23041	if (html.search(/\xae/i) > 0)
23042		html = html.replace(/\xae/ig, '&reg;');
23043
23044	if (html.search(/\x0a\xb1/i) > 0)
23045		html = html.replace(/\x0a\xb1/ig, '&plusmn;');
23046	if (html.search(/\xb1/i) > 0)
23047		html = html.replace(/\xb1/ig, '&plusmn;');
23048
23049	if (html.search(/\u2260/i) > 0)
23050		html = html.replace(/\u2260/ig, '&ne;');
23051
23052	if (html.search(/\x0a\xf7/i) > 0)
23053		html = html.replace(/\x0a\xf7/ig, '&divide;');
23054	if (html.search(/\xf7/i) > 0)
23055		html = html.replace(/\xf7/ig, '&divide;');
23056
23057	if (html.search(/\x0a\xd7/i) > 0)
23058		html = html.replace(/\x0a\xd7/ig, '&times;');
23059	if (html.search(/\xd7/i) > 0)
23060		html = html.replace(/\xd7/ig, '&times;');
23061
23062	if (html.search(/\x0a\xbd/i) > 0)
23063		html = html.replace(/\x0a\xbd/ig, '&frac12;');
23064	if (html.search(/\xbd/i) > 0)
23065		html = html.replace(/\xbd/ig, '&frac12;');
23066
23067	if (html.search(/\x0a\xbc/i) > 0)
23068		html = html.replace(/\x0a\xbc/ig, '&frac14;');
23069	if (html.search(/\xbc/i) > 0)
23070		html = html.replace(/\xbc/ig, '&frac14;');
23071
23072	if (html.search(/\x0a\xbe/i) > 0)
23073		html = html.replace(/\x0a\xbe/ig, '&frac34;');
23074	if (html.search(/\xbe/i) > 0)
23075		html = html.replace(/\xbe/ig, '&frac34;');
23076
23077	if (html.search(/\x0a\xb2/i) > 0)
23078		html = html.replace(/\x0a\xb2/ig, '&sup2;');
23079	if (html.search(/\xb2/i) > 0)
23080		html = html.replace(/\xb2/ig, '&sup2;');
23081
23082	if (html.search(/\x0a\xb3/i) > 0)
23083		html = html.replace(/\x0a\xb3/ig, '&sup3;');
23084	if (html.search(/\xb3/i) > 0)
23085		html = html.replace(/\xb3/ig, '&sup3;');
23086
23087	if (html.search(/\x0a\xb6/i) > 0)
23088		html = html.replace(/\x0a\xb6/ig, '&para;');
23089	if (html.search(/\xb6/i) > 0)
23090		html = html.replace(/\xb6/ig, '&para;');
23091
23092	if (html.search(/\x0a\xa7/i) > 0)
23093		html = html.replace(/\x0a\xa7/ig, '&sect;');
23094	if (html.search(/\xa7/i) > 0)
23095		html = html.replace(/\xa7/ig, '&sect;');
23096
23097	if (html.search(/\x0a\xb5/i) > 0)
23098		html = html.replace(/\x0a\xb5/ig, '&micro;');
23099	if (html.search(/\xb5/i) > 0)
23100		html = html.replace(/\xb5/ig, '&micro;');
23101
23102	if (html.search(/\x0a\xd8/i) > 0)
23103		html = html.replace(/\x0a\xd8/ig, '&Oslash;');
23104	if (html.search(/\xd8/i) > 0)
23105		html = html.replace(/\xd8/ig, '&Oslash;');
23106
23107	if (html.search(/\x0a\xba/i) > 0)
23108		html = html.replace(/\x0a\xba/ig, '&ordm;');
23109	if (html.search(/\xba/i) > 0)
23110		html = html.replace(/\xba/ig, '&ordm;');
23111
23112	if (html.search(/\x0a\xab/i) > 0)
23113		html = html.replace(/\x0a\xab/ig, '&laquo;');
23114	if (html.search(/\xab/i) > 0)
23115		html = html.replace(/\xab/ig, '&laquo;');
23116
23117	if (html.search(/\x0a\xbb/i) > 0)
23118		html = html.replace(/\x0a\xbb/ig, '&raquo;');
23119	if (html.search(/\xbb/i) > 0)
23120		html = html.replace(/\xbb/ig, '&raquo;');
23121
23122	if (html.search(/\x0a\xb7/i) > 0)
23123		html = html.replace(/\x0a\xb7/ig, '&middot;');
23124	if (html.search(/\xb7/i) > 0)
23125		html = html.replace(/\xb7/ig, '&middot;');
23126
23127	var re2;
23128	if (html.search(String.fromCharCode(8364)) > 0) {
23129		re2 = new RegExp(String.fromCharCode(8364), "gi")
23130		html = html.replace(re2, "&euro;");
23131	}
23132
23133	if (html.search(String.fromCharCode(8776)) > 0) {
23134		re2 = new RegExp(String.fromCharCode(8776), "gi")
23135		html = html.replace(re2, "&asymp;");
23136	}
23137
23138	if (html.search(String.fromCharCode(8804)) > 0) {
23139		re2 = new RegExp(String.fromCharCode(8804), "gi")
23140		html = html.replace(re2, "&le;");
23141	}
23142
23143	if (html.search(String.fromCharCode(8805)) > 0) {
23144		re2 = new RegExp(String.fromCharCode(8805), "gi")
23145		html = html.replace(re2, "&ge;");
23146	}
23147
23148	if (html.search(String.fromCharCode(8734)) > 0) {
23149		re2 = new RegExp(String.fromCharCode(8734), "gi")
23150		html = html.replace(re2, "&infin;");
23151	}
23152
23153	if (html.search(String.fromCharCode(8240)) > 0) {
23154		re2 = new RegExp(String.fromCharCode(8240), "gi")
23155		html = html.replace(re2, "&permil;");
23156	}
23157
23158	if (html.search(String.fromCharCode(945)) > 0) {
23159		re2 = new RegExp(String.fromCharCode(945), "gi")
23160		html = html.replace(re2, "&alpha;");
23161	}
23162	if (html.search(String.fromCharCode(946)) > 0) {
23163		re2 = new RegExp(String.fromCharCode(946), "gi")
23164		html = html.replace(re2, "&beta;");
23165	}
23166	if (html.search(String.fromCharCode(916)) > 0) {
23167		re2 = new RegExp(String.fromCharCode(916), "gi")
23168		html = html.replace(re2, "&Delta;");
23169	}
23170	if (html.search(String.fromCharCode(937)) > 0) {
23171		re2 = new RegExp(String.fromCharCode(937), "gi")
23172		html = html.replace(re2, "&Omega;");
23173	}
23174	if (html.search(String.fromCharCode(8721)) > 0) {
23175		re2 = new RegExp(String.fromCharCode(8721), "gi")
23176		html = html.replace(re2, "&sum;");
23177	}
23178	if (html.search(String.fromCharCode(8736)) > 0) {
23179		re2 = new RegExp(String.fromCharCode(8736), "gi")
23180		html = html.replace(re2, "&ang;");
23181	}
23182	if (html.search(String.fromCharCode(8226)) > 0) {
23183		re2 = new RegExp(String.fromCharCode(8226), "gi")
23184		html = html.replace(re2, "&bull;");
23185	}
23186	if (html.search(String.fromCharCode(402)) > 0) {
23187		re2 = new RegExp(String.fromCharCode(402), "gi")
23188		html = html.replace(re2, "&fnof;");
23189	}
23190	if (html.search(String.fromCharCode(8225)) > 0) {
23191		re2 = new RegExp(String.fromCharCode(8225), "gi")
23192		html = html.replace(re2, "&Dagger;");
23193	}
23194	if (html.search(String.fromCharCode(8224)) > 0) {
23195		re2 = new RegExp(String.fromCharCode(8224), "gi")
23196		html = html.replace(re2, "&dagger;");
23197	}
23198	return html;
23199}
23200
23201function findChildWithID(node, id) {
23202	if (node.id == id) return node;
23203	else if (node.hasChildNodes()) {
23204		for (var i = 0; i < node.childNodes.length; i++) {
23205			var child = findChildWithID(node.childNodes[i], id);
23206			if (child != null)
23207				return child;
23208		}
23209	}
23210	return null;
23211}
23212
23213function showHistoryYudox(productName, webuserDataId, webuserDataName, webuserDataType, countryCode) {
23214	var type_name = webuserDataType;
23215	if (type_name == 'Working Answers' || !type_name) type_name = 'Initial Answers';
23216	var data_name = (webuserDataName && webuserDataName != 'Untitled') ? webuserDataName : (countryCode ? type_name + ' (' + countryCode + ')' : type_name);
23217	showDialog("Document History" + ": " + data_name + " - " + productName, "/ChangeLog/index.aspx?id=" + webuserDataId, 581, 439);
23218	return false;
23219}
23220
23221function showSharingYudox(productName, webuserDataId, webuserDataName, webuserDataType, countryCode) {
23222	var type_name = webuserDataType;
23223	if (type_name == 'Working Answers' || !type_name) type_name = 'Initial Answers';
23224	var data_name = (webuserDataName && webuserDataName != 'Untitled') ? webuserDataName : (countryCode ? type_name + ' (' + countryCode + ')' : type_name);
23225	showDialog("Share Document" + ": " + data_name, "/Sharing/index.aspx?wdid=" + webuserDataId, 627, 415);
23226	return false;
23227}
23228
23229function showSharingYudox2(param) {
23230	var title = "Share Document";
23231	var qryString = "wdid=" + param;
23232	if (param == "Delegate") {
23233		title = "Invite Shared User";
23234		qryString = "isdelegate=true";
23235	}
23236
23237
23238	showDialog(title, "/Sharing/index.aspx?" + qryString, 732, 572, "plainDialog posFixed");
23239	return false;
23240}
23241
23242function showSharingYudox2Confirmation(productName, parties) {
23243	var divItem = "<div class='shareConfirm'>[content]</div>";
23244	var image = "<div></div>"
23245	var titleMessage = "<div class='title'>" + "Your [ProductName] has been shared with".replace("[ProductName]", productName) + "</div>";
23246	var ulItems = "<ul>[LiItems]</ul>";
23247	var liItems = "";
23248	for (var i = 0; i < parties.length; i++) {
23249		liItems += "<li><strong>" + parties[i].Name + "</strong><span>" + parties[i].Email + "</span></li>";
23250	}
23251
23252	ulItems = ulItems.replace("[LiItems]", liItems);
23253
23254	divItem = divItem.replace("[content]", image + titleMessage + ulItems);
23255	var config = {};
23256	config.includeParagraph = false;
23257	config.cssClass = "sharing-alert";
23258
23259	if (!isPhone()) {
23260		config.width = 732;
23261	}
23262	alert(divItem, config);
23263}
23264
23265function logMyDocsActivity(activity) {
23266	// Uncomment to enable activity logging
23267	//var postData = "logged_data="+escape(activity)+"&log_file="+escape("MyDocs/activity-"+(typeof ip_ad != 'undefined' ? ip_ad : '')+".log")+"";
23268	//httpRequest(postData, "/temp/ajax_logger.php", null, null, false, true);
23269}
23270
23271function saveAnswers2() {
23272	if (!isLoggedIn()) {
23273		showSignInDialog({ directLink: false, url: window.top.location.href, mode: "SignedOutDialog" });
23274		return;
23275	}
23276
23277	saveAnswersHref = "/MyDocuments/index.aspx?view=save&code=" + PC;
23278	if (_show_tip) tipWindow();
23279	else
23280	{
23281		let saveAnswersDialogWidth = isLoggedIn() ? 400 : 500;
23282		showSaveAnswersDialog("Save Answers", saveAnswersHref, saveAnswersDialogWidth, 339, "plainDialog newmydocumentDialog", 0.7);
23283	}
23284}
23285function saveAsHTML2() {
23286	if (!isLoggedIn()) {
23287		showSignInDialog({ directLink: false, url: window.top.location.href, mode: "SignedOutDialog" });
23288		return;
23289	}
23290	showDialog("Save Document As HTML", "/MyDocuments/index.aspx?view=saveDoc&code=" + PC + "&format=html", 400, 339, 'plainDialog newmydocumentDialog', 0.7);
23291}
23292function saveAsWord2() {
23293	if (!isLoggedIn()) {
23294		showSignInDialog({ directLink: false, url: window.top.location.href, mode: "SignedOutDialog" });
23295		return;
23296	}
23297	showDialog("Save Document As Word", "/MyDocuments/index.aspx?view=saveDoc&code=" + PC + "&format=doc", 400, 339, 'plainDialog newmydocumentDialog', 0.7);
23298}
23299
23300function saveAsRTF2() {
23301	if (!isLoggedIn()) {
23302		showSignInDialog({ directLink: false, url: window.top.location.href, mode: "SignedOutDialog" });
23303		return;
23304	}
23305	showDialog("Save Document As RTF", "/MyDocuments/index.aspx?view=saveDoc&code=" + PC + "&format=rtf", 400, 339, 'plainDialog newmydocumentDialog', 0.7);
23306}
23307
23308function saveAsPDF2() {
23309	showDialog("Save Document As PDF", "/MyDocuments/index.aspx?view=saveDoc&code=" + PC + "&format=pdf", 400, 339, 'plainDialog newmydocumentDialog', 0.7);
23310}
23311
23312function showSignedOutModal() {
23313	if (typeof jQuery != "undefined") {
23314		if ($('#signedOutDiv').length == 0) {
23315			/**/
23316
23317			$('body').append('<div id="signedOutDiv">You cannot complete that action while signed out. Please <a href="/SignIn/" style="color:#22a">click here</a> to sign in.</div>');
23318		}
23319		$('#signedOutDiv').dialog({ title: 'Signed Out', modal: true });
23320	}
23321	else {
23322		alert('You cannot complete that action while signed out. Please refresh the page then click \"Sign In\" at the top right to sign in.');
23323	}
23324}
23325
23326function printPDF(queryString) {
23327	trackEvent('Print');
23328	if (typeof (WebuserDataInfo) !== "undefined") WebuserDataInfo.AddEvent("print");
23329
23330	var extraQString = getExtraQString().split('&');
23331	var splitQString = queryString.split('&');
23332
23333	var combinedQString = queryString;
23334
23335	// Values from the passed in query string take priority over anything from the extraQString function.
23336	for (var i = 0; i < extraQString.length; ++i) {
23337		var splitVal = extraQString[i].split('=');
23338		// Make sure there's nothing in the query string already with this name.
23339		if (splitVal[0] !== '' && !splitQString.some(function (val) { return val.indexOf(splitVal[0] + '=') === 0; })) {
23340			combinedQString += combinedQString.endsWith('&') ? extraQString[i] : '&' + extraQString[i];
23341		}
23342	}
23343
23344	// The Android stock browser has errors with downloads that are triggered via POST, so make sure this remains a GET.
23345	if ("application/pdf" in navigator.mimeTypes || cssua.ua.ios) {
23346		window.open('displaypdf.aspx?' + combinedQString, "_blank");
23347	}
23348	else {
23349		window.open("displaypdf.aspx?save=true&" + combinedQString);
23350	}
23351}
23352
23353function trackEvent(eventAction) {
23354	var eventName = "Preview";
23355	var eventCategoryGA = "Preview Page";
23356	if (window.location.pathname.toLowerCase().indexOf('/lawdepoteditor/') != -1) {
23357		eventName = "Editor";
23358		eventCategoryGA = "Editor";
23359	}
23360	submitInternalEvent(eventAction, eventName, "");
23361	submitGAEvent(eventAction, null, null, eventCategoryGA, false);
23362}
23363
23364var saveDocumentServiceLocation = "/contracts/SaveDoc/index.aspx";
23365function getHtmlDocLocation(usePhpPreview) {
23366	if (typeof usePhpPreview !== "undefined" && usePhpPreview) {
23367		return "preview.php";
23368	}
23369	return !useDisplayHTML() ? "preview.aspx" : "displayhtml.aspx";
23370}
23371
23372function useDisplayHTML() {
23373	return !(typeof (dcsVersion) == "undefined");
23374}
23375
23376function getOutputTemplate() {
23377	return (typeof (outputTemplate) != "undefined" ? outputTemplate : "");
23378}
23379
23380function getOutputTemplateQuery() {
23381	return (typeof (outputTemplate) != "undefined" ? "outputTemplate=" + outputTemplate + "&" : "");
23382}
23383
23384/**
23385 * Gets additional query string parameters that should be preserved when moving between dcs pages
23386 * @return {string} Either a blank string if no extra parameters were specified, or a valid query string partial starting with '&'
23387 */
23388function getExtraQString() {
23389	return Sequiter.QueryString.GetPersistedQueryStringValues();
23390}
23391
23392/*For the LimitFeatures experiment to restrict features for free trials*/
23393var _restrictTrialFeatures = false;
23394function openRestrictedFeaturesDialog(featureName) {
23395	/*tracking*/
23396	submitTrackedEvent('View Dialog', featureName, featureName, 'Restricted Trial');
23397	/*open dialog*/
23398	var dialogTitle = ''
23399	if (featureName == 'Word' || featureName == 'RTF' || featureName == 'HTML') {
23400		dialogTitle = 'Download as ' + featureName + ' when you upgrade';
23401	} else if (featureName == 'Editor') {
23402		dialogTitle = 'Use the Editor when you upgrade';
23403	}
23404	showDialog(dialogTitle, '/LimitFeaturesDialog.php?feature=' + featureName, 600, 400, "plainDialog");
23405}
23406
23407
23408/*SaveAs HTML/Word/RTF depending on file type*/
23409function saveAs(fileType, fileName, download, isSignInRequired, htmlCallback, docID, usePhpPreview, webuserDataId) {
23410
23411	/* Is Signed in check*/
23412	isSignInRequired = typeof isSignInRequired == "undefined" ? true : isSignInRequired;
23413	if (!isSignInRequired) { suppressBeforeUnload = true; }
23414
23415	if (isSignInRequired && fileType.toLowerCase() !== "pdf" && (typeof (window.UID) === 'undefined' || window.UID == null || window.UID == "")) {
23416		showSignInDialog({ directLink: false, url: window.top.location.href, mode: "SignedOutDialog" });
23417		return false;
23418	}
23419
23420	/* START: Variables declaration, default is set for HTML,
23421		 NOTE: Don't translate the variable name ending with Param
23422	*/
23423	var restrictedParam = "HTML";
23424	var logDownloadParam = "Download as HTML";
23425	var logSaveParam = "Save as HTML";
23426	var savingMessage = "Saving Document as HTML...";
23427	var windowName = "formvalueHtml";
23428	var hashLink = "";
23429	var prodTech = "";
23430	var contractType = "";
23431
23432
23433	if (typeof productTechnology != "undefined" && productTechnology.length > 0) {
23434		if (productTechnology.indexOf("DCS") != -1 || productTechnology.indexOf("yudox") != -1)
23435			contractType = "&type=aspnet";
23436		prodTech = "&technology=" + productTechnology;
23437	}
23438
23439	/* Setup querystring  */
23440	var extraQString = "";
23441	if (typeof getQueryStringValue === "function") {
23442		extraQString += getExtraQString();
23443		extraQString += docID ? "&docID=" + docID : "";
23444		hashLink = (getQueryStringValue("l") && !isSignInRequired) ? getQueryStringValue("l") : "";
23445	}
23446
23447	if (!htmlCallback) {
23448		htmlCallback = (typeof usingLDEditor == "undefined" || !usingLDEditor) ? displaySuccess : saveAsHTMLCompleteEditor;
23449	}
23450
23451	switch (fileType.toLowerCase()) {
23452		case "doc":
23453			restrictedParam = "Word";
23454			logDownloadParam = "Download as Microsoft Word";
23455			logSaveParam = "Save as Microsoft Word";
23456			savingMessage = "Saving Document as Word ...";
23457			windowName = "formvalueDoc";
23458			break;
23459
23460		case "rtf":
23461			if (cssua.ua.mobile && cssua.ua.ios) {
23462				alert("RTF is not supported on iOS. Please use a different device to download this document in RTF format.", { title: "Error" });
23463				return false;
23464			}
23465			restrictedParam = "RTF";
23466			logDownloadParam = "Download as RTF";
23467			logSaveParam = "Save as RTF";
23468			savingMessage = "Saving Document as RTF ...";
23469			windowName = "formvalueRtf";
23470			break;
23471
23472		case "pdf":
23473			restrictedParam = "PDF";
23474			logDownloadParam = "Download as PDF";
23475			logSaveParam = "Save as PDF";
23476			savingMessage = "Saving Document as PDF ...";
23477			htmlCallback = (typeof usingLDEditor != "undefined" && usingLDEditor) ? displaySuccess : htmlCallback;
23478			windowName = "formvaluePdf";
23479			break;
23480	}
23481
23482	/* END: variable declaraiton and setup */
23483
23484	var callbackParams = {};
23485	callbackParams.fileName = fileName ? fileName : null;
23486	callbackParams.fileType = fileType;
23487	callbackParams.sharedHashLink = hashLink;
23488	callbackParams.saveDocLocation = saveDocumentServiceLocation;
23489	callbackParams.productUrl = PU;
23490	callbackParams.outputTempate = getOutputTemplate();
23491	callbackParams.outputTempateQuery = getOutputTemplateQuery();
23492	callbackParams.windowName = windowName;
23493	callbackParams.prodTech = prodTech;
23494	callbackParams.htmlCallback = htmlCallback;
23495	callbackParams.contractType = contractType;
23496	callbackParams.countryCode = getCountry();
23497	callbackParams.regionCode = getRegion();
23498	callbackParams.criteria = getCriteria();
23499	callbackParams.productCode = PC;
23500	callbackParams.additionalPrintCSS = (typeof (additionalPrintCSS) != "undefined" && additionalPrintCSS ? "&additionalPrintCSS=" + escape(additionalPrintCSS) : "");
23501	callbackParams.download = (typeof download == "undefined" ? false : download) || !callbackParams.fileName; /* If name doesn't exists or download is true then download the file.Note: For Editor we want to download file with saved name. */
23502	callbackParams.webuserDataId = webuserDataId;
23503
23504	/* Restricted feature */
23505	if (fileType.toLowerCase() !== "pdf") {
23506		if (_restrictTrialFeatures) {
23507			openRestrictedFeaturesDialog(restrictedParam);
23508			return false;
23509		}
23510	}
23511
23512	/* Trace Event */
23513	if (!fileName) {
23514		trackEvent(logDownloadParam);
23515		if (typeof (WebuserDataInfo) !== "undefined") WebuserDataInfo.AddEvent("download");
23516	}
23517	else {
23518		trackEvent(logSaveParam);
23519	}
23520
23521	if (callbackParams.download && fileType.toLowerCase() !== 'pdf' && (cssua.ua.ios || (cssua.ua.safari && cssua.ua.mac_os_x)))
23522		newWinForDownloadIOS = window.open("", windowName);
23523
23524
23525	/* Editor/PHP  portions of download/save  */
23526	if ((typeof dcsVersion == "undefined" && getObject("outputPage")) || (typeof (usingLDEditor) != "undefined" && usingLDEditor)) {
23527		saveFinal(getObject("outputPage").innerHTML, callbackParams);
23528	}
23529	/* DCS and PHP portions of download/save */
23530	else {
23531		if (fileType.toLowerCase() == 'pdf') {
23532			if (callbackParams.fileName)
23533				httpRequest('', "displaypdf.aspx?download=false&filename=" + encodeURIComponent(callbackParams.fileName) + getExtraQString(), null, null, displaySuccess, true);
23534			else if (cssua.ua.ios)
23535				window.open("displaypdf.aspx?" + getExtraQString(), "_blank");
23536			else
23537				window.open("displaypdf.aspx?save=true" + getExtraQString());
23538		} else {
23539			if (!callbackParams.download) {
23540				showMessage('Please Wait');
23541			}
23542
23543			var callbackFuncToFetchHtml = function (req, ind, suc) { htmlFetched(req, ind, suc, callbackParams) };
23544			var xmlData = "parent=yes&visited=true&SID=" + SID;
23545
23546			if ((typeof usePhpPreview !== "undefined" && usePhpPreview)) {
23547				xmlData += "&variablestring=" + escape(createVarString());
23548			} else if (!useDisplayHTML()) {
23549				xmlData += "&variablestring=" + escape(tempstring);
23550			}
23551
23552			httpRequest(xmlData, getHtmlDocLocation() + "?loc=" + dbcountry + extraQString, getObject("content"), null, callbackFuncToFetchHtml, true);
23553		}
23554	}
23555}
23556
23557/* Finally Save the answer*/
23558function saveFinal(html, params) {
23559	if (html) {
23560		html = outputOnly(html);
23561		var enc_html = encodeURIComponent(html);
23562		var enc_filename = params.fileName;
23563		if (enc_filename) enc_filename = encodeURIComponent(params.fileName);
23564		/* Download portion */
23565		if (params.download) {
23566			var url = params.saveDocLocation + "?download=true" + params.contractType;
23567			var useInline = (params.fileType == "html" && cssua.ua.android && cssua.ua.chrome) ? true : false;
23568			var data = { 'outputTemplate': params.outputTempate, 'contract': params.productUrl, 'html': enc_html, 'format': params.fileType, 'filename': enc_filename, 'download': true, 'l': params.sharedHashLink, 'useInline': useInline }
23569
23570			if (cssua.ua.ios || (cssua.ua.safari && cssua.ua.mac_os_x)) {
23571				postToTarget(url, params.windowName, data);
23572			}
23573			else {
23574				postTo(url, data);
23575			}
23576		}
23577		/* Save portion */
23578		else {
23579
23580			var xmlData = params.outputTempateQuery + 'contract=' + params.productUrl + '&html=' + escape(enc_html) + '&format=' + params.fileType + params.contractType + "&productCode=" + PC + "&countryCode=" + params.countryCode + "&regionCode=" + params.regionCode + "&criteria=" + params.criteria + params.additionalPrintCSS + (params.webuserDataId ? "&webuser_data_id=" + params.webuserDataId : "");
23581			httpRequest(xmlData, params.saveDocLocation + "?download=false&filename=" + escape(enc_filename) + params.prodTech, null, null, params.htmlCallback, true);
23582		}
23583	}
23584	else {
23585		alert("Could not retrieve document.");
23586	}
23587}
23588
23589/* Save as done, callback function */
23590function htmlFetched(req, ind, suc, params) {
23591	if (ind && ind.parentNode) ind.parentNode.removeChild(ind);
23592
23593	if (suc) {
23594		saveFinal(req.responseText, params);
23595	}
23596	else {
23597		hideMessage();
23598		alert("There was a problem saving your document (" + req.status + ": " + req.statusText + ")");
23599	}
23600}
23601
23602/* Add to EstateVault and Redirect to Estate Dashboard page*/
23603function AddToEstateVault(override) {
23604	submitTrackedEvent("click", null, PC, "Callout Banner - Estate Dashboard", false);
23605
23606	override = typeof override == "undefined" ? 0 : override;
23607
23608	var successCallback = function (res) {
23609		hideMessage();
23610		if (res.Status == "Conflict") {
23611			var html = "<p>" + res.ErrorMessage + "</p><div><a class='largeActiveButton' onclick='AddToEstateVault(1);'>REPLACE</a><a class='largeInactiveButton' onclick=\"closeDialog('divInlineDialog');\">CANCEL</a></div></div>";
23612			var config = { cssClass: "EDConfirmDialog" };
23613			showInlineDialog(html, "Replace Document", null, config);
23614		} else if (res.Status == "SignedOut") {
23615			showSignInDialog('signin', false, true, window.top.location.href, false, true);
23616		} else {
23617			document.location.href = "/estatedashboard/";
23618		}
23619	};
23620
23621	var errorCallback = function (res) {
23622		alert(res.Status);
23623	};
23624	showMessage("Loading");
23625	new EstateDashboardItemTileService().Add(wdid, null, PC, override, successCallback, errorCallback);
23626}
23627/* End Include yanswers */
23628
23629/* Include recategorization */
23630function recategorizationToggleToShowAll(){    
23631    var toggleAtag = $(".sm .recategorizationToggleButton").children('a');
23632    if(toggleAtag.hasClass("collapse"))
23633    {
23634        var elements = $(".sm .smRecategorizationDisplay");                
23635        elements.removeClass('smRecategorizationDisplay');
23636        elements.addClass('smRecategorizationDisplay_Tracker');                    
23637        toggleAtag.removeClass("collapse").html("Show Less <span>-</span>");
23638    }
23639    else{
23640        var elements = $(".sm .smRecategorizationDisplay_Tracker");                
23641        elements.removeClass('smRecategorizationDisplay_Tracker');
23642        elements.addClass('smRecategorizationDisplay');                    
23643        toggleAtag.addClass("collapse").html("Show More <span>+</span>");
23644
23645    }
23646
23647    return false;
23648}   
23649
23650function recategorizationBackToTop(){
23651    var height;
23652    if($('.wbTop').length)
23653        height = $('.wbTop').height(); 
23654    else
23655        height = 0;
23656
23657    $('html, body').animate({scrollTop:$('#wrapper').offset().top - height}, 500);
23658    return false;
23659}
23660/* End Include recategorization */
23661
23662/* Include multiUserQuestionnaire */
23663/**
23664 * All JavaScript related to the Multi-User Questionnaire workflow. Where customers can invite others to complete
23665 * certain portions of specially designed contracts.
23666 */
23667
23668/**
23669 * A wrapper for the gatekeeper sections onClick method for the Save and Continue button.
23670 * Warns the user of the consequences of stating they want to invite others, and provides and opportunity to return to
23671 * change their responses before continuing
23672 * 
23673 * @param originalOnClick a callback that should perform the original onClick action.
23674 */
23675function gatekeeperOnClickWrapper(originalOnClick) {
23676    if ($('[name="ctl00$Content$ctrlQuestions$ctl07$ctl03$ctl02"]:checked').val() == 'yes') {
23677        confirmDialog("You've chosen to let LawDepot help you collect responses from other people. When you continue, you'll have a chance to send an email or link to others who can start filling out your form. If later you want to change the document, you may need to create a new document or have your recipients fill out the document again. Are you ready to invite others now?",
23678            {
23679                title: "Just to make sure...",
23680                yesText: "Yes, I'm finished",
23681                noText: "No, I need to change my answers",
23682                callback: function (readyToInvite) {
23683                    if (readyToInvite) {
23684                        originalOnClick();
23685                    }
23686                },
23687            }
23688        );
23689    } else {
23690        originalOnClick();
23691    }
23692}
23693
23694/**
23695 * Check if active invitations exist for this document, and get additional confirmation from the user on what should happen to them before edits are made
23696 * @param {function} callback function to execute if the user confirms they wish to make edits
23697 */
23698function checkActiveInvites(callback) {
23699    if (
23700    	isModified() 
23701		&& WebuserDataInfo.Multiuser != null
23702		&& (WebuserDataInfo.Multiuser.invitations.inProgress > 0 || WebuserDataInfo.Multiuser.invitations.submitted > 0)) {
23703    	// Four possible dialog options
23704		// 1. No one has submitted yet, everyone is in progress
23705		// 2. Both in progress and submitted documents exist
23706		// 3. Nothing is in progress, but submitted and unstarted documents exist
23707		// 4. Everything has been submitted
23708		
23709		// Possible choices in the dialog
23710		const DIALOG_OPTIONS = {
23711			OK: "0", // Keep edits, continue on without other actions
23712			NEW_DOC: "1", // Create a new document instead of editing
23713			CANCEL_INVITATIONS: "2", // Save edit, cancel in progress invitations
23714		}
23715		
23716		const SHARED_TRANSLATIONS = {
23717			CANCEL_OR_MAKE_NEW: "Do you want to cancel your invitations or create a new document?",
23718			MUST_INVITE_AGAIN: "You must invite recipients again if you want them to fill out an updated document."
23719		}
23720		
23721		var dialogBody;
23722		var dialogButtons = [];
23723		// Only inprogress documents exist
23724		if(WebuserDataInfo.Multiuser.invitations.submitted === 0){
23725			// Pick the correct translation based on if we have a plural number of recipients
23726			var translation = WebuserDataInfo.Multiuser.invitations.inProgress === 1
23727				? "One recipient is filling out this document."
23728				: formatString("{0} recipients are filling out this document.", changeCase(WebuserDataInfo.Multiuser.invitationsLocalized.inProgress, "upperCase", "first"))
23729			dialogBody = "<p>" 
23730				+ translation
23731				+ "</p><p>"
23732				+ SHARED_TRANSLATIONS.CANCEL_OR_MAKE_NEW
23733				+ "</p>";
23734			dialogButtons.push({
23735				text: "New Document",
23736				value: DIALOG_OPTIONS.NEW_DOC,
23737				className: "largeActiveButton"
23738			});
23739			dialogButtons.push({
23740				text: "Cancel Invitations",
23741				value: DIALOG_OPTIONS.CANCEL_INVITATIONS,
23742				className: "largeInactiveButton"
23743			});
23744		}
23745		// Both in progress and submitted documents exist
23746		else if (WebuserDataInfo.Multiuser.invitations.inProgress > 0 && WebuserDataInfo.Multiuser.invitations.submitted > 0){
23747			// Pick the correct translations based on if we have a plural number of recipients for each type
23748			var translationInProgress = WebuserDataInfo.Multiuser.invitations.inProgress === 1
23749				? "One recipient is filling out this document"
23750				: formatString("{0} recipients are filling out this document", changeCase(WebuserDataInfo.Multiuser.invitationsLocalized.inProgress, "upperCase", "first"))
23751			var translationSubmitted = WebuserDataInfo.Multiuser.invitations.submitted === 1
23752				? " and one copy has been submitted."
23753				: formatString(" and {0} copies have been submitted.", WebuserDataInfo.Multiuser.invitationsLocalized.submitted)
23754			dialogBody = "<p>"
23755				+ translationInProgress 
23756				+ translationSubmitted
23757				+ "</p><p>"
23758				+ SHARED_TRANSLATIONS.CANCEL_OR_MAKE_NEW
23759				+ "</p>";
23760			dialogButtons.push({
23761				text: "New Document",
23762				value: DIALOG_OPTIONS.NEW_DOC,
23763				className: "largeActiveButton"
23764			});
23765			dialogButtons.push({
23766				text: "Cancel Invitations",
23767				value: DIALOG_OPTIONS.CANCEL_INVITATIONS,
23768				className: "largeInactiveButton"
23769			});
23770		}
23771		// Submitted documents and not started documents exist
23772		else if (WebuserDataInfo.Multiuser.invitations.notStarted > 0){
23773			dialogBody = "<p>"
23774				+ "Any changes will not affect submitted documents."
23775				+ "</p><p>"
23776				+ SHARED_TRANSLATIONS.MUST_INVITE_AGAIN
23777				+ "</p>";
23778			dialogButtons.push({
23779				text: "Ok",
23780				value: DIALOG_OPTIONS.OK,
23781				className: "largeActiveButton"
23782			})
23783		}
23784		else{
23785			// Everything has been submitted
23786			dialogBody = "<p>"
23787				+ "All recipients have filled out this document."
23788				+ "</p><p>"
23789				+ SHARED_TRANSLATIONS.MUST_INVITE_AGAIN
23790				+ "</p>";
23791			dialogButtons.push({
23792				text: "Ok",
23793				value: DIALOG_OPTIONS.OK,
23794				className: "largeActiveButton"
23795			})
23796		}
23797		
23798		confirmDialog(dialogBody,
23799			{
23800				includeParagraph: false,
23801				buttons: dialogButtons,
23802				title: "Shared Document",
23803				cssClass: "activeInvitesWarning",
23804				callback: function (chosenOption) {
23805					if(chosenOption === DIALOG_OPTIONS.CANCEL_INVITATIONS){
23806						Sequiter.Services.MultiuserService.InvalidateInProgress(WebuserDataInfo.id)
23807							.then(function (resp) {
23808								WebuserDataInfo.Multiuser.invitations.inProgress = 0;
23809								alert("All in progress invitations have been cancelled. To send new invitations, click Print/Download.", {
23810									title: "Invitations Canceled",
23811									cssClass: "invitationsCancelledAlert"
23812								});
23813								// The invites were cancelled and we can continue
23814								callback();
23815							});
23816					}
23817					else if (chosenOption === DIALOG_OPTIONS.NEW_DOC){
23818						// We will create a new doc and navigate there, we should not continue on in this questionnaire.
23819						newAnswerDialog(getCurrentProductCode())
23820					} else {
23821						// Owner was warned and no action was decided on.
23822						callback();
23823					}
23824				}
23825			})
23826    }
23827    else {
23828    	callback();
23829	}
23830}
23831
23832/**
23833 * Call this method to inform the user that invitations have been sent
23834 * 
23835 * @param recipients {Array} Array of objects with names and emails.
23836 */
23837function alertInvitesSent(recipients) {
23838	var content = "<div class='icon'></div><p>An invitation has been sent to:</p><ul>";
23839	if (Array.isArray(recipients)) {
23840		for (var i = 0; i < recipients.length; ++i) {
23841			content += "<li><span class=\"name\">" + recipients[i].Name + "</span><span class=\"email\">" + recipients[i].Email + "</span></li>"
23842		}
23843	}
23844	content += "</ul>";
23845	confirmDialog(content, {
23846		includeParagraph: false,
23847		title: "Success!",
23848		yesText: "MANAGE RECIPIENTS",
23849		noText: "CLOSE",
23850		cssClass: "multiuserInvitesSentDialog InvitesSentDialog",
23851		callback: function (openRecipientsDialog) {
23852			if (openRecipientsDialog) {
23853				viewStatusOfChildDocuments(WebuserDataInfo.id);
23854			}
23855		}
23856	})
23857}
23858
23859/**
23860 * onClick handler for the open invitation 'copy link' button
23861 */
23862function openInviteLinkButton_OnClick() {
23863    // Automatically copy the text to their clipboard.
23864    $(".multiuser-OpenInvite input").trigger("select");
23865    document.execCommand("copy");
23866    
23867    // Add classes, change imagery, and show a toast so users know they have clicked
23868	$(".multiuser-OpenInvite .link-icon").addClass('activated');
23869	$(".multiuser-OpenInvite .link-icon img").attr('src', "/images/multiUserQuestionnaire/2x_CopyLink_Copied.png?v=3");
23870	Sequiter.Utility.toast("Copied", $(".multiuser-OpenInvite .copy-link-button"));
23871}
23872
23873/**
23874 * Displays a warning for owners that are viewing a multiuser child copy of an original document they created. Informs them
23875 * they are about to fill out this document as a recipient and provides a convenience link to manage the parent document instead.
23876 * Uses cookies to only warn once per browser session.
23877 * @param parentLink {string} the link to the preview page for the parent document.
23878 */
23879function displayOwnerViewingAsRecipientWarning(parentLink){
23880    // Checks the cookie to see if during this session the viewer has been warned already
23881    var seenHashes = (getCookie("multiUser-ownerViewedAsRecipient") || "").split(",");
23882	for (var i = 0; i < seenHashes.length; ++i){
23883        if(seenHashes[i] === currentLinkHash()) {
23884            return;
23885        }
23886    }
23887    
23888    confirmDialog("Do you want to view it as a recipient or manage it?", {
23889        title: "You're the owner of this document",
23890        yesText: "MANAGE",
23891        noText: "VIEW AS RECIPIENT",
23892        cssClass: "ownerWarningDialog",
23893        callback: function(goToPreviewPage){
23894            if(goToPreviewPage){
23895                window.location.href = parentLink;
23896            }
23897        }
23898    })
23899    setCookie("multiUser-ownerViewedAsRecipient", 
23900        (getCookie("multiUser-ownerViewedAsRecipient") || "") + currentLinkHash() + ",", 
23901        0);
23902}
23903
23904/**
23905 * If landing on a page with an id in the query string parameter "openRecipientManagementDialog", open the dialog for that ID.
23906 * Also, remove that from the query string so refreshing the page won't open the dialog again.
23907 */
23908onJsReady(function () {
23909	$(document).ready(function () {
23910		var id = parseNum(getQueryStringValue("openRecipientManagementDialog"));
23911		if (id > 0) {
23912			pushState(null, null, updateQueryStringParameter(window.location.search, "openRecipientManagementDialog", null), true);
23913			viewStatusOfChildDocuments(id, vh.G('__UseESignature'));
23914		}
23915	});
23916});
23917
23918/**
23919 * Returns the link hash currently used to access this document.
23920 * null if there is no link hash.
23921 */
23922function currentLinkHash(){
23923    var match = window.location.search.match(/[?&]l=([A-Za-z0-9]*)/);
23924    if(match != null){
23925        return match[1];
23926    }
23927    return null;
23928}
23929
23930/**
23931 * Opens a dialog that displays all the child documents with their latest statuses and possible actions to take on them.
23932 * @param webuserDataId {int} The webuser_data_id for the document you wish to view the status of child documents for.
23933 * @param eSignAvailable {boolean} If the webuser_data_id could possibly use esign, for providing better labels. Not all callers can accurately determine this value (e.g. my documents), so this value should not be used for critical logic.
23934 */
23935function viewStatusOfChildDocuments(webuserDataId, eSignAvailable) {
23936	var dialog = showInlineDialog("<div id='multiuserRecipientsApp'><p>Loading...</p></div>",
23937		"Manage Recipients",
23938		null,
23939		{
23940			cssClass: "multiuserChildDocumentsDialog",
23941		}
23942	);
23943
23944	// Remove jQuery UI's default typical dimension settings, so that they can be specified manually in css
23945	dialog
23946		.css("minHeight", "")
23947		.css("height", "")
23948		.css("width", "")
23949		.css("maxHeight", "")
23950		.css("minWidth", "")
23951		.css("maxWidth", "");
23952	reCenterDialog(dialog.get(0).id);
23953
23954	// Check if the browser supports ResizeObserver before trying to use it
23955	if(typeof ResizeObserver === "function"){
23956		// Recenter the dialog anytime the dialog changes size
23957		var ro = new ResizeObserver(function(entries) {
23958			reCenterDialog(dialog.get(0).id)
23959		});
23960		ro.observe(dialog.get(0));
23961	}
23962
23963	$.get("/contracts/RecipientManagementDialog/",
23964		function (response) {
23965			// Get just the contents of the body tag in the response and insert that HTML.
23966			var bodyStart = response.indexOf("<body");
23967			bodyStart = response.indexOf(">", bodyStart) + 1;
23968			var bodyEnd = response.indexOf("</body");
23969			$("#multiuserRecipientsApp").html(response.substring(bodyStart, bodyEnd));
23970			// Provide external data required by the app to run
23971			window.RecipientManagementDialog.webuserDataId = webuserDataId;
23972			window.RecipientManagementDialog.eSignAvailable = eSignAvailable;
23973		}
23974	)
23975}
23976
23977/**
23978 * Submits the current multiuser child document to the parent document's owner.
23979 * Locks the document so that the answer set can no longer be changed.
23980 * If eSign is available, this function should also cause the document to become signed by the Recipient.
23981 */
23982function submitChildDocumentToOwner() {
23983	// Use event system to mark document as submitted.
23984	WebuserDataInfo.AddEvent("multiuser:Submitted", true, currentLinkHash());
23985	// Schedule the email notification for the owner.
23986	Sequiter.Services.MultiuserService.Submit(WebuserDataInfo.id, currentLinkHash());
23987	alert("Your application has been sent.", { iconClass: 'muq-icon-request_sent' });
23988}
23989
23990/**
23991 * Handler for when a multiuser child document has been viewed
23992 */
23993function onMultiuserChildViewed(){
23994	WebuserDataInfo.AddEvent('multiuser:Viewed', true, currentLinkHash());
23995}
23996
23997/**
23998 * Start the esignature process on a multiuser document.
23999 * This records a different tracking event, but otherwise starts the esignature process normally.
24000 */
24001function startESignatureMultiuser(){
24002	startESignatureTrack("start-multiuserRecipient");
24003}
24004
24005/**
24006 * If a redirect exists in the query string follow it
24007 * returns true or false depending if a default redirect exists
24008 * @param {Function} beforeRedirecting (optional) A function to call before redirecting.
24009 */
24010function followDefaultRedirect(beforeRedirecting) {
24011	var redirect = getQueryStringValue('redirect', true);
24012	if (typeof(redirect) !== "undefined" && redirect !== null) {
24013		if (typeof (beforeRedirecting) === "function") beforeRedirecting();
24014		window.location.href = redirect;
24015	}
24016}
24017
24018/**
24019 * Follow the default redirect and set the welcomed cookie to 1 to indicate that the welcome page has been viewed
24020 */
24021function followWelcomeRedirect() {
24022
24023	followDefaultRedirect(function () {
24024		if (localStorage.getItem('welcomed') !== '3') { // a value of 3 means that it will always show the welcome page, used to aid with testing/development
24025			localStorage.setItem('welcomed', '1'); // Ideally this should be an integer but at least some implementations of local storage only support strings so we'll go with that at least for now.
24026		}
24027	});
24028}
24029
24030/**
24031 * If the user has already seen the welcome page (welcomed cookie is 1) then instantly redirect
24032 * This will run when the welcome page first loads 
24033 */
24034function followWelcomeRedirectOnLoad() {
24035	if (localStorage.getItem('welcomed') === '1') {
24036		followWelcomeRedirect();
24037	}
24038}
24039
24040/**
24041 * Creates a dialog warning the current inviter that some party names may not be filled, and offers to take the user to the page of the questionnaire
24042 * that would let them fill out that those party names, or just continue with blanks. see warnBlankPartiesESignature(...)
24043 * @param {bool} isCreator If the person being warned is the creator of the document (supporting more specific translations)
24044 * @param {int} numParties The number of parties that are still blank that this inviter has control over
24045 * @param {string} redirectQuestionGroupId The id of the first question group that has blank esignature information and is under this inviter's responsibility
24046 * @param {function} continueCallback What to do if the user decides to ignore the warning and continue anyway
24047 */
24048function warnBlankPartiesMultiuserESignature(isCreator, numParties, redirectQuestionGroupId, continueCallback){
24049	var text;
24050	var redirectOptionText;
24051	var title;
24052	if(numParties == 1){
24053		redirectOptionText = "Enter Party Name";
24054		title = "Missing Name";
24055		if(isCreator){
24056			text = "Your document is missing the name of 1 party. Your document might appear incomplete with a missing name. Are you sure you want to proceed with sending invitations?";
24057		} else {
24058			text = "Your response is missing the name of 1 party. Your document might appear incomplete with a missing name. Are you sure you want to sign?";
24059		}
24060	}
24061	else {
24062		redirectOptionText = "Enter Party Names";
24063		title = "Missing Names";
24064		if(isCreator){
24065			text = "Your document is missing the names of [numParties] parties. Your document might appear incomplete with missing names. Are you sure you want to proceed with sending invitations?".replace("[numParties]", numParties.toString());
24066		} else {
24067			text = "Your response is missing the names of [numParties] parties. Your document might appear incomplete with missing names. Are you sure you want to sign?".replace("[numParties]", numParties.toString());
24068		}
24069	}
24070	confirmDialog(text, {
24071		yesText:redirectOptionText,
24072		noText: isCreator ? "Send invitations" : "Sign document",
24073		title:title,
24074		callback: function(redirect){ 
24075			if(redirect) qnh.GotoGroup(redirectQuestionGroupId);
24076			else continueCallback(); 
24077		},
24078		cssClass: "ESignatureMissingNames"
24079	});
24080}
24081/* End Include multiUserQuestionnaire */
24082
24083/* Include badges */
24084var badgeNameMap = {
24085	"Original": "Original",
24086	"Sent": "Sent",
24087	"Reminded": "Reminded",
24088	"Viewed": "Viewed",
24089	"Submitted": "Submitted",
24090	"Deleted": "Deleted",
24091	"Unsigned": "Unsigned",
24092	"Signed": "Signed",
24093	"{0}/{1} Signed": "{0}/{1} Signed"
24094}
24095/**
24096 * A badge used to show the state of a document
24097 * @typedef {object} Badge
24098 * @property {string} name - the name of the badge, used to identify the badge and determine if it should be blocked
24099 * @property {number?} priority - how important the badge is, higher number = higher priority
24100 * @property {...*} additionalInfo - any other information about the badge
24101 */
24102
24103/**
24104 * Filters a list of badges based on blocking rules and orders them by priority.
24105 * @param {object[]} badgeBlockers - blocker set that will be used to filter the badges.
24106 *		object format: { "name of blocking event": ["name of blocked event", ...], ... }
24107 * @param {Badge[]} availableBadges - A list of the unfiltered badges in the
24108 * @returns {Badge[]} - A filtered list of badges. The list returned will be a deep clone and thus contain any information that was part of the input list.
24109 */
24110function blockBadges(badgeBlockers, availableBadges) {
24111	// Build a list of badges that should be blocked.
24112	var blockers = Object.keys(badgeBlockers);
24113	var blockedBadges = [];
24114	for (var i = 0; i < blockers.length; i++) {
24115		var blocker = blockers[i];
24116		var blocked = badgeBlockers[blocker];
24117		if (availableBadges.some(function (bdg) { return blocker === bdg.name })) {
24118			for (var j = 0; j < blocked.length; j++) {
24119				if (!blockedBadges.some(function (bdg) { return bdg === blocked[j] })) {
24120					blockedBadges.push(blocked[j]);
24121				}
24122			}
24123		}
24124	}
24125
24126	// Filter out blocked badges
24127	var filteredBadges = [];
24128	for (i = 0; i < availableBadges.length; i++) {
24129		if (!blockedBadges.some(function (bdg) { return availableBadges[i].name === bdg })) {
24130			var deepClone = {};
24131			$.extend(deepClone, availableBadges[i]);
24132			deepClone.priority = typeof(deepClone.priority) === "number" ? deepClone.priority : 0; //set a default priority of 0
24133			filteredBadges.push(deepClone);
24134		}
24135	}
24136	filteredBadges.sort(function (a, b) {
24137		return b.priority - a.priority;
24138	});
24139	return filteredBadges;
24140}
24141
24142if (typeof exports !== "undefined") {
24143	exports.blockBadges = blockBadges;
24144}
24145/* End Include badges */
24146
24147/* Include recategorization */
24148function recategorizationToggleToShowAll(){    
24149    var toggleAtag = $(".sm .recategorizationToggleButton").children('a');
24150    if(toggleAtag.hasClass("collapse"))
24151    {
24152        var elements = $(".sm .smRecategorizationDisplay");                
24153        elements.removeClass('smRecategorizationDisplay');
24154        elements.addClass('smRecategorizationDisplay_Tracker');                    
24155        toggleAtag.removeClass("collapse").html("Show Less <span>-</span>");
24156    }
24157    else{
24158        var elements = $(".sm .smRecategorizationDisplay_Tracker");                
24159        elements.removeClass('smRecategorizationDisplay_Tracker');
24160        elements.addClass('smRecategorizationDisplay');                    
24161        toggleAtag.addClass("collapse").html("Show More <span>+</span>");
24162
24163    }
24164
24165    return false;
24166}   
24167
24168function recategorizationBackToTop(){
24169    var height;
24170    if($('.wbTop').length)
24171        height = $('.wbTop').height(); 
24172    else
24173        height = 0;
24174
24175    $('html, body').animate({scrollTop:$('#wrapper').offset().top - height}, 500);
24176    return false;
24177}
24178/* End Include recategorization */
24179
24180/* Include Contracts/general */
24181/** The general contracts namespace. Other files can add to this. */
24182var Sequiter = Sequiter || {};
24183Sequiter.Contracts = Sequiter.Contracts || {};
24184(function (Contracts) {
24185	// Some constants. These are grouped together to make them easier to export for unit testing.
24186	const ILLEGAL_NAME_CHARACTERS = ['\\', '/', ':', '*', '"', '?', '<', '>', '|']; // This is declared before the general constants because it gets used to determine one of them.
24187	const CONSTANTS = {
24188		WEBUSER_DATA_ID_QUERY_PARAMETER: "webuser_data_id",
24189		BLANK_NAME_ERROR: "You can not enter a blank name.",
24190		NAME_LENGTH_ERROR: "File name is restricted to 50 characters",
24191		ILLEGAL_NAME_CHARACTERS: ILLEGAL_NAME_CHARACTERS,
24192		ILLEGAL_NAME_CHARACTERS_ERROR: "File name cannot contain " + ILLEGAL_NAME_CHARACTERS.join(" "),
24193		INVALID_URL_ERROR: "URL is invalid",
24194		INVALID_WEBUSER_DATA_ID: "webuser data id must be a number"
24195	};
24196	/**
24197	 * Does client side validation for a saved answer set name
24198	 * @param {string} name
24199	 * @returns An error message or null if there is no error.
24200	 */
24201	function ValidateName (name) {
24202		if (typeof (name) !== "string" || name === "") {
24203			return CONSTANTS.BLANK_NAME_ERROR;
24204		}
24205		if (name.length > 50) {
24206			return CONSTANTS.NAME_LENGTH_ERROR;
24207		}
24208		for (var i = 0; i < name.length; i++) {
24209			for(var j = 0; j < CONSTANTS.ILLEGAL_NAME_CHARACTERS.length; j++){
24210				if(name.charAt(i) === CONSTANTS.ILLEGAL_NAME_CHARACTERS[j]) return CONSTANTS.ILLEGAL_NAME_CHARACTERS_ERROR;
24211			}
24212		}
24213		return null;
24214	}
24215	/**
24216	 * Open an answer set at the specified url using the specified webuserDataId
24217	 * @param {string} url
24218	 * @param {number} webuserDataId
24219	 */
24220	function OpenAnswerSet (url, webuserDataId) {
24221		if (typeof (url) !== "string") throw CONSTANTS.INVALID_URL_ERROR;
24222		if (typeof (webuserDataId) !== "number") throw CONSTANTS.INVALID_WEBUSER_DATA_ID;
24223		if (url.indexOf("?") >= 0) {
24224			if(url.lastIndexOf("&") !== url.length - 1) {
24225				url += "&";
24226			}
24227		} else url += "?";
24228		url += CONSTANTS.WEBUSER_DATA_ID_QUERY_PARAMETER + "=" + webuserDataId;
24229		window.location.href = url;
24230	}
24231	/**
24232	 * Updates the webuser_data_id in the query string if it is blank or invalid
24233	 * Alternatively it will cause a redirect to the open contracts page depending on the "requireWebuserDataId" feature flag
24234	 * @param {string} productCode - the code for the current product
24235	 */
24236	function updateWebuserDataId(productCode) {
24237		var queryWebuserDataId = getQueryStringValue(CONSTANTS.WEBUSER_DATA_ID_QUERY_PARAMETER);
24238		// If there's nothing specified in the query string use null since that's what the "realWebuserDataId" will be set to if the user has no saved answers.
24239		if (queryWebuserDataId === undefined) queryWebuserDataId = null;
24240		else queryWebuserDataId = parseInt(queryWebuserDataId);
24241
24242		var websiteLinkHash = getQueryStringValue("l") || null;
24243
24244		var realWebuserDataId = window.WebuserDataInfo.id || (typeof webuserDataID !== "undefined" ? parseInt(webuserDataID) : null);
24245		if (isNaN(realWebuserDataId)) realWebuserDataId = null;
24246		// If the webuser_data_id wasn't found then make a dataservice call as a final fallback
24247		if (realWebuserDataId === null){
24248			CallDataService("GetMostRecentWebuserDataId",
24249				{
24250					productCode: productCode,
24251					websiteLinkHash: websiteLinkHash,
24252					webuserDataType: null
24253				},
24254				function (resp) {
24255					if ('d' in resp && resp.d !== null) {
24256						realWebuserDataId = resp.d;
24257						handleInvalidWebuserDataId(queryWebuserDataId,realWebuserDataId,productC
24257ode);
24258					}
24259				}
24260			);
24261		} else {
24262			handleInvalidWebuserDataId(queryWebuserDataId,realWebuserDataId,productCode);
24263		}
24264	}
24265
24266	/**
24267	 * Checks if the webuserDataId is valid and determines what to do with invalid webuserDataIds
24268	 * @param {string} currentWebuserDataId - the current webuserDataId in the query string
24269	 * @param {string} correctWebuserDataId - the correct webuserDataId that should be used
24270	 * @param {string} productCode - the code for the current product
24271	 */
24272	function handleInvalidWebuserDataId(currentWebuserDataId,correctWebuserDataId,productCode){
24273		// If the currentWebuserDataId is incorrect and a correct webuserDataId can be determined then update it
24274		if (correctWebuserDataId !== null && currentWebuserDataId !== correctWebuserDataId) {
24275			if (Sequiter.SiteConfig.GetConfigValue("requireWebuserDataId", false)) {
24276				// If the requireWebuserDataId feature flag is enabled redirect to the open contracts page
24277				doRedirect(productCode);
24278			} else {
24279				// Otherwise attempt to correct the invalid webuserDataId
24280				if(
24281					currentWebuserDataId !== null // The query string already contains a webuser data id, so we should always update it even if on an old dcs version
24282					|| !(typeof(dcsVersion) === "undefined" || dcsVersion === null || dcsVersion <= 3.24)
24283				) {
24284					setWebuserDataId(correctWebuserDataId);
24285				} else {
24286					// Old dcs versions cannot handle a webuser data id in the query string if the document is brand new, but due to bugs
24287					// related to storing the variable string in these old versions, we have to get the string directly from the db for these old versions
24288					// This check can be removed if all contracts are on 3.25+ and the webuser data id can be safely set
24289					CallDataService("LoadAnswerVarstringComplete", {webuser_data_id: correctWebuserDataId}, function(resp){
24290						if (!('d' in resp && resp.d !== null && resp.d === "ver=yudox2")) {
24291							setWebuserDataId(correctWebuserDataId);
24292						} 
24293						else {
24294							// do nothing, it is unsafe to append the webuser data id in the query string
24295						}
24296					})
24297				}
24298			}
24299		}
24300	}
24301
24302	/**
24303	 * Sets the webuser_data_id in the query string
24304	 * @param {string} webuserDataId - the webuserDataId to set
24305	 */
24306	function setWebuserDataId(webuserDataId) {
24307		// Update the query string in browser URL
24308		var currentQueryString = window.location.search;
24309		currentQueryString = updateQueryStringParameter(currentQueryString, CONSTANTS.WEBUSER_DATA_ID_QUERY_PARAMETER, webuserDataId);
24310		pushState(null, "", currentQueryString, true);
24311
24312		// Update the query string for the form element
24313		var form = document.forms["aspnetForm"];
24314		if(form !== undefined){
24315			form.action = updateQueryStringParameter(form.action, CONSTANTS.WEBUSER_DATA_ID_QUERY_PARAMETER, webuserDataId);
24316		}
24317	}
24318
24319	/**
24320	 * Redirects to the open contracts page
24321	 * @param {string} productCode - the code for the current product
24322	 */
24323	function doRedirect(productCode) {
24324		var hasSavedAnswers = false;
24325		if (typeof dcsVersion === 'number' && dcsVersion >= 3.02) {
24326			// DCSMain 3.02+ will set the WebuserDataInfo with an id of the automatically loaded file, indicating they already have answers if it is not null
24327			if (window.WebuserDataInfo.id !== null) {
24328				hasSavedAnswers = true;
24329			}
24330		} else if (typeof dcsVersion === 'number') {
24331			// An older DCSMain version 2.56+ (the oldest on live at the time of writing). We check the the variable string to see if it is not empty instead
24332			if (window.VS !== "") {
24333				hasSavedAnswers = true;
24334			}
24335		}
24335 else if (window.location.pathname.includes("preview.php")) {
24336			// PHP preview pages are accessed from the questionnaire page without the webuser_data_id added, add it here.
24337			if (typeof (webuserDataID) === "number") {
24338				var phpPreviewQueryString = window.location.search;
24339				phpPreviewQueryString = updateQueryStringParameter(phpPreviewQueryString, CONSTANTS.WEBUSER_DATA_ID_QUERY_PARAMETER, webuserDataID);
24340				pushState(null, "", phpPreviewQueryString, true);
24341			}
24342			return;
24343		}
24344		else {
24345			// A php contract, these set a different parameter
24346			if ((typeof window.variablestring === 'string' && window.variablestring !== "")) {
24347				saveReq = false; // Don't save as that will overwrite the most recent answer set with blank values.
24348				hasSavedAnswers = true;
24349			}
24350		}
24351
24352
24353		// If they have any saved answers redirect them to the page to select what to load.
24354		if (hasSavedAnswers) {
24355			var currentUrl = window.location.toString();
24356			// Remove the webuser_data_id if it is set
24357			currentUrl = updateQueryStringParameter(currentUrl, CONSTANTS.WEBUSER_DATA_ID_QUERY_PARAMETER, null);
24358			window.location.href = window.location.href = "https://" + window.location.hostname + '/OpenContract/?code=' + productCode + '&referringUrl=' + encodeURIComponent(currentUrl);
24359		}
24360		else {
24361			// If they don't have saved answers, remove the webuser_data_id from the query string.
24362			var currentQueryString = window.location.search;
24363			currentQueryString = updateQueryStringParameter(currentQueryString, CONSTANTS.WEBUSER_DATA_ID_QUERY_PARAMETER, null);
24364			pushState(null, "", currentQueryString, true);
24365		}
24366	}
24367
24368	/**
24369	 * Gets the canonical product url for the given product code and country code
24370	 * 
24371	 * @param {string} productCode - the code for the product to get the canonical url for
24372	 * @param {string} countryCode - the code for the country to get the canonical url for
24373	 * @returns {string?} The canonical product url, or undefined if the product code or country code is invalid
24374	 */
24375	async function getCanonicalProductUrl(productCode, countryCode) {
24376		try{
24377			const response = await fetch(`/api/foundation/navigation/v1/countries?ProductCode=${productCode}&Host=${window.location.hostname}`, {
24378				method: "GET",
24379				headers: {
24380					"Accept": "application/json",
24381					"Content-Type": "application/json",
24382				},
24383			});
24384			if (!response.ok) {
24385				return undefined;
24386			}
24387			const data = await response.json();
24388			if (!data.succeeded) {
24389				return undefined;
24390			}
24391			return data.result.find(country => country.countryCode === countryCode)?.canonicalUrl;
24392		} catch (error) {
24393			logErrorMessage(`Error getting canonical product URL: ${error}`, url_escape(location.href), null, url_escape(parent.location.href), 'javascript_error.log');
24394			return undefined;
24395		}
24396	}
24397
24398	// Export public members for website use.
24399	$.extend(Contracts, {
24400		ValidateName: ValidateName,
24401		OpenAnswerSet: OpenAnswerSet,
24402		updateWebuserDataId: updateWebuserDataId,
24403		getCanonicalProductUrl: getCanonicalProductUrl,
24404	});
24405
24406	// Exports for unit testing.
24407	if (typeof exports !== "undefined") {
24408		exports.Contracts = Contracts;
24409		exports.CONSTANTS = CONSTANTS;
24410		exports.Sequiter = Sequiter;
24411	}
24412})(Sequiter.Contracts);
24413/* End Include Contracts/general */
24414
24415/* Include Contracts/new */
24416/** The general contracts namespace. Other files can add to this. */
24417var Sequiter = Sequiter || {};
24418Sequiter.Contracts = Sequiter.Contracts || {};
24419(function (Contracts) {
24420	// Some constants. These are grouped together to make them easier to export for unit testing.
24421	const CONSTANTS = {
24422		UNKNOWN_ERROR: "There was an unknown error creating your new document.",
24423		INVALID_SETTINGS_ERROR: "Invalid Settings",
24424		INVALID_RESULTS_ERROR: "Invalid result parameter",
24425		INVALID_WEBUSER_DATA_ID_ERROR: "Invalid webuser data id",
24426		ERROR_DIALOG_TITLE: "Error",
24427		ANSWER_TYPE: "working_answers",
24428		NEW_ANSWER_DATA_SERVICE_FUNCTION: "NewAnswer2",
24429		DEFAULT_NEW_ANSWER_DATA: "yudox2",
24430		NAME_EXISTS_KEY: "NAME_ALREADY_IN_USE",
24431		NAME_EXISTS_ERROR: "You already have a document with that name. Please enter a new name."
24432	};
24433
24434	/**
24435	 * @typedef {Object} newAnswerResult
24436	 * @property {boolean} success If the creation was successful.
24437	 * @property {string} value The secure id for the user that the answer set was created for if successful, otherwise an error message
24438	 * @property {number} [webuserDataId] The webuser data id of the newly created answer set, won't be set if success was false
24439	 */
24440
24441	/**
24442	 * A function to call when creating a new answer set is successful
24443	 * @callback newAnswerSuccess
24444	 * @param {newAnswerResult} results
24445	 */
24446
24447	/**
24448	 * A function to call when there is an error while creating a new answer set
24449	 * @callback newAnswerError
24450	 * @param {string} message The error message
24451	 */
24452
24453	/**
24454	 * Creates a new answer set for the current user.
24455	 * @param {Object} settings The settings for the new answer set.
24456	 * @param {string} settings.code The product code.
24457	 * @param {string} settings.name - The name of the new document.
24458	 * @param {string} [settings.data="yudox2"] - The data for the new answer set.
24459	 * @param {string} [settings.url] - A url to go to on success. This will have the generated 
24459webuser_data_id appended to it. If not specified this won't redirect automatically on success.
24460	 * @param {newAnswerSuccess} [settings.success] - The function to call on a success. If not specified will redirect to the provided url with the webuser data id added to it.
24461	 * @param {newAnswerError} [settings.error] - The function to call on an error. This will be passed an error message. If not specified errors will be displayed in an alert dialog.
24462	 * @returns An error message if this couldn't proceed for any reason. Null otherwise.
24463	 */
24464	function CreateNewAnswerSet(settings) {
24465		// Provide default settings.
24466		var set = $.extend({
24467			data: CONSTANTS.DEFAULT_NEW_ANSWER_DATA,
24468			success: function (result) { DefaultNewAnswerSetSuccess(settings.url, result); },
24469			error: DefaultNewAnswerSetError
24470		}, settings);
24471
24472		// Make sure a product code was provided.
24473		if (typeof (set.code) !== "string" || set.code === "") {
24474			set.error(CONSTANTS.UNKNOWN_ERROR);
24475			return;
24476		}
24477
24478		// Do client side name validation.
24479		var valName = Sequiter.Contracts.ValidateName(set.name);
24480		if (valName !== null) {
24481			set.error(valName);
24482			return;
24483		}
24484
24485		AjaxWait();
24486		CallDataService(
24487			CONSTANTS.NEW_ANSWER_DATA_SERVICE_FUNCTION,
24488			{ PC: set.code, name: set.name, data: set.data, type: CONSTANTS.ANSWER_TYPE, criteria: null },
24489			function (result) { CreateNewAnswerSetCallback(set, result); },
24490			function (request, status, error) { CreateNewAnswerSetErrorCallback(set, request, status, error); }
24491		);
24492	}
24493
24494	/**
24495	 * The default callback for successfully creating a new answer set.
24496	 * Redirects to the questionnaire for that answer set.
24497	 * @param {string} url The url to go to.
24498	 * @param {newAnswerResult} results The result from the service call that created the answer set.
24499	 */
24500	function DefaultNewAnswerSetSuccess(url, results) {
24501		if (typeof (url) !== "string") return; // Do nothing if no url was provided.
24502		if (typeof (results) !== "object") throw CONSTANTS.INVALID_RESULTS_ERROR;
24503		if (typeof (results.webuserDataId) !== "number") throw CONSTANTS.INVALID_WEBUSER_DATA_ID_ERROR;
24504		Sequiter.Contracts.OpenAnswerSet(url, results.webuserDataId);
24505	}
24506
24507	/**
24508	 * Default error handling for creating a new answer set.
24509	 * Displays the error message in an alert dialog.
24510	 * @param {string} message
24511	 */
24512	function DefaultNewAnswerSetError(message) {
24513		if (typeof (message) !== "string") throw "Invalid error message";
24514		alert(message, { title: CONSTANTS.ERROR_DIALOG_TITLE });
24515	}
24516
24517	/**
24518	 * Handles the result of the service call to create a new answer set.
24519	 * @param {Object} settings The original settings from the call to CreateNewAnswerSet
24520	 * @param {string} [settings.url] - A url to go to on success. 
24521	 * @param {newAnswerSuccess} settings.success - The function to call on a success. 
24522	 * @param {newAnswerError} settings.error - The function to call on an error. 
24523	 * @param {Object} resultsRaw The result of the service call.
24524	 * @param {newAnswerResult} resultsRaw.d (SERIALIZED) The string representation of the json object returned by the service call.
24525	 */
24526	function CreateNewAnswerSetCallback(settings, resultsRaw) {
24527		hideMessage();
24528		var results = JSON.parse(resultsRaw.d);
24529		if (results.success) {
24530			settings.success(results)
24531		}
24532		else {
24533			if (results.value === CONSTANTS.NAME_EXISTS_KEY)
24534				settings.error(CONSTANTS.NAME_EXISTS_ERROR)
24535			else
24536				settings.error(CONSTANTS.UNKNOWN_ERROR)
24537		}
24538	}
24539
24540	/**
24541	 * If the service call for creating a new answer set results in an error.
24542	 * Calls the error handler from the settings and reports an unknown error.
24543	 * @param {object} settings The original settings for creating the new document.
24544	 * @param {newAnswerError} settings.error The error function to call.
24545	 * @param {object} request A request object.
24546	 * @param {string} status The response status
24547	 * @param {string} error The error message.
24548	 */
24549	function CreateNewAnswerSetErrorCallback(settings, request, status, error) {
24550		hideMessage();
24551		settings.error(CONSTANTS.UNKNOWN_ERROR);
24552	}
24553
24554	// Export public members for website use.
24555	$.extend(Contracts, {
24556		CreateNewAnswerSet: CreateNewAnswerSet
24557	});
24558
24559	// Exports for unit testing.
24560	if (typeof exports !== "undefined") {
24561		exports.Contracts = Contracts;
24562		exports.CONSTANTS = CONSTANTS;
24563	}
24564})(Sequiter.Contracts);
24565/* End Include Contracts/new */
24566
24567/* Include siteInfo */
24568var Sequiter = Sequiter || {};
24569Sequiter.SiteInfo = Sequiter.SiteInfo || {};
24570
24571(function (SiteInfo) {
24572
24573	// The possible site styles to check for
24574	var SiteStyles = {
24575	    LawDepot : "LD",
24576	    LegalContracts: "LC",
24577	    Doculaw : "DLAW"
24578	}
24579
24580	/**
24581	 * Gets the site style for the current page.
24582	 * @returns the name of the site style, if none can be determined it will return a blank string
24583	 **/	
24584	function GetSiteStyle(){
24585		// First check if the html class can identify the site style
24586		for (var style in SiteStyles) {
24587			var styleName = SiteStyles[style];
24588			if($("html").hasClass(styleName)){
24589				return styleName;
24590			}
24591		}
24592
24593		// If the site style couldn't be retrieved from the document then check the URL
24594		var host = window.location.host;
24595		if(host.indexOf("localhost") !== -1 || host.indexOf("lawdepot") !== -1){
24596			return SiteStyles.LawDepot;
24597		}else if(host.indexOf("doculaw") !== -1){
24598			return SiteStyles.Doculaw;
24599		}else if(host.indexOf("legalcontracts") !== -1){
24600			return SiteStyles.LegalContracts;
24601		}
24602
24603		// If the site cannot be determined return a blank string
24604		return "";
24605	}
24606
24607	// Export public members for website use.
24608	$.extend(SiteInfo, {
24609		GetSiteStyle: GetSiteStyle,
24610		SiteStyles: SiteStyles
24611	});
24612
24613	// Exports for unit testing.
24614	if (typeof exports !== "undefined") {
24615		exports.SiteInfo = SiteInfo;
24616		exports.SiteStyles = SiteStyles;
24617	}
24618})(Sequiter.SiteInfo);
24619
24620/* End Include siteInfo */
24621
24622/* Include images */
24623/** The general utility namespace. Other files can add to this. */
24624var Sequiter = Sequiter || {};
24625Sequiter.Images = Sequiter.Images || {};
24626(function (Images) {
24627	var IMAGE_INPUT_ID = "imageRequestInput";
24628	var HEIC2ANY_URL = "/common/scripts/lib/heic2any.js?v=1";
24629
24630	/**
24631	 * Requests an image from the user.
24632	 *
24633	 * This will fail in some browsers (Firefox) if this function isn't called as the result of a user action.
24634	 * @returns {Promise<File>} A promise that gets the image file.
24635	 */
24636	function requestImage() {
24637		var input = document.getElementById(IMAGE_INPUT_ID);
24638		if (input === null) {
24639			input = document.createElement("input");
24640			input.setAttribute("type", "file");
24641			// Edge seems to ignore this setting, but it applies in all other browsers.
24642			input.setAttribute("accept", ".png,.gif,.jpeg,.jpg,.svg,.heic");
24643			input.id = IMAGE_INPUT_ID;
24644			// Using display: none disables the input in safari. So just move it off screen
24645			input.style.position = "fixed";
24646			input.style.top = "-100em";
24647			document.body.appendChild(input);
24648		}
24649		// Clear the input so previous promises aren't triggered.
24650		input.onchange = null;
24651		input.value = "";
24652		// Create the promise.
24653		var p = new Promise(function (resolve, reject) {
24654			input.onchange = function () {
24655				if (input.files.length === 1)
24656					resolve(input.files[0]);
24657				else
24658					// This is here for the sake of completeness but the change event only gets triggered when a file is selected.
24659					// There's apparently no way to tell if the user clicked cancel in the dialog box.
24660					// So what happens is this promise just never resolves if no image is selected.
24661					reject("No files selected");
24662			}
24663		}).then(function(file) {
24664			return convertIfHeic(file);
24665		});
24666
24667		input.click();
24668		return p;
24669	}
24670
24671	/**
24672	 * Requests an image file and height/width to resize to.
24673	 * Image is resized to fit the bounded area without skewing.
24674	 * @param {File} file - the image file to upload
24675	 * @param {number} maxWidth - Maximum width to scale image to
24676	 * @param {number} maxHeight - Maximum height to scale image to
24677	 * @returns {Promise<Blob>} A promise that gets the blob.
24678	 */
24679	function resizeImage(file, maxWidth, maxHeight) {
24680		var reader = new FileReader();
24681		var img = new Image();
24682		var canvas = document.createElement('canvas');
24683		var canvasContext = canvas.getContext("2d");
24684		var resize = function () {
24685			var iw = img.width;
24686			var ih = img.height;
24687			if (iw == 0 || ih == 0 ){
24688				alert("Please upload a different file type  (.png, .jpeg, .gif).", {title:"Invalid File Type"});
24689			};
24690			var ratio = Math.min(maxWidth / iw, maxHeight / ih);
24691			if (ratio > 1) ratio = 1;
24692			canvas.width = iw * ratio;
24693			canvas.height = ih * ratio;
24694			canvasContext.drawImage(img, 0, 0, iw, ih, 0, 0, iw * ratio, ih * ratio);
24695			return getCanvasBlob(canvas);
24696		};
24697		return new Promise(function (resolve, reject) {
24698			if (typeof (file) !== "object" || file === null || typeof (file.type) !== "string" || !file.type.match(/image.*/)) {
24699				reject(uploadError("The uploaded file is not an image.", true));
24700				return;
24701			}
24702			if (typeof (maxWidth) !== "number" || maxWidth < 1 || maxWidth > 523 || typeof (maxHeight) !== "number" || maxHeight < 1 || maxHeight > 720) {
24703				reject(uploadError("The expected image dimensions are invalid.", false));
24704				return;
24705			}
24706			reader.onload = function (readerEvent) {
24707				img.onload = function () {
24708					resolve(resize().then(
24709						function (blob) {
24710							return appendFileMetaData(blob, file)
24711						})
24712					);
24713				};
24714				img.src = readerEvent.target.result;
24715			};
24716			reader.readAsDataURL(file);
24717		});
24718	}
24719
24720	/**
24721	* Converts the image to png if it is .heic, otherwise it will simply return the input image
24722	* @param {file} file - the image blob/file to check
24723	* @returns {Promise<blob>} - A promise that returns the converted or the input image
24724	*/
24725	function convertIfHeic(file){
24726		// Since heic may not be a recognized file type we have to check the file name for the type
24727		var splitName = file.name.split(".");
24728		var visibleExtension = splitName[splitName.length-1].toLowerCase();
24729		if(visibleExtension !== "heic"){
24730			return new Promise(function (resolve, reject) {
24731				resolve(file);
24732			});
24733		}
24734		return convertHeicToPng(file);
24735	}
24736
24737	/**
24738	* Takes a heic image and converts it to a png image
24739	* This will also fetch inject the heic2any library when called
24740	* @param {file} file - the heic image file to convert
24741	* @returns {Promise<file>} - A promise that returns the converted png file
24742	*/
24743	function convertHeicToPng(file){
24744		if(cssua.ua.ie){
24745			// Not only does IE not support heic2any but it also doesn't support the ability to catch the error indicating that it doesn't support it
24746			// As a result to this we need to manually check if the browser is IE to throw an error here
24747			throw uploadError("Your browser doesn't support uploading of .heic images.", true);
24748		}
24749		return fetchInject([HEIC2ANY_URL]).then(function() {
24750			let fileName = file.name;
24751			// Set the file extension to .png since that will be type of the converted result
24752			fileName = fileName.replace(/\.[^/.]+$/, ".png");
24753			return heic2any({
24754				blob: file
24755			}).then(function(blob){
24756				return new File([blob], fileName, {'type': 'image/png'});
24757			});
24758		});
24759	}
24760
24761	/**
24762	* Takes a blob and a file and appends file metadata information onto the blob
24763	* @param {blob} blob - blob to append metadata to
24764	* @param {file} file - file to take metadata from
24765	* @returns blob - blob with appended metadata.
24766	*/
24767	function appendFileMetaData(blob, file) {
24768		blob.name = file.name;
24769		return blob;
24770	}
24771
24772	/**
24773	 * Takes a canvas and returns a promise that resolves to a blob
24774	 * representation of what is currently on the canvas
24775	 * @param {canvas} canvas - canvas to get image blob from
24776	 * @returns {Promise<blob>} A promise that gets the blob.
24777	 */
24778	function getCanvasBlob(canvas) {
24779		return new Promise(function (resolve, reject) {
24780			if(typeof canvas.toBlob === "function"){
24781				canvas.toBlob(function (blob) {
24782					resolve(blob);
24783				});
24784			}else if(typeof canvas.msToBlob === "function"){
24785				resolve(canvas.msToBlob());
24786			}
24787		});
24788	}
24789
24790	/**
24791	 * Uploads an image.
24792	 *
24793	 * @param {File} image - the image file to upload
24794	 * @returns {Promise<object>} A promise that will return the Utility.Utility.Blob object of the uploaded image
24795	 */
24796	function uploadImage(image) {
24797		return Services.FileStore.create(image, { hidden: true });
24798	}
24799
24800	/**
24801	 * Creates and handles errors for image upload.
24802	 *
24803	 * @param {string} errorMessage - the message for the error
24804	 * @param {boolean} showMessage - if the error message should be shown to the user
24805	 * @returns {Error} An error object containing the errorMessage
24806	 */
24807	function uploadError(errorMessage, showMessage){
24808		if(showMessage){
24809			alert(errorMessage, {title: "Upload Error"});
24810		}
24811		return new Error(errorMessage);
24812	}
24813
24814	// Export public members for website use.
24815	$.extend(Images, {
24816		requestImage: requestImage,
24817		uploadImage: uploadImage,
24818		resizeImage: resizeImage,
24819		convertIfHeic: convertIfHeic
24820	});
24821
24822	// Exports for unit testing.
24823	if (typeof exports !== "undefined") {
24824		exports.Images = Images;
24825	}
24826})(Sequiter.Images);
24827
24828
24829/* End Include images */
24830
24831/* Include membersV2 */
24832
24833if (typeof ($) == "function") {
24834	$(function () {
24835      /* Check if banner searchbar exists */
24836      if ($(".search_input_body").length) {
24837			$(".search_input_body").on("keydown", function (event) {
24838				var code = getKeyCode(event);
24839            /* Intercept TAB key */
24840            if (code === 9) {
24841               /* If Shift + TAB pretend UP arrow hit */
24842               if (event.shiftKey) {
24843						code = 38;
24844					}
24845               /* Else pretend DOWN arrow */
24846               else {
24847						code = 40;
24848					}
24849				}
24850			}).on("keypress", function (event) {
24851				if (getKeyCode(event) == 13) { /* Enter key */
24852					submitSearch($(this).attr("id"));
24853					event.preventDefault();
24854					event.stopPropagation();
24855					return false;
24856				}
24857			}).on("focus", function () {
24858				setFocus(this);
24859				clearInitText(this);
24860			}).on("blur", function () {
24861				unsetFocus(this);
24862				resetInitText(this);
24863			});
24864			$(".search_submit_body").on("click", function () {
24865				submitSearch($(this).siblings(".search_input_body").attr("id"));
24866			});
24867			var appendToselector = null;
24868			var intViewportWidth = window.innerWidth;
24869			var intViewportHeight = window.innerHeight;
24870			if (typeof (fluidLayout) != "undefined" && fluidLayout) {
24871
24872				if (typeof (supportsMobile) != "undefined" && supportsMobile) {
24873					rE(window, "load", function () {
24874						$(".menu-container, .searchDocs .searchBox .ui-autocomplete").css({ "width": parseInt($(".searchBox").outerWidth()) + "px" });
24875						$(".menu-container, .searchDocs .searchBox .ui-autocomplete").css({ "max-width": parseInt($(".searchBox").outerWidth()) + "px" });
24876					});
24877					$(window).on("resize", function () {
24878						$(".menu-container, .searchDocs .searchBox .ui-autocomplete").css({ "width": parseInt($("#tag").outerWidth()) + "px" });
24879						$(".mobileOnly #search_menu .ui-autocomplete").css({ "width": parseInt($(".mobileOnly #search_menu #txtSearchMobile").outerWidth()) + "px" });
24880						$(".mobileOnly #search_menu .ui-autocomplete").css({ "left": "10px" });
24881						$(".menu-container, .searchDocs .searchBox .ui-autocomplete").css({ "max-width": parseInt($("#tag").outerWidth()) + "px" });
24882					});
24883				} 
24884				appendToselector = '#resultsContainer';
24885			} else {
24886				if (isPhone() && (typeof (supportsMobile) != "undefined" && supportsMobile)) {
24887					$(window).on("resize", function () {
24888						$(".searchBox .menu-container, .searchBox .ui-autocomplete").css({ "width": parseInt($(".searchBox #tag").innerWidth()) + "px" });
24889						$(".mobileOnly #recat_header_search .ui-autocomplete").css({ "width": parseInt($(".mobileOnly #recat_header_search #txtSearchMobile").outerWidth()) + "px" });
24890						$(".mobileOnly #recat_header_search .ui-autocomplete").css({ "left": "10px" });
24891					});
24892				}
24893				appendToselector = '#resultsContainer';
24894			}
24895
24896			var autocomplete = $(".search_input_body").autocomplete({
24897				source: function (request, response) {
24898					arr = resortContractList(request.term);
24899					response(arr);
24900				},
24901				select: function (event, ui) {
24902					var selectedObj = ui.item;
24903					location = selectedObj.value;
24904					return false;
24905				},
24906				open: function (event) {
24907					if ((typeof (fluidLayout) != "undefined" && fluidLayout) || $('#banner .navRedesignWrapper').length) {
24908						if ($('html body, html form').hasClass('Slate')) {
24909							$('.ui-menu').css('overflow', 'auto');
24910						}
24911						else {
24912							if ($('html').hasClass('ua-desktop') && intViewportWidth > 736) {
24913								$('.ui-menu').width('100%');
24914							}
24915						}
24916						$('.ui-menu').position({ my: "right top", at: "right bottom", of: "#" + event.target.id });
24917					} else {
24918						if ($('html').hasClass('ua-desktop')) {
24919							if ($('html body, html form').hasClass('Slate')) {
24920								var listSize = $('#txtSearch').outerWidth() - 2;
24921
24922								$('.ui-menu').width(listSize);
24923
24924							}
24925
24926						}
24927						$('.ui-menu').position({ my: "right top", at: "right bottom", of: "#" + event.target.id });
24928					}
24929					$('.ui-menu').addClass("search_dropdown");
24930					$(".LD.ua-desktop .Slate #banner .SignInOut ul").hide();
24931					if (typeof (cssua) != "undefined" && cssua.ua.ios) {
24932						$('.ui-autocomplete').off('menufocus hover mouseover mouseenter');
24933					}
24934				},
24935				focus: function (event, ui) {
24936					event.preventDefault();
24937				},
24938				search: function (event, ui) {
24939					var valueItem = $(event.target).val();
24940					var newItem = $.trim(valueItem.replace(/\s+/g, ' '));
24941					if (valueItem != newItem && event.target == event.currentTarget) {
24942						event.preventDefault();
24943						event.stopPropagation();
24944						$(event.target).autocomplete("search", newItem);
24945					}
24946					$('.ui-menu').position({ my: "right top", at: "right bottom", of: "#" + event.target.id });
24947				},
24948				appendTo: appendToselector
24949			});
24950			var dataSelector = autocomplete.data("ui-autocomplete") ? "ui-autocomplete" : (autocomplete.data("autocomplete") ? "autocomplete" : null);
24951			if (dataSelector) {
24952				autocomplete.each(function (index, item) {
24953					$(item).data(dataSelector)
24954						._renderItem = function (ul, item) {
24955							var newTerm = $.trim(this.term.replace(/\s+/g, ' '));
24956							/* highlightSearchMatches lives in banner.js; guard in case a page loads this file without it */
24957							var newText = (typeof highlightSearchMatches === "function")
24958								? highlightSearchMatches(item.label, newTerm)
24959								: String(item.label).replace(new RegExp($.ui.autocomplete.escapeRegex(newTerm), "gi"), "<span class='ui-state-highlight'>$&<\/span>");
24960							return $("<li><\/li>")
24961								.data("item.autocomplete", item)
24962								.append("<a>" + newText + "<\/a>")
24963								.appendTo(ul);
24964						};
24965				});
24966			}
24967		}
24968		$('#help_top,.help_top, .countryNav').on("mouseenter", function () {
24969			$('.ui-autocomplete').hide();
24970		});
24971		$(window).on("resize", function () {
24972			$('.ui-autocomplete').hide();
24973		});
24974	});
24975}
24976
24977rE(window, "load", function () {
24978	setSearchText();
24979});
24980
24981$(window).on("resize", function () {
24982	setSearchText();
24983});
24984
24985function setSearchText() {
24986	if ($(window).width() > 767) {
24987		$('#txtSearch_body').attr("data-inittext", "Search hundreds of documents...");
24988		$('#txtSearch_body').attr("value", "Search hundreds of documents...");
24989	} else {
24990		$('#txtSearch_body').attr("data-inittext", "Search documents...");
24991		$('#txtSearch_body').attr("value", "Search documents...");
24992	}
24993}
24994/* End Include membersV2 */
24995
24996/* Include toast */
24997/**
24998 Toast library.
24999 Toasts are short lived popups that require no user interaction, useful for quick confirmations you don't want to have the user to
25000 click away from manually.
25001 For styling of the toasts, see the _toast.scss partial
25002 */
25003/** The general utility namespace. Other files can add to this. */
25004var Sequiter = Sequiter || {};
25005Sequiter.Utility = Sequiter.Utility || {}; // Simply add this library to the utility namespace, it is not large enough to warrant it's own namespace
25006(function (util) {
25007	/**
25008	 * Parse a string into a number.
25009	 * @param {string} content - The content to display in the toast
25010	 * @param {HTMLElement} target - The element to attach the toast to
25011	 */
25012	function toast(content, target) {
25013		const DATAKEY_IS_TOASTING = "sequiter.utility.toast.isToasting";
25014		var $target = $(target);
25015
25016		if($target.data(DATAKEY_IS_TOASTING) === true){
25017			// A toast is in progress, and only one toast can occur on a given target at a time
25018			return;
25019		}
25020		
25021		var $toast = $("<div role='tooltip' class='ui-tooltip ui-corner-all ui-widget-shadow ui-widget ui-widget-content sequiter-toast'><div class='ui-tooltip-content'>" + content + "</div></div>");
25022		
25023		if($target.css('position') === "static"){
25024			throw "Cannot toast on a static positioned element";
25025		}
25026		
25027		$target.append($toast);
25028		$target.data(DATAKEY_IS_TOASTING, true);
25029		$toast.animate(
25030			{
25031				opacity: 1
25032			},
25033			100,
25034			function () {
25035				setTimeout(function () {
25036					$toast.animate(
25037						{
25038							opacity: 0
25039						},
25040						100,
25041						function(){
25042							$toast.remove();
25043							$target.removeData(DATAKEY_IS_TOASTING)
25044						});
25045				}, 1000)
25046			}
25047		);
25048	}
25049
25050	// Export public members for website use.
25051	$.extend(util, {
25052		toast: toast
25053	});
25054
25055	// Exports for unit testing.
25056	if (typeof exports !== "undefined") {
25057		exports.Utility = util;
25058	}
25059})(Sequiter.Utility);
25060/* End Include toast */
25061
25062/* Include userManagement */
25063function getWebuserExperimentVariation(
25064	experimentName,
25065	includeProductCode = true
25066) {
25067	if (getServerName().search("affiliate") != -1) {
25068		return Promise.resolve({
25069			result: {
25070				variationName: "C",
25071			},
25072		});
25073	}
25074
25075	let params = { countryCode: getCountry(), experimentName: experimentName };
25076
25077	if (includeProductCode) {
25078		params.productCode = getCurrentProductCode();
25079	}
25080
25081	return new Promise(function (resolve, reject) {
25082		$.ajax({
25083			type: "POST",
25084			url: "/api/foundation/user-account-management/v1/user-experiment",
25085			contentType: "application/json",
25086			dataType: "json",
25087			data: JSON.stringify(params),
25088			success: function (result) {
25089				resolve(result);
25090			},
25091			error: function (result) {
25092				reject(result);
25093			},
25094		});
25095	});
25096}
25097
25098
25099/* End Include userManagement */
25100
25101/* Include productMenuStrategy */
25102const EmptyNavigationMenuCategoryUtility = (function() {
25103
25104    function removeAllClickHandlers(menuCategoryLinkNodes) {
25105        menuCategoryLinkNodes.off('click'); 
25106    }
25107
25108    function openLink(menuCategoryLinkNode) {
25109        const samePageTarget = '_self';
25110        const menuCategoryUrl = menuCategoryLinkNode.attr('data-url');
25111        window.open(menuCategoryUrl, samePageTarget);
25112    }
25113
25114    function executeHtmlOnClickHandler(menuCategoryLinkNode) {
25115        const defaultOnClickHandler = menuCategoryLinkNode.attr("onclick");
25116        if (defaultOnClickHandler) {
25117            eval(defaultOnClickHandler);
25118        }
25119    }
25120
25121    function handleClick(e) {
25122        const menuCategoryLinkNode = $(e.currentTarget);
25123        executeHtmlOnClickHandler(menuCategoryLinkNode);
25124        openLink(menuCategoryLinkNode);
25125    }
25126
25127    function setCustomClickHandlers(menuCategoryLinkNodes) {
25128        menuCategoryLinkNodes.on('click', handleClick);
25129    }
25130
25131    /**
25132     * Finds empty navigation menu categories, 
25133     * deletes all existing click handlers (mainly to disable jQuery Accordion's behavior),
25134     * sets new click handlers that call tracking (via the execution of the HTML handler)
25135     * and open the destination page of a menu category.
25136     */
25137    function configureAnchorTagBehaviour() {
25138        const emptyMenuCategoryLinkNodes = $('.empty-menu-category-link');
25139
25140        // It is necessary to delete jQuery Accordion's click handler. 
25141        // The only solution is to delete all click handlers.
25142        removeAllClickHandlers(emptyMenuCategoryLinkNodes); 
25143        setCustomClickHandlers(emptyMenuCategoryLinkNodes);
25144    }
25145
25146    return {
25147        configureAnchorTagBehaviour
25148    }
25149})();
25150
25151$(document).ready(function() {
25152    EmptyNavigationMenuCategoryUtility.configureAnchorTagBehaviour();
25153});
25154
25155/* End Include productMenuStrategy */
25156
25157/* Include vueAdapter */
25158const shouldUseVueSignInDialog =
25159  "";
25160
25161class VueComponentObserver {
25162  static banner = undefined;
25163  static footer = undefined;
25164
25165  static observeFooterHeight() {
25166    if (VueComponentObserver.getFooter()) {
25167      const fixViewHeightObserver = new MutationObserver(
25168        Assign.footerLinksAndFixViewHeight
25169      );
25170      fixViewHeightObserver.observe(VueComponentObserver.footer, {
25171        attributes: true,
25172        childList: true,
25173        subtree: true,
25174      });
25175    }
25176  }
25177
25178  static observeLinks() {
25179    if (VueComponentObserver.getBanner()) {
25180      const linksObserver = new MutationObserver(Assign.bannerLinks);
25181      linksObserver.observe(VueComponentObserver.banner, {
25182        attributes: false,
25183        childList: true,
25184        subtree: true,
25185      });
25186    }
25187  }
25188
25189  static getBanner() {
25190    if (!VueComponentObserver.banner) {
25191      VueComponentObserver.banner = document.querySelector(
25192        '[id^="base-application-banner"]'
25193      );
25194    }
25195    return VueComponentObserver.banner;
25196  }
25197
25198  static getFooter() {
25199    if (!VueComponentObserver.footer) {
25200      VueComponentObserver.footer = document.querySelector(
25201        '[id^="base-application-footer"]'
25202      );
25203    }
25204    return VueComponentObserver.footer;
25205  }
25206}
25207
25208class DOMHelper {
25209  static findClosestChildNodeAttribute(e, attribute) {
25210    let target = e.target;
25211    let hrefValue = null;
25212
25213    if (target.getAttribute(attribute)) {
25214      hrefValue = target.getAttribute(attribute);
25215    }
25216
25217    if (!hrefValue) {
25218      hrefValue =
25219        DOMHelper.findAttributeInChildren(e.target, attribute) ??
25220        DOMHelper.findAttributeInParent(e.target, attribute);
25221    }
25222    return hrefValue;
25223  }
25224
25225  static findAttributeInParent(target, attribute) {
25226    return target?.parentElement?.attributes.hasOwnProperty(attribute)
25227      ? target.parentElement.attributes[attribute].value
25228      : null;
25229  }
25230
25231  static findAttributeInChildren(target, attribute) {
25232    if (!target || !target.children) return null;
25233
25234    for (var i = 0; i < target.children.length; i++) {
25235      var child = target.children[i];
25236      if (child.getAttribute && child.getAttribute(attribute)) {
25237        return child.getAttribute(attribute);
25238      } else {
25239        var result = DOMHelper.findAttributeInChildren(child, attribute);
25240        if (result !== null) {
25241          return result;
25242        }
25243      }
25244    }
25245
25246    return null;
25247  }
25248
25249  static setClickActionToAllNodes(selector, callback) {
25250    document
25251      .querySelectorAll(selector)
25252      .forEach((element) => element.addEventListener("click", callback));
25253  }
25254}
25255
25256class LinkActions {
25257  static showDialogAndRedirect(redirectLink, target) {
25258    if ((LinkActions.isContractPage() && shouldShowSignInDialog(false, true)) ||
25259        LinkActions.isCheckoutPage()) {
25260      showSignInDialog({
25261        page: "create",
25262        directLink: false,
25263        url: redirectLink,
25264      });
25265    } else {
25266      window.open(redirectLink ?? "/", target ?? "_self");
25267    }
25268  }
25269
25270  static isPreviewPage() {
25271    return (
25272      typeof analyticsPageName === "string" &&
25273      analyticsPageName.includes("Preview")
25274    );
25275  }
25276
25277  static isContractPage() {
25278    return (
25279      typeof analyticsPageName === "string" &&
25280      (analyticsPageName.includes("Index") || LinkActions.isPreviewPage())
25281    );
25282  }
25283
25284  static isCheckoutPage() {
25285    return (
25286      typeof analyticsPageName === "string" &&
25287      (analyticsPageName === "Payment" || analyticsPageName === "Product Selection")
25288    );
25289  }
25290
25291  static currentRedirectLink = undefined;
25292
25293  static setCurrentRedirectLink(e) {
25294    LinkActions.currentRedirectLink = DOMHelper.findClosestChildNodeAttribute(
25295      e,
25296      "href"
25297    );
25298    e.stopImmediatePropagation();
25299  }
25300
25301  static unsetCurrentRedirectLink(e) {
25302    LinkActions.currentRedirectLink = undefined;
25303    e.stopImmediatePropagation();
25304  }
25305
25306  static linkAction(event) {
25307    if (!LinkActions.currentRedirectLink) {
25308      LinkActions.setCurrentRedirectLink(event);
25309    }
25310    LinkActions.showDialogAndRedirect(LinkActions.currentRedirectLink, event.target.getAttribute("target"));
25311  }
25312}
25313
25314class Assign {
25315  static bannerLinks() {
25316    Assign.signInLinks();
25317  }
25318
25319  static footerLinksAndFixViewHeight() {
25320    fixViewHeight();
25321  }
25322
25323  static signInLinks() {
25324    DOMHelper.setClickActionToAllNodes(
25325      "#header .logo-link a",
25326      LinkActions.linkAction
25327    );
25328    DOMHelper.setClickActionToAllNodes(
25329      ".mobile-header .logo-link a",
25330      LinkActions.linkAction
25331    );
25332  }
25333}
25334
25335// Add observer to check for any change in base application footer and banner
25336function initializeVueAdapter() {
25337  if (shouldUseVueSignInDialog) {
25338    if (LinkActions.isPreviewPage() && typeof saveData !== "function") {
25339      saveData = () => {
25340        setSave(false);
25341      };
25342    }
25343    VueComponentObserver.observeFooterHeight();
25344    VueComponentObserver.observeLinks();
25345    Assign.bannerLinks();
25346  }
25347}
25348
25349if (document.readyState !== "loading") {
25350  initializeVueAdapter();
25351} else {
25352  document.addEventListener("DOMContentLoaded", initializeVueAdapter);
25353}
25354
25355(function() {
25356  const handleOpenUrlRequest = (event) => {
25357    LinkActions.showDialogAndRedirect(event.detail.url, event.detail.target);
25358  }
25359
25360  window.addEventListener("@ado/base-application.open-url", handleOpenUrlRequest);
25361})();
25362/* End Include vueAdapter */
25363/* Include jquery.mask.min */
25364if(typeof($) == "function"){
25365   if(!(cssua.ua.ie < 8.0)){
25366      // jQuery Mask Plugin v1.14.12
25367// github.com/igorescobar/jQuery-Mask-Plugin
25368var $jscomp={scope:{},findInternal:function(a,l,d){a instanceof String&&(a=String(a));for(var p=a.length,h=0;h<p;h++){var b=a[h];if(l.call(d,b,h,a))return{i:h,v:b}}return{i:-1,v:void 0}}};$jscomp.defineProperty="function"==typeof Object.defineProperties?Object.defineProperty:function(a,l,d){if(d.get||d.set)throw new TypeError("ES3 does not support getters and setters.");a!=Array.prototype&&a!=Object.prototype&&(a[l]=d.value)};
25369$jscomp.getGlobal=function(a){return"undefined"!=typeof window&&window===a?a:"undefined"!=typeof global&&null!=global?global:a};$jscomp.global=$jscomp.getGlobal(this);$jscomp.polyfill=function(a,l,d,p){if(l){d=$jscomp.global;a=a.split(".");for(p=0;p<a.length-1;p++){var h=a[p];h in d||(d[h]={});d=d[h]}a=a[a.length-1];p=d[a];l=l(p);l!=p&&null!=l&&$jscomp.defineProperty(d,a,{configurable:!0,writable:!0,value:l})}};
25370$jscomp.polyfill("Array.prototype.find",function(a){return a?a:function(a,d){return $jscomp.findInternal(this,a,d).v}},"es6-impl","es3");
25371(function(a,l,d){"function"===typeof define&&define.amd?define(["jquery"],a):"object"===typeof exports?module.exports=a(require("jquery")):a(l||d)})(function(a){var l=function(b,e,f){var c={invalid:[],getCaret:function(){try{var a,r=0,g=b.get(0),e=document.selection,f=g.selectionStart;if(e&&-1===navigator.appVersion.indexOf("MSIE 10"))a=e.createRange(),a.moveStart("character",-c.val().length),r=a.text.length;else if(f||"0"===f)r=f;return r}catch(C){}},setCaret:function(a){try{if(b.is(":focus")){var c,
25372g=b.get(0);g.setSelectionRange?g.setSelectionRange(a,a):(c=g.createTextRange(),c.collapse(!0),c.moveEnd("character",a),c.moveStart("character",a),c.select())}}catch(B){}}
25372,events:function(){b.on("keydown.mask",function(a){b.data("mask-keycode",a.keyCode||a.which);b.data("mask-previus-value",b.val());b.data("mask-previus-caret-pos",c.getCaret());c.maskDigitPosMapOld=c.maskDigitPosMap}).on(a.jMaskGlobals.useInput?"input.mask":"keyup.mask",c.behaviour).on("paste.mask drop.mask",function(){setTimeout(function(){b.trigger("keydown").trigger("keyup")},
25373100)}).on("change.mask",function(){b.data("changed",!0)}).on("blur.mask",function(){d===c.val()||b.data("changed")||b.trigger("change");b.data("changed",!1)}).on("blur.mask",function(){d=c.val()}).on("focus.mask",function(b){!0===f.selectOnFocus&&a(b.target).select()}).on("focusout.mask",function(){f.clearIfNotMatch&&!h.test(c.val())&&c.val("")})},getRegexMask:function(){for(var a=[],b,c,f,n,d=0;d<e.length;d++)((e.charAt(d-1)!='\\')?b=m.translation[e.charAt(d)]:'')?(c=b.pattern.toString().replace(/.{1}$|^.{1}/g,""),f=b.optional,
25374(b=b.recursive)?(a.push(e.charAt(d)),n={digit:e.charAt(d),pattern:c}):a.push(f||b?c+"?":c)):a.push((e.charAt(d)!='\\'||e.charAt(d-1)=='\\')?e.charAt(d).replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"):'');a=a.join("");n&&(a=a.replace(new RegExp("("+n.digit+"(.*"+n.digit+")?)"),"($1)?").replace(new RegExp(n.digit,"g"),n.pattern));return new RegExp(a)},destroyEvents:function(){b.off("input keydown keyup paste drop blur focusout ".split(" ").join(".mask "))},val:function(a){var c=b.is("input")?"val":"text";if(0<arguments.length){if(b[c]()!==a)b[c](a);
25375c=b}else c=b[c]();return c},calculateCaretPosition:function(){var a=b.data("mask-previus-value")||"",e=c.getMasked(),g=c.getCaret();if(a!==e){var f=b.data("mask-previus-caret-pos")||0,e=e.length,d=a.length,m=a=0,h=0,l=0,k;for(k=g;k<e&&c.maskDigitPosMap[k];k++)m++;for(k=g-1;0<=k&&c.maskDigitPosMap[k];k--)a++;for(k=g-1;0<=k;k--)c.maskDigitPosMap[k]&&h++;for(k=f-1;0<=k;k--)c.maskDigitPosMapOld[k]&&l++;g>d?g=10*e:f>=g&&f!==d?c.maskDigitPosMapOld[g]||(f=g,g=g-(l-h)-a,c.maskDigitPosMap[g]&&(g=f)):g>f&&
25376(g=g+(h-l)+m)}return g},behaviour:function(f){f=f||window.event;c.invalid=[];var e=b.data("mask-keycode");if(-1===a.inArray(e,m.byPassKeys)){var e=c.getMasked(),g=c.getCaret();setTimeout(function(){c.setCaret(c.calculateCaretPosition())},10);c.val(e);c.setCaret(g);return c.callbacks(f)}},getMasked:function(a,b){var g=[],d=void 0===b?c.val():b+"",n=0,h=e.length,q=0,l=d.length,k=1,r="push",p=-1,t=0,y=[],v,z;f.reverse?(r="unshift",k=-1,v=0,n=h-1,q=l-1,z=function(){return-1<n&&-1<q}):(v=h-1,z=function(){return n<
25377h&&q<l});for(var A;z();){var x=e.charAt(n),w=d.charAt(q),u=(e.charAt(n-1)!='\\'?m.translation[x]:'');if(u)w.match(u.pattern)?(g[r](w),u.recursive&&(-1===p?p=n:n===v&&(n=p-k),v===p&&(n-=k)),n+=k):w===A?(t--,A=void 0):u.optional?(n+=k,q-=k):u.fallback?(g[r](u.fallback),n+=k,q-=k):c.invalid.push({p:q,v:w,e:u.pattern}),q+=k;else{if(e.charAt(n)!='\\'||e.charAt(n-1)=='\\'){if(!a)g[r](x);w===x?(y.push(q),q+=k):(A=x,y.push(q+t),t++);}n+=k}}d=e.charAt(v);h!==l+1||m.translation[d]||g.push(d);g=g.join("");c.mapMaskdigitPositions(g,y,l);return g},mapMaskdigitPositions:function(a,
25378b,e){a=f.reverse?a.length-e:0;c.maskDigitPosMap={};for(e=0;e<b.length;e++)c.maskDigitPosMap[b[e]+a]=1},callbacks:function(a){var h=c.val(),g=h!==d,m=[h,a,b,f],q=function(a,b,c){"function"===typeof f[a]&&b&&f[a].apply(this,c)};q("onChange",!0===g,m);q("onKeyPress",!0===g,m);q("onComplete",h.length===e.length,m);q("onInvalid",0<c.invalid.length,[h,a,b,c.invalid,f])}};b=a(b);var m=this,d=c.val(),h;e="function"===typeof e?e(c.val(),void 0,b,f):e;m.mask=e;m.options=f;m.remove=function(){var a=c.getCaret();
25379c.destroyEvents();c.val(m.getCleanVal());c.setCaret(a);return b};m.getCleanVal=function(){return c.getMasked(!0)};m.getMaskedVal=function(a){return c.getMasked(!1,a)};m.init=function(d){d=d||!1;f=f||{};m.clearIfNotMatch=a.jMaskGlobals.clearIfNotMatch;m.byPassKeys=a.jMaskGlobals.byPassKeys;m.translation=a.extend({},a.jMaskGlobals.translation,f.translation);m=a.extend(!0,{},m,f);h=c.getRegexMask();if(d)c.events(),c.val(c.getMasked());else{f.placeholder&&b.attr("placeholder",f.placeholder);b.data("mask")&&
25380b.attr("autocomplete","off");d=0;for(var l=!0;d<e.length;d++){var g=m.translation[e.charAt(d)];if(g&&g.recursive){l=!1;break}}l&&b.attr("maxlength",e.length);c.destroyEvents();c.events();d=c.getCaret();c.val(c.getMasked());
vendor: 2,287 bytes, lines 25380-25390
25380c.setCaret(d)}};m.init(!b.is("input"))};a.maskWatchers={};var d=function(){var b=a(this),e={},f=b.attr("data-mask");b.attr("data-mask-reverse")&&(e.reverse=!0);b.attr("data-mask-clearifnotmatch")&&(e.clearIfNotMatch=!0);"true"===b.attr("data-mask-selectonfocus")&&(e.selectOnFocus=
25381!0);if(p(b,f,e))return b.data("mask",new l(this,f,e))},p=function(b,e,f){f=f||{};var c=a(b).data("mask"),d=JSON.stringify;b=a(b).val()||a(b).text();try{return"function"===typeof e&&(e=e(b)),"object"!==typeof c||d(c.options)!==d(f)||c.mask!==e}catch(t){}},h=function(a){var b=document.createElement("div"),d;a="on"+a;d=a in b;d||(b.setAttribute(a,"return;"),d="function"===typeof b[a]);return d};a.fn.mask=function(b,d){d=d||{};var e=this.selector,c=a.jMaskGlobals,h=c.watchInterval,c=d.watchInputs||c.watchInputs,
25382t=function(){if(p(this,b,d))return a(this).data("mask",new l(this,b,d))};a(this).each(t);e&&""!==e&&c&&(clearInterval(a.maskWatchers[e]),a.maskWatchers[e]=setInterval(function(){a(document).find(e).each(t)},h));return this};a.fn.masked=function(a){return this.data("mask").getMaskedVal(a)};a.fn.unmask=function(){clearInterval(a.maskWatchers[this.selector]);delete a.maskWatchers[this.selector];return this.each(function(){var b=a(this).data("mask");b&&b.remove().removeData("mask")})};a.fn.cleanVal=function(){return this.data("mask").getCleanVal()};
25383a.applyDataMask=function(b){b=b||a.jMaskGlobals.maskElements;(b instanceof a?b:a(b)).filter(a.jMaskGlobals.dataMaskAttr).each(d)};h={maskElements:"input,td,span,div",dataMaskAttr:"*[data-mask]",dataMask:!0,watchInterval:300,watchInputs:!0,useInput:!/Chrome\/[2-4][0-9]|SamsungBrowser/.test(window.navigator.userAgent)&&h("input"),watchDataMask:!1,byPassKeys:[9,16,17,18,36,37,38,39,40,91],translation:{0:{pattern:/\d/},9:{pattern:/\d/,optional:!0},"#":{pattern:/\d/,recursive:!0},A:{pattern:/[a-zA-Z0-9]/},
25384S:{pattern:/[a-zA-Z]/},L:{pattern:/[a-zA-Z]/,optional:!0}}};a.jMaskGlobals=a.jMaskGlobals||{};h=a.jMaskGlobals=a.extend(!0,{},h,a.jMaskGlobals);h.dataMask&&a.applyDataMask();setInterval(function(){a.jMaskGlobals.watchDataMask&&a.applyDataMask()},h.watchInterval)},window.jQuery,window.Zepto);
25385   }
25386   else{
25387      $.fn.mask = function() {};
25388   }
25389}
25390//# sourceURL=https://www.legalcontracts.com:5052/common/scripts/m.js?v=857

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.