function toClickStat(n,t,i,r){r?clickStat("tu=;s=p;t=sd_mapp"):clickStat("tu=;s=p;t=sd_mapl_o"+i)}$(function(){MarkCurrMenu("nearby"),Page_NearBy.Init(),Page_NearBy.Map.InitMap(),Page_NearBy.Map.SearchMap()});var Page_NearBy=window.NameSpace||{};Page_NearBy={Init:function(){try{$("#show-more").click(function(){$("#cbd-list").hasClass("h145")?($("#cbd-list").removeClass("h145"),$(this).html("收起更多商圈")):($("#cbd-list").addClass("h145"),$(this).html("展开更多商圈"))}),$(".select_option li").click(function(){var n=$(this).text();$(this).parent().siblings(".select_txt").text(n).attr("data-value",$(this).attr("data-value")),Page_NearBy.Par.BaiduMap&&Page_NearBy.Map.SearchMap()});$(".map_mask .mapinfo .map_ul li").on("click",function(){$(this).find("i").addClass("b_org").removeClass("b_hui").parent().siblings().find("i").removeClass("b_org").addClass("b_hui"),$(this).find("span").addClass("color-ff9900").removeClass("color-999").parent().siblings().find("span").removeClass("color-ff9900").addClass("color-999"),Page_NearBy.Par.BaiduMap&&Page_NearBy.Map.SearchMap()})}catch(n){}},Par:{BaiduMap:null,BaiduMapIsMoving:!0,SearchPoint_SW:null,SearchPoint_NE:null},Map:{InitMapJS:function(){try{var n=document.createElement("script");n.type="text/javascript",n.readyState?n.onreadystatechange=function(){if(n.readyState=="loaded"||n.readyState=="complete")return console.log("成功"),n.onreadystatechange=null,!0}:n.onload=function(){return console.log("成功"),!0},n.src="//api.map.baidu.com/api?v=2.0&ak=atUG2uC1wMGRoXuLlXl7FbQj",document.getElementsByTagName("head")[0].appendChild(n)}catch(t){}},InitMap:function(){var n,u,t,f,i,r;try{if(Page_NearBy.Par.BaiduMap=new BMap.Map("allmap",{enableMapClick:!1}),n=GETAO.Cookie.GetCookie("BYWCURCITY"),n){n=JSON2.parse(unescape(decodeURI(n))),!0&&(u=$("#hidHotCBDLocate_Lng").val(),t=$("#hidHotCBDLocate_Lat").val(),GETAO.IsLAOWANG(t)||GETAO.IsLAOWANG(t)?Page_NearBy.Par.BaiduMap.centerAndZoom(new BMap.Point(n.Point.Lng,n.Point.Lat),n.MLevel):Page_NearBy.Par.BaiduMap.centerAndZoom(new BMap.Point(u,t),16)),Page_NearBy.Par.BaiduMap.setCurrentCity(n.Name),Page_NearBy.Par.BaiduMap.enableScrollWheelZoom(!0),Page_NearBy.Par.BaiduMap.addControl(new BMap.ScaleControl({anchor:BMAP_ANCHOR_BOTTOM_RIGHT})),Page_NearBy.Par.BaiduMap.addControl(new BMap.NavigationControl),Page_NearBy.Par.BaiduMap.addEventListener("zoomend",function(){Page_NearBy.Map.EventChangeBaiduMapSearchPoint(Page_NearBy.Par.BaiduMap.getBounds()),Page_NearBy.Par.BaiduMap&&Page_NearBy.Map.SearchMap()}),Page_NearBy.Par.BaiduMap.addEventListener("moveend",function(){Page_NearBy.Par.BaiduMapIsMoving?(Page_NearBy.Map.EventChangeBaiduMapSearchPoint(Page_NearBy.Par.BaiduMap.getBounds()),Page_NearBy.Par.BaiduMap&&Page_NearBy.Map.SearchMap()):Page_NearBy.Par.BaiduMapIsMoving=!0}),Page_NearBy.Map.EventChangeBaiduMapSearchPoint(Page_NearBy.Par.BaiduMap.getBounds()),Page_NearBy.Model.BaiduSearchControl.prototype=new BMap.Control,Page_NearBy.Model.BaiduSearchControl.prototype.initialize=function(t){var o=document.createElement("div"),f=document.createElement("div"),u,i,r,e,s;return f.id="r-result",f.style.height="40px",f.style.width="660px",f.style.borderRadius="5px",f.style.position="relative",u=document.createElement("i"),u.id="mark-bg",u.style.height="40px",u.style.width="660px",u.style.backgroundColor="#000",u.style.borderRadius="5px",u.style.position="absolute",u.style.left="1px",u.style.top="1px",u.style.opacity="0.7",u.style.zIndex="1",i=document.createElement("input"),i.type="text",i.value="",i.id="suggestId",i.style.width="300px",i.style.height="28px",i.style.fontSize="12px",i.style.borderWidth="1px",i.style.marginTop="5px",i.style.marginLeft="5px",i.style.cssFloat="left",i.style.paddingLeft="5px",i.style.paddingRight="5px",i.style.borderRadius="5px",i.style.position="relative",i.style.zIndex="2",i.style.styleFloat="left",i.style.lineHeight="28px",r=document.createElement("button"),r.id="but_Search",r.style.height="24px",r.style.width="65px",r.style.borderRadius="2px",r.style.backgroundColor="#3399ff",r.style.color="#fff",r.style.fontSize="12px",r.style.cursor="pointer",r.style.border="none",r.textContent="找附近",r.style.position="absolute",r.style.left="248px",r.style.top="8px",r.style.zIndex="3",r.innerHTML="找附近",e=document.createElement("div"),e.id="searchResultPanel",e.style.border="1px solid #3399ff",e.style.width="200px",e.style.height="auto",e.style.display="none",r.onclick=function(){if(i.value.length>0)try{var u=$(i).attr("data-lng"),f=$(i).attr("data-lat");u&&f&&(t.setZoom(15),t.panTo(new BMap.Point(parseFloat(u),parseFloat(f))))}catch(r){}else t.setCenter(new BMap.Point(n.Point.Lng,n.Point.Lat)),t.setZoom(12)},f.appendChild(i),f.appendChild(r),f.appendChild(u),s="
",s+="当前视野显示 0<\/span> 家 当前城市共计 0<\/span> 家",s+="<\/div>",f.insertAdjacentHTML("beforeEnd",s),o.appendChild(f),o.appendChild(e),t.getContainer().appendChild(o),o},f=new Page_NearBy.Model.BaiduSearchControl,Page_NearBy.Par.BaiduMap.addControl(f),i=new BMap.Autocomplete({input:"suggestId",location:Page_NearBy.Par.BaiduMap}),i.addEventListener("onhighlight",function(n){var r="",t=n.fromitem.value,i="";n.fromitem.index>-1&&(i=t.province+t.city+t.district+t.street+t.business),r="FromItem
index ="+n.fromitem.index+"
value = "+i,i="",n.toitem.index>-1&&(t=n.toitem.value,i=t.province+t.city+t.district+t.street+t.business),r+="
ToItem
index = "+n.toitem.index+"
value = "+i,document.getElementById("searchResultPanel").innerHTML=r}),i.addEventListener("onconfirm",function(n){var t=n.item.value;r=t.province+t.city+t.district+t.street+t.business,document.getElementById("searchResultPanel").innerHTML="onconfirm
index = "+n.item.index+"
myValue = "+r,e()});function e(){function t(){var t=n.getResults().getPoi(0).point;$("#suggestId").attr("data-lng",t.lng),$("#suggestId").attr("data-lat",t.lat),$("#but_Search").trigger("click")}var n=new BMap.LocalSearch(Page_NearBy.Par.BaiduMap,{onSearchComplete:t});n.search(r)}}}catch(o){}},EventChangeBaiduMapSearchPoint:function(n){try{if(n){var t=n.getSouthWest(),i=n.getNorthEast();Page_NearBy.Par.SearchPoint_SW=t.lng+","+t.lat,Page_NearBy.Par.SearchPoint_NE=i.lng+","+i.lat}}catch(r){}},SearchMap:function(){var i,r,u,n,t,e,f;try{$("#search4Sellers").html(""),i=$("#selServiceFeature .select_txt").attr("data-value"),GETAO.IsNullOrEmptyOrUndefined(i)&&(i=""),r=$("#selServicePromise .select_txt").attr("data-value"),GETAO.IsNullOrEmptyOrUndefined(r)&&(r=""),u=$("#selTrading .select_txt").attr("data-value"),GETAO.IsNullOrEmptyOrUndefined(u)&&(u=""),n="bj",t=GETAO.Cookie.GetCookie("BYWCURCITY"),t&&(t=JSON2.parse(unescape(decodeURI(t))),n=t.FPI),GETAO.IsNullOrEmptyOrUndefined(n)&&(n="bj"),e=0,$(".map_mask .mapinfo .map_ul li").each(function(){if($(this).find("i").hasClass("b_org")){e=$(this).find("i").attr("data-order");return}}),f=$("#hidBestesABC").val(),GETAO.IsNullOrEmptyOrUndefined(f)&&(f="0"),$.ajax({type:"POST",async:!1,dataType:"json",data:{cityDomain:n,sf:i,sp:r,st:u,order:e,point_sw:Page_NearBy.Par.SearchPoint_SW,point_ne:Page_NearBy.Par.SearchPoint_NE},url:"/home/ZHttpPost_SellerSearch4LBS?rd="+Math.random(),success:function(t){var s,r,u,o,i,l,h,c,e;if(Page_NearBy.Par.BaiduMap.clearOverlays(),t.ResponseCode=="0")if(s=JSON2.parse(t.ResponseData),s)if(!0&&($("#msg_map_search_count_citys").html(s.CityCount),$("#msg_map_search_count_sellers").html(s.DRecords)),r=JSON2.parse(s.DTable),r&&r.length>0){for(u="",o="normal",i=0;i",u+="
",u+="
",i<=2&&f=="1"?(l=i==0?"a":i==1?"b":"c",u+="

"+$.trim(r[i].S_SN)+"<\/h3>",u+="<\/i>"):u+="

"+$.trim(r[i].S_SN)+"<\/h3>",r[i].S_V==1&&(u+="认证<\/span>"),u+="
<\/div>",u+="<\/div>",u+="

"+r[i].Z_Add+"<\/span><\/p>",u+="

",h=r[i].S_SFs.split(","),h!=null&&h.length>0)for(e=0;e";if(c=r[i].S_SPs.split(","),c!=null&&c.length>0)for(e=0;e";u+="<\/div>",u+="<\/div>",u+="<\/a>",$("#search4Sellers").append(u),o=i<=2?i==0?"A":i==1?"B":"C":r[i].O_S!=null&&r[i].O_S>0?"star":r[i].S_V=="1"?"V":"normal",Page_NearBy.Map.CreateMarker(r[i],n,o,i+1)}catch(a){return!1}$("#search4Sellers").append("
<\/div>")}else Page_NearBy.Map.NoData();else Page_NearBy.Map.NoData();else Page_NearBy.Map.NoData()}})}catch(o){}},CreateMarker:function(n,t,i,r){var u,e;try{var s=new BMap.Point(n.L_Lng,n.L_Lat),o=null,f=0;i=="normal"?o=new BMap.Icon($("#hidResWebsiteURL").val()+"/img/s_v1/com/lbs/p_normal.png",new BMap.Size(30,25)):i=="A"||i=="B"||i=="C"?(o=new BMap.Icon($("#hidResWebsiteURL").val()+"/img/s_v1/com/lbs/p_"+i+".png",new BMap.Size(40,35)),i=="A"?f=9:i=="B"?f=8:i=="C"&&(f=7)):(i=="star"||i=="V")&&(o=new BMap.Icon($("#hidResWebsiteURL").val()+"/img/s_v1/com/lbs/p_"+i+".png",new BMap.Size(30,25)),i=="V"?f=6:i=="star"&&(f=5)),u=new BMap.Marker(s,{icon:o}),u.setTitle("点击查看商家详情【"+$.trim(n.S_SN)+"】"),e=new BMap.InfoWindow(Page_NearBy.Map.CreateMarkerInfoWindow(n,t,r),{width:275,height:80}),u.setZIndex(f),e.disableAutoPan(),u.addEventListener("mouseover",function(){u.setTop(!0);var n=u.getTitle();n&&(n=n.substring(n.indexOf("【")+1,n.length-1),n=$.trim(n),$("#search4Sellers div[name='sellerDIV']").each(function(t,i){var r=$(i).attr("data-SN");if(r&&n==r)try{document.getElementById("search4Sellers").scrollTop=document.getElementById($(this).attr("id")).offsetTop-document.getElementById("search4Sellers").offsetHeight,document.getElementById($(this).attr("id")).style.backgroundColor="#f6fbff"}catch(u){}}))}),u.addEventListener("mouseout",function(){u.setTop(!1);var n=u.getTitle();n&&(n=n.substring(n.indexOf("【")+1,n.length-1),n=$.trim(n),$("#search4Sellers div[name='sellerDIV']").each(function(t,i){var r=$(i).attr("data-SN");if(r&&n==r){try{document.getElementById($(this).attr("id")).style.backgroundColor=""}catch(u){}return}}))}),u.addEventListener("click",function(){e.isOpen()||(Page_NearBy.Par.BaiduMapIsMoving=!1,e.enableAutoPan(),u.openInfoWindow(e))}),Page_NearBy.Par.BaiduMap.addOverlay(u),u.disableDragging()}catch(h){alert(h.message)}},CreateMarkerInfoWindow:function(n,t,i){var r,e,o,u;try{var s=n.S_C,h=$.trim(n.S_SN),c=n.S_SFs,l=n.S_SPs,f=n.O_S,a=n.Z_Add;if((GETAO.IsNullOrUndefined(f)||f>5)&&(f=0),GETAO.IsNullOrUndefined(c)&&(c=""),GETAO.IsNullOrUndefined(l)&&(l=""),r="