// Compacted by ScriptingMagic.com
//** Animated Collapsible DIV v2.0- (c) Dynamic Drive DHTML code library: http://www.dynamicdrive.com.
//** May 24th, 08'- Script rewritten and updated to 2.0.
//** June 4th, 08'- Version 2.01: Bug fix to work with jquery 1.2.6 (which changed the way attr() behaves).

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