/*
Copyright 2010 Google Inc.
Copyright 2016 Akamai Technolgies

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

See the source code here:
     http://code.google.com/p/episodes/
*/

(function(b){b.parent!==b&&void 0==b.AKSB&&(b=b.parent);var k=b.document;"undefined"===typeof b.AKSB&&(b.AKSB={});var a=b.AKSB;if(void 0!=a.prof&&!0===a.prof.origin&&("number"!==typeof a.prof.beaconrate&&(a.prof.beaconrate=10),parseInt(a.prof.beaconrate,10)<=100*Math.random()))return;a.q=a.q||[];a.autorun="undefined"!==typeof a.autorun?a.autorun:!0;a.version||"X"===b.AKSB.prof.akTT||(a.version=8,a.init=function(){a.bDone=!1;a.marks={};a.measures={};a.starts={};a.getClientProf();a.processQ();var c=
a.findStartWebTiming();c&&(a.mark("starttime",c),a.addEventListener("DOMContentLoaded",a.onready,!1),a.addEventListener("load",a.onload,!1),"complete"===k.readyState&&(a.onloadHasFired=!0,window.setTimeout(a.onload,1)),a.processQ())},a.processQ=function(){for(var c=a.q.length,b=0;b<c;b++){var e=a.q[b],f=e[0];"mark"===f?a.mark(e[1],e[2]):"measure"===f?a.measure(e[1],e[2],e[3]):"done"===f&&a.done(e[1])}},a.getClientProf=function(){a.prof=a.prof||{};a.prof.beaconUrl=a.prof.beaconUrl||("https:"===k.location.protocol?
"https:":"http:")+"//ds-aksb-a.akamaihd.net/2/"+a.prof.custid+"/b";a.prof.ua=escape(b.navigator.userAgent);a.prof.plat=escape(b.navigator.platform);a.prof.uri=escape(k.location.protocol.toLowerCase()+"//"+k.location.hostname.toLowerCase()+k.location.pathname);var c=b.navigator.connection||b.navigator.mozConnection||b.navigator.webkitConnection,d="",e="";c&&"number"===typeof c.type?c.type==c.WIFI?(d="wifi",e=7E6):c.type==c.CELL_2G?(d="cellular",e=384):c.type==c.CELL_3G?(d="cellular",e=42E3):c.type==
c.CELL_4G?(d="cellular",e=1E5):c.type==c.ETHERNET?(d="ethernet",e=1E7):c.type==c.NONE?(d="none",e=0):d="unknown":c&&"string"===typeof c.type&&(d=c.type,c.downlinkMax&&(e=Math.round(1E3*c.downlinkMax)));a.prof.connType=escape(d);a.prof.connBandwidth=e;a.prof.pageViz=k.visibilityState||k.webkitVisibilityState||k.mozVisibilityState||k.msVisibilityState;a.prof.feo="undefined"!==typeof b.aFeoApplied?!0:!1;a.prof.qryTrunc=""!==k.location.search;!a.prof.pct||parseInt(a.prof.pct,10)<=100*Math.random()||void 0===
a.prof.clientip||(c=a.getMangledAddress(),a.prof.beaconUrl=("https:"===k.location.protocol?"https:":"http:")+"//"+(a.prof.ipv6?"j":"i")+c+"-ds-aksb-a.akamaihd.net/2/"+a.prof.custid+"/b")},a.getMangledAddress=function(){if(void 0===a.prof.clientip)return"";if(a.prof.ipv6){var c=a.prof.clientip.split(":");return(""==c[0]?"":parseInt(c[0],16).toString(32))+"z"+(""==c[1]?"":parseInt(c[1],16).toString(32))+"z"+(""==c[2]?"":parseInt(c[2],16).toString(32))}c=a.prof.clientip.split(".");return("00000000"+
(256*(256*(256*+c[0]+ +c[1])+ +c[2])+0).toString(16)).slice(-8)},a.mark=function(c,b){c&&(a.marks[c]=parseInt(b||(new Date).getTime(),10),"firstbyte"===c?a.measure("t_fb","starttime","firstbyte"):"onload"===c?a.measure("t_onload","starttime","onload"):"done"===c&&a.measure("t_plt","starttime","done"))},a.measure=function(c,b,e){if(c){if("undefined"===typeof b)b="number"===typeof a.marks[c]?a.marks[c]:(new Date).getTime();else if("number"===typeof a.marks[b])b=a.marks[b];else if("number"!==typeof b)return;
if("undefined"===typeof e)e=(new Date).getTime();else if("number"===typeof a.marks[e])e=a.marks[e];else if("number"!==typeof e)return;a.starts[c]=parseInt(b,10);a.measures[c]=parseInt(e-b,10)}},a.done=function(c){a.mark("done");var d=a.getNavTimingAPI(),e=d.navigation,f=d.timing;if(void 0!==d){var n=function(){if(e&&(0===e.type||1===e.type)&&f&&0<f.loadEventEnd){for(var d in f)a.mark(d,f[d]);a.measure("dE","domainLookupStart","domainLookupEnd");a.measure("cS","domainLookupStart","connectStart");f.secureConnectionStart&&
a.measure("sS","domainLookupStart","secureConnectionStart");a.measure("cE","domainLookupStart","connectEnd");a.measure("rqS","domainLookupStart","requestStart");a.measure("rsS","domainLookupStart","responseStart");a.measure("rsE","domainLookupStart","responseEnd");f.msFirstPaint?a.measure("fp","navigationStart","msFirstPaint"):"undefined"!==typeof b.chrome&&b.chrome.hasOwnProperty("loadTimes")&&(d=Math.round(1E3*b.chrome.loadTimes().firstPaintTime),0<d&&a.measure("fp","domainLookupStart",d));a.measure("dl",
"domainLookupStart","domLoading");a.measure("di","domainLookupStart","domInteractive");a.measure("dlS","domainLookupStart","domContentLoadedEventStart");a.measure("dlE","domainLookupStart","domContentLoadedEventEnd");a.measure("dc","domainLookupStart","domComplete");a.measure("leS","domainLookupStart","loadEventStart");a.measure("leE","domainLookupStart","loadEventEnd");a.bDone=!0;a.autorun&&a.sendBeacon();"function"===typeof c&&c()}else f&&0>=f.loadEventEnd&&setTimeout(n,100)};n()}},a.aksbVersion=
function(){return""+(void 0===a.prof.blver?0:a.prof.blver)+":"+(void 0===a.version?0:a.version)},a.sendBeacon=function(b,d){b=b||a.prof.beaconUrl;var e="";a.bf=a.bitField();a.createBitField();var f={dE:a.measures.dE,cS:a.measures.cS,cE:a.measures.cE,rqS:a.measures.rqS,rsS:"undefined"!==typeof a.measures.rsS?a.measures.rsS:a.measures.t_fb,rsE:a.measures.rsE,sS:a.measures.sS,dl:a.measures.dl,di:a.measures.di,fp:a.measures.fp,dlS:a.measures.dlS,dlE:"undefined"!==typeof a.measures.dlE?a.measures.dlE:
a.measures.t_onready,dc:a.measures.dc,leS:"undefined"!==typeof a.measures.leS?a.measures.leS:a.measures.t_onload,leE:"undefined"!==typeof a.measures.leE?a.measures.leE:a.measures.t_plt,to:a.measures.to,ol:a.prof.originlat,cr:a.prof.clientrtt,mt:a.prof.connType,mb:a.prof.connBandwidth,b:a.bf.get(),u:a.prof.uri,ua:a.prof.ua,pl:a.prof.plat,us:a.prof.ustr,gh:a.prof.ghostip,t:a.prof.token,rid:a.prof.requestid,akM:a.prof.akM,akN:a.prof.akN,vc:a.aksbVersion(),bpcip:a.getMangledAddress(),akTX:a.prof.akTX,
akTI:a.prof.akTI,ai:a.prof.ai,pmgn:a.prof.pmgn,pmgi:a.prof.pmgi,pmp:a.prof.pmp},n;for(n in f)e+="&"+escape(n)+"="+("undefined"===typeof f[n]?"":f[n]);if(e){e=e.substring(1);if(d)for(var p in d)d.hasOwnProperty(p)&&(e+="&"+escape(p)+"="+escape(d[p]));a.bf.get();f=new Image;f.src=b+"?"+e;return f.src}return""},a.bitField=function(a){var b=Math.abs(a);a=function(){};a.prototype.set=function(a){return this.hasbit(a)?b:b|=a};a.prototype.hasbit=function(a){return a>b?0:b&a};a.prototype.get=function(){return b};
return new a},a.createBitField=function(){a.bf.set(1);var c=a.prof.protocol;void 0!==c&&("h2"==c.slice(0,2)?a.bf.set(131072):"spdy"==c.slice(0,4)&&a.bf.set(64));a.prof.ipv6&&a.bf.set(16);a.prof.feo&&a.bf.set(32);"hidden"===a.prof.pageViz&&a.bf.set(128);"visible"===a.prof.pageViz&&a.bf.set(256);"prerendered"===a.prof.pageViz&&a.bf.set(512);a.prof.qryTrunc&&a.bf.set(2048);!0===a.prof.origin&&a.bf.set(4096);!0===a.onloadHasFired&&a.bf.set(8192);"true"===a.prof.ra&&a.bf.set(524288);b.performance&&(b.performance.getEntries||
b.performance.webkitGetEntries)||a.bf.set(16384);a.prof.akTT&&"O"!=a.prof.akTT&&a.bf.set(262144)},a.findStartWebTiming=function(){var b=void 0,d=a.getNavTimingAPI();"undefined"!==typeof d&&"undefined"!==typeof d.timing&&"undefined"!==typeof d.timing.navigationStart&&(b=a.prof.ua.match(/Firefox\/[78]\./i)?d.timing.unloadEventStart||d.timing.fetchStart:d.timing.navigationStart,a.prof.src="nt");return b},a.onready=function(b){a.mark("onready",(new Date).getTime());a.measure("t_onready","starttime","onready")},
a.onload=function(b){a.mark("onload",(new Date).getTime());a.autorun&&a.done()},a.addEventListener=function(a,d,e){if("undefined"!==typeof b.attachEvent)return b.attachEvent("on"+a,d);if(b.addEventListener)return b.addEventListener(a,d,e)},a.getNavTimingAPI=function(){return b.performance||b.mozPerformance||b.msPerformance||b.webkitPerformance},a.init())})(window);
(function(b){function k(){this.data={};this.value=[]}b.parent!==b&&void 0==b.AKSB&&(b=b.parent);var a=b.document;"undefined"===typeof b.RT&&(b.RT={});var c=b.RT;if(!c.version&&"undefined"!==typeof b.AKSB.version&&void 0!==Object.keys){c.version="0.2";c.init=function(){"complete"===a.readyState?window.setTimeout(c.getW3CTimings,1):c.addEventListener("load",c.getW3CTimings,!1)};c.getW3CTimings=function(){var e=new k,f=c.getResourceTimingAPI(),d={},p=0;if("all"in b.document)for(var l=b.document.all,
h=0;h<l.length;h++){var m=l[h];if("LINK"===m.tagName&&"href"in m){if("http"===m.href.substr(0,4).toLowerCase()&&(d[m.href]=1,1E3<p++))break}else if("src"in m&&"http"===m.src.substr(0,4).toLowerCase()&&(d[m.src]=1,1E3<p++))break}if(f)for(h in f)"undefined"!==typeof f[h].duration&&(delete d[f[h].name],e.insert(f[h].name,[Math.round(f[h].redirectStart),Math.round(f[h].redirectEnd),Math.round(f[h].fetchStart),Math.round(f[h].domainLookupStart),Math.round(f[h].domainLookupEnd),Math.round(f[h].connectStart),
Math.round(f[h].connectEnd),Math.round(f[h].secureConnectionStart),Math.round(f[h].requestStart),Math.round(f[h].responseStart),Math.round(f[h].responseEnd),Math.round(f[h].duration),f[h].initiatorType,f[h].nextHopProtocol,f[h].transferSize,f[h].encodedBodySize,f[h].decodedBodySize]));for(res in d)e.insert(res,[]);c.radtree=e;c.baseurl=a.location.protocol.toLowerCase()+"//"+a.location.hostname.toLowerCase()+a.location.pathname;var q=function(a){var e=new XMLHttpRequest;e.open("POST",("https:"===b.document.location.protocol?
"https:":"http:")+"//ds-aksb-a.akamaihd.net/RRT",!0);e.setRequestHeader("Content-Type","application/x-www-form-urlencoded");a={nt:escape(JSON.stringify(a)),rt:escape(JSON.stringify(c.radtree.data)),rid:b.AKSB.prof.requestid,gh:b.AKSB.prof.ghostip,b:b.AKSB.bf.get(),c:b.AKSB.prof.custid,us:b.AKSB.prof.ustr,ol:b.AKSB.prof.originlat,cr:b.AKSB.prof.clientrtt,ua:b.AKSB.prof.ua,pl:b.AKSB.prof.plat,mt:b.AKSB.prof.connType,mb:b.AKSB.prof.connBandwidth,vc:b.AKSB.aksbVersion(),bpcip:b.AKSB.getMangledAddress(),
akTX:b.AKSB.akTX,akTI:b.AKSB.akTI,ai:b.AKSB.prof.ai};var f=[],d;for(d in a)a.hasOwnProperty(d)&&a[d]&&f.push(d+"="+a[d]);e.send(f.join("&"))};if(b.performance&&b.performance.timing){var g=b.performance.timing,r=function(){if(0<g.loadEventEnd){var a=[g.domainLookupEnd-g.domainLookupStart,g.connectStart-g.domainLookupStart,g.connectEnd-g.domainLookupStart,g.secureConnectionStart?g.secureConnectionStart-g.domainLookupStart:null,g.requestStart-g.domainLookupStart,g.responseStart-g.domainLookupStart,g.responseEnd-
g.domainLookupStart,g.domLoading-g.domainLookupStart,g.domInteractive-g.domainLookupStart,g.msFirstPaint?g.msFirstPaint-g.navigationStart:"undefined"!==typeof b.chrome&&b.chrome.hasOwnProperty("loadTimes")?Math.round(1E3*b.chrome.loadTimes().firstPaintTime)-g.domainLookupStart:null,g.domContentLoadedEventStart-g.domainLookupStart,g.domContentLoadedEventEnd-g.domainLookupStart,g.domComplete-g.domainLookupStart,g.loadEventStart-g.domainLookupStart,g.loadEventEnd-g.domainLookupStart],e={};e[c.baseurl]=
a;q(e)}else 0>=g.loadEventEnd&&setTimeout(r,100)};r()}else{var s=function(){if("AKSB"in b&&"measures"in b.AKSB&&"t_plt"in b.AKSB.measures){var a={};a[c.baseurl]=[null,null,null,0,null,null,null,null,null,null,null,null,null,b.AKSB.measures.t_onload,b.AKSB.measures.t_plt];q(a)}else setTimeout(s,100)};s()}};c.addEventListener=function(a,c,d){if("undefined"!==typeof b.attachEvent)return b.attachEvent("on"+a,c);if(b.addEventListener)return b.addEventListener(a,c,d)};c.getResourceTimingAPI=function(){if("performance"in
b){if("getEntriesByType"in b.performance)return b.performance.getEntriesByType("resource");if("webkitGetEntriesByType"in b.performance)return b.performance.webkitGetEntriesByType("resource")}return null};k.prototype.insert=function(a,b){for(var c=this.data;a;){var d=this.get_prefix(a,Object.keys(c)),l=d[0],d=d[1];if(!l||"string"!==typeof l||"string"!==typeof d)break;var h=l.length;if(l!==d){var m=d.slice(h,d.length),k=c[d];k===this.value&&(k=JSON.parse(JSON.stringify(k)));c[l]={};c[l][m]=k;delete c[d]}else c[l]===
this.value&&(c[l]=JSON.parse(JSON.stringify(this.value)));a=a.slice(h,a.length);c=c[l]}c[a]=a?b:null;return!0};k.prototype.get_prefix=function(a,b){function c(a,b){if(""===b)return!0;if(null==a||null==b)return!1;a=String(a);b=String(b);return a.length>=b.length&&a.slice(0,b.length)===b}b.sort(function(a,b){return a.length<b.length?-1:a.length>b.length?1:0}).reverse;if("undefined"!==typeof a){wc=a[0];for(var d in b)if(c(b[d],wc))for(var k=a.length;1<=k;k--)if(c(b[d],a.slice(0,k)))return[a.slice(0,
k),b[d]]}return["",null]};var d=b.AKSB.prof.akTT;"R"===d?c.init():"O"!==d&&void 0!==d||!(0<=b.document.location.search.search("akamai-rum-rt=on"))&&5<=100*Math.random()||c.init()}})(window);
