document.addEventListener("DOMContentLoaded",function(){CheckRTL();PageRank_ShowItems();CheckSelectedTab()});function CheckRTL(){IsRTL()&&(document.body.style.direction="rtl")}
function PageRank_ShowItems(){var a,b={"0":"tf_alexa",1:"tf_alexa_cnt",2:"tf_compete",3:"tf_quantcast"};a='<table id="table_2cols"><tr><td class="top col">'+GetTrafficImg(b,"TrafficGraphs","trafficgraphs",0);a=a+'<div class="report_space"></div>'+GetGroupItems(b,"Traffic","traffic",0);a+="</td></tr></table>";$("#content").html(a);$("#f_traffic_type").change(OnUpdateTrafficGraph)}
function CheckSelectedTab(){if(""!=sessionStorage.url){for(var a in g_arrSites)"traffic"==g_arrSites[a].tab&&AjaxUpdate(a,0);OnUpdateTrafficGraph()}}function GetTrafficImg(){return GetReportHead(MYLANG("TrafficGraphs"),"trafficgraphs")+ShowTrafficGraphs()+GetReportTail()}
function OnUpdateTrafficGraph(){$("#traffic_img_target").attr("src","image/loading-big-2b.gif");var a=parseInt($("#f_traffic_type").attr("value")),b="http://traffic.alexa.com/graph?&w=295&h=160&o=f&y=t&r=6m&u="+sessionStorage.host,d="icon_tr_alexa";switch(a){case 1:b="http://traffic.alexa.com/graph?o=f&w=510&h=185&y=u&r=6m&u="+sessionStorage.host;break;case 2:b="http://traffic.alexa.com/graph?o=f&w=510&h=185&y=r&r=6m&u="+sessionStorage.host;break;case 3:b="http://traffic.alexa.com/graph?o=f&w=510&h=185&y=t&r=2y&u="+
sessionStorage.host;break;case 4:b="http://traffic.alexa.com/graph?o=f&w=510&h=185&y=t&r=6m&u="+sessionStorage.host;break;case 5:b="http://traffic.alexa.com/graph?o=f&w=510&h=185&y=q&r=6m&u="+sessionStorage.host;break;case 6:b="https://siteanalytics.compete.com/embed_chart/"+sessionStorage.host+"/small/?source_panel=us",d="icon_tr_compete"}$("#traffic_img_target").attr("src",b);$("#traffic_img_target").attr("class",d);localStorage.config_traffic_imgtype=a}
function ShowTrafficGraphs(){var a=void 0==localStorage.config_traffic_imgtype?4:localStorage.config_traffic_imgtype;return'<div id="traffic_ctrl"><select id="f_traffic_type">  <option value="1"'+(1==a?" selected":"")+">"+MYLANG("AlexaPV")+'</option>  <option value="2"'+(2==a?" selected":"")+">"+MYLANG("AlexaDR")+'</option>  <option value="3"'+(3==a?" selected":"")+">"+MYLANG("AlexaDTRT")+" ("+MYLANG("2years")+')</option>  <option value="4"'+(4==a?" selected":"")+">"+MYLANG("AlexaDTRT")+" ("+MYLANG("6months")+
')</option>  <option value="5"'+(5==a?" selected":"")+">"+MYLANG("AlexaSV")+'</option>  <option value="6"'+(6==a?" selected":"")+">"+MYLANG("CompeteUV")+'</option>  </select>  <\!-- input type="submit" name="" value="" id="f_traffic_btn" onclick="OnUpdateTrafficGraph();" --\>  </div>  <div id="traffic_img"><img id="traffic_img_target" src="image/icon-blank.png"></div>  '};function GetGroupItems(a,b,d,e){var c="",f=0,h=0,g="",i;for(i in a)0<f&&e&&(c+='</table><table id="tbl_'+d+f+'" class="report_tbl">'),g=GetReportItem(a[i],h),""!=g&&h++,c+=g,f++;""!=c&&(c=GetReportHead(MYLANG(b),d)+c+GetReportTail());return c}function GetReportHead(a,b){return'<div id="h_'+b+'" class="report_title"><div class="report_title_txt">'+a+'</div></DIV><div class="report_items"><table id="tbl_'+b+'" class="report_tbl">'}function GetReportTail(){return"</table></div>"}
function GetReportItem(a,b){if(""==a)return'<tr class="'+(0==b?"noborder ":"")+(b%2?"tr_b":"tr_a")+'"><td colspan=3></td></tr>';if(!g_arrSites[a])return"";var d=g_arrSites[a],e="td_2",c="td_3";"rank_ggpr"==a||"rank_alexa"==a||"rank_compete"==a?(e="td_2_gg",c="td_3_gg"):"domain_dns"==a||"domain_dns2"==a||"geoip_ip2"==a||"geoip_city2"==a||"geoip_ip"==a||"geoip_city"==a||"geoip_country"==a||"geoip_country2"==a?(e="td_2_ip",c="td_3_ip"):"ch_google"==a||"ch_archive"==a?(e="td_2_ch",c="td_3_ch"):"traffic"==
g_arrSites[a].tab&&(e="td_2_tf",c="td_3_tf");var f=MYLANG(d.text_id),d=""==d.tip_id?f:f+"("+MYLANG(d.tip_id)+")";return'<tr class="'+(0==b?"noborder ":"")+(b%2?"tr_b":"tr_a")+'" id="tr_'+a+'">    <td class="td_1" title="'+d+'"><div id="img_'+a+'" class="imgicon"></div></td>    <td class="'+e+'" title="'+d+'"><div class="'+e+'_txt" id="lnk_'+a+'" >'+f+'</div></td>    <td class="'+c+'" id="val_'+a+'"><div id="'+a+'" class="'+c+'_txt" ></div></td>    </tr>'};
