Partial convert of the client JavaScript code into Dart (http://dartlang.org)