/*
CustomJS PROD
Version 1.1
*/
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() {
        //console.log('running CustomJS afterInterceptsLoaded');
      },
      'mods': {
        isLocalStorageAvailable: function isLocalStorageAvailable() {
          var test = 'im_test_ls';
          try {
            localStorage.setItem(test, test);
            localStorage.removeItem(test);
            return true;
          } catch (e) {
            return false;
          }
        },
        getPassthroughParam: function(key) {
          //console.log('get passthrough param: ' + key);
          //console.log(localStorage.getItem(key));
          if (IMI.CustomJS.mods.isLocalStorageAvailable()) {
            var value = localStorage.getItem(key);
                        
            if (value !== null) {
              return value;
            } else {
              return key + ' not set';
            }
          } else {
            return 'localStorage not available';
          }
        },
      }
    }
  })();
}