function MapManager(e,a,c,b,d){this.mapState=b;this.zillowMap;this.mapLoaded=false;this.mapInitialized=false;
this.mapName=c;this.mapDivName=e;this.zestimateTilingEnabled=(d==true);this.bubbleManager=new BubbleManager(this,a);
this.mapObjectManager=new MapObjectManager(this);this.clearMapObjectsOnZoomChange=false;this.onMapLoad=new Subscriber("onMapLoad");
this.onMapModeTypeSwitchStreet=new Subscriber("onMapModeTypeSwitchStreet");this.onMapModeTypeSwitchAerial=new Subscriber("onMapModeTypeSwitchAerial");
this.onMapModeTypeSwitchHybrid=new Subscriber("onMapModeTypeSwitchHybrid");this.onMapPan=new Subscriber("onMapPan");
this.onMapZoomChanged=new Subscriber("onMapZoomChanged");this.onEditLocation=new Subscriber("onEditLocation");
this.onRegionClick=new Subscriber("onRegionClick");this.onMouseClick=new Subscriber("onMouseClick");this.onSaveFavorite=new Subscriber("onSaveFavorite");
this.onMapError=new Subscriber("onMapError");}MapManager.prototype={registerMap:function(){window.ZillowMapRegister[this.mapName]=this;
},unregisterMap:function(){window.ZillowMapRegister[this.mapName]=undefined;},getMapState:function(){return this.mapState;
},getZillowMap:function(){return this.zillowMap;},getMapObjectManager:function(){return this.mapObjectManager;
},getBubbleManager:function(){return this.bubbleManager;},getMapDivName:function(){return this.mapDivName;
},isMapLoaded:function(){return this.mapLoaded;},isShowing:function(){return(typeof this.zillowMap!="undefined");
},isInitialized:function(){return this.mapInitialized;},destroyMap:function(){var a=$(this.getMapDivName());
if(a){Element.clear(a);}this.unregisterMap();this.zillowMap=undefined;this.mapLoaded=false;this.mapInitialized=false;
},showMap:function(){if(MapSettings.isMapEnabled()==false){return false;}else{if(MapSettings.isFlashEnabled()==false){var a=replicate.getCDATAValue("noflash");
var b=$(this.getMapDivName());Element.setHTML(b,a);SearchMain.setNoFlashMode(true);return false;}else{if(typeof this.zillowMap=="undefined"){try{this.zillowMap=new ZillowMap(this.mapDivName,this.mapName);
var d=this.zillowMap;$(this.mapDivName).onmouseout=function(){if(d){d.onMapContainerMouseOut();}};this.registerMap();
var c=replicate.getCDATAValue("flashdiv");var b=$(this.getMapDivName());Element.setHTML(b,c);return true;
}catch(f){serverLog.log("map show error","exception in showMap: "+f,serverLog.level.INFO);}}}}return false;
},setClearMapObjectsOnZoomChange:function(a){this.clearMapObjectsOnZoomChange=a;},isZestimateTilingEnabled:function(){return this.zestimateTilingEnabled;
},setMapModeType:function(a){if(this.mapState.getMapModeType()!=a){this.mapState.setMapModeType(a);if(this.isInitialized()){this.getZillowMap().setMapModeType(a);
}}},addMapObject:function(a){if(this.mapLoaded==true){this.getZillowMap().addMapObjectAsString(a.getMapString());
}},addMapObjectList:function(d){if(this.mapLoaded==true){var b=new Array();for(var c=0;c<d.length;c++){b.push(d[c].getMapString());
}this.getZillowMap().addMapObjectList(b);}},batchAddMapObjectList:function(h){var c=30;if(this.mapLoaded==true){var b=new Array();
var e=Math.ceil(h.length/c);var d=0;for(var g=0;g<e;g++){var j="";var f=Math.min(((g+1)*c),h.length);
for(;d<f;d++){j+=h[d].getMapString()+"\n";}b.push(j);}this.getZillowMap().batchAddMapObjectList(b);}},batchRemoveObjectIdList:function(f){var c=50;
if(this.mapLoaded==true){var b=new Array();var e=Math.ceil(f.length/c);var d=0;for(var h=0;h<e;h++){var j="";
var g=Math.min(((h+1)*c),f.length);for(;d<g;d++){j+=f[d]+"\n";}b.push(j);}this.getZillowMap().batchRemoveObjectIdList(b);
}},removeMapObject:function(a){if(this.mapLoaded==true){this.getZillowMap().removeMapObject(a);}},removeMapObjectList:function(a){if(this.mapLoaded==true){this.getZillowMap().removeMapObjectList(a);
}},addEditableMarker:function(b,a){if(this.mapLoaded==true){this.getZillowMap().addEditableMarker(b,a);
}},moveEditableMarker:function(b,a){if(this.mapLoaded==true){this.getZillowMap().moveEditableMarker(b,a);
}},setOrientation:function(a){switch(a){case MapConstants.Orientation.North:this.mapState.setOrientation(MapConstants.Orientation.North);
this.getZillowMap().rotateNorth();break;case MapConstants.Orientation.South:this.mapState.setOrientation(MapConstants.Orientation.South);
this.getZillowMap().rotateSouth();break;case MapConstants.Orientation.East:this.mapState.setOrientation(MapConstants.Orientation.East);
this.getZillowMap().rotateEast();break;case MapConstants.Orientation.West:this.mapState.setOrientation(MapConstants.Orientation.West);
this.getZillowMap().rotateWest();break;}this.getBubbleManager().closeActiveBubble();this.getMapObjectManager().redrawAllMapObjects();
},setZoomLevel:function(a){},setMapCenter:function(a){this.getZillowMap().setMapCenter(a.getLatitude(),a.getLongitude());
},setMapCenterAndZoom:function(a,b){this.getZillowMap().setMapCenterAndZoom(a.getLatitude(),a.getLongitude(),b,true);
},reinitializeMap:function(a){this.mapState=a;if(this.mapInitialized==true){this.getZillowMap().initializeMap(this.getMapState());
}},displayMessage:function(b,a){if(this.mapInitialized==true){this.getZillowMap().displayMessage(b,a);
}},drawMapObjects:function(){if(this.mapInitialized==true){this.getZillowMap().drawMapObjects();}},regionClick:function(b,a){this.onRegionClick.fireEvent(b,a);
},changeRegionSelection:function(c){if(c!=null){var a=c.getBoundingRect();var b=c.getRegionSelectionString();
this.mapState.setSelectionBoundingRect(a);this.mapState.setSelectionId(b);this.getZillowMap().changeRegionSelection(b,a.getWest(),a.getSouth(),a.getEast(),a.getNorth());
}else{this.mapState.setSelectionBoundingRect(null);this.mapState.setSelectionId(null);this.getZillowMap().changeRegionSelection(null,null,null,null,null);
}},refreshJCMTiles:function(){this.getZillowMap().refreshJCMTiles();},setNoChildRollups:function(a){this.getZillowMap().setNoChildRollups(a);
},setMouseLoadingIconStatus:function(a){this.getZillowMap().setMouseLoadingIconStatus(a);},clearMapObjects:function(){this.mapObjectManager.destroy();
delete this.mapObjectManager;this.mapObjectManager=new MapObjectManager(this);},__as2jsOnSwfLoad:function(){this.getZillowMap().initLoadedMapObj();
serverLog.flashCall="load config-js";try{this.getZillowMap().loadSwfConfig();}catch(a){serverLog.log("config load exception","exception loading config: "+a,serverLog.level.INFO);
}},__as2jsOnSwfConfigLoad:function(){serverLog.flashCall="config loaded";this.getZillowMap().swfConfigLoadNotificationReceived();
serverLog.flashCall="setting ConfigLoadNotificationReceived";this.mapLoaded=true;this.getZillowMap().initializeMap(this.getMapState());
this.mapInitialized=true;this.bubbleManager.onMapInitialized(this.getMapState());},__as2jsOnShowInterstitial:function(){log("__as2jsOnShowInterstitial");
serverLog.logMapFailure();this.getZillowMap().logFailedLoadAttempt();},__as2jsOnMapLoad:function(a,d,c,f,e){var b=BoundingRect.createFromMillionths(a,d,c,f);
this.mapState.setBoundingRect(b);this.mapState.setZoomLevel(e);this.mapObjectManager.getZestimateTileManager().updateLocation(b,e);
this.mapObjectManager.redrawAllMapObjects();this.onMapLoad.fireEvent(b,e);this.bubbleManager.onMapViewChanged(b,e);
},__as2jsOnMapUpdate:function(a,d,c,f,e){var b=BoundingRect.createFromMillionths(a,d,c,f);this.mapState.setBoundingRect(b);
if(this.mapState.getZoomLevel()!=e){this.mapState.setZoomLevel(e);if(this.clearMapObjectsOnZoomChange==true){this.clearMapObjects();
}else{this.mapObjectManager.redrawAllMapObjects();}this.onMapZoomChanged.fireEvent(b,e);}else{this.onMapPan.fireEvent(b,e);
}this.bubbleManager.onMapViewChanged(b,e);this.mapObjectManager.getZestimateTileManager().updateLocation(b,e);
},__as2jsOnMouseClick:function(d,c,b,a){this.onMouseClick.fireEvent(new LatLong(d,c));},__as2jsOnMapMouseDown:function(d,c,b,a){this.bubbleManager.onMapMouseClick();
},__as2jsOnEditLocation:function(b,a){this.onEditLocation.fireEvent(new LatLong(b,a));},__as2jsOnMapModeTypeSwitchStreet:function(){if(this.mapState.getMapModeType()!=MapConstants.MapModeType.Street){this.mapState.setMapModeType(MapConstants.MapModeType.Street);
this.onMapModeTypeSwitchStreet.fireEvent();}},__as2jsOnMapModeTypeSwitchAerial:function(){if(this.mapState.getMapModeType()!=MapConstants.MapModeType.Aerial){this.mapState.setMapModeType(MapConstants.MapModeType.Aerial);
this.onMapModeTypeSwitchAerial.fireEvent();}},__as2jsOnMapModeTypeSwitchHybrid:function(){if(this.mapState.getMapModeType()!=MapConstants.MapModeType.Hybrid){this.mapState.setMapModeType(MapConstants.MapModeType.Hybrid);
this.onMapModeTypeSwitchHybrid.fireEvent();}},__as2jsMapObjectClick:function(d,c,a){var b=new LatLong(c,a);
this.mapObjectManager.onObjectClick(d,b);},__as2jsConsoleLog:function(a){if(typeof console!="undefined"&&console.log){console.log("[map]: "+a);
}}};function MapObject(h,b,g,d,a,f,e,c){this.arr=[h,b,g,d,a,f,e,c];}MapObject.prototype={getId:function(){return this.arr[0];
},getObjectType:function(){return this.arr[1];},getListingType:function(){return this.arr[2];},getLabelText:function(){return this.arr[3];
},getLabelIsButton:function(){return this.arr[4];},getLatitude:function(){return this.arr[5];},getLongitude:function(){return this.arr[6];
},getSecondaryText:function(){return this.arr[7];},getArrayObject:function(){return this.arr;},getMapString:function(){return this.arr[0]+"\t"+this.arr[1]+"\t"+this.arr[2]+"\t"+this.arr[3]+"\t"+this.arr[4]+"\t"+this.arr[5]+"\t"+this.arr[6]+"\t"+this.arr[7];
}};MapObject.ObjectType={Property:0,Building:1,Region:2};MapObject.ListingType={None:0,ForSale:1,MakeMeMove:2,RecentlySold:3,OpenHouse:4,Target:5,ForRent:6};
function MapObjectManager(a){this.mapManager=a;this.zestimateTileManager=new ZestimateTileManager(this,a.isZestimateTilingEnabled());
this.searchResultsManager=new SearchResultsManager(this);this.currentObjects=new Object();}MapObjectManager.prototype={onObjectClick:function(b,d){var e=this.currentObjects[b];
if(e!=null&&"p_"==b.substring(0,2)){this.mapManager.getBubbleManager().requestPropertyBubble(b.slice(2),e.getListingType(),new LatLong(e.getLatitude(),e.getLongitude()));
}else{if("r_"==b.substring(0,2)){var f=b.slice(2);this.mapManager.regionClick(f,d);}else{if(e!=null&&"b_"==b.substring(0,2)){var a=b.slice(2).split("_");
var c=true;if(e.getListingType()==MapObject.ListingType.None){c=false;}this.mapManager.getBubbleManager().requestBuildingBubble(a[0],a[1],c);
}else{if(e!=null&&"mye_"==b.substring(0,4)){this.mapManager.getBubbleManager().requestMyEstimatorBubble(b.slice(4),new LatLong(e.getLatitude(),e.getLongitude));
}}}}},addMyEResult:function(e,c,a){var d=this.createMyEObjectId(e);var b=new MapObject(d,MapObject.ObjectType.Property,MapObject.ListingType.RecentlySold,a,true,c.getLatitude(),c.getLongitude(),undefined);
this.currentObjects[d]=b;this.mapManager.addMapObject(b);},updateSearchResults:function(j,c,h,f,k,a){var x=new Array();
var s=new Array();try{for(var u=0;u<c.length;u++){var n=c[u];var q=n.getZpid();var g=n.getLatitude();
var d=n.getLongitude();var o=this.createPropertyObjectId(q);x.push(o);delete this.currentObjects[o];var m=this.zestimateTileManager.getProperty(q,g,d);
if(m){var t=new MapObject(o,MapObject.ObjectType.Property,MapObject.ListingType.None,m.getLabel(),true,m.getLatitude(),m.getLongitude(),undefined);
this.currentObjects[o]=t;s.push(t);}else{var w=this.zestimateTileManager.getBuilding(g,d);if(w){var z=this.createBuildingObjectId(g,d);
var t=new MapObject(z,MapObject.ObjectType.Building,MapObject.ListingType.None,"",true,g,d,undefined);
this.currentObjects[z]=t;s.push(t);}}}for(var u=0;u<f.length;u++){var y=f[u];var g=y.getLatitude();var d=y.getLongitude();
var o=this.createBuildingObjectId(g,d);x.push(o);delete this.currentObjects[o];var w=this.zestimateTileManager.getBuilding(g,d);
if(w){var t=new MapObject(o,MapObject.ObjectType.Building,MapObject.ListingType.None,"",true,g,d,undefined);
this.currentObjects[o]=t;s.push(t);}}for(var u=0;u<a.length;u++){var l=a[u];var o=this.createRegionObjectId(l.getRegionId());
x.push(o);delete this.currentObjects[o];}for(var u=0;u<j.length;u++){var n=j[u];var o=this.createPropertyObjectId(n.getZpid());
var g=n.getLatitude();var d=n.getLongitude();if(this.currentObjects[o]){x.push(o);delete this.currentObjects[o];
}var t=new MapObject(o,MapObject.ObjectType.Property,n.getStatusType(),n.getLabel(),true,g,d,undefined);
this.currentObjects[o]=t;s.push(t);var w=this.zestimateTileManager.getBuilding(g,d);if(w){var z=this.createBuildingObjectId(g,d);
x.push(z);delete this.currentObjects[z];}}for(var u=0;u<h.length;u++){var y=h[u];var o=this.createBuildingObjectId(y.getLatitude(),y.getLongitude());
if(this.currentObjects[o]){x.push(o);delete this.currentObjects[o];}var t=new MapObject(o,MapObject.ObjectType.Building,y.getStatusType(),y.getLabel(),true,y.getLatitude(),y.getLongitude(),undefined);
this.currentObjects[o]=t;s.push(t);}for(var u=0;u<k.length;u++){var l=k[u];var o=this.createRegionObjectId(l.getRegionId());
if(this.currentObjects[o]){x.push(o);delete this.currentObjects[o];}var t=new MapObject(o,MapObject.ObjectType.Region,MapObject.ListingType.Target,l.getLabel(),true,l.getLatitude(),l.getLongitude(),l.getRegionName());
this.currentObjects[o]=t;s.push(t);}}catch(v){log.error(v);}this.mapManager.batchRemoveObjectIdList(x);
this.mapManager.batchAddMapObjectList(s.reverse());this.mapManager.drawMapObjects();},addZestimateTileObjects:function(c){try{var j=c.getPropertiesObject();
var f=c.getBuildingsObject();var g=new Array();for(var l in j){var d=j[l];var i=d.getZpid();var b=new MapObject(this.createPropertyObjectId(i),MapObject.ObjectType.Property,MapObject.ListingType.None,d.getLabel(),true,d.getLatitude(),d.getLongitude());
if(this.searchResultsManager.getProperty(i)==undefined){this.currentObjects[b.getId()]=b;g.push(b);}}for(var l in f){var m=f[l];
var k=m.getLatitude();var a=m.getLongitude();var b=new MapObject(this.createBuildingObjectId(k,a),MapObject.ObjectType.Building,MapObject.ListingType.None,"",true,k,a,undefined);
if(this.searchResultsManager.getBuilding(k,a)==undefined&&this.searchResultsManager.getPropertyByLocation(k,a)==undefined){this.currentObjects[b.getId()]=b;
g.push(b);}}this.mapManager.batchAddMapObjectList(g);}catch(h){log.error(h);}this.mapManager.drawMapObjects();
},removeZestimateTileObjects:function(b){try{var f=new Array();var i=b.getPropertiesObject();var d=b.getBuildingsObject();
for(var l in i){var c=i[l];var h=c.getZpid();if(this.searchResultsManager.getProperty(h)==undefined){var k=this.createPropertyObjectId(h);
delete this.currentObjects[k];f.push(k);}}for(var l in d){var m=d[l];var j=m.getLatitude();var a=m.getLongitude();
if(this.searchResultsManager.getBuilding(j,a)==undefined&&this.searchResultsManager.getPropertyByLocation(j,a)){var k=this.createBuildingObjectId(j,a);
delete this.currentObjects[k];f.push(k);}}this.mapManager.batchRemoveObjectIdList(f);}catch(g){log.error(g);
}this.mapManager.drawMapObjects();},getZestimateTileManager:function(){return this.zestimateTileManager;
},getSearchResultsManager:function(){return this.searchResultsManager;},createPropertyObjectId:function(a){return"p_"+a;
},createBuildingObjectId:function(b,a){return"b_"+b+"_"+a;},createRegionObjectId:function(a){return"r_"+a;
},createMyEObjectId:function(a){return"mye_"+a;},redrawAllMapObjects:function(){var a=new Array();var c=new Array();
for(var b in this.currentObjects){var d=this.currentObjects[b];a.push(d);c.push(d.getId());}this.mapManager.batchRemoveObjectIdList(c);
this.mapManager.batchAddMapObjectList(a);this.mapManager.drawMapObjects();},destroy:function(){this.zestimateTileManager.clearAllTiles();
delete this.zestimateTileManager;this.mapManager=undefined;delete this.currentObjects;}};function MapState(c,g,b,f,d,a,e){this.boundingRect=c;this.zoomLevel=g;this.orientation=b;this.mapModeType=f;
this.selectionId=d;this.selectionBoundingRect=a;this.mapResultsMode=e;}MapState.prototype={getBoundingRect:function(){return this.boundingRect;
},getZoomLevel:function(){return this.zoomLevel;},getOrientation:function(){return this.orientation;},getMapModeType:function(){return this.mapModeType;
},getSelectionId:function(){return this.selectionId;},getSelectionBoundingRect:function(){return this.selectionBoundingRect;
},getMapResultsMode:function(){return this.mapResultsMode;},setBoundingRect:function(a){this.boundingRect=a;
},setZoomLevel:function(a){this.zoomLevel=a;},setOrientation:function(a){this.orientation=a;},setMapModeType:function(a){this.mapModeType=a;
},setSelectionId:function(a){this.selectionId=a;},setSelectionBoundingRect:function(a){this.selectionBoundingRect=a;
},setMapResultsMode:function(a){this.mapResultsMode=a;}};MapState.toString=function(a){if(a){var b="";
b+="rect:"+BoundingRect.toString(a.getBoundingRect());b+="z:"+(a.getZoomLevel()?a.getZoomLevel():"null");
b+="mode:"+(a.getMapModeType()?a.getMapModeType():"null");b+="o:"+(a.getOrientation()?a.getOrientation():"null");
b+="resultsMode:"+(a.getMapResultsMode()?a.getMapResultsMode():"null");return b;}return"null";};MapState.createBlankMapState=function(){return new MapState(undefined,undefined,undefined,undefined,undefined,undefined,MapConstants.MapResultsMode.Default);
};MapState.createMapState=function(c,g,b,f,d,a,e){return new MapState(c,g,b,f,d,a,e);};MapState.calculateZoomForBounds=function(b,c,f){if(b!=null&&c!=null&&f!=null){var a=Math.round(VETiles.LongitudeToPixelX(c.getEast(),f))-Math.round(VETiles.LongitudeToPixelX(c.getWest(),f));
var e=Math.round(VETiles.LatitudeToPixelY(c.getSouth(),f))-Math.round(VETiles.LatitudeToPixelY(c.getNorth(),f));
var d=18;while(d>3&&((Math.round(VETiles.LongitudeToPixelX(b.getEast(),d))-Math.round(VETiles.LongitudeToPixelX(b.getWest(),d)))>a||(Math.round(VETiles.LatitudeToPixelY(b.getSouth(),d))-Math.round(VETiles.LatitudeToPixelY(b.getNorth(),d)))>e)){d--;
}return d;}return null;};var MapConstants=(function(){return{MapModeType:{Street:1,Aerial:2,Hybrid:3},Zoom:{MIN_ZOOM_LEVEL:2,MAX_ZOOM_LEVEL:18,USA_MAP_ZOOM_LEVEL:2},Orientation:{West:"W",South:"S",East:"E",North:"N"},BubbleType:{Error:-1,None:0,Property:1,Region:2,RegionInfo:3,Building:4,BuildingRollo:5,MyEComp:6},MapResultsMode:{Default:1,NoChildRollups:2}};
})();function BoundingRect(a,c,b,d){this.west=Math.round(a);this.south=Math.round(c);this.east=Math.round(b);
this.north=Math.round(d);}BoundingRect.prototype={getWest:function(){return this.west;},getSouth:function(){return this.south;
},getEast:function(){return this.east;},getNorth:function(){return this.north;},getBottomLeft:function(){return new LatLong(this.getSouth(),this.getWest());
},getTopRight:function(){return new LatLong(this.getNorth(),this.getEast());},calculateArea:function(){return(this.east-this.west)*(this.north-this.south);
},valuesNotNull:function(){return this.west&&this.south&&this.east&&this.north;},getCenter:function(){var b=Math.round((VETiles.LongitudeToPixelX(this.east,18)+VETiles.LongitudeToPixelX(this.west,18))/2);
var a=Math.round((VETiles.LatitudeToPixelY(this.south,18)+VETiles.LatitudeToPixelY(this.north,18))/2);
var c=VETiles.PixelYToLatitude(a,18);var d=VETiles.PixelXToLongitude(b,18);return new LatLong(c,d);}};
BoundingRect.createFromDegrees=function(a,c,b,d){return new BoundingRect(MapUtil.degreesToMillionths(a),MapUtil.degreesToMillionths(c),MapUtil.degreesToMillionths(b),MapUtil.degreesToMillionths(d));
};BoundingRect.createFromMillionths=function(a,c,b,d){return new BoundingRect(a,c,b,d);};BoundingRect.calculateIntersection=function(e,d){var a=Math.max(e.getWest(),d.getWest());
var c=Math.min(e.getEast(),d.getEast());var f=Math.min(e.getNorth(),d.getNorth());var b=Math.max(e.getSouth(),d.getSouth());
if(a>c||b>f){return null;}return BoundingRect.createFromMillionths(a,b,c,f);};BoundingRect.isIntersected=function(b,a){if(b.getWest()>a.getEast()||a.getWest()>b.getEast()||b.getSouth()>a.getNorth()||a.getSouth()>b.getNorth()){return false;
}return true;};BoundingRect.equals=function(b,a){if(b==null&&a==null){return true;}else{if(b==null^a==null){return false;
}}return(b.getWest()==a.getWest()&&b.getSouth()==a.getSouth()&&b.getEast()==a.getEast()&&b.getNorth()==a.getNorth());
};BoundingRect.toString=function(a){if(a){return"w"+a.getWest()+"s"+a.getSouth()+"e"+a.getEast()+"n"+a.getNorth();
}return"null";};function LatLong(a,b){this.latitude=Math.round(a);this.longitude=Math.round(b);}LatLong.prototype={getLatitude:function(){return this.latitude;
},getDegreesLatitude:function(){return MapUtil.millionthsToDegrees(this.latitude);},getLongitude:function(){return this.longitude;
},getDegreesLongitude:function(){return MapUtil.millionthsToDegrees(this.longitude);}};LatLong.createFromDegrees=function(a,b){if(a==null||b==null){return null;
}return new LatLong(MapUtil.degreesToMillionths(a),MapUtil.degreesToMillionths(b));};var MapUtil=(function(){var a=1000000;
return{degreesToMillionths:function(b){return Math.round(b*a);},millionthsToDegrees:function(b){return Math.round(b)/a;
}};})();function MapConfiguration(a,b){this.virtualEarth=a;this.mapFeatures=b;}MapConfiguration.prototype={getVirtualEarth:function(){return this.virtualEarth;
},getMapFeatures:function(){return this.mapFeatures;}};function VEConfiguration(b,a,d,c){this.baseUrl=b;
this.hybrid=a;this.aerial=d;this.street=c;}VEConfiguration.prototype={getBaseUrl:function(){return this.baseUrl;
},getHybrid:function(){return this.hybrid;},getAerial:function(){return this.aerial;},getStreet:function(){return this.street;
},toVEConfigurationObject:function(){var a={};a.baseUrl=this.baseUrl;a.hybrid=this.hybrid.toTileConfigObject();
a.street=this.street.toTileConfigObject();a.aerial=this.aerial.toTileConfigObject();return a;}};function VETileConfig(a,b){this.obj={};
this.obj.prefix=a;this.obj.suffix=b;}VETileConfig.prototype={getPrefix:function(){return this.obj.prefix;
},getSuffix:function(){return this.obj.suffix;},toTileConfigObject:function(){return this.obj;}};function MapFeatures(c,e,f,d,b,a){this.obj={};
this.obj.compass=Boolean(c);this.obj.zoomSlider=Boolean(e);this.obj.centerPoint=Boolean(f);this.obj.mapScale=Boolean(d);
this.obj.panning=Boolean(b);this.obj.USAEnabled=Boolean(a);}MapFeatures.prototype={getCompass:function(){return this.obj.compass;
},getZoomSlider:function(){return this.obj.zoomSlider;},getCenterPoint:function(){return this.obj.centerPoint;
},getMapScale:function(){return this.obj.mapScale;},getPanning:function(){return this.obj.panning;},getUSAEnabled:function(){return this.obj.USAEnabled;
},getFeaturesObject:function(){return this.obj;}};var MapSettings=(function(){var c;var b;this.veConfiguration;
function a(g,p){var j=parseFloat(g+"."+p);if(navigator.plugins&&typeof navigator.plugins["Shockwave Flash"]=="object"){var l=navigator.plugins["Shockwave Flash"].description;
if(l){var q=l.split(" ");var o=q[2].split(".");var n=o[0];if(q[3]){var f=q[3].split("r");}else{var f=q[4].split("r");
}var i=f[1]>0?f[1]:0;var d=parseFloat(n+"."+i);}}else{if(window.ActiveXObject){try{var k=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
var l=k.GetVariable("$version");if(l){var q=l.split(" ");var h=q[1].split(",");var n=h[0];var i=h[2];
var d=parseFloat(n+"."+i);}}catch(m){}}}if(typeof d!="undefined"){return(d>=j?true:false);}return false;
}return{isMapEnabled:function(){if(typeof b=="undefined"){var d=$("map-list-brownout");if(d){b=!(d.value=="true");
}else{b=true;}}return b;},isFlashEnabled:function(){if(typeof c=="undefined"){c=(YAHOO.env.ua.gecko>=1.9&&a(9,0))||a(8,0);
}return c;},isMapDisplayable:function(){return this.isMapEnabled()&&this.isFlashEnabled();},setVeConfiguration:function(d){this.veConfiguration=d;
},getVeConfiguration:function(){return this.veConfiguration;}};})();var VETiles=(function(){var h=180000000,f=256;
var d=-180000000,g=180000000,b=-85051128,a=85051128;function c(j,k,i){return Math.min(Math.max(j,k),i);
}function e(i){i=Math.floor(i)+1;return Math.round(f<<i);}return{TILESIZE:f,LatLongToPixelXY:function(i){return{x:this.LongitudeToPixelX(i.lon,i.zoom),y:this.LatitudeToPixelY(i.lat,i.zoom),zoom:i.zoom};
},LatitudeToPixelY:function(m,i){i=Math.floor(i);m=c(m,b,a);var k=Math.sin(m*Math.PI/h);var l=0.5-Math.log((1+k)/(1-k))/(4*Math.PI);
var j=e(i);return Math.round(c(l*j+0.5,0,j-1));},LongitudeToPixelX:function(l,j){j=Math.floor(j);l=c(l,d,g);
var i=(l+h)/360000000;var k=e(j);return Math.round(c(i*k+0.5,0,k-1));},PixelXToLongitude:function(k,j){j=Math.floor(j);
var l=e(j);var i=((k-0.5)/l);return(360000000*i)-180000000;},PixelYToLatitude:function(j,i){i=Math.floor(i);
var l=e(i);var n=((j-0.5)/l);var m=Math.pow(Math.E,(0.5-n)*4*Math.PI);var k=(m-1)/(m+1);return(180000000*Math.asin(k))/Math.PI;
},PixelXYToTileXY:function(j,i){var k=new Object();k.x=Math.floor(j/f);k.y=Math.floor(i/f);return k;},PixelXYToQuadKey:function(i){return VETiles.TileXYToQuadKey(Math.floor(i.x/f),Math.floor(i.y/f),i.zoom);
},TileXYToQuadKey:function(o,n,k){o=Math.floor(o);n=Math.floor(n);k=Math.floor(k)+1;var l=[];for(var m=k;
m>0;m--){var p=0;var j=1<<(m-1);if((o&j)!=0){p++;}if((n&j)!=0){p++;p++;}l.push(p);}return l.join("");
},LatLongToQuadKey:function(i){return VETiles.PixelXYToQuadKey(VETiles.LatLongToPixelXY(i));}};})();var PhotoExperience=(function(){var c;var f=new Array();var a="photo-viewer";var b=new Array();var e=function(o,n){var g=0;
g=n.large.length;for(var m=0;m<n.large.length&&m<9;m++){b[m]=n.large[m];}var h="";for(var k=9;k>1;k--){if(k<=g){h+='<a href="'+o+'" rel="nofollow"><img id="mt0'+k+'" class="minithumb" src="'+n.thumbs[k-2]+'" onmouseover="PhotoExperience.imgswitch(\''+b[k-1]+"', '' , false)\" alt=\"\" /></a>\n";
}else{h+='<div class="minithumb default"></div>\n';}}var l='		<div class="minithumbs"> 			<div class="viewmore"> 				<ul class="carrot"> 					<li> 						<a href="'+o+'" rel="nofollow">View ';
if(g>1){l+="all photos";}else{l+="photo";}l+="</a> 					</li> 				</ul> 			</div> 		"+h+'		</div> 		<a href="'+o+'" rel="nofollow"> 			<img id="photoexmain" class="photoexmain" src="'+b[0]+'" width="316" height="234" alt="" /> 		';
l+=' 			<img src="/static/images/ajax-loader.gif" id="mainphotoex-loader" class="loading hide" /> 		</a> 		';
return(l);};var d=function(h,i){var g="mainphotoex-loader";if(i){g="bubble-"+g;}switch(h){case"show":Element.show(g);
break;case"hide":default:Element.hide(g);break;}};return{thumbout:function(){PhotoExperience.hovering("out");
},photodivout:function(){PhotoExperience.hovering("out");},init:function(){var j=false;j=($("photo-bubble-enabled").value==="true");
if(j){var m=$("list-container");var h=$D.getElementsByClassName("search-result","li",m);var l;PhotoExperience.hovering("out");
for(var k=0;k<h.length;k++){var g=$D.getElementsByClassName("photoex","div",h[k]);$E.on(g,"mouseover",function(o){var n=this.parentNode.parentNode;
var i="";i=this.getElementsByTagName("a")[0].href;clearTimeout(l);PhotoExperience.imgswitch(b[0],"",false);
PhotoExperience.hovering("over",n.id,i,this);});$E.on($(a),"mouseover",function(i){clearTimeout(l);});
$E.on(g,"mouseout",function(i){clearTimeout(l);l=setTimeout("PhotoExperience.thumbout()",200);});$E.on($(a),"mouseout",function(i){clearTimeout(l);
l=setTimeout("PhotoExperience.photodivout()",200);});}}},hovering:function(h,j,i,g){var m=$(a);var l="";
if(j){l=j.replace(/zpid(\d+)$/,"$1");}switch(h){case"over":var k={success:function(p){var n=p.responseText.parseJSON();
$(a).innerHTML=e(i,n);PhotoExperience.hidePhotoexLoader(g);},failure:function(n){}};if(!c||(c.id!==j)){PhotoExperience.showPhotoexLoader(g);
if(c){$D.removeClass(c,"photoreveal");}$(a).innerHTML="";$C.asyncRequest("GET","/search/PropertyPhotoURLs.htm?zpid="+l,k);
c=$(j);}$D.addClass(c,"photoreveal");Element.show(a);m.style.top=c.offsetTop-247+1+"px";break;case"out":if(c){$D.removeClass(c,"photoreveal");
}Element.hide(a);PhotoExperience.hidePhotoexLoader(g);break;default:break;}},imgswitch:function(k,j,i){var h;
if(i){h=$("bubble-photoexmain");}else{h=$("photoexmain");}var g=new Image();g.src=k;if(g.width<=0){if(h){d("show",i);
$E.on(g,"load",function(l){h.src=k;h.alt=j;d("hide",i);});}}else{if(h){h.src=k;h.alt=j;}}},showPhotoexLoader:function(g){var h=$D.getElementsByClassName("photoex-loader","img",g);
Element.show(h);},hidePhotoexLoader:function(g){var h=$D.getElementsByClassName("photoex-loader","img",g);
Element.hide(h);}};})();function ZillowMap(a,b){this.mapName=b;this.swfDivName=a;this.mapObj=undefined;$E.on(window,"unload",this.clearSwf);
}ZillowMap.prototype=(function zmapProto(){return{constructor:ZillowMap.prototype.constructor,toString:function(){return"[ZillowMap]";
},clearSwf:function(){var a=$(this.swfDivName);if(a){Element.clear(a);}},log:function(){var a=Array.create(arguments);
a.unshift("[ZillowMap]");log.apply(log,a);},logSearchResultsFailure:function(){this.logSearchError("/static/images/bcn/searchResultsFailed.gif",undefined);
},logFailedLoadAttempt:function(a){this.logSearchError("/static/images/bcn/mapFailed.gif",a);},logSearchError:function(b,a){log("MAP LOADING FAILED",b);
b+="?";b+="&failedURL="+window.location;if(a){b+="&info="+encodeURIComponent(a);}$E.onDOMReady(function(){document.body.appendChild(Element.make("img",{src:b}));
});this.alreadyLogged=true;},loadSwfConfig:function(){var b=0;function d(f){try{f();}catch(e){b++;if(b<100){window.setTimeout(function(){d(f);
},10);}}}if(this.mapObj){var c={};c.virtualEarth=MapSettings.getVeConfiguration().toVEConfigurationObject();
serverLog.flashCall="load config-as";var a=this.mapObj;d(function(){a.__js2asLoadSwfConfig(c);});}},swfConfigLoadNotificationReceived:function(){if(this.mapObj){this.mapObj.__js2asSwfConfigLoadNotificationReceived();
}},initializeMap:function(d){if(this.mapObj){var e=d.getBoundingRect();var h=d.getSelectionBoundingRect();
var g=null;var b=null;var a=null;var f=null;if(h){g=h.getWest();b=h.getSouth();a=h.getEast();f=h.getNorth();
}var c=false;if(d.getMapResultsMode()==MapConstants.MapResultsMode.NoChildRollups){c=true;}this.mapObj.__js2asInitializeMap(e.getWest(),e.getSouth(),e.getEast(),e.getNorth(),d.getZoomLevel(),d.getMapModeType(),d.getOrientation(),d.getSelectionId(),g,b,a,f,c);
}},addMapObject:function(a){if(this.mapObj){this.mapObj.__js2asAddMapObject(a);}},addMapObjectAsString:function(a){if(this.mapObj){this.mapObj.__js2asAddMapObjectAsString(a);
}},addMapObjectList:function(a){if(this.mapObj){this.mapObj.__js2asAddMapObjectList(a);}},batchAddMapObjectList:function(b){if(this.mapObj){this.mapObj.__js2asBatchAddMapObjectList(b);
}},batchRemoveObjectIdList:function(b){if(this.mapObj){this.mapObj.__js2asBatchRemoveMapObjectList(b);
}},removeMapObjectList:function(a){if(this.mapObj){this.mapObj.__js2asRemoveMapObjectList(a);}},removeMapObject:function(a){if(this.mapObj){this.mapObj.__js2asRemoveMapObject(a);
}},setMapCenter:function(b,a){if(this.mapObj){this.mapObj.__js2asSetMapCenter(b,a);}},setMapCenterAndZoom:function(d,b,c,a){if(this.mapObj){this.mapObj.__js2asSetMapCenterAndZoom(d,b,c,a);
}},setNoChildRollups:function(a){if(this.mapObj){this.mapObj.__js2asSetNoChildRollups(a);}},setMouseLoadingIconStatus:function(a){if(this.mapObj){this.mapObj.__js2asSetMouseLoadingIcon(a);
}},showInterstitial:function(a){if(this.mapObj){this.mapObj.__js2asShowInterstitial(a);}},hideInterstitial:function(a){if(this.mapObj){this.mapObj.__js2asHideInterstitial(a);
}},displayMessage:function(b,a){if(this.mapObj){this.mapObj.__js2asDisplayMessage(b,a);}},hideMessage:function(){if(this.mapObj){this.mapObj.__js2asHideMessage();
}},rotate:function(a){if(this.mapObj){this.mapObj.__js2asSetOrientation(a);}},rotateNorth:function(){if(this.mapObj){this.mapObj.__js2asSetOrientationNorth();
}},rotateSouth:function(){if(this.mapObj){this.mapObj.__js2asSetOrientationSouth();}},rotateEast:function(){if(this.mapObj){this.mapObj.__js2asSetOrientationEast();
}},rotateWest:function(){if(this.mapObj){this.mapObj.__js2asSetOrientationWest();}},setZoomLevel:function(a){if(this.mapObj){this.mapObj.__js2asSetZoomLevel(a);
}},changeRegionSelection:function(c,e,b,a,d){if(this.mapObj){this.mapObj.__js2asChangeRegionSelection(c,e,b,a,d);
}},refreshJCMTiles:function(){if(this.mapObj){this.mapObj.__js2asRefreshJCMTiles();}},addEditableMarker:function(b,a){if(this.mapObj){this.mapObj.__js2asAddEditableMarker(b,a);
}},moveEditableMarker:function(b,a){if(this.mapObj){this.mapObj.__js2asMoveEditableMarker(b,a);}},setMapModeType:function(a){if(this.mapObj){this.mapObj.__js2asSetMapModeType(a);
}},onMapContainerMouseOut:function(){if(this.mapObj){this.mapObj.__js2asOnMapContainerMouseOut();}},drawMapObjects:function(){if(this.mapObj){this.mapObj.__js2asDrawMapObjects();
}},setMapObj:function(a){this.mapObj=a;},registerMap:function(){window.ZillowMapRegister[this.mapName]=this;
},unregisterMap:function(){window.ZillowMapRegister[this.mapName]=undefined;},initLoadedMapObj:function(){if(!this.mapObj){var a=$(this.swfDivName).getElementsByTagName("object")[0];
if(typeof a.__js2asLoadSwfConfig!="function"){a=document.ZillowFlashMap;}this.setMapObj(a);}}};})();function IterableBubbleResult(c,a,b){this.zpid=c;this.html=a;this.detailPageUrl=b;}IterableBubbleResult.prototype={getZpid:function(){return this.zpid;
},getHTML:function(){return this.html;},getDetailPageUrl:function(){return this.detailPageUrl;}};IterableBubbleResult.LOADING_RESULT=new IterableBubbleResult(-1,"<div>Loading result...</div>",null);
IterableBubbleResult.LOADING_RESULT_FAILED=new IterableBubbleResult(-1,"<div>Loading results failed.</div>",null);
IterableBubbleResult.NO_MATCHES=new IterableBubbleResult(-1,"<div>No matching results.</div>",null);function IterableBubbleResultsPage(b,a,d,c){this.pageNumber=b;
this.pageSize=a;this.resultList=d;this.resultCount=c;}IterableBubbleResultsPage.prototype={getPageNumber:function(){return this.pageNumber;
},getPageSize:function(){return this.pageSize;},getResultList:function(){return this.resultList;},getResultCount:function(){return this.resultCount;
}};function PropertyBubble(c,a,b){this.mapBubbleObject;this.zpid=c;this.location=a;this.bubbleHTML=b;}PropertyBubble.prototype={getMapBubbleObject:function(){return this.mapBubbleObject;
},setMapBubbleObject:function(a){this.mapBubbleObject=a;},getLocation:function(){return this.location;
},draw:function(a,b){this.mapBubbleObject.displayContents(this.bubbleHTML,a,b);},getBubbleType:function(){return MapConstants.BubbleType.Property;
},getZpid:function(){return this.zpid;}};function PropertyBubbleRequest(b,d,e,a,c){this.bubbleManager=b;
this.requestId=d;this.zpid=e;this.type=a;this.latLong=c;this.timeout;}PropertyBubbleRequest.prototype=(function(){var f="/search/bubble/GetPropertyBubble.htm";
var d="zpid";var e="type";var a="lat";var b="lon";var g=10000;function c(l,i,k,j){var h=f+"?"+d+"="+l+"&"+e+"="+i;
if(k&&j){h+="&"+a+"="+MapUtil.millionthsToDegrees(k)+"&"+b+"="+MapUtil.millionthsToDegrees(j);}return h;
}return{submitRequest:function(){this.timeout=g;$C.asyncRequest("GET",c(this.zpid,this.type,this.latLong.getLatitude(),this.latLong.getLongitude()),this);
},success:function(i){var h=i.responseText.parseJSON();this.bubbleManager.onPropertyBubbleLoad(h);},failure:function(h){}};
})();function RegionBubble(f,d,c,b,a,e){this.mapBubbleObject;this.regionId=f;this.centroid=d;this.boundingRect=c;
this.resultCount=b;this.bubbleHTML=a;this.loadedPages=new Object();if(e!=null){this.loadedPages[1]=e;
}this.requestedPages=new Object();this.currentResultIndex=0;}RegionBubble.prototype=(function(){var a=10;
function c(d){return Math.floor(d/a)+1;}function b(g,f){if(f){if(f.id==g){return f;}else{if(f.childNodes){for(var e=0;
e<f.childNodes.length;e++){var d=b(g,f.childNodes[e]);if(d!=undefined){return d;}}}}}return undefined;
}return{getMapBubbleObject:function(){return this.mapBubbleObject;},setMapBubbleObject:function(d){this.mapBubbleObject=d;
},getRegionId:function(){return this.regionId;},getLocation:function(){return this.centroid;},getBoundingRect:function(){return this.boundingRect;
},getPageSize:function(){return this.pageSize;},getResultCount:function(){return this.resultCount;},setResultCount:function(d){this.resultCount=d;
},getResultsPage:function(d){return this.loadedPages[d];},requestPage:function(d){if(typeof this.loadedPages[d]=="undefined"&&typeof this.requestedPages[d]=="undefined"){this.requestedPages[d]=true;
var e=new IterableRegionPageRequest(this,d);e.submitRequest();}},onPageLoad:function(d,e){delete this.requestedPages[d];
this.loadedPages[d]=e;this.setDisplayResult();if(this.getResultCount()==null&&e!=null){this.setResultCount(e.getResultCount());
this.updateResultCount();}},onPageLoadFailure:function(d){delete this.requestedPages[d];},draw:function(e,j){this.mapBubbleObject.displayContents(this.bubbleHTML,e,j);
this.setDisplayResult();var g=this.mapBubbleObject.getContentDivElement();var i=b("show-previous-button",g);
var f=b("show-next-button",g);var h=b("region-zoom-link",g);var d=this;if(i){i.onclick=function(){d.onClickPrev();
};}if(f){f.onclick=function(){d.onClickNext();};}if(h){h.onclick=function(){d.onClickZoom();};}},setBubbleResult:function(f){var d=this.mapBubbleObject.getContentDivElement();
var e=b("result-number",d);if(e){e.innerHTML=this.currentResultIndex+1;}var g=b("region-bubble-contents",d);
if(g){g.innerHTML=f.getHTML();}this.mapBubbleObject.refresh();this.mapBubbleObject.updatePosition(undefined,undefined);
},updateResultCount:function(){var e=this.mapBubbleObject.getContentDivElement();var d=b("result-count",e);
if(d){var f="";if(this.resultCount){f=this.resultCount;}d.innerHTML=f;}},onClickNext:function(){if(this.resultCount!=null&&this.currentResultIndex<this.resultCount-1){this.currentResultIndex++;
this.setDisplayResult();}if(this.resultCount==null||this.currentResultIndex>=this.resultCount-1){var d=$("show-next-button");
$D.addClass(d,"last");}if(this.currentResultIndex>=1){var e=$("show-previous-button");$D.removeClass(e,"first");
}},onClickPrev:function(){if(this.currentResultIndex>0){this.currentResultIndex--;this.setDisplayResult();
var d=$("show-next-button");$D.removeClass(d,"last");}if(this.currentResultIndex<=0){var e=$("show-previous-button");
$D.addClass(e,"first");}},onClickZoom:function(){var h=SearchMain.getMapManager();var f=h.getMapState();
var m=f.getZoomLevel();var e=f.getBoundingRect();var j=VETiles.LongitudeToPixelX(e.getEast(),m)-VETiles.LongitudeToPixelX(e.getWest(),m);
var i=VETiles.LatitudeToPixelY(e.getSouth(),m)-VETiles.LatitudeToPixelY(e.getNorth(),m);var l=VETiles.LongitudeToPixelX(this.boundingRect.getEast(),m)-VETiles.LongitudeToPixelX(this.boundingRect.getWest(),m);
var d=VETiles.LatitudeToPixelY(this.boundingRect.getSouth(),m)-VETiles.LatitudeToPixelY(this.boundingRect.getNorth(),m);
var g=m;while(g<18&&l*2<=j&&d*2<=i){g++;l*=2;d*=2;}if(g==m&&m<18){g++;}var k=this.mapBubbleObject.getClickLatLong();
if(k==undefined){k=this.centroid;}SearchMain.getMapManager().setMapCenterAndZoom(k,g);},setDisplayResult:function(){var e=c(this.currentResultIndex);
var g=this.getResultsPage(e);var f=IterableBubbleResult.LOADING_RESULT;if(typeof g=="undefined"){this.requestPage(e);
}else{if(g==null){f=IterableBubbleResult.NO_MATCHES;}else{var d=g.getResultList()[this.currentResultIndex%a];
if(d){f=d;}else{f=IterableBubbleResult.LOADING_RESULT_FAILED;}}}this.setBubbleResult(f);}};})();function IterableRegionPageRequest(b,a){this.regionBubble=b;
this.pageNumber=a;this.timeout;}IterableRegionPageRequest.prototype=(function(){var a="/search/bubble/GetRegionBubblePage.htm";
var b=10000;return{submitRequest:function(){this.timout=b;var c=this.createRequestUrl();if(c){this.connection=$C.asyncRequest("GET",c,this);
}},createRequestUrl:function(){var g=FilterManager.getUserFilterState();var f=SearchMain.getMapManager().getMapState();
var e=SearchMain.getPageState();var c=a+"?";c+=g.toUrlString();c+="&zoom="+f.getZoomLevel();var d=e.getSearchRectangle();
c+="&rect="+d.getWest()+","+d.getSouth()+","+d.getEast()+","+d.getNorth();c+="&p="+this.pageNumber;c+="&regionId="+this.regionBubble.getRegionId();
return c;},success:function(f){try{var c=f.responseText.parseJSON();this.regionBubble.onPageLoad(this.pageNumber,c);
}catch(d){}},failure:function(c){this.regionBubble.onPageLoadFailure(this.pageNumber);}};})();function RegionBubbleRequest(b,c,d,a){this.bubbleManager=b;
this.requestId=c;this.regionId=d;this.clickLatLong=a;this.timeout;}RegionBubbleRequest.prototype=(function(){var b="/search/bubble/GetRegionBubble.htm";
var c=10000;function a(i,h,g,f){var d=b+"?";d+=h.toUrlString();if(g){if(g.getZoomLevel()){d+="&zoom="+g.getZoomLevel();
}}var e=f.getSearchRectangle();if(e){d+="&rect="+e.getWest()+","+e.getSouth()+","+e.getEast()+","+e.getNorth();
}d+="&regionId="+i;return d;}return{submitRequest:function(){this.timeout=c;$C.asyncRequest("GET",a(this.regionId,FilterManager.getUserFilterState(),this.bubbleManager.getMapManager().getMapState(),SearchMain.getPageState()),this);
},success:function(e){var d=e.responseText.parseJSON();this.bubbleManager.onRegionBubbleLoad(d,this.clickLatLong);
},failure:function(d){}};})();function BuildingBubble(e,b,a,c,d){this.mapBubbleObject;this.latLong=e;this.resultCount=b;this.bubbleHTML=a;
this.parameterized=c;this.loadedPages=new Object();if(d!=null){this.loadedPages[1]=d;}this.requestedPages=new Object();
this.currentResultIndex=0;}BuildingBubble.prototype=(function(){var a=10;function c(d){return Math.floor(d/a)+1;
}function b(g,f){if(f){if(f.id==g){return f;}else{if(f.childNodes){for(var e=0;e<f.childNodes.length;
e++){var d=b(g,f.childNodes[e]);if(d!=undefined){return d;}}}}}return undefined;}return{getMapBubbleObject:function(){return this.mapBubbleObject;
},setMapBubbleObject:function(d){this.mapBubbleObject=d;},getLocation:function(){return this.latLong;
},getPageSize:function(){return this.pageSize;},getResultCount:function(){return this.resultCount;},setResultCount:function(d){this.resultCount=d;
},getResultsPage:function(d){return this.loadedPages[d];},getLatitude:function(){return this.latLong.getLatitude();
},getLongitude:function(){return this.latLong.getLongitude();},requestPage:function(d){if(typeof this.loadedPages[d]=="undefined"&&typeof this.requestedPages[d]=="undefined"){this.requestedPages[d]=true;
var e=new IterableBuildingPageRequest(this,d,this.parameterized);e.submitRequest();}},onPageLoad:function(d,f){delete this.requestedPages[d];
this.loadedPages[d]=f;this.setDisplayResult();if(this.getResultCount()==null){var e=0;if(f!=null){e=f.getResultCount();
}this.setResultCount(e);if(e==0){setBubbleResult(IterableBubbleProperty.NO_MATCHES);}this.updateResultCount();
}},onPageLoadFailure:function(d){delete this.requestedPages[d];},draw:function(e,i){this.mapBubbleObject.displayContents(this.bubbleHTML,e,i);
this.setDisplayResult();var g=this.mapBubbleObject.getContentDivElement();var h=b("show-previous-button",g);
var f=b("show-next-button",g);var d=this;if(h){h.onclick=function(){d.onClickPrev();};}if(f){f.onclick=function(){d.onClickNext();
};}},setBubbleResult:function(f){var d=this.mapBubbleObject.getContentDivElement();var e=b("result-number",d);
if(e){e.innerHTML=this.currentResultIndex+1;}var g=b("building-bubble-contents",d);if(g){g.innerHTML=f.getHTML();
}this.mapBubbleObject.refresh();this.mapBubbleObject.updatePosition(undefined,undefined);},updateResultCount:function(){var e=this.mapBubbleObject.getContentDivElement();
var d=b("result-count",e);if(d){var f="";if(this.resultCount){f=this.resultCount;}d.innerHTML=f;}},onClickNext:function(){if(this.resultCount!=null&&this.currentResultIndex<this.resultCount-1){this.currentResultIndex++;
this.setDisplayResult();}if(this.resultCount==null||this.currentResultIndex>=this.resultCount-1){var d=$("show-next-button");
$D.addClass(d,"last");}if(this.currentResultIndex>=1){var e=$("show-previous-button");$D.removeClass(e,"first");
}},onClickPrev:function(){if(this.currentResultIndex>0){this.currentResultIndex--;this.setDisplayResult();
var d=$("show-next-button");$D.removeClass(d,"last");}if(this.currentResultIndex<=0){var e=$("show-previous-button");
$D.addClass(e,"first");}},setDisplayResult:function(){var e=c(this.currentResultIndex);var g=this.getResultsPage(e);
var f=IterableBubbleResult.LOADING_RESULT;if(g==undefined){this.requestPage(e);}else{var d=g.getResultList()[this.currentResultIndex%a];
if(d){f=d;}else{f=IterableBubbleResult.LOADING_RESULT_FAILED;}}this.setBubbleResult(f);}};})();function IterableBuildingPageRequest(c,a,b){this.buildingBubble=c;
this.pageNumber=a;this.parameterized=b;this.timeout;}IterableBuildingPageRequest.prototype=(function(){var a="/search/bubble/GetBuildingBubblePage.htm";
var b="/search/bubble/GetSimpleBuildingBubblePage.htm";var c=10000;return{submitRequest:function(){this.timout=c;
var d=this.createRequestUrl();if(d){this.connection=$C.asyncRequest("GET",d,this);}},createRequestUrl:function(){var d;
if(this.parameterized==true){var g=FilterManager.getUserFilterState();d=a+"?";var f=SearchMain.getMapManager().getMapState();
var e=SearchMain.getPageState();d+=g.toUrlString();}else{d=b+"?";}d+="&p="+this.pageNumber;d+="&lat="+this.buildingBubble.getLocation().getLatitude();
d+="&lon="+this.buildingBubble.getLocation().getLongitude();return d;},success:function(g){try{var d=g.responseText.parseJSON();
this.buildingBubble.onPageLoad(this.pageNumber,d);}catch(f){}},failure:function(d){this.buildingBubble.onPageLoadFailure(this.pageNumber);
}};})();function BuildingBubbleRequest(b,d,e,c,a){this.bubbleManager=b;this.requestId=d;this.latitude=e;
this.longitude=c;this.parameterized=a;this.timeout;}BuildingBubbleRequest.prototype=(function(){var b="/search/bubble/GetBuildingBubble.htm";
var c="/search/bubble/GetSimpleBuildingBubble.htm";var d=10000;function a(h,g,f){var e;if(h!=undefined){e=b+"?"+h.toUrlString();
}else{e=c+"?";}e+="&lat="+g;e+="&lon="+f;return e;}return{submitRequest:function(){this.timeout=d;var e=undefined;
if(this.parameterized==true){e=FilterManager.getUserFilterState();}$C.asyncRequest("GET",a(e,this.latitude,this.longitude),this);
},success:function(f){var e=f.responseText.parseJSON();this.bubbleManager.onBuildingBubbleLoad(e);},failure:function(e){}};
})();function MyEstimatorBubble(d,e,a,c,b){this.myzCompsManager=d;this.mapBubbleObject;this.zpid=e;this.location=a;
this.added=c;this.bubbleHTML=b;}MyEstimatorBubble.prototype=(function(){function a(e,d){if(d){if(d.id==e){return d;
}else{if(d.childNodes){for(var c=0;c<d.childNodes.length;c++){var b=a(e,d.childNodes[c]);if(b!=undefined){return b;
}}}}}return undefined;}return{getMapBubbleObject:function(){return this.mapBubbleObject;},setMapBubbleObject:function(b){this.mapBubbleObject=b;
},getLocation:function(){return this.location;},draw:function(b,c){this.mapBubbleObject.displayContents(this.bubbleHTML,b,c);
this.setCompSelectorText();},getBubbleType:function(){return MapConstants.BubbleType.MyEComp;},getZpid:function(){return this.zpid;
},setAdded:function(b){this.added=b;},isAdded:function(){return this.added;},onCompSelectorClick:function(){this.added=!this.added;
this.setCompSelectorText();if(this.added){this.myzCompsManager.addMyComp(null,this.zpid);}else{this.myzCompsManager.addMyComp(null,this.zpid);
}},setCompSelectorText:function(){var e=(this.added?"Remove from My Comps":"Add to My Comps");var c=this.mapBubbleObject.getContentDivElement();
var d=a("comp-selector-button",c);if(d){d.innerHTML=e;var b=this;d.onclick=function(){b.onCompSelectorClick();
};}}};})();MyEstimatorBubble.createHTML=function(j,b,c,a,e,f){var i="/homedetails/"+j+"_zpid/";var h="<a class='close'>Close</a>";
var k="<div id='property-home-info' class='listing-info'><div class='property-info' id='pinfo-block'><div class='adr'><a href='"+i+"'>"+b+"</a></div><ul class='listing'><li class='type type-recentlySold'><span class='type'>Recently Sold: </span><span class='price'>"+c+"</span></li></ul><ul class='attributes'><li>"+a+" Beds</li><li>"+e+" Baths</li><li>"+f+" sqft</li></ul></div></div>";
var d="<div id='bubblebottom'><ul class='morehomeinfo carrot'><li><a id='comp-selector-button'></a></li></ul></div>";
var g="<div class='map-bubble property-bubble estimator-bubble'><div class='search-result clearfix'><div class='hlisting property clearfix'>"+h+k+d+"</div></div><div class='bubble-beak'></div></div>";
return g;};function BubbleManager(b,a){this.containerId=a;this.mapManager=b;this.requireIframe=false;var c=navigator.appVersion.toLowerCase();
if(c.indexOf("x11")!=-1||c.indexOf("linux")!=-1||c.indexOf("unix")!=-1){this.requireIframe=true;}this.pendingBubbleImpl;
this.pendingId;this.activeBubble;this.lastRequestId=0;}BubbleManager.prototype={getNextRequestId:function(){this.lastRequestId++;
return this.lastRequestId;},onMapInitialized:function(){var b=this.pendingId;var a=this.pendingBubbleImpl;
this.id=undefined;this.pendingBubbleImpl=undefined;if(b&&a){this.openBubble(b,a,undefined);}},openBubble:function(f,a,b){var e=(f==="initial"?true:false);
if(a){var c=this.mapManager.getMapState();if(this.mapManager.isInitialized()&&c){if(this.activeBubble){if(this.activeBubble.getBubbleId()!=f){this.activeBubble.destroyBubble();
this.activeBubble=null;}else{this.activeBubble.updatePosition(c.getBoundingRect(),c.getZoomLevel());this.activeBubble.getBubbleObject().draw();
return;}}this.activeBubble=new MapBubble(this.containerId,this,f,this.requireIframe,a.getLocation(),b,a,e);
a.setMapBubbleObject(this.activeBubble);a.draw(c.getBoundingRect(),c.getZoomLevel());}else{if(this.activeBubble){this.closeActiveBubble();
}this.pendingBubbleImpl=a;this.pendingId=f;}}try{LeadFormManager.init();}catch(d){log("LeadFormManager not defined");
}},closeActiveBubble:function(){if(this.activeBubble){this.activeBubble.destroyBubble();this.activeBubble=undefined;
}},requestPropertyBubble:function(e,a,d){var c=this.getNextRequestId();var b=new PropertyBubbleRequest(this,c,e,a,d);
b.submitRequest();},onPropertyBubbleLoad:function(b,a){if(b){var c="p_"+b.getZpid();this.openBubble(c,b,undefined);
}},requestRegionBubble:function(d,a){var c=this.getNextRequestId();var b=new RegionBubbleRequest(this,c,d,a);
b.submitRequest();},onRegionBubbleLoad:function(b,a){var c="r_"+b.getRegionId();this.openBubble(c,b,a);
},requestBuildingBubble:function(e,c,a){var d=this.getNextRequestId();var b=new BuildingBubbleRequest(this,d,e,c,a);
b.submitRequest();},onBuildingBubbleLoad:function(b){var a="b_"+b.getLatitude()+"_"+b.getLongitude();
this.openBubble(a,b,undefined);},requestMyEstimatorBubble:function(b){var a=compsSelectorMap.getBubbleByZpid(b);
this.onMyEstimatorBubbleLoad(a);},onMyEstimatorBubbleLoad:function(a){var b="mye_"+a.getZpid();this.openBubble(b,a,undefined);
},getMapManager:function(){return this.mapManager;},onMapViewChanged:function(a,b){if(this.activeBubble){this.activeBubble.updatePosition(a,b);
}},onMapMouseClick:function(){this.closeActiveBubble();}};function MapBubble(a,e,d,b,h,c,g,f){this.containerId=a;this.bubbleManager=e;this.bubbleId=d;this.requireIframe=b;
this.latLong=h;this.clickLatLong=c;this.bubbleObject=g;this.isInitialBubble=f;this.initialized=false;
this.boundingRect;this.zoomLevel;this.xPos=0;this.yPos=0;}MapBubble.prototype={updatePosition:function(A,e){if(A&&e){this.boundingRect=A;
this.zoomLevel=e;}else{A=this.boundingRect;e=this.zoomLevel;}var n=VETiles.LatitudeToPixelY(A.getNorth(),e);
var o=VETiles.LongitudeToPixelX(A.getWest(),e);var a=VETiles.LatitudeToPixelY(A.getSouth(),e);var B=VETiles.LongitudeToPixelX(A.getEast(),e);
var q=B-o;var f=a-n;var T=this.latLong;if(this.clickLatLong!=undefined){T=this.clickLatLong;}var s=this.bubbleManager.getMapManager().getMapState().getOrientation();
switch(s){case MapConstants.Orientation.North:this.yPos=VETiles.LatitudeToPixelY(T.getLatitude(),e)-n;
this.xPos=VETiles.LongitudeToPixelX(T.getLongitude(),e)-o;break;case MapConstants.Orientation.South:this.yPos=f-(VETiles.LatitudeToPixelY(T.getLatitude(),e)-n);
this.xPos=q-(VETiles.LongitudeToPixelX(T.getLongitude(),e)-o);break;case MapConstants.Orientation.East:this.yPos=q-(VETiles.LongitudeToPixelX(T.getLongitude(),e)-o);
this.xPos=VETiles.LatitudeToPixelY(T.getLatitude(),e)-n;break;case MapConstants.Orientation.West:this.yPos=VETiles.LongitudeToPixelX(T.getLongitude(),e)-o;
this.xPos=f-(VETiles.LatitudeToPixelY(T.getLatitude(),e)-n);break;}if(this.initialized){var m=this;var v=true;
var C=false;var H=$("bubble-photo");var P=false;var W=$("photo-bubble-enabled");if(W){P=(W.value==="true");
}var V=$(m.getBubbleDivName());if(V){var K=0;var g=150;var u=$("iterable-top");var k=$("bubblebottom");
if((H&&P)||((u||k)&&P)){K=243;}var d=navigator.appName;var S=null;if(d==="Microsoft Internet Explorer"){var S=parseFloat((new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})")).exec(navigator.userAgent)[1]);
}var F=m.xPos;var E=m.yPos;var G=0;var R=0;var I=$("map-menu-container");var O=$("property-home-info");
var U=$(m.getContentDivName());if(U){if(O){m.setPropertyBubbleWidth(O,V);}R=U.offsetHeight;G=U.offsetWidth;
if((R===0)||(G===0)){E+=8;$D.addClass(V,"bubble-below");v=false;F-=39;$D.addClass(V,"bubble-right");}else{var Q=R;
if((H&&P)||((u||k)&&P)){if(u){Q-=u.offsetHeight;}Q+=K-g;}if(!m.isInitialBubble){Q+=30;}if(E<Q){E+=8;$D.addClass(V,"bubble-below");
v=false;}else{E-=R;E-=8;if(u&&P){K-=u.offsetHeight;}}if((I&&(I.offsetWidth-F)>105)){F-=39;$D.addClass(V,"bubble-right");
}else{F-=(G-40);}if(d==="Microsoft Internet Explorer"){var M=$("iterable-top");if(M){M.style.width=(G-3)+"px";
}}}}V.style.left=F+"px";V.style.top=E+"px";V.style.zIndex=9999;if(!(R===0)||(G===0)){m.setBubbleShadow(F,E,G,R,O,d);
}if(this.requireIframe){var l=$(m.getIFrameDivName());if(l){l.style.width=G+"px";l.style.height=R+"px";
}}var H=$("bubble-photo");if(P){if(H){var i;var z=/zpid\-(\d+)/;var L="";var j="";var D="";j=H.getElementsByTagName("a")[0].href;
if(v){i=$("bubble-photoex-up");}else{v=false;i=$("bubble-photoex-down");}var J;if(k&&!v){K-=k.offsetHeight;
}var N=$("header-wrapper");$E.on(H,"mouseover",function(h){clearTimeout(J);var c=this;N.style.zIndex=-1;
if(I){I.style.zIndex=9990;}L=H.className.match(z)[1];var r={success:function(w){try{D=w.responseText.parseJSON();
i.innerHTML=m.photoexHTML(m,v,j,D);PhotoExperience.hidePhotoexLoader(c);}catch(t){}},failure:function(t){},argument:v};
if(!C){PhotoExperience.showPhotoexLoader(c);$C.asyncRequest("GET","/search/PropertyPhotoURLs.htm?zpid="+L,r);
C=true;}else{if(D){PhotoExperience.imgswitch(D.large[0],"",true);}}Element.show(i);var p=$("close-bubble");
$D.addClass(V,"bubble-expanded");if(v){var b=V.childNodes[0].childNodes[0].className;if(!u){p.style.top=K+7+"px";
}else{Element.hide(p);if(u){Element.hide(u);}}V.style.top=E-K+"px";m.setBubbleShadow(F,E-K,G,R+K,O,d);
}else{if(k){Element.hide(k);}m.setBubbleShadow(F,E,G,R+K,O,d);}});$E.on(i,"mouseover",function(b){clearTimeout(J);
});$E.on(H,"mouseout",function(b){clearTimeout(J);J=setTimeout(function(){m.photoexMouseout(m,i,I,N,V,F,E,G,R,O,u,k,d,S);
},200);});$E.on(i,"mouseout",function(b){clearTimeout(J);J=setTimeout(function(){m.photoexMouseout(m,i,I,N,V,F,E,G,R,O,u,k,d,S);
},200);});}}}}},getBubbleId:function(){return this.bubbleId;},getBubbleDivName:function(){return this.containerId+"-"+this.bubbleId;
},getIFrameDivName:function(){return this.getBubbleDivName()+"-iframe";},getContentDivName:function(){return this.getBubbleDivName()+"-content";
},setPropertyBubbleWidth:function(h,a){var c=0;var e=$("featured-listing");var d=$("bubble-photo");var g=$("pinfo-block");
if(g){var i=$("adr-container");c=g.offsetWidth;if(c>0){if(e){c+=16;}if(d){c+=105;$D.addClass(a,"bubble-has-photo");
h.style.width=430+"px";g.style.width=317+"px";if(i){i.style.width=286+"px";}}else{if(c<247){c=247;}h.style.width=c+"px";
}}}},setBubbleShadow:function(j,f,k,c,a,d){var l=$("map-bubble-shadow");var g=$(this.getBubbleDivName());
if(l!==null&&g){var i=j+8;var e=f+4;if(d==="Microsoft Internet Explorer"){i-=3;}l.style.left=i+"px";l.style.top=e+"px";
l.style.width=k+"px";l.style.height=c+"px";l.style.display="block";}},displayContents:function(e,a,f){this.updatePosition(a,f);
var d=$(this.containerId);var g=Element.make("div",{id:this.getBubbleDivName(),style:{position:"absolute",left:this.xPos+"px",top:this.yPos+"px"}});
var c=Element.make("div",{id:this.getContentDivName(),style:{position:"relative",display:"block",zIndex:10,"min-width":350}});
d.appendChild(g);g.appendChild(c);this.initialized=true;if(this.requireIframe){var b=Element.make("iframe",{src:"javascript:''",id:this.getIFrameDivName(),style:{display:"block",position:"absolute",zIndex:5,top:"0px",left:"0px"},scrolling:"no",frameborder:"0"});
g.appendChild(b);}this.updateContents(e);this.updatePosition(a,f);},updateContents:function(f){var e=$(this.getContentDivName());
if(e){e.innerHTML=f;if(this.requireIframe){var c=$(this.getIFrameDivName());if(c){c.style.width=e.offsetWidth+"px";
c.style.height=e.offsetHeight+"px";}}var d=$D.getElementsByClassName("close","a",e);var g=this.bubbleManager;
for(var b=0;b<d.length;b++){d[b].onclick=function a(){g.closeActiveBubble();};}}},refresh:function(){var e=$(this.getContentDivName());
if(e){if(this.requireIframe){var c=$(this.getIFrameDivName());if(c){c.style.width=e.offsetWidth+"px";
c.style.height=e.offsetHeight+"px";}}var d=$D.getElementsByClassName("close","a",e);var f=this.bubbleManager;
for(var b=0;b<d.length;b++){d[b].onclick=function a(){f.closeActiveBubble();};}}},getContentDivElement:function(){return $(this.getContentDivName());
},destroyBubble:function(){var a=$(this.getBubbleDivName());var d=$(this.containerId);var c=$("map-bubble-shadow");
if(c!=null){c.style.display="none";}if(a&&d){d.removeChild(a);}this.initialized=false;},hideContainer:function(){Element.hide(this.containerId);
},showContainer:function(){Element.show(this.containerId);},getBubbleObject:function(){return this.bubbleObject;
},getClickLatLong:function(){return this.clickLatLong;},photoexMouseout:function(a,g,i,l,n,o,m,q,f,d,c,j,e,k){Element.hide(g);
$D.removeClass(n,"bubble-expanded");var r="";if(r=$("close-bubble")){r.style.top="7px";Element.show(r);
}if(c){Element.show(c);}if(j){Element.show(j);}n.style.top=m+"px";a.setBubbleShadow(o,m,q,f,d,e);l.style.zIndex=9000;
if(i){i.style.zIndex=16;}},photoexMinithumbs:function(f,a,e,d){var b="";if(f){for(var c=9;c>1;c--){if(c<=a){b+='<a href="'+e+'" rel="nofollow"><img id="bmt0'+c+'" class="minithumb" src="'+d.thumbs[c-2]+'" onmouseover="PhotoExperience.imgswitch(\''+d.large[c-1]+"', '', true)\" alt=\"\" /></a>\n";
}else{b+='<div class="minithumb default"></div>\n';}}}else{for(var c=2;c<10;c++){if(c<=a){b+='<a href="'+e+'" rel="nofollow"><img id="bmt0'+c+'" class="minithumb" src="'+d.thumbs[c-2]+'" onmouseover="PhotoExperience.imgswitch(\''+d.large[c-1]+"', '', true)\" alt=\"\" /></a>\n";
}else{b+='<div class="minithumb default"></div>\n';}}}return b;},photoexHTML:function(c,g,f,e){var a=0;
a=e.large.length;var b='			<div class="viewmore">				<ul class="carrot"> 					<li> 					<a href="'+f+'" rel="nofollow">View ';
if(a>1){b+="all photos";}else{b+="photo";}b+="</a> 					</li> 				</ul> 			</div> 		";var d='			<div class="minithumbs"> 		';
if(g){d+=b;d+=c.photoexMinithumbs(g,a,f,e);}else{d+=c.photoexMinithumbs(g,a,f,e);d+=b;}d+='		</div> 		<a href="'+f+'" rel="nofollow"> 			<img id="bubble-photoexmain"  class="photoexmain" src="'+e.large[0]+'" width="316" height="234" /> 		';
d+='			<img src="/static/images/ajax-loader.gif" id="bubble-mainphotoex-loader" class="loading hide" /> 		</a> 		';
return(d);}};function SearchResultsManager(a){this.mapObjectManager=a;this.buildings=new Object();this.properties=new Object();
this.latLongToPropertyKeyMap=new Object();this.regions=new Object();}SearchResultsManager.prototype=(function(){return{setSearchResults:function(m,g,h){var a=new Object();
var e=new Object();var n=new Array();var f=new Array();for(var o=0;o<m.length;o++){var l=m[o];var v=l.getZpid();
a[v]=l;e[l.getLatitude()+"_"+l.getLongitude()]=v;var c=this.properties[v];if(c){if(!SearchResultProperty.isEqual(l,c)){f.push(c);
n.push(l);}delete this.properties[v];}else{n.push(l);}}for(var v in this.properties){f.push(this.properties[v]);
}this.properties=a;this.latLongToPropertyKeyMap=e;var s=new Object();var w=new Array();var t=new Array();
for(var o=0;o<g.length;o++){var u=g[o];var v=""+u.getLatitude()+"_"+u.getLongitude();s[v]=u;var c=this.buildings[v];
if(c){if(!SearchResultBuilding.isEqual(u,c)){t.push(c);w.push(u);}delete this.buildings[v];}else{w.push(u);
}}for(var v in this.buildings){t.push(this.buildings[v]);}this.buildings=s;var q=new Object();var j=new Array();
var d=new Array();for(var o=0;o<h.length;o++){var k=h[o];var v=k.getRegionId();q[v]=k;var c=this.regions[v];
if(c){if(!SearchResultRegion.isEqual(k,c)){d.push(c);j.push(k);}delete this.regions[v];}else{j.push(k);
}}for(var v in this.regions){d.push(this.regions[v]);}this.regions=q;this.mapObjectManager.updateSearchResults(n,f,w,t,j,d);
},getProperty:function(a){return this.properties[a];},getPropertyByLocation:function(b,a){return this.latLongToPropertyKeyMap[b+"_"+a];
},getBuilding:function(b,a){return this.buildings[b+"_"+a];}};})();function SearchResultProperty(e,d,c,a,b){this.zpid=e;
this.latitude=d;this.longitude=c;this.label=a;this.statusType=b;}SearchResultProperty.prototype={getZpid:function(){return this.zpid;
},getLatitude:function(){return this.latitude;},getLongitude:function(){return this.longitude;},getLabel:function(){return this.label;
},getStatusType:function(){return this.statusType;}};SearchResultProperty.isEqual=function(b,a){return b.zpid==a.zpid&&b.latitude==a.latitude&&b.longitude==a.longitude&&b.label==a.label&&b.statusType==a.statusType;
};function SearchResultBuilding(e,d,a,c,b){this.latitude=e;this.longitude=d;this.label=a;this.count=c;
this.statusType=b;}SearchResultBuilding.prototype={getLatitude:function(){return this.latitude;},getLongitude:function(){return this.longitude;
},getLabel:function(){return this.label;},getCount:function(){return this.count;},getStatusType:function(){return this.statusType;
}};SearchResultBuilding.isEqual=function(b,a){return b.latitude==a.latitude&&b.longitude==a.longitude&&b.label==a.label&&b.count==a.count&&b.statusType==a.statusType;
};function SearchResultRegion(g,f,c,a,b,d,e){this.regionId=g;this.latitude=f;this.longitude=c;this.label=a;
this.statusType=b;this.regionName=d;this.child=e;}SearchResultRegion.prototype={getRegionId:function(){return this.regionId;
},getLatitude:function(){return this.latitude;},getLongitude:function(){return this.longitude;},getLabel:function(){return this.label;
},getStatusType:function(){return this.statusType;},getRegionName:function(){return this.regionName;},isChild:function(){return this.child;
}};SearchResultRegion.isEqual=function(b,a){return b.regionId==a.regionId&&b.latitude==a.latitude&&b.longitude==a.longitude&&b.label==a.label&&b.statusType==a.statusType&&b.regionName==a.regionName;
};function ZestimateTile(b,a){this.row=b;this.column=a;this.buildings=new Object();this.properties=new Object();
}ZestimateTile.prototype={getRow:function(){return this.row;},getColumn:function(){return this.column;
},addProperty:function(a){this.properties[""+a.getZpid()]=a;},addBuilding:function(a){this.buildings[a.getLatitude()+"_"+a.getLongitude()]=a;
},getProperty:function(a){return this.properties[""+a];},getBuilding:function(b,a){return this.buildings[b+"_"+a];
},getBuildingsObject:function(){return this.buildings;},getPropertiesObject:function(){return this.properties;
}};function ZestimateTileProperty(d,c,b,a){this.zpid=d;this.latitude=c;this.longitude=b;this.label=a;
}ZestimateTileProperty.prototype={getZpid:function(){return this.zpid;},getLatitude:function(){return this.latitude;
},getLongitude:function(){return this.longitude;},getLabel:function(){return this.label;}};function ZestimateTileBuilding(c,b,a){this.latitude=c;
this.longitude=b;this.count=a;}ZestimateTileBuilding.prototype={getLatitude:function(){return this.latitude;
},getLongitude:function(){return this.longitude;},getCount:function(){return this.count;}};function ZestimateTileManager(a,b){this.enabled=b;this.mapObjectManager=a;this.requestedTiles=new Object();
this.loadedTiles=new Object();this.zoomLevel=null;this.minColumn;this.maxColumn;this.minRow;this.maxRow;
}ZestimateTileManager.prototype=(function(){var c=15;var b=17;var a=18;return{updateLocation:function(e,f){if(f!=this.zoomLevel){this.zoomLevel=f;
this.clearAllTiles();}if(f>=b&&f<=a&&this.enabled){var g=VETiles.PixelXYToTileXY(VETiles.LongitudeToPixelX(e.getWest(),c),VETiles.LatitudeToPixelY(e.getNorth(),c),c);
var d=VETiles.PixelXYToTileXY(VETiles.LongitudeToPixelX(e.getEast(),c),VETiles.LatitudeToPixelY(e.getSouth(),c),c);
this.minColumn=g.x;this.maxColumn=d.x;this.minRow=g.y;this.maxRow=d.y;this.requestTiles(g.x,d.x,g.y,d.y);
this.cleanUpTiles();}if(f<b||f>a){this.clearAllTiles();}},requestTiles:function(f,e,d,k){if((1+e-f)*(1+k-d)<30){for(var j=d;
j<=k;j++){for(var g=f;g<=e;g++){var i=ZestimateTileManager.createTileName(j,g);if((typeof this.loadedTiles[i]=="undefined")&&(typeof this.requestedTiles[i]=="undefined")){var h=new ZestimateTileRequest(this);
this.requestedTiles[i]=true;h.addTileToRequest(j,g);h.submitRequest();}}}}},removeTile:function(g,d){var f=ZestimateTileManager.createTileName(g,d);
var e=this.loadedTiles[f];if(e){this.mapObjectManager.removeZestimateTileObjects(e);}delete this.loadedTiles[f];
delete this.requestedTiles[f];},cleanUpTiles:function(){for(var e in this.loadedTiles){var d=this.loadedTiles[e];
if(d.getRow()<this.minRow||d.getRow()>this.maxRow||d.getColumn()<this.minColumn||d.getColumn()>this.maxColumn){this.removeTile(d.getRow(),d.getColumn());
}}},clearAllTiles:function(){this.requestedTiles=new Object();for(var e in this.loadedTiles){var d=this.loadedTiles[e];
this.mapObjectManager.removeZestimateTileObjects(d);}this.loadedTiles=new Object();},onZestimateTileLoad:function(e){var d=ZestimateTileManager.createTileName(e.getRow(),e.getColumn());
if(this.requestedTiles[d]==true&&e.getRow()>=this.minRow&&e.getRow()<=this.maxRow&&e.getColumn()>=this.minColumn&&e.getColumn()<=this.maxColumn){this.loadedTiles[d]=e;
delete this.requestedTiles[d];this.mapObjectManager.addZestimateTileObjects(e);}},onZestimateTileLoadFailure:function(f,d){var e=ZestimateTileManager.createTileName(f,d);
delete this.requestedTiles[e];},getProperty:function(i,h,g){var f=VETiles.PixelXYToTileXY(VETiles.LongitudeToPixelX(g,c),VETiles.LatitudeToPixelY(h,c),c);
var e=ZestimateTileManager.createTileName(f.y,f.x);var d=this.loadedTiles[e];if(d){return d.getProperty(i);
}return undefined;},getBuilding:function(h,g){var f=VETiles.PixelXYToTileXY(VETiles.LongitudeToPixelX(g,c),VETiles.LatitudeToPixelY(h,c),c);
var e=ZestimateTileManager.createTileName(f.y,f.x);var d=this.loadedTiles[e];if(d){return d.getBuilding(h,g);
}return undefined;}};})();ZestimateTileManager.createTileName=function(b,a){return b+"_"+a;};function ZestimateTileRequest(a){this.zestimateTileManager=a;
this.requestedTiles=new Array();this.timeout;}ZestimateTileRequest.prototype=(function(){var BASE_URL="/search/GetZestimateTiles.htm";
var TILES_PARAM_NAME="tiles";var TIMEOUT_MS=5000;function createRequestURL(requestedtilesArray){var tilesString="";
for(var i=0;i<requestedtilesArray.length;i++){var t=requestedtilesArray[i];var tileName=t.row+"_"+t.column;
if(tilesString.length>0){tilesString+="!";}tilesString+=tileName;}return BASE_URL+"?"+TILES_PARAM_NAME+"="+tilesString;
}return{addTileToRequest:function(row,column){var t=new Object();t.row=row;t.column=column;this.requestedTiles.push(t);
},getRequestedTilesArray:function(){return this.requestedTiles;},getRequestedTilesCount:function(){return this.requestedTiles.length;
},submitRequest:function(){this.timeout=TIMEOUT_MS;$C.asyncRequest("GET",createRequestURL(this.requestedTiles),this);
},success:function(o){var responseArray=eval(o.responseText);for(var tileIdx=0;tileIdx<responseArray.length;
tileIdx++){var tileObj=responseArray[tileIdx];if(typeof tileObj.error!="undefined"){this.zestimateTileManager.onZestimateTileLoadFailure(tileObj.row,tileObj.column);
}else{var zestimateTile=new ZestimateTile(tileObj.row,tileObj.column);var pArr=tileObj.properties;var bArr=tileObj.buildings;
for(var pIdx=0;pIdx<pArr.length;pIdx++){var p=pArr[pIdx];zestimateTile.addProperty(new ZestimateTileProperty(p[0],p[1],p[2],p[3]));
}for(var bIdx=0;bIdx<bArr.length;bIdx++){var b=bArr[bIdx];zestimateTile.addBuilding(new ZestimateTileBuilding(b[0],b[1],b[2]));
}this.zestimateTileManager.onZestimateTileLoad(zestimateTile);}}},failure:function(o){for(var i=0;i<this.requestedTiles.length;
i++){this.zestimateTileManager.onZestimateTileLoadFailure(this.requestedTiles[i].row,this.requestedTiles[i].column);
}}};})();
