added gruntfile to build distribution and phonegap apps. Several
code fixes from JSHint, start of Karma unit tests