Require.js (WIP)

Opened so people can spy on me.  Please ignore random code snippets sitting in files they don't belong in (especially in notebook.js), I'll move them when I get to the correct file.
I do like this idea, since it means we don't need to import IPython everywhere.  However, I don't know how to handle this kind of scenario:

main.js requires notebook.js (which returns Notebook class)
Notebook class requires codecell.js (which returns CodeCell class)

in main.js how will I register CodeCell if notebook.js only returns Notebook?  I don't think notebook.js should return anything other than Notebook class (i.e. I think returning [Notebook, CodeCell, ...] will get messy and confusing real fast).  If I'm to do it the way you suggest, the only option I see is to unflatten the tree: i.e. you would have IPython.Notebook.CodeCell.  Is this the kind of thing you were suggesting?