var g_bContinuous=false;var g_pMainSearchMap=null;var g_strOnErrorMsg="";var g_strFindMsgTxt='Could not find address/location. Please try entering a "city, state" or zip code.';var g_pLocationRefineContainer=null;var g_bContinuous=false;var g_strMainMapObjId="resultmap";function North_Start(){g_strOnErrorMsg="Could not navigate map, please check your direction and try again.";g_pMainSearchMap.StartContinuousPan(0,-20);g_bContinuous=true}function North_End(){if(g_bContinuous){g_pMainSearchMap.EndContinuousPan();
g_bContinuous=false}}function South_Start(){g_strOnErrorMsg="Could not navigate map, please check your direction and try again.";g_pMainSearchMap.StartContinuousPan(0,20);g_bContinuous=true}function South_End(){if(g_bContinuous){g_pMainSearchMap.EndContinuousPan();g_bContinuous=false}}function East_Start(){g_strOnErrorMsg="Could not navigate map, please check your direction and try again.";g_pMainSearchMap.StartContinuousPan(20,0);g_bContinuous=true}function East_End(){if(g_bContinuous){g_pMainSearchMap.EndContinuousPan();
g_bContinuous=false}}function West_Start(){g_strOnErrorMsg="Could not navigate map, please check your direction and try again.";g_pMainSearchMap.StartContinuousPan(-20,0);g_bContinuous=true}function West_End(){if(g_bContinuous){g_pMainSearchMap.EndContinuousPan();g_bContinuous=false}}function FindLocationCallback(D,F,E,C,B){RfgHideWaitDialog(g_strMainMapObjId);g_strOnErrorMsg="";if(E==null||E.length<1){alert(g_strFindMsgTxt);return }if(E.length>1){if(HandleMultipleLocationMatches(E)){return }}var A=E[0];g_pMainSearchMap.Clear();
g_pMainSearchMap.SetZoomLevel(13);g_pMainSearchMap.SetCenter(A.LatLong)}function SetMapLocation(A,B,D){var C=document.getElementById("placename");if(C&&A){C.value=unescape(A)}if(g_pLocationRefineContainer){g_pLocationRefineContainer.style.visibility="hidden";g_pLocationRefineContainer.innerHTML=""}g_pMainSearchMap.Clear();g_pMainSearchMap.SetZoomLevel(13);g_pMainSearchMap.SetCenter(new VELatLong(B,D))}function HandleMultipleLocationMatches(results){if(results.length>1){try{if(!g_pLocationRefineContainer){var pMapContainerDiv=document.getElementById(g_strMainMapObjId);
var iMapWidth=parseInt(pMapContainerDiv.offsetWidth);var iMapHeight=parseInt(pMapContainerDiv.offsetHeight);var iChildWidth=parseInt(iMapWidth-(iMapWidth*0.2));var iChildHeight=parseInt(iMapHeight-(iMapHeight*0.15));var iChildLeft=parseInt((iMapWidth-iChildWidth)/2);var iChildTop=parseInt((iMapHeight-iChildHeight)/2);g_pLocationRefineContainer=document.createElement("div");g_pLocationRefineContainer.id="locrefine_"+g_strMainMapObjId;g_pLocationRefineContainer.style.top=iChildTop+"px";g_pLocationRefineContainer.style.left=iChildLeft+"px";
g_pLocationRefineContainer.style.width=iChildWidth+"px";g_pLocationRefineContainer.style.height=iChildHeight+"px";g_pLocationRefineContainer.style.background="#FFFFFF";g_pLocationRefineContainer.innerHTML="";g_pLocationRefineContainer.style.position="absolute";g_pMainSearchMap.AddControl(g_pLocationRefineContainer,null);g_pLocationRefineContainer.style.zIndex=999}var strLocationOptions="<ul>";var iShowResults=0;var strSetCmd="";for(var i=0;i<results.length;i++){if(iShowResults<18){iShowResults++;strSetCmd="SetMapLocation('"+escape(results[i].Name)+"', "+results[i].LatLong.Latitude+", "+results[i].LatLong.Longitude+");";
strLocationOptions+='<li><a href="Javascript:'+strSetCmd+'">'+results[i].Name+"</a>"}}strLocationOptions+="</ul>";g_pLocationRefineContainer.innerHTML='<div class=graycalloutcontainer style="border:0;"><div class=bluecalloutcontainer><img src="'+g_strRfgClientSupportUrl+'/close.gif" alt="X" border=0 align=right onClick="g_pLocationRefineContainer.style.visibility = \'hidden\';"><b>More than one location matched your search:<b></div><br>'+strLocationOptions+"</div>";if(iShowResults>1){g_pLocationRefineContainer.style.visibility="visible"
}else{g_pLocationRefineContainer.style.visibility="hidden"}if(iShowResults==1){eval(strSetCmd)}return(iShowResults>0)}catch(e){}}return false}function ResetMapToPlace(){g_strOnErrorMsg="";if(!g_pMainSearchMap){alert("Please wait for the map to finish loading before searching for a place.");return false}var A=document.getElementById("placename");if(A&&A.value!=""){RfgShowWaitDialog(g_strMainMapObjId,true,"Locating place");g_strOnErrorMsg=g_strFindMsgTxt;RfgFindLocation(g_strMainMapObjId,A.value,false,false,FindLocationCallback)
}else{alert("Please enter a city & state, zip code or major landmark to start your search.")}return false};