implemented tree open/close

TODO: change the click event to OO design.