Why not just call toggleSidebar and let browser.js take care of all this for us?