Javascript to PhoneGap App