N Game Rewrite in HTML 5 and Javascript