Expand and Collapse buttons function.

Implements expand all button and collapse all buttons