(function (a) {
	var b = {
		init: function (c) {
			typeof c == "undefined" && (c = !1);
			return this.each(function () {
				var d = a(this);
				if (!d.data("d")) {
					var e = d.children("ul").first(),
					f,
					g;
					e.children("li").has("ul").each(function () {
						f = a(this),
						g = f.children("a").first();
						var d = g.height(),
						h = f.height(),
						i = f.hasClass("selected");
						f.css("height", i ? h: d).data("d", {
							ignr: !1,
							mul: e,
							autoCls: c,
							cls: i ? !1 : !0,
							ch: d,
							oh: h
						}),
						g.bind("click.slashcTwoTierMenu", a.proxy(function (c) {
							var d = this.data("d");
							d.ignr = !0,
							b._toggleLi(this),
							d.autoCls && d.mul.children("li").has("ul").each(function () {
								var c = a(this),
								d = c.data("d");
								d.ignr || b._closeLi(c),
								d.ignr = !1
							}),
							c.preventDefault()
						},
						f))
					}),
					d.data("d", "inited")
				}
			})
		},
		_openLi: function (a) {
			var b = a.data("d");
			b.cls && (b.cls = !1, a.stop().animate({
				height: b.oh
			},
			"fast").addClass("selected"))
		},
		_closeLi: function (a) {
			var b = a.data("d");
			b.cls || (b.cls = !0, a.stop().animate({
				height: b.ch
			},
			"fast").removeClass("selected"))
		},
		_toggleLi: function (a) {
			var c = a.data("d");
			c.cls ? b._openLi(a) : b._closeLi(a)
		}
	};
	a.fn.slashcTwoTierMenu = function (a, c) {
		if (typeof c == "undefined") return typeof a == "undefined" ? b.init.call(this) : b[a] ? b[a].call(this) : b.init.call(this, a);
		if (b[a]) return c ? b[a].call(this, c) : b[a].call(this);
		return this
	},
	a(document).ready(function () {
		a("div.slashc-two-tier-menu").slashcTwoTierMenu(!0)
	})
})(jQuery)
