"So what happens if you call this in a function? Will it refer to the window?"
Yes, though that's a technical detail I've never tried.
"Is the document even an object?"
Yes, though notice it's a child of the window object.
"I mean if at the beginning of my page I just have anObj = this. What is anObj?"
A syntax error, probably. I don't know what you're trying to do there.
"All my errors would go away if I referred to it as window.document.frames[0] but not when I referred to it by its name, window.document.aForm."
(I'll assume you meant forms[0].) You named your form aForm. This is where we get into browser-specific terrain. You have names and id's. The differences are actually pretty obscure. The general rule is that names are not, nor required to be, unique. id's must and should always be unique. IE uses names and id's interchangably. Since this namespace covers a whole document, you have to be careful in naming.
What you should do is use an ID. I always use an id for everything important. Calling document.getElementById() always gets me the element I want. So when I want to reference an object I use:
document.getElementById('id_of_what_I_want')
This is really all about namespaces. Functions are stored directly in the global object. Methods are stored in an object, which itself is in the global object.
this refers to objects, not functions. In the DOM, everything is contained in something else. things like event handlers are owned by HTML objects, while functions are owned by the window object.
It's not a great idea to use this outside of an object (in functions) because it can be confusing. In the same way, global variables can be confusing.
Some more information at Quirksmode.