var Shake = new Class({
	Implements:Options,
		options:{
			distance: 3,
			duration: 50,
			transition: Fx.Transitions.Sine.easeInOut,
			loops: 15
		},
		
	initialize:function(element,options){
		this.setOptions(options);
		this.element=$(element);
		this.tween = new Fx.Tween(this.element,{ 
			link: 'chain', 
			duration: this.options.duration,
			transition: this.options.transition
		});
	},
	
	shake:function(){
		var d=this.options.distance;
		var im = this.element.getStyle('margin-left');
		temp = new Array();
		temp = im.split('px');
		im = temp[0];
		pos_pos = parseInt(im)+d;
		pos_neg = parseInt(im)-d;
		for(x=0;x<this.options.loops;x++) this.tween.start('margin-left',pos_pos).start('margin-left',pos_neg);
		this.tween.start('margin-left',pos_pos).start('margin-left',im);
	}
	
});