/*global URI*/
(function ($) {
  window.onPopoutClose = function (popout, callback) {
    var closeInterval = setInterval(function () {
      if (popout && (popout.closed || popout.success)) {
        callback(!!popout.success);
        popout.close();
        clearInterval(closeInterval);
      }
    }, 500);
  };
})(jQuery);
