( function() {  var mapping = [{"appname":"", "appid":"REFERENCE_APPLICATIONS_FOR_PIC32CX_MCUS_OVERVIEW", "path":"GUID-81106188-B834-4A58-93EE-A23907621042.html"},{"appname":"", "appid":"REFERENCE_APPLICATIONS_FOR_PIC32CX_MCUS_RELEASE_NOTES", "path":"GUID-CDAA7B17-7940-46E4-AD86-17D2DA794C9A.html"},{"appname":"", "appid":"REFERENCE_APPLICATIONS_FOR_PIC32CX_MCUS", "path":"GUID-E32895E3-0E25-4211-8798-B154526D1974.html"},{"appname":"", "appid":"PIC32CX_SG61_CURIOSITY_ULTRA_EVALUATION_BOARD", "path":"GUID-1270986F-62B2-4A71-903B-562A909AFE48.html"},{"appname":"", "appid":"PIC32CX_SG41_CURIOSITY_ULTRA_EVALUATION_BOARD", "path":"GUID-266CBB97-46BC-450A-BD48-43B9EC986769.html"},{"appname":"", "appid":"PIC32CX_SG61_CULT_GETTING_STARTED", "path":"GUID-23CFBC57-AC59-4F7D-86B9-4289B3E3F8DE.html"},{"appname":"", "appid":"PIC32CX_SG61_CULT_BARCODE_SCANNER", "path":"GUID-38F1FCD5-C3DE-4195-BDEA-164449D9C3C4.html"},{"appname":"", "appid":"PIC32CX_SG61_CULT_SECURE_CAN_BOOTLOADER", "path":"GUID-95FE1735-6833-4CAF-9859-0403079FC8A8.html"},{"appname":"", "appid":"PIC32CX_SG61_CULT_FITNESS_TRACKER", "path":"GUID-2165A854-7FF2-4E3D-A76D-A167D4589B19.html"},{"appname":"", "appid":"PIC32CX_SG41_CULT_GETTING_STARTED", "path":"GUID-127AF9F9-91C2-46ED-B745-08F228EE0666.html"}];
            var mchp = (function (mchp) {
                var mchp = mchp || {};
                var mapping = [];
        
                mchp.utils = {};
        
                mchp.utils.getQueryParam = function (name, url = window.location.href) {
                  name = name.replace(/[\[\]]/g, "\\$&");
                  var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
                    results = regex.exec(url);
                  if (!results) return null;
                  if (!results[2]) return "";
                  return decodeURIComponent(results[2].replace(/\+/g, " "));
                };

                mchp.utils.isFirefox = typeof InstallTrigger !== 'undefined';
        
                mchp.init = function (options) {
                  mchp.mapping = options.mapping || [];
                  mchp.bindEvents();
                };
        
                mchp.bindEvents = function () {
                    if (mchp.utils.isFirefox) {
                      window.onload = mchp.checkRedirect;
                    } else {
                      document.onreadystatechange = mchp.checkRedirect;
                    }
                };

                mchp.checkRedirect = function() {
                  var contextId = mchp.utils.getQueryParam("contextId") || "";
                  if (contextId && contextId != undefined) {
                    var record = mchp.mapping.find(function(x){
                      return x.appid && x.appid.toLowerCase() == contextId.toLowerCase();
                    });
                    if (record && record.path) {
                      window.stop();
                      window.location = record.path;
                    }
                  }
                };
        
                return {
                  init: mchp.init,
                };
              })();
        
              mchp.init({
                mapping: mapping
              });

        })();