Fix possible js error - issue #243

require cordova to a local variable instead of access the global cordova variable