Fixes for jshint
Change function defs to vars

This makes the scoping clearer.
Check for own properties
Add jshint options to suppress warnings
Merge pull request #302 from wch/jshint

Fixes to make JSHint happy