Reset variable in javascript (jQuery)
<p>I am trying to reset a variable (that updates the src value for an image) when an area of an image map is clicked, so that the hover function calls a different image when the user hovers over another area in the image map.</p>

<p>I have a variable called "state" that I set right off the bat. This is the variable that I want to reset when an area is clicked.</p>

<pre><code>var state = "path/to/images/feed1.png";
</code></pre>

<p>I have a couple of functions involving hover() and click(). </p>

<pre><code>$("#Map area").click(
    function () {
        var button = $(this).attr("id");                
        // here is where i want to reset the 'state' variable
        var state = "path/to/images/" + button + ".png";
        alert("you clicked "+button+" hello");
        return false;
    }
); 


$("#Map area").hover(
    function () {
        var button = $(this).attr("id");
        over("path/to/images/" + button + ".png");
    },
    function () {
        off();
    });
</code></pre>

<p>And some functions that these functions call:</p>

<pre><code>function over(image) {
    $("#feednavImg").attr("src", image);
}

function off() {
    $("#feednavImg").attr("src", state);
}
</code></pre>
