fixed cordova ref and converted to module

ref was to Cordova with meant it didn't work for cordova >= 2.0
and wrapped with module to prevent window littering with the class