var animatedcollapse={divholders:{},divgroups:{},lastactiveingroup:{},show:function(a){if(typeof a=="object"){for(var b=0;b<a.length;b++){this.showhide(a[b],"show")}}else{this.showhide(a,"show")}},hide:function(a){if(typeof a=="object"){for(var b=0;b<a.length;b++){this.showhide(a[b],"hide")}}else{this.showhide(a,"hide")}},toggle:function(a){this.showhide(a,"toggle")},addDiv:function(b,a){this.divholders[b]=({id:b,$divref:null,attrs:a});this.divholders[b].getAttr=function(d){var c=new RegExp(d+"=([^,]+)","i");return(c.test(this.attrs)&&parseInt(RegExp.$1)!=0)?RegExp.$1:null}},showhide:function(d,b){var a=this.divholders[d].$divref;if(this.divholders[d]&&a.length==1){var c=this.divgroups[a.attr("groupname")];if(a.attr("groupname")&&c.count>1&&(b=="show"||b=="toggle"&&a.css("display")=="none")){if(c.lastactivedivid&&c.lastactivedivid!=d){this.slideengine(c.lastactivedivid,"hide")}this.slideengine(d,"show");c.lastactivedivid=d}else{this.slideengine(d,b)}}},slideengine:function(d,b){var a=this.divholders[d].$divref;if(this.divholders[d]&&a.length==1){var c={height:b};if(a.attr("fade")){c.opacity=b}a.animate(c,a.attr("speed")?parseInt(a.attr("speed")):500);return false}},generatemap:function(){var b={};for(var a=0;a<arguments.length;a++){if(arguments[a][1]!=null){b[arguments[a][0]]=arguments[a][1]}}return b},init:function(){var a=this;jQuery(document).ready(function(e){var d=a.getCookie("acopendivids");var b=a.getCookie("acgroupswithpersist");if(d!=null){d=(d=="nada")?[]:d.split(",")}b=(b==null||b=="nada")?[]:b.split(",");jQuery.each(a.divholders,function(){this.$divref=e("#"+this.id);if((this.getAttr("persist")||jQuery.inArray(this.getAttr("group"),b)!=-1)&&d!=null){var g=(jQuery.inArray(this.id,d)!=-1)?"block":"none"}else{var g=this.getAttr("hide")?"none":null}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 h=a.divgroups[this.getAttr("group")]||(a.divgroups[this.getAttr("group")]={});h.count=(h.count||0)+1;if(!h.lastactivedivid&&this.$divref.css("display")!="none"||g=="block"){h.lastactivedivid=this.id}this.$divref.css({display:"none"})}});jQuery.each(a.divgroups,function(){if(this.lastactivedivid){a.divholders[this.lastactivedivid].$divref.show()}});var c=e("*[rel]").filter('[@rel^="collapse-"], [@rel^="expand-"], [@rel^="toggle-"]');var f=/(collapse-)|(expand-)|(toggle-)/;c.each(function(){e(this).click(function(){var g=this.getAttribute("rel");var i=g.replace(f,"");var h=(g.indexOf("collapse-")!=-1)?"hide":(g.indexOf("expand-")!=-1)?"show":"toggle";return a.showhide(i,h)})});e(window).bind("unload",function(){a.uninit()})})},uninit:function(){var b="",a="";jQuery.each(this.divholders,function(){if(this.$divref.css("display")!="none"){b+=this.id+","}if(this.getAttr("group")&&this.getAttr("persist")){a+=this.getAttr("group")+","}});b=(b=="")?"nada":b.replace(/,$/,"");a=(a=="")?"nada":a.replace(/,$/,"");this.setCookie("acopendivids",b);this.setCookie("acgroupswithpersist",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,c,d){if(typeof d!="undefined"){var b=new Date();b.setDate(b.getDate()+d);document.cookie=a+"="+c+"; path=/; expires="+b.toGMTString()}else{document.cookie=a+"="+c+"; path=/"}}};