Only send panel show/hide events after the panel's document is ready.

This waits to send the initial show event until the content document is ready.
`panel.destroy();` here, not sure why it was missing before.