Global Variable Throwing "Undefined" error in hover function
<p>I have this global variable which is used as counter which I want to access in the jquery hover function. But some how the variable is throwing "undefined" error when I try to access it in the hover function. The code is  </p>

<pre><code>var i = 0

$('#ticker-area').hover(function() {
    alert(i); //THROWS UNDEFINED ERROR  
    clearTimeout(t1);   
    if (i &gt; 0) {  
        alert(i); //NEVER REACHES HERE  
        var i = i - 1;  
        var innerText = tickerItems[i];  
        i++;  
    }  
    $('#ticker-area').html(innerText);  
}, function() {  
    clearTimeout(t1);  
    rotateTicker();  
});  
</code></pre>

<p>Please help. 
Thanks
Paddy</p>
