var g_arrLoadTime={1:0.1,2:0.15,3:0.2,4:0.24,5:0.28,6:0.32,7:0.35,8:0.39,9:0.42,10:0.46,11:0.49,12:0.52,13:0.55,14:0.58,15:0.61,16:0.64,17:0.67,18:0.7,19:0.73,20:0.76,21:0.79,22:0.82,23:0.85,24:0.88,25:0.91,26:0.94,27:0.97,28:1,29:1.04,30:1.07,31:1.1,32:1.14,33:1.17,34:1.2,35:1.24,36:1.27,37:1.31,38:1.35,39:1.39,40:1.43,41:1.47,42:1.51,43:1.55,44:1.6,45:1.64,46:1.69,47:1.74,48:1.79,49:1.84,50:1.89,51:1.94,52:2,53:2.05,54:2.11,55:2.17,56:2.23,57:2.29,58:2.36,59:2.43,60:2.5,61:2.57,62:2.65,63:2.73,
64:2.81,65:2.9,66:2.99,67:3.08,68:3.18,69:3.28,70:3.39,71:3.5,72:3.62,73:3.75,74:3.88,75:4.02,76:4.16,77:4.32,78:4.49,79:4.68,80:4.88,81:5.09,82:5.33,83:5.59,84:5.88,85:6.21,86:6.57,87:6.99,88:7.46,89:8.02,90:8.68,91:9.48,92:10.4,93:11.7,94:13.2,95:15.4,96:18.7,97:23.2,98:31,99:50.4},g_iTotal=0,g_iCanvasSize=200,g_xImgBk=new Image;document.addEventListener("DOMContentLoaded",function(){CheckRTL();InitPageSpeed();CheckSpeedReady()});
function CheckRTL(){IsRTL()&&(document.body.style.direction="rtl")}
function InitPageSpeed(){var a=document.getElementById("imagearea").getContext("2d");g_xImgBk.src="image/logo-speed.png";g_xImgBk.onload=function(){a.drawImage(g_xImgBk,0,0,g_iCanvasSize,g_iCanvasSize)};var b=eOk(sessionStorage.url)?'<img src="image/loading.gif" class="icon_16">':"";$("#speed_title").html('<span class="all">'+MYLANG("PageTime1")+"</span> &nbsp;"+b);$("#speed_timing").html('<div id="title_timing">'+MYLANG("PageTimings")+':</DIV><table id="tbl_timing"><thead><tr class="tr_head"><td class="td1">'+
MYLANG("PageEvent")+'</td><td class="right">'+MYLANG("PageLong")+'</td><td class="right_per">%</td></tr></thead><tbody><tr class="tr_item tr_bg1"><td class="td1" TITLE="'+MYLANG("PageRedirect")+'">'+MYLANG("PageRedirect")+':</td><td id="col_redirect" class="right"></td><td id="col_redirect_per" class="right_per"></td></tr><tr class="tr_item tr_bg2"><td class="td1" TITLE="'+MYLANG("DomainLookup")+'">'+MYLANG("DomainLookup")+':</td><td id="col_dns" class="right"></td><td id="col_dns_per" class="right_per"></td></tr><tr class="tr_item tr_bg1"><td class="td1" TITLE="'+
MYLANG("PageRedirect")+'">'+MYLANG("PageConnect")+':</td><td id="col_connect" class="right"></td><td id="col_connect_per" class="right_per"></td></tr><tr class="tr_item tr_bg2"><td class="td1" TITLE="'+MYLANG("PageConnect")+'">'+MYLANG("PageRequest")+':</td><td id="col_request" class="right"></td><td id="col_request_per" class="right_per"></td></tr><tr class="tr_item tr_bg1"><td class="td1" TITLE="'+MYLANG("PageRequest")+'">'+MYLANG("PageResponse")+':</td><td id="col_response" class="right"></td><td id="col_response_per" class="right_per"></td></tr><tr class="tr_item tr_bg2"><td class="td1" TITLE="'+
MYLANG("PageDOM")+'">'+MYLANG("PageDOM")+':</td><td id="col_dom" class="right"></td><td id="col_dom_per" class="right_per"></td></tr><tr class="tr_item tr_bg1"><td class="td1" TITLE="'+MYLANG("PageInteractive")+'"><div class="dom_sub">'+MYLANG("PageInteractive")+':</div></td><td id="col_interactive" class="right"></td></td><td id="col_interactive_per" class="right_per"></td></tr><tr class="tr_item tr_bg2"><td class="td1" TITLE="'+MYLANG("PageLoaded")+'"><div class="dom_sub">'+MYLANG("PageLoaded")+
':</div></td><td id="col_loaded" class="right"></td><td id="col_loaded_per" class="right_per"></td></tr><tr class="tr_item tr_bg1"><td class="td1" TITLE="'+MYLANG("PageLoadEvt")+'">'+MYLANG("PageLoadEvt")+':</td><td id="col_loadevt" class="right"></td><td id="col_loadevt_per" class="right_per"></td></tr><tr class="tr_item tr_bg2"><td class="td1"></td><td></td><td></td></tr></tbody></table><div id="pingbtn"><div id="ping"><a href="http://ping.chromefans.org/" title="'+MYLANG("Free_ping")+'" target=_blank>'+
MYLANG("Free_ping")+"</a></div></div>")}function CheckSpeedReady(){void 0==sessionStorage.status_pagespeed_ok||0==sessionStorage.status_pagespeed_ok?setTimeout(CheckSpeedReady,1E3):ShowSpeedValue()}
function ShowSpeedValue(){var a=sessionStorage.domain;if(eOk(sessionStorage.url)&&""!=a){var b=26<a.length?a.substr(0,23)+"...":a;$("#ping").html('<a href="http://ping.chromefans.org/?q='+a+'" title="ping '+a+'" target=_blank>ping '+b+"</a>")}a=0==sessionStorage.redirectStart?sessionStorage.fetchStart:sessionStorage.redirectStart;g_iTotal=sessionStorage.loadEventEnd-a;var c=String((g_iTotal/1E3).toPrecision(3)).substring(0,4),b="fil"==MYLANG("id")?"fil":"all";$("#speed_title").html('<span class="'+
b+'">'+MYLANG("PageTime1")+" "+MYLANG("PageTime2").replace("%NUM%",'<span id="speed_num">'+c+"</span>")+"</span>");var d=GetSpeedLevelImg(c);$("#speed_rate").html(d.img);var b=GetSlowerRate(c),f=50<=b?MYLANG("PageSpeedSlower"):MYLANG("PageSpeedFaster"),g="";50>b&&(g=" "+MYLANG("PageSlowInfo").replace("%LINK%",'<a href="http://topwebhosting.chromefans.org/?ref=ext-pr-speed" target=_blank>'));d=d.txt+", "+f.replace("%NUM%",(50<=b?b:100-b)+"%")+g;50>b?$("#speed_per").html(d):$("#speed_per").html('<div class="speed_per_fast">'+
d+"</div>");ShowEvent("redirect",a,sessionStorage.redirectStart,sessionStorage.redirectEnd,0);ShowEvent("dns",a,sessionStorage.domainLookupStart,sessionStorage.domainLookupEnd,0);ShowEvent("connect",a,sessionStorage.connectStart,sessionStorage.connectEnd,0);ShowEvent("request",a,sessionStorage.requestStart,sessionStorage.responseStart,0);ShowEvent("response",a,sessionStorage.responseStart,sessionStorage.responseEnd,0);ShowEvent("dom",a,sessionStorage.domLoading,sessionStorage.domComplete,0);0<sessionStorage.domInteractive?
ShowEvent("interactive",a,sessionStorage.domInteractive,sessionStorage.domContentLoadedEventStart,1):ShowEvent("interactive",a,0,0,1);ShowEvent("loaded",a,sessionStorage.domContentLoadedEventStart,sessionStorage.domContentLoadedEventEnd,1);ShowEvent("loadevt",a,sessionStorage.loadEventStart,sessionStorage.loadEventEnd,0);var e=document.getElementById("imagearea").getContext("2d"),h=new Image;h.src="image/logo-speed-point.png";h.onload=function(){var a=GetRotate(c);e.save();e.drawImage(g_xImgBk,0,
0,g_iCanvasSize,g_iCanvasSize);e.translate(99,93);e.rotate(a*Math.PI/180);e.drawImage(h,0,0,g_iCanvasSize,g_iCanvasSize,-99,-93,g_iCanvasSize,g_iCanvasSize);e.restore()}}
function GetRotate(a){var b={"0.0":225,"0.2":235,"0.4":245,"0.6":255,"0.8":264,"1.0":273,"1.8":280,"2.6":290,"3.4":300,"4.2":310,"5.0":318,"6.0":326,"7.0":334,"8.0":342,"9.0":352,"10.0":360,"11.0":368,"12.0":376,"13.0":385,"14.0":393,"15.0":402,"16.0":410,"17.0":419,"18.0":428,"19.0":436,"20.0":445,"21.0":454,"22.0":463,"23.0":472,"24.0":482,"25.0":493},c=0,d=b[c],f=0,g=0,e;for(e in b){if(parseFloat(e)>parseFloat(a)){f=e;g=b[f];break}c=e;d=b[e]}if(0==f)return d;a=(parseFloat(a)-parseFloat(c))/(parseFloat(f)-
parseFloat(c));return parseFloat(d)+a*(parseFloat(g)-parseFloat(d))}function ShowEvent(a,b,c,d,f){b=d>=c&&0<c?d-c:"-";document.getElementById("col_"+a).innerHTML="-"==b?"-":FormatNum(b);c="-";f||"-"==b||(c=0==b?"0%":1<100*b/g_iTotal?(100*b/g_iTotal).toFixed(0)+"%":(100*b/g_iTotal).toFixed(1)+"%");document.getElementById("col_"+a+"_per").innerHTML=c}function GetSpeedLevel(a){return a<g_arrLoadTime[20]?0:a<g_arrLoadTime[40]?1:a<g_arrLoadTime[70]?2:a<g_arrLoadTime[90]?3:4}
function GetSpeedLevelImg(a){for(var b={"0":'<span class="fast">'+MYLANG("PageLevel1")+"</span>",1:'<span class="fast">'+MYLANG("PageLevel2")+"</span>",2:'<span class="average">'+MYLANG("PageLevel3")+"</span>",3:'<span class="slow">'+MYLANG("PageLevel4")+"</span>",4:'<span class="slow">'+MYLANG("PageLevel5")+"</span>"},a=GetSpeedLevel(a),c="",d=0;d<5-a;d++)c+='<img src="image/icon-star-light.png" class="icon_star" ALT="">';for(d=0;d<a;d++)c+='<img src="image/icon-star-dark.png" class="icon_star" ALT="">';
return{img:c,txt:b[a]}}function GetSlowerRate(a){for(var b in g_arrLoadTime)if(g_arrLoadTime[b]>=a)return 100-b;return 1};
