var animatedcollapse={divholders:{},divgroups:{},statusholders:{},lastactiveingroup:{},show:function(a){if("object"==typeof a)for(var b=0;b<a.length;b++)this.showhide(a[b],"show");else this.showhide(a,"show")},hide:function(a){if("object"==typeof a)for(var b=0;b<a.length;b++)this.showhide(a[b],"hide");else this.showhide(a,"hide")},toggle:function(a){"object"==typeof a&&(a=a[0]);this.showhide(a,"toggle")},addDiv:function(a,b){this.divholders[a]={id:a,$divref:null,attrs:b};this.divholders[a].getAttr=
function(a){return RegExp(a+"=([^,]+)","i").test(this.attrs)&&0!=parseInt(RegExp.$1)?RegExp.$1:null};this.currentid=a;return this},showhide:function(a,b){var c=this.divholders[a].$divref;if(this.divholders[a]&&1==c.length){var d=this.divgroups[c.attr("groupname")];c.attr("groupname")&&1<d.count&&("show"==b||"toggle"==b&&"none"==c.css("display"))?(d.lastactivedivid&&d.lastactivedivid!=a&&this.slideengine(d.lastactivedivid,"hide"),this.slideengine(a,"show"),d.lastactivedivid=a):this.slideengine(a,b)}},
slideengine:function(a,b){var c=this.divholders[a].$divref;if(this.divholders[a]&&1==c.length){var d={height:b};if(c.attr("fade"))d.opacity=b;c.animate(d,c.attr("speed")?parseInt(c.attr("speed")):300,function(){if(animatedcollapse.ontoggle)try{animatedcollapse.ontoggle(jQuery,c.get(0),c.css("display"))}catch(a){alert('An error exists inside your "ontoggle" function:\n\n'+a+"\n\nAborting execution of function.")}});return!1}},generatemap:function(){for(var a={},b=0;b<arguments.length;b++)null!=arguments[b][1]&&
(a[arguments[b][0]]=arguments[b][1]);return a},init:function(){var a=this;jQuery(document).ready(function(b){animatedcollapse.ontoggle=animatedcollapse.ontoggle||null;var c=animatedcollapse.urlparamselect(),d=a.getCookie("acopendivids"),f=a.getCookie("acgroupswithpersist");null!=d&&(d="nada"==d?[]:d.split(","));f=null==f||"nada"==f?[]:f.split(",");jQuery.each(a.divholders,function(){this.$divref=b("#"+this.id);var g=(this.getAttr("persist")||-1!=jQuery.inArray(this.getAttr("group"),f))&&null!=d?-1!=
jQuery.inArray(this.id,d)?"block":"none":this.getAttr("hide")?"none":null;"all"==c[0]||-1!=jQuery.inArray(this.id,c)?g="block":"none"==c[0]&&(g="none");this.$divref.css(a.generatemap(["height",this.getAttr("height")],["display",g]));this.$divref.attr(a.generatemap(["groupname",this.getAttr("group")],["fade",this.getAttr("fade")],["speed",this.getAttr("speed")]));if(this.getAttr("group")){var e=a.divgroups[this.getAttr("group")]||(a.divgroups[this.getAttr("group")]={});e.count=(e.count||0)+1;if(-1!=
jQuery.inArray(this.id,c))e.lastactivedivid=this.id,e.overridepersist=1;if(!e.lastactivedivid&&"none"!=this.$divref.css("display")||"block"==g&&"undefined"==typeof e.overridepersist)e.lastactivedivid=this.id;this.$divref.css({display:"none"})}});jQuery.each(a.divgroups,function(){this.lastactivedivid&&"none"!=c[0]&&a.divholders[this.lastactivedivid].$divref.show()});animatedcollapse.ontoggle&&jQuery.each(a.divholders,function(){animatedcollapse.ontoggle(jQuery,this.$divref.get(0),this.$divref.css("display"))});
b(window).bind("unload",function(){a.uninit()})})},uninit:function(){var a="",b="";jQuery.each(this.divholders,function(){"none"!=this.$divref.css("display")&&(a+=this.id+",");this.getAttr("group")&&this.getAttr("persist")&&(b+=this.getAttr("group")+",")});a=""==a?"nada":a.replace(/,$/,"");b=""==b?"nada":b.replace(/,$/,"");this.setCookie("acopendivids",a);this.setCookie("acgroupswithpersist",b)},getCookie:function(a){a=RegExp(a+"=[^;]*","i");return document.cookie.match(a)?document.cookie.match(a)[0].split("=")[1]:
null},setCookie:function(a,b,c){if("undefined"!=typeof c){var d=new Date;d.setDate(d.getDate()+c);document.cookie=a+"="+b+"; path=/; expires="+d.toGMTString()}else document.cookie=a+"="+b+"; path=/"},urlparamselect:function(){window.location.search.match(/expanddiv=([\w\-_,]+)/i);return""!=RegExp.$1?RegExp.$1.split(","):[]}};
