Sidebar=Fx.Base.extend({
	setNow:function(){for(var i=0;i<2;i++)this.now[i]=this.compute(this.from[i],this.to[i])},
	vertical:function(){return[this.element.getStyle('margin-top').toInt(),this.wrapper.getStyle('height').toInt()]},
	slideIn:function(){return this.start(this.vertical(),[0,this.offset])},
	slideOut:function(){return this.start(this.vertical(),[-this.offset,0])},
	toggle:function(){if(this.wrapper.offsetHeight==0)return this.slideIn();else return this.slideOut()},
	getOptions:function(){return{duration:500,transition:Fx.Transitions.linear}},
	initialize:function(element,wrapper,height,options){
		this.setOptions(this.getOptions(),options);
		this.element=$(element);
		this.wrapper=$(wrapper);
		this.margin='top';
		this.layout='height';
		this.offset=height;
		this.now=[];
		this.parent(this.options);
		this.options.onComplete=function(tr){$E(tr).style.display="block";}
		this.slideOut();
	},
	addTriggerEvent:function(tr){
		var trigger=$E(tr);
		if(this.element&&trigger)trigger.addEvent('click',function(){this.toggle()}.bind(this))},
	increase:function(){
		this.element.setStyle('margin-'+this.margin,this.now[0]+this.options.unit);
		this.wrapper.setStyle(this.layout,this.now[1]+this.options.unit)}
});

