String.prototype.substringPro=function(C,D){var E="";D=D||"...";if(this.getLen()<=C){return this}for(var B=0,A=0;A<C-D.length;){if(this.charCodeAt(B)>=0&&this.charCodeAt(B)<256){E+=this.charAt(B);A++}else{if((A+=3)<=C){E+=this.charAt(B)}}B++}E+=D;return E};String.prototype.getRootDomain=function(){var A=/^([^:]*:\/\/)?([^\/\.]+\.([^\/]+))/.exec(this);return A&&A[3]!==undefined?A[3]+"":""};String.prototype.Trim=function(){return this.replace(/(^\s*)|(\s*$)/g,"")};String.prototype.getLen=function(){var A=0;for(var B=0;B<this.length;++B){if(this.charCodeAt(B)>127){A+=3}else{A++}}return A};String.prototype.chkLen=function(B,A){var C=this.getLen(this);if(C>A||C<B){return false}else{return true}};String.prototype.chkType=function(A){switch(A){case"int":return(/^-?[1-9][0-9]+$|^-?[0-9]$/).test(this);case"url":return(/^https?:\/\/([a-z0-9-]+\.)+[a-z0-9]{2,4}.*$/).test(this);case"email":return(/^[a-z0-9_+.-]+\@([a-z0-9-]+\.)+[a-z0-9]{2,4}$/i).test(this);case"idcard":return(/^[0-9]{15}$|^[0-9]{17}[a-zA-Z0-9]/).test(this);case"area":return(/^\d+(\.\d{1,2})?$/).test(this);case"money":return(/^\d+(\.\d{1,2})?$/).test(this);case"year":return(/^(19|20)\d\d$/).test(this);case"input":return(/^[\u4e00-\u9fa5A-Za-z0-9_\s\~\@\!\#\$\.\,\/\\\%\^\&\*\(\)_\+\?\>\<《〉》〉、，。？！￥（）\{\}\[\]]+$/).test(this)}return false};String.prototype.containType=function(A){switch(A){case"mobile":return(/[0-9]{11}/).test(this)}return false};Array.prototype.unique=function(){var C={};for(var B=0,A=0;B<this.length;B++){if(this[B]!==undefined){if(!C[this[B]]){this[A++]=this[B];C[this[B]]=true}}}this.length=A;return this};Array.prototype.clone=function(){var A=[];for(var B in this){if(A[B]===undefined&&typeof this[B]=="string"){A[B]=this[B]}}return A};Array.prototype.insertAt=function(A,C){var D=this.slice(0,A);var B=this.slice(A);D.push(C);return(D.concat(B))};window.openNew=function(C,A){var B=document.createElement("form");form.action=C;form.target=A;form.submit()};window.getRadioValue=function(B){var C=document.getElementsByName(B);var D=C.length;if(0==D){return null}for(var A=0;A<D;++A){if(C[A].checked==true){return C[A].value}}return""};APF.Namespace.register("anjuke.global.header");anjuke.global.header.CitySelector=Class.create({initialize:function(D,C,A){this.selector=$(D);this.panelId=C;this.hideTimeout=A;var B=$(C);this.iframe=B.select("iframe").first();this.iframe.setStyle({width:B.getWidth()+"px",height:B.getHeight()+"px"});this.selector.observe("mouseover",function(){window.clearTimeout(this.timeoutHandle);$(this.panelId).show()}.bind(this));this.selector.observe("mouseout",function(){window.clearTimeout(this.timeoutHandle);this.timeoutHandle=window.setTimeout("$('"+this.panelId+"').hide()",this.hideTimeout)}.bind(this));var E=this.selector.select("a").first();if(E!=undefined){E.observe("click",function(F){F.preventDefault()})}}});APF.Namespace.register("anjuke.global.header");anjuke.global.header.CornerLinks=Class.create({initialize:function(A){this.element=$(A)},test:function(B,A){$(B).hide();A.className="myanjuke"},bindEvents:function(C,B,A){this.selector=$(C);this.panelId=B;this.panel=$(B);this.hideTimeout=A;this.selector.observe("mouseover",function(D){window.clearTimeout(this.timeoutHandle);this.panel.style.display="block";this.selector.addClassName("myanjuke_hover")}.bind(this));this.panel.observe("mouseover",function(){window.clearTimeout(this.timeoutHandle);this.selector.addClassName("myanjuke_hover")}.bind(this));this.panel.observe("mouseout",function(){window.clearTimeout(this.timeoutHandle);this.timeoutHandle=window.setTimeout("$('"+this.panelId+"').hide();$('"+C+"').removeClassName('myanjuke_hover');",this.hideTimeout)}.bind(this));this.selector.observe("mouseout",function(){window.clearTimeout(this.timeoutHandle);this.timeoutHandle=window.setTimeout("$('"+this.panelId+"').hide();$('"+C+"').removeClassName('myanjuke_hover');",this.hideTimeout)}.bind(this))}});APF.Namespace.register("anjuke.global.search");anjuke.global.search.Autocompleter=Class.create(Ajax.Autocompleter,{initialize:function($super,C,D,B,A){$super(C,D,B,A);this.index=-1;this._fixChineseInputMethodProblem()},_fixChineseInputMethodProblem:function(){var A=window.setInterval(function(){if(this.oldElementValue==this.element.value){return }this.oldElementValue=this.element.value;if(this.observer){clearTimeout(this.observer)}this.observer=setTimeout(this.onObserverEvent.bind(this),0)}.bind(this),this.options.frequency*1000)},selectEntry:function($super){this.oldElementValue=this.element.value;if(this.observer){clearTimeout(this.observer)}$super()},updateChoices:function($super,C){if(!this.changed&&this.hasFocus){this.update.innerHTML=C;Element.cleanWhitespace(this.update);Element.cleanWhitespace(this.update.down());if(this.update.firstChild&&this.update.down().childNodes){this.entryCount=this.update.down().childNodes.length;for(var A=0;A<this.entryCount;A++){var B=this.getEntry(A);B.autocompleteIndex=A;this.addObservers(B)}}else{this.entryCount=0}this.stopIndicator();this.index=-1;if(this.entryCount==1&&this.options.autoSelect){this.selectEntry();this.hide()}else{this.render()}}},onKeyPress:function(A){if(this.observer){clearTimeout(this.observer);this.observer=null}if(this.active){switch(A.keyCode){case Event.KEY_RETURN:if(this.index<0){return }this.selectEntry();Event.stop(A);case Event.KEY_TAB:case Event.KEY_ESC:this.hide();this.active=false;Event.stop(A);return ;case Event.KEY_LEFT:case Event.KEY_RIGHT:return ;case Event.KEY_UP:this.markPrevious();this.render();Event.stop(A);return ;case Event.KEY_DOWN:this.markNext();this.render();Event.stop(A);return }}else{if(A.keyCode==Event.KEY_TAB||A.keyCode==Event.KEY_RETURN||(Prototype.Browser.WebKit>0&&A.keyCode==0)){return }}this.changed=true;this.hasFocus=true},show:function($super){$super();this.update.setStyle({width:this.update.getWidth()-2+"px"})},markPrevious:function(){if(this.index>0){this.index--}else{this.index=this.entryCount-1}this.getEntry(this.index).scrollIntoView(false)},getUpdatedChoices:function($super){this.startIndicator();var B=encodeURIComponent(this.options.paramName)+"="+encodeURIComponent(this.getToken());this.options.parameters=this.options.callback?this.options.callback(this.element,B):B;if(this.options.defaultParams){this.options.parameters+="&"+this.options.defaultParams}var A=new Ajax.Request(this.url,this.options);this.requestingURL=A.url},onComplete:function(A){if(this.requestingURL==A.request.url){this.requestingURL=null;this.updateChoices(A.responseText)}}});anjuke.global.search.SearchSuggestion=Class.create({initialize:function(C,B,A){this.options=A||{};this.element=$(C);this.update=this.options.update?$(this.options.update):this._createUpdateElement();this.url=B;this.useSuggestion=false;this.autocompleter=new anjuke.global.search.Autocompleter(this.element,this.update,this.url,{method:"GET",frequency:0.2,minChars:1,afterUpdateElement:function(D,F){D.value=F.firstDescendant().innerHTML;var E=this._findParentForm(D);if(E){E.submit()}}.bind(this),callback:function(D,E){if(!this.options.onParameters){return E}var F=this.options.onParameters(E);if(F&&"function"==typeof (F.toQueryString)){return F.toQueryString()}else{return F}}.bind(this)})},_findParentForm:function(A){var B=A;while(B){if(B.tagName=="FORM"){break}B=B.parentNode}return B},_createUpdateElement:function(){var A=$(document.createElement("div"));this.options.className=this.options.className||"SearchSuggestion";A.addClassName(this.options.className);var C=this._getInternetExplorerVersion();if(C>0&&C<=7){var B=this.element.ancestors();Element.insert(B[0],{after:A})}else{Element.insert(document.body,{top:A})}return A},_getInternetExplorerVersion:function(){var C=-1;if(navigator.appName=="Microsoft Internet Explorer"){var A=navigator.userAgent;var B=new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})");if(B.exec(A)!=null){C=parseFloat(RegExp.$1)}}return C}});APF.Namespace.register("anjuke.global.header");anjuke.global.header.OptionList=Class.create({initialize:function(J,D,A,E,G,H){this.trigger=$(J);this.panel=$(D);var I=$(E);var F=$(A);var B=$(H);var C=$(G);this.trigger.observe("click",function(){this.panel.style.display=this.panel.style.display=="none"?"block":"none"}.bind(this));this.searchAction=new anjuke.global.SearchInputAction(G,E,"kw_input2");F.observe("mouseover",function(){F.addClassName("current_option_hover")});F.observe("mouseout",function(){if(this.panel.visible()){return }F.removeClassName("current_option_hover")}.bind(this));F.observe("blur",function(K){var L=K.explicitOriginalTarget==undefined?document.activeElement:K.explicitOriginalTarget;if(Element.descendantOf(L,this.panel)){F.focus();return }F.removeClassName("current_option_hover");this.panel.hide()}.bind(this));this.panel.getElementsBySelector("span").each(function(K){K.observe("click",function(){F.innerHTML=K.innerHTML;I.value=K.getAttribute("v");this.searchAction.setKeyword(I.value,C.value);B.target=(I.value=="1"||I.value=="3")?"":"_blank";$("sbtn").className=I.value=="3"?"btn2":"btn";F.removeClassName("current_option_hover");this.panel.hide();Element.fire(document,"SearchBar:OptionList",I.value);this.panel.getElementsBySelector("span").each(function(L){L.setAttribute("s","none");L.setAttribute("class","item");L.setAttribute("className","item")});K.setAttribute("s","selected");K.setAttribute("class","selected");K.setAttribute("className","selected")}.bind(this));K.observe("mouseover",function(){if(K.getAttribute("s")!="selected"){K.setAttribute("class","mousehover");K.setAttribute("className","mousehover")}});K.observe("mouseout",function(){if(K.getAttribute("s")!="selected"){K.setAttribute("class","item");K.setAttribute("className","item")}})}.bind(this))},descendantOfPanel:function(A){if(A==null){return false}if(A==this.panel){return true}return this.descendantOfPanel(A.parentNode)}});APF.Namespace.register("anjuke.global");anjuke.global.SearchInputAction=Class.create({initialize:function(C,A,B){this.defaultkeyword=["请输入房源特征,地点或小区名...","请输入楼盘名称或地址...","请输入小区名或路名..."];this.kw_input=$(C);this.kw_type_textbox=$(A);this.kw_input.observe("focus",function(){if(this.defaultkeyword.indexOf(this.kw_input.value)>=0){this.kw_input.value="";this.kw_input.addClassName(B)}}.bind(this));this.kw_input.observe("blur",function(){this.setKeyword(this.kw_type_textbox.value,this.kw_input.value);if(this.kw_input.value==""||this.defaultkeyword.indexOf(this.kw_input.value)>=0){this.kw_input.removeClassName(B)}}.bind(this))},setKeyword:function(A,B){if(this.defaultkeyword.indexOf(B)>=0||!B){switch(A){case"5":this.kw_input.value=this.defaultkeyword[1];break;case"3":this.kw_input.value=this.defaultkeyword[2];break;default:this.kw_input.value=this.defaultkeyword[0];break}}}});APF.Namespace.register("anjuke.global.topnav");anjuke.global.topnav=Class.create({initialize:function(C,B,D,A,E){this.divAnjuke=$(C);this.divList=$(B);this.aSelector=$(D);this.intTimeout=A;this.intUserType=E;this.arrLis=this.divList.getElementsByTagName("li");this.divAnjuke.observe("mouseover",function(){window.clearTimeout(this.timeoutHandle);this.aSelector.className="ba_s";if(2==this.intUserType){this.divAnjuke.className="myanjuke_b_s"}else{this.divAnjuke.className="myanjuke_s"}}.bind(this));this.divList.observe("mouseover",function(){window.clearTimeout(this.timeoutHandle)}.bind(this));this.divList.observe("mouseout",function(){window.clearTimeout(this.timeoutHandle);this.timeoutHandle=window.setTimeout(function(){if(2==this.intUserType){this.divAnjuke.className="myanjuke_b"}else{this.divAnjuke.className="myanjuke"}this.aSelector.className="ba"}.bind(this),this.intTimeout)}.bind(this));this.divAnjuke.observe("mouseout",function(){window.clearTimeout(this.timeoutHandle);this.timeoutHandle=window.setTimeout(function(){if(2==this.intUserType){this.divAnjuke.className="myanjuke_b"}else{this.divAnjuke.className="myanjuke"}this.aSelector.className="ba"}.bind(this),this.intTimeout)}.bind(this))}});APF.Namespace.register("Anjuke.Map2");Anjuke.Map2.Header=Class.create({initialize:function(B,A){this.map2Header=$(B);this.hideTimeout=A},doTrack:function(B){if(typeof s_account=="undefined"){return }var A=s_gi(s_account);if(B.linkTrackVars){A.linkTrackVars=B.linkTrackVars}if(B.linkTrackEvents){A.linkTrackEvents=B.linkTrackEvents}if(B.eVar13){A.eVar13=B.eVar13}if(B.events){A.events=B.events}A.tl(this,"o",B.pVar)}});APF.Namespace.register("Anjuke.Map2");Anjuke.Map2.Findding2=Class.create({initialize:function(D,B){this.cavanId=D;this.cavansElement=$(D);this.canvas=this.cavansElement.select("#"+D+"_map2_canvas2").first();this.commname=this.cavansElement.select(".map2_commname").first();this.commname_heighlight=this.cavansElement.select(".map2_commname_highlight").first();this.propwind=this.cavansElement.select(".map2_propwind").first();this.proparrow=this.cavansElement.select(".map2_proparrow").first();this.propwind_commname=this.propwind.select(".map2_propwind_commname").first();this.propwind_listlink=this.propwind.select(".map2_propwind_listlink").first();this.propwind_morelink=this.propwind.select(".map2_filters_morelink").first();this.serch_result_container=$("search_result_panel");this.qmtype_container=this.cavansElement.select(".qmtype_container").first();this.win_price_list=this.propwind.select(".map2_filters_price").first();this.win_housemodel_list=this.propwind.select(".map2_filters_housemodel").first();this.noPrompt=APF.Utils.getCookie("noprmp");this.noPromptNoResult=APF.Utils.getCookie("noprmp_norslt");var A=this.qmtype_container.select(".qmtype_normal").first();var C=this.qmtype_container.select(".qmtype_hybrid").first();A.observe("click",function(){document.fire("map:type",{type:"normal"})});C.observe("click",function(){document.fire("map:type",{type:"hybrid"})});A.observe("click",function(){document.fire("map:type",{type:"normal"})});C.observe("click",function(){document.fire("map:type",{type:"hybrid"})});this.PageSidebar=sidebar;this.PageHeaderObj=sidebarFilter;this.hqbutton=$("map2_is_hq");this.page_info=this.propwind.select(".total_pages").first();this.maxSearchNumber=8;this.getCanvasDimension();this.DEF_CITY_INFO=B.cityInfo;this.DEF_TRADE_TYPE=B.tradetype;this.filter=B.filter;this.filter.defaultPrice=this.filter.price;this.filter.defaultRoom=this.filter.room;this.flag=B.filter.flag;this.flagname=B.filter.flagname;this.DEF_PROP_WINDOW_WIDTH=550;this.DEF_PROP_WINDOW_HEIGHT=435;this.DEF_LEFT_LIMIT=380;this.DEF_ARROW_WIDTH=7;this.keyword="";this.mapMarkers=new Hash();this.pwCommId=0;this.propPage=1;this.propOrder=41;this.propIsHq=0;this.dragging=0;this.subwayZoom=13;this.currentCommId=0;this.maxPage=0;this.curr_lat=B.cityInfo.lat;this.curr_lng=B.cityInfo.lng;this.curr_zoom=B.cityInfo.zoom;this.propMaxCondition=17;this.propHideLinkCondition=11;this.propConditions=0;this.logurl="/v2/map/log/";this.currentClickType=0;this.currentClickFrom=0;this.mapTrackers=new Hash();this.polyLine=new Hash();this.cavansElement.select(".map2_propwind_close").each(function(E){E.observe("click",function(){this.currentClickType=2;this.currentClickFrom=9;var F=this.buildUrl(this.currentCommId,this.propPage,this.propOrder);new Ajax.Request(F,{method:"get",onSuccess:function(G){}.bind(this)});this.hidePropWind()}.bind(this))}.bind(this));this.propwind.select(".page_next").first().observe("click",function(){if(this.propPage<this.maxPage){this.propPage+=1;this.updatePropWind(this.propCommId,this.propPage,this.propOrder,2,1)}}.bind(this));this.propwind.select(".page_prev").first().observe("click",function(){this.propPage-=1;if(this.propPage==0){this.propPage=1}this.updatePropWind(this.propCommId,this.propPage,this.propOrder,2,2)}.bind(this));this.hqbutton.observe("click",function(){if(this.hqbutton.checked){this.propIsHq=1}else{this.propIsHq=0}this.propPage=1;this.updatePropWind(this.propCommId,this.propPage,this.propOrder,2,3)}.bind(this));document.observe("map:pan",function(E){this.map.panTo(new GLatLng(E.memo.lat,E.memo.lng));if(E.memo.zoom!=undefined){this.removeMapMarkers();this.map.setZoom(E.memo.zoom)}}.bind(this));document.observe("map:center",function(E){this.map.setCenter(new GLatLng(E.memo.lat,E.memo.lng),E.memo.zoom)}.bind(this));document.observe("map:zoom",function(E){this.map.setZoom(E.memo.zoom)}.bind(this));document.observe("filter:price",function(E){this.filter.price=E.memo.price;this.filter.defaultPrice=E.memo.price;this.hidePropWind();this.getJsonMarkers();this.updateListUrl()}.bind(this));document.observe("filter:model",function(E){this.filter.room=E.memo.model;this.filter.defaultRoom=E.memo.model;this.hidePropWind();this.getJsonMarkers();this.updateListUrl()}.bind(this));document.observe("filter:range",function(E){this.filter.area=E.memo.range;this.hidePropWind();this.getJsonMarkers();this.updateListUrl()}.bind(this));document.observe("filter:fitment",function(E){this.filter.fitment=E.memo.fitment;this.hidePropWind();this.getJsonMarkers();this.updateListUrl()}.bind(this));document.observe("map:type",function(E){if(E.memo.type=="normal"){this.map.setMapType(G_NORMAL_MAP);this.logging("map.maptype","{tradetype:"+this.DEF_TRADE_TYPE+",frommode:'hybrid',tomode:'normal'}")}else{if(E.memo.type=="hybrid"){this.map.setMapType(G_HYBRID_MAP);this.logging("map.maptype",'{"tradetype":"'+this.DEF_TRADE_TYPE+'","frommode":"normal","tomode":"hybrid"}')}}}.bind(this));document.observe("map:geo",function(F){var E=F.memo.keyword;this.getGeo(E);this.logging("map.searchbox",'{"tradetype":"'+this.DEF_TRADE_TYPE+'","keywords":"'+E+'"}')}.bind(this));document.observe("custom:tracker",function(E){this.filter.customtype=E.memo.type;this.filter.customid=E.memo.id}.bind(this));this.propWindOrder=this.propwind.select(".sort_buttons").first().select(".sort_button");this.propWindOrder.each(function(E){E.observe("click",function(G){this.propWindOrder.each(function(H){H.className="sort_button"}.bind(this));switch(E.rel){case"11":if(this.propOrder==11){E.className="sort_button sort_button_up";this.propOrder=12}else{E.className="sort_button sort_button_down";this.propOrder=11}var F=4;break;case"21":if(this.propOrder==21){E.className="sort_button sort_button_up";this.propOrder=22}else{E.className="sort_button sort_button_down";this.propOrder=21}var F=5;break;case"41":E.className="sort_button sort_button_down";this.propOrder=41;var F=6;break}this.updatePropWind(this.propCommId,this.propPage,this.propOrder,2,F)}.bind(this))}.bind(this));if(this.filter.customtype>0&&this.filter.customid>0){sidebar.switchTab($("map2_tab_selector_upper").select(".metro").first());this.customTrackers()}else{sidebar.switchTab($("map2_tab_selector_upper").select(".area").first())}},customTrackers:function(){this.removeTrackers();this.removePolyLine();var B=this.filter.customtype;var C=this.filter.customid;if(!this.mapTrackers.get(C)){var A="/v2/map/markers/"+C;new Ajax.Request(A,{method:"get",onSuccess:function(D){this.mapTrackers.set(C,D.responseJSON);this.drawTrackers(C)}.bind(this)})}else{this.drawTrackers(C)}},drawTrackers:function(B){var C=this.mapTrackers.get(B);if(C){if(C.points!=null){C.points.each(function(D){if(D.title.blank()){return false}var E=this.buildTracker(this.filter.customtype,D.title,D.lat,D.lng);if($("tracker_"+this.filter.customtype+D.lat+D.lng)){$("tracker_"+this.filter.customtype+D.lat+D.lng).remove()}var G=new GLatLng(D.lat,D.lng);var F=this.map.fromLatLngToDivPixel(G);this.drawTracker(E,F.y,F.x)}.bind(this))}if(C.lines!=""){var A=0;C.lines.each(function(F){var D=new Array();for(i=0;i<F.vertex.length;i++){D[i]=new GLatLng(F.vertex[i].lat,F.vertex[i].lng)}var E=this.buildPolyLine(D,F.color,F.weight,0.9);this.polyLine.set(A,E);this.map.addOverlay(E);A++}.bind(this))}}},removeTrackers:function(){this.cavansElement.select(".tracker").each(function(A){A.remove()})},removePolyLine:function(){var A=this.polyLine.keys();for(i=0;i<A.length;i++){this.map.removeOverlay(this.polyLine.get(A[i]))}},buildPolyLine:function(A,B,D,C){return new GPolyline(A,B,D,C)},buildTracker:function(E,A,G,B){var F=$(document.createElement("div"));F.id="tracker_"+E+G+B;F.className="tracker";var D=$(document.createElement("div"));if(E==2){D.className="tracker_icon icon_subway"}else{D.className="tracker_icon icon_custom"}var H=$(document.createElement("div"));H.className="tracker_text";H.update(A);var C=$(document.createElement("div"));C.className="tracker_right";Event.observe(D,"mouseover",function(I){F.className="tracker tracker_hover"});Event.observe(D,"mouseout",function(I){F.className="tracker"});Event.observe(H,"mouseover",function(I){F.className="tracker tracker_hover"});Event.observe(H,"mouseout",function(I){F.className="tracker"});Event.observe(D,"click",function(){document.fire("map:center",{lat:G,lng:B,zoom:this.subwayZoom})}.bind(this));Event.observe(H,"click",function(){document.fire("map:center",{lat:G,lng:B,zoom:this.subwayZoom})}.bind(this));F.insert(D);F.insert(H);F.insert(C);return F},drawTracker:function(A,C,B){Element.insert(this.markerPanel,A);A.setStyle({top:C-50+"px",left:B+"px",display:"block"})},getGeo:function(A){if(this.geocoder==undefined){this.geocoder=new GClientGeocoder();this.searchBound=new GLatLngBounds(new GLatLng(this.DEF_CITY_INFO.swlat,this.DEF_CITY_INFO.swlng),new GLatLng(this.DEF_CITY_INFO.nelat,this.DEF_CITY_INFO.nelng));this.geocoder.setViewport(this.searchBound)}this.hidePropWind();$kw=this.DEF_CITY_INFO.name+"+"+A;this.loadingAutoComplatePanel();this.geocoder.getLocations($kw,function(D){if(!D||D.Status.code!=200){this.disappearAutoComplatePanel();this.showResultErr();APF.log("NO ADDRESS")}else{var C=D.Placemark[0];var B=new GLatLng(C.Point.coordinates[1],C.Point.coordinates[0]);if(B&&this.searchBound.containsLatLng(B)){this.searchPoint=B;this.map.panTo(B);if(this.searchMarker==undefined){this.searchMarker=new GMarker(B);this.map.addOverlay(this.searchMarker)}else{this.searchMarker.setLatLng(B)}this.updateAutoComplatePanel(D.Placemark);this.searchMarker.openInfoWindowHtml(C.address)}else{if(this.noPromptNoResult!=1){if(this.noticeNoResult==undefined){this.noticeNoResult=this.cavansElement.select(".map2_notice_noresult").first();var E=this.noticeNoResult.select(".l4").first();E.observe("click",function(){this.hideNoResultNotice()}.bind(this))}var F=(this.canvasDimension.width-360)/2;this.noticeNoResult.select(".l1").first().innerHTML="找不到这个地方："+A;this.noticeNoResult.setStyle({display:"block",left:F+"px"});this.disappearAutoComplatePanel()}}}}.bind(this))},getCanvasDimension:function(){this.canvasDimension=this.canvas.getDimensions()},drawMap:function(){this.map=new GMap2(this.canvas);var A=new GLatLng(this.DEF_CITY_INFO.lat,this.DEF_CITY_INFO.lng);this.map.setCenter(A,this.DEF_CITY_INFO.zoom);this.getBounds();this.markerPanel=this.map.getPane(G_MAP_MARKER_PANE);this.map.enableScrollWheelZoom();this.map.addControl(new GLargeMapControl());G_NORMAL_MAP.getMinimumResolution=function(){return 9};G_NORMAL_MAP.getMaximumResolution=function(){return 19};G_HYBRID_MAP.getMinimumResolution=function(){return 9};G_HYBRID_MAP.getMaximumResolution=function(){return 19};GEvent.addListener(this.map,"click",function(){this.disappearAutoComplatePanel()}.bind(this));GEvent.addListener(this.map,"dragstart",function(){this.disappearAutoComplatePanel()}.bind(this));GEvent.addListener(this.map,"zoomend",function(){window.clearTimeout(this.timeoutHandle);this.hideCommName();this.hideCommNameHighLight();this.hidePropWind();this.removeMapMarkers();this.removeTrackers();this.doTrack({linkTrackVars:"events",linkTrackEvents:"event8",events:"event8",pVar:"zoom"})}.bind(this));GEvent.addListener(this.map,"movestart",function(){window.clearTimeout(this.timeoutHandle);this.dragging=1;this.hidePropWind();this.hideCommName();this.hideCommNameHighLight();this.hideNotice()}.bind(this));GEvent.addListener(this.map,"moveend",function(){this.customTrackers();this.timeoutHandle=window.setTimeout(function(){this.getBounds();this.getJsonMarkers()}.bind(this),800);this.dragging=0;this.hidePropWind();this.hideCommName();this.hideCommNameHighLight();if(this.flag=="1"){this.drawFlagMarker(new GLatLng(this.DEF_CITY_INFO.lat,this.DEF_CITY_INFO.lng),this.flagname)}}.bind(this));if(this.flag=="1"){this.drawFlagMarker(new GLatLng(this.DEF_CITY_INFO.lat,this.DEF_CITY_INFO.lng),this.flagname)}},getBounds:function(){var E=80;var G=this.map.fromContainerPixelToLatLng(new GPoint(E,E/2));var D=this.map.fromContainerPixelToLatLng(new GPoint(this.canvasDimension.width-E/2,this.canvasDimension.height-E/2));var B=D.lat().toFixed(3);var A=G.lat().toFixed(3);var F=G.lng().toFixed(3);var C=D.lng().toFixed(3);this.bounds={slatFrom:B,slatTo:A,slngFrom:F,slngTo:C}},buildMarker:function(D,C,F,E,B){var A=$(document.createElement("div"));A.update('<div id="prop_num_'+E+'"><strong>'+D+"</strong>&nbsp;套</div>");A.className="marker";A.writeAttribute("propNum",D);A.id=E;A.name=C;A.fullname=B;this.updateMarker(A,F);return A},buildDefaultCommName:function(A,B){if($("map2_commname_default_"+A.id)){$("map2_commname_default_"+A.id).remove()}comm_name=$(document.createElement("div"));comm_name.className="map2_commname_default";comm_name.id="map2_commname_default_"+A.id;comm_name.update(A.name);Event.observe(comm_name,"click",function(){if(this.currentCommId>0){$("prop_num_"+this.currentCommId).parentNode.className="marker"}var C=this.map.fromLatLngToContainerPixel(B);this.showPropWind(C.y,C.x,A.id,A.name,A.fullname)}.bind(this));Event.observe(comm_name,"mouseover",function(C){if(C.stopPropagation){C.stopPropagation()}else{C.cancelBubble=true}A.className="marker marker_hover";$("map2_commname_default_"+A.id).addClassName("map2_commname_hover")}.bind(this));Event.observe(comm_name,"mouseout",function(C){if(this.currentCommId!=A.id){if(this.currentCommId!=A.id){if(C.stopPropagation){C.stopPropagation()}else{C.cancelBubble=true}A.className="marker"}}$("map2_commname_default_"+A.id).removeClassName("map2_commname_hover")}.bind(this));return comm_name},drawMarker:function(A,C,B,D){Element.insert(this.markerPanel,A);A.setStyle({top:C-40+"px",left:B+"px",display:"block"});current_zoom=this.map.getZoom();if(current_zoom>15){default_commname=this.buildDefaultCommName(A,D);default_commname.setStyle({top:C-42+"px",left:B+45+"px"});Element.insert(this.markerPanel,default_commname)}},updateMarker:function(A,B){Event.observe(A,"mouseover",function(C){if(this.currentCommId>0&&this.currentCommId!=A.id){this.hideCommNameHighLight()}Event.stop(C);A.className="marker marker_hover";if(this.dragging==0){var D=this.map.fromLatLngToContainerPixel(B);this.showCommName(A.name,D.y,D.x)}}.bind(this));Event.observe(A,"mouseout",function(C){if(this.currentCommId!=A.id){Event.stop(C);A.className="marker";this.hideCommName()}}.bind(this));Event.observe(A,"click",function(){if(this.currentCommId>0){$("prop_num_"+this.currentCommId).parentNode.className="marker"}var C=this.map.fromLatLngToContainerPixel(B);this.showPropWind(C.y,C.x,A.id,A.name,A.fullname);this.doTrack({linkTrackVars:"events",linkTrackEvents:"event10",events:"event10",pVar:"click"})}.bind(this))},showInfoWindow:function(E,D){var A=this.DEF_PROP_WINDOW_WIDTH;var F=this.DEF_PROP_WINDOW_HEIGHT;var C=parseInt((this.canvasDimension.height-F)/2);var B=parseInt((this.canvasDimension.width-A)/2);this.propwind.setStyle({top:C+"px",left:B+"px",display:"block"})},showCommName:function(A,C,B){this.commname.update(A);this.commname.setStyle({top:C-41+"px",left:B+45+"px",display:"block"})},showCommNameDefault:function(A,D,C){var B=new Element("div");B.className="map2_commname_default";B.update(A);B.setStyle({top:D-42+"px",left:C+45+"px",display:"block"});this.cavansElement.appendChild(B)},hideCommName:function(){this.commname.setStyle({display:"none"})},showCommNameHighLight:function(E,B,D,C,A){this.hideCommName();this.commname_heighlight.update(B);this.commname_heighlight.setStyle({top:D-41+"px",left:C+45+"px",display:"block"});Event.stopObserving(this.commname_heighlight,"click");Event.observe(this.commname_heighlight,"click",function(){this.showPropWind(D,C,E,B,A)}.bind(this))},hideCommNameHighLight:function(){if(this.currentCommId>0&&$("prop_num_"+this.currentCommId)){$("prop_num_"+this.currentCommId).parentNode.className="marker"}if($("map2_commname_default_"+this.currentCommId)){$("map2_commname_default_"+this.currentCommId).removeClassName("map2_commname_hover")}this.currentCommId=0;this.hideCommName();this.commname_heighlight.setStyle({display:"none"})},showWindArrow:function(B,A){if(A<this.DEF_LEFT_LIMIT){this.proparrow.className="map2_proparrow map2_proparrow_right";windowLeft=A}else{this.proparrow.className="map2_proparrow map2_proparrow_left";windowLeft=A-this.DEF_ARROW_WIDTH-1}this.proparrow.setStyle({top:B-7+"px",left:windowLeft+"px",display:"block"})},showPropWind:function(D,C,E,B,A){this.currentCommId=E;this.showCommNameHighLight(E,B,D,C,A);$("prop_num_"+this.currentCommId).parentNode.addClassName("marker_hover");this.setFilter(this.propWindOrder,0);this.propwind_listlink.update(A);this.propwind_listlink.href="/v2/community/view/"+E;this.propwind.select(".map2_comm_moreinfo").first().href="/v2/community/details/"+E;this.propwind.select(".map2_comm_fresh").first().href="/v2/community/view/"+E;this.propwind_morelink.show();this.propCommId=E;this.propPage=1;this.propOrder=41;this.propIsHq=0;this.hqbutton.checked=false;this.updatePropWind(this.propCommId,this.propPage,this.propOrder,1,0);this.showInfoWindow(D,C)},hidePropWind:function(){this.proparrow.setStyle({display:"none"});this.propwind.setStyle({display:"none"});this.clearPropWinCondition();if(!this.dragging&&this.changedFilter){this.changedFilter=false;this.filter.price=this.filter.defaultPrice;this.filter.room=this.filter.defaultRoom}},updatePropWind:function(F,E,A,B,D){this.showLoading();this.currentClickType=B;this.currentClickFrom=D;var C=this.buildUrl(F,E,A);new Ajax.Request(C,{method:"get",onSuccess:function(I){this.drawPropBox(I.responseJSON);var H=this.propwind.select(".map2_filters_price").first();var G=this.propwind.select(".map2_filters_housemodel").first();if(H.innerHTML!=""||G!=""){this.clearPropWinCondition();this.getConditions(I.responseJSON[3])}}.bind(this)})},drawPropBox:function(H){this.propwindTable.update("");if(this.propBoxes==undefined){this.propNum=this.cavansElement.select(".prop_num").first();this.propPriceTrend=this.cavansElement.select(".prop_pricetrend").first()}var I=6;this.propNum.update(H[0]);this.maxPage=H[0]%I==0?parseInt(H[0]/I):parseInt(H[0]/I)+1;if(this.propPage==1){this.propwind.select(".page_prev").first().setStyle("visibility:hidden;")}else{this.propwind.select(".page_prev").first().setStyle("visibility:visible;")}if(this.propPage<this.maxPage){this.propwind.select(".page_next").first().setStyle("visibility:visible;")}else{this.propwind.select(".page_next").first().setStyle("visibility:hidden;")}this.page_info.update(this.propPage+"/"+this.maxPage);this.propPriceTrend.update(H[1]);var J=H[2];if(J.length>0){$("noprops").hide();for(var F=0;F<I;F++){if(typeof (J[F])=="undefined"){break}var B=J[F];var G=new Element("li");var O=new Element("div");O.addClassName("proimg");var L=new Element("div");L.addClassName("proname");var M=new Element("div");M.addClassName("area");var A=new Element("div");A.addClassName("price");if(B!=undefined){var E=new Element("a",{href:"javascript:;",rel:B[5]});var D=new Element("img",{border:"0",src:B[1]});D.setAttribute("width",53);D.setAttribute("height",40);E.insert(D);var K=new Element("p");K.addClassName("hq");K.update('&nbsp;<img src="http://pages.anjukestatic.com/img/subway/icon-more-28x16.gif" alt="" />');var C=new Element("p");C.addClassName("title");C.update('<a rel="'+B[5]+'" href="'+B[5]+'" onclick="return false;" title="'+B[13]+'">'+B[6]+"</a>");var N=new Element("p");if(B[12]==1){N.update(B[2]+"室"+B[8]+"厅，"+B[3]+"平米，"+B[9]+"层，<span>"+B[11]+"发布</span>")}else{N.update(B[2]+"室"+B[8]+"厅，"+B[3]+"平米，"+B[9]+"层，<span>"+B[11]+"发布</span>")}O.update(E);if(B[7]){C.insert(K)}L.insert(C);L.insert(N);M.update(B[3]+"平米");A.update(B[4])}else{O.update(null);L.update(null);M.update(null);A.update(null)}G.insert(O);G.insert(L);G.insert(A);this.propwindTable.insert(G)}this.hideLoading()}else{$("noprops").setStyle("display:block");this.propwindLoad.hide();this.propwindTable.hide();this.propwindNumber.show()}this.propwindTable.select("li").each(function(P){P.observe("mouseover",function(Q){P.addClassName("list_hover");Event.stop(Q)}.bind(this));P.observe("mouseout",function(Q){P.removeClassName("list_hover");Event.stop(Q)}.bind(this));P.observe("click",function(R){var Q=new Element("form",{action:P.select("a").first().rel,target:"_blank"});Q.setStyle("width:0px;height:0px;font-size:0px;line-height:0;overflow:hidden;display:inline;margin:0;padding:0;");P.insert(Q);Q.submit();Q.remove()}.bind(this))}.bind(this))},showLoading:function(){if(this.propwindTable==undefined){this.propwindLoad=this.propwind.select(".map2_propwind_load").first();this.propwindTable=this.propwind.select(".property_list").first();this.propwindNumber=this.propwind.select(".prop_num").first();this.propwindPagenav=$("map2_info_page")}this.propwindLoad.show();this.propwindTable.hide();this.propwindNumber.hide();this.propwindPagenav.hide();$("noprops").hide()},hideLoading:function(){this.propwindLoad.hide();this.propwindTable.show();this.propwindNumber.show();this.propwindPagenav.show()},getJsonMarkers:function(){document.fire("tip:loading");this.currentClickType=0;this.currentClickFrom=0;var A=this.buildUrl(0,1,0);this.updateLocationHref();new Ajax.Request(A,{method:"get",onSuccess:function(H){var F=H.responseJSON;var E=Object.keys(F);var B=E.length;document.fire("tip:finished",{num:B});if(B==0){this.removeMapMarkers();this.hideCommName();this.hideCommNameHighLight();if(this.noPrompt!=1){if(this.notice==undefined){this.notice=this.cavansElement.select(".map2_notice").first();var D=this.notice.select(".l4").first();D.observe("click",function(){this.hideNotice()}.bind(this))}var G=(this.canvasDimension.width-360)/2;this.notice.setStyle({display:"block",left:G+"px"})}}else{this.hideNotice();this.mapMarkers.each(function(J){var I=F[J.key];if(I==undefined||I[1]!=J.value.readAttribute("propNum")){if($("map2_commname_default_"+J.key)){$("map2_commname_default_"+J.key).remove()}this.mapMarkers.get(J.key).remove();if(this.currentCommId==J.key){this.hidePropWind();this.hideCommNameHighLight()}this.mapMarkers.unset(J.key)}else{var L=new GLatLng(I[2],I[3]);var K=this.map.fromLatLngToDivPixel(L);this.mapMarkers.get(J.key).remove();if($("map2_commname_default_"+J.key)){$("map2_commname_default_"+J.key).remove()}this.drawMarker(this.mapMarkers.get(J.key),K.y,K.x,L)}}.bind(this));var C=0;E.each(function(I){if(this.mapMarkers.get(I)==undefined){window.setTimeout(function(){var K=F[I];var M=new GLatLng(K[2],K[3]);var J=this.buildMarker(K[1],K[0],M,I,K[4]);var L=this.map.fromLatLngToDivPixel(M);if(this.mapMarkers.get(I)){this.mapMarkers.get(I).remove()}this.drawMarker(J,L.y,L.x,M);this.mapMarkers.set(I,J)}.bind(this),C++*30)}}.bind(this))}}.bind(this)})},removeMapMarkers:function(){this.mapMarkers.each(function(A){if($("map2_commname_default_"+A.key)){$("map2_commname_default_"+A.key).remove()}this.mapMarkers.get(A.key).remove();this.mapMarkers.unset(A.key)}.bind(this))},buildUrl:function(D,E,B){var G=this.map.getCenter();var F=this.map.getZoom();var A=$H({p2:this.DEF_TRADE_TYPE,p3:this.bounds.slatFrom,p4:this.bounds.slatTo,p5:this.bounds.slngFrom,p6:this.bounds.slngTo,p7:this.filter.price,p8:this.filter.area,p9:this.filter.room,p14:this.filter.fitment,p11:D,p12:E,p13:B,p15:1,p16:1,p17:this.curr_lat,p18:this.curr_lng,p19:G.lat(),p20:G.lng(),p21:this.curr_zoom,p22:F,p23:this.filter.customtype,p24:this.filter.customid,p25:this.currentClickType,p26:this.currentClickFrom,is_hq:this.propIsHq}).toQueryString();var C="/v2/map/search?"+A;return C},setFilter:function(A,B){this.propWindOrder.each(function(C){C.className="sort_button";if(C.rel==41){C.className="sort_button orderdown"}}.bind(this))},hideNotice:function(){if(this.notice!=undefined){if($("chkNoPrompt").checked==true){this.noPrompt=1;APF.Utils.setCookie("noprmp",1,30)}this.notice.setStyle({display:"none"})}},hideNoResultNotice:function(){if(this.noticeNoResult!=undefined){if($("chkNoPromptNoResult").checked==true){this.noPromptNoResult=1;APF.Utils.setCookie("noprmp_norslt",1,30)}this.noticeNoResult.setStyle({display:"none"})}},wlog:function(A){GLog.write(A)},updateLocationHref:function(){var B=document.location.hash.substring(1).toQueryParams();var C=this.map.getCenter();var A=this.map.getZoom();upparams={};upparams.l1=C.lat();upparams.l2=C.lng();upparams.l3=A;this.curr_lat=upparams.l1;this.curr_lng=upparams.l2;this.curr_zoom=upparams.l3;B.kw="";upparams.f1=this.filter.price;upparams.f2=this.filter.area;upparams.f3=this.filter.room;upparams.f4=this.filter.fitment;upparams.f5=this.filter.customtype;upparams.f6=this.filter.customid;upparams.flag=this.flag;upparams.flagname=this.flagname;document.location.hash=Object.toQueryString(upparams)},logging:function(B,A){new Ajax.Request(this.logurl,{method:"get",parameters:{key:B,string:A},onSuccess:function(C){}.bind(this)})},updateAutoComplatePanel:function(B){this.serch_result_container.innerHTML="";this.serch_result_container.removeClassName("loading");this.serch_result_container.setStyle("display:block");list_content=new Element("ul");for(i=0;i<B.length;i++){if(i>=this.maxSearchNumber){break}var A=new Element("li");if(i==0){A.addClassName("selected")}A.innerHTML='<a href="javascript:;" rel="'+i+'" id="item_address_'+i+'">'+B[i]["address"]+"</a>";list_content.appendChild(A)}closeLi=new Element("li");closeLi.addClassName("close");closeLi.innerHTML='<a href="javascript:;" id="item_close">关闭</a>';list_content.appendChild(closeLi);this.serch_result_container.appendChild(list_content);this.serch_result_container.select("a").each(function(C){if(C.id=="item_close"){C.observe("click",function(){this.disappearAutoComplatePanel()}.bind(this))}else{C.observe("click",function(){this.serch_result_container.select("li").each(function(F){if(F.select("a").first().id==C.id){F.addClassName("selected")}else{F.removeClassName("selected")}}.bind(this));var E=B[C.rel];var D=new GLatLng(E.Point.coordinates[1],E.Point.coordinates[0]);this.searchPoint=D;this.map.setCenter(D);if(this.searchMarker==undefined){this.searchMarker=new GMarker(D);this.map.addOverlay(this.searchMarker)}else{this.searchMarker.setLatLng(D)}this.searchMarker.openInfoWindowHtml(E.address)}.bind(this))}}.bind(this))},loadingAutoComplatePanel:function(){this.serch_result_container.addClassName("loading");this.serch_result_container.setStyle("display:block");this.serch_result_container.innerHTML="正在查找，请稍候..."},disappearAutoComplatePanel:function(){this.serch_result_container.innerHTML="";this.serch_result_container.removeClassName("loading");this.serch_result_container.setStyle("display:none")},doTrack:function(B){if(typeof s_account=="undefined"){return }var A=s_gi(s_account);if(B.linkTrackVars){A.linkTrackVars=B.linkTrackVars}if(B.linkTrackEvents){A.linkTrackEvents=B.linkTrackEvents}if(B.eVar13){A.eVar13=B.eVar13}if(B.events){A.events=B.events}A.tl(this,"o",B.pVar)},getConditions:function(H){var F=this.propwind.select(".map2_filters_price").first();var A=this.propwind.select(".map2_filters_housemodel").first();this.propConditions=0;for(i=0;i<H.price.length;i++){if(H.price[i][3]>0){this.propConditions++;lower_price=this.DEF_TRADE_TYPE==1?H.price[i][1]/10000:H.price[i][1];upper_price=this.DEF_TRADE_TYPE==1?H.price[i][2]/10000:H.price[i][2];title=this.DEF_TRADE_TYPE==1?"万":"元/月";var G=new Element("li");if(this.filter.price==H.price[i][0]){G.addClassName("selected")}var D=new Element("a",{id:"price_filter_"+i,priceid:H.price[i][0],href:"javascript:;"});if(H.price[i][0]==0){D.update("不限")}else{if(lower_price>0&&upper_price<10000){D.update(lower_price+"-"+upper_price+title)}else{if(lower_price<=0){D.update(upper_price+title+"以下")}if(upper_price>=10000){D.update(lower_price+title+"以上")}}}G.insert(D);F.insert(G)}}F.select("li").each(function(J){var I=J.select("a").first();I.observe("click",function(K){F.select("li").each(function(L){L.removeClassName("selected")});I.parentNode.addClassName("selected");this.propPage=1;this.filter.price=I.readAttribute("priceid");this.changedFilter=true;this.updatePropWind(this.propCommId,this.propPage,this.propOrder,2,7)}.bind(this))}.bind(this));for(j=0;j<H.housemodel.length;j++){var E=new Array("零","一","二","三","四","五","六");if(H.housemodel[j][2]>0){this.propConditions++;var B=new Element("li");if(this.filter.room==H.housemodel[j][0]){B.addClassName("selected")}var C=new Element("a",{hmid:H.housemodel[j][0],href:"javascript:;"});if(H.housemodel[j][0]==0){C.update("不限")}else{if(H.housemodel[j][1]==E.length-1){C.update(E[H.housemodel[j][1]-1]+"室以上")}else{C.update(E[H.housemodel[j][1]]+"室")}}B.insert(C);A.insert(B)}}A.select("li").each(function(J){var I=J.select("a").first();I.observe("click",function(K){A.select("li").each(function(L){L.removeClassName("selected")});I.parentNode.addClassName("selected");this.propPage=1;this.filter.room=I.readAttribute("hmid");this.changedFilter=true;this.updatePropWind(this.propCommId,this.propPage,this.propOrder,2,8)}.bind(this))}.bind(this));if(this.propConditions>this.propHideLinkCondition){this.propwind_morelink.hide()}if(this.propConditions>=this.propMaxCondition){this.win_housemodel_list.addClassName("map2_filters_housemodel_float")}else{this.win_housemodel_list.removeClassName("map2_filters_housemodel_float")}},clearPropWinCondition:function(){var B=this.propwind.select(".map2_filters_price").first();var A=this.propwind.select(".map2_filters_housemodel").first();B.update("");A.update("")},updateHeader:function(){this.PageHeaderObj.updateSelectors(this.filter)},updateListUrl:function(){this.PageSidebar.updateListUrl(this.filter,this.DEF_TRADE_TYPE)},drawFlagMarker:function(A,B){var E=this.map.fromLatLngToDivPixel(A);var D=E.y;var C=E.x;if(D>0&&C>0){if(this.divGeoPointer==undefined){this.divGeoPointer=$(document.createElement("div"));this.divGeoPointer.setStyle({display:"none",whiteSpace:"nowrap"});Element.insert(this.map.getPane(G_MAP_MARKER_PANE),this.divGeoPointer);this.divGeoArrow=$(document.createElement("div"));this.divGeoArrow.setStyle({display:"none"});Element.insert(this.map.getPane(G_MAP_MARKER_PANE),this.divGeoArrow);this.divGeoPointer.update(B)}this.divGeoPointer.className="mapFinddingCanvasGeoPointer";this.divGeoPointer.setStyle({top:D-59+"px",left:C-32+"px",display:"block"});this.divGeoArrow.className="mapFinddingCanvasGeoArrow";this.divGeoArrow.setStyle({top:D-40+"px",left:C-12+"px",display:"block"})}else{this.divGeoPointer.remove();this.divGeoArrow.remove()}},rebuildList:function(B,A){}});APF.Namespace.register("Anjuke.Map2");Anjuke.Map2.Sidebar=Class.create({initialize:function(B){var E=$(B);var C=E.select("#sidebar_area_box a");var D=E.select("#sidebar_metro_box a");var A=E.select("#sidebar_custom_box a");this.listlink=E.select(".switch_to_list").first();var F=this;this.tabbar_selector=E.select("#map2_tab_selector_upper a");C.each(function(G){G.observe("click",function(){var K=G.readAttribute("lat");var H=G.readAttribute("lng");var I=parseInt(G.readAttribute("zoom"));document.fire("map:center",{lat:K,lng:H,zoom:I});var J=G.innerHTML;J=J.replace(/(^\s*)|(\s*$)/g,"");F.doTrack({linkTrackVars:"eVar13,events",linkTrackEvents:"event9",eVar13:J,events:"event9",pVar:"区域"})})});D.each(function(G){G.observe("click",function(){var I=G.readAttribute("type");var M=G.readAttribute("oid");document.fire("custom:tracker",{type:I,id:M});var L=G.readAttribute("lat");var H=G.readAttribute("lng");var J=parseInt(G.readAttribute("zoom"));document.fire("map:center",{lat:L,lng:H,zoom:J});var K=G.innerHTML;K=K.replace(/(^\s*)|(\s*$)/g,"");F.doTrack({linkTrackVars:"eVar13,events",linkTrackEvents:"event9",eVar13:K,events:"event9",pVar:"轨道交通"})})});A.each(function(G){G.observe("click",function(){var I=G.readAttribute("type");var M=G.readAttribute("oid");document.fire("custom:tracker",{type:I,id:M});var L=G.readAttribute("lat");var H=G.readAttribute("lng");var J=parseInt(G.readAttribute("zoom"));document.fire("map:center",{lat:L,lng:H,zoom:J});var K=G.innerHTML;K=K.replace(/(^\s*)|(\s*$)/g,"");F.doTrack({linkTrackVars:"eVar13,events",linkTrackEvents:"event9",eVar13:K,events:"event9",pVar:"热门地图"})})});this.tabbar_selector.each(function(G){G.observe("mouseover",function(){this.switchTab(G)}.bind(this))}.bind(this))},switchTab:function(B){this.tabbar_selector.each(function(C){C.removeClassName("selected");$("tabbar_container").select("ul").each(function(D){D.setStyle({display:"none"})})}.bind(this));var A="sidebar_"+B.className+"_box";$(A).setStyle({display:"block"});B.addClassName("selected")},doTrack:function(B){if(typeof s_account=="undefined"){return }var A=s_gi(s_account);if(B.linkTrackVars){A.linkTrackVars=B.linkTrackVars}if(B.linkTrackEvents){A.linkTrackEvents=B.linkTrackEvents}if(B.eVar13){A.eVar13=B.eVar13}if(B.events){A.events=B.events}A.tl(this,"o",B.pVar)},updateListUrl:function(C,B){var A=B==1?"/v2/sale/":"/v2/rent/";A+="W0QQdsmZmm";if(C.price>0){A+="QQp3Z"+C.price}if(C.room>0){A+="QQp5Z"+C.room}if(C.area>0){A+="QQp4Z"+C.area}if(C.fitment>0){A+="QQp8Z"+C.range}this.listlink.href=A}});APF.Namespace.register("Anjuke.Map2");Anjuke.Map2.SidebarFilter=Class.create({initialize:function(E,L){this.map2SidebarFilter=$(E);this.hideTimeout=L;var P=this.map2SidebarFilter.select(".qwhereimg").first();var O=this.map2SidebarFilter.select(".qwhereinput").first();var I=this.map2SidebarFilter.select(".map2_sidebar_filter_price a");var G=this.map2SidebarFilter.select(".map2_sidebar_filter_house a");var H=this.map2SidebarFilter.select(".map2_sidebar_filter_area a");var C=this.map2SidebarFilter.select(".map2_sidebar_filter_fitment a");var N=this.map2SidebarFilter.select(".filter_price").first();var M=this.map2SidebarFilter.select(".filter_house").first();var K=this.map2SidebarFilter.select(".filter_area_fit").first();var D=this.map2SidebarFilter.select(".map2_sidebar_filter_price").first();var B=this.map2SidebarFilter.select(".map2_sidebar_filter_house").first();var A=this.map2SidebarFilter.select(".map2_sidebar_filter_area").first();if(A==undefined){A=this.map2SidebarFilter.select(".map2_sidebar_filter_fitment").first()}this.timeoutHandles=[];var J=this;var F=[[N,D,2],[M,B,3],[K,A,4]];F.each(function(T){var Q=T[0];var S=T[1];var R=T[2];if(Q!=undefined){Q.observe("mouseover",function(){window.clearTimeout(this.timeoutHandles[R]);F.each(function(W){qf=W[1];if(qf!=undefined){var V=this.map2SidebarFilter.select(".map2_sidebar_filters_panel li");V.each(function(X){X.removeClassName("selected")});qf.setStyle({display:"none"})}}.bind(this));Q.addClassName("selected");var U=S.select(".background").first();U.setStyle({height:(S.getHeight()-38)+"px"});S.setStyle({display:"block",top:Q.offsetTop+"px"})}.bind(this));Q.observe("mouseout",function(U){window.clearTimeout(this.timeoutHandles[R]);this.hideDiv(U,S,L,R,Q)}.bind(this))}if(S!=undefined){S.observe("mouseover",function(U){window.clearTimeout(this.timeoutHandles[R])}.bind(this));S.observe("mouseout",function(U){window.clearTimeout(this.timeoutHandles[R]);this.hideDiv(U,S,L,R,Q)}.bind(this))}}.bind(this));if(I.length>0){I.each(function(Q){Q.observe("click",function(){var R=Q.readAttribute("paramid");D.setStyle({display:"none"});N.update('<a href="javascript:;" style="color:#EB6100">'+Q.innerHTML+"</a>");N.removeClassName("selected");document.fire("filter:price",{price:R});J.doTrack({linkTrackVars:"eVar13,events",linkTrackEvents:"event9",events:"event9",eVar13:R,pVar:"售价"})})})}if(G.length>0){G.each(function(Q){Q.observe("click",function(){var R=Q.readAttribute("paramid");document.fire("filter:model",{model:R});B.setStyle({display:"none"});M.update('<a href="javascript:;" style="color:#EB6100">'+Q.innerHTML+"</a>");M.removeClassName("selected");J.doTrack({linkTrackVars:"eVar13,events",linkTrackEvents:"event9",events:"event9",eVar13:R,pVar:"房型"})})})}if(C.length>0){C.each(function(Q){Q.observe("click",function(){var R=Q.readAttribute("paramid");document.fire("filter:fitment",{fitment:R});A.setStyle({display:"none"});K.update('<a href="javascript:;" style="color:#EB6100">'+Q.innerHTML+"</a>");K.removeClassName("selected");J.doTrack({linkTrackVars:"eVar13,events",linkTrackEvents:"event9",events:"event9",eVar13:R,pVar:"click"})})})}if(H.length>0){H.each(function(Q){Q.observe("click",function(){var R=Q.readAttribute("paramid");document.fire("filter:range",{range:R});A.setStyle({display:"none"});K.update('<a href="javascript:;" style="color:#EB6100">'+Q.innerHTML+"</a>");K.removeClassName("selected");J.doTrack({linkTrackVars:"eVar13,events",linkTrackEvents:"event9",events:"event9",eVar13:R,pVar:"面积"})})})}P.observe("click",function(){var Q=O.className.indexOf("gray")==-1?O.value:"";if(!Q.blank()){document.fire("map:geo",{keyword:Q});J.doTrack({linkTrackVars:"eVar13,events",linkTrackEvents:"event1",events:"event1",eVar13:Q,pVar:"click"})}});O.observe("keyup",function(R){if(R.keyCode==13){var Q=O.value;if(!Q.blank()){document.fire("map:geo",{keyword:Q});J.doTrack({linkTrackVars:"eVar13,events",linkTrackEvents:"event1",events:"event1",eVar13:Q,pVar:"click"})}}});O.observe("focus",function(Q){if(O.className.indexOf("gray")!=-1){O.removeClassName("gray");O.value=""}$("search_result_panel").innerHTML="";$("search_result_panel").setStyle("display:none")});O.observe("blur",function(Q){if(O.value==""){O.addClassName("gray");O.value="输入名称或地标"}});document.observe("filter:price",function(Q){I.each(function(R){var S=R.readAttribute("paramid");if(S==Q.memo.id){N.update('<a href="javascript:;" style="color:#EB6100">'+R.innerHTML+"</a>");N.removeClassName("selected")}})});document.observe("filter:room",function(Q){G.each(function(R){var S=R.readAttribute("paramid");if(S==Q.memo.id){M.update('<a href="javascript:;" style="color:#EB6100">'+R.innerHTML+"</a>");M.removeClassName("selected")}})});document.observe("filter:area",function(Q){H.each(function(R){var S=R.readAttribute("paramid");if(S==Q.memo.id){K.update('<a href="javascript:;" style="color:#EB6100">'+R.innerHTML+"</a>");K.removeClassName("selected")}})});document.observe("filter:fitment",function(Q){C.each(function(R){var S=R.readAttribute("paramid");if(S==Q.memo.id){K.update('<a href="javascript:;" style="color:#EB6100">'+R.innerHTML+"</a>");K.removeClassName("selected")}})})},hideDiv:function(E,D,C,B,A){if(this.realOut(E,D)==true){window.clearTimeout(this.timeoutHandles[B]);this.timeoutHandles[B]=window.setTimeout(function(){A.removeClassName("selected");D.setStyle({display:"none"})},C)}},realOut:function(A,C){var B=A.explicitOriginalTarget==undefined?document.activeElement:A.explicitOriginalTarget;if(Element.descendantOf(B,C)){return false}else{return true}},doTrack:function(B){if(typeof s_account=="undefined"){return }var A=s_gi(s_account);if(B.linkTrackVars){A.linkTrackVars=B.linkTrackVars}if(B.linkTrackEvents){A.linkTrackEvents=B.linkTrackEvents}if(B.eVar13){A.eVar13=B.eVar13}if(B.events){A.events=B.events}A.tl(this,"o",B.pVar)},updateSelectors:function(C){var E=this.map2SidebarFilter.select(".map2_sidebar_filter_price a");var D=this.map2SidebarFilter.select(".map2_sidebar_filter_house a");var B=this.map2SidebarFilter.select(".filter_price").first();var A=this.map2SidebarFilter.select(".filter_house").first();if(C.price>0){E.each(function(F){var G=F.readAttribute("paramid");if(G==C.price){B.update('<a href="javascript:;" style="color:#EB6100">'+F.innerHTML+"</a>");B.removeClassName("selected")}}.bind(this))}if(C.room>0){D.each(function(F){var G=F.readAttribute("paramid");if(G==C.room){A.update('<a href="javascript:;" style="color:#EB6100">'+F.innerHTML+"</a>");A.removeClassName("selected")}}.bind(this))}}});