common functions on main window