better handling the JS modal window event binding