PhoneGap Support

Added some changes to support for Phonegap builds