This is code that I used for my NYU Phonegap project