get the value undefine on onkeyup when used setTimeout function
<p>i have call function on onkeyup event of textbox which pass the data using ajax.below is sample code of my function which in .js file.</p>

<pre><code>var timeout;
function testfont(id,image) 
{
    alert('image');//when alert here it shows value
    clearTimeout(timeout);
    timeout = setTimeout( function()
    {
        if(image.match(/_small/g))
        {
            var image = image.replace('_small','');
        } else {
            var image = image;
        }
        alert('image'); //when alert here it show undefined
    }, 500);
}
</code></pre>

<p>But the problem is that i get the image value undefined inside setTimeout function.it works perfectly without use of setTimeout but i need setTimeout function for event fire after some time.</p>

<p>how can i resolve this?</p>
