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,c=b("."+a);b("."+this.contentclassname[a]+":hidden").each(function(){c.eq(parseInt(b(this).attr("contentindex"))).trigger("evt_accordion")})},collapseall:function(a){var b=jQuery,c=b("."+a);b("."+this.contentclassname[a]+":visible").each(function(){c.eq(parseInt(b(this).attr("contentindex"))).trigger("evt_accordion")})},
toggleone:function(a,b,c){var e=jQuery,f=e("."+a).eq(b),a=e("."+this.contentclassname[a]).eq(b);(typeof c=="undefined"||c=="expand"&&a.is(":hidden")||c=="collapse"&&a.is(":visible"))&&f.trigger("evt_accordion")},expandit:function(a,b,c,e,f){this.transformHeader(a,c,"expand");b.slideDown(c.animatespeed,function(){c.onopenclose(a.get(0),parseInt(a.attr("headerindex")),b.css("display"),e);if(c.postreveal=="gotourl"&&f){var d=a.is("a")?a.get(0):a.find("a:eq(0)").get(0);d&&setTimeout(function(){location=
d.href},200)}})},collapseit:function(a,b,c,e){this.transformHeader(a,c,"collapse");b.slideUp(c.animatespeed,function(){c.onopenclose(a.get(0),parseInt(a.attr("headerindex")),b.css("display"),e)})},transformHeader:function(a,b,c){a.addClass(c=="expand"?b.cssclass.expand:b.cssclass.collapse).removeClass(c=="expand"?b.cssclass.collapse:b.cssclass.expand);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)):b.htmlsetting.location==
"prefix"?a.find(".accordprefix").html(c=="expand"?b.htmlsetting.expand:b.htmlsetting.collapse):b.htmlsetting.location=="suffix"&&a.find(".accordsuffix").html(c=="expand"?b.htmlsetting.expand:b.htmlsetting.collapse)},urlparamselect:function(a){a=window.location.search.match(RegExp(a+"=((\\d+)(,(\\d+))*)","i"));a!=null&&(a=RegExp.$1.split(","));return a},getCookie:function(a){a=RegExp(a+"=[^;]+","i");return document.cookie.match(a)?document.cookie.match(a)[0].split("=")[1]:null},setCookie:function(a,
b){document.cookie=a+"="+b+"; path=/"},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.revealtype=a.revealtype||"click";a.revealtype=a.revealtype.replace(/mouseover/i,
"mouseenter");if(a.revealtype=="clickgo")a.postreveal="gotourl",a.revealtype="click";a.htmlsetting=typeof a.togglehtml=="undefined"?{location:"none"}:{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 e,f,d=ddaccordion.urlparamselect(a.headerclass)||(a.persiststate&&c!=null?c:a.defaultexpanded);typeof d=="string"&&(d=d.replace(/c/ig,"").split(","));
var i=b("."+a.contentclass);d.length==1&&d[0]=="-1"&&(d=[]);a.collapseprev&&d.length>1&&(d=[d.pop()]);a.onemustopen&&d.length==0&&(d=[0]);b("."+a.headerclass).each(function(c){/(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");i.eq(c).attr("contentindex",c+"c");var g=i.eq(c);jQuery.inArray(typeof d[0]=="number"?c:c+"",d)!=-1?(a.animatedefault==
false&&g.show(),ddaccordion.expandit(b(this),g,a,false),e=b(this),f=g):(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).bind("evt_accordion",function(c,d){var h=i.eq(parseInt(b(this).attr("headerindex")));h.css("display")=="none"?(ddaccordion.expandit(b(this),h,a,true,d),a.collapseprev&&e&&b(this).get(0)!=e.get(0)&&ddaccordion.collapseit(e,f,a,true),e=b(this),f=h):(!a.onemustopen||
a.onemustopen&&e&&b(this).get(0)!=e.get(0))&&ddaccordion.collapseit(b(this),h,a,true)});b("."+a.headerclass).bind(a.revealtype,function(){if(a.revealtype=="mouseenter"){clearTimeout(a.revealdelay);var c=parseInt(b(this).attr("headerindex"));a.revealdelay=setTimeout(function(){ddaccordion.expandone(a.headerclass,c)},a.mouseoverdelay||0)}else return b(this).trigger("evt_accordion",[true]),false});b("."+a.headerclass).bind("mouseleave",function(){clearTimeout(a.revealdelay)});a.oninit(b("."+a.headerclass).get(),
d);b(window).bind("unload",function(){b("."+a.headerclass).unbind();var c=[];b("."+a.contentclass+":visible").each(function(){c.push(b(this).attr("contentindex"))});a.persiststate==true&&b("."+a.headerclass).length>0&&(c=c.length==0?"-1c":c,ddaccordion.setCookie(a.headerclass,c))})})}};
