var nu=window.navigator.userAgent;var ie=(nu.indexOf("Firefox")==-1&&nu.indexOf("Netscape")==-1);var gmapContn=null;var gdays_isNew=7;var igenkey=0;var longitude=0;var latitude=0;var markers=new Object();var gisMap=false;var gisSelfMap=false;var glimitCount=500;var glimitLevel=13;var gsState=false;var gcState=false;var greLoad=false;var gisZoom=false;var gmTop=0;var gmLeft=0;var gcm_Center;var gcm_PinID;var gmTypeView=false;var gcZindex=0;var gisMove=false;var gisMLoading=false;var gMaxLati=0;var gMinLati=0;var gMaxLong=0;var gMinLong=0;var gIS_HaveAllPins=false;var gIS_NeedAllPins=true;var gIS_RealSearch=false;var gSearchTime=0;var gTotalCount=-1;var gmatchCount=-1;var gISMapSearch=false;function GetWebPath(){if(typeof(gWebPath)=="undefined"){return""}else{return gWebPath}}function iGenMap(b){try{this.control=null;this.center=null;this.zoomlevel=9;this.firstCenter=null;if(b!=null&&b!=""){this.divid=b}else{this.divid="map"}this.dv=document.getElementById(this.divid);if(this.dv==null){return}if(!ie){this.dv.onmouseout=function(){MarkerClose()}}this.dv.innerHTML="";this.map=new GMap2(this.dv);this.map.setCenter(new GLatLng(35.496586,-118.894042),5);this.pc=CreateFormatDiv("GMarker",true);this.mapdiv=this.map.getPane(G_MAP_MARKER_PANE).parentNode;if(!gISMapSearch){this.mapdiv.appendChild(this.pc)}if(!ie){GEvent.addListener(this.map,"click",function(){MarkerClose()})}if(gisSelfMap){GEvent.addListener(this.map,"zoomend",function(d,c){if(iGenParseInt(d)==iGenParseInt(c)||gmTypeView){return}gisZoom=true;gmapContn.zoomlevel=iGenParseInt(c);if(gisMap){if(c>=glimitLevel){gsState=true}else{gsState=false}InitSearch(true)}});GEvent.addListener(this.map,"movestart",function(){if(gmapContn.mapdiv.disabled&&!ie){gisMLoading=true}});GEvent.addListener(this.map,"moveend",function(){if(greLoad&&(gisMap||gisMove)){if(gmapContn.zoomlevel==gmapContn.map.getZoom()){var e=gmapContn.map.getCenter();if(gcm_Center.x==e.x&&gcm_Center.y==e.y){return}else{gcm_Center=e}var c=gmapContn.map.getBounds().getNorthEast();var d=gmapContn.map.getBounds().getSouthWest();if(c.x>gMaxLati||d.x<gMinLati||c.y>gMaxLong||d.y<gMinLong){InitSearch(false)}}}gisMove=false});this.dv.onmouseover=function(){gisMap=true};this.dv.onmouseout=function(){gisMap=false;MarkerClose(false)};this.dots=CreateFormatDiv("gmContainer",false);this.mapdiv.appendChild(this.dots);this.reLoadMarker=function(c){this.dots.style.cssText="Z-INDEX: 1001; VISIBILITY: visible; POSITION: absolute;";if(c!=null&&c!=""){this.dots.style.top=0-iGenParseInt(this.mapdiv.style.top)+"px";this.dots.style.left=0-iGenParseInt(this.mapdiv.style.left)+"px";this.dots.innerHTML=c;this.firstCenter=this.map.getCenter();this.HiddenMessage()}else{this.dots.innerHTML="";this.mapdiv.disabled=false;gmatchCount=0}}}this.mc=CreateFormatDiv("messagecontainer");this.mcDelay=CreateFormatDiv("delaymessagecontainer");this.dv.appendChild(this.mc);this.mc.style.visibility="hidden";this.mapControl=function(c){if(c!=null){if(c==3){this.map.addControl(new GSmallZoomControl());this.map.addControl(new GMapTypeControl())}else{this.map.addControl(new GSmallZoomControl())}this.control=c}else{if(gisSelfMap){this.dv.appendChild(GetGMapType())}else{this.map.addControl(new GLargeMapControl());this.map.addControl(new GMapTypeControl())}this.control=0}};this.mapCenter=function(d,c){if(c!=null){this.zoomlevel=iGenParseInt(c)}this.map.setCenter(d,this.zoomlevel);this.center=d;gcm_Center=d};this.mapZoomLevel=function(c){if(c!=null&&this.mapdiv.disabled==false){try{c=iGenParseInt(c);this.map.setZoom(c);this.zoomlevel=c}catch(d){}}};this.ShowMessage=function(k,d,j){var i=this.mc;var c=this.dv.style.width.replace("px","");var g=this.dv.style.height.replace("px","");var f=240;if(gisSelfMap){f=320}if(k.indexOf("Loading data ...")!=-1&&gISMapSearch){i.style.top=g/2-78;i.style.left=c/2-f/2-70+c/7;i.style.width=313+"px";i.style.height=116+"px";i.style.border="blue 2px solid";i.innerHTML="<div style='top:50px; position:relative;margin-top:-15px;text-align:center;'><img src='"+GetWebPath()+"images/mt/Maploading.gif'></div>"}else{i.style.border=" #f4ae70 1px solid";i.style.top=g/2-f/4+30+"px";i.style.left=c/2-f/2+20+"px";i.style.width=f+"px";i.style.height=12*iGenParseInt(k.length/30)+44+"px";if(k.indexOf("Sign in to see map")!=-1){i.style.height=iGenParseInt(i.style.height)-30+"px"}i.innerHTML='<TABLE width = "'+f+'"><TR><TD style="text-align:center;background-color:white;color:red;font-weight:bold;padding: 12px 6px 12px 6px;font-size:12px">'+k+"</TD></TR></TABLE>"}i.style.position="absolute";i.style.background="white";i.style.visibility="";if(!ie&&gISMapSearch&&gisSelfMap&&k.indexOf("Loading data ...")==-1){this.mcDelay.innerHTML=i.innerHTML;i.innerHTML="";setTimeout("DelayShowMessage()",200)}else{i.style.display="block"}if(k!=null&&k.length>=4&&k.substring(1,4)=="img"){i.style.width="0px";i.innerHTML=k;i.style.border="#f4ae70 0px solid"}if(d){this.map.clearOverlays();this.pc.style.display="none";if(j==null){this.mapZoomLevel(10);this.center=null}}};this.HiddenMessage=function(){this.mc.style.visibility="hidden"}}catch(a){this.map=null}}function DelayShowMessage(){gmapContn.mc.innerHTML=gmapContn.mcDelay.innerHTML;gmapContn.mc.style.display="block"}function GetGMapType(){var a=GetWebPath()+"images/mt/Imgmapb.gif";var h=GetWebPath()+"images/mt/Imgsatellitea.gif";var d=GetWebPath()+"images/mt/Imghybrida.gif";var b=GetWebPath()+"images/mt/Imgzoomout.gif";var e=GetWebPath()+"images/mt/Imgzoomin.gif";var c=iGenParseInt(0);if(gISMapSearch==false){gmTop=0;gmLeft=0;c=200}var g="<a href=\"javascript: GMapTypeView('mv');\"><img id='mv'src='"+a+"' style='position:absolute;z-index:2001;left:"+iGenParseInt(345+c)+'px;top:5px\' border="0" height="19" width="74" /></a>';g+="<a href=\"javascript: GMapTypeView('sv');\"><img id='sv'src='"+h+"' style='position:absolute;z-index:2002;left:"+iGenParseInt(423+c)+'px;top:5px\' border="0" height="19" width="74" /></a>';g+="<a href=\"javascript: GMapTypeView('hv');\"><img id='hv'src='"+d+"' style='position:absolute;z-index:2003;left:"+iGenParseInt(501+c)+'px;top:5px\' border="0" height="19" width="74" /></a>';g+="<a href=\"javascript: GMapZoom(true);\"><img alt='Zoom In' id='zout'src='"+e+'\' style=\'position:absolute;z-index:2004;left:10px;top:5px\' border="0" height="18" width="18" /></a>';g+="<a href=\"javascript: GMapZoom(false);\"><img alt='Zoom Out' id='zin'src='"+b+'\' style=\'position:absolute;z-index:2005;left:10px;top:25px\' border="0" height="18" width="18" /></a>';var f=CreateFormatDiv("gmType");f.style.cssText="Z-INDEX: 2001; VISIBILITY: visible; POSITION: absolute;";f.style.top=0-gmTop+"px";f.style.left=0-gmLeft+"px";f.innerHTML=g;return f}function GMapTypeView(b){if(document.getElementById(b).getAttribute("src").indexOf("b.gif")!=-1){return}if(gmapContn.map!=null){var a=gmapContn.map.getZoom();gmTypeView=true;gisZoom=false;if(b=="mv"){gmapContn.map.setMapType(G_NORMAL_MAP);document.getElementById("mv").setAttribute("src",document.getElementById("mv").getAttribute("src").replace("a.gif","b.gif"));document.getElementById("sv").setAttribute("src",document.getElementById("sv").getAttribute("src").replace("b.gif","a.gif"));document.getElementById("hv").setAttribute("src",document.getElementById("hv").getAttribute("src").replace("b.gif","a.gif"))}else{if(b=="sv"){gmapContn.map.setMapType(G_SATELLITE_MAP);document.getElementById("mv").setAttribute("src",document.getElementById("mv").getAttribute("src").replace("b.gif","a.gif"));document.getElementById("sv").setAttribute("src",document.getElementById("sv").getAttribute("src").replace("a.gif","b.gif"));document.getElementById("hv").setAttribute("src",document.getElementById("hv").getAttribute("src").replace("b.gif","a.gif"))}else{if(b=="hv"){gmapContn.map.setMapType(G_HYBRID_MAP);document.getElementById("mv").setAttribute("src",document.getElementById("mv").getAttribute("src").replace("b.gif","a.gif"));document.getElementById("sv").setAttribute("src",document.getElementById("sv").getAttribute("src").replace("b.gif","a.gif"));document.getElementById("hv").setAttribute("src",document.getElementById("hv").getAttribute("src").replace("a.gif","b.gif"))}}}gmTypeView=false;gmapContn.map.setZoom(iGenParseInt(a));if(iGenParseInt(gmapContn.mapdiv.style.top)!=gmTop||iGenParseInt(gmapContn.mapdiv.style.left)!=gmLeft){if(gisZoom==false){InitSearch(true)}}}}function GMapZoom(b){var a=iGenParseInt(gmapContn.map.getZoom());document.getElementById("gmType").disabled=true;if(b&&a<17){a++}if(b==false&&a>7){a--}gmapContn.mapZoomLevel(a);document.getElementById("gmType").disabled=false}function GMapMove(j,m,d){try{if(m=="highlight"){d.style.backgroundColor="#ffff99"}else{if(m=="off"){d.style.backgroundColor="#f2efe9"}else{if(m=="move"&&gmapContn.mapdiv.disabled==false){if(gisMove){return}var b=gmapContn.map;var c=b.getBounds().getNorthEast();var k=b.getBounds().getSouthWest();var l=b.getCenter();var f=l.x,i=l.y,a=(c.y-k.y)*0.1;if(j=="dn"){i=k.y-a}else{if(j=="up"){i=c.y+a}else{if(j=="lt"){f=k.x-a}else{if(j=="rt"){f=c.x+a}}}}var h=new GLatLng(i,f);gisMove=true;gmapContn.map.panTo(h)}}}}catch(g){return}}GxMarkerNamespace();function GxMarkerNamespace(){var d=(document.layers);var a=(document.getElementById&&!document.all);var c=(navigator.appName.indexOf("Opera")!=-1);var g=(navigator.userAgent.indexOf("Safari")!=-1);function f(i,e,j){this.inheritFrom=GMarker;this.inheritFrom(i,e);if(typeof j!="undefined"){this.setTooltip(j)}}try{f.prototype=new GMarker(new GLatLng(33.911527,-118.0069))}catch(h){return null}f.prototype.setTooltip=function(e){this.tooltip=new Object();this.tooltip.opacity=70;this.tooltip.contents=e};f.prototype.initialize=function(i){try{GMarker.prototype.initialize.call(this,i);var k=this.iconImage;if(a&&this.icon.imageMap&&!g){k=this.imageMap}else{if(this.transparentIcon&&typeof this.transparentIcon!="undefined"){k=this.transparentIcon}}GEvent.bindDom(k,"mouseover",this,this.onMouseOver);GEvent.bindDom(k,"mouseout",this,this.onMouseOut)}catch(j){}};f.prototype.remove=function(e){GMarker.prototype.remove.call(this)};f.prototype.openInfoWindowHtml=function(i,e){this.showMouseClick(i,e)};f.prototype.onMouseOver=function(){this.showMouseOver()};f.prototype.onMouseOut=function(){this.hideMouseOver()};f.prototype.showMouseOver=function(){clearTimeout(window.timerOut);if(this.tooltip){if(typeof this.tooltipObject=="undefined"||this.tooltipObject!=GetPopup()){this.tooltipObject=GetPopup();this.tooltipObject.style.position="absolute";this.tooltipObject.style.background="white";this.tooltipObject.style.padding="0";this.tooltipObject.style.margin="0";this.tooltipObject.style.zIndex=50000}var e=gmapContn.map.fromLatLngToDivPixel(this.getPoint());this.tooltipObject.style.top=e.y-50+"px";this.tooltipObject.style.left=e.x+12+"px";this.tooltipObject.innerHTML=this.tooltip.contents;this.tooltipObject.style.display="block";if(document.getElementById("closelayer")==null){this.tooltipObject.innerHTML+='<div id = "closelayer" style="RIGHT: 6px; POSITION: absolute; TOP: 6px"><a href="javascript: MarkerClose();"><img alt="Close" src="'+GetWebPath()+'images/close.gif" border="0"></a></div>'}this.tooltipObject.disabled=false}};f.prototype.hideMouseOver=function(){if(ie){timerOut=setTimeout("MarkerClose(false)",100)}};f.prototype.showMouseClick=function(i,e){if(e==null){CheckLogin(i)}else{if(e.toLowerCase()=="house"){CheckLogin(i)}else{if(e.toLowerCase()=="school"){top.location.href=GetRelativePath2()+"public-schools/compare-schools/"+i+".htm"}}}};function b(i){var e=i||window;e.GxMarker=f}b()}function GetMarkerClick(a){MarkerClick(markers[a])}function MarkerClick(a){try{if(a!=null){GEvent.trigger(a,"click")}}catch(b){}}function createXMarker(a,e,f,d,c){var b=new GxMarker(a,e,f);GEvent.addListener(b,"click",function(){if(d!=null){b.openInfoWindowHtml(d,c)}});GEvent.addListener(b,"mouseover",function(){b.onMouseOver()});GEvent.addListener(b,"mouseout",function(){b.onMouseOut()});return b}function createMarker(a,d,e,c){var b=new GMarker(a,d);GEvent.addListener(b,"click",function(){if(e!=""){b.openInfoWindowHtml(e)}if(c!=null&&document.getElementById(c)!=null){GetMsg(c);document.getElementById(c).style.backgroundColor="#ffff00"}});if(c!=null){GEvent.addListener(b,"infowindowclose",function(){if(document.getElementById(c)!=null){document.getElementById(c).style.backgroundColor=""}})}return b}function CreateMap(f,a,d){try{document.getElementById(f).innerHTML="";var c=new GMap2(document.getElementById(f));if(d!=null){if(d==0){c.addControl(new GLargeMapControl())}else{if(d==1){c.addControl(new GSmallZoomControl())}else{if(d==2){c.addControl(new GMapTypeControl())}else{if(d==3){c.addControl(new GSmallZoomControl());c.addControl(new GMapTypeControl())}}}}}else{c.addControl(new GLargeMapControl());c.addControl(new GMapTypeControl())}if(a!=null){if(isValidCenter(a)){c.setCenter(new GLatLng(a[1],a[0]),iGenParseInt(a[2]))}}return c}catch(b){return null}}function CreateMap_iGen(h,d,c,a){try{if(gmapContn==null||gmapContn.map==null){gmapContn=new iGenMap(h)}else{if(gisSelfMap==false){gmapContn.HiddenMessage();gmapContn.map.clearOverlays()}}if(gmapContn.control==null){gmapContn.mapControl(c)}var g=gmapContn.map;if(d!=null){if(isValidCenter(d)){var b=gmapContn.map.center;if(b!=null){b=gmapContn.map.getCenter()}if(b==null){gmapContn.mapCenter(new GLatLng(d[1],d[0]),iGenParseInt(d[2]))}else{if(!a){if(b.x!=d[0]||b.y!=d[1]){gmapContn.mapCenter(new GLatLng(d[1],d[0]),iGenParseInt(d[2]))}else{d[2]=gmapContn.zoomlevel}}else{if(gmapContn.zoomlevel!=iGenParseInt(d[2])){gmapContn.mapZoomLevel(iGenParseInt(d[2]))}}}if(iGenParseInt(d[2])>=glimitLevel){gsState=true}else{gsState=false}}}if(gisSelfMap){gmapContn.mapdiv.disabled=true;gmTop=iGenParseInt(gmapContn.mapdiv.style.top);gmLeft=iGenParseInt(gmapContn.mapdiv.style.left)}return g}catch(f){gmapContn=null;return null}}function SetMapCenter(f){if(f==null||f[0]==null||f[0]==0||gisMove||gmapContn==null||gmapContn.map==null){return}var c=gmapContn.map.getBounds().getNorthEast();var d=gmapContn.map.getBounds().getSouthWest();var g=0.7;sX=(c.x-d.x)*g;sY=(c.y-d.y)*g;var a=d.x-sX;maxX=c.x+sX;cenX=(d.x+c.x)/2;var h=d.y-sY;maxY=c.y+sY;cenY=(d.y+c.y)/2;gisMove=true;var e=gmapContn.zoomlevel;if(e<glimitLevel){gmapContn.map.panTo(new GLatLng(f[1],f[0]));if(f[0]<a||f[0]>maxX||f[1]<h||f[1]>maxY||gmapContn.zoomlevel>glimitLevel){InitSearch(true)}}else{var b=gmapContn.map.getCenter();if(b.x!=f[0]||b.y!=f[1]){gmapContn.mapCenter(new GLatLng(f[1],f[0]),e);InitSearch(true)}}gisMove=false}function CreateIcon(){try{var a=new GIcon();a.iconSize=new GSize(20,34);a.shadowSize=new GSize(37,34);a.iconAnchor=new GLatLng(20,6);a.infoWindowAnchor=new GLatLng(1,5);return a}catch(b){return null}}function ShowMessageWithoutMap(i){var f=document.getElementById("map");var c=f.style.width.replace("px","");var d=f.style.height.replace("px","");f.innerHTML="";var g=CreateFormatDiv("messagecontainer");f.appendChild(g);g.style.top=0;g.style.left=0;g.style.width=c+"px";g.style.height=d+"px";var b=d/2-28+"px";var a=c/2-58+"px";g.innerHTML='<TABLE width = "'+c+'"><TR><TD style="text-align:left;background-color:white;color:red;font-weight:bold;font-size:12px;padding-right:0px;padding-top:'+b+";padding-left:"+a+';">'+i+"</TD></TR></TABLE>";g.style.background="white";g.style.display="block";g.style.border=" #f4ae70 1px solid";g.style.visibility=""}function ShowMapMessage(d,a,c){try{if(gmapContn==null&&d.indexOf("Loading")!=-1){ShowMessageWithoutMap(d);return}if(d==""||d==null){d="No match found.<br>Try a different selection."}if(gmapContn==null||gmapContn.map==null){gmapContn=new iGenMap()}if(gmapContn!=null&&gmapContn.dv!=null){gmapContn.ShowMessage(d,a,c)}else{if(gmapContn==null){alert(d)}}}catch(b){}}function HiddenMessage(){gmapContn.HiddenMessage()}function gmArray(b){for(var a=0;a<b;a++){this[a]=null}this.length=b}function GetMapCenter(f,b){var r=new gmArray(5);var j=0;var d=0;var a=13;if(isValid(f)==true){var o=GetTable(f);var q=o.Rows.length;var h=0;var t=0;var c=0;var k=0;var l=0;var m=0;var e=0;var n=24;if(q>=2){n=32.85}if(o.Rows.length>0){for(var s=q-1;s>=0;s--){longitude=o.Rows[s].Longitude;latitude=o.Rows[s].Latitude;if(t==0&&h==0&&k==0&&c==0){t=longitude;h=longitude;k=latitude;c=latitude}else{if(longitude<-60&&latitude>n){if(t<longitude){t=longitude}if(h>longitude){h=longitude}if(k<latitude){k=latitude}if(c>latitude||c<n){c=latitude}l+=longitude;m+=latitude;e+=1}}}}j=(h+t)/2;d=(c+k)/2;var p=t-h;var g=k-c;if(q>=2){a=GetZoomLevel(p,g);if(b!=""&&b!=null){j=l/e;d=m/e;if(a<12){a=12}}}else{}}r[0]=j;r[1]=d;r[2]=a;r[3]=p;r[4]=g;return r}function GetZoomLevel(g,d){var a=13;var e=g;var b=d;var c=1;var f=1;if(document.getElementById("map")!=null){c=document.getElementById("map").style.width.replace("px","")/500-0.05;f=document.getElementById("map").style.height.replace("px","")/500-0.05}if(e>0.08583068*c||b>0.06811065*f){a=12}if(e>0.17166137*c||b>0.13659816*f){if(e<0.34332275*c&&b<0.27319624*f){a=11}else{if(e<0.6866455*c&&b<0.54638786*f){a=10}else{if(e<1.4*c&&b<1.2*f){a=9}else{a=8}}}}return a}function Getopenhouse(a){var b="";if(Trim(a)!="&nbsp"&&Trim(a)!=""&&Trim(a)!="&nbsp;"){b="<br>"+a}return b}function Refresh(b){var a="";a=Trim(b);if(a.toUpperCase().indexOf("N/A")==-1&&a.toUpperCase().indexOf("SF")==-1){a+=" SF"}return a}function GetPropertyImg(a,c){c=gdays_isNew;var b="images/mm_20_white.png";if(a<=c){b="images/mm_20_new_31.png"}return GetRelativePath2()+b}function GetHousePhoto_Link(b,a,d,c){var e;b=GetAppURL()+b;if(!a){e='<img class="noPhoto" src ="'+GetRelativePath2()+'images/nophoto_small.gif">'}else{e='<a style="CURSOR: pointer" href = "'+b+'"><IMG id="imgHouse" src="'+GetSmallImage(d,c)+'" border="0" width="150px"></a>'}return e}function GetHousePhoto_Limited(c,b,h,e,d,f,a){var g="";if(h==""){if(d!="701"){g='<a style="CURSOR: pointer" href = "javascript:CheckLogin('+c+');"><IMG id="imgHouse" src="'+GetSmallImage(e,d)+'" border="0" width="150px"></a>'}else{g='<a style="CURSOR: pointer" href = "javascript:linkToSearchResult('+f+", "+a+');"><IMG id="imgHouse" src="'+GetSmallImage(e,d)+'" border="0" width="150px"></a>'}}else{g='<IMG id="imgHouse" src="'+GetSmallImage(e,d)+'" width="150px" border="0">'}if(!b){g='<img class="noPhoto" src ="'+GetRelativePath2()+'images/nophoto_small.gif">'}return g}function GetHousePhoto(c,b,a,e){var d='<IMG id="imgHouse" src="'+GetSmallImage(c,b)+'" width="150px" border="0">';if(!a){d='<img class="noPhoto" src ="'+GetRelativePath2()+'images/nophoto_small.gif">'}return d}function CheckLogin(c){var a=document.getElementById(gCtlIdPrefix.MainContent+"MS_CLatLng_Zoom");if(a!=null&&gmapContn!=null&&gmapContn.map!=null){var d=gmapContn.map.getCenter();var b=gmapContn.map.getZoom();a.value=d.x+","+d.y+","+b;if(gIS_HaveAllPins&&greLoad){a.value=a.value+",LLL"}}iGen.WebServices.Common.GetPropertyPath(c,onGetPropertyPathSucceeded)}function onGetPropertyPathSucceeded(a){if(a!=null){top.location.href=a}}function GetHouseAddress(b,a,c,f,d,e){if(f!=""){return a}if(c==2){if(e==null){return'<a style="CURSOR: pointer" href = "javascript:checkiframe('+b+",'"+d+"');\"><U>"+a+"</U></a>"}else{return'<a style="CURSOR: pointer" href = "javascript:checkiframe('+b+",'"+d+"','"+e+"');\"><U>"+a+"</U></a>"}}else{return'<a style="CURSOR: pointer" href = "javascript:CheckLogin('+b+');"><U>'+a+"</U></a>"}}function checkiframe(a,d,c){var b;if(a==null){return}if(d==null){b=a+"&logSrc=MapSearch"}else{if(d=="school"){if(c!=null){b=GetRelativePath2()+"public-schools/compare-schools/"+c.toLowerCase()+"/"+a+".htm"}else{b=GetRelativePath2()+"public-schools/compare-schools/"+a+".htm"}}else{CheckLogin(a);return}}top.location.href=b}function GetValuesSpot(a,b,c){if(b){if(c!=""){return'<IMG src="'+c+'images/icon_dollar_sign.gif">'}return"<IMG onmouseover=\"showIndgMap('MVSP_"+a+"')\" onmouseout=\"HiddenIndgMap('MVSP_"+a+'\')" src="'+GetWebPath()+'images/icon_dollar_sign.gif"><span id="MVSP_'+a+'"></span>'}else{return""}}function GetLastLogin(){var a="0";if(document.getElementById(gCtlIdPrefix.PageHeader+"LAST_LOGIN_DTM")!=null){a=document.getElementById(gCtlIdPrefix.PageHeader+"LAST_LOGIN_DTM").innerHTML;a=a.replace("<font>","").replace("</font>","")}return a}function isValid(c,a){var b=false;if(c!=null&&c.Tables!=0){b=true}else{if(c!=null&&c.Rows!=null){if(c.Rows.length!=0){b=true}}else{if(a!=true){ShowMapMessage(null,true)}}}return b}function isValidCenter(b){var a=true;if(b!=null){if(b[0]>-60||b[1]<24){ShowMapMessage("The map of this property is temporarily not available.",true);a=false}}return a}function GetTable(a){var b;if(a!=null&&a.Tables!=0){try{b=GetDataTable("Marker",a);if(b==null){b=a.Tables[0]}}catch(c){return a.Tables[0]}}else{if(b==null&&a.Rows.length!=0){b=a}}return b}function ShowNowTime(a){if(document.getElementById(a)!=null){document.getElementById(a).innerHTML=GetNow()}}function GetNow(){var b;var a=new Date();b=a.getMinutes()+":"+a.getSeconds().toString()+":"+a.getMilliseconds().toString();return b}function showIndgMap(b){var a=document.getElementById(b);a.className="notesStyle";a.style.width="270px";a.style.margin="20px 0 0 -200px";if(b=="VSP"){a.innerHTML="<p align=left style='FONT-SIZE:80%'>ValueSpotter<sup><font style='font-size:8px'>TM</font></sup> identifies houses with a low price compared to nearby listings.</p>"}else{a.style.margin="20px 0 0 -100px";a.innerHTML="<p align=left>ValueSpotter<sup><font style='font-size:8px'>TM</font></sup> identifies houses with a low price compared to nearby listings.</p>"}}function HiddenIndgMap(b){var a=document.getElementById(b);a.className="notesStyleHidden"}function CreateFormatDiv(divid,isFormat){var popup;if(document.getElementById(divid)!=null){popup=document.getElementById(divid)}else{popup=document.createElement("div")}if(isFormat!=null&&isFormat==true){popup.onmouseover=function(){MarkerOpen()};popup.onmouseout=function(){MarkerClose(false)}}with(popup){if(divid!=null){id=divid}style.cssText="DISPLAY: none;BORDER: #f4ae70 1px solid;WIDTH: 180px;"}return popup}function GetPopup(){var a=document.getElementById("GMarker");return a}function MarkerClose(b){var f=GetPopup();var d=f.style.display;if(d!="none"){if(b==false&&ie&&event!=null){var c=mouseCoords(event);var a=iGenParseInt(c.x-iGenParseInt(f.style.left)-165);var g=iGenParseInt(c.y-iGenParseInt(f.style.top)-170);if(0<a&&a<190&&0<g&&g<190){return}}f.style.display="none";if(gisSelfMap){popout(document.getElementById(gcm_PinID))}}}function MarkerOpen(){clearTimeout(window.timerOut);var a=GetPopup();a.style.display="block";if(gisSelfMap){ChangePin(document.getElementById(gcm_PinID))}}function InitSearch(a){var b=gisMap;gisMap=true;if((a||greLoad)&&gmapContn!=null){var d="";var c=document.getElementById(gCtlIdPrefix.MainContent+"mapsearch");if(c!=null){d=GetSearchCondition()}gmapContn.reLoadMarker();if(d!=""&&gISMapSearch){ReGetMapSearch(d,false)}else{if(gISMapSearch==false){GetMapForSearchResult()}}}gisMap=b}function ChangePin(b){if(b==null){return}gcm_PinID=b.id;var c=b.getAttribute("src");var a=parseInt(b.getAttribute("sd"));if(c.indexOf(mImg_D)!=-1){b.setAttribute("src",GetWebPath()+mImg_D2)}else{if(c.indexOf(mImg_N)!=-1){b.setAttribute("src",GetWebPath()+mImg_N2)}else{if(c.indexOf(mImg_Foreclosure)!=-1){b.setAttribute("src",GetWebPath()+mImg_Foreclosure+"0.gif")}}}gcZindex=b.style.zIndex;b.style.zIndex=3001}function popup2(c){var d=c.style;popout(document.getElementById(gcm_PinID));ChangePin(c);var b=GetPopup();b.style.position="absolute";b.style.background="white";b.style.padding="0";b.style.margin="0";b.style.zIndex=10000;var a=GetPos(c);b.style.top=a.y+"px";b.style.left=a.x+"px";b.style.display="block";b.disabled=false;b.innerHTML=composePopup(c);if(document.getElementById("closelayer")==null){b.innerHTML+='<div id = "closelayer" style="RIGHT: 6px; POSITION: absolute; TOP: 6px"><a href="javascript: MarkerClose();"><img alt="Close" src="'+GetWebPath()+'images/close.gif" border="0"></a></div>'}if(mImg_D!=null&&mImg_D.indexOf("mt_60.gif")!=-1){b.style.left=iGenParseInt(b.style.left)-5+"px"}}function GetPos(i){var g=38;var b=41;var j=i.style;var a=gmapContn.map;var c=a.fromLatLngToDivPixel(gmapContn.firstCenter);var f=a.fromLatLngToDivPixel(a.getCenter());var d=subGPoints(f,c);var h=new GPoint();h.x=iGenParseInt(j.left)-d.x+b;h.y=iGenParseInt(j.top)-d.y+g;return h}function subGPoints(d,c){return new GPoint(d.x-c.x,d.y-c.y)}function MatchResultForSMA(a,c){if(c!=null){a=c.getAttribute("as")}if(a!=null){var b=a+",12,0|-1,1|-1,0,0";iGen.WebServices.mapSearch.SaveMapSearch(30,b,"","","",true,onMatchResultForSMASucceed)}}function onMatchResultForSMASucceed(c){if(c!=null){var b;var a=GetRelativePath2();b=a+"searchresults.aspx?searchid="+c;b+="&logPage=BASIC_SEARCH_RESULT&logSearch=basic";window.location.href=b}}function popout(b){if(b==null){return}var c=b.getAttribute("src");var a=parseInt(b.getAttribute("sd"));if(c.indexOf(mImg_D2)!=-1){b.setAttribute("src",GetWebPath()+mImg_D)}else{if(c.indexOf(mImg_N2)!=-1){b.setAttribute("src",GetWebPath()+mImg_N)}else{if(c.indexOf(mImg_Foreclosure)!=-1&&a>0){b.setAttribute("src",GetWebPath()+mImg_Foreclosure+a+".gif")}}}b.style.zIndex=gcZindex}function linkDetail(c){var a=GetMlsDbFromComplexKey(c.getAttribute("id"));if(a=="701"){var d=c.getAttribute("bi");var b=c.getAttribute("ci");linkToSearchResult(d,b)}else{CheckLogin(c.id)}}function linkToSearchResult(b,a){top.location.href=GetRelativePath2()+"searchresults.aspx?Type=NewHomeCommunity&BuilderID="+b+"&CommunityID="+a+"&logPage=NewHomeCommunity_SEARCH_RESULT"}function GetListingBoxTemplate_Map(k){if(k==undefined||k==null){k=0}k=parseInt(k);var j="";var f='<FONT style="font-size:7pt">~Address~<br>~ValueSpotImg~$~Price~ <br>~Bed~ <b>beds</b> - ~Bath~ <b>baths</b><br>~SQFeet~ SF&nbsp; <b>Lot:</b>~LotSize~<br><b>Days on Market:</b>&nbsp;~DaysOnMkt~ <br></FONT>~MoreInfo~';var a='<FONT style="font-size:7pt">~Address~<br>~ValueSpotImg~$~Price~ <br>~Bed~ <b>beds</b> - ~Bath~ <b>baths</b><br>~SQFeet~ SF&nbsp; <b>Lot:</b>~LotSize~<br><b>Days on Market:</b>&nbsp;~DaysOnMkt~ <br>~Office~ ~newRowOffice~</FONT>~MoreInfo~';var d='<FONT style="font-size:7pt">~Address~<br>~ValueSpotImg~$~Price~ <br>~Bed~ <b>beds</b> - ~Bath~ <b>baths</b><br>~SQFeet~ SF&nbsp; <b>Lot:</b>~LotSize~<br><b>Days on Movoto:</b>&nbsp;~DaysOnMkt~ <br></FONT>~MoreInfo~';var c='<FONT style="font-size:7pt">~Address~<br>~ValueSpotImg~$~Price~ <br>~Bed~ <b>beds</b> - ~Bath~ <b>baths</b><br>~SQFeet~ SF&nbsp; <b>Lot:</b>~LotSize~<br></FONT>~MoreInfo~';var h='<FONT style="font-size:7pt">~Address~<br>~ValueSpotImg~$~Price~ <br>~Bed~ <b>beds</b> - ~Bath~ <b>baths</b><br>~SQFeet~ SF&nbsp; <b>Lot:</b>~LotSize~<br><b>Days on Movoto:</b>&nbsp;~DaysOnMkt~ <br>~OfficeFor431~ ~newRowOffice~</FONT>~MoreInfo~';var g='<FONT style="font-size:7pt">~Address~<br>~ValueSpotImg~$~Price~ <br>~Bed~ <b>beds</b> - ~Bath~ <b>baths</b><br>~SQFeet~ SF&nbsp; <b>Lot:</b>~LotSize~<br><b>Days on Market:</b>&nbsp;~DaysOnMkt~ <br>~Office~ ~newRowOffice~ ~Agent~ ~newRowAgent~</FONT>~MoreInfo~';var b='<FONT style="font-size:7pt">~Address~<br>~ValueSpotImg~$~Price~ <br>~Bed~ <b>beds</b> - ~Bath~ <b>baths</b><br>~SQFeet~ SF&nbsp; <b>Lot:</b>~LotSize~<br><b>Days on Movoto:</b>&nbsp;~DaysOnMkt~ <br><b>Status:</b>&nbsp;~Status~&nbsp;&nbsp;<b>MLS</b>#&nbsp;~MLSNum~<br>~Office~ ~newRowOffice~</FONT>~MoreInfo~&nbsp;&nbsp;~MLSImg~';var e='<FONT style="font-size:7pt">~Address~<br>~ValueSpotImg~$~Price~ <br>~Bed~ <b>beds</b> - ~Bath~ <b>baths</b><br>~SQFeet~ SF&nbsp; <b>Lot:</b>~LotSize~<br><b>Days on Movoto:</b>&nbsp;~DaysOnMkt~ <br>Courtesy of: ~Office~ ~newRowOffice~</FONT>~MoreInfo~';var i='<FONT style="font-size:7pt">~Address~<br>~ValueSpotImg~$~Price~ <br>~Bed~ <b>beds</b> - ~Bath~ <b>baths</b><br>~SQFeet~ SF&nbsp; <b>Lot:</b>~LotSize~<br /><b>Status:</b>&nbsp;~Status~&nbsp;&nbsp;<b>MLS#:</b>&nbsp;~MLSNum~<br>~Office~ ~newRowOffice~</FONT>~MoreInfo~&nbsp;&nbsp;~MLSImg~';switch(k){case 102:case 661:case 662:case 663:case 664:j=a;break;case 204:j=g;break;case 300:case 651:j=c;break;case 411:j=b;break;case 431:j=h;break;case 401:case 402:case 412:case 432:case 433:case 491:case 471:case 571:case 522:case 501:case 436:case 437:case 438:j=d;break;case 441:j=e;break;case 521:j=i;break;default:j=f;break}return j}function composePopup(k,d){var l;if(d!=null&&d){var o=k.getAttribute("asc");if(o==-1){o="?"}var p=k.getAttribute("as");l='<FONT style="font-size:10pt"><b>'+p+"</b><br> "+o+" Home Listings<br><br> <A class='cursorPointer' style=\"TEXT-DECORATION: underline\" onclick=\"MatchResultForSMA('"+p+"');\"><b> Click here to view homes</b></A></FONT><br><br>";l+="<FONT style=\"font-size:8pt\">Due to local MLS rules, we can only display the locations of homes to users who have registered with Movoto.<br><br><A class='cursorPointer' style=\"TEXT-DECORATION: underline\" onclick=\"checkLoginPop('Register','save');\">Click here to register or log in</A></FONT><br><br>";l="<TABLE width = \"200\" ><TR style ='background-color: white'><TD><div style='MARGIN-LEFT: 4px;MARGIN-RIGHT: 4px'>"+l+"</div></TD></TR></TABLE>";return l}igenkey=k.id;var m=k.getAttribute("ld");var n=false;var f=false;if(k.getAttribute("ph")==1){f=true}var q="";var h=GetMlsDbFromComplexKey(igenkey);var c="";var a="";var i="";if(h!="701"){c=GetHousePhoto_Link(k.getAttribute("url"),f,k.getAttribute("no"),h);q=GetALink("<b>"+k.getAttribute("ad")+"</b>",k.getAttribute("url"));var j=new HouseBox();j.Address=q;j.bathroomText=k.getAttribute("ba");j.bedroomText=k.getAttribute("be");j.DaysOnMkt=k.getAttribute("ld");j.iGen_Key=k.id;j.list_price=k.getAttribute("lp");j.ln_list_agents_name=k.getAttribute("ag");j.lo_listing_office=k.getAttribute("oln");j.lot_size=k.getAttribute("lt");j.lotsize_desc=null;j.mls_db=h;j.mls_num=k.getAttribute("no");j.num_photos_dl=null;j.square_feet=k.getAttribute("sf");j.StaticURL=k.getAttribute("url");j.ss_status=1;j.vs_flag=k.getAttribute("ld");j.flag_display=k.getAttribute("fd");var g=j.GetHouse();l="<TABLE width = \"180\" ><TR style ='background-color: white;' align=left><TD>"+g+"</TD></TR><TR style ='background-color: white;' align=center><TD>"+c+"</TD></TR></TABLE>"}else{var b=GetAppURL()+k.getAttribute("url");c=GetHousePhoto_Link(k.getAttribute("url"),f,k.getAttribute("no"),h);q='<a style="CURSOR: pointer" href = "'+b+'"><U><b>'+k.getAttribute("ad")+"</b></U></a>";a='<a style="CURSOR: pointer" href = "'+b+'"><U><b>See Available Plans</b></U></a>';i=q+'<br><div style="margin:4px 0 4px 0">'+k.getAttribute("cn")+", "+k.getAttribute("sc")+"<br>$"+k.getAttribute("lp")+" </div>";l="<TABLE width = \"180\" ><TR style ='background-color: white;' align=left><TD><b>"+i+"</b>"+a+"</TD></TR><TR style ='background-color: white;' align=center><TD>"+c+"</TD></TR></TABLE>"}return l}function GetALink(b,a){a=GetAppURL()+a;return'<a href = "'+a+'"><U>'+b+"</U></a>"}function LoadState(b,a){if(b){if(gsState&&gcState){greLoad=true}else{if(gsState&&!gIS_HaveAllPins&&gSearchTime>=1){greLoad=true}else{if(gsState&&greLoad&&gIS_HaveAllPins){greLoad=true}else{greLoad=false}}}if(greLoad){if(gTotalCount>0&&gTotalCount<=200){greLoad=false}gIS_NeedAllPins=true}gIS_RealSearch=true;if(gisMap||(a!=null&&a>2)){gIS_RealSearch=false}}else{greLoad=false;if(gsState&&gcState){greLoad=true}}}function SetMaxMinLatLong(h){var b=h.getBounds().getNorthEast();var g=h.getBounds().getSouthWest();var f=h.getZoom();var a="";gMaxLati=iGenParseInt(b.x*1000000)/1000000;gMinLati=iGenParseInt(g.x*1000000)/1000000;gMaxLong=iGenParseInt(b.y*1000000)/1000000;gMinLong=iGenParseInt(g.y*1000000)/1000000;a=gMinLati+","+gMaxLati+","+gMinLong+","+gMaxLong+","+f+","+gdays_isNew;if(greLoad){var e=iGenParseInt(f-glimitLevel);if(e>=2){e=2}var d=(gMaxLati-gMinLati)*e/2;var c=(gMaxLong-gMinLong)*e/2;gMaxLati=iGenParseInt((gMaxLati+d)*1000000)/1000000;gMinLati=iGenParseInt((gMinLati-d)*1000000)/1000000;gMaxLong=iGenParseInt((gMaxLong+c)*1000000)/1000000;gMinLong=iGenParseInt((gMinLong-c)*1000000)/1000000;a+=","+gMinLati+"|"+gMaxLati+"|"+gMinLong+"|"+gMaxLong}return a}function iGenParseInt(a){if(a==null){return 0}if(a==""){return 0}return parseInt(a)}function NewZoom(a){var a=iGenParseInt(a);if(a>=10){return a}return 17-a}function FilterBathRoom(a){if(a==5){return 1.5}else{if(a==6){return 2.5}else{if(a==7){return 3.5}else{return a}}}}function GetMlsDbFromComplexKey(b){var a=3;if(b.substring(0,2)=="12"){a=2}return b.substring(0,a)}var mpcitycode="";var mImg_D="images/mt/mm_20_red_mt.gif";var mImg_D2="images/mt/mm_20_orange_mt.gif";var mImg_N="images/mt/mm_20_new_mt.gif";var mImg_N2="images/mt/mm_20_orange2_mt.gif";var mImg_7D="images/mt/mm_20_red_mt.gif";var mImg_7N="images/mt/mm_20_grey.gif";var mImg_Foreclosure="images/mt/mm_20_mt_";var minBed=0;var maxBed=-1;var minBath=1;var maxBath=-1;var minPrice=0;var maxPrice=0;function TransferUrl(){if(location.href.indexOf("%5F")!=-1||location.href.indexOf("%5f")!=-1){var a=location.href.replace("%5F","_").replace("%5f","_");window.location.href=a}}function GetMlsNum(){var c=location.search;var a=c.indexOf("=")+1;var b=c.substring(a);if(b.indexOf("MLS_NUM=")!=-1){b=b.substring(b.indexOf("=")+1)}if(b.indexOf("&")!=-1){b=b.substring(0,b.indexOf("&"))}if(b.indexOf("M")!=-1){b=b.substring(0,b.length-1)}return b}function GetGeneralMap(){var a=GetMlsNum();iGen.WebServices.GoogleMap.GetMarker(a,true,LoadGeneralMap)}function isFocus(){if(location.search.indexOf("M")!=-1){this.focus()}}function SetMapViewType(){if(gisSelfMap==false){if(document.getElementById("isSelfMap")!=null){if(document.getElementById("isSelfMap").value=="false"){return}}}gisSelfMap=true}function ReGetMapSearch(b,a){GetMapSearch(b,a)}function GetMapForSearchResult(b,c){ShowMapMessage("Loading data ...");if(b==null){b=document.getElementById(gCtlIdPrefix.MainContent+"tbSearchID").value}var d=CreateMap_iGen(null,c,null);if(d==null){alert("We encountered problems while displaying the Map. They may be caused by security settings on the browser.");return}var a=SetMaxMinLatLong(d);iGen.WebServices.searchResults.GetSearchResultForMap(b,a,glimitCount,ShowMap_MT,onGetSearchResultForMapSuccessed)}function onGetSearchResultForMapSuccessed(a,c,b){}function GetMapSearch(h,e,b,i){document.getElementById("map").style.width="580px";document.getElementById("map").style.height="538px";SetMapViewType();var f="";var k=document.getElementById(gCtlIdPrefix.MainContent+"tbInputLetters_Valid").value;if(b==null&&(h==null||h==""||k=="")){if(document.getElementById("maptable")!=null){document.getElementById("maptable").style.visibility="visible"}var l=GetCurrentMetroAreaCode();var j=new gmArray(3);j[0]=-99;j[1]=31.1;j[2]=4;var d=document.getElementById(gCtlIdPrefix.PageHeader+"longitudeForAD");if(d!=null){d.value=j[0]}var a=document.getElementById(gCtlIdPrefix.PageHeader+"latitudeForAD");if(a!=null){a.value=j[1]}var g=document.getElementById(gCtlIdPrefix.PageHeader+"zoomLevelForAD");if(g!=null){g.value=j[2]}CreateMap_iGen(null,j,null);var c='<img id="ar"src="'+GetWebPath()+'images/mt/MC_Arrow3.gif" style="position:absolute;z-index:2001;left:-32px;top:-195px" border="0" height="352" width="339" />';ShowMapMessage(c)}else{if(gisSelfMap){ShowMapMessage("Loading data ...");ShowHideMapRelatedControls(true);var j=null;if(b!=null){if(b[0]!=null&&b[0]!=0){j=b}}else{if(gisMap){j=null}else{if(e||b==null){iGen.WebServices.mapSearch.GetLatLongZoomLevel(GetCurrentMetroAreaCode(),k,onGetZoomLevelSucceed,null,{isPageLoad:e,str:h,searchType:i});return}}}GetZoomedMapSearch(j,e,h,i)}}}function onGetZoomLevelSucceed(c,f){var d=null;var b=f.isPageLoad;var e=f.str;var a=f.searchType;if(c!=null){d=c.split(",")}if(b){d=GetLatLongNZoomLevelByControl(d)}if(d==null||d[0]=="0"){if(gmapContn!=null){gmapContn.reLoadMarker()}ShowMapMessage("One or more of the items in your search could not be found. <br>Please check your search terms and try again.",true);ShowHideMapRelatedControls(false);return}GetZoomedMapSearch(d,b,e,a)}function GetZoomedMapSearch(e,d,g,c){gcState=false;if(e!=null&&gmapContn!=null&&gmapContn.center!=null){var b=gmapContn.center;if(b.x!=e[0]||b.y!=e[1]){gmapContn.reLoadMarker()}}var f=CreateMap_iGen(null,e,null);if(f==null){alert("We encountered problems while displaying the Map. They may be caused by security settings on the browser.");ShowHideMapRelatedControls(false);return}LoadState(true,c);if(d){ShowMapMessage("Loading data ...")}document.getElementById(gCtlIdPrefix.MainContent+"mapsearch").value=GetSearchCondition();var a=SetMaxMinLatLong(f);iGen.WebServices.mapSearch.GetSearchResult(g,a,glimitCount,gTotalCount,greLoad,gIS_RealSearch,gIS_NeedAllPins,d,GetCurrentMetroAreaCode(),ShowMap_MT)}function GetLatLongNZoomLevelByControl(c){var a=document.getElementById(gCtlIdPrefix.MainContent+"MS_CLatLng_Zoom");if(a!=null&&a.value!=""){var d=a.value;var b=d.split(",");if(c==null){c=new gmArray(3)}c[0]=b[0];c[1]=b[1];c[2]=parseInt(b[2]);if(c[2]<=glimitLevel){gsState=true}if(b[3]!=null&&b[3]=="LLL"){greLoad=true;gIS_HaveAllPins=true}}return c}function GetAreaItemBeforeSubmit(h,d,c,j,e,b,f,i){var a=new gmArray(4);a[0]=0;a[1]=0;a[2]=0;var g;if(f==null||f==""){g=2}else{if(f=="A"){g=2;a[0]=iGenParseInt(b*1000000+e*1000000)/2000000;a[1]=iGenParseInt(j*1000000+c*1000000)/2000000;a[2]=GetZoomLevel(b-e,j-c)}else{if(f=="D"){g=1}else{a[0]=e;a[1]=c;g=3}}}if(g!=3){SetFirstSearchState(d)}if(d==""){document.getElementById(gCtlIdPrefix.MainContent+"mapsearch").value="";if(gmapContn!=null&&gmapContn.map!=null){gmapContn.reLoadMarker();if(document.getElementById("mapResultHint")!=null){document.getElementById("mapResultHint").innerHTML=""}}return}GetSelectItemBeforeSubmit(false,a,g)}function IS_DefautCondition(){if(minBed>0){return false}if(maxBed!=-1){return false}if(minBath>1){return false}if(maxBath!=-1){return false}if(minPrice>0){return false}if(maxPrice!=0){return false}return true}function SetFirstSearchState(a){var b=document.getElementById(gCtlIdPrefix.MainContent+"tbInputLetters_Valid");b.value=a;gIS_HaveAllPins=false;gIS_NeedAllPins=true;gSearchTime=0;greLoad=false;gTotalCount=-1;gmatchCount=0}function ShowGMarkerType(a){var b=4;if(a==1){var h=0;var c=1;var g=-1;var f=-1;h=getSliderValue("Bedroom",0);c=getSliderValue("Bathroom",0);g=getSliderValue("Bedroom",1);f=getSliderValue("Bathroom",1);if(h==minBed&&g==maxBed&&c==minBath&&f==maxBath){return}else{minBed=h;maxBed=g;minBath=c;maxBath=f}b=5}else{if(a==2){var e;var d;e=getSliderValue("Price",0);d=getSliderValue("Price",1);if(e==minPrice&&d==maxPrice){return}else{minPrice=e;maxPrice=d}b=5}else{if(a==3||a==4){var h=0;var c=1;var g=-1;var f=-1;var e;var d;h=getSliderValue("Bedroom",0);g=getSliderValue("Bedroom",1);c=getSliderValue("Bathroom",0);f=getSliderValue("Bathroom",1);e=getSliderValue("Price",0);d=getSliderValue("Price",1);minBed=h;maxBed=g;minBath=c;maxBath=f;minPrice=e;maxPrice=d;if(a==3){return}else{a=0}}}}if(a==0||gIS_HaveAllPins==false){if(a==0){gIS_NeedAllPins=true;gSearchTime=0;greLoad=false}GetSelectItemBeforeSubmit(false,new gmArray(3),b)}else{ShowGMarker(a)}ReloadADS()}function ShowGMarker(e,a){if(a==null||a){ShowMapMessage("Loading data ...")}gmatchCount=0;var b=100000000;var h=FilterBathRoom(minBath);var f=FilterBathRoom(maxBath);if(maxPrice!=0){b=maxPrice}minBed=parseInt(minBed);var g=document.getElementsByTagName("img");var c;var j;if(e==1&&minPrice==0&&maxPrice==0){for(var d=0;d<g.length;d++){c=g[d];if(c.getAttribute("be")!=null){if(c.getAttribute("be")>=minBed&&CompareMinBathroom(c.getAttribute("ba"),h)&&CompareMaxBathroom(c.getAttribute("ba"),f)&&CompareMaxBathroom(c.getAttribute("be"),maxBed)){c.style.display="block";gmatchCount++}else{c.style.display="none"}}}}else{if(e==2&&minBed==0&&minBath==1&&maxBed==-1&&maxBath==-1){for(var d=0;d<g.length;d++){c=g[d];if(c.getAttribute("be")!=null){j=parseInt(c.getAttribute("lp").replace(/\$|\,/g,""));if(j>=parseInt(minPrice)&&j<=parseInt(b)){c.style.display="block";gmatchCount++}else{c.style.display="none"}}}}else{for(var d=0;d<g.length;d++){c=g[d];if(c.getAttribute("be")!=null){j=parseInt(c.getAttribute("lp").replace(/\$|\,/g,""));if(c.getAttribute("be")>=minBed&&CompareMinBathroom(c.getAttribute("ba"),h)&&j>=parseInt(minPrice)&&j<=parseInt(b)&&CompareMaxBathroom(c.getAttribute("ba"),f)&&CompareMaxBathroom(c.getAttribute("be"),maxBed)){c.style.display="block";gmatchCount++}else{c.style.display="none"}}}}}document.getElementById(gCtlIdPrefix.MainContent+"mapsearch").value=GetSearchCondition();if(a==null||a){iGen.WebServices.Common.MSCookie(document.getElementById(gCtlIdPrefix.MainContent+"mapsearch").value,GetCurrentMetroAreaCode(),callback_MSCookie);setTimeout("HiddenMessage()",500);SetMapResultHint()}}function callback_MSCookie(a){var b=false;if(a!=null&&a==true){b=true}}function CompareMinBathroom(a,b){if(parseInt(a.replace("&1/2",".5")*4)>=parseInt(b*4)){return true}else{return false}}function CompareMaxBathroom(a,b){if(b==-1||parseInt(a.replace("&1/2",".5")*4)<=parseInt(b*4)){return true}else{return false}}function ShowMap_MT(b){try{if(gisMLoading&!ie){gisMLoading=false;InitSearch(true);return}gmapContn.reLoadMarker();if(b!=null){if(b.length<10){ShowMapMessage("No match found.<br>Try to refresh page.",true,true)}else{var h=b.substring(0,b.indexOf("</DIV>"));h=h.substring(h.indexOf(">")+1);gIS_HaveAllPins=true;if(h.substring(h.indexOf("|")+1)=="false"){gIS_HaveAllPins=false}if(gIS_NeedAllPins&&gIS_HaveAllPins==false){gIS_NeedAllPins=false;if(greLoad==false){if(gsState&&gSearchTime==0){greLoad=true}else{greLoad=false}}}gSearchTime++;h=h.substring(0,h.indexOf("|")).split(",");if(h.length>1){gTotalCount=parseInt(h[1])}h=parseInt(h[0]);if(!gsState&&gTotalCount>=glimitCount&&h>=glimitCount/2){mImg_D=mImg_D.replace("mt.gif","mt_60.gif");mImg_N=mImg_N.replace("mt.gif","mt_60.gif");mImg_D2=mImg_D2.replace("mt.gif","mt_60.gif");mImg_N2=mImg_N2.replace("mt.gif","mt_60.gif");mImg_Foreclosure=mImg_Foreclosure.replace("20_mt_","20_mt_60_")}else{mImg_D=mImg_D.replace("mt_60.gif","mt.gif");mImg_N=mImg_N.replace("mt_60.gif","mt.gif");mImg_D2=mImg_D2.replace("mt_60.gif","mt.gif");mImg_N2=mImg_N2.replace("mt_60.gif","mt.gif");mImg_Foreclosure=mImg_Foreclosure.replace("20_mt_60_","20_mt_")}var d='" onclick="javascript:linkDetail(this)" onmouseover="javascript:popup2(this)" style="cursor: pointer;position:absolute;';var a="";var c="";var i="";if(gListingTypeForMap==2){i=mImg_Foreclosure}else{if(gListingTypeForMap==1){a=mImg_7D;c=mImg_7N}else{a=mImg_D;c=mImg_N}}if(gIS_HaveAllPins&&IS_DefautCondition()==false){d+="DISPLAY: none;z-index:";var f=b.replace(/\gImg_d/g,GetWebPath()+a+d).replace(/\gImg_n/g,GetWebPath()+c+d);f=f.replace(/\gImg_(\d)/g,GetWebPath()+i+"$1.gif"+d);gmapContn.reLoadMarker(f);ShowGMarker(0,false)}else{d+="z-index:";var f=b.replace(/\gImg_d/g,GetWebPath()+a+d).replace(/\gImg_n/g,GetWebPath()+c+d);f=f.replace(/\gImg_(\d)/g,GetWebPath()+i+"$1.gif"+d);gmapContn.reLoadMarker(f);gmatchCount=h}}}else{if(greLoad){HiddenMessage()}else{ShowMapMessage(null,true,true);if(gSearchTime==0&&IS_DefautCondition()){gIS_HaveAllPins=true}}}SetMapResultHint()}catch(g){ShowMapMessage("Please refresh again.")}if(gISMapSearch){ShowHideMapRelatedControls(false)}}function SetMapResultHint(){if(document.getElementById("mapResultHint")!=null){var d=document.getElementById("mapResultHint");d.innerHTML="";if(gTotalCount<=0){return}var a="<FONT color='red' style='font-size:12px;'><strong>"+gmatchCount+"</strong></FONT>";var c="<a onclick='switchToMaxRangesForMapSearch();' style='cursor:pointer;'><FONT color='red' style='font-size:12px;'><strong><u>"+gTotalCount+"</u></strong></FONT></a>";var b="";if(gListingTypeForMap!=1){b=c+" Properties."}else{b=c+" Communities."}if(greLoad){d.innerHTML=b}else{if(gIS_HaveAllPins){if(gTotalCount>0){if(gmatchCount>=0){d.innerHTML="Showing "+a+" out of "+b}}}else{if(gmatchCount>=glimitCount||gmatchCount==200){d.innerHTML="Showing >="+a+" out of "+b}else{if(gmatchCount>=0){d.innerHTML="Showing "+a+" out of "+b}}}}}MarkerClose();if(gISMapSearch){TrackMapSearch()}}function GetSelectedValue(g,f,e){var d="";var c="";if(g!=null){var a=g.options.length;if(g.selectedIndex!=-1){for(var b=0;b<a;b++){if(g.options[b].selected){if(f!=null&&f=="text"){d+=Trim(g.options[b].text)+"|"}else{d+=Trim(g.options[b].value)+"|"}c+=b+"|"}}d=d.substring(0,d.length-1);if(e){c=c.substring(0,c.length-1);if(c.indexOf("|")==-1){g.selectedIndex=g.selectedIndex}else{}}}}mpcitycode=d;return d}function LoadGeneralMap(j){try{var o=GetMapCenter(j);if(isValidCenter(o)==false){return}var w=CreateMap("map",o,null);if(w==null){alert("We encountered problems while displaying the Map. They may be caused by security settings on the browser.");return}var l=GetTable(j);var u=CreateIcon();var h;var m;var s;var v;var p;var n;var b;var f=true;var g=GetRelativePath();var k=l.Rows.length;if(k==1){for(var r=0;r<k;r++){igenkey=l.Rows[r].IGen_Key;m=l.Rows[r].ListDays;longitude=l.Rows[r].Longitude;latitude=l.Rows[r].Latitude;if(longitude<-60&&latitude>24){if(l.Rows[r].ImgUrlType!=null&&l.Rows[r].ImgUrlType!=""){s="<TABLE><TR><TD>"+l.Rows[r].Remark+"</TD></TR></TABLE>";f=false}else{var c="";if(l.Rows[r].MScore>=80){c=" ("+l.Rows[r].MScore+")"}h=GetHouseAddress(igenkey,l.Rows[r].Address,1,g);var a=GetMlsDbFromComplexKey(igenkey);b=GetHousePhoto_Limited(igenkey,l.Rows[r].doesPhotos,g,l.Rows[r].Mls_num,a,"","");v=GetValuesSpot(igenkey,l.Rows[r].Spot,g);s='<TABLE width = "180"><TR><TD><table align=left width = "180"><FONT size=1><a href="'+GetAppURL()+l.Rows[r].FullURL+'" target="_blank">'+h+"</a><br>"+v+"$"+l.Rows[r].List_Price+c+" <br>"+l.Rows[r].Remark;if(a!="300"&&a!="651"){s+="<br><b>Days on Market:</b>&nbsp;"+m;var q=MLSWithNoListDate(a);if(q!=null&&q==true){s=s.replace("Days on Market:","Days on Movoto:")}}s+='</FONT></table></TD></TR><TR><TD align=center><FONT size=1><a class = "noPhoto" href="'+GetAppURL()+l.Rows[r].FullURL+'" target="_blank">'+b+"</a></FONT></TD></TR></TABLE>"}n=GetPropertyImg(m,0);u.image=n;p=new GLatLng(latitude,longitude);var d=createMarker(p,u,s);w.addOverlay(d);MarkerClick(d)}else{ShowMapMessage("The map of this property is temporarily not available.")}}}}catch(t){ShowMapMessage("Please refresh again.")}}function GetMapURL(f,d){if(isValid(f)==true){var g=f.Tables[0];if(g.Rows.length>0){if(d==null){var k=GetMapCenter(f);var t=CreateMap("map",k,null);if(t==null){alert("We encountered problems while displaying the Map. They may be caused by security settings on the browser.");return}}var r=new CreateIcon();if(r==null){return}var c;var h;var p;var s;var l;var j;var b;var m="";for(var o=0;o<g.Rows.length;o++){igenkey=g.Rows[o].igen_key;if(g.Rows[o].DaysOnMkt!=null&&g.Rows[o].DaysOnMkt!=""){h=g.Rows[o].DaysOnMkt}else{h="<font color=red>"+g.Rows[o].status+"</font>"}longitude=g.Rows[o].Longitude;latitude=g.Rows[o].Latitude;if(longitude<-60&&latitude>24){if(Getopenhouse(g.Rows[o].Sale_Price)!=""){if(location.href.indexOf("compsresults.aspx")!=-1){m=" - Sold: $"+Trim(g.Rows[o].Sale_Price)}}var a=GetMlsDbFromComplexKey(igenkey);MlsDbList.AddMlsDb(a);c=GetHouseAddress(igenkey,g.Rows[o].Address,0,"");b=GetHousePhoto(g.Rows[o].mls_num,g.Rows[o].mls_db,g.Rows[o].doesPhotos,"");s=GetValuesSpot(igenkey,g.Rows[o].Spot,"");p='<TABLE width = "180"><TR><TD><table align=left ><FONT size=1>'+c+"<br>"+s+"$"+g.Rows[o].List_Price+m+" <br>Beds:"+g.Rows[o].Bed+" - Baths:"+g.Rows[o].Bath+"<br>"+g.Rows[o].sq_feet.toString()+" SF&nbsp;&nbsp; Lot: "+Refresh(g.Rows[o].Lot);if(a!="300"&&a!="651"){p+="<br>Days on Market: "+h+" "+Getopenhouse(g.Rows[o].Open);var n=MLSWithNoListDate(a);if(n!=null&&n==true){p=p.replace("Days on Market:","Days on Movoto:")}}else{p+="<br>"+Getopenhouse(g.Rows[o].Open)}p+="</FONT></table></TD></TR><TR><TD width=170>"+b+"</TD></TR></TABLE>";try{j=GetPropertyImg(h,0);r.image=j;l=new GLatLng(latitude,longitude);markers[igenkey]=createMarker(l,r,p,igenkey)}catch(q){return}}if(d==null&&markers[igenkey]!=null){t.addOverlay(markers[igenkey])}}}}}function GetDetailMap(s,f,l,b){try{var m=GetRelativePath2();if(l==null){l=3}if(f==null){f="house"}if(isValid(s)){var c=GetTable(s);var j=c.Rows.length;if(j>0){var n=GetMapCenter(s);if(!isValidCenter(n)){if(document.getElementById("MapLinks")!=null){document.getElementById("MapLinks").innerHTML=""}return}}else{igenkey=0}if(j>1&&b==null&&n!=null&&n[2]>12){n[2]=12}if(typeof pType!="undefined"){if(n!=null&&pType==2){n[2]=iGenParseInt(n[2])-1}}n[2]+=2;var a=CreateMap_iGen(null,n,l,b);if(a==null){return}var k=CreateIcon();var p;var h="";var r;var q;for(var d=0;d<j;d++){longitude=c.Rows[d].Longitude;latitude=c.Rows[d].Latitude;if(longitude<-60&&latitude>24){if(f=="school"){igenkey=c.Rows[d].Cds_Code;q=c.Rows[d].StateCode;r=m+"images/mm_20_green.png";if(c.Rows[d].isCurP){r=m+"images/mm_20_orange.png"}if(c.Rows[d].SType!=null){h="<br>"+c.Rows[d].SType+"<br>"}}else{igenkey=c.Rows[d].IGen_Key;if(c.Rows[d].ImgUrl!=null&&c.Rows[d].ImgUrl!=""){r=c.Rows[d].ImgUrl}else{r=GetPropertyImg(1000,0)}if(c.Rows[d].List_Price!=null){h="<br>$"+c.Rows[d].List_Price+"<br>"}}var o="";if(c.Rows[d].Address!=null){o=GetHouseAddress(igenkey,c.Rows[d].Address,2,"",f,q)}h="<table align=left border=0 cellpadding=0 cellspacing=0><FONT size=1>"+o+h+c.Rows[d].Remark+"</FONT></table>";k.image=r;p=new GLatLng(latitude,longitude);markers[igenkey]=createXMarker(p,k,h,igenkey,f);a.addOverlay(markers[igenkey])}}if(b!=null&&b){if(properMarker!=null&&igenkey!=PropertyNO()){a.addOverlay(properMarker)}if(f=="house"&&j==1&&igenkey==PropertyNO()&&markers[igenkey]!=null){markers[igenkey].openInfoWindowHtml=function(){};markers[igenkey].tooltip.contents=markers[igenkey].tooltip.contents.toLowerCase().replace(igenkey,"null");if(properMarker==null){properMarker=markers[igenkey]}}}else{if(j==1&&markers[igenkey]!=null){markers[igenkey].openInfoWindowHtml=function(){};markers[igenkey].tooltip.contents=markers[igenkey].tooltip.contents.toLowerCase().replace(igenkey,"null")}}}}catch(g){ShowMapMessage("The map is temporarily unavailable, we are working to fix this problem as fast as possible. Thanks for your patience.")}}function GetSelectItemBeforeSubmit(a,d,b){var c="";c=document.getElementById(gCtlIdPrefix.MainContent+"tbInputLetters_Valid").value.replace(/,/g,"|");if(c==""||b==3){if(d!=null){SetMapCenter(d)}return}var e=GetSearchCondition();if(document.getElementById(gCtlIdPrefix.MainContent+"mapsearch").value!=e||a){document.getElementById(gCtlIdPrefix.MainContent+"mapsearch").value=e;GetMapSearch(e,a,d,b)}}function GetSearchCondition(c){var e="";var b=document.getElementById("chkSingle");var d=document.getElementById("chkCondos");if(b!=null&&b.checked&&d!=null&&d.checked){e="12"}else{if(b!=null&&b.checked){e=1}if(d!=null&&d.checked){e=2}}var a=document.getElementById(gCtlIdPrefix.MainContent+"tbInputLetters_Valid").value.replace(/,/g,"|");if(a.substring(a.length-1)=="|"){a=a.substring(0,a.length-1)}var g="";if(c){g=a+","+e+","+minBed+","+FilterBathRoom(minBath)+","+minPrice+","+maxPrice}else{g=a+","+e+","+minBed+"|"+maxBed+","+minBath+"|"+maxBath+","+minPrice+","+maxPrice}var f=GetListingType();return g+","+f}function TrackMapSearch(a){try{if(a){TrackGoogleAnalytics(GetSearchPageName("m0"));var c=document.getElementById(gCtlIdPrefix.PageHeader+"GetCityZipForAd");if(c!=null&&c.value!=""){TrackGoogleAnalyticsNew()}}else{if(NeedTrackMapSearch){TrackGoogleAnalytics(GetSearchPageName("m1"));var c=document.getElementById(gCtlIdPrefix.PageHeader+"GetCityZipForAd");if(c!=null&&c.value!=""){TrackGoogleAnalyticsNew()}}else{NeedTrackMapSearch=true}}}catch(b){}}function GetMapURL2(f,d){var h=f;if(h.length>0){if(d==null){var l=GetMapCenter2(f);var v=CreateMap("map",l,null);if(v==null){alert("We encountered problems while displaying the Map. They may be caused by security settings on the browser.");return}}var t=new CreateIcon();if(t==null){return}var c;var j;var r;var u;var n;var k;var b;var o="";for(var q=0;q<h.length;q++){igenkey=h[q].iGen_Key.toString();if(h[q].DaysOnMkt!=null&&h[q].DaysOnMkt!=""){j=h[q].DaysOnMkt}else{j="<font color=red>"+GetStatus(h[q].ss_status)+"</font>"}longitude=h[q].longitude;latitude=h[q].latitude;if(longitude<-60&&latitude>24){var a=GetMlsDbFromComplexKey(igenkey);MlsDbList.AddMlsDb(a);c=GetHouseAddress(igenkey,h[q].Address,0,"");var m=false;if(h[q].num_photos_dl>0){m=true}b=GetHousePhoto(h[q].mls_num,h[q].mls_db,m,"");var g=false;if(h[q].vs_flag==1){g=true}u=GetValuesSpot(igenkey,g,"");r='<table width = "220"><tr><td><table align=left ><font size=1>'+c+"<br />"+u+"$"+h[q].list_price+o+" <br />Beds:"+h[q].bedroomText+" - Baths:"+h[q].bathroomText+"<br />"+h[q].square_feet.toString()+" SF&nbsp;&nbsp; Lot: "+Refresh(h[q].lot_size.toString());if(a!="300"&&a!="651"&&a!="521"){r+="<br>Days on Market: "+j+" "+Getopenhouse(h[q].openHouseText);var p=MLSWithNoListDate(a);if(p!=null&&p==true){r=r.replace("Days on Market:","Days on Movoto:")}}else{r+="<br />"+Getopenhouse(h[q].openHouseText)}if(a=="441"||a=="661"||a=="662"||a=="663"||a=="664"){r+="<br />Courtesy of: "+h[q].lo_listing_office}else{if(a=="521"){r+="MLS#: "+h[q].mls_num+", "+h[q].lo_listing_office}}if(a=="521"){b+=" "+GetMLSLogosByMlsDb(a)}r+="</font></table></td></tr><tr><td width=220>"+b+"</td></tr></table>";try{k=GetPropertyImg(j,0);t.image=k;n=new GLatLng(latitude,longitude);markers[igenkey]=createMarker(n,t,r,igenkey)}catch(s){return}}if(d==null&&markers[igenkey]!=null){v.addOverlay(markers[igenkey])}}}}function GetMapCenter2(f,b){var r=new gmArray(5);var j=0;var d=0;var a=13;var m=f;var q=m.length;var h=0;var t=0;var c=0;var k=0;var l=0;var n=0;var e=0;var o=10;if(q>=2){o=15}if(q>0){for(var s=q-1;s>=0;s--){longitude=m[s].longitude;latitude=m[s].latitude;if(t==0&&h==0&&k==0&&c==0){t=longitude;h=longitude;k=latitude;c=latitude}else{if(longitude<-60&&latitude>o){if(t<longitude){t=longitude}if(h>longitude){h=longitude}if(k<latitude){k=latitude}if(c>latitude||c<o){c=latitude}l+=longitude;n+=latitude;e+=1}}}}j=(h+t)/2;d=(c+k)/2;var p=t-h;var g=k-c;if(q>=2){a=GetZoomLevel(p,g);if(b!=""&&b!=null){j=l/e;d=n/e;if(a<12){a=12}}}r[0]=j;r[1]=d;r[2]=a;r[3]=p;r[4]=g;return r}function GuidePinColor(){var a=new popUpWindow("divPinColorGuide");a.width="480";a.height="430";a.titleBar.innerHTML="Mapsearch Pin Color Guide";a.bodyContainerTypeValue=GetWebPath()+"PinColorGuide.aspx";a.show()};
