add tree state saving

Add functionality for saving state of tree. You can save to cookie or URL hash