Fixed JavaScript errors on loading screens

I've added checks to see if functions exist before attempting to run them on loading screens. This prevents the errors from being logged in the console while joining a server.
![JSerrors](http://samuelmaddock.com/up/2013-06-23_16-47-32.png)