{"version":3,"sources":["../../../../Wellness/SharedUI/Scripts/hrbl-config/hrbl-config-1.1.3.js","../../../../Wellness/SharedUI/Scripts/data-view-models/data-view-models-1.1.6.js","../../../../Wellness/SharedUI/Scripts/hrbl-ui/hrbl-ui-1.2.6.js","../../../../Wellness/SharedUI/Scripts/MyHerbalife.js","../../../../Wellness/SharedUI/Scripts/video.js"],"names":["_resolveScope","context","accessor","result","MvvmConfiguration","this","Activate","viewModelHelpers","wire","configure","makeModel","o","kendo","observable","mvvmUtil","asLoadable","bind","init","apply","ContentListModel","path","items","randomItem","originId","title","HL","Locale","getLocale","loading","dataHandler","data","set","Title","OriginId","Items","item","Math","floor","random","length","body","Body","shift","push","AnnouncementsListModel","viewAllText","viewAllLink","ViewAllText","ViewAllLink","index","announcement","CmsPageViewModel","defaultClass","determineCurrent","navItems","relatedPages","i","isCurrentPage","Link","cssClass","currentPage","previousPage","nextPage","url","currentLink","decodeURI","window","location","pathname","toLowerCase","leftNav","breadCrumbs","description","cssIconClass","canLoad","cmsData","clickableCrumbs","allCrumbs","slice","crumb1","crumb2","crumb3","pop","crumb","selfCrumb","classes","split","isArrayWithValues","name","value","get","hasLeftNav","hasBreadCrumbs","showRelatedPreview","target","$","currentTarget","closest","find","targetMid","height","toggleClass","on","e","offset","left","pageX","top","pageY","hideRelatedPreview","ProfileViewModel","urlPrefix","callMbox","mb","segment","adobe","getOffer","mbox","params","profile.Parameter1","success","response","applyOffer","selector","offer","element","undefined","wiredModel","attachTo","attr","wireModelsToElements","show","logger","log","error","status","timeout","callGlobalMbox","adobeFmtdProfileData","r","elementTgt","elementTgtId","replace","targetInfo","Name","Salutation","TeamLevelName","DisplayBizworksStatus","IsBizworksSubscriber","FullNamePattern","TargetInfo","targetCheck","simpleMediator","publish","campaigns","c","CampaignName","trim","removeClass","SegmentName","each","InboxViewModel","AlertCount","EnvelopeClass","totalNumber","AlertsViewModel","_currentIndex","_alertsContainerStorageKey","BannerAlerts","CurrentAlert","UpDownClass","ContainerPadding","Collapsed","NotificationColors","1","2","3","onBeforeLoad","sessionStorage","storeValue","getItem","visibleAlerts","msg","inArray","ValidPages","getNormalizedURL","alertData","colors","v","NotificationColor","BannerTypeId","CollapseClass","CanCollapse","getBannerType","previousAlert","bannerAlerts","nextAlert","getCurrentCount","localizedOf","getShouldShowBanner","isEnabled","getShouldHidePagination","collapseAlert","isCollapsed","setItem","CollapseNotification","event","notificationId","Id","notificationIndex","GetNotificationIndex","tempNotifications","extraSpace","outerHeight","maxH","children","first","minH","parseInt","css","HasLink","animate","IsCollapsed","map","obj","idx","IdomooVideoViewModel","flowPlayer","player","baseUrl","videoId","shouldPlay","hasVideo","thumbNail","pauseVideo","api","flowplayer","pause","video_href","showVideo","open","center","setCookie","cookie","expires","ok","cookieText","CartViewModel","id","quantity","subTotal","volumePoints","sku","loaded","reset","Quantity","DisplaySubtotal","VolumePoints","Sku","onLoadError","checkout","scope","load","onAfterLoad","href","viewSavedCarts","activationHandler","shouldHide","VolumeViewModel","CurrentMonthVolume","VolumeMonth","HeaderText","PlainHeaderText","PPV","DV","TV","PV","GV","HeaderVolume","LastMonthVolume","ChartData","MonthName","xhr","isArray","cleanHeaderText","IsCurrentMonth","setChartValues","createChart","statusText","volumeObject","volume","chart","kendoChart","dataSource","DataSource","chartArea","background","text","position","legend","visible","seriesDefaults","type","labels","series","field","color","gap","border","overlay","gradient","categoryAxis","majorGridLines","valueAxis","tooltip","template","dismissableUiModel","deferDurationDays","externalContent","saveChoice","newMode","newDate","mode","deferDate","prefix","closeWindow","isStorageSupported","dismissMode","session","storeItem","localStorage","store","itemName","key","removeItem","itemKey","storeageKeyPrefix","ifPromoModal","contentType","isClosed","dVM","subscribe","promoModalMboxClosed","itemPrefix","actualWidget","callToAction","showMeLater","doNotShowAgain","imgSrc","later","indefinite","deferDays","_API_PATH","that","modalOpened","userChoice","queryTag","encodeURIComponent","reason","now","Date","isVisible","choice","openWindow","profileViewModel","getInstance","isModelBoundToElement","setTargetInfo","reasonText","widget","onWaiting","isPublished","onWaiting2","isModalOpened","modalData","image","callToActionButton","doNotShowAgainButton","alertId","post","done","fail","parent","resize","setOptions","modal","img","prop","hide","close","onDismissOnce","onDismissForLater","actionType","deferUntil","setDate","getDate","onDismissIndefinite","onCallToAction","onReset","setDisplayBehavior","validModal","modalNotifClosed","Array","popupNotifications","found","topNavViewModel","hideNav","navItem","flag","isMobileNav","hideElement","waiting","nextNavItem","setTimeout","className","getFirstChild","nodeName","nextSibling","style","display","firstChild","nodeType","isMobile","Util","Browser","any","isSmallScreen","dimensions","Width","previousNavItem","openLevel","actualNav","parentNode","relatedTarget","mobileNavViewModel","UrlEncriptionViewModel","sendURL","delegateTarget","search","temp","_AnalyticsFacts_","modalWindowViewModel","titleelement","titleElement","icon","iconElement","modalElement","UImodal","resizable","animation","effects","addClass","SessionMsgViewModel","cookieName","isOldIE","OldIE","Cookie","getCookie","IE","isTheBrowser","actualVersion","slideDown","closeMessage","slideUp","document","alphaNumericNoSpace","input","String","fromCharCode","which","regex","test","shiftKey","keyCode","preventDefault","scrollFixed","leftMenuFixed","leftMenuOffset","scroll","scrollTop","hasClass","openEventDetailWindow","eventID","arr","URL","openEventDetailWindowAnonmyous","addClickEventToLink","linkElement","getElementById","click","onclick","eval","AC_AddExtension","src","ext","indexOf","AC_Generateobj","objAttrs","embedAttrs","str","write","AC_FL_RunContent","ret","AC_GetArgs","arguments","AC_SW_RunContent","args","srcParamName","classid","mimeType","Object","currArg","dynamicDividerLine","offsetHeight","tab1_col1_height","tab1_col2_height","tab1_tallest","adjustDividerLineTab2","tab2_col1_height","tab2_col2_height","tab2_tallest","adjustDividerLineTab3","tab3_col1_height","tab3_col2_height","tab3_tallest","hideAllWraps","showDynamicWrap1a","showDynamicWrap1b","showDynamicWrap2","showDynamicWrap3","showHealthyIcons","hideHealthyIcons","toggleTab","backgroundImage","getXmlHttpRequestObject","XMLHttpRequest","xmlHttp","ActiveXObject","OpenWindow","strLink","width","strName","blnSizeWindow","strWidth","strHeight","strTop","strLeft","strProp","screen","availWidth","availHeight","_top","_left","oWindow","focus","checkMaxQuantity","max","srcElement","alert","checkSKU","ctrl","inputAmounts","getElementsByTagName","p","newString","checkQuantity","keynum","keychar","cancelBubble","returnValue","checkAmount","allowdecimal","valid","CVVKeyPress","totaldue","maxlen","useComma","eSource","GetEventSource","amtField","balanceField","findBalanceField","amount","balance","parseFloat","AmountLosingFocus","allowDecimals","ftotaldue","total","hasCommas","toFixed","val","isNaN","HideButtons","checkout1","checkout2","displayButton","DisableOnClick","button","DisableOnClick2","AmoutLosingFocus","Function","prototype","instantiate","constructorArguemnts","invokable","customBindings","k","binders","oneWayValueFromDOM","Binder","extend","refresh","valueFromDOM","bindings","centerWindow","options","fn","call","getWidget","fieldName","parents","confirmedClick","binding","method","source","message","confirm","configuration","x","wireMode","shared","own","defaultMode","sharedInstances","ownInstances","modelsCreatedListeners","modelName","instance","proto","initializeModel","activateLoaders","notifyModelsCreated","f","parseConstructorArguments","a","parsed","JSON","parse","applyHelper","e2","parsedArgs","model","e1","modelsCreated","modelsCreatedListener","toObservable","_events","change","selectors","sender","err","genericDataLoader","ajax","xhrFields","withCredentials","toLoadable","asObservable","topics","topic","callback","l","subscription","ctx","cb","constructor","logToConsole","console","Stash","isSupported","local","Android","navigator","userAgent","match","BlackBerry","iOS","Opera","Windows","whatBrowser","Chrome","Firefox","Safari","Explorer","all","jscriptMap","jscriptVersion","5.5","5.6","5.7","5.8","9","10","11","Height","Lib","resolveScope","moduleExtender","moduleArray","ModuleList","depsExtender","depsArray","require","deps","Url","getUrlParameter","queryParameterName","RegExp","encodeURI","UI","_guid","eWidth","wWidth","newLeft","scrollTo","config","xpos","ypos","Kendo","Validation","Create","ele","kendoValidator","Notification","Defaults","hideDelay","pinned","stacking","appendTo","Level","Success","Error","Info","Warning","kendoNotification","autoHideAfter","templates","byCookie","byURL","locale","nurl","ca","charAt","substring","values","j","IdleLogout","Act","Handle","Action","Interval","Warn","cfg","setIfDefined","tryReset","start","clearTimeout","tryStart","conflictElement","addConflictElement","hideConflictElements","showConflictElements","coreMvvm","cartVM","remove","leftMenuVar","filter","link","testElement","createElement","before","focusin","blur","keypress","substr","is","stopImmediatePropagation","localeSelectorChangeHandler","selectedIndex","jqXHR","textStatus","errorThrown","kendoDropDownList","nav","navPos","h","resizeId","hrblModal","live","removeAttr","actualModal","numPar","actualDiv","currentPar","html","nextDiv","next","fadeOut","fadeIn","prev","slideToggle","separator","idleWarningWindow","idleWarningContentUrl","LanguageCode","CountryCode","handle","logoutUrl","prepend","ready","rToken","append","decodeURIComponent"],"mappings":"AAiWA,QAASA,eAAcC,EAASC,GAC5B,GAAIC,GAASF,EAAQC,IAAaD,CAClC,OAAOE,GAmWX,QAASC,qBAELC,KAAKC,SAAW,WACZC,iBAAiBC,KAAKC,WAAYC,UAAW,SAAUC,GAAK,MAAOC,OAAMC,WAAWN,iBAAiBO,SAASC,WAAWJ,KAAQK,KAAMJ,MAAMI,KAAMC,KAAM,SAAUC,SCxsB3K,QAASC,kBAAiBC,GACtBf,KAAKgB,SACLhB,KAAKiB,WAAa,KAClBjB,KAAKkB,SAAW,KAChBlB,KAAKmB,MAAQ,KACbnB,KAAKe,KAAO,IAAMK,GAAGC,OAAOC,YAAc,2BAA6BP,EAAO,SAC9Ef,KAAKuB,SAAU,EACfvB,KAAKwB,YAAc,SAAUC,GACzB,GAAY,MAARA,EAKA,GAJAzB,KAAK0B,IAAI,WAAW,GACpB1B,KAAK0B,IAAI,UAAU,GACnB1B,KAAK0B,IAAI,QAASD,EAAKE,OACvB3B,KAAK0B,IAAI,WAAYD,EAAKG,UACtBH,EAAKI,MAAO,CACZ,GAAIC,GAAOL,EAAKI,MAAME,KAAKC,MAAMD,KAAKE,SAAWR,EAAKI,MAAMK,QAM5D,KAJAlC,KAAK0B,IAAI,cACLR,SAAUY,EAAKF,UAAY,GAC3BO,KAAML,EAAKM,MAAQ,KAEhBN,EAAOL,EAAKI,MAAMQ,SACrBrC,KAAKgB,MAAMsB,MACPpB,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,QAAQstB,OAAO,wWAA0WttB,EAAE,qBAAqBjE,KAAK,cAAgB,kBAAoBiE,EAAE,qBAAqBjE,KAAK,aAAe,kBAAoBsxB,EAAS,wMAAyMrtB,EAAE,QAAQstB,OAAOC,mBAAmB,2CAA6CvtB,EAAE,qBAAqBjE,KAAK,cAAgB,IAAMiE,EAAE,qBAAqBjE,KAAK,aAAe,6CAG13BiE,EAAE,qBAAqBxD,OAAS,IAChCwD,EAAE,QAAQstB,OAAO,oYAAsYttB,EAAE,qBAAqBjE,KAAK,cAAgB,kBAAoBiE,EAAE,qBAAqBjE,KAAK,aAAe,mIAClgBiE,EAAE,QAAQstB,OAAOC,mBAAmB,2CAA6CvtB,EAAE,qBAAqBjE,KAAK,cAAgB,IAAMiE,EAAE,qBAAqBjE,KAAK,aAAe,6CAG9KiE,EAAE,qBAAqBxD,OAAS,IAChCwD,EAAE,QAAQstB,OAAO,wWAA0WttB,EAAE,qBAAqBjE,KAAK,cAAgB,kBAAoBiE,EAAE,qBAAqBjE,KAAK,aAAe,kBAAoBsxB,EAAS,sRACngBrtB,EAAE,QAAQstB,OAAOC,mBAAmB,2CAA6CvtB,EAAE,qBAAqBjE,KAAK,cAAgB,IAAMiE,EAAE,qBAAqBjE,KAAK,aAAe,6CAG9KiE,EAAE,qBAAqBxD,OAAS,IAChCwD,EAAE,QAAQstB,OAAO,wWAA0WttB,EAAE,qBAAqBjE,KAAK,cAAgB,kBAAoBiE,EAAE,qBAAqBjE,KAAK,aAAe,kBAAoBsxB,EAAS,iIACngBrtB,EAAE,QAAQstB,OAAOC,mBAAmB,2CAA6CvtB,EAAE,qBAAqBjE,KAAK,cAAgB,IAAMiE,EAAE,qBAAqBjE,KAAK,aAAe","file":"common.js","sourcesContent":["// --------------------------------------------------------------------------------------------------------------------\r\n// \r\n// Herbalife 2014\r\n// \r\n// \r\n// Base file for require JS modules\r\n// \r\n// \r\n// DTS - Content DEV UI | DTS - Integration \r\n// \r\n// --------------------------------------------------------------------------------------------------------------------\r\n\r\n// namespace HL defined\r\nvar HL = HL || {};\r\nHL['Util'] || (HL.Util = {});\r\n\r\n\r\n// prototypes\r\n\r\nFunction.prototype.instantiate = function (constructorArguemnts) {\r\n var context = this,\r\n invokable = function () {\r\n context.apply(this, constructorArguemnts);\r\n };\r\n\r\n invokable.prototype = context.prototype;\r\n return new invokable();\r\n};\r\n\r\nviewModelHelpers = (function ($, kendo) {\r\n var customBindings = function (k) {\r\n // Kendo binding to set a view model's field from HTML one way (in case DOM bound to model, but model value shoudl be passed from DOM)\r\n k.data.binders.oneWayValueFromDOM = k.data.Binder.extend({\r\n refresh: function () {\r\n // HTML5 supports this.element.dataset.initialvalue / but compatibility with IE is an issue so use $().attr()\r\n var valueFromDOM = $(this.element).data('initialvalue');\r\n this.bindings.oneWayValueFromDOM.set(valueFromDOM);\r\n }\r\n });\r\n\r\n //Kendo Window Center\r\n k.data.binders.widget.centerWindow = k.data.Binder.extend({\r\n init: function (widget, bindings, options) {\r\n try {\r\n k.data.Binder.fn.init.call(this, widget.element[0], bindings, options);\r\n var flag = String(this.bindings['centerWindow'].path) === \"true\";\r\n flag && widget && widget.center && widget.center();\r\n } catch (error) {\r\n logger.log(error);\r\n }\r\n },\r\n refresh: function () {\r\n }\r\n });\r\n\r\n k.data.binders.widget.getWidget = k.data.Binder.extend({\r\n init: function (widget, bindings, options) {\r\n try {\r\n k.data.Binder.fn.init.call(this, widget.element[0], bindings, options);\r\n var fieldName = String(this.bindings['getWidget'].path);\r\n bindings.getWidget.parents[0][fieldName] = widget;\r\n } catch (error) {\r\n logger.log(error);\r\n }\r\n },\r\n refresh: function () {\r\n }\r\n });\r\n\r\n k.data.binders.confirmedClick = k.data.Binder.extend({\r\n init: function (element, bindings, options) {\r\n try {\r\n k.data.Binder.fn.init.call(this, element, bindings, options);\r\n var binding = bindings['confirmedClick'];\r\n var method = binding.source.get(binding.path);\r\n var message = $(element).data('confirm-message');\r\n $(element).bind(\"click\", function (e) {\r\n if (window.confirm(message)) {\r\n method.call(binding.source, e);\r\n }\r\n });\r\n } catch (error) {\r\n logger.log(error);\r\n }\r\n },\r\n refresh: function () { }\r\n });\r\n };\r\n var wire = (function () {\r\n var configuration = {\r\n makeModel: function (x) { return x; },\r\n bind: function (x) { return x; },\r\n init: function () {\r\n },\r\n };\r\n\r\n var wireMode = {\r\n shared: \"shared\",\r\n own: \"own\"\r\n };\r\n\r\n var defaultMode = wireMode.shared;\r\n\r\n var sharedInstances = {};\r\n\r\n var ownInstances = [];\r\n\r\n var modelsCreatedListeners = [];\r\n\r\n var getInstance = function (modelName, mode, args) {\r\n var instance = null;\r\n\r\n // if shared exists, return it.\r\n if (mode == wireMode.shared && sharedInstances[modelName]) {\r\n return sharedInstances[modelName];\r\n }\r\n\r\n // create instance\r\n //var target = new window[modelName];\r\n\r\n var proto = window[modelName];\r\n\r\n var target = proto.instantiate(args);\r\n\r\n instance = configuration.makeModel(target) || target;\r\n\r\n\r\n // stash if shared\r\n if (mode == wireMode.shared) {\r\n sharedInstances[modelName] = instance;\r\n } else {\r\n ownInstances.push(instance);\r\n }\r\n\r\n return instance;\r\n\r\n };\r\n\r\n var initializeModel = function (instance) {\r\n instance && instance[configuration.init] && instance[configuration.init]();\r\n };\r\n\r\n var activateLoaders = function () {\r\n for (var modelName in sharedInstances) {\r\n initializeModel(sharedInstances[modelName]);\r\n }\r\n\r\n for (var i = 0; i < ownInstances.length; i++) {\r\n initializeModel(ownInstances[i]);\r\n }\r\n };\r\n\r\n var notifyModelsCreated = function () {\r\n for (var i = 0; i < modelsCreatedListeners.length; i++) {\r\n try {\r\n modelsCreatedListeners[i]();\r\n } catch (error) {\r\n logger.log(error);\r\n }\r\n }\r\n };\r\n\r\n var configure = function (obj) {\r\n for (var f in obj) {\r\n configuration[f] = obj[f];\r\n }\r\n\r\n return this;\r\n };\r\n\r\n var parseConstructorArguments = function (args) {\r\n var a, result = [];\r\n\r\n while ((a = args.shift()) && a) {\r\n var parsed = JSON.parse($.trim(a));\r\n result.push(parsed);\r\n }\r\n return result;\r\n };\r\n var apply = function (element) {\r\n\r\n if (element == undefined) {\r\n $('[wire-model]').each(function () {\r\n applyHelper(this);\r\n });\r\n }\r\n\r\n else {\r\n applyHelper(element);\r\n }\r\n\r\n try {\r\n notifyModelsCreated();\r\n activateLoaders();\r\n } catch (e2) {\r\n logger.log(e2);\r\n }\r\n\r\n return this;\r\n };\r\n\r\n var applyHelper = function (obj) {\r\n try {\r\n // config\r\n var args = ($(obj).attr(\"wire-mode\") || defaultMode).split(','),\r\n parsedArgs,\r\n mode,\r\n modelName = $(obj).attr(\"wire-model\");\r\n\r\n // first arg is the mode.\r\n mode = ($.trim(args.shift()) == wireMode.own) ? wireMode.own : defaultMode;\r\n\r\n // rest to be parsed from the mode initialization\r\n parsedArgs = parseConstructorArguments(args);\r\n\r\n // model\r\n var model = getInstance(modelName, mode, parsedArgs);\r\n\r\n //adding obj to model\r\n model.obj = obj;\r\n\r\n // binding\r\n configuration.bind(obj, model);\r\n } catch (e1) {\r\n logger.log(\"ApplyHelper func: \" + e1 + \" @\" + modelName);\r\n }\r\n };\r\n\r\n var modelsCreated = function (modelsCreatedListener) {\r\n if (!modelsCreatedListener) {\r\n return;\r\n }\r\n modelsCreatedListeners.push(modelsCreatedListener);\r\n };\r\n\r\n return {\r\n apply: apply,\r\n configure: configure,\r\n getInstance: getInstance,\r\n mode: wireMode,\r\n configuration: configuration,\r\n modelsCreated: modelsCreated,\r\n };\r\n }());\r\n\r\n var mvvmUtil = (function () {\r\n\r\n var toObservable = function (obj) {\r\n return kendo.observable(obj);\r\n };\r\n\r\n var isModelBoundToElement = function (obj) {\r\n return obj && obj._events && obj._events.change;\r\n };\r\n\r\n var wireModelsToElements = function (selectors) {\r\n var instance = this;\r\n\r\n // each selector, each element found by selector\r\n $.each(selectors, function (i, selector) {\r\n $(selector).each(function (index, sender) {\r\n try {\r\n kendo.bind(sender, instance);\r\n } catch (err) {\r\n logger.log('wireModelsToElements encountered binding error' + err);\r\n }\r\n });\r\n });\r\n\r\n return instance;\r\n };\r\n\r\n var genericDataLoader = function (obj) {\r\n var instance = obj || this;\r\n if (!instance.isModelBoundToElement(instance)) {\r\n return;\r\n }\r\n\r\n if (!instance.get('canLoad') == true) {\r\n // should not load now.\r\n return;\r\n }\r\n\r\n if (!this.path) {\r\n // no way to load\r\n return;\r\n }\r\n\r\n if (instance.onBeforeLoad) {\r\n instance.onBeforeLoad();\r\n }\r\n\r\n $.ajax({\r\n type: \"GET\",\r\n url: this.path,\r\n xhrFields: {\r\n withCredentials: true\r\n }\r\n })\r\n .done(function (context, status, xhr) {\r\n if (instance.dataHandler) {\r\n instance.dataHandler(context, status, xhr);\r\n } else {\r\n logger.log('No data handler found for data returned from ' + this.path);\r\n }\r\n\r\n if (instance.onAfterLoad) {\r\n instance.onAfterLoad();\r\n }\r\n })\r\n .fail(function (context, status, error) {\r\n logger.log(status + ' : ' + error + \" on \" + this.url);\r\n if (instance.onLoadError) {\r\n instance.onLoadError(context, status, error);\r\n }\r\n });\r\n };\r\n\r\n var toLoadable = function (obj) {\r\n // assign standard behavior unless exists on obj\r\n obj.load = obj.load || genericDataLoader;\r\n obj.canLoad = !(obj.canLoad === false);\r\n obj.isModelBoundToElement = obj.isModelBoundToElement || isModelBoundToElement;\r\n obj.wireModelsToElements = obj.wireModelsToElements || wireModelsToElements;\r\n\r\n return obj;\r\n };\r\n\r\n return {\r\n isModelBoundToElement: isModelBoundToElement,\r\n\r\n wireModelsToElements: wireModelsToElements,\r\n\r\n attachTo: function (obj) { return toLoadable(toObservable(obj)); },\r\n\r\n asObservable: toObservable,\r\n\r\n asLoadable: toLoadable\r\n };\r\n\r\n }());\r\n\r\n // register custom bindigs\r\n customBindings(kendo);\r\n\r\n return {\r\n wire: wire,\r\n mvvmUtil: mvvmUtil\r\n };\r\n\r\n})($, kendo);\r\n\r\n\r\nfunction _resolveScope(context, accessor) {\r\n var result = context[accessor] || context;\r\n return result;\r\n}\r\n\r\nvar simpleMediator = (function () {\r\n var topics = {};\r\n\r\n // topic: thing to subscribe to, some name\r\n // fn: function to call back when someone publishes to that topic.\r\n var subscribe = function (topic, fn) {\r\n\r\n if (!topics[topic]) {\r\n topics[topic] = [];\r\n }\r\n\r\n topics[topic].push({ context: this, callback: fn });\r\n\r\n return this;\r\n\r\n };\r\n\r\n // topic: the topic listeners attach to.\r\n // further arguments may be supplied after the topic, which will be relayed to the subscribers\r\n var publish = function (topic) {\r\n var args;\r\n var response;\r\n\r\n if (!topics[topic]) {\r\n return false;\r\n }\r\n\r\n args = Array.prototype.slice.call(arguments, 1);\r\n for (var i = 0, l = topics[topic].length; i < l; i++) {\r\n\r\n var subscription = topics[topic][i],\r\n ctx = subscription.context,\r\n cb = subscription.callback,\r\n fn = (typeof cb == \"string\" || (typeof cb == \"object\" && cb.constructor === String)) ? ctx[cb] : cb;\r\n\r\n response = fn.apply(ctx, args);\r\n }\r\n return response || this;\r\n };\r\n\r\n var isPublished = function (topic) {\r\n return !topics[topic] ? false : true;\r\n };\r\n\r\n return {\r\n publish: publish,\r\n subscribe: subscribe,\r\n isPublished: isPublished,\r\n attachTo: function (obj) {\r\n obj.subscribe = subscribe;\r\n obj.publish = publish;\r\n obj.isPublished = isPublished;\r\n return obj;\r\n }\r\n };\r\n\r\n}());\r\n\r\nvar logger = (function () {\r\n var logToConsole = function (message) {\r\n if (window.console && window.console.log) {\r\n window.console.log(message);\r\n }\r\n };\r\n return {\r\n log: logToConsole\r\n };\r\n}());\r\n\r\nHL.Util.Stash = (function () {\r\n\r\n var isSupported = function () {\r\n return (typeof (Storage) !== \"undefined\" || sessionStorage && localStorage);\r\n };\r\n\r\n var setItem = function (store, key, value) {\r\n if (!isSupported || !store) {\r\n return false;\r\n }\r\n\r\n\r\n if (value) {\r\n store.setItem(key, value);\r\n } else {\r\n store.removeItem(key);\r\n }\r\n\r\n return true;\r\n };\r\n\r\n var getItem = function (store, key) {\r\n return store.getItem(key);\r\n };\r\n\r\n return {\r\n isSupported: isSupported,\r\n session: { set: function (k, v) { return setItem(sessionStorage, k, v); }, get: function (k) { return getItem(sessionStorage, k); } },\r\n local: { set: function (k, v) { return setItem(localStorage, k, v); }, get: function (k) { return getItem(localStorage, k); } }\r\n };\r\n})();\r\n\r\nHL.Util.Browser = {\r\n\r\n //simple dirty mobile OS detection\r\n isMobile: {\r\n Android: function () {\r\n return navigator.userAgent.match(/Android/i);\r\n },\r\n BlackBerry: function () {\r\n return navigator.userAgent.match(/BlackBerry/i);\r\n },\r\n iOS: function () {\r\n return navigator.userAgent.match(/iPhone|iPad|iPod/i);\r\n },\r\n Opera: function () {\r\n return navigator.userAgent.match(/Opera Mini/i);\r\n },\r\n Windows: function () {\r\n return navigator.userAgent.match(/IEMobile/i);\r\n },\r\n any: function () {\r\n return (this.Android() || this.BlackBerry() || this.iOS() || this.Opera() || this.Windows());\r\n }\r\n },\r\n\r\n //simple dirty browser detection\r\n whatBrowser: {\r\n Chrome: function () {\r\n return !(navigator.userAgent.indexOf('Chrome') > -1 && navigator.userAgent.toLowerCase().indexOf(\"op\") > -1) ? navigator.userAgent.match(/Chrome/i) : null;\r\n },\r\n Firefox: function () {\r\n return navigator.userAgent.match(/Firefox/i);\r\n },\r\n Safari: function () {\r\n return !(navigator.userAgent.indexOf('Chrome') > -1 && navigator.userAgent.indexOf(\"Safari\") > -1) ? navigator.userAgent.match(/Safari/i) : null;\r\n },\r\n Explorer: function () {\r\n return navigator.userAgent.match(/MSIE/i);\r\n },\r\n //detection for the 4 major supported browsers\r\n all: function () {\r\n return (this.Chrome() || this.Firefox() || this.Safari() || this.Explorer());\r\n }\r\n },\r\n\r\n //IE real detection browser\r\n IE: function () {\r\n \"use strict\";\r\n var ret, isTheBrowser, actualVersion, jscriptMap, jscriptVersion;\r\n\r\n isTheBrowser = false;\r\n jscriptMap = { \"5.5\": \"5.5\", \"5.6\": \"6\", \"5.7\": \"7\", \"5.8\": \"8\", \"9\": \"9\", \"10\": \"10\", \"11\": \"11\" };\r\n jscriptVersion = new Function(\"/*@cc_on return @_jscript_version; @*/\")();\r\n\r\n if (jscriptVersion !== undefined) {\r\n isTheBrowser = true;\r\n actualVersion = jscriptMap[jscriptVersion];\r\n if (actualVersion === undefined) {\r\n actualVersion = jscriptVersion;\r\n }\r\n }\r\n\r\n ret = { isTheBrowser: isTheBrowser, actualVersion: actualVersion };\r\n\r\n return ret;\r\n },\r\n\r\n dimensions: {\r\n Height: function () {\r\n return $(window).height();\r\n },\r\n Width: function () {\r\n return $(window).width();\r\n }\r\n\r\n }\r\n};\r\n\r\nHL.Util.Lib = {\r\n resolveScope: function (context, accessor) {\r\n var result = context[accessor] || context;\r\n return result;\r\n },\r\n\r\n moduleExtender: function (moduleArray) {\r\n for (var i = 0; i < length.moduleArray; i++) {\r\n HL.ModuleList.push(moduleArray[i]);\r\n }\r\n },\r\n\r\n depsExtender: function (depsArray) {\r\n for (var i = 0; i < length.depsArray; i++) {\r\n require.deps.push(depsArray[i]);\r\n }\r\n }\r\n};\r\n\r\nHL.Util.Url = {\r\n getUrlParameter: function (queryParameterName) {\r\n return decodeURI(\r\n window.location.search.replace(\r\n new RegExp(\"^(?:.*[&\\\\?]\" + encodeURI(queryParameterName).replace(/[\\.\\+\\*]/g, \"\\\\$&\") + \"(?:\\\\=([^&]*))?)?.*$\", \"i\"), \"$1\")\r\n );\r\n }\r\n};\r\n\r\nHL.Util.UI = {\r\n centerWindow: function (e) {\r\n if (!$(\".\" + e.sender._guid)[1]) {\r\n var element = e.element.parent(),\r\n eWidth = element.width(),\r\n wWidth = $(window).width(),\r\n\r\n newLeft = Math.floor(wWidth / 2 - eWidth / 2);\r\n e.element.parent().css({ left: newLeft });\r\n }\r\n },\r\n\r\n scrollTo: function (config) {\r\n config = config || {};\r\n\r\n if (config.element == null) {\r\n var xpos = config.xpos || 0;\r\n var ypos = config.ypos || 0;\r\n\r\n window.scrollTo(xpos, ypos);\r\n } else {\r\n var offset = config.element.offset();\r\n window.scrollTo(offset.left, offset.top);\r\n }\r\n }\r\n};\r\n\r\nHL.Util.Kendo = {\r\n Validation: {\r\n Create: function (ele) {\r\n var result = ele.kendoValidator().data(\"kendoValidator\");\r\n return result;\r\n }\r\n },\r\n\r\n\r\n Notification: {\r\n\r\n Defaults: { parent: \"#hrblNotifications\", hideDelay: 0, pinned: true, top: 30, stacking: 'down', appendTo: null },\r\n\r\n Level: { Success: 'success', Error: 'error', Info: 'info', Warning: 'warning' },\r\n\r\n Create: function (config) {\r\n var result;\r\n\r\n config = config || {};\r\n\r\n result = $((config.parent || HL.Util.Kendo.Notification.Defaults.parent)).kendoNotification({\r\n position: {\r\n pinned: config.pinned || HL.Util.Kendo.Notification.Defaults.pinned,\r\n top: config.top || HL.Util.Kendo.Notification.Defaults.top\r\n },\r\n autoHideAfter: config.hideDelay || HL.Util.Kendo.Notification.Defaults.hideDelay,\r\n stacking: config.stacking || HL.Util.Kendo.Notification.Defaults.stacking,\r\n appendTo: config.appendTo || HL.Util.Kendo.Notification.Defaults.appendTo,\r\n show: HL.Util.UI.centerWindow,\r\n templates: [\r\n {\r\n type: HL.Util.Kendo.Notification.Level.Success,\r\n template: '
#= message #
'\r\n }, {\r\n type: HL.Util.Kendo.Notification.Level.Error,\r\n template: '
#= message #Hide
'\r\n }, {\r\n type: HL.Util.Kendo.Notification.Level.Info,\r\n template: '
#= message #Hide
'\r\n }, {\r\n type: HL.Util.Kendo.Notification.Level.Warning,\r\n template: '
#= message #Hide
'\r\n }\r\n ],\r\n\r\n }).data(\"kendoNotification\");\r\n\r\n return result;\r\n }\r\n }\r\n};\r\n\r\nHL.Locale = (function () {\r\n\r\n var byCookie = function () {\r\n return HL.Cookie.getCookie('HerbalifeUser', 'Locale');\r\n };\r\n\r\n var byURL = function () {\r\n locale = location.pathname.split(\"/\")[1];\r\n return locale.match(/[A-Za-z]{2}-[A-Za-z]{2}/) != null ? locale : false;\r\n };\r\n\r\n var getNormalizedURL = function () {\r\n\r\n var nurl = location.pathname;\r\n var regex = new RegExp(\"^/\" + getLocale(), \"ig\");\r\n nurl = nurl.replace(regex, \"\");\r\n nurl = nurl.replace(/\\/(Mb|Ds)$/i, \"\");\r\n\r\n return nurl;\r\n };\r\n\r\n var getLocale = function () {\r\n return byURL() ? byURL() : byCookie();\r\n };\r\n\r\n\r\n return {\r\n getLocale: getLocale,\r\n getNormalizedURL: getNormalizedURL\r\n };\r\n\r\n})();\r\n\r\nHL.Cookie = (function () {\r\n\r\n var getCookie = function (name, value) {\r\n var name = name + \"=\";\r\n var ca = document.cookie.split(';');\r\n for (var i = 0; i < ca.length; i++) {\r\n var c = ca[i];\r\n while (c.charAt(0) == ' ') {\r\n c = c.substring(1);\r\n }\r\n\r\n if (c.indexOf(name) == 0) {\r\n if (value) {\r\n var values = c.substring(name.length, c.length).split('&');\r\n for (var j = 0; j < values.length; j++) {\r\n if (values[j].indexOf(value) == 0) {\r\n return values[j].substring(value.length + 1, values[j].length);\r\n }\r\n }\r\n }\r\n else {\r\n return c.substring(name.length, c.length);\r\n }\r\n }\r\n }\r\n return \"\";\r\n };\r\n\r\n return {\r\n getCookie: getCookie\r\n }\r\n\r\n})();\r\n\r\nfunction MvvmConfiguration() {\r\n\r\n this.Activate = function () {\r\n viewModelHelpers.wire.configure({ makeModel: function (o) { return kendo.observable(viewModelHelpers.mvvmUtil.asLoadable(o)); }, bind: kendo.bind, init: 'load' }).apply();\r\n };\r\n}","// content list view model - generic CMS content lists \r\nfunction ContentListModel(path) {\r\n this.items = [];\r\n this.randomItem = null;\r\n this.originId = null;\r\n this.title = null;\r\n this.path = \"/\" + HL.Locale.getLocale() + '/api/ContentListItem?id=' + path + \"&tags=\";\r\n this.loading = true;\r\n this.dataHandler = function (data) {\r\n if (data != null) {\r\n this.set('loading', false);\r\n this.set('loaded', true);\r\n this.set(\"title\", data.Title);\r\n this.set(\"originId\", data.OriginId);\r\n if (data.Items) {\r\n var item = data.Items[Math.floor(Math.random() * data.Items.length)];\r\n\r\n this.set('randomItem', {\r\n originId: item.OriginId || '',\r\n body: item.Body || ''\r\n });\r\n while (item = data.Items.shift()) {\r\n this.items.push({\r\n originId: item.OriginId || '',\r\n body: item.Body || ''\r\n });\r\n }\r\n } else {\r\n this.set('error', true);\r\n this.set('loading', false);\r\n }\r\n }\r\n };\r\n}\r\n\r\nfunction AnnouncementsListModel() {\r\n this.items = [];\r\n this.title = null;\r\n this.viewAllText = null;\r\n this.viewAllLink = null;\r\n this.path = \"/\" + HL.Locale.getLocale() + '/api/Announcements/';\r\n this.loading = true;\r\n\r\n this.dataHandler = function (data) {\r\n if (data.Items.length == 0) {\r\n this.set('emptyModel', true);\r\n } else {\r\n this.set('emptyModel', false);\r\n }\r\n if (data != null) {\r\n this.set('loading', false);\r\n this.set('loaded', true);\r\n this.set(\"title\", data.Title);\r\n this.set(\"viewAllText\", data.ViewAllText);\r\n this.set(\"viewAllLink\", data.ViewAllLink);\r\n if (data.Items) {\r\n for (var index = 0; index < data.Items.length; index++) {\r\n var item = data.Items[index];\r\n var announcement = {\r\n body: item.Body || ''\r\n };\r\n this.items.push(announcement);\r\n }\r\n }\r\n } else {\r\n this.set('error', true);\r\n this.set('loading', false);\r\n }\r\n };\r\n}\r\n\r\n// cms published page support (breadcrumbs, left nav, previous next navigation handles\r\nfunction CmsPageViewModel(data) {\r\n var defaultClass = 'darkgreyB';\r\n this.determineCurrent = function (navItems) {\r\n this.relatedPages = [];\r\n for (var i = 0; i < navItems.length; i++) {\r\n if (isCurrentPage(navItems[i].Link)) {\r\n navItems[i].cssClass = 'active';\r\n this.currentPage = navItems[i];\r\n if (i > 0) this.previousPage = navItems[(i - 1)];\r\n if ((i + 1) < navItems.length) this.nextPage = navItems[i + 1];\r\n } else {\r\n this.relatedPages.push(navItems[i]);\r\n }\r\n }\r\n return navItems;\r\n };\r\n\r\n var isCurrentPage = function (url) {\r\n var currentLink = decodeURI(window.location.pathname.toLowerCase());\r\n return (url && url.toLowerCase() == currentLink);\r\n };\r\n\r\n this.currentPage = null;\r\n this.nextPage = null;\r\n this.previousPage = null;\r\n this.relatedPages = null;\r\n this.leftNav = null;\r\n this.breadCrumbs = null;\r\n this.title = null;\r\n this.description = null;\r\n this.cssClass = null;\r\n this.cssIconClass = null;\r\n this.canLoad = false;\r\n var cmsData = data || window.cmsData;\r\n // support for sub header and breadcrumbs\r\n if (cmsData) {\r\n this.leftNav = this.determineCurrent(cmsData.leftNav);\r\n\r\n this.breadCrumbs = cmsData.breadCrumbs;\r\n this.clickableCrumbs = [];\r\n this.title = cmsData.title;\r\n this.description = cmsData.description;\r\n\r\n // breadcrumb fixed elements\r\n if (this.breadCrumbs && this.breadCrumbs.length > 2) {\r\n var allCrumbs = this.breadCrumbs.slice(0);\r\n\r\n this.crumb1 = allCrumbs.shift();\r\n this.crumb2 = allCrumbs.shift();\r\n\r\n // cms creates L5 links for sibling match for 'category' \r\n // use the depth 4 item as 3rd crumb\r\n if (allCrumbs.length == 4) {\r\n allCrumbs.shift();\r\n this.crumb3 = allCrumbs.shift();\r\n } else {\r\n // use own parent as 3rd crumb\r\n allCrumbs.pop(); // one before last (self)\r\n this.crumb3 = allCrumbs.pop();\r\n }\r\n\r\n // side by side support for dynamic crumbs\r\n allCrumbs = this.breadCrumbs.slice(2);\r\n var crumb;\r\n while (crumb = allCrumbs.shift()) {\r\n if (crumb.Link && crumb.Link.length > 2) {\r\n this.clickableCrumbs.push(crumb);\r\n }\r\n }\r\n this.selfCrumb = this.clickableCrumbs.pop();\r\n }\r\n\r\n var classes = ('' + cmsData.cssClass).split(' ');\r\n this.cssIconClass = classes.length > 0 && classes[0].length > 1 ? classes[0] : defaultClass;\r\n this.cssClass = classes.length > 1 && classes[1].length > 1 ? classes[1] : defaultClass;\r\n }\r\n\r\n this.isArrayWithValues = function (name) {\r\n var value = this.get(name);\r\n return (value && value.length > 0);\r\n };\r\n\r\n this.hasLeftNav = function () {\r\n return this.isArrayWithValues('leftNav');\r\n };\r\n\r\n this.hasBreadCrumbs = function () {\r\n return this.isArrayWithValues('breadCrumbs');\r\n };\r\n\r\n this.showRelatedPreview = function (item) {\r\n var target = $(item.currentTarget).closest(\"li\").find(\".preview\");\r\n targetMid = target.height() / 3;\r\n\r\n target.toggleClass(\"active\");\r\n $(item.currentTarget).on('mousemove', function (e) {\r\n target.offset({\r\n left: e.pageX + 20,\r\n top: e.pageY - targetMid\r\n });\r\n });\r\n };\r\n\r\n this.hideRelatedPreview = function (item) {\r\n var target = $(item.currentTarget).closest(\"li\").find(\".preview\");\r\n target.toggleClass(\"active\");\r\n };\r\n}\r\n\r\n// profile\r\nfunction ProfileViewModel(urlPrefix) {\r\n this.path = (urlPrefix ? urlPrefix : '') + \"/\" + HL.Locale.getLocale() + '/api/DistributorProfile/';\r\n this.targetInfo = false;\r\n this.Name = '';\r\n this.Salutation = '';\r\n this.TeamLevelName = '';\r\n this.DisplayBizworksStatus = '';\r\n this.loading = true;\r\n this.IsBizworksSubscriber = false;\r\n\r\n this.dataHandler = function (data) {\r\n if (data) {\r\n this.set(\"loading\", false);\r\n this.set(\"loaded\", true);\r\n this.set(\"Name\", data.FullNamePattern);\r\n this.set(\"Salutation\", data.Salutation);\r\n this.set(\"TeamLevelName\", data.TeamLevelName);\r\n this.set(\"DisplayBizworksStatus\", data.DisplayBizworksStatus);\r\n this.set(\"IsBizworksSubscriber\", data.IsBizworksSubscriber);\r\n this.set(\"targetInfo\", data.TargetInfo);\r\n this.targetCheck(data);\r\n }\r\n };\r\n\r\n this.targetCheck = function (data) {\r\n //Test&Target funcionality\r\n simpleMediator.publish(\"setTargetInfo\", data.TargetInfo);\r\n //We create an object to store profile information\r\n var adobeFmtdProfileData = {\r\n //We include profile information on the call to be used by Adobe\r\n FullNamePattern: data.FullNamePattern,\r\n Salutation: data.Salutation,\r\n TeamLevelName: data.TeamLevelName,\r\n DisplayBizworksStatus: data.DisplayBizworksStatus,\r\n IsBizworksSubscriber: data.IsBizworksSubscriber,\r\n //We declare the campaigns as an empty string\r\n campaigns: \"\"\r\n };\r\n if (data.TargetInfo && data.TargetInfo != null) {\r\n\r\n for (c = 0; c < data.TargetInfo.length; c++) {\r\n //Mbox items\r\n element = \"#\" + data.TargetInfo[c].CampaignName + '.mbox-item';\r\n\r\n //Identify existing mbox in campigns\r\n if (data.TargetInfo[c].CampaignName.trim() != \"\" && $(element).length != 0) {\r\n $(element).removeClass('mbox-item');\r\n callMbox(data.TargetInfo[c].CampaignName, data.TargetInfo[c].SegmentName);\r\n }\r\n //We append campaign information to list of campaigns\r\n adobeFmtdProfileData.campaigns += (data.TargetInfo[c].CampaignName + \"=\" + data.TargetInfo[c].SegmentName + \"&\");\r\n }\r\n }\r\n $(\".mbox-item\").each(function () {\r\n $(this).show();\r\n });\r\n //call to callGlobalMbox(adobeFmtdProfileData)\r\n callGlobalMbox(adobeFmtdProfileData);\r\n };\r\n\r\n //Call to initialize .mbox-item\r\n function callMbox(mb, segment) {\r\n //Call to Adobe\r\n adobe.target.getOffer({\r\n \"mbox\": mb,\r\n \"params\": { \"profile.Parameter1\": segment },\r\n \"success\": function (response) {\r\n if (response.length != 0) {\r\n\r\n adobe.target.applyOffer({\r\n \"selector\": (\"#\" + mb),\r\n \"offer\": [response[0]]\r\n });\r\n\r\n var element = $(\"#\" + mb);\r\n if (element.data(\"waitonload\") != undefined) {\r\n var wiredModel = $(\"[wire-model]\", element);\r\n viewModelHelpers.mvvmUtil.attachTo(new window[wiredModel.attr(\"wire-model\")]()).wireModelsToElements([wiredModel]);\r\n }\r\n element.show();\r\n }\r\n else {\r\n $(\"#\" + mb).show();\r\n logger.log(\"No response to Mbox: \" + mb);\r\n }\r\n },\r\n \"error\": function (status, error) {\r\n logger.log(\"Something went wrong with Mbox: \" + mb);\r\n },\r\n \"timeout\": 5000\r\n });\r\n };\r\n //\r\n function callGlobalMbox(adobeFmtdProfileData) {\r\n //Call to Adobe\r\n adobe.target.getOffer({\r\n //We use the Global Mbox\r\n \"mbox\": \"hl-global-mbox\",\r\n //We send multiple values including a string with all Campaigns the User belongs to\r\n \"params\": adobeFmtdProfileData,\r\n \"success\": function (response) {\r\n //We expect multiple responses, since multiple Campaigns on Adobe may be triggered\r\n if (response.length != 0) {\r\n //We iterate through them\r\n for (r = 0; r < response.length; r++) {\r\n\r\n //We wrap response[0], which is the content as a jquery object\r\n var elementTgt = $(response[r][\"content\"]);\r\n\r\n //We pull its ID which will help us target page location from Adobe for an HTML offer on the site\r\n //on Adobe we will ID the offers with an ID plus TgtOffer as an identifier, IE:
0) {\r\n this.set('EnvelopeClass', 'dsInboxBubble');\r\n this.set('AlertCount', totalNumber > 9 ? '9+' : totalNumber);\r\n }\r\n }\r\n };\r\n}\r\n\r\n// System alerts\r\nfunction AlertsViewModel(urlPrefix) {\r\n // internal class variables\r\n var _currentIndex = 0;\r\n var _alertsContainerStorageKey = 'ds_alerts_container_collapsed_status';\r\n\r\n this.path = (urlPrefix ? urlPrefix : '') + '/Account/api/v1/notification/messages/getsystemnotifications';\r\n this.BannerAlerts = [];\r\n this.CurrentAlert = {};\r\n this.UpDownClass = 'up';\r\n this.ContainerPadding = '5px';\r\n this.Collapsed = false;\r\n this.NotificationColors = {\r\n 1: '#F7DBCC',\r\n 2: '#DAE8AF',\r\n 3: '#FAE4B2'\r\n };\r\n\r\n this.onBeforeLoad = function () {\r\n if (sessionStorage != undefined) {\r\n var storeValue = sessionStorage.getItem(_alertsContainerStorageKey);\r\n\r\n if (storeValue && storeValue === true) {\r\n this.set('Collapsed', true);\r\n }\r\n }\r\n };\r\n\r\n this.dataHandler = function (data) {\r\n if (data) {\r\n var visibleAlerts = [];\r\n\r\n for (var msg in data) {\r\n if ($.inArray('/home/default1.aspx', data[msg].ValidPages) > -1) {\r\n data[msg].ValidPages.push('/home/default.aspx');\r\n data[msg].ValidPages.push('/home/default');\r\n }\r\n\r\n if ($.inArray(HL.Locale.getNormalizedURL().toLowerCase(), data[msg].ValidPages) > -1) {\r\n visibleAlerts.push(data[msg]);\r\n }\r\n }\r\n\r\n var alertData = data[_currentIndex];\r\n //Green System Notifications\r\n if (visibleAlerts && visibleAlerts.length > 0) {\r\n var colors = this.get('NotificationColors');\r\n $.each(visibleAlerts, function (i, v) {\r\n v.NotificationColor = colors[v.BannerTypeId];\r\n v.CollapseClass = v.CanCollapse ? 'upDownArrows icon-chevron-down' : '';\r\n });\r\n }\r\n this.set('BannerAlerts', visibleAlerts);\r\n this.set('CurrentAlert', alertData);\r\n }\r\n };\r\n\r\n this.getBannerType = function () {\r\n var alertData = this.get('CurrentAlert');\r\n if (alertData && alertData.BannerTypeId) {\r\n var value = 'hrblAlert';\r\n switch (alertData.BannerTypeId) {\r\n case 1:\r\n value = 'hrblAlert';\r\n break;\r\n case 2:\r\n value = 'hrblAlert general';\r\n break;\r\n case 3:\r\n value = 'hrblAlert info';\r\n break;\r\n }\r\n\r\n return value;\r\n }\r\n\r\n return 'hrblAlert';\r\n };\r\n\r\n this.previousAlert = function () {\r\n var bannerAlerts = this.get('BannerAlerts');\r\n\r\n if (bannerAlerts && bannerAlerts.length > 0 && index > 0) {\r\n _currentIndex--;\r\n this.set('CurrentAlert', bannerAlerts[_currentIndex]);\r\n }\r\n };\r\n\r\n this.nextAlert = function () {\r\n var bannerAlerts = this.get('BannerAlerts');\r\n var index = this.get('CurrentIndex');\r\n\r\n if (bannerAlerts && bannerAlerts.length > 0 && index < bannerAlerts.length - 1) {\r\n _currentIndex++;\r\n this.set('CurrentAlert', bannerAlerts[_currentIndex]);\r\n }\r\n };\r\n\r\n this.getCurrentCount = function (localizedOf) {\r\n var bannerAlerts = this.get('BannerAlerts');\r\n return (_currentIndex + 1) + ' ' + localizedOf + ' ' + bannerAlerts.length;\r\n };\r\n\r\n this.getShouldShowBanner = function (isEnabled) {\r\n var bannerAlerts = this.get('BannerAlerts');\r\n return !isEnabled || (isEnabled && bannerAlerts.length <= 0);\r\n };\r\n\r\n this.getShouldHidePagination = function () {\r\n var bannerAlerts = this.get('BannerAlerts');\r\n return bannerAlerts.length = 1;\r\n };\r\n\r\n this.collapseAlert = function () {\r\n var isCollapsed = !this.get('Collapsed');\r\n\r\n if (isCollapsed) {\r\n this.set('UpDownClass', 'down');\r\n this.set('ContainerPadding', '15px 5px');\r\n } else {\r\n this.set('UpDownClass', 'up');\r\n this.set('ContainerPadding', '5px');\r\n }\r\n\r\n if (sessionStorage != undefined) {\r\n sessionStorage.setItem(_alertsContainerStorageKey, isCollapsed);\r\n }\r\n\r\n this.set('Collapsed', isCollapsed);\r\n };\r\n\r\n this.CollapseNotification = function (event) {\r\n if (!event || !event.data || !this.get('BannerAlerts'))\r\n return;\r\n\r\n //The DOM element\r\n var target = $(event.currentTarget);\r\n if (target) {\r\n var notificationId = event.data.Id;\r\n var notificationIndex = this.GetNotificationIndex(notificationId);\r\n var tempNotifications = this.get('BannerAlerts');\r\n\r\n if (tempNotifications[notificationIndex] && tempNotifications[notificationIndex].CanCollapse) {\r\n var extraSpace = $(target).outerHeight() - $(target).height();\r\n var maxH = $(target).children().first().height() + extraSpace;\r\n var minH = parseInt($(target).css(\"line-height\").replace(\"px\", \"\")) + extraSpace;\r\n if (tempNotifications[notificationIndex].HasLink)\r\n maxH += extraSpace - 2;\r\n\r\n\r\n //Collapse/Expand animation\r\n $(target).animate({\r\n height: tempNotifications[notificationIndex].IsCollapsed ? maxH : minH\r\n }, 150);\r\n\r\n this.set('BannerAlerts[' + notificationIndex + '].IsCollapsed', !tempNotifications[notificationIndex].IsCollapsed);\r\n this.set('BannerAlerts[' + notificationIndex + '].CollapseClass', tempNotifications[notificationIndex].IsCollapsed ? 'upDownArrows icon-chevron-down' : 'upDownArrows icon-chevron-up');\r\n }\r\n }\r\n };\r\n\r\n this.GetNotificationIndex = function (notificationId) {\r\n var result = null;\r\n if (this.BannerAlerts && this.BannerAlerts.length > 0) {\r\n var index = $.map(this.BannerAlerts, function (obj, idx) {\r\n if (obj.Id == notificationId)\r\n return idx;\r\n });\r\n\r\n result = index;\r\n }\r\n return result;\r\n };\r\n}\r\n\r\n// idomoo- deprecate if no longer in use\r\nfunction IdomooVideoViewModel(flowPlayer) {\r\n var player = flowPlayer;\r\n this.path = \"/\" + HL.Locale.getLocale() + '/api/custom/Idomoo';\r\n this.baseUrl = \"https://herbalife.idomoo.com/videos/1216/\";\r\n this.videoId = \"\";\r\n this.shouldPlay = false;\r\n this.hasVideo = false;\r\n this.thumbNail = \"\";\r\n this.pauseVideo = function () {\r\n var api = flowplayer();\r\n api.pause();\r\n };\r\n this.video_href = function () {\r\n return this.get(\"baseUrl\") + this.get(\"videoId\") + \".mp4\";\r\n };\r\n this.showVideo = function () {\r\n $('.idomooVideo').data('kendoWindow').open().center();\r\n };\r\n\r\n this.setCookie = function () {\r\n $.cookie(\"__IDOMOOVidCookie\", this.videoId, {\r\n expires: 7,\r\n path: '/'\r\n });\r\n };\r\n\r\n this.dataHandler = function (data) {\r\n if (data && data.ok == true) {\r\n this.set(\"hasVideo\", true);\r\n this.set(\"videoId\", data.videoId);\r\n this.set(\"thumbNail\", data.thumbNail);\r\n player.flowplayer();\r\n var cookieText = $.cookie(\"__IDOMOOVidCookie\");\r\n if (!cookieText) {\r\n this.showVideo();\r\n this.setCookie();\r\n } else if (cookieText != this.videoId) {\r\n this.showVideo();\r\n this.setCookie();\r\n }\r\n }\r\n };\r\n\r\n}\r\n\r\nfunction CartViewModel() {\r\n this.id = null;\r\n this.quantity = 0;\r\n this.name = null;\r\n this.subTotal = 0.0;\r\n this.volumePoints = 0.0;\r\n this.sku = null;\r\n this.loaded = false;\r\n this.loading = true;\r\n this.error = false;\r\n this.canLoad = false;\r\n this.reset = function () {\r\n this.set(\"id\", null);\r\n this.set(\"quantity\", null);\r\n this.set(\"name\", null);\r\n this.set(\"subTotal\", null);\r\n this.set(\"volumePoints\", null);\r\n this.set(\"sku\", null);\r\n this.set(\"loading\", true);\r\n this.set(\"loaded\", false);\r\n this.set(\"error\", false);\r\n };\r\n this.path = \"/ordering/api/CartWidget/\";\r\n this.dataHandler = function (data) {\r\n if (data) {\r\n this.set(\"id\", data.Id);\r\n this.set(\"quantity\", data.Quantity);\r\n this.set(\"name\", data.Name);\r\n this.set(\"subTotal\", data.DisplaySubtotal);\r\n this.set(\"volumePoints\", data.VolumePoints);\r\n this.set(\"sku\", data.Sku);\r\n this.set(\"loading\", false);\r\n this.set(\"loaded\", true);\r\n } else {\r\n this.set(\"error\", true);\r\n this.set(\"loading\", false);\r\n }\r\n };\r\n\r\n this.onLoadError = function () {\r\n this.set(\"error\", true);\r\n this.set(\"loading\", false);\r\n };\r\n\r\n this.checkout = function () {\r\n var scope = this;\r\n if (scope.id == null) {\r\n this.set(\"canLoad\", true);\r\n this.load();\r\n this.onAfterLoad = function () {\r\n window.location.href = \"/Ordering/Shoppingcart.aspx?CartID=\" + scope.id;\r\n };\r\n } else window.location.href = \"/Ordering/Shoppingcart.aspx?CartID=\" + scope.id;\r\n return false;\r\n };\r\n\r\n this.viewSavedCarts = function () {\r\n window.location.href = \"/ordering/savedcarts.aspx\";\r\n return false;\r\n };\r\n\r\n this.activationHandler = function (shouldHide) {\r\n this.set(\"canLoad\", true);\r\n shouldHide ? this.reset() : this.load();\r\n }\r\n}\r\n\r\nfunction VolumeViewModel(urlPrefix) {\r\n this.path = (urlPrefix ? urlPrefix : '') + \"/\" + HL.Locale.getLocale() + '/api/Volume/';\r\n this.CurrentMonthVolume = {\r\n \"VolumeMonth\": 0,\r\n \"HeaderText\": \"...\",\r\n \"PlainHeaderText\": \"...\",\r\n \"PPV\": 0,\r\n \"DV\": 0,\r\n \"TV\": 0,\r\n \"PV\": 0,\r\n \"GV\": 0,\r\n \"HeaderVolume\": 0\r\n };\r\n this.LastMonthVolume = null;\r\n this.ChartData = [{\r\n \"name\": \"PPV\",\r\n \"value\": 0\r\n }, {\r\n \"name\": \"DLV\",\r\n \"value\": 0\r\n }, {\r\n \"name\": \"PV\",\r\n \"value\": 0\r\n }, {\r\n \"name\": \"GV\",\r\n \"value\": 0\r\n }, {\r\n \"name\": \"TV\",\r\n \"value\": 0\r\n }];\r\n this.MonthName = \"\";\r\n this.loading = true;\r\n this.error = \"\";\r\n\r\n this.dataHandler = function (data, status, xhr) {\r\n if (xhr && xhr.status == 200 && data && $.isArray(data)) {\r\n for (var i = 0; i < data.length; i++) {\r\n var v = this.cleanHeaderText(data[i]);\r\n this.set(\"MonthName\", v.MonthName);\r\n if (v.IsCurrentMonth) {\r\n this.set(\"CurrentMonthVolume\", v);\r\n this.setChartValues(v);\r\n } else {\r\n this.set(\"LastMonthVolume\", v);\r\n }\r\n }\r\n this.createChart(\"#volChart\");\r\n this.set(\"loading\", false);\r\n if (this.get(\"LastMonthVolume\") == null) this.set(\"loadSingle\", true);\r\n else this.set(\"loadDual\", true);\r\n } else {\r\n // no transport issue, but data not as expected.\r\n this.set(\"error\", \"inline\");\r\n }\r\n };\r\n\r\n this.onLoadError = function (xhr, status, statusText) {\r\n this.set(\"error\", \"inline\");\r\n };\r\n\r\n this.cleanHeaderText = function (volumeObject) {\r\n if (volumeObject && volumeObject.HeaderText) {\r\n volumeObject.PlainHeaderText = volumeObject.HeaderText.replace(/\\<[^>]+\\>/, ' ');\r\n }\r\n return volumeObject;\r\n };\r\n\r\n this.setChartValues = function (volume) {\r\n this.set(\r\n \"ChartData\", [{\r\n \"name\": \"PPV\",\r\n \"value\": volume.PPV\r\n }, {\r\n \"name\": \"DLV\",\r\n \"value\": volume.DV\r\n }, {\r\n \"name\": \"PV\",\r\n \"value\": volume.PV\r\n }, {\r\n \"name\": \"GV\",\r\n \"value\": volume.GV\r\n }, {\r\n \"name\": \"TV\",\r\n \"value\": volume.TV\r\n }]);\r\n };\r\n\r\n this.createChart = function (selector) {\r\n var chart = $(selector);\r\n if (!(chart && chart.length)) {\r\n return;\r\n }\r\n chart.kendoChart({\r\n dataSource: new kendo.data.DataSource({\r\n data: this.ChartData\r\n }),\r\n chartArea: {\r\n background: \"#EEE\"\r\n },\r\n title: {\r\n text: this.MonthName,\r\n position: \"bottom\"\r\n },\r\n legend: {\r\n visible: true,\r\n position: \"top\"\r\n },\r\n seriesDefaults: {\r\n type: \"column\",\r\n labels: {\r\n visible: false\r\n }\r\n },\r\n series: [{\r\n field: \"value\",\r\n color: \"#75c52a\",\r\n gap: 0.9,\r\n border: 0,\r\n overlay: {\r\n gradient: \"none\"\r\n }\r\n }],\r\n categoryAxis: {\r\n field: \"name\",\r\n majorGridLines: {\r\n visible: false\r\n }\r\n },\r\n valueAxis: [{\r\n majorGridLines: {\r\n visible: false\r\n }\r\n }],\r\n tooltip: {\r\n visible: true,\r\n template: \"#= category #: #= value #\",\r\n color: \"gray\",\r\n background: \"white\"\r\n }\r\n });\r\n };\r\n}\r\n\r\n//View model for dissmisable modals\r\nfunction dismissableUiModel(deferDurationDays, externalContent, type) { // type 0 = promoModal, type 1 = mbox, type 2 = notifications\r\n this.itemPrefix = externalContent || '';\r\n this.actualWidget = null;\r\n this.callToAction = null;\r\n this.showMeLater = null;\r\n this.doNotShowAgain = null;\r\n this.imgSrc = \"\";\r\n this.title = null;\r\n var visible = false;\r\n\r\n var dismissMode = {\r\n session: 'session',\r\n later: 'later',\r\n indefinite: 'indefinite'\r\n },\r\n deferDays = deferDurationDays || 7,\r\n contentType = type || 0,\r\n _API_PATH = (contentType == 0 ? \"/\" + HL.Locale.getLocale() + '/api/ContentListItem?id=' : '/account/api/v1/Popup'),\r\n that = null,\r\n dVM,\r\n isClosed = false,\r\n modalOpened = -1;\r\n\r\n this.userChoice = {\r\n mode: null,\r\n deferDate: null\r\n };\r\n\r\n //Set load type\r\n if (contentType != 1) { // From API\r\n if (contentType == 0) {\r\n var queryTag = window['_ModalQueryTagValue_'] || '';\r\n this.path = _API_PATH + externalContent + \"&Tags=\" + queryTag;\r\n } else {\r\n this.path = _API_PATH + \"?pageUrl=\" + encodeURIComponent(HL.Locale.getNormalizedURL());\r\n }\r\n } else { // From Default content or target\r\n this.load = function () {\r\n this.onAfterLoad();\r\n };\r\n }\r\n\r\n this.reason = \"unknown reason\";\r\n\r\n var now = new Date();\r\n\r\n this.isVisible = function (context, loaded) {\r\n\r\n if (!visible) return visible;\r\n\r\n if (context == undefined) context = this;\r\n\r\n var choice = context.get('userChoice');\r\n\r\n //if model is not totally loaded and no notifications exists\r\n if (choice.deferDate == null && contentType != 2) return false;\r\n\r\n dVM = simpleMediator.attachTo(this);\r\n\r\n //model correctly loaded\r\n if (choice) {\r\n if (choice.mode == dismissMode.session) {\r\n ifPromoModal(this);\r\n return closeWindow('session mode');\r\n }\r\n\r\n if (choice.mode == dismissMode.later) {\r\n if (choice.deferDate > now) {\r\n ifPromoModal(this);\r\n return context.closeWindow('deferred to ' + choice.deferDate + '. Now too early: ' + now);\r\n }\r\n }\r\n\r\n if (choice.mode == dismissMode.indefinite) {\r\n ifPromoModal(this);\r\n return context.closeWindow('deferred indefinitely');\r\n }\r\n }\r\n\r\n // If notification, open it.\r\n if (contentType == 2) return context.openWindow('content loaded');\r\n\r\n if (contentType == 1) {\r\n if (typeof profileViewModel === 'undefined') {\r\n profileViewModel = viewModelHelpers.wire.getInstance(\"ProfileViewModel\", \"shared\");\r\n if (!viewModelHelpers.mvvmUtil.isModelBoundToElement(profileViewModel)) {\r\n profileViewModel.wireModelsToElements($(this.obj));\r\n profileViewModel.load();\r\n }\r\n }\r\n if (profileViewModel.targetInfo != false) {\r\n this.setTargetInfo(profileViewModel.targetInfo);\r\n return;\r\n }\r\n else {\r\n dVM.subscribe(\"setTargetInfo\", this.setTargetInfo);\r\n return;\r\n }\r\n }\r\n\r\n // dynamically loaded content\r\n if (!externalContent || contentType == 2) {\r\n return context.openWindow('no choice');\r\n }\r\n\r\n return context.get('content') ? context.openWindow('content loaded') : context.closeWindow('too early');\r\n };\r\n\r\n this.openWindow = function (reasonText) {\r\n this.set('reason', reasonText);\r\n var widget = this.get(\"actualWidget\");\r\n\r\n if ($(\"#modalNotif\").length != 0 && contentType != 2 && simpleMediator.publish(\"modalNotifClosed\") === false) {\r\n modalOpened = false;\r\n dVM.subscribe(\"onWaiting\", this.onWaiting);\r\n return false;\r\n }\r\n\r\n if ($(\"#promoModalMbox\").length != 0 && contentType == 0 && simpleMediator.publish(\"promoModalMboxClosed\") === false) {\r\n modalOpened = false;\r\n if (!dVM.isPublished(\"onWaiting\")) {\r\n dVM.subscribe(\"onWaiting\", this.onWaiting);\r\n }\r\n else {\r\n dVM.subscribe(\"onWaiting2\", this.onWaiting2);\r\n }\r\n return false;\r\n }\r\n\r\n modalOpened = true;\r\n dVM.subscribe(\"modalOpened\", this.isModalOpened);\r\n\r\n if (widget) {\r\n\r\n if (contentType == 2) {\r\n var modalData = this.get('content');\r\n if (modalData.title != null) this.set(\"title\", $(modalData.title).text());\r\n if (modalData.image != null) this.set(\"imgSrc\", modalData.image);\r\n if (modalData.body != null) this.set(\"body\", modalData.body);\r\n if (modalData.callToActionButton) {\r\n this.set(\"callToAction\", modalData.callToActionButton);\r\n }\r\n if (modalData.showMeLater) {\r\n this.set(\"showMeLater\", modalData.showMeLater);\r\n }\r\n if (modalData.doNotShowAgainButton) {\r\n this.set(\"doNotShowAgain\", modalData.doNotShowAgainButton);\r\n }\r\n\r\n //call on Open\r\n path = _API_PATH + \"/\" + this.get('content').alertId + \"/SetShown/\";\r\n $.post(path)\r\n .done(function () {\r\n logger.log(\"Alert: \" + that.get('content').alertId + \" succesfully shown\");\r\n })\r\n .fail(function () {\r\n logger.log(\"Something wrong happened with SetShown in alert: \" + that.get('content').alertId);\r\n });\r\n\r\n }\r\n\r\n $(this.obj).parent().css(\"max-width\", $(this.obj).css(\"max-width\"));\r\n\r\n $(window).resize(function () {\r\n widget.center();\r\n });\r\n\r\n if (widget.setOptions) {\r\n widget.setOptions({\r\n modal: true\r\n });\r\n }\r\n if (widget.open) {\r\n\r\n img = $(\"img\", widget.element);\r\n if (img.length != 0) {\r\n if (img.prop('complete')) {\r\n widget.open().center();\r\n } else {\r\n img.on(\"load\", function () {\r\n img.show();\r\n widget.open().center();\r\n }).error(function () {\r\n img.hide();\r\n widget.open().center();\r\n });\r\n }\r\n } else {\r\n widget.open().center();\r\n }\r\n\r\n }\r\n }\r\n\r\n return true;\r\n };\r\n\r\n this.closeWindow = function (reasonText) {\r\n this.set('reason', reasonText);\r\n var widget = this.get(\"actualWidget\");\r\n if (widget && widget.close) {\r\n widget.close();\r\n }\r\n return false;\r\n };\r\n\r\n this.onDismissOnce = function (e) {\r\n saveChoice(this, dismissMode.session, null);\r\n };\r\n\r\n this.onDismissForLater = function (e) {\r\n if (contentType == 2) {\r\n this.closeWindow();\r\n path = _API_PATH + \"/\" + this.get('content').alertId + \"/Suspend/\" + this.get('content').showMeLater.actionType;\r\n $.post(path)\r\n .done(function () {\r\n logger.log(\"Alert: \" + that.get('content').alertId + \" succesfully dismissed for later\");\r\n })\r\n .fail(function () {\r\n logger.log(\"Something wrong happened with DismissForLater on alert: \" + that.get('content').alertId);\r\n });\r\n } else {\r\n var deferUntil = new Date();\r\n deferUntil.setDate(deferUntil.getDate() + deferDays);\r\n saveChoice(this, dismissMode.later, deferUntil);\r\n }\r\n };\r\n\r\n this.onDismissIndefinite = function (e) {\r\n if (contentType == 2) {\r\n this.closeWindow();\r\n path = _API_PATH + \"/\" + this.get('content').alertId + \"/Suspend/\" + this.get('content').doNotShowAgainButton.actionType;\r\n $.post(path)\r\n .done(function () {\r\n logger.log(\"Alert: \" + that.get('content').alertId + \" succesfully dismissed indefinite\");\r\n })\r\n .fail(function () {\r\n logger.log(\"Something wrong happened with DismissIndefinite on alert: \" + that.get('content').alertId);\r\n });;\r\n } else {\r\n saveChoice(this, dismissMode.indefinite, null);\r\n }\r\n };\r\n\r\n this.onCallToAction = function (e) {\r\n path = _API_PATH + \"/\" + this.get('content').alertId + \"/ActionLog/\" + this.get('content').callToActionButton.actionType;\r\n $.post(path)\r\n .done(function () {\r\n logger.log(\"Alert: \" + that.get('content').alertId + \" succesfully send Action log\");\r\n })\r\n .fail(function () {\r\n logger.log(\"Something wrong happened with CallToAction on alert: \" + that.get('content').alertId);\r\n });\r\n this.onDismissForLater();\r\n };\r\n\r\n this.onReset = function (e) {\r\n saveChoice(this, null, null);\r\n };\r\n\r\n function saveChoice(obj, newMode, newDate) {\r\n var value = {\r\n mode: newMode,\r\n deferDate: newDate\r\n };\r\n var prefix = obj.get('itemPrefix');\r\n obj.closeWindow();\r\n\r\n obj.set('userChoice', value);\r\n\r\n if (isStorageSupported()) {\r\n if (value.mode == dismissMode.session) {\r\n storeItem(sessionStorage, 'surfaceMessageChoice_mode', dismissMode.session, prefix);\r\n\r\n storeItem(localStorage, 'surfaceMessageChoice_mode', null, prefix);\r\n storeItem(localStorage, 'surfaceMessageChoice_deferDate', null, prefix);\r\n } else {\r\n storeItem(sessionStorage, 'surfaceMessageChoice_mode', null, prefix);\r\n\r\n storeItem(localStorage, 'surfaceMessageChoice_mode', value.mode, prefix);\r\n storeItem(localStorage, 'surfaceMessageChoice_deferDate', value.deferDate || null, prefix);\r\n }\r\n }\r\n }\r\n\r\n function storeItem(store, itemName, value, prefix) {\r\n var key = prefix + itemName;\r\n if (value) {\r\n store.setItem(key, value);\r\n } else {\r\n store.removeItem(key);\r\n }\r\n };\r\n\r\n function getItem(store, itemName, prefix) {\r\n var key = itemKey(itemName, prefix);\r\n return store.getItem(key);\r\n };\r\n\r\n function itemKey(itemName, storeageKeyPrefix) {\r\n return storeageKeyPrefix + itemName;\r\n };\r\n\r\n function isStorageSupported() {\r\n return (typeof (Storage) !== \"undefined\");\r\n };\r\n\r\n this.onAfterLoad = function () {\r\n that = this;\r\n visible = true;\r\n switch (contentType) {\r\n case 0:\r\n case 1:\r\n if ($(this.get(\"actualWidget\").element).data(\"cookie\") != undefined) {\r\n this.set('itemPrefix', $(this.get(\"actualWidget\").element).data(\"cookie\"));\r\n }\r\n this.setDisplayBehavior();\r\n break;\r\n case 2:\r\n\r\n //Validate buttons on modal\r\n var modalData = this.get('content');\r\n var validModal = false;\r\n for (modal in modalData) {\r\n if (modalData[modal].callToActionButton || modalData[modal].showMeLater || modalData[modal].doNotShowAgainButton) {\r\n this.set('content', modalData[modal]);\r\n validModal = true;\r\n break;\r\n }\r\n }\r\n\r\n if (modalData == undefined || !validModal) {\r\n visible = false;\r\n isClosed = true;\r\n dVM = simpleMediator.attachTo(this);\r\n dVM.subscribe(\"modalNotifClosed\", this.modalNotifClosed);\r\n simpleMediator.publish(\"onWaiting\");\r\n\r\n }\r\n break;\r\n }\r\n if (visible) this.isVisible();\r\n };\r\n\r\n this.onLoadError = function () {\r\n visible = false;\r\n isClosed = true;\r\n dVM = simpleMediator.attachTo(this);\r\n dVM.subscribe(\"modalNotifClosed\", this.modalNotifClosed);\r\n simpleMediator.publish(\"onWaiting\");\r\n };\r\n\r\n this.setDisplayBehavior = function () {\r\n var prefix = this.get('itemPrefix');\r\n var choice = {\r\n mode: null,\r\n deferDate: null\r\n };\r\n if (isStorageSupported()) {\r\n if (getItem(sessionStorage, 'surfaceMessageChoice_mode', prefix)) {\r\n choice.mode = dismissMode.session;\r\n } else {\r\n choice.mode = getItem(localStorage, 'surfaceMessageChoice_mode', prefix);\r\n choice.deferDate = new Date(getItem(localStorage, 'surfaceMessageChoice_deferDate', prefix));\r\n }\r\n\r\n this.set('userChoice', choice);\r\n }\r\n };\r\n\r\n this.dataHandler = function (data) {\r\n var item;\r\n switch (contentType) {\r\n case 0:\r\n if (data != null && data.Items && data.Items[0]) {\r\n item = data.Items.shift();\r\n if (item != null) {\r\n this.set('content', item);\r\n this.set('itemPrefix', item.OriginId || 'cms_defect_no_OriginId');\r\n }\r\n }\r\n break;\r\n case 2:\r\n item = new Array();\r\n for (var key in data.popupNotifications) {\r\n item[key] = data.popupNotifications[key];\r\n }\r\n if (item.length != 0) this.set('content', item);\r\n break;\r\n }\r\n };\r\n\r\n this.setTargetInfo = function (targetInfo) {\r\n var found = false;\r\n var mb = externalContent;\r\n var that = this;\r\n for (c = 0; c < targetInfo.length; c++) {\r\n if (targetInfo[c].CampaignName == mb) {\r\n found = true;\r\n //Call to Adobe\r\n adobe.target.getOffer({\r\n \"mbox\": mb,\r\n \"params\": { \"profile.Parameter1\": targetInfo[c].SegmentName },\r\n \"success\": function (response) {\r\n if (response.length != 0) {\r\n\r\n adobe.target.applyOffer({\r\n \"selector\": (\"#\" + mb),\r\n \"offer\": [response[0]]\r\n });\r\n\r\n\r\n kendo.bind($(\"> div\", that.obj), that);\r\n $(\"> div\", that.obj).show();\r\n\r\n that.openWindow();\r\n }\r\n else {\r\n isClosed = true;\r\n logger.log(\"No response to Mbox: \" + mb);\r\n dVM.subscribe(\"promoModalMboxClosed\", that.promoModalMboxClosed);\r\n if (dVM.isPublished(\"onWaiting2\")) {\r\n simpleMediator.publish(\"onWaiting2\");\r\n }\r\n else {\r\n simpleMediator.publish(\"onWaiting\");\r\n }\r\n }\r\n },\r\n \"error\": function (status, error) {\r\n logger.log(\"Something went wrong with Mbox: \" + mb);\r\n },\r\n \"timeout\": 5000\r\n });\r\n\r\n }\r\n }\r\n };\r\n\r\n this.isModalOpened = function () {\r\n return modalOpened;\r\n };\r\n\r\n this.onWaiting = function () {\r\n this.openWindow();\r\n };\r\n\r\n this.onWaiting2 = function () {\r\n this.openWindow();\r\n };\r\n\r\n this.modalNotifClosed = function () {\r\n return isClosed;\r\n };\r\n\r\n this.promoModalMboxClosed = function () {\r\n return isClosed;\r\n };\r\n\r\n function ifPromoModal(obj) {\r\n if (contentType == 1) {\r\n isClosed = true;\r\n dVM.subscribe(\"promoModalMboxClosed\", obj.promoModalMboxClosed);\r\n }\r\n }\r\n\r\n};\r\n\r\nfunction topNavViewModel() {\r\n var previousNavItem = null;\r\n var waiting = false;\r\n var nextNavItem = null;\r\n\r\n this.openLevel = function (e) {\r\n\r\n if (e.type == \"click\") {\r\n if (isMobile() || isSmallScreen()) {\r\n\r\n actualNav = e.currentTarget.parentNode;\r\n //mobile approach\r\n if (previousNavItem) {\r\n hideNav(previousNavItem, true, true);\r\n }\r\n if (actualNav != previousNavItem) {\r\n hideNav(actualNav, false, true);\r\n previousNavItem = actualNav;\r\n } else\r\n previousNavItem = null;\r\n }\r\n } else {\r\n if (!isSmallScreen() && !isMobile()) {\r\n //desktop approach\r\n if (e.type == \"mouseover\") {\r\n hideNav(e.currentTarget, false, false);\r\n previousNavItem = e.currentTarget;\r\n } else if (e.type == \"mouseout\" && $(e.relatedTarget).closest(e.currentTarget).length == 0) {\r\n previousNavItem && hideNav(previousNavItem, true, false);\r\n previousNavItem = null;\r\n }\r\n } else\r\n return false;\r\n }\r\n\r\n };\r\n\r\n function hideNav(navItem, flag, isMobileNav) {\r\n if (flag) {\r\n if (isMobileNav) {\r\n hideElement(navItem, true);\r\n } else {\r\n waiting = true;\r\n nextNavItem = null;\r\n setTimeout(\r\n function () {\r\n waiting = false;\r\n hideElement(navItem, true);\r\n if (nextNavItem) {\r\n hideElement(nextNavItem, false);\r\n }\r\n }, 500);\r\n }\r\n } else {\r\n if ((!waiting || isMobileNav) && navItem.className != \"active\") {\r\n hideElement(navItem, false);\r\n } else\r\n nextNavItem = navItem;\r\n }\r\n };\r\n\r\n function hideElement(element, flag) {\r\n var e = getFirstChild(element);\r\n while (e.nodeName != \"UL\") e = e.nextSibling;\r\n if (flag) {\r\n e.style.display = \"none\";\r\n element.className = \"\";\r\n } else {\r\n e.style.display = \"block\";\r\n element.className = \"active\";\r\n }\r\n element.id == \"cartInfoDropDown\" && simpleMediator.publish(\"topNavCartEvent\", flag);\r\n };\r\n\r\n function getFirstChild(e) {\r\n e = e.firstChild;\r\n while (e.nodeType != 1) e = e.nextSibling;\r\n return e;\r\n };\r\n\r\n function isMobile() {\r\n return HL.Util.Browser.isMobile.any();\r\n };\r\n\r\n function isSmallScreen() {\r\n return HL.Util.Browser.dimensions.Width() < 960;\r\n };\r\n\r\n};\r\n\r\nfunction mobileNavViewModel() {\r\n this.open = function (e) {\r\n $(\".transformer\").toggleClass(\"is-open\");\r\n }\r\n};\r\n\r\n//View model to encrypt URL's\r\nfunction UrlEncriptionViewModel() {\r\n var url;\r\n var data = new Array();\r\n\r\n this.sendURL = function (e) {\r\n first = true;\r\n url = $(e.delegateTarget).data(\"url\");\r\n if (url.search(\"\\\\?\") == -1) url = url + \"?\";\r\n data = $(e.delegateTarget).data(\"values\").split(\",\");\r\n for (index = 0; index < data.length; ++index) {\r\n temp = data[index].split(\":\");\r\n url = url + (!first ? \"&\" : \"\") + temp[0] + \"=\" + encodeURIComponent(_AnalyticsFacts_[temp[1]]);\r\n first ? first = false : first;\r\n }\r\n $(e.delegateTarget).attr(\"href\", url);\r\n }\r\n};\r\n\r\n//View modal for generic modal\r\nfunction modalWindowViewModel(element, titleelement) {\r\n that = null;\r\n title = '';\r\n titleElement = titleelement || \"h4\";\r\n icon = 'icon-delete-fl-5';\r\n iconElement = \".k-window .k-icon\";\r\n this.modalElement = element;\r\n UImodal = \"kendoWindow\";\r\n\r\n this.load = function () {\r\n that = this;\r\n if ($(titleElement, $(that.modalElement)).length != 0 && !$(titleElement, $(that.modalElement)).data('ignoretitle')) {\r\n title = $(titleElement, $(that.modalElement)).text();\r\n }\r\n $(that.modalElement)[UImodal]({\r\n modal: true,\r\n resizable: false,\r\n visible: false,\r\n title: title,\r\n animation: {\r\n open: {\r\n effects: \"fade:in\"\r\n },\r\n close: {\r\n effects: \"fade:out\"\r\n }\r\n }\r\n });\r\n\r\n //max-width\r\n $(that.modalElement).parent().css(\"max-width\", $(that.modalElement).css(\"max-width\"));\r\n\r\n //setting icon\r\n $(iconElement).addClass(icon).text(\"\");\r\n\r\n $(that.modalElement).attr(\"data-centerwindow\", true);\r\n\r\n }\r\n};\r\n\r\nfunction SessionMsgViewModel(cookieName, isOldIE) {\r\n var OldIE = isOldIE || false;\r\n\r\n this.isVisible = function () {\r\n if (HL.Cookie.getCookie(cookieName) != \"true\" &&\r\n ((OldIE && HL.Util.Browser.IE().isTheBrowser && HL.Util.Browser.IE().actualVersion <= 9) || !OldIE)) {\r\n $(this.obj).slideDown();\r\n return true;\r\n } else {\r\n return false;\r\n }\r\n };\r\n\r\n this.closeMessage = function () {\r\n $(this.obj).slideUp();\r\n document.cookie = cookieName + \"=true\";\r\n };\r\n\r\n}","// --------------------------------------------------------------------------------------------------------------------\r\n// \r\n// Herbalife 2013\r\n// \r\n// \r\n// Global UI Javascript modules, used in MyHerbalife.com and Herbalife.com\r\n// Framwork: Require JS, jQuery JS and Kendo UI\r\n// \r\n// \r\n// DTS - Content DEV UI | DTS - Integration \r\n// \r\n// -------------------------------------------------------------------------------------------------------------------- \r\n\r\nfunction alphaNumericNoSpace(e) {\r\n var input = String.fromCharCode(e.which);\r\n var regex = /[a-zA-Z0-9_]/;\r\n if (!regex.test(input)) {\r\n if (!e.shiftKey && input != \".\") {\r\n switch (e.keyCode) {\r\n case 8://backspace\r\n case 9://tab\r\n case 13://enter\r\n case 35://end\r\n case 36://home\r\n case 37://left arrow\r\n case 38://up arrow\r\n case 39://right arrow\r\n case 40://down arrow\r\n case 46://delete\r\n return;\r\n }\r\n }\r\n e.preventDefault();\r\n }\r\n};\r\n\r\nvar IdleLogout = (function () {\r\n var config = {\r\n Act: { Handle: null, Action: null, Interval: 25 * 60 * 1000 },\r\n Warn: { Handle: null, Action: null, Interval: 20 * 60 * 1000 }\r\n };\r\n\r\n var configure = function (cfg) {\r\n setIfDefined(config.Act, 'Interval', cfg.Act);\r\n setIfDefined(config.Act, 'Action', cfg.Act);\r\n\r\n setIfDefined(config.Warn, 'Interval', cfg.Warn);\r\n setIfDefined(config.Warn, 'Action', cfg.Warn);\r\n };\r\n\r\n var setIfDefined = function (target, prop, value) {\r\n if (target && value && value[prop]) {\r\n target[prop] = value[prop];\r\n }\r\n };\r\n\r\n var reset = function () {\r\n tryReset(config.Warn);\r\n tryReset(config.Act);\r\n\r\n // We need to review this line, is causing a print of

in every scroll action.\r\n //$('body').append('

reset by something ' + new Date() + '

');\r\n\r\n start();\r\n };\r\n\r\n var tryReset = function (cfg) {\r\n if (cfg && cfg.Handle && window) { window.clearTimeout(cfg.Handle); }\r\n\r\n };\r\n\r\n var start = function () {\r\n tryStart(config.Warn);\r\n tryStart(config.Act);\r\n };\r\n\r\n var tryStart = function (cfg) {\r\n if (cfg && cfg.Action && cfg.Interval) {\r\n cfg.Handle = window.setTimeout(cfg.Action, cfg.Interval);\r\n }\r\n };\r\n\r\n //elements that have conflicts with this modal\r\n var conflictElement = [];\r\n\r\n var addConflictElement = function (element) {\r\n conflictElement.push(element);\r\n };\r\n\r\n var hideConflictElements = function () {\r\n for (x = 0; x < conflictElement.length; x++) {\r\n $(conflictElement[x]).css(\"visibility\", \"hidden\");\r\n }\r\n };\r\n\r\n var showConflictElements = function (element) {\r\n for (x = 0; x < conflictElement.length; x++) {\r\n $(conflictElement[x]).css(\"visibility\", \"\");\r\n }\r\n };\r\n\r\n return {\r\n reset: reset,\r\n\r\n start: start,\r\n\r\n addConflictElement: addConflictElement,\r\n\r\n hideConflictElements: hideConflictElements,\r\n\r\n showConflictElements: showConflictElements,\r\n\r\n configure: function (configuration) {\r\n reset();\r\n configure(configuration);\r\n }\r\n };\r\n})();\r\n\r\n$(function () {\r\n coreMvvm = new MvvmConfiguration();\r\n coreMvvm.Activate();\r\n\r\n //*** splash page\r\n if ($(\".splash\").length == 0) {\r\n try { //break in case there's no Cart available for any country\r\n var cartVM = viewModelHelpers.wire.getInstance('CartViewModel', 'shared');\r\n simpleMediator.attachTo(cartVM);\r\n cartVM.subscribe(\"topNavCartEvent\", cartVM.activationHandler);\r\n } catch (error) {\r\n logger.log(error);\r\n }\r\n } //else splash();\r\n\r\n //*** Left Menu fixes\r\n if ($(\"#left_menu.leftMenuNew\").length == 0) $(\"#LeftNavMenuCell\").remove();\r\n\r\n try {\r\n var leftMenuVar = $(\".leftMenuNew\") ? \".leftMenuNew\" : \"#main-side-nav\";\r\n var leftNav = $(leftMenuVar);\r\n\r\n //Getting page name\r\n var pathname = decodeURI($(location).attr('pathname') + $(location).attr('search')).toLowerCase();\r\n\r\n //Searching and assigning active class\r\n var item = $(leftMenuVar + \" a\").filter(function () {\r\n link = $(this).attr(\"href\").toLowerCase();\r\n if ($(\"#ProductMenu\").length > 0) link = \"/ordering/\" + link;\r\n return link == pathname;\r\n });\r\n if (leftNav && item) item.parents('li').addClass(\"active\");\r\n } catch (err) {\r\n }\r\n\r\n $(\"#main-left-container > span a\").click(function () {\r\n var that = this;\r\n if ($(\"#main-side-nav:visible\").length != 0) { //visible\r\n $(that).removeClass();\r\n $(that).addClass(\"icon-arrow-circle-fl-29\");\r\n $(\"#main-side-nav\").slideUp();\r\n\r\n $(window).resize(function () {\r\n if ($(window).width() > 960) {\r\n $(that).removeClass();\r\n $(that).addClass(\"icon-arrow-circle-fl-30\");\r\n $(\"#main-side-nav\").slideDown();\r\n }\r\n else {\r\n $(that).removeClass();\r\n $(that).addClass(\"icon-arrow-circle-fl-29\");\r\n $(\"#main-side-nav\").slideUp();\r\n }\r\n });\r\n }\r\n else { //not visible\r\n $(that).removeClass();\r\n $(that).addClass(\"icon-arrow-circle-fl-30\");\r\n $(\"#main-side-nav\").slideDown();\r\n }\r\n });\r\n\r\n //Left Menu fixed\r\n scrollFixed();\r\n\r\n //*** Placeholders for I8 and IE9\r\n var testElement = document.createElement('input');\r\n if (!('placeholder' in testElement)) {\r\n $(\"input[placeholder]\").each(function () {\r\n if ($(this).attr(\"type\") == \"password\")\r\n $(this).before('');\r\n else\r\n $(this).val($(this).attr('placeholder'));\r\n });\r\n\r\n $(\"input[placeholder]\").focusin(function () {\r\n if ($(this).attr(\"type\") == \"password\") {\r\n if ($(this).val() == \"\") $('label[for=\"' + $(this).attr(\"id\") + '\"]').hide();\r\n }\r\n else\r\n if ($(this).val() == $(this).attr('placeholder')) $(this).val('');\r\n });\r\n\r\n $(\"input[placeholder]\").blur(function () {\r\n if ($(this).val() == '') {\r\n if ($(this).attr(\"type\") == \"password\")\r\n $('label[for=\"' + $(this).attr(\"id\") + '\"]').show();\r\n else\r\n $(this).val($(this).attr('placeholder'));\r\n }\r\n });\r\n\r\n $(\"#pin\").bind('propertychange change', function () {\r\n if ($(\"#pin\").val() == '')\r\n $('label[for=\"pin\"]').show();\r\n else\r\n $('label[for=\"pin\"]').hide();\r\n });\r\n\r\n }\r\n\r\n //*** Search box\r\n $(\"#rightTopNav input.search, #mobile-main-nav input.search\").keypress(function (event) {\r\n var locale;\r\n //Get locale value from current selection \r\n $.each($(\".localeSelector option\").filter(\":selected\"),\r\n function (i, val) {\r\n if (val.value) {\r\n if (val.length >= 5) {\r\n locale = locale.substr(0, 5);\r\n }\r\n\r\n locale = val.value;\r\n }\r\n });\r\n if (event.keyCode == 13) {\r\n if ($(this).val() == \"\") return false;\r\n else {\r\n event.preventDefault();\r\n window.location.href = '/ed/' + locale + '/SearchResults?q=' + $(this).val();\r\n }\r\n }\r\n });\r\n\r\n //*** Local Selector\r\n $(\"#closeLocalSel\").click(function () {\r\n $(\"#localeSel\").click();\r\n });\r\n\r\n $(\"#localeSel, #localeSelMobile\").click(function (e) {\r\n $(this).toggleClass(\"selected\");\r\n if ($(\".icon-chevron-down\", this).length) $(\".icon-chevron-down\", this).toggleClass(\"icon-chevron-up\");\r\n else $(\".icon-chevron-up\", this).toggleClass(\"icon-chevron-down\");\r\n\r\n if ($(\"#locales\").is(\":visible\")) $(\"#locales\").slideUp(400);\r\n else $(\"#locales\").slideDown(400);\r\n\r\n e.stopImmediatePropagation();\r\n });\r\n\r\n var localeSelectorChangeHandler = function (e) {\r\n var sender = e.target;\r\n var locale = sender.options[sender.selectedIndex].value;\r\n\r\n if (locale) {\r\n if (locale.length >= 5) {\r\n locale = locale.substr(0, 5);\r\n }\r\n\r\n $.get('/api/localeSelector/' + locale + '?url=' + encodeURI(window.location.href))\r\n .success(function (data, status) {\r\n window.location.href = data;\r\n })\r\n .error(function (jqXHR, textStatus, errorThrown) {\r\n logger.log('An error has ocurred executing locale change api.');\r\n });\r\n }\r\n };\r\n\r\n $(\"select.localeSelector\").kendoDropDownList({\r\n height: 500\r\n });\r\n $(\"select.localeSelector\").change(localeSelectorChangeHandler);\r\n\r\n //*** Nav position \r\n var nav = $(\"#main-nav\");\r\n var navPos = nav.offset();\r\n $(window).scroll(function () {\r\n //code for fixed navigation\r\n if (nav.length != 0) {\r\n if (($(this).scrollTop() > navPos.top) && !nav.hasClass('fixed')) {\r\n nav.addClass('fixed');\r\n } else if ($(this).scrollTop() <= navPos.top && nav.hasClass('fixed')) {\r\n nav.removeClass('fixed');\r\n }\r\n }\r\n });\r\n\r\n //*** Footer fix when not enough content \r\n if ((h = $(window).height() - $(\"body\").height()) > 0) {\r\n $(\"#hrblSiteWrapper > footer\").css(\"margin-top\", h + \"px\");\r\n }\r\n\r\n var resizeId;\r\n $(window).resize(function () {\r\n clearTimeout(resizeId);\r\n resizeId = setTimeout(function () {\r\n $(\"#hrblSiteWrapper > footer\").css(\"margin-top\", \"0px\");\r\n h = $(window).height() - $(\"body\").height();\r\n if ((h = $(window).height() - $(\"body\").height()) > 0) {\r\n $(\"#hrblSiteWrapper > footer\").css(\"margin-top\", h + \"px\");\r\n }\r\n }, 200);\r\n });\r\n\r\n //*** Buttons for K-grid\r\n if ($(\".k-grid\").length) {\r\n //Add record buttons on k-grid\r\n $(\".k-grid-add\").removeClass(\"k-button\");\r\n $(\".k-grid-add\").addClass(\"btn\"); //styling of \"Add Shipping Address\" button\r\n }\r\n\r\n //*** modal window\r\n $(\".hrblModal\").each(function () {\r\n hrblModal = this;\r\n var model;\r\n\r\n model = new modalWindowViewModel(hrblModal).load();\r\n });\r\n\r\n $('.modalBtn[title]').on(\"mouseenter\", function () {\r\n $(this).data(\"title\", $(this).attr(\"title\")).removeAttr(\"title\");\r\n });\r\n\r\n $('.modalBtn').on(\"click\", function (e) {\r\n e.preventDefault();\r\n actualModal = $(\"#\" + $(this).data(\"title\") + \".hrblModal\").data(\"kendoWindow\");\r\n if (actualModal != null) {\r\n\r\n img = $(\"img\", actualModal.element[0]);\r\n if (img.length != 0) {\r\n if (img.prop('complete')) {\r\n actualModal.open().center();\r\n } else {\r\n img.on(\"load\", function () {\r\n img.show();\r\n actualModal.open().center();\r\n }).error(function () {\r\n img.hide();\r\n actualModal.open().center();\r\n });\r\n }\r\n } else {\r\n actualModal.open().center();\r\n }\r\n\r\n\r\n }\r\n\r\n });\r\n\r\n $(window).resize(function () {\r\n if ($('[data-centerwindow]:visible').length != 0) {\r\n $(\"[data-centerwindow]:visible\").data(\"kendoWindow\").center();\r\n }\r\n });\r\n\r\n //*** Alert Messages\r\n if ($(\"#systemAlert\")) {\r\n\r\n var numPar = $('#systemAlert div').length;\r\n var actualDiv = $('#systemAlert div:first-child');\r\n var currentPar = 1;\r\n\r\n $('#systemAlert span b').html(currentPar + ' of ' + numPar);\r\n\r\n $('#systemAlert .next').click(function () {\r\n if (currentPar >= numPar) {\r\n currentPar = numPar;\r\n } else {\r\n currentPar++;\r\n var nextDiv = actualDiv.next();\r\n actualDiv.fadeOut(200, function () { nextDiv.fadeIn(200); });\r\n actualDiv = nextDiv;\r\n $('#systemAlert span b').html(currentPar + ' of ' + numPar);\r\n }\r\n });\r\n\r\n $('#systemAlert .prev').click(function () {\r\n if (currentPar <= 1) {\r\n currentPar = 1;\r\n } else {\r\n currentPar--;\r\n var nextDiv = actualDiv.prev();\r\n actualDiv.fadeOut(200, function () { nextDiv.fadeIn(400); });\r\n actualDiv = nextDiv;\r\n $('#systemAlert span b').html(currentPar + ' of ' + numPar);\r\n }\r\n });\r\n\r\n $('#systemAlert button').click(function () {\r\n $(\"#systemAlert p\").slideToggle(600);\r\n });\r\n\r\n }\r\n\r\n //*** Video\r\n if ($(\".videoWrapper\").length != 0) {\r\n $('.videoWrapper iframe').each(function () {\r\n var separator = \"?\";\r\n var url = $(this).attr(\"src\");\r\n\r\n if (url.indexOf(\"?\") != -1) {\r\n separator = \"&\";\r\n }\r\n $(this).attr(\"src\", url + separator + \"wmode=transparent\");\r\n });\r\n }\r\n\r\n if (window && window._AnalyticsFacts_ && window._AnalyticsFacts_.Id) {\r\n //*** idle timeout handling\r\n var idleWarningWindow = '#idleLogout';\r\n var idleWarningContentUrl = '/ed/' + _AnalyticsFacts_.LanguageCode + '-' + _AnalyticsFacts_.CountryCode + '/pages/IdleTimeoutWarning.html';\r\n var handle = \"\";\r\n var logoutUrl = '/Authentication/Logout';\r\n\r\n IdleLogout.configure({\r\n Warn: {\r\n Action: function () {\r\n if (handle == \"\") {\r\n //Check if fragment exists\r\n $.get(idleWarningContentUrl)\r\n .done(function () {\r\n\r\n try {\r\n handle = $(idleWarningWindow).data(\"kendoWindow\");\r\n handle.refresh({\r\n url: idleWarningContentUrl\r\n });\r\n $(idleWarningWindow + \" .btnForward\").on(\"click\", function () { handle.close(); });\r\n\r\n //On close\r\n handle.bind(\"close\", function () {\r\n IdleLogout.showConflictElements();\r\n IdleLogout.reset();\r\n });\r\n\r\n IdleLogout.hideConflictElements();\r\n\r\n handle.bind(\"refresh\", function () {\r\n handle.open().center();\r\n });\r\n } catch (err) { }\r\n\r\n }).fail(function () {\r\n // not exists code\r\n handle = \"fail\";\r\n logger.log(\"There's no fragment to show for Session Timeout. Reseting the timer\");\r\n IdleLogout.reset();\r\n });\r\n }\r\n else {\r\n if (handle == \"fail\")\r\n IdleLogout.reset();\r\n else {\r\n IdleLogout.hideConflictElements();\r\n handle && handle.open().center();\r\n }\r\n }\r\n }\r\n },\r\n Act: {\r\n Action: function () { document.location.href = logoutUrl; }\r\n }\r\n });\r\n // wire up resetting actions\r\n $(window).scroll(IdleLogout.reset);\r\n $(window).click(IdleLogout.reset);\r\n // start the timer\r\n IdleLogout.start();\r\n\r\n }\r\n\r\n //Put locale text from current selection in Country Header\r\n var locale;\r\n $.each($(\".localeSelector option\").filter(\":selected\"),\r\n function (i, val) {\r\n if (val.value) {\r\n locale = val.text;\r\n $('#localeSel').html(' ' + locale);\r\n }\r\n });\r\n\r\n $('a[href=\"/Home/RedirectToProfileCreate\"]').hide();\r\n\r\n //Link Box\r\n if ($('#classicLinkBox') && $('#classicLinkBox').length != 0) {\r\n $('#classicLinkBox').prepend(\"\");\r\n $('#classicLinkBox i').click(function () {\r\n $('#classicLinkBox').remove();\r\n });\r\n }\r\n\r\n //**************** Prevent multiple logout ****************//\r\n $(\"#myProfileDropDown a.full-width\").click(function () {\r\n if (!$(this).hasClass(\"disabled\")) {\r\n $(this).addClass(\"disabled\");\r\n }\r\n else { return false; }\r\n });\r\n\r\n});\r\n\r\n//Fixes left search to scroll SearchResults page\r\nfunction scrollFixed() {\r\n var leftMenuFixed = $('.scroll-fixed');\r\n if (leftMenuFixed.length != 0) {\r\n var leftMenuOffset = leftMenuFixed.offset().top - $('#main-nav').height();\r\n $(window).scroll(function () {\r\n if (($(this).scrollTop() > leftMenuOffset) && !leftMenuFixed.hasClass('fixed')) {\r\n leftMenuFixed.addClass('fixed');\r\n } else if ($(this).scrollTop() <= leftMenuOffset && leftMenuFixed.hasClass('fixed')) {\r\n leftMenuFixed.removeClass('fixed');\r\n }\r\n });\r\n }\r\n};\r\n","//// The script to open event detail window\r\nfunction openEventDetailWindow(eventID) {\r\n var arr = document.URL.split(\"/\");\r\n if (arr.length > 2) {\r\n var url = arr[0] + '//' + arr[2] + '/Events/EventDetail.aspx?eid=' + eventID;\r\n window.open(url, \"\", \"height=400,width=650,left=160,top=100,resizable=yes,toolbar=yes,scrollbars=yes,menubar=yes,location=no,directories=no,status=yes\");\r\n }\r\n}\r\n\r\nfunction openEventDetailWindowAnonmyous(eventID) {\r\n var url = '/Events/Public/EventDetail.aspx?eid=' + eventID;\r\n window.open(url, \"\", \"height=500,width=650,left=160,top=100,resizable=yes,toolbar=yes,scrollbars=yes,menubar=yes,location=no,directories=no,status=yes\");\r\n}\r\n\r\n\r\n// Support for firefox - add click event to a link\r\nfunction addClickEventToLink(id) {\r\n var linkElement = document.getElementById(id);\r\n if (linkElement && typeof (linkElement.click) == 'undefined') {\r\n linkElement.click = function () {\r\n var result = true;\r\n if (linkElement.onclick) result = linkElement.onclick();\r\n if (typeof (result) == 'undefined' || result) {\r\n eval(linkElement.href);\r\n linkElement.click();\r\n }\r\n }\r\n }\r\n}\r\n\r\n\r\n///////////////////////////////////////\r\n// Support for flash activation - start\r\n//Copyright 2006 Adobe Systems, Inc. All rights reserved. //v1.0\r\nfunction AC_AddExtension(src, ext) {\r\n if (src.indexOf('?') != -1)\r\n return src.replace(/\\?/, ext + '?');\r\n else\r\n return src + ext;\r\n}\r\n\r\nfunction AC_Generateobj(objAttrs, params, embedAttrs) {\r\n var str = ' ';\r\n str += ' 130) {\r\n\r\n }\r\n }\r\n if (document.getElementById('3tabsbox') && document.getElementById('tab1-col1')) {\r\n\r\n var tab1_col1_height = document.getElementById('tab1-col1').offsetHeight;\r\n \r\n var tab1_col2_height = document.getElementById('tab1-col2').offsetHeight;\r\n \r\n\r\n if ((tab1_col1_height > 130) || (tab1_col2_height > 130)) {\r\n \r\n var tab1_tallest;\r\n if (tab1_col1_height > tab1_col2_height) {\r\n tab1_tallest = tab1_col1_height;\r\n document.getElementById('tab1-divider').style.height = tab1_tallest + 'px';\r\n }\r\n else if (tab1_col2_height > tab1_col1_height) {\r\n tab1_tallest = tab1_col2_height;\r\n document.getElementById('tab1-divider').style.height = tab1_tallest + 'px';\r\n }\r\n else { /* DO NOTHING */ }\r\n }\r\n else if ((tab1_col1_height < 130) && (tab1_col2_height < 130)) {\r\n }\r\n else { /* DO NOTHING */ }\r\n\r\n }\r\n}\r\n\r\n\r\n\r\nfunction adjustDividerLineTab2() {\r\n\r\n if (document.getElementById('3tabsbox') && document.getElementById('tab1-col2')) {\r\n\r\n var tab2_col1_height = document.getElementById('tab2-col1').offsetHeight;\r\n var tab2_col2_height = document.getElementById('tab2-col2').offsetHeight;\r\n\r\n if ((tab2_col1_height > 130) || (tab2_col2_height > 130)) {\r\n var tab2_tallest;\r\n if (tab2_col1_height > tab2_col2_height) {\r\n tab2_tallest = tab2_col1_height;\r\n document.getElementById('tab2-divider').style.height = tab2_tallest + 'px';\r\n }\r\n else if (tab2_col2_height > tab2_col1_height) {\r\n tab2_tallest = tab2_col2_height;\r\n document.getElementById('tab2-divider').style.height = tab2_tallest + 'px';\r\n }\r\n else { /* DO NOTHING */ }\r\n }\r\n else if ((tab2_col1_height < 130) && (tab2_col2_height < 130)) {\r\n }\r\n else { /* DO NOTHING */ }\r\n\r\n }\r\n}\r\n\r\n\r\n\r\nfunction adjustDividerLineTab3() {\r\n\r\n if (document.getElementById('3tabsbox') && document.getElementById('tab3-col1')) {\r\n\r\n var tab3_col1_height = document.getElementById('tab3-col1').offsetHeight;\r\n var tab3_col2_height = document.getElementById('tab3-col2').offsetHeight;\r\n\r\n if ((tab3_col1_height > 130) || (tab3_col2_height > 130)) {\r\n var tab3_tallest;\r\n if (tab3_col1_height > tab3_col2_height) {\r\n tab3_tallest = tab3_col1_height;\r\n document.getElementById('tab3-divider').style.height = tab3_tallest + 'px';\r\n }\r\n else if (tab3_col2_height > tab3_col1_height) {\r\n tab3_tallest = tab3_col2_height;\r\n document.getElementById('tab3-divider').style.height = tab3_tallest + 'px';\r\n }\r\n else { /* DO NOTHING */ }\r\n }\r\n else if ((tab3_col1_height < 130) && (tab3_col2_height < 130)) {\r\n }\r\n else { /* DO NOTHING */ }\r\n\r\n }\r\n}\r\n\r\n\r\n\r\n\r\nfunction hideAllWraps() {\r\n if (document.getElementById('dynamic_wrap1a') != null)\r\n document.getElementById('dynamic_wrap1a').style.display = 'none';\r\n if (document.getElementById('dynamic_wrap1b') != null)\r\n document.getElementById('dynamic_wrap1b').style.display = 'none';\r\n if (document.getElementById('dynamic_wrap2') != null)\r\n document.getElementById('dynamic_wrap2').style.display = 'none';\r\n if (document.getElementById('dynamic_wrap3') != null)\r\n document.getElementById('dynamic_wrap3').style.display = 'none';\r\n}\r\n\r\n\r\nfunction showDynamicWrap1a() {\r\n if (document.getElementById('dynamic_wrap1a') != null)\r\n document.getElementById('dynamic_wrap1a').style.display = 'inline';\r\n}\r\n\r\n\r\n// dynamic_wrap1b - TWO COLUMNS;\r\nfunction showDynamicWrap1b() {\r\n if (document.getElementById('dynamic_wrap1b') != null)\r\n document.getElementById('dynamic_wrap1b').style.display = 'inline';\r\n}\r\n\r\n// dynamic_wrap2 - TWO COLUMN;\r\nfunction showDynamicWrap2() {\r\n if (document.getElementById('dynamic_wrap2') != null)\r\n document.getElementById('dynamic_wrap2').style.display = 'inline';\r\n}\r\n\r\n// dynamic_wrap3 - TWO COLUMN;\r\nfunction showDynamicWrap3() {\r\n if (document.getElementById('dynamic_wrap3') != null)\r\n document.getElementById('dynamic_wrap3').style.display = 'inline';\r\n}\r\n\r\nfunction showHealthyIcons() {\r\n if (document.getElementById('healthy_icons') != null)\r\n document.getElementById('healthy_icons').style.display = 'inline';\r\n}\r\nfunction hideHealthyIcons() {\r\n if (document.getElementById('healthy_icons') != null)\r\n document.getElementById('healthy_icons').style.display = 'none';\r\n}\r\n\r\n\r\nfunction toggleTab(id) {\r\n if (id == 'tab1') {\r\n hideAllWraps();\r\n showDynamicWrap1a();\r\n hideHealthyIcons();\r\n if (document.getElementById('vis1') != null)\r\n document.getElementById('vis1').style.backgroundImage = 'url(/Content/Global/Products/Img/tab-blu-on.gif)';\r\n if (document.getElementById('vis1-header') != null)\r\n document.getElementById('vis1-header').style.color = '#005b7f';\r\n if (document.getElementById('vis2') != null)\r\n document.getElementById('vis2').style.backgroundImage = 'url(/Content/Global/Products/Img/tab-blu-off.gif)';\r\n if (document.getElementById('vis2-header') != null)\r\n document.getElementById('vis2-header').style.color = '#8c978b';\r\n if (document.getElementById('vis3') != null)\r\n document.getElementById('vis3').style.backgroundImage = 'url(/Content/Global/Products/Img/tab-blu-off_171x25.gif)';\r\n if (document.getElementById('vis3-header') != null)\r\n document.getElementById('vis3-header').style.color = '#8c978b';\r\n }\r\n\r\n else if (id == 'tab2') {\r\n hideAllWraps();\r\n showDynamicWrap2();\r\n showHealthyIcons();\r\n if (document.getElementById('vis1') != null)\r\n document.getElementById('vis1').style.backgroundImage = 'url(/Content/Global/Products/Img/tab-blu-off.gif)';\r\n if (document.getElementById('vis1-header') != null)\r\n document.getElementById('vis1-header').style.color = '#8c978b';\r\n if (document.getElementById('vis2') != null)\r\n document.getElementById('vis2').style.backgroundImage = 'url(/Content/Global/Products/Img/tab-blu-on.gif)';\r\n if (document.getElementById('vis2-header') != null)\r\n document.getElementById('vis2-header').style.color = '#005b7f';\r\n if (document.getElementById('vis3') != null)\r\n document.getElementById('vis3').style.backgroundImage = 'url(/Content/Global/Products/Img/tab-blu-off_171x25.gif)';\r\n if (document.getElementById('vis3-header') != null)\r\n document.getElementById('vis3-header').style.color = '#8c978b';\r\n }\r\n\r\n\r\n else if (id == 'tab3') {\r\n hideAllWraps();\r\n showDynamicWrap3();\r\n showHealthyIcons();\r\n if (document.getElementById('vis1') != null)\r\n document.getElementById('vis1').style.backgroundImage = 'url(/Content/Global/Products/Img/tab-blu-off.gif)';\r\n if (document.getElementById('vis1-header') != null)\r\n document.getElementById('vis1-header').style.color = '#8c978b';\r\n if (document.getElementById('vis2') != null)\r\n document.getElementById('vis2').style.backgroundImage = 'url(/Content/Global/Products/Img/tab-blu-off.gif)';\r\n if (document.getElementById('vis2-header') != null)\r\n document.getElementById('vis2-header').style.color = '#8c978b';\r\n if (document.getElementById('vis3') != null)\r\n document.getElementById('vis3').style.backgroundImage = 'url(/Content/Global/Products/Img/tab-blu-on_171x25.gif)';\r\n if (document.getElementById('vis3-header') != null)\r\n document.getElementById('vis3-header').style.color = '#005b7f';\r\n }\r\n\r\n\r\n}\r\n\r\n\r\n// Support for flash activation - end\r\n\r\n\r\n\r\n/// \r\nvar xmlHttp = false;\r\nfunction getXmlHttpRequestObject() {\r\n // check for native XMLHttpRequest object\r\n if (window.XMLHttpRequest && !(window.ActiveXObject)) {\r\n try {\r\n xmlHttp = new XMLHttpRequest();\r\n }\r\n catch (e) {\r\n xmlHttp = false;\r\n }\r\n }\r\n // check for IE/Windows ActiveX version\r\n else if (window.ActiveXObject) {\r\n try {\r\n xmlHttp = new ActiveXObject(\"Msxml2.XMLHTTP\");\r\n }\r\n catch (e) {\r\n try {\r\n xmlHttp = new ActiveXObject(\"Microsoft.XMLHTTP\");\r\n }\r\n catch (e) {\r\n xmlHttp = false;\r\n }\r\n }\r\n }\r\n}\r\n\r\n\r\nfunction OpenWindow(strLink, width, height, strName) {\r\n var blnSizeWindow = true;\r\n var strWidth = \"\";\r\n var strHeight = \"\";\r\n var strTop = \"\";\r\n var strLeft = \"\";\r\n var strProp = \"toolbar=no,,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes\";\r\n\r\n if (strName == null)\r\n strName = \"MiVentana\"\r\n\r\n if (width == null || width == 0) {\r\n width = screen.availWidth - 15;\r\n height = screen.availHeight - 50;\r\n _top = 0\r\n _left = 0\r\n }\r\n else {\r\n _top = (screen.availHeight / 2) - (height / 2);\r\n _left = (screen.availWidth / 2) - (width / 2);\r\n }\r\n\r\n if (width != 0) {\r\n strWidth = \"width=\" + width;\r\n strLeft = \"left=\" + _left;\r\n }\r\n\r\n if (height != 0) {\r\n strHeight = \"height=\" + height;\r\n strTop = \"top=\" + _top;\r\n }\r\n\r\n\r\n if (blnSizeWindow)\r\n strProp = \"toolbar=no,,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,\" + strWidth + \",\" + strHeight + \",\" + strTop + \",\" + strLeft;\r\n\r\n var oWindow = window.open(strLink, strName, strProp)\r\n oWindow.focus();\r\n\r\n return;\r\n}\r\n\r\nfunction checkMaxQuantity(event, max, error) {\r\n if (event.srcElement.value > max) {\r\n event.srcElement.value = \"\";\r\n alert(error);\r\n }\r\n}\r\n\r\nfunction checkSKU(e, ctrl, error) {\r\n\r\n var sku = event.srcElement.value;\r\n if (sku != null && sku != \"\") {\r\n var inputAmounts = document.getElementsByTagName(\"input\");\r\n for (i = 0; i < inputAmounts.length; i++) {\r\n var p = inputAmounts[i];\r\n if (p.name.indexOf(\"uxSKU\") != -1 && p.value != \"\" && p.name != event.srcElement.name) {\r\n if (p.value == sku) {\r\n event.srcElement.value = \"\";\r\n var newString = error.replace(\"{0}\", sku);\r\n alert(newString);\r\n break;\r\n } \r\n }\r\n }\r\n }\r\n}\r\n\r\nfunction checkQuantity(e, ctrl) {\r\n var keynum;\r\n var keychar;\r\n\r\n if (!e) {\r\n e = window.event;\r\n }\r\n\r\n if (e.keyCode) {\r\n keynum = e.keyCode;\r\n } else if (e.which) {\r\n keynum = e.which;\r\n }\r\n\r\n keychar = String.fromCharCode(keynum);\r\n\r\n // take only numbers\r\n if (!/^ *[0-9]+ *$/.test(keychar)) {\r\n e.cancelBubble = true;\r\n if (event.preventDefault) {\r\n event.preventDefault();\r\n }\r\n else {\r\n event.returnValue = false;\r\n }\r\n }\r\n}\r\n\r\nfunction checkAmount(e, ctrl, allowdecimal) {\r\n var keynum;\r\n var keychar;\r\n\r\n if (window.event) // IE\r\n {\r\n keynum = e.keyCode;\r\n } else if (e.which) // Netscape/Firefox/Opera\r\n {\r\n keynum = e.which;\r\n }\r\n keychar = String.fromCharCode(keynum);\r\n\r\n var valid = false;\r\n if (allowdecimal == 1) {\r\n valid = (/^ *[0-9.]+ *$/.test(keychar));\r\n } else {\r\n valid = (/^ *[0-9]+ *$/.test(keychar));\r\n }\r\n if (valid == false) {\r\n\r\n e.cancelBubble = true;\r\n if (window.event) // IE\r\n {\r\n e.keyCode = 0;\r\n } else if (e.which) {\r\n e.which = 0;\r\n }\r\n\r\n }\r\n}\r\n\r\nvar amtField = null;\r\nvar balanceField = null;\r\n\r\nfunction CVVKeyPress(e, ctrl, totaldue, maxlen) {\r\n var useComma = totaldue.indexOf(',') > -1;\r\n checkQuantity(e, ctrl);\r\n var eSource = GetEventSource(e);\r\n var name = eSource.id;\r\n name = name.replace(\"txtCVV\", \"txtAmount\");\r\n var amtField = document.getElementById(name);\r\n var balanceField = null;\r\n if (null != amtField) {\r\n balanceField = findBalanceField();\r\n if (null != balanceField) {\r\n if (balanceField.value.length == 0) {\r\n balanceField.value = window.amount;\r\n }\r\n var balance = balanceField.value;\r\n if (amtField.value.length == 0) {\r\n if (useComma) {\r\n balanceField.value = balanceField.value.replace(',', '.');\r\n }\r\n if (parseFloat(balanceField.value) > 0) {\r\n amtField.value = balance;\r\n balanceField.value = 0;\r\n }\r\n if (useComma) {\r\n balanceField.value = balanceField.value.replace('.', ',');\r\n }\r\n }\r\n }\r\n }\r\n}\r\n\r\nfunction AmountLosingFocus(e, ctrl, totaldue, allowDecimals) {\r\n var ftotaldue = 0.0;\r\n var total = 0.0;\r\n var hasCommas = totaldue.indexOf(',') > -1;\r\n if (hasCommas) {\r\n totaldue = totaldue.replace(',', '.');\r\n }\r\n //test;\r\n ftotaldue = parseFloat(totaldue).toFixed(2);\r\n var inputAmounts = document.getElementsByTagName(\"input\");\r\n for (i = 0; i < inputAmounts.length; i++) {\r\n var p = inputAmounts[i];\r\n if (p.name.indexOf(\"txtAmount\") != -1 && p.value != \"\") {\r\n if (hasCommas) {\r\n p.value = p.value.replace(',', '.');\r\n }\r\n if (parseFloat(p.value) == 0) {\r\n p.value = '';\r\n }\r\n else {\r\n if (allowDecimals) {\r\n p.value = parseFloat(p.value).toFixed(2);\r\n }\r\n else {\r\n p.value = parseInt(p.value);\r\n }\r\n total += parseFloat(p.value);\r\n if (hasCommas) {\r\n p.value = p.value.replace('.', ',');\r\n }\r\n }\r\n }\r\n }\r\n\r\n var balanceField = findBalanceField();\r\n if (null != balanceField) {\r\n var val = (ftotaldue - total).toFixed(2);\r\n if (isNaN(val)) {\r\n window.alert('Please enter valid input');\r\n }\r\n else {\r\n if (allowDecimals) {\r\n balanceField.value = val;\r\n }\r\n else {\r\n balanceField.value = parseInt(val);\r\n }\r\n if (hasCommas) {\r\n balanceField.value = balanceField.value.replace('.', ',');\r\n }\r\n }\r\n }\r\n}\r\n\r\nfunction findBalanceField() {\r\n var balanceField = null;\r\n var inputAmounts = document.getElementsByTagName(\"input\");\r\n for (i = 0; i < inputAmounts.length; i++) {\r\n var p = inputAmounts[i];\r\n if (p.name.indexOf(\"totalAmountBalance\") != -1) {\r\n balanceField = p;\r\n break;\r\n }\r\n }\r\n\r\n return balanceField;\r\n}\r\n\r\nfunction HideButtons() {\r\n var checkout1 = document.getElementById('ctl00_ctl00_ContentArea_ProductsContent_CheckoutButtonDisabled');\r\n if (checkout1 != null) {\r\n checkout1.style.display = 'none';\r\n }\r\n var checkout2 = document.getElementById('ctl00_ctl00_ContentArea_ProductsContent_CheckoutButton2Disabled');\r\n if (checkout2 != null) {\r\n checkout2.style.display = 'none';\r\n }\r\n}\r\n\r\nfunction displayButton(ctrl) {\r\n if (ctrl != null) {\r\n ctrl.style.display = 'inline';\r\n }\r\n}\r\n\r\nfunction DisableOnClick(ctrl) {\r\n ctrl.style.display = 'none';\r\n var button = document.getElementById('ctl00_ctl00_ContentArea_ProductsContent_CheckoutButtonDisabled');\r\n if (button != null) {\r\n displayButton(button);\r\n }\r\n button = document.getElementById('ctl00_ctl00_ContentArea_ProductsContent_CheckoutButton2');\r\n if (button != null) {\r\n button.style.display = 'none';\r\n }\r\n button = document.getElementById('ctl00_ctl00_ContentArea_ProductsContent_CheckoutButton2Disabled');\r\n if (button != null) {\r\n displayButton(button);\r\n }\r\n}\r\n\r\nfunction DisableOnClick2(ctrl) {\r\n ctrl.style.display = 'none';\r\n var button = document.getElementById('ctl00_ctl00_ContentArea_ProductsContent_CheckoutButton2Disabled');\r\n if (button != null) {\r\n displayButton(button);\r\n }\r\n button = document.getElementById('ctl00_ctl00_ContentArea_ProductsContent_CheckoutButton');\r\n if (button != null) {\r\n button.style.display = 'none';\r\n }\r\n button = document.getElementById('ctl00_ctl00_ContentArea_ProductsContent_CheckoutButtonDisabled');\r\n if (button != null) {\r\n displayButton(button);\r\n }\r\n}\r\n\r\nfunction AmoutLosingFocus(e, ctrl, totaldue) {\r\n\r\n var total = 0.0;\r\n\r\n var inputAmounts = document.getElementsByTagName(\"input\");\r\n for (i = 0; i < inputAmounts.length; i++) {\r\n var p = inputAmounts[i];\r\n if (p.name.indexOf(\"txtAmount\") != -1 && p.value != \"\") {\r\n total += parseFloat(p.value);\r\n }\r\n }\r\n if (balanceField == null) {\r\n findBalanceField();\r\n }\r\n\r\n if (balanceField != null) {\r\n balanceField.value = totaldue - total;\r\n }\r\n}","$(document).ready(function () {\r\n var rToken;\r\n $('a[class*=\"bc_modal_link\"]').each(function () {\r\n if ($(this).data(\"bc-tkn\") !== undefined) {\r\n rToken = $(this).data(\"bc-tkn\");\r\n }\r\n });\r\n\r\n if ($(\"a.p_bc_modal_link\").length > 0) {\r\n $(\"body\").append('
 
    '); $(\"body\").append(decodeURIComponent('%3Cscript src=\"//players.brightcove.net/' + $(\"a.p_bc_modal_link\").data(\"bc-account\") + '/' + $(\"a.p_bc_modal_link\").data(\"bc-player\") + '_default/index.min.js\" %3E%3C/script%3E'));\r\n }\r\n\r\n if ($(\"a.s_bc_modal_link\").length > 0) {\r\n $(\"body\").append('
     
    ');\r\n $(\"body\").append(decodeURIComponent('%3Cscript src=\"//players.brightcove.net/' + $(\"a.s_bc_modal_link\").data(\"bc-account\") + '/' + $(\"a.s_bc_modal_link\").data(\"bc-player\") + '_default/index.min.js\" %3E%3C/script%3E'));\r\n }\r\n\r\n if ($(\"a.a_bc_modal_link\").length > 0) {\r\n $(\"body\").append('
     
      ');\r\n $(\"body\").append(decodeURIComponent('%3Cscript src=\"//players.brightcove.net/' + $(\"a.a_bc_modal_link\").data(\"bc-account\") + '/' + $(\"a.a_bc_modal_link\").data(\"bc-player\") + '_default/index.min.js\" %3E%3C/script%3E'));\r\n }\r\n\r\n if ($(\"a.u_bc_modal_link\").length > 0) {\r\n $(\"body\").append('
       
      ');\r\n $(\"body\").append(decodeURIComponent('%3Cscript src=\"//players.brightcove.net/' + $(\"a.u_bc_modal_link\").data(\"bc-account\") + '/' + $(\"a.u_bc_modal_link\").data(\"bc-player\") + '_default/index.min.js\" %3E%3C/script%3E'));\r\n }\r\n});\r\n"]}