Animate = new Class({
        options: {
		defDur: 200
        },
	initialize: function(el){
		this.target = el;
		this.d = [];
		this.t = [];
	},
	run: function(d, t){
		var tfx = new Fx.Styles(this.target, {wait: false, transition: Fx.Transitions.Quad.easeOut});
		var n = 0;
		var dly = 0;
		this.t.each(function(tarr) {
			if(this.d[n] != null) { dur = this.d[n]; } else { dur = this.options.defDur }
			tfx.options.duration = dur;
			tfx.start.delay(dly, tfx, tarr);
			dly += dur;
			n++;
		}.bind(this));
	}
});
Animate.implement(new Options, new Events);

Kick = Animate.extend({
	initialize: function(el){
		this.parent(el);
		this.d = [400,50,100,500];
		this.t = [
			{'top': 100, 'left': 160, 'height': 20, 'width': 20},
			{'top': 95, 'left': 170, 'height': 18, 'width': 18},
			{'top': 100, 'left': 180, 'height': 16, 'width': 16},
			{'top': 180, 'left': 220, 'height': 3, 'width': 3}
		];
	}
});

Fly = Animate.extend({
	initialize: function(el){
		this.parent(el);
		this.d = [400,400,400,500,100,200,400];
		this.t = [
			{'top': 200, 'left': 180, 'height': 30, 'width': 30},
			{'top': 95, 'left': 200, 'height': 30, 'width': 30},
			{'top': 30, 'left': 10, 'height': 30, 'width': 30},
			{'top': 180, 'left': 50, 'height': 30, 'width': 30},
			{'top': 80, 'left': 150, 'height': 30, 'width': 30},
			{'top': 280, 'left': 20, 'height': 30, 'width': 30},
			{'top': 130, 'left': 100, 'height': 30, 'width': 30}
		];
	}
});

Butterfly = Animate.extend({
	options:{
		min: 20,
		max: 300 
	},
	initialize: function(el, steps){
		this.parent(el);
		for(i = 0; i < steps; i++){
			this.t.push({'top': this.next(), 'left': this.next()});
		}
	},
	next: function() {
		return Math.floor((this.options.max-(this.options.min-1))*Math.random()) + this.options.min;
	}
});
