var ddaccordion={ajaxloadingmsg:'<img src="../../../Images/loading2.gif" /><br />Loading Content...',headergroup:{},contentgroup:{},preloadimages:function(a){a.each(function(){(new Image).src=this.src})},expandone:function(a,b){this.toggleone(a,b,"expand")},collapseone:function(a,b){this.toggleone(a,b,"collapse")},expandall:function(a){var b=this.headergroup[a];this.contentgroup[a].filter(":hidden").each(function(){b.eq(parseInt($(this).attr("contentindex"))).trigger("evt_accordion")})},collapseall:function(a){var b=this.headergroup[a];this.contentgroup[a].filter(":visible").each(function(){b.eq(parseInt($(this).attr("contentindex"))).trigger("evt_accordion")})},toggleone:function(a,b,d){var g=this.headergroup[a].eq(b);a=this.contentgroup[a].eq(b);if(typeof d=="undefined"||d=="expand"&&a.is(":hidden")||d=="collapse"&&a.is(":visible"))g.trigger("evt_accordion")},ajaxloadcontent:function(a,b,d,g){function h(c){if(c){e.cacheddata=c;e.status="cached";if(b.queue("fx").length==0){b.hide().html(c);e.status="complete";g()}}e.status!="complete"&&setTimeout(function(){h(e.cacheddata)},100)}var e=a.data("ajaxinfo");if(e.status=="none"){b.html(this.ajaxloadingmsg);b.slideDown(d.animatespeed);e.status="loading";$.ajax({url:e.url,error:function(c){h("Error fetching content. Server Response: "+c.responseText)},success:function(c){c=c==""?" ":c;h(c)}})}else e.status=="loading"&&h(e.cacheddata)},expandit:function(a,b,d,g,h,e){var c=a.data("ajaxinfo");if(c)if(c.status=="none"||c.status=="loading")this.ajaxloadcontent(a,b,d,function(){ddaccordion.expandit(a,b,d,g,h)});else if(c.status=="cached"){b.html(c.cacheddata);c.cacheddata=null;c.status="complete"}this.transformHeader(a,d,"expand");b.slideDown(e?0:d.animatespeed,function(){d.onopenclose(a.get(0),parseInt(a.attr("headerindex")),b.css("display"),g);if(d.postreveal=="gotourl"&&h){var f=a.is("a")?a.get(0):a.find("a:eq(0)").get(0);f&&setTimeout(function(){location=f.href},200)}})},collapseit:function(a,b,d,g){this.transformHeader(a,d,"collapse");b.slideUp(d.animatespeed,function(){d.onopenclose(a.get(0),parseInt(a.attr("headerindex")),b.css("display"),g)})},transformHeader:function(a,b,d){a.addClass(d=="expand"?b.cssclass.expand:b.cssclass.collapse).removeClass(d=="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",d=="expand"?b.htmlsetting.expand:b.htmlsetting.collapse)}else if(b.htmlsetting.location=="prefix")a.find(".accordprefix").html(d=="expand"?b.htmlsetting.expand:b.htmlsetting.collapse);else if(b.htmlsetting.location=="suffix")a.find(".accordsuffix").html(d=="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("a.hiddenajaxlink{display: none}\n");document.write("</style>");jQuery(document).ready(function(b){ddaccordion.urlparamselect(a.headerclass);var d=ddaccordion.getCookie(a.headerclass);ddaccordion.headergroup[a.headerclass]=b("."+a.headerclass);ddaccordion.contentgroup[a.headerclass]=b("."+a.contentclass);var g=ddaccordion.headergroup[a.headerclass],h=ddaccordion.contentgroup[a.headerclass];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={},c=ddaccordion.urlparamselect(a.headerclass)||(a.persiststate&&d!=null?d:a.defaultexpanded);if(typeof c=="string")c=c.replace(/c/ig,"").split(",");if(c.length==1&&c[0]=="-1")c=[];if(a.collapseprev&&c.length>1)c=[c.pop()];if(a.onemustopen&&c.length==0)c=[0];g.each(function(f){var i=b(this);if(/(prefix)|(suffix)/i.test(a.htmlsetting.location)&&i.html()!=""){b('<span class="accordprefix"></span>').prependTo(this);b('<span class="accordsuffix"></span>').appendTo(this)}i.attr("headerindex",f+"h");h.eq(f).attr("contentindex",f+"c");var j=h.eq(f),k=j.find("a.hiddenajaxlink:eq(0)");k.length==1&&i.data("ajaxinfo",{url:k.attr("href"),cacheddata:null,status:"none"});if(jQuery.inArray(typeof c[0]=="number"?f:f+"",c)!=-1){ddaccordion.expandit(i,j,a,false,false,!a.animatedefault);e={$header:i,$content:j}}else{j.hide();a.onopenclose(i.get(0),parseInt(i.attr("headerindex")),j.css("display"),false);ddaccordion.transformHeader(i,a,"collapse")}});g.bind("evt_accordion",function(f,i){var j=h.eq(parseInt(b(this).attr("headerindex")));if(j.css("display")=="none"){ddaccordion.expandit(b(this),j,a,true,i);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:j}}else if(!a.onemustopen||a.onemustopen&&e.$header&&b(this).get(0)!=e.$header.get(0))ddaccordion.collapseit(b(this),j,a,true)});g.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}});g.bind("mouseleave",function(){clearTimeout(a.revealdelay)});a.oninit(g.get(),c);b(window).bind("unload",function(){g.unbind();var f=[];h.filter(":visible").each(function(){f.push(b(this).attr("contentindex"))});if(a.persiststate==true&&g.length>0){f=f.length==0?"-1c":f;ddaccordion.setCookie(a.headerclass,f)}})})}};ddaccordion.preloadimages(jQuery(ddaccordion.ajaxloadingmsg).filter("img"));
