var GetSearchArr = [1,2,3,4,5,6,7,11,12,13,14,15,16,17,21];
var GetReg=new Array(15);
var GetResult=new Array(15);
var GUrl;
var urls=document.location.search;
var arr=urls.split("&");
for(var i=0;i<arr.length;i++){
    var ar=arr[i].split("=");
    if(ar[0]=="?S"){
        GUrl=ar[1];
    }
}

function GQuery(){
    for (i = 0; i < GetSearchArr.length; i++) {
        getNews(GetSearchArr[i],"Js/Search.php?S="+GUrl+"&T="+GetSearchArr[i])
    }
}

function getNews(gid,url){
    var ajax = InitAjax();
    ajax.open("GET", url, true);
    ajax.onreadystatechange = function() {
        if (ajax.readyState == 4 && ajax.status == 200) {
            switch (gid)
            {
                case 1:
                    document.getElementById("GoogleCount").innerHTML=ajax.responseText;
                    break;
                case 2:
                    document.getElementById("BaiduCount").innerHTML=ajax.responseText;
                    break;
                case 3:
                    document.getElementById("BingCount").innerHTML=ajax.responseText;
                    break;
                case 4:
                    document.getElementById("YahooCount").innerHTML=ajax.responseText;
                    break;
                case 5:
                    document.getElementById("SosoCount").innerHTML=ajax.responseText;
                    break;
                case 6:
                    document.getElementById("YoudaoCount").innerHTML=ajax.responseText;
                    break;
                case 7:
                    document.getElementById("SogouCount").innerHTML=ajax.responseText;
                    break;
                case 11:
                    document.getElementById("GoogleLCount").innerHTML=ajax.responseText;
                    break;
                case 12:
                    document.getElementById("BaiduLCount").innerHTML=ajax.responseText;
                    break;
                case 13:
                    document.getElementById("BingLCount").innerHTML=ajax.responseText;
                    break;
                case 14:
                    document.getElementById("YahooLCount").innerHTML=ajax.responseText;
                    break;
                case 15:
                    document.getElementById("SosoLCount").innerHTML=ajax.responseText;
                    break;
                case 16:
                    document.getElementById("YoudaoLCount").innerHTML=ajax.responseText;
                    break;
                case 17:
                    document.getElementById("SogouLCount").innerHTML=ajax.responseText;
                    break;
                case 21:
                    document.getElementById("SogouPCount").innerHTML=ajax.responseText;
                    break;
            }
        }
    }
    ajax.send(null);
}

function InitAjax(){
    var ajax=false;
    try {
        ajax = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
        try {
            ajax = new ActiveXObject("Microsoft.XMLHTTP");
        } catch (E) {
            ajax = false;
        }
    }
    if (!ajax && typeof XMLHttpRequest!='undefined') {
        ajax = new XMLHttpRequest();
    }
    return ajax;
}

GQuery();