var g_aLocations=[];RfgQueueCommand("RfgCreateMap('resultmap','RoadVE',false,38.643700,-98.823500,4,false,false,'');");RfgQueueCommand("RfgShowMapDashboard('resultmap',false);");RfgQueueCommand("g_pMainSearchMap = RfgGetMapById('resultmap');");RfgQueueCommand("if(g_aLocations.length)RfgResizeMapToPoints('resultmap',g_aLocations);");function MapSearch(){this.m_bRadiusSet=false;this.selectCurrentMap=function(C){var F=RfgGetCurrentMapView("resultmap");var B=new Array();B.push(F.TopLeftLatLong);B.push(new VELatLong(F.TopLeftLatLong.Latitude,F.BottomRightLatLong.Longitude));
B.push(F.BottomRightLatLong);B.push(new VELatLong(F.BottomRightLatLong.Latitude,F.TopLeftLatLong.Longitude));B.push(F.TopLeftLatLong);var E=new MapShape("p","Map Area",0,B);var D=obj("sidebar_form_property");D.type.value="map";D.shape.value=E.getSerialized();switchToMapSearch();if(!C){DoPropertySearch(D);D.submit()}};this.drawSearchShape=function(D){if(D!=""){D=D.split("|");if(D[0]=="c"){var E=D[3].split(",");E[0]=parseFloat(E[0]);E[1]=parseFloat(E[1]);var C=parseFloat(D[2])/80;g_aLocations.push(new VELatLong(E[0]+C,E[1]+C));
g_aLocations.push(new VELatLong(E[0]-C,E[1]-C));RfgQueueCommand("RfgDrawRadius('resultmap',"+D[2]+","+D[3]+")")}else{if(D[0]=="p"){var F=D.splice(3,D.length-3);for(var B=0;B<F.length;B+=2){g_aLocations.push(new VELatLong(parseFloat(F[B].split(",")[0]),parseFloat(F[B].split(",")[1])))}RfgQueueCommand("RfgDrawPolygon('resultmap',"+F.join(",")+")")}}}};this.onCompleteRadiusDraw=function(D){this.m_bRadiusSet=true;var C=new MapShape("c","Map Area",D.fDistance,g_pRfgRadiusInProgress.aLocs);var B=obj("sidebar_form_property");
B.type.value="map";B.shape.value=C.getSerialized();A()};this.onCompleteRectangleDraw=function(D){var C=new MapShape("p","Map Area",0,g_pRfgRadiusInProgress.aLocs);var B=obj("sidebar_form_property");B.type.value="map";B.shape.value=C.getSerialized();A()};this.onCompleteTriangleDraw=function(D){var C=new MapShape("p","Map Area",0,g_pRfgRadiusInProgress.aLocs);var B=obj("sidebar_form_property");B.type.value="map";B.shape.value=C.getSerialized();A()};this.MapSearch=function(){var B=obj("sidebar_form_property");B.action="/search/property/map.jsp";
DoPropertySearch(B);B.submit()};this.onMapViewChange=function(){if(!this.m_bRadiusSet){this.selectCurrentMap(true)}};this.startRadiusDraw=function(){if(RfgGetZoomLevel("resultmap")<=6){alert("Please zoom in further before using the drawing tools");return }if(g_pRfgRadiusDrawLayers.resultmap&&g_pRfgRadiusDrawLayers.resultmap.mask){return }var C=RfgGetMapById("resultmap");try{C.DeleteAllPolygons();RfgStartRadiusDrawMode("resultmap",function(D){Gm.onCompleteRadiusDraw(D)})}catch(B){alert(B.message)}};this.startRectangleDraw=function(){if(RfgGetZoomLevel("resultmap")<=6){alert("Please zoom in further before using the drawing tools");
return }if(g_pRfgRadiusDrawLayers.resultmap&&g_pRfgRadiusDrawLayers.resultmap.mask){return }var C=RfgGetMapById("resultmap");try{C.DeleteAllPolygons();RfgStartRectangleDrawMode("resultmap",Gm.onCompleteRectangleDraw)}catch(B){alert(B.message)}};this.startTriangleDraw=function(){if(RfgGetZoomLevel("resultmap")<=6){alert("Please zoom in further before using the drawing tools");return }if(g_pRfgRadiusDrawLayers.resultmap&&g_pRfgRadiusDrawLayers.resultmap.mask){return }var C=RfgGetMapById("resultmap");try{C.DeleteAllPolygons();
RfgStartTriangleDrawMode("resultmap",Gm.onCompleteTriangleDraw)}catch(B){alert(B.message)}};this.GetFirstResults=A;function A(){var C=obj("sidebar_form_property");var B=new QueryString("/erabuy/mapsearchajax.jsp",C);B.add("atr","RST");B.nocache=true;g_CyberAjaxQueue.schedule("GetFirstResults",B,function(){var E=obj("maplistingcontainer");var F=E.getElementsByTagName("div");var G="";if(this.xmlObject.responseText.replace("\t","","g").replace("\r\n","","g")==""){G="none"}for(var D=0;D<F.length;D++){F[D].style.display=G
}obj("SearchPreview").innerHTML=this.xmlObject.responseText},function(){alert("error")},false,false)}this.redrawMap=function(){RfgAttachMapEvent("resultmap","onchangeview",function(){Gm.onMapViewChange()});this.onMapViewChange()}}var Gm=new MapSearch();RfgQueueCommand("Gm.redrawMap()");function UpdatePropertySearchLimits(B){if(typeof B=="undefined"){B=false}if(!g_bInitializeComplete){return }if(g_bIgnoreSearchInput){return }var A=obj("sidebar_form_property");if(A.onsubmit){if(!A.onsubmit()){return }}if(B){A.submit()
}else{Gm.GetFirstResults()}}function postMe(C){var A=C.value.split(",");var F=parseFloat(A[0]);var B=parseFloat(A[1]);var E=parseFloat(A[2]);var D=RfgGetMapById("resultmap");D.DeleteAllPolygons();g_pRfgRadiusInProgress={aLocs:[new VELatLong(F,B)]};Gm.onCompleteRadiusDraw({fDistance:E});RfgShowRadius("resultmap",F,B,E,true,"00FF00","00FF00")};
