function is not defined when using setTimeout?

function is not defined when using setTimeout?

Hello.

I have this code:
  1. setTimeout("urlcode()",2000);

which runs on a click event, it runs on the click event but i get this error in firebug:
  1. urlcode is not defined


It should call this function:
  1. function urlcode(){
  2. //My code here
  3. };

But if I just call the function without the setTimeout then it runs the function. What am i doing wrong?

Thanks.