var Animation = new Class({
	div:null,
	length: 0,
	fx: null,
	initialize: function(div) {
		this.div = div;
		this.length = this.div.getElements('img').length;
		this.div.addEvent('mouseover', this.move.bind(this));
		//this.div.addEvent('mouseout', this.back.bind(this));
	},
	move: function() {
		this.div.removeEvents('mouseover');
		if (this.fx) this.fx.cancel();
		var target = this.div.getPosition(this.div.parentNode).x - Animation.vars.width;
		this.fx = new Fx.Tween(this.div, {duration: Animation.vars.tweenDuration}).start('left', target).chain(function(){
			this.div.addEvent('mouseout', this.back.bind(this));
		}.bind(this));
	},
	back: function() {
		this.div.removeEvents('mouseout');
		if (this.fx) this.fx.cancel();
		this.fx = new Fx.Tween(this.div, {duration: Animation.vars.tweenDuration}).start('left', 0).chain(function(){
			this.div.addEvent('mouseover', this.move.bind(this));
		}.bind(this));
	}
});
Animation.vars = {
	width: 99,
	height: 133,
	duration: 5000,
	tweenDuration: 200
};
window.addEvent('load', function() {
	$$('.animation').each(function(element) {
		new Animation(element);
	});
});
