Mercurial > repos > jankanis > blast2html
view NCBI Blast reference example_files/InstrumentPageStarterJS.js @ 76:7d0d46168fd5 py2.6
Format all numbers in a predictable way
author | Jan Kanis <jan.code@jankanis.nl> |
---|---|
date | Thu, 19 Jun 2014 14:07:00 +0200 |
parents | 344cd76f6fd2 |
children |
line wrap: on
line source
(function(){if(typeof ncbi==="undefined")ncbi={};if(ncbi.sg)typeof console!=="undefined"&&console.error&&console.error("The logging JavaScript was added twice in the document. Please include it one time.");else{ncbi.sg=function(){};ncbi.sg.getInstance=function(){if(!ncbi.sg._instance)ncbi.sg._instance=new ncbi.sg;return ncbi.sg._instance};ncbi.sg._instance=null;ncbi.sg._version="26";(function(){var a=navigator.cookieEnabled?true:false;if(typeof navigator.cookieEnabled==="undefined"&&!a){document.cookie= "testcookie";a=document.cookie.indexOf("testcookie")!==-1?true:false}ncbi.sg.isCookieEnabled=a})();ncbi.sg.appLogIgnore=["ncbi_sessionid","ncbi_clickdisabled"];ncbi.sg.prototype={init:function(){this.isProcessRunning=true;this._setUpMetaTagValues();this._setScrollingEnabled();if(this._cachedVals.ncbi_db&&this._cachedVals.ncbi_db.value.toLowerCase()=="pubmed"&&this._cachedVals.ncbi_report&&this._cachedVals.ncbi_report.value.toLowerCase()=="abstract"&&this._cachedVals.ncbi_resultcount&&this._cachedVals.ncbi_resultcount.value.toLowerCase()== "1"||this._cachedVals.ncbi_db&&this._cachedVals.ncbi_db.value.toLowerCase()=="pmc"&&this._cachedVals.ncbi_report&&this._cachedVals.ncbi_report.value.toLowerCase()=="record"&&this._cachedVals.ncbi_type&&this._cachedVals.ncbi_type.value.toLowerCase()=="fulltext")ncbi.sg.isHoverEnabled=true;this._setUpPathParts();this._setUpCustomProps();this._addOnScrollListeners();this._send("init");this._scheduleDOMReadyPing();this._sendPrev();this._addPrintPing();this._setBeforeScrollDetails()},_vals:{},_cachedVals:{}, _hasInitRun:false,_readyPinged:false,_pathParts:{part1:"",part2:"",part3:"",part4:""},_scheduleDOMReadyPing:function(){var a=this,b=function(){return typeof jQuery!=="undefined"&&typeof jQuery.ui!=="undefined"&&typeof jQuery.ui.jig!=="undefined"?typeof jQuery.ui.jig.version!=="undefined"&&jQuery.ui.jig.version?jQuery.ui.jig.version:"unknown":"unknown"},d=function(){var k={},j=jQuery.ui.jig._foundWidgets;for(var t in j)k["jigWidget_"+t]=j[t];k.jigVersion=b();return k},c=function(){if(!a._readyPinged){var k= {};if(typeof jQuery!=="undefined"&&typeof jQuery.ui!=="undefined"&&typeof jQuery.ui.jig!=="undefined"&&typeof jQuery.ui.jig.scanned!=="undefined")if(jQuery.ui.jig.scanned){k=d();k.jsevent="domready";ncbi.sg._ping(k);a._readyPinged=true}else{if(typeof jQuery.ui.jig.scan!=="undefined"&&jQuery.ui.jig.scan){var j=jQuery.ui.jig.scan;jQuery.ui.jig.scan=function(){var t=j.apply(this,arguments);c();return t}}}else{k.jigVersion="nojig";k.jsevent="domready";ncbi.sg._ping(k);a._readyPinged=true}}};if(document.addEventListener){var e= function(){document.removeEventListener("DOMContentLoaded",e,false);c()};document.addEventListener("DOMContentLoaded",e)}else if(document.attachEvent){var g=function(){if(document.readyState==="complete"){document.detachEvent("onreadystatechange",g);c()}};document.attachEvent("onreadystatechange",g)}},_setScrollingEnabled:function(){try{ncbi.sg.isScrollingEnabled=false;var a=ncbi.sgAppsWithScrolling;if(typeof a!=="undefined")for(var b=0;b<a.length;b++){var d=true,c=a[b];for(var e in c)if(!this._cachedVals[e]|| this._cachedVals[e].value.toLowerCase()!=c[e]){d=false;break}if(d){ncbi.sg.isScrollingEnabled=true;break}}}catch(g){ncbi.sg.getInstance().noteEventData("jserror",{jserror:g.toString(),SELF_URL:window.location.href},["ncbi_sessionid","ncbi_phid"])}},_setUpMetaTagValues:function(){for(var a=document.getElementsByTagName("meta"),b=0;b<a.length;b++){var d=a[b].name;d.indexOf("ncbi_")===0&&this.addEntry(d,a[b].content)}},_setUpCachedMetaTagValues:function(a){for(var b=0;b<a.length;b++){var d=this._cachedVals[a[b]]; d&&this.addEntry(a[b],d.value)}},cachedNames:["ncbi_app","ncbi_db","ncbi_pcid","ncbi_pdid","ncbi_phid","ncbi_sessionid","ncbi_uidlist"],ignoreLengthRestrictions:["jserror","jserrorlocation"],addEntry:function(a,b){if(!(b===undefined||b.length===0)){if(b.length>100&&this.ignoreLengthRestrictions.indexOf(a)===-1)b=b.substr(0,100);this._cachedVals[a]={sProp:a,value:b}}},getVal:function(a){return typeof this._cachedVals[a]!=="undefined"&&this._cachedVals[a]&&typeof this._cachedVals[a].value!=="undefined"? this._cachedVals[a].value:null},removeAllEntries:function(){for(var a={},b=this.cachedNames.length,d=0;d<b;d++){var c=this.cachedNames[d],e=this._cachedVals[c];if(e)a[c]=e}this._cachedVals=a;for(var g in this._pathParts)this._pathParts[g]=""},_setUpCustomProps:function(){var a=this._pathParts.part1,b=this._pathParts.part2.length>0?":"+this._pathParts.part2:"",d=this._pathParts.part3.length>0?":"+this._pathParts.part3:"",c=this._pathParts.part4.length>0?":"+this._pathParts.part4:"";a={pagename:a+b+ d,server:window.location.hostname,sitesect2:a+b,subsect3:a+b+d,subsect4:a+b+d+c,heir1:(a+b+d+c).replace(/:/g,"|")};for(var e in a)this.addEntry(e,a[e]);this._sessionIdCheck();this._staticPageCheck();this._prevHitCheck();this._browserConfigurationSettings();this._hashCheck()},_staticPageCheck:function(){this._cachedVals.ncbi_app&&this._cachedVals.ncbi_app.value.length>0||this.addEntry("ncbi_app","static");this._cachedVals.ncbi_pdid&&this._cachedVals.ncbi_pdid.value.length>0||this.addEntry("ncbi_pdid", (document.title||"unknown").replace(/\s+/g,""))},_sessionIdCheck:function(){if(!(this._cachedVals.ncbi_sessionid&&this._cachedVals.ncbi_sessionid.value.length>0)){var a="";if(a.length===0){var b=this.getCookie("WebCubbyUser")||this.getCookie("WebEnv");if(b.length>0){b=unescape(b).split("@");if(b.length>1)a=b[b.length-1]}}if(a.length===0)a="NOSESSIONID";this.addEntry("ncbi_sessionid",a)}},getBrowserWidthHeight:function(){var a=this.getViewportWidth(),b=this.getViewportHeight();return{width:a,height:b}}, _browserConfigurationSettings:function(){var a=this.getBrowserWidthHeight();this.addEntry("browserwidth",a.width);this.addEntry("browserheight",a.height);this.addEntry("screenwidth",screen.width);this.addEntry("screenheight",screen.height);this.addEntry("screenavailwidth",screen.availWidth);this.addEntry("screenavailheight",screen.availHeight);if(document&&document.body){var b=document.body.scrollWidth,d=document.body.scrollHeight,c=d>a.height?"true":"false";this.addEntry("canscroll_x",b>a.width? "true":"false");this.addEntry("canscroll_y",c);this.addEntry("scrollwidth",b);this.addEntry("scrollheight",d)}if(screen.colorDepth)this.addEntry("colorDepth",screen.colorDepth);else screen.pixelDepth&&this.addEntry("colorDepth",screen.pixelDepth)},_hashCheck:function(){var a=window.location.hash;if(a){a=a.replace("#","");this.addEntry("urlhash",a)}(a=window.location.search.match(/[?&]campaign=([^&]*)/))&&this.addEntry("campaign",a[1])},_createPHID:function(){var a=this._cachedVals.ncbi_sessionid.value, b=a.substr(0,15)+"9"+(new Date).getTime().toString(),d=a.length;b+=a.substr(d-(32-b.length),d);a={value:b};this.addEntry("ncbi_phid",b);return a},currentPageHitId:null,_prevHitCheck:function(){var a=this.getCookie("ncbi_prevPHID"),b=this._cachedVals.ncbi_phid;a.length>0&&this.addEntry("prev_phid",a);if(!b||!b.value||b.value.length===0)b=this._createPHID();this.currentPageHitId=b.value;var d=this;ncbi.sg._hasFocus&&d.setCookie("ncbi_prevPHID",b.value);var c=window.onfocus;window.onfocus=function(e){d.getCookie("ncbi_prevPHID")!== b.value&&d.setCookie("ncbi_prevPHID",b.value);typeof c==="function"&&c(e)}},_setUpPathParts:function(){var a=this._cachedVals.ncbi_app,b=this._cachedVals.ncbi_db,d=this._cachedVals.ncbi_pdid,c=this._cachedVals.ncbi_pcid;this._pathParts.part1=a!==undefined?a.value:"";this._pathParts.part2=b!==undefined?b.value:"";this._pathParts.part3=d!==undefined?d.value:"";this._pathParts.part4=c!==undefined?c.value:""},getPerfStats:function(){var a=window.performance;if(!a)return{};var b=a.timing;if(b)b={dns:b.domainLookupEnd- b.domainLookupStart,connect:b.connectEnd-b.connectStart,ttfb:b.responseStart-b.connectEnd,basePage:b.responseEnd-b.responseStart,frontEnd:b.loadEventStart-b.responseEnd};else return{};if(a=a.navigation){b.navType=a.type;b.redirectCount=a.redirectCount}return b},setPerfStats:function(a,b){var d=this.getPerfStats();for(var c in d){var e=d[c];if(e>=0){var g="jsperf_"+c;if(b)a[g]=e;else a.push(g+"="+e)}}},getExtraRenderStats:function(){var a={SELF_URL:encodeURIComponent(window.location.href)};if(typeof document!== "undefined"&&typeof document.referrer!=="undefined")a.HTTP_REFERER=encodeURIComponent(document.referrer);return a},setExtraRenderStats:function(a){var b=this.getExtraRenderStats();for(var d in b)a.push(d+"="+b[d])},_send:function(a,b,d){if(typeof d==="undefined"||d===null)d=true;var c=[];if(a==="init"){c.push("jsevent=render");ncbi.sg.renderTime=new Date;if(typeof ncbi_startTime!=="undefined"){c.push("jsrendertime="+(ncbi.sg.renderTime-ncbi_startTime));ncbi.sg.loadTime&&c.push("jsloadtime="+(ncbi.sg.loadTime- ncbi_startTime))}this.setPerfStats(c);this.setExtraRenderStats(c);c.push("cookieenabled="+(ncbi.sg.isCookieEnabled?"true":"false"))}for(var e in this._cachedVals)ncbi.sg.appLogIgnore.indexOf(e)===-1&&c.push(e+"="+encodeURIComponent(this._cachedVals[e].value));this._sendAl(c.join("&"),b,true,d);this._hasInitRun=true;var g=this;setTimeout(function(){g.isProcessRunning=false;g.runSGProcess()},300)},send:function(a,b){this._send(a,b,false)},_sendPrev:function(){var a=ncbi.sg.getInstance(),b=a.getCookie("clicknext"); if(b){ncbi.sg._ping(b);a.setCookie("clicknext","")}if(b=a.getCookie("prevsearch")){ncbi.sg._ping(b);a.setCookie("prevsearch","")}if(b=a.getCookie("unloadnext")){ncbi.sg._ping(b);a.setCookie("unloadnext","")}},_sendAl:function(a,b,d,c){if(typeof c==="undefined"||c===null)c=true;if(a.indexOf("jseventms")===-1)a+="&jseventms="+ncbi.sg.getInstance().getMillisecondsSinceSunday();a.match(/jsevent=search/i)&&this._storeNext("prevsearch",a.replace(/jsevent=search(next)?/i,"jsevent=searchnext"),null,c);a+= "&sgVersion="+ncbi.sg._version;if(a.indexOf("sgSource")===-1)a=this._setSgSource(a,c);c=window.location.port?":"+window.location.port:"";reqURL=typeof __ncbi_stat_url!=="undefined"?__ncbi_stat_url+"?"+a:window.location.protocol+"//"+window.location.hostname+c+"/stat?"+a;this.makeAjaxCall(reqURL,function(){typeof b==="function"&&b()},d)},sendAl:function(a,b,d){this._sendAl(a,b,d,false)},_processingQueue:[],isProcessRunning:false,addSGProcess:function(a){this._processingQueue.push(a)},getSGProcess:function(a){return this._processingQueue.shift(a)}, runSGProcess:function(){if(this.isProcessRunning||this._processingQueue.length===0||!this._hasInitRun)return false;this.isProcessRunning=true;this.removeAllEntries();var a=this.getSGProcess();this._setUpCachedMetaTagValues(a.metadata);this.addEntry("jsevent",a.eventName);for(var b in a.props)this.addEntry(b,a.props[b]);this._send(a.eventName,a.callbackFnc);var d=this;setTimeout(function(){d.isProcessRunning=false;d.runSGProcess()},300)},noteEventData:function(a,b,d,c){this.addSGProcess({eventName:a, props:b,metadata:d,callback:c});this.runSGProcess()},setCookie:function(a,b,d){if(window.sessionStorage)try{sessionStorage.setItem(a,b)}catch(c){}var e=new Date;d!==null&&e.setDate(e.getDate()+d);document.cookie=a+"="+escape(b)+(d===null?"":"; expires="+e.toGMTString())+"; domain="+escape(".nih.gov")+"; path=/"},_setSgSource:function(a,b){a+="&sgSource="+(b?"native":"api");return a},_storeNext:function(a,b,d,c){if(typeof c==="undefined"||c===null)c=true;b=this._setSgSource(b,c);this.setCookie(a,b, d)},getCookie:function(a){var b;if(window.sessionStorage){try{b=sessionStorage.getItem(a)||""}catch(d){b=""}if(b.length>0)return b}if(document.cookie.length>0){b=document.cookie.indexOf(a+"=");if(b!==-1){b=b+a.length+1;a=document.cookie.indexOf(";",b);if(a===-1)a=document.cookie.length;return unescape(document.cookie.substring(b,a))}}return""},getTransport:function(){var a=null;if(window.XMLHttpRequest)try{a=new XMLHttpRequest;this.getTransport=function(){return new XMLHttpRequest}}catch(b){a=null}if(window.ActiveXObject&& a===null)try{a=new ActiveXObject("Msxml2.XMLHTTP");this.getTransport=function(){return new ActiveXObject("Msxml2.XMLHTTP")}}catch(d){try{a=new ActiveXObject("Microsoft.XMLHTTP");this.getTransport=function(){return new ActiveXObject("Microsoft.XMLHTTP")}}catch(c){a=false}}if(a===null)this.getTransport=function(){return null};return this.getTransport()},makeAjaxCall:function(a,b,d){var c=this.getTransport();c._ncbi_skipOverride=true;c.open("GET",a,d);if(d)c.onreadystatechange=function(){c.readyState=== 4&&b(c)};ncbi.sg.lastPing=c;c.send(null);return c},scrollDetails:{maxScroll_x:0,maxScroll_y:0,currScroll_x:0,currScroll_y:0,hasScrolled:false},scrollEventDetails:{xTenths:0,yTenths:0,xMax:0,yMax:0},_getScrollXYPx:function(){return[window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0,window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0]},_getScrollXY:function(){var a=this.getViewportHeight(),b=this.getViewportWidth(),d=document.body.scrollHeight, c=document.body.scrollWidth,e=this._getScrollXYPx(),g=Math.round(e[1]/a*10)/10;return{xRel:Math.round(e[0]/b*10)/10,yRel:g,viewportHeight:a,viewportWidth:b,pageHeight:d,pageWidth:c}},_addOnScrollListeners:function(){var a=window.onscroll,b=this;window.onscroll=function(){if(ncbi.sg.isScrollingEnabled){b._setScrollDetails();b.scrollDetails.hasScrolled=true;b._addScrollEvent()}else{b._setScrollDetails();b.scrollDetails.hasScrolled=true}if(typeof a==="function")return a()}},getViewportHeight:function(){return window.innerHeight? window.innerHeight:document.documentElement&&document.documentElement.clientHeight?document.documentElement.clientHeight:document.body!==null?document.body.clientHeight:"NA"},getViewportWidth:function(){return window.innerWidth?window.innerWidth:document.documentElement&&document.documentElement.clientWidth?document.documentElement.clientWidth:document.body!==null?document.body.clientWidth:"NA"},_setScrollDetails:function(){this.scrollDetails.currScroll_y=window.pageYOffset||document.documentElement.scrollTop|| document.body.scrollTop||0;this.scrollDetails.currScroll_x=window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0;this.getViewportWidth();this.getViewportHeight();if(this.scrollDetails.maxScroll_y<this.scrollDetails.currScroll_y)this.scrollDetails.maxScroll_y=this.scrollDetails.currScroll_y;if(this.scrollDetails.maxScroll_x<this.scrollDetails.currScroll_x)this.scrollDetails.maxScroll_x=this.scrollDetails.currScroll_x},isVisible:function(a){var b=this.findEffectiveStyleProperty(a, "visibility");a=this._isDisplayed(a);return b!="hidden"&&a},_isDisplayed:function(a){if(this.findEffectiveStyleProperty(a,"display")=="none")return false;if(a.parentNode.style)return this._isDisplayed(a.parentNode);return true},findEffectiveStyleProperty:function(a,b){var d=this.findEffectiveStyle(a)[b];if(d=="inherit"&&a.parentNode.style)return this.findEffectiveStyleProperty(a.parentNode,b);return d},findEffectiveStyle:function(a){if(a.style!=undefined){if(window.getComputedStyle)return window.getComputedStyle(a, null);if(a.currentStyle)return a.currentStyle;if(window.document.defaultView&&window.document.defaultView.getComputedStyle)return window.document.defaultView.getComputedStyle(a,null);return null}},findElementPos:function(a,b,d){var c=0,e=0;if(a.offsetLeft)c+=parseInt(a.offsetLeft);if(a.offsetTop)e+=parseInt(a.offsetTop);if(a.scrollTop&&a.scrollTop>0){e-=parseInt(a.scrollTop);d=true}if(a.scrollLeft&&a.scrollLeft>0){c-=parseInt(a.scrollLeft);b=true}if(a.offsetParent){b=this.findElementPos(a.offsetParent, b,d);if(b==-1)return-1;c+=b[0];e+=b[1]}else if(a.ownerDocument){var g=a.ownerDocument.defaultView;if(!g&&a.ownerDocument.parentWindow)g=a.ownerDocument.parentWindow;if(g){var k=g.pageXOffset!==undefined?g.pageXOffset:(a.document.documentElement||a.document.body.parentNode||a.document.body).scrollLeft;a=g.pageYOffset!==undefined?g.pageYOffset:(a.document.documentElement||a.document.body.parentNode||a.document.body).scrollTop;if(!d&&a&&a>0)e-=parseInt(a);if(!b&&k&&k>0)c-=parseInt(k);if(g.frameElement){b= this.findElementPos(g.frameElement);if(b==-1)return-1;c+=b[0];e+=b[1]}}}return[c,e]},addObjData:function(a,b){for(var d in b)a[d]=b[d]},getJoinedData:function(a){var b=[];for(var d in a)b.push(d+"="+encodeURIComponent(a[d]));return b.join("&")},addScrollHeadingData:function(a,b){var d=this.scrollEventDetails.headings;if(d){a["numHeadings."+this._scrollOrder+".scrollInfo"]=d.length;for(var c=0;c<d.length;c++){var e=d[c];if(e.visible){var g={};if(e.innerText)g["innerText."+e.index+".headings."+this._scrollOrder+ ".scrollInfo"]=e.innerText;if(e.id)g["id."+e.index+".headings."+this._scrollOrder+".scrollInfo"]=e.id;g["tagName."+e.index+".headings."+this._scrollOrder+".scrollInfo"]=e.tagName;b=b?b:1800;this.getJoinedData(a).length+this.getJoinedData(g).length<b&&this.addObjData(a,g)}}}return a},getVisibleHeadings:function(){for(var a=[],b=document.getElementsByTagName("*"),d=-1,c=0;c<b.length;c++){for(var e=b[c],g=false,k=e.tagName.toLowerCase(),j=0;j<7;j++)if(k=="h"+j)g=true;if(g){d+=1;j=this.findElementPos(e); g=j[1];j=j[0];var t=e.offsetHeight,y=e.offsetWidth,A=this.getViewportHeight(),B=this.getViewportWidth(),w={},v=e.getAttribute("id")||e.id;if(v)w.id=v;if(v=(e.getAttribute("innerText")||e.innerText||e.getAttribute("textContent")||e.textContent||"").replace(/^\s+|\s+$/g,""))w.innerText=v.substring(0,50);w.index=d;w.tagName=k;if(g+t>=0&&g<=A&&j+y>=0&&j<=B)if(this.isVisible(e)){w.visible=true;a.push(w)}}}return a},_setBeforeScrollDetails:function(a){this._lastScroll=a?a:null;a=this._getScrollXY();var b= a.yRel;this.scrollEventDetails.xTenths=Math.round(a.xRel*10);this.scrollEventDetails.yTenths=Math.round(b*10);this.scrollEventDetails.xMax=Math.max(this.scrollEventDetails.xTenths,this.scrollEventDetails.xMax);this.scrollEventDetails.yMax=Math.max(this.scrollEventDetails.yTenths,this.scrollEventDetails.yMax);this.scrollEventDetails.headings=this.getVisibleHeadings()},getScrollDetails:function(a,b){if(!ncbi.sg.isScrollingEnabled){this._setScrollDetails();return this.scrollDetails}var d=this.scrollEventDetails; d.tstamp=(new Date).getTime();var c=this._getScrollXY(),e=null;if(b||!this._lastScroll||d.tstamp-this._lastScroll>1E3){this._scrollOrder=this._scrollOrder!=undefined?this._scrollOrder+1:0;b="yTenths."+this._scrollOrder+".scrollInfo";e="xTenths."+this._scrollOrder+".scrollInfo";var g="maxXTenths."+this._scrollOrder+".scrollInfo",k="maxYTenths."+this._scrollOrder+".scrollInfo",j={};j["duration."+this._scrollOrder+".scrollInfo"]=this._lastScroll?d.tstamp-this._lastScroll:new Date-ncbi.sg.loadTime;j[e]= this.scrollEventDetails.xTenths;j[b]=this.scrollEventDetails.yTenths;j[g]=this.scrollEventDetails.xMax;j[k]=this.scrollEventDetails.yMax;j["viewportHeight."+this._scrollOrder+".scrollInfo"]=c.viewportHeight;j["viewportWidth."+this._scrollOrder+".scrollInfo"]=c.viewportWidth;j["maxPossibleScrollTenthsY."+this._scrollOrder+".scrollInfo"]=Math.round((c.pageHeight/c.viewportHeight-1)*10);j["maxPossibleScrollTenthsX."+this._scrollOrder+".scrollInfo"]=Math.round((c.pageWidth/c.viewportWidth-1)*10);e=j= this.addScrollHeadingData(j,a)}this._setBeforeScrollDetails(d.tstamp);return e},getScrollDetailsAr:function(a,b){var d=[];a=this.getScrollDetails(a,b);for(var c in a)d.push(c+"="+encodeURIComponent(a[c]));return d},addScrollDetailsAr:function(a,b,d){b=this.getScrollDetailsAr(b,d);for(d=0;d<b.length;d++)a.push(b[d])},addScrollDetails:function(a,b,d){b=this.getScrollDetails(b,d);for(var c in b)a[c]=b[c]},trimScrollDetails:function(){},_addScrollEvent:function(){try{var a=this.getScrollDetails();if(a){a.jsevent= "scroll";ncbi.sg._ping(a)}}catch(b){ncbi.sg.getInstance().noteEventData("jserror",{jserror:b.toString(),SELF_URL:window.location.href},["ncbi_sessionid","ncbi_phid"])}},_addPrintPing:function(){function a(){var c=document.createElement("style");c.type="text/css";var e=document.createElement("style");e.type="text/css";e.media="print";for(var g=["jsevent=print"],k=0;k<b.cachedNames.length;k++){var j=b.cachedNames[k],t=b._cachedVals[j];t&&j!=="ncbi_sessionid"&&g.push(j+"="+encodeURIComponent(t.value))}g= ".print-log { position:absolute;left:-10000px;top:auto;width:1px;height:1px;overflow:hidden; }.print-log li { list-style-image: url('/stat?"+g.join("&")+"'); }";if(e.styleSheet){e.styleSheet.cssText=g;c.styleSheet.cssText=".print-log { position:absolute;left:-10000px;top:auto;width:1px;height:1px;overflow:hidden; }"}else{e.appendChild(document.createTextNode(g));c.appendChild(document.createTextNode(".print-log { position:absolute;left:-10000px;top:auto;width:1px;height:1px;overflow:hidden; }"))}g= document.getElementsByTagName("head")[0];g.appendChild(e);g.appendChild(c);c=document.createElement("ul");c.className="print-log";e=document.createElement("li");c.appendChild(e);document.body.appendChild(c)}var b=this;if(typeof jQuery!=="undefined")jQuery(a);else{var d=window.onload;window.onload=function(c){d&&d(c);a()}}},getMillisecondsSinceSunday:function(){var a=new Date,b=new Date;b.setDate(b.getDate()-b.getDay());b.setHours(0);b.setMinutes(0);b.setSeconds(0);b.setMilliseconds(0);return(a-b).toString(36)}}; ncbi.sg.lastPing=null;ncbi.sg.hasNotedErrorEvent=false;(function(){function a(){ncbi.sg.getInstance().setCookie("ncbi_prevPHID",ncbi.sg.getInstance().currentPageHitId);if(y.length>0)for(;y.length>0;)d(y.pop());var f={jsevent:"unload",ncbi_pingaction:"unload"};if(typeof ncbi_startTime!=="undefined"){f.ncbi_timeonpage=new Date-ncbi_startTime;if(typeof ncbi_onloadTime!=="undefined"&&ncbi_onloadTime)f.ncbi_onloadTime=ncbi_onloadTime-ncbi_startTime}var i=ncbi.sg.getInstance();i.setPerfStats(f,true);i.addScrollDetails(f, 1800-i.getJoinedData(f).length,true);if(!w){ncbi.sg._ping(f);var m="";for(var l in f)m+=l+"="+(l==="jsevent"?"unloadnext":f[l])+"&";m+="ncbi_phid="+i.currentPageHitId;i._storeNext("unloadnext",m,null)}w=true}function b(f){for(var i=y.length-1;i>=-1;i--)if(y[i]===f){y.slice(i,1);break}d(f)}function d(f,i){if(A.indexOf(f.tstamp)===-1){A.push(f.tstamp);B.push(f);c("click",f,i)}}function c(f,i,m,l){if(typeof l==="undefined"||l===null)l=true;var n=f==="click"?"link":"elem",h=i.link,o=i.evt,p=h.id||"", x=h.name||"",F=h.sid||"",G=h.href||"",C=h.innerText||h.textContent||"";if(C.length>50)C=C.substr(0,50);var H=h.getAttribute?h.getAttribute("ref")||h.ref||"":"",I=h.className?h.className.replace(/^\s?/,"").replace(/\s?$/,"").split(/\s/g).join(",")||"":"";i=[];var D=[],z=h.parentNode;if(z)for(var r=0;r<6&&z!==null;r++){(parId=z.id)&&i.push(parId);if(parClassName=z.className)D=D.concat(parClassName.split(/\s/));z=z.parentNode}z=ncbi.sg.getInstance();r=z.currentPageHitId||"";var q=[];p.length>0&&q.push(n+ "_id="+encodeURIComponent(p));x.length>0&&q.push(n+"_name="+encodeURIComponent(x));F.length>0&&q.push(n+"_sid="+encodeURIComponent(F));G.length>0&&q.push(n+"_href="+encodeURIComponent(G));C.length>0&&q.push(n+"_text="+encodeURIComponent(C));I.length>0&&q.push(n+"_class="+encodeURIComponent(I));r=z.getBrowserWidthHeight();r.width!==null&&q.push("browserwidth="+encodeURIComponent(r.width));r.height!==null&&q.push("browserheight="+encodeURIComponent(r.height));for(var E in o){r=o[E];r!==undefined&&q.push(E.toLowerCase()+ "="+r.toString())}q.push("jsevent="+f);H.length>0&&q.push(H);if(typeof jQuery!=="undefined")if(h=jQuery(h).attr("sg")){h=h.split(/\}\s*,\s*\{/);for(r=0;r<h.length;r++){o=h[r].match(/name\s*:\s*'(.+)',\s*selector\s*:\s*'(.+)'/);if(o.length===3){E="cust_"+o[1];o=jQuery(o[2]).val();q.push(E+"="+encodeURIComponent(o))}}}if(m&&m.length>0)for(;m.length>0;)q.push(m.shift());i.length>0&&q.push("ancestorId="+i.join(","));D.length>0&&q.push("ancestorClassName="+D.join(",").replace(/\s+/g," ").replace(/(^\s|\s$)/g, ""));z.addScrollDetailsAr(q,1800-q.join("&").length,true);if(f==="click"){f=q.join("&").replace("jsevent=click","jsevent=clicknext");r=ncbi.sg.getInstance().currentPageHitId||"";f+="&ncbi_phid="+r;z._storeNext("clicknext",f,null,l)}ncbi.sg._ping(q,true,null,null,l)}function e(f){var i={};if(f){if(f.clientX||f.clientY){var m=ncbi.sg.getInstance()._getScrollXYPx();i.evt_coor_x=f.clientX+m[0];i.evt_coor_y=f.clientY+m[1]}else if(f.pageX||f.pageY){i.evt_coor_x=f.pageX;i.evt_coor_y=f.pageY}i.jseventms= ncbi.sg.getInstance().getMillisecondsSinceSunday()}return i}function g(f,i,m,l,n){var h={},o=null,p=null;if(typeof i==="string"){o=i;p=m}else{h=e(i);o=m;p=l}if(p){i=typeof p;if(i==="string")p=[p];else if(i==="object"&&!(p instanceof Array)){i=[];for(var x in p)i.push(x+"="+p[x]);p=i}}c(o,{link:f,evt:h},p,n)}function k(f,i,m){var l=[];if(typeof i==="undefined")i=true;if(typeof f==="object"&&!(f instanceof Array))for(var n in f)l.push(n+"="+encodeURIComponent(f[n]));else if(typeof f==="string")l.push(f); else l=f;f=ncbi.sg.getInstance().currentPageHitId||"";n=null;if(typeof ncbi.sg.loadTime!=="undefined")n=new Date-ncbi.sg.loadTime;var h=l.join("&");if(h.indexOf("jsevent=clicknext")!==-1||h.indexOf("jsevent=searchnext")!==-1||h.indexOf("jsevent=unloadnext")!==-1){f.length>0&&l.push("next_phid="+encodeURIComponent(f));n!==null&&l.push("next_ncbi_timesinceload="+n)}else{f.length>0&&l.push("ncbi_phid="+encodeURIComponent(f));n!==null&&l.push("ncbi_timesinceload="+n)}ncbi.sg.getInstance()._sendAl(l.join("&"), null,i,m)}var j=window.onerror;window.onerror=function(f,i,m){if(!ncbi.sg.hasNotedErrorEvent){ncbi.sg.getInstance().noteEventData("jserror",{jserror:f,jserrorlocation:i,jserrorline:m,SELF_URL:window.location.href},["ncbi_sessionid","ncbi_phid"]);ncbi.sg.hasNotedErrorEvent=true;if(typeof j==="function")return j(f,i,m)}};var t=window.onbeforeunload;window.onbeforeunload=function(f){a();if(typeof t==="function")return t(f)};var y=[],A=[],B=[],w=false;ncbi.sg.sendElementEvent=function(f,i,m){c(f,i,m, false)};ncbi.sg.clickTimers=[];if(typeof ncbi.sg.isClickEnabled==="undefined"){for(var v=document.getElementsByTagName("meta"),u=v.length-1,s=true;u>=0;){if(v[u].name.toLowerCase()==="ncbi_clickdisabled"){s=v[u].content.toLowerCase()==="false";break}u--}ncbi.sg.isClickEnabled=s}setClickEvent=function(){var f=function(h){return(h=typeof h.parentNode!=="undefined"?h.parentNode:null)?m(h)?h:f(h):false},i=function(h){h=h.target||h.srcElement;if(typeof h=="undefined"||h==null)return null;if(h.nodeType== 3)h=target.parentNode;m(h)||(h=f(h));return h},m=function(h){var o=typeof h.tagName!=="undefined"?h.tagName.toLowerCase():null,p=false,x=false;if(typeof jQuery!=="undefined")p=jQuery(h).is("button, input[type=button], input[type=submit], input[type=reset]");else if(o==="input"){h=inp.type;p=h=="button"||h=="submit"||h=="reset"}else p=o==="button"?true:false;p||(x=o=="a"||o=="area");return x?"link":p?"button":null},l=function(h,o,p,x){if(!(x&&x=="click"&&h.which&&h.which==3))if(!(!o||m(o)==null)){ncbi.sg.getInstance().setCookie("ncbi_prevPHID", ncbi.sg.getInstance().currentPageHitId);h=e(h);h.iscontextmenu=x=="contextmenu"?"true":"false";o={evt:h,link:o,tstamp:(new Date).getTime(),floodTstamp:(new Date).getTime()};b(o);ncbi.sg.clickTimers&&window.clearTimeout(ncbi.sg.clickTimers);ncbi.sg.clickTimers=window.setTimeout(function(){ncbi.sg.clickTimers=null},300)}};if(window.addEventListener){window.addEventListener("click",function(h){l(h,i(h),[],"click")});window.addEventListener("contextmenu",function(h){l(h,i(h),[],"contextmenu")},false)}else if(window.attachEvent){document.attachEvent("onclick", function(h){l(h,i(h),[],"click")});document.attachEvent("oncontextmenu",function(h){l(h,i(h),[],"contextmenu")},false)}if(Event.prototype.stopPropagation){var n=Event.prototype.stopPropagation;Event.prototype.stopPropagation=function(){var h=i(this);if(m(h)!=null)if(this.type=="click")l(this,h,[],"click");else this.type=="contextmenu"&&l(this,h,[],"contextmenu");return n.apply(this,arguments)}}};setClickEvent();ncbi.sg.scanLinks=function(){};ncbi.sg._ping=function(f,i,m,l,n){if(typeof n==="undefined"|| n===null)n=true;typeof f==="undefined"||f===null||(typeof f==="object"&&f.nodeName!==undefined?g(f,i,m,l,n):k(f,i,n))};ncbi.sg.ping=function(f,i,m,l){ncbi.sg._ping(f,i,m,l,false)};ncbi.sg.loadTime=new Date})();if(!Array.prototype.indexOf)Array.prototype.indexOf=function(a,b){var d=this.length>>>0;b=Number(b)||0;b=b<0?Math.ceil(b):Math.floor(b);if(b<0)b+=d;for(;b<d;b++)if(b in this&&this[b]===a)return b;return-1};(function(){function a(){ncbi_onloadTime=new Date}ncbi_onloadTime=null;if(typeof jQuery!== "undefined")jQuery(window).load(a);else{var b=window.onload;window.onload=function(d){b&&b(d);a()}}})()}})(); (function(){ncbi.sg._ajaxRequestIndex=1;if(typeof XMLHttpRequest!=="undefined"){var a,b=function(c,e,g,k){if(typeof a==="undefined"||!a)a=ncbi.sg.getInstance();e=(e=a.getVal(e))?e:"unknown";if(typeof k!=="undefined"&&k)e+=".0"+ncbi.sg._ajaxRequestIndex;c.setRequestHeader(g,e)},d=XMLHttpRequest.prototype.open;XMLHttpRequest.prototype.open=function(){var c=d.apply(this,arguments);if(!(typeof this._ncbi_skipOverride!=="undefined"&&this._ncbi_skipOverride)){b(this,"ncbi_phid","NCBI-PHID",true);b(this, "ncbi_sessionid","NCBI-SESSIONID",false);ncbi.sg._ajaxRequestIndex+=1}return c}}})(); typeof jQuery!=="undefined"&&jQuery(function(){if(ncbi.sg.isHoverEnabled){var a=function(c,e,g){var k=[];if(typeof e==="undefined")e=true;if(typeof c==="object"&&!(c instanceof Array))for(var j in c)k.push(j+"="+encodeURIComponent(c[j]));else if(typeof c==="string")k.push(c);else k=c;c=ncbi.sg.getInstance().currentPageHitId||"";j=null;if(typeof ncbi.sg.loadTime!=="undefined")j=new Date-ncbi.sg.loadTime;k.join("&");c.length>0&&k.push("next_phid="+encodeURIComponent(c));j!==null&&k.push("next_ncbi_timesinceload="+ j);ncbi.sg.getInstance()._sendAl(k.join("&"),null,e,g)},b=ncbi.sg.getInstance().getCookie("hovernext");if(b){a(b);ncbi.sg.getInstance().setCookie("hovernext","")}var d=function(c){var e={};if(c){if(c.clientX||c.clientY){var g=ncbi.sg.getInstance()._getScrollXYPx();e.evt_coor_x=c.clientX+g[0];e.evt_coor_y=c.clientY+g[1]}else if(c.pageX||c.pageY){e.evt_coor_x=c.pageX;e.evt_coor_y=c.pageY}e.jseventms=ncbi.sg.getInstance().getMillisecondsSinceSunday()}return e};jQuery(document).on("mousedown","a[ref*='itool=Abstract-nondef'], #disc_col a", function(c){c=c.originalEvent;var e=d(c);jQuery(c.target);(new Date).getTime();(new Date).getTime();var g=jQuery(c.target),k=g.id||"",j=g.name||"",t=g.sid||"",y=g.href||"",A=g.innerText||g.textContent||"";if(A.length>50)A=A.substr(0,50);var B=g.getAttribute?g.getAttribute("ref")||g.ref||"":"",w=g.className?g.className.replace(/^\s?/,"").replace(/\s?$/,"").split(/\s/g).join(",")||"":"";c=[];var v=[],u=g.parentNode;if(u)for(var s=0;s<6&&u!==null;s++){(parId=u.id)&&c.push(parId);if(parClassName=u.className)v= v.concat(parClassName.split(/\s/));u=u.parentNode}u=ncbi.sg.getInstance();var f=u.currentPageHitId||"";f=[];k.length>0&&f.push("link_id="+encodeURIComponent(k));j.length>0&&f.push("link_name="+encodeURIComponent(j));t.length>0&&f.push("link_sid="+encodeURIComponent(t));y.length>0&&f.push("link_href="+encodeURIComponent(y));A.length>0&&f.push("link_text="+encodeURIComponent(A));w.length>0&&f.push("link_class="+encodeURIComponent(w));s=u.getBrowserWidthHeight();s.width!==null&&f.push("browserwidth="+ encodeURIComponent(s.width));s.height!==null&&f.push("browserheight="+encodeURIComponent(s.height));for(var i in e){s=e[i];s!==undefined&&f.push(i.toLowerCase()+"="+s.toString())}f.push("jsevent=hovernext");B.length>0&&f.push(B);if(typeof jQuery!=="undefined")if(e=jQuery(g).attr("sg")){e=e.split(/\}\s*,\s*\{/);for(s=0;s<e.length;s++){g=e[s].match(/name\s*:\s*'(.+)',\s*selector\s*:\s*'(.+)'/);if(g.length===3){i="cust_"+g[1];g=jQuery(g[2]).val();f.push(i+"="+encodeURIComponent(g))}}}c.length>0&&f.push("ancestorId="+ c.join(","));v.length>0&&f.push("ancestorClassName="+v.join(",").replace(/\s+/g," ").replace(/(^\s|\s$)/g,""));u.addScrollDetailsAr(f,1800-f.join("&").length,true);c=f.join("&");f=ncbi.sg.getInstance().currentPageHitId||"";c+="&ncbi_phid="+f;ncbi.sg.getInstance()._storeNext("hovernext",c,null)});jQuery(document).on("mouseup mousedown",function(c){!jQuery(c.target).is("a[ref*='itool=Abstract-nondef']")&&jQuery(c.target).parents("a[ref*='itool=Abstract-nondef']").length==0&&!jQuery(c.target).is("#disc_col a")&& jQuery(c.target).parents("#disc_col a").length==0&&ncbi.sg.getInstance().setCookie("hovernext","")})}}); ; // This code creates window.console if it doesn't exist. // It also creates stub functions for those functions that are missing in window.console. // (Safari implements some but not all of the firebug window.console methods--this implements the rest.) (function() { var names = [ "log", "debug", "info", "warn", "error", "assert", "dir", "dirxml", "group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd" ]; if (typeof(console) === 'undefined' || typeof console === "function" ) { //"typeof function" is needed see PP-769 console = {}; } for (var i = 0; i < names.length; ++i) { if (typeof(console[names[i]]) === 'undefined') { console[names[i]] = function() { return false; }; } } ncbi.sg.getInstance().init(); })();