Smart Javascript Objects