if(typeof Protoplasm=="undefined"){throw ("protoplasm.js not loaded, could not intitialize expander")}if(window.Control==undefined){Control={}}Control.Expander=Class.create({initialize:function(a,b){this._initialize(a,b)},_initialize:function(a,b){this.container=$(a);this.options=Object.extend({expandedClass:null,collapsedClass:null,hoverClass:null,triggerElement:null,onexpand:Prototype.emptyFunction,oncollapse:Prototype.emptyFunction},b||{});Element.cleanWhitespace(this.container);if(this.container.childNodes.length==2){this.title=this.container.childNodes[0];this.body=this.container.childNodes[1];this.trigger=this.options.triggerElement||this.title}if(!this.options.expand){this.collapse(true)}this.applyBehavior(this.trigger,this.body)},applyBehavior:function(b,a){b.onclick=function(c){if(this.expanded){this.collapse()}else{this.expand()}}.bindAsEventListener(this);b.onmouseover=this.hover.bindAsEventListener(this);b.onmouseout=this.restore.bindAsEventListener(this);b.onmousedown=function(c){return false}.bindAsEventListener(this);b.onselectstart=function(c){return false}.bindAsEventListener(this)},expand:function(){Element.removeClassName(this.title,this.options.collapsedClass);Element.addClassName(this.title,this.options.expandedClass);this.body.style.display="block";this.expanded=true;if(this.options.onexpand){this.options.onexpand(this)}},collapse:function(a){Element.removeClassName(this.title,this.options.expandedClass);Element.addClassName(this.title,this.options.collapsedClass);this.body.style.display="none";this.expanded=false;if(this.options.oncollapse&&!a){this.options.oncollapse(this)}},hover:function(){Element.addClassName(this.title,this.options.hoverClass)},restore:function(){Element.removeClassName(this.title,this.options.hoverClass)}});Protoplasm.register("expander",Control.Expander);