/*
CustomJS LIVE, Orica
Version 1.0
*/
if (!Array.prototype.includes) {
  Object.defineProperty(Array.prototype, "includes", {
    enumerable: false,
    value: function (obj) {
      var newArr = this.filter(function (el) {
        return el == obj;
      });
      return newArr.length > 0;
    }
  });
}

if (!(IMI.CustomJS && IMI.CustomJS.customJSisLoaded)) {
  (function () {
    IMI.CustomJS = {
      customJSisLoaded: true,
      afterInterceptsLoaded: function () {
        
      },
      locks: {},
      portaltask: "",
      mods: {


        resetIntercept: function (intercept) {

					intercept.visual.type.unTriggerVisual(intercept.visual);
					if(intercept.visual.subVisual){
							intercept.visual.type.unTriggerVisual(intercept.visual.subVisual);
					}
        },
        notifyPageChange: function (...params) {
          console.log("notifyPageChange", params);

          IMI.Intercepts.forEach(function (intercept) {
            IMI.CustomJS.mods.resetIntercept(intercept);
          });

          IMI.InterceptUtil.evaluateIntercepts(IMI.Intercepts);
          //IMI.InterceptUtil.reevaluateIntercepts(true,false);
        }        
			}
		};
	})();
}
