Fixed a small syntax error
Added more comments. Some comments are still missing.

Minor changes to the code.
- I changed multiple if-statements to a switch-statement
- I also merged multiple if(!GUI.loaded) parts. Since there is no threading in WebArena and the GUI.loaded variable isn't set in any of the called methods.