-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBootstrap.js
155 lines (153 loc) · 70.2 KB
/
Bootstrap.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
(function ensightenInit(){var ensightenOptions = {client: "npg", clientId: 322, publishPath: "prod-sa", isPublic:0, serverComponentLocation: "nexus.ensighten.com/npg/prod-sa/serverComponent.php", staticJavascriptPath: "nexus.ensighten.com/npg/prod-sa/code/", ns: 'Bootstrapper', nexus:"nexus.ensighten.com", scUseCacheBuster: "true", enableTagAuditBeacon : "true", enablePagePerfBeacon : "true", callOnDOMParsedFix: "false", registryNs : "ensBootstraps", generatedOn : "Fri Oct 16 21:18:47 GMT 2015", beaconSamplingSeedValue: 11};
if ( !window[ensightenOptions.ns] ) {
window[ensightenOptions.registryNs]||(window[ensightenOptions.registryNs]={});
window[ensightenOptions.registryNs][ensightenOptions.ns]=window[ensightenOptions.ns]=function(f){function m(a){this.name="DependencyNotAvailableException";this.message="Dependency with id "+a+"is missing"}function n(a){this.name="BeaconException";this.message="There was an error durring beacon initialization";a=a||{};this.lineNumber=a.lineNumber||a.line;this.fileName=a.fileName}function p(){for(var a=b.dataDefinitionIds.length,e=!0,d=0;d<a;d++){var c=b.dataDefinitions[b.dataDefinitionIds[d]];if(!c||
null==c.endRegistration){e=!1;break}}e&&b.callOnDataDefintionComplete()}var c={},b={};b.ensightenOptions=ensightenOptions;b.scDataObj={};c.version="1.26.0";c.nexus=f.nexus||"nexus.ensighten.com";c.rand=-1;c.currSec=(new Date).getSeconds();c.options={interval:f.interval||100,erLoc:f.errorLocation||c.nexus+"/error/e.gif",scLoc:f.serverComponentLocation||c.nexus+"/"+f.client+"/serverComponent.php",sjPath:f.staticJavascriptPath||c.nexus+"/"+f.client+"/code/",alLoc:f.alertLocation||c.nexus+"/alerts/a.gif",
publishPath:f.publishPath,isPublic:f.isPublic,client:f.client,clientId:f.clientId,enableTagAuditBeacon:f.enableTagAuditBeacon,callOnDOMParsedFix:f.callOnDOMParsedFix,scUseCacheBuster:f.scUseCacheBuster,beaconSamplingSeedValue:f.beaconSamplingSeedValue||-1};c.ruleList=[];c.allDeploymentIds=[];c.runDeploymentIds=[];c.exceptionList=[];c.ensightenVariables={};c.test=function(a){if(!(a.executionData.hasRun||a.executionData.runTime&&0<a.executionData.runTime.length)){for(var b=0;b<a.dependencies.length;b++)if(!1===
a.dependencies[b]())return;a.execute()}};m.prototype=Error();m.prototype||(m.prototype={});m.prototype.constructor=m;c.DependencyNotAvailableException=m;n.prototype=Error();n.prototype||(n.prototype={});n.prototype.constructor=n;c.BeaconException=n;c.checkForInvalidDependencies=function(a,e,d,l){for(a=0;a<d.length;a++)if("DEPENDENCYNEVERAVAILABLE"===d[a])return b.currentRuleId=this.id,b.currentDeploymentId=this.deploymentId,b.reportException(new c.DependencyNotAvailableException(l[a])),e&&-1!==e&&
c.allDeploymentIds.push(e),!0;return!1};b.currentRuleId=-1;b.currentDeploymentId=-1;b.reportedErrors=[];b.reportedAlerts=[];b.AF=[];b._serverTime="";b._clientIP="";b.sampleBeacon=function(){var a=!1;try{var b=(c.currSec||0)%20,d=c.options.beaconSamplingSeedValue;-1===d?a=!0:0!==b&&0===d%b&&(a=!0)}catch(l){}return a};b.getServerComponent=function(a){b.callOnGetServerComponent();b.insertScript(window.location.protocol+"//"+c.options.scLoc,!1,a||!0,c.options.scUseCacheBuster)};b.setVariable=function(a,
b){c.ensightenVariables[a]=b};b.getVariable=function(a){return a in c.ensightenVariables?c.ensightenVariables[a]:null};b.testAll=function(){for(var a=0;a<c.ruleList.length;a++)c.test(c.ruleList[a])};b.executionState={DOMParsed:!1,DOMLoaded:!1,dataDefinitionComplete:!1,conditionalRules:!1,readyForServerComponent:!1};b.reportException=function(a){a.timestamp=(new Date).getTime();c.exceptionList.push(a);a=window.location.protocol+"//"+c.options.erLoc+"?msg="+encodeURIComponent(a.message||"")+"&lnn="+
encodeURIComponent(a.lineNumber||a.line||-1)+"&fn="+encodeURIComponent(a.fileName||"")+"&cid="+encodeURIComponent(c.options.clientId||-1)+"&client="+encodeURIComponent(c.options.client||"")+"&publishPath="+encodeURIComponent(c.options.publishPath||"")+"&rid="+encodeURIComponent(b.currentRuleId||-1)+"&did="+encodeURIComponent(b.currentDeploymentId||-1)+"&errorName="+encodeURIComponent(a.name||"");a=b.imageRequest(a);a.timestamp=(new Date).getTime();this.reportedErrors.push(a)};b.Rule=function(a){this.execute=
function(){this.executionData.runTime.push(new Date);b.currentRuleId=this.id;b.currentDeploymentId=this.deploymentId;try{this.code()}catch(a){window[ensightenOptions.ns].reportException(a)}finally{this.executionData.hasRun=!0,-1!==this.deploymentId&&c.runDeploymentIds.push(this.deploymentId),b.testAll()}};this.id=a.id;this.deploymentId=a.deploymentId;this.dependencies=a.dependencies||[];this.code=a.code;this.executionData={hasRun:!1,runTime:[]}};b.registerRule=function(a){if(b.getRule(a.id)&&-1!==
a.id)return!1;c.ruleList.push(a);-1!==a.deploymentId&&c.allDeploymentIds.push(a.deploymentId);b.testAll();return!0};b.getRule=function(a){for(var b=0;b<c.ruleList.length;b++)if(c.ruleList[b].id===a)return c.ruleList[b];return!1};
b.getAllDeploymentIds=function(){return c.allDeploymentIds};b.getRunDeploymentIds=function(){return c.runDeploymentIds};b.hasRuleRun=function(a){return(a=b.getRule(a))?a.executionData.hasRun:
!1};c.toTwoChar=function(a){return(2===a.toString().length?"":"0")+a};b.Alert=function(a){var b=new Date,b=b.getFullYear()+"-"+c.toTwoChar(b.getMonth())+"-"+c.toTwoChar(b.getDate())+" "+c.toTwoChar(b.getHours())+":"+c.toTwoChar(b.getMinutes())+":"+c.toTwoChar(b.getSeconds());this.severity=a.severity||1;this.subject=a.subject||"";this.type=a.type||1;this.ruleId=a.ruleId||-1;this.severity=encodeURIComponent(this.severity);this.date=encodeURIComponent(b);this.subject=encodeURIComponent(this.subject);
this.type=encodeURIComponent(this.type)};b.generateAlert=function(a){a=b.imageRequest(window.location.protocol+"//"+c.options.alLoc+"?d="+a.date+"&su="+a.subject+"&se="+a.severity+"&t="+a.type+"&cid="+c.options.clientId+"&client="+c.options.client+"&publishPath="+c.options.publishPath+"&rid="+b.currentRuleId+"&did="+b.currentDeploymentId);a.timestamp=(new Date).getTime();this.reportedAlerts.push(a)};b.imageRequest=function(a){var b=new Image(0,0);b.src=a;return b};b.insertScript=function(a,e,d,l){var h=
document.getElementsByTagName("script"),g;l=void 0!==l?l:!0;if(void 0!==e?e:1)for(g=0;g<h.length;g++)if(h[g].src===a&&h[g].readyState&&/loaded|complete/.test(h[g].readyState))return;if(d){d=1==d&&"object"==typeof b.scDataObj?b.scDataObj:d;c.rand=Math.random()*("1E"+(10*Math.random()).toFixed(0));e=window.location.href;if("object"===typeof d)for(g in d){g=~e.indexOf("#")?e.slice(e.indexOf("#"),e.length):"";e=e.slice(0,g.length?e.length-g.length:e.length);e+=~e.indexOf("?")?"&":"?";for(k in d)e+=k+
"="+d[k]+"&";e=e.slice(0,-1)+g;break}a+="?";l&&(a+="r="+c.rand+"&");a+="ClientID="+encodeURIComponent(c.options.clientId)+"&PageID="+encodeURIComponent(e)}(function(a,b,e){var d=b.head||b.getElementsByTagName("head");setTimeout(function(){if("item"in d){if(!d[0]){setTimeout(arguments.callee,25);return}d=d[0]}var a=b.createElement("script");a.src=e;a.onload=a.onerror=function(){this.addEventListener&&(this.readyState="loaded")};d.insertBefore(a,d.firstChild)},0)})(window,document,a)};b.loadScriptCallback=
function(a,b,d){var c=document.getElementsByTagName("script"),h;d=c[0];for(h=0;h<c.length;h++)if(c[h].src===a&&c[h].readyState&&/loaded|complete/.test(c[h].readyState))try{b()}catch(g){window[ensightenOptions.ns].reportException(g)}finally{return}c=document.createElement("script");c.type="text/javascript";c.async=!0;c.src=a;c.onerror=function(){this.addEventListener&&(this.readyState="loaded")};c.onload=c.onreadystatechange=function(){if(!this.readyState||"complete"===this.readyState||"loaded"===
this.readyState){this.onload=this.onreadystatechange=null;this.addEventListener&&(this.readyState="loaded");try{b.call(this)}catch(a){window[ensightenOptions.ns].reportException(a)}}};d.parentNode.insertBefore(c,d)};b.unobtrusiveAddEvent=function(a,b,d){try{var c=a[b]?a[b]:function(){};a[b]=function(){d.apply(this,arguments);return c.apply(this,arguments)}}catch(h){window[ensightenOptions.ns].reportException(h)}};b.anonymous=function(a,e){return function(){try{b.currentRuleId=e?e:"anonymous",a()}catch(d){window[ensightenOptions.ns].reportException(d)}}};
b.setCurrentRuleId=function(a){b.currentRuleId=a};b.setCurrentDeploymentId=function(a){b.currentDeploymentId=a};b.bindImmediate=function(a,e,d){if("function"===typeof a)a=new b.Rule({id:e||-1,deploymentId:d||-1,dependencies:[],code:a});else if("object"!==typeof a)return!1;b.registerRule(a)};b.bindDOMParsed=function(a,e,d){if("function"===typeof a)a=new b.Rule({id:e||-1,deploymentId:d||-1,dependencies:[function(){return window[ensightenOptions.ns].executionState.DOMParsed}],code:a});else if("object"!==
typeof a)return!1;b.registerRule(a)};b.bindDOMLoaded=function(a,e,d){if("function"===typeof a)a=new b.Rule({id:e||-1,deploymentId:d||-1,dependencies:[function(){return window[ensightenOptions.ns].executionState.DOMLoaded}],code:a});else if("object"!==typeof a)return!1;b.registerRule(a)};b.bindPageSpecificCompletion=function(a,e,d){if("function"===typeof a)a=new b.Rule({id:e||-1,deploymentId:d||-1,dependencies:[function(){return window[ensightenOptions.ns].executionState.conditionalRules}],code:a});
else if("object"!==typeof a)return!1;b.registerRule(a)};b.bindOnGetServerComponent=function(a,e,d){if("function"===typeof a)a=new b.Rule({id:e||-1,deploymentId:d||-1,dependencies:[function(){return window[ensightenOptions.ns].executionState.readyForServerComponent}],code:a});else if("object"!==typeof a)return!1;b.registerRule(a)};b.bindDataDefinitionComplete=function(a,e,d){if("function"===typeof a)a=new b.Rule({id:e||-1,deploymentId:d||-1,dependencies:[function(){return window[ensightenOptions.ns].executionState.dataDefinitionComplete}],
code:a});else if("object"!==typeof a)return!1;b.registerRule(a)};b.checkHasRun=function(a){if(0===a.length)return!0;for(var e,d=0;d<a.length;++d)if(e=b.getRule(parseInt(a[d],10)),!e||!e.executionData.hasRun)return!1;return!0};b.bindDependencyImmediate=function(a,e,d,l,h){var g=[];if(!c.checkForInvalidDependencies(e,l,d,h)){g.push(function(){return window[ensightenOptions.ns].checkHasRun(d)});if("function"===typeof a)a=new b.Rule({id:e||-1,deploymentId:l||-1,dependencies:g,code:a});else if("object"!==
typeof a)return!1;b.registerRule(a)}};b.bindDependencyDOMLoaded=function(a,e,d,l,h){var g=[];if(!c.checkForInvalidDependencies(e,l,d,h)){g.push(function(){return window[ensightenOptions.ns].executionState.DOMLoaded});g.push(function(){return window[ensightenOptions.ns].checkHasRun(d)});if("function"===typeof a)a=new b.Rule({id:e||-1,deploymentId:l||-1,dependencies:g,code:a});else if("object"!==typeof a)return!1;b.registerRule(a)}};b.bindDependencyDOMParsed=function(a,e,d,l,h){var g=[];if(!c.checkForInvalidDependencies(e,
l,d,h)){g.push(function(){return window[ensightenOptions.ns].executionState.DOMParsed});g.push(function(){return window[ensightenOptions.ns].checkHasRun(d)});if("function"===typeof a)a=new b.Rule({id:e||-1,deploymentId:l||-1,dependencies:g,code:a});else if("object"!==typeof a)return!1;b.registerRule(a)}};b.bindDependencyPageSpecificCompletion=function(a,e,d,l,h){var g=[];if(!c.checkForInvalidDependencies(e,l,d,h)){g.push(function(){return window[ensightenOptions.ns].executionState.conditionalRules});
g.push(function(){return window[ensightenOptions.ns].checkHasRun(d)});if("function"===typeof a)a=new b.Rule({id:e||-1,deploymentId:l||-1,dependencies:g,code:a});else if("object"!==typeof a)return!1;b.registerRule(a)}};b.bindDependencyOnGetServerComponent=function(a,e,d,l,h){var g=[];if(!c.checkForInvalidDependencies(e,l,d,h)){g.push(function(){return window[ensightenOptions.ns].executionState.readyForServerComponent});g.push(function(){return window[ensightenOptions.ns].checkHasRun(d)});if("function"===
typeof a)a=new b.Rule({id:e||-1,deploymentId:l||-1,dependencies:g,code:a});else if("object"!==typeof a)return!1;b.registerRule(a)}};b.bindDependencyPageSpecificCompletion=function(a,e,d,l,h){var g=[];if(!c.checkForInvalidDependencies(e,l,d,h)){g.push(function(){return window[ensightenOptions.ns].executionState.dataDefinitionComplete});g.push(function(){return window[ensightenOptions.ns].checkHasRun(d)});if("function"===typeof a)a=new b.Rule({id:e||-1,deploymentId:l||-1,dependencies:g,code:a});else if("object"!==
typeof a)return!1;b.registerRule(a)}};b.dataDefintionIds=[];b.dataDefinitions=[];b.pageSpecificDataDefinitionsSet=!1;b.setPageSpecificDataDefinitionIds=function(a){for(var e=a.length,d=0;d<e;d++){var c=a[d];if(Array.prototype.indexOf)-1==b.dataDefinitionIds.indexOf(c)&&b.dataDefinitionIds.push(c);else{for(var h=!1,g=b.dataDefinitionIds.length,f=0;f<g;f++)if(b.dataDefinitionIds[f]===c){h=!0;break}h||b.dataDefinitionIds.push(c)}}b.pageSpecificDataDefinitionsSet=!0;p()};b.DataDefinition=function(a,b){this.id=
a;this.registrationFn=b;this.endRegistrationTime=this.startRegistrationTime=null;this.startRegistration=function(){this.startRegistrationTime=new Date};this.endRegistration=function(){this.endRegistrationTime=new Date}};b.registerDataDefinition=function(a,e){var c=b.dataDefinitions[e];c||(c=new b.DataDefinition(e,a),b.dataDefinitions[e]=c);c.startRegistrationTime||(c.startRegistration(),c.registrationFn(),c.endRegistration());b.pageSpecificDataDefinitionsSet&&p()};b.callOnDataDefintionComplete=function(){b.executionState.dataDefinitionComplete=
!0;b.testAll()};b.callOnDOMParsed=function(){window[ensightenOptions.ns].executionState.DOMParsed=!0;window[ensightenOptions.ns].testAll()};b.callOnDOMLoaded=function(){window[ensightenOptions.ns].executionState.DOMParsed=!0;window[ensightenOptions.ns].executionState.DOMLoaded=!0;window[ensightenOptions.ns].testAll()};b.callOnPageSpecificCompletion=function(){for(var a=document.getElementsByTagName("script"),b=0,c=a.length;b<c;b++)if(a[b].src.match(/\.ensighten\.com\/(.+?)\/code\/.*/i)&&"loaded"!=
a[b].readyState&&"complete"!=a[b].readyState){setTimeout(window[ensightenOptions.ns].callOnPageSpecificCompletion,50);return}setTimeout(function(){window[ensightenOptions.ns].executionState.conditionalRules=!0;window[ensightenOptions.ns].testAll()},1)};b.callOnGetServerComponent=function(){window[ensightenOptions.ns].executionState.readyForServerComponent=!0;window[ensightenOptions.ns].testAll()};b.hasDOMParsed=function(){return window[ensightenOptions.ns].executionState.DOMParsed};b.hasDOMLoaded=
function(){return window[ensightenOptions.ns].executionState.DOMLoaded};b.hasPageSpecificCompletion=function(){return window[ensightenOptions.ns].executionState.conditionalRules};var q=function(){var a=[],b=!1,c=!1;return{add:function(f){b&&!c?f():"function"==typeof f&&(a[a.length]=f)},exec:function(){c=!0;do{var f=a;a=[];b=!0;for(var h=0;h<f.length;h++)try{f[h].call(window)}catch(g){window[ensightenOptions.ns].reportException(g)}}while(0<a.length);c=!1},haveRun:function(){return b}}};b.new_fArray=
function(){return q()};c.timer=null;(function(){function a(a,b){return function(){a.apply(b,arguments)}}window.console||(window.console={});var b=window.console;if(!b.log)if(window.log4javascript){var c=log4javascript.getDefaultLogger();b.log=a(c.info,c);b.debug=a(c.debug,c);b.info=a(c.info,c);b.warn=a(c.warn,c);b.error=a(c.error,c)}else b.log=function(){};b.debug||(b.debug=b.log);b.info||(b.info=b.log);b.warn||(b.warn=b.log);b.error||(b.error=b.log)})();document.addEventListener?(-1<navigator.userAgent.indexOf("AppleWebKit/")?
c.timer="true"===c.options.callOnDOMParsedFix?window.setInterval(function(){/loaded|interactive|complete/.test(document.readyState)&&(clearInterval(c.timer),b.callOnDOMParsed())},50):window.setInterval(function(){/loaded|complete/.test(document.readyState)&&(clearInterval(c.timer),b.callOnDOMParsed())},50):document.addEventListener("DOMContentLoaded",b.callOnDOMParsed,!1),window.addEventListener("load",b.callOnDOMLoaded,!1)):(setTimeout(function(){var a=window.document;(function(){try{if(!document.body)throw"continue";
a.documentElement.doScroll("left")}catch(b){setTimeout(arguments.callee,15);return}window[ensightenOptions.ns].callOnDOMParsed()})()},1),window.attachEvent("onload",function(){window[ensightenOptions.ns].callOnDOMLoaded()}));"true"===c.options.enableTagAuditBeacon&&b.sampleBeacon()&&window.setTimeout(function(){if(window[ensightenOptions.ns]&&!window[ensightenOptions.ns].mobilePlatform)try{for(var a=[],e,d,l,h,g=0;g<c.ruleList.length;++g)d=c.ruleList[g],l=d.executionData.hasRun?"1":"0",h=d.deploymentId.toString()+
"|"+d.id.toString()+"|"+l,a.push(h);e="["+a.join(";")+"]";var m=window.location.protocol+"//"+c.nexus+"/"+encodeURIComponent(f.client)+"/"+encodeURIComponent(f.publishPath)+"/TagAuditBeacon.rnc?cid="+encodeURIComponent(f.clientId)+"&data="+e+"&idx=0&r="+c.rand;b.imageRequest(m)}catch(n){b.currentRuleId=-1,b.currentDeploymentId=-1,a=new c.BeaconException(n),window[ensightenOptions.ns].reportException(a)}},3E3);window.setInterval(b.testAll,c.options.interval);return b}(ensightenOptions);
"true"===ensightenOptions.enablePagePerfBeacon&&window[ensightenOptions.ns]&&window[ensightenOptions.ns].sampleBeacon()&&window[ensightenOptions.ns].bindDOMParsed(function(){if(!window[ensightenOptions.ns].mobilePlatform){var f=window.performance;if(f){var f=f.timing||{},m="",n=f.navigationStart||0,p,c={connectEnd:"ce",connectStart:"cs",domComplete:"dc",domContentLoadedEventEnd:"dclee",domContentLoadedEventStart:"dcles",domInteractive:"di",domLoading:"dl",domainLookupEnd:"dle",domainLookupStart:"dls",
fetchStart:"fs",loadEventEnd:"lee",loadEventStart:"les",redirectEnd:"rede",redirectStart:"reds",requestStart:"reqs",responseStart:"resps",responseEnd:"respe",secureConnectionStart:"scs",unloadEventStart:"ues",unloadEventEnd:"uee"},m="&ns="+encodeURIComponent(f.navigationStart),b;for(b in c)void 0!==f[b]?(p=f[b]-n,m+="&"+c[b]+"="+(0<p?encodeURIComponent(p):0)):m+="&"+c[b]+"=-1";window[ensightenOptions.ns].timing=m;b=ensightenOptions.nexus||"nexus.ensighten.com";f=ensightenOptions.staticJavascriptPath||
"";m=f.indexOf(".com/");n=f.indexOf("/code/");f=f.substring(m+4,n)+"/perf.rnc";f+="?cid="+encodeURIComponent(ensightenOptions.clientId)+window[ensightenOptions.ns].timing;window[ensightenOptions.ns].imageRequest("//"+b+f)}}});
if (!window[ensightenOptions.ns].data) {
/*
MIT License (c) copyright 2011-2013 original author or authors MIT License (c) copyright 2013 original author or authors */
window.JSON&&"object"===typeof JSON||(window[ensightenOptions.ns].JSON={});
(function(){function e(a){return 10>a?"0"+a:a}function m(a){h.lastIndex=0;return h.test(a)?'"'+a.replace(h,function(a){var c=f[a];return"string"===typeof c?c:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+a+'"'}function l(f,e){var b,g,p,d,h=k,u,q=e[f];q&&"object"===typeof q&&"function"===typeof q.toJSON&&(q=q.toJSON(f));"function"===typeof c&&(q=c.call(e,f,q));switch(typeof q){case "string":return m(q);case "number":return isFinite(q)?String(q):"null";case "boolean":case "null":return String(q);
case "object":if(!q)return"null";k+=a;u=[];if("[object Array]"===Object.prototype.toString.apply(q)){d=q.length;for(b=0;b<d;b+=1)u[b]=l(b,q)||"null";p=0===u.length?"[]":k?"[\n"+k+u.join(",\n"+k)+"\n"+h+"]":"["+u.join(",")+"]";k=h;return p}if(c&&"object"===typeof c)for(d=c.length,b=0;b<d;b+=1)"string"===typeof c[b]&&(g=c[b],(p=l(g,q))&&u.push(m(g)+(k?": ":":")+p));else for(g in q)Object.prototype.hasOwnProperty.call(q,g)&&(p=l(g,q))&&u.push(m(g)+(k?": ":":")+p);p=0===u.length?"{}":k?"{\n"+k+u.join(",\n"+
k)+"\n"+h+"}":"{"+u.join(",")+"}";k=h;return p}}var b=window.JSON?window.JSON:window[ensightenOptions.ns].JSON;"function"!==typeof Date.prototype.toJSON&&(Date.prototype.toJSON=function(){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+e(this.getUTCMonth()+1)+"-"+e(this.getUTCDate())+"T"+e(this.getUTCHours())+":"+e(this.getUTCMinutes())+":"+e(this.getUTCSeconds())+"Z":null},String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(){return this.valueOf()});var d=
/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,h=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,k,a,f={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},c;"function"!==typeof b.stringify&&(b.stringify=function(b,f,e){var g;a=k="";if("number"===typeof e)for(g=0;g<e;g+=1)a+=" ";else"string"===typeof e&&(a=e);if((c=f)&&"function"!==typeof f&&
("object"!==typeof f||"number"!==typeof f.length))throw Error("JSON.stringify");return l("",{"":b})});"function"!==typeof b.parse&&(b.parse=function(a,c){function f(a,b){var e,g,d=a[b];if(d&&"object"===typeof d)for(e in d)Object.prototype.hasOwnProperty.call(d,e)&&(g=f(d,e),void 0!==g?d[e]=g:delete d[e]);return c.call(a,b,d)}var b;a=String(a);d.lastIndex=0;d.test(a)&&(a=a.replace(d,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)}));if(/^[\],:{}\s]*$/.test(a.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,
"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return b=eval("("+a+")"),"function"===typeof c?f({"":b},""):b;throw new SyntaxError("JSON.parse");})})();
window[ensightenOptions.ns].when=function(){function e(a,b,c,f){return l(a).then(b,c,f)}function m(a){this.then=a}function l(a){return b(function(b){b(a)})}function b(c){function e(a){n&&(t=d(a),f(n,t),n=v)}function g(a){e(k(a))}function p(b){n&&f(n,a(b))}var t,n=[];try{c(e,g,p)}catch(h){g(h)}return new m(function(a,c,f){return b(function(b,e,g){n?n.push(function(d){d.then(a,c,f).then(b,e,g)}):r(function(){t.then(a,c,f).then(b,e,g)})})})}function d(a){return a instanceof m?a:a!==Object(a)?h(a):b(function(b,
c,f){r(function(){try{var e=a.then;"function"===typeof e?B(e,a,b,c,f):b(h(a))}catch(g){c(g)}})})}function h(a){var b=new m(function(c){try{return"function"==typeof c?d(c(a)):b}catch(f){return k(f)}});return b}function k(a){var b=new m(function(c,f){try{return"function"==typeof f?d(f(a)):b}catch(e){return k(e)}});return b}function a(b){var c=new m(function(f,e,g){try{return"function"==typeof g?a(g(b)):c}catch(d){return a(d)}});return c}function f(a,b){r(function(){for(var c,f=0;c=a[f++];)c(b)})}function c(a,
c,f,g,d){p(2,arguments);return e(a,function(a){return b(function(b,f,g){function d(a){l(a)}function p(a){r(a)}var n,h,w,k,r,l,x,z;x=a.length>>>0;n=Math.max(0,Math.min(c,x));w=[];h=x-n+1;k=[];if(n)for(l=function(a){k.push(a);--h||(r=l=t,f(k))},r=function(a){w.push(a);--n||(r=l=t,b(w))},z=0;z<x;++z)z in a&&e(a[z],p,d,g);else b(w)}).then(f,g,d)})}function n(a,b,c,f){p(1,arguments);return w(a,x).then(b,c,f)}function w(a,c){return e(a,function(a){return b(function(b,f,g){var d,p,t,n,h;t=p=a.length>>>0;
d=[];if(t)for(n=function(a,p){e(a,c).then(function(a){d[p]=a;--t||b(d)},f,g)},h=0;h<p;h++)h in a?n(a[h],h):--t;else b(d)})})}function r(a){1===A.push(a)&&D(g)}function g(){for(var a,b=0;a=A[b++];)a();A=[]}function p(a,b){for(var c,f=b.length;f>a;)if(c=b[--f],null!=c&&"function"!=typeof c)throw Error("arg "+f+" must be a function");}function t(){}function x(a){return a}e.defer=function(){var a,c,f;a={promise:v,resolve:v,reject:v,notify:v,resolver:{resolve:v,reject:v,notify:v}};a.promise=c=b(function(b,
g,e){a.resolve=a.resolver.resolve=function(a){if(f)return l(a);f=!0;b(a);return c};a.reject=a.resolver.reject=function(a){if(f)return l(k(a));f=!0;g(a);return c};a.notify=a.resolver.notify=function(a){e(a);return a}});return a};e.resolve=l;e.reject=function(a){return e(a,k)};e.join=function(){return w(arguments,x)};e.all=n;e.map=w;e.reduce=function(a,b){var c=B(q,arguments,1);return e(a,function(a){var f;f=a.length;c[0]=function(a,c,g){return e(a,function(a){return e(c,function(c){return b(a,c,g,
f)})})};return u.apply(a,c)})};e.any=function(a,b,f,g){return c(a,1,function(a){return b?b(a[0]):a[0]},f,g)};e.some=c;e.isPromise=function(a){return a&&"function"===typeof a.then};m.prototype={otherwise:function(a){return this.then(v,a)},ensure:function(a){function b(){return l(a())}return this.then(b,b).yield(this)},yield:function(a){return this.then(function(){return a})},spread:function(a){return this.then(function(b){return n(b,function(b){return a.apply(v,b)})})},always:function(a,b){return this.then(a,
a,b)}};var u,q,B,D,A,E,y,C,v;A=[];E=setTimeout;D="function"===typeof setImmediate?"undefined"===typeof window?setImmediate:setImmediate.bind(window):"object"===typeof process&&process.nextTick?process.nextTick:function(a){E(a,0)};y=Function.prototype;C=y.call;B=y.bind?C.bind(C):function(a,b){return a.apply(b,q.call(arguments,2))};y=[];q=y.slice;u=y.reduce||function(a){var b,c,f,g;g=0;b=Object(this);f=b.length>>>0;c=arguments;if(1>=c.length)for(;;){if(g in b){c=b[g++];break}if(++g>=f)throw new TypeError;
}else c=c[1];for(;g<f;++g)g in b&&(c=a(c,b[g],g,b));return c};return e}();
(function(){function e(b,e){return l.all(e||[],function(e){return b.apply(null,e)})}function m(d){var h=b.call(arguments,1);return function(){return e(d,h.concat(b.call(arguments)))}}var l,b;l=window[ensightenOptions.ns].when;b=[].slice;l.apply=e;l.call=function(d){return e(d,b.call(arguments,1))};l.lift=m;l.bind=m;l.compose=function(d){var h=b.call(arguments,1);return function(){var k=b.call(arguments),k=e(d,k);return l.reduce(h,function(a,b){return b(a)},k)}}})();
window[ensightenOptions.ns].data=function(e,m){function l(a,b){this.name="DataDefinitionException";this.message=b||"Data definitions cannot be resolved as there are invalid id(s): "+a}var b={engines:{memory:{get:function(a){if(d.utils.isArray(a)){for(var f=[],c=0;c<a.length;c++)f.push(b.data[a[c]]);return e[ensightenOptions.ns].when.resolve(f)}f=b.dataDefinitions[a]||{storage:{get:function(){}}};f=f.storage.get(f);b.data[a]=f;return e[ensightenOptions.ns].when.resolve(b.data[a])},set:function(a,f){if(d.utils.isArray(a))for(var c in a)b.data[a[c]]=
f[c];else b.data[a]=f;return e[ensightenOptions.ns].when.resolve(!0)},remove:function(a){if(d.utils.isArray(a))for(var f in a)delete b.data[a[f]];else delete b.data[a];return e[ensightenOptions.ns].when.resolve(!0)},clear:function(a){b.data={};b.definitions={};return e[ensightenOptions.ns].when.resolve(!0)},all:function(){return e[ensightenOptions.ns].when.resolve(b.data)}}},normalizeInputArgs:function(a,b){var c={key:[],val:m},e;if(d.utils.isPlainObject(a))for(e in c.val=[],a)c.key.push(e),c.val.push(a[e]);
else d.utils.isArray(a),c.key=a,c.val=b;return c},definitions:{},data:{}},d={utils:{isPlainObject:function(a){return!!a&&"[object Object]"===Object.prototype.toString.call(a)},isArray:function(a){return"[object Array]"===Object.prototype.toString.call(a)},escapeRegEx:function(a){try{return a.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1")}catch(b){return a}}}},h=function(){return e[ensightenOptions.ns].when.reject("Not Implemented.")};l.prototype=Error();l.prototype||(l.prototype={});l.prototype.constructor=
l;b.DataDefinitionException=l;b.checkForInvalidDataDefinitions=function(a){d.utils.isArray(a)||(a=[a]);return a&&0<a.length&&(a=a.join(","),-1<a.indexOf("invalid_id"))?(e[ensightenOptions.ns].reportException(new b.DataDefinitionException(a)),!0):!1};b.collectAvailableDataDefinitions=function(a){for(var f=[],c=0;c<a.length;c++){var n=parseInt(a[c],10),h=e[ensightenOptions.ns].dataDefinitions[n];if(null===h||h===m)if(h=d.storage.session.get({id:n}),null!==h&&h!==m)d.set(n,h),b.dataDefinitions[n]={id:n,
load:"visitor",storage:d.storage.visitor,missingDDFromCache:!0},f.push(e[ensightenOptions.ns].data.get(""+n));else return e[ensightenOptions.ns].reportException(new b.DataDefinitionException(a,"Invalid data definition used: "+n)),{promises:[],isInvalid:!0};else f.push(e[ensightenOptions.ns].data.get(a[c]))}return{promises:f,isInvalid:!1}};b.getSync=function(a){function f(a){var b=a.extract||h,f=a.transform||k,g=!1,e=null,d=null;try{e=b()}catch(p){e=null,g=!0}try{d=f(e)}catch(r){d=null,g=!0}g&&c.push(a.id);
return d}var c=[],h=function(){return document},k=function(a){return null!==a&&a!==m?a.toString():null},r=parseInt(a);a="string"===typeof a?a.split("."):[];var g={},p="";isNaN(r)?3==a.length&&(g=d.getDataDefinitionBySourceCollectionName(a[0],a[1],a[2])):g=d.getDataDefinitionById(r);p=g.load&&g.load.match(/(session|visitor)/i)&&g.storage&&g.storage.get?g.storage.get(g):f(g);0<c.length&&e[ensightenOptions.ns].reportException(new b.DataDefinitionException(c,"Error resolving data definitions synchronously: "+
c));return p};b.dataDefinitions={};b.dataDefinitionsBySourceCollName={};d.defineEngine=function(a,f){var c,d=["get","set","remove","clear","all"];b.engines[a]=f;if(!f.returnsPromise)for(c=0;c<d.length;c++){var h=d[c];f[h]=e[ensightenOptions.ns].when.lift(f[h])}};d.storage={instance:{set:function(a,b){},get:function(a){return b.getSync(a.id)}},page:{set:function(a,b){},get:function(a){return b.data[a.id]}},session:{set:function(a,b){var c=d.storage.session.get({id:a}),h=new Date,k=h.getTime();h.setTime(k+
18E5);null!=c&&(b=c);e[ensightenOptions.ns].data.cookie.utils.set(a,b,{expires:h.toGMTString()});c={expires:h.getTime(),value:b};e[ensightenOptions.ns].data.local.utils.set(a,c)},get:function(a){var b=e[ensightenOptions.ns].data.cookie.utils.get(a.id),c=e.JSON&&e.JSON.stringify?e.JSON:e[ensightenOptions.ns].JSON,c=c||{},d,h=new Date,h=h.getTime();if(null===b){try{d=c.parse(e[ensightenOptions.ns].data.local.utils.get(a.id))}catch(k){d=null}null!=d&&(d.expires=+d.expires,h<=d.expires?b=d.value:""==
d.expires&&d.value!=m?b=d.value:e[ensightenOptions.ns].data.local.utils.remove(a.id))}return b}},visitor:{set:function(a,b){var c=d.storage.session.get({id:a});null!=c&&(b=c);e[ensightenOptions.ns].data.cookie.utils.set(a,b);e[ensightenOptions.ns].data.local.utils.set(a,{expires:"",value:b})},get:function(a){return d.storage.session.get(a)}}};d.getEngine=d.engine=function(a){return a?b.engines[a]||{get:h,set:h,remove:h,clear:h,all:h}:b.engines};d.all=function(a){return e[ensightenOptions.ns].data.engine(a||
"memory").all()};d.get=function(a,f,c){f=f||"memory";c=c||{};-1<a.indexOf(",")&&(a=a.split(","));a=b.normalizeInputArgs(a);return c.wait?b.getWait(a.key,e[ensightenOptions.ns].data.engine(f),c):b.data&&b.data.hasOwnProperty(a.key)?e[ensightenOptions.ns].data.engine(f).get(a.key):b.getWaitForKey(a.key,e[ensightenOptions.ns].data.engine(f),c)};b.getWait=function(a,b,c){var h=+new Date,k=e[ensightenOptions.ns].when.defer(),r=function(){var e=b.get(a);if(-1===c.wait)return e;e.then(function(a){c.setCheck(a)?
k.resolve(a):setTimeout(g,c.interval)},function(a){setTimeout(g,c.interval)})},g=function(){var a=+new Date-h;-1!==c.wait&&a<c.wait?r():k.reject("Timeout")};c.interval=c.interval||500;c.wait=c.wait||5E3;d.utils.isArray(a)?c.setCheck=c.setCheck||function(a){for(var b=!0,c=0;c<a.length;c++)b=b&&!!a[c];return b}:c.setCheck=c.setCheck||function(a){return!!a};r();return k.promise};b.getWaitForKey=function(a,f,c){var d=e[ensightenOptions.ns].when.defer(),h=function(){if(b.data&&b.data.hasOwnProperty(a)){var g=
f.get(a);if(-1===c.wait)return g;g.then(function(a){d.resolve(a)},function(a){d.reject(a)})}else setTimeout(k,c.interval)},k=function(){h()};c.interval=c.interval||100;c.wait=c.wait||1;h();return d.promise};d.set=function(a,f,c){var d=b.normalizeInputArgs(a,f);Array.prototype.slice.call(arguments);return e[ensightenOptions.ns].data.engine(c||"memory").set(d.key,d.val)};d.remove=function(a,b){return e[ensightenOptions.ns].data.engine(b||"memory").remove(a)};d.clear=function(a){return e[ensightenOptions.ns].data.engine(a||
"memory").clear()};d.define=function(a,f){f&&(a.name=f.id||f.name);if(!a.name)return e[ensightenOptions.ns].when.reject(Error("Invalid parameters: missing 'name'"));a.id=a.name;var c=a.load||"page";a.load=a.load||"javascript";a.load=-1<a.load.indexOf("javascript")?a.load:a.load+",javascript";a.trigger=a.trigger||function(){return e[ensightenOptions.ns].when.resolve()};a.priv=a.priv||!1;a.collection=a.collection||"Data Layer";a.persist=e[ensightenOptions.ns].data.engine("memory");a.storage=d.storage[c.toLowerCase()]||
d.storage.page;var h=a.extract||function(){return document},k=a.transform||function(a){return a},r=function(b,c){var d=[];d.push(a.persist.set(b,c));a.storage.set(a.id,c);"object"==typeof e[ensightenOptions.ns].data.dataExport&&e[ensightenOptions.ns].data.dataExport(b,c,a.collection);e[ensightenOptions.ns].when.all(d).then(function(a){g.resolve(a)},function(a){g.reject(a)})},g=e[ensightenOptions.ns].when.defer();a.trigger().then(function(){g.resolve(e[ensightenOptions.ns].when.reduce([h(),k,r],function(b,
c,g,e){if(1==g)return c(b);2==g&&c(a.name,b)}))},function(a){g.reject(a)});b.dataDefinitions[a.id]=a;b.dataDefinitionsBySourceCollName[""+a.source+"."+a.collection+"."+a.dataDefName]=a;return g.promise};d.checkConditions=function(a){var f,c={lt:function(a,c){var g=+a,d=+c;return isNaN(g)||isNaN(d)?(e[ensightenOptions.ns].reportException(new b.DataDefinitionException(null,"Value(s) cannot be converted to number: compareWith: "+a+", compareTo: "+c)),!1):g<d},gt:function(a,c){var g=+a,d=+c;return isNaN(g)||
isNaN(d)?(e[ensightenOptions.ns].reportException(new b.DataDefinitionException(null,"Value(s) cannot be converted to number: compareWith: "+a+", compareTo: "+c)),!1):g>d},eql:function(a,b){return a==b},exists:function(a,b){return null==a||a==m||""==a?!1:!0},re:function(a,b,c){b=new RegExp(b,c?"i":"");try{return a.match(b)}catch(d){return!1}},starts:function(a,b,g){b=d.utils.escapeRegEx(b);return c.re(a,"^"+b,g)},ends:function(a,b,g){b=d.utils.escapeRegEx(b);return c.re(a,b+"$",g)},contains:function(a,
b,g){b=d.utils.escapeRegEx(b);return c.re(a,".*"+b+".*",g)}};c.is=c.eql;c["starts with"]=c.starts;c["ends with"]=c.ends;c["is greater than"]=c.gt;c["is less than"]=c.lt;c.matches=c.re;for(f=0;f<a.values.length;f++){var h=(a.customComparator?a.customComparator[f]?a.customComparator[f]:c[a.comparators[f]]:c[a.comparators[f]])(a.values[f],a.compareTo[f],a.caseInsensitive?a.caseInsensitive[f]||!1:!1);a.not[f]&&(h=!h);if(!h)return!1}return!0};d.triggerPromise=function(a,b,c){c=c||5E3;var d=+new Date,h=
e[ensightenOptions.ns].when.defer();(function(){var e=a();e!=b?h.resolve(e):+new Date-d<c?setTimeout(arguments.callee,200):h.reject("timed out")})();return h.promise};d.timeoutPromise=function(a,b){var c=e[ensightenOptions.ns].when.defer();b=b||800;a.then(c.resolve,c.reject);setTimeout(function(){c.reject(Error("timed out"))},b);return c.promise};d.delayTrigger=function(a){a=a||10;var b=e[ensightenOptions.ns].when.defer();setTimeout(function(){b.resolve()},a);return b.promise};d.delayUntilTrigger=
function(a,b,c,d){c=c||null;d=d||200;var h=+new Date,k=e[ensightenOptions.ns].when.defer();(function(){var g=a();g!=b?k.resolve(g):c?+new Date-h<c?setTimeout(arguments.callee,d):k.reject("timed out"):setTimeout(arguments.callee,d)})();return k.promise};b.applyTrigger=function(a){var b=e[ensightenOptions.ns].when.defer();a(function(){b.resolve(!0)});return b.promise};d.bottomOfBodyTrigger=function(){return b.applyTrigger(e[ensightenOptions.ns].bindDOMParsed)};d.afterEnsightenCompleteTrigger=function(){return b.applyTrigger(e[ensightenOptions.ns].bindPageSpecificCompletion)};
d.afterElementsDownloadedTrigger=function(){return b.applyTrigger(e[ensightenOptions.ns].bindDOMLoaded)};d.getAllDataDefinitionsOnCurrentPage=function(){return b.dataDefinitions};d.getAllDataDefinitionsOnCurrentPage_S_C_N=function(){return b.dataDefinitionsBySourceCollName};d.getDataDefinitionById=function(a){return b.dataDefinitions[a||-1]||{}};d.getDataDefinitionBySourceCollectionName=function(a,d,c){return b.dataDefinitionsBySourceCollName[""+a+"."+d+"."+c]||{}};d.getDataDefinitionByPercentSyntax=
function(a){a=(""+a).split("_");return 1>a.length?{}:b.dataDefinitions[a[1]]||{}};d.resolve=function(a,f){var c=this,h=null;if(!b.checkForInvalidDataDefinitions(a))if(f)e[ensightenOptions.ns].bindDataDefinitionComplete(function(){var d=b.collectAvailableDataDefinitions(a);d.isInvalid||e[ensightenOptions.ns].when.all(d.promises).then(function(d){try{f.apply(c,d)}catch(g){e[ensightenOptions.ns].reportException(new b.DataDefinitionException(a,"Error resolving data definitions: "+a+". Details: "+g))}},
function(c){e[ensightenOptions.ns].reportException(new b.DataDefinitionException(a,"Error resolving data definitions: "+a+". Details: "+c))})});else{var h=[],k=a;d.utils.isArray(a)||(k=[a]);for(var l=0;l<k.length;l++)h.push(b.getSync(k[l]));return h=d.utils.isArray(a)?h:h[0]}};d.extract=function(a,b){var c="",d=function(a,b){var c=~b.indexOf("#")?b.split("#")[1]:"",d=c?0:~b.indexOf("[")?parseInt(b.match(/\[(\d+)\]/)[1]):0,e=(c?b.split("#")[0]:d?b.split("[")[0]:b).toLowerCase();if(a==document&&"html"==
e&&0==d)return document.getElementsByTagName("html")[0];if(~b.indexOf("#"))return document.getElementById(b.split("#")[1]);var g=a.firstChild;if(!g)return null;for(var f=0,d=0!=d?d-1:d;g;){if(1==g.nodeType){if(g.tagName.toLowerCase()==e&&""!=c&&g.id==c||g.tagName.toLowerCase()==e&&f==d&&""==c)return g;g.tagName.toLowerCase()==e&&f++}g=g.nextSibling}},h=function(a,b){a=a.split("/");for(var c=d(b||document,a[1]),g=2;g<a.length;g++){if(null==c)return null;c=d(c,a[g])}return c},k=function(){for(var a=
{},b=e.document.getElementsByTagName("META")||[],c=0,d=b.length;c<d;c++){var g=b[c].name||b[c].getAttribute("property")||"";0!==g.length&&(a[g]=b[c].content)}return a}(),g=function(a){var b=k[a];if(b)return b;for(var b=e.document.getElementsByTagName("META")||[],c=0,d=b.length;c<d;c++){var g=b[c].name||b[c].getAttribute("property")||"";if(a==g)return b[c].content}},p=function(a){return(val=(new RegExp("&"+a+"=([^&]*)")).exec(e.location.search.replace(/^\?/,"&")))?val[0].split("=")[1]:""},t=function(a){return(val=
(new RegExp("^"+a+"=.*|;\\s*"+a+"=.*")).exec(e.document.cookie))?val[0].split("=")[1].split(";")[0]:""},l=function(a){(a=m(a))&&a.nodeType&&1==a.nodeType&&(a=a.value||a.innerHTML||"");return a.toString().replace(/\n|\r|\s\s+/g,"")||""},m=function(a){var b="";if(0==a.indexOf("/HTML/BODY"))b=h(a);else try{b=eval(a)}catch(c){b=""}return b};try{return b?"meta"==b?c=g(a):"cookie"==b?c=t(a):"param"==b?c=p(a):"content"==b?c=l(a):"event"==b?c=m(a):"var"==b&&(c=e[a]):c=g(a)||t(a)||p(a)||l(a)||m(a)||e[a]||
"",c||""}catch(q){return""}};if("undefined"==typeof k)var k={exports:{}};return d}(window);
window[ensightenOptions.ns].data.defineEngine("store",function(){var e={},m=window,l=m.document,b,d,h=Array.isArray||function(a){return"[object Array]"===Object.prototype.toString.call(a)};e.set=function(a,b){};e.get=function(a){};e.remove=function(a){};e.clear=function(){};try{if("localStorage"in m&&m.localStorage)b=m.localStorage,e.set=function(a,c){var d,e,f=window.JSON&&window.JSON.stringify?window.JSON:window[ensightenOptions.ns].JSON;if(h(a))for(d=0,e=a.length;d<e;d++)b.setItem(a[d],"string"===
typeof c[d]?c[d]:f.stringify(c[d]));else b.setItem(a,"string"===typeof c?c:f.stringify(c))},e.get=function(a){if(h(a)){var c={},d,e;d=0;for(e=a.length;d<e;d++)c[a[d]]=b.getItem(a[d]);return c}return b.getItem(a)},e.remove=function(a){if(h(a)){var c,d;c=0;for(d=a.length;c<d;c++)b.removeItem(a[c])}else b.removeItem(a)},e.clear=function(){b.clear()},e.all=function(){return b};else if("globalStorage"in m&&m.globalStorage)b=m.globalStorage[m.location.hostname],e.set=function(a,c){if(h(a)){var d,e;d=0;
for(e=a.length;d<e;d++)b[a[d]]=c[d]}else b[a]=c},e.get=function(a){if(h(a)){var c={},d,e;d=0;for(e=a.length;d<e;d++)c[a[d]]=b[a[d]]&&b[a[d]].value;return c}return b[a]&&b[a].value},e.remove=function(a){if(h(a)){var c,d;c=0;for(d=a.length;c<d;c++)delete b[a[c]]}else delete b[a]},e.clear=function(){for(var a in b)delete b[a]},e.all=function(){return b};else if(l.documentElement.addBehavior){var k=function(a){return a.replace(n,"___")},m=function(c){return function(){var d=Array.prototype.slice.call(arguments,
0);d.unshift(b);a.appendChild(b);b.addBehavior("#default#userData");b.load("localStorage");d=c.apply(store,d);a.removeChild(b);return d}},a,f;try{f=new ActiveXObject("htmlfile"),f.open(),f.write('<script>document.w=window\x3c/script><iframe src="/favicon.ico"></frame>'),f.close(),a=f.w.frames[0].document,b=a.createElement("div")}catch(c){b=l.createElement("div"),a=l.body}var n=RegExp("[!\"#$%&'()*+,/\\\\:;<=>?@[\\]^`{|}~]","g");e.set=m(function(a,b,c){if(h(b)){var d,f;d=0;for(f=b.length;d<f;d++){fixedKey=
k(b[d]);if(void 0===c[d])return e.remove(fixedKey);a.setAttribute(fixedKey,c[d]);a.save("localStorage")}}else{fixedKey=k(b);if(void 0===c)return e.remove(fixedKey);a.setAttribute(fixedKey,c);a.save("localStorage")}});e.get=m(function(a,b){if(h(b)){var c={},d,e,f;e=0;for(f=b.length;e<f;e++)d=k(b[e]),c[b[e]]=a.getAttribute(d);return c}b=k(b);return a.getAttribute(b)});e.remove=m(function(a,b){if(h(b)){var c,d;c=0;for(d=b.length;c<d;c++)a.removeAttribute(k(b[c])),a.save("localStorage")}else b=k(b),a.removeAttribute(b),
a.save("localStorage")});e.clear=m(function(a){var b=a.XMLDocument.documentElement.attributes;a.load("localStorage");for(var c=0,d;d=b[c];c++)a.removeAttribute(d.name);a.save("localStorage")});e.all=m(function(a){for(var b=a.XMLDocument.documentElement.attributes,c={},d=0,e;e=b[d];++d){var f=k(e.name);c[e.name]=a.getAttribute(f)}return c})}}catch(w){}var r={};for(d in e)r[d]=e[d];r.testStorage=function(){try{var a="tk_"+Math.ceil(5E7*Math.random());r.set(a,"test");if("test"===r.get(a))return r.remove(a),
!0}catch(b){}return!1};e.utils=r;return window[ensightenOptions.ns].data.local=e}());
window[ensightenOptions.ns].data.defineEngine("cookie",function(e,m){var l=function(){return l.get.apply(l,arguments)},b=l.utils={isArray:Array.isArray||function(b){return"[object Array]"===Object.prototype.toString.call(b)},isPlainObject:window[ensightenOptions.ns].data.utils.isPlainObject,toArray:function(b){return Array.prototype.slice.call(b)},getKeys:Object.keys||function(b){var e=[],k="";for(k in b)b.hasOwnProperty(k)&&e.push(k);return e},escape:function(b){return String(b).replace(/[,;"\\=\s%]/g,
function(b){return encodeURIComponent(b)})},retrieve:function(b,e){return null==b?e:b},getAllCookies:function(){if(""===e.cookie)return{};for(var b=e.cookie.split("; "),h={},k=0,a=b.length;k<a;k++){var f=b[k].split("=");h[decodeURIComponent(f[0])]=decodeURIComponent(f[1])}return h},set:function(d,h,k){k=k||-1;if(b.isPlainObject(d))for(var a in d)d.hasOwnProperty(a)&&l.set(a,d[a],h);else if(b.isArray(d)){var f;a=0;for(f=d.length;a<f;a++)l.set(d[a],h[a],k)}else{a=k.expires!==m?k.expires:l.defaults.expires||
"";"number"===typeof a&&(a=new Date(a));a=b.isPlainObject(a)&&"toGMTString"in a?";expires="+a.toGMTString():b.isPlainObject(a)&&a instanceof Date?";expires="+a.toUTCString():";expires="+a;f=(f=k.path||l.defaults.path)?";path="+f:"";var c=k.domain||l.defaults.domain,c=c?";domain="+c:"";k=k.secure||l.defaults.secure?";secure":"";e.cookie=b.escape(d)+"="+b.escape(h)+a+f+c+k}},get:function(d,e){e=e||m;var k=b.getAllCookies();if(b.isArray(d)){for(var a={},f=0,c=d.length;f<c;f++)a[d[f]]=b.retrieve(k[d[f]],
e),a[d[f]]===m&&(a[d[f]]=null);return a}a=b.retrieve(k[d],e);return a===m?null:a},getGMTString:function(b){var e=new Date;e.setTime(e.getTime()+864E5*b);return e.toGMTString()}};l.defaults={path:"/",expires:b.getGMTString(90)};l.set=function(d,e){b.set(d,e)};l.remove=function(d){d=b.isArray(d)?d:b.toArray(arguments);for(var e=0,k=d.length;e<k;e++)b.set(d[e],"",{expires:-1})};l.clear=function(){return l.remove(b.getKeys(b.getAllCookies()))};l.get=function(d,e){return b.get(d,e)};l.all=function(){return b.getAllCookies()};
l.utils=b;return window[ensightenOptions.ns].data.cookie=l}(document));
}
Bootstrapper.dataDefinitionIds = [];Bootstrapper.bindImmediate(function(){var Bootstrapper=window["Bootstrapper"];var ensightenOptions=Bootstrapper.ensightenOptions;Bootstrapper.myLog=function(a){if(window.console)console.log(a)};Bootstrapper.Cookies=new function(){var hosts=[".nature.com",".scientificamerican.com"];for(var i=0;i<hosts.length;i++){var tempRegex=new RegExp(hosts[i]);if(document.location.host.match(tempRegex))this.defaultDomain=hosts[i]}this._cookies={};this.build=function(){for(var c=document.cookie.split("; "),a=0;a<
c.length;a++)this._cookies[c[a].slice(0,c[a].indexOf("\x3d"))]=c[a].slice(c[a].indexOf("\x3d")+1)};this.get=function(c,a,f){this.build();var g=this._cookies[c];if(arguments.length==1)return g;else for(var g=g.split(f||"\x26"),d=0,b=g.length;d<b;d++)if(g[d].indexOf(a+"\x3d")==0)return g[d].slice((a+"\x3d").length,g[d].length)};this.modCookie=function(c,a,f,g){document.cookie=c+"\x3d"+a+(f?";expires\x3d"+f:"")+";domain\x3d"+(g?g:this.defaultDomain)+";path\x3d/"};this.set=function(c,a,f,g){if(arguments.length==
4){for(var d="",b=0;b<a.length;b++)d+=(b!=0?f:"")+a[b].join("\x3d");this.modCookie(c,d,g)}else if(arguments.length==3)if(typeof a=="object")if(typeof f=="object"){d="";for(b=0;b<a.length;b++)d+=(b!=0?"\x26":"")+a[b].join("\x3d");this.modCookie(c,d,f)}else{d="";for(b=0;b<a.length;b++)d+=(b!=0?f:"")+a[b].join("\x3d");this.modCookie(c,d)}else this.modCookie(c,a,f);else if(typeof a=="object"){d="";for(b=0;b<a.length;b++)d+=(b!=0?"\x26":"")+a[b].join("\x3d");this.modCookie(c,d)}else this.modCookie(c,a)};
this.addValue=function(c,a,f,g){this.build();var d=this._cookies[c]||"";if(arguments.length==4){for(var b="",e=0;e<a.length;e++)b+=(d==""&&e==0?"":f)+a[e].join("\x3d");this.modCookie(c,d+b,g)}else if(arguments.length==3)if(typeof a=="object")if(typeof f=="object"){b="";for(e=0;e<a.length;e++)b+=(d==""&&e==0?"":"\x26")+a[e].join("\x3d");this.modCookie(c,d+b,f)}else{b="";for(e=0;e<a.length;e++)b+=(d==""&&e==0?"":f)+a[e].join("\x3d");this.modCookie(c,d+b)}else this.modCookie(c,d+a,f);else if(typeof a==
"object"){b="";for(e=0;e<a.length;e++)b+=(d==""&&e==0?"":"\x26")+a[e].join("\x3d");this.modCookie(c,d+b)}else this.modCookie(c,d+a)};this.remove=function(c,a){this.build();if(this._cookies[c]){var f=(new Date).toGMTString();this.modCookie(c,"",f,a)}};this.check=function(c,a){this.build();return arguments.length==2?this.get(c).match(a+"\x3d")?!0:!1:this._cookies[c]?!0:!1};this.build()};Bootstrapper.linkTracker=function(){var _private={links:{},pushTrack:function(name,fn){if(typeof name!="string")return false;
this.links[name]=this.links[name]||[];if(typeof fn=="function")this.links[name].push(fn);return true},callTrack:function(name){if(typeof name!="string")return false;var l=_private.links[name];if(typeof l=="object"&&l.length)for(var i=0;i<l.length;i++)l[i].call(this)},debug:function(name,ref){if(window.location.search.match(/debugger=true/)){console.log("::linkTracker - Name:"+name);console.log("::linkTracker - Scope:"+ref)}}},_public={addLink:function(name,fn){return _private.pushTrack(name,fn)},
addTracking:function(name,fn){return _private.pushTrack(name,fn)},getLink:function(name){return _private.links[name]},track:function(name,ref){var $this=ref||window;_private.debug(name,$this);return _private.callTrack.call($this,name)}};return _public}();Bootstrapper.ajaxListener=function(){var listeners={},listener=function(a,b){var detected=[],selector=a||function(){},attach=b||function(node){};return function(){if(typeof selector=="function"&&typeof attach=="function"){var n=selector();if(typeof n==
"object")if(typeof n.length!="undefined"){for(var i=n.length-1;i>=0;i--)for(var j=0;j<detected.length;j++)if(n[i]==detected[j])n.splice(i,1);for(var i=0;i<n.length;detected.push(n[i++]));for(var i=0;i<n.length;attach.call(n[i],n[i++]));}else{for(var i=0;i<detected.length;i++)if(n==detected[i])return;detected.push(n);attach.call(n,n)}}}},_public={create:function(x,y){do var a=parseInt(Math.random()*1E5)+"";while(listeners[a]);listeners[a]=listener(x,y)}};setInterval(function(){for(key in listeners)listeners[key]()},
500);return _public}();Bootstrapper.getElementsByClassName=function(){var root=document,className="",partial=false;for(var i=0;i<arguments.length;i++)if(typeof arguments[i]=="object")root=arguments[i];else if(typeof arguments[i]=="string")className=arguments[i];else partial=arguments[i];var elements=root.getElementsByTagName("*");var retElements=[],needle=partial?new RegExp(className):new RegExp("^"+className+"$");for(var i=0;i<elements.length;i++){var tempClass=(elements[i].className||"").split(" ");
for(var j=0;j<tempClass.length;j++)if(tempClass[j].match(needle))retElements.push(elements[i])}return retElements}},291853,136502);
Bootstrapper.bindImmediate(function(){var Bootstrapper=window["Bootstrapper"];var ensightenOptions=Bootstrapper.ensightenOptions;$(document).ready(function(){$("a").click(function(){var linkText=$(this).text();var linkHref=$(this).attr("href");if($(this).closest("ul").hasClass("nav")&&!$(this).closest("ul").hasClass("navPrimarySticky")||$(this).closest("ul").hasClass("dropdown-menu")&&!$(this).closest("ul").hasClass("dropdown-menuSticky")){var linkAction="NavBar";var linkSource=$(this).closest("li.dropdown").find("a.dropdown-toggle").text();
dcsMultiTrack("DCS.dcssip",window.location.hostname,"DCS.dcsuri",linkHref,"WT.action",linkAction,"WT.source",linkSource,"WT.destination","link:"+linkText,"WT.dl","1","WT.ndl","1")}if($(this).closest("ul").hasClass("navPrimarySticky")||$(this).closest("ul").hasClass("dropdown-menuSticky")){var linkAction="NavBar_Persistent";var linkSource=$(this).closest("li.dropdown").find("a.dropdown-toggle").text();dcsMultiTrack("DCS.dcssip",window.location.hostname,"DCS.dcsuri",linkHref,"WT.action",linkAction,
"WT.source",linkSource,"WT.destination","link:"+linkText,"WT.dl","1","WT.ndl","1")}if($(this).closest("ul").attr("id")=="flairBar"&&!$(this).closest("li").attr("id")=="commentsFlair"){var linkAction="NavBar_Breadcrumb";dcsMultiTrack("DCS.dcssip",window.location.hostname,"DCS.dcsuri",linkHref,"WT.action",linkAction,"WT.source",linkSource,"WT.destination","link:"+linkText,"WT.dl","1","WT.ndl","1")}if($(this).parent().parent().hasClass("breadcrumbs")){var linkAction="NavBar_Breadcrumb";dcsMultiTrack("DCS.dcssip",
window.location.hostname,"DCS.dcsuri",linkHref,"WT.action",linkAction,"WT.source",linkSource,"WT.destination","link:"+linkText,"WT.dl","1","WT.ndl","1")}if($(this).closest("div").hasClass("topic-podcasts")&&location.href.indexOf("topic")==-1){var linkAction="Category: Podcast article click";dcsMultiTrack("DCS.dcssip",window.location.hostname,"DCS.dcsuri",linkHref,"WT.action",linkAction,"WT.source",linkSource,"WT.destination","link:"+linkText,"WT.dl","1","WT.ndl","1")}if($(this).closest("div").hasClass("topic-editorsRecommend")&&
location.href.indexOf("topic")==-1){var linkAction="Category: Editor's Recommend article click";dcsMultiTrack("DCS.dcssip",window.location.hostname,"DCS.dcsuri",linkHref,"WT.action",linkAction,"WT.source",linkSource,"WT.destination","link:"+linkText,"WT.dl","1","WT.ndl","1")}if($(this).closest("div").hasClass("topic-blogs")&&location.href.indexOf("topic")==-1){var linkAction="Category: Blog title click";dcsMultiTrack("DCS.dcssip",window.location.hostname,"DCS.dcsuri",linkHref,"WT.action",linkAction,
"WT.source",linkSource,"WT.destination","link:"+linkText,"WT.dl","1","WT.ndl","1")}if($(this).closest("div").hasClass("topic-video")&&location.href.indexOf("topic")==-1){var linkAction="Category: Video article click";dcsMultiTrack("DCS.dcssip",window.location.hostname,"DCS.dcsuri",linkHref,"WT.action",linkAction,"WT.source",linkSource,"WT.destination","link:"+linkText,"WT.dl","1","WT.ndl","1")}if($(this).closest("div").hasClass("topic-citizenScience")&&location.href.indexOf("topic")==-1){var linkAction=
"Category: Citizen Science clicks";dcsMultiTrack("DCS.dcssip",window.location.hostname,"DCS.dcsuri",linkHref,"WT.action",linkAction,"WT.source",linkSource,"WT.destination","link:"+linkText,"WT.dl","1","WT.ndl","1")}if($(this).closest("div").hasClass("topic-podcasts")&&location.href.indexOf("/topic/")!=-1){var linkAction="SubCat: Podcast article click";dcsMultiTrack("DCS.dcssip",window.location.hostname,"DCS.dcsuri",linkHref,"WT.action",linkAction,"WT.source",linkSource,"WT.destination","link:"+linkText,
"WT.dl","1","WT.ndl","1")}if($(this).closest("div").hasClass("topic-editorsRecommend")&&location.href.indexOf("/topic/")!=-1){var linkAction="SubCat: Editor's Recommend article click";dcsMultiTrack("DCS.dcssip",window.location.hostname,"DCS.dcsuri",linkHref,"WT.action",linkAction,"WT.source",linkSource,"WT.destination","link:"+linkText,"WT.dl","1","WT.ndl","1")}if($(this).closest("div").hasClass("topic-blogs")&&location.href.indexOf("/topic/")!=-1){var linkAction="SubCat: Blog title click";dcsMultiTrack("DCS.dcssip",
window.location.hostname,"DCS.dcsuri",linkHref,"WT.action",linkAction,"WT.source",linkSource,"WT.destination","link:"+linkText,"WT.dl","1","WT.ndl","1")}if($(this).closest("div").hasClass("topic-video")&&location.href.indexOf("/topic/")!=-1){var linkAction="SubCat: Video article click";dcsMultiTrack("DCS.dcssip",window.location.hostname,"DCS.dcsuri",linkHref,"WT.action",linkAction,"WT.source",linkSource,"WT.destination","link:"+linkText,"WT.dl","1","WT.ndl","1")}if($(this).closest("div").hasClass("topic-citizenScience")&&
location.href.indexOf("/topic/")!=-1){var linkAction="SubCat: Citizen Science clicks";dcsMultiTrack("DCS.dcssip",window.location.hostname,"DCS.dcsuri",linkHref,"WT.action",linkAction,"WT.source",linkSource,"WT.destination","link:"+linkText,"WT.dl","1","WT.ndl","1")}if(!$(this).closest("article").hasClass("spanishLang")&&$(this).hasClass("agendaFeaturedImageMind")&&$(this).hasClass("agendaFeaturedImage")&&$(this).closest("div").hasClass("featuredImage")){var linkAction="MINDHome: Science Agenda clicks";
var linkSource="MINDHome Agenda: Headline 1 image";dcsMultiTrack("DCS.dcssip",window.location.hostname,"DCS.dcsuri",linkHref,"WT.action",linkAction,"WT.source",linkSource,"WT.destination","link:"+linkText,"WT.dl","1","WT.ndl","1")}if(!$(this).closest("article").hasClass("spanishLang")&&$(this).hasClass("agendaFeaturedTitleMind")&&$(this).hasClass("agendaFeaturedTitle")&&$(this).closest("div").hasClass("featuredImage")){var linkAction="MINDHome: Science Agenda clicks";var linkSource="MINDHome Agenda: Headline 1 List";
dcsMultiTrack("DCS.dcssip",window.location.hostname,"DCS.dcsuri",linkHref,"WT.action",linkAction,"WT.source",linkSource,"WT.destination","link:"+linkText,"WT.dl","1","WT.ndl","1")}if(!$(this).closest("article").hasClass("spanishLang")&&$(this).hasClass("agendaImage")&&$(this).hasClass("agendaImageMind")){var linkAction="MINDHome: Science Agenda clicks";var indexLi=$(this).parent("li").index();var indexLiPadding=indexLi+2;var linkSource="MINDHome: Agenda Headline "+indexLiPadding;dcsMultiTrack("DCS.dcssip",
window.location.hostname,"DCS.dcsuri",linkHref,"WT.action",linkAction,"WT.source",linkSource,"WT.destination","link:"+linkText,"WT.dl","1","WT.ndl","1")}if(!$(this).closest("article").hasClass("spanishLang")&&$(this).hasClass("agendaTitle")&&$(this).hasClass("agendaTitleMind")){var linkAction="MINDHome: Science Agenda clicks";var indexLi=$(this).parent().parent("li").index();var indexLiPadding=indexLi+2;var linkSource="MINDHome: Agenda Headline "+indexLiPadding;dcsMultiTrack("DCS.dcssip",window.location.hostname,
"DCS.dcsuri",linkHref,"WT.action",linkAction,"WT.source",linkSource,"WT.destination","link:"+linkText,"WT.dl","1","WT.ndl","1")}if($(this).closest("div").hasClass("mindHomePodcasts")){var linkAction="MINDHome: Podcast article click";dcsMultiTrack("DCS.dcssip",window.location.hostname,"DCS.dcsuri",linkHref,"WT.action",linkAction,"WT.source",linkSource,"WT.destination","link:"+linkText,"WT.dl","1","WT.ndl","1")}if($(this).closest("div").hasClass("mindHomeBlogs")){var linkAction="MINDHome: Blog title click";
dcsMultiTrack("DCS.dcssip",window.location.hostname,"DCS.dcsuri",linkHref,"WT.action",linkAction,"WT.source",linkSource,"WT.destination","link:"+linkText,"WT.dl","1","WT.ndl","1")}if(!$(this).closest("article").hasClass("spanishLang")&&$(this).hasClass("agendaFeaturedImage")&&!$(this).hasClass("agendaFeaturedImageMind")&&$(this).closest("div").hasClass("featuredImage")){var linkAction="Homepage: Science Agenda clicks";var linkSource="Science Agenda: Headline 1 image";dcsMultiTrack("DCS.dcssip",window.location.hostname,
"DCS.dcsuri",linkHref,"WT.action",linkAction,"WT.source",linkSource,"WT.destination","link:"+linkText,"WT.dl","1","WT.ndl","1")}if(!$(this).closest("article").hasClass("spanishLang")&&$(this).hasClass("agendaFeaturedTitle")&&!$(this).hasClass("agendaFeaturedTitleMind")&&$(this).closest("div").hasClass("featuredImage")){var linkAction="Homepage: Science Agenda clicks";var linkSource="Science Agenda: Headline 1 List";dcsMultiTrack("DCS.dcssip",window.location.hostname,"DCS.dcsuri",linkHref,"WT.action",
linkAction,"WT.source",linkSource,"WT.destination","link:"+linkText,"WT.dl","1","WT.ndl","1")}if(!$(this).closest("article").hasClass("spanishLang")&&$(this).hasClass("agendaImage")&&!$(this).hasClass("agendaImageMind")){var linkAction="Homepage: Science Agenda clicks";var indexLi=$(this).parent("li").index();var indexLiPadding=indexLi+2;var linkSource="Science Agenda: Headline "+indexLiPadding;dcsMultiTrack("DCS.dcssip",window.location.hostname,"DCS.dcsuri",linkHref,"WT.action",linkAction,"WT.source",
linkSource,"WT.destination","link:"+linkText,"WT.dl","1","WT.ndl","1")}if(!$(this).closest("article").hasClass("spanishLang")&&$(this).hasClass("agendaTitle")&&!$(this).hasClass("agendaTitleMind")){var linkAction="Homepage: Science Agenda clicks";var indexLi=$(this).parent().parent("li").index();var indexLiPadding=indexLi+2;var linkSource="Science Agenda: Headline "+indexLiPadding;dcsMultiTrack("DCS.dcssip",window.location.hostname,"DCS.dcsuri",linkHref,"WT.action",linkAction,"WT.source",linkSource,
"WT.destination","link:"+linkText,"WT.dl","1","WT.ndl","1")}if($(this).closest("ul").attr("id")=="latest"&&!$(this).closest("ul").hasClass("sideBarLatest")){var linkAction="Homepage: Latest Headlines article click";dcsMultiTrack("DCS.dcssip",window.location.hostname,"DCS.dcsuri",linkHref,"WT.action",linkAction,"WT.source",linkSource,"WT.destination","link:"+linkText,"WT.dl","1","WT.ndl","1")}if($(this).closest("ul").attr("id")=="mostRead"&&!$(this).closest("ul").hasClass("sideBarMostRead")){var linkAction=
"Homepage: Most Read article click";dcsMultiTrack("DCS.dcssip",window.location.hostname,"DCS.dcsuri",linkHref,"WT.action",linkAction,"WT.source",linkSource,"WT.destination","link:"+linkText,"WT.dl","1","WT.ndl","1")}if($(this).closest("section").hasClass("newOnSA")){var linkAction="Homepage: Edit Promo Click";dcsMultiTrack("DCS.dcssip",window.location.hostname,"DCS.dcsuri",linkHref,"WT.action",linkAction,"WT.source",linkSource,"WT.destination","link:"+linkText,"WT.dl","1","WT.ndl","1")}if($(this).closest("section").hasClass("homeEditorsPicks")){var linkAction=
"Homepage: Editor's Picks article/pic click";dcsMultiTrack("DCS.dcssip",window.location.hostname,"DCS.dcsuri",linkHref,"WT.action",linkAction,"WT.source",linkSource,"WT.destination","link:"+linkText,"WT.dl","1","WT.ndl","1")}if($(this).hasClass("homeBlogArticle")){var linkAction="Homepage: Blogs article click";dcsMultiTrack("DCS.dcssip",window.location.hostname,"DCS.dcsuri",linkHref,"WT.action",linkAction,"WT.source",linkSource,"WT.destination","link:"+linkText,"WT.dl","1","WT.ndl","1")}if($(this).closest("ul").hasClass("homepagePodcasts")){var linkAction=
"Homepage: Podcasts article click";dcsMultiTrack("DCS.dcssip",window.location.hostname,"DCS.dcsuri",linkHref,"WT.action",linkAction,"WT.source",linkSource,"WT.destination","link:"+linkText,"WT.dl","1","WT.ndl","1")}if($(this).closest("section").hasClass("homeCitizenScience")){var linkAction="Homepage: Citizen Science article click";dcsMultiTrack("DCS.dcssip",window.location.hostname,"DCS.dcsuri",linkHref,"WT.action",linkAction,"WT.source",linkSource,"WT.destination","link:"+linkText,"WT.dl","1",
"WT.ndl","1")}if($(this).closest("section").hasClass("homeEducation")){var linkAction="Homepage: Education article click";dcsMultiTrack("DCS.dcssip",window.location.hostname,"DCS.dcsuri",linkHref,"WT.action",linkAction,"WT.source",linkSource,"WT.destination","link:"+linkText,"WT.dl","1","WT.ndl","1")}if($(this).closest("ul").attr("id")=="videoList"&&$(this).closest("section").hasClass("homeLatestVideos")){var linkAction="Homepage: Video article click";dcsMultiTrack("DCS.dcssip",window.location.hostname,
"DCS.dcsuri",linkHref,"WT.action",linkAction,"WT.source",linkSource,"WT.destination","link:"+linkText,"WT.dl","1","WT.ndl","1")}if($(this).closest("div").hasClass("slideShowsWrap")||$(this).closest("div").hasClass("imageInfo")){var linkAction="Homepage: Multimedia Box article/pic click";dcsMultiTrack("DCS.dcssip",window.location.hostname,"DCS.dcsuri",linkHref,"WT.action",linkAction,"WT.source",linkSource,"WT.destination","link:"+linkText,"WT.dl","1","WT.ndl","1")}if($(this).closest("ul").attr("id")==
"chicletLinks"){var linkAction="RightNav: Follow Us Image Click";var linkText=$(this).attr("title");dcsMultiTrack("DCS.dcssip",window.location.hostname,"DCS.dcsuri",linkHref,"WT.action",linkAction,"WT.source",linkSource,"WT.destination","link:"+linkText,"WT.dl","1","WT.ndl","1")}if($(this).closest("li").hasClass("tweet")){var linkAction="RightNav: Twitter Feed Link/Pic Click";dcsMultiTrack("DCS.dcssip",window.location.hostname,"DCS.dcsuri",linkHref,"WT.action",linkAction,"WT.source",linkSource,"WT.destination",
"","WT.dl","1","WT.ndl","1")}if($(this).closest("ul").hasClass("rightNavMoreToExplore")){var linkAction="RightNav: More to Explore article click";dcsMultiTrack("DCS.dcssip",window.location.hostname,"DCS.dcsuri",linkHref,"WT.action",linkAction,"WT.source",linkSource,"WT.destination","link:"+linkText,"WT.dl","1","WT.ndl","1")}if($(this).closest("ul").hasClass("rightNavLatestBlogs")){var linkAction="RightNav: Latest Blogs article click";dcsMultiTrack("DCS.dcssip",window.location.hostname,"DCS.dcsuri",
linkHref,"WT.action",linkAction,"WT.source",linkSource,"WT.destination","link:"+linkText,"WT.dl","1","WT.ndl","1")}if($(this).closest("ul").hasClass("sideBarMostRead")){var linkAction="RightNav: Most Read article click";dcsMultiTrack("DCS.dcssip",window.location.hostname,"DCS.dcsuri",linkHref,"WT.action",linkAction,"WT.source",linkSource,"WT.destination","link:"+linkText,"WT.dl","1","WT.ndl","1")}if($(this).closest("ul").hasClass("sideBarLatest")){var linkAction="RightNav: Latest Headlines article click";
dcsMultiTrack("DCS.dcssip",window.location.hostname,"DCS.dcsuri",linkHref,"WT.action",linkAction,"WT.source",linkSource,"WT.destination","link:"+linkText,"WT.dl","1","WT.ndl","1")}if($(this).closest("ul").hasClass("sideBarNewsPartners")){var linkAction="RightNav: News from our Partners article click";dcsMultiTrack("DCS.dcssip",window.location.hostname,"DCS.dcsuri",linkHref,"WT.action",linkAction,"WT.source",linkSource,"WT.destination","link:"+linkText,"WT.dl","1","WT.ndl","1")}if($(this).closest("div").hasClass("natureJobs")){var linkAction=
"RightNav: Science Jobs of the Week article click";dcsMultiTrack("DCS.dcssip",window.location.hostname,"DCS.dcsuri",linkHref,"WT.action",linkAction,"WT.source",linkSource,"WT.destination","link:"+linkText,"WT.dl","1","WT.ndl","1")}if($(this).closest("li").hasClass("tweet")){var linkAction="RightNav: Twitter Feed Link/pic click";dcsMultiTrack("DCS.dcssip",window.location.hostname,"DCS.dcsuri",linkHref,"WT.action",linkAction,"WT.source",linkSource,"WT.destination","link:"+linkText,"WT.dl","1","WT.ndl",
"1")}if($(this).closest("div").hasClass("articleIDRPromo")){var linkAction="Article: Classics promo click";dcsMultiTrack("DCS.dcssip",window.location.hostname,"DCS.dcsuri",linkHref,"WT.action",linkAction,"WT.source",linkSource,"WT.destination","link:"+linkText,"WT.dl","1","WT.ndl","1")}if($(this).closest("div").hasClass("moreToExplore")){var linkAction="Article: Related article click";dcsMultiTrack("DCS.dcssip",window.location.hostname,"DCS.dcsuri",linkHref,"WT.action",linkAction,"WT.source",linkSource,
"WT.destination","link:"+linkText,"WT.dl","1","WT.ndl","1")}if($(this).closest("h3").hasClass("articleBooks")){var linkAction="Article: Books Promo click";dcsMultiTrack("DCS.dcssip",window.location.hostname,"DCS.dcsuri",linkHref,"WT.action",linkAction,"WT.source",linkSource,"WT.destination","link:"+linkText,"WT.dl","1","WT.ndl","1")}if($(this).closest("ul").hasClass("refineDate")){var linkAction="Search: Date Filter";dcsMultiTrack("DCS.dcssip",window.location.hostname,"DCS.dcsuri",linkHref,"WT.action",
linkAction,"WT.source",linkSource,"WT.destination","link:"+linkText,"WT.dl","1","WT.ndl","1")}if($(this).closest("ul").hasClass("refineSource")){var linkAction="Search: Source Filter";dcsMultiTrack("DCS.dcssip",window.location.hostname,"DCS.dcsuri",linkHref,"WT.action",linkAction,"WT.source",linkSource,"WT.destination","link:"+linkText,"WT.dl","1","WT.ndl","1")}if($(this).closest("ul").hasClass("refineAuthor")){var linkAction="Search: Author Filter";dcsMultiTrack("DCS.dcssip",window.location.hostname,
"DCS.dcsuri",linkHref,"WT.action",linkAction,"WT.source",linkSource,"WT.destination","link:"+linkText,"WT.dl","1","WT.ndl","1")}if($(this).closest("ul").hasClass("refineTopic")){var linkAction="Search: Topic Filter";dcsMultiTrack("DCS.dcssip",window.location.hostname,"DCS.dcsuri",linkHref,"WT.action",linkAction,"WT.source",linkSource,"WT.destination","link:"+linkText,"WT.dl","1","WT.ndl","1")}if($(this).closest("div").hasClass("pagination")&&$(this).closest("section").hasClass("search-footer")){var linkAction=
"Search: Page Number";dcsMultiTrack("DCS.dcssip",window.location.hostname,"DCS.dcsuri",linkHref,"WT.action",linkAction,"WT.source",linkSource,"WT.destination","link:"+linkText,"WT.dl","1","WT.ndl","1")}if($(this).closest("article").hasClass("spanishLang")&&$(this).closest("div").hasClass("featuredImage")&&$(this).hasClass("agendaFeaturedImage")){var linkAction="Espanol - Agenda: Science Agenda clicks";var linkSource="Espanol - Agenda: Headline 1 image";dcsMultiTrack("DCS.dcssip",window.location.hostname,
"DCS.dcsuri",linkHref,"WT.action",linkAction,"WT.source",linkSource,"WT.destination","link:"+linkText,"WT.dl","1","WT.ndl","1")}if($(this).closest("article").hasClass("spanishLang")&&$(this).closest("div").hasClass("featuredImage")&&$(this).hasClass("agendaFeaturedTitle")){var linkAction="Espanol - Agenda: Science Agenda clicks";var linkSource="Espanol - Agenda: Headline 1 title";dcsMultiTrack("DCS.dcssip",window.location.hostname,"DCS.dcsuri",linkHref,"WT.action",linkAction,"WT.source",linkSource,
"WT.destination","link:"+linkText,"WT.dl","1","WT.ndl","1")}if($(this).closest("article").hasClass("spanishLang")&&$(this).hasClass("agendaImage")&&$(this).closest("ul").hasClass("featuredThumbs")){var linkAction="Espanol - Agenda: Science Agenda clicks";var indexLi=$(this).parent().parent("li").index();var indexLiPadding=indexLi+2;var linkSource="Espanol - Agenda: Agenda Headline "+indexLiPadding+" image";dcsMultiTrack("DCS.dcssip",window.location.hostname,"DCS.dcsuri",linkHref,"WT.action",linkAction,
"WT.source",linkSource,"WT.destination","link:"+linkText,"WT.dl","1","WT.ndl","1")}if($(this).closest("article").hasClass("spanishLang")&&$(this).hasClass("agendaTitle")&&$(this).hasClass("agendaTitle")&&$(this).closest("ul").hasClass("featuredThumbs")){var linkAction="Espanol - Agenda: Science Agenda clicks";var indexLi=$(this).parent().parent("li").index();var indexLiPadding=indexLi+2;var linkSource="Espanol - Agenda: Agenda Headline "+indexLiPadding+" title";dcsMultiTrack("DCS.dcssip",window.location.hostname,
"DCS.dcsuri",linkHref,"WT.action",linkAction,"WT.source",linkSource,"WT.destination","link:"+linkText,"WT.dl","1","WT.ndl","1")}if($(this).closest("article").hasClass("spanishLang")&&$(this).hasClass("spanishPurchase")&&$(this).closest("div").hasClass("SA")){var linkAction="Espanol - Home: SA Issue Box";var linkSource="Espanol - Home: SA Issue Box headline";dcsMultiTrack("DCS.dcssip",window.location.hostname,"DCS.dcsuri",linkHref,"WT.action",linkAction,"WT.source",linkSource,"WT.destination","link:"+
linkText,"WT.dl","1","WT.ndl","1")}if($(this).closest("article").hasClass("spanishLang")&&$(this).hasClass("spanishPurchase")&&$(this).closest("div").hasClass("saMind")){var linkAction="Espanol - Home: MIND Issue Box";var linkSource="Espanol - Home: MIND Issue Box headline";dcsMultiTrack("DCS.dcssip",window.location.hostname,"DCS.dcsuri",linkHref,"WT.action",linkAction,"WT.source",linkSource,"WT.destination","link:"+linkText,"WT.dl","1","WT.ndl","1")}if($(this).closest("article").hasClass("spanishLang")&&
$(this).closest("div").hasClass("imgOfTheWeek")){var linkAction="Espanol - Home: Science Image";var linkSource="Espanol - Home: Science Image link";dcsMultiTrack("DCS.dcssip",window.location.hostname,"DCS.dcsuri",linkHref,"WT.action",linkAction,"WT.source",linkSource,"WT.destination","link:"+linkText,"WT.dl","1","WT.ndl","1")}if($(this).closest("article").hasClass("spanishLang")&&$(this).closest("div").hasClass("vidOfTheWeek")){var linkAction="Espanol - Home: Video";var linkSource="Espanol - Home: Video link";
dcsMultiTrack("DCS.dcssip",window.location.hostname,"DCS.dcsuri",linkHref,"WT.action",linkAction,"WT.source",linkSource,"WT.destination","link:"+linkText,"WT.dl","1","WT.ndl","1")}if($(this).closest("div").hasClass("spanishMagPromo")&&$(this).closest("div").hasClass("article-complementaryNode")&&$(this).hasClass("SA")){var linkAction="Espanol - Article: SA Issue Box";var linkSource="Espanol - Article: SA Issue Box link";dcsMultiTrack("DCS.dcssip",window.location.hostname,"DCS.dcsuri",linkHref,"WT.action",
linkAction,"WT.source",linkSource,"WT.destination","link:"+linkText,"WT.dl","1","WT.ndl","1")}if($(this).closest("div").hasClass("spanishMagPromo")&&$(this).closest("div").hasClass("article-complementaryNode")&&$(this).hasClass("saMind")){var linkAction="Espanol - Article: MIND Issue Box";var linkSource="Espanol - Article: MIND Issue Box link";dcsMultiTrack("DCS.dcssip",window.location.hostname,"DCS.dcsuri",linkHref,"WT.action",linkAction,"WT.source",linkSource,"WT.destination","link:"+linkText,"WT.dl",
"1","WT.ndl","1")}if($(this).hasClass("viewInAnotherLanguage")){var linkAction="Article: Read in Another Language";dcsMultiTrack("DCS.dcssip",window.location.hostname,"DCS.dcsuri",linkHref,"WT.action",linkAction,"WT.destination","link:"+linkText+" promo","WT.dl","1","WT.ndl","1")}});$("div.nextStoryFly").on("click","a#nextStoryLink",function(){var linkText=$(this).text();var linkHref=$(this).attr("href");var linkAction="Article: Next article click";dcsMultiTrack("DCS.dcssip",window.location.hostname,
"DCS.dcsuri",linkHref,"WT.action",linkAction,"WT.destination","link:"+linkText,"WT.dl","1","WT.ndl","1")});$("div#latestWrap ul").on("click","a",function(){var linkText=$(this).text();var linkHref=$(this).attr("href");var linkAction="NavBar_Story clicks";var indexLi=$(this).parent("li").index();var indexLiPadding=indexLi+1;var linkSource="NavBar_Story: Headline "+indexLiPadding+" List";dcsMultiTrack("DCS.dcssip",window.location.hostname,"DCS.dcsuri",linkHref,"WT.action",linkAction,"WT.source",linkSource,
"WT.destination","link:"+linkText,"WT.dl","1","WT.ndl","1")});$("div#latestWrap").on("click","a.floatLink",function(){var linkText=$(this).text();var linkHref=$(this).attr("href");var linkAction="NavBar_StoryBreadcrumb";dcsMultiTrack("DCS.dcssip",window.location.hostname,"DCS.dcsuri",linkHref,"WT.action",linkAction,"WT.destination","link:"+linkText,"WT.dl","1","WT.ndl","1")});$("footer#site-footer .subOffer .subscriptionForm form").submit(function(){var actionLink=$(this).attr("action");dcsMultiTrack("DCS.dcssip",
window.location.hostname,"DCS.dcsuri",actionLink,"WT.action","Footer: Risk-Free Issue Form button click","WT.source","","WT.destination","link: Continue","WT.dl","1","WT.ndl","1")})})},781822,221817);Bootstrapper.getServerComponent(Bootstrapper.getExtraParams ? Bootstrapper.getExtraParams() : undefined);}})();