Added confirmation dialog on page unload to allow people to cancel an unintentional attempt to leave the page and thus loose their work. It is enabled in optimized builds only to avoid hampering debugging.