$.fn.extend({
	
	jshake: function(){
		var selector = $(this);
		//selector.css('position', 'absolute');
		var duration= 175;
		var shake= 20;
		var vibrateIndex = 0;
		var interval = 4;
		
		var vibrate = function(){
			$(selector).stop(true,false)
			.css({
			left: Math.round(Math.random() * shake) - ((shake + 1) / 2) +'px',
			top: Math.round(Math.random() * shake) - ((shake + 1) / 2) +'px'
			});
		}
		
		var stopVibration = function() {
			clearInterval(vibrateIndex);
			$(selector).css({left: '0px', top: '0px'});
		};
		
		function Shake(element){
			vibrateIndex = setInterval(vibrate, interval);
			setTimeout(stopVibration, duration);
		}
		
		Shake(selector);
	}
});
