﻿/* (c) LoopNet MasterProperty Map Search Results Version 1.0 */
LNJS.__fiddlersearchresults=true;LNJS.FiddlerSearchResults=Class.create();LNJS.FiddlerSearchResults.prototype=(new LNJS.MapBase()).extend({initialize:function(options){this.__className="LNJS.FiddlerSearchResults";this.__trapErr=true;this.cacheEL("msgcont",null,true);this.cacheEL("msgclass",null,true);this.cacheEL("msgtext",null,true);this.cacheEL("msgpntr",null,true);this.cacheEL("msgdontshow",null,true);this.cacheEL("dontshowagain",null,true);this.cacheEL("msgclose",null,true);var msg=this.Msgs[LNJS.ErrType.SystemError][LNJS.ErrSource.ClientSideJavaScriptError];msg.extend({onShow:function(){if(LNJS.Page){LNJS.Page.hideUpdatingMapMsg();if(LNJS.Page.SearchMgr){LNJS.Page.SearchMgr._clearPins();LNJS.Page.SearchMgr._clearResultList();}}}});this.Msgs.add({title:"Please Try Again",text:"Unknown Virtual Earth Error.",useErrText:true},{type:LNJS.ErrType.LNJSFramework,source:LNJS.ErrSource.LNJSMapManager});if(typeof defaultLat=='undefined')window.defaultLat=34.108277;if(typeof defaultLon=='undefined')window.defaultLon=-118.330807;if(typeof defaultZoom=='undefined')window.defaultZoom=15;if(typeof defaultSearchType=='undefined')window.defaultSearchType='MP';if(typeof defaultTrackHistory=='undefined')window.defaultTrackHistory=false;if(typeof defaultCats=='undefined')window.defaultCats=[];if(typeof defaultView=='undefined')window.defaultView=null;this.options={hidepause:700,showpause:300,mapopt:{container:"MapFrame",opt:{latitude:defaultLat,longitude:defaultLon,zoomlevel:defaultZoom,mapView:defaultView,disableObliqueNotification:true,onMapInit:this._onInitMap.bindAsEventListener(this),pinOffsets:{rbb:11,rba:-15,lr:31,lbb:11,lba:-15,ll:1}}},searchopt:{resultCount:"resultCount",resultcont:"mapResultsList",searchType:defaultSearchType,searchTypes:["MP"],selectedCats:[defaultCats],trackHistory:defaultTrackHistory,popup:'ppp',critopt:{searchType:defaultSearchType,editor:"map"}}}.extend(options||{});this.hidepause=this.options.hidepause;this.showpause=this.options.showpause;this.searchMode=null;this.isAddressSearch=(!isNaN(window.addressLat)&&!isNaN(window.addressLon));this.Msgs.add({title:"You Need to Zoom In",text:"Some results are not shown, please narrow your search. Tip: you may also zoom in by double clicking the map.",pointer:"ml",targetX:"MSVE_navAction_zoomMinusWrapper",y:"338px",offsetX:-71,dontshow:true},{name:"result100plus"});this.Msgs.add({title:"",text:""},{name:"genericMsg"});this.cacheEL("ToolTip");this.cacheEL("updatingResultsMsg");this.cacheEL("IconType",null,true);if(this.EL.IconType)Event.observe(this.EL.IconType,"change",this._onChangeIconType.bindAsEventListener(this));if(LNJS.isNull(LNJS.SearchManager))throw this.Err(this.__className+" requires LNJS.SearchManager!");this.SearchMgr=new LNJS.SearchManager(this.options.searchopt);if(LNJS.isNull(LNJS.MapManager))throw this.Err(this.__className+" requires LNJS.MapManager!");this.MapMgr=new LNJS.MapManager(this.options.mapopt.container,this.options.mapopt.opt);if(this.options.searchopt.trackHistory){params=this._checkHashURL();if(params!=null){this.MapMgr.setMapState(params,this.SearchMgr);}}this.onLoad=function(){if(LNJS.ServerSearchResults){if(this.MapMgr.mapInitialized&&this.SearchMgr){this.SearchMgr._initFromServerSearch(LNJS.ServerSearchResults);setTimeout((function(){this.SearchMgr._LoadResultImg();}).bind(this),650);}}else if(LNJS.ServerClusterSearchResults){if(this.MapMgr.mapInitialized&&this.SearchMgr){this.SearchMgr._initFromServerClusterSearch(LNJS.ServerClusterSearchResults);}}};},_onChangeIconType:function(event){if(LNJS.Page.isClusterSearch)return;var el=Event.element(event);$("divPhotos").style.display="none";$("divStatus").style.display="none";$("divHistory").style.display="none";var selectedValue=el.options[el.selectedIndex].value;switch(selectedValue){case"Photo":$("divPhotos").style.display="block";break;case"Status":$("divStatus").style.display="block";break;case"History":$("divHistory").style.display="block";break;}if(!LNJS.isNull(LNJS.Page.SearchMgr.pData)){for(var i=LNJS.Page.SearchMgr.pageIndex;i<LNJS.Page.SearchMgr.pData.resultCount;i++){var p=LNJS.Page.SearchMgr.pData.items[i];if(LNJS.isNull(p.lat)||LNJS.isNull(p.lon)){}else{var oPin=LNJS.Page.MapMgr.getShapeByIndex(p.idx2);var classname=LNJS.Page.SearchMgr.getPinClassName(p,el.options[el.selectedIndex].value);oPin.SetCustomIcon("<div id='p"+pinid+"' class='"+classname+"'><!--"+(1+i)+"--></div>");}}p=null;}},zoomToStreet:function(index){var item=LNJS.Page.SearchMgr.pData.items[index];LNJS.Page.SearchMgr.profileZoomLock=item;LNJS.Page.MapMgr.setCenterAndZoom(new VELatLong(item.lat,item.lon),16);item=null;},toggle:function(e,arg){var args={call:LNJS.Page._toggle,hidepause:LNJS.Page.hidepause,showpause:0}.extend(arg||{});if(!args.element)return;if(e.type==="show"||e.type==="mouseover"){if(!isNaN(args.element.hid)){clearTimeout(args.element.hid);args.element.hid=null;}args.element.sid=setTimeout((function(){args.call({type:"show"},args);}).bind(this),args.showpause);}else{if(!isNaN(args.element.sid)){clearTimeout(args.element.sid);args.element.sid=null;}args.element.hid=setTimeout((function(){args.call({type:"hide"},args);}).bind(this),args.hidepause);}},showUpdatingMapMsg:function(){Element.show(this.EL.updatingResultsMsg);},hideUpdatingMapMsg:function(){if(this.EL.updatingResultsMsg)Element.hide(this.EL.updatingResultsMsg);},dispose:function(){if(LNJS.Page.EL.IconType)Event.stopObserving(LNJS.Page.EL.IconType,"change",LNJS.Page._onChangeIconType);},_onInitMap:function(oMapMgr){if(this.SearchMgr.attachMapEvents){this.SearchMgr.attachMapEvents(oMapMgr);}},_checkHashURL:function(){if(LNJS.History){var hash=LNJS.History.getCurrent();if(hash.length>0){params=LNJS.Base64.decode(hash).split('|');if(params.length>2){return params;}}}return null;}});LNJS.addObserver({onPageLoad:function(){LNJS.Page=new LNJS.FiddlerSearchResults();if(LNJS.Page.onLoad)LNJS.Page.onLoad();}});