_EFECTO25=true;
var MooScroll25 = new Class({
	options: {
		id: 'mooScroll',
		contenedor:'',
		element: '',
		duration: '100',
		paso:'10'
	},
	
	initialize: function(options) {
		this.setOptions(options);
		
		this.element=options.element;//capa interior que se mueve
		this.duration=options.duration;
		this.paso=options.paso;
		this.contenedor=options.contenedor;
		this.contentHeight=$(this.contenedor).getStyle('height').toInt();
		this.posYrel=0;
		this.posXrel=0;
		this.positionX=0;
		this.positionY=0;
		this.efectoDisponible=true;
		this.posYMax=$(this.element).getStyle('height').toInt()-this.contentHeight;
		
		$(this.element).setStyle('position','relative');
		this.efect = new Fx.Style(this.element, 'top', {duration:this.duration,'onComplete':function(el){
			_EFECTO25=true;
			}});
		this.efect1 = new Fx.Style(this.element, 'left', {duration:this.duration,'onComplete':function(el){
			_EFECTO25=true;
			}});
		
	},

	move: function(movimiento) {
		
		this[movimiento]()
	},
	
	up:function(){
		
		var fondoelement=$(this.element).getCoordinates().height+$(this.element).getCoordinates().top;
		var fondocontent=$(this.contenedor).getCoordinates().height+$(this.contenedor).getCoordinates().top;
		
		if(fondoelement>fondocontent && $(this.element).getCoordinates().height > $(this.contenedor).getCoordinates().height && _EFECTO25==true){
		this.positionY=$(this.element).getCoordinates().top;
		this.positionY=this.posYrel;
		this.posYrel-=this.paso;
		_EFECTO25=false;
		this.efect.start(this.positionY, this.posYrel);
		}
	},
	
	izq:function(){
		if($(this.element).getCoordinates().right > $(this.contenedor).getCoordinates().right && _EFECTO25==true){
			start=this.positionX;
			this.positionX-=this.paso;
			this.posYrel-=this.paso;
			_EFECTO25=false;
			this.efect1.start(start, this.positionX);
		}
	},
	der:function(){
		if($(this.contenedor).getCoordinates().left > $(this.element).getCoordinates().left && _EFECTO25==true){
			start=this.positionX;
			this.positionX+=this.paso;
			_EFECTO25=false;
			this.efect1.start(start, this.positionX);
		}
	},
	
	down:function(){
		
		if(this.posYrel<0 && _EFECTO25==true){
			this.positionY=$(this.element).getStyle('top').toInt();
			var start=this.positionY;
			this.count-=this.paso;//cuanto baja
			this.positionY+=this.paso;
			this.posYrel+=this.paso;
			_EFECTO25=false;
			this.efect.start(start, this.positionY);
		}
	}
	
});

MooScroll25.implement(new Options);
MooScroll25.implement(new Events);

