window.diiOnLoad =
  window.diiOnLoad ||
  function (fn) {
    var len;
    if (document.diiDomReady == "true") {
      if (fn) {
        fn();
      } else {
        if (window.dii_on_load_functions) {
          len = window.dii_on_load_functions.length;
          for (var i = 0; i < len; i++) {
            window.dii_on_load_functions[i]();
          }
          // deletes everything in the array once its been run
          window.dii_on_load_functions = [];
        }
        window.addEventListener(
          "message",
          (event) => {
            // Do we trust the sender of this message?  (might be
            // different from what we originally opened, for example).

            if (!/\.demosphere-secure\.(com|test)/.test(event.origin)) return;
            if (event.data.status === 419) {
              console.log("show inactive pop up");
            }
          },
          false
        );
      }
    } else {
      window.dii_on_load_functions = window.dii_on_load_functions || [];
      if (fn) window.dii_on_load_functions.push(fn);
    }
  };
