<%@ Page Title="" Language="C#" MasterPageFile="~/BackStage/HelperMaster.Master" AutoEventWireup="true" CodeBehind="Frm_BtypeMap.aspx.cs" Inherits="AndroidSevice.Web.WLTGL.Frm_BtypeMap" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <style type="text/css">
		body, html,#allmap {width: 100%;height: 100%;overflow: hidden;margin:0;font-family:"微软雅黑";}
	</style>
	<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=8cb299725cff45869425b1bbdae988aa"></script>
    <script type="text/javascript">
        function sAlert(info) {
            var message = info;
            layer.alert(message, 8); //风格一，layer弹出层特效
        }
        function sAlerts(info, reltype) {
            var message = info;
            var realtype = reltype
            layer.alert(message, 8); //风格一，layer弹出层特效
            if (realtype == 'true') {
                parent.location.reload(); //刷新父页面
            }
        }
        // 百度地图API功能
        var map = new BMap.Map("allmap");
        var point; //;
        map.centerAndZoom(point, 12);
        // 创建地址解析器实例
        // 将地址解析结果显示在地图上,并调整地图视野
        function Geocode(result, btpeid) {
           // alert(result);
            var index = 0;
            var pointstring = "123";
            var myGeo = new BMap.Geocoder();
            var results = result.split(',');
            var btpeids = btpeid.split(',');
            for (var i = 0; i < results.length; i++) {
                myGeo.getPoint(results[i], function (point) {
                    if (point) {
                        //alert(point.lng + ":" + point.lat);
                        pointstring = point.lng + ":" + point.lat + ":" + btpeids[index];
                        postdata(pointstring);
                    }
                    else {
                        // alert(results[index] + ":地址无法解析！");
                        // window.external.ShowMessage(":" + ";" + btpeids[index++]);
                        // pointstring = "::" + btpeids[index++];
                        // postdata(pointstring);
                        index;
                    }
                    index++;
                }, "");
            }
        }

        function postdata(pointstring) {
            //$.post("PtypeShopingListPage.aspx",
            //{
            //    WeiXinID: wxid,
            //    ptypeid: ptypeid,
            //    ptypenum: $("#text_box" + textvalue).val(),
            //    ptypejftotal: $("#total" + textvalue).text()
            //})

            //接收表单的URL地址  
            var url = "Frm_BtypeMap.aspx";
            //需要POST的值，把每个变量都通过&来联接  
            var postStr = "pointstring=" + pointstring + "&sub=jxvalue";
            //实例化Ajax  
            //var ajax = InitAjax();  

            var ajax = false;
            //开始初始化XMLHttpRequest对象  
            if (window.XMLHttpRequest) { //Mozilla 浏览器  
                ajax = new XMLHttpRequest();
                if (ajax.overrideMimeType) {//设置MiME类别  
                    ajax.overrideMimeType("text/xml");
                }
            }
            else if (window.ActiveXObject) { // IE浏览器  
                try {
                    ajax = new ActiveXObject("Msxml2.XMLHTTP");
                } catch (e) {
                    try {
                        ajax = new ActiveXObject("Microsoft.XMLHTTP");
                    } catch (e) { }
                }
            }
            if (!ajax) { // 异常，创建对象实例失败  
                window.alert("不能创建XMLHttpRequest对象实例.");
                return false;
            }

            //通过Post方式打开连接  
            ajax.open("POST", url, false);

            //定义传输的文件HTTP头信息  
            ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");

            //发送POST数据  
            ajax.send(postStr);

            //获取执行状态  
            //ajax.onreadystatechange = function () {
            //    //如果执行状态成功，那么就把返回信息写到指定的层里  
            //    if (ajax.readyState == 4 && ajax.status == 200) {
            //        msg.innerHTML = ajax.responseText;
            //    }
            //}
        }
</script>
</asp:Content> 
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div class="container-fluid">
				<div class="row-fluid">
					<div class="span12">
						<div class="widget-box">
							<div class="widget-title">
								<span class="icon">
									<i class="icon-th-list"></i>
								</span>
								<h5>地址解析</h5>
							</div>
							<div class="widget-content">
                            <button type="submit" name="sub" value="sub" class="btn"><i class="icon-hdd"></i>地址解析</button>
                             <table id="wew" class="table table-bordered table-striped table-hover">
                                    <tbody>
                                    <tr>
                                        <td>
                                        <div id="allmap"></div>
                                        </td>
									</tr>
                                    </tbody>
							</table>
							</div>
						</div>
					</div>
				</div>
			</div>
<input id="HBtypeid" type="hidden" runat="server" />
<input id="HResults" type="hidden" runat="server" />
</asp:Content>
