example with jQueryUI dialogbeforeclose trigger (better)