OO javascript

see inline comments