Fix #8

Added to core: support for changing buttons before dialog state change.
Added to core: set state to normal after _restore
Reworked minimization code. Now it can support iframes.