Updated to use phone gap API more in index.html