Phonegap support

Updated to have only relative paths, allowing for file:// style paths (e.g. phonegap) to work.

Bunch of other minor changes.