Cleard up all global variables and refactored some functions.
Quick bug fix.
Merge branch 'master' of https://github.com/sunrise987/javascript_chess