function OnLoadHistory(){$("#a_pop_pp").click(function(){OpenDonate()});SetLinkActions({a_pop_sami:{type:"link",sel:0,url:"http://www.6sto.com/"},a_pop_azure:{type:"link",sel:1,url:"http://www.tkqlhce.com/click-6311780-11230467?sid=azure-pop"},a_pop_dropbox:{type:"link",sel:0,url:"https://db.tt/f0MjKM1l"},a_pop_history:{type:"link",sel:0,url:"http://pagerank.chromefans.org/updates/?ref=ext-pr"}})}
var g_xReqDB=0,g_xDB=0,g_arrStatsType={domain_dns:{type:1,key:"dn"},domain_dns2:{type:1,key:"d2"},tf_compete:{type:1,key:"tp"},geoip_ip:{type:2,key:"gi"},geoip_city:{type:2,key:"gt"},geoip_country:{type:2,key:"gc"},geoip_code:{type:2,key:"gd"},bl_alexa:{type:2,key:"la"},tf_alexa:{type:2,key:"ta"},tf_alexa_cnt_code:{type:2,key:"td"},tf_alexa_cnt_name:{type:2,key:"tn"},tf_alexa_cnt:{type:2,key:"tc"},tf_quantcast:{type:2,key:"tq"},on_robots:{type:2,key:"or"},on_sitemap:{type:2,key:"os"},idx_bing:{type:2,
key:"ib"},idx_baidu:{type:2,key:"ia"},idx_goo:{type:2,key:"ig"},idx_google:{type:2,key:"il"},idx_sogou:{type:2,key:"is"},idx_soso:{type:2,key:"io"},idx_yandex:{type:2,key:"iy"},idx_360:{type:2,key:"i3"},bl_google_w:{type:2,key:"lg"},bl_sogou:{type:2,key:"ls"},sec_norton:{type:2,key:"en"},sec_siteadv:{type:2,key:"es"},sec_wot:{type:2,key:"ew"},sns_facebook:{type:3,key:"nf"},sns_ggplus:{type:3,key:"ng"},sns_twitter:{type:3,key:"nt"},sns_stumbles:{type:3,key:"ns"},sns_delicious:{type:3,key:"nd"},ch_archive:{type:3,
key:"ca"},ch_google:{type:3,key:"cg"},rank_ggpr:{type:3,key:"rg"}};
document.addEventListener("DOMContentLoaded",function(){CheckVersion();LoadLangToStorage();sessionStorage.status_cache_db_1=sessionStorage.status_cache_db_2=sessionStorage.status_cache_db_3=0;sessionStorage.status_cache_remote_1=sessionStorage.status_cache_remote_2=sessionStorage.status_cache_remote_3=0;sessionStorage.status_pageinfo_ok=0;sessionStorage.status_pagespeed_ok=0;sessionStorage.status_nowtime=Date.parse(new Date)/1E3;chrome.tabs.getSelected(null,function(a){SaveSession(a.id,a.url,a.title);
InitDatabaseAndCache();window.setTimeout(function(){InitPageRankPage()},1100)});CheckRTL();ShowFrame();ShowTopLinks();ShowTabLinks();ShowOtherRes();OpenHistoryOnce()});
function OpenHistory(){var a=MYLANG("id"),a=void 0==g_arrHistry[a]?g_arrHistry.en:g_arrHistry[a];$("#pop_history").html('<div id="h2_new">'+MYLANG("History_New")+"</div>"+a+'<a id="close_x" class="close sprited" href="#" title="'+MYLANG("Close")+'"></a>');$("#pop_history").lightbox_me({centered:!0,onLoad:function(){OnLoadHistory()}})}
function OpenHistoryOnce(){if((void 0==localStorage.version_show?"":localStorage.version_show)!=g_strShowHistory)localStorage.version_show=g_strShowHistory,OpenHistory()}
function OpenDonate(){$("#pop_donate").html('<h2 id="h2_new">'+MYLANG("Donate")+'</h2>    <div class="pop_subject">'+MYLANG("DonateTxt")+'</div>    <div class="pop_items">      <ul>        <li><b>'+MYLANG("DonatePaypal")+'</b>:<br><a href="#" id="a_pop_pp2" title="'+MYLANG("DonatePaypal")+'"><img src="image/paypal.png" width=100 height=40 alt="" id="img_paypal"></a></li>        <li><b>'+MYLANG("DonateBitcoin")+"</b>, "+MYLANG("DonateSend")+': <br>          <div id="bitcion_adr">1GdR8k5tJ5uMAGavnW3UEALdPvZYftrUhs</div></li>      </ul>    </div>    <a id="close_x2" class="close sprited" href="#" title="'+
MYLANG("Close")+'"></a>  ');$("#pop_donate").lightbox_me({centered:!0,onLoad:function(){OnLoadDonate()}})}function OnLoadDonate(){var a={a_pop_pp2:{type:"link",sel:1,url:GetPaypalLink("paypal@chromefans.org","EXT-PR","Donate for PageRank Status")}};SetLinkActions(a)}
function CheckRTL(){IsRTL()&&(document.body.style.direction="rtl",$("#out1").attr("class","outRTL"),$("#out2").attr("class","outRTL"),$("#out3").attr("class","outRTL"),$("#out4").attr("class","outRTL"),$("#out5").attr("class","outRTL"),$("#out6").attr("class","outRTL"),$("#out7").attr("class","outRTL"),$("#out8").attr("class","outRTL"),$("#out9").attr("class","outRTL"),$("#out10").attr("class","outRTL"),$("#space_out").attr("class","shadowRTL"))}
function ShowTopLinks(){$("#title_info").html('<div id="title_h1">PageRank Status</div><div id="title_desc">'+MYLANG("ChromeSeobar")+"</div>")}
function ShowTabLinks(){var a=GetConfig("config_firstopen","seostats"),b={seostats:{txt:"SEOStats",tips:"SEOStats"},traffic:{txt:"TrafficStats",tips:"TrafficStats"},siteinfo:{txt:"PageSite",tips:"PageSite"},pageinfo:{txt:"PageInfo",tips:"PageInfo"},links:{txt:"LinksStats",tips:"LinksStats"},pagespeed:{txt:"PageSpeed",tips:"PageSpeed"},webtools:{txt:"Tools",tips:"WebmasterTools"},options:{txt:"Options",tips:"Options"},history:{txt:"History",tips:"History"},donate:{txt:"Donate",tips:"Donate"}},c;for(c in b)$("#lbl_"+
c).html(MYLANG(b[c].txt)),$("#btn_"+c).attr("title",MYLANG(b[c].tips));$("#btn_seostats").click(function(){ActiveTab("seostats")});$("#btn_traffic").click(function(){ActiveTab("traffic")});$("#btn_siteinfo").click(function(){ActiveTab("siteinfo")});$("#btn_pageinfo").click(function(){ActiveTab("pageinfo")});$("#btn_links").click(function(){ActiveTab("links")});$("#btn_pagespeed").click(function(){ActiveTab("pagespeed")});$("#btn_webtools").click(function(){ActiveTab("webtools")});$("#btn_options").click(function(){OpenOptions()});
$("#btn_history").click(function(){OpenHistory()});$("#btn_donate").click(function(){OpenDonate()});ActiveTab(a)}function OpenOptions(){t_strURL=MyExtURL("options.html");chrome.tabs.create({url:t_strURL,selected:!0})}function ActiveTab(a){ShowTab("seostats","seostats"==a);ShowTab("traffic","traffic"==a);ShowTab("siteinfo","siteinfo"==a);ShowTab("pageinfo","pageinfo"==a);ShowTab("links","links"==a);ShowTab("pagespeed","pagespeed"==a);ShowTab("webtools","webtools"==a)}
function ShowTab(a,b){GetCtrl("btn_"+a).className=b?"active":"normal";GetCtrl("page_"+a).className=b?"":"noshow"}
function ShowFrame(){$("#page_seostats").html('<div id="loading_out"><div id="loading"><img src="image/loading-big-2b.gif" ALT=""></div></div>');$("#page_traffic").html('<div id="loading_out"><div id="loading"><img src="image/loading-big-2b.gif" ALT=""></div></div>');$("#page_siteinfo").html('<div id="loading_out"><div id="loading"><img src="image/loading-big-2b.gif" ALT=""></div></div>');$("#page_pageinfo").html('<div id="loading_out"><div id="loading"><img src="image/loading-big-2b.gif" ALT=""></div></div>');
$("#page_links").html('<div id="loading_out"><div id="loading"><img src="image/loading-big-2b.gif" ALT=""></div></div>');$("#page_pagespeed").html('<div id="loading_out"><div id="loading"><img src="image/loading-big-2b.gif" ALT=""></div></div>');$("#page_webtools").html('<div id="loading_out"><div id="loading"><img src="image/loading-big-2b.gif" ALT=""></div></div>')}
function InitPageRankPage(){$("#page_seostats").html('<IFRAME src="frame-seostats.html" scrolling="YES" id="frame_seostats" class="framepage"></frame>');$("#page_traffic").html('<IFRAME src="frame-traffic.html" scrolling="YES" id="frame_traffic" class="framepage"></frame>');$("#page_siteinfo").html('<IFRAME src="frame-siteinfo.html" scrolling="YES" id="frame_siteinfo" class="framepage"></frame>');$("#page_pageinfo").html('<IFRAME src="frame-pageinfo.html" scrolling="YES" id="frame_pageinfo" class="framepage"></frame>');
$("#page_links").html('<IFRAME src="frame-links.html" scrolling="YES" id="frame_links" class="framepage"></frame>');$("#page_pagespeed").html('<IFRAME src="frame-pagespeed.html" scrolling="YES" id="frame_pagespeed" class="framepage"></frame>');$("#page_webtools").html('<IFRAME src="frame-webtools.html" scrolling="YES" id="frame_webtools" class="framepage"></frame>');""!=sessionStorage.url&&chrome.tabs.executeScript(null,{file:"jsr/en_content.js"});GetSpeedValues();CheckDomainSession();CheckHostSession();
CheckPageSession();CheckAllSession()}
function ShowOtherRes(){var a={"0":{link_id:"azuretxt",img_ico:"icon-azure.png",en:{url:"http://www.tkqlhce.com/click-6311780-11230467?sid=azure-txt-en",txt:'<span class="r">Windows Azure</span> 90 day free trial',tips:"Windows Azure 90 day free trial: Quickly build, deploy & manage applications;  Use any operating system, language or tool; No obligation, totally free"},"zh-cn":{url:"http://www.tkqlhce.com/click-6311780-11230467?sid=azure-txt-zh-cn",txt:'\u5fae\u8f6f <span class="r">Windows Azure</span> \u4e91\u4e3b\u673a\u514d\u8d39\u8bd5\u7528',tips:"Windows Azure \u5fae\u8f6f\u4e91\u8ba1\u7b97\u4e3b\u673a, \u514d\u8d39\u8bd5\u7528\uff0c\u53ef\u5b89\u88c5\u7ba1\u7406\u4efb\u4f55\u64cd\u4f5c\u7cfb\u7edf\u3001\u5f00\u53d1\u8bed\u8a00\u548c\u5de5\u5177"},
"zh-tw":{url:"http://www.tkqlhce.com/click-6311780-11230467?sid=azure-txt-zh-tw",txt:'<span class="r">Windows Azure</span> \u96f2\u7aef\u670d\u52d9\u514d\u8cbb\u8a66\u7528',tips:"Windows Azure \u96f2\u7aef\u670d\u52d9\u514d\u8cbb\u8a66\u7528\uff0c\u64c1\u6709\u5b8c\u6574\u5b58\u53d6\u6b0a\uff0c\u6c92\u6709\u4efb\u4f55\u9644\u52a0\u689d\u4ef6"}},1:{link_id:"bluehost",img_ico:"icon-bluehost.png",en:{url:"http://www.bluehost.com/track/chromefans/bluehost-en",txt:'Bluehost <span class="r">Unlimited Hosting</span> for $4.95/mo',
tips:"Bluehost Web Hosting for $4.95/mo, UNLIMITED Domain Hosting, UNLIMITED GB Hosting Space, No Hidden Fees, Anytime Money-Back Guarantee"},"zh-cn":{url:"http://www.bluehost.com/track/chromefans/bluehost-zh-cn",txt:'\u7f8e\u56fd Bluehost <span class="r">\u65e0\u9650\u4e3b\u673a</span>\u6bcf\u6708 $4.95',tips:"\u7f8e\u56fd Bluehost \u65e0\u9650\u4e3b\u673a\u6bcf\u6708 $4.95\uff0c\u65e0\u9644\u52a0\u8d39\u7528\uff0c\u53ef\u968f\u65f6\u7533\u8bf7\u9000\u6b3e"},"zh-tw":{url:"http://www.bluehost.com/track/chromefans/bluehost-zh-tw",
txt:'\u7f8e\u570b Bluehost <span class="r">\u7121\u9650\u4e3b\u6a5f</span>\u6bcf\u6708 $4.95',tips:"\u7f8e\u570b Bluehost \u7121\u9650\u4e3b\u6a5f\u6bcf\u6708$4.95\uff0c\u7121\u9644\u52a0\u8cbb\u7528\uff0c\u53ef\u96a8\u6642\u7533\u8acb\u9000\u6b3e"}},2:{link_id:"greengeek",img_ico:"icon-greengeek.png",en:{url:"http://www.greengeeks.com/cgi-bin/affiliates/clickthru.cgi?id=chromefans&campaign=ext_pr_txt_en",txt:'<span class="g8">Green Web Hosting</span>: Starting at <span class="r">$4.95</span>',tips:"GREEN WEB HOSTING: Starting at $4.95, Unlimited Space, Unlimited Bandwidth"},
"zh-cn":{url:"http://www.greengeeks.com/cgi-bin/affiliates/clickthru.cgi?id=chromefans&campaign=ext_pr_txt_zh_cn",txt:'\u7f8e\u56fd GreenGeek <span class="r">\u65e0\u9650\u4e3b\u673a</span>\u6bcf\u6708 $4.95',tips:"\u7f8e\u56fd GreenGeek \u7eff\u8272\u4e3b\u673a\u6bcf\u6708 $4.95\uff0c\u65e0\u9650\u7a7a\u95f4\uff0c\u65e0\u9650\u6d41\u91cf, \u65e0\u9644\u52a0\u8d39\u7528\uff0c30\u5929\u9000\u6b3e\u4fdd\u8bc1"},"zh-tw":{url:"http://www.greengeeks.com/cgi-bin/affiliates/clickthru.cgi?id=chromefans&campaign=ext_pr_txt_zh_tw",
txt:'\u7f8e\u570b GreenGeek <span class="r">\u7121\u9650\u4e3b\u6a5f</span>\u6bcf\u6708 $4.95',tips:"\u7f8e\u570b GreenGeek \u7da0\u8272\u4e3b\u6a5f\u6bcf\u6708$4.95\uff0c\u7121\u9650\u7a7a\u9593\uff0c\u7121\u9650\u6d41\u91cf, \u7121\u9644\u52a0\u8cbb\u7528\uff0c30\u5929\u9000\u6b3e\u4fdd\u8b49"}},3:{link_id:"digitalnetmarketing",img_ico:"icon-digitalnetmarketing.png",en:{url:"http://www.digitalnetmarketing.net/?page_id=&wpam_refkey=EjHsUZm75,NqyBsrhTUhs8NoWbC00000000000",txt:'WordPress <span class="r">Blog Hosting</span>',
tips:"Professional Web Design, Hosting and Social Media Marketing Services"},"zh-cn":{url:"http://www.digitalnetmarketing.net/?page_id=&wpam_refkey=EjHsUZm75,NqyBsrhTUhs8NoWbC00000000000",txt:'\u7f8e\u56fd WordPress \u4e13\u4e1a<span class="r">\u535a\u5ba2\u4e3b\u673a</span>',tips:"\u7f8e\u56fd\u4e13\u4e1a\u7f51\u7ad9\u8bbe\u8ba1\u3001\u4e3b\u673a\u548cSNS\u8425\u9500\u670d\u52a1\u63d0\u4f9b\u5546"},"zh-tw":{url:"http://www.digitalnetmarketing.net/?page_id=&wpam_refkey=EjHsUZm75,NqyBsrhTUhs8NoWbC00000000000",
txt:'\u7f8e\u570b WordPress <span class="r">\u90e8\u843d\u683c\u4e3b\u6a5f</span>',tips:"\u7f8e\u570b\u5c08\u696d\u7db2\u7ad9\u8a2d\u8a08\u3001\u4e3b\u6a5f\u548cSNS\u71df\u92b7\u670d\u52d9\u63d0\u4f9b\u5546"}}},b=sessionStorage.status_nowtime%4,c=4==b+1?0:b+1,b=GetAD(a[b]),a=GetAD(a[c]),c=GetLink("a_translate","Help translate into your language","Help translate into your language","a_translate_img","icon-translate.png","icon_16",0),d=GetLink("a_rateit",MYLANG("RateIt"),MYLANG("RateIt"),"a_rateit_img",
"icon-rate.png","icon_16",0),e=GetLink("a_feedback",'<span class="">pr@chromefans.org</span>',MYLANG("Feedback")+": pr@chromefans.org","a_feedback_img","icon-email16.png","icon_16",0);$("#other_res").html('<table>    <tr>      <td class="otd1" rowspan="2"><a href="#" id="a_facebook" title="Like us on Facebook"><img src="image/lnk-facebook.png" ALT="" width=44 height=44></a></td>      <td class="otd2 feedback">'+e+'</td>      <td class="otd_space" rowspan="2"><div class="space_top"></div><div class="space_bottom"></div></td>      <td class="otd3">'+
d+'</td>      <td class="otd_space" rowspan="2"><div class="space_top"></div><div class="space_bottom"></div></td>      <td class="otd4">'+b.link+'</td>    </tr>    <tr>      <td>    <a href="http://pagerank.chromefans.org/?ref=ext_pr" target=_blank title="http://pagerank.ChromeFans.org" title="Support site"><div id="sns_site" class="sns_follow"></div></a>    <a href="http://g.chromefans.org/?ref=ext_pr" target=_blank title="Follow us on Google Plus"><div id="sns_ggplus" class="sns_follow"></div></a>    <a href="https://twitter.com/#!/lovechrome" target=_blank title="Follow us on Twitter"><div id="sns_twitter" class="sns_follow"></div></a>    <a href="http://feeds.feedburner.com/chromefans" target=_blank title="RSS Feed"><div id="sns_rss" class="sns_follow"></div></a>    <a href="http://feedburner.google.com/fb/a/mailverify?uri=chromefans" target=_blank title="Subscribe by Email"><div id="sns_email" class="sns_follow"></div></a></div></td>      <td><div id="trans_txt">'+
c+"</div></td>      <td>"+a.link+"</td>    </tr></table>");c={a_facebook:{type:"link",sel:0,url:"https://www.facebook.com/pagerankstatus"},a_feedback:{type:"mail",sel:0,url:"mailto:pr@chromefans.org"},a_donate:{type:"link",sel:1,url:GetPaypalLink("paypal@chromefans.org","EXT-PR","Donate for PageRank Status")},a_translate:{type:"link",sel:0,url:"http://www.chromefans.org/chrome-plugins/translate-chrome-pagerank.htm"},a_rateit:{type:"link",sel:0,url:"https://chrome.google.com/webstore/detail/hbdkkfheckcdppiaiabobmennhijkknn/reviews"}};
c["a_"+b.id]={type:"link",sel:1,url:b.url};c["a_"+a.id]={type:"link",sel:1,url:a.url};SetLinkActions(c);GetCtrl("a_feedback").target="_blank";GetCtrl("a_feedback_img").target="_blank"}function GetAD(a){var b=MYLANG("id"),b=void 0==a[b]?a.en:a[b],c=GetLink("a_"+a.link_id,b.txt,b.tips,"a_"+a.link_id+"_img",a.img_ico,"icon_16",0);return{id:a.link_id,url:b.url,link:c}}
function SaveSession(a,b,c){if(eOk(b)){var d=b.indexOf("#");-1!=d&&(b=b.substr(0,d));sessionStorage.id=a;sessionStorage.url=b;sessionStorage.title=c;sessionStorage.domain=GetHostOrDomain(b,0);sessionStorage.host=GetHostOrDomain(b,1)}else sessionStorage.url=""}
function LoadLangToStorage(){var a=MYLANG("id_folder")+localStorage.version_marjor+"."+localStorage.version_mini;if((void 0==localStorage.version_lang_flag?"":localStorage.version_lang_flag)!=a){localStorage.version_lang_flag=a;var b=new XMLHttpRequest;b.onload=function(){var a=JSON.parse(b.responseText),d;for(d in a)localStorage["_L_"+d]=a[d].message};b.open("GET","_locales/"+MYLANG("id_folder")+"/messages.json",!0);b.send()}}
chrome.extension.onMessage.addListener(function(a){if("getSource"==a.action&&a.url==sessionStorage.url){sessionStorage.PI_url=a.url;sessionStorage.PI_title=a.title;sessionStorage.PI_keywords=a.keywords;sessionStorage.PI_description=a.description;sessionStorage.PI_robots=a.robots;sessionStorage.PI_h1=a.h1;sessionStorage.PI_h1_len=a.h1_len;sessionStorage.PI_h2=a.h2;sessionStorage.PI_h2_len=a.h2_len;sessionStorage.PI_b=a.b;sessionStorage.PI_b_len=a.b_len;sessionStorage.PI_i=a.i;sessionStorage.PI_i_len=
a.i_len;sessionStorage.PI_alt=a.alt;sessionStorage.PI_alt_len=a.alt_len;sessionStorage.PI_body=a.body;sessionStorage.PI_body_len=a.body_len;sessionStorage.PI_link_canonical=a.link_canonical;sessionStorage.PI_link_internal=a.link_internal;sessionStorage.PI_link_internal_nofollow=a.link_internal_nofollow;sessionStorage.PI_link_external=a.link_external;sessionStorage.PI_link_external_nofollow=a.link_external_nofollow;var b,c=0,d;for(d in a.link_map)if(a.link_map.hasOwnProperty(d)){b=a.link_map[d];sessionStorage["PI_link"+
c+"_count"]=b.count;sessionStorage["PI_link"+c+"_href"]=b.href;sessionStorage["PI_link"+c+"_hostname"]=b.hostname;sessionStorage["PI_link"+c+"_nofollow"]=b.nofollow;sessionStorage["PI_link"+c+"_is_internal"]=b.is_internal;for(var e=0;e<b.count;e++)sessionStorage["PI_link"+c+"_text"+e+"type"]=b.text[e].type,sessionStorage["PI_link"+c+"_text"+e+"data"]=b.text[e].data;c++}sessionStorage.PI_link_count=c;sessionStorage.status_pageinfo_ok=1}else"getSpeed"==a.action?GetSpeedValues():"openPage"==a.action&&
ActiveTab(a.page)});function GetSpeedValues(){var a=chrome.extension.getBackgroundPage().g_arrCache[sessionStorage.id];if(void 0!=a&&a.status_pagespeed_url==sessionStorage.url){for(var b in a)sessionStorage[b]=a[b];sessionStorage.status_pagespeed_ok=1}}function CheckDomainSession(){1!=sessionStorage.status_cache_db_1&&(CheckSessionComplete(1)||setTimeout(CheckDomainSession,1100))}
function CheckHostSession(){1!=sessionStorage.status_cache_db_2&&(CheckSessionComplete(2)||setTimeout(CheckHostSession,1100))}function CheckPageSession(){1!=sessionStorage.status_cache_db_2&&(CheckSessionComplete(3)||setTimeout(CheckPageSession,1100))}
function CheckAllSession(){if(!(1==sessionStorage.status_cache_db_1&&1==sessionStorage.status_cache_db_2&&1==sessionStorage.status_cache_db_3)){var a;for(a=1;4>a;a++)if(0==sessionStorage["status_cache_db_"+a]&&0==sessionStorage["status_cache_remote_"+a]){setTimeout(CheckAllSession,1100);return}t_strReq="http://query.openadmintools.com/?v="+localStorage.version_lang_flag+"&i="+GetUID()+"&sw="+screen.width+"&sh="+screen.height;for(a=1;4>a;a++)if(0==sessionStorage["status_cache_db_"+a]&&1==sessionStorage["status_cache_remote_"+
a]){switch(a){case 1:t_strReq=t_strReq+"&d="+encodeURIComponent(sessionStorage.domain);break;case 2:t_strReq=t_strReq+"&h="+encodeURIComponent(sessionStorage.host);break;case 3:t_strReq=t_strReq+"&u="+encodeURIComponent(sessionStorage.url)}for(var b in g_arrStatsType)g_arrStatsType[b].type==a&&(t_strReq=t_strReq+"&"+g_arrStatsType[b].key+"="+encodeURIComponent(sessionStorage["remote_"+b]))}var c=new XMLHttpRequest,d=window.setTimeout(function(){c.abort()},2E4);try{c.onreadystatechange=function(){4==
c.readyState&&window.clearTimeout(d)},c.onerror=function(){window.clearTimeout(d)},c.open("GET",t_strReq,!0),c.send(null)}catch(e){window.clearTimeout(d)}}}
function CheckSessionComplete(a){for(var b in g_arrStatsType)if(g_arrStatsType[b].type==a&&void 0==sessionStorage["remote_"+b])return 0;sessionStorage["status_cache_remote_"+a]=1;if(!g_xDB)return 1;var c=t_strVal=t_strStore="";switch(a){case 1:t_strStore="DomainInfo";c="domain";t_strVal=sessionStorage.domain;break;case 2:t_strStore="SiteInfo";c="host";t_strVal=sessionStorage.host;break;case 3:t_strStore="PageInfo",c="url",t_strVal=sessionStorage.url}var d={};d[c]=t_strVal;d.time=sessionStorage.status_nowtime;
for(b in g_arrStatsType)g_arrStatsType[b].type==a&&(d[b]=sessionStorage["remote_"+b]);g_xDB.transaction([t_strStore],"readwrite").objectStore(t_strStore).put(d);return 1}
function InitDatabaseAndCache(){if(!(void 0==sessionStorage.url||""==sessionStorage.url)&&window.indexedDB)g_xReqDB=window.indexedDB.open("PRS-DB",1),g_xReqDB.onerror=function(){},g_xReqDB.onsuccess=function(a){g_xDB=a.target.result;a=GetConfig("config_cache_hours",24);0!=a&&(ExportToCache("DomainInfo",sessionStorage.domain,a,1),ExportToCache("SiteInfo",sessionStorage.host,a,2),ExportToCache("PageInfo",sessionStorage.url,a,3))},g_xReqDB.onupgradeneeded=function(a){g_xDB=a.target.result;g_xDB.createObjectStore("DomainInfo",
{keyPath:"domain"});g_xDB.createObjectStore("SiteInfo",{keyPath:"host"});g_xDB.createObjectStore("PageInfo",{keyPath:"url"})}}function ExportToCache(a,b,c,d){var e=g_xDB.transaction([a],"readwrite").objectStore(a),f=e.get(b);f.onerror=function(){SetDBToCache(0,d)};f.onsuccess=function(){void 0==f.result?SetDBToCache(0,d):sessionStorage.status_nowtime-3600*c>f.result.time?(SetDBToCache(0,d),e["delete"](b)):SetDBToCache(f.result,d)}}
function SetDBToCache(a,b){sessionStorage["status_cache_db_"+b]=0==a?0:1;if(0==a)for(var c in g_arrStatsType)g_arrStatsType[c].type==b&&(sessionStorage["cache_"+c]="");else for(c in a)sessionStorage["cache_"+c]=a[c]};
