PageSourceSearch

https://www.nestlehealthscience.com.hk/modules/custom/nhsc_utils/j…/NHSSkin/js/nhs-v2.js?5ca2p3

js nestlehealthscience.com.hk collected 2026-10-06 07:59:28 UTC 33,996 bytes, 1,086 lines download raw bytes

1(function ($) {
2  var NHSMainMenu = [];
3  var NHSSubMenu = [];
4  $(document).ready(function () {
5    AutoSizeNHSMenu();
6    if ($(".SubNavigation.NavIsFixed").length) {
7      if (nhs_getCookie("nhsSubNavPos") === "") {
8        var smpos = parseInt($(".SubNavigation").offset().top);
9        nhs_writeCookiePlusOneYear("nhsSubNavPos", smpos, "/");
10      }
11      $(window).scroll(function () {
12        var smpos = parseInt(nhs_getCookie("nhsSubNavPos"));
13        var stop = parseInt($(this).scrollTop());
14        if (stop >= smpos) {
15          $(".SubNavigation").addClass("f_nav");
16        } else {
17          $(".SubNavigation").removeClass("f_nav");
18        }
19      });
20    }
21    if ($(".HomeContentPush").length) {
22      var h = $(".HomeContentPush .text-wrapper").outerHeight();
23      var t = $(".HomeContentPush .text-wrapper").position().top;
24      var ih = $(".HomeContentPush .image-wrapper").height();
25      if (ih < h + t) {
26        $(".HomeContentPush .image-wrapper").height(ih + (h + t - ih) + 20);
27      }
28    }
29    var h = document.location.hash;
30    if (h) {
31      if (h.indexOf("nhsacc") > 0) {
32        var a = h.split("-");
33        var i = parseInt(a[1]);
34        var elm = $(".accordeon:eq(" + i + ")");
35        if (!elm.hasClass("expanded")) {
36          elm.addClass("expanded");
37          elm.children(".accordeon-content").show();
38        }
39        scrollToElm(elm);
40      }
41    }
42    if ($(".place-for-hcp-switch").length) {
43      $(document).on("click", ".place-for-hcp-switch .switch", function () {
44        var promptPatientSwitchBack = $(
45          ".AudienceToggle input[name=promptPatientSwitchBack]",
46        ).val();
47        var _cookieHCP = parseInt(nhs_getCookie("isHCP"));
48        if (_cookieHCP == "1" && promptPatientSwitchBack == "False") {
49          nhs_writeCookiePlusOneYear("isHCP", "0", "/");
50          if ($(".place-for-hcp-switch").length) {
51            $(".place-for-hcp-switch").removeClass("switch_on");
52            $(".place-for-hcp-switch").addClass("switch_off");
53          }
54          NHSCheckAudienceRedirection();
55        } else {
56          OpenHcpPatientPopIn();
57        }
58        return false;
59      });
60    }
61    if ($(".AudienceToggle").length) {
62      NHSCheckAudienceRedirection();
63      $(document).on("click", ".AudienceToggleBox a.hcp", function () {
64        nhs_writeCookiePlusOneYear("isHCP", "1", "/");
65        if ($(".place-for-hcp-switch").length) {
66          $(".place-for-hcp-switch").removeClass("switch_off");
67          $(".place-for-hcp-switch").addClass("switch_on");
68        }
69        NHSCheckAudienceRedirection();
70        return false;
71      });
72      $(document).on("click", ".AudienceToggleBox a.patient", function () {
73        nhs_writeCookiePlusOneYear("isHCP", "0", "/");
74        if ($(".place-for-hcp-switch").length) {
75          $(".place-for-hcp-switch").removeClass("switch_on");
76          $(".place-for-hcp-switch").addClass("switch_off");
77        }
78        NHSCheckAudienceRedirection();
79        return false;
80      });
81      $(document).on("click", ".AudienceToggleBox a.auth_close", function () {
82        $.fancybox.close();
83        return false;
84      });
85    }
86    $(document).on("DOMNodeInserted", ".nwe-setting-item-fields", function () {
87      $(".nwe-setting-item-label span:contains('ShowHeader')").text(
88        "HideTopMargin",
89      );
90      $(".nwe-setting-item-label span:contains('ShowFooter')").text(
91        "HideBottomMargin",
92      );
93    });
94    $(document).on("click", "#header .open-settings", function () {
95      if ($(this).hasClass("open")) {
96        $(this).removeClass("open");
97        $("#header .mobile-background-settings").hide();
98      } else {
99        $(this).addClass("open");
100        $("#header .mobile-background-settings").show();
101      }
102    });
103    $(".nhs-site-search input").keyup(function (e) {
104      if (e.keyCode == 13) {
105        $(".nhs-site-search a").click();
106      }
107    });
108    $(".nhs-site-search a").click(function () {
109      var input = encodeURIComponent($(".nhs-site-search input").val());
110      document.location.href = $("#nhs-search-url").html() + "?q=" + input;
111      return false;
112    });
113    $(".nhs-site-search input").click(function () {
114      if (this.value == this.defaultValue) {
115        $(".nhs-site-search input").val("");
116      }
117    });
118    $(".media-search input").keyup(function (e) {
119      if (e.keyCode == 13) {
120        $(".media-search a").click();
121      }
122    });
123    $(".media-search a").click(function () {
124      var input = encodeURIComponent($(".media-search input").val());
125      document.location.href = $(location).attr("pathname") + "?k=" + input;
126      return false;
127    });
128    $(".media-search input").click(function () {
129      if (this.value == this.defaultValue) {
130        $(".media-search input").val("");
131      }
132    });
133    $(".SearchMedia .YearFilter a").click(function () {
134      var url = $(location).attr("pathname") + "?setYear=" + $(this).text();
135      $(location).attr("href", url);
136      return false;
137    });
138    $(".MedicalConditionPushBlock").on(
139      "mouseenter mouseleave click",
140      MedicalConditionPushBlockEffect,
141    );
142    $(".BrandPushBlock").on(
143      "mouseenter mouseleave click",
144      BrandPushBlockEffect,
145    );
146    $("#nhs2-menu .menu").on("mouseenter mouseleave click", NHSMenuEffect);
147    $(".SubNavigation .level-0").on(
148      "mouseenter mouseleave click",
149      NHSSubMenuEffect,
150    );
151    $("#nhs2-menu .level-1.hasChild .level1Action").click(function () {
152      var __ul = $(this).next("ul");
153      if (__ul.is(":visible")) {
154        __ul.hide();
155        $(this).removeClass("visible");
156      } else {
157        __ul.show();
158        $(this).addClass("visible");
159      }
160      return false;
161    });
162    $(".burger-menu #nhs2-menu .level-1.hasChild .level1Action").each(
163      function (index) {
164        var __ul = $(this).next("ul");
165        $(this).removeClass("visible");
166        __ul.hide();
167      },
168    );
169    $("#nhs2-menu .main-nav .menu").each(function (index) {
170      NHSMainMenu[index] = [];
171      $(this)
172        .find("a")
173        .each(function (index2) {
174          var _a = $(this).attr("href");
175          if (_a != "/#nhsGetChild" && _a != "/") {
176            var _p = _a.split("/");
177            if (_p.length > 1) {
178              var _v = _p[1];
179              if (_v.toLowerCase() != "pages" && _v != "") {
180                if (NHSMainMenu[index].indexOf(_v) == -1) {
181                  NHSMainMenu[index].push(_v.toLowerCase());
182                }
183              }
184            }
185          }
186        });
187    });
188    $(".SubNavigation .mobile").click(function () {
189      if ($(".SubNavigation .links").is(":visible")) {
190        $(this).removeClass("visible");
191        $(".SubNavigation .links").hide();
192      } else {
193        $(this).addClass("visible");
194        $(".SubNavigation .links").show();
195      }
196      return false;
197    });
198    $(".SubNavigation .level-0.hasChild a.link0").click(function () {
199      var isMobile = $(".SubNavigation ").hasClass("bar-menu");
200      if (isMobile) {
201        if ($(this).parent().hasClass("opened")) {
202          $(this).parent().removeClass("opened");
203        } else {
204          $(this).parent().addClass("opened");
205        }
206      }
207      return false;
208    });
209    $(".SubNavigation .sublinks").each(function (index) {
210      var __parent = $(this).parent();
211      var _val = ($(this).outerWidth() - __parent.outerWidth()) / 2;
212      $(this).css("left", -_val);
213    });
214    $(".SubNavigation .links .level-0").each(function (index) {
215      NHSSubMenu[index] = [];
216      $(this)
217        .find("a")
218        .each(function (index2) {
219          var _a = $(this).attr("href");
220          _a = _a.replace("Pages/", "");
221          _a = _a.replace(".aspx", "");
222          if (_a != "/") {
223            if (NHSSubMenu[index].indexOf(_a) == -1) {
224              NHSSubMenu[index].push(_a.toLowerCase());
225            }
226          }
227        });
228    });
229    $("#header .nav-button").click(function () {
230      if ($(this).parent().is("#nhs-menu")) {
231        $("#nhs-menu").stop().slideToggle();
232      } else {
233        $("#nhs-menu").stop().slideToggle();
234      }
235      if ($(this).parent().is("#nhs2-menu")) {
236        $("#nhs2-menu .main-nav").stop().slideToggle();
237      } else {
238        $("#nhs2-menu .main-nav").stop().slideToggle();
239      }
240      $(this).toggleClass("nav-open");
241      return false;
242    });
243    var accordeons = $(".accordeon .accordeon-header, .accordeon .opener");
244    accordeons.parent().find(".accordeon-content, .content").hide();
245    $(".accordeon .accordeon-header, .accordeon .opener").click(function () {
246      $(this)
247        .parent()
248        .find(".accordeon-content, .content")
249        .stop(false, true)
250        .slideToggle("fast");
251      $(this).parent().toggleClass("expanded");
252      window.dataLayer = window.dataLayer || [];
253      dataLayer.push({
254        event: "useraction",
255        eventCategory: "general content",
256        eventAction: "accordeon toggle",
257        eventLabel: window.location.href,
258        eventValue: undefined,
259        eventNonInteraction: 0,
260      });
261      return false;
262    });
263    $(".medical-condition-group").click(function () {
264      var __ul = $(this).next("ul");
265      if (__ul.is(":visible")) {
266        __ul.hide();
267        $(this).removeClass("visible");
268      } else {
269        __ul.show();
270        $(this).addClass("visible");
271      }
272      return false;
273    });
274    $(document).on("click", "a.youtube", function () {
275      var href = $(this).attr("href");
276      var vidcode = GetIsYoutubeId(href);
277      if (vidcode != "" && !$(this).hasClass("clicked")) {
278        $(this).addClass("clicked");
279        $(this)
280          .parent()
281          .prepend(
282            '<iframe width="1" height="1" src="https://www.youtube.com/embed/' +
283              vidcode +
284              '?autoplay=1&rel=0" frameborder="0" allowfullscreen></iframe>',
285          );
286        $(this).fadeOut(400);
287      }
288      return false;
289    });
290    if ($(".AvailableStoryPatientStory").length) {
291      $(".AvailableStoryPatientStory li a").each(function (index) {
292        var href = $(this).attr("href");
293        if (href == "#") {
294          $(this).parent().html($(this).html());
295        } else {
296          var vidcode = GetIsYoutubeId(href);
297          if (vidcode != "") {
298            $(this).addClass("youtube");
299            $(this).append('<span class="video"></span>');
300            $(this).wrap('<div class="youtube-wrapper"></div>');
301          }
302        }
303      });
304    }
305    $(".fancy-products").fancybox({
306      wrapCSS: "nhs-root big-products-images-slider",
307      prevEffect: "none",
308      nextEffect: "none",
309      beforeShow: function () {
310        this.title = $(this.element).next(".fancy-product-content").html();
311      },
312      helpers: {
313        title: {
314          type: "inside",
315        },
316      },
317    });
318    if ($("#owl-productImagescarousel").length) {
319      $("#owl-productImagescarousel").owlCarousel({
320        singleItem: true,
321        autoPlay: true,
322        navigation: true,
323        pagination: true,
324        stopOnHover: true,
325        slideSpeed: 500,
326      });
327    }
328    if ($(".KeyFactBlock").length) {
329      $(".KeyFactBlock .owl-carousel").each(function (index) {
330        var _settings = CarouselGetSettingsValues(this);
331        $(this).owlCarousel({
332          singleItem: true,
333          autoPlay: _settings.autoPlay,
334          navigation: false,
335          pagination: true,
336          stopOnHover: true,
337          slideSpeed: _settings.slideSpeed,
338        });
339      });
340    }
341    if ($(".ProductRelatedproducts").length) {
342      var _nbItems = $(".ProductRelatedproducts").find(".product").length;
343      if (_nbItems > 1) {
344        _nbItems = 2;
345      }
346      $(".ProductRelatedproducts .owl-carousel").each(function (index) {
347        var _settings = CarouselGetSettingsValues(this);
348        $(this).owlCarousel({
349          items: _nbItems,
350          itemsDesktop: false,
351          itemsDesktopSmall: false,
352          itemsTablet: false,
353          autoPlay: _settings.autoPlay,
354          navigation: true,
355          pagination: true,
356          stopOnHover: true,
357          slideSpeed: _settings.slideSpeed,
358        });
359      });
360    }
361    if ($(".BrandProductZone").length) {
362      var _nbItems = $(".BrandProductZone").find(".product").length;
363      if (_nbItems > 2) {
364        _nbItems = 3;
365      }
366      $(".BrandProductZone .owl-carousel").each(function (index) {
367        var _settings = CarouselGetSettingsValues(this);
368        $(this).owlCarousel({
369          items: _nbItems,
370          itemsDesktop: false,
371          itemsDesktopSmall: false,
372          itemsTablet: false,
373          autoPlay: _settings.autoPlay,
374          navigation: true,
375          pagination: true,
376          stopOnHover: true,
377          slideSpeed: _settings.slideSpeed,
378        });
379      });
380    }
381    if ($(".HealthyTips").length) {
382      $(".HealthyTips .owl-carousel").each(function (index) {
383        var _settings = CarouselGetSettingsValues(this);
384        $(this).owlCarousel({
385          singleItem: true,
386          autoPlay: _settings.autoPlay,
387          navigation: true,
388          pagination: true,
389          stopOnHover: true,
390          slideSpeed: _settings.slideSpeed,
391        });
392      });
393    }
394    if ($(".Recipes").length) {
395      $(".Recipes .owl-carousel").each(function (index) {
396        var _settings = CarouselGetSettingsValues(this);
397        $(this).owlCarousel({
398          singleItem: true,
399          autoPlay: _settings.autoPlay,
400          navigation: true,
401          pagination: true,
402          stopOnHover: true,
403          slideSpeed: _settings.slideSpeed,
404        });
405      });
406    }
407    if ($(".homeCarousel").length) {
408      $(".homeCarousel .owl-carousel").each(function (index) {
409        var _settings = CarouselGetSettingsValues(this);
410        $(this).owlCarousel({
411          singleItem: true,
412          autoPlay: _settings.autoPlay,
413          navigation: true,
414          pagination: true,
415          stopOnHover: true,
416          slideSpeed: _settings.slideSpeed,
417        });
418      });
419    }
420    if ($(".brandsCarousel").length) {
421      $("#owl-brandscarousel").owlCarousel({
422        singleItem: true,
423        autoPlay: true,
424        navigation: false,
425        pagination: true,
426        stopOnHover: true,
427        slideSpeed: 500,
428      });
429    }
430    if ($(".SymptomsTrackerTools").length) {
431      $("#openTrackerTool").click(function () {
432        if (IsTouchDevice()) {
433          return true;
434        } else {
435          var _url = $(this).attr("href");
436          $.get(_url, function (data, status) {
437            var _content =
438              '<div class="AssessmentToolBox cf">' +
439              $(data).find(".AssessmentToolBox").html() +
440              "</div>";
441            $.fancybox.open(
442              [
443                {
444                  content: _content,
445                  type: "inline",
446                },
447              ],
448              {
449                wrapCSS: "nhs-fancybox",
450                padding: 0,
451                margin: 0,
452                scrolling: "no",
453                closeBtn: true,
454                minHeight: 100,
455              },
456            );
457          });
458          return false;
459        }
460      });
461    }
462    $(document).on("click", ".AssessmentToolBox .next", function () {
463      var current_screen = $(this).parent();
464      var pn = parseInt(current_screen.attr("id").split("_")[1]);
465      var next_screen = $("#screen_" + (pn + 1));
466      if (next_screen.hasClass("result")) {
467        var nbChecked = $(".AssessmentToolBox :checkbox:checked").length;
468        next_screen.find(".description").hide();
469        if (nbChecked == 0) {
470          $(".recap-symptoms-list").hide();
471          next_screen.find(".description:eq(0)").show();
472        } else if (nbChecked == 1) {
473          $(".recap-symptoms-list").show();
474          $(".symptoms-list").html(
475            "<li>" +
476              $(".AssessmentToolBox :checkbox:checked")[0].nextSibling
477                .nodeValue +
478              "</li>",
479          );
480          next_screen.find(".description:eq(1)").show();
481        } else {
482          $(".recap-symptoms-list").show();
483          $(".AssessmentToolBox :checkbox:checked").each(function (index) {
484            $(".symptoms-list").append(
485              "<li>" + this.nextSibling.nodeValue + "</li>",
486            );
487          });
488          next_screen.find(".description:eq(2)").show();
489        }
490        next_screen.find(".description:eq(3)").show();
491      }
492      next_screen.show();
493      current_screen.hide();
494      $.fancybox.reposition();
495      return false;
496    });
497    $(document).on("click", ".AssessmentToolBox .previous", function () {
498      var current_screen = $(this).parent();
499      var pn = parseInt(current_screen.attr("id").split("_")[1]);
500      var previous_screen = $("#screen_" + (pn - 1));
501      previous_screen.show();
502      current_screen.hide();
503      return false;
504    });
505    $(document).on("click", ".AssessmentToolBox .print", function () {
506      var content =
507        '<html><body><img src="/skin-engine-shared/NHSSkin/css/images/logo.png"><br><br>';
508      content += "<br><br>" + $(".AssessmentToolBox .introduction").html();
509      content += "<br><br>" + $(".recap-symptoms-list").html();
510      $("#screen_5 .description:visible").each(function (index) {
511        content += "<br><br>" + $(this).html();
512      });
513      content += "</body>";
514      content += "</html>";
515      var printWin = window.open(
516        "",
517        "",
518        "left=0,top=0,width=1000,height=500,toolbar=0,scrollbars=0,status =0",
519      );
520      printWin.document.write(content);
521      printWin.document.close();
522      printWin.focus();
523      printWin.print();
524      printWin.close();
525      return false;
526    });
527    $(".nhs_expandable").each(function (index) {
528      var _ctHeight = $(this).height("auto").height();
529      var classList = $(this).attr("class").split(/\s+/);
530      var _nbLines = 6;
531      var _lh = parseInt($(this).css("line-height"), 10);
532      if (isNaN(_lh)) {
533        _lh = 28;
534      }
535      $.each(classList, function (index, item) {
536        if (item.match("^nblines_")) {
537          _nbLines = item.split("_")[1];
538        }
539      });
540      var _h = _nbLines * _lh;
541      if ($(this).hasClass("kfContentBlock")) {
542        _h = 300;
543      }
544      if ($(this).hasClass("productContentBlock")) {
545        _h = 300;
546      }
547      if (_ctHeight > _h) {
548        $(this).height(_h);
549        $(this).append(
550          '<div class="readmore"  data-min-height="' +
551            _h +
552            '"><a href="#" class="button">' +
553            $("#ReadMoreJS_ReadMore").val() +
554            "</a></div>",
555        );
556      } else {
557        $(this).css("height", "auto");
558      }
559    });
560    $(document).on("click", ".StoreLocator #storeLocatorShowMap", function () {
561      $(".StoreLocator .results").removeClass("list");
562      $(".StoreLocator .results").addClass("map");
563      return false;
564    });
565    $(document).on("click", ".StoreLocator #storeLocatorShowList", function () {
566      $(".StoreLocator .results").removeClass("map");
567      $(".StoreLocator .results").addClass("list");
568      return false;
569    });
570    NHS_HighlightMainNavMenu();
571    if ($(".SubNavigation").length) {
572      NHS_HighlightSubNavMenu();
573    }
574    setTimeout(function () {
575      NHSAlignElmHeight();
576    }, 200);
577  });
578  $(window).load(function () {
579    $(".MedicalConditionPushBlock").each(function () {
580      var s_push = $(this).height();
581      var s_title = $(this).find(".title").height();
582      var t = s_push - s_title - 30;
583      $(this)
584        .find(".text-wrapper")
585        .css({
586          top: t + "px",
587        });
588      $(this).find(".text-wrapper").css("visibility", "visible");
589    });
590    $(".BrandPushBlock").each(function () {
591      var s_push = $(this).height();
592      var t = s_push;
593      $(this)
594        .find(".text-wrapper")
595        .css({
596          top: t + "px",
597        });
598      $(this).find(".text-wrapper").css("visibility", "visible");
599    });
600  });
601
602  var GetIsYoutubeId = function (href) {
603    var vidcode = "";
604    var arr = href.split("v=");
605    if (arr.length > 1) {
606      var vidcode = arr[1].substr(0, 11);
607    } else if (href.indexOf("youtu.be") > -1) {
608      arr = href.split("youtu.be");
609      var vidcode = arr[1].substr(1, 11);
610    }
611    return vidcode;
612  };
613  var IsTouchDevice = function () {
614    if (
615      /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
616        navigator.userAgent,
617      )
618    ) {
619      return true;
620    }
621    return false;
622  };
623  var MedicalConditionPushBlockEffect = function (event) {
624    var _elm = event.currentTarget;
625    var maxTop = 290;
626    var minTop = 40;
627    var s_push = $(_elm).height();
628    var s_title = $(_elm).find(".title").height();
629    var t = s_push - s_title - 30;
630    if (!IsTouchDevice() && event.type == "mouseenter") {
631      $(_elm)
632        .find(".color-panel")
633        .stop()
634        .animate({
635          height: $(".MedicalConditionPushBlock").height() + "px",
636        });
637      $(_elm)
638        .find(".text-wrapper")
639        .stop()
640        .animate({
641          top: minTop + "px",
642        });
643      $(_elm).toggleClass("mcpb_1");
644    } else if (!IsTouchDevice() && event.type == "mouseleave") {
645      $(_elm).find(".color-panel").stop().animate({
646        height: "10px",
647      });
648      $(_elm)
649        .find(".text-wrapper")
650        .stop()
651        .animate({
652          top: t + "px",
653        });
654      $(_elm).toggleClass("mcpb_1");
655    } else if (IsTouchDevice() && event.type == "click") {
656      if ($(_elm).hasClass("mcpb_1")) {
657        $(_elm).find(".color-panel").stop().animate({
658          height: "10px",
659        });
660        $(_elm)
661          .find(".text-wrapper")
662          .stop()
663          .animate({
664            top: t + "px",
665          });
666        $(_elm).toggleClass("mcpb_1");
667      } else {
668        $(_elm)
669          .find(".color-panel")
670          .stop()
671          .animate({
672            height: $(".MedicalConditionPushBlock").height() + "px",
673          });
674        $(_elm)
675          .find(".text-wrapper")
676          .stop()
677          .animate({
678            top: minTop + "px",
679          });
680        $(_elm).toggleClass("mcpb_1");
681      }
682    }
683  };
684  var BrandPushBlockEffect = function (event) {
685    var _elm = event.currentTarget;
686    var s_push = $(_elm).height();
687    var t = s_push;
688    if (!IsTouchDevice() && event.type == "mouseenter") {
689      $(_elm)
690        .find(".color-panel")
691        .stop()
692        .animate({
693          height: $(".BrandPushBlock").height() + "px",
694        });
695      $(_elm).find(".text-wrapper").stop().animate({
696        top: "40px",
697      });
698      $(_elm).toggleClass("bpb_1");
699    } else if (!IsTouchDevice() && event.type == "mouseleave") {
700      $(_elm).find(".color-panel").stop().animate({
701        height: "0px",
702      });
703      $(_elm)
704        .find(".text-wrapper")
705        .stop()
706        .animate({
707          top: t + "px",
708        });
709      $(_elm).toggleClass("bpb_1");
710    } else if (IsTouchDevice() && event.type == "click") {
711      if ($(_elm).hasClass("bpb_1")) {
712        $(_elm).find(".color-panel").stop().animate({
713          height: "0px",
714        });
715        $(_elm)
716          .find(".text-wrapper")
717          .stop()
718          .animate({
719            top: t + "px",
720          });
721        $(_elm).toggleClass("bpb_1");
722      } else {
723        $(_elm)
724          .find(".color-panel")
725          .stop()
726          .animate({
727            height: $(".BrandPushBlock").height() + "px",
728          });
729        $(_elm).find(".text-wrapper").stop().animate({
730          top: "40px",
731        });
732        $(_elm).toggleClass("bpb_1");
733      }
734    }
735  };
736  var NHSMenuEffect = function (event) {
737    var _elm = event.currentTarget;
738    var isBurger = $("#header").hasClass("burger-menu");
739    if (!isBurger && event.type == "mouseenter") {
740      $(_elm).addClass("opened");
741    } else if (!isBurger && event.type == "mouseleave") {
742      $(_elm).removeClass("opened");
743    } else if (isBurger && event.type == "click") {
744      if ($(_elm).hasClass("opened")) {
745        $(_elm).removeClass("opened");
746      } else {
747        $(_elm).addClass("opened");
748      }
749    }
750  };
751  var NHSSubMenuEffect = function (event) {
752    var _elm = event.currentTarget;
753    var isMobile = $(".SubNavigation ").hasClass("bar-menu");
754    if (!isMobile && event.type == "mouseenter") {
755      $(_elm).addClass("opened");
756    } else if (!isMobile && event.type == "mouseleave") {
757      $(_elm).removeClass("opened");
758    }
759  };
760
761  function OpenHcpPatientPopIn() {
762    if (screen.width <= 480) {
763      $.fancybox.open(
764        [
765          {
766            href: ".AudienceToggleBox",
767            type: "inline",
768          },
769        ],
770        {
771          wrapCSS: "nhs-fancybox",
772          padding: 0,
773          margin: 0,
774          scrolling: "yes",
775          closeBtn: false,
776          minHeight: 100,
777          modal: true,
778        },
779      );
780    } else {
781      $.fancybox.open(
782        [
783          {
784            href: ".AudienceToggleBox",
785            type: "inline",
786          },
787        ],
788        {
789          wrapCSS: "nhs-fancybox",
790          padding: 0,
791          margin: 0,
792          scrolling: "no",
793          closeBtn: false,
794          minHeight: 100,
795          modal: true,
796        },
797      );
798    }
799  }
800  function NHSCheckAudienceRedirection() {
801    if ($(".disabledisclaimer").length == 0) {
802      var _cookieHCP = parseInt(nhs_getCookie("isHCP"));
803      var __ok = true;
804      if ($(".place-for-hcp-switch").length) {
805        if (_cookieHCP != 1) {
806          _cookieHCP = 0;
807          nhs_writeCookiePlusOneYear("isHCP", "0", "/");
808        }
809      } else {
810        if (_cookieHCP !== 0 && _cookieHCP != 1) {
811          __ok = false;
812          $(window).load(function () {
813            OpenHcpPatientPopIn();
814          });
815        }
816      }
817      if (__ok) {
818        var str = $(".AudienceToggle input[name=audience]").val();
819        var _audiences = str.split(",");
820        var _redirect = true;
821        for (_val in _audiences) {
822          if (
823            _audiences[_val] == "" ||
824            (_audiences[_val] == "hcp" && _cookieHCP == 1) ||
825            (_audiences[_val] == "patient" && _cookieHCP == 0)
826          ) {
827            _redirect = false;
828          }
829        }
830        if (_redirect) {
831          var _content = '<div class="AudienceToggleRedirectionBox">';
832          if (_cookieHCP == 1) {
833            _content += $("#Patient_Redirection_message").html();
834          } else {
835            _content += $("#HCP_Redirection_message").html();
836          }
837          _content += "</div>";
838          setTimeout(function () {
839            $.fancybox.open(
840              [
841                {
842                  content: _content,
843                  type: "inline",
844                },
845              ],
846              {
847                wrapCSS: "nhs-fancybox",
848                padding: 0,
849                margin: 0,
850                scrolling: "no",
851                closeBtn: false,
852                modal: true,
853                minHeight: 80,
854              },
855            );
856          }, 0);
857          var _redirection = $(".AudienceToggle input[name=redirection]").val();
858          var _suffix = $(".AudienceToggle input[name=suffix]").val();
859          if (!_redirection) {
860            _redirection = document.location.href;
861            _redirection = _redirection.replace(_suffix, "");
862            _redirection = _redirection.split("?")[0].split("#")[0];
863            if (_audiences[_val] == "patient") {
864              var _pos = _redirection.indexOf(".aspx");
865              if (_pos === -1) {
866                _redirection += _suffix;
867              } else {
868                _redirection =
869                  _redirection.substring(0, _pos) +
870                  _suffix +
871                  _redirection.substring(_pos, _redirection.length);
872              }
873            }
874          }
875          setTimeout(function () {
876            document.location.href = _redirection;
877          }, 2500);
878        } else {
879          $.fancybox.close();
880        }
881      }
882    }
883  }
884  function CarouselGetSettingsValues(_this) {
885    var _valAutoPlaySpeed = parseInt(
886      $(_this).prev().children(".CarouselAutoPlaySpeed").val(),
887    );
888    if (_valAutoPlaySpeed % 1 !== 0) {
889      _valAutoPlaySpeed = 0;
890    }
891    if (_valAutoPlaySpeed <= 0) {
892      _valAutoPlaySpeed = false;
893    }
894    var _valSlideSpeed = parseInt(
895      $(_this).prev().children(".CarouselSlideSpeed").val(),
896    );
897    if (_valSlideSpeed % 1 !== 0) {
898      _valSlideSpeed = 0;
899    }
900    if (_valSlideSpeed <= 0) {
901      _valSlideSpeed = 300;
902    }
903    return {
904      autoPlay: _valAutoPlaySpeed,
905      slideSpeed: _valSlideSpeed,
906    };
907  }
908  function nhs_getCookie(cname) {
909    var name = cname + "=";
910    var ca = document.cookie.split(";");
911    for (var i = 0; i < ca.length; i++) {
912      var c = ca[i].trim();
913      if (c.indexOf(name) == 0) return c.substring(name.length, c.length);
914    }
915    return "";
916  }
917  function nhs_writeCookiePlusOneYear(name, value, path) {
918    var expiration_date = new Date();
919    expiration_date.setFullYear(expiration_date.getFullYear() + 1);
920    expiration_date = expiration_date.toGMTString();
921    var cookie_string =
922      escape(name) + "=" + escape(value) + "; expires=" + expiration_date;
923    if (path != null) cookie_string += "; path=" + path;
924    document.cookie = cookie_string;
925  }
926  function scrollToElm(elm) {
927    $("html, body").animate(
928      {
929        scrollTop: elm.offset().top,
930      },
931      500,
932    );
933  }
934  function AutoSizeNHSMenu() {
935    if ($("#nhs2-menu").length) {
936      var _w = document.documentElement.clientWidth;
937      var _dynamic = $("#V2MainNavigationDynamicWidth").val();
938      if (_w > 1024) {
939        if (_dynamic == "True") {
940          $("#nhs2-menu .main-nav").addClass("dynamicWidth");
941        }
942        $("#header").removeClass("burger-menu");
943      } else {
944        if (_dynamic == "True") {
945          $("#nhs2-menu .main-nav").removeClass("dynamicWidth");
946        }
947        $("#header").addClass("burger-menu");
948      }
949      $("#nhs2-menu").css("visibility", "visible");
950    }
951    if ($(".SubNavigation").length) {
952      var _w = document.documentElement.clientWidth;
953      if (_w > 1024) {
954        $(".SubNavigation").removeClass("bar-menu");
955      } else {
956        $(".SubNavigation").addClass("bar-menu");
957      }
958      $(".SubNavigation").css("visibility", "visible");
959    }
960  }
961  $(window).resize(function () {
962    AutoSizeNHSMenu();
963  });
964  function NHS_HighlightMainNavMenu() {
965    var _p = window.location.pathname;
966    _p = _p.replace(/Pages\//gi, "");
967    var _t = _p.split("/");
968    if (_t.length > 1) {
969      var _v = _t[1].toLowerCase();
970      var _ok = false;
971      for (var i = 0; i < NHSMainMenu.length; i++) {
972        if (NHSMainMenu[i].indexOf(_v) >= 0) {
973          _ok = true;
974          $("#nhs2-menu .main-nav .menu:eq(" + i + ")").addClass("selected");
975        }
976      }
977      if (!_ok) {
978        if (_p != "" || _p != "/" || _p != "/home") {
979          $("#nhs2-menu .main-nav .menu:eq(0)").addClass("selected");
980        }
981      }
982    }
983  }
984  function NHS_HighlightSubNavMenu() {
985    var _p = window.location.pathname;
986    _p = _p.replace("Pages/", "");
987    _p = _p.replace(".aspx", "");
988    var _ok = true;
989    for (var i = 0; i < NHSSubMenu.length; i++) {
990      if (NHSSubMenu[i].indexOf(_p) >= 0) {
991        $(".SubNavigation .links .level-0:eq(" + i + ")").addClass("selected");
992        _ok = false;
993      }
994    }
995    if (_ok) {
996      for (var i = 0; i < NHSSubMenu.length; i++) {
997        for (var j = 0; j < NHSSubMenu[i].length; j++) {
998          if (_p.lastIndexOf(NHSSubMenu[i][j], 0) === 0) {
999            $(".SubNavigation .links .level-0:eq(" + i + ")").addClass(
1000              "selected",
1001            );
1002          }
1003        }
1004      }
1005    }
1006  }
1007  function NHSAlignElmHeight() {
1008    var maxHeight = 0;
1009    var _elms = document.getElementsByClassName("NHSAlignHeight");
1010    for (var i = 0; i < _elms.length; i++) {
1011      var th = $(".NHSAlignHeight:eq(" + i + ")")
1012        .children()
1013        .eq(0)
1014        .children()
1015        .eq(0)
1016        .innerHeight();
1017      if (th > maxHeight) {
1018        maxHeight = th;
1019      }
1020    }
1021    for (var i = 0; i < _elms.length; i++) {
1022      $(".NHSAlignHeight:eq(" + i + ")")
1023        .children()
1024        .eq(0)
1025        .children()
1026        .eq(0)
1027        .innerHeight(maxHeight);
1028    }
1029  }
1030  var checkCheckBox = function (target, checked) {
1031    target.checked = checked;
1032  };
1033  var setTextInput = function (target, value) {
1034    target.value = value;
1035  };
1036  var setTextArea = function (target, value) {
1037    $(target).val(value).change();
1038  };
1039  var clearDropDownList = function (target) {
1040    $(target).val($(target).find("option:first").val());
1041  };
1042  var clearRadioButton = function (target) {
1043    $(target).prop("checked", false);
1044  };
1045  var checkAllCheckBoxes = function (target, checked) {
1046    var allCheckboxes = target.find("[type=checkbox]");
1047    $.each(allCheckboxes, function (index, item) {
1048      checkCheckBox(item, checked);
1049    });
1050  };
1051  var setAllTextInputs = function (target, value) {
1052    var all = target.find("[type=text]");
1053    $.each(all, function (index, item) {
1054      setTextInput(item, value);
1055    });
1056  };
1057  var setAllTextAreas = function (target, value) {
1058    var all = target.find("textarea");
1059    $.each(all, function (index, item) {
1060      clearDropDownList(item, value);
1061    });
1062  };
1063  var clearAllDropDownLists = function (target) {
1064    var all = target.find("select");
1065    $.each(all, function (index, item) {
1066      clearDropDownList(item);
1067    });
1068  };
1069  var clearAllRadioButtons = function (target) {
1070    var all = target.find("[type=radio]");
1071    $.each(all, function (index, item) {
1072      clearRadioButton(item);
1073    });
1074  };
1075  var clickSubmitButtons = function (targetWidget, targetSubmitButton) {
1076    var all = targetWidget.find("input:text");
1077    all.keyup(function (e) {
1078      if (e.keyCode == 13) {
1079        targetSubmitButton.click();
1080      }
1081    });
1082    $.each(all, function (index, item) {
1083      item.click();
1084    });
1085  };
1086})(jQuery);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.