Put
alert("test");
in the if block and test the function. If you get a popup with "test" that means that on the first click the id is empty. I'm not sure what the reason of this could be. Maybe the page hasn't rendered yet completely, but there might be many other reasons possible.
Why are you doing this?
return false;
Doesn't seem necessary to me.
You could also wrap the thing in a try/catch in the catch you put an alert again to see if an exception is thrown somewhere.
What control is calling this function? How is it defined?
hope you have some ideas on how to find your problem.