﻿(function (b) {
    b.fn.expandAll = function (e) {
        var a = b.extend({}, b.fn.expandAll.defaults, e); return this.each(function () {
            function d(a) { for (var c = 0, e = arguments.length; c < e; c++) { var d = arguments[c], f = b(d); if (0 < f.scrollTop()) return d; f.scrollTop(1); var g = 0 < f.scrollTop(); f.scrollTop(0); if (g) return d;
                            } return [];
            } var c = b(this), e, g, i, f, j, k; "before" == a.switchPosition ? (b.fn.findSibling = b.fn.prev, b.fn.insrt = b.fn.before) : (b.fn.findSibling = b.fn.next, b.fn.insrt = b.fn.after); f = this.id.length ? "#" + this.id : this.className.length ?
this.tagName.toLowerCase() + "." + this.className.split(" ").join(".") : this.tagName.toLowerCase(); if (a.ref && c.find(a.ref).length) if ("before" == a.switchPosition ? e = c.find("'" + a.ref + ":first'") : e = c.find("'" + a.ref + ":last'"), a.cllpsLength && c.closest(f).find(a.cllpsEl).text().length < a.cllpsLength) c.closest(f).find(a.cllpsEl).addClass("dont_touch"); else {
                "show" == a.initTxt ? (j = a.expTxt, k = "") : (j = a.cllpsTxt, k = "open"); "hidden" == a.state ? c.find(a.cllpsEl + ":not(.shown, .dont_touch)").hide().findSibling().find("> a.open").removeClass("open") :
c.find(a.cllpsEl).show().findSibling().find("> a").addClass("open"); a.oneSwitch ? e.insrt('<p class="switch"><a href="#" class="' + k + '">' + j + "</a></p>") : e.insrt('<p class="switch"><a href="#" class="">' + a.expTxt + '</a>&nbsp;|&nbsp;<a href="#" class="open">' + a.cllpsTxt + "</a></p>"); e = e.findSibling("p").find("a"); g = c.closest(f).find(a.cllpsEl).not(".dont_touch"); i = a.trigger ? c.closest(f).find(a.trigger + " > a") : c.closest(f).find(".expand > a"); if (a.child) c.find(a.cllpsEl + ".shown").show().findSibling().find("> a").addClass("open").text(a.cllpsTxt),
window.$vrbls = { kt1: a.expTxt, kt2: a.cllpsTxt }; var h; "function" == typeof d ? h = d("html", "body") : h = "html, body"; e.click(function () {
    var c = b(this), e = c.closest(f).find(a.cllpsEl + ":first").offset().top; if (a.parent) { var d = c.parent().nextAll().children("p.switch").find("a"); kidTxt1 = $vrbls.kt1; kidTxt2 = $vrbls.kt2; kidTxt = c.text() == a.expTxt ? kidTxt2 : kidTxt1; d.text(kidTxt); c.text() == a.expTxt ? d.addClass("open") : d.removeClass("open");
                                                                               } if (c.text() == a.expTxt) a.oneSwitch && c.text(a.cllpsTxt).attr("class", "open"), i.addClass("open"),
g[a.showMethod](a.speed); else { a.oneSwitch && c.text(a.expTxt).attr("class", ""); i.removeClass("open"); if (0 == a.speed || a.instantHide) g.hide(); else g[a.hideMethod](a.speed); a.scroll && e < b(window).scrollTop() && b(h).animate({ scrollTop: e }, 600);
                                                                                 } return !1;
}); a.localLinks && (c = b(f).find(a.localLinks), c.length && b(c).click(function () { var a = b(this.hash), a = a.length && a || b("[name=" + this.hash.slice(1) + "]"); if (a.length) return a = a.offset().top, b(h).animate({ scrollTop: a }, 600), !1;
}));
                                                                                                                                        } 
        });
    }; b.fn.expandAll.defaults = { state: "hidden",
        initTxt: "show", expTxt: "[Expand All]", cllpsTxt: "[Collapse All]", oneSwitch: !0, ref: ".expand", switchPosition: "before", scroll: !1, showMethod: "slideDown", hideMethod: "slideUp", speed: 600, cllpsEl: ".collapse", trigger: ".expand", localLinks: null, parent: !1, child: !1, cllpsLength: null, instantHide: !1
    }; b.fn.toggler = function (e) {
        var a = b.extend({}, b.fn.toggler.defaults, e), d = b(this); d.wrapInner('<a style="display:block" href="#" title="Expand/Collapse" />'); a.initShow && b(a.initShow).addClass("shown"); d.next(a.cllpsEl + ":not(.shown)").hide();
        return this.each(function () { var c; a.container ? c = a.container : c = "html"; d.next("div.shown").length && d.closest(c).find(".shown").show().prev().find("a").addClass("open"); b(this).click(function () { b(this).find("a").toggleClass("open").end().next(a.cllpsEl)[a.method](a.speed); return !1;
        });
        });
    }; b.fn.toggler.defaults = { cllpsEl: "div.collapse", method: "slideToggle", speed: "slow", container: "", initShow: ".shown" }; b.fn.toggleHeight = function (b, a, d) { return this.animate({ height: "toggle" }, b, a, d); }; b.fn.fadeToggle = function (b,
a, d) { return this.animate({ opacity: "toggle" }, b, a, d);
    }; b.fn.slideFadeToggle = function (b, a, d) { return this.animate({ opacity: "toggle", height: "toggle" }, b, a, d); };
})(jQuery);
