Compatibility with phonegap 2.0 (js and java) (Cordova) and previuos versions (in JS file)

Here's the updated pull request following phonegap plugin development specs. tested and working perflectly.