var stn_Http = null, stn_CookieExpiryDays = 30;
stn_CheckIfDomainChanged = function() {
    if (stn_GetOpenerDomainName() != stn_OldDomainName) {
        try {
            stn_SetCookie("stn_popupAnswer", "taken")
        } catch (b) {
        }
        stn_PopOver()
    } else {
        setTimeout("stn_CheckIfDomainChanged();", 2500)
    }
};
stn_PopOver = function() {
    try {
        var b = !1, d = null, d = self;
        if (top != self) {
            try {
                top.document.location.toString() && (d = top)
            } catch (a) {
            }
        }
        (function() {
            if (b == !0) {
                return !0
            }
            var a = stn_GetQueryString("link") + "&History=" + escape(stn_GetCookie("stn_urlTracker")), c = d.window.open(a, "title", "toolbar=0,scrollbars=1,location=1,statusbar=1,menubar=0,resizable=1,width=" + screen.width + ",height=" + screen.height);
            if (c) {
                b = !0, c.focus(), navigator.userAgent.toLowerCase().indexOf("applewebkit") > -1 && (d.window.focus(), d.window.blur()), c.Init = function(a) {
                    with (a) {
                        Main = function() {
                            try {
                                window.open("about:blank").close()
                            } catch (a) {
                            }
                            try {
                                c.window.moveTo(0, 0), c.window.resizeTo(screen.width, screen.height), opener.window.blur(), c.focus()
                            } catch (g) {
                            }
                        }, Main()
                    }
                }, c.Init(c)
            }
            return c
        })()
    } catch (c) {
    }
};
stn_SetDocumentTitle = function(b) {
    document.title = b
};
stn_GetOpenerDomainName = function() {
    try {
        return window.opener.location.href.split("/")[2].split(":")[0]
    } catch (b) {
        return null
    }
};
stn_GetQueryString = function(b, d) {
    d == null && (d = "");
    var b = b.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]"), a = RegExp("[\\?&]" + b + "=([^&#]*)"), c = unescape(window.location.href.replace(/#/, "?")), c = c.replace("%3D", "="), c = c.replace("%26", "&"), a = a.exec(c);
    return a == null ? d : unescape(a[1])
};
stn_TrackURL = function() {
    var b = null;
    switch (stn_GetCookie("stn_popupAnswer")) {
        case "yes":
            b = stn_GetCookie("stn_urlTracker"), b == null ? stn_SetCookie("stn_urlTracker", window.location.href.replace("http://" + window.location.href.split("/")[2].split(":")[0] + "/", "").replace("https://" + window.location.href.split("/")[2].split(":")[0] + "/", "") + "|" + stn_GetTimeStamp()) : stn_SetCookie("stn_urlTracker", b + "|||" + window.location.href.replace("http://" + window.location.href.split("/")[2].split(":")[0] + "/", "").replace("https://" + window.location.href.split("/")[2].split(":")[0] +
      "/", "") + "|" + stn_GetTimeStamp())
    }
};
stn_SetCookie = function(b, d) {
    var a = new Date;
    a.setTime(a.getTime() + stn_CookieExpiryDays * 864E5);
    document.cookie = b + "=" + d + "; expires=" + a.toGMTString() + "; path=/"
};
stn_GetCookie = function(b) {
    b += "=";
    for (var d = document.cookie.split(";"), a = 0, c = d.length; a < c; a++) {
        for (var g = d[a]; g.charAt(0) == " "; ) {
            g = g.substring(1, g.length)
        }
        if (g.indexOf(b) == 0) {
            return g.substring(b.length, g.length)
        }
    }
    return null
};
stn_SendHttpResponse = function() {
    stn_Http.send(null)
};
stn_GetHTTPObject = function() {
    var b;
    if (!window.XMLHttpRequest) {
        window.XMLHttpRequest = function() {
            return new ActiveXObject("Microsoft.XMLHTTP")
        }
    }
    if (!b && typeof XMLHttpRequest != "undefined") {
        try {
            b = new XMLHttpRequest
        } catch (d) {
            b = !1
        }
    }
    return b
};
stn_GetTimeStamp = function() {
    var b = new Date, d = new Date, a = d.getDate(), c = d.getMonth() + 1, d = d.getFullYear();
    return c + "-" + a + "-" + d + " " + b.getHours() + ":" + b.getMinutes() + ":" + b.getSeconds()
};
window.stn_EmbeddedPopup = function(b) {
    this.options = { initialPopupPreventDisplay: null, initialPopupStartPos: null, initialPopupWidth: null, initialPopupHeight: null, initialPopupAnimate: null, initialPopupSpeed: null, initialPopupViewRate: null, initialPopupContentSectionOne: null, initialPopupContentSectionTwo: null, initialPopupContentSectionThree: null, initialPopupContentSectionFour: null, initialPopupContentSectionFive: null, surveyID: null, surveyBase: null, surveyPopupWaitWindowWidth: null, surveyPopupWaitWindowHeight: null, initialPopupYesButtonImage: null,
        initialPopupLaterButtonImage: null, initialPopupNoButtonImage: null, protocol: "http", initialPopupDelayInSeconds: null, embeddedData: {}
    };
    var b = b || {}, d;
    for (d in b) {
        this.options[d] = b[d], this.Initialize = function() {
            try {
                if (!this.options.surveyID) {
                    throw "Missing Survey ID";
                }
                if (!this.options.surveyBase) {
                    throw "Missing Survey Base";
                }
                if (!this.options.initialPopupDelayInSeconds) {
                    throw "Missing Random Delay Max Seconds";
                }
                if (this.options.surveyBase.indexOf("http") == -1) {
                    this.options.surveyBase = this.options.protocol + "://" + this.options.surveyBase
                }
                this.options.yesButton = this.options.surveyBase + "?SID=" + this.options.surveyID + "&Q_LOC=" + escape(window.location.href);
                for (var a in this.options.embeddedData) {
                    this.options.yesButton += "&" + a + "=" + this.options.embeddedData[a]
                }
                var c = this, g = stn_GetCookie("stn_popupTime");
                if (g == null || g.length == 0) {
                    var i = new Date, e = new Date(i);
                    e.setSeconds(i.getSeconds() + this.options.initialPopupDelayInSeconds);
                    stn_SetCookie("stn_popupTime", e)
                }
                window.setTimeout(function() {
                    c.ShouldShow()
                }, 500)
            } catch (b) {
                throw " Popup is configured incorrectly: " + b + ". Please contact your website administrator.";
            }
        }
    }
    this.ShouldShow = function() {
        if (this.options.initialPopupPreventDisplay == 0) {
            var a = stn_GetCookie("stn_popupAnswer"), c = !1;
            a != null ? a.length == 0 && a != "no" && a != "taken" && (c = !0) : c = !0;
            if (c == !0) {
                if (a = new Date(stn_GetCookie("stn_popupTime")), new Date > a) {
                    var g = this;
                    stn_Http = stn_GetHTTPObject();
                    this.Popup()
                } else {
                    g = this, window.setTimeout(function() {
                        g.ShouldShow()
                    }, 500)
                }
            }
        }
    };
    this.Popup = function() {
        var a = this, c = this.GetWindowSize(), g = c[0], b = c[1], e = this.options.initialPopupWidth, d = this.options.initialPopupHeight;
        e > g && (e = g);
        d > b && (d = b);
        var c = this.IsIE6() ? "absolute" : "fixed", k = e * 0.091837, l = d * 0.115384, m = this.GetScrollOffsets(), o = g / 2 - e / 2, p = b / 2 - d / 2, j = Math.max(Math.max(document.body.scrollHeight, document.documentElement.scrollHeight), Math.max(document.body.offsetHeight, document.documentElement.offsetHeight), Math.max(document.body.clientHeight, document.documentElement.clientHeight)), f = document.createElement("div");
        f.id = "stnDimmer";
        this.SetStyle(f, { textAlign: "left", opacity: 0.7, filter: "alpha(opacity=70)", zIndex: 1, width: window.screen.width + "px", height: j + "px", background: "black", position: "absolute", top: "0px", left: "0px" });
        document.body.appendChild(f);
        j = document.createElement("div");
        this.SetStyle(j, { padding: "10px 10px", zIndex: "20002" });
        f = document.createElement("div");
        f.innerHTML = this.options.initialPopupContentSectionOne + "<br /><br />";
        this.SetStyle(f, { textAlign: "center", zIndex: 200003 });
        j.appendChild(f);
        f = document.createElement("div");
        f.innerHTML = this.options.initialPopupContentSectionTwo + "<br /><br />";
        this.SetStyle(f, { textAlign: "left", zIndex: 200003 });
        j.appendChild(f);
        f = document.createElement("div");
        f.innerHTML = this.options.initialPopupContentSectionThree + "<br /><br />";
        this.SetStyle(f, { textAlign: "left", zIndex: 200003 });
        j.appendChild(f);
        f = document.createElement("div");
        f.innerHTML = this.options.initialPopupContentSectionFour + "<br /><br />";
        this.SetStyle(f, { textAlign: "left", zIndex: 200003 });
        j.appendChild(f);
        f = document.createElement("div");
        f.innerHTML = this.options.initialPopupContentSectionFive + "<br /><br />";
        this.SetStyle(f, { textAlign: "left", zIndex: 200003 });
        j.appendChild(f);
        f = document.createElement("div");
        if (this.options.initialPopupYesButtonImage != null && this.options.initialPopupYesButtonImage.length > 0) {
            var h = document.createElement("a");
            h.innerHTML = this.options.initialPopupYesButtonImage;
            h.onclick = function() {
                a.SurveyPopupNow(a.options.yesButton)
            };
            this.SetStyle(h, { padding: "20px", zIndex: 200003 });
            f.appendChild(h)
        }
        if (this.options.initialPopupLaterButtonImage != null && this.options.initialPopupLaterButtonImage.length > 0) {
            h = document.createElement("a"), h.innerHTML = this.options.initialPopupLaterButtonImage, h.onclick = function() {
                a.SurveyPopupLater(a.options.yesButton)
            }, this.SetStyle(h, { padding: "20px", zIndex: 200003 }), f.appendChild(h)
        }
        if (this.options.initialPopupNoButtonImage != null && this.options.initialPopupNoButtonImage.length > 0) {
            h = document.createElement("a"), h.innerHTML = this.options.initialPopupNoButtonImage, h.onclick = function() {
                a.SurveyPopupNo()
            }, this.SetStyle(h, { padding: "20px", zIndex: 200003 }), f.appendChild(h)
        }
        h = document.createElement("div");
        h.appendChild(j);
        h.appendChild(f);
        this.SetStyle(h, { position: "absolute", textAlign: "center", fontFamily: "Arial", fontSize: "10pt", zIndex: "20001" });
        this.PopupFrame = j = document.createElement("div");
        j.appendChild(h);
        this.SetStyle(j, { position: c, zIndex: 2E4, width: e + "px", height: d + "px" });
        this.SetStyle(j, { width: e + "px", height: d + "px" });
        h.style.top = l + "px";
        h.style.left = k + "px";
        h.style.width = e - 2 * k - 40 + "px";
        h.style.height = d - 2 * l - 40 + "px";
        h.style.margin = "20px";
        h.style.background = "white";
        this.IsIE6() && (k = this.BuildIframeCover(e, d, k, l), j.appendChild(k));
        if (this.options.initialPopupAnimate) {
            start = this.options.initialPopupStartPos;
            switch (start) {
                default:
                    ;
                case "ML":
                    g = -e;
                    b = b / 2 - d / 2;
                    break;
                case "TL":
                    g = -e;
                    b = -d;
                    break;
                case "BL":
                    g = -e;
                    break;
                case "TC":
                    g = g / 2 - e / 2;
                    b = -d;
                    break;
                case "TR":
                    b = -d;
                    break;
                case "MR":
                    b = b / 2 - d / 2;
                    break;
                case "BR":
                    break;
                case "BC":
                    g = g / 2 - e / 2
            }
            g += c == "fixed" ? 0 : m[0];
            b += c == "fixed" ? 0 : m[1];
            this.InitialPopupAnimatePopup(this.options.initialPopupSpeed, { x: g, y: b }, { x: o, y: p })
        } else {
            j.style.zoom = 1, j.style.left = o + "px", j.style.top = p + "px", document.body.appendChild(j)
        }
    };
    this.SetStyle = function(a, c) {
        for (var b in c) {
            a.style[b] = c[b]
        }
    };
    this.Close = function() {
        this.PopupFrame.parentNode && this.PopupFrame.parentNode.removeChild(this.PopupFrame);
        document.getElementById("stnDimmer").style.visibility = "hidden"
    };
    this.GetWindowSize = function() {
        var a = 0, c = 0;
        if (typeof window.innerWidth == "number") {
            a = window.innerWidth, c = window.innerHeight
        } else {
            if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
                a = document.documentElement.clientWidth, c = document.documentElement.clientHeight
            } else {
                if (document.body && (document.body.clientWidth || document.body.clientHeight)) {
                    a = document.body.clientWidth, c = document.body.clientHeight
                }
            }
        }
        return [a, c]
    };
    this.GetScrollOffsets = function() {
        var a = 0, c = 0;
        if (typeof window.pageYOffset == "number") {
            c = window.pageYOffset, a = window.pageXOffset
        } else {
            if (document.body && (document.body.scrollLeft || document.body.scrollTop)) {
                c = document.body.scrollTop, a = document.body.scrollLeft
            } else {
                if (document.documentElement && (document.documentElement.scrollLeft || document.documentElement.scrollTop)) {
                    c = document.documentElement.scrollTop, a = document.documentElement.scrollLeft
                }
            }
        }
        return [a, c]
    };
    this.InitialPopupAnimatePopup = function(a, c, b) {
        this.PopupFrame.style.left = c.x + "px";
        this.PopupFrame.style.top = c.y + "px";
        document.body.appendChild(this.PopupFrame);
        this.PopupFrame.style.zoom = 1;
        this.Slide(new Date, a, b, 1E3 / 30)
    };
    this.Slide = function(a, c, b, d) {
        var e = this.PopupFrame, n = new Date - a, k = c - n, n = this.Inquad(n / c), l = e.style.left, m = e.style.top, l = l.substring(0, l.indexOf("p")), m = m.substring(0, m.indexOf("p")), o = (m - b.y) * n;
        e.style.left = l - (l - b.x) * n + "px";
        e.style.top = m - o + "px";
        if (k > 0) {
            var p = this;
            setTimeout(function() {
                p.Slide(a, c, b, d)
            }, d)
        } else {
            e.style.left = b.x, e.style.top = b.y, e.style.zIndex = 5E4
        }
    };
    this.Inquad = function(a) {
        return a * a
    };
    this.SurveyPopupNo = function() {
        stn_SetCookie("stn_popupAnswer", "no");
        try {
            this.Close()
        } catch (a) {
            this.Close()
        }
    };
    this.SurveyPopupNow = function(a) {
        stn_SetCookie("stn_popupAnswer", "taken");
        a = a + "&History=" + stn_GetCookie("stn_urlTracker");
        window.open(a);
        try {
            this.Close()
        } catch (c) {
            this.Close()
        }
    };
    this.SurveyPopupLater = function(a) {
        stn_SetCookie("stn_popupAnswer", "yes");
        this.PopUnder("http://www.second-to-none.com/stn_survey_popup/stnSurveyFrame.htm?link=" + escape(a), this.options.surveyPopupWaitWindowWidth, this.options.surveyPopupWaitWindowHeight);
        try {
            this.Close()
        } catch (c) {
            this.Close()
        }
    };
    this.BuildIframeCover = function(a, c, b, d) {
        var e = document.createElement("iframe");
        e.style.border = "none";
        e.width = a + "px";
        e.height = c + "px";
        e.style.position = "absolute";
        e.style.top = b + "px";
        e.style.left = d + "px";
        e.frameBorder = "0";
        e.style.filter = "progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)";
        return e
    };
    this.IsIE6 = function() {
        var a = navigator.appVersion.split("MSIE"), a = parseFloat(a[1]);
        return a >= 5.5 && a < 7 && document.body.filters
    };
    this.FixPNG = function(a, b, d) {
        if (this.IsIE6()) {
            var i = document.createElement("span");
            i.id = a.id;
            i.className = a.className;
            i.title = a.title;
            i.style.cssText = a.style.cssText;
            i.style.fontSize = 0;
            i.onclick = a.onclick;
            i.style.setAttribute("filter", "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + a.src + "', sizingMethod='scale')");
            setTimeout(function() {
                i.style.width = (b || a.width) + "px";
                i.style.height = (d || a.height) + "px";
                i.style.display = "inline-block";
                i.style.setAttribute("filter", "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + a.src + "', sizingMethod='scale')")
            }, 100);
            return i
        } else {
            return a
        }
    };
    this.EraseCookie = function(a) {
        stn_SetCookie(a, "", -1)
    };
    this.PopUnder = function(a, b, d) {
        var i = !1, e = null, e = self;
        if (top != self) {
            try {
                top.document.location.toString() && (e = top)
            } catch (n) {
            }
        }
        (function() {
            if (i == !0) {
                return !0
            }
            var k = e.window.open(a, "title", "toolbar=0,scrollbars=1,location=1,statusbar=1,menubar=0,resizable=1,width=" + b + ",height=" + d);
            if (k) {
                i = !0, k.blur(), navigator.userAgent.toLowerCase().indexOf("applewebkit") > -1 && (e.window.blur(), e.window.focus()), k.Init = function(a) {
                    with (a) {
                        Main = function() {
                            if (typeof window.mozPaintCount != "undefined") {
                                try {
                                    window.open("about:blank").close()
                                } catch (a) {
                                }
                            }
                            try {
                                opener.window.focus()
                            } catch (b) {
                            }
                        }, Main()
                    }
                }, k.Init(k)
            }
            return k
        })()
    };
    this.Initialize()
};
if (window.location.href.indexOf("stnSurveyFrame.htm") != -1) {
    var stn_OldDomainName = "";
    stn_SetDocumentTitle("Second To None Website Feedback Survey");
    stn_OldDomainName = stn_GetOpenerDomainName();
    stn_CheckIfDomainChanged()
} else {
    stn_TrackURL();
    var stn_WithinViewRate = stn_GetCookie("stn_popupViewRate");
    stn_WithinViewRate == null && (stn_WithinViewRate = Math.random() < 1, stn_SetCookie("stn_popupViewRate", stn_WithinViewRate));
    if (stn_WithinViewRate == !0 || stn_WithinViewRate == "true") {
        var q_popup_f = function() {
            setTimeout(function() {
                new stn_EmbeddedPopup({ initialPopupPreventDisplay: 1, initialPopupStartPos: "MT", initialPopupWidth: 660, initialPopupHeight: 550, initialPopupAnimate: !0, initialPopupSpeed: 3E3, initialPopupViewRate: 100, initialPopupDelayInSeconds: 30, initialPopupContentSectionOne: "<img src='http://www.second-to-none.com/stn_survey_popup/assets/logo.jpg'>", initialPopupContentSectionTwo: "<b>We'd appreciate your feedback!</b>", initialPopupContentSectionThree: "Thanks for visiting the Second To None website. You have been randomly selected to participate in a very brief survey about your experience with our website. Your feedback will help us to determine how we can improve our website to serve you better in the future.",
                    initialPopupContentSectionFour: "You can continue to browse our website as you normally would and for as long as you'd like.  If you agree to participate, the survey will simply appear once you exit our website.", initialPopupContentSectionFive: "<b>Would you like to give us your feedback?</b>", initialPopupYesButtonImage: "", initialPopupLaterButtonImage: "<img src='http://www.second-to-none.com/stn_survey_popup/assets/btn_yes.jpg' border='0' />", initialPopupNoButtonImage: "<img src='http://www.second-to-none.com/stn_survey_popup/assets/btn_no.jpg' border='0' />",
                    surveyID: "SV_a5eAilenUK74OoI", surveyBase: "https://secondtonone.qualtrics.com/WRQualtricsSurveyEngine/", surveyPopupWaitWindowWidth: 505, surveyPopupWaitWindowHeight: 320
                })
            }, 500)
        };
        window.addEventListener ? window.addEventListener("load", q_popup_f, !1) : window.attachEvent && (r = window.attachEvent("onload", q_popup_f))
    }
}
;
