var animatedcollapse={divholders:{},divgroups:{},lastactiveingroup:{},show:function(B){if(typeof B=="object"){for(var A=0;A<B.length;A++){this.showhide(B[A],"show")}}else{this.showhide(B,"show")}},hide:function(B){if(typeof B=="object"){for(var A=0;A<B.length;A++){this.showhide(B[A],"hide")}}else{this.showhide(B,"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,C){var A=this.divholders[D].$divref;if(this.divholders[D]&&A.length==1){var B=this.divgroups[A.attr("groupname")];if(A.attr("groupname")&&B.count>1&&(C=="show"||C=="toggle"&&A.css("display")=="none")){if(B.lastactivedivid&&B.lastactivedivid!=D){this.slideengine(B.lastactivedivid,"hide")}this.slideengine(D,"show");B.lastactivedivid=D}else{this.slideengine(D,C)}}},slideengine:function(D,C){var A=this.divholders[D].$divref;if(this.divholders[D]&&A.length==1){var B={height:C};if(A.attr("fade")){B.opacity=C}A.animate(B,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 B=A.getCookie("acopendivids");var D=A.getCookie("acgroupswithpersist");if(B!=null){B=(B=="nada")?[]:B.split(",")}D=(D==null||D=="nada")?[]:D.split(",");jQuery.each(A.divholders,function(){this.$divref=E("#"+this.id);if((this.getAttr("persist")||jQuery.inArray(this.getAttr("group"),D)!=-1)&&B!=null){var H=(jQuery.inArray(this.id,B)!=-1)?"block":"none"}else{var H=this.getAttr("hide")?"none":null}this.$divref.css(A.generatemap(["height",this.getAttr("height")],["display",H]));this.$divref.attr(A.generatemap(["groupname",this.getAttr("group")],["fade",this.getAttr("fade")],["speed",this.getAttr("speed")]));if(this.getAttr("group")){var G=A.divgroups[this.getAttr("group")]||(A.divgroups[this.getAttr("group")]={});G.count=(G.count||0)+1;if(!G.lastactivedivid&&this.$divref.css("display")!="none"||H=="block"){G.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(B,C,D){if(typeof D!="undefined"){var A=new Date();A.setDate(A.getDate()+D);document.cookie=B+"="+C+"; path=/; expires="+A.toGMTString()}else{document.cookie=B+"="+C+"; path=/"}}};
var ss={fixAllLinks:function(){var B=document.getElementsByTagName("a");for(var A=0;A<B.length;A++){var C=B[A];if((C.href&&C.href.indexOf("#")!=-1)&&((C.pathname==location.pathname)||("/"+C.pathname==location.pathname))&&(C.search==location.search)){ss.addEvent(C,"click",ss.smoothScroll)}}},smoothScroll:function(H){if(window.event){target=window.event.srcElement}else{if(H){target=H.target}else{return}}if(target.nodeType==3){target=target.parentNode}if(target.nodeName.toLowerCase()!="a"){return}anchor=target.hash.substr(1);var K=document.getElementsByTagName("a");var D=document.getElementsByTagName("div");var J=[K,D];var I=null;for(var E=0;E<J.length;E++){for(var F=0;F<J[E].length;F++){var G=J[E][F];if(G.name&&(G.name==anchor)){I=G;break}else{if(G.id&&(G.id==anchor)){I=G;break}}}}if(!I){return true}var C=I.offsetLeft;var A=I.offsetTop;var B=I;while(B.offsetParent&&(B.offsetParent!=document.body)){B=B.offsetParent;C+=B.offsetLeft;A+=B.offsetTop}clearInterval(ss.INTERVAL);cypos=ss.getCurrentYPos();ss_stepsize=parseInt((A-cypos)/ss.STEPS);ss.INTERVAL=setInterval("ss.scrollWindow("+ss_stepsize+","+A+',"'+anchor+'")',10);if(window.event){window.event.cancelBubble=true;window.event.returnValue=false}if(H&&H.preventDefault&&H.stopPropagation){H.preventDefault();H.stopPropagation()}},scrollWindow:function(A,C,B){wascypos=ss.getCurrentYPos();isAbove=(wascypos<C);window.scrollTo(0,wascypos+A);iscypos=ss.getCurrentYPos();isAboveNow=(iscypos<C);if((isAbove!=isAboveNow)||(wascypos==iscypos)){window.scrollTo(0,C);clearInterval(ss.INTERVAL);location.hash=B}},getCurrentYPos:function(){if(document.body&&document.body.scrollTop){return document.body.scrollTop}if(document.documentElement&&document.documentElement.scrollTop){return document.documentElement.scrollTop}if(window.pageYOffset){return window.pageYOffset}return 0},addEvent:function(E,D,B,A){if(E.addEventListener){E.addEventListener(D,B,A);return true}else{if(E.attachEvent){var C=E.attachEvent("on"+D,B);return C}else{alert("Handler could not be removed")}}}};ss.STEPS=25;ss.addEvent(window,"load",ss.fixAllLinks);