A simple javascript class implementation