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