$(document).ready( function() {
	var interval = 30;
	var duration= 1000;
	var shake= 3;
	var vibrateIndex = 0;
	var selector = $('#header_pic');
	
	$(selector).mouseenter(
		function () {	
			vibrateIndex = setInterval(vibrate, interval);
	}).mouseleave(
		function () {
			clearInterval(vibrateIndex);
			$(selector).stop(true,false)
				.css({position: 'static', left: '0px', top: '0px'});
	});

	var vibrate = function () {
		$(selector).stop(true,false)
			.css({position: 'relative', 
			left: Math.round(Math.random() * shake) - ((shake + 1) / 2) +'px', 
			top: Math.round(Math.random() * shake) - ((shake + 1) / 2) +'px'});
	}

});
