/* */_jsload&&_jsload('autocomplete', 'var jk,gw=jk=gw||{version:"1.3.4"};gw.guid="$BAIDU$";window[gw.guid]=window[gw.guid]||{};gw.object=gw.object||{};gw.extend=gw.object.extend=function(T,e){for(var i in e){if(e.hasOwnProperty(i)){T[i]=e[i]}}return T};gw.dom=gw.dom||{};gw.dom.g=function(e){if("string"==typeof e||e instanceof String){return document.getElementById(e)}else{if(e&&e.nodeName&&(e.nodeType==1||e.nodeType==9)){return e}}return null};gw.g=gw.G=gw.dom.g;gw.dom.hide=function(e){e=gw.dom.g(e);if(e===null){return e}e.style.display="none";return e};gw.hide=gw.dom.hide;gw.lang=gw.lang||{};gw.lang.isString=function(e){return"[object String]"==Object.prototype.toString.call(e)};gw.isString=gw.lang.isString;gw.lang.isEmptyObject=function(T){if(Object.prototype.toString.call(T)==="[object Object]"){for(var e in T){return false}return true}else{return false}return"[object String]"==Object.prototype.toString.call(T)};gw.isEmptyObject=gw.lang.isEmptyObject;gw.dom._g=function(e){if(gw.lang.isString(e)){return document.getElementById(e)}return e};gw._g=gw.dom._g;gw.dom.getElementsByClassName=function(e,i){if(e.getElementsByClassName){return e.getElementsByClassName(i)}else{return(function T(j2,j0){if(j0==null){j0=document}var jZ=[],jY=j0.getElementsByTagName("*"),jV=jY.length,j1=new RegExp("(^|\\\\s)"+j2+"(\\\\s|$)"),jX,jW;for(jX=0,jW=0;jX0&&j1.getBoxObjectFor&&jY(e,"position")=="absolute"&&(e.style.top===""||e.style.left===""),jZ={left:0,top:0},jX=(jV.ie&&!jV.isStrict)?j1.body:j1.documentElement,j2,i;if(e==jX){return jZ}if(e.getBoundingClientRect){i=e.getBoundingClientRect();jZ.left=Math.floor(i.left)+Math.max(j1.documentElement.scrollLeft,j1.body.scrollLeft);jZ.top=Math.floor(i.top)+Math.max(j1.documentElement.scrollTop,j1.body.scrollTop);jZ.left-=j1.documentElement.clientLeft;jZ.top-=j1.documentElement.clientTop;var j0=j1.body,j3=parseInt(jY(j0,"borderLeftWidth")),jW=parseInt(jY(j0,"borderTopWidth"));if(jV.ie&&!jV.isStrict){jZ.left-=isNaN(j3)?2:j3;jZ.top-=isNaN(jW)?2:jW}}else{j2=e;do{jZ.left+=j2.offsetLeft;jZ.top+=j2.offsetTop;if(jV.isWebkit>0&&jY(j2,"position")=="fixed"){jZ.left+=j1.body.scrollLeft;jZ.top+=j1.body.scrollTop;break}j2=j2.offsetParent}while(j2&&j2!=e);if(jV.opera>0||(jV.isWebkit>0&&jY(e,"position")=="absolute")){jZ.top-=j1.body.offsetTop}j2=e.offsetParent;while(j2&&j2!=j1.body){jZ.left-=j2.scrollLeft;if(!jV.opera||j2.tagName!="TR"){jZ.top-=j2.scrollTop}j2=j2.offsetParent}}return jZ};if(/firefox\\/(\\d+\\.\\d)/i.test(navigator.userAgent)){gw.browser.firefox=+RegExp["\\x241"]}if(/BIDUBrowser/i.test(navigator.userAgent)){gw.browser.baidu=true}(function(){var e=navigator.userAgent;if(/(\\d+\\.\\d)?(?:\\.\\d)?\\s+safari\\/?(\\d+\\.\\d+)?/i.test(e)&&!/chrome/i.test(e)){gw.browser.safari=+(RegExp["\\x241"]||RegExp["\\x242"])}})();if(/chrome\\/(\\d+\\.\\d)/i.test(navigator.userAgent)){gw.browser.chrome=+RegExp["\\x241"]}gw.array=gw.array||{};gw.array.each=function(jY,jW){var jV;var jX;var T;var e=jY.length;if("function"==typeof jW){for(T=0;T=0)};gw.ui=gw.ui||{version:"1.3.9"};gw.ui.getUI=function(jV){var jV=jV.split("-"),T=gw.ui,e=jV.length,jW=0;for(;jW",tplPrependAppend:"
#{2}
",tplClose:\'
关闭
\',tplBody:\'#{0}
\',tplRow:\'#{1}\',getString:function(){var e=this;return gw.format(e.tplDOM,e.getId(),e.getClass(),e.guid)},render:function(jV,i){var T=this;var e;var jV=eP.G(jV);T.baseDom=i;if(T.getMain()||!jV){return}if(jV.id){T.targetId=jV.id}else{T.targetId=jV.id=T.getId("input")}e=T.renderMain();e.style.display="none";e.innerHTML=T.getString();this.dispatchEvent("onload")},_isShowing:function(){var i=this,e=i.getMain();return e&&e.style.display!="none"},pick:function(e){var jV=this,i=jV.currentData,jW=i&&typeof e=="number"&&typeof i[e]!="undefined"?i[e].value:e,T={data:{item:jW==e?{value:e,content:e}:i[e],index:e}};if(jV.dispatchEvent("onbeforepick",T)){jV.dispatchEvent("onpick",T)}},show:function(jY,jX,jV){var T=0,e=jX.length,jW=this;jW.enableIndex=[];jW.currentIndex=-1;if(e==0&&!jV){jW.hide()}else{jW.currentData=[];for(;T=0&&jX.holdHighLight){var jW=jX.currentData,T=-1;for(var jV=0,e=jW.length;jV=0&&T._clearHighLight();i=T._getItem(e);gw.addClass(i,T.getClass("current"));T.currentIndex=gw.array.indexOf(jV,e);T.dispatchEvent("onhighlight",{index:e,data:T.getDataByIndex(e)})},clearHighLight:function(){var T=this,e=T.currentIndex,i=T.enableIndex[e];T._clearHighLight()&&T.dispatchEvent("onclearhighlight",{index:i,data:T.getDataByIndex(i)})},_clearHighLight:function(){var T=this,e=T.currentIndex,jV=T.enableIndex,i=null;if(e>=0){i=T._getItem(jV[e]);gw.removeClass(i,T.getClass("current"));T.currentIndex=-1;return true}return false},confirm:function(e,T){var i=this;if(T!="keyboard"){if(!i._isEnable(e)){return}}i.pick(e);i.dispatchEvent("onconfirm",{data:i.getDataByIndex(e)||e,source:T});i.currentIndex=-1;i.hide()},getDataByIndex:function(e){return{item:this.currentData[e],index:e}},getTargetValue:function(){return this.getTarget().value},getTarget:function(){return eP.G(this.targetId)},_getItem:function(e){return eP.G(this.getId("item"+e))},_getBodyString:function(){var jY=this,jX="",jW=[],jZ=jY.currentData,e=jZ.length,jV=0;function T(i){return gw.format(jY.tplPrependAppend,jY.getId(i),jY.getClass(i),jY[i+"HTML"])}for(;jV0?gw.dom.insertBefore(i,T.firstChild):T.appendChild(i);gw.setStyles(i,{position:"absolute",top:"0px",left:"0px"});gw.dom.setBorderBoxSize(i,{width:T.offsetWidth,height:T.offsetHeight});gw.dom.setBorderBoxSize(jY,{width:i.offsetWidth});gw.dom.setStyles(jY,{zIndex:-1,display:"block",border:0,backgroundColor:jV,filter:"progid:DXImageTransform.Microsoft.Alpha(style=0,opacity="+jW+")"});i.appendChild(jY);jY.src="javascript:void(0)";jY.frameBorder="0";jY.scrolling="no";jY.height="97%";jZ.Coverable_isShowing=true};e.Coverable_hide=function(){var T=this,i=T.Coverable_iframe;if(!T.Coverable_isShowing){return}gw.setStyle(i,"display","none");T.Coverable_isShowing=false};e.Coverable_update=function(jV){var jX=this,jV=jV||{},T=jX.Coverable_container,i=jX.Coverable_iframeContainer,jW=jX.Coverable_iframe;gw.dom.setBorderBoxSize(i,{width:T.offsetWidth,height:T.offsetHeight});gw.dom.setBorderBoxSize(jW,gw.extend({width:gw.getStyle(i,"width")},jV))}})();gw.extend(gw.ui.Suggestion.prototype,{coverable:true,coverableOptions:{}});gw.ui.Suggestion.register(function(e){if(e.coverable){e.addEventListener("onshow",function(){e.Coverable_show()});e.addEventListener("onhide",function(){e.Coverable_hide()})}});gw.ui.Suggestion.extend({setData:function(jV,T,i){var e=this;e.dataCache[jV]=T;if(!i){e.show(jV,e.dataCache[jV])}}});gw.ui.Suggestion.register(function(e){e.dataCache={};e.addEventListener("onneeddata",function(T,jV){var i=e.dataCache;if(typeof i[jV]=="undefined"){e.getData(jV)}else{e.show(jV,i[jV])}})});gw.dom.setOuterWidth=gw.dom.setBorderBoxWidth=function(e,i){return gw.dom.setBorderBoxSize(e,{width:i})};gw.dom.getWindow=function(e){e=gw.dom.g(e);if(e===null){return e}var i=gw.dom.getDocument(e);return i.parentWindow||i.defaultView||null};gw.dom.setPosition=function(i,e){return gw.dom.setStyles(i,{left:e.left-(parseFloat(gw.dom.getStyle(i,"margin-left"))||0),top:e.top-(parseFloat(gw.dom.getStyle(i,"margin-top"))||0)})};gw.page=gw.page||{};gw.page.getViewWidth=function(){var i=document,e=i.compatMode=="BackCompat"?i.body:i.documentElement;return e.clientWidth};gw.page.getViewHeight=function(){var i=document,e=i.compatMode=="BackCompat"?i.body:i.documentElement;return e.clientHeight};gw.page.getScrollTop=function(){var e=document;return window.pageYOffset||e.documentElement.scrollTop||e.body.scrollTop};gw.page.getScrollLeft=function(){var e=document;return window.pageXOffset||e.documentElement.scrollLeft||e.body.scrollLeft};gw.fn=gw.fn||{};gw.fn.bind=function(i,e){var T=arguments.length>2?[].slice.call(arguments,2):null;return function(){var jW=gw.lang.isString(i)?e[i]:i,jV=(T)?T.concat([].slice.call(arguments,0)):arguments;return jW.apply(e||jW,jV)}};(function(){var i=gw.ui.behavior.posable=function(){};i.setPosition=function(jY,jW,jV){jW=eP.G(jW)||this.getMain();jV=jV||{};var jX=this,T=[jW,jY,jV];jX.__execPosFn(jW,"_positionByCoordinate",jV.once,T)};i._positionByCoordinate=function(T,j8,j9,jW){j8=j8||[0,0];j9=j9||{};var j5=this,j6={},j3=gw.page.getViewHeight(),j7=gw.page.getViewWidth(),j0=gw.page.getScrollLeft(),jY=gw.page.getScrollTop(),jX=T.offsetWidth,jZ=T.offsetHeight,jV=T.offsetParent,j4=(!jV||jV==document.body)?{left:0,top:0}:gw.dom.getPosition(jV);j9.position=(typeof j9.position!=="undefined")?j9.position.toLowerCase():"bottomright";j8=e(j8||[0,0]);j9.offset=e(j9.offset||[0,0]);j8.x+=(j9.position.indexOf("right")>=0?(j8.width||0):0);j8.y+=(j9.position.indexOf("bottom")>=0?(j8.height||0):0);j6.left=j8.x+j9.offset.x-j4.left;j6.top=j8.y+j9.offset.y-j4.top;switch(j9.insideScreen){case"surround":j6.left+=j6.left(j0+j7)?-jX-(j8.width||0):0);j6.top+=j6.top(jY+j3)?-jZ-(j8.height||0):0);break;case"fix":j6.left=Math.max(0-parseFloat(gw.dom.getStyle(T,"marginLeft"))||0,Math.min(j6.left,gw.page.getViewWidth()-jX-j4.left));j6.top=Math.max(0-parseFloat(gw.dom.getStyle(T,"marginTop"))||0,Math.min(j6.top,gw.page.getViewHeight()-jZ-j4.top));break;case"verge":var j2={width:(j9.position.indexOf("right")>-1?j8.width:0),height:(j9.position.indexOf("bottom")>-1?j8.height:0)},j1={width:(j9.position.indexOf("bottom")>-1?j8.width:0),height:(j9.position.indexOf("right")>-1?j8.height:0)};j6.left-=(j9.position.indexOf("right")>=0?(j8.width||0):0);j6.top-=(j9.position.indexOf("bottom")>=0?(j8.height||0):0);j6.left+=j6.left+j2.width+jX-j0>j7-j4.left?j1.width-jX:j2.width;j6.top+=j6.top+j2.height+jZ-jY>j3-j4.top?j1.height-jZ:j2.height;break}gw.dom.setPosition(T,j6);if(!jW&&(j3!=gw.page.getViewHeight()||j7!=gw.page.getViewWidth())){j5._positionByCoordinate(T,j8,{},true)}jW||j5.dispatchEvent("onpositionupdate")};i.__execPosFn=function(jV,jY,jW,T){var jX=this;if(typeof jW=="undefined"||!jW){gw.event.on(gw.dom.getWindow(jV),"resize",gw.fn.bind.apply(jX,[jY,jX].concat([].slice.call(T))))}jX[jY].apply(jX,T)};function e(T){T.x=T[0]||T.x||T.left||0;T.y=T[1]||T.y||T.top||0;return T}})();gw.ui.Suggestion.extend({posable:true,fixWidth:true,getWindowResizeHandler:function(){var e=this;return function(){e.adjustPosition(true)}},adjustPosition:function(T){var jW=this;var jX=jW.getTarget();var i=jW.baseDom;var jV;var e=jW.getMain();var jY;if(!jW._isShowing()&&T){return}if(i){jX=i}jV=gw.dom.getPosition(jX);jY={top:(jV.top+jX.offsetHeight-1),left:jV.left,width:jX.offsetWidth};jY=typeof jW.view=="function"?jW.view(jY):jY;jW.setPosition([jY.left,jY.top],null,{once:true});gw.dom.setOuterWidth(e,jY.width)}});gw.ui.Suggestion.register(function(e){e.windowResizeHandler=e.getWindowResizeHandler();e.addEventListener("onload",function(){e.adjustPosition();if(e.fixWidth){e.fixWidthTimer=setInterval(function(){var i=e.getMain(),T=e.getTarget();if(i.offsetWidth!=0&&T&&T.offsetWidth!=i.offsetWidth){e.adjustPosition();i.style.display="block"}},100)}e.on(window,"resize",e.windowResizeHandler)});e.addEventListener("onshow",function(){e.adjustPosition()});e.addEventListener("ondispose",function(){clearInterval(e.fixWidthTimer)})});gw.ui.Suggestion.register(function(jW){var jZ;var T="";var jY;var jV;var i=false;var jX=false;function e(){setTimeout(function(){var j0=jW.getTarget();jY=j0===null?"":j0.value},20)}jW.addEventListener("onload",function(){jZ=this.getTarget();e();jW.on(window,"onload",e);jW.targetKeydownHandler=jW.getTargetKeydownHandler();jW.on(jZ,"keydown",jW.targetKeydownHandler);jZ.setAttribute("autocomplete","off");jW.circleTimer=setInterval(function(){if(jX){return}if(eP.G(jZ)==null){jW.dispose()}var j0=jZ.value;if(j0==T&&j0!=""&&j0!=jY&&j0!=jV){if(jW.requestTimer==0){jW.requestTimer=setTimeout(function(){jW.dispatchEvent("onneeddata",j0)},100)}}else{clearTimeout(jW.requestTimer);jW.requestTimer=0;if(j0==""&&T!=""){jV="";jW.hide()}T=j0;if(j0!=jV){jW.defaultIptValue=j0}if(jY!=jZ.value){jY=""}}},10);jW.on(jZ,"beforedeactivate",jW.beforedeactivateHandler)});jW.addEventListener("onitemclick",function(){jX=false;jW.defaultIptValue=T=jW.getTargetValue()});jW.addEventListener("onpick",function(j0){if(i){jZ.blur()}jZ.value=jV=j0.data.item.value;if(i){jZ.focus()}});jW.addEventListener("onmousedownitem",function(j0){i=true;jX=true;setTimeout(function(){jX=false;i=false},500)});jW.addEventListener("ondispose",function(){clearInterval(jW.circleTimer)})});gw.ui.Suggestion.extend({beforedeactivateHandler:function(){return function(){if(mousedownView){window.event.cancelBubble=true;window.event.returnValue=false}}},getTargetKeydownHandler:function(){var i=this;function e(T){if(!i._isShowing()){i.dispatchEvent("onneeddata",i.getTargetValue());return}var jW=i.enableIndex,jV=i.currentIndex;if(jW.length==0){return}if(T){switch(jV){case -1:jV=jW.length-1;i.pick(jW[jV]);i.highLight(jW[jV]);break;case 0:jV=-1;i.pick(i.defaultIptValue);i.clearHighLight();break;default:jV--;i.pick(jW[jV]);i.highLight(jW[jV]);break}}else{switch(jV){case -1:jV=0;i.pick(jW[jV]);i.highLight(jW[jV]);break;case jW.length-1:jV=-1;i.pick(i.defaultIptValue);i.clearHighLight();break;default:jV++;i.pick(jW[jV]);i.highLight(jW[jV]);break}}i.currentIndex=jV}return function(jW){var T=false,jV;jW=jW||window.event;switch(jW.keyCode){case 9:i.hide();break;case 27:i.hide();break;case 13:gw.event.stop(jW);i.confirm(i.currentIndex==-1?i.getTarget().value:i.enableIndex[i.currentIndex],"keyboard");break;case 38:T=true;gw.event.stop(jW);e(T);break;case 40:gw.event.stop(jW);e(T);break;default:i.currentIndex=-1}}},defaultIptValue:""});eP.undope=true;iN.IS_INCLUDE_STYLE=false;iN.STYLE_FILE_PATH=B.apiHost+"/res/20/bmap_autocomplete.css";iN.TYPES_COLLECTION={ALL:"0",CITY:"1"};eP.extend(iN.prototype,{_asyncSearch:function(){this._initialize()},_initialize:function(){this._exIndex=-1;this._json=null;this._typeIds=[];this._cityId=0;this._results=this._getAutocompleteResult();if(!!this._options.input){this._getStyles();this._renderSuggestion();this.setInputValue(this._inputValue)}var e=null;if(!!this._word){e={};e.method="search";e.arguments=[this._word]}this._getTypesId();this._getCityId(e)},_renderSuggestion:function(){var i=this;var e=new gw.ui.Suggestion({getData:function(T){i._sendAutocompleteRequest(T)},onhide:function(){i._exIndex=-1;if(i._suggestion.getTargetValue()===""){i._word="";i._results=i._getAutocompleteResult()}},onhighlight:function(T){if(!i._json){return}var jW={},jV={};jV={index:T.data.index,value:i._json.items[T.data.index].value};jW={index:i._exIndex,value:i._exIndex>=0?i._json.items[i._exIndex].value:{}};var jX=new fA("onhighlight");jX.fromitem=jX.fromitem=jW;jX.toitem=jX.toitem=jV;i.dispatchEvent(jX);i._exIndex=T.data.index},onbeforepick:function(T){if(!i._json){return}if(typeof(T.data.index)==="number"){var jV=i._json.items[T.data.index].value;T.data.item.content=T.data.item.value=jV.province+jV.city+jV.district+jV.street+jV.business}},onconfirm:function(T){if(!i._json){return}var jV={};if(typeof(T.data.index)==="number"){jV={index:T.data.index,value:i._json.items[T.data.index].value};var jW=new fA("onconfirm");jW.item=jW.item=jV;i.dispatchEvent(jW)}}});e.render(eP.G(this._options.input),eP.G(this._options.baseDom));this._suggestion=e},show:function(){if(this._suggestion){this._suggestion.getMain().style.display="block"}},hide:function(){this._suggestion&&this._suggestion.hide();this._exIndex=-1},dispose:function(){this._suggestion&&this._suggestion.dispose();gw.lang.Class.prototype.dispose.call(this)},setTypes:function(e){this._options.types=e||[];this._getTypesId()},setLocation:function(e,i){this._loc.src=e;this._getCityId(i)},search:function(e){this._sendAutocompleteRequest(e)},setInputValue:function(e){if(this._suggestion){this._suggestion.pick(e)}},_sendAutocompleteRequest:function(jV){var T=this,e=(Math.random()*100000).toFixed(0);BMapGL._rd["_cbk"+e]=function(jW){if(eP.G(T._options.input)!==null){T._getAutocompleteBack(jW)}delete BMapGL._rd["_cbk"+e]};var i=B.mapHost+"/su?wd="+encodeURIComponent(jV)+"&callback=BMapGL._rd._cbk"+e+"&cid="+T._cityId+"&type="+T._typeIds+"&t="+new Date().getTime()+"&from=jsapi&ak="+eF;T._word=jV;T._exIndex=-1;T._results=this._getAutocompleteResult();da.request(i)},_getAutocompleteBack:function(e){if(e&&e.q){this._word=e.q}var i=this._formatDataForTangram(e);this._showResultList(i);this._results=this._getAutocompleteResult(this._json);this._options.onSearchComplete(this._results)},_formatDataForTangram:function(jX){var jY=[],T=jX.s,e={};e.keyword=jX.q||"";e.count=jX.s["length"]||0;e.status=jX.e<0?BMAP_STATUS_SERVICE_UNAVAILABLE:BMAP_STATUS_SUCCESS;e.items=[];var jW=0;var jZ=T.length;if(bU()&&jZ>6){jZ=6}for(;jW",j1={province:"",city:j2[0],district:j2[1],street:j2[2],streetNumber:"",business:j2[3]},jY="",T=3;if(j2.length>=7){j1.city=j2[5]||j1.city;j1.district=j2[6]||j1.city;j2[0]=j2[5];j2[1]=j2[6]}for(var j0=T;j0>=0;j0--){jY=j2[j0]+jY;if(jY.indexOf(jW)>-1){var jZ=j0-1,jX="";while(jZ>-1){jX=j2[jZ]+jX;jZ--}jY=jY.replace(e,jV);if(!!jX){jY+=" "+jX+""}break}else{continue}}if(!jX){for(var j0=T;j0>=0;j0--){jX+=j2[j0]}}return{value:{value:j1},html:jY}},_getItemValueForCity:function(jY){var i=jY.split("$"),jW=this._word,e=new RegExp(jW,"g"),T=""+jW+"",jV={province:i[0],city:i[1],district:"",street:"",streetNumber:"",business:""},jX=(i[0]+i[1]).replace(e,T);return{value:{value:jV},html:jX}},_getTypesId:function(){var T=this._options.types,jV=[];if(gw.isString(T)){jV.push(iN.TYPES_COLLECTION[T.toUpperCase()])}else{if(gw.lang.isArray(T)){for(var e=0,jW=T.length;e0?jV.join(","):"0"},_getCityId:function(i){var e=this;e._getIdByLoc(e._loc,function(T){e._cityId=T;if(!!i){e[i.method].apply(e,i.arguments)}})},_getStyles:function(){if(!iN.IS_INCLUDE_STYLE){var T=document,i=T.createElement("link");i.setAttribute("rel","stylesheet");i.setAttribute("type","text/css");i.setAttribute("href",iN.STYLE_FILE_PATH);var e=T.getElementsByTagName("head");if(e.length){e[0].appendChild(i)}else{T.documentElement.appendChild(i)}iN.IS_INCLUDE_STYLE=true}},_getAutocompleteResult:function(e){if(!e){return new dM({keyword:this._word,total:0,pois:[]})}var jV=[];for(var T=0,jW=e.items.length;T