function getAddress() {
    var address = document.getElementById("addressName").value;
    if(address.length>2){
        new WsCommonClass("GetAddressAnalyseResult", ["address", "pageSize", "pageIndex"], [address, 20, 1], queryProjectSucess, "findAddress");
    }
}

function searchRoadPage(count) {
    if(searchRoadName==null){
        return;
    }
    if(count==-1){//上一页
       if(searchRoadNameThisPage==1){
           return;
       } else {
           searchRoadNameThisPage--;//当前页减一
       }
        
    }else if (count==-2){//下一页
       if(searchRoadNameThisPage==searchRoadNameAllPage) {
           return;
       }else {
           searchRoadNameThisPage++;
       }
        
    }else if (count==-3){//尾页
        if(searchRoadNameThisPage==searchRoadNameAllPage){
            return
        }else {
            searchRoadNameThisPage=searchRoadNameAllPage;
        }
    }else if(count==0){//首页
        if(searchRoadNameThisPage==1){
            return
        }else {
            searchRoadNameThisPage=1;
        }
    }else {
        searchRoadNameThisPage=count
    }

    btClear_Click()
    new WsCommonClass("GetAddressAnalyseResult", ["address", "pageSize", "pageIndex"], [searchRoadName, 6, searchRoadNameThisPage], queryProjectSucess, "addressNamePage");
}

function queryProjectSucess(evt, keyValue) {
    var xmlUtil = new XMLUtil();
    var xmlResult = xmlUtil.stringToXml(evt[0].childNodes[0].textContent);
    if (xmlResult) {
        var xmlAddressResult = xmlResult.getElementsByTagName("Address");
        var promptLenth = xmlAddressResult.length;

        switch (keyValue) {
            case "findAddress":
                var option = "";;
                for (var i = 0; i < promptLenth; i++) {
                    var name = xmlAddressResult[i].getElementsByTagName("PoiName")[0].innerHTML;
                    option += "<option value='" + name + "'>"
                }
                document.getElementById("browsers").innerHTML = option;;
                break;
             case "addressNamePage":
                var count=xmlResult.getElementsByTagName("AnalyseStatus")[0].getElementsByTagName("MatchCount")[0].innerHTML;
                searchRoadNameAllPage=xmlResult.getElementsByTagName("AnalyseStatus")[0].getElementsByTagName("PageCount")[0].innerHTML;
                var pageIndex=xmlResult.getElementsByTagName("AnalyseStatus")[0].getElementsByTagName("PageIndex")[0].innerHTML;
                document.getElementById("roadCount").innerHTML="共"+count+"条数据";
                var td="";;
                for (var i = 0; i < promptLenth; i++) {
                    var name = xmlAddressResult[i].getElementsByTagName("PoiName")[0].innerHTML;
                    var roadType=xmlAddressResult[i].attributes.getNamedItem("TypeName").nodeValue;
                    var area=xmlAddressResult[i].getElementsByTagName("AreaName")[0].innerHTML;
                    var street=xmlAddressResult[i].getElementsByTagName("TownName")[0].innerHTML;
                    var x=parseFloat(xmlAddressResult[i].getElementsByTagName("X")[0].innerHTML);
                    var y=parseFloat(xmlAddressResult[i].getElementsByTagName("Y")[0].innerHTML);
                    showRoadPoint(x,y,name);
                    td+="<tr><td>";
                    td+="<a class='roadNameA' onclick='showRoad("+x+","+y+")'>名称："+name+"</a><br>["+roadType+"]<br>"+area+"-"+street;;
                    td+="</td></tr>";
                }
                 m_view.goTo(GraphicsLayer_myLayer.graphics);
               //  ZoomOut();
                document.getElementById("table10").innerHTML=td;
                document.getElementById("roadAllPage").innerHTML="共"+promptLenth+"条记录   分"+searchRoadNameAllPage+"页   当前第"+pageIndex+"页";

              
                break;
        }
    }
}

