var SDPA={init:function(){if(window.addEventListener){window.addEventListener("load",SDPA.loadEvents,false);window.addEventListener("unload",SDPA.unloadEvents,false);window.addEventListener("beforeunload",SDPA.beforeUnloadEvents,false)}else{window.attachEvent("onload",SDPA.loadEvents);window.attachEvent("onunload",SDPA.unloadEvents);window.attachEvent("onbeforeunload",SDPA.beforeUnloadEvents)}},loadEvents:function(){SDPA.sendIndex();SDPA.sendPage();SDPA.sendResources(1E3)},unloadEvents:function(){SDPA.sendResources(0)},
beforeUnloadEvents:function(){SDPA.pcrSend()},hashCode:function(stringToEncode){var encodedString=0;if(stringToEncode.length===0)return encodedString;for(var i=0;i<stringToEncode.length;i++){var letr=stringToEncode.charCodeAt(i);encodedString=(encodedString<<5)-encodedString+letr;encodedString=encodedString&encodedString}return encodedString},pcrSend:function(){if(Object.keys)if(prs&&(Object.keys(prs).length>1&&Object.keys(prs).length<17)){if(SDM.cpc)prs.cpc=SDM.cpc;else prs.cpc="SD";prs.pagetype=
SDM.pageType;prs.sdsh=SDPA.hashCode(SDM.si.sds);prs.tidh=SDPA.hashCode(SDM.tid);if("performance"in window){var wpt=window.performance.timing;prs.navigationStart=wpt.navigationStart}else prs.navigationStart=-1;var queryStr="";var prsLen=Object.keys(prs).length;for(var i=1;i<prsLen;i++){var tOfV=typeof prs[Object.keys(prs)[i]];if(tOfV=="string"||tOfV=="number"){if(queryStr!=="")queryStr+="&";queryStr+=Object.keys(prs)[i]+"="+prs[Object.keys(prs)[i]]}}}},retryFrag:0,sendIndex:function(){var sds=SDM.si.sds,
tid=SDM.tid,sdsh=SDPA.hashCode(sds),tidh=SDPA.hashCode(tid),idxBase="",absf="",maxf="";if("Fragment"in window)if(Fragment.mapsComplete){absf="&absf="+(Fragment.foldCheckJumper()+1);maxf="&maxf="+Fragment.fragmentMap.length}else if(this.retryFrag<4){this.retryFrag++;setTimeout(function(){SDPA.sendIndex()},1E3);return}if(SDM.cpc)idxBase+="cpc="+SDM.cpc;else idxBase+="cpc=SD";idxBase+="&pagetype="+SDM.pageType;idxBase+="&sds="+sds;idxBase+="&tid="+tid;idxBase+="&sdsh="+sdsh;idxBase+="&tidh="+tidh;if("pageTransKey"in
SDM)idxBase+="&key="+encodeURIComponent(SDM.pageTransKey);if(SDM.tm in SDM){if("ahm"in SDM.tm)idxBase+="&ahm="+SDM.tm.ahm;if("chm"in SDM.tm)idxBase+="&chm="+SDM.tm.chm}if(document.documentElement.clientWidth&&document.documentElement.clientHeight){idxBase+="&winHeight="+document.documentElement.clientHeight;idxBase+="&winWidth="+document.documentElement.clientWidth}idxBase+="&domCount="+document.getElementsByTagName("*").length;if("optimizely"in window)if("data"in window.optimizely&&"state"in window.optimizely.data){var n=
window.optimizely.data.state.activeExperiments;var r=n.length;var i="&oexp=";for(var s=0;s<r;s++)if(s+1<r)i+=n[s]+"|";else i+=n[s];idxBase+=i}if("ud"in SDM)idxBase+="&ud="+SDM.ud;if(SDM.pf&&(SDM.pf.oa&&SDM.pf.oa.item))idxBase+="&oa=1";else idxBase+="&oa=-1";if(typeof AdobeDetect!="undefined"){var av=AdobeDetect.getVersion();if(!av)av="unk";idxBase+="&av="+av}},sendPage:function(){if("performance"in window)if("timing"in window.performance){var navigationTiming=window.performance.timing;var pageBase=
"";if(SDM.cpc)pageBase+="cpc="+SDM.cpc;else pageBase+="cpc=SD";pageBase+="&pagetype="+SDM.pageType;pageBase+="&sdsh="+SDPA.hashCode(SDM.si.sds);pageBase+="&tidh="+SDPA.hashCode(SDM.tid);if(document.location.href)pageBase+="&href="+encodeURIComponent(document.location.href);if(navigationTiming.loadEventEnd>0){for(var timer in navigationTiming)if(typeof navigationTiming[timer]=="number")pageBase+="&"+timer+"="+navigationTiming[timer];if(typeof chrome!="undefined")if("loadTimes"in chrome)pageBase+="&msFirstPaint="+
Math.round(chrome.loadTimes().firstPaintTime*1E3)}else setTimeout(SDPA.sendPage,100)}},buildResources:function(firstResource,lastResource,sdsh,tidh){var wp=window.performance;var wpt=wp.timing;var iframes=document.getElementsByTagName("iframe");var navStart=wpt.navigationStart;var resTimer=wp.getEntriesByType("resource");var resTimerArray=[];if(SDM.cpc)resTimerArray.cpc=SDM.cpc;else resTimerArray.cpc="SD";resTimerArray.push({sdsh:sdsh,tidh:tidh,ns:navStart});for(var c=firstResource;c<lastResource;c++){var urlObject=
resTimer[c].name.match(/^https?\:\/\/([^\/\s]+)((\/\w+)*\/)([\w\-\.]+[^#?\s]+)(.*)?(#[\w\-]+)?$/i);var resourcePath="";var fragID="";var resourceDomain="";if(urlObject===null)resourceDomain="";else{var v=urlObject[2].split("/");if(v.length>=4)resourcePath=v[1]+"/"+v[2]+"/"+v[3];else if(v.length==3)resourcePath=v[1]+"/"+v[2];else if(v.length==2)resourcePath=v[1];resourceDomain=urlObject[1];fragID="";if(urlObject[0].indexOf("science/frag")>-1)if(urlObject[4].split("_")[1]!==undefined)fragID=urlObject[4].split("_")[1];
else if(urlObject[4]=="maps")fragID=0;else if(urlObject[4]=="all")fragID=32767}resTimerArray.push({i:c,tm:Math.round(resTimer[c].startTime)+"|"+Math.round(resTimer[c].responseStart)+"|"+Math.round(resTimer[c].duration),t:resTimer[c].initiatorType,h:resourceDomain,p:resourcePath,f:fragID});if(resTimer[c].initiatorType==="iframe")if(iframes[SDPA.u]!==undefined){var iURLObject=iframes[SDPA.u].src.match(/^https?\:\/\/([^\/?#]+)(?:[\/?#]|$)/i);if(iURLObject&&iURLObject[1].indexOf("www.sciencedirect.com")!=
-1){iframeResources=iframes[SDPA.u].contentWindow.window.performance.getEntriesByType("resource");for(ic=0;ic<iframeResources.length;ic++){var ifrResourceURL=iframeResources[ic].name.match(/^https?\:\/\/([^\/\s]+)((\/\w+)*\/)([\w\-\.]+[^#?\s]+)(.*)?(#[\w\-]+)?$/i);var ifrResoucePath="";if(ifrResourceURL===null)ifrResoucePath="";else if(ifrResourceURL.length>2){var b=ifrResourceURL[2].split("/");if(b.length>=4)ifrResoucePath=b[1]+"/"+b[2]+"/"+b[3];else if(b.length==3)ifrResoucePath=b[1]+"/"+b[2];else if(b.length==
2)ifrResoucePath=b[1]}resTimerArray.push({i:c,ifr:ic,tm:Math.round(iframeResources[ic].startTime)+"|"+Math.round(iframeResources[ic].responseStart)+"|"+Math.round(iframeResources[ic].duration),t:iframeResources[ic].initiatorType,h:ifrResourceURL[1],p:ifrResoucePath})}SDPA.u++}else SDPA.u++}}var w=encodeURI(JSON.stringify(resTimerArray));SDPA.sc=lastResource;SDPA.loopc=0},ec:[0],sc:0,loopc:0,u:0,sendResources:function(timeOutValue){var t=0;if(typeof timeOutValue!="undefined"&&timeOutValue>0)t=timeOutValue;
var sdsh=SDPA.hashCode(SDM.si.sds);var tidh=SDPA.hashCode(SDM.tid);if("performance"in window){var r=window.performance;if("getEntriesByType"in r){var currentTotalResources=r.getEntriesByType("resource").length;SDPA.ec.push(currentTotalResources);ecl=SDPA.ec.length-1;ecC=0;lastCapturedResource=0;if(ecl>1){var lastCapturedResource=SDPA.ec[ecl-1];ecC=currentTotalResources-lastCapturedResource}else if(currentTotalResources>0)ecC=currentTotalResources;if(ecC>15||t===0)if(ecC>15)for(var currentResource=
lastCapturedResource;currentTotalResources-currentResource>0;currentResource=currentResource+15)if(currentTotalResources-currentResource>15)SDPA.buildResources(currentResource,currentResource+15,sdsh,tidh);else SDPA.buildResources(currentResource,currentTotalResources,sdsh,tidh);else SDPA.buildResources(lastCapturedResource,currentTotalResources,sdsh,tidh);else{SDPA.loopc+=1;if(SDPA.loopc<8){SDPA.sc=1;setTimeout(function(){SDPA.sendResources(t)},t)}}}}},trackItem:function(value){var image=new Image;
image.width=0;image.height=0;image.style.display="none";image.src=value;document.body.appendChild(image)},allFrags:function(){return true}};SDPA.init();
