// Global switch var wa_enable = true; var hexcase = 0; /* hex output format. 0 - lowercase; 1 - uppercase */ var b64pad = "="; /* base-64 pad character. "=" for strict RFC compliance */ var chrsz = 8; /* bits per input character. 8 - ASCII; 16 - Unicode */ var sendBid = ""; var wa_global_disable = false; /* Method for SHA 256 encryption. */ function SHA256(s) { var chrsz = 8; var hexcase = 0; function safe_add(x, y) { var lsw = (x & 0xFFFF) + (y & 0xFFFF); var msw = (x >> 16) + (y >> 16) + (lsw >> 16); return (msw << 16) | (lsw & 0xFFFF); } function S(X, n) { return (X >>> n) | (X << (32 - n)); } function R(X, n) { return (X >>> n); } function Ch(x, y, z) { return ((x & y) ^ ((~x) & z)); } function Maj(x, y, z) { return ((x & y) ^ (x & z) ^ (y & z)); } function Sigma0256(x) { return (S(x, 2) ^ S(x, 13) ^ S(x, 22)); } function Sigma1256(x) { return (S(x, 6) ^ S(x, 11) ^ S(x, 25)); } function Gamma0256(x) { return (S(x, 7) ^ S(x, 18) ^ R(x, 3)); } function Gamma1256(x) { return (S(x, 17) ^ S(x, 19) ^ R(x, 10)); } function core_sha256(m, l) { var K = new Array(0x428A2F98, 0x71374491, 0xB5C0FBCF, 0xE9B5DBA5, 0x3956C25B, 0x59F111F1, 0x923F82A4, 0xAB1C5ED5, 0xD807AA98, 0x12835B01, 0x243185BE, 0x550C7DC3, 0x72BE5D74, 0x80DEB1FE, 0x9BDC06A7, 0xC19BF174, 0xE49B69C1, 0xEFBE4786, 0xFC19DC6, 0x240CA1CC, 0x2DE92C6F, 0x4A7484AA, 0x5CB0A9DC, 0x76F988DA, 0x983E5152, 0xA831C66D, 0xB00327C8, 0xBF597FC7, 0xC6E00BF3, 0xD5A79147, 0x6CA6351, 0x14292967, 0x27B70A85, 0x2E1B2138, 0x4D2C6DFC, 0x53380D13, 0x650A7354, 0x766A0ABB, 0x81C2C92E, 0x92722C85, 0xA2BFE8A1, 0xA81A664B, 0xC24B8B70, 0xC76C51A3, 0xD192E819, 0xD6990624, 0xF40E3585, 0x106AA070, 0x19A4C116, 0x1E376C08, 0x2748774C, 0x34B0BCB5, 0x391C0CB3, 0x4ED8AA4A, 0x5B9CCA4F, 0x682E6FF3, 0x748F82EE, 0x78A5636F, 0x84C87814, 0x8CC70208, 0x90BEFFFA, 0xA4506CEB, 0xBEF9A3F7, 0xC67178F2); var HASH = new Array(0x6A09E667, 0xBB67AE85, 0x3C6EF372, 0xA54FF53A, 0x510E527F, 0x9B05688C, 0x1F83D9AB, 0x5BE0CD19); var W = new Array(64); var a, b, c, d, e, f, g, h, i, j; var T1, T2; m[l >> 5] |= 0x80 << (24 - l % 32); m[((l + 64 >> 9) << 4) + 15] = l; for (var i = 0; i < m.length; i += 16) { a = HASH[0]; b = HASH[1]; c = HASH[2]; d = HASH[3]; e = HASH[4]; f = HASH[5]; g = HASH[6]; h = HASH[7]; for (var j = 0; j < 64; j++) { if (j < 16) W[j] = m[j + i]; else W[j] = safe_add(safe_add(safe_add(Gamma1256(W[j - 2]), W[j - 7]), Gamma0256(W[j - 15])), W[j - 16]); T1 = safe_add(safe_add(safe_add(safe_add(h, Sigma1256(e)), Ch(e, f, g)), K[j]), W[j]); T2 = safe_add(Sigma0256(a), Maj(a, b, c)); h = g; g = f; f = e; e = safe_add(d, T1); d = c; c = b; b = a; a = safe_add(T1, T2); } HASH[0] = safe_add(a, HASH[0]); HASH[1] = safe_add(b, HASH[1]); HASH[2] = safe_add(c, HASH[2]); HASH[3] = safe_add(d, HASH[3]); HASH[4] = safe_add(e, HASH[4]); HASH[5] = safe_add(f, HASH[5]); HASH[6] = safe_add(g, HASH[6]); HASH[7] = safe_add(h, HASH[7]); } return HASH; } function str2binb(str) { var bin = Array(); var mask = (1 << chrsz) - 1; for (var i = 0; i < str.length * chrsz; i += chrsz) { bin[i >> 5] |= (str.charCodeAt(i / chrsz) & mask) << (24 - i % 32); } return bin; } /* * Convert an binary array to a string */ function binb2str(input) { var output = ""; for (var i = 0; i < input.length * 32; i += 8) output += String.fromCharCode((input[i >> 5] >>> (24 - i % 32)) & 0xFF); return output; } /* * Convert a raw string to a base-64 string */ function str2b64(input) { try { b64pad } catch (e) { b64pad = ''; } var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; var output = ""; var len = input.length; for (var i = 0; i < len; i += 3) { var triplet = (input.charCodeAt(i) << 16) | (i + 1 < len ? input.charCodeAt(i + 1) << 8 : 0) | (i + 2 < len ? input.charCodeAt(i + 2) : 0); for (var j = 0; j < 4; j++) { if (i * 8 + j * 6 > input.length * 8) output += b64pad; else output += tab.charAt((triplet >>> 6 * (3 - j)) & 0x3F); } } return output; } return str2b64(binb2str(core_sha256(str2binb(s), s.length * chrsz))); } function getCookie(c_name) { var i, x, y, cookies = document.cookie.split(";"); for (i = 0; i < cookies.length; i++) { x = cookies[i].substr(0, cookies[i].indexOf("=")); y = cookies[i].substr(cookies[i].indexOf("=") + 1); x = x.replace(/^\s+|\s+$/g, ""); if (x == c_name) { return unescape(y); } } } function fetchBrowserId(cbidInd) { var cbid; var np2 = getCookie("NP2"); if (np2 != null && np2.indexOf("|") != -1) { var val = np2.split("|"); if (val.length > 2) { cbid = cbidInd + SHA256(cbidInd + val[1]); //Browser ID sendBid = val[1]; } } else { var browserId = base64ToAscii(bin2String(str2ab(createGuid()))).replace(/(^=+|=+$)/mg, ""); var np2Cookie = "|" + browserId + "|||||||||||||"; mkTmsCookie("NP2", np2Cookie, 6000, "/", ".schwab.com"); cbid = cbidInd + SHA256(cbidInd + browserId); sendBid = browserId; } return cbid; } function base64ToAscii(text) { var digits = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", i = 0, cur, prev, byteNum, result = []; while (i < text.length) { cur = text.charCodeAt(i); byteNum = i % 3; switch (byteNum) { case 0: //first byte result.push(digits.charAt(cur >> 2)); break; case 1: //second byte result.push(digits.charAt((prev & 3) << 4 | (cur >> 4))); break; case 2: //third byte result.push(digits.charAt((prev & 0x0f) << 2 | (cur >> 6))); result.push(digits.charAt(cur & 0x3f)); break; } prev = cur; i++; } return result.join(""); } // NP2 Cookie Initialization for Akamai Pages function mkTmsCookie(name, value, expires, path, domain) { var cookie = name + "=" + value + ";"; if (expires) { // If it's a date if (expires instanceof Date) { // If it isn't a valid date if (isNaN(expires.getTime())) expires = new Date(); } else expires = new Date(new Date().getTime() + parseInt(expires) * 1000 * 60 * 60 * 24); cookie += "expires=" + expires.toGMTString() + ";"; } if (path) cookie += "path=" + path + ";"; if (domain) cookie += "domain=" + domain + ";"; document.cookie = cookie; } function str2ab(str) { var res = str.split('-'); var bufView = new Array(16); var k = 0; // Convert every two chars of each portion // of res from hex to int. for (var i = 0; i < res.length; i++) { for (var j = 0; j < res[i].length; j += 2) { var hex = res[i][j] + res[i][j + 1]; bufView[k++] = parseInt(hex, 16); } } return bufView; } function bin2String(array) { var result = ""; for (var i = 0; i < array.length; i++) { result += String.fromCharCode(parseInt(array[i])); } return result; } function createGuid() { return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) { var r = Math.random() * 16 | 0, v = c === 'x' ? r : (r & 0x3 | 0x8); return v.toString(16); }); } // SC - TAG - HEADER // Schwab Charitable // Report suite: cschwabcharitableuat, cschwabcharitableprod var scatAccounts = { "DEV": "cschwabcharitableuat", "ACPT": "cschwabcharitableuat", "PROD": "cschwabcharitableprod" }; // UTAG Data Object var utag_data = { sc_report_suite: typeof (waEnvId) == "undefined" ? "" : (typeof (scatAccounts) == "undefined" ? "cschwabcharitableuat" : scatAccounts[waEnvId]), sc_server: "metric.schwab.com", sc_serversecure: "smetric.schwab.com", env_id: typeof (waEnvId) == "undefined" ? "DEV" : waEnvId, page_name: typeof (waPageName) == "undefined" ? "DEFAULT_PAGE_NAME" : waPageName, page_path: typeof (waUri) == "undefined" ? location.pathname : waUri, page_category: typeof (waCategoryName) == "undefined" ? "prospect" : waCategoryName, page_multi_level_category: typeof (waMultiLevelCategory) == "undefined" ? "" : waMultiLevelCategory, page_use_default_name: typeof (waUseDefaultPageName) == "undefined" ? false : waUseDefaultPageName, campaign_id: typeof (waCampaign) == "undefined" ? "" : waCampaign, entry_tracking: typeof (waEntryTracking) == "undefined" ? false : waEntryTracking, segment: typeof (waSegment) == "undefined" ? "" : waSegment, user_id: typeof (waUserId) == "undefined" ? "" : waUserId, page_disabled: typeof (waDisabled) == "undefined" ? false : waDisabled, application_name: typeof (waAppName) == "undefined" ? "" : waAppName, success_event_id: typeof (waSuccessEventId) == "undefined" ? "" : waSuccessEventId, application_id: typeof (waApplicationId) == "undefined" ? "" : waApplicationId, account_type : typeof (waAccountType) == "undefined" ? "" : waAccountType, lead_type: typeof (waLeadType) == "undefined" ? "" : waLeadType, transaction_id: typeof (waCeid) == "undefined" ? "" : waCeid, // NOTE: existing Cbid call for MISC tag was fetchBrowserId() // is that correct? correlated_browser_id: fetchBrowserId("A"), application_detail: typeof (waApplicationDetail1) == "undefined" ? "" : waApplicationDetail1, tool_name: typeof (waToolName) == "undefined" ? "" : waToolName, tool_success_action: typeof (waToolSuccessAction) == "undefined" ? "" : waToolSuccessAction, tool_error_desc: typeof (waToolErrorDescription) == "undefined" ? "" : waToolErrorDescription, custom_evar05: typeof (waCustEventVar5) == "undefined" ? "" : waCustEventVar5, custom_evar06: typeof (waCustEventVar6) == "undefined" ? "" : waCustEventVar6, custom_evar07: typeof (waCustEventVar7) == "undefined" ? "" : waCustEventVar7, custom_evar08: typeof (waCustEventVar8) == "undefined" ? "" : waCustEventVar8, custom_evar09: typeof (waCustEventVar9) == "undefined" ? "" : waCustEventVar9, custom_evar10: typeof (waCustEventVar10) == "undefined" ? "" : waCustEventVar10, custom_evar13: typeof (waCustEventVar13) == "undefined" ? "" : waCustEventVar13, custom_evar19: typeof (waCustEventVar19) == "undefined" ? "" : waCustEventVar19, custom_evar24: typeof (waCustEventVar24) == "undefined" ? "" : waCustEventVar24, custom_evar59: typeof (waCustEventVar59) == "undefined" ? "" : waCustEventVar59, custom_evar60: typeof (waCustEventVar60) == "undefined" ? "" : waCustEventVar60, custom_evar61: typeof (waCustEventVar61) == "undefined" ? "" : waCustEventVar61, custom_evar62: typeof (waCustEventVar62) == "undefined" ? "" : waCustEventVar62, custom_evar63: typeof (waCustEventVar63) == "undefined" ? "" : waCustEventVar63, custom_evar64: typeof (waCustEventVar64) == "undefined" ? "" : waCustEventVar64, custom_evar65: typeof (waCustEventVar65) == "undefined" ? "" : waCustEventVar65, custom_evar68: typeof (waCustEventVar68) == "undefined" ? "" : waCustEventVar68, custom_evar70: typeof (waCustEventVar70) == "undefined" ? "" : waCustEventVar70, dc_acct_type: typeof (waDcAcctType) == "undefined" ? "" : waDcAcctType, dc_src: typeof (waDcSrc) == "undefined" ? "" : waDcSrc, dc_type: typeof (waDcType) == "undefined" ? "" : waDcType, dc_cat: typeof (waDcCat) == "undefined" ? "" : waDcCat, dc_ceidg: typeof (waDcCeidG) == "undefined" ? "" : waDcCeidG, dc_browser_id: fetchBrowserId("G"), dc_tag_set: typeof (waDcTagSet) == "undefined" ? "" : waDcTagSet, site_subsection2: "", site_subsection3: "", search_keyword: typeof (waSearchParameter) == "undefined" ? "" : waSearchParameter, search_count: typeof (waSearchCount) == "undefined" ? "" : waSearchCount, taxonomy_author: typeof (document.getElementsByName("author")[0]) == "undefined" ? "" : document.getElementsByName("author")[0], taxonomy_business_line: typeof (document.getElementsByName("businessline")[0]) == "undefined" ? "" : document.getElementsByName("businessline")[0], taxonomy_detailed_subject: typeof (document.getElementsByName("subject-lvl2")[0]) == "undefined" ? "" : document.getElementsByName("subject-lvl2")[0], taxonomy_experience_level: typeof (document.getElementsByName("experiencelevel")[0]) == "undefined" ? "" : document.getElementsByName("experiencelevel")[0], taxonomy_format_type: typeof (document.getElementsByName("formattype")[0]) == "undefined" ? "" : document.getElementsByName("formattype")[0], taxonomy_general_subject: typeof (document.getElementsByName("subject-lvl1")[0]) == "undefined" ? "" : document.getElementsByName("subject-lvl1")[0], taxonomy_keyword_category: typeof (document.getElementsByName("category")[0]) == "undefined" ? "" : document.getElementsByName("category")[0], taxonomy_life_event: typeof (document.getElementsByName("lifeevent")[0]) == "undefined" ? "" : document.getElementsByName("lifeevent")[0], taxonomy_page_segment: typeof (document.getElementsByName("segment")[0]) == "undefined" ? "" : document.getElementsByName("segment")[0], sz_id: typeof (waSzId) == "undefined" ? "" : waSzId }; // Post-processing of the data (function () { if (utag_data.page_category != null && utag_data.page_category.length > 0 && utag_data.page_category.substring(0, 1) != "/") { utag_data.page_category = "/" + utag_data.page_category; } if (utag_data.page_use_default_name == true) { utag_data.page_name = typeof (utag_data.page_name) == "undefined" ? "" : utag_data.page_category + "/" + utag_data.page_name; } else { utag_data.page_name = typeof (utag_data.page_name) == "undefined" ? "" : utag_data.page_category + "/" + utag_data.page_path + "/" + utag_data.page_name; } utag_data.page_name = utag_data.page_name.replace(/\/\/+/gi, "/"); var mlc = utag_data.page_category + "/" + utag_data.page_path; mlc = mlc.replace(/\/\/+/gi, "/"); utag_data.page_multi_level_category = typeof (utag_data.page_multi_level_category) == "undefined" ? "No_MultiLevelCategory" : (utag_data.page_multi_level_category != "" ? utag_data.page_multi_level_category : mlc); utag_data.custom_evar19 = typeof (utag_data.custom_evar19) == "undefined" ? (typeof (tmp) == "undefined" || tmp == null ? "" : tmp[1]) : utag_data.custom_evar19; })();