(function() {
    var e, n, r, t, i, o, s, a, c, l, d, h, p, u, f;
    e = {
        "str-contents": "Contents",
        "str-terms": "Index",
        "str-search": "Search",
        "str-topic": "Topic",
        "str-searching": "Searching...",
        "str-loading": "loading",
        "str-previous": "Previous",
        "str-next": "Next",
        "str-home": "Home",
        "str-search-empty": "not found",
        "str-search-error": "search failed",
        "str-search-common-words": ""
    }, f = function() {
        var e;
        e = Array.prototype.slice.call(arguments), parent.frames[e.shift()].postMessage(e.join("[||]"), "*")
    }, h = function() {
        window.parent.postMessage(Array.prototype.slice.call(arguments).join("[||]"), "*")
    }, r = function(e) {
        window.addEventListener("message", function(n) {
            var r;
            r = (n.data || n).split("[||]"), e(r.shift(), r || null)
        })
    }, c = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream, t = document.documentElement, !c && parent !== self && window.addEventListener("scroll", function() {
        var e;
        e = (window.pageYOffset || t.scrollTop) - (t.clientTop || 0), parent.window.postMessage(["scroll", window.name, e.toString()].join("[||]"), "*"), e
    }), n = null, a = null, p = function(e) {
        var r, t;
        if ((r = n && $(n).children("a")[0]) && -1 !== r.href.indexOf(e) || (r = $("a[href='" + e + "']")[0]), r) return t = r.parentElement, u(r, t), d(t), $(r).parents(".group").add($(t).children(".group")).slideDown(100, function() {
            $(this).parent(".branch").removeClass("closed")
        }), l(r)
    }, o = function(e, n) {
        var r, t;
        if (r = void 0, t = null, e)
            if (r = $(e), "previous" === n)
                if (r.prev().length) {
                    for (r = r.prev(); r.hasClass("branch");) r = r.children(".group").children().last();
                    t = r.get(0)
                } else t = r.parent().closest(".entry")[0];
        else if (r.hasClass("branch")) t = r.children(".group").children()[0];
        else
            for (t = r.next()[0]; r.length && !t;) t = (r = r.parent()).closest(".entry").next()[0];
        return t
    }, s = function(e) {
        var r;
        if (r = o(n, e)) return d(r), h("loadTopic", $(r).children("a")[0].href)
    }, i = function() {
        return a || (a = $("div#toc > div.entry:first-child").children("a")[0]), a
    }, u = function(e, n) {
        var r, t, i, s, a;
        return r = [], $(e).parents("div.entry").children("a").each(function() {
            r.push(this.innerHTML, this.href)
        }), f("topicwin", "updateBreadCrumbs", r.join("[$$]")), a = i = null, s = o(n, "previous"), t = o(n, "next"), s && (a = $(s).children("a")[0].innerHTML), t && (i = $(t).children("a")[0].innerHTML), h("updateNav", a, i)
    }, d = function(e) {
        if (e !== n) return n && $(n).removeClass("active"), n = e, $(n).addClass("active")
    }, l = function(e) {
        var n, r, t, i;
        return n = (r = $(e).offset().top) + $(e)[0].scrollHeight, (t = (i = $(window).scrollTop()) > n - 20 ? -1 : i + $(window).height() < r + 20 ? 1 : 0) && e.scrollIntoView(1 !== t)
    }, r(function(e, r) {
        switch (e) {
            case "topicLoaded":
                p(r[0]);
                break;
            case "gotoSibling":
                s(r[0]);
                break;
            case "checkToc":
                f("topicwin", "tocLoaded");
                break;
            case "home":
                d(i().parentElement);
                h("loadTopic", i().href);
                break;
            case "selected":
                n && l(n)
        }
    }), self !== parent && (i(), d(a.parentElement), f("topicwin", "tocLoaded")), $("div.branch > span.icon").click(function() {
        return $(this).parent().toggleClass("closed").children(".group").slideToggle()
    }), $("div.entry > a").click(function() {
        return d(this.parentElement), h("loadTopic", this.href), !1
    })
}).call(this);
