changed doc tool to YUIDoc, rewrote documentation, relocated some files and improved scoping of some variables.