This code always works, even in different browsers:
function fooCheck() { alert(internalFoo()); // We are using internalFoo() here... return internalFoo
I have only used JavaScript a little. I am not sure if this will help, but it looks very similar to what you are talking about and may give some insight:
http://www.dustindiaz.com/javascript-function-declaration-ambiguity/