IE can’t decide whether it’s there or not

This time I’m messing with javascript and DOM. And guess what? First time when I try to get a specific div using document.getElementById it is null, but on subsequent times it is a valid object! Good job, IE. Now we can have several if’s checking for null so that bottom menu will appear after second call to a function, but not sooner. I’ve checked my eyes several times while debugging that and the div is there right from the beginning, it is hard-coded in html. And both Firefox and Opera get that. I don’t know, I haven’t coded much javascript, barely none and some css but I could have spent so many hours on something else than fixing it and some other things for IE.
Edit: my fault, it hadn’t been rendered yet. *Tries to remember to put such function calls in body onload property.*