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