{"trackingEventsBlock":{"id":"28bac2ec-5bc0-4dfc-9064-7d1f6cb8d776","createdAt":"2019-03-12T15:09:52.003Z","updatedAt":"2026-07-27T13:49:17.015Z","company":"dbe86aab-25ca-4793-b6b8-914b4d0b987f","aiSearchScripts":null,"pageViewScripts":"<!-- Google Tag Manager (noscript) -->\n\n<noscript><iframe src=\"https://www.googletagmanager.com/ns.html?id=GTM-PTB42KQ\"\nheight=\"0\" width=\"0\" style=\"display:none;visibility:hidden\"></iframe></noscript>\n<!-- End Google Tag Manager (noscript) -->\n\n<!-- BEGIN Testing Institute Masthead script -->\n<script src=\"https://haymarket-static.s3.amazonaws.com/LMS/prod/js/masthead_institute.js\"></script>\n<!-- END Testing Institute Masthead serving js from S3 bucket -->\n\n<!-- PVS ------------------------ SET CHILD DIV HEIGHT 0 FOR EMPTY PRUCHASE DIV ---- -->\n<script>\n  function noChildSetHeight() {\n    //console.log(\"%c RUN CHILD DETECT FUNCTION!\", \"color: purple\");\n    var parentDiv = document.querySelector('.widget--html_standard');\n    if (parentDiv.hasChildNodes() && parentDiv.firstChild.tagName === 'div') {\n      //console.log(\"The parent div has a child div!\");\n    } else {\n      parentDiv.classList.add('no--child--div');\n      //console.log(\"The parent div does not have a child div.\");\n    } \n  }\n  \n  //const getUrl = '{{url}}';\n  if ('{{url}}'.indexOf(\".com/collections\") > 1 ) {\n    setTimeout(noChildSetHeight, 900);\n  }\n</script>\n\n<!-- OneTrust Reload Banner Script -->\n<script>\n    function getCookie(name) {\n        var value = \"; \" + document.cookie;\n        var parts = value.split(\"; \" + name + \"=\");\n        if (parts.length == 2) {\n            return true;\n        }\n    }\n\n    function reloadOTBanner() {\n        var otConsentSdk = document.getElementById(\"onetrust-consent-sdk\");\n        if (otConsentSdk) {\n            otConsentSdk.remove();\n        }\n\n        if (window.OneTrust != null) {\n            OneTrust.Init();\n\n            setTimeout(function() {\n                OneTrust.LoadBanner();\n\n                var toggleDisplay = document.getElementsByClassName(\n                    \"ot-sdk-show-settings\"\n                );\n\n                for (var i = 0; i < toggleDisplay.length; i++) {\n                    toggleDisplay[i].onclick = function(event) {\n                        event.stopImmediatePropagation();\n                        window.OneTrust.ToggleInfoDisplay();\n                    };\n                }\n            }, 1000);\n        }\n    }\n    \n    reloadOTBanner();\n</script>\n\n\n<!-- END OneTrust Reload Banner Script -->\n\n<!-- PVS ------------- DETECT SEARCH BAR ------------------- -->\n<script>\n// Check if search bar exists and adjust layout accordingly\n  function checkForSearchBar() {\n  const navSearchExists = document.querySelector('.nav--search');\n  const getMobileNav = document.querySelector('#mobile__Nav');\n  const mqsrh = matchMedia('(max-width: 928px)');\n  const homeContent = document.querySelector('.home__content');\n  const mobileNavSpan = document.querySelector('.mobileNav'); //used to detect search when mobile nav is open\n  const mobileNav = document.querySelector('.mqNav');\n    if (navSearchExists) {\n      mobileNavSpan.classList.add('searchDetected');\n      mobileNav.classList.add('searchExist');\n      homeContent.classList.add('withSearch');\n      if (mqsrh.matches) { // mobile view\n        homeContent.style.marginTop = '154px';\n        navSearchExists.style.marginTop = '0px';\n      } else { // non-mobile view\n        homeContent.classList.add('set--top');\n        navSearchExists.classList.add('set--top-search');\n      }\n    } else {\n      homeContent.classList.remove('set--top');\n      mobileNav.classList.remove('searchExist');\n      mobileNavSpan.classList.remove('searchDetected');\n    }\n }\n\n // Wait for DOM elements to load and then check for search bar\n setTimeout(checkForSearchBar, 2900);\n\n // Also check on resize\n window.addEventListener('resize', checkForSearchBar);\n</script>\n\n<!-- PVS ------------------------ SCROLL TO TOP --------------------- -->\n<script>\n  // Function to scroll to the top of the page\n  function scrollToTop() {\n      document.body.scrollTop = 0; // For Safari\n      document.documentElement.scrollTop = 0; // For Chrome, Firefox, IE, and Opera\n  }\n  \n  scrollToTop();\n</script>\n\n<script>\n//pageView Alt test to track and compare pageView push to the dataLayer\n  //dataLayer.push({\n    //'event': 'firePageviewAlt'\n  //}); // A test from Allistar to send alternative PageViews to compagre with pageview firing numbers\n  //console.log(\"%c ::::ALT PAGE VIEW FIRED::::\", \"color: teal\");\n</script>\n\n<script>\n  \n</script>\n\n<script language=\"javascript\">\n  // platformq\n  var pqattempt = 0;\n  var pqattemptLimit = 40;\n  var pqinterval = 250;\n\n  function waitForPlatformQ() {\n    pqattempt++;\n    \n    // check for the platformq container element in the DOM\n    if (document.querySelector(\"div.topic__content div.ember-view div.pq-embed\") !== null) {\n      console.log(\"platformq div found\");\n\n      pqEmbed.init({\n        email: '{{email}}',\n        firstName: '{{firstName}}',\n        lastName: '{{lastName}}',\n        degree: '{{ref1}}',\n        specialty: '{{ref3}}',\n        refCode: 'PAR_myCME_CLLBTK_Embed',\n        disclosure: '081420_OML_BTK_CME_Disclosure'\n      });\n    }else{\n      console.log(\"waiting for platformq div on page\");\n      if (pqattempt <= pqattemptLimit) {\n        setTimeout(waitForPlatformQ, pqinterval);\n      }else{\n        console.log(\"giving up on platformq, not on page after \" + (pqattemptLimit * pqinterval / 1000 ) + \" seconds\" );\n      }\n    }\n  }\n\n\n  // dynamically include the platformq js file on specific pages only\n  if(window.location.href.indexOf(\"/learn/course/\") > -1 \n    && (window.location.href.indexOf(\"/content\") > -1 || window.location.href.indexOf(\"/lesson\") > -1) ){\n    waitForPlatformQ();\n  }\n  \n</script>\n\n<script>\n//Open Graph TAG ( OpenGraph ) in GTM  depends on this trigger\nfunction runOG() {\n    window.dataLayer.push({\"event\": \"ogTrigger\"});\n    //console.log(\"%c OG ran\", \"color: blue\");\n}\n\nsetTimeout(runOG, 1300);\n</script>\n\n<script>\n  function pushMetaTags() {\n    var metaTitle = document.getElementsByTagName('title')[0].text;\n    var metaDescr = document.getElementsByName('description')[0].getAttribute('content');\n    dataLayer.push({ 'Course.Title': metaTitle });\n    dataLayer.push({ 'Course.Description': metaDescr });\n    console.log(\"Meta Pushed\");\n  }\nsetTimeout(pushMetaTags, 1200);\n</script>\n  \n<script>\nfunction userIdFunction() {\n    // generated from userid.js --- compiled via https://babeljs.io/repl#?browsers=ie%2011%2C%20ie_mob%2011&build=&builtIns=false&spec=false&loose=false&code_lz=Q&debug=false&forceAllTransforms=false&shippedProposals=false&circleciRepo=&evaluate=false&fileSize=false&timeTravel=false&sourceType=module&lineWrap=true&presets=env%2Creact%2Cstage-2%2Cenv&prettier=false&targets=&version=7.10.2&externalPlugins=\n    function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\n\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\n\nvar loginDomain = window.location.host.match(/www\\./i) ? \"my.mycme.com\" : \"stagemy.mycme.com\";\nvar ssoDomain = window.location.host.match(/www\\./i) ? \"accounts.haymarketmedia.com\" : \"staging.accounts.haymarketmedia.com\";\nvar subapiDomain = window.location.host.match(/www\\./i) ? \"webapi.haymarketmedia.com\" : \"staging.webapi.haymarketmedia.com\";\n\nfunction fieldComplete(userData, fieldName) {\n  var isComplete = typeof userData[fieldName] !== \"undefined\" && userData[fieldName] !== null && userData[fieldName] !== '';\n  console.log(\"is field \" + fieldName + \" complete?:\" + isComplete);\n  return isComplete;\n}\n\nfunction userDataComplete(userData) {\n  var isComplete = true;\n\n  if (!fieldComplete(userData, 'User.Profession')) {\n    return false;\n  }\n\n  if (!fieldComplete(userData, 'User.Specialty')) {\n    return false;\n  }\n\n  console.log(\"is user data complete?:\" + isComplete);\n  return isComplete;\n}\n\nfunction waitForVariable(key, callback) {\n  if (window[key]) {\n    callback();\n  } else {\n    setTimeout(function () {\n      waitForVariable(key, callback);\n    }, 100);\n  }\n}\n\n_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {\n  var idSource, userData, search, userNid, response, subApiResponse;\n  return regeneratorRuntime.wrap(function _callee$(_context) {\n    while (1) {\n      switch (_context.prev = _context.next) {\n        case 0:\n          userData = {\n            'User.IsLoggedIn': false\n          };\n\n          if ('{{userId}}' !== '') {\n            console.log(\"visitor is logged in\");\n            idSource = \"LoggedIn\";\n            userData['User.IsLoggedIn'] = true;\n            userData['User.Id'] = '{{userId}}';\n            userData['User.Profession'] = '{{ref1}}';\n            userData['User.Specialty'] = '{{ref3}}';\n          }\n\n          if (userDataComplete(userData)) {\n            _context.next = 19;\n            break;\n          }\n\n          console.log(\"looking for email tracking\");\n          search = new URLSearchParams(window.location.search);\n\n          if (!(search.has(\"hmSubId\") && search.get(\"hmSubId\").length > 0 || search.has(\"hmEmail\") && search.get(\"hmEmail\").length > 0 || search.has(\"NID\") && search.get(\"NID\").length > 0)) {\n            _context.next = 19;\n            break;\n          }\n\n          console.log(\"found email tracking\");\n          idSource = \"Email\";\n          userNid = search.get(\"NID\"); //if (userNid) { userData['User.NpiNum'] = userNid }\n\n          _context.prev = 9;\n          _context.next = 12;\n          return axios({\n            url: 'https://' + subapiDomain + '/subscriber/lite?id=' + search.get(\"hmSubId\") + '&hmemail=' + search.get(\"hmEmail\") + '&publicationId=10',\n            timeout: 2500\n          });\n\n        case 12:\n          response = _context.sent;\n          _context.next = 18;\n          break;\n\n        case 15:\n          _context.prev = 15;\n          _context.t0 = _context[\"catch\"](9);\n          console.log(_context.t0);\n\n        case 18:\n          if (typeof response !== \"undefined\" && typeof response.data.subscriber !== \"undefined\") {\n            console.log('found in subscriber database');\n\n            if (typeof response.data.medicalData !== \"undefined\" && response.data.medicalData !== null) {\n              if (typeof response.data.medicalData.profession !== \"undefined\" && response.data.medicalData.profession !== null) {\n                if (!fieldComplete(userData, \"User.Profession\")) {\n                  userData['User.Profession'] = response.data.medicalData.profession.name;\n                }\n              }\n\n              if (typeof response.data.medicalData.specialty !== \"undefined\" && response.data.medicalData.specialty !== null) {\n                if (!fieldComplete(userData, \"User.Specialty\")) {\n                  userData['User.Specialty'] = response.data.medicalData.specialty.name;\n                }\n              }\n            }\n          }\n\n        case 19:\n          if (userDataComplete(userData)) {\n            _context.next = 54;\n            break;\n          }\n\n          console.log(\"looking for sso\");\n          _context.prev = 21;\n          _context.next = 24;\n          return axios({\n            url: 'https://' + loginDomain + '/sso/check?gn=101',\n            timeout: 2500\n          });\n\n        case 24:\n          ssoResponse = _context.sent;\n          _context.next = 30;\n          break;\n\n        case 27:\n          _context.prev = 27;\n          _context.t1 = _context[\"catch\"](21);\n          console.log(_context.t1);\n\n        case 30:\n          if (!(typeof ssoResponse === \"undefined\" || typeof ssoResponse !== \"undefined\" && (typeof ssoResponse.data === \"undefined\" || ssoResponse.data === null) || typeof ssoResponse !== \"undefined\" && typeof ssoResponse.data !== \"undefined\" && (typeof ssoResponse.data.HashedSubscriberId === \"undefined\" || ssoResponse.data.HashedSubscriberId === null))) {\n            _context.next = 40;\n            break;\n          }\n\n          _context.prev = 31;\n          _context.next = 34;\n          return axios({\n            url: 'https://' + ssoDomain + '/sso/check?gn=101',\n            timeout: 2500\n          });\n\n        case 34:\n          ssoResponse = _context.sent;\n          _context.next = 40;\n          break;\n\n        case 37:\n          _context.prev = 37;\n          _context.t2 = _context[\"catch\"](31);\n          console.log(_context.t2);\n\n        case 40:\n          if (!(typeof ssoResponse !== \"undefined\" && typeof ssoResponse.data !== \"undefined\" && ssoResponse.data !== null && typeof ssoResponse.data.HashedSubscriberId !== \"undefined\" && ssoResponse.data.HashedSubscriberId !== null)) {\n            _context.next = 54;\n            break;\n          }\n\n          console.log(\"found SSO\");\n          idSource = \"SSO\";\n          _context.prev = 43;\n          console.log(\"calling subscriber api\");\n          _context.next = 47;\n          return axios({\n            url: \"https://\" + subapiDomain + \"/subscriber/lite?id=\" + encodeURIComnponent(ssoResponse.data.HashedSubscriberId),\n            timeout: 2500\n          });\n\n        case 47:\n          subApiResponse = _context.sent;\n          _context.next = 53;\n          break;\n\n        case 50:\n          _context.prev = 50;\n          _context.t3 = _context[\"catch\"](43);\n          console.log(_context.t3);\n\n        case 53:\n          if (typeof subApiResponse.data.medicalData !== \"undefined\" && subApiResponse.data.medicalData !== null) {\n            if (typeof subApiResponse.data.medicalData.profession !== \"undefined\" && subApiResponse.data.medicalData.profession !== null) {\n              if (!fieldComplete(userData, \"User.Profession\")) {\n                userData['User.Profession'] = subApiResponse.data.medicalData.profession.name;\n              }\n            }\n\n            if (typeof subApiResponse.data.medicalData.specialty !== \"undefined\" && subApiResponse.data.medicalData.specialty !== null) {\n              if (!fieldComplete(userData, \"User.Specialty\")) {\n                userData['User.Specialty'] = subApiResponse.data.medicalData.specialty.name;\n              }\n            }\n          }\n\n        case 54:\n          if (!fieldComplete(userData, 'User.Id')) {\n            userData['User.Id'] = '';\n          }\n\n          if (fieldComplete(userData, 'User.Id')) {\n            dataLayer.push({\n              'User.Id': userData['User.Id']\n            });\n          }\n\n          if (fieldComplete(userData, 'User.IsLoggedIn')) {\n            dataLayer.push({\n              'User.IsLoggedIn': userData['User.IsLoggedIn']\n            });\n          }\n\n          if (fieldComplete(userData, 'User.Profession')) {\n            dataLayer.push({\n              'User.Profession': userData['User.Profession']\n            });\n          }\n\n          if (fieldComplete(userData, 'User.Specialty')) {\n            dataLayer.push({\n              'User.Specialty': userData['User.Specialty']\n            });\n          }\n\n          dataLayer.push({\n            'event': 'firePageview'\n          }); //* JF-20190708: This must always be the last dataLayer.push statement to correctly retrieve variables before firing the pageview in GTM */\n\n        case 60:\n        case \"end\":\n          return _context.stop();\n      }\n    }\n  }, _callee, null, [[9, 15], [21, 27], [31, 37], [43, 50]]);\n}))();\n}\n\nsetTimeout(userIdFunction, 900);\n</script>\n\n<!-- PVS ------- myCME APP UPLOAD CERTIFICATION MESSAGE ------ -->\n<script>\n\n  // Function to check if the \"buttonA_clicked\" cookie exists\n  function checkButtonACookie() {\n    var cookies = document.cookie.split(';');\n    for (var i = 0; i < cookies.length; i++) {\n      var cookie = cookies[i].trim();\n      if ( cookie.indexOf('msg_Closed_Ok_Clicked=') === 0) {\n        return true; // Cookie exists\n        //console.log(\":::::: Cookie exists\");\n      }\n    }\n    return false; // Cookie does not exist\n    //console.log(\":::::: Cookie does not exists\");\n  }\n\n  function uploadCertsMobileMessage() {\n    // Create overlaying background\n    const certBgOverlay = document.createElement('div');\n    \n    //Add class to Troposphere background\n    certBgOverlay.classList.add('troposphere-bg');\n    \n    // Create a div element for the popup message\n    const certPopup = document.createElement('div');\n\n    // Add class 'troposphere-atmo' to the popup message\n    certPopup.classList.add('troposphere-atmo');\n\n    // Set the innerHTML of the popup message with Atmo message\n    certPopup.innerHTML = 'myCME stores image data to enable the saving of CME credit certificates earned outside the app. Images are only stored when you select them to be added to the app, and they are not used for any data mining or sent to any 3rd party services.';\n    \n    //Create Close button\n    const certCloseBtn = document.createElement('span');\n    \n    // Set the innerHTML of the X closed with Atmo message\n    certCloseBtn.innerHTML = 'X';\n    \n    // Add class 'troposphere-atmo' to the popup message\n    certCloseBtn.classList.add('troposphere-atmo-close');\n    \n    // Create button element for the popup message\n    const okClosed = document.createElement('button');\n    \n    // Set the innerHTML of the OK button with Atmo message\n    okClosed.innerHTML = 'Ok';\n    \n    // Append the popup message to the document body\n    document.body.appendChild(certBgOverlay);\n    document.body.appendChild(certPopup);\n    certPopup.appendChild(certCloseBtn);\n    certPopup.appendChild(okClosed);\n    \n    certPopup.classList.add('fadeInDown');\n    setTimeout(() => {\n        certPopup.classList.add('show');\n        //Scroll to Dashboard Cert Button - to keep everything in view\n        const targetElement = document.querySelector('.dashboard-access-tab'); //New\n        targetElement.scrollIntoView({ behavior: 'auto', block: 'start' }); //New\n        //window.scrollTo({ top: 0, behavior: 'smooth' });//New\n    }, 100); // Adding a small delay for better visual effect\n    \n  } \n  \n  function closeUploadMsg(event) {\n     \n      const closeUploadMsg = document.querySelector('.troposphere-atmo');\n      const removeMsgBg = document.querySelector('.troposphere-bg');//New\n      closeUploadMsg.classList.add('fadeOut');\n      removeMsgBg.classList.add('fadeOut');//New\n      setTimeout(() => {\n          closeUploadMsg.classList.add('hide');\n          removeMsgBg.classList.add('hide');\n          setTimeout(() => {\n              closeUploadMsg.remove(); // Remove the element from the DOM after fade-out animation\n              removeMsgBg.remove(); //New\n          }, 500); // Wait for the animation duration\n      }, 100); // Adding a small delay for better visual effect\n\n      if (event.target.closest('.troposphere-atmo button')) {\n        // Insert cookie if buttonA is clicked\n        document.cookie = \"msg_Closed_Ok_Clicked=true; expires=Fri, 31 Dec 9999 23:59:59 GMT\";\n      }\n  }\n  function mustClose() {\n    const checkCertMessage = document.querySelector('.troposphere-atmo');\n    if (checkCertMessage) {\n      checkCertMessage.querySelector('button').addEventListener('click', closeUploadMsg);\n      checkCertMessage.querySelector('span').addEventListener('click', closeUploadMsg);\n    } else {\n      //\n    }\n  }\n  \n  if (navigator.userAgent.indexOf(\"Troposphere\") !== -1) { \n    if ( window.location.href.indexOf(\".mycme.com/learn/dashboard\") !== -1 ) {\n      // Define the callback function for the observer\n      const observerCallback = function(mutationsList, observer) {\n          for(let mutation of mutationsList) {\n              if (mutation.type === 'childList') {\n                if (!checkButtonACookie()) {  \n                  const uploadBtn = document.querySelector('.dashboard-access-list-item:last-of-type button.btn--medium');\n                  if (uploadBtn) {\n                    // Attach click event listener to the upload button\n                    uploadBtn.addEventListener('click', uploadCertsMobileMessage);\n                    setTimeout(mustClose, 300);\n                    // Disconnect the observer if upload buttons are found\n                    if (uploadBtn.length > 0) {\n                        observer.disconnect();\n                    }\n                  }\n                }\n              }\n          }\n      };\n      \n      // Create a MutationObserver instance\n      const observer = new MutationObserver(observerCallback);\n      \n      // Start observing the target node for changes\n      observer.observe(document.body, { childList: true, subtree: true });\n    }\n  }\n</script>\n\n<!-- PVS ------------------------------------------------------------------ -->\n<script>\n\n    // Replace Serach Bar widget placeholder text\n    //$('.search-bar-widget input').attr('placeholder', 'Search All myCME'); //Individual Search Widget Placeholder text  \n\n    ////////////////////////////////////////////\n\n    var userLoggedIn = '{{userId}}';\n    var signInDiv = document.getElementById(\"signInLink\");\n    var returnTo,\n        userAccount;\n\n  // we have to do this because TI pass us the url HTML encoded\n  // if we find more chars to replace, then look for a library\n  function encodeUrl(url){\n    // decode HTML entities in the url first\n    var theurl = url.replace(/amp;/gi,\"\");\n    // now it's safe to URL encode\n    return encodeURIComponent(theurl);\n  }\n  \n  //+++ HIDE SIGN IN DIV WHEN USE IS LOGGED IN ++++\n  //console.log(\"BLUE\");\n /*if(signInDiv) {\n   signInDiv.classList.add(\"logged\");\n  if (userLoggedIn.length === 0) {\n    signInDiv.style.display = \"block\";\n    //console.log(\"IS NOT LOGGED IN\");\n   }\n   else{\n     signInDiv.style.display = \"none\";\n     //console.log(\"IS LOGGED - IN\");\n   };\n }*/\n \n function loginBtnStat() {\n    var signInDivP = document.querySelector('p#signInLink');\n    if(!userLoggedIn){\n      if(signInDivP){\n        signInDivP.classList.add('not-loggedIn');\n      }\n    } else {\n      if(signInDivP){\n        signInDivP.classList.remove('not-loggedIn');\n      }\n    }\n  }\n    \n  setTimeout(loginBtnStat, 400);\n   \n\n  \n  $(document).ready( function() {\n    //Get screen width for mobile and adjust margin-top to sit below fixed purchase buttons \n      var mq = window.matchMedia(' screen and (min-width: 40em) ');\n      var purchaseWidget = $('.widget--course-purchase_standard');\n      var headerMicrosite = $('.header.header--microsite');\n      var inPage = $('.home__content');\n      var isMobile = false;\n      \n      //Needed for the App ( Atmo )\n      if (navigator.userAgent.indexOf(\"Troposphere\") !== -1) { \n        inPage.css('margin-top', 0 );\n      } else {\n        inPage.css('margin-top', (headerMicrosite.height() + 16 ));\n      }\n      \n      if(purchaseWidget.css(\"position\") == \"fixed\"  ) {\n        if (navigator.userAgent.indexOf(\"Troposphere\") !== -1) {\n          inPage.css(\"margin-top\", (purchaseWidget.height() - 18));\n        } else {\n          inPage.css(\"margin-top\", (purchaseWidget.height() + 96));\n        }\n      }\n\n      mq.addListener(function(changed) {\n      if (mq.matches ) {\n        inPage.removeClass( \"mobile\" );\n        inPage.css(\"margin-top\", \"96px\");\n      } else {\n        inPage.addClass( \"mobile\" );\n        //inPage.css(\"margin-top\", (purchaseWidget.height() + 96));\n      }\n    });\n     \n        \n    var replaceDashboardLink = document.getElementById('dashboard-header-dropdown');//.getElementsByTagName(\"li\")[0];\n    if(replaceDashboardLink) {\n      replaceDashboardLink.getElementsByTagName(\"li\")[0].getElementsByTagName(\"a\")[0].setAttribute('href', userAccount);\n    }\n    \n    if ( window.location.href.indexOf(\"mycme.com/courses/\") > -1 ) {\n      checkPurchaseStart();\n    }\n    //adjust marging top of content when Start Activity Widget is in place\n    function checkPurchaseStart() {\n      if( $('.widget--course-purchase').length > -1 ) {\n        //console.log( \"HEIGHT OF START BTN IS : \" + $('.widget--course-purchase').height() );\n        inPage.css(\"margin-top\", ( $('.widget--course-purchase').height() + 72) );\n      } \n    }\n    \n    //reset for myCME Live Right rail. Code is in GTM ( Live-Detail- )\n    function isitLive() {\n      if ( $('.myCME--Live').length > 0 ) {\n         inPage.css(\"margin-top\", ( $('.myCME--Live .widget--html_standard').height() + 0));\n       } else if ( inPage.css(\"margin-top\", (purchaseWidget.height() + 96) ) ) {\n          //\n       }\n    }\n    \n    function detectmob() {\n      var getWindowWidth = document.documentElement.clientWidth;\n      //console.log(\"Width is : \" +  getWindowWidth);\n       if(getWindowWidth < 929 /*&& window.innerHeight <= 800*/) {\n\n         isMobile = true;\n         //console.log(\"%c IS MOBILE\", \"background-color: blue; color: white;\");\n         //isitLive();\n          setTimeout(waitforHamburger, 500); //Function can be found in [ Footer Scripts ] area\n         return true;\n\n       } else {\n         isMobile = false;\n         //console.log(\"IS NOTTTTTT MOBILE\");\n          return false;\n       }\n       \n    }\n\n    detectmob();\n    window.addEventListener('resize', detectmob);\n    \n\n  //Link out Course Loading ... code\n  function waitForAssignmentExternalActivityLinks() {\n    var selector = document.querySelector(\".assignment__content button.btn\");\n    var selectParent = document.querySelector(\".assignment__content\");\n    if (selector !== null && selector.innerText === \"Take me to the course\" && !selectParent.classList.contains(\"processed\") ) {\n      selector.click();\n      selectParent.classList.add(\"processed\");\n      selector.innerHTML = \"Course loading…\";\n    }\n  }\n  setTimeout(waitForAssignmentExternalActivityLinks, 500);\n  \n  // Start : add returnTo to sign In button //\n    var observer = new IntersectionObserver((entries, observer) => {\n    entries.forEach(entry => {\n        if ( entry.isIntersecting && entry.target ) {\n            var encodeUri = encodeURIComponent(window.location.href);\n            var getSignInTags = entry.target.getElementsByTagName(\"a\")[0];\n            getSignInTags.setAttribute(\"href\", getSignInTags + \"?returnTo=\" + encodeUri);\n            observer.unobserve( entry.target );\n        }\n    });\n    }, { rootMargin: '0px',threshold: 1.0});\n\n    //renamed var element to signInLink to avoid global clash\n    var signInLink = document.querySelector('#signInLink')\n    observer.observe(signInLink);\n    // End : add returnTo to sign In button //\n\n    function checkMenuWrap() {\n    const getHomecontent = document.querySelector(\".home__content\");\n    if ( document.documentElement.clientWidth < 1270 ) {\n        getHomecontent.classList.add(\"menuWrap\");\n    }\n    else {\n      getHomecontent.classList.remove(\"menuWrap\");\n    }\n  }\n/*\n  let windowWidth = window.innerWidth;\n  const findSearchBar = document.querySelector(\".nav--search\");\n  //console.log(\"%c Window Width IS : \" + windowWidth, \"color: orange\");\n    \n    const body = document.getElementsByTagName(\"body\")[0];\n    let resizeObserver = new ResizeObserver(() => {\n      const getBody = document.querySelector(\"body\");\n      const findNav = document.querySelector(\"#utilityWrapper\");\n      //const checkSrch =  document.querySelector(\".nav--search\");\n      const mqm = window.matchMedia(' screen and (min-width: 929px) and (max-width: 1270px) ');\n      //console.log(\"mqm is : \" + mqm.matches);\n      if ( findSearchBar && mqm.matches) {\n        findNav.classList.add(\"srchExist\");\n      } else if(!findSearchBar && mqm.matches) {\n          checkMenuWrap();\n      } else {\n        findNav.classList.remove(\"srchExist\");\n        checkMenuWrap();\n      }\n      //function is in Header Scripts line\n      setTimeout(checkForSearchBar, 400);\n    });\n    \n    resizeObserver.observe(body);\n*/\n\n//+++++++++++++++++  Check for search Bar and adjust if Menu is wrapped using Observer ++++++++++++++++//\n  let windowWidth = window.innerWidth;\n  const body = document.getElementsByTagName(\"body\")[0];\n  let resizeObserver = new ResizeObserver(() => {\n    \n    const getHomecontent = document.querySelector(\".home__content\");\n    const findSearchBar = document.querySelector(\".container .layout__content .nav--search\");\n    const findNav = document.querySelector(\"#utilityWrapper\");\n    const mqm = window.matchMedia(' screen and (min-width: 929px) and (max-width: 1350px) ');\n    const getUtilityWrapper = document.querySelector('.myCME__brandHeader #utilityWrapper');\n    const elementKissHeight = getUtilityWrapper.getBoundingClientRect().height; \n    const searchLeft = document.querySelector('#lms .nav--search .search-bar-widget');    \n    \n    if (findSearchBar) {\n      // get the zoom level\n      //const zoomLevel = window.innerWidth / screen.width;\n      //console.log(`Zoom level IS: ${zoomLevel}`);\n          \n      if ( (findSearchBar && mqm.matches) || elementKissHeight > \"96\") {\n        findNav.classList.add(\"srchExist\");\n        searchLeft.classList.add(\"menuWrap\");\n      } else if(!findSearchBar && mqm.matches) {\n        findNav.classList.add(\"srchExist\");\n        getHomecontent.classList.add(\"menuWrap\");\n      } else if ( elementKissHeight < \"96\" ) {\n        searchLeft.classList.remove(\"menuWrap\");\n        findNav.classList.remove(\"srchExist\");\n        getHomecontent.classList.remove(\"menuWrap\");\n      }\n    }\n      //function is in Header Scripts\n      setTimeout(checkForSearchBar, 900);\n  });\n\n  resizeObserver.observe(body); \n  //+++++++++++++++++  END Check for search Bar and adjust if Menu is wrapped using Observer ++++++++++++++++//\n  \n});\n  \n  //Check Out Back Button\n  function checkoutReturnToBackLink() {\n   var slug = returnTo;\n   return slug.replace('https%3A%2F%2Fmycme.com%2F', \"\");\n  } \n\n  function waitForCheckOut() {\n    if ($('#checkoutBackLink').length === 0 && $('.header--checkout .header__title').length >= 1) {\n      var backLink = '<a id=\"checkoutBackLink\"  href=\"'+checkoutReturnToBackLink()+'\">Back to Previous Page</a>';\n      // Add the course overview URL to the course title\n      $(\".header--checkout .header__title\").addClass('hasCheckoutBackLink').append(backLink);\n    }\n    \n    setTimeout(waitForCheckOut, 200);\n  }\n\n  waitForCheckOut();\n</script>\n\n<!-- Console Logging Variables -->\n<script>\n  \n  function consoleLogings(passVal, logColor) {\n    var getEmail = '{{email}}';\n    if ( getEmail === \"user02@test.com\" ) {\n      console.log(\"%c \" + passVal, \"color:\" + logColor);\n    }\n  }\n</script>\n\n<script>\n\n  function grabCourseDetails() {\n    //Grab Course Image\n    var getCourseImage = document.querySelector(\".course__detail__asset picture img\");\n    var courseImage = getCourseImage.srcset;\n    \n    //console.log(\"%c image URL is : \" + courseImage, \"color: orange\");\n    \n    window.dataLayer.push({\"Course.Image\": courseImage});\n    window.dataLayer.push({\"event\": 'courseDetail'});\n\n  }\n  \n  function grabCourseLive() {\n    console.log(\"%c THIS IS A LIVE COURSE : \", \"background: black; color: yellow\");\n    //Grab Live Course Image\n    var getCourseImage = document.querySelector(\".course__detail__asset picture img\");\n    var courseImage = getCourseImage.srcset;\n        \n    window.dataLayer.push({\"Course.Image\": courseImage});\n\n    //Grab Live Event Date\n    var getLiveDate = document.querySelector(\".overviewFormatLive .live_date\");\n    var timeZones = getLiveDate.dataset.timeZone === \"EST\" ? \"-05:00\" : \n                    getLiveDate.dataset.timeZone === \"CST\" ? \"-06:00\" :\n                    getLiveDate.dataset.timeZone === \"MST\" ? \"-07:00\" : \n                    getLiveDate.dataset.timeZone === \"PST\" ? \"-08:00\" : \"-05:00\";\n    var liveStartDate = getLiveDate.dataset.dateStart + \"T\" + getLiveDate.dataset.timeStart + timeZones;\n    var liveEndDate = getLiveDate.dataset.dateEnd + \"T\" + getLiveDate.dataset.timeEnd + timeZones;\n    if (liveStartDate !== null && liveEndDate !== null ) {\n      window.dataLayer.push({\"Live.StartDate\": liveStartDate});\n      window.dataLayer.push({\"Live.EndDate\": liveEndDate});\n      //console.log(\"%c Start Time : \" + liveStartDate, \"color: blue\");\n      //console.log(\"%c End Time : \" + liveEndDate, \"color: blue\");\n    }\n    \n    //Grab Live Event Location\n    var getLiveLocation = document.querySelector(\".overviewFormatLive .live_location \");\n    var liveLocation;\n    var liveLocationUrl;\n    if ( getLiveLocation !== null ) {\n      liveLocation = getLiveLocation.dataset.location ? getLiveLocation.dataset.location : \"VirtualLocation\" ;\n      liveLocationUrl = getLiveLocation.dataset.locationUrl;\n      if ( liveLocation === \"Place\" ) {\n        liveLocationUrl = getLiveLocation.dataset.locationUrl;\n        var liveLocatioName = getLiveLocation.dataset.locationName;\n        var liveLocatioAddress = getLiveLocation.dataset.locationAddress;\n        var liveLocatioCity = getLiveLocation.dataset.locationCity;\n        var liveLocatioState = getLiveLocation.dataset.locationState;\n        var liveLocatioZip = getLiveLocation.dataset.locationZip;\n        var liveLocatioCountry = getLiveLocation.dataset.locationCountry;\n        /*\n        console.log(\"%c Location : \" + liveLocation, \"color: orange\");\n        console.log(\"%c Location URL : \" + liveLocationUrl, \"color: brown\");\n        console.log(\"%c Location Name : \" + liveLocatioName, \"color: brown\");\n        console.log(\"%c Location Address : \" + liveLocatioAddress, \"color: brown\");\n        console.log(\"%c Location City : \" + liveLocatioCity, \"color: brown\");\n        console.log(\"%c Location State : \" + liveLocatioState, \"color: brown\");\n        console.log(\"%c Location Zip : \" + liveLocatioZip, \"color: brown\");\n        console.log(\"%c Location Country : \" + liveLocatioCountry, \"color: brown\");\n        */\n        window.dataLayer.push({\n          \"Live.Location\": liveLocation,\n          \"Live.Name\" : liveLocatioName,\n          \"Live.Address\" : liveLocatioAddress,\n          \"Live.City\" : liveLocatioCity,\n          \"Live.State\" : liveLocatioState,\n          \"Live.Zip\" : liveLocatioZip,\n          \"Live.Country\" : liveLocatioCountry\n        });\n      } else {\n          liveLocation = \"VirtualLocation\";\n          window.dataLayer.push({\"Live.Location\": liveLocation});\n          console.log(\"%c Location : \" + liveLocation, \"color: orange\");\n        }\n    } \n    \n    //Grab Live Event Target Audience\n    var getLiveAudience = document.querySelector(\".overviewFormatLive .live_targetAdience\");\n    var liveAudience = getLiveAudience.innerText;\n    window.dataLayer.push({\"Live.Audience\": liveAudience});\n    console.log(\"%c Target Audience : \" + liveAudience, \"color: blue\");\n    \n    //Grab Live Event Format\n    var getLiveFormat = document.querySelector(\".overviewFormatLive .live_format \");\n    var liveFormat = getLiveFormat.innerText;\n    window.dataLayer.push({\"Course.Format\": liveFormat});\n    console.log(\"%c Format : \" + liveFormat, \"color: blue\");\n    \n    //Grab Live Event Credits \n    var getLiveCredits = document.querySelector(\".overviewFormatLive .live_credits \");\n    var liveCredits = getLiveCredits.innerText.split(\"\\n\");\n    window.dataLayer.push({\"Course.Credits\": liveCredits});\n    //console.log(\"%c Credit(s) : \" + liveCredits, \"color: blue\");\n    \n    //Grab Live Event Cost \n    var getLiveCost = document.querySelector(\".overviewFormatLive .live_cost \");\n    var liveCost = getLiveCost.innerText;\n    window.dataLayer.push({\"Live.Price\": liveCost});\n    window.dataLayer.push({\"event\": 'liveEventDetail'});\n    //console.log(\"%c Cost : \" + liveCost, \"color: blue\");\n    \n    const cxLiveCourseFormat = liveFormat;\n    const cxLiveCourseIntendedAudience = liveAudience;\n    //send to Infinity\n    (function(){\n      // Declare Your Parameters (or leave object empty {})\n      var cxDataObject = {}\n      \n      if(cxLiveCourseFormat){cxDataObject[\"hm.activityFormat\"] = cxLiveCourseFormat};\n      //if(cxCourseTherapeuticCat){cxDataObject[\"hm.therapeuticCategories\"] = cxCourseTherapeuticCat};\n      if(cxLiveCourseIntendedAudience){cxDataObject[\"hm.activityAudience\"] = cxLiveCourseIntendedAudience};\n    \n      // DO NOT EDIT BELOW THIS LINE - ORA.view()\n      window.ORA = window.ORA || {productReady: []};\n      ORA.productReady.push(['analytics', function(cxDataObject) {return function() {return ORA.view({\"data\": cxDataObject})}}(cxDataObject)]);\n    })();\n  }\n  \n  function runDelay() {\n    if (window.location.href.indexOf(\"/courses/\") > -1 ) {\n      if ( document.querySelector(\".myCME--Live\") === null ) {\n        grabCourseDetails();\n      }\n      if ( document.querySelector(\".myCME--Live\") !== null ) {\n        grabCourseLive();\n      } \n    }\n  }\n  \n  setTimeout(runDelay, 1500);\n \n\n</script>\n\n<script>\n\nfunction addReturnTo() {\n  console.log(\"%c addReturnTo function Called\", \"background: yellow; color: red\");\n  //Get returnTo URL related items\n  var grabLink = window.location.href;\n  var returnTo = grabLink;\n  //encoding URI -- Best Practices --\n  var encodeUri = encodeURIComponent(returnTo);\n  //Target Header SignIn Link\n  var getSignInTags = document.getElementById(\"signInLink\").getElementsByTagName(\"a\")[0];\n  //Target Header Register Link\n  var getRegisterTags = document.getElementsByClassName(\"container\")[0].getElementsByTagName(\"nav\")[0].getElementsByTagName(\"li\")[0].getElementsByTagName(\"a\")[0];\n  \n  if( $(\"div.course__detail__container\").length > 0 ) {\n    //Target Detail Page Register Link\n    var detailRegisterTag = document.getElementsByClassName(\"widget--course-purchase_standard\")[0].getElementsByClassName(\"panel\")[0].getElementsByClassName(\"ember-view\")[0].getElementsByTagName(\"a\")[0];\n    //Append to returnTo to href\n    getSignInTags.setAttribute(\"href\", getSignInTags + \"?returnTo=\" + encodeUri);\n    getRegisterTags.setAttribute(\"href\", getRegisterTags + \"?returnTo=\" + encodeUri);\n    //detailRegisterTag.setAttribute(\"href\", detailRegisterTag + \"?returnTo=\" + encodeUri);\n  }\n\n  return false;\n}\n  \n  //***** [ Register For Free ] override Link *******//\n  if (document.querySelectorAll('.header.header--microsite').length > 0 ) {\n    var reposiLink = document.getElementsByTagName('nav')[0].getElementsByTagName('a')[0];\n  \n    if (reposiLink.getElementsByTagName('span')[0].innerHTML === \"Register For Free\" ) {\n      reposiLink.classList.add('registerFor--mycme'); //added class for GA\n      $('.header__inner').addClass('clickNav--btns');\n      reposiLink.addEventListener('click', registerOvrideLink );\n    } \n  }\n  \n  //add Classes for GA\n  var registerButtonClassA = $('.widget--course-purchase .enroll a.btn--primary');\n  var signinButtonClassA = $('.widget--course-purchase .course__detail__enrolled a');\n  \n  if (registerButtonClassA.length >= 1) {\n    registerButtonClassA.addClass('registerDetail--mycme');\n    signinButtonClassA.addClass('signInDetail--mycme');\n  }\n  \n  //add class for myCME Live Detail pages\n  if ( $('div.startRegisterLive').length ) {\n    $('.layout__content--sidebar').addClass('mycme--Live-Detail');\n    $('.mycme--Live-Detail .course__detail__enrolled a').addClass('startSign-inLive');\n  }\n  \n  function registerOvrideLink(event) {\n    event.preventDefault();\n    window.location.href = \"https://my.mycme.com/register\"+ \"?returnTo=\" + encodeUri;\n    return;\n  }\n  //***** END [ Register For Free ] override Link *******//\n\n//setTimeout(addReturnTo, 300);\n\n\nfunction runThisLate() {\nvar datdat = '{{email}}';\n  if ( datdat === \"user04@test.com\" || datdat === \"user03@test.com\" ) {\n    console.log(\"Email is : \" + datdat );\n    console.log(\"contentTitle is : \" + '{{contentTitle}}');\n    console.log(\"contentStart is : \" + '{{contentStart}}');\n    console.log(\"time is : \" + '{{time}}');\n    console.log(\"contentDescription is : \" + '{{contentDescription}}');\n    console.log(\"firstName is : \" + '{{firstName}}');\n    console.log(\"lastName is : \" + '{{lastName}}');\n    console.log(\"Role is : \" + '{{role}}');\n    console.log(\"ref1 is : \" + '{{ref1}}');\n    console.log(\"ref2 is : \" + '{{ref2}}');\n    console.log(\"ref3 is : \" + '{{ref3}}');\n    console.log(\"ref4 is : \" + '{{ref4}}');\n    console.log(\"ref5 is : \" + '{{ref5}}');\n    console.log(\"ref6 is : \" + '{{ref6}}');\n    console.log(\"ref7 is : \" + '{{ref7}}');\n    console.log(\"ref8 is : \" + '{{ref8}}');\n    console.log(\"ref9 is : \" + '{{ref9}}');\n    console.log(\"ref10 is : \" + '{{ref10}}');\n    console.log(\"url is : \" + '{{url}}');\n    console.log(\"referralSource is : \" + '{{referralSource}}');\n    console.log(\"purchasableSlug is : \" + '{{purchasableSlug}}');\n    console.log(\"purchasableTitle is : \" + '{{purchasableTitle}}');\n    console.log(\"courseId is : \" + '{{courseId}}');\n    console.log(\"userId is : \" + '{{userId}}');\n    const homeContent =  document.querySelector('.home__content');\n    homeContent.classList.add('runningTest');\n    console.log(\"GRIMES is \" + homeContent);\n  }\n}\n\nsetTimeout(runThisLate, 5000);\n\n//myCME Live added class\n  function classLiveSidebar() {\n    if( $('div.mycmeLiveLogo').length >= 1 ) {\n      //console.log('FRANKSTERS');\n      $('.layout__content--sidebar').addClass('myCME--Live');\n    }\n  }\n  \n  setTimeout(classLiveSidebar, 300);\n\n</script>\n\n<script>\n\n//Get api data for  - Title : CourseId : Sku : CourseStartDate : CourseEndDate : EnrollmentStartDate : EnrollmentEndDate\n\"use strict\";\n\nvar apiRequest = function apiRequest(method, url) {\n  var promise = new Promise(function (resolve, reject) {\n    var xhr = new XMLHttpRequest();\n    xhr.open(method, url);\n    xhr.responseType = \"json\";\n\n    xhr.onload = function () {\n      resolve(xhr.response);\n    };\n\n    xhr.send();\n  });\n  return promise;\n}; // call the promise method to get users\n\n</script> \n\n<!-- Add [noFollow] script on buttons -->\n<script>\n  var activityButton = document.querySelector(\".enroll a.btn--primary\");\n  var purchaseButton = document.querySelector(\".course__detail__enrolled a.btn\");\n  var detailSignIn = document.querySelector(\".course__detail__enrolled .btn\");\n \n  function addNoFollows() {\n    //console.log(\"%c Function Ran\", \"color: orange\");\n  \n    if ( activityButton !== null ) {\n      activityButton.setAttribute(\"rel\", \"nofollow\");\n      var passVal = \"Attr noFollow Set activityButton\";\n      var logColor = \"green\";\n      consoleLogings(passVal, logColor);\n      //console.log(\"%c Attr noFollow Set activityButton\", \"color: green\");\n    }\n  \n    if ( purchaseButton !== null ) {\n      purchaseButton.setAttribute(\"rel\", \"nofollow\");\n      var passVal = \"Attr noFollow Set purchaseButton\";\n      var logColor = \"orange\";\n      consoleLogings(passVal, logColor);\n      //console.log(\"%c Attr noFollow Set purchaseButton\", \"color: green\");\n    }\n    \n    if ( detailSignIn !== null ) {\n      detailSignIn.setAttribute(\"rel\", \"nofollow\");\n      var passVal = \"Attr noFollow Set detailSignIn\";\n      var logColor = \"orange\";\n      consoleLogings(passVal, logColor);\n      //console.log(\"%c Attr noFollow Set detailSignIn\", \"color: green\");\n    }\n    \n  }\n\n  setTimeout(addNoFollows, 1500);\n\n</script>\n\n<!-- PVS ----------------- Function to get the value of a cookie by name --- -->\n<script>\n  function getCookie(name) {\n    let matches = document.cookie.match(new RegExp(\n        \"(?:^|; )\" + name.replace(/([.$?*|{}()[]\\\\\\/+^])/g, '\\\\$1') + \"=([^;]*)\"\n    ));\n    return matches ? decodeURIComponent(matches[1]) : undefined;\n  }\n</script>\n\n<!-- PVS ---------------------------- GET ORACLE COOKIE  -------------- -->\n<script>\n  let queryOraCookie;\n  let getOraCookieVal;\n\n  const getOraCookie = () => {\n    let oraCookieValue = getCookie('ORA_FPC');\n    \n    if (oraCookieValue) {\n      let valSplit = oraCookieValue.split(\"id=\");\n      queryOraCookie = \"oracleCookieId=\"+valSplit[1]; //This is Used to query User data from Unity\n      getOraCookieVal = valSplit[1];\n    }\n  }\n  \n</script>\n\n<!-- PVS ---------------------------- PUSH ORA COOKIE TO DATALAYER -------- -->\n<script>\n  function pushOraCookieDl() {\n    getOraCookie(); //Call function to get Oracle Cookie. 'getOraCookieVal' returns the value\n    //console.log(\"%c ORA COOKIE IS : \" + getOraCookieVal, \"color: blue;\");\n  \n    dataLayer.push({\n      'User.oracleCookieId': getOraCookieVal,\n      'event': 'OracleCookieIdRefresh'\n    });\n  }\n  \n  setTimeout( pushOraCookieDl, 50 ); //Important to set a Timeout for the function to ensure values are catured before sending to dataLayer. Specific for TI Platform\n</script>\n\n<!-- PVS ------------------------ CATALOG TOPICS LEFT RAIL COLLAPSE ------------------------ -->\n<script>\n  /*CATALOG TOPICS left rail expanded button auto click */\n  function catalogLeftRail() {\n    const envir = getDomain === prodUrl ? \"prod\" : \"sandbox\"; //getDomain is located in the Header Scripts js\n    //Look for URL that contains [-catalog] and [/learn] before calling function\n    const urlCat = \"{{url}}\".match(/-catalog|catalog-/); //add '|\\/learn' to match if catalog is re-added to dashboard\n    if( urlCat !== null ) {\n      const loadExternalScript = (scriptUrl, callback) => {\n      if ([...document.getElementsByTagName('script')].some(script => script.src === scriptUrl)) {\n        if (callback && typeof callback === 'function') {\n          callback();\n        }\n      } else {\n        const script = document.createElement('script');\n        script.src = scriptUrl;\n        script.onload = () => {\n          if (callback && typeof callback === 'function') {\n            callback();\n          }\n        };\n        document.head.appendChild(script);\n      }\n    };\n  \n      // Usage example\n      const externalCatLgScriptUrl = 'https://haymarket-static-assets-'+envir+'.s3.amazonaws.com/LMS/JS/catalog-topics-leftrail-expand.js';\n      loadExternalScript(externalCatLgScriptUrl, () => {\n        // Callback function to execute after the script is loaded (optional)\n        mycmeFunction.catalogColl();\n      });\n    }\n  }\n  \n  setTimeout(catalogLeftRail, 900);\n</script>\n\n<!-- PVS ------------------------ ORACLE CX DATA OBJECT SCRIPT :: COURSE INFO ------- -->\n<script>\n// Send Course Information to Infinity \n\nconst sendCourseDataToInfinity = (responseData) => {\n  //console.log(\"WE ARE ON A COURSE PAGE\");\n  const cxCourseId = responseData.CourseId;\n  const cxCourseFormat = responseData.Format ? responseData.Format : responseData.CourseFormat;\n  //const cxCourseFormatCourse = responseData.CourseFormat;\n  const cxCourseTopic = responseData.Topics;\n  const cxCourseTherapeuticCat = responseData.TherapeuticArea;\n  const cxCourseIntendedAudience = responseData.IntendedAudience;\n\n  //console.log(\"%c courseId is \" + cxCourseId, \"background: purple; color: white; font-weight: bold;\");\n  \n  if ( cxCourseFormat ) {\n    //console.log(\"%c courseTagFormat is \" + cxCourseFormat, \"background: purple; color: white; font-weight: bold;\");\n  }\n  if ( cxCourseTopic ) {\n    //console.log(\"%c courseTopic is \" + cxCourseTopic, \"background: purple; color: white; font-weight: bold;\");\n  }\n  \n  if ( cxCourseTherapeuticCat ) {\n    //console.log(\"%c cxCourseTherapeuticCat is \" + cxCourseTherapeuticCat, \"background: purple; color: white; font-weight: bold;\");\n  }\n\n  if ( cxCourseIntendedAudience ) {\n    //console.log(\"%c cxCourseIntendedAudience is \" + cxCourseIntendedAudience, \"background: purple; color: white; font-weight: bold;\");\n  }\n  \n  (function(){\n    // Declare Your Parameters (or leave object empty {})\n    var cxDataObject = {\n      \"hm.activityId\": cxCourseId,\n      \"dcsuri\": window.location.pathname\n    }\n    \n    if(cxCourseTopic){cxDataObject[\"hm.courseTopics\"] = cxCourseTopic};\n    if(cxCourseFormat){cxDataObject[\"hm.activityFormat\"] = cxCourseFormat};\n    if(cxCourseTherapeuticCat){cxDataObject[\"hm.therapeuticCategories\"] = cxCourseTherapeuticCat};\n    if(cxCourseIntendedAudience){cxDataObject[\"hm.activityAudience\"] = cxCourseIntendedAudience};\n  \n    // DO NOT EDIT BELOW THIS LINE - ORA.view()\n    window.ORA = window.ORA || {productReady: []};\n    ORA.productReady.push(['analytics', function(cxDataObject) {return function() {return ORA.view({\"data\": cxDataObject})}}(cxDataObject)]);\n  })();\n}\n</script>\n\n<!-- PVS -------------- PUSH COURSE INFO TO DATALAYER ------------ -->\n<script>\n  // PUSH COURSE INFO TO DATALAYER \n  const sendCourseToDatalayer = (responseData) => {\n  //set format for current date and filter data to CourseEndDate\n  let m = new Date();\n  const courseId = responseData.CourseId;\n  const courseTitleReal = responseData.Title;\n  const courseFormat = responseData.CourseFormat;\n  const tagFormat = responseData.Format;\n  const courseEndDate = responseData.CourseEndDate;\n  const courseStartDate = responseData.CourseStartDate;\n  const courseSku = responseData.Sku;\n  const courseTime = responseData.CourseTimeToComplete;\n  const courseCredits = responseData.CourseCredits;\n  const courseTopic = responseData.Topics;\n  const courseTherapeuticCat = responseData.TherapeuticArea;\n  const courseIntendedAudience = responseData.IntendedAudience;\n\n  if( courseTitleReal !== \"undefined\") {\n    window.dataLayer.push({\"Course.Title\": courseTitleReal });\n  }\n\n  if(courseSku !== null) {\n    window.dataLayer.push({\"Course.Sku\": courseSku});\n  }\n  if(courseFormat ) {\n    window.dataLayer.push({\"Course.Format\": courseFormat});\n    //console.log(\"%c courseFormat is \" + courseFormat, \"background: red; color: yellow; font-weight: bold;\");\n  }\n  // This data is also sent to Oracle Infinity\n  if(tagFormat ) {\n    window.dataLayer.push({\"Course.TagFormat\": tagFormat});\n    cxCourseFormat = tagFormat;\n    //console.log(\"%c tagFormat is \" + tagFormat, \"background: red; color: yellow; font-weight: bold;\");\n  }\n  \n  if(courseTime ) {\n    window.dataLayer.push({\"Course.CompleteTime\": courseTime});\n  }\n  \n  if(courseCredits ) {\n    window.dataLayer.push({\"Course.Credits\": courseCredits});\n  }\n  // This data is also sent to Oracle Infinity\n  if(courseId ) {\n    window.dataLayer.push({\"Course.Id\": courseId});\n    //console.log(\"%c courseId is \" + courseId, \"background: red; color: yellow; font-weight: bold;\");\n  }\n  // This data is also sent to Oracle Infinity\n  if(courseTopic ) {\n    window.dataLayer.push({\"Course.Topics\": courseTopic});\n    //console.log(\"%c courseTopic is \" + courseTopic, \"background: red; color: yellow; font-weight: bold;\");\n  }\n  //New Field to send to Oracle Infinity\n  if(courseTherapeuticCat ) {\n    window.dataLayer.push({\"Course.TherapeuticCategory\": courseTherapeuticCat});\n    //console.log(\"%c courseTherapeticCat is \" + courseTherapeuticCat, \"background: red; color: yellow; font-weight: bold;\");\n  }\n  //New Field to send to Oracle Infinity\n  if(courseIntendedAudience ) {\n    window.dataLayer.push({\"Course.IntendedAudience\": courseIntendedAudience});\n    //console.log(\"%c courseIntendedAudience is \" + courseIntendedAudience, \"background: red; color: yellow; font-weight: bold;\");\n  }\n\n  let currDateString =\n    m.getUTCFullYear() +\n    \"-\" +\n    (\"0\" + (m.getUTCMonth() + 1)).slice(-2) +\n    \"-\" +\n    (\"0\" + m.getUTCDate()).slice(-2);\n  \n  if (courseStartDate !== null) {\n    //Split date to match Current Date Format\n    const courseStartDateString = courseStartDate.split(\"T\")[0];\n    const startDateDlPush = courseStartDate.split(\".\")[0];\n    window.dataLayer.push({\"Course.StartDate\": courseStartDateString});\n    if( startDateDlPush !== \"undefined\") {\n      window.dataLayer.push({\"Course.StartDateSplit\": startDateDlPush});\n      //Storing in localStorage for easy GTM access\n      localStorage.setItem('CourseStartDateSplit', courseStartDateString);\n    }\n    //console.log(\"%c Course StartDate is : \" + courseStartDateString, \"background: black; color:white\");\n  }\n  \n  if (courseEndDate !== null) {\n    //Split date to match Current Date Format\n    const courseEndDateString = courseEndDate.split(\"T\")[0];\n    const endDateDlPush = courseEndDate.split(\".\")[0];\n    checkEndDate(courseEndDateString, currDateString); \n    window.dataLayer.push({\"Course.EndDate\": courseEndDateString});\n    \n    if( endDateDlPush !== \"undefined\") {\n      window.dataLayer.push({\"Course.EndDateSplit\": endDateDlPush});\n      //Storing in localStorage for easy GTM access\n      localStorage.setItem('CourseEndDateSplit', courseEndDateString);\n    }\n    //console.log(\"%c Course EndDate is : \" + courseEndDateString, \"background: black; color:white\");\n  } else {\n  } //Do Nothing!\n  //Call \n}\n\nconst checkEndDate = (courseEndDateString, currDateString) => {\n  // Check if course End-Date is Less Than Current Date\n  if (new Date(courseEndDateString) < new Date(currDateString)) {\n      // Hide Action Panel\n      $(\".widget--course-purchase_standard\").fadeOut(\"500\");\n  } else {\n    //console.log(\" DO NOTHING! CARRY ALONG...\");\n  }\n};\n</script>\n\n<!-- PVS ------------------------ FETCH ENROLL SCRIPT ------------------------ -->\n<script>\n  if ( \"{{url}}\".match(/courses\\/([^\\/\\?]+)/i)[1] ) {\n    function getFetchEnroll(scriptUrls) {\n    // Create an array to store promises\n    const promises = [];\n    \n    // Iterate over each script URL\n    scriptUrls.forEach(url => {\n      // Create a promise for each script\n      //debugger\n      const promise = new Promise((resolve, reject) => {\n        // Create a script element\n        const script = document.createElement('script');\n        script.src = url;\n  \n        // Set up the event handlers for script loading\n        script.onload = resolve;\n        script.onerror = reject;\n  \n        // Append the script element to the document\n        document.head.appendChild(script);\n      });\n  \n      // Add the promise to the array\n      promises.push(promise);\n      \n    });\n  \n    // Return a promise that resolves when all scripts are loaded\n    return Promise.all(promises);\n  }\n  \n  // Usage\n  const envir = getDomain === prodUrl ? \"prod\" : \"sandbox\"; //\n  const s3envjs = 'https://haymarket-static-assets-'+envir+'.s3.amazonaws.com/LMS/JS/';\n  const externalScriptUrls = [s3envjs + 'course-enroll-data.js'];\n  \n  getFetchEnroll(externalScriptUrls)\n    .then(() => {\n      // All scripts have been loaded and executed\n      //console.log('%c External scripts loaded are : ' + externalScriptUrls, \"color:teal;\");\n      if (document.readyState === 'interactive' || document.readyState === 'complete') {\n        console.log('External scripts loaded successfully.');\n        \n        setTimeout(mycmeFunction.fetchEnrollEnd(), 900);\n        //setTimeout( fetchEnrollEnd, 2000 );;\n      }\n      // Call the callback function if needed For example:\n      // callback();\n    })\n    .catch(error => {\n      // An error occurred while loading the scripts\n      console.error('Error loading external scripts:', error);\n    });\n  }\n  \n</script>\n\n<!-- PVS ----------------------- HASH 256 ---------------- -->\n<script>\n  // Encode the email string as UTF-8\n  var emailBuff;\n  var hashedEmail;\n  \n  if('{{email}}' !== '' ) {\n    emailBuff = new TextEncoder().encode('{{email}}');\n\n    // Compute the hash using SHA-256\n    crypto.subtle.digest(\"SHA-256\", emailBuff).then(function(data) {\n        // Convert the hash buffer to a hexadecimal string\n        const hashArray = Array.from(new Uint8Array(data));\n        hashedEmail = hashArray.map(byte => ('00' + byte.toString(16)).slice(-2)).join('');\n        \n    }).catch(function(error) {\n        console.error('Error computing hash:', error);\n    });\n  }\n</script>\n\n<!-- PVS ----------------- GET USERDATA FROM UNITY --------------------- -->\n<script>\n  const getUserDataFromUnity = () => {\n    const env = envir; //defined and located in headerscripts\n    const subscriberDomain = 'haymarketmedia.com/userlookup/LookupUser?';\n    const domain = env === 'prod' ? `subscriber.${subscriberDomain}` : `staging.subscriber.${subscriberDomain}`;\n    const apiUrl = `https://${domain}${queryItem}`;\n\n    // console.log(\"%c APIURL IS = \" + apiUrl+hashedEmail, \"color: teal;\");\n    // console.log(\"%c ENVIRONMENT IS = \" + env, \"color: teal;\");\n    //console.log(\"%c QUERY ITEM IS = \" + queryItem, \"color: teal;\");\n    \n    try {\n      apiRequest('GET', apiUrl)\n        .then(responseData => {\n          \n          sendUserInfoToDl(responseData);\n        })\n        .catch(error => {\n          console.error(`Error fetching responseData from Unity: ${error}`);\n        });\n    } catch (error) {\n      console.error(`Error making API request: ${error}`);\n    }\n  };\n  \nfunction sendUserInfoToDl(responseData) {\n  const utyHashedEmail  = responseData.EmailSHA256;\n  const utyProfession   = responseData.Profession;\n  const utySpecialty    = responseData.Specialty;\n  \n  //console.log(\"%c sendUserInfoToDl Called: \", \"background: purple; color:white;\");\n  if ( utyHashedEmail ) {\n    window.dataLayer.push({'User.HashedEmail': utyHashedEmail });\n  }\n  if ( utyProfession ) {\n    window.dataLayer.push({'User.Profession': utyProfession });\n  }\n  if ( utySpecialty ) {\n    window.dataLayer.push({'User.Specialty': utySpecialty });\n  }\n  \n  //console.log(\"%c is Unity user data complete?: \" + utyHashedEmail, \"background: purple; color:white;\");\n}\n\n    // Function to get the value of a cookie by name\nfunction getCookie(name) {\n    let matches = document.cookie.match(new RegExp(\n        \"(?:^|; )\" + name.replace(/([.$?*|{}()[]\\\\\\/+^])/g, '\\\\$1') + \"=([^;]*)\"\n    ));\n    return matches ? decodeURIComponent(matches[1]) : undefined;\n}\n\n// Function to get a URL parameter by name\nfunction getURLParameter(name) {\n    let urlParams = new URLSearchParams(window.location.search);\n    return urlParams.get(name);\n}\n\n// Example function to send the value somewhere\nfunction sendValue(value) {\n    //console.log(\"Value to send:\", value);\n    queryItem = value;\n    setTimeout( getUserDataFromUnity(queryItem), 2900 );\n    // Your logic to send the value, e.g., an AJAX request\n}\n\n// Check for hashedEmail variable\nfunction setValsForUnity() {\n  //console.log(\"%c setValsForUnity Function Called ! \", \"color: purple;\");\n  if (typeof hashedEmail !== \"undefined\") {\n    queryItem = \"hashedEmail=\"+hashedEmail;\n    sendValue(queryItem);\n    //console.log(\"%c HASHED IEMAIL IS = \" + queryItem, \"color: purple;\");\n    \n  } else {\n    // Check for npiNumber in the URL\n    let npNumberValue = getURLParameter(\"npiNumber\");\n    //console.log(\"%c NPI NUMBER = \" + npNumberValue, \"color: purple;\")\n    if (npNumberValue) {\n      queryItem = \"npiNumber=\"+npNumberValue;\n      sendValue(queryItem)\n      \n    } else {\n      // Check for doer cookie\n      let oraCookieValue = getCookie(\"ORA_FPC\");\n      if (oraCookieValue) {\n          let valSplit = oraCookieValue.split(\"id=\");\n          queryItem = \"oracleCookieId=\"+valSplit[1];\n          sendValue(queryItem);\n      } else {\n          console.log(\"%c No value found for doer, npiNumber, or hashedEmail.\", \"background: black; color: yellow;\");\n      }\n    }\n  }\n}\n\nsetTimeout(setValsForUnity, 900);\n    \n</script>\n\n<!-- PVS ------------------------ ORACLE CX DATA OBJECT SCRIPT :: USER INFO ------- -->\n<script type=\"text/JavaScript\">\n    function sendToInfinity() {  \n      \n      (function(){\n   \n        // Declare Your Parameters (or leave object empty {})\n        var cxDataObject = {\n          \"dcsuri\": window.location.pathname\n        }\n        if(hashedEmail){cxDataObject[\"hm.emailhash\"] = hashedEmail}; \n        if(\"{{ref1}}\"){cxDataObject[\"hm.profession\"] = \"{{ref1}}\"}; \n        if(\"{{ref3}}\"){cxDataObject[\"hm.specialty\"] = \"{{ref3}}\"}; \n        \n        // DO NOT EDIT BELOW THIS LINE - ORA.view()\n        window.ORA = window.ORA || {productReady: []};\n        ORA.productReady.push(['analytics', function(cxDataObject) {return function() {return ORA.view({\"data\": cxDataObject})}}(cxDataObject)]);\n      })();\n    }\n  \n    setTimeout(sendToInfinity, 800);\n</script>\n<!-- PVS --------------- THROTLE PIXEL TAG (Updated) -------------- -->\n<script title=\"pxsnpt\">\n  var oraCVal;\n  setTimeout(() => {\n    //Cookie function is called in PUSH ORA COOKIE TO DATALAYER function\n    oraCVal = getOraCookieVal;\n    }, 1200 //setTime to wait on DOM contents to load\n  );\n  \n   var c082Data = {\n\t   cdmn: 'metrics.idtid.com',\n\t   lm: 'e',\n\t   tt: 'tcs.dhj'\n   };\n   setTimeout(() => {\n       (function(a) {\n  \t   a.aqet = 'pv';\n  \t   a.r = new Date().getTime();\n  \t   a.pn = document.title;\n  \t   a.dmn = location.hostname;\n  \t   a.evid = crypto.randomUUID ? crypto.randomUUID() : Math.random().toString(36).substring(2); // Fallback for random UUID\n  \t   a.client_id = '1003';\n  \t   a.sub_id = '027';\n  \t   a.extra_param = oraCVal;\n  \t   a.full_url = window.location.href;\n  \t   //console.log('ORA-ID ISSS : ' + oraCVal);\n     })(c082Data);\n   }, 1900);\n   function _pxTagInject(p, d, w, l) {\n\t   var o, k = [],\n\t\t   t = p.tt.slice(-1),\n\t\t   x = { cdmn: 1, lm: 1, tt: 1 },\n\t\t   y = { cid: 1, cls: 1, dmn: 1, pubid: 1, evid: 1, aq_m: 1 };\n\t       p.dmn = (p.dmn || (w.top[l] === w[l] ? '' + w[l] : d.referrer).split('/')[2]).split(':')[0];\n\t   for (o in p) {\n\t\t   if (y[o] || ((t != 'j' || p.aq_m) && !x[o])) {\n\t\t\t   k.push(o + \"=\" + encodeURIComponent(p[o])); // Encode values for safety\n\t\t   }\n\t   }\n\t   var s = d.createElement(t === 'f' ? 'img' : 'script');\n\t   s.id = s.title = 'pxscrpt';\n\t   s.async = s.defer = true;\n\t   s.src = 'https://' + p.cdmn + '/1/' + p.lm + '/' + p.tt + '?' + k.join(\"&\");\n\t   d.body.appendChild(s);\n   }\n\n   // Wait for DOM to be fully loaded before injecting the tag\n   function initPxTag() {\n\t   if (document.readyState === 'loading') {\n\t\t   document.addEventListener('DOMContentLoaded', function() {\n\t\t\t   _pxTagInject(c082Data, document, window, 'location');\n\t\t   });\n\t   } else {\n\t\t   _pxTagInject(c082Data, document, window, 'location');\n\t   }\n   }\n  \n   // Execute immediately or when DOM is ready\n   setTimeout( () => {\n        initPxTag();\n     }, 2000 );\n</script>\n\n<!-- PVS ------------------------ PP Modal (Template-Dependent Loading) ------------------ -->\n<script>\n(function() {\n    'use strict';\n    const S3_PP_URL = 'https://haymarket-static.s3.amazonaws.com/LMS/prod/privacy-policy-folder/pp-text-data.json';\n\n\n    // Helper function to get cookie value\n    function getLegalNotifierCookie(name) {\n        const value = `; ${document.cookie}`;\n        const parts = value.split(`; ${name}=`);\n        if (parts.length === 2) {\n            return parts.pop().split(';').shift();\n        }\n        return null;\n    }\n\n    // Helper function to set cookie\n    function setLegalNotifierCookie(name, value, days) {\n        const date = new Date();\n        date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));\n        const expires = `expires=${date.toUTCString()}`;\n        document.cookie = `${name}=${value};${expires};path=/`;    }\n\n    // Track if modal is currently shown\n    let modalShown = false;\n\n    async function initLegalNotifier() {\n        // ONLY proceed if template exists on page\n        const template = document.getElementById('legal-notifier-modal-tpl');\n        if (!template) {\n            return;\n        }\n\n        // Check if modal is already in DOM (prevents duplicates)\n        const existingModal = document.getElementById('legal-notifier-overlay');\n        if (existingModal) {\n            return;\n        }\n\n        // Prevent multiple initializations\n        if (modalShown) {\n            return;\n        }\n\n        try {\n          const response = await fetch(S3_PP_URL);\n        \n          if (!response.ok) throw new Error(`S3 fetch failed: ${response.status}`);\n            \n          // Parse JSON\n          const data = await response.json();// Parse JSON instead of text\n          const pp_start_date = data.startDate;\n          const pp_duration  = data.duration;\n          const pp_copy      = data.copy; \n          \n            const legalNotifier = {\n                // startDate: \"2026-02-02\",\n                // popupText: \"<p>Our Privacy Policy has been updated, effective February 2, 2026, to reflect changes in how we collect and use information as we continually improve our Offerings, and in response to frequently changing data privacy laws. The updates were made to the following sections: I (About), II (Notification), III (Categories), IV (Collection), V (Use), VI (Sharing), IX (Marketing Ad Technology) and XII (Disclosures under applicable state laws). We've added more details on how we use approximate location data and have clarified that the data is shared with the ad network ecosystem and data analytics service providers. For more information, access the updated <a href='https://www.haymarketmediaus.com/haymarket-media-inc-privacy-policy/' target='_blank'>Privacy Policy</a>.</p>\",\n                // cookieDuration: \"30\",\n                startDate:  pp_start_date,\n                popupText: \"<p>\" + pp_copy + \"</p>\", \n                cookieDuration: pp_duration,\n            }\n\n            const cookieName = 'hm_lna'; // haymarket legal notifier accepted cookie\n            const cookieDurationInt = parseInt(legalNotifier.cookieDuration, 10);\n            const filterClass = '-nht-filter';\n\n            // Check date range - normalize dates to remove time component\n            const today = new Date();\n            today.setHours(0, 0, 0, 0);\n\n            // Use this to parse as local date:\n            const [year, month, day] = legalNotifier.startDate.split('-');\n            const startDateObj = new Date(year, month - 1, day); // month is 0-indexed\n            startDateObj.setHours(0, 0, 0, 0);\n\n            const endDateObj = new Date(startDateObj);\n            endDateObj.setDate(endDateObj.getDate() + cookieDurationInt);\n\n            // Only proceed if today is within the valid date range\n            if (today < startDateObj) {\n                return;\n            }\n\n            if (today > endDateObj) {\n                return;\n            }\n\n            // CHECK if cookie exists\n            const existingCookie = getLegalNotifierCookie(cookieName);\n\n            if (existingCookie === 'true') {\n                return;\n            }\n\n            // exit if NHT by checking for body class\n            if (document.body.classList.contains(filterClass)) {\n                return;\n            }\n\n            // exit if NHT by checking headers\n            // to improve performance, add defer when loading this script\n            try {\n                const response = await fetch(window.location.href, { method: 'HEAD' });\n                if (response.headers.get('X-WPENGINE-SEGMENT') === 'NHT') {\n                    return;\n                }\n            } catch (error) {\n                console.error('%c Legal Notifier: Could not perform HEAD request to check for headers. Showing popup.', 'background: red; color: white', error);\n                // Do not abort if the header check fails. Continue to show the popup.\n            }\n\n            //console.log('%c Legal Notifier: Template found and no cookie - showing modal', 'background: red; color: white');\n\n            // Validate data\n            if (!legalNotifier.startDate || !legalNotifier.popupText) {\n                //console.error('%c Legal Notifier: Localized data is missing or incomplete', 'background: red; color: white');\n                return;\n            }\n\n            // Validate template content\n            if (!template.content) {\n                //console.error('%c Legal Notifier: Template has no content', 'background: red; color: white');\n                return;\n            }\n\n            const modalClone = template.content.cloneNode(true);\n\n            // Get references to essential elements\n            const contentDiv = modalClone.querySelector('.legal-notifier-content');\n            const popupOverlay = modalClone.querySelector('#legal-notifier-overlay');\n            const acceptButton = modalClone.querySelector('#legal-notifier-accept');\n\n            if (!contentDiv || !popupOverlay || !acceptButton) {\n                //console.error('%c Legal Notifier: Incomplete template - missing required elements', 'background: red; color: white');\n                return;\n            }\n\n            //console.log('%c Legal Notifier: Modal template validated', 'background: red; color: white');\n\n            // Populate the dynamic content\n            contentDiv.innerHTML = legalNotifier.popupText;\n\n            // Add event listener for \"Accept\" button\n            acceptButton.addEventListener('click', function () {\n                // Set the cookie when user accepts\n                setLegalNotifierCookie(cookieName, 'true', cookieDurationInt);\n\n                // Hide and remove modal from DOM\n                popupOverlay.style.display = 'none';\n                document.body.classList.remove('legal-notifier-modal-open');\n\n                // Remove from DOM to prevent duplicates\n                setTimeout(() => {\n                    if (popupOverlay.parentNode) {\n                        popupOverlay.parentNode.removeChild(popupOverlay);\n                    }\n                }, 300);\n\n                // Mark as shown\n                modalShown = true;\n\n                //console.log('%c Legal Notifier: Modal closed and cookie set', 'background: red; color: white');\n            });\n\n            // Append modal to body\n            document.body.appendChild(modalClone);\n\n            // Show the modal\n            popupOverlay.style.display = 'flex';\n            document.body.classList.add('legal-notifier-modal-open');\n\n            // Mark as shown\n            modalShown = true;\n\n        } catch (error) {\n            console.error('%c Legal Notifier: An unexpected error occurred: ' + error, 'background: red; color: white');\n        }\n    }\n\n    // MutationObserver to watch for template appearing in DOM\n    const observer = new MutationObserver((mutations, obs) => {\n        const template = document.getElementById('legal-notifier-modal-tpl');\n        if (template) {\n            // Template found, run initialization\n            initLegalNotifier();\n            // Disconnect observer since we found what we're looking for\n            obs.disconnect();\n        }\n    });\n\n    // Start observing\n    if (document.readyState === 'loading') {\n        document.addEventListener('DOMContentLoaded', function() {\n            // Check immediately first\n            if (document.getElementById('legal-notifier-modal-tpl')) {\n                initLegalNotifier();\n            } else {\n                // Start watching for template\n                observer.observe(document.body, {\n                    childList: true,\n                    subtree: true\n                });\n            }\n        });\n    } else {\n        // DOM already loaded, check immediately\n        if (document.getElementById('legal-notifier-modal-tpl')) {\n            initLegalNotifier();\n        } else {\n            // Start watching for template\n            observer.observe(document.body, {\n                childList: true,\n                subtree: true\n            });\n        }\n    }\n\n    // LIGHTWEIGHT SPA SUPPORT: Hook into history methods\n    const originalPushState = history.pushState;\n    const originalReplaceState = history.replaceState;\n\n    history.pushState = function() {\n        originalPushState.apply(this, arguments);\n        modalShown = false;\n        initLegalNotifier();\n    };\n\n    history.replaceState = function() {\n        originalReplaceState.apply(this, arguments);\n        modalShown = false;\n        initLegalNotifier();\n    };\n\n    // Handle browser back/forward buttons\n    window.addEventListener('popstate', function() {\n        modalShown = false;\n        initLegalNotifier();\n    });\n\n})();\n</script>\n<!-- Look at GTM for other scripts  -->\n","addCartItemScripts":"<script>\n  /*JF-20190723: Ecommerce implementation, using guide from https://developers.google.com/tag-manager/enhanced-ecommerce */\n  dataLayer.push({ 'ecommerce': null });  // Clear the previous ecommerce object.\n  dataLayer.push({\n    'event': 'addToCart',\n    'ecommerce': {\n      'currencyCode': 'USD',\n      'add': {                                \n        'products': [{                        \n          'name': '{{purchasableTitle}}',\n          'id': '{{purchasableId}}',\n          'price': {{priceInDollars}},\n          'currency': 'USD',\n          'category': '{{purchasableType}}',\n          'quantity': 1\n         }]\n      }\n    }\n  });\n  /*JF-20190723: End of Ecommerce implementation */\n</script>","productViewScripts":"<script>\n  /*JF-20190723: Ecommerce implementation, using guide from https://developers.google.com/tag-manager/enhanced-ecommerce */\n  dataLayer.push({ 'ecommerce': null });  // Clear the previous ecommerce object.\n  dataLayer.push({\n    'event': 'productView',\n    'ecommerce': {\n      'detail': {                                \n        'products': [{                        \n          'name': '{{purchasableTitle}}',\n          'id': '{{purchasableId}}',\n          'price': {{priceInDollars}},\n          'currency': 'USD',\n          'category': '{{purchasableType}}'\n         }]\n      }\n    }\n  });\n  /*JF-20190723: End of Ecommerce implementation */\n</script>","emailCaptureScripts":null,"courseCompleteScripts":null,"removeCartItemScripts":"<script>\n  /*JF-20190723: Ecommerce implementation, using guide from https://developers.google.com/tag-manager/enhanced-ecommerce */\n  dataLayer.push({ 'ecommerce': null });  // Clear the previous ecommerce object.\n  dataLayer.push({\n    'event': 'removeFromCart',\n    'ecommerce': {\n      'currencyCode': 'USD',\n      'remove': {                                \n        'products': [{                        \n          'name': '{{purchasableTitle}}',\n          'id': '{{purchasableId}}',\n          'price': {{priceInDollars}},\n          'currency': 'USD',\n          'category': '{{purchasableType}}',\n          'quantity': 1\n         }]\n      }\n    }\n  });\n  /*JF-20190723: End of Ecommerce implementation */\n</script>","checkoutStepOneScripts":"<script>\n  /*JF-20190723: Ecommerce implementation, using guide from https://developers.google.com/tag-manager/enhanced-ecommerce */\n  dataLayer.push({ 'ecommerce': null });  // Clear the previous ecommerce object.\n  products = []; \n  for(i=0; i < window.order.orderItems.length; i++) {\n      product = {};\n      product.name = window.order.orderItems[i].title;\n      product.id = window.order.orderItems[i].purchasableId;\n      product.price = (window.order.orderItems[i].priceInCents / 100);\n      product.category = window.order.orderItems[i].purchasableType;\n      product.currency = \"USD\";\n      product.quantity = 1;\n      products.push(product);\n  }\n  \n  dataLayer.push({\n    'event': 'checkout',\n    'ecommerce': {\n      'checkout': {\n        'actionField': {'step': 1},\n        'products': products\n     }\n   }\n  });\n  /*JF-20190723: End of Ecommerce implementation */\n</script>","checkoutStepTwoScripts":"<script>\n  /*JF-20190723: Ecommerce implementation, using guide from https://developers.google.com/tag-manager/enhanced-ecommerce */\n  dataLayer.push({ 'ecommerce': null });  // Clear the previous ecommerce object.\n  products = []; \n  for(i=0; i < window.order.orderItems.length; i++) {\n      product = {};\n      product.name = window.order.orderItems[i].title;\n      product.id = window.order.orderItems[i].purchasableId;\n      product.price = (window.order.orderItems[i].priceInCents / 100);\n      product.category = window.order.orderItems[i].purchasableType;\n      product.currency = \"USD\";\n      product.quantity = 1;\n      products.push(product);\n  }\n  \n  dataLayer.push({\n    'event': 'checkoutPaymentInfo',\n    'ecommerce': {\n      'checkout': {\n        'actionField': {'step': 2},\n        'products': products\n     }\n   }\n  });\n  /*JF-20190723: End of Ecommerce implementation */\n</script>","sectionCompleteScripts":"<script>\n  /*JF-20220317: Trigger event when section is completed */\n  dataLayer.push({\n    'event': 'sectionCompleted'\n  });\n  /*JF-20220317: Trigger event when section is completed */\n</script>","onboardingSurveyResponseScripts":null}}