How to stop a setInterval on hover

How to stop a setInterval on hover

Hi,

Here is my problem broken down:

I have some animation inside a function like this:

function doAnimation() {

$('div.nav').animate({left: 15}, 200, 'swing')
$('div.nav').animate({left: 10}, 200, 'swing')
$('div.nav').animate({left: 15}, 170, 'swing')




$('div.nav').animate({left: 10}, 200, 'swing')

}


and then I am setting an interval like this:

$(document).ready(function(){
setInterval('doAnimation()', 5000);
});


which is all fine, but I want to kill the animation and the interval as soon as you hover into here:


$('.nav UL.first > LI.top-level').hover(function(e) {

//some code to stop the animation and interval here

}


Cheers in advance

David