[jQuery] JS strangeness

[jQuery] JS strangeness


I posted a message on comp.lang.javascript asking a simple question
and got dumped on, so I'll try again here.
I have a large PHP file that includes various jQuery pieces, including
a $(document).ready() function. My problem is that it behaves
inconsistently under Firefox, and I'm trying to get pointed in the
right direction. If I run it locally under FF, it behaves the way I
expect it to, but if I run it from the host site, it sometimes gets
hung up. Specifically, when the $(document).ready() function runs, I
sometimes get a Firebug message saying that a reference to a local
variable is undefined, which apparently aborts the entire .ready()
function and leaves the page in a hung state. Specifically, I
reference a local variable called 'calimg'. This is defined in an
inline script positioned before the .ready() function in the file,
which says something like 'var calimg = "<URL of an image file>";'
When I look at the source online, the declaration and assignment are
there, as I would expect them to be, but Firebug says that 'calimg' is
undefined (it actually says that its value is null). Why does this
happen, and what can I do about it?