var mzSlide=new Class({

	options: {
		hst:false,
		hstname:"slide",
		init_function:false,
		mode:"vertical",
		min:0,
		max:250,
		layerTransition:Fx.Transitions.linear,
		layerSpeed:500
	}, 

	initialize: function(objs,options){

		this.setOptions(options);
	
		this.objname=this.options.hstname;
		this.objs=objs;
		this.objsproperty = (this.options.mode=="vertical") ? "height" : "width";
		this.history = (this.options.hst) ? this.options.hst.register(this.objname,this) : null;
		this.init=(this.options.init_function) ? this.options.init_function.bind(this) : function(){};
		this.effects = {};
	},
	
	doit: function(action,params){

		switch(action){
		case "init":
			this.init();
		break;
		case "hide":
			this.hide();
		break;
		case "show":
			this.show();
		break;
		}
	
	},
	
	show: function(){
	
		var eseguito=false;

		this.objs.each(function(el){

			if($(el)) {
				
				eseguito=true;
				
				if(this.effects[el.id]) this.effects[el.id].stop()
				
				this.effects[el.id] = new Fx.Style($(el), this.objsproperty ,{duration: this.options.layerSpeed,transition:this.options.layerTransition}).start(this.options.max);
			
			}	
		
		}.bind(this))

		if(this.history && eseguito) this.history.setValues(["show"]);

	},

	hide: function(){

		var eseguito=false;

		this.objs.each(function(el){

			if($(el)) {

				eseguito=true;
				
				if(this.effects[el.id]) this.effects[el.id].stop()
				
				this.effects[el.id] = new Fx.Style($(el), this.objsproperty ,{duration: this.options.layerSpeed,transition:this.options.layerTransition}).start(this.options.min);
			
			}
		
		
		}.bind(this))

		if(this.history && eseguito) this.history.setValues(["hide"])
		
	}
	
});

mzSlide.implement(new Options);

