﻿(function (d) { d.fn.hoverAccordion = function (a) { function i(e) { void 0 == d(e).html() && (e = this); if (!k.is(":animated")) { var b = d(e).parent().children("ul"), e = d(e).parent().parent().children("li").children("ul:visible"); thisheight = "true" == a.keepheight ? g : b.height(); b.is(":visible") || (b.children().hide(), b.animate({ height: thisheight }, { step: function (a) { b.height(thisheight - a) }, duration: a.speed }).children().show(), e.animate({ height: "hide" }, { step: function (a) { b.height(thisheight - a) }, duration: a.speed }).children().hide(), e.parent().children("a").addClass(a.closed).removeClass(a.opened), b.parent().children("a").addClass(a.opened).removeClass(a.closed)) } } var a = jQuery.extend({ speed: "fast", activateitem: "true", active: "active", header: "header", hover: "hover", opened: "opened", closed: "closed", keepheight: "true" }, a), k = this, f = window.location.href, h = 0, j = 0, g = 0; d(this).children("li").each(function () { var e = d(this); j++; var b = e.children("a"); if (0 < b.length) { b.hover(function () { d(this).addClass(a.hover) }, function () { d(this).removeClass(a.hover) }); var c = b.attr("href"); "#" == c ? b.click(function () { i(this); this.blur(); return !1 }) : "true" == a.activateitem && 0 < f.indexOf(c) && f.length - f.lastIndexOf(c) == c.length && b.parent().addClass(a.active) } c = e.children("ul"); 0 < c.length && (g < c.height() && (g = c.height()), c.children("li." + a.active).parent().parent().children("a").addClass(a.header), b.hover(function () { var a = this; h = setInterval(function () { i(a); clearInterval(h) }, 400) }, function () { clearInterval(h) }), "true" == a.activateitem ? c.children("li").each(function () { var b = d(this).children("a").attr("href"); b && 0 < f.indexOf(b) && f.length - f.lastIndexOf(b) == b.length && d(this).addClass(a.active).parent().parent().children("a").addClass(a.opened) }) : parseInt(a.activateitem) == j && e.addClass(a.active).children("a").addClass(a.opened)); c.not(d(this).parent().children("li." + a.active).children("ul")).not(c.children("li." + a.active).parent()).hide().parent().children("a").addClass(a.closed) }); return this } })(jQuery);
