Reformatting of the javascript to be more in line with JSLint - JSLint basically had a shouting match at me until I fixed all the issues :)

Known issue: If trying to load the contents of a directory which has a full stop in the name, the server mistakes this for a file and returns "not found" - going to have to rework that area to check for a directory of that name.