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