var YMAPPID="yrealestate";document.write('<'+'script src="http://us.js2.yimg.com/us.js.yimg.com/lib/map/js/api/ymapapi_3_5_0_4.js" type="text/javascript"></script>');var yreMap={id:null,mapObj:null,zoomLevel:6,centerPt:null,width:null,height:null,expWidth:null,expHeight:null,openExpand:0,mapType:null,mapSize:null,currSize:null,rendered:false,init:function(id,lat,lon,width,height,expWidth,expHeight,zoomLevel,openExpand){this.id=id;this.centerPt=new YGeoPoint(lat,lon);this.width=width;this.height=height;this.expWidth=expWidth;this.expHeight=expHeight;this.zoomLevel=zoomLevel;this.openExpand=openExpand;var mt=yreGetPrefCookie(YRE_COOKIE_MAP_TYPE);this.mapType=(mt=='')?YAHOO_MAP_REG:mt;var ms=yreGetPrefCookie(YRE_COOKIE_MAP_SIZE);this.mapSize=(ms=='')?'S':ms;this.currSize=(this.mapSize=='L')?'expand':'default';document.getElementById('map_size_link').onclick=function(){yreMap.resize();return false;};if(document.getElementById('yreMapHideLnk')){document.getElementById('yreMapHideLnk').onclick=function(){yreMap.hideMap();return false;};}
if(document.getElementById('yreMapShowLnk')){document.getElementById('yreMapShowLnk').onclick=function(){yreMap.showMap();return false;};}},createMarker:function(geoPoint,label,autoExpand,smartWin,icon,iconSize,color){var bubble=new YImage();bubble.src=icon;bubble.size=iconSize;bubble.offsetSmartWindow=new YCoordPoint(0,0);var marker=new YMarker(geoPoint,bubble);marker.addLabel("<div class=mapLabel>"+label+"</div>");marker.addAutoExpand(autoExpand);marker.setSmartWindowColor(color);YEvent.Capture(marker,EventsList.MouseClick,function(){marker.openSmartWindow(smartWin);});return marker;},display:function(points){var size=(this.mapSize=='L')?new YSize(this.expWidth,this.expHeight):new YSize(this.width,this.height);var map=new YMap(document.getElementById(this.id),this.mapType,size);map.removeZoomScale();map.addTypeControl();map.addPanControl();map.addZoomLong();map.disableKeyControls();YEvent.Capture(map,EventsList.changeMapType,function(){yreMap.changeMapType();return true;});var geoPoints=[];var first=null;for(var i=0;i<points.length;i++){var p=points[i];var geoPoint=new YGeoPoint(p.lat,p.lon);geoPoints[geoPoints.length]=geoPoint;var marker=this.createMarker(geoPoint,p.label,p.popupS,p.popupL,p.icon.url,new YSize(p.icon.w,p.icon.h),p.popupColor);map.addOverlay(marker);if(i==0){first=marker;}}
if(1&&geoPoints.length>0){var zoomCenter=map.getBestZoomAndCenter(geoPoints);map.drawZoomAndCenter(zoomCenter.YGeoPoint,zoomCenter.zoomLevel);}else{map.drawZoomAndCenter(this.centerPt,this.zoomLevel);}
if(this.openExpand&&first!=null){first.openAutoExpand();}
this.rendered=true;this.mapObj=map;},resize:function(){var lnk=document.getElementById("map_size_link");var ico=document.getElementById("icon-size");if(this.currSize=='default'){this.mapObj.resizeTo(new YSize(this.expWidth,this.expHeight));lnk.innerHTML='Reduce Map Size';ico.src='/webfront/idx/map/images/unzoom.gif';this.currSize='expand';yreSetPrefCookie(YRE_COOKIE_MAP_SIZE,'L');}else{this.mapObj.resizeTo(new YSize(this.width,this.height));lnk.innerHTML='Expand Map Size';ico.src='/webfront/idx/map/images/zoom.gif';this.currSize='default';yreSetPrefCookie(YRE_COOKIE_MAP_SIZE,'S');}},hideMap:function(){document.getElementById("map_wrapper").className="yreMapView1";if(document.getElementById("yreMapCaption")){document.getElementById("yreMapCaption").className="caption2";}
yreSetPrefCookie(YRE_COOKIE_MAP_SHOW,'N');},showMap:function(){document.getElementById("map_wrapper").className="yreMapView2";if(document.getElementById("yreMapCaption")){document.getElementById("yreMapCaption").className="caption";}
yreSetPrefCookie(YRE_COOKIE_MAP_SHOW,'Y');if(!this.rendered){this.display(mapPoints);}},changeMapType:function(){var type=this.mapObj.getCurrentMapType();yreSetPrefCookie(YRE_COOKIE_MAP_TYPE,type);}};var yreImageMap={zoomLevel:4,apiUrl:'/api/mapimage.html',locations:[],ajax:true,setUseAjax:function(ajax){this.ajax=ajax;},add:function(o){this.locations[this.locations.length]=o;},displayAll:function(){if(!this.ajax){var len=this.locations.length;if(len<1){return;}
var url="http://"+document.location.host+this.apiUrl+"?";for(var i=0;i<len;i++){if(i>0){url+="&";}
var o=this.locations[i];url+="q="+escape(o.elemId+"|"+o.lat+"|"+o.lon);}
this._mapRequest(url);}else{for(var i=0;i<this.locations.length;i++){this.displayAjaxMap(this.locations[i]);}}},display:function(o){if(this.ajax){this.displayAjaxMap(o);}else{this.displayImageMap(o);}},displayAjaxMap:function(o){var map=new YMap(document.getElementById(o.elemId),YAHOO_MAP_REG,new YSize(100,100));var cPT=new YGeoPoint(o.lat,o.lon);map.removeYLogo();map.removeYCopy();map.removeZoomScale();map.disableKeyControls();map.drawZoomAndCenter(cPT,this.zoomLevel);var myImage=new YImage();myImage.src=o.icon.url;myImage.size=new YSize(o.icon.w,o.icon.h);var marker=new YMarker(cPT,myImage);map.addOverlay(marker);},displayImageMap:function(o){if(!o.url){return;}
document.getElementById(o.elemId).style['background']="transparent url('"+o.url+"') no-repeat center center";},_mapRequest:function(url){YAHOO.util.Connect.asyncRequest('GET',url,this._mapCallback);},_mapSuccess:function(obj){var resp=obj.responseText;if(resp!=null){resp=resp.substring(0,resp.lastIndexOf('}')+1);var images=eval('('+resp+')');for(var i=0;i<this.locations.length;i++){var loc=this.locations[i];if(images[loc.elemId]){loc['url']=images[loc.elemId];this.displayImageMap(loc);}}}},_mapFailure:function(obj){return;},_mapCallback:{success:function(o){yreImageMap._mapSuccess(o);},failure:function(o){yreImageMap._mapFailure(o);}}};var yreNeighborhoodMap={cid:null,zoomLevel:3,lat:null,lon:null,mapObj:null,poiCtrl:null,poiUrl:'/api/poisearch.html',points:{},poiLabels:{school:'A',apartment:'B',sales:'B',grocery:'C',park:'D',restaurant:'E','gas station':'F'},display:function(o){this.lat=o.lat;this.lon=o.lon;this.cid=o.cid;var map=new YMap(document.getElementById('nmMap'),YAHOO_MAP_REG,new YSize(657,318));this.mapObj=map;var cPT=new YGeoPoint(this['lat'],this['lon']);map.addTypeControl();map.addPanControl();map.addZoomLong();map.disableKeyControls();map.drawZoomAndCenter(cPT,this.zoomLevel);var myImage=new YImage();myImage.src="images/re_map_pointer_bubble_current.png";myImage.size=new YSize(22,28);var marker=new YMarker(cPT,myImage);this.mapObj.addOverlay(marker);YAHOO.util.Event.addListener(window,"unload",function(){yreNeighborhoodMap.unload();});this.initPoiControl();},initPoiControl:function(){this.poiCtrl={buttons:document.poiform.poi,clear:function(){for(var i=0;i<this.buttons.length;i++){this.buttons[i].checked=false;}}};var _this=this;for(var i=0;i<this.poiCtrl.buttons.length;i++){if(this.poiCtrl.buttons[i].checked){this.switchPoi(this.poiCtrl.buttons[i]);}
this.poiCtrl.buttons[i].onclick=function(){_this.switchPoi(this);return true;};}
var cl=document.getElementById('clearlink');cl.onclick=function(){_this.clearPoi();_this.poiCtrl.clear();return false;};},switchPoi:function(node){var poiType=node.value;if(poiType==''){return;}
if(!node.checked){this.clearPoi(poiType);return;}
if(this.points[poiType]){this.displayPoi(this.points[poiType],poiType);return;}
var url="http://"+document.location.host+this.poiUrl;url+="?lat="+this.lat+"&lon="+this.lon;url+="&q="+escape(poiType);url+="&cid="+this.cid;this.poiRequest(url);},clearPoi:function(poiType){if(poiType==null){for(var pt in this.points){this.clearPoi(pt);}
return;}
var ps=this.points[poiType];if(ps==null){return;}
for(var i=ps.length-1;i>=0;i--){if(ps[i].marker!=null){this.mapObj.removeOverlay(ps[i].marker);ps[i].marker=null;}}},displayPoi:function(poi,poiType){if(poi==null){return;}
var createMarker=function(geoPoint,icon,label,autoExpand,smart){var m=new YMarker(geoPoint,icon);m.setSmartWindowColor("lightblue");m.addLabel("<div class=yreMapLabel>"+label+"</div>");m.addAutoExpand(autoExpand);YEvent.Capture(m,EventsList.MouseClick,function(){m.openSmartWindow(smart);});return m;};var label=this.poiLabels[poiType];for(var i=0;i<poi.length;i++){var geoPoint=new YGeoPoint(poi[i]['lat'],poi[i]['lon']);var myImage=new YImage();myImage.src="images/local_map_marker_blue.png";myImage.size=new YSize(23,29);var expand=poi[i]['autoExpand'];var smart=poi[i]['smartWin'];var marker=createMarker(geoPoint,myImage,label,expand,smart);this.mapObj.addOverlay(marker);poi[i]['marker']=marker;}},poiRequest:function(url){YAHOO.util.Connect.asyncRequest('GET',url,this.poiCallback);},poiSuccess:function(obj){var resp=obj.responseText;if(resp!=null){resp=resp.substring(0,resp.lastIndexOf('}')+1);var poi=eval('('+resp+')');var query=poi['query'];if(query!=null){this.points[query]=poi['points'];this.displayPoi(this.points[query],query);}}},poiFailure:function(obj){},poiCallback:{success:function(o){yreNeighborhoodMap.poiSuccess(o);},failure:function(o){yreNeighborhoodMap.poiFailure(o);}},unload:function(){this.mapObj=null;this.poiCtrl=null;for(var p in this.points){delete this.points[p];}
this.points=null;}};function yreStartMap(e,o){yreMap.display(o);}
function yreStartImageMap(e){yreImageMap.displayAll();}
function yreStartNeighborhoodMap(e,o){yreNeighborhoodMap.display(o);}