Let's take things one a at a time, then, rather than mixing and matching and confusing those who are trying to help you.
The value will never be null if the element exists. You should probably check
if(parent.map.document.mapForm.mode.value.length == 0)
instead.
This says that the parent to the frame with this function has a frame called map that has a form called mapForm spelled EXACTLY like that, and that form has an element named mode spelled EXACTLY like that. The error message says that doesn't exist.
Since you're reluctant to show the relevant code, that's about all I can tell you to help you.
Lee