﻿var WRWarn = "Copyright 2006-2011 ClickTale Ltd., US Patent and US Patent Pending", WRA, WRD = document, WRAS = location, WRA4 = false, WRA5, WRv, WRL, WRE = ".clicktale.net/", WRAP = "http://s.clicktale.net/", WRn, WRBh, WRB = [], WRw, ClickTaleCookieDomain, ClickTaleUnloadPause = 200, ClickTaleEventsMask = 255 - 128, ClickTaleFetchFrom, ClickTaleCookieExpiryDays = 365, ClickTaleUIDCookieName = "WRUID", ClickTaleIgnoreCookieName = "WRIgnore", WRBe, WRAf, WRAT, WRAU, WRAV, WRAW, WRBi = !(!(window.WRW)); (function (a) { if (a.search(/www\.\w+\.\w+/i) == 0) { ClickTaleCookieDomain = a.substring(4, a.length) } })(WRD.domain); WRA6(); if (WRA4) { WRA7("note1: entering debug mode, ClickTale script is installed") } if (typeof WRInitTime == "undefined") { var WRInitTime = (new Date()).getTime(); if (WRA4) { WRA7("warning1: top ClickTale script is missing in the page") } } if (!WRBh) { WRBh = WRBj() } if (!WRn) { WRn = WRBh.a } WRw = (WRD.compatMode == "BackCompat"); WRv = (WRw ? WRD.body : WRD.documentElement); WRo(window, "load", WRf); if (!window.ClickTaleIncludedOnDOMReady) { if (WRD.addEventListener) { WRD.addEventListener("DOMContentLoaded", WRondomload, false) } else { if (WRBh && WRBh.t == WRBh.IE) { WRD.write('<script id="ClickTaleDefer" defer="defer" src=//:><\/script>'); (function (a) { if (a) { a.onreadystatechange = function () { if (this.readyState == "complete") { WRondomload() } } } })(WRD.getElementById("ClickTaleDefer")) } } } else { WRondomload() } function ClickTale(d, e, a) { if (WRAf) { if (WRA4) { WRA7("error3: Monitoring has already started") } throw "CT: Monitoring has already started" } if (ClickTaleIsPlayback()) { return } if (e == undefined) { e = 1 } if (WRA4) { WRA7("note2: preparing to record (ver " + 12 + "." + 5 + ") for project id " + d); if (e == 1) { WRA7("note3: recording all visitors to this page") } else { WRA7("note3: recording approximately 1 of every " + Math.ceil(1 / e) + " visitors to this page") } } if (!WRn) { if (WRA4) { WRA7("warning2: the current browser is not supported") } return } if (WRAS.protocol == "file:") { if (WRA4) { WRA7("warning3: the current protocol is not supported") } return } if (WRl(ClickTaleIgnoreCookieName)) { if (WRA4) { WRA7("warning6: the current machine/user is temporarily disabled for recording") } return } WRL = WRl(ClickTaleUIDCookieName); var c = false; if (WRL == null) { c = true; if (Math.random() < e) { WRL = WRAg() } else { WRL = 0 } } WRk(ClickTaleUIDCookieName, WRL, ClickTaleCookieExpiryDays); if (WRL == 0 || (WRl(ClickTaleUIDCookieName) == null && e != 1)) { if (WRA4) { WRA7("warning4: the current machine/user is disabled for recording") } return } if (!a) { a = "www" } WRE = "http://" + a + WRE; if (typeof ClickTaleSSL != "undefined") { if ((ClickTaleSSL == 1 && WRAS.protocol == "https:") || ClickTaleSSL == 2) { WRAP = WRE = WRE.replace(/^http/, "https") } } if (typeof ClickTaleScriptSource != "undefined") { if (typeof ClickTaleScriptSource == "string") { WRAP = ClickTaleScriptSource } else { WRAP = WRE } } WRAf = true; WRC({ a: "start", t: WRI() }); WRA = d; var b = new Image(); b.src = WRE + "i/" + WRA + ".gif?r=" + e + "&UID=" + WRL + (c ? "&new" : "") + (WRBe ? "&as=1" : "") + "&" + WRH(); b.onerror = function () { b.onload = null; b.onerror = null; WRA8() }; b.onload = function () { b.onload = null; b.onerror = null; WRG(b) } } function ClickTaleIsPlayback() { try { return parent && parent != window && parent.WebPlayer } catch (a) { } return false } function WRG(b) { if (WRBi) { WRW() } else { var c = WRD.createElement("script"); c.src = WRAP + "WRc5b.js"; var a = WRD.getElementById("ClickTaleDiv"); if (!a) { a = WRD.getElementById("ClickTale") } if (a) { if (WRA4) { WRA7("note4: preparing for stage 2") } a.appendChild(c) } else { if (WRA4) { WRA7("error1: no 'ClickTale' DIV element found in this page") } } } } function WRA8() { if (WRA4) { WRA7('error2: unable to record because either there are no credits for project, the domain is not checked in the account\'s "Manage Domains" section or communication is down') } WRk(ClickTaleIgnoreCookieName, true, ClickTaleCookieExpiryDays ? 0.007 : false) } function WRH() { return Math.floor(Math.random() * 2147483647) } function WRAg() { return WRH() + "." + (WRInitTime & 2147483647) } function WRI() { return (new Date()).getTime() - WRInitTime } function WRC(a) { if (typeof WRSID == "number") { WRc(a) } else { if (WRB.push) { WRB.push(a) } } } function WRf() { WRC({ a: "load", w: WRs(), h: WRt(), sw: WRv.scrollWidth, sh: WRv.scrollHeight, cw: WRv.clientWidth, ch: WRv.clientHeight, t: WRI() }) } function WRs() { return self.innerWidth || WRv.offsetWidth } function WRt() { return self.innerHeight || WRv.offsetHeight } function WRk(c, d, e) { if (e) { var b = new Date(); b.setTime(b.getTime() + (e * 86400000)); var a = "; expires=" + b.toGMTString() } else { var a = "" } WRD.cookie = c + "=" + d + a + "; path=/;" + (ClickTaleCookieDomain ? " domain=" + ClickTaleCookieDomain + ";" : "") } function WRl(b) { var e = b + "="; var a = WRD.cookie.split(";"); for (var d = 0; d < a.length; d++) { var f = a[d]; while (f.charAt(0) == " ") { f = f.substring(1, f.length) } if (f.indexOf(e) == 0) { return f.substring(e.length, f.length) } } return null } function ClickTaleGetSID() { return typeof WRSID == "number" ? WRSID : null } function ClickTaleGetUID() { var a = WRl(ClickTaleUIDCookieName); return a > 0 ? a : null } function ClickTaleSetUID(a) { if (a > 0 || a === 0 || a === "0") { WRk(ClickTaleUIDCookieName, a, ClickTaleCookieExpiryDays) } else { WRk(ClickTaleUIDCookieName, null, -1) } } function ClickTaleGetPID() { return typeof WRA == "number" ? WRA : null } function ClickTaleTag(a) { WRC({ a: "tag", c: a, t: WRI() }) } var ClickTaleEvent = ClickTaleTag; function ClickTaleNote(a) { WRC({ a: "note", c: a, t: WRI() }) } function ClickTaleField(b, a) { WRC({ a: "field", f: b, v: a, t: WRI() }) } function ClickTaleExec(a) { WRC({ a: "exec", c: a, t: WRI() }) } function ClickTaleIgnore(a) { WRk(ClickTaleUIDCookieName, 0, a) } function ClickTaleUploadPage(a, b) { if (WRAf) { throw "CTUP: Monitoring has already started" } WRAT = true; WRAV = a; WRAW = b; if (WRAU && typeof WRAh == "function") { WRAh() } } function ClickTaleSetAllSensitive() { WRBe = true } function ClickTaleGetVersion() { return [12, 5] } function WRondomload() { if (ClickTaleIsPlayback() || WRAU) { return } var b = WRD.getElementById("ClickTaleDefer"); if (b) { b.parentNode.removeChild(b) } var a = new RegExp('(<div id="?ClickTaleDiv"?[^>]+>)\\s*<script[^>]+><\/script>\\s*(</div>)', "i"); WRAU = WRD.documentElement.innerHTML.replace(a, "$1$2"); WRC({ a: "domload", t: WRI() }); if (typeof WRAX == "function") { WRAX() } if (WRAT && typeof WRAh == "function") { WRAh() } } function WRA6() { if (ClickTaleIsPlayback()) { return } WRA9(WRAS.hash.substr(1)); WRA9(WRAS.search.substr(1)) } function WRA9(d) { var c = d.split("&"); for (var b = 0; b < c.length; b++) { var e = c[b].split("="); var a = decodeURIComponent(e[0]).toLowerCase(); if (e.length == 2 && (a == "ct" || a == "clicktale")) { WRBA(e[1]) } } } function WRBA(d) { var c = d.split(","); for (var b = 0; b < c.length; b++) { switch (c[b].toLowerCase()) { case "debug": WRD.write('<textarea id="ClickTaleDebugDump" rows="5" cols="80" style="position: absolute; left:10px; top:10px; border: solid #6C358D;"></textarea>'); WRA5 = WRD.getElementById("ClickTaleDebugDump"); if (WRA5) { WRA5.value = "" } WRA4 = true; break; case "enable": WRk(ClickTaleIgnoreCookieName, null, -1); var a = WRl(ClickTaleUIDCookieName); if (a == null || a == 0) { WRk(ClickTaleUIDCookieName, WRAg(), ClickTaleCookieExpiryDays) } break; case "disable": WRk(ClickTaleUIDCookieName, 0, ClickTaleCookieExpiryDays); break; case "reset": WRk(ClickTaleUIDCookieName, null, -1); break; case "uaskipcheck": WRBh = WRBj(true); WRA7("warning8: skipping userAgent support check, running as: " + WRBh.a); break; default: ts = c[b].match(/^(\w+)(\(|%28)(.+)(\)|%29)$/i); if (ts && ts.length == 5) { var a = decodeURIComponent(ts[3]), e = ts[1]; switch (e.toLowerCase()) { case "t": ClickTaleTag(a); break; case "u": ClickTaleSetUID(a); break; case "ua": WRn = decodeURIComponent(a); WRA7("warning7: forcing userAgent type: " + WRn); break; case "uao": WRBh = JSON.parse(a); WRA7("warning7: forcing userAgentObj type: " + a); break; default: WRA7("warning5: unknown parameter in URL: " + e); break } } break } } } function WRA7(a) { if (WRA5) { WRA5.value += (a + "\n") } else { if (console && console.log) { console.log("CT: " + a) } else { alert("CT: " + a) } } } function WRBj(a) { var b = WRBr(); if (!a) { if (window.ClickTaleSettings && ClickTaleSettings.CheckAgentSupport) { b = ClickTaleSettings.CheckAgentSupport(WRBs, b) } else { b = WRBs(b) } } return b } function WRBr() { var b = navigator.userAgent; var c = { IE: 0, FF: 1, Ch: 2, Sa: 3, Op: 4 }; if (b.indexOf("Opera ") != -1) { c.t = c.Op; c.v = 0; c.a = "Op"; return c } var a = b.indexOf("MSIE "); if (a != -1) { c.t = c.IE; c.v = parseFloat(b.substr(a + 5, 3)); c.a = "IE" + c.v; if (c.v >= 8) { c.XDR = true } return c } a = b.indexOf("Firefox/"); if (a != -1) { c.t = c.FF; c.v = parseFloat(b.substr(a + 8, 3)); c.a = "FF" + (c.v * 10); if (c.v >= 3.5) { c.XDR = true } return c } a = b.indexOf("Chrome/"); if (a != -1) { c.t = c.Ch; c.v = parseFloat(b.substr(a + 7, 3)); c.a = "Ch" + c.v; if (c.v >= 9) { c.XDR = true } return c } a = b.indexOf("Safari/"); if (a != -1) { a = b.indexOf("Version/"); if (a != -1) { c.t = c.Sa; c.v = parseFloat(b.substr(a + 8, 3)); c.a = "Sa" + c.v; if (c.v >= 5) { c.XDR = true } return c } } return false } function WRBs(a) { if (!a) { return false } if ((a.t == a.IE && a.v >= 6 && a.v <= 9) || (a.t == a.FF && a.v >= 1.5 && a.v <= 5) || (a.t == a.Ch && a.v >= 9 && a.v <= 15)) { return a } return false } function WRo(c, a, b) { if (c.addEventListener) { c.addEventListener(a, b, false) } else { if (c.attachEvent) { c.attachEvent("on" + a, b) } } } var ClickTaleFetchFromWithCookies = (function () { var b = [], e, h, d, a, g, c; a = function (n, m) { m = m || b; for (var k = 0, j = b.length; k < j; k++) { if (n.call(m, b[k], k)) { return true } } return false }; e = function (i) { return a(function (k, j) { return k.k == i }) }; h = function (i) { var j = null; a(function (l, k) { if (l.k == i) { j = l; return true } return false }); return j }; c = function (i, j) { var k = h(i); if (k) { k.v = j } else { b.push({ k: i, v: j }) } }; g = function (k) { var j = arguments.callee; if (!j.sRE) { var i = ["/", ".", "*", "+", "?", "|", "(", ")", "[", "]", "{", "}", "\\"]; j.sRE = new RegExp("(\\" + i.join("|\\") + ")", "g") } return k.replace(j.sRE, "\\$1") }; d = function (i) { if (i instanceof String || i instanceof Boolean || i instanceof Number) { i = i.valueOf() } else { if (i === null) { return "null" } } switch (typeof i) { case "number": i = isFinite(i) ? String(i) : "null"; break; case "boolean": i = String(i); break; case "object": if (typeof i.toString == "function") { i = i.toString() } else { i = "[Object]" } break } return i }; var f = { _URL_PARAM_NAME: "CTFetchCookies", cookieNameDecoder: decodeURIComponent, cookieValueDecoder: function (i) { return i }, clear: function () { b = [] }, set: function (j, i) { if (i === null || typeof i == "undefined") { f.setFromCookie(j); return } i = d(i); c(j, i) }, setFromCookie: function (j) { var q, p, k, n, o = document.cookie.split(/;\s/g), m; if (typeof j == "string") { q = function (i) { return i == j } } else { if (typeof j.test == "function") { q = function (i) { return j.test(i) } } else { q = function () { return false } } } for (m = 0; m < o.length; m++) { k = o[m].match(/([^=]+)=/i); if (k instanceof Array) { try { p = f.cookieNameDecoder(k[1]); n = f.cookieValueDecoder(o[m].substring(k[1].length + 1)) } catch (l) { } } else { p = f.cookieNameDecoder(o[m]); n = p } if (q(p)) { c(p, n) } } }, constructCookiesParam: function () { var i = []; a(function (k, j) { i.push(k.k); i.push("="); i.push(k.v); i.push(";"); return false }); return f._URL_PARAM_NAME + "=" + encodeURIComponent(i.join("")) }, constructCookiesHash: function () { return "#" + f.constructCookiesParam() }, constructFetchFromUrl: function (i) { i = i || window.location.href; if (!(i.indexOf("#") >= 0)) { i += "#" } else { i += "&" } i += f.constructCookiesParam(); return i } }; return f })(); (function (l) { if (!l.XMLHttpRequest) { return } if (!l.JSON || !JSON.stringify) { return } if (typeof (l.XMLHttpRequest.ClickTaleWrapperVersion) == "number") { return } if (typeof l.ClickTaleSettings != "object") { l.ClickTaleSettings = {} } if (typeof l.ClickTaleSettings.XHRWrapper != "object") { l.ClickTaleSettings.XHRWrapper = {} } var P = l.ClickTaleSettings.XHRWrapper; var i = "Enable"; var E = "MaxResponseSize"; var p = "RequestFilter"; var u = "ResponseFilter"; if (typeof P[i] != "boolean") { P[i] = false } if (typeof P[E] != "number") { P[E] = 50000 } if (typeof P[p] != "function") { P[p] = function (V, U) { return true } } if (typeof P[u] != "function") { P[u] = function (U) { } } if (!P[i]) { return } var T = 0, K = l.XMLHttpRequest; var z = "x", q = "id", v = "sk", r = "ps"; var d = { GET: 1, HEAD: 2, POST: 3, OPTIONS: 4, PUT: 5, DELETE: 6 }; var g = 1; var R = "v", J = "h", L = "c"; var w = "onreadystatechange", A = "readyState", H = "open", c = "setRequestHeader", O = "send", I = "abort", m = "status", n = "statusText", x = "getResponseHeader", f = "getAllResponseHeaders", o = "responseText", h = "responseXML"; function C(U) { return Array.prototype.slice.call(U, 0) } var F, Q, j; var t = []; function B(V, U) { if (Q) { return false } if (t.push) { t.push([V, C(U)]) } return true } function y() { t = t.reverse(); while (t.length > 0) { var U = t.pop(); U[0].apply(l, U[1]) } } function e(V, U, W) { if (B(e, arguments)) { return } W = d[W]; F({ a: "xhropen", xhrid: V, u: U, methodid: W, t: Q() }) } function S(V, U) { if (B(S, arguments)) { return } F({ a: "xhrstate", xhrid: V, stateid: U, t: Q() }) } function D(aa, U, Z, ab, V) { if (B(D, arguments)) { return } var Y = {}; Y[R] = g; Y[J] = ab; Y[L] = V; var X = JSON.stringify(Y); var W = j(X); F({ a: "xhrstatedone", xhrid: aa, status: U, statusText: Z, streamid: W, t: Q() }) } function b(W, X, U) { try { return W[X] } catch (V) { return U } } function G(aa, W) { var V = b(W, A, 0), U = b(W, m, 0), Y = b(W, n, ""), X = b(W, o, ""), Z = b(W, h, ""); aa[A] = V; aa[m] = U; aa[n] = Y; aa[o] = X; aa[h] = Z } function a(V, U) { return function (Y, X, ac, ab, Z) { var W = this[z]; if (U) { U.apply(this, arguments) } var aa; if (V == "open") { aa = W.open(Y, X, ac, ab, Z) } else { if (V == "send") { aa = W.send(Y, X, ac, ab, Z) } else { aa = W[V].apply(W, arguments) } } G(this, W); return aa } } function M(U, ae) { var Y = U[q], ab = U[z], ag = U[r], ai = U[v], Z, X, ad, ah, af; af = b(ab, A, 0); Z = b(ab, m, 0); X = b(ab, n, ""); ad = b(ab, o, ""); ah = b(ab, h, ""); if (!ai && ag != af) { if (af > 0 && af < 4) { S(Y, af) } else { if (af == 4) { var ac, aa, W = []; if (!!U.headersToRecord && typeof U.headersToRecord.length == "number") { aa = U.headersToRecord.length; while (aa-- > 0) { ac = U.headersToRecord[aa]; W.push(ac + ":" + ab[x].call(ab, ac)) } } else { W = ab[f].call(ab).split("\n") } var V = { status: Z, statusText: X, headers: W, responseText: ad }; if (P[u]) { P[u](V) } if (V.responseText && V.responseText.length > P[E]) { V.responseText = ""; V.statusText = "responseText is larger than MaxResponseSize" } D(Y, V.status, V.statusText, V.headers, V.responseText) } } } U[A] = af; U[m] = Z; U[n] = X; U[o] = ad; U[h] = ah; U[r] = af; if (typeof U[w] != "function") { return } return U[w].apply(U, ae) } function s(U) { return function () { return M.call(this, U, C(arguments)) } } function N() { var V = this, U = new K(); V[z] = U; V[q] = T++; U[w] = s(V) } var k = {}; k[I] = a(I); k[f] = a(f); k[x] = a(x); k[c] = a(c); k[O] = a(O); k[H] = a(H, function (V, U) { if (P[p] && P[p](V, U) == false) { this[v] = true } else { e(this[q], U, V.toUpperCase()) } }); N.prototype = k; N.OriginalXMLHttpRequest = K; N.ClickTaleWrapperVersion = g; N.RegisterRecorderFunction = function (V, U, W) { F = V; Q = U; j = W; y() }; l.XMLHttpRequest = N })(window); if (typeof ClickTaleOnReady == "function") { ClickTaleOnReady() };
function ClickTaleIsIn(testFor) {
    var topLocation = top.location;

    if (testFor == "recording" && window.location == topLocation) {
        return true;
    } else if (testFor == "recording" || window.location == topLocation) {
        return false;
    }

    switch (testFor.toLowerCase()) {
        case "report":
            var fn = arguments.callee;
            return fn("scroll-heatmap") || fn("click-heatmap") || fn("form-analytics");
        case "reports":
            var fn = arguments.callee;
            return fn("scroll-heatmap") || fn("click-heatmap") || fn("form-analytics");
        case "scroll-heatmap":
            var regex = new RegExp("Heatmap.aspx\?", "i");
            return regex.test(topLocation);
        case "click-heatmap":
            var regex = new RegExp("ClickHeatMap.aspx\?", "i");
            return regex.test(topLocation);
        case "form-analytics":
            var regex = new RegExp("FormAnalytics.aspx\?", "i");
            return regex.test(topLocation);
        case "playback":
            var regex = new RegExp("Player.aspx\?", "i");
            return regex.test(topLocation);
    }
}
