jQuery.noConflict(); var ddaccordion = { contentclassname: {}, expandone: function (a, b) { this.toggleone(a, b, "expand") }, collapseone: function (a, b) { this.toggleone(a, b, "collapse") }, expandall: function (a) { var b = jQuery; var c = b("." + a); b("." + this.contentclassname[a] + ":hidden").each(function () { c.eq(parseInt(b(this).attr("contentindex"))).click() }) }, collapseall: function (a) { var b = jQuery; var c = b("." + a); b("." + this.contentclassname[a] + ":visible").each(function () { c.eq(parseInt(b(this).attr("contentindex"))).click() }) }, toggleone: function (a, b, c) { var d = jQuery; var e = d("." + a).eq(b); var f = d("." + this.contentclassname[a]).eq(b); if (typeof c == "undefined" || c == "expand" && f.is(":hidden") || c == "collapse" && f.is(":visible")) e.click() }, expandit: function (a, b, c, d) { b.slideDown(c.animatespeed, function () { c.onopenclose(a.get(0), parseInt(a.attr("headerindex")), b.css("display"), d) }); this.transformHeader(a, c, "expand") }, collapseit: function (a, b, c, d) { b.slideUp(c.animatespeed, function () { c.onopenclose(a.get(0), parseInt(a.attr("headerindex")), b.css("display"), d) }); this.transformHeader(a, c, "collapse") }, transformHeader: function (a, b, c) { a.addClass(c == "expand" ? b.cssclass.expand : b.cssclass.collapse).removeClass(c == "expand" ? b.cssclass.collapse : b.cssclass.expand); if (b.htmlsetting.location == "src") { a = a.is("img") ? a : a.find("img").eq(0); a.attr("src", c == "expand" ? b.htmlsetting.expand : b.htmlsetting.collapse) } else if (b.htmlsetting.location == "prefix") a.find(".accordprefix").html(c == "expand" ? b.htmlsetting.expand : b.htmlsetting.collapse); else if (b.htmlsetting.location == "suffix") a.find(".accordsuffix").html(c == "expand" ? b.htmlsetting.expand : b.htmlsetting.collapse) }, urlparamselect: function (a) { var b = window.location.search.match(new RegExp(a + "=((\\d+)(,(\\d+))*)", "i")); if (b != null) b = RegExp.$1.split(","); return b }, getCookie: function (a) { var b = new RegExp(a + "=[^;]+", "i"); if (document.cookie.match(b)) return document.cookie.match(b)[0].split("=")[1]; return null }, setCookie: function (a, b) { document.cookie = a + "=" + b }, al: function (a) { alert(a) }, init: function (a) { document.write('<style type="text/css">\n'); document.write("." + a.contentclass + "{display: none}\n"); document.write("</style>"); jQuery(document).ready(function (b) { ddaccordion.urlparamselect(a.headerclass); var c = ddaccordion.getCookie(a.headerclass); ddaccordion.contentclassname[a.headerclass] = a.contentclass; a.cssclass = { collapse: a.toggleclass[0], expand: a.toggleclass[1] }; a.htmlsetting = { location: a.togglehtml[0], collapse: a.togglehtml[1], expand: a.togglehtml[2] }; a.oninit = typeof a.oninit == "undefined" ? function () { } : a.oninit; a.onopenclose = typeof a.onopenclose == "undefined" ? function () { } : a.onopenclose; var d = {}; var e = ddaccordion.urlparamselect(a.headerclass) || (a.persiststate && c != null ? c : a.defaultexpanded); if (typeof e == "string") e = e.replace(/c/ig, "").split(","); var f = b("." + a["contentclass"]); if (!(e instanceof Array)) e = []; if (a["collapseprev"] && e.length > 1) e = [e.pop()]; b("." + a["headerclass"]).each(function (c) { if (/(prefix)|(suffix)/i.test(a.htmlsetting.location) && b(this).html() != "") { b('<span class="accordprefix"></span>').prependTo(this); b('<span class="accordsuffix"></span>').appendTo(this) } b(this).attr("headerindex", c + "h"); f.eq(c).attr("contentindex", c + "c"); var g = f.eq(c); if (jQuery.inArray(c, e) != -1) { if (a.animatedefault == false) g.show(); ddaccordion.expandit(b(this), g, a, false); d = { $header: b(this), $content: g} } else { g.hide(); a.onopenclose(b(this).get(0), parseInt(b(this).attr("headerindex")), g.css("display"), false); ddaccordion.transformHeader(b(this), a, "collapse") } }); b("." + a["headerclass"]).click(function () { var c = f.eq(parseInt(b(this).attr("headerindex"))); if (c.css("display") == "none") { ddaccordion.expandit(b(this), c, a, true); if (a["collapseprev"] && d.$header && b(this).get(0) != d.$header.get(0)) { ddaccordion.collapseit(d.$header, d.$content, a, true) } d = { $header: b(this), $content: c} } else { ddaccordion.collapseit(b(this), c, a, true) } return false }); a.oninit(b("." + a["headerclass"]).get(), e); b(window).bind("unload", function () { b("." + a["headerclass"]).unbind("click"); var c = []; b("." + a["contentclass"] + ":visible").each(function (a) { c.push(b(this).attr("contentindex")) }); if (a.persiststate == true) { c = c.length == 0 ? "-1c" : c; ddaccordion.setCookie(a.headerclass, c) } }) }) } }
