{"version":3,"file":"SharedScripts.min.js","sources":["SharedScripts.js"],"sourcesContent":[" /*!----------------------------------------------\r\n DO NOT EDIT THIS FILE!\r\n\r\n This file is compiled from the CertifySite Solution and any changes\r\n made here will be lost the next time it is re-compiled. If you need to\r\n make a change and don't have access to the CertifySite solution, ask\r\n someone who does.\r\n\r\n DO NOT EDIT THIS FILE!\r\n ----------------------------------------------*/\r\n\r\nvar localStorageSupported = (function() {\r\n\ttry {\r\n\t\tlocalStorage.setItem('test', 1);\r\n\t\tlocalStorage.removeItem('test');\r\n\t\tsessionStorage.setItem('test', 1);\r\n\t\tsessionStorage.removeItem('test', 1);\r\n\t\treturn true;\r\n\t} catch (e) {\r\n\t\treturn false;\r\n\t}\r\n})();\r\n\r\nif (!(window.console)) {\r\n\tconsole = {\r\n\t\tlog: function() { },\r\n\t\tdebug: function() { },\r\n\t\tinfo: function() { },\r\n\t\twarn: function() { },\r\n\t\terror: function() { }\r\n\t};\r\n}\r\n\r\n// Date.now polyfill for Less than IE9\r\nDate.now = Date.now || function() { return +new Date(); };\n\r\n// Bind polyfill\r\nFunction.prototype.bind = function() {\r\n\tvar fn = this,\r\n args = Array.prototype.slice.call(arguments),\r\n object = args.shift();\r\n\treturn function() {\r\n\t\treturn fn.apply(object,\r\n args.concat(Array.prototype.slice.call(arguments)));\r\n\t};\r\n};\r\n\r\n// Array indexOf polyfill\r\nif (!Array.prototype.indexOf) {\r\n\tArray.prototype.indexOf = function(obj, start) {\r\n\t\tfor (var i = (start || 0), j = this.length; i < j; i++) {\r\n\t\t\tif (this[i] === obj) { return i; }\r\n\t\t}\r\n\t\treturn -1;\r\n\t};\r\n}\r\n\r\n\r\n// **************************************************************************************************\r\n// Local + session storage polyfill. Always use these methods to access localstorage because\r\n// LocalStorage is not available on older browsers, and there is some weird behavior on safari\r\n// when browsingin private mode.\r\n// **************************************************************************************************\r\nvar Storage = {\r\n\tlocal: {\r\n\t\tset: function(key, value) {\r\n\t\t\ttry {\r\n\t\t\t\tlocalStorage[key] = value;\r\n\t\t\t}\r\n\t\t\tcatch (error) {\r\n\t\t\t\tdocCookies.setItem(key, value);\r\n\t\t\t}\r\n\t\t},\r\n\t\tget: function(key) {\r\n\t\t\ttry {\r\n\t\t\t\treturn localStorage[key];\r\n\t\t\t}\r\n\t\t\tcatch (error) {\r\n\t\t\t\treturn docCookies.getItem(key);\r\n\t\t\t}\r\n\t\t},\r\n\t\tkeys: function() {\r\n\t\t\tvar lsKeys = [];\r\n\t\t\ttry {\r\n\t\t\t\tfor (var key in localStorage) {\r\n\t\t\t\t\tlsKeys.push(key);\r\n\t\t\t\t}\r\n\t\t\t\treturn lsKeys;\r\n\t\t\t} catch (error) {\r\n\t\t\t\tconsole.log(error);\r\n\r\n\t\t\t\treturn docCookies.keys();\r\n\t\t\t}\r\n\t\t},\r\n\t\tremove: function(key) {\r\n\t\t\ttry {\r\n\t\t\t\tlocalStorage.removeItem(key);\r\n\t\t\t} catch (error) {\r\n\t\t\t\tdocCookies.removeItem(key);\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n\tsession: {\r\n\t\tset: function(key, value) {\r\n\t\t\ttry {\r\n\t\t\t\tsessionStorage[key] = value;\r\n\t\t\t}\r\n\t\t\tcatch (error) {\r\n\t\t\t\t// Clear cookie after 2 minutes in lieu of being able to clear at end of session.\r\n\t\t\t\tdocCookies.setItem(key, value, 120000);\r\n }\r\n },\r\n\r\n\t\tkeys: function() {\r\n\t\t\tvar ssKeys = [];\r\n\t\t\ttry {\r\n\t\t\t\tfor (var key in sessionStorage) {\r\n\t\t\t\t\tssKeys.push(key);\r\n\t\t\t\t}\r\n\t\t\t\treturn ssKeys;\r\n\t\t\t} catch (error) {\r\n\t\t\t\tconsole.log(error);\r\n\r\n\t\t\t\treturn docCookies.keys();\r\n\t\t\t}\r\n\t\t},\r\n\t\tget: function(key) {\r\n\t\t\ttry {\r\n\t\t\t\treturn sessionStorage[key];\r\n\t\t\t}\r\n\t\t\tcatch (error) {\r\n\t\t\t\treturn docCookies.getItem(key);\r\n\t\t\t}\r\n\t\t},\r\n\t\tremove: function(key) {\r\n\t\t\ttry {\r\n\t\t\t\tsessionStorage.removeItem(key);\r\n\t\t\t} catch (error) {\r\n\t\t\t\tdocCookies.removeItem(key);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n};\r\n\r\n\r\n// ES6 Promise polyfill\r\n!function(e) { function n() { } function t(e, n) { return function() { e.apply(n, arguments) } } function o(e) { if (\"object\" != typeof this) throw new TypeError(\"Promises must be constructed via new\"); if (\"function\" != typeof e) throw new TypeError(\"not a function\"); this._state = 0, this._handled = !1, this._value = void 0, this._deferreds = [], s(e, this) } function i(e, n) { for (; 3 === e._state;)e = e._value; return 0 === e._state ? void e._deferreds.push(n) : (e._handled = !0, void o._immediateFn(function() { var t = 1 === e._state ? n.onFulfilled : n.onRejected; if (null === t) return void (1 === e._state ? r : u)(n.promise, e._value); var o; try { o = t(e._value) } catch (i) { return void u(n.promise, i) } r(n.promise, o) })) } function r(e, n) { try { if (n === e) throw new TypeError(\"A promise cannot be resolved with itself.\"); if (n && (\"object\" == typeof n || \"function\" == typeof n)) { var i = n.then; if (n instanceof o) return e._state = 3, e._value = n, void f(e); if (\"function\" == typeof i) return void s(t(i, n), e) } e._state = 1, e._value = n, f(e) } catch (r) { u(e, r) } } function u(e, n) { e._state = 2, e._value = n, f(e) } function f(e) { 2 === e._state && 0 === e._deferreds.length && o._immediateFn(function() { e._handled || o._unhandledRejectionFn(e._value) }); for (var n = 0, t = e._deferreds.length; n < t; n++)i(e, e._deferreds[n]); e._deferreds = null } function c(e, n, t) { this.onFulfilled = \"function\" == typeof e ? e : null, this.onRejected = \"function\" == typeof n ? n : null, this.promise = t } function s(e, n) { var t = !1; try { e(function(e) { t || (t = !0, r(n, e)) }, function(e) { t || (t = !0, u(n, e)) }) } catch (o) { if (t) return; t = !0, u(n, o) } } var a = setTimeout; o.prototype[\"catch\"] = function(e) { return this.then(null, e) }, o.prototype.then = function(e, t) { var o = new this.constructor(n); return i(this, new c(e, t, o)), o }, o.all = function(e) { var n = Array.prototype.slice.call(e); return new o(function(e, t) { function o(r, u) { try { if (u && (\"object\" == typeof u || \"function\" == typeof u)) { var f = u.then; if (\"function\" == typeof f) return void f.call(u, function(e) { o(r, e) }, t) } n[r] = u, 0 === --i && e(n) } catch (c) { t(c) } } if (0 === n.length) return e([]); for (var i = n.length, r = 0; r < n.length; r++)o(r, n[r]) }) }, o.resolve = function(e) { return e && \"object\" == typeof e && e.constructor === o ? e : new o(function(n) { n(e) }) }, o.reject = function(e) { return new o(function(n, t) { t(e) }) }, o.race = function(e) { return new o(function(n, t) { for (var o = 0, i = e.length; o < i; o++)e[o].then(n, t) }) }, o._immediateFn = \"function\" == typeof setImmediate && function(e) { setImmediate(e) } || function(e) { a(e, 0) }, o._unhandledRejectionFn = function(e) { \"undefined\" != typeof console && console && console.warn(\"Possible Unhandled Promise Rejection:\", e) }, o._setImmediateFn = function(e) { o._immediateFn = e }, o._setUnhandledRejectionFn = function(e) { o._unhandledRejectionFn = e }, \"undefined\" != typeof module && module.exports ? module.exports = o : e.Promise || (e.Promise = o) }(this);\r\n\r\n\n\r\n// ***********\r\n// UTILITIES\r\n// ***********\r\n/*\r\n\tmaps query string parameters to the urlParams object for easy access.\r\n\tURLinfo object provides formatted, easier access to commonly used properties\r\n\tof the window.location object.\r\n*/\r\nvar URLinfo = {\r\n\thref: window.location.href.toLowerCase(),\r\n\tpath: window.location.pathname.substring(1).toLowerCase(),\r\n\thost: window.location.host.toLowerCase()\r\n};\r\n\r\nvar urlParams = {};\r\n\r\n(function() {\r\n\tvar queryString = window.location.search.substring(1);\r\n\tvar params = queryString.split('&');\r\n\tvar pairs;\r\n\r\n\tif (queryString) {\r\n\t\tvar i = 0;\r\n\t\tvar numParams = params.length;\r\n\t\twhile (i < numParams) {\r\n\t\t\tpairs = params[i].split('=');\r\n\t\t\tswitch (pairs[0]) {\r\n\t\t\t\tcase 's':\r\n\t\t\t\t\tpairs[0] = 'campaign';\r\n\t\t\t\t\tpairs[1] = pairs[1] ? decodeURIComponent(pairs[1]) : pairs[1];\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase 'r':\r\n\t\t\t\t\tpairs[0] = 'resourceRequested';\r\n\t\t\t\t\tpairs[1] = pairs[1] ? decodeURIComponent(pairs[1]) : pairs[1];\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase 'ls':\r\n\t\t\t\t\tpairs[0] = 'leadSource';\r\n\t\t\t\t\tpairs[1] = pairs[1] ? decodeURIComponent(pairs[1]) : pairs[1];\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase 'lt':\r\n\t\t\t\t\tpairs[0] = 'leadType';\r\n\t\t\t\t\tpairs[1] = pairs[1] ? decodeURIComponent(pairs[1]) : pairs[1];\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase 'rt':\r\n\t\t\t\t\tpairs[0] = 'resourceType';\r\n\t\t\t\t\tpairs[1] = pairs[1] ? decodeURIComponent(pairs[1]) : pairs[1];\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase 'rp':\r\n\t\t\t\t\tpairs[0] = 'referralPartner';\r\n\t\t\t\t\tpairs[1] = pairs[1] ? decodeURIComponent(pairs[1]) : pairs[1];\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase 'p':\r\n\t\t\t\t\tpairs[0] = 'pardotUrl';\r\n\t\t\t\t\tpairs[1] = pairs[1] ? decodeURIComponent(pairs[1]) : pairs[1];\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase 'c':\r\n\t\t\t\t\tpairs[0] = 'completionUrl';\r\n\t\t\t\t\tpairs[1] = pairs[1] ? decodeURIComponent(pairs[1]) : pairs[1];\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase 'd':\r\n\t\t\t\t\t\tpairs[0] = 'productRequested';\r\n\t\t\t\t\t\tpairs[1] = pairs[1] ? decodeURIComponent(pairs[1]) : pairs[1];\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\turlParams[pairs[0]] = pairs[1];\r\n\t\t\ti++;\r\n\t\t}\r\n\t}\r\n})();\r\n\r\n// math helpers\r\nfunction pxToPercent(pxValue, percent) {\r\n\treturn pxValue * (percent / 100);\r\n}\n\r\n\r\n// check browser + browser version\r\nvar browser = (function() {\r\n\tvar ua = navigator.userAgent, tem,\r\n\tM = ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\\/))\\/?\\s*(\\d+)/i) || [];\r\n\tif (/trident/i.test(M[1])) {\r\n\t\ttem = /\\brv[ :]+(\\d+)/g.exec(ua) || [];\r\n\t\treturn 'IE ' + (tem[1] || '');\r\n\t}\r\n\tif (M[1] === 'Chrome') {\r\n\t\ttem = ua.match(/\\bOPR\\/(\\d+)/);\r\n\t\tif (tem !== null) {\r\n\t\t\treturn 'Opera ' + tem[1];\r\n\t\t}\r\n\t}\r\n\tM = M[2] ? [M[1], M[2]] : [navigator.appName, navigator.appVersion, '-?'];\r\n\tif ((tem = ua.match(/version\\/(\\d+)/i)) !== null) {\r\n\t\tM.splice(1, 1, tem[1]);\r\n\t}\r\n\treturn M.join(' ');\r\n})();\r\n\r\n// identify legacy IE browser\r\nvar isLegacyIE = (function() {\r\n\tvar legacyStrings = ['IE 8', 'IE 7', 'IE 6', 'MSIE 8', 'MSIE 7', 'MSIE 6'];\r\n\tbrowser = browser.toUpperCase();\r\n\treturn $.inArray(browser, legacyStrings) > -1;\r\n})();\r\n\r\n\r\n// Window width detection functions\r\n\r\nvar verticalScrollPresent = function() {\r\n\treturn (document.documentElement.scrollHeight !== document.documentElement.clientHeight);\r\n};\r\n\r\nvar scrollBarWidth = (function() {\r\n\tvar $outer = $('
').css({ visibility: 'hidden', width: 100, overflow: 'scroll' }).appendTo('body'), widthWithScroll = $('
').css({ width: '100%' }).appendTo($outer).outerWidth();\r\n\t$outer.remove();\r\n\treturn 100 - widthWithScroll;\r\n});\r\n\r\nvar getFullWindowWidth = function() {\r\n\tif (verticalScrollPresent) {\r\n\t\treturn $(window).width() + scrollBarWidth;\r\n\t}\r\n\treturn $(window).width();\r\n};\r\n\r\n\r\n// Layout Utilities\r\n\r\nfunction removeTitleBar() {\r\n\t$('#BannerContainer').remove();\r\n\t$('.PostHeaderContainer').css({\r\n\t\t'width': '100%',\r\n\t\t'max-width': '100%',\r\n\t\t'border-bottom': '1px solid #ddd'\r\n\t});\r\n}\r\n\r\nfunction getRandomInt(min, max) {\n return Math.floor(Math.random() * (max - min + 1)) + min;\n}\n\nif (typeof JSON == 'undefined') {\r\n\t/*! JSON v3.3.2 | http://bestiejs.github.io/json3 | Copyright 2012-2014, Kit Cambridge | http://kit.mit-license.org */\r\n\t(function () { function t(e, n) { function c(t) { if (c[t] !== b) return c[t]; var e; if (\"bug-string-char-index\" == t) e = \"a\" != \"a\"[0]; else if (\"json\" == t) e = c(\"json-stringify\") && c(\"json-parse\"); else { var r; if (\"json-stringify\" == t) { e = n.stringify; var o = \"function\" == typeof e && d; if (o) { (r = function () { return 1 }).toJSON = r; try { o = \"0\" === e(0) && \"0\" === e(new i) && '\"\"' == e(new l) && e(j) === b && e(b) === b && e() === b && \"1\" === e(r) && \"[1]\" == e([r]) && \"[null]\" == e([b]) && \"null\" == e(null) && \"[null,null,null]\" == e([b, j, null]) && '{\"a\":[1,true,false,null,\"\\\\u0000\\\\b\\\\n\\\\f\\\\r\\\\t\"]}' == e({ a: [r, !0, !1, null, \"\\x00\\b\\n\\f\\r\t\"] }) && \"1\" === e(null, r) && \"[\\n 1,\\n 2\\n]\" == e([1, 2], null, 1) && '\"-271821-04-20T00:00:00.000Z\"' == e(new f(-864e13)) && '\"+275760-09-13T00:00:00.000Z\"' == e(new f(864e13)) && '\"-000001-01-01T00:00:00.000Z\"' == e(new f(-621987552e5)) && '\"1969-12-31T23:59:59.999Z\"' == e(new f(-1)) } catch (a) { o = !1 } } e = o } if (\"json-parse\" == t) { if (e = n.parse, \"function\" == typeof e) try { if (0 === e(\"0\") && !e(!1)) { r = e('{\"a\":[1,true,false,null,\"\\\\u0000\\\\b\\\\n\\\\f\\\\r\\\\t\"]}'); var u = 5 == r.a.length && 1 === r.a[0]; if (u) { try { u = !e('\"\t\"') } catch (s) { } if (u) try { u = 1 !== e(\"01\") } catch (h) { } if (u) try { u = 1 !== e(\"1.\") } catch (p) { } } } } catch (g) { u = !1 } e = u } } return c[t] = !!e } e || (e = o.Object()), n || (n = o.Object()); var i = e.Number || o.Number, l = e.String || o.String, a = e.Object || o.Object, f = e.Date || o.Date, u = e.SyntaxError || o.SyntaxError, s = e.TypeError || o.TypeError, h = e.Math || o.Math, p = e.JSON || o.JSON; \"object\" == typeof p && p && (n.stringify = p.stringify, n.parse = p.parse); var g, y, b, a = a.prototype, j = a.toString, d = new f(-0xc782b5b800cec); try { d = -109252 == d.getUTCFullYear() && 0 === d.getUTCMonth() && 1 === d.getUTCDate() && 10 == d.getUTCHours() && 37 == d.getUTCMinutes() && 6 == d.getUTCSeconds() && 708 == d.getUTCMilliseconds() } catch (C) { } if (!c(\"json\")) { var v = c(\"bug-string-char-index\"); if (!d) var S = h.floor, O = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334], A = function (t, e) { return O[e] + 365 * (t - 1970) + S((t - 1969 + (e = +(e > 1))) / 4) - S((t - 1901 + e) / 100) + S((t - 1601 + e) / 400) }; if ((g = a.hasOwnProperty) || (g = function (t) { var e, r = {}; return (r.__proto__ = null, r.__proto__ = { toString: 1 }, r).toString != j ? g = function (t) { var e = this.__proto__; return t = t in (this.__proto__ = null, this), this.__proto__ = e, t } : (e = r.constructor, g = function (t) { var r = (this.constructor || e).prototype; return t in this && !(t in r && this[t] === r[t]) }), r = null, g.call(this, t) }), y = function (t, e) { var n, o, c, i = 0; (n = function () { this.valueOf = 0 }).prototype.valueOf = 0, o = new n; for (c in o) g.call(o, c) && i++; return n = o = null, i ? y = 2 == i ? function (t, e) { var r, n = {}, o = \"[object Function]\" == j.call(t); for (r in t) o && \"prototype\" == r || g.call(n, r) || !(n[r] = 1) || !g.call(t, r) || e(r) } : function (t, e) { var r, n, o = \"[object Function]\" == j.call(t); for (r in t) o && \"prototype\" == r || !g.call(t, r) || (n = \"constructor\" === r) || e(r); (n || g.call(t, r = \"constructor\")) && e(r) } : (o = \"valueOf toString toLocaleString propertyIsEnumerable isPrototypeOf hasOwnProperty constructor\".split(\" \"), y = function (t, e) { var n, c = \"[object Function]\" == j.call(t), i = !c && \"function\" != typeof t.constructor && r[typeof t.hasOwnProperty] && t.hasOwnProperty || g; for (n in t) c && \"prototype\" == n || !i.call(t, n) || e(n); for (c = o.length; n = o[--c]; i.call(t, n) && e(n)); }), y(t, e) }, !c(\"json-stringify\")) { var w = { 92: \"\\\\\\\\\", 34: '\\\\\"', 8: \"\\\\b\", 12: \"\\\\f\", 10: \"\\\\n\", 13: \"\\\\r\", 9: \"\\\\t\" }, T = function (t, e) { return (\"000000\" + (e || 0)).slice(-t) }, _ = function (t) { for (var e = '\"', r = 0, n = t.length, o = !v || n > 10, c = o && (v ? t.split(\"\") : t) ; n > r; r++) { var i = t.charCodeAt(r); switch (i) { case 8: case 9: case 10: case 12: case 13: case 34: case 92: e += w[i]; break; default: if (32 > i) { e += \"\\\\u00\" + T(2, i.toString(16)); break } e += o ? c[r] : t.charAt(r) } } return e + '\"' }, N = function (t, e, r, n, o, c, i) { var l, a, f, u, h, p, d, C, v; try { l = e[t] } catch (O) { } if (\"object\" == typeof l && l) if (a = j.call(l), \"[object Date]\" != a || g.call(l, \"toJSON\")) \"function\" == typeof l.toJSON && (\"[object Number]\" != a && \"[object String]\" != a && \"[object Array]\" != a || g.call(l, \"toJSON\")) && (l = l.toJSON(t)); else if (l > -1 / 0 && 1 / 0 > l) { if (A) { for (u = S(l / 864e5), a = S(u / 365.2425) + 1970 - 1; A(a + 1, 0) <= u; a++); for (f = S((u - A(a, 0)) / 30.42) ; A(a, f + 1) <= u; f++); u = 1 + u - A(a, f), h = (l % 864e5 + 864e5) % 864e5, p = S(h / 36e5) % 24, d = S(h / 6e4) % 60, C = S(h / 1e3) % 60, h %= 1e3 } else a = l.getUTCFullYear(), f = l.getUTCMonth(), u = l.getUTCDate(), p = l.getUTCHours(), d = l.getUTCMinutes(), C = l.getUTCSeconds(), h = l.getUTCMilliseconds(); l = (0 >= a || a >= 1e4 ? (0 > a ? \"-\" : \"+\") + T(6, 0 > a ? -a : a) : T(4, a)) + \"-\" + T(2, f + 1) + \"-\" + T(2, u) + \"T\" + T(2, p) + \":\" + T(2, d) + \":\" + T(2, C) + \".\" + T(3, h) + \"Z\" } else l = null; if (r && (l = r.call(e, t, l)), null === l) return \"null\"; if (a = j.call(l), \"[object Boolean]\" == a) return \"\" + l; if (\"[object Number]\" == a) return l > -1 / 0 && 1 / 0 > l ? \"\" + l : \"null\"; if (\"[object String]\" == a) return _(\"\" + l); if (\"object\" == typeof l) { for (t = i.length; t--;) if (i[t] === l) throw s(); if (i.push(l), v = [], e = c, c += o, \"[object Array]\" == a) { for (f = 0, t = l.length; t > f; f++) a = N(f, l, r, n, o, c, i), v.push(a === b ? \"null\" : a); t = v.length ? o ? \"[\\n\" + c + v.join(\",\\n\" + c) + \"\\n\" + e + \"]\" : \"[\" + v.join(\",\") + \"]\" : \"[]\" } else y(n || l, function (t) { var e = N(t, l, r, n, o, c, i); e !== b && v.push(_(t) + \":\" + (o ? \" \" : \"\") + e) }), t = v.length ? o ? \"{\\n\" + c + v.join(\",\\n\" + c) + \"\\n\" + e + \"}\" : \"{\" + v.join(\",\") + \"}\" : \"{}\"; return i.pop(), t } }; n.stringify = function (t, e, n) { var o, c, i, l; if (r[typeof e] && e) if (\"[object Function]\" == (l = j.call(e))) c = e; else if (\"[object Array]\" == l) { i = {}; for (var a, f = 0, u = e.length; u > f; a = e[f++], l = j.call(a), (\"[object String]\" == l || \"[object Number]\" == l) && (i[a] = 1)); } if (n) if (\"[object Number]\" == (l = j.call(n))) { if (0 < (n -= n % 1)) for (o = \"\", n > 10 && (n = 10) ; o.length < n; o += \" \"); } else \"[object String]\" == l && (o = 10 >= n.length ? n : n.slice(0, 10)); return N(\"\", (a = {}, a[\"\"] = t, a), c, i, o, \"\", []) } } if (!c(\"json-parse\")) { var U, J, m = l.fromCharCode, x = { 92: \"\\\\\", 34: '\"', 47: \"/\", 98: \"\\b\", 116: \"\t\", 110: \"\\n\", 102: \"\\f\", 114: \"\\r\" }, M = function () { throw U = J = null, u() }, F = function () { for (var t, e, r, n, o, c = J, i = c.length; i > U;) switch (o = c.charCodeAt(U)) { case 9: case 10: case 13: case 32: U++; break; case 123: case 125: case 91: case 93: case 58: case 44: return t = v ? c.charAt(U) : c[U], U++, t; case 34: for (t = \"@\", U++; i > U;) if (o = c.charCodeAt(U), 32 > o) M(); else if (92 == o) switch (o = c.charCodeAt(++U)) { case 92: case 34: case 47: case 98: case 116: case 110: case 102: case 114: t += x[o], U++; break; case 117: for (e = ++U, r = U + 4; r > U; U++) o = c.charCodeAt(U), o >= 48 && 57 >= o || o >= 97 && 102 >= o || o >= 65 && 70 >= o || M(); t += m(\"0x\" + c.slice(e, U)); break; default: M() } else { if (34 == o) break; for (o = c.charCodeAt(U), e = U; o >= 32 && 92 != o && 34 != o;) o = c.charCodeAt(++U); t += c.slice(e, U) } if (34 == c.charCodeAt(U)) return U++, t; M(); default: if (e = U, 45 == o && (n = !0, o = c.charCodeAt(++U)), o >= 48 && 57 >= o) { for (48 == o && (o = c.charCodeAt(U + 1), o >= 48 && 57 >= o) && M() ; i > U && (o = c.charCodeAt(U), o >= 48 && 57 >= o) ; U++); if (46 == c.charCodeAt(U)) { for (r = ++U; i > r && (o = c.charCodeAt(r), o >= 48 && 57 >= o) ; r++); r == U && M(), U = r } if (o = c.charCodeAt(U), 101 == o || 69 == o) { for (o = c.charCodeAt(++U), 43 != o && 45 != o || U++, r = U; i > r && (o = c.charCodeAt(r), o >= 48 && 57 >= o) ; r++); r == U && M(), U = r } return +c.slice(e, U) } if (n && M(), \"true\" == c.slice(U, U + 4)) return U += 4, !0; if (\"false\" == c.slice(U, U + 5)) return U += 5, !1; if (\"null\" == c.slice(U, U + 4)) return U += 4, null; M() } return \"$\" }, k = function (t) { var e, r; if (\"$\" == t && M(), \"string\" == typeof t) { if (\"@\" == (v ? t.charAt(0) : t[0])) return t.slice(1); if (\"[\" == t) { for (e = []; t = F(), \"]\" != t; r || (r = !0)) r && (\",\" == t ? (t = F(), \"]\" == t && M()) : M()), \",\" == t && M(), e.push(k(t)); return e } if (\"{\" == t) { for (e = {}; t = F(), \"}\" != t; r || (r = !0)) r && (\",\" == t ? (t = F(), \"}\" == t && M()) : M()), \",\" != t && \"string\" == typeof t && \"@\" == (v ? t.charAt(0) : t[0]) && \":\" == F() || M(), e[t.slice(1)] = k(F()); return e } M() } return t }, D = function (t, e, r) { r = E(t, e, r), r === b ? delete t[e] : t[e] = r }, E = function (t, e, r) { var n, o = t[e]; if (\"object\" == typeof o && o) if (\"[object Array]\" == j.call(o)) for (n = o.length; n--;) D(o, n, r); else y(o, function (t) { D(o, t, r) }); return r.call(t, e, o) }; n.parse = function (t, e) { var r, n; return U = 0, J = \"\" + t, r = k(F()), \"$\" != F() && M(), U = J = null, e && \"[object Function]\" == j.call(e) ? E((n = {}, n[\"\"] = r, n), \"\", e) : r } } } return n.runInContext = t, n } var e = \"function\" == typeof define && define.amd, r = { \"function\": !0, object: !0 }, n = r[typeof exports] && exports && !exports.nodeType && exports, o = r[typeof window] && window || this, c = n && r[typeof module] && module && !module.nodeType && \"object\" == typeof global && global; if (!c || c.global !== c && c.window !== c && c.self !== c || (o = c), n && !e) t(o, n); else { var i = o.JSON, l = o.JSON3, a = !1, f = t(o, o.JSON3 = { noConflict: function () { return a || (a = !0, o.JSON = i, o.JSON3 = l, i = l = null), f } }); o.JSON = { parse: f.parse, stringify: f.stringify } } e && define(function () { return f }) }).call(this);\r\n}\n// ***********\r\n// ANALYTICS\r\n// ***********\r\nvar preventTracking = Storage.session.get('preventTracking') || (function() {\r\n\tif (urlParams.track) { return false; }\r\n\tif (window.location.hostname.indexOf('certify.com') == -1 && window.location.hostname !== 'localhost') {\r\n\t\treturn true;\r\n\t}\r\n})();\r\n\r\nfunction gaEvent(category, action, label, value) {\r\n\tif (preventTracking) {\r\n\t\treturn false;\r\n\t}\r\n\tvar eventLabel = label || '';\r\n\tif (value) {\r\n\t\tga('send', 'event', category, action, eventLabel, value);\r\n\t} else {\r\n\t\tga('send', 'event', category, action, eventLabel);\r\n\t}\r\n}\r\n\r\nfunction reportErrorToGA(error, category, type) {\r\n\tgaEvent(category, type, error.message);\r\n\tconsole.log(error);\r\n}\r\n\n$(document).ready(function () {\r\n setTimeout(function () {\r\n var $isFloatingLabelsPresent = $('.form--floating-labels').length;\r\n \r\n //.form.form--float is present on page\r\n if ($isFloatingLabelsPresent) {\r\n floatFormLabels();\r\n }\r\n\r\n function floatFormLabels() {\r\n\r\n //Delay script to make sure select element inputs are added\r\n setTimeout(function () {\r\n var $form = $('.form--floating-labels'),\r\n $fields = $form.find('.formField');\r\n\r\n //Fade in demo request form when form is ready (delayed slightly to make sure all inputs are there)\r\n $form.addClass('show');\r\n\r\n //When field is in focus...\r\n $fields.on('focus', function (e) {\r\n var $input = $(this),\r\n $wrap = $input.parent('.js-float-label');\r\n\r\n //Adds color to floating label\r\n $wrap.addClass('focus');\r\n\r\n //Activate floating label\r\n activateLabel($input, $wrap);\r\n });\r\n\r\n //When field looses focus..\r\n $fields.on('blur', function (e) {\r\n var $input = $(this),\r\n $wrap = $input.parent('.js-float-label'),\r\n isEmpty = $input.val() === '';\r\n\r\n $wrap.removeClass('focus');\r\n\r\n //if input is empty then remove floating-label\r\n if (isEmpty) {\r\n deactivateLabel($input, $wrap);\r\n }\r\n else {\r\n //If input is filled and is the country label activate phone label since its been changed\r\n if ($input.attr('name') == 'ac-country') {\r\n $input = $('#phone');\r\n $wrap = $input.parent('.js-float-label');\r\n\r\n activateLabel($input, $wrap);\r\n\r\n //Check if State is International, if so activate label\r\n var $state = $('#ac-state');\r\n var $stateWrap = $state.parent('.js-float-label');\r\n var $stateDisabled = $('#ac-state').attr('disabled');\r\n\r\n if ($stateDisabled == 'disabled') {\r\n activateLabel($state, $stateWrap);\r\n }\r\n }\r\n }\r\n });\r\n\r\n //Activate label-float and remove placeholder text\r\n function activateLabel($input, $wrap) {\r\n var $label = $wrap.find('label'),\r\n $labelHeight = $label.height(),\r\n $activate = true;\r\n\r\n //Makes label-float visible\r\n $wrap.addClass('has-floating-label');\r\n\r\n //If label is larger than one line, then apply some style adjustments relative to height\r\n if ($labelHeight > 15) {\r\n labelFieldSpacing($activate, $labelHeight, $label, $wrap, $input);\r\n }\r\n\r\n //Remove placeholder text in input\r\n $input.attr('placeholder', '');\r\n\r\n // Animate the label-float element to top of input & Mark as 'isActive'\r\n setTimeout(function () {\r\n $wrap.addClass('animate');\r\n }, 50);\r\n };\r\n\r\n //Replace label-float with placeholder text\r\n function deactivateLabel($input, $wrap) {\r\n var $label = $wrap.find('label'),\r\n $labelHeight = $label.height(),\r\n $labelTxt = $wrap.find('.floating-label').text(),\r\n $activate = false;\r\n\r\n if ($labelHeight > 15) {\r\n labelFieldSpacing($activate, $labelHeight, $label, $wrap, $input)\r\n }\r\n\r\n $wrap.removeClass('animate');\r\n\r\n //Hide floating label and add placeholder text back in\r\n setTimeout(function () {\r\n $wrap.removeClass('has-floating-label');\r\n $input.attr('placeholder', $labelTxt);\r\n }, 50);\r\n }\r\n\r\n function labelFieldSpacing($activate, $labelHeight, $label, $wrap, $input) {\r\n if ($activate) {\r\n var marginAdjust = $labelHeight + 4,\r\n positionAdjust = $labelHeight - 8;\r\n\r\n if ($(window).width() < 765) {\r\n marginAdjust = $labelHeight + 5;\r\n }\r\n\r\n $label.attr('style', 'top: -' + positionAdjust + 'px');\r\n $wrap.attr('style', 'margin-top:' + marginAdjust + 'px');\r\n\r\n //Make input regular height while label is floating (no placeholder)\r\n $input.attr('style', 'max-height: 53px');\r\n }\r\n else {\r\n $input.removeAttr('style');\r\n $label.attr('style', 'top: 0;');\r\n $wrap.removeAttr('style');\r\n $label.removeAttr('style');\r\n }\r\n }\r\n }, 500);\r\n\r\n };\r\n }, 500);\r\n});\n//Free Trial adjustments\r\n$(document).ready(function () {\r\n\r\n var placeholder = \"Select one or more\";\r\n\r\n //Set up supporting elements if they don't exist (Free Trial page)\r\n pageSetup(placeholder);\r\n\r\n //Password Field, space for password status label\r\n $('#registrationInfo #pwCell .formField').on('input', function () {\r\n $(this).parent('#pwCell').addClass('active');\r\n });\r\n\r\n $('#registrationInfo #pwStatus').removeAttr(\"style\");\r\n\r\n $('#registrationInfo #pwCell .formField').keydown(function () {\r\n if ($(this).val() == \"\") {\r\n $(this).parent('#pwCell').removeClass('active');\r\n }\r\n });\r\n\r\n //Resize form table on mobile (Free Trial)\r\n if ($(window).width() < 765) {\r\n $(\"#registrationInfo\").attr(\"width\", \"100%\");\r\n $(\"#WizNavButtonsTable\").attr(\"width\", \"100%\");\r\n var leftMargin = $(\".objTextPanelTable-table-margin\").find(\"tr:nth-of-type(2) td:first\");\r\n $(leftMargin).css(\"display\", \"none\");\r\n $('td.left-table-margin').remove();\r\n $('td.left-table-margin').css(\"display\", \"none\");\r\n }\r\n\r\n function pageSetup(placeholder) {\r\n var isFreeTrial = $(\"#registrationInfoContent\").length > 0;\r\n\r\n if (isFreeTrial == true) {\r\n var origDD = $(\".multi-select-dropdown\");\r\n\r\n $(origDD).wrap(\"
\");\r\n $('.multi-select-wrap').wrap(\"
\");\r\n $(origDD).before(\"\");\r\n $(origDD).before(\"
\");\r\n $(origDD).find(\"option\").addClass(\"multi-option\");\r\n $(origDD).find(\"option[value='\" + placeholder + \"']\").addClass(\"ignore\");\r\n\r\n var multiSelectInner = $(\".multi-select-dropdown\").html();\r\n var optionInner = $('.multi-option').html();\r\n\r\n $(origDD).replaceWith($('
' + multiSelectInner + '
'));\r\n\r\n $('.multi-option').each(function () {\r\n var value = $(this).attr(\"value\"),\r\n optionInner = $(this).html(),\r\n isIgnore = $(this).text(),\r\n isEmpty = $(this).text() == \"\";\r\n\r\n if (isIgnore == placeholder) {\r\n $(this).replaceWith($('
'));\r\n } else {\r\n $(this).replaceWith($('
'));\r\n }\r\n\r\n if (isEmpty) {\r\n $(this).remove();\r\n }\r\n })\r\n\r\n var newDD = $('.multi-select-dropdown');\r\n\r\n $(newDD).find('label[value=\"\"]').remove();\r\n $(newDD).find(\"label:first-of-type\").attr(\"value\", \"\");\r\n $(newDD).find(\"label\").wrapAll(\"
\");\r\n $(newDD).find('label:not(\".ignore\")').prepend('');\r\n }\r\n }\r\n});\n// REPLACE \"LEVERDEMO\" WITH YOUR COMPANY NAME BELOW\r\nurl = 'https://api.lever.co/v0/postings/certify?department=Certify&department=Tallie'\r\n\r\n\r\n//Setting up the structure for each job posting\r\nfunction createJobs(_data) {\r\n\r\n //Checking for potential Lever source or origin parameters\r\n var pageUrl = window.location.href;\r\n var leverParameter = '';\r\n var trackingPrefix = '?lever-'\r\n\r\n if (pageUrl.indexOf(trackingPrefix) >= 0) {\r\n // Found Lever parameter\r\n var pageUrlSplit = pageUrl.split(trackingPrefix);\r\n leverParameter = '?lever-' + pageUrlSplit[1];\r\n }\r\n\r\n for (i = 0; i < _data.length; i++) {\r\n var posting = _data[i]\r\n var title = posting.text\r\n var description = posting.description\r\n\r\n //Grab only second paragraph\r\n var html = $.parseHTML(description);\r\n var string = $(html).eq(2).text();\r\n\r\n //Making each job description shorter than 250 characters\r\n var shortDescription = $.trim(string).substring(0, 250)\r\n .replace('\\n', ' ') + \"...\";\r\n var location = posting.categories.location\r\n var department = posting.categories.department;\r\n var commitment = posting.categories.commitment\r\n var team = posting.categories.team\r\n var link = posting.hostedUrl + leverParameter\r\n\r\n $('#jobs-container .jobs-list').append(\r\n '
' +\r\n '' + title + '' +\r\n '
' + location + '
' +\r\n '
' + shortDescription + '
' +\r\n '' +\r\n '
'\r\n );\r\n }\r\n}\r\n\r\n//Fetching job postings from Lever's postings API\r\n$.ajax({\r\n dataType: \"json\",\r\n url: url,\r\n success: function (data) {\r\n createJobs(data);\r\n }\r\n});\r\n\r\n\n$(function () {\r\n $(\"#Form1\").find(\"input[type='submit']\").click(function () {\r\n var email = $(\"#Form1\")\r\n .find(\"input[name='email']\")\r\n .val();\r\n\r\n window[\"Bizible\"] = window[\"Bizible\"] || {\r\n _queue: [],\r\n Push: function (o, p) {\r\n this._queue.push({\r\n type: o,\r\n data: p\r\n });\r\n }\r\n };\r\n Bizible.Push(\"User\", {\r\n eMail: email // required\r\n });\r\n });\r\n\r\n //Multi-select field dropdown JS\r\n $(document).ready(function () {\r\n\r\n //Global Variables\r\n var multiItems = $(\".multi-select-items\"),\r\n multiWrap = $(\".multi-select-wrap\"),\r\n multiSelect = $(\".multi-select-dropdown\"),\r\n multiDD = $(\".multiselect-wrap\"),\r\n multiOption = $(\"label\", multiDD),\r\n optionCheckbox = $('input[type=\"checkbox\"]', multiDD),\r\n bubbleCollection = $(\".multi-bubbles-collection\"),\r\n field = $(\".multi-select-field\"),\r\n placeholder = \"Select one or more\",\r\n submit = $('input[type=\"submit\"]');\r\n\r\n adjustHeight();\r\n \r\n $(multiSelect).closest(\".inputWrap\").addClass(\"inputMultiple\");\r\n\r\n //Prevent multi-field from accepting text/interaction\r\n $(field).focus(function (e) {\r\n $(this).blur();\r\n });\r\n\r\n $(multiItems).click(function (event) {\r\n event.stopPropagation();\r\n $(multiDD).toggleClass('hide');\r\n });\r\n\r\n $(window).click(function () {\r\n $(multiDD).addClass('hide');\r\n });\r\n\r\n //User selected an option\r\n $(multiOption).on(\"change\", function () {\r\n var selected = $(this).attr(\"value\"),\r\n isSelected = $(\".multi-option:contains(\" + selected + \")\"),\r\n isChecked = $(isSelected).find('input[type=\"checkbox\"]').is(\":checked\"),\r\n choiceIgnore = $(isSelected).hasClass(\"ignore\");\r\n\r\n //If option is checked...\r\n if (isChecked == true) {\r\n\r\n //Add grey text bubble under field\r\n addBubble(selected, choiceIgnore);\r\n }\r\n //If it is not checked...\r\n else {\r\n\r\n //Remove grey text bubble under field\r\n removeBubble(selected);\r\n }\r\n\r\n //Remove bubble options\r\n $(\".bubble-close\").on(\"click\", function (event) {\r\n event.stopPropagation();\r\n var selected = $(this).parent(\".multi-bubble\").attr(\"value\");\r\n\r\n removeBubble(selected);\r\n\r\n //If last multi-bubble was deleted, show placeholder text\r\n if ($(\".multi-bubble\").length == 0) {\r\n lastBubble();\r\n }\r\n });\r\n });\r\n\r\n function addBubble(selected, choiceIgnore) {\r\n var bubble = '' + selected + '',\r\n allBubbles = $(\".multi-bubble:not(.ignore)\"),\r\n bubbleValue = $(\".multi-bubble\").val(),\r\n bubbleExists = false,\r\n anybubbles = false;\r\n\r\n //Check to make sure option wasn't already selected\r\n $(allBubbles).each(function () {\r\n var checkValue = $(this).attr(\"value\");\r\n if (checkValue == selected) {\r\n bubbleExists = true;\r\n }\r\n });\r\n\r\n //If bubble option wasn't already selected and \"(choose one or more)\" wasn't selected\r\n if (bubbleExists === false && choiceIgnore == false) {\r\n //Place bubble in collection under dropdown\r\n $(bubbleCollection).append(bubble);\r\n $(bubbleCollection).removeClass(\"hide\");\r\n adjustHeight();\r\n addSelected(selected, allBubbles);\r\n }\r\n }\r\n\r\n function removeBubble(selected) {\r\n var target = $('.multi-bubble:contains(\"' + selected + '\")');\r\n $(target).remove();\r\n\r\n //Remove bubble selection from field text\r\n removeSelected(selected);\r\n\r\n //Uncheck checkbox for selected\r\n uncheckSelected(selected);\r\n }\r\n\r\n //Adding selected to field string\r\n function addSelected(selected, allBubbles) {\r\n var added = selected;\r\n\r\n //If any bubbles exist...\r\n if ($(allBubbles).length > 0) {\r\n //Add bubble selection to field text by\r\n //converting to array, add option, then convert to string\r\n var fieldVal = $(field).val();\r\n var array = fieldVal.split(\", \");\r\n array.push(added);\r\n var newFieldVal = array.join(\", \");\r\n\r\n //Show new array in field\r\n $(field).val(newFieldVal);\r\n } else {\r\n //First bubble added \r\n //Add bubble selection to field text without spaces\r\n field.val(\"\");\r\n field.val(field.val() + selected);\r\n $(field).removeClass(\"placeholder\");\r\n }\r\n }\r\n\r\n function removeSelected(selected) {\r\n //Remove selection from field text by\r\n //converting to array, remove option, then convert back to string\r\n var fieldVal = $(field).val(),\r\n array = fieldVal.split(\", \"),\r\n removed = selected;\r\n\r\n array = jQuery.grep(array, function (value) {\r\n return value != removed;\r\n });\r\n\r\n var newFieldVal = array.join(\", \");\r\n $(field).val(newFieldVal);\r\n adjustHeight();\r\n }\r\n\r\n //Check selected (when bubbles exists on checkData function)\n function checkSelected(productInterest) {\n var added = productInterest,\n empty = true;\n\n var array = added.split(\", \");\n var i;\r\n for (i = 0; i < array.length; ++i) {\r\n var val = array[i];\r\n var optionTarget = $('.multi-option[value=\"'+ val +'\"');\r\n\r\n $(optionTarget).find('input[type=\"checkbox\"]').prop(\"checked\", true);\r\n }\n }\r\n\r\n function uncheckSelected(selected) {\r\n var removed = selected,\r\n empty = true;\r\n\r\n //Uncheck removed option from select dropdown\r\n $(multiOption).each(function () {\r\n var target = $(this).text(),\r\n isChecked = $(this)\r\n .find('input[type=\"checkbox\"]')\r\n .is(\":checked\");\r\n\r\n if (target == removed) {\r\n $(this)\r\n .find('input[type=\"checkbox\"]')\r\n .prop(\"checked\", false);\r\n $(this).removeClass(\"selected\");\r\n }\r\n\r\n if (isChecked == true) {\r\n empty = false;\r\n }\r\n });\r\n\r\n if (empty == true) {\r\n $(field).val(placeholder);\r\n $(field).addClass(\"placeholder\");\r\n }\r\n\r\n //If last multi-bubble was deleted, show placeholder text\r\n if ($(\".multi-bubble\").length == 0) {\r\n lastBubble();\r\n }\r\n }\r\n\r\n function lastBubble() {\r\n $(bubbleCollection).addClass(\"hide\");\r\n $(field).val(placeholder);\r\n $(field).addClass(\"placeholder\");\r\n adjustHeight();\r\n }\r\n\r\n //Adjust field height for when options wrap to next line\r\n function adjustHeight() {\r\n\r\n setTimeout(function () {\r\n $(multiWrap).removeAttr(\"style\");\r\n\r\n var bubblesHide = $(bubbleCollection).hasClass('hide');\r\n\r\n if (bubblesHide == true) {\r\n\r\n var fieldHeight = $('.multi-select-field').height(),\r\n sheight = parseFloat(fieldHeight),\r\n newHeight = sheight;\r\n } else {\r\n var bubblesHeight = $(bubbleCollection).height(),\r\n cheight = parseFloat(bubblesHeight),\r\n fieldHeight = $('.multi-select-field').height(),\r\n sheight = parseFloat(fieldHeight),\r\n newHeight = cheight + sheight + 30;\r\n }\r\n\r\n //Increase height of multi-select-dropdown to contain all multi-bubbles\r\n $(multiWrap).css(\"height\", newHeight);\r\n\r\n }, 100);\r\n }\r\n });\r\n});\n$(document).ready(function () {\r\n //All Select Fields: Darken text color if ignored option (first option) isn't selected. Otherwise keep the color light grey\r\n var emptyOptions = $('option:empty'),\r\n ignoreOptions = $('select').find('option:contains(\"Select\")'),\r\n selectFields = $('select.formField');\r\n\r\n $(emptyOptions).each(function () {\r\n $(this).remove();\r\n });\r\n\r\n $(ignoreOptions).addClass('ignore');\r\n $(ignoreOptions).attr(\"value\", \"\");\r\n $(ignoreOptions).removeAttr(\"disabled\");\r\n\r\n //Select Setup\r\n $(selectFields).each(function () {\r\n var dropdown = $(this);\r\n selected = $(dropdown).val(),\r\n selectOption = $(dropdown).find('option[value=\"' + selected + '\"]'),\r\n ignoreSelected = $(dropdown).find('.ignore').attr(\"selected\");\r\n\r\n if ($(selectOption).hasClass('ignore') || ignoreSelected !== false) {\r\n $(dropdown).addClass('placeholder');\r\n }\r\n else {\r\n $(dropdown).removeClass('placeholder');\r\n }\r\n });\r\n\r\n //All Select Fields on change\r\n $('select').on(\"change\", function () {\r\n var dropdown = $(this),\r\n selectedVal = $(dropdown).val(),\r\n isSelected = $(dropdown).find(\"option[value='\" + selectedVal + \"']\"),\r\n prevOption = $(dropdown).find('option[selected=\"selected\"]');\r\n\r\n //If first ignored option was not selected\r\n if ($(isSelected).hasClass('ignore') == false) {\r\n $(dropdown).removeClass('placeholder');\r\n $(prevOption).removeAttr('selected');\r\n $(isSelected).attr(\"selected\", \"selected\");\r\n $(dropdown).val(selectedVal);\r\n }\r\n else {\r\n $(this).addClass('placeholder');\r\n }\r\n });\r\n\r\n $('.ac-select').removeClass('placeholder');\r\n\r\n});\n\r\n/*\r\nVersion: 1.0.9\r\nDocumentation: http://baymard.com/labs/country-selector#documentation\r\nCopyright (C) 2011 by Jamie Appleseed, Baymard Institute (baymard.com)\r\nPermission is hereby granted, free of charge, to any person obtaining a copy\r\nof this software and associated documentation files (the \"Software\"), to deal\r\nin the Software without restriction, including without limitation the rights\r\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\ncopies of the Software, and to permit persons to whom the Software is\r\nfurnished to do so, subject to the following conditions:\r\nThe above copyright notice and this permission notice shall be included in\r\nall copies or substantial portions of the Software.\r\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\r\nTHE SOFTWARE.\r\n*/\r\n(function() {\r\n var settings = {\r\n 'sort': false,\r\n 'sort-attr': 'data-priority',\r\n 'sort-desc': false,\r\n 'autoselect': true,\r\n 'alternative-spellings': true,\r\n 'alternative-spellings-attr': 'data-alternative-spellings',\r\n 'remove-valueless-options': true,\r\n 'copy-attributes-to-text-field': true,\r\n 'autocomplete-plugin': 'jquery_ui',\r\n 'relevancy-sorting': true,\r\n 'relevancy-sorting-partial-match-value': 1,\r\n 'relevancy-sorting-strict-match-value': 5,\r\n 'relevancy-sorting-booster-attr': 'data-relevancy-booster',\r\n 'minLength': 0,\r\n 'delay': 0,\r\n 'autoFocus': true,\r\n handle_invalid_input: function(context) {\r\n var selected_finder = 'option:selected:first';\r\n if(context.settings['remove-valueless-options']) {\r\n selected_finder = 'option:selected[value!=\"\"]:first';\r\n }\r\n context.$text_field.val(context.$select_field.find(selected_finder).text());\r\n },\r\n handle_select_field: function($select_field) {\r\n return $select_field.hide();\r\n },\r\n insert_text_field: function(context) {\r\n var $text_field = $('');\r\n if(settings['copy-attributes-to-text-field']) {\r\n var attrs = {};\r\n var raw_attrs = context.$select_field[0].attributes;\r\n for(var i = 0;i < raw_attrs.length;i++) {\r\n var key = raw_attrs[i].nodeName;\r\n var value = raw_attrs[i].nodeValue;\r\n if(key !== 'name' && key !== 'id' && typeof context.$select_field.attr(key) !== 'undefined') {\r\n attrs[key] = value;\r\n }\r\n };\r\n $text_field.attr(attrs);\r\n }\r\n $text_field.blur(function() {\r\n var valid_values = context.$select_field.find('option').map(function(i,option) { return $(option).text(); });\r\n if(($.inArray($text_field.val(),valid_values) < 0) && typeof settings['handle_invalid_input'] === 'function') {\r\n settings['handle_invalid_input'](context);\r\n }\r\n });\r\n // give the input box the ability to select all text on mouse click\r\n if(context.settings['autoselect']) {\r\n $text_field.click(function() {\r\n this.select();\r\n });\r\n }\r\n var selected_finder = 'option:selected:first';\r\n if(context.settings['remove-valueless-options']) {\r\n selected_finder = 'option:selected[value!=\"\"]:first';\r\n }\r\n return $text_field.val(context.$select_field.find(selected_finder).text())\r\n .insertAfter(context.$select_field);\r\n },\r\n extract_options: function($select_field) {\r\n var options = [];\r\n var $options = $select_field.find('option');\r\n var number_of_options = $options.length;\r\n\r\n // go over each option in the select tag\r\n $options.each(function() {\r\n var $option = $(this);\r\n var option = {\r\n 'real-value': $option.attr('value'),\r\n 'label': $option.text()\r\n }\r\n if(settings['remove-valueless-options'] && option['real-value'] === '') {\r\n // skip options without a value\r\n } else {\r\n // prepare the 'matches' string which must be filtered on later\r\n option['matches'] = option['label'];\r\n var alternative_spellings = $option.attr(settings['alternative-spellings-attr']);\r\n if(alternative_spellings) {\r\n option['matches'] += ' ' + alternative_spellings;\r\n }\r\n // give each option a weight paramter for sorting\r\n if(settings['sort']) {\r\n var weight = parseInt($option.attr(settings['sort-attr']),10);\r\n if(weight) {\r\n option['weight'] = weight;\r\n } else {\r\n option['weight'] = number_of_options;\r\n }\r\n }\r\n // add relevancy score\r\n if(settings['relevancy-sorting']) {\r\n option['relevancy-score'] = 0;\r\n option['relevancy-score-booster'] = 1;\r\n var boost_by = parseFloat($option.attr(settings['relevancy-sorting-booster-attr']));\r\n if(boost_by) {\r\n option['relevancy-score-booster'] = boost_by;\r\n }\r\n }\r\n\r\n\r\n if($option.attr('class')) {\r\n // **\r\n // CUSTOM CODE:\r\n // If the option is segmented add a class to filter on.\r\n // **\r\n option.type = $option.attr('class');\r\n }\r\n // add option to combined array\r\n options.push(option);\r\n }\r\n });\r\n // sort the options based on weight\r\n if(settings['sort']) {\r\n if(settings['sort-desc']) {\r\n options.sort(function(a,b) { return b['weight'] - a['weight']; });\r\n } else {\r\n options.sort(function(a,b) { return a['weight'] - b['weight']; });\r\n }\r\n }\r\n\r\n // return the set of options, each with the following attributes: real-value, label, matches, weight (optional)\r\n return options;\r\n }\r\n };\r\n\r\n var public_methods = {\r\n init: function(customizations) {\r\n\r\n if(/msie/.test(navigator.userAgent.toLowerCase()) && parseInt(navigator.appVersion,10) <= 6) {\r\n\r\n return this;\r\n\r\n } else {\r\n\r\n settings = $.extend(settings,customizations);\r\n\r\n return this.each(function() {\r\n var $select_field = $(this);\r\n\r\n var context = {\r\n '$select_field': $select_field,\r\n 'options': settings['extract_options']($select_field),\r\n 'settings': settings\r\n };\r\n \r\n context['$text_field'] = settings['insert_text_field'](context).attr({\r\n \t'id': 'ac-' + $(this).attr('id'),\r\n \t'name': 'ac-' + $(this).attr('name')\r\n }).addClass('formField');\r\n\r\n settings['handle_select_field']($select_field);\r\n\r\n if(typeof settings['autocomplete-plugin'] === 'string') {\r\n adapters[settings['autocomplete-plugin']](context);\r\n } else {\r\n settings['autocomplete-plugin'](context);\r\n }\r\n });\r\n\r\n }\r\n\r\n }\r\n };\r\n\r\n var adapters = {\r\n jquery_ui: function(context) {\r\n // loose matching of search terms\r\n var filter_options = function(term) {\r\n var split_term = term.split(' ');\r\n var matchers = [];\r\n for(var i = 0;i < split_term.length;i++) {\r\n if(split_term[i].length > 0) {\r\n var matcher = {};\r\n matcher['partial'] = new RegExp($.ui.autocomplete.escapeRegex(split_term[i]),\"i\");\r\n if(context.settings['relevancy-sorting']) {\r\n matcher['strict'] = new RegExp(\"^\" + $.ui.autocomplete.escapeRegex(split_term[i]),\"i\");\r\n }\r\n matchers.push(matcher);\r\n }\r\n };\r\n\r\n return $.grep(context.options,function(option) {\r\n var partial_matches = 0;\r\n\r\n if(context.settings['relevancy-sorting']) {\r\n var strict_match = false;\r\n var split_option_matches = option.matches.split(' ');\r\n }\r\n\r\n var stateField = context.$select_field.attr('id') == 'state';\r\n for(var i = 0;i < matchers.length;i++) {\r\n\r\n if(matchers[i]['partial'].test(option.matches)) {\r\n\r\n \tif ($('#ac-country') && $('#ac-state')) {\r\n // **\r\n // CUSTOM CODE:\r\n // Appropriately populate the State/Province list\r\n // according to the value set in country if both\r\n // country and state autocomplete fields exist\r\n // **\r\n var countryVal = $('#ac-country').val().toUpperCase();\r\n var optionType = option.type;\r\n\r\n if(countryVal && stateField) {\r\n var isUS = countryVal == 'UNITED STATES OF AMERICA (USA)';\r\n var isCan = countryVal == 'CANADA';\r\n if (isUS && optionType == 'state') {\r\n partial_matches++;\r\n } else if(isCan && optionType == 'province') {\r\n partial_matches++;\r\n } else if(!isUS && !isCan && !optionType) {\r\n partial_matches++;\r\n }\r\n }\r\n else {\r\n // if country is empty\r\n partial_matches++;\r\n }\r\n }\r\n else {\r\n partial_matches++;\r\n }\r\n }\r\n if(context.settings['relevancy-sorting']) {\r\n for(var q = 0;q < split_option_matches.length;q++) {\r\n if(matchers[i]['strict'].test(split_option_matches[q])) {\r\n strict_match = true;\r\n break;\r\n }\r\n };\r\n }\r\n };\r\n\r\n if(context.settings['relevancy-sorting']) {\r\n var option_score = 0;\r\n option_score += partial_matches * context.settings['relevancy-sorting-partial-match-value'];\r\n if(strict_match) {\r\n option_score += context.settings['relevancy-sorting-strict-match-value'];\r\n }\r\n option_score = option_score * option['relevancy-score-booster'];\r\n option['relevancy-score'] = option_score;\r\n }\r\n return (!term || matchers.length === partial_matches);\r\n });\r\n }\r\n // update the select field value using either selected option or current input in the text field\r\n var update_select_value = function(option) {\r\n if(option) {\r\n if(context.$select_field.val() !== option['real-value']) {\r\n context.$select_field.val(option['real-value']);\r\n context.$select_field.change();\r\n }\r\n } else {\r\n var option_name = context.$text_field.val().toLowerCase();\r\n var matching_option = { 'real-value': false };\r\n for(var i = 0;i < context.options.length;i++) {\r\n if(option_name === context.options[i]['label'].toLowerCase()) {\r\n matching_option = context.options[i];\r\n break;\r\n }\r\n };\r\n if(context.$select_field.val() !== matching_option['real-value']) {\r\n context.$select_field.val(matching_option['real-value'] || '');\r\n context.$select_field.change();\r\n }\r\n if(matching_option['real-value']) {\r\n context.$text_field.val(matching_option['label']);\r\n }\r\n if(typeof context.settings['handle_invalid_input'] === 'function' && context.$select_field.val() === '') {\r\n context.settings['handle_invalid_input'](context);\r\n }\r\n }\r\n }\r\n // jQuery UI autocomplete settings & behavior\r\n context.$text_field.autocomplete({\r\n 'minLength': context.settings['minLength'],\r\n 'delay': context.settings['delay'],\r\n 'autoFocus': context.settings['autoFocus'],\r\n source: function(request,response) {\r\n\r\n var filtered_options = filter_options(request.term);\r\n if(context.settings['relevancy-sorting']) {\r\n filtered_options = filtered_options.sort(function(a,b) {\r\n\r\n if(b['relevancy-score'] == a['relevancy-score']) {\r\n return b['label'] < a['label'] ? 1 : -1;\r\n } else {\r\n return b['relevancy-score'] - a['relevancy-score'];\r\n }\r\n });\r\n }\r\n response(filtered_options);\r\n },\r\n select: function(event,ui) {\r\n update_select_value(ui.item);\r\n },\r\n change: function(event,ui) {\r\n update_select_value(ui.item);\r\n }\r\n });\r\n // force refresh value of select field when form is submitted\r\n context.$text_field.parents('form:first').submit(function() {\r\n update_select_value();\r\n });\r\n // select current value\r\n update_select_value();\r\n }\r\n };\r\n\r\n $.fn.selectToAutocomplete = function(method) {\r\n if(public_methods[method]) {\r\n return public_methods[method].apply(this,Array.prototype.slice.call(arguments,1));\r\n } else if(typeof method === 'object' || !method) {\r\n return public_methods.init.apply(this,arguments);\r\n } else {\r\n $.error('Method ' + method + ' does not exist on jQuery.fn.selectToAutocomplete');\r\n }\r\n };\r\n\r\n})();\n/*!\r\n * jQuery Validation Plugin v1.14.0\r\n *\r\n * http://jqueryvalidation.org/\r\n *\r\n * Copyright (c) 2015 Jörn Zaefferer\r\n * Released under the MIT license\r\n */\r\n(function(factory) {\r\n if(typeof define === \"function\" && define.amd) {\r\n define([\"jquery\"],factory);\r\n } else {\r\n factory(jQuery);\r\n }\r\n}(function($) {\r\n\r\n $.extend($.fn,{\r\n // http://jqueryvalidation.org/validate/\r\n validate: function(options) {\r\n\r\n // if nothing is selected, return nothing; can't chain anyway\r\n if(!this.length) {\r\n if(options && options.debug && window.console) {\r\n console.warn(\"Nothing selected, can't validate, returning nothing.\");\r\n }\r\n return;\r\n }\r\n\r\n // check if a validator for this form was already created\r\n var validator = $.data(this[0],\"validator\");\r\n if(validator) {\r\n return validator;\r\n }\r\n\r\n // Add novalidate tag if HTML5.\r\n this.attr(\"novalidate\",\"novalidate\");\r\n\r\n validator = new $.validator(options,this[0]);\r\n $.data(this[0],\"validator\",validator);\r\n\r\n if(validator.settings.onsubmit) {\r\n\r\n this.on(\"click.validate\",\":submit\",function(event) {\r\n if(validator.settings.submitHandler) {\r\n validator.submitButton = event.target;\r\n }\r\n\r\n // allow suppressing validation by adding a cancel class to the submit button\r\n if($(this).hasClass(\"cancel\")) {\r\n validator.cancelSubmit = true;\r\n }\r\n\r\n // allow suppressing validation by adding the html5 formnovalidate attribute to the submit button\r\n if($(this).attr(\"formnovalidate\") !== undefined) {\r\n validator.cancelSubmit = true;\r\n }\r\n });\r\n\r\n // validate the form on submit\r\n this.on(\"submit.validate\",function(event) {\r\n if(validator.settings.debug) {\r\n // prevent form submit to be able to see console output\r\n event.preventDefault();\r\n }\r\n function handle() {\r\n var hidden,result;\r\n if(validator.settings.submitHandler) {\r\n if(validator.submitButton) {\r\n // insert a hidden input as a replacement for the missing submit button\r\n hidden = $(\"\")\r\n .attr(\"name\",validator.submitButton.name)\r\n .val($(validator.submitButton).val())\r\n .appendTo(validator.currentForm);\r\n }\r\n result = validator.settings.submitHandler.call(validator,validator.currentForm,event);\r\n if(validator.submitButton) {\r\n // and clean up afterwards; thanks to no-block-scope, hidden can be referenced\r\n hidden.remove();\r\n }\r\n if(result !== undefined) {\r\n return result;\r\n }\r\n return false;\r\n }\r\n return true;\r\n }\r\n\r\n // prevent submit for invalid forms or custom submit handlers\r\n if(validator.cancelSubmit) {\r\n validator.cancelSubmit = false;\r\n return handle();\r\n }\r\n if(validator.form()) {\r\n if(validator.pendingRequest) {\r\n validator.formSubmitted = true;\r\n return false;\r\n }\r\n return handle();\r\n } else {\r\n validator.focusInvalid();\r\n return false;\r\n }\r\n });\r\n }\r\n\r\n return validator;\r\n },\r\n // http://jqueryvalidation.org/valid/\r\n valid: function() {\r\n var valid,validator,errorList;\r\n\r\n if($(this[0]).is(\"form\")) {\r\n valid = this.validate().form();\r\n } else {\r\n errorList = [];\r\n valid = true;\r\n validator = $(this[0].form).validate();\r\n this.each(function() {\r\n valid = validator.element(this) && valid;\r\n errorList = errorList.concat(validator.errorList);\r\n });\r\n validator.errorList = errorList;\r\n }\r\n return valid;\r\n },\r\n\r\n // http://jqueryvalidation.org/rules/\r\n rules: function(command,argument) {\r\n var element = this[0],\r\n settings,staticRules,existingRules,data,param,filtered;\r\n\r\n if(command) {\r\n settings = $.data(element.form,\"validator\").settings;\r\n staticRules = settings.rules;\r\n existingRules = $.validator.staticRules(element);\r\n switch(command) {\r\n case \"add\":\r\n $.extend(existingRules,$.validator.normalizeRule(argument));\r\n // remove messages from rules, but allow them to be set separately\r\n delete existingRules.messages;\r\n staticRules[element.name] = existingRules;\r\n if(argument.messages) {\r\n settings.messages[element.name] = $.extend(settings.messages[element.name],argument.messages);\r\n }\r\n break;\r\n case \"remove\":\r\n if(!argument) {\r\n delete staticRules[element.name];\r\n return existingRules;\r\n }\r\n filtered = {};\r\n $.each(argument.split(/\\s/),function(index,method) {\r\n filtered[method] = existingRules[method];\r\n delete existingRules[method];\r\n if(method === \"required\") {\r\n $(element).removeAttr(\"aria-required\");\r\n }\r\n });\r\n return filtered;\r\n }\r\n }\r\n\r\n data = $.validator.normalizeRules(\r\n $.extend(\r\n {},\r\n $.validator.classRules(element),\r\n $.validator.attributeRules(element),\r\n $.validator.dataRules(element),\r\n $.validator.staticRules(element)\r\n ),element);\r\n\r\n // make sure required is at front\r\n if(data.required) {\r\n param = data.required;\r\n delete data.required;\r\n data = $.extend({ required: param },data);\r\n $(element).attr(\"aria-required\",\"true\");\r\n }\r\n\r\n // make sure remote is at back\r\n if(data.remote) {\r\n param = data.remote;\r\n delete data.remote;\r\n data = $.extend(data,{ remote: param });\r\n }\r\n\r\n return data;\r\n }\r\n });\r\n\r\n // Custom selectors\r\n $.extend($.expr[\":\"],{\r\n // http://jqueryvalidation.org/blank-selector/\r\n blank: function(a) {\r\n return !$.trim(\"\" + $(a).val());\r\n },\r\n // http://jqueryvalidation.org/filled-selector/\r\n filled: function(a) {\r\n return !!$.trim(\"\" + $(a).val());\r\n },\r\n // http://jqueryvalidation.org/unchecked-selector/\r\n unchecked: function(a) {\r\n return !$(a).prop(\"checked\");\r\n }\r\n });\r\n\r\n // constructor for validator\r\n $.validator = function(options,form) {\r\n this.settings = $.extend(true,{},$.validator.defaults,options);\r\n this.currentForm = form;\r\n this.init();\r\n };\r\n\r\n // http://jqueryvalidation.org/jQuery.validator.format/\r\n $.validator.format = function(source,params) {\r\n if(arguments.length === 1) {\r\n return function() {\r\n var args = $.makeArray(arguments);\r\n args.unshift(source);\r\n return $.validator.format.apply(this,args);\r\n };\r\n }\r\n if(arguments.length > 2 && params.constructor !== Array) {\r\n params = $.makeArray(arguments).slice(1);\r\n }\r\n if(params.constructor !== Array) {\r\n params = [params];\r\n }\r\n $.each(params,function(i,n) {\r\n source = source.replace(new RegExp(\"\\\\{\" + i + \"\\\\}\",\"g\"),function() {\r\n return n;\r\n });\r\n });\r\n return source;\r\n };\r\n\r\n $.extend($.validator,{\r\n\r\n defaults: {\r\n messages: {},\r\n groups: {},\r\n rules: {},\r\n errorClass: \"error\",\r\n validClass: \"valid\",\r\n errorElement: \"label\",\r\n focusCleanup: false,\r\n focusInvalid: true,\r\n errorContainer: $([]),\r\n errorLabelContainer: $([]),\r\n onsubmit: true,\r\n ignore: \":hidden\",\r\n ignoreTitle: false,\r\n onfocusin: function(element) {\r\n this.lastActive = element;\r\n\r\n // Hide error label and remove error class on focus if enabled\r\n if(this.settings.focusCleanup) {\r\n if(this.settings.unhighlight) {\r\n this.settings.unhighlight.call(this,element,this.settings.errorClass,this.settings.validClass);\r\n }\r\n this.hideThese(this.errorsFor(element));\r\n }\r\n },\r\n onfocusout: function(element) {\r\n if(!this.checkable(element) && (element.name in this.submitted || !this.optional(element))) {\r\n this.element(element);\r\n }\r\n },\r\n onkeyup: function(element,event) {\r\n // Avoid revalidate the field when pressing one of the following keys\r\n // Shift => 16\r\n // Ctrl => 17\r\n // Alt => 18\r\n // Caps lock => 20\r\n // End => 35\r\n // Home => 36\r\n // Left arrow => 37\r\n // Up arrow => 38\r\n // Right arrow => 39\r\n // Down arrow => 40\r\n // Insert => 45\r\n // Num lock => 144\r\n // AltGr key => 225\r\n var excludedKeys = [\r\n 16,17,18,20,35,36,37,\r\n 38,39,40,45,144,225\r\n ];\r\n\r\n if(event.which === 9 && this.elementValue(element) === \"\" || $.inArray(event.keyCode,excludedKeys) !== -1) {\r\n return;\r\n } else if(element.name in this.submitted || element === this.lastElement) {\r\n this.element(element);\r\n }\r\n },\r\n onclick: function(element) {\r\n // click on selects, radiobuttons and checkboxes\r\n if(element.name in this.submitted) {\r\n this.element(element);\r\n\r\n // or option elements, check parent select in that case\r\n } else if(element.parentNode.name in this.submitted) {\r\n this.element(element.parentNode);\r\n }\r\n },\r\n highlight: function(element,errorClass,validClass) {\r\n if(element.type === \"radio\") {\r\n this.findByName(element.name).addClass(errorClass).removeClass(validClass);\r\n } else {\r\n $(element).addClass(errorClass).removeClass(validClass);\r\n }\r\n },\r\n unhighlight: function(element,errorClass,validClass) {\r\n if(element.type === \"radio\") {\r\n this.findByName(element.name).removeClass(errorClass).addClass(validClass);\r\n } else {\r\n $(element).removeClass(errorClass).addClass(validClass);\r\n }\r\n }\r\n },\r\n\r\n // http://jqueryvalidation.org/jQuery.validator.setDefaults/\r\n setDefaults: function(settings) {\r\n $.extend($.validator.defaults,settings);\r\n },\r\n\r\n messages: {\r\n required: \"This field is required.\",\r\n remote: \"Please fix this field.\",\r\n email: \"Please enter a valid email address.\",\r\n url: \"Please enter a valid URL.\",\r\n date: \"Please enter a valid date.\",\r\n dateISO: \"Please enter a valid date ( ISO ).\",\r\n number: \"Please enter a valid number.\",\r\n digits: \"Please enter only digits.\",\r\n creditcard: \"Please enter a valid credit card number.\",\r\n equalTo: \"Please enter the same value again.\",\r\n maxlength: $.validator.format(\"Please enter no more than {0} characters.\"),\r\n minlength: $.validator.format(\"Please enter at least {0} characters.\"),\r\n rangelength: $.validator.format(\"Please enter a value between {0} and {1} characters long.\"),\r\n range: $.validator.format(\"Please enter a value between {0} and {1}.\"),\r\n max: $.validator.format(\"Please enter a value less than or equal to {0}.\"),\r\n min: $.validator.format(\"Please enter a value greater than or equal to {0}.\")\r\n },\r\n\r\n autoCreateRanges: false,\r\n\r\n prototype: {\r\n\r\n init: function() {\r\n this.labelContainer = $(this.settings.errorLabelContainer);\r\n this.errorContext = this.labelContainer.length && this.labelContainer || $(this.currentForm);\r\n this.containers = $(this.settings.errorContainer).add(this.settings.errorLabelContainer);\r\n this.submitted = {};\r\n this.valueCache = {};\r\n this.pendingRequest = 0;\r\n this.pending = {};\r\n this.invalid = {};\r\n this.reset();\r\n\r\n var groups = (this.groups = {}),\r\n rules;\r\n $.each(this.settings.groups,function(key,value) {\r\n if(typeof value === \"string\") {\r\n value = value.split(/\\s/);\r\n }\r\n $.each(value,function(index,name) {\r\n groups[name] = key;\r\n });\r\n });\r\n rules = this.settings.rules;\r\n $.each(rules,function(key,value) {\r\n rules[key] = $.validator.normalizeRule(value);\r\n });\r\n\r\n function delegate(event) {\r\n var validator = $.data(this.form,\"validator\"),\r\n eventType = \"on\" + event.type.replace(/^validate/,\"\"),\r\n settings = validator.settings;\r\n if(settings[eventType] && !$(this).is(settings.ignore)) {\r\n settings[eventType].call(validator,this,event);\r\n }\r\n }\r\n\r\n $(this.currentForm)\r\n .on(\"focusin.validate focusout.validate keyup.validate\",\r\n \":text, [type='password'], [type='file'], select, textarea, [type='number'], [type='search'], \" +\r\n \"[type='tel'], [type='url'], [type='email'], [type='datetime'], [type='date'], [type='month'], \" +\r\n \"[type='week'], [type='time'], [type='datetime-local'], [type='range'], [type='color'], \" +\r\n \"[type='radio'], [type='checkbox']\",delegate)\r\n // Support: Chrome, oldIE\r\n // \"select\" is provided as event.target when clicking a option\r\n .on(\"click.validate\",\"select, option, [type='radio'], [type='checkbox']\",delegate);\r\n\r\n if(this.settings.invalidHandler) {\r\n $(this.currentForm).on(\"invalid-form.validate\",this.settings.invalidHandler);\r\n }\r\n\r\n // Add aria-required to any Static/Data/Class required fields before first validation\r\n // Screen readers require this attribute to be present before the initial submission http://www.w3.org/TR/WCAG-TECHS/ARIA2.html\r\n $(this.currentForm).find(\"[required], [data-rule-required], .required\").attr(\"aria-required\",\"true\");\r\n },\r\n\r\n // http://jqueryvalidation.org/Validator.form/\r\n form: function() {\r\n this.checkForm();\r\n $.extend(this.submitted,this.errorMap);\r\n this.invalid = $.extend({},this.errorMap);\r\n if(!this.valid()) {\r\n $(this.currentForm).triggerHandler(\"invalid-form\",[this]);\r\n }\r\n this.showErrors();\r\n return this.valid();\r\n },\r\n\r\n checkForm: function() {\r\n this.prepareForm();\r\n for(var i = 0,elements = (this.currentElements = this.elements()) ;elements[i];i++) {\r\n this.check(elements[i]);\r\n }\r\n return this.valid();\r\n },\r\n\r\n // http://jqueryvalidation.org/Validator.element/\r\n element: function(element) {\r\n var cleanElement = this.clean(element),\r\n checkElement = this.validationTargetFor(cleanElement),\r\n result = true;\r\n\r\n this.lastElement = checkElement;\r\n\r\n if(checkElement === undefined) {\r\n delete this.invalid[cleanElement.name];\r\n } else {\r\n this.prepareElement(checkElement);\r\n this.currentElements = $(checkElement);\r\n\r\n result = this.check(checkElement) !== false;\r\n if(result) {\r\n delete this.invalid[checkElement.name];\r\n } else {\r\n this.invalid[checkElement.name] = true;\r\n }\r\n }\r\n // Add aria-invalid status for screen readers\r\n $(element).attr(\"aria-invalid\",!result);\r\n\r\n if(!this.numberOfInvalids()) {\r\n // Hide error containers on last error\r\n this.toHide = this.toHide.add(this.containers);\r\n }\r\n this.showErrors();\r\n return result;\r\n },\r\n\r\n // http://jqueryvalidation.org/Validator.showErrors/\r\n showErrors: function(errors) {\r\n if(errors) {\r\n // add items to error list and map\r\n $.extend(this.errorMap,errors);\r\n this.errorList = [];\r\n for(var name in errors) {\r\n this.errorList.push({\r\n message: errors[name],\r\n element: this.findByName(name)[0]\r\n });\r\n }\r\n // remove items from success list\r\n this.successList = $.grep(this.successList,function(element) {\r\n return !(element.name in errors);\r\n });\r\n }\r\n if(this.settings.showErrors) {\r\n this.settings.showErrors.call(this,this.errorMap,this.errorList);\r\n } else {\r\n this.defaultShowErrors();\r\n }\r\n },\r\n\r\n // http://jqueryvalidation.org/Validator.resetForm/\r\n resetForm: function() {\r\n if($.fn.resetForm) {\r\n $(this.currentForm).resetForm();\r\n }\r\n this.submitted = {};\r\n this.lastElement = null;\r\n this.prepareForm();\r\n this.hideErrors();\r\n var i,elements = this.elements()\r\n .removeData(\"previousValue\")\r\n .removeAttr(\"aria-invalid\");\r\n\r\n if(this.settings.unhighlight) {\r\n for(i = 0;elements[i];i++) {\r\n this.settings.unhighlight.call(this,elements[i],\r\n this.settings.errorClass,\"\");\r\n }\r\n } else {\r\n elements.removeClass(this.settings.errorClass);\r\n }\r\n },\r\n\r\n numberOfInvalids: function() {\r\n return this.objectLength(this.invalid);\r\n },\r\n\r\n objectLength: function(obj) {\r\n /* jshint unused: false */\r\n var count = 0,\r\n i;\r\n for(i in obj) {\r\n count++;\r\n }\r\n return count;\r\n },\r\n\r\n hideErrors: function() {\r\n this.hideThese(this.toHide);\r\n },\r\n\r\n hideThese: function(errors) {\r\n errors.not(this.containers).text(\"\");\r\n this.addWrapper(errors).hide();\r\n },\r\n\r\n valid: function() {\r\n return this.size() === 0;\r\n },\r\n\r\n size: function() {\r\n return this.errorList.length;\r\n },\r\n\r\n focusInvalid: function() {\r\n if(this.settings.focusInvalid) {\r\n try {\r\n $(this.findLastActive() || this.errorList.length && this.errorList[0].element || [])\r\n .filter(\":visible\")\r\n .focus()\r\n // manually trigger focusin event; without it, focusin handler isn't called, findLastActive won't have anything to find\r\n .trigger(\"focusin\");\r\n } catch(e) {\r\n // ignore IE throwing errors when focusing hidden elements\r\n }\r\n }\r\n },\r\n\r\n findLastActive: function() {\r\n var lastActive = this.lastActive;\r\n return lastActive && $.grep(this.errorList,function(n) {\r\n return n.element.name === lastActive.name;\r\n }).length === 1 && lastActive;\r\n },\r\n\r\n elements: function() {\r\n var validator = this,\r\n rulesCache = {};\r\n\r\n // select all valid inputs inside the form (no submit or reset buttons)\r\n return $(this.currentForm)\r\n .find(\"input, select, textarea\")\r\n .not(\":submit, :reset, :image, :disabled\")\r\n .not(this.settings.ignore)\r\n .filter(function() {\r\n if(!this.name && validator.settings.debug && window.console) {\r\n console.error(\"%o has no name assigned\",this);\r\n }\r\n\r\n // select only the first element for each name, and only those with rules specified\r\n if(this.name in rulesCache || !validator.objectLength($(this).rules())) {\r\n return false;\r\n }\r\n\r\n rulesCache[this.name] = true;\r\n return true;\r\n });\r\n },\r\n\r\n clean: function(selector) {\r\n return $(selector)[0];\r\n },\r\n\r\n errors: function() {\r\n var errorClass = this.settings.errorClass.split(\" \").join(\".\");\r\n return $(this.settings.errorElement + \".\" + errorClass,this.errorContext);\r\n },\r\n\r\n reset: function() {\r\n this.successList = [];\r\n this.errorList = [];\r\n this.errorMap = {};\r\n this.toShow = $([]);\r\n this.toHide = $([]);\r\n this.currentElements = $([]);\r\n },\r\n\r\n prepareForm: function() {\r\n this.reset();\r\n this.toHide = this.errors().add(this.containers);\r\n },\r\n\r\n prepareElement: function(element) {\r\n this.reset();\r\n this.toHide = this.errorsFor(element);\r\n },\r\n\r\n elementValue: function(element) {\r\n var val,\r\n $element = $(element),\r\n type = element.type;\r\n\r\n if(type === \"radio\" || type === \"checkbox\") {\r\n return this.findByName(element.name).filter(\":checked\").val();\r\n } else if(type === \"number\" && typeof element.validity !== \"undefined\") {\r\n return element.validity.badInput ? false : $element.val();\r\n }\r\n\r\n val = $element.val();\r\n if(typeof val === \"string\") {\r\n return val.replace(/\\r/g,\"\");\r\n }\r\n return val;\r\n },\r\n\r\n check: function(element) {\r\n element = this.validationTargetFor(this.clean(element));\r\n\r\n var rules = $(element).rules(),\r\n rulesCount = $.map(rules,function(n,i) {\r\n return i;\r\n }).length,\r\n dependencyMismatch = false,\r\n val = this.elementValue(element),\r\n result,method,rule;\r\n\r\n for(method in rules) {\r\n rule = { method: method,parameters: rules[method] };\r\n try {\r\n\r\n result = $.validator.methods[method].call(this,val,element,rule.parameters);\r\n\r\n // if a method indicates that the field is optional and therefore valid,\r\n // don't mark it as valid when there are no other rules\r\n if(result === \"dependency-mismatch\" && rulesCount === 1) {\r\n dependencyMismatch = true;\r\n continue;\r\n }\r\n dependencyMismatch = false;\r\n\r\n if(result === \"pending\") {\r\n this.toHide = this.toHide.not(this.errorsFor(element));\r\n return;\r\n }\r\n\r\n if(!result) {\r\n this.formatAndAdd(element,rule);\r\n return false;\r\n }\r\n } catch(e) {\r\n if(this.settings.debug && window.console) {\r\n console.log(\"Exception occurred when checking element \" + element.id + \", check the '\" + rule.method + \"' method.\",e);\r\n }\r\n if(e instanceof TypeError) {\r\n e.message += \". Exception occurred when checking element \" + element.id + \", check the '\" + rule.method + \"' method.\";\r\n }\r\n\r\n throw e;\r\n }\r\n }\r\n if(dependencyMismatch) {\r\n return;\r\n }\r\n if(this.objectLength(rules)) {\r\n this.successList.push(element);\r\n }\r\n return true;\r\n },\r\n\r\n // return the custom message for the given element and validation method\r\n // specified in the element's HTML5 data attribute\r\n // return the generic message if present and no method specific message is present\r\n customDataMessage: function(element,method) {\r\n return $(element).data(\"msg\" + method.charAt(0).toUpperCase() +\r\n method.substring(1).toLowerCase()) || $(element).data(\"msg\");\r\n },\r\n\r\n // return the custom message for the given element name and validation method\r\n customMessage: function(name,method) {\r\n var m = this.settings.messages[name];\r\n return m && (m.constructor === String ? m : m[method]);\r\n },\r\n\r\n // return the first defined argument, allowing empty strings\r\n findDefined: function() {\r\n for(var i = 0;i < arguments.length;i++) {\r\n if(arguments[i] !== undefined) {\r\n return arguments[i];\r\n }\r\n }\r\n return undefined;\r\n },\r\n\r\n defaultMessage: function(element,method) {\r\n return this.findDefined(\r\n this.customMessage(element.name,method),\r\n this.customDataMessage(element,method),\r\n // title is never undefined, so handle empty string as undefined\r\n !this.settings.ignoreTitle && element.title || undefined,\r\n $.validator.messages[method],\r\n \"Warning: No message defined for \" + element.name + \"\"\r\n );\r\n },\r\n\r\n formatAndAdd: function(element,rule) {\r\n var message = this.defaultMessage(element,rule.method),\r\n theregex = /\\$?\\{(\\d+)\\}/g;\r\n if(typeof message === \"function\") {\r\n message = message.call(this,rule.parameters,element);\r\n } else if(theregex.test(message)) {\r\n message = $.validator.format(message.replace(theregex,\"{$1}\"),rule.parameters);\r\n }\r\n this.errorList.push({\r\n message: message,\r\n element: element,\r\n method: rule.method\r\n });\r\n\r\n this.errorMap[element.name] = message;\r\n this.submitted[element.name] = message;\r\n },\r\n\r\n addWrapper: function(toToggle) {\r\n if(this.settings.wrapper) {\r\n toToggle = toToggle.add(toToggle.parent(this.settings.wrapper));\r\n }\r\n return toToggle;\r\n },\r\n\r\n defaultShowErrors: function() {\r\n var i,elements,error;\r\n for(i = 0;this.errorList[i];i++) {\r\n error = this.errorList[i];\r\n if(this.settings.highlight) {\r\n this.settings.highlight.call(this,error.element,this.settings.errorClass,this.settings.validClass);\r\n }\r\n this.showLabel(error.element,error.message);\r\n }\r\n if(this.errorList.length) {\r\n this.toShow = this.toShow.add(this.containers);\r\n }\r\n if(this.settings.success) {\r\n for(i = 0;this.successList[i];i++) {\r\n this.showLabel(this.successList[i]);\r\n }\r\n }\r\n if(this.settings.unhighlight) {\r\n for(i = 0,elements = this.validElements() ;elements[i];i++) {\r\n this.settings.unhighlight.call(this,elements[i],this.settings.errorClass,this.settings.validClass);\r\n }\r\n }\r\n this.toHide = this.toHide.not(this.toShow);\r\n this.hideErrors();\r\n this.addWrapper(this.toShow).show();\r\n },\r\n\r\n validElements: function() {\r\n return this.currentElements.not(this.invalidElements());\r\n },\r\n\r\n invalidElements: function() {\r\n return $(this.errorList).map(function() {\r\n return this.element;\r\n });\r\n },\r\n\r\n showLabel: function(element,message) {\r\n var place,group,errorID,\r\n error = this.errorsFor(element),\r\n elementID = this.idOrName(element),\r\n describedBy = $(element).attr(\"aria-describedby\");\r\n if(error.length) {\r\n // refresh error/success class\r\n error.removeClass(this.settings.validClass).addClass(this.settings.errorClass);\r\n // replace message on existing label\r\n error.html(message);\r\n } else {\r\n // create error element\r\n error = $(\"<\" + this.settings.errorElement + \">\")\r\n .attr(\"id\",elementID + \"-error\")\r\n .addClass(this.settings.errorClass)\r\n .html(message || \"\");\r\n\r\n // Maintain reference to the element to be placed into the DOM\r\n place = error;\r\n if(this.settings.wrapper) {\r\n // make sure the element is visible, even in IE\r\n // actually showing the wrapped element is handled elsewhere\r\n place = error.hide().show().wrap(\"<\" + this.settings.wrapper + \"/>\").parent();\r\n }\r\n if(this.labelContainer.length) {\r\n this.labelContainer.append(place);\r\n } else if(this.settings.errorPlacement) {\r\n this.settings.errorPlacement(place,$(element));\r\n } else {\r\n place.insertAfter(element);\r\n }\r\n\r\n // Link error back to the element\r\n if(error.is(\"label\")) {\r\n // If the error is a label, then associate using 'for'\r\n error.attr(\"for\",elementID);\r\n } else if(error.parents(\"label[for='\" + elementID + \"']\").length === 0) {\r\n // If the element is not a child of an associated label, then it's necessary\r\n // to explicitly apply aria-describedby\r\n\r\n errorID = error.attr(\"id\").replace(/(:|\\.|\\[|\\]|\\$)/g,\"\\\\$1\");\r\n // Respect existing non-error aria-describedby\r\n if(!describedBy) {\r\n describedBy = errorID;\r\n } else if(!describedBy.match(new RegExp(\"\\\\b\" + errorID + \"\\\\b\"))) {\r\n // Add to end of list if not already present\r\n describedBy += \" \" + errorID;\r\n }\r\n $(element).attr(\"aria-describedby\",describedBy);\r\n\r\n // If this element is grouped, then assign to all elements in the same group\r\n group = this.groups[element.name];\r\n if(group) {\r\n $.each(this.groups,function(name,testgroup) {\r\n if(testgroup === group) {\r\n $(\"[name='\" + name + \"']\",this.currentForm)\r\n .attr(\"aria-describedby\",error.attr(\"id\"));\r\n }\r\n });\r\n }\r\n }\r\n }\r\n if(!message && this.settings.success) {\r\n error.text(\"\");\r\n if(typeof this.settings.success === \"string\") {\r\n error.addClass(this.settings.success);\r\n } else {\r\n this.settings.success(error,element);\r\n }\r\n }\r\n this.toShow = this.toShow.add(error);\r\n },\r\n\r\n errorsFor: function(element) {\r\n var name = this.idOrName(element),\r\n describer = $(element).attr(\"aria-describedby\"),\r\n selector = \"label[for='\" + name + \"'], label[for='\" + name + \"'] *\";\r\n\r\n // aria-describedby should directly reference the error element\r\n if(describer) {\r\n selector = selector + \", #\" + describer.replace(/\\s+/g,\", #\");\r\n }\r\n return this\r\n .errors()\r\n .filter(selector);\r\n },\r\n\r\n idOrName: function(element) {\r\n return this.groups[element.name] || (this.checkable(element) ? element.name : element.id || element.name);\r\n },\r\n\r\n validationTargetFor: function(element) {\r\n\r\n // If radio/checkbox, validate first element in group instead\r\n if(this.checkable(element)) {\r\n element = this.findByName(element.name);\r\n }\r\n\r\n // Always apply ignore filter\r\n return $(element).not(this.settings.ignore)[0];\r\n },\r\n\r\n checkable: function(element) {\r\n return (/radio|checkbox/i).test(element.type);\r\n },\r\n\r\n findByName: function(name) {\r\n return $(this.currentForm).find(\"[name='\" + name + \"']\");\r\n },\r\n\r\n getLength: function(value,element) {\r\n switch(element.nodeName.toLowerCase()) {\r\n case \"select\":\r\n return $(\"option:selected\",element).length;\r\n case \"input\":\r\n if(this.checkable(element)) {\r\n return this.findByName(element.name).filter(\":checked\").length;\r\n }\r\n }\r\n return value.length;\r\n },\r\n\r\n depend: function(param,element) {\r\n return this.dependTypes[typeof param] ? this.dependTypes[typeof param](param,element) : true;\r\n },\r\n\r\n dependTypes: {\r\n \"boolean\": function(param) {\r\n return param;\r\n },\r\n \"string\": function(param,element) {\r\n return !!$(param,element.form).length;\r\n },\r\n \"function\": function(param,element) {\r\n return param(element);\r\n }\r\n },\r\n\r\n optional: function(element) {\r\n var val = this.elementValue(element);\r\n return !$.validator.methods.required.call(this,val,element) && \"dependency-mismatch\";\r\n },\r\n\r\n startRequest: function(element) {\r\n if(!this.pending[element.name]) {\r\n this.pendingRequest++;\r\n this.pending[element.name] = true;\r\n }\r\n },\r\n\r\n stopRequest: function(element,valid) {\r\n this.pendingRequest--;\r\n // sometimes synchronization fails, make sure pendingRequest is never < 0\r\n if(this.pendingRequest < 0) {\r\n this.pendingRequest = 0;\r\n }\r\n delete this.pending[element.name];\r\n if(valid && this.pendingRequest === 0 && this.formSubmitted && this.form()) {\r\n $(this.currentForm).submit();\r\n this.formSubmitted = false;\r\n } else if(!valid && this.pendingRequest === 0 && this.formSubmitted) {\r\n $(this.currentForm).triggerHandler(\"invalid-form\",[this]);\r\n this.formSubmitted = false;\r\n }\r\n },\r\n\r\n previousValue: function(element) {\r\n return $.data(element,\"previousValue\") || $.data(element,\"previousValue\",{\r\n old: null,\r\n valid: true,\r\n message: this.defaultMessage(element,\"remote\")\r\n });\r\n },\r\n\r\n // cleans up all forms and elements, removes validator-specific events\r\n destroy: function() {\r\n this.resetForm();\r\n\r\n $(this.currentForm)\r\n .off(\".validate\")\r\n .removeData(\"validator\");\r\n }\r\n\r\n },\r\n\r\n classRuleSettings: {\r\n required: { required: true },\r\n email: { email: true },\r\n url: { url: true },\r\n date: { date: true },\r\n dateISO: { dateISO: true },\r\n number: { number: true },\r\n digits: { digits: true },\r\n creditcard: { creditcard: true }\r\n },\r\n\r\n addClassRules: function(className,rules) {\r\n if(className.constructor === String) {\r\n this.classRuleSettings[className] = rules;\r\n } else {\r\n $.extend(this.classRuleSettings,className);\r\n }\r\n },\r\n\r\n classRules: function(element) {\r\n var rules = {},\r\n classes = $(element).attr(\"class\");\r\n\r\n if(classes) {\r\n $.each(classes.split(\" \"),function() {\r\n if(this in $.validator.classRuleSettings) {\r\n $.extend(rules,$.validator.classRuleSettings[this]);\r\n }\r\n });\r\n }\r\n return rules;\r\n },\r\n\r\n normalizeAttributeRule: function(rules,type,method,value) {\r\n\r\n // convert the value to a number for number inputs, and for text for backwards compability\r\n // allows type=\"date\" and others to be compared as strings\r\n if(/min|max/.test(method) && (type === null || /number|range|text/.test(type))) {\r\n value = Number(value);\r\n\r\n // Support Opera Mini, which returns NaN for undefined minlength\r\n if(isNaN(value)) {\r\n value = undefined;\r\n }\r\n }\r\n\r\n if(value || value === 0) {\r\n rules[method] = value;\r\n } else if(type === method && type !== \"range\") {\r\n\r\n // exception: the jquery validate 'range' method\r\n // does not test for the html5 'range' type\r\n rules[method] = true;\r\n }\r\n },\r\n\r\n attributeRules: function(element) {\r\n var rules = {},\r\n $element = $(element),\r\n type = element.getAttribute(\"type\"),\r\n method,value;\r\n\r\n for(method in $.validator.methods) {\r\n\r\n // support for in both html5 and older browsers\r\n if(method === \"required\") {\r\n value = element.getAttribute(method);\r\n\r\n // Some browsers return an empty string for the required attribute\r\n // and non-HTML5 browsers might have required=\"\" markup\r\n if(value === \"\") {\r\n value = true;\r\n }\r\n\r\n // force non-HTML5 browsers to return bool\r\n value = !!value;\r\n } else {\r\n value = $element.attr(method);\r\n }\r\n\r\n this.normalizeAttributeRule(rules,type,method,value);\r\n }\r\n\r\n // maxlength may be returned as -1, 2147483647 ( IE ) and 524288 ( safari ) for text inputs\r\n if(rules.maxlength && /-1|2147483647|524288/.test(rules.maxlength)) {\r\n delete rules.maxlength;\r\n }\r\n\r\n return rules;\r\n },\r\n\r\n dataRules: function(element) {\r\n var rules = {},\r\n $element = $(element),\r\n type = element.getAttribute(\"type\"),\r\n method,value;\r\n\r\n for(method in $.validator.methods) {\r\n value = $element.data(\"rule\" + method.charAt(0).toUpperCase() + method.substring(1).toLowerCase());\r\n this.normalizeAttributeRule(rules,type,method,value);\r\n }\r\n return rules;\r\n },\r\n\r\n staticRules: function(element) {\r\n var rules = {},\r\n validator = $.data(element.form,\"validator\");\r\n\r\n if(validator.settings.rules) {\r\n rules = $.validator.normalizeRule(validator.settings.rules[element.name]) || {};\r\n }\r\n return rules;\r\n },\r\n\r\n normalizeRules: function(rules,element) {\r\n // handle dependency check\r\n $.each(rules,function(prop,val) {\r\n // ignore rule when param is explicitly false, eg. required:false\r\n if(val === false) {\r\n delete rules[prop];\r\n return;\r\n }\r\n if(val.param || val.depends) {\r\n var keepRule = true;\r\n switch(typeof val.depends) {\r\n case \"string\":\r\n keepRule = !!$(val.depends,element.form).length;\r\n break;\r\n case \"function\":\r\n keepRule = val.depends.call(element,element);\r\n break;\r\n }\r\n if(keepRule) {\r\n rules[prop] = val.param !== undefined ? val.param : true;\r\n } else {\r\n delete rules[prop];\r\n }\r\n }\r\n });\r\n\r\n // evaluate parameters\r\n $.each(rules,function(rule,parameter) {\r\n rules[rule] = $.isFunction(parameter) ? parameter(element) : parameter;\r\n });\r\n\r\n // clean number parameters\r\n $.each([\"minlength\",\"maxlength\"],function() {\r\n if(rules[this]) {\r\n rules[this] = Number(rules[this]);\r\n }\r\n });\r\n $.each([\"rangelength\",\"range\"],function() {\r\n var parts;\r\n if(rules[this]) {\r\n if($.isArray(rules[this])) {\r\n rules[this] = [Number(rules[this][0]),Number(rules[this][1])];\r\n } else if(typeof rules[this] === \"string\") {\r\n parts = rules[this].replace(/[\\[\\]]/g,\"\").split(/[\\s,]+/);\r\n rules[this] = [Number(parts[0]),Number(parts[1])];\r\n }\r\n }\r\n });\r\n\r\n if($.validator.autoCreateRanges) {\r\n // auto-create ranges\r\n if(rules.min != null && rules.max != null) {\r\n rules.range = [rules.min,rules.max];\r\n delete rules.min;\r\n delete rules.max;\r\n }\r\n if(rules.minlength != null && rules.maxlength != null) {\r\n rules.rangelength = [rules.minlength,rules.maxlength];\r\n delete rules.minlength;\r\n delete rules.maxlength;\r\n }\r\n }\r\n\r\n return rules;\r\n },\r\n\r\n // Converts a simple string to a {string: true} rule, e.g., \"required\" to {required:true}\r\n normalizeRule: function(data) {\r\n if(typeof data === \"string\") {\r\n var transformed = {};\r\n $.each(data.split(/\\s/),function() {\r\n transformed[this] = true;\r\n });\r\n data = transformed;\r\n }\r\n return data;\r\n },\r\n\r\n // http://jqueryvalidation.org/jQuery.validator.addMethod/\r\n addMethod: function(name,method,message) {\r\n $.validator.methods[name] = method;\r\n $.validator.messages[name] = message !== undefined ? message : $.validator.messages[name];\r\n if(method.length < 3) {\r\n $.validator.addClassRules(name,$.validator.normalizeRule(name));\r\n }\r\n },\r\n\r\n methods: {\r\n\r\n // http://jqueryvalidation.org/required-method/\r\n required: function(value,element,param) {\r\n // check if dependency is met\r\n if(!this.depend(param,element)) {\r\n return \"dependency-mismatch\";\r\n }\r\n if(element.nodeName.toLowerCase() === \"select\") {\r\n // could be an array for select-multiple or a string, both are fine this way\r\n var val = $(element).val();\r\n return val && val.length > 0;\r\n }\r\n if(this.checkable(element)) {\r\n return this.getLength(value,element) > 0;\r\n }\r\n return value.length > 0;\r\n },\r\n\r\n // http://jqueryvalidation.org/email-method/\r\n email: function(value,element) {\r\n // From https://html.spec.whatwg.org/multipage/forms.html#valid-e-mail-address\r\n // Retrieved 2014-01-14\r\n // If you have a problem with this implementation, report a bug against the above spec\r\n // Or use custom methods to implement your own email validation\r\n return this.optional(element) || /^[a-zA-Z0-9.!#$%&'*+\\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/.test(value);\r\n },\r\n\r\n // http://jqueryvalidation.org/url-method/\r\n url: function(value,element) {\r\n\r\n // Copyright (c) 2010-2013 Diego Perini, MIT licensed\r\n // https://gist.github.com/dperini/729294\r\n // see also https://mathiasbynens.be/demo/url-regex\r\n // modified to allow protocol-relative URLs\r\n return this.optional(element) || /^(?:(?:(?:https?|ftp):)?\\/\\/)(?:\\S+(?::\\S*)?@)?(?:(?!(?:10|127)(?:\\.\\d{1,3}){3})(?!(?:169\\.254|192\\.168)(?:\\.\\d{1,3}){2})(?!172\\.(?:1[6-9]|2\\d|3[0-1])(?:\\.\\d{1,3}){2})(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:[a-z\\u00a1-\\uffff]{2,})).?)(?::\\d{2,5})?(?:[/?#]\\S*)?$/i.test(value);\r\n },\r\n\r\n // http://jqueryvalidation.org/date-method/\r\n date: function(value,element) {\r\n return this.optional(element) || !/Invalid|NaN/.test(new Date(value).toString());\r\n },\r\n\r\n // http://jqueryvalidation.org/dateISO-method/\r\n dateISO: function(value,element) {\r\n return this.optional(element) || /^\\d{4}[\\/\\-](0?[1-9]|1[012])[\\/\\-](0?[1-9]|[12][0-9]|3[01])$/.test(value);\r\n },\r\n\r\n // http://jqueryvalidation.org/number-method/\r\n number: function(value,element) {\r\n return this.optional(element) || /^(?:-?\\d+|-?\\d{1,3}(?:,\\d{3})+)?(?:\\.\\d+)?$/.test(value);\r\n },\r\n\r\n // http://jqueryvalidation.org/digits-method/\r\n digits: function(value,element) {\r\n return this.optional(element) || /^\\d+$/.test(value);\r\n },\r\n\r\n // http://jqueryvalidation.org/creditcard-method/\r\n // based on http://en.wikipedia.org/wiki/Luhn_algorithm\r\n creditcard: function(value,element) {\r\n if(this.optional(element)) {\r\n return \"dependency-mismatch\";\r\n }\r\n // accept only spaces, digits and dashes\r\n if(/[^0-9 \\-]+/.test(value)) {\r\n return false;\r\n }\r\n var nCheck = 0,\r\n nDigit = 0,\r\n bEven = false,\r\n n,cDigit;\r\n\r\n value = value.replace(/\\D/g,\"\");\r\n\r\n // Basing min and max length on\r\n // http://developer.ean.com/general_info/Valid_Credit_Card_Types\r\n if(value.length < 13 || value.length > 19) {\r\n return false;\r\n }\r\n\r\n for(n = value.length - 1;n >= 0;n--) {\r\n cDigit = value.charAt(n);\r\n nDigit = parseInt(cDigit,10);\r\n if(bEven) {\r\n if((nDigit *= 2) > 9) {\r\n nDigit -= 9;\r\n }\r\n }\r\n nCheck += nDigit;\r\n bEven = !bEven;\r\n }\r\n\r\n return (nCheck % 10) === 0;\r\n },\r\n\r\n // http://jqueryvalidation.org/minlength-method/\r\n minlength: function(value,element,param) {\r\n var length = $.isArray(value) ? value.length : this.getLength(value,element);\r\n return this.optional(element) || length >= param;\r\n },\r\n\r\n // http://jqueryvalidation.org/maxlength-method/\r\n maxlength: function(value,element,param) {\r\n var length = $.isArray(value) ? value.length : this.getLength(value,element);\r\n return this.optional(element) || length <= param;\r\n },\r\n\r\n // http://jqueryvalidation.org/rangelength-method/\r\n rangelength: function(value,element,param) {\r\n var length = $.isArray(value) ? value.length : this.getLength(value,element);\r\n return this.optional(element) || (length >= param[0] && length <= param[1]);\r\n },\r\n\r\n // http://jqueryvalidation.org/min-method/\r\n min: function(value,element,param) {\r\n return this.optional(element) || value >= param;\r\n },\r\n\r\n // http://jqueryvalidation.org/max-method/\r\n max: function(value,element,param) {\r\n return this.optional(element) || value <= param;\r\n },\r\n\r\n // http://jqueryvalidation.org/range-method/\r\n range: function(value,element,param) {\r\n return this.optional(element) || (value >= param[0] && value <= param[1]);\r\n },\r\n\r\n // http://jqueryvalidation.org/equalTo-method/\r\n equalTo: function(value,element,param) {\r\n // bind to the blur event of the target in order to revalidate whenever the target field is updated\r\n // TODO find a way to bind the event just once, avoiding the unbind-rebind overhead\r\n var target = $(param);\r\n if(this.settings.onfocusout) {\r\n target.off(\".validate-equalTo\").on(\"blur.validate-equalTo\",function() {\r\n $(element).valid();\r\n });\r\n }\r\n return value === target.val();\r\n },\r\n\r\n // http://jqueryvalidation.org/remote-method/\r\n remote: function(value,element,param) {\r\n if(this.optional(element)) {\r\n return \"dependency-mismatch\";\r\n }\r\n\r\n var previous = this.previousValue(element),\r\n validator,data;\r\n\r\n if(!this.settings.messages[element.name]) {\r\n this.settings.messages[element.name] = {};\r\n }\r\n previous.originalMessage = this.settings.messages[element.name].remote;\r\n this.settings.messages[element.name].remote = previous.message;\r\n\r\n param = typeof param === \"string\" && { url: param } || param;\r\n\r\n if(previous.old === value) {\r\n return previous.valid;\r\n }\r\n\r\n previous.old = value;\r\n validator = this;\r\n this.startRequest(element);\r\n data = {};\r\n data[element.name] = value;\r\n $.ajax($.extend(true,{\r\n mode: \"abort\",\r\n port: \"validate\" + element.name,\r\n dataType: \"json\",\r\n data: data,\r\n context: validator.currentForm,\r\n success: function(response) {\r\n var valid = response === true || response === \"true\",\r\n errors,message,submitted;\r\n\r\n validator.settings.messages[element.name].remote = previous.originalMessage;\r\n if(valid) {\r\n submitted = validator.formSubmitted;\r\n validator.prepareElement(element);\r\n validator.formSubmitted = submitted;\r\n validator.successList.push(element);\r\n delete validator.invalid[element.name];\r\n validator.showErrors();\r\n } else {\r\n errors = {};\r\n message = response || validator.defaultMessage(element,\"remote\");\r\n errors[element.name] = previous.message = $.isFunction(message) ? message(value) : message;\r\n validator.invalid[element.name] = true;\r\n validator.showErrors(errors);\r\n }\r\n previous.valid = valid;\r\n validator.stopRequest(element,valid);\r\n }\r\n },param));\r\n return \"pending\";\r\n }\r\n }\r\n\r\n });\r\n\r\n // ajax mode: abort\r\n // usage: $.ajax({ mode: \"abort\"[, port: \"uniqueport\"]});\r\n // if mode:\"abort\" is used, the previous request on that port (port can be undefined) is aborted via XMLHttpRequest.abort()\r\n\r\n var pendingRequests = {},\r\n ajax;\r\n // Use a prefilter if available (1.5+)\r\n if($.ajaxPrefilter) {\r\n $.ajaxPrefilter(function(settings,_,xhr) {\r\n var port = settings.port;\r\n if(settings.mode === \"abort\") {\r\n if(pendingRequests[port]) {\r\n pendingRequests[port].abort();\r\n }\r\n pendingRequests[port] = xhr;\r\n }\r\n });\r\n } else {\r\n // Proxy ajax\r\n ajax = $.ajax;\r\n $.ajax = function(settings) {\r\n var mode = (\"mode\" in settings ? settings : $.ajaxSettings).mode,\r\n port = (\"port\" in settings ? settings : $.ajaxSettings).port;\r\n if(mode === \"abort\") {\r\n if(pendingRequests[port]) {\r\n pendingRequests[port].abort();\r\n }\r\n pendingRequests[port] = ajax.apply(this,arguments);\r\n return pendingRequests[port];\r\n }\r\n return ajax.apply(this,arguments);\r\n };\r\n }\r\n\r\n}));\n\r\n// Clicktap\r\n// -----------------------\r\n// Register Clicktap event to automatically choose to either click\r\n// or tap depending on device support.\r\n\r\n\r\nvar tapEvent = {\r\n\tmovement: 0,\r\n\tisValid: function() {\r\n\t\treturn this.movement < 4;\r\n\t}\r\n};\r\n\r\n$.fn.clickTap = function(elem, f, preventStart) {\r\n\t//$(this).on('touchstart',function() { });\r\n\t$(this).on('touchmove', elem, function() {\r\n\t\t// Keep track of the number of touchmove events fired\r\n\t\t// If more than 3, we will cancel our touch event\r\n\t\ttapEvent.movement++;\r\n\t});\r\n\t$(this).on('touchend click', elem, function(e) {\r\n\t\tif (!preventStart) { e.preventDefault(); }\r\n\t\t// if no touchend\r\n\t\tif (e.type == 'touchend') {\r\n\t\t\tif (tapEvent.isValid()) {\r\n\t\t\t\tf.apply(this, [e]);\r\n\t\t\t\t// prevent from firing subsequent click event\r\n\t\t\t\te.preventDefault();\r\n\t\t\t}\r\n\t\t\t// reset tap movement\r\n\t\t\ttapEvent.movement = 0;\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tf.apply(this, [e]);\r\n\t});\r\n};\n/*\r\n|*|\r\n|*| :: cookies.js ::\r\n|*|\r\n|*| A complete cookies reader/writer framework with full unicode support.\r\n|*|\r\n|*| Revision #1 - September 4, 2014\r\n|*|\r\n|*| https://developer.mozilla.org/en-US/docs/Web/API/document.cookie\r\n|*| https://developer.mozilla.org/User:fusionchess\r\n|*|\r\n|*| This framework is released under the GNU Public License, version 3 or later.\r\n|*| http://www.gnu.org/licenses/gpl-3.0-standalone.html\r\n|*|\r\n|*| Syntaxes:\r\n|*|\r\n|*| * docCookies.setItem(name, value[, end[, path[, domain[, secure]]]])\r\n|*| * docCookies.getItem(name)\r\n|*| * docCookies.removeItem(name[, path[, domain]])\r\n|*| * docCookies.hasItem(name)\r\n|*| * docCookies.keys()\r\n|*|\r\n\\*/\r\nvar docCookies = {\r\n\tgetItem: function(sKey) {\r\n\t\tif (!sKey) { return null; }\r\n\t\treturn decodeURIComponent(document.cookie.replace(new RegExp(\"(?:(?:^|.*;)\\\\s*\" + encodeURIComponent(sKey).replace(/[\\-\\.\\+\\*]/g, \"\\\\$&\") + \"\\\\s*\\\\=\\\\s*([^;]*).*$)|^.*$\"), \"$1\")) || null;\r\n\t},\r\n\tsetItem: function(sKey, sValue, vEnd, sPath, sDomain, bSecure) {\r\n\t\tconsole.log(vEnd);\r\n\t\tif (!sKey || /^(?:expires|max\\-age|path|domain|secure)$/i.test(sKey)) { return false; }\r\n\t\tvar sExpires = \"\";\r\n\t\tif (vEnd) {\r\n\t\t\tconsole.log(vEnd);\r\n\t\t\tswitch (vEnd.constructor) {\r\n\t\t\t\tcase Number:\r\n\t\t\t\t\tconsole.log('num');\r\n\t\t\t\t\tsExpires = vEnd === Infinity ? \"; expires=Fri, 31 Dec 9999 23:59:59 GMT\" : \"; max-age=\" + vEnd;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase String:\r\n\t\t\t\t\tconsole.log('hi');\r\n\t\t\t\t\tsExpires = \"; expires=\" + vEnd;\r\n\t\t\t\t\tdebugger;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase Date:\r\n\t\t\t\t\tsExpires = \"; expires=\" + vEnd.toUTCString();\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t\tdocument.cookie = encodeURIComponent(sKey) + \"=\" + encodeURIComponent(sValue) + sExpires + (sDomain ? \"; domain=\" + sDomain : \"\") + (sPath ? \"; path=\" + sPath : \"\") + (bSecure ? \"; secure\" : \"\");\r\n\t\t//console.log(encodeURIComponent(sKey) + \"=\" + encodeURIComponent(sValue) + sExpires + (sDomain ? \"; domain=\" + sDomain : \"\") + (sPath ? \"; path=\" + sPath : \"\") + (bSecure ? \"; secure\" : \"\"));\r\n\t\treturn true;\r\n\t},\r\n\tremoveItem: function(sKey, sPath, sDomain) {\r\n\t\tif (!this.hasItem(sKey)) { return false; }\r\n\t\tdocument.cookie = encodeURIComponent(sKey) + \"=; expires=Thu, 01 Jan 1970 00:00:00 GMT\" + (sDomain ? \"; domain=\" + sDomain : \"\") + (sPath ? \"; path=\" + sPath : \"\");\r\n\t\treturn true;\r\n\t},\r\n\thasItem: function(sKey) {\r\n\t\tif (!sKey) { return false; }\r\n\t\treturn (new RegExp(\"(?:^|;\\\\s*)\" + encodeURIComponent(sKey).replace(/[\\-\\.\\+\\*]/g, \"\\\\$&\") + \"\\\\s*\\\\=\")).test(document.cookie);\r\n\t},\r\n\tkeys: function() {\r\n\t\tvar aKeys = document.cookie.replace(/((?:^|\\s*;)[^\\=]+)(?=;|$)|^\\s*|\\s*(?:\\=[^;]*)?(?:\\1|$)/g, \"\").split(/\\s*(?:\\=[^;]*)?;\\s*/);\r\n\t\tfor (var nLen = aKeys.length, nIdx = 0; nIdx < nLen; nIdx++) { aKeys[nIdx] = decodeURIComponent(aKeys[nIdx]); }\r\n\t\treturn aKeys;\r\n\t}\r\n};\r\n\nfunction FormConstructor() {\r\n var $form,\r\n $fieldWrap,\r\n $fields,\r\n $submit,\r\n $page = $('.page'),\r\n\r\n // salesforce submit URL\r\n //sfid = \"&oid=00D80000000KudK\",\r\n //sfga = \"&sfga=00D80000000KudK\",\r\n salesForceEndpoint = 'https://webto.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8&oid=00D80000000KudK&sfga=00D80000000KudK&',\r\n formId,\r\n s = {},\r\n leadAttributes = [\r\n 'leadSource',\r\n 'campaign',\r\n 'referralPartner'\r\n ],\r\n _completionTimer,\r\n dt = new Date(),\r\n time = dt.getHours() + \":\" + dt.getMinutes() + \":\" + dt.getSeconds(),\r\n date = dt.getFullYear() + '-' + (dt.getMonth() + 1) + '-' + dt.getDate(),\r\n dateTime = date + ' ' + time;\r\n\r\n this.submitInProgress = false;\r\n this.submissionPoints = 0;\r\n\r\n\r\n // --------------------------\r\n // Validation Methods\r\n // --------------------------\r\n function _initValidationRules() {\r\n // initialize form validation so we can add new rules\r\n $('form').validate();\r\n $fields.each(function (i) {\r\n var fieldName = $(this).attr('name');\r\n\r\n if (fieldName == \"phone\") {\r\n $(this).rules(\"add\", {\r\n minlength: 10,\r\n messages: {\r\n minlength: \"Please enter a valid phone number with area code\"\r\n }\r\n });\r\n }\r\n if (fieldName == \"email\") {\r\n $(this).rules(\"add\", {\r\n email: true,\r\n tldCheck: true,\r\n messages: {\r\n email: \"Please enter a valid email address\"\r\n }\r\n });\r\n }\r\n $(this).rules(\"add\", {\r\n required: true,\r\n messages: {\r\n required: \"This field is required\"\r\n }\r\n });\r\n });\r\n\r\n // require email addresses to have both an @ symbol\r\n // and at least a 2 character top level domain\r\n $.validator.addMethod(\"tldCheck\", function (value) {\r\n var string = value;\r\n var lastChar = string.length;\r\n var tldUrl = string.substring(string.indexOf('@'), lastChar);\r\n var domIndex = tldUrl.lastIndexOf('.') + 2;\r\n var tldCheck = tldUrl.charAt(domIndex);\r\n var atCheck = tldUrl.charAt(domIndex - 1);\r\n return tldCheck && atCheck != '@';\r\n }, \"Please enter a valid email address\");\r\n }\r\n\r\n function _allFieldsValid(isHuman) {\r\n var booValid = true;\r\n\r\n //If human test was completed and correct submit the form with field validation but skip bot detection!\r\n if (isHuman == \"true\") {\r\n\r\n // loop through required fields and set booValid to false if any of them are invalid\r\n $fields.each(function () {\r\n\r\n if (!$(this).valid()) {\r\n booValid = false;\r\n }\r\n\r\n // check for test submissions\r\n if ($(this).val() && $(this).val().toUpperCase().indexOf('_TEST') > -1) {\r\n s.leadType = 'ignore';\r\n }\r\n });\r\n }\r\n else if (isHuman == \"false\") {\r\n _displayErrorAndPreventSubmission('Invalid Submission', 'Form submission could not be processed. For immediate assistance please contact us by email or phone.

contact sales: sales@certify.com | 888-925-0510
contact support:
support@certify.com | 888-925-0510');\r\n throw new Error('Invalid Submission');\r\n }\r\n\r\n if (isHuman == null) {\r\n // Detect if bots exist in Honey Pot and Character Detection dig out the human test\r\n if (_preventBotSubmissions()) {\r\n booValid = false;\r\n\r\n _disableSubmit();\r\n\r\n if (_humanTest()) {\r\n booValid = true;\r\n\r\n $fields.each(function () {\r\n\r\n if (!$(this).valid()) {\r\n booValid = false;\r\n }\r\n\r\n // check for test submissions\r\n if ($(this).val() && $(this).val().toUpperCase().indexOf('_TEST') > -1) {\r\n s.leadType = 'ignore';\r\n }\r\n\r\n return booValid;\r\n });\r\n }\r\n }\r\n else {\r\n // loop through required fields and set booValid to false if any of them are invalid\r\n $fields.each(function () {\r\n\r\n if (!$(this).valid()) {\r\n booValid = false;\r\n }\r\n\r\n // check for test submissions\r\n if ($(this).val() && $(this).val().toUpperCase().indexOf('_TEST') > -1) {\r\n s.leadType = 'ignore';\r\n }\r\n });\r\n }\r\n }\r\n\r\n return booValid;\r\n }\r\n\r\n function _addHoneyPotCaptcha() {\r\n var i = getRandomInt(0, $fields.length - 1);\r\n\r\n // A field hidden by JavaScript: honeypot field that only bots which enter data into hidden fields will fill out.\r\n var userDataHtml = '
';\r\n\r\n // A field hidden by CSS: honeypot field that is populated to the users email address when the real email field is blurred.\r\n var emailHtml = '
';\r\n\r\n // A field requiring a specific input: Using date/time as the value, it must not be changed by a bot or it will prevent Form from submitting\r\n var dateHtml = '
';\r\n\r\n // A field requiring a blank input: Using a blank value, it must not be filled by a bot or it will prevent Form from submitting\r\n var blankHtml = '
';\r\n\r\n if ($($('.inputWrap')[i]).length) {\r\n $($('.inputWrap')[i]).prepend(userDataHtml, emailHtml, dateHtml, blankHtml);\r\n\r\n } else {\r\n $($fields[i]).prepend(userDataHtml, emailHtml, dateHtml, blankHtml);\r\n }\r\n\r\n //Hiding fields above via jquery\r\n $('.userContent').hide();\r\n }\r\n\r\n function _humanTest() {\r\n var isHuman = false;\r\n var valueOne = Math.floor(Math.random() * 10);\r\n var valueTwo = Math.floor(Math.random() * 10);\r\n var operators = ['+', '-'] // An array of Operators\r\n var operator = operators[Math.round(Math.random() * (operators.length - 1))]; // Choose a random operator\r\n var humanTestHTML = \"
\" + valueOne + \"\" + operator + \"\" + valueTwo + \" =
\";\r\n\r\n if (operator == '-') {\r\n result = valueOne - valueTwo;\r\n }\r\n else {\r\n result = valueOne + valueTwo;\r\n }\r\n\r\n $(humanTestHTML).insertBefore('.submit');\r\n\r\n $('.submit').addClass('human-test-button');\r\n $('.submit').attr('data-human', false);\r\n\r\n var humanTest = $('.human-test');\r\n var numOne = $('.valOne', humanTest);\r\n var numTwo = $('.valTwo', humanTest);\r\n var operatorHTML = $('.operator', humanTest);\r\n var humanTestResult = $('.answer', humanTest);\r\n var submitTest = $('.submit', humanTest);\r\n\r\n //Fill in human test with the random values\r\n $(numOne).html(valueOne);\r\n $(numTwo).html(valueTwo);\r\n $(operatorHTML).html(operator);\r\n\r\n //Push isHuman variable to data-human attribute (true/false) on submit button during keyup event.\r\n $(humanTestResult).on('keyup', function () {\r\n var answerValue = $(this).val();\r\n\r\n _enableSubmit();\r\n\r\n if (answerValue == result) {\r\n isHuman = true;\r\n }\r\n else {\r\n isHuman = false;\r\n }\r\n\r\n $('.submit').attr(\"data-human\", isHuman);\r\n });\r\n }\r\n\r\n\r\n function _preventBotSubmissions() {\r\n var fields = $('input.formField');\r\n var char = '';\r\n var botDetected = false;\r\n\r\n //Step 1: Are any of the honeyPot fields filled out?\r\n if ($('.userName').val() !== '' || $('.userAddress').val() !== '' || $('.userPhone').val() !== dateTime || $('.userComments').val() !== '') {\r\n // check if honeypot field filled by bot\r\n s.leadType = 'ignore';\r\n\r\n _displayErrorAndPreventSubmission('Invalid Submission', 'Form submission could not be processed. For immediate assistance please contact us by email or phone.

contact sales: sales@certify.com | 888-925-0510
contact support:
support@certify.com | 888-925-0510');\r\n throw new Error('Invalid Submission');\r\n }\r\n\r\n //Step 2: Go through each field inside of form for Foreign Character test\r\n $(fields).each(function () {\r\n var target = $(this).val();\r\n var d = false;\r\n\r\n //Check through each character in this field for foreign character (not part of alphabet)\r\n for (var i = 0; i < target.length; i++) {\r\n char = target.charAt(i);\r\n\r\n //Is this character a foreign character??\r\n d = /[\\u3400-\\u9FBF]/.test(char);\r\n\r\n //If true then set botDetected variable to true\r\n if (d == true) {\r\n botDetected = true;\r\n }\r\n }\r\n });\r\n\r\n return botDetected;\r\n }\r\n\r\n function _formatPhoneNumberForSF() {\r\n if ($('input[name=\"phone\"]').val()) {\r\n phoneNum = $('input[name=\"phone\"]').val();\r\n phoneNum = phoneNum.replace(/\\s+/g, '');\r\n phoneDigits = phoneNum.replace(/\\D/g, '').length;\r\n if (phoneDigits > 10 && phoneNum.charAt(0)) {\r\n phoneNum = phoneNum.substr(1);\r\n }\r\n if (phoneNum.charAt(0) == '-') {\r\n phoneNum = phoneNum.substr(1);\r\n }\r\n $('input[name=\"phone\"]').val(phoneNum);\r\n }\r\n }\r\n\r\n\r\n // --------------------------\r\n // Optional setting methods\r\n // --------------------------\r\n function _autoLoad() {\r\n setTimeout(function () {\r\n\r\n _showModal($form);\r\n //blur landing page content if selected\r\n if ($('.blur-wrap').length) {\r\n $('.blur-wrap').addClass('blur');\r\n }\r\n }, s.autoLoadDelay);\r\n }\r\n\r\n function _enableLinkedInAutofill() {\r\n $('form').attr('name', 'autoFillForm');\r\n var LI = document.createElement('script');\r\n LI.src = '//platform.linkedin.com/in.js';\r\n LI.type = 'text/javascript';\r\n LI.innerHTML = ' \\n api_key: 7751qswuyhszau \\n noAuth: true \\n lang: en_us \\n';\r\n $('head').append(LI);\r\n var LIdata = '