Mobile JS

This is a lot of changes, so I'll elaborate more in the pull request. Basically it adds all the mobile functions.