Ref #3465: Another update on javascript popup management

http://www.rudder-project.org/redmine/issues/3465

It was still little buggy ... now it's fixed!