
function StringBuffer(){this.buffer=[];}
StringBuffer.prototype.append=function(s){this.buffer.push(s);};StringBuffer.prototype.toString=function(){return this.buffer.join("");};String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"");};google.maps.Polygon.prototype.getBounds=function(latLng){var i,p;var bounds=new google.maps.LatLngBounds();var paths=this.getPaths();var path;for(p=0;p<paths.getLength();p++){path=paths.getAt(p);for(i=0;i<path.getLength();i++){bounds.extend(path.getAt(i));}}
return bounds;}
google.maps.Polygon.prototype.containsLatLng=function(latLng){var bounds=this.getBounds();if(bounds!=null&&!bounds.contains(latLng)){return false;}
var inPoly=false;var numPaths=this.getPaths().getLength();for(var p=0;p<numPaths;p++){var path=this.getPaths().getAt(p);var numPoints=path.getLength();var j=numPoints-1;for(var i=0;i<numPoints;i++){var vertex1=path.getAt(i);var vertex2=path.getAt(j);if(vertex1.lng()<latLng.lng()&&vertex2.lng()>=latLng.lng()||vertex2.lng()<latLng.lng()&&vertex1.lng()>=latLng.lng()){if(vertex1.lat()+(latLng.lng()-vertex1.lng())/(vertex2.lng()-vertex1.lng())*(vertex2.lat()-vertex1.lat())<latLng.lat()){inPoly=!inPoly;}}
j=i;}}
return inPoly;}
google.maps.Polygon.prototype.toString=function(){var i,p;var coords=[];var path=this.getPath();var numPoints=path.getLength();for(i=0;i<numPoints;i++){p=path.getAt(i);coords.push(p.lat().toFixed(5));coords.push(p.lng().toFixed(5));}
return coords.join(",");}
function keyDownHandler(e){e=e||window.event;gOptionKeyDown=e.altKey;if(gOptionKeyDown){gOperaFlag=false;}else{if(e.keyCode==18){gOptionKeyDown=true;gOperaFlag=true;}}
if(gTourInProgress){if(e.ctrlKey&&gOptionKeyDown){switch(e.keyCode){case 37:animationPrev();break;case 38:animationOff();break;case 39:animationNext();break;case 40:if(gAnimationSingleStepMode){animationResume();}else{animationPause();}
break;}}}}
function keyUpHandler(e){e=e||window.event;if(gOperaFlag){if(e.keyCode==18){gOptionKeyDown=false;}}else{gOptionKeyDown=e.altKey;}}
function dragEndHandler(b){var i;var r,rm;if(gOptionKeyDown){for(i=1;i<=gPropertyCount;i++){r=propertyDB[i];rm=r.theMarker;if(r.inFoundSet&&rm.getVisible()){if(b.contains(rm.getPosition())){markForceOnOne(i);}}}
setMarkerVisibilityAll();showFavoritesList();}}
function in_array(needle,haystack){var key;for(key in haystack){if(haystack.hasOwnProperty(key)){if(needle==haystack[key]){return true;}}}
return false;}
function overlayBegin(iStart){var i;var oCount=0;var oGroupSize=50;for(i=iStart;i<=gPropertyCount;i++){if(!propertyDB[i].theMarker.isOverlaid){addPropertyOverlay(i);oCount++;if(oCount==oGroupSize){iStart=i+1;break;}}}
if((oCount<oGroupSize)&&(gOverlayRef!=null)){clearTimeout(gOverlayRef);gOverlaidAll=true;}else{gOverlayRef=setTimeout("overlayBegin("+iStart+")",1*1000);}}
function initPricePopups(){var i;var priceLowPopup=gMapFormLower.elements[kLowPriceFilter];var priceHighPopup=gMapFormLower.elements[kHighPriceFilter];priceLowPopup.options.length=0;priceHighPopup.options.length=0;priceLowPopup.options[0]=new Option(formatPrice(kPriceLowest),kPriceLowest);for(i=0;i<kPriceBands.length;i++){priceLowPopup.options[i+1]=new Option(formatPrice(kPriceBands[i]),kPriceBands[i]);priceHighPopup.options[i]=new Option(formatPrice(kPriceBands[i]),kPriceBands[i]);}
priceHighPopup.options[kPriceBands.length]=new Option("Unlimited",kPriceHighest);priceLowPopup.value=kPriceLowest;priceHighPopup.value=kPriceHighest;}
function logPropertyClick(i){if(kLogClicks){var req;var parms="";var a="";var now=getCurrentTimeString();var ymd=now.substr(0,now.indexOf(" "));a+=now+"\t";a+=propertyDB[i].theMLSnumber+"\t";a+=propertyDB[i].theStreetAddress+"\t";a+=propertyDB[i].theTown+"\t";a+=formatPrice(propertyDB[i].thePrice)+"\t";if(gUserName==""){a+=gLogUserID+"\n";}else{a+=gUserName+"\n";}
parms+="a="+escape(a);parms+="&f="+escape(kLogClickFile.replace("%d",ymd));try{req=new XMLHttpRequest();req.open("POST",kLogClickURL,true);req.setRequestHeader("Content-Type","application/x-www-form-urlencoded");req.send(parms);}catch(e){}}}
function getSalesHistory(pid){var history="";try{var parms="u="+escape(kPropertiesSoldFile)+"&pid="+escape(pid);var req=new XMLHttpRequest();req.open("POST",kPropertiesSearchDB,true);req.onreadystatechange=function(message,errorCode){var i,f,d;var info;var rows;var history="";if(req.readyState==4){if(req.status==200||req.status==0){info=req.responseText;if(info!=""){rows=info.split("\n");if(rows.length>1){for(i=1;i<rows.length;i++){f=rows[i].split("\t");d=f[33].split("/");history+="<span onclick='mlsGoID(\""+f[0]+"\");'>";history+="Sold "+kMonthNamesAbbrev[d[0]-1]+" "+d[2]+" for "+formatPrice(f[32]);history+="</span>";if(f[9]!="Lot"){}
history+="<br>";}
try{document.getElementById(pid).innerHTML=history;}catch(e2){}
try{document.getElementById(pid+"-detail").innerHTML=history;}catch(e3){}}}}}};req.setRequestHeader("Content-Type","application/x-www-form-urlencoded");req.send(parms);}catch(e1){}}
function createMapFamilyMarker(i){var m;var size=new google.maps.Size(kMarkerWidth,kMarkerHeight);var origin=new google.maps.Point(112,64);var anchor=new google.maps.Point(kMarkerWidth/2,kMarkerHeight/2);var mapName=kMapFamily[i][0];var mapDesc=kMapFamily[i][1];var mapLocn=kMapFamily[i][2];var markerImage=new google.maps.MarkerImage(kMarkersAllURL,size,origin,anchor);if(mapName!=kMapName){m=new google.maps.Marker({position:mapLocn,clickable:true,icon:markerImage,map:gMap});google.maps.event.addListener(m,"click",function(){var parms;var c=m.getPosition().lat()+","+m.getPosition().lng();parms="?kUserData="+escape(kUserData);parms+="&kMapServerURL="+escape(kMapServerURL);parms+="&kMapClientURL="+escape(kMapClientURL);parms+="&random="+escape(Math.random());parms+="&gParametersInit="+escape("map="+mapName+"&zoom=12&center="+c);self.location.href=parms;});google.maps.event.addListener(m,"mouseover",function(){var msg;msg="<div id='"+kTooltipID+"' style='padding: 5px;'>";msg+="Load <b>"+mapDesc+"</b> map";msg+="</div>";this.tooltip=msg;showTooltipLandmark(this);});google.maps.event.addListener(m,"mouseout",function(){gSummaryBox.hide();});}}
function getCurrentTimeString(){var d=new Date();var MMM=d.getMonth()+1;var DDD=d.getDate();var YYY=d.getFullYear();var h=d.getHours();var m=d.getMinutes();var s=d.getSeconds();if(MMM<10){MMM="0"+MMM;}
if(DDD<10){DDD="0"+DDD;}
if(h<10){h="0"+h;}
if(m<10){m="0"+m;}
if(s<10){s="0"+s;}
return YYY+"-"+MMM+"-"+DDD+" "+h+":"+m+":"+s;}
function getWindowHeight(){if(self.innerHeight){return self.innerHeight;}
if(document.documentElement&&document.documentElement.clientHeight){return document.documentElement.clientHeight;}
if(document.body){return document.body.clientHeight;}
return 0;}
function getMapHeight(){var mapMargin;var mapHeight;mapMargin=gMapFormUpper.offsetHeight+gMapFormLower.offsetHeight;mapHeight=getWindowHeight()-mapMargin-10;if(mapHeight>kMapHeightMax){mapHeight=kMapHeightMax;}
return mapHeight;}
function getSidebarHeight(){return getMapHeight();}
function resizeMap(){var w;gMap.getDiv().style.width="1px";if(document.getElementById("sidebar").style.display==""){w=document.body.offsetWidth-kMapSidebarWidth-29;}else{w=document.body.offsetWidth-29;}
if(w>kMapWidthMax){w=kMapWidthMax;}
if(w<kMapWidthMin){w=kMapWidthMin;}
gMap.getDiv().style.width=w+"px";gMap.getDiv().style.height=getMapHeight()+"px";google.maps.event.trigger(gMap,"resize");}
function resizeSidebar(){document.getElementById(kMapSidebarID).style.width=kMapSidebarWidth+"px";document.getElementById(kMapSidebarID).style.height=getSidebarHeight()+"px";}
function toggleSearchBar(){var d=document.getElementById("searchBar").style.display;if(d==""){hideSearchBar();if(gOptionKeyDown){hideSidebar();}}else{showSearchBar();if(gOptionKeyDown){showSidebar();}}}
function showSearchBar(){var sb=document.getElementById("searchBar");var sbIcon=document.getElementById("dArrow2");if(sb.style.display!=""){sb.style.display="";sbIcon.src=kShowSearchBarURL;sbIcon.title="Hide search panel";try{window.onresize();}catch(e){}}}
function hideSearchBar(){var sb=document.getElementById("searchBar");var sbIcon=document.getElementById("dArrow2");if(sb.style.display==""){sb.style.display="none";sbIcon.src=kHideSearchBarURL;sbIcon.title="Show search panel";try{window.onresize();}catch(e){}}}
function toggleSidebar(){var d=document.getElementById("sidebar").style.display;if(d==""){hideSidebar();if(gOptionKeyDown){hideSearchBar();}}else{showSidebar();if(gOptionKeyDown){showSearchBar();}}}
function showSidebar(){var sb=document.getElementById("sidebar");var sbIcon=document.getElementById("dArrow");if(sb.style.display!=""){sb.style.display="";sbIcon.src=kHideSidebarURL;sbIcon.title="Hide sidebar";try{window.onresize();}catch(e){}}}
function hideSidebar(){var sb=document.getElementById("sidebar");var sbIcon=document.getElementById("dArrow");if(sb.style.display==""){sb.style.display="none";sbIcon.src=kShowSidebarURL;sbIcon.title="Show sidebar";try{window.onresize();}catch(e){}}}
function getCoordRange(){var b;var ne,sw;b=gMap.getBounds();ne=b.getNorthEast();sw=b.getSouthWest();return sw.lat()+","+ne.lat()+","+sw.lng()+","+ne.lng();}
function findSimilar(i){var tolerance=0.15;var j;var d;var z;var r2;var theContent="";var r=propertyDB[i];var theCenter=r.theMarker.getPosition();removeCircle();hideCustomArea();gCircleOverlay=new google.maps.Circle({center:theCenter,clickable:false,fillColor:"#ff0000",fillOpacity:0.25,radius:kSimilarRadius,map:gMap});theContent+="<table><tr>";theContent+="<td>";theContent+="<i><b>Similar to "+r.theStreetAddress+"</b></i> shown";theContent+="</td>";theContent+="<td>";theContent+="<img src='"+kDeleteURL+"' onclick='filterProperties();' style='cursor: pointer;' title=' Show all properties '>";theContent+="</td>";theContent+="</tr></table>";gSearchBox.innerHTML=theContent;gSearchBox.style.display="";gTotalFound=0;for(j=1;j<=gPropertyCount;j++){r2=propertyDB[j];r2.inFoundSet=false;d=r2.theMarker.getPosition();if(distanceBetween(theCenter,d)<=kSimilarRadius){if(r2.thePropType==r.thePropType){if(Math.abs((r2.thePrice-r.thePrice)/r.thePrice)<=tolerance){if(Math.abs((r2.theHouseSize-r.theHouseSize)/r.theHouseSize)<=tolerance){if(Math.abs(r2.theBedroomCount-r.theBedroomCount)<=1){if(Math.abs(r2.theBathroomCount-r.theBathroomCount)<=1){r2.inFoundSet=true;gTotalFound++;}}}}}}}
gMap.fitBounds(gCircleOverlay.getBounds());gMap.setCenter(theCenter);gShowOnlyMarked=false;gMapFormLower.elements[kFavoritesOnlyCheckbox].checked=gShowOnlyMarked;showFoundList();return;}
function removeCircle(){if(gCircleOverlay!==null){gCircleOverlay.setMap(null);gCircleOverlay=null;}}
function distanceBetween(p1,p2){var R=6371;var dLat=rad(p2.lat()-p1.lat());var dLong=rad(p2.lng()-p1.lng());var a=Math.sin(dLat/2)*Math.sin(dLat/2)+
Math.cos(rad(p1.lat()))*Math.cos(rad(p2.lat()))*Math.sin(dLong/2)*Math.sin(dLong/2);var c=2*Math.atan2(Math.sqrt(a),Math.sqrt(1-a));var d=R*c*1000;return d.toFixed(3);}
function getViewList(){var i;var r;var viewList="";var removeList="";var b=gMap.getBounds();for(i=1;i<=gPropertyCount;i++){r=propertyDB[i];if(b.contains(r.theMarker.getPosition())){viewList+=r.theMLSnumber+",";}else if(!r.isMarked){if(i!=gActiveDetail){removeList+=r.theMLSnumber+",";}}}
if(viewList!==""){viewList=viewList.substring(0,viewList.length-1);}
if(removeList!==""){removeList=removeList.substring(0,removeList.length-1);}
return{view:viewList,remove:removeList};}
function showTooltip(marker,n){var i;var iActive;var r,rm;var point,offset,pos;var c,cOther;var count=0;iActive=marker.index;c=marker.getPosition();for(i=1;i<=gPropertyCount;i++){r=propertyDB[i];rm=r.theMarker;if(r.inFoundSet){if(!gShowOnlyMarked||(gShowOnlyMarked&&r.isMarked)){cOther=rm.getPosition();if(cOther.equals(c)){if(count==n){iActive=rm.index;}
count++;}}}}
gSummaryBox.setContent(getTooltip(iActive,count,n));if(gPanoViewer.getVisible()){gSummaryBox.open(gPanoViewer);}else{gSummaryBox.open(gMap);c=adjustTooltipPosition(c,180);}
gSummaryBox.setPosition(c)
google.maps.event.addListenerOnce(gSummaryBox,"domready",function(){gSummaryBox.show();});return count;}
function refreshMap(){setMarkerVisibilityAll();showFoundList();}
function setMarkerVisibilityAll(){var i;var n;var r,rm;var labelVisibility;var buttonColor;var favoriteCounter=0;var z=gMap.getZoom();var b=gMap.getBounds();gTotalView=0;gTotalFound=0;for(i=1;i<=gPropertyCount;i++){r=propertyDB[i];rm=r.theMarker;if(r.isMarked){favoriteCounter++;}
if(r.inFoundSet){gTotalFound++;if(gShowOnlyMarked&&!r.isMarked){if(rm.isOverlaid&&rm.getVisible()){rm.setVisible(false);}}else{if(rm.isOverlaid){if(!rm.getVisible()){rm.setVisible(true);}}
if((typeof b!="undefined")&&b.contains(rm.getPosition())){gTotalView++;}}}else{if(rm.isOverlaid&&rm.getVisible()){rm.setVisible(false);}}}
gMC.repaint();n=gTotalFound;if(gShowOnlyMarked){n=favoriteCounter;}
document.getElementById(kStatisticsID).innerHTML=n+"&nbsp;found<br>"+gTotalView+"&nbsp;in&nbsp;view";document.getElementById(kStatistics2ID).innerHTML="<b>("+favoriteCounter+" favourite"+(favoriteCounter==1?"":"s")+")</b>";document.getElementById(kShowAllID).value="Show All "+gPropertyCount;if(n==gPropertyCount){buttonColor="gray";document.getElementById(kShowAllID).disabled=true;}else{buttonColor="red";document.getElementById(kShowAllID).disabled=false;}
document.getElementById(kShowAllID).style.color=buttonColor;}
function markToggle(i){var r=propertyDB[i];var oldState=r.isMarked;r.isMarked=!oldState;if(r.theMarker.isOverlaid){r.theMarker.setIcon(getHighlightedMarkerImage(r.isMarked));}
setMarkerVisibilityAll();showFavoritesList();try{document.getElementById(kListFormID).elements[kMarkName+i].checked=!oldState;}catch(e){}
if(gActiveDetail==i){document.getElementById(kDetailFormID).elements[kMarkName].checked=!oldState;}}
function addPropertyOverlay(i){var r=propertyDB[i];var rm=r.theMarker;google.maps.event.addListener(rm,"mouseover",function(){var propertyCount;if(gPolygonHighlighted){gPolygonHighlighted.setMap(null);}
highlightPropertyList(this.index);if(gSummaryRef!==null){clearTimeout(gSummaryRef);gSummaryRef=null;}
propertyCount=showTooltip(this,0);if(propertyCount>1){gSummaryRef=setTimeout("swapPropSummary("+this.index+", 1)",kPropertyInterval*1000);}else{if(propertyDB[this.index].thePictureCount>1){gSummaryRef=setTimeout("swapPicSummary("+this.index+", 1)",kPictureInterval*1000);}}});google.maps.event.addListener(rm,"mouseout",function(){try{document.getElementById(kItemRowID+this.index).style.backgroundColor=kListOffColor;}catch(e){}
gSummaryBox.hide();if(gSummaryRef!==null){clearTimeout(gSummaryRef);gSummaryRef=null;}});google.maps.event.addListener(rm,"dblclick",function(c){gMap.setCenter(this.getPosition());gMap.setZoom(gMap.getZoom()+1);});google.maps.event.addListener(rm,"click",function(){if(gOptionKeyDown&&!gTourInProgress){markToggle(this.index);}else{if(document.getElementById("sidebar").style.display!=""){showSidebar();gMap.setCenter(this.getPosition());}
showPropertyDetail(this.index);}});gMC.addMarker(rm,true);rm.isOverlaid=true;rm.setVisible(false);rm.setIcon(getIconURL(r.thePropType,r.DOM,r.DOMprice,r.theSoldDate,r.isMarked));}
function hideDialogBox(){gDialogBox.style.display="none";}
function addMapEventListeners(){google.maps.event.addListener(gMap,"click",function(){gSummaryBox.hide();if(gPolygonHighlighted){gPolygonHighlighted.setMap(null);}});google.maps.event.addListener(gMap,"maptypeid_changed",function(){var i;var labelColor="black";var copyrightColor="black";var theOpacity="1.0";switch(this.getMapTypeId()){case google.maps.MapTypeId.ROADMAP:case google.maps.MapTypeId.TERRAIN:break;case google.maps.MapTypeId.HYBRID:labelColor="white";copyrightColor="white";break;case google.maps.MapTypeId.SATELLITE:theOpacity="0.0";copyrightColor="white";break;}
for(i=0;i<labelDB.length;i++){labelDB[i].setOptions({boxStyle:{color:labelColor,opacity:theOpacity}});}
gCopyrightDiv.style.color=copyrightColor;gPlaceAttribution.style.color=copyrightColor;});google.maps.event.addListener(gMap,"zoom_changed",function(){setMapLabelVisibility(this.getZoom());});google.maps.event.addListener(gMap,"idle",function(){var i,j;var rm;var b=gMap.getBounds();if(typeof b=="undefined"){return;}
showPlaces();if(!gOverlaidAll){for(i=1;i<=gPropertyCount;i++){rm=propertyDB[i].theMarker;if(!rm.isOverlaid){if(b.contains(rm.getPosition())){addPropertyOverlay(i);}}}}
setMarkerVisibilityAll();});}
function addWindowEventListener(){window.onresize=function(){resizeMap();resizeSidebar();try{document.getElementById(kListBodyID).style.height=(getSidebarHeight()-20)+"px";}catch(e1){}
try{document.getElementById(kDetailBodyID).style.height=(getSidebarHeight()-39)+"px";}catch(e2){}
try{document.getElementById(kListBodyID).style.width=(kMapSidebarWidth-20)+"px";}catch(e3){}
try{document.getElementById(kDetailBodyID).style.width=(kMapSidebarWidth-20)+"px";}catch(e4){}
google.maps.event.trigger(gMap,"idle");};}
function toggleBoundaryLayer(){gBoundaryFlag=!gBoundaryFlag;setBoundaryOverlay();}
function setBoundaryOverlay(){if(gBoundaryLayer!==null){gBoundaryBox.className=(gBoundaryFlag?kMapControlOnClass:kMapControlOffClass)+" "+kNoprintClass;if(gBoundaryFlag){gBoundaryLayer.setMap(gMap);gBoundaryBox.title="Hide lot lines";}else{gBoundaryLayer.setMap(null);gBoundaryBox.title="Show lot lines";}
try{document.getElementById("lotBox").checked=gBoundaryFlag;}catch(e){}}}
function showLoadedMessage(){var status=document.getElementById(kLoadStatusID);if(status!==null){status.style.color="green";status.innerHTML="The map information has now been loaded. You may begin using the map.";}}
function addDateDisplay(){gCopyrightDiv.innerHTML=kCopyrightNotice+" - "+propertyDB[0];}
function addLatLongDisplay(divID){google.maps.event.addListener(gMap,"center_changed",function(){var cInfo;var c=gMap.getCenter();var latitude=c.lat();var longitude=c.lng();if(kShowCoordinates){if(latitude>=0){latitude=latitude.toFixed(5)+"&deg;N";}else{latitude=(-latitude).toFixed(5)+"&deg;S";}
if(longitude>=0){longitude=longitude.toFixed(5)+"&deg;E";}else{longitude=(-longitude).toFixed(5)+"&deg;W";}
cInfo=latitude+"&nbsp;/&nbsp;"+longitude;document.getElementById(divID).innerHTML=cInfo;}});}
function getLinkBoxHTML(){var h="";h+="<div class='"+kLinkBoxClass+"' style='width: "+(kMapSidebarWidth-24)+"px; padding: 10px;'>";h+="<img src='"+kCloseBoxURL+"' onclick='hideDialogBox();' onmouseover='this.src = kCloseBoxOnURL;' onmouseout='this.src=kCloseBoxURL;' align=left style='cursor: pointer;'>";h+="<img src='"+kCloseBoxURL+"' onclick='hideDialogBox();' onmouseover='this.src = kCloseBoxOnURL;' onmouseout='this.src=kCloseBoxURL;' align=right style='cursor: pointer;'>";h+="<div style='font-size: 12pt; text-align: center;'>";h+="<p style='margin: 0px; font-size: 12pt;'>Copy this link, then paste in <b>email</b> or <b>IM</b></p>";h+="<form id='"+kLinkBoxClass+"'>";h+="<input type='text' readonly value='"+getMapURL()+"' style='width: 355px;' onclick='this.select();'>";h+="</form>";h+="</div>";h+="</div>";return h;}
function getFavWarningHTML(){var h="";h+="<div id='"+kDialogBoxID+"' style='width: "+(kMapSidebarWidth-22)+"px; font-size: 10pt;'>";h+="<table cellpadding=4 style='margin: 5px;'><tr>";h+="<td valign=top align=center>";if(kShowSheetBranding){h+="<img src='"+kAgentPhotoURL+"'><br><i>"+kAgentName+"</i>";}
h+="<td valign=top>";h+="A virtual tour includes only those properties which you have marked as favourites.";h+="<p style='margin-bottom: 0px;'>";h+="Since you have not yet marked any favourite properties, you cannot start the tour at this time.";h+="</table>";h+="<center>";h+="<form style='margin-top: 0px; margin-bottom: 8px;'><input type='button' value=' OK ' onclick='hideDialogBox();'></form>";h+="</center>";h+="</div>";return h;}
function showTipDialog(){showSidebar();showDialogBox(getStartupHTML());loadRandomMessage();}
function getStartupHTML(){var h="";h+="<div id='"+kDialogBoxID+"' style='width: "+(kMapSidebarWidth-22)+"px; font-size: 10pt; padding: 10px;'>";h+="<table><tr>";h+="<td style='vertical-align: top; text-align: center;'>";if(kShowSheetBranding){h+="<img src='"+kAgentPhotoURL+"'><br><i>"+kAgentName+"</i>";}else{h+="<img src='"+kAgentBrokerageLogoBigURL+"'>";}
h+="<td style='vertical-align: top; padding-left: 8px;'>";h+="<span style='font-weight: bold; color: red; font-size: 11pt;'>Hello and welcome to the interactive real estate map.</span><p>";if(gLastVisit!=""){h+="Your last visit was on<br>"+gLastVisit;}
h+="<div id='message0'></div>";h+="</table>";h+="<hr style='margin: 0px;'>";h+="<table width='100%'><tr>";h+="<td align=left>";if(gUserName!=""){h+="<form><input type='checkbox' ";h+=(gHideStartupTip?"":"checked");h+=" onclick='gHideStartupTip = !gHideStartupTip;'>Show tips at startup</form>";}
h+="<td align=right id='nexttip'>";h+="<a href='javascript:void(0)' onclick='loadRandomMessage()'>Next Tip</a>&rarr;";h+="</table>";h+="<hr style='margin-top: 2px;'>";h+="<div id='message1'></div>";h+="<center>";h+="<form style='margin-top: 2px; margin-bottom: 0px;'><input type='button' value=' OK ' onclick='hideDialogBox();'></form>";h+="</center>";h+="</div>";return h;}
function getTourEndHTML(){var h="";h+="<div id='"+kDialogBoxID+"' style='width: "+(kMapSidebarWidth-22)+"px; font-size: 10pt;'>";h+="<table cellpadding=4 style='margin: 5px; font-size: 10pt;'><tr>";h+="<td valign=top align=center>";if(kShowSheetBranding){h+="<img src='"+kAgentPhotoURL+"'><br><i>"+kAgentName+"</i>";}
h+="<td valign=top>";h+="The virtual tour has ended.";h+="<p style='margin-bottom: 0px;'>";h+="Click the <i>Begin Tour of Favourites</i> button in the bar below the map if you want to replay the tour.";h+="</table>";h+="<center>";h+="<form style='margin-top: 0px; margin-bottom: 8px;'><input type='button' value=' OK ' onclick='hideDialogBox();'></form>";h+="</center>";h+="</div>";return h;}
function showLinkBox(){gDialogBox.innerHTML=getLinkBoxHTML();gDialogBox.style.display="";showSidebar();document.getElementById(kLinkBoxClass).elements[0].focus();document.getElementById(kLinkBoxClass).elements[0].select();}
function showDialogBox(theHTML){gDialogBox.innerHTML=theHTML;gDialogBox.style.display="";gDialogBox.style.zIndex=3000;}
function markForceOnOne(i){var r=propertyDB[i];var rm=r.theMarker;r.isMarked=true;if(rm.isOverlaid){rm.setIcon(getIconURL(r.thePropType,r.DOM,r.DOMprice,r.theSoldDate,true));}
try{document.getElementById(kListFormID).elements[kMarkName+i].checked=true;}catch(e){}
if(gActiveDetail==i){document.getElementById(kDetailFormID).elements[kMarkName].checked=true;}}
function markForceOffOne(i){var r=propertyDB[i];var rm=r.theMarker;r.isMarked=false;if(rm.isOverlaid){rm.setIcon(getIconURL(r.thePropType,r.DOM,r.DOMprice,r.theSoldDate,false));}
setMarkerVisibilityAll();showFavoritesList();try{document.getElementById(kListFormID).elements[kMarkName+i].checked=false;}catch(e){}
if(gActiveDetail==i){document.getElementById(kDetailFormID).elements[kMarkName].checked=false;}}
function markForceOnAll(){var i;var r,rm;gLastMarkCmd="all";for(i=1;i<=gPropertyCount;i++){r=propertyDB[i];rm=r.theMarker;if(r.inFoundSet){r.isMarked=true;try{document.getElementById(kListFormID).elements[kMarkName+i].checked=true;}catch(e){}
if(rm.isOverlaid){rm.setIcon(getIconURL(r.thePropType,r.DOM,r.DOMprice,r.theSoldDate,true));}}}
setMarkerVisibilityAll();showFavoritesList();if(gActiveDetail>0&&propertyDB[gActiveDetail].isMarked){document.getElementById(kDetailFormID).elements[kMarkName].checked=true;}}
function markForceOffAll(){var i;var r,rm;gLastMarkCmd="none";for(i=1;i<=gPropertyCount;i++){r=propertyDB[i];rm=r.theMarker;r.isMarked=false;try{document.getElementById(kListFormID).elements[kMarkName+i].checked=false;}catch(e){}
if(rm.isOverlaid){rm.setIcon(getIconURL(r.thePropType,r.DOM,r.DOMprice,r.theSoldDate,false));}}
gShowOnlyMarked=false;gMapFormLower.elements[kFavoritesOnlyCheckbox].checked=false;setMarkerVisibilityAll();showFavoritesList();if(gActiveDetail>0){document.getElementById(kDetailFormID).elements[kMarkName].checked=false;}}
function markForceOnInView(){var i;var theLatLng;var r,rm;var b=gMap.getBounds();gLastMarkCmd="inview";for(i=1;i<=gPropertyCount;i++){r=propertyDB[i];rm=r.theMarker;if(r.inFoundSet){theLatLng=rm.getPosition();if(b.contains(theLatLng)){r.isMarked=true;try{document.getElementById(kListFormID).elements[kMarkName+i].checked=true;}catch(e){}
if(rm.isOverlaid){rm.setIcon(getIconURL(r.thePropType,r.DOM,r.DOMprice,r.theSoldDate,true));}}}}
setMarkerVisibilityAll();showFavoritesList();if(gActiveDetail>0&&propertyDB[gActiveDetail].isMarked){document.getElementById(kDetailFormID).elements[kMarkName].checked=true;}}
function markPropertiesByID(idListString){var i;var theID;var idIndex;var markedPropertyList;if(idListString!==""){markedPropertyList=idListString.split(",");for(i=0;i<markedPropertyList.length;i++){theID=markedPropertyList[i].trim().toLowerCase();if(theID=="all"){markForceOnAll();break;}
idIndex=getIndexFromID(theID);if(idIndex!=-1){markForceOnOne(idIndex);}}}}
function showOnlyMarkedToggle(f){gShowOnlyMarked=f.elements[kFavoritesOnlyCheckbox].checked;refreshMap();}
function animationPause(){gAnimationSingleStepMode=true;document.getElementById(kPausePlaySlideID).src=kPlaySlideURL;document.getElementById(kPausePlaySlideID).title="Play (Ctrl + Opt/Alt + down arrow)";document.getElementById(kPausePlaySlideID).onclick=animationResume;if(gAnimationRef!==null){clearTimeout(gAnimationRef);gAnimationRef=null;}}
function animationResume(){gAnimationSingleStepMode=false;document.getElementById(kPausePlaySlideID).src=kPauseSlideURL;document.getElementById(kPausePlaySlideID).title="Pause (Ctrl + Opt/Alt + down arrow)";document.getElementById(kPausePlaySlideID).onclick=animationPause;if(gSortOrder==0){animationGo(animationGetNextFrame(gAnimationPrevFrame));}else{animationGo(animationGetPrevFrame(gAnimationPrevFrame));}}
function animationNext(){var f;if(gAnimationRef!==null){clearTimeout(gAnimationRef);gAnimationRef=null;}
if(gSortOrder==0){f=animationGetNextFrame(gAnimationPrevFrame);}else{f=animationGetPrevFrame(gAnimationPrevFrame);}
if(f===0){animationOff();}else{animationGo(f);}}
function animationPrev(){var f;if(gAnimationRef!==null){clearTimeout(gAnimationRef);gAnimationRef=null;}
if(gSortOrder==0){f=animationGetPrevFrame(gAnimationPrevFrame);if(f>=gAnimationPrevFrame&&!gAnimationRepeat){return;}}else{f=animationGetNextFrame(gAnimationPrevFrame);if(f<=gAnimationPrevFrame&&!gAnimationRepeat){return;}}
if(f===0){animationOff();}else{animationGo(f);}}
function animationOn(){var i;gAnimationRef=null;gAnimationPrevFrame=0;gAnimationSingleStepMode=false;if(gSortOrder==0){i=animationGetNextFrame(gAnimationPrevFrame);}else{i=animationGetPrevFrame(gAnimationPrevFrame);}
if(i===0){animationOff();showDialogBox(getFavWarningHTML());showSidebar();}else{document.getElementById(kPausePlaySlideID).src=kPauseSlideURL;document.getElementById(kPausePlaySlideID).title="Pause (Ctrl + Opt/Alt + down arrow)";document.getElementById(kPausePlaySlideID).style.cursor="pointer";document.getElementById(kPausePlaySlideID).onclick=animationPause;document.getElementById(kPrevSlideID).title="Previous slide (Ctrl + Opt/Alt + left arrow)";document.getElementById(kPrevSlideID).style.cursor="pointer";document.getElementById(kPrevSlideID).onclick=animationPrev;document.getElementById(kNextSlideID).title="Next slide (Ctrl + Opt/Alt + right arrow)";document.getElementById(kNextSlideID).style.cursor="pointer";document.getElementById(kNextSlideID).onclick=animationNext;document.getElementById(kSlideShowControlsID).style.visibility="visible";gMapFormLower.elements[kAnimationButton].value="End Tour of Favourites";gTourInProgress=true;animationGo(i);}}
function animationOff(){gTourInProgress=false;if(gAnimationRef!==null){clearTimeout(gAnimationRef);gAnimationRef=null;}
gAnimationSingleStepMode=false;if(gAnimationPrevFrame>0){doMouseOut(gAnimationPrevFrame);}
gMapFormLower.elements[kAnimationButton].value="Begin Tour of Favourites";document.getElementById(kPausePlaySlideID).onclick="";document.getElementById(kPausePlaySlideID).style.cursor="default";document.getElementById(kPrevSlideID).onclick="";document.getElementById(kPrevSlideID).style.cursor="default";document.getElementById(kNextSlideID).onclick="";document.getElementById(kNextSlideID).style.cursor="default";document.getElementById(kSlideShowControlsID).style.visibility="hidden";}
function animationGo(i){var f;var idNumber;if(i>0){if(gAnimationPrevFrame>0){doMouseOut(gAnimationPrevFrame);}
gAnimationPrevFrame=i;idNumber=propertyDB[i].theMLSnumber;gMap.setCenter(propertyDB[i].theMarker.getPosition());i=getIndexFromID(idNumber);showPropertyOnMap(i);if(gSortOrder==0){f=animationGetNextFrame(i);}else{f=animationGetPrevFrame(i);}
if(f>0&&!(f<i&&!gAnimationRepeat&&gSortOrder==0)&&!(f>i&&!gAnimationRepeat&&gSortOrder==1)){if(!gAnimationSingleStepMode){gAnimationRef=setTimeout("animationGo("+f+")",animationGetFrameDuration()*1000);}}else{showDialogBox(getTourEndHTML());showSidebar();animationOff();}}}
function animationCount(){var i,r;var c=0;for(i=1;i<=gPropertyCount;i++){r=propertyDB[i];if(r.inFoundSet&&r.isMarked){c++;}}
return c;}
function animationGetNextFrame(i){var j;var nextFrame=0;for(j=i+1;j<=gPropertyCount;j++){if(propertyDB[j].inFoundSet&&propertyDB[j].isMarked){nextFrame=j;break;}}
return nextFrame;}
function animationGetPrevFrame(i){var j;var prevFrame=0;if(i==0){i=gPropertyCount+1;}
for(j=i-1;j>0;j--){if(propertyDB[j].inFoundSet&&propertyDB[j].isMarked){prevFrame=j;break;}}
return prevFrame;}
function animationGetFrameDuration(){var seconds;seconds=parseInt(gMapFormLower.elements[kAnimationIntervalField].value,10);if(isNaN(seconds)||seconds<kAnimationIntervalMinimum){seconds=kAnimationIntervalMinimum;}
gMapFormLower.elements[kAnimationIntervalField].value=seconds;return seconds;}
function animationToggle(){if(gTourInProgress){animationOff();}else{animationOn();}}
function bounceStart(marker){bounceStop();gBounceItem=marker;gBounceRef=setTimeout(bounceStop,kBouncesMax*kBouncesPeriod);setTimeout(function(){marker.setAnimation(google.maps.Animation.BOUNCE)},100);}
function bounceStop(){if(gBounceRef!==null){clearTimeout(gBounceRef);gBounceRef=null;}
if(gBounceItem!==null){gBounceItem.setAnimation(null);gBounceItem=null;}}
function swapPicSummary(i,n){if(!gOptionKeyDown){var pictureCount=propertyDB[i].thePictureCount;var pictureList=propertyDB[i].thePictureList
document.getElementById(kPicSummaryID).src=pictureList.split(" ")[n];n++;document.getElementById("tipPhotoCount").innerHTML=n+" of "+pictureCount;if(n==pictureCount){n=0;}}
gSummaryRef=setTimeout("swapPicSummary("+i+","+n+")",kPictureInterval*1000);}
function swapPropSummary(i,n){if(!gOptionKeyDown){var propertyCount=showTooltip(propertyDB[i].theMarker,n);n++;if(n==propertyCount){n=0;}}
gSummaryRef=setTimeout("swapPropSummary("+i+","+n+")",kPropertyInterval*1000);}
function swapPicInfo(i){if(!gOptionKeyDown){showNextPicture(i);}
gInfoRef=setTimeout("swapPicInfo("+i+")",kPictureInterval*1000);}
function getMapURL(){var t;var now=new Date();var url=gBaseURL+"?";url+="map="+kMapName;t=gMapFormLower.elements[kCategoryFilter].value;switch(t){case kPropertyHouse:url+="&type=h";break;case kPropertyCondo:url+="&type=c";break;case kPropertyManufacturedHome:url+="&type=m";break;case kPropertyLot:url+="&type=l";break;case kPropertyAll:default:}
try{t=gMapFormLower.elements[kTownFilter].value;if(t!=kTownAll){url+="&town="+escape(t);}}catch(e1){}
t=gMapFormLower.elements[kAgeFilter].value;if(t!=kAgeAll){url+="&age="+t;}
t=gMapFormLower.elements[kLowPriceFilter].value;if(t!=kPriceLowDefault){url+="&minprice="+t;}
t=gMapFormLower.elements[kHighPriceFilter].value;if(t!=kPriceHighDefault){url+="&maxprice="+t;}
try{t=gMapFormLower.elements[kBedroomsFilter].value;if(t!=kBedroomsAll){url+="&minbeds="+t;}}catch(e2){}
try{t=gMapFormLower.elements[kBathroomsFilter].value;if(t!=kBathroomsAll){url+="&minbaths="+t;}}catch(e3){}
try{t=gMapFormLower.elements[kMinLotSizeFilter].value;if(t!=kLotSizesAll){url+="&minlotsize="+t;}}catch(e4){}
try{t=gMapFormLower.elements[kMaxLotSizeFilter].value;if(t!=kLotSizesAll){url+="&maxlotsize="+t;}}catch(e5){}
try{t=gMapFormLower.elements[kMinHouseSizeFilter].value;if(t!=kHouseSizesAll){url+="&minhousesize="+t;}}catch(e6){}
try{t=gMapFormLower.elements[kMaxHouseSizeFilter].value;if(t!=kHouseSizesAll){url+="&maxhousesize="+t;}}catch(e7){}
if(getFeatureList()!=""){url+="&features="+getFeatureList();}
if(getLandmarkList()!=""){url+="&poi="+getLandmarkList();}
url+="&center="+gMap.getCenter().lat().toFixed(5)+","+gMap.getCenter().lng().toFixed(5);url+="&zoom="+gMap.getZoom();t=gMap.getMapTypeId();switch(t){case google.maps.MapTypeId.ROADMAP:url+="&mode=r";break;case google.maps.MapTypeId.SATELLITE:url+="&mode=s";break;case google.maps.MapTypeId.TERRAIN:url+="&mode=t";break;case google.maps.MapTypeId.HYBRID:url+="&mode=h";break;default:}
if(gActiveDetail>0){url+="&id="+propertyDB[gActiveDetail].theMLSnumber;}
if(getMarkedList()!==""){url+="&favorites="+getMarkedList();}
if(gShowOnlyMarked){url+="&favonly=on";}
if(gTourInProgress){url+="&tour=on";}
t=gMapFormLower.elements[kAnimationIntervalField].value;if(t!=kAnimationIntervalDefault){url+="&tourtime="+t;}
if(gSearchQuery!=""){url+="&q="+escape(gSearchQuery);}
switch(gListID){case 1:url+="&sidebar=favorites";break;case 0:default:}
if(gBoundaryFlag){url+="&lotlines=on";}
url+="&date="+(now.getMonth()+1)+"/"+now.getDate()+"/"+now.getFullYear();url+=kMapAnchorName;return url;}
function getMarkedList(numbersOnly){var i;var r;var idList=[];if(typeof numbersOnly==="undefined"){numbersOnly=false;}
for(i=1;i<=gPropertyCount;i++){r=propertyDB[i];if(r.isMarked){idList.push(r.theMLSnumber);}}
idList=idList.join(",");if(idList!==""&&!numbersOnly){switch(gLastMarkCmd){case"all":if(idList==getAllList()){idList="all";}
break;}}
return idList;}
function getAllList(){var i;var r;var idList="";for(i=1;i<=gPropertyCount;i++){r=propertyDB[i];if(r.inFoundSet){idList+=r.theMLSnumber+",";}}
if(idList.length>0){idList=idList.substring(0,idList.length-1);}
return idList;}
function getFavoriteList(){var i;var r;var idList="";for(i=1;i<=gPropertyCount;i++){r=propertyDB[i];if(r.isMarked){idList+=r.theMLSnumber+",";}}
idList=idList.substring(0,idList.length-1);return idList;}
function getCenterOfProperties(idList){var i,j;var z;var cNew,zNew;var idArray;var idCount=0;var b=new google.maps.LatLngBounds();switch(idList){case"all":idList=getAllList();break;default:}
idArray=idList.split(",");for(i=0;i<idArray.length;i++){j=getIndexFromID(idArray[i]);if(j!=-1){b.extend(propertyDB[j].theMarker.getPosition());idCount++;}}
if(idCount==0){cNew=gMap.getCenter();zNew=gMap.getZoom();}else{cNew=b.getCenter();z=gMap.getZoom();gMap.fitBounds(b);zNew=gMap.getZoom();if(idCount==1){zNew-=2;}
if(zNew>17){zNew=17;}
gMap.setZoom(z);}
return{c:cNew,z:zNew,n:idCount};}
function showPropertyOnMapByID(theID){var i;if(theID!=""){i=getIndexFromID(theID);if(i!=-1){showPropertyOnMap(i);}}}
function showPropertyOnMap(i){gMap.setCenter(propertyDB[i].theMarker.getPosition());if(gMap.getZoom()<kShowPropertyZoomLevel){gMap.setZoom(kShowPropertyZoomLevel);}
showSidebar();showPropertyDetail2(propertyDB[i].theMarker.index);}
function getIndexFromID(theID){var i;var idIndex=-1;if(theID!=""){theID=theID.trim().toLowerCase();for(i=1;i<=gPropertyCount;i++){if(theID==propertyDB[i].theMLSnumber.toLowerCase()){idIndex=i;break;}}}
return idIndex;}
function showPropertyOnMapByKeyword(){var i;var idList;var czInfo,c,z,n;var qAbbrev;var theContent="";var keywordList=gMapFormLower.elements[kKeywordID].value;removeCircle();hideCustomArea();if((keywordList!=="")&&(keywordList!==kSearchNumberPrompt)){idList=setFoundProperties(keywordList);if(idList!=""){czInfo=getCenterOfProperties(idList);c=czInfo.c;z=czInfo.z;n=czInfo.n;if(n>0){gSearchQuery=keywordList;if(gSearchQuery.length>32){qAbbrev=gSearchQuery.substr(0,32)+"&hellip;";}else{qAbbrev=gSearchQuery;}
theContent+="<table><tr>";theContent+="<td>";theContent+="<i><b>"+qAbbrev+"</b></i> shown";theContent+="</td>";theContent+="<td>";theContent+="<img src='"+kDeleteURL+"' onclick='filterProperties();' style='cursor: pointer;' title=' Show all properties '>";theContent+="</td>";theContent+="</tr></table>";gSearchBox.innerHTML=theContent;gSearchBox.style.display="";gShowOnlyMarked=false;gMapFormLower.elements[kFavoritesOnlyCheckbox].checked=false;if(n==1){i=getIndexFromID(idList);showPropertyOnMap(i);}else{gMap.setZoom(z);gMap.setCenter(c);}
gTotalFound=n;showFoundList();}}}
gMapFormLower.elements[kKeywordID].style.color=kSearchNumberPromptColor;gMapFormLower.elements[kKeywordID].value=kSearchNumberPrompt;gMapFormLower.elements[kKeywordID].blur();}
function setFoundProperties(theKeyword){var i,j,k;var jStart;var keywordFound;var descPresent;var words;var keywordList;var mlsNumber,postalCode,streetAddress,features,description;var quoteActive,parenActive;var theKeywordEsc;var theChar;var idList="";var indices=[];theKeyword=theKeyword.toLowerCase();if(theKeyword!==""){for(i=1;i<=gPropertyCount;i++){quoteActive=false;parenActive=false;theKeywordEsc="";mlsNumber=propertyDB[i].theMLSnumber.toLowerCase();postalCode=propertyDB[i].thePostalCode.toLowerCase();streetAddress=propertyDB[i].theStreetAddress.toLowerCase();features=propertyDB[i].theFeatures.toLowerCase();description=propertyDB[i].theDescription.toLowerCase();keywordList=[];for(k=0;k<theKeyword.length;k++){theChar=theKeyword.charAt(k);if(theChar=='"'){quoteActive=!quoteActive;}else if(theChar=="("){parenActive=true;}else if(theChar==")"){parenActive=false;}else if(theChar==" "&&(quoteActive||parenActive)){theChar="%20";}
theKeywordEsc+=theChar;}
theKeyword=theKeywordEsc.replace(/\"/g,"");words=theKeyword.split(" ");for(k=0;k<words.length;k++){keywordList.push(words[k].replace(/%20/g," ").trim());}
keywordFound=true;for(k=0;k<keywordList.length;k++){if(keywordList[k].charAt(0)=="-"){if(kDontSearchDesc){descPresent=true;}else{descPresent=keywordPresent(keywordList[k],description);}
if(!keywordPresent(keywordList[k],mlsNumber)||!keywordPresent(keywordList[k],postalCode)||!keywordPresent(keywordList[k],streetAddress)||!keywordPresent(keywordList[k],features)||!descPresent){keywordFound=false;break;}}else{if(kDontSearchDesc){descPresent=false;}else{descPresent=keywordPresent(keywordList[k],description);}
if(!keywordPresent(keywordList[k],mlsNumber)&&!keywordPresent(keywordList[k],postalCode)&&!keywordPresent(keywordList[k],streetAddress)&&!keywordPresent(keywordList[k],features)&&!descPresent){keywordFound=false;break;}}}
if(keywordFound){idList+=mlsNumber+",";indices.push(i);propertyDB[i].inFoundSet=true;}}
idList=idList.substr(0,idList.length-1);if(indices.length>0){jStart=0;for(i=1;i<=gPropertyCount;i++){keywordFound=false;for(j=jStart;j<indices.length;j++){if(i==indices[j]){keywordFound=true;jStart=j+1;break;}}
if(!keywordFound){propertyDB[i].inFoundSet=false;}}}}
return idList;}
function keywordPresent(keyword,haystack){var i,k;var partialOK;var words;var endOfWord=" .!?,;:-+&'\"";var invertSearch=false;var result=false;if((keyword.charAt(0)=="(")&&(keyword.charAt(keyword.length-1)==")")){keyword=keyword.substr(1,keyword.length-2).trim();words=keyword.split(",");for(i=0;i<words.length;i++){words[i]=words[i].trim();if(keywordPresent(words[i],haystack)){result=true;break;}}
return result;}
if(keyword.charAt(0)=="-"){invertSearch=true;keyword=keyword.substr(1);}
if(keyword.charAt(keyword.length-1)=="*"){partialOK=true;keyword=keyword.substr(0,keyword.length-1);}else{partialOK=false;if(keyword.charAt(keyword.length-1)=="s"){keyword=keyword.substr(0,keyword.length-1);}}
k=haystack.indexOf(keyword);if(k!=-1){if(partialOK){if(k==0||endOfWord.indexOf(haystack.charAt(k-1))!=-1){result=true;}}else{if(k==0||endOfWord.indexOf(haystack.charAt(k-1))!=-1){if((k+keyword.length)==haystack.length||endOfWord.indexOf(haystack.charAt(k+keyword.length))!=-1||haystack.charAt(k+keyword.length)=="s"&&((k+keyword.length+1)==haystack.length||endOfWord.indexOf(haystack.charAt(k+keyword.length+1))!=-1)){result=true;}}}}
if(invertSearch){result=!result;}
return result;}
function getParameter(paramName,paramLine){if(typeof paramLine==="undefined"){paramLine=gParameters;}
var i;var paramList=paramLine.split("&");var paramValue="";paramName=paramName.toLowerCase();for(i=0;i<paramList.length;i++){if(paramList[i].toLowerCase().indexOf(paramName+"=")==0){paramValue=paramList[i].split("=");paramValue=paramValue[1];break;}}
return paramValue;}
function changeParameter(theCommand,paramName,newValue){var i;var paramPresent=false;var parameters=theCommand.split("&");var value="&"+paramName+"="+newValue;for(i=0;i<parameters.length;i++){if(parameters[i].toLowerCase().indexOf(paramName+"=")>-1){theCommand=theCommand.replace("&"+parameters[i],value);paramPresent=true;break;}}
if(!paramPresent){theCommand+=value;}
return theCommand;}
function showSpot(){var theIcon;var tt;landmarkDB[0].theMarker.setMap(null);theIcon=new google.maps.MarkerImage(kSpotURL);landmarkDB[0].theMarker=new google.maps.Marker({position:new google.maps.LatLng(gSpotLatitude,gSpotLongitude),icon:theIcon,clickable:true,visible:true});tt="<div id='"+kTooltipID+"'>";tt+="<b>"+gSpotDescription+"</b>";tt+="</div>";landmarkDB[0].theMarker.tooltip=tt;landmarkDB[0].inFoundSet=true;google.maps.event.addListener(landmarkDB[0].theMarker,"mouseover",function(){showTooltipLandmark(this);});google.maps.event.addListener(landmarkDB[0].theMarker,"mouseout",function(){gSummaryBox.hide();});landmarkDB[0].theMarker.setMap(gMap);}
function parseCommandLine(cmd){var i;var parmText,parmList;var areaCode;var dateA;var areaName;var areaPopup=gMapFormLower.elements[kTownFilter];var startLatitude=0;var startLongitude=0;gParameters=cmd;parmText=unescape(getParameter("zoom")).trim();if(parmText===""){gStartZoom=0;}else{gStartZoom=parseInt(parmText,10);}
if(gStartZoom===0){gStartZoom=kDefaultArea[3];}
parmText=unescape(getParameter("type")).trim().toLowerCase();switch(parmText){case"h":gStartType=kPropertyHouse;break;case"a":case"c":gStartType=kPropertyCondo;break;case"m":gStartType=kPropertyManufacturedHome;break;case"l":gStartType=kPropertyLot;break;case"all":default:gStartType=kPropertyAll;}
gStartTown=unescape(getParameter("town")||getParameter("area")).trim();if(gStartTown==""){gStartTown=kTownAll;}else{for(i=0;i<areaPopup.options.length;i++){if(gStartTown.toLowerCase()==areaPopup.options[i].value.toLowerCase()){gStartTown=areaPopup.options[i].value;break;}}}
parmText=unescape(getParameter("age")).trim();switch(parmText){case"":case"all":parmText=kAgeAll;break;case"today":parmText="0";break;case"week":parmText="7";break;case"recent":parmText="14";break;case"month":parmText="31";break;}
if(parmText===kAgeAll){gStartAge=kAgeAll;}else if(isNaN(parseInt(parmText,10))){gStartAge=kAgeAll;}else{gStartAge=parseInt(parmText,10);}
parmText=unescape(getParameter("mode")).trim().toLowerCase();switch(parmText){case"s":gStartMode=google.maps.MapTypeId.SATELLITE;break;case"t":gStartMode=google.maps.MapTypeId.TERRAIN;break;case"r":gStartMode=google.maps.MapTypeId.ROADMAP;break;case"h":gStartMode=google.maps.MapTypeId.HYBRID;break;default:gStartMode=google.maps.MapTypeId.ROADMAP;}
parmText=unescape(getParameter("favonly")).trim();gShowOnlyMarked=false;if(parmText=="on"){gShowOnlyMarked=true;}
parmText=unescape(getParameter("tour")).trim();gStartSlideShow=false;if(parmText=="on"){gStartSlideShow=true;}
parmText=unescape(getParameter("tourtime")).trim();gAnimationInterval=kAnimationIntervalDefault;if(parmText!==""){gAnimationInterval=parseInt(parmText,10);}
if(gAnimationInterval<kAnimationIntervalMinimum){gAnimationInterval=kAnimationIntervalMinimum;}
if(gAnimationInterval>kAnimationIntervalMaximum){gAnimationInterval=kAnimationIntervalMaximum;}
gMinPrice=unescape(getParameter("minprice")).trim();if(gMinPrice===""){gMinPrice=kPriceLowDefault;}
gMaxPrice=unescape(getParameter("maxprice")).trim();if(gMaxPrice===""){gMaxPrice=kPriceHighDefault;}
gMinBedrooms=unescape(getParameter("minbeds")).trim();if(gMinBedrooms===""){gMinBedrooms=kBedroomsAll;}
gMinBathrooms=unescape(getParameter("minbaths")).trim();if(gMinBathrooms===""){gMinBathrooms=kBathroomsAll;}
gStartID=unescape(getParameter("id")).trim();gFavoritesList=unescape(getParameter("favorites")||getParameter("favourites"));parmText=unescape(getParameter("center")||getParameter("centre"));if(parmText!==""){parmList=parmText.split(",");if(parmList.length==2){startLatitude=parseFloat(parmList[0].trim(),10);startLongitude=parseFloat(parmList[1].trim(),10);}}
parmText=unescape(getParameter("x"));gSpotLatitude=0;gSpotLongitude=0;gSpotDescription="";if(parmText!==""){parmList=parmText.split(",");if(parmList.length>=2){gSpotLatitude=parseFloat(parmList[0].trim(),10);gSpotLongitude=parseFloat(parmList[1].trim(),10);if(parmList.length>=3){gSpotDescription=parmList[2].trim();}}}
gStartAgent=unescape(getParameter("agent")).trim().toLowerCase();gStartAgentSell=unescape(getParameter("sagent")).trim().toLowerCase();gStartBrokerage=unescape(getParameter("brokerage")).trim().toLowerCase();gStartBrokerageSell=unescape(getParameter("sbrokerage")).trim().toLowerCase();gStartMinLotSize=unescape(getParameter("minlotsize")).trim().toLowerCase();if(gStartMinLotSize==""){gStartMinLotSize=kLotSizesAll;}
gStartMaxLotSize=unescape(getParameter("maxlotsize")).trim().toLowerCase();if(gStartMaxLotSize==""){gStartMaxLotSize=kLotSizesAll;}
gStartMinHouseSize=unescape(getParameter("minhousesize")).trim().toLowerCase();if(gStartMinHouseSize==""){gStartMinHouseSize=kHouseSizesAll;}
gStartMaxHouseSize=unescape(getParameter("maxhousesize")).trim().toLowerCase();if(gStartMaxHouseSize==""){gStartMaxHouseSize=kHouseSizesAll;}
gStartServices=unescape(getParameter("poi")).trim().toLowerCase();gStartFeatures=unescape(getParameter("features")).trim().toLowerCase();gSearchQuery=unescape(getParameter("q")).trim().toLowerCase();parmText=unescape(getParameter("sidebar"));switch(parmText){case"favorites":case"favourites":gListID=1;break;case"found":default:gListID=0;}
gLastSearchDate=unescape(getParameter("date")).trim();if(gLastSearchDate===""){gLastSearchDate=new Date();gLastSearchDate.setHours(0);gLastSearchDate.setMinutes(0);gLastSearchDate.setSeconds(0);gLastSearchDate.setMilliseconds(0);}else{dateA=gLastSearchDate.split("/",3);gLastSearchDate=new Date(dateA[2],dateA[0]-1,dateA[1]);}
if((startLatitude==0)&&(startLongitude==0)){if(gStartID===""&&!(gSpotLatitude==0&&gSpotLongitude==0)){gStartCoordinates=new google.maps.LatLng(gSpotLatitude,gSpotLongitude);}else{gStartCoordinates=gDefaultLocation;}}else{gStartCoordinates=new google.maps.LatLng(startLatitude,startLongitude);}}
function invokeCommandLine(){var i;var czInfo;var foundTown=false;var h="";var areaPopup=gMapFormLower.elements[kTownFilter];try{gMapFormUpper.elements[kRegionSelect].selectedIndex=0;}catch(e1){}
gMapFormLower.elements[kAnimationIntervalField].value=gAnimationInterval;gMapFormLower.elements[kCategoryFilter].value=gStartType;gStartType=gMapFormLower.elements[kCategoryFilter].value;if(gStartTown.indexOf(":")!==-1){for(i=0;i<areaPopup.options.length;i++){if(gStartTown==areaPopup.options[i].value){foundTown=true;break;}}
if(!foundTown){areaPopup.options[areaPopup.options.length]=new Option(gStartTown.substr(0,gStartTown.indexOf(":")),gStartTown);}}
try{gMapFormLower.elements[kTownFilter].value=gStartTown;gStartTown=gMapFormLower.elements[kTownFilter].value;}catch(e2){}
gMapFormLower.elements[kAgeFilter].value=gStartAge;gStartAge=gMapFormLower.elements[kAgeFilter].value;try{gMapFormLower.elements[kMinLotSizeFilter].value=gStartMinLotSize;gStartMinLotSize=gMapFormLower.elements[kMinLotSizeFilter].value;}catch(e3){}
try{gMapFormLower.elements[kMaxLotSizeFilter].value=gStartMaxLotSize;gStartMaxLotSize=gMapFormLower.elements[kMaxLotSizeFilter].value;}catch(e4){}
try{gMapFormLower.elements[kMinHouseSizeFilter].value=gStartMinHouseSize;gStartMinHouseSize=gMapFormLower.elements[kMinHouseSizeFilter].value;}catch(e5){}
try{gMapFormLower.elements[kMaxHouseSizeFilter].value=gStartMaxHouseSize;gStartMaxHouseSize=gMapFormLower.elements[kMaxHouseSizeFilter].value;}catch(e6){}
gMapFormLower.elements[kLowPriceFilter].value=gMinPrice;gMinPrice=gMapFormLower.elements[kLowPriceFilter].value;gMapFormLower.elements[kHighPriceFilter].value=gMaxPrice;gMaxPrice=gMapFormLower.elements[kHighPriceFilter].value;try{gMapFormLower.elements[kBedroomsFilter].value=gMinBedrooms;gMinBedrooms=gMapFormLower.elements[kBedroomsFilter].value;}catch(e7){}
try{gMapFormLower.elements[kBathroomsFilter].value=gMinBathrooms;gMinBathrooms=gMapFormLower.elements[kBathroomsFilter];}catch(e8){}
gMapFormLower.elements[kFavoritesOnlyCheckbox].checked=gShowOnlyMarked;resetLandmarks();setLandmarks(gStartServices);resetFeatures();setFeatures(gStartFeatures);applyFilters(gMinPrice,gMaxPrice,gStartType,gStartTown,gStartAge,gStartAgent,gStartBrokerage,gStartAgentSell,gStartBrokerageSell,gStartMinLotSize,gStartMaxLotSize,gStartMinHouseSize,gStartMaxHouseSize,gMinBedrooms,gMinBathrooms,gMapFormLower.elements[kWaterfrontBox].checked,gMapFormLower.elements[kViewBox].checked,gMapFormLower.elements[kFireplaceBox].checked,gMapFormLower.elements[kTubBox].checked,gMapFormLower.elements[kPoolBox].checked,gMapFormLower.elements[kSecurityBox].checked,gMapFormLower.elements[kWorkshopBox].checked,gLastSearchDate,false);hideDialogBox();markPropertiesByID(gFavoritesList);markPropertiesByID(gStartID);refreshMap();if(gFavoritesList!==""&&gStartID===""&&gStartCoordinates==gDefaultLocation){czInfo=getCenterOfProperties(gFavoritesList);gStartCoordinates=czInfo.c;if(gStartZoom==kDefaultArea[3]){gStartZoom=czInfo.z;}}
gMap.setOptions({center:gStartCoordinates,zoom:gStartZoom,mapTypeId:gStartMode});if(gStartID!==""){i=getIndexFromID(gStartID);if(i!=-1){showPropertyOnMap(i);showPropertyDetail(i);}}
if(!(gSpotLatitude==0&&gSpotLongitude==0)){showSpot();}
if(gSearchQuery!=""){gMapFormLower.elements[kKeywordID].value=gSearchQuery;showPropertyOnMapByKeyword();}
if(gStartSlideShow){animationOn();}
gActiveDetail=0;}
function resetFeatures(){gMapFormLower.elements[kWaterfrontBox].checked=false;gMapFormLower.elements[kViewBox].checked=false;gMapFormLower.elements[kFireplaceBox].checked=false;gMapFormLower.elements[kTubBox].checked=false;gMapFormLower.elements[kPoolBox].checked=false;gMapFormLower.elements[kSecurityBox].checked=false;gMapFormLower.elements[kWorkshopBox].checked=false;}
function setFeatures(featureList){var i;var s;s=featureList.split(",");if(s.length>0){for(i=0;i<s.length;i++){switch(s[i].trim()){case"waterfront":gMapFormLower.elements[kWaterfrontBox].checked=true;break;case"view":gMapFormLower.elements[kViewBox].checked=true;break;case"fireplace":gMapFormLower.elements[kFireplaceBox].checked=true;break;case"tub":gMapFormLower.elements[kTubBox].checked=true;break;case"pool":gMapFormLower.elements[kPoolBox].checked=true;break;case"security":gMapFormLower.elements[kSecurityBox].checked=true;break;case"workshop":gMapFormLower.elements[kWorkshopBox].checked=true;break;default:}}}}
function getFeatureList(){var featureList=[];if(gMapFormLower.elements[kWaterfrontBox].checked){featureList.push("waterfront");}
if(gMapFormLower.elements[kViewBox].checked){featureList.push("view");}
if(gMapFormLower.elements[kFireplaceBox].checked){featureList.push("fireplace");}
if(gMapFormLower.elements[kTubBox].checked){featureList.push("tub");}
if(gMapFormLower.elements[kPoolBox].checked){featureList.push("pool");}
if(gMapFormLower.elements[kSecurityBox].checked){featureList.push("security");}
if(gMapFormLower.elements[kWorkshopBox].checked){featureList.push("workshop");}
return featureList.join(",");}
function formatPrice(thePrice){var numString;var fmtString;numString=""+Math.round(1000*thePrice);fmtString="";while(numString.length>3){fmtString=","+numString.substr(numString.length-3,3)+fmtString;numString=numString.substr(0,numString.length-3);}
fmtString=numString+fmtString;return"$"+fmtString;}
function formatNumber(theNumber){var numString;var fmtString;numString=""+theNumber;fmtString="";while(numString.length>3){fmtString=","+numString.substr(numString.length-3,3)+fmtString;numString=numString.substr(0,numString.length-3);}
fmtString=numString+fmtString;return fmtString;}
function getTooltip(i,count,n){var theTip="";var r=propertyDB[i];var mlsNumber=r.theMLSnumber;var price=r.thePrice;var priceTrend=r.thePriceTrend;var bedroomCount=r.theBedroomCount;var bathroomCount=r.theBathroomCount;var houseSize=r.theHouseSize;var lotSizeAcres=r.theLotSizeAcres;var houseAge=r.theHouseAge;var streetAddress=r.theStreetAddress;var brokerage=r.theBrokerage;var pictureCount=r.thePictureCount;var pictureList=r.thePictureList;var propertyCategory=r.thePropertyCategory;var DOM=r.DOMactual;var soldDate=r.theSoldDate;var priceOld=r.thePriceOld;var realtor=r.theRealtor;var landArea=r.theLandArea;theTip+="<div id='"+kTooltipID+"'>";theTip+="<img style='position: absolute; bottom: 2px; left: 2px; z-index: 2;' src='"+kMLSRiconSmallURL+"'>";theTip+="<table style='width: 100%; text-align: center;'><tr>";theTip+="<td align='center' width='"+kPictureWidthSummary+"' valign='top'>";if(pictureCount>0){theTip+="<div style='position: relative;'>";theTip+="<img id='"+kPicSummaryID+"' src='"+pictureList.split(" ")[0]+"' width='"+kPictureWidthSummary+"'>";theTip+="<div class='"+kOverlayClass+"' id='tipPhotoCount'>";theTip+="1 of "+pictureCount;theTip+="</div>";if(soldDate!==""){theTip+="<div class='"+kOverlayClass2+"'>"+"<img src='"+kSoldSashURL+"'>"+"</div>";}else if(DOM<=kRecentListingMaxAge){theTip+="<div class='"+kOverlayClass2+"'>"+"<img src='"+kNewSashURL+"'>"+"</div>";}else if(propertyIsFeatured(i)){theTip+="<div class='"+kOverlayClass2+"'>"+"<img src='"+kFeaturedSashURL+"'>"+"</div>";}
theTip+="</div>";}
theTip+="<td>";theTip+="<span style='font-weight: bold; font-size: 12pt; color: green;'>"+formatPrice(price)+priceTrend+"</span>";if(soldDate!=""){theTip+=" ("+kMonthNamesAbbrev[soldDate.getMonth()]+" "+soldDate.getDate()+", "+soldDate.getFullYear()+")";}else if(priceOld!=0){theTip+=" <span style='color: red; text-decoration: line-through;'>"+formatPrice(priceOld)+"</span>";}
theTip+="<br>";if(propertyCategory=="Lot"){theTip+="Vacant Lot";theTip+="<br>";if(lotSizeAcres>0){theTip+=lotSizeAcres+" ac";theTip+="<br>";}}else{if(bedroomCount>0||bathroomCount>0){if(bedroomCount>0){theTip+=bedroomCount+" bedroom"+(bedroomCount==1?"":"s");}
if(bathroomCount>0){if(bedroomCount>0){theTip+=" / ";}
theTip+=Math.floor(bathroomCount)+(bathroomCount==Math.floor(bathroomCount)?"":"&frac12;");theTip+=" bathroom"+(bathroomCount==1?"":"s");}
theTip+="<br>";}
if(houseSize>0){theTip+=formatNumber(houseSize)+" sf";}
if(lotSizeAcres>0){if(houseSize>0){theTip+=" / ";}
theTip+=lotSizeAcres+" ac";}
if(parseInt(houseAge,10)>0){houseAge+=" yr"+(parseInt(houseAge,10)==1?"":"s");}
if(houseAge=="Old Timer"){houseAge="Old";}
if(houseAge!=""){if(houseSize>0||lotSizeAcres>0){theTip+=" / ";}
theTip+=houseAge;}
theTip+="<br>";}
theTip+="<span style='color: red; font-weight: bold;'>"+streetAddress+"</span>";theTip+="<br>";theTip+=DOM+" day"+(DOM==1?"":"s")+" on market";theTip+="<br>";theTip+=mlsNumber;theTip+="<br>";if(gShowRealtorName==0){theTip+=brokerage.replace(/\'/g,"&#146;");}else{theTip+=realtor.replace(/\'/g,"&#146;");}
theTip+="<tr><td colspan=2>";if(count>1){theTip+="<b>("+count+" properties located here &mdash; #"+(n+1)+" shown)"+"</b>";}
theTip+="<div>Click the property marker to see more detail.</div>";if(landArea>0&&(gUserName.toLowerCase()==kAgentEmail.toLowerCase())){theTip+="<div>[ Calculated lot area: "+(landArea/kSquareMetersPerAcre).toFixed(2)+" ac ]</div>";}
theTip+="</table>";theTip+="</div>";return theTip;}
function propertyIsFeatured(i){var isFeatured=false;var listingAgent=propertyDB[i].theRealtor.toLowerCase();var agents=kAgentNameOthers.toLowerCase().split(",");var key;for(key in agents){if(agents.hasOwnProperty(key)){agents[key]=agents[key].trim();}}
if(listingAgent==kAgentName.toLowerCase()){isFeatured=true;}else if(in_array(listingAgent,agents)){isFeatured=true;}
return isFeatured;}
function highlightPropertyList(i){if(gLastListItem>0){try{document.getElementById(kItemRowID+gLastListItem).style.backgroundColor=kListOffColor;}catch(e1){}}
try{document.getElementById(kItemRowID+i).style.backgroundColor=kListOnColor;}catch(e2){}
gLastListItem=i;}
function showPropertyDetail(i){var r="";hideDialogBox();if(!gSuppressMultiples){r=getMultipleDetail(i);}
if(r==""){showPropertyDetail2(i);}else{r=getTitleBar()+r;showInfoPanel();setInfoPanelContent(r);bounceStart(propertyDB[i].theMarker);}}
function showPropertyDetail2(i){var r=getTitleBar()+getPropertyDetail(i);showInfoPanel();setInfoPanelContent(r);displayPanoButton(i);displayReferralInfo(i);gInfoRef=setTimeout("swapPicInfo("+i+")",kPictureInterval*1000);bounceStart(propertyDB[i].theMarker);logPropertyClick(i);}
function displayReferralInfo(i){if(!kShowSheetBranding){if(propertyDB[i].theBrokerage.toLowerCase()==kAgentBrokerageName.toLowerCase()){getAgentReferral(propertyDB[i].theRealtor);}else{getAgentReferral("");}}}
function getAgentReferral(agent){try{var parms="f="+escape(kAgentReferralDB)+"&a="+escape(agent);var req=new XMLHttpRequest();req.open("POST",kAgentReferralURL,true);req.onreadystatechange=function(message,errorCode){var info;if(req.readyState==4){if(req.status==200||req.status==0){info=req.responseText;if(info!=""){info=info.split("\t");kAgentName=info[0];kAgentEmail=info[1];kAgentPhone=info[2];kAgentPhotoURL=info[3];document.getElementById("referPic").innerHTML="<img src='"+kAgentPhotoURL+"'>";if(agent==""){document.getElementById("referInfo").innerHTML="<b>Contact "+kAgentName+" <span style='font-variant: small-caps;'>realtor</span><br>"+kAgentPhone+"</b>";}}}}};req.setRequestHeader("Content-Type","application/x-www-form-urlencoded");req.send(parms);}catch(e){}}
function getMultipleDetail(iClick){var r="";var i,iSorted;var c,cOther;var p;var condo;var bbHTML,bathHTML;var bathCount;var count=0;try{c=propertyDB[iClick].theMarker.getPosition();condo=propertyDB[iClick].theCondoName;for(i=1;i<=gPropertyCount;i++){if(gSortOrder==0){iSorted=i;}else{iSorted=gPropertyCount+1-i;}
if(propertyDB[iSorted].inFoundSet){if(!gShowOnlyMarked||(gShowOnlyMarked&&propertyDB[iSorted].isMarked)){try{cOther=propertyDB[iSorted].theMarker.getPosition();}catch(e2){continue;}
if(c.equals(cOther)){r+="<li>";r+="<a href='javascript:void(0)' onclick='showPropertyDetail2("+iSorted+");' onmouseover='doMouseOver("+iSorted+");' onmouseout='doMouseOut("+iSorted+");'>";r+=propertyDB[iSorted].theStreetAddress;bbHTML="";if(propertyDB[iSorted].thePropertyCategory=="Lot"){if(propertyDB[iSorted].theLotSizeAcres>0){bbHTML=propertyDB[iSorted].theLotSizeAcres+" ac.";}}else{if(propertyDB[iSorted].theBedroomCount==0){bbHTML="?";}else{bbHTML=propertyDB[iSorted].theBedroomCount;}
bbHTML+=" Bd";bathCount=propertyDB[iSorted].theBathroomCount;if(bathCount==0){bathHTML="?";}else{bathHTML=""+Math.floor(bathCount);if(bathCount!=Math.floor(bathCount)){bathHTML+="&frac12;";}}
bathHTML+=" Ba";bbHTML+=" / "+bathHTML;}
if(bbHTML!=""){r+=" &mdash; "+bbHTML;}
r+=" &mdash; "+formatPrice(propertyDB[iSorted].thePrice)+propertyDB[iSorted].thePriceTrend;r+="</a>";count++;}}}}}catch(e){}
if(count>1){p="<div id='"+kDetailBodyID+"'>";if(condo!==""){p+="<center>";p+="<div id='"+kPanelHeadingID+"'>";p+=condo+"<br>";p+=parseCondoAddress(propertyDB[iClick].theStreetAddress)+"<br>";p+=propertyDB[iClick].theTown;p+="</div>";p+="</center>";p+="<div style='height: 8px;'></div>";}
p+="These properties are all found at this location:";r=p+"<ul>"+r+"</ul>";r+="Click the property of interest in this list to see detailed information about it.";r+="</div>";}else{r="";}
return r;}
function parseCondoAddress(condoAddress){var i,iStart,info;var streetAddress=condoAddress;info=condoAddress.split(" ");if(info.length>2){if(info[0]=="#"){switch(info[1]){case"LT":case"LOT":case"BLK":case"BLOCK":case"SL":case"TH":case"PH":case"UNIT":case"BAY":iStart=3;break;default:iStart=2;}
streetAddress="";for(i=iStart;i<info.length;i++){streetAddress+=info[i]+" ";}
streetAddress=streetAddress.substring(0,streetAddress.length-1);}}
return streetAddress;}
function getPropertyDetail(i){var j,k;var r;var bathHTML;var fullAddress;var dateA;var iconOrigin;var ratio;var streetAddress;var town;var city;var postalCode;var condoName;var price;var priceAsking;var bedroomCount;var bathroomCount;var houseAge;var houseSize;var lotSize;var lotFrontage;var lotDepth;var taxes;var taxesYear;var realtorURL;var DOM;var soldDate;var realtor;var realtorPhone;var realtorEmail;var brokerage;var description;var notes;var features;var basement;var pictureCount;var propertyCategory;var propertyStyle;var mlsNumber;var virtualTour;var renovations;var levels;var finished;var unfinished;var construction;var foundation;var flooring;var exterior;var strataFee;var padRental;var strataRules;var suite;var exposure;var fireplace;var parking;var parkingAccess;var outdoor;var roof;var heating;var water;var sewer;var zoning;var rooms,bathrooms,roomInfo;var assessLand,assessBldg;var cable;var gas;var electricity;var telephone;var storm;var fencing;var access;var alr;var flood;var restrictions;var sellingAgent;var sellingBrokerage;var pricePerSqFt;var picArray;gActiveDetail=i;streetAddress=propertyDB[i].theStreetAddress;town=propertyDB[i].theTown;city=propertyDB[i].theCity;postalCode=propertyDB[i].thePostalCode;condoName=propertyDB[i].theCondoName;price=formatPrice(propertyDB[i].thePrice)+propertyDB[i].thePriceTrend;priceAsking=formatPrice(propertyDB[i].thePriceAsking);bedroomCount=propertyDB[i].theBedroomCount;bathroomCount=propertyDB[i].theBathroomCount;houseAge=propertyDB[i].theHouseAge;houseSize=propertyDB[i].theHouseSize;lotSize=propertyDB[i].theLotSize;lotFrontage=propertyDB[i].theLotFrontage;lotDepth=propertyDB[i].theLotDepth;taxes=propertyDB[i].theTaxes;taxesYear=propertyDB[i].theTaxesYear;realtorURL=propertyDB[i].theRealtorURL;DOM=propertyDB[i].DOMactual;soldDate=propertyDB[i].theSoldDate;realtor=propertyDB[i].theRealtor;realtorPhone=propertyDB[i].theRealtorPhone;realtorEmail=propertyDB[i].theRealtorEmail;brokerage=propertyDB[i].theBrokerage;description=propertyDB[i].theDescription;notes=propertyDB[i].theNotes;notesLoaded=propertyDB[i].notesLoaded;features=propertyDB[i].theFeatures;basement=propertyDB[i].theBasement;pictureCount=propertyDB[i].thePictureCount;propertyCategory=propertyDB[i].thePropertyCategory;if(propertyCategory=="Lot"){propertyCategory="Vacant Lot";}
propertyStyle=propertyDB[i].thePropertyStyle;mlsNumber=propertyDB[i].theMLSnumber;virtualTour=propertyDB[i].theVirtualTour;renovations=propertyDB[i].theRenovations;levels=propertyDB[i].theLevels;finished=propertyDB[i].theFinished;unfinished=propertyDB[i].theUnfinished;construction=propertyDB[i].theConstruction;foundation=propertyDB[i].theFoundation;flooring=propertyDB[i].theFlooring;exterior=propertyDB[i].theExterior;strataFee=propertyDB[i].theStrataFee;padRental=propertyDB[i].thePadRental;strataRules=propertyDB[i].theStrataRules;suite=propertyDB[i].theSuite;exposure=propertyDB[i].theExposure;parking=propertyDB[i].theParking;parkingAccess=propertyDB[i].theParkingAccess;outdoor=propertyDB[i].theOutdoor;fireplace=propertyDB[i].theFireplace;roof=propertyDB[i].theRoof;heating=propertyDB[i].theHeating;water=propertyDB[i].theWater;sewer=propertyDB[i].theSewer;zoning=propertyDB[i].theZoning;rooms=propertyDB[i].theRooms;bathrooms=propertyDB[i].theBathrooms;assessLand=propertyDB[i].theAssessLand;assessBldg=propertyDB[i].theAssessBldg;cable=propertyDB[i].theCable;gas=propertyDB[i].theGas;electricity=propertyDB[i].theElectricity;telephone=propertyDB[i].theTelephone;storm=propertyDB[i].theStorm;fencing=propertyDB[i].theFencing;access=propertyDB[i].theAccess;alr=propertyDB[i].theALR;flood=propertyDB[i].theFlood;restrictions=propertyDB[i].theRestrictions;sellingAgent=propertyDB[i].theSellingAgent;sellingBrokerage=propertyDB[i].theSellingBrokerage;picArray=propertyDB[i].thePictureList.split(" ");fullAddress="";fullAddress+="<b>"+streetAddress+"</b><br>";if(condoName!=""&&(condoName.toLowerCase()!=town.toLowerCase())){fullAddress+="<b>"+condoName+"</b><br>";}
fullAddress+=town;if(city!==""&&city!=town){fullAddress+="<br><span style='font-size: 14pt;'>("+city;if(postalCode!=""){fullAddress+=" <span style='font-size: 10pt;'>"+postalCode+"</span>";}
fullAddress+=")</span>";}else{if(postalCode!=""){fullAddress+=" <span style='font-size: 10pt;'>("+postalCode+")</span>";}}
r="";r+="<div onmouseover='doMouseOver("+i+");' onmouseout='doMouseOut("+i+");'>";r+="<div id='"+kDetailBodyID+"'>";r+="<div style='padding-right: 8px;'>";r+="<div id='"+kPanelHeadingID+"'>"+fullAddress+"</div>";r+="<form>";r+="<table width='100%'><tr>";r+="<td align=left><input value='";r+="Photo Gallery ("+pictureCount+")' ";r+="type=button onclick='showPhotoArray("+i+");' style='display: ";if(pictureCount==0){r+="none";}
r+=";'>";r+="<td align=center><input value='Print/Email Brochure' type=button onclick='showDataSheet("+i+", 0);'> ";r+="<td><input value='Watch' type=button onclick='requestWatch(\""+mlsNumber+"\");'> ";r+="<td align=right><input value='Directions' type=button onclick='showDirections("+i+");'> ";r+="</table>";r+="</form>";r+="<hr style='margin-top: 0px;'>";if(brokerage.toLowerCase()==kAgentBrokerageName.toLowerCase()){r+="<img src='"+kAgentBrokerageLogoBigURL+"' align=right>";}else{r+="<img src='"+kMLSRiconURL+"' align=right>";}
r+="<form id='"+kDetailFormID+"'>";r+="<table style='font-size: 10pt;'><tr><td style='cursor: pointer;' onclick='doMouseClick("+i+");' title=' Show on map ' align=center>";r+=getIconURL(propertyDB[i].thePropType,propertyDB[i].DOM,propertyDB[i].DOMprice,propertyDB[i].theSoldDate,false,true);r+="<td valign=top><input type='checkbox' name='"+kMarkName+"'";r+=propertyDB[i].isMarked?" checked":"";r+=" onclick='markToggle("+i+");'>Favourite";r+=" <input id='"+kStreetViewButtonID+"' type='button' value='Street View' onclick = 'showPano("+i+");'>";r+=" <input type='button' value='Find Similar' onclick = 'findSimilar("+i+");' title=' Properties within 2 km; price +/- 15%; house size +/- 15%; beds +/- 1; baths +/- 1 '>";r+=" <img id='eye"+mlsNumber+"' src='"+kEyeURL+"' style='cursor: pointer; visibility: "+(propertyDB[i].watched?"visible":"hidden")+";' title=' Stop receiving emails when price changes ' onclick='stopWatching(\""+mlsNumber+"\");'>";r+="</table>";r+="</form>";r+="<span style='font-size: 16pt; font-weight: bold; color: green;'>"+price+"</span>";if(propertyDB[i].thePriceOld!=0){r+=" <span style='font-size: 10pt; color: red; text-decoration: line-through;'>"+formatPrice(propertyDB[i].thePriceOld)+"</span>";}
if(soldDate!==""){r+=" <span style='color: red; font-weight: bold;'>Sold ";r+=kMonthNames[soldDate.getMonth()]+" "+soldDate.getDate()+", "+soldDate.getFullYear();r+="</span>";}
r+="<br clear=right>";r+="<table width='100%' style='font-size: 10pt;'>";r+="<tr><td align=center valign=top width='"+kPictureWidthDetail+"'>";if(pictureCount>0){r+="<table><tr><td>";r+="<div style='position: relative; cursor: pointer;' title=' Show next picture ' onclick='showNextPicture2("+i+");'>";r+="<img src='"+picArray[0]+"' width='"+kPictureWidthDetail+"' id='"+mlsNumber+"-1'>";r+="<div class='"+kOverlayClass+"' id='"+mlsNumber+"'>";r+="1 of "+pictureCount;r+="</div>";if(soldDate!==""){r+="<div class='"+kOverlayClass2+"'>"+"<img src='"+kSoldSashURL+"'>"+"</div>";}else if(DOM<=kRecentListingMaxAge){r+="<div class='"+kOverlayClass2+"'>"+"<img src='"+kNewSashURL+"'>"+"</div>";}else if(propertyIsFeatured(i)){r+="<div class='"+kOverlayClass2+"'>"+"<img src='"+kFeaturedSashURL+"'>"+"</div>";}
r+="</div>";r+="</table>";}
r+="<span onclick='mlsGoOne("+i+");'>"+mlsNumber+"</span>";r+="</td>";r+="<td valign=top>";r+="<table border=1 width='100%' style='font-size: 8pt;'>";r+="<tr align=center><td colspan=2>"+propertyCategory;if(propertyStyle!="NA"&&propertyStyle!==""){r+=" / "+propertyStyle;}
if(bedroomCount>0||bathroomCount>0){r+="<tr align=center><td colspan=2>";}
if(bedroomCount>0){r+=bedroomCount+" bedroom";if(bedroomCount!=1){r+="s";}
if(bathroomCount>0){r+=" / ";}}
if(bathroomCount>0){bathHTML=""+Math.floor(bathroomCount);if(bathroomCount!=Math.floor(bathroomCount)){bathHTML+="&frac12;";}
r+=bathHTML+" bathroom";if(bathroomCount!=1){r+="s";}}
if(soldDate!==""){r+="<tr><td><b>Asking Price</b><td align=right>"+priceAsking;}
if(houseSize>0){r+="<tr><td><b>Size of Home</b><td align=right>"+formatNumber(houseSize)+" sq.ft.";}
if(houseSize>0){r+="<tr><td><b>$/sqft</b><td align=right>";r+="$"+formatNumber(parseInt(propertyDB[i].thePrice*1000/houseSize,10));}
if(basement!==""){r+="<tr><td><b>Basement</b><td align=right>"+basement;}
if(lotSize!==""&&lotSize!="0"&&lotSize!="NA"){r+="<tr><td><b>Lot Size</b><td align=right>"+lotSize;}
if(lotFrontage!==""&&lotFrontage!="0"&&lotFrontage.toLowerCase()!="not available"){r+="<tr><td><b>Lot Frontage</b><td align=right>"+lotFrontage;}
if(lotDepth!==""&&lotDepth!="0"&&lotDepth.toLowerCase()!="not available"){r+="<tr><td><b>Lot Depth</b><td align=right>"+lotDepth;}
if(houseAge!==""){if(houseAge=="0"){houseAge="New";}
r+="<tr><td><b>Age of Home</b><td align=right>"+houseAge;houseAge=parseInt(houseAge,10);if(houseAge>0){r+=" year"+(houseAge==1?"":"s");}}
if(taxes>0){r+="<tr><td><b>Taxes</b><td align=right>"+formatPrice(taxes/1000);if(taxesYear!==""){r+=" ("+taxesYear+")";}}
r+="<tr><td><b>Days on market</b><td align=right>";if(DOM==0&&soldDate==""){r+="new today";}else{r+=DOM;}
if((realtor.toLowerCase()==kAgentName.toLowerCase()||gShowRealtorName>0||(!kShowSheetBranding&&(brokerage.toLowerCase()==kAgentBrokerageName.toLowerCase())))&&virtualTour!==""){r+="<tr align=center><td colspan=2>";r+="<a href='"+virtualTour+"' target=_'blank'>"+"Virtual Tour"+"</a>";}
r+="<tr align=center><td colspan=2>";r+="<span onclick='if (gOptionKeyDown && gUserName.toLowerCase() == kAgentEmail.toLowerCase()) { gShowRealtorName=((gShowRealtorName == 0) ? 1 : 0); showFavoritesList(); showPropertyDetail2("+i+"); return false; }'>";r+=brokerage.replace(/\'/g,"&#146;");if(gShowRealtorName>0||(!kShowSheetBranding&&(brokerage.toLowerCase()==kAgentBrokerageName.toLowerCase()))){r+="<br>";if(realtorEmail==""){r+=realtor.replace(/\'/g,"&#146;");}else{r+="<a href='mailto:"+realtorEmail+"?subject="+escape("Re: "+streetAddress+" property")+"'>";r+=realtor.replace(/\'/g,"&#146;");r+="</a>";}
r+="<br>"+realtorPhone;if(realtorURL!=""){r+="<br><a href='http://"+realtorURL+"' target='_blank'>"+realtorURL+"</a>";}}
if(sellingBrokerage!=""){r+="<br>"+sellingBrokerage.replace(/\'/g,"&#146;")+" [Sale]";if(gShowRealtorName>0||(!kShowSheetBranding&&(brokerage.toLowerCase()==kAgentBrokerageName.toLowerCase()))){r+="<br>"+sellingAgent.replace(/\'/g,"&#146;");}}
r+="</span>";if(realtor.toLowerCase()==kAgentName.toLowerCase()){r+="<br><b>";r+=kAgentName+" "+kAgentPhone;r+="</b>";}
r+="</table>";r+="</td></tr></table>";r+="<hr>";r+="<div style='text-align: justify;'>"+description+"</div>";if(features!==""){r+="<hr>";r+="<i>"+features+"</i>";}
r+="<hr>";if(propertyCategory=="Vacant Lot"){r+="<b>More Information</b>";}else{r+="<b>Room Information &amp; More</b>";}
if(gUserName==""&&(brokerage.toLowerCase()!=kAgentBrokerageName.toLowerCase())){r+=" (<a href='javascript:void(0);' onclick='showLoginBox();'>Log In</a> required to view)";r+="<div style='display: none;'>";}else{r+="<div style='border: 1px solid black; background-color: silver; padding: 2px;'>";}
if(rooms.length>0||bathrooms.length>0){r+="<table width='100%' style='font-size: 8pt;'>";for(j=0;j<rooms.length;j++){if(rooms[j]!=""){r+="<tr>";roomInfo=rooms[j].split("/");r+="<td>"+roomInfo[0];r+="<td align=center>"+roomInfo[1];r+="<td align=right>"+roomInfo[2];}}
r+="<tr><td colspan=3><hr style='margin: 0px;'>";for(j=0;j<bathrooms.length;j++){if(bathrooms[j]!=""){r+="<tr>";roomInfo=bathrooms[j].split("/");r+="<td>Bathroom";if(roomInfo[1]=="Y"){r+=" (ensuite)";}
r+="<td align=center>"+roomInfo[0]+" pieces";r+="<td align=right>"+roomInfo[2];}}
r+="</table>";r+="<hr>";}
r+="<table width='100%' style='font-size: 8pt;'>";if(levels!=""){r+="<tr><td><b>Levels&nbsp;(Finished)</b><td align=right>"+levels;}
if(basement!==""){r+="<tr><td><b>Basement</b><td align=right>"+basement;}
if(finished!=""){r+="<tr><td><b>Floor&nbsp;Area&nbsp;(Finished)</b><td align=right>"+finished;}
if(unfinished!=""){r+="<tr><td><b>Floor&nbsp;Area&nbsp;(Unfinished)</b><td align=right>"+formatNumber(unfinished)+" sq.ft.";}
if(houseSize!=""&&unfinished!=""){r+="<tr><td><b>Floor&nbsp;Area&nbsp;(Total)</b><td align=right>"+formatNumber(houseSize)+" sq.ft.";}
if(renovations!=""){r+="<tr><td><b>Renovations</b><td align=right>"+renovations;}
if(flooring!=""){r+="<tr><td><b>Flooring</b><td align=right>"+flooring.replace(/,/g,", ");}
if(suite!=""){r+="<tr><td><b>Suite</b><td align=right>"+suite;}
r+="</table>";if(levels||basement||finished||unfinished||houseSize||renovations||flooring||suite){r+="<hr>";}
r+="<table width='100%' style='font-size: 8pt;'>";if(strataFee>0){r+="<tr><td><b>Strata&nbsp;Fee&nbsp;(Monthly)</b><td align=right>"+formatPrice(strataFee/1000);}
if(padRental>0){r+="<tr><td><b>Pad Rental (Monthly)</b><td align=right>"+formatPrice(padRental/1000);}
if(strataRules!=""){r+="<tr><td><b>Strata Rules</b><td align=right>"+strataRules.replace(/,/g,", ");}
r+="</table>";if(strataFee||padRental||restrictions){r+="<hr>";}
r+="<table width='100%' style='font-size: 8pt;'>";if(roof!=""){r+="<tr><td><b>Roof</b><td align=right>"+roof.replace(/,/g,", ");}
if(foundation!=""){r+="<tr><td><b>Foundation</b><td align=right>"+foundation;}
if(construction!=""){r+="<tr><td><b>Construction</b><td align=right>"+construction.replace(/,/g,", ");}
if(exterior!=""){r+="<tr><td><b>Exterior Finish</b><td align=right>"+exterior.replace(/,/g,", ");}
if(outdoor!=""){r+="<tr><td><b>Outdoor Features</b><td align=right>"+outdoor.replace(/,/g,", ");}
if(parking!=""){r+="<tr><td><b>Parking&nbsp;(Total/Covered)</b><td align=right>"+parking.replace(/,/g,", ");}
if(parkingAccess!=""){r+="<tr><td><b>Parking&nbsp;Access</b><td align=right>"+parkingAccess.replace(/,/g,", ");}
if(exposure!=""){r+="<tr><td><b>Rear&nbsp;Yard&nbsp;Exposure</b><td align=right>"+exposure;}
r+="</table>";if(roof||foundation||construction||exterior||outdoor||parking||parkingAccess||exposure){r+="<hr>";}
r+="<table width='100%' style='font-size: 8pt;'>";if(fireplace!=""){r+="<tr><td><b>Fireplaces</b><td align=right>"+fireplace.replace(/,/g,", ");}
if(heating!=""){r+="<tr><td><b>Heating</b><td align=right>"+heating.replace(/,/g,", ");}
if(zoning!=""){r+="<tr><td><b>Zoning</b><td align=right>"+zoning;}
r+="</table>";r+="<table width='100%' style='font-size: 8pt;'>";if(water!=""){r+="<tr><td><b>Water Supply</b><td align=right>"+water.replace(/,/g,", ");}
if(electricity!=""){r+="<tr><td><b>Electricity</b><td align=right>"+electricity;}
if(gas!=""){r+="<tr><td><b>Natural Gas</b><td align=right>"+gas;}
if(telephone!=""){r+="<tr><td><b>Telephone</b><td align=right>"+telephone;}
if(cable!=""){r+="<tr><td><b>Cable Television</b><td align=right>"+cable;}
if(sewer!=""){r+="<tr><td><b>Sanitary Sewer</b><td align=right>"+sewer;}
if(storm!=""){r+="<tr><td><b>Storm Sewer</b><td align=right>"+storm;}
if(fencing!=""){r+="<tr><td><b>Fencing</b><td align=right>"+fencing;}
if(access!=""){r+="<tr><td><b>Access</b><td align=right>"+access;}
if(flood!=""){r+="<tr><td><b>Flood Plain</b><td align=right>"+flood;}
if(alr!=""){r+="<tr><td><b>In ALR?</b><td align=right>"+alr;}
if(restrictions!=""){r+="<tr><td><b>Restrictions</b><td align=right>"+restrictions.replace(/,/g,", ");}
r+="</table>";r+="</div>";if(assessLand>0||assessBldg>0){ratio=(100*(propertyDB[i].thePrice-assessLand-assessBldg)/(assessLand+assessBldg)).toFixed(0);r+="<div style='font-size: 8pt;'>";r+="<div style='text-align: center; font-weight: bold; font-size: 12pt;'>Assessment Information</div>";r+="<table width='100%'><tr align='left' style='font-size: 10pt;'><th>Year</th><th>Total</th><th>Land</th><th>Improvements</th></tr>";r+="<tr>";r+="<td>"+kAssessmentYear;r+="<td><b>"+formatPrice(assessLand+assessBldg)+"</b>";r+="<td>"+(assessLand>0?formatPrice(assessLand):"");r+="<td>"+(assessBldg>0?formatPrice(assessBldg):"");r+="</table>";r+="<br>";r+="<b>Asking Price premium</b>: ";r+="<span style='color: "+(ratio<1?"red":"green")+"'>"+ratio+"%</span>";r+="</div>";}
r+="<hr>";r+="<div id='walkscore' style='text-align: center;'><form><input type='button' value='Get Walk Score' onclick='this.style.color = \"red\"; this.value=\"Calculating...\"; getWalkScore(\""+mlsNumber+"\");'></form></div>";if(!notesLoaded&&gUserName!=""){notes=userGet(kMapName+"-notes-"+mlsNumber.toLowerCase());notes=unescape(notes);propertyDB[i].theNotes=notes;propertyDB[i].notesLoaded=true;}
if(gUserName!=""){r+="<hr>";r+="<b>Your Notes:</b>";r+="<form style='text-align: center;'>";r+="<textarea name='notes' rows=4 style='width: 410px;'>"+notes+"</textarea>";r+="<br>";r+="<input type=button value='Save the Notes' onclick='saveNotes("+i+", this.form.notes.value);'> ";r+="<input type=button value='Remove the Notes' onclick='saveNotes("+i+", \"\"); this.form.notes.value=\"\";'>";r+="</form>";}
r+="<hr>";r+="<table width='100%'><tr><td align='center'>";if(kShowSheetBranding){r+="<img src='"+kAgentPhotoURL+"'>";r+="<td align='center'>";r+="<b>Contact "+kAgentName+" <span style='font-variant: small-caps;'>realtor</span><br>"+kAgentPhone+"</b>";}else{if(brokerage.toLowerCase()==kAgentBrokerageName.toLowerCase()){r+="<div id='referPic'></div>";r+="<td align='center'>";r+="<b>Contact "+realtor+" <span style='font-variant: small-caps;'>realtor</span><br>"+realtorPhone+"</b>";}else{r+="<div id='referPic'></div>";r+="<td align='center'>";r+="<div id='referInfo'></div>";}}
r+="<p><form><input type=button value='Email Me a Question' onclick='showInfoRequest("+i+");'></form>";r+="<p><b>"+kAgentBrokerageName+"</b>";r+="</table>";r+="<hr>";r+="<div style='font-size: 10pt; font-style: italic; text-align: left;'>";r+="This property information is presented by "+kAgentBrokerageName+".";r+="<p>";r+=kDisclaimerBoard;r+="<p>";r+=kCopyrightNoticeBoard;r+="</div>";r+="</div>";r+="</div>";r+="</div>";return r;}
function saveNotes(i,notes){var reply;propertyDB[i].theNotes=notes;if(notes==""){reply=userRemove(kMapName+"-notes-"+propertyDB[i].theMLSnumber.toLowerCase());}else{reply=userSet(kMapName+"-notes-"+propertyDB[i].theMLSnumber.toLowerCase(),escape(notes));}
if(reply!="OK"){alert("Sorry, you must log in before you can save Notes. The Log In link is located in the bar above the map.");}}
function clearNotesField(){var i;for(i=1;i<=gPropertyCount;i++){propertyDB[i].theNotes="";}}
function showNextPicture2(i){if(gInfoRef!==null){clearTimeout(gInfoRef);gInfoRef=null;}
showNextPicture(i,gOptionKeyDown);}
function showNextPicture(i,reverse){var j;var currentPicture;var theID=propertyDB[i].theMLSnumber;var pictureCount=propertyDB[i].thePictureCount;var picArray=propertyDB[i].thePictureList.split(" ");var progressBar=document.getElementById(theID);if(pictureCount>1){currentPicture=document.getElementById(theID+"-1");for(j=0;j<pictureCount;j++){if(picArray[j]==currentPicture.src){if(reverse){j--;if(j==-1){j=pictureCount-1;}}else{j++;if(j==pictureCount){j=0;}}
currentPicture.src=picArray[j];progressBar.innerHTML=(j+1)+" of "+pictureCount;return;}}}}
function showPropertyList(){document.getElementById(kMapSidebarID).innerHTML=getPropertyList();document.getElementById(kListBodyID).style.height=(getMapHeight()-20)+"px";}
function doMouseOver(i){var r=propertyDB[i];var rm=r.theMarker;if(rm.isOverlaid){rm.setIcon(getHighlightedMarkerImage(r.isMarked));}
highlightPropertyList(i);}
function doMouseOut(i){var r=propertyDB[i];var rm=r.theMarker;if(rm.isOverlaid){rm.setIcon(getIconURL(r.thePropType,r.DOM,r.DOMprice,r.theSoldDate,r.isMarked));}
try{document.getElementById(kItemRowID+i).style.backgroundColor=kListOffColor;}catch(e){}}
function doMouseClick(i){showPropertyOnMap(i);}
function getPropertyList(){var r="";r+="<div id='"+kListContainerID+"'>";r+="<div id='"+kListBodyID+"'>";r+="Click a property marker on the map to see detailed information about the property in this panel.";r+="</div>";r+="</div>";r+="<div id='"+kDetailContainerID+"'></div>";return r;}
function encloseFavorites(){var i;var r;var idList="";var c,z,czInfo;for(i=1;i<=gPropertyCount;i++){r=propertyDB[i];if(r.isMarked){idList+=r.theMLSnumber+",";}}
idList=idList.substring(0,idList.length-1);if(idList!==""){czInfo=getCenterOfProperties(idList);c=czInfo.c;z=czInfo.z;gMap.setZoom(z);gMap.setCenter(c);}}
function mlsGoAll(){var i;var r;var idList="";if(gUserName.toLowerCase()==kAgentEmail.toLowerCase()){for(i=1;i<=gPropertyCount;i++){r=propertyDB[i];if(r.isMarked){idList+=r.theMLSnumber+",";}}
idList=idList.substring(0,idList.length-1);window.open(kINTERFACExpressURL+idList);}}
function mlsGoOne(i){var id;if(gUserName.toLowerCase()==kAgentEmail.toLowerCase()){id=propertyDB[i].theMLSnumber;window.open(kINTERFACExpressURL+id);}}
function mlsGoID(id){if(gUserName.toLowerCase()==kAgentEmail.toLowerCase()){window.open(kINTERFACExpressURL+id);}}
function reverseSortOrder(){gSortOrder=(gSortOrder==0?1:0);showFavoritesList();showFoundList();}
function showFavoritesList(){var i,iSorted;var r;var bedHTML,bathHTML;var houseAge;var bedCount,bathCount;var favoriteCounter=0;var pictureCount,picArray;var h=new StringBuffer();var body=new StringBuffer();for(i=1;i<=gPropertyCount;i++){if(gSortOrder==0){iSorted=i;}else{iSorted=gPropertyCount+1-i;}
r=propertyDB[iSorted];if(r.isMarked){favoriteCounter++;pictureCount=propertyDB[iSorted].thePictureCount;picArray=propertyDB[iSorted].thePictureList.split(" ");body.append("<div style='border: 1px solid black; margin-bottom: 2px;'>");body.append("<table width='100%' style='font-size: 8pt;'>");body.append("<tr align=center id='"+kItemRowID+iSorted+"' onmouseover='doMouseOver("+iSorted+");' onmouseout='doMouseOut("+iSorted+");'>");body.append("<td width=20><img src='"+kCloseBoxURL+"' onclick='markForceOffOne("+iSorted+");' onmouseover='this.src=kCloseBoxOnURL;' onmouseout='this.src=kCloseBoxURL;' title=' Remove from favourites list ' style='cursor: pointer;' class=noprint>");body.append("<p>");body.append("<div style='cursor: pointer;' title=' Show detail ' onclick='doMouseClick("+iSorted+");'>"+getIconURL(r.thePropType,r.DOM,r.DOMprice,r.theSoldDate,false,true)+"</div>");body.append("<td align=left valign=top width='"+kPictureWidthList+"'>");if(pictureCount>0){body.append("<div style='position: relative; cursor: pointer;' onclick='showPhotoArray("+iSorted+");' title=' Show photo gallery '>");body.append("<img src='"+picArray[0]+"' width='"+kPictureWidthList+"'>");if(r.theSoldDate!==""){body.append("<div class='"+kOverlayClass2+"'>"+"<img src='"+kSoldSashURL+"'>"+"</div>");}else if(r.DOMactual<=kRecentListingMaxAge){body.append("<div class='"+kOverlayClass2+"'>"+"<img src='"+kNewSashURL+"'>"+"</div>");}else if(propertyIsFeatured(iSorted)){body.append("<div class='"+kOverlayClass2+"'>"+"<img src='"+kFeaturedSashURL+"'>"+"</div>");}
body.append("<div class='"+kOverlayClass+" "+kNoprintClass+"' style='font-size: 6pt;'>");body.append(pictureCount);body.append("</div>");body.append("</div>");}
body.append("<td width=87 valign=top>");body.append("<b>"+formatPrice(r.thePrice)+r.thePriceTrend+"</b>");if(r.theSoldDate!=""){body.append("<br>");body.append("("+formatPrice(r.thePriceAsking)+")");body.append("<br>");body.append(kMonthNamesAbbrev[r.theSoldDate.getMonth()]+" "+r.theSoldDate.getDate()+", "+r.theSoldDate.getFullYear());}else if(r.thePriceOld!=0){body.append("<br>");body.append("<span style='text-decoration: line-through;'>"+formatPrice(r.thePriceOld)+"</span>");}
body.append("<div style='height: 5px;'></div>");if(r.theBrokerage.toLowerCase()==kAgentBrokerageName.toLowerCase()){body.append("<img src='"+kAgentBrokerageLogoURL+"'>");}else{body.append("<img src='"+kMLSRiconSmallURL+"'>");}
body.append("<td valign=top><a href='javascript:void(0)' onclick='doMouseClick("+iSorted+");' title=' Show detail '>"+r.theStreetAddress+"</a><br>"+r.theTown);body.append("<br><br>");body.append("<span onclick='mlsGoOne("+iSorted+");'>"+r.theMLSnumber+"</span>");body.append("<br>");body.append("<span onclick='if (gOptionKeyDown && gUserName.toLowerCase() == kAgentEmail.toLowerCase()) { gShowRealtorName=((gShowRealtorName == 0) ? 1 : 0); showFavoritesList(); return false; }'>");if(gShowRealtorName>0||!kShowSheetBranding&&(r.theBrokerage.toLowerCase()==kAgentBrokerageName.toLowerCase())){if(r.theRealtorEmail==""){body.append(r.theRealtor);}else{body.append("<a href='mailto:"+r.theRealtorEmail+"?subject="+escape("Re: "+r.theStreetAddress+" property")+"'>");body.append(r.theRealtor);body.append("</a>");}
body.append("<br>"+r.theRealtorPhone);}else{body.append(r.theBrokerage);}
body.append("</span>");if(r.thePropertyCategory==kPropertyLot){bedHTML="";bathHTML="";bedHTML="Lot";}else{bedCount=r.theBedroomCount;bedHTML=""+bedCount;if(bedCount===0){bedHTML="?";}
bedHTML+="bd/";bathCount=r.theBathroomCount;bathHTML=""+Math.floor(bathCount);if(bathCount===0){bathHTML="?";}
if(bathCount!=Math.floor(bathCount)){bathHTML=bathHTML+"&frac12;";}
bathHTML+="ba";}
body.append("<td align=right valign=top>");body.append(bedHTML+bathHTML);if(r.theHouseSize>0){body.append("<br>"+formatNumber(r.theHouseSize)+"&nbsp;sf");}
if(r.theLotSizeAcres>0){body.append("<br>"+r.theLotSizeAcres+"&nbsp;ac");}
houseAge=r.theHouseAge;if(houseAge!=""&&(parseInt(houseAge,10)>0)){houseAge+=" yr";if(parseInt(houseAge,10)>1){houseAge+="s";}}
if(houseAge=="Old Timer"){houseAge="Old";}
if(houseAge!=""){body.append("<br>"+houseAge);}
body.append("<br>"+r.DOMactual+" dom");body.append("</table>");body.append("</div>");}}
h.append("<div style='padding-right: 8px;'>");h.append("<table style='width: 100%;' class=noprint><tr>");h.append("<td>");if(gPadFlag){h.append("<b>Use two fingers to scroll this panel.</b>");}
h.append("<td align='right'>");h.append("<table><tr>");h.append("<td><img src='"+kFoundURL+"'>");h.append("<td><a href='javascript:void(0)' onclick='gListID = 0; showFoundList();'>Switch to Found Properties</a>");h.append("</table>");h.append("</table>");h.append("<p>");h.append("<div style='font-weight: bold; font-size: 14pt; text-align: center;'>");h.append("<img src='"+kHelpIconURL+"' align=left onclick='if ( gHelpFavorite ) { document.getElementById(\"favoritehelp\").style.display = \"none\"; } else { document.getElementById(\"favoritehelp\").style.display = \"\"; } gHelpFavorite = !gHelpFavorite;' style='cursor: pointer;' title=' Turn help on and off ' class=noprint>");h.append("Favourite Properties (<span onclick='mlsGoAll();'>"+favoriteCounter+"</span>)");h.append("</div><hr style='margin-bottom: 0px;'>");if(favoriteCounter===0){gHelpFavorite=true;}else{gHelpFavorite=false;}
h.append("<div id='favoritehelp' style='font-size: 10pt; text-align: left; margin-top: 3px; display: ");if(gHelpFavorite){h.append("");}else{h.append("none");}
h.append(";' class=noprint>");h.append("To add a property to this list, click its marker on the map to open its information panel, then mark the <i>Favourite</i> box. A shortcut for doing this is to click the marker while holding down the <i>Option</i> key (Macintosh) or <i>Alt</i> key (PC).");h.append("<p>");h.append("Once you have added properties to the Favourite Properties list you can perform the following tasks:");h.append("<ul>");h.append("<li>Compare the properties in the Favourite Properties list by displaying them in a vertical side-by-side format (click the <i>Compare</i> button at the top of the list)<p>");h.append("<li>Print or email brochures for all the properties in the Favourite Properties list (click the <i>Print/Email Brochures</i> button at the top of the list)<p>");h.append("<li>Print or email the Favourite Properties list (click the <i>Print/Email List</i> button at the top of the list)<p>");h.append("<li>Begin a virtual tour of the properties in the Favourite Properties list (click the <i>Begin Tour of Favourites</i> button in the bar below the map)<p>");h.append("</ul>");h.append("<hr style='margin-bottom: 0px;'>");h.append("</div>");if(favoriteCounter!=0){h.append("<div class=noprint style='text-align: center;'><form><table width='100%'><tr><td align=left><input type='button' value='Compare' onclick='showComparison();'><td align=left><input type='button' value='Watch...' onclick='requestWatch(getFavoriteList());'><td align=center><input type='button' value='Print/Email Brochures' onclick='showDataSheet(0, 0);'><td align=right><input type='button' value='Print/Email List' onclick='showDataSheet(0, 1);'></table></form><hr style='margin: 0px;'></div>");h.append("<table width='100%' style='font-size: 8pt;' class=noprint>");h.append("<tr align=center>");h.append("<th width=25>Fav</th><th width='"+kPictureWidthList+"'></th><th width=87 onclick='reverseSortOrder();' title=' Reverse price order ' style='cursor: pointer;'><span style='text-decoration: underline;'>Price</span><img src='");if(gSortOrder==0){h.append(kAscendingURL);}else{h.append(kDescendingURL);}
h.append("' align=bottom></th><th>Address</th><th align=right>Size/Age</th>");h.append("</tr>");h.append("</table>");h.append(body);}
h.append("</div>");h=h.toString();document.getElementById(kMapFavoritesID).innerHTML=h;if(gListID==1){document.getElementById(kListBodyID).innerHTML=h;}}
function getIconURL(propType,DOM,DOMprice,soldDate,isMarked,returnDiv){var size,origin,anchor;var spriteOffsetV;var spriteOffsetH=0;if(typeof returnDiv=="undefined"){returnDiv=false;}
if(soldDate!==""){spriteOffsetH=3*kMarkerWidth;}else if(DOM<=kRecentListingMaxAge){spriteOffsetH=1*kMarkerWidth;}else if(DOMprice!=-1&&DOMprice<=kRecentListingMaxAge){spriteOffsetH=2*kMarkerWidth;}
if(isMarked){spriteOffsetH+=4*kMarkerWidth;}
switch(propType){case kREA:spriteOffsetV=1*kMarkerHeight;break;case kLND:spriteOffsetV=3*kMarkerHeight;break;case kPAD:spriteOffsetV=2*kMarkerHeight;break;case kRED:default:spriteOffsetV=0*kMarkerHeight;}
size=new google.maps.Size(kMarkerWidth,kMarkerHeight);origin=new google.maps.Point(spriteOffsetH,spriteOffsetV);anchor=new google.maps.Point(kMarkerWidth/2,kMarkerHeight/2);if(returnDiv){return"<div style='position: relative; overflow: hidden; width: "+kMarkerWidth+"px; height: "+kMarkerHeight+"px;'><img src='"+kMarkersAllURL+"' style='position: absolute; left: -"+origin.x+"px; top: -"+origin.y+"px;'></div>";}else{return new google.maps.MarkerImage(kMarkersAllURL,size,origin,anchor);}}
function getHighlightedMarkerImage(isFavorite){var hmi;var iconOffset=(isFavorite?(4*kMarkerWidth):0);hmi=new google.maps.MarkerImage(kMarkersAllURL,new google.maps.Size(kMarkerWidth,kMarkerHeight),new google.maps.Point(iconOffset,4*kMarkerHeight),new google.maps.Point(kMarkerWidth/2,kMarkerHeight/2));return hmi;}
function resetFilters(){var i;var f=gMapFormLower;f.elements[kCategoryFilter].value=kPropertyAll;try{f.elements[kTownFilter].value=kTownAll;}catch(e1){gStartTown=kTownAll;}
f.elements[kAgeFilter].value=kAgeAll;f.elements[kLowPriceFilter].value=kPriceLowDefault;f.elements[kHighPriceFilter].value=kPriceHighDefault;try{f.elements[kBedroomsFilter].value=kBedroomsAll;}catch(e2){gMinBedrooms=kBedroomsAll;}
try{f.elements[kBathroomsFilter].value=kBathroomsAll;}catch(e3){gMinBathrooms=kBathroomsAll;}
try{f.elements[kAgentsFilter].value=kAgentsAll;}catch(e4){gStartAgent=kAgentsAll;}
try{f.elements[kBrokeragesFilter].value=kBrokeragesAll;}catch(e5){gStartBrokerage=kBrokeragesAll;}
try{f.elements[kAgentsSellFilter].value=kAgentsAll;}catch(e6){gStartAgentSell=kAgentsAll;}
try{f.elements[kBrokeragesSellFilter].value=kBrokeragesAll;}catch(e7){gStartBrokerageSell=kBrokeragesAll;}
try{f.elements[kMinLotSizeFilter].value=kLotSizesAll;}catch(e8){gStartMinLotSize=kLotSizesAll;}
try{f.elements[kMaxLotSizeFilter].value=kLotSizesAll;}catch(e9){gStartMaxLotSize=kLotSizesAll;}
try{f.elements[kMinHouseSizeFilter].value=kHouseSizesAll;}catch(e10){gStartMinHouseSize=kHouseSizesAll;}
try{f.elements[kMaxHouseSizeFilter].value=kHouseSizesAll;}catch(e11){gStartMaxHouseSize=kHouseSizesAll;}
try{f.elements[kWaterfrontBox].checked=false;}catch(e12){}
try{f.elements[kViewBox].checked=false;}catch(e13){}
try{f.elements[kFireplaceBox].checked=false;}catch(e14){}
try{f.elements[kTubBox].checked=false;}catch(e15){}
try{f.elements[kPoolBox].checked=false;}catch(e16){}
try{f.elements[kSecurityBox].checked=false;}catch(e17){}
try{f.elements[kWorkshopBox].checked=false;}catch(e18){}
try{gMapFormUpper.elements[kRegionSelect].selectedIndex=0;}catch(e19){}
gMapFormLower.elements["searchName1"].selectedIndex=0;gShowOnlyMarked=false;gMapFormLower.elements[kFavoritesOnlyCheckbox].checked=false;filterProperties();}
function filterProperties(){var categoryF,townF,ageF;var minPriceF,maxPriceF;var minBedroomsF,minBathroomsF;var minLotSizeF,maxLotSizeF;var minHouseSizeF,maxHouseSizeF;var agentF,brokerageF;var agentSellF,brokerageSellF;var waterfrontFlag,viewFlag,fireplaceFlag,workshopFlag,tubFlag,poolFlag,securityFlag;var f=gMapFormLower;try{townF=f.elements[kTownFilter].value;}catch(e1){townF=kTownAll;}
if(townF=="edit"){editCustomAreas();return;}
categoryF=f.elements[kCategoryFilter].value;ageF=f.elements[kAgeFilter].value;if(ageF===kAgeAll){ageF=kAgeAll;}else{ageF=parseInt(ageF,10);}
try{agentF=f.elements[kAgentsFilter].value;}catch(e2){agentF=gStartAgent;}
try{brokerageF=f.elements[kBrokeragesFilter].value;}catch(e3){brokerageF=gStartBrokerage;}
try{minLotSizeF=f.elements[kMinLotSizeFilter].value;}catch(e4){minLotSizeF=gStartMinLotSize;}
if(minLotSizeF===kLotSizesAll){minLotSizeF=kLotSizesAll;}else{minLotSizeF=parseInt(minLotSizeF,10);}
try{maxLotSizeF=f.elements[kMaxLotSizeFilter].value;}catch(e5){maxLotSizeF=gStartMaxLotSize;}
if(maxLotSizeF===kLotSizesAll){maxLotSizeF=kLotSizesAll;}else{maxLotSizeF=parseInt(maxLotSizeF,10);}
try{minHouseSizeF=f.elements[kMinHouseSizeFilter].value;}catch(e6){minHouseSizeF=gStartMinHouseSize;}
if(minHouseSizeF===kHouseSizesAll){minHouseSizeF=kHouseSizesAll;}else{minHouseSizeF=parseInt(minHouseSizeF,10);}
try{maxHouseSizeF=f.elements[kMaxHouseSizeFilter].value;}catch(e7){maxHouseSizeF=gStartMaxHouseSize;}
if(maxHouseSizeF===kHouseSizesAll){maxHouseSizeF=kHouseSizesAll;}else{maxHouseSizeF=parseInt(maxHouseSizeF,10);}
minPriceF=parseInt(f.elements[kLowPriceFilter].value,10);maxPriceF=parseInt(f.elements[kHighPriceFilter].value,10);if((maxPriceF!=kPriceHighest)&&(minPriceF>maxPriceF)){f.elements[kHighPriceFilter].value=kPriceHighest;maxPriceF=parseInt(kPriceHighest,10);}
try{minBedroomsF=f.elements[kBedroomsFilter].value;}catch(e8){minBedroomsF=kBedroomsAll;}
try{minBathroomsF=f.elements[kBathroomsFilter].value;}catch(e9){minBathroomsF=kBathroomsAll;}
try{agentSellF=f.elements[kAgentsSellFilter].value;}catch(e10){agentSellF=gStartAgentSell;}
try{brokerageSellF=f.elements[kBrokeragesSellFilter].value;}catch(e11){brokerageSellF=gStartBrokerageSell;}
gShowOnlyMarked=false;gMapFormLower.elements[kFavoritesOnlyCheckbox].checked=false;waterfrontFlag=f.elements[kWaterfrontBox].checked;viewFlag=f.elements[kViewBox].checked;fireplaceFlag=f.elements[kFireplaceBox].checked;workshopFlag=f.elements[kWorkshopBox].checked;tubFlag=f.elements[kTubBox].checked;poolFlag=f.elements[kPoolBox].checked;securityFlag=f.elements[kSecurityBox].checked;gLastSearchName="";gSearchQuery="";gSearchBox.style.display="none";removeCircle();hideCustomArea();applyFilters(minPriceF,maxPriceF,categoryF,townF,ageF,agentF,brokerageF,agentSellF,brokerageSellF,minLotSizeF,maxLotSizeF,minHouseSizeF,maxHouseSizeF,minBedroomsF,minBathroomsF,waterfrontFlag,viewFlag,fireplaceFlag,tubFlag,poolFlag,securityFlag,workshopFlag,new Date());hideDialogBox();gListID=0;refreshMap();}
function applyFilters(minimumPrice,maximumPrice,categoryCode,townCode,ageCode,agentCode,brokerageCode,agentSellCode,brokerageSellCode,minLotSize,maxLotSize,minHouseSize,maxHouseSize,minBedrooms,minBathrooms,waterfrontFlag,viewFlag,fireplaceFlag,tubFlag,poolFlag,securityFlag,workshopFlag,dateLastSearch){var i;var r,rm;var key;var category;var towns;var price;var bedroomCount,bathroomCount;var lotSize,houseSize;var agents,realtorNames,realtor,brokerage;var features;var isCustomArea=false;gTotalFound=0;if(townCode.indexOf(":")!==-1){showCustomArea(townCode);isCustomArea=true;}
for(i=1;i<=gPropertyCount;i++){r=propertyDB[i];rm=r.theMarker;r.inFoundSet=true;if(r.theVOWonly&&!gVOWactive){r.inFoundSet=false;continue;}
if(rm.getPosition().lat()===0&&rm.getPosition().lng()===0){r.inFoundSet=false;continue;}
if(categoryCode!=kPropertyAll){category=r.thePropType;switch(category){case kREA:category=kPropertyCondo;break;case kPAD:category=kPropertyManufacturedHome;break;case kLND:category=kPropertyLot;break;case kRED:default:category=kPropertyHouse;}
if(category!=categoryCode){r.inFoundSet=false;continue;}}
if(townCode!=kTownAll){if(isCustomArea){if(!gPolygonCustomArea.containsLatLng(rm.getPosition())){r.inFoundSet=false;continue;}}else{towns=townCode.toLowerCase().split(",");for(key in towns){if(towns.hasOwnProperty(key)){towns[key]=towns[key].trim();}}
if(!in_array(r.theTown.toLowerCase(),towns)){r.inFoundSet=false;continue;}}}
if(ageCode!==kAgeAll){ageCode=parseInt(ageCode,10);if(r.DOM>ageCode){if(r.DOMprice==-1||r.DOMprice>ageCode){r.inFoundSet=false;continue;}}}
minimumPrice=parseInt(minimumPrice,10);maximumPrice=parseInt(maximumPrice,10);price=r.thePrice;if(minimumPrice==kPriceLowest){if(maximumPrice!=kPriceHighest){if(price>maximumPrice){r.inFoundSet=false;continue;}}}else if(price>=minimumPrice){if(maximumPrice!=kPriceHighest){if(price>maximumPrice){r.inFoundSet=false;continue;}}}else{r.inFoundSet=false;continue;}
if(minBedrooms!=kBedroomsAll){bedroomCount=r.theBedroomCount;if(bedroomCount<minBedrooms){r.inFoundSet=false;continue;}}
if(minBathrooms!=kBathroomsAll){bathroomCount=r.theBathroomCount;if(bathroomCount<minBathrooms){r.inFoundSet=false;continue;}}
if(minLotSize!=kLotSizesAll){lotSize=r.theLotSizeAcres*kSquareMetersPerAcre;if(lotSize<minLotSize){r.inFoundSet=false;continue;}}
houseSize=r.theHouseSize;if(minHouseSize==kHouseSizesAll){if(maxHouseSize!=kHouseSizesAll){if(houseSize>maxHouseSize){r.inFoundSet=false;continue;}}}else if(houseSize>=minHouseSize){if(maxHouseSize!=kHouseSizesAll){if(houseSize>maxHouseSize){r.inFoundSet=false;continue;}}}else{r.inFoundSet=false;continue;}
if(agentCode!=kAgentsAll){agentCode=agentCode.toLowerCase();agents=agentCode.split(",");for(key in agents){if(agents.hasOwnProperty(key)){agents[key]=agents[key].trim();}}
realtor=r.theRealtor.toLowerCase();if(agents[0].split(" ").length==1){realtorNames=realtor.split(" ");realtor=realtorNames[realtorNames.length-1];}
if(!in_array(realtor,agents)){r.inFoundSet=false;continue;}}
if(brokerageCode!=kBrokeragesAll){brokerageCode=brokerageCode.toLowerCase();brokerage=r.theBrokerage.toLowerCase();if(brokerage!=brokerageCode){r.inFoundSet=false;continue;}}
if(agentSellCode!=kAgentsAll){agentSellCode=agentSellCode.toLowerCase();agents=agentSellCode.split(",");for(key in agents){if(agents.hasOwnProperty(key)){agents[key]=agents[key].trim();}}
realtor=r.theSellingAgent.toLowerCase();if(agents[0].split(" ").length==1){realtorNames=realtor.split(" ");realtor=realtorNames[realtorNames.length-1];}
if(!in_array(realtor,agents)){r.inFoundSet=false;continue;}}
if(brokerageSellCode!=kBrokeragesAll){brokerageSellCode=brokerageSellCode.toLowerCase();brokerage=r.theSellingBrokerage.toLowerCase();if(brokerage!=brokerageSellCode){r.inFoundSet=false;continue;}}
features=r.theFeatures.toLowerCase();if(waterfrontFlag&&(features.indexOf("waterfront")==-1)){r.inFoundSet=false;continue;}
if(viewFlag&&(features.indexOf("view")==-1)){r.inFoundSet=false;continue;}
if(fireplaceFlag&&(features.indexOf("fireplace")==-1)&&(features.indexOf("f/p")==-1)){r.inFoundSet=false;continue;}
if(tubFlag&&(features.indexOf("hot tub")==-1)){r.inFoundSet=false;continue;}
if(poolFlag&&(features.indexOf("pool")==-1)){r.inFoundSet=false;continue;}
if(securityFlag&&(features.indexOf("security system")==-1)){r.inFoundSet=false;continue;}
if(workshopFlag&&(features.indexOf("workshop")==-1)){r.inFoundSet=false;continue;}
gTotalFound++;}}
function showCustomArea(areaInfo){var i;var areaData,coords;var h="";var vertextList=[];areaData=areaInfo.split(":");areaData[1]=areaData[1].replace(/\s/g,"");coords=areaData[1].split(",");for(i=0;i<coords.length;i+=2){vertextList.push(new google.maps.LatLng(coords[i],coords[i+1]));}
gPolygonCustomArea.setPath(vertextList);gPolygonCustomArea.setMap(gMap);google.maps.event.addListener(gPolygonCustomArea.getPath(),"insert_at",modifyPolygonHandler);google.maps.event.addListener(gPolygonCustomArea.getPath(),"remove_at",modifyPolygonHandler);google.maps.event.addListener(gPolygonCustomArea.getPath(),"set_at",modifyPolygonHandler);h+="<table><tr>";h+="<td>";h+="<i>Properties in <b>"+areaData[0]+"</b></i> shown";h+="</td>";h+="<td>";h+="<img src='"+kDeleteURL+"' onclick='gMapFormLower.elements[kTownFilter].value = kTownAll; filterProperties();' style='cursor: pointer;' title=' Show all properties '>";h+="</td>";h+="</tr></table>";gSearchBox.innerHTML=h;gSearchBox.style.display="";gMap.fitBounds(gPolygonCustomArea.getBounds());}
function hideCustomArea(){gPolygonCustomArea.setMap(null);}
function getTitleBar(){var r="";r+="<div id='"+kPanelTitleBarID+"' style='text-align: center;'>";r+="<img src='"+kCloseBoxURL+"' onclick='hideInfoPanel();' onmouseover='this.src = kCloseBoxOnURL;' onmouseout='this.src=kCloseBoxURL;' style='cursor: pointer;' align=right>";if(gPadFlag){r+="<b>Use two fingers to scroll this panel.</b>";}
r+="<img src='"+kCloseBoxURL+"' onclick='hideInfoPanel();' onmouseover='this.src = kCloseBoxOnURL;' onmouseout='this.src=kCloseBoxURL;' style='cursor: pointer;' align=left>";r+="</div>";return r;}
function showInfoPanel(){gLastListScrollPos=document.getElementById(kListBodyID).scrollTop;document.getElementById(kListContainerID).style.display="none";document.getElementById(kDetailContainerID).style.display="";document.getElementById(kDetailContainerID).scrollTop=0;}
function hideInfoPanel(){gActiveDetail=0;document.getElementById(kDetailContainerID).style.display="none";document.getElementById(kListContainerID).style.display="";document.getElementById(kListBodyID).scrollTop=gLastListScrollPos;if(gInfoRef!==null){clearTimeout(gInfoRef);gInfoRef=null;}}
function setInfoPanelContent(theHTML){document.getElementById(kDetailContainerID).innerHTML=theHTML;document.getElementById(kDetailBodyID).style.height=(getMapHeight()-39)+"px";}
function getCookie(cookieName){var cStart,cEnd;var cookieValue="";var theCookie=document.cookie;try{if(theCookie.length>0){cStart=theCookie.indexOf(cookieName+"=");if(cStart!=-1){cStart+=cookieName.length+1;cEnd=theCookie.indexOf(";",cStart);if(cEnd==-1){cEnd=theCookie.length;}
cookieValue=unescape(theCookie.substring(cStart,cEnd));}}}catch(e){}
return cookieValue;}
function setCookie(cookieName,cookieValue,expiredays){var expiryDate=new Date();expiryDate.setDate(expiryDate.getDate()+expiredays);try{document.cookie=cookieName+"="+escape(cookieValue)+((typeof expiredays==="undefined")?"":";expires="+expiryDate.toGMTString());}catch(e){}}
function searchMenuRefresh(){var cv=userGet(kSearchValueCookie);if(cv==""||typeof cv=="undefined"){cv="";}
initSearchPopup(cv);}
function initSearchPopup(values){var i;var divider;var theName;var searchNameField=gMapFormLower.elements["newSearch"];var searchPopup=gMapFormLower.elements["searchName1"];var searchArray=explodeString(values,"\t");while(searchPopup.hasChildNodes()){searchPopup.removeChild(searchPopup.firstChild);}
searchPopup.options[0]=new Option("","");searchPopup.options[0].innerHTML="Select a Search to Run &darr;";for(i=0;i<kSearchStdNames.length;i++){searchPopup.options[searchPopup.options.length]=new Option(kSearchStdNames[i],kSearchStdValues[i]);}
divider=document.createElement("optgroup");divider.label="";searchPopup.appendChild(divider);searchPopup.options[searchPopup.options.length]=new Option("Manage custom searches...","edit");for(i=0;i<searchArray.length;i++){theName=unescape(getParameter("title",searchArray[i]));searchPopup.options[searchPopup.options.length]=new Option(theName,searchArray[i]);}
searchNameField.style.color=kSearchNamePromptColor;searchNameField.value=kSearchNamePrompt;}
function initAreaPopup(values){var i;var divider;var name;var areaPopup=gMapFormLower.elements[kTownFilter];var valueArray=explodeString(values,"\t");while(areaPopup.hasChildNodes()){areaPopup.removeChild(areaPopup.firstChild);}
areaPopup.options[0]=new Option("Any Area",kTownAll);for(i=0;i<kAreaNames.length;i++){if(kAreaNames[i]==""){kAreaNames[i]=kAreaValues[i];}
areaPopup.options[areaPopup.options.length]=new Option(kAreaNames[i],kAreaValues[i]);}
divider=document.createElement("optgroup");divider.label="";areaPopup.appendChild(divider);areaPopup.options[areaPopup.options.length]=new Option("Custom areas...","edit");if(valueArray.length>0){for(i=0;i<valueArray.length;i++){name=valueArray[i].substr(0,valueArray[i].indexOf(":"));areaPopup.options[areaPopup.options.length]=new Option(name,valueArray[i]);}}}
function addCustomArea(areaName,areaPolygon){var b=areaPolygon.getBounds();var areaPopup=gMapFormLower.elements[kTownFilter];areaName=areaName.replace(/\:/g,"-");areaPopup.options[areaPopup.options.length]=new Option(areaName,areaName+":"+areaPolygon.toString());areaPopup.selectedIndex=areaPopup.options.length-1;areaPolygon.setMap(null);filterProperties();}
function editCustomAreas(){var h="";var areaPopup=gMapFormLower.elements[kTownFilter];var n=areaPopup.options.length;h+="<div style='background: black; text-align: center; font-size: 10pt; color: white; padding: 5px 0px;'>";h+="<form>";h+="Custom Search Area Manager<hr>";if(n>(kAreaNames.length+2)){for(i=(kAreaNames.length+2);i<n;i++){h+="<input name='areaName"+i+"' size=20 value='"+areaPopup.options[i].text.replace(/\'/g,"&#39;")+"'> ";h+="<input type=button value='Rename' onclick='changeCustomArea("+i+", "+"this.form.areaName"+i+".value, \"\");'>";h+="<input type=button value='Delete' onclick='removeCustomArea("+i+");'>";h+="<br>";}}else{h+="No Custom Search Areas have been defined.<br>";}
h+="<input type=button value=' Done ' onclick='editStopCustomAreas();'>";h+="</form>";h+="</div>";gHelpAC.open(gMap);gHelpAC.setContent(h);gHelpAC.setPosition(gMap.getCenter());gHelpAC.show();}
function editStopCustomAreas(){gHelpAC.hide();var areaPopup=gMapFormLower.elements[kTownFilter];areaPopup.selectedIndex=0;filterProperties();}
function removeCustomArea(i){var areaPopup=gMapFormLower.elements[kTownFilter];areaPopup.options[i]=null;editCustomAreas();}
function changeCustomArea(i,areaName,value){var areaValue;var areaPopup=gMapFormLower.elements[kTownFilter];areaName=areaName.trim();value=value.trim();if(areaName!=""){areaName=areaName.replace(/\:/g,"-");areaPopup.options[i].text=areaName;areaValue=areaPopup.options[i].value;areaPopup.options[i].value=areaName+areaValue.substr(areaValue.indexOf(":"));}
if(value!=""){areaPopup.options[i].value=value;}}
function modifyPolygonHandler(){var path,numPoints,j,vertex,coord;var vertexList=[];var areaPopup=gMapFormLower.elements[kTownFilter];var i=areaPopup.selectedIndex;var areaName=areaPopup.options[i].text;path=gPolygonCustomArea.getPath();numPoints=path.getLength();for(j=0;j<numPoints;j++){vertex=path.getAt(j);coord=vertex.lat().toFixed(5)+","+vertex.lng().toFixed(5);vertexList.push(coord);}
value=areaName+":"+vertexList.join(",");changeCustomArea(i,"",value);}
function runStartupSearch(){var i;var searchPopup=gMapFormLower.elements["searchName1"];var totalSearchCount=searchPopup.options.length
var stdSearchCount=kSearchStdNames.length+2;for(i=stdSearchCount;i<totalSearchCount;i++){if(searchPopup.options[i].text.toLowerCase()==kSearchStartup.toLowerCase()){searchPopup.selectedIndex=i;runSearch();break;}}}
function runSearch(){var theCommand;var d=new Date();var theDate=(d.getMonth()+1)+"/"+d.getDate()+"/"+d.getFullYear();var search=gMapFormLower.elements["searchName1"];var i=search.selectedIndex;if(search.options[i].value=="edit"){search.selectedIndex=0;showSearchDetail(true);}else if(i>0){hideCustomArea();gSearchBox.style.display="none";theCommand=search[i].value;gLastSearchName=search[i].text;theCommand=theCommand.replace(gBaseURL+"?","");theCommand=theCommand.replace(kMapAnchorName,"");markForceOffAll();parseCommandLine(theCommand);invokeCommandLine();showFavoritesList();showFoundList();}}
function addSearchOption(){var now=new Date();var searchNameField=gMapFormLower.elements["newSearch"];var searchFreqField=gMapFormLower.elements["freqSearch"];var searchPopup=gMapFormLower.elements["searchName1"];var stdSearchCount=kSearchStdNames.length;var i=searchPopup.options.length;var theSearchName=searchNameField.value;var theFreq=searchFreqField.checked?searchFreqField.value:0;var theCommand=getMapURL();theCommand=theCommand.replace(gBaseURL+"?","");theCommand=theCommand.replace(kMapAnchorName,"");theCommand+="&freq="+theFreq;theCommand+="&title="+escape(theSearchName);theCommand+="&searchdate="+(now.getMonth()+1)+"/"+now.getDate()+"/"+now.getFullYear();if(theSearchName!==""&&theSearchName!=kSearchNamePrompt){searchPopup.options[i]=new Option(theSearchName,theCommand);saveSearchCookies();}
searchFreqField.checked=false;searchNameField.style.color=kSearchNamePromptColor;searchNameField.value=kSearchNamePrompt;searchNameField.blur();if(document.getElementById("searchDialog")){showSearchDetail(false);}}
function saveSearchCookies(){var i;var searchPopup=gMapFormLower.elements["searchName1"];var n=searchPopup.options.length;var values=[];var stdSearchCount=kSearchStdNames.length;for(i=2+stdSearchCount;i<n;i++){values.push(searchPopup.options[i].value);}
if(gUserName!=""){userSet(kSearchValueCookie,implodeArray(values,"\t"));}}
function saveCustomAreaCookies(){var i;var areaPopup=gMapFormLower.elements[kTownFilter];var values=[];var stdAreaCount=kAreaNames.length+2;for(i=stdAreaCount;i<areaPopup.options.length;i++){values.push(areaPopup.options[i].value);}
if(gUserName!=""){userSet(kCustomAreaValueCookie,implodeArray(values,"\t"));}}
function implodeArray(a,separator){var s="";if(a.length>0){s=a.join(separator);}
return s;}
function explodeString(s,separator){var a=[];if(s!==""){a=s.split(separator);}
return a;}
function mapChanged(f){var theURL;theURL=f.elements[kMapSelect].value;if(theURL!=""){theURL+=kMapAnchorName;try{self.location.href=theURL;}catch(e){}}}
function mapUnload(){saveUserData();}
function saveUserData(){var reply;var data="";if(gUserName!=""){saveCustomAreaCookies();data+=kLastVisitCookie+"\t"+getCurrentTimeString()+"\n";data+=kLastPosnCookie+"\t"+gMap.getCenter().lat().toFixed(5)+","+gMap.getCenter().lng().toFixed(5)+"\n";data+=kLastZoomCookie+"\t"+gMap.getZoom()+"\n";data+=kLastModeCookie+"\t"+gMap.getMapTypeId()+"\n";data+=kFavoritesCookie+"\t"+getMarkedList(true)+"\n";data+=kBoundaryCookie+"\t"+(gBoundaryFlag?"1":"")+"\n";data+=kNewsCookie+"\t"+gNewsIndex+"\n";data+=kOrderCookie+"\t"+gSortOrder+"\n";data+=kRealtorCookie+"\t"+gShowRealtorName+"\n";data+=kTipCookie+"\t"+(gHideStartupTip?"1":"")+"\n";data+=kSearchBarCookie+"\t"+(document.getElementById("searchBar").style.display=="none"?"1":"")+"\n";data+=kSidebarCookie+"\t"+(document.getElementById("sidebar").style.display=="none"?"1":"")+"\n";data+=kTemperatureCookie+"\t"+gTemperatureUnits+"\n";data+=kTimeCookie+"\t"+gTimeUnits+"\n";reply=userSetAll(data);}}
function saveUserLogin(){if(gRememberLogin==""){setCookie(kUserNameCookie,"",5*365);setCookie(kUserPasswordCookie,"",5*365);}else{setCookie(kUserNameCookie,gUserName,5*365);setCookie(kUserPasswordCookie,gUserPassword,5*365);}}
function showFoundList(groupStart){var lastScroll;if(gListID==0){if(typeof groupStart==="undefined"){groupStart=gGroupStartLast;}
if(groupStart>gTotalFound){groupStart=1;lastScroll=0;}else{lastScroll=document.getElementById(kListBodyID).scrollTop;}
try{document.getElementById(kListBodyID).innerHTML=getFoundList(groupStart);document.getElementById(kListBodyID).scrollTop=lastScroll;}catch(e){}}}
function getFoundList(groupStart){var i,iSorted;var r;var bedHTML,bathHTML;var bedCount,bathCount;var groupEnd;var pictureCount;var picArray;var foundCounter=0;var h="";var body=new StringBuffer();gGroupStartLast=groupStart;groupEnd=groupStart+kGroupSize-1;for(i=1;i<=gPropertyCount;i++){if(gSortOrder==0){iSorted=i;}else{iSorted=gPropertyCount+1-i;}
r=propertyDB[iSorted];if(r.inFoundSet){foundCounter++;if(foundCounter>=groupStart){pictureCount=r.thePictureCount;picArray=r.thePictureList.split(" ");body.append("<div style='border: 1px solid black; margin-bottom: 2px;'>");body.append("<table width='100%' style='font-size: 8pt;'>");body.append("<tr align=center id='"+kItemRowID+iSorted+"' onmouseover='doMouseOver("+iSorted+");' onmouseout='doMouseOut("+iSorted+");'>");body.append("<td width=20>");body.append("<input type='checkbox' name='"+kMarkName+iSorted+"'");body.append(propertyDB[iSorted].isMarked?" checked":"");body.append(" onclick='markToggle("+iSorted+");' style='cursor: pointer;' title=' Toggle favourite status '>");body.append("<p>");body.append("<div style='cursor: pointer;' title=' Show detail ' onclick='doMouseClick("+iSorted+");'>"+getIconURL(r.thePropType,r.DOM,r.DOMprice,r.theSoldDate,false,true)+"</div>");body.append("<td align=left valign=top width='"+kPictureWidthList+"'>");if(pictureCount>0){body.append("<div style='position: relative; cursor: pointer;' onclick='showPhotoArray("+iSorted+");' title=' Show photo gallery '>");body.append("<img src='"+picArray[0]+"' width='"+kPictureWidthList+"'>");if(r.theSoldDate!==""){body.append("<div class='"+kOverlayClass2+"'>"+"<img src='"+kSoldSashURL+"'>"+"</div>");}else if(r.DOMactual<=kRecentListingMaxAge){body.append("<div class='"+kOverlayClass2+"'>"+"<img src='"+kNewSashURL+"'>"+"</div>");}else if(propertyIsFeatured(iSorted)){body.append("<div class='"+kOverlayClass2+"'>"+"<img src='"+kFeaturedSashURL+"'>"+"</div>");}
body.append("<div class='"+kOverlayClass+" "+kNoprintClass+"' style='font-size: 6pt;'>");body.append(pictureCount);body.append("</div>");body.append("</div>");}
body.append("<td width=87 valign=top>");body.append("<b>"+formatPrice(r.thePrice)+r.thePriceTrend+"</b>");if(r.theSoldDate!=""){body.append("<br>");body.append("("+formatPrice(r.thePriceAsking)+")");body.append("<br>");body.append(kMonthNamesAbbrev[r.theSoldDate.getMonth()]+" "+r.theSoldDate.getDate()+", "+r.theSoldDate.getFullYear());}else if(r.thePriceOld!=0){body.append("<br>");body.append("<span style='text-decoration: line-through;'>"+formatPrice(r.thePriceOld)+"</span>");}
body.append("<div style='height: 5px;'></div>");if(r.theBrokerage.toLowerCase()==kAgentBrokerageName.toLowerCase()){body.append("<img src='"+kAgentBrokerageLogoURL+"'>");}else{body.append("<img src='"+kMLSRiconSmallURL+"'>");}
body.append("<td valign=top><a href='javascript:void(0)' onclick='doMouseClick("+iSorted+");' title=' Show detail '>"+r.theStreetAddress+"</a><br>"+r.theTown);body.append("<br><br>");body.append("<span onclick='mlsGoOne("+iSorted+");'>"+r.theMLSnumber+"</span>");body.append("<br>");body.append("<span onclick='if (gOptionKeyDown && gUserName.toLowerCase() == kAgentEmail.toLowerCase()) { gShowRealtorName=((gShowRealtorName == 0) ? 1 : 0); showFoundList(); return false; }'>");if(gShowRealtorName>0||!kShowSheetBranding&&(r.theBrokerage.toLowerCase()==kAgentBrokerageName.toLowerCase())){if(r.theRealtorEmail==""){body.append(r.theRealtor);}else{body.append("<a href='mailto:"+r.theRealtorEmail+"?subject="+escape("Re: "+r.theStreetAddress+" property")+"'>");body.append(r.theRealtor);body.append("</a>");}
body.append("<br>"+r.theRealtorPhone);}else{body.append(r.theBrokerage);}
body.append("</span>");if(r.thePropertyCategory==kPropertyLot){bedHTML="";bathHTML="";bedHTML="Lot";}else{bedCount=r.theBedroomCount;bedHTML=""+bedCount;if(bedCount===0){bedHTML="?";}
bedHTML+="bd/";bathCount=r.theBathroomCount;bathHTML=""+Math.floor(bathCount);if(bathCount===0){bathHTML="?";}
if(bathCount!=Math.floor(bathCount)){bathHTML=bathHTML+"&frac12;";}
bathHTML+="ba";}
body.append("<td align=right valign=top>");body.append(bedHTML+bathHTML);if(r.theHouseSize>0){body.append("<br>"+formatNumber(r.theHouseSize)+"&nbsp;sf");}
if(r.theLotSizeAcres>0){body.append("<br>"+r.theLotSizeAcres+"&nbsp;ac");}
houseAge=r.theHouseAge;if(houseAge=="0"){houseAge="New";}
if(houseAge=="Old Timer"){houseAge="Old";}
if(houseAge!=""&&(parseInt(houseAge,10)>0)){houseAge+=" yr"+(parseInt(houseAge,10)==1?"":"s");}
if(houseAge!=""){body.append("<br>"+houseAge);}
body.append("<br>"+r.DOMactual+" dom");body.append("</table>");body.append("</div>");}}
if(foundCounter==groupEnd){break;}}
if(groupEnd>gTotalFound){groupEnd=gTotalFound;}
if(gTotalFound==0){groupStart=0;}
h+="<div style='padding-right: 8px;'>";h+="<table style='width: 100%;'><tr>";h+="<td>";if(gPadFlag){h+="<b>Use two fingers to scroll this panel.</b>";}
h+="<td align='right'>";h+="<table><tr>";h+="<td><img src='"+kCheckmarkURL+"'>";h+="<td><a href='javascript:void(0)' onclick='gListID = 1; showFavoritesList();' style='padding-bottom: 22px;'>Switch to Favourite Properties</a>";h+="</table>";h+="</table>";h+="<p>";h+="<div style='font-weight: bold; font-size: 14pt; text-align: center;'>";h+="Found Properties ("+gTotalFound+")";h+="<br>";h+="</div>";h+="<div style='font-size: 8pt;'>";h+="<hr style='margin-bottom: 0px;'>";h+="<table width='100%' style='font-size: 8pt;'><tr>";h+="<td>Properties "+groupStart+" - "+groupEnd+" of "+gTotalFound;h+="<td align=right>";if(groupStart>1){h+="&larr;<a href='javascript:void(0)' onclick='document.getElementById(\""+kListBodyID+"\").scrollTop = 0; showFoundList("+(groupStart-kGroupSize)+");'>Show Previous "+kGroupSize+"</a>";}
if(groupEnd<gTotalFound){h+="&nbsp;&nbsp;"+"<a href='javascript:void(0)' onclick='document.getElementById(\""+kListBodyID+"\").scrollTop = 0; showFoundList("+(groupStart+kGroupSize)+");'>Show Next "+kGroupSize+"</a>&rarr;";}
h+="</table>";h+="<hr style='margin-top: 2px; margin-bottom: 0px;'>";h+="</div>";h+="<form id='"+kListFormID+"'>";h+="<table width='100%' style='font-size: 8pt;' class=noprint>";h+="<tr align=center>";h+="<th width=25>Fav</th><th width='"+kPictureWidthList+"'></th><th width=87 onclick='reverseSortOrder();' title=' Reverse price order ' style='cursor: pointer;'><span style='text-decoration: underline;'>Price</span><img src='";if(gSortOrder==0){h+=kAscendingURL;}else{h+=kDescendingURL;}
h+="' align=bottom></th><th>Address</th><th align=right>Size/Age</th>";h+="</tr>";h+="</table>";h+=body.toString();h+="</form>";h+="<div style='font-size: 8pt;'>";h+="<hr style='margin-bottom: 0px;'>";h+="<table width='100%' style='font-size: 8pt;'><tr>";h+="<td>Properties "+groupStart+" - "+groupEnd+" of "+gTotalFound;h+="<td align=right>";if(groupStart>1){h+="&larr;<a href='javascript:void(0)' onclick='document.getElementById(\""+kListBodyID+"\").scrollTop = 0; showFoundList("+(groupStart-kGroupSize)+");'>Show Previous "+kGroupSize+"</a>";}
if(groupEnd<gTotalFound){h+="&nbsp;&nbsp;"+"<a href='javascript:void(0)' onclick='document.getElementById(\""+kListBodyID+"\").scrollTop = 0; showFoundList("+(groupStart+kGroupSize)+");'>Show Next "+kGroupSize+"</a>&rarr;";}
h+="</table>";h+="<hr style='margin-top: 2px; margin-bottom: 0px;'>";h+="</div>";h+="</div>";return h;}
function loadRandomMessage(){try{var req=new XMLHttpRequest();req.open("GET",kHelpFile,true);req.onreadystatechange=function(message,errorCode){var i;var messageArray;var tipCount;if(req.readyState==4){if(req.status==200||req.status==0){message=req.responseText.replace(/\r/g,"\n");messageArray=message.split("\n");for(i=0;i<messageArray.length;i++){if(messageArray[i]===""){messageArray.splice(i,1);i--;}}
tipCount=messageArray.length;if(tipCount>0){do{i=Math.floor(Math.random()*tipCount);}while((i==gLastMessage)&&(tipCount>1));gLastMessage=i;try{document.getElementById("message0").innerHTML="";document.getElementById("message1").innerHTML=messageArray[i];}catch(e1){}}else{document.getElementById("nexttip").style.display="none";}}}};req.send(null);}catch(e2){}}
function showDirections(i){var parms="";var a,t,pc,p,id,lat,lng,cn;var w,h;a=propertyDB[i].theStreetAddress;t=propertyDB[i].theTown;pc=propertyDB[i].theCity;p=propertyDB[i].thePrice;id=propertyDB[i].theMLSnumber;lat=propertyDB[i].theMarker.getPosition().lat();lng=propertyDB[i].theMarker.getPosition().lng();cn=propertyDB[i].theCondoName;w=window.open("","","left=0,top=0,width=975,height=850,scrollbars=1,resizable=1,toolbar=0,location=0,directories=0,status=0,menubar=0");h="";h+='<html><head></head><body><form id="formid" method="post" action="'+kMapDirectionsURL+'">';h+='<input type="hidden" name="a" value="'+a+'">';h+='<input type="hidden" name="t" value="'+t+'">';h+='<input type="hidden" name="pc" value="'+pc+'">';h+='<input type="hidden" name="p" value="'+p+'">';h+='<input type="hidden" name="id" value="'+id+'">';h+='<input type="hidden" name="lat" value="'+lat+'">';h+='<input type="hidden" name="lng" value="'+lng+'">';h+='<input type="hidden" name="cn" value="'+cn+'">';h+='<input type="hidden" name="map" value="'+kMapName+'">';h+='<input type="hidden" name="user" value="'+kUserData+'">';if(gUserName!=""){h+='<input type="hidden" name="fromAddress" value="'+userGet(kAddressCookie)+'">';h+='<input type="hidden" name="email" value="'+gUserName+'">';h+='<input type="hidden" name="pw" value="'+gUserPassword+'">';}
h+="</form><script>document.getElementById('formid').submit()</script></body></html>";w.document.write(h);}
function requestWatch(idList){var i,index;var cmd;var propList,newQuery;var idArray;var now=new Date();if(gUserName==""){alert("Sorry, you must log in before you can Watch a property. The Log In link is located in the bar above the map.");}else{cmd=userGet(kWatchCookie);propList=getParameter("q",cmd);propList=propList.substr(1,propList.length-2);propList=(propList==""?"":propList+",")+idList;propList=eliminateDuplicates(propList.split(",")).join(",");newQuery="("+propList+")";cmd=changeParameter(cmd,"q",newQuery);cmd=changeParameter(cmd,"searchdate",(now.getMonth()+1)+"/"+now.getDate()+"/"+now.getFullYear());cmd=changeParameter(cmd,"nodesc",1);userSet(kWatchCookie,cmd);idArray=idList.split(",");for(i=0;i<idArray.length;i++){index=getIndexFromID(idArray[i]);if(index!=-1){propertyDB[index].watched=true;if(i==0){try{document.getElementById("eye"+idArray[i]).style.visibility="visible";}catch(e){}}}}}}
function stopWatching(idNumber){var i;var idList,idArray;var cmd=userGet(kWatchCookie);idList=getParameter("q",cmd);idList=idList.substr(1,idList.length-2);idArray=idList.split(",");for(i=0;i<idArray.length;i++){if(idNumber==idArray[i]){idArray.splice(i,1);break;}}
if(idArray.length==0){cmd="";}else{cmd=changeParameter(cmd,"q","("+idArray.join(",")+")");}
userSet(kWatchCookie,cmd);try{i=getIndexFromID(idNumber)
if(i!=-1){propertyDB[i].watched=false;}
document.getElementById("eye"+idNumber).style.visibility="hidden";}catch(e){}}
function loadWatchList(){var i,index;var idList,idArray;var cmd;if(gUserName==""){cmd="";}else{cmd=userGet(kWatchCookie);}
idList=getParameter("q",cmd);idList=idList.substr(1,idList.length-2);idArray=idList.split(",");for(i=1;i<=gPropertyCount;i++){propertyDB[i].watched=in_array(propertyDB[i].theMLSnumber,idArray);}}
function eliminateDuplicates(arr){var i;var out=[];var obj={};for(i=0;i<arr.length;i++){obj[arr[i]]=0;}
for(i in obj){out.push(i);}
return out;}
function M(mlsNumber,listingDate,entryDate,latitude,longitude,streetAddress,condoName,town,price,priceOld,priceOldDate,taxes,taxesYear,realtorURL,propertyCategory,propertyStyle,description,realtor,realtorPhone,realtorEmail,brokerage,houseAge,houseSize,bedroomCount,bathroomCount,lotFrontage,lotDepth,pictureList,lotSize,features,basement,priceSold,soldDate,city,pictureCount,virtualTour,hitCount,postalCode,roof,heating,water,zoning,room1,room2,room3,room4,room5,room6,room7,room8,room9,room10,room11,room12,room13,room14,room15,room16,room17,room18,room19,room20,room21,room22,room23,room24,room25,room26,room27,room28,fireplace,outdoor,parking,suite,exposure,strataRules,strataFee,padRental,construction,foundation,flooring,exterior,aboveMainFFA,mainFFA,belowMainFFA,bsmtFFA,totalFFA,unfinished,levels,renovations,parkingAccess,bathroom1,bathroom2,bathroom3,bathroom4,bathroom5,bathroom6,bathroom7,bathroom8,sewer,boundary,landArea,assessLand,assessBldg,cable,gas,electricity,telephone,storm,fencing,access,alr,flood,restrictions,vow,propType,sellingAgent,sellingBrokerage,pid){var rec={};var i,j;var polygons,rings,points;var ffaValue;var picturePrefix;var pictureBigList,pictureSmallList;var pictureBase;var iconURL,theIcon;var roomArray,bathroomArray;var lotSizeAcres=0;var priceAsking=price;var priceTrend="";var dateA=listingDate.split("/",3);var dateB=priceOldDate.split("/",3);var dateC=soldDate.split("/",3);var dateD=entryDate.split("/",3);var now=new Date().getTime();gPropertyCounter++;rec.inFoundSet=false;rec.isMarked=false;rec.theListingDate=new Date(dateA[2],dateA[0]-1,dateA[1]);rec.theEntryDate=new Date(dateD[2],dateD[0]-1,dateD[1]);if(soldDate===""){rec.theSoldDate="";rec.DOMactual=Math.floor((now-rec.theListingDate.getTime())/kOneDayMilliseconds);rec.DOM=Math.floor((now-rec.theEntryDate.getTime())/kOneDayMilliseconds);if(rec.DOM<0){rec.DOM=0;}}else{rec.theSoldDate=new Date(dateC[2],dateC[0]-1,dateC[1]);rec.DOMactual=Math.floor((rec.theSoldDate.getTime()-rec.theListingDate.getTime())/kOneDayMilliseconds);rec.DOM=Math.floor((now-rec.theEntryDate.getTime())/kOneDayMilliseconds);price=priceSold;}
if(lotSize.indexOf(" sq.ft.")!=-1){lotSizeAcres=(parseInt(lotSize,10)/kSquareFeetPerAcre).toFixed(2);lotSize=formatNumber(parseInt(lotSize,10))+" sq.ft. ("+lotSizeAcres+" ac.)";}
if(soldDate===""&&priceOldDate!==""){rec.thePriceChangeDate=new Date(dateB[2],dateB[0]-1,dateB[1]);rec.DOMprice=Math.floor((now-rec.thePriceChangeDate.getTime())/kOneDayMilliseconds);if(rec.DOMprice<0){rec.DOMprice=0;}
if(rec.DOMprice<=kRecentListingMaxAge){if(priceOld>price){priceTrend="&darr;";}else if(priceOld<price){priceTrend="&uarr;";}}}else{rec.thePriceChangeDate="";rec.DOMprice=-1;}
if(pictureList===""){pictureBigList="";pictureSmallList="";if(pictureCount>0){if(soldDate!=""){picturePrefix=kPictureBaseSold+mlsNumber.charAt(mlsNumber.length-1)+"/"+mlsNumber.toLowerCase()+"_";pictureBigList=picturePrefix+"1.jpg";pictureSmallList=pictureBigList;}else{switch(mlsNumber.charAt(0).toLowerCase()){case"f":pictureBase=kPictureBase2;break;case"h":pictureBase=kPictureBase3;break;case"k":pictureBase=kPictureBase4;break;case"n":pictureBase=kPictureBase5;break;default:pictureBase=kPictureBase;}
picturePrefix=pictureBase+mlsNumber.charAt(mlsNumber.length-1)+"/"+mlsNumber.toLowerCase()+"_";for(i=0;i<pictureCount;i++){pictureBigList+=picturePrefix+(i+1)+".jpg"+" ";}
pictureBigList=pictureBigList.substring(0,pictureBigList.length-1);pictureSmallList=pictureBigList.replace(/\/highres\//g,"/lowres/");}}}else{pictureCount=pictureList.split(" ").length;pictureBigList=pictureList;pictureSmallList=pictureList;}
iconURL=getIconURL(propType,rec.DOM,rec.DOMprice,rec.theSoldDate,rec.isMarked);rec.theMarker=new PropertyMarker({position:new google.maps.LatLng(latitude,longitude),icon:iconURL,clickable:true,draggable:false,visible:false,boundary:boundary});rec.theMarker.index=gPropertyCounter;rec.theMarker.isOverlaid=false;rec.theMarker.isProperty=true;rec.theStreetAddress=streetAddress;rec.theCondoName=condoName;rec.theTown=town;rec.thePrice=price;rec.thePriceAsking=priceAsking;rec.thePriceTrend=priceTrend;rec.thePriceSold=priceSold;rec.thePriceOld=priceOld;rec.theTaxes=taxes;rec.theTaxesYear=taxesYear;rec.theBedroomCount=bedroomCount;rec.theBathroomCount=bathroomCount;rec.theRealtor=realtor;rec.theRealtorPhone=realtorPhone;rec.theRealtorEmail=realtorEmail;rec.theBrokerage=brokerage;rec.theHouseAge=houseAge;rec.theHouseSize=houseSize;rec.theLotSize=lotSize;rec.theLotSizeAcres=lotSizeAcres;rec.theLotFrontage=lotFrontage;rec.theLotDepth=lotDepth;rec.theFeatures=features;rec.theBasement=basement;rec.theDescription=description;rec.theNotes="";rec.notesLoaded=false;rec.theRealtorURL=realtorURL;rec.thePropertyCategory=propertyCategory;rec.thePropertyStyle=propertyStyle;rec.thePictureList=pictureSmallList;rec.thePictureBigList=pictureBigList;rec.thePictureCount=pictureCount;rec.theCity=city;rec.theMLSnumber=mlsNumber;rec.theVirtualTour=virtualTour;rec.thePostalCode=postalCode;rec.theRoof=roof;rec.theHeating=heating;rec.theWater=water;rec.theZoning=zoning;rec.theFireplace=fireplace;rec.theOutdoor=outdoor;rec.theParking=parking;rec.theSuite=suite;rec.theExposure=exposure;rec.theStrataRules=strataRules;rec.theStrataFee=strataFee;rec.thePadRental=padRental;rec.theConstruction=construction;rec.theFoundation=foundation;rec.theFlooring=flooring;rec.theExterior=exterior;rec.theUnfinished=unfinished;rec.theLevels=levels;rec.theRenovations=renovations;rec.theParkingAccess=parkingAccess;rec.theSewer=sewer;rec.theLandArea=landArea;rec.theAssessLand=assessLand;rec.theAssessBldg=assessBldg;ffaValue=[];if(mainFFA>0){ffaValue.push(formatNumber(mainFFA)+"&nbsp;Main");}
if(aboveMainFFA>0){ffaValue.push(formatNumber(aboveMainFFA)+"&nbsp;Up");}
if(belowMainFFA>0){ffaValue.push(formatNumber(belowMainFFA)+"&nbsp;Down");}
if(bsmtFFA>0){ffaValue.push(formatNumber(bsmtFFA)+"&nbsp;Bsmt");}
if(ffaValue.length>0){if(ffaValue.length>1){rec.theFinished=implodeArray(ffaValue," + ")+" = "+formatNumber(totalFFA)+"&nbsp;sq.ft.";}else{ffaValue[0]=parseInt(ffaValue[0].replace(/,/g,""),10);rec.theFinished=formatNumber(ffaValue[0])+" sq.ft.";}}else{rec.theFinished="";}
roomArray=[];if(room1!=""){roomArray.push(room1);}
if(room2!=""){roomArray.push(room2);}
if(room3!=""){roomArray.push(room3);}
if(room4!=""){roomArray.push(room4);}
if(room5!=""){roomArray.push(room5);}
if(room6!=""){roomArray.push(room6);}
if(room7!=""){roomArray.push(room7);}
if(room8!=""){roomArray.push(room8);}
if(room9!=""){roomArray.push(room9);}
if(room10!=""){roomArray.push(room10);}
if(room11!=""){roomArray.push(room11);}
if(room12!=""){roomArray.push(room12);}
if(room13!=""){roomArray.push(room13);}
if(room14!=""){roomArray.push(room14);}
if(room15!=""){roomArray.push(room15);}
if(room16!=""){roomArray.push(room16);}
if(room17!=""){roomArray.push(room17);}
if(room18!=""){roomArray.push(room18);}
if(room19!=""){roomArray.push(room19);}
if(room20!=""){roomArray.push(room20);}
if(room21!=""){roomArray.push(room21);}
if(room22!=""){roomArray.push(room22);}
if(room23!=""){roomArray.push(room23);}
if(room24!=""){roomArray.push(room24);}
if(room25!=""){roomArray.push(room25);}
if(room26!=""){roomArray.push(room26);}
if(room27!=""){roomArray.push(room27);}
if(room28!=""){roomArray.push(room28);}
bathroomArray=[];if(bathroom1!=""){bathroomArray.push(bathroom1);}
if(bathroom2!=""){bathroomArray.push(bathroom2);}
if(bathroom3!=""){bathroomArray.push(bathroom3);}
if(bathroom4!=""){bathroomArray.push(bathroom4);}
if(bathroom5!=""){bathroomArray.push(bathroom5);}
if(bathroom6!=""){bathroomArray.push(bathroom6);}
if(bathroom7!=""){bathroomArray.push(bathroom7);}
if(bathroom8!=""){bathroomArray.push(bathroom8);}
rec.theRooms=roomArray;rec.theBathrooms=bathroomArray;rec.theCable=cable;rec.theGas=gas;rec.theElectricity=electricity;rec.theTelephone=telephone;rec.theStorm=storm;rec.theFencing=fencing;rec.theAccess=access;rec.theALR=alr;rec.theFlood=flood;rec.theRestrictions=restrictions;rec.theVOWonly=(vow==1);rec.thePropType=propType;if(typeof sellingAgent==="undefined"){sellingAgent="";sellingBrokerage="";}
rec.theSellingAgent=sellingAgent;rec.theSellingBrokerage=sellingBrokerage;rec.watched=false;return rec;}
function switchData(){var i;var r,rm;for(i=1;i<=gPropertyCount;i++){r=propertyDB[i];rm=r.theMarker;if(rm.isOverlaid){google.maps.event.clearInstanceListeners(rm);}}
gMC.clearMarkers();propertyDB=[];loadPropertiesDoc(kPropertiesLoadDB,"u="+kPropertiesActiveFile);gOverlaidAll=false;overlayBegin(1);gOptionKeyDown=false;hideInfoPanel();addDateDisplay();google.maps.event.trigger(gMap,"idle");filterProperties();showFavoritesList();showFoundList();}
function loadPropertiesDoc(url,parms){try{gRequestLoad=new XMLHttpRequest()
gRequestLoad.open("POST",url,false);gRequestLoad.setRequestHeader("Content-Type","application/x-www-form-urlencoded");gRequestLoad.send(parms);processPropertyData();}catch(e){alert(e.message);}}
function processPropertyData(){var i,j,ip;var db;var dbRecords;var p;if(gRequestLoad.readyState==4){if(gRequestLoad.status==200||gRequestLoad.status==0){db=gRequestLoad.responseText;if(db.charAt(db.length-1)=="\n"){db=db.substring(0,db.length-1);}
dbRecords=db.split("\n");propertyDB[0]=dbRecords[0];gPropertyCounter=propertyDB.length-1;ip=1;for(i=1;i<dbRecords.length;i++){p=dbRecords[i].split("\t");p[1]=parseFloat(p[1],10);p[2]=parseFloat(p[2],10);p[7]=parseFloat(p[7],10);p[12]=parseInt(p[12],10);p[13]=parseFloat(p[13],10);p[14]=parseInt(p[14],10);p[25]=parseFloat(p[25],10);p[27]=parseFloat(p[27],10);p[32]=parseFloat(p[32],10);p[37]=parseInt(p[37],10);p[39]=parseInt(p[39],10);p[43]=parseInt(p[43],10);p[82]=parseInt(p[82],10);p[83]=parseInt(p[83],10);p[88]=parseInt(p[88],10);p[89]=parseInt(p[89],10);p[90]=parseInt(p[90],10);p[91]=parseInt(p[91],10);p[92]=parseInt(p[92],10);p[93]=parseInt(p[93],10);p[94]=parseInt(p[94],10);p[108]=parseInt(p[108],10);p[109]=parseInt(p[109],10);p[110]=parseInt(p[110],10);p[121]=parseInt(p[121],10);for(j=ip;j<propertyDB.length;j++){if(p[7]<propertyDB[j].thePrice){break;}}
ip=j;propertyDB.splice(ip,0,M(p[0],p[3],p[34],p[1],p[2],p[5],p[4],p[6],p[7],p[25],p[26],p[27],p[38],p[24],p[9],p[10],p[8],p[21],p[22],p[23],p[20],p[11],p[14],p[12],p[13],p[15],p[16],p[19],p[29],p[30],p[31],p[32],p[33],p[36],p[37],p[40],p[43],p[35],p[44],p[45],p[46],p[47],p[48],p[49],p[50],p[51],p[52],p[53],p[54],p[55],p[56],p[57],p[58],p[59],p[60],p[61],p[62],p[63],p[64],p[65],p[66],p[67],p[68],p[69],p[70],p[71],p[72],p[73],p[74],p[75],p[76],p[77],p[78],p[79],p[80],p[81],p[82],p[83],p[84],p[85],p[86],p[87],p[88],p[89],p[90],p[91],p[92],p[93],p[94],p[95],p[96],p[97],p[98],p[99],p[100],p[101],p[102],p[103],p[104],p[105],p[107],p[108],p[109],p[110],p[111],p[112],p[113],p[114],p[115],p[116],p[117],p[118],p[119],p[120],p[39],p[121],p[17],p[18],p[106]));ip++;}
gPropertyCount=propertyDB.length-1;for(i=1;i<=gPropertyCount;i++){propertyDB[i].theMarker.index=i;}}}}
function R(regionName,latitude,longitude,zoomLevel){var rec={};rec.theRegionName=regionName;rec.theLocation=new google.maps.LatLng(latitude,longitude);rec.theZoomLevel=zoomLevel;return rec;}
function regionChanged(f){var i=f.elements[kRegionSelect].value;if(i!==""){gMap.setOptions({center:new google.maps.LatLng(kViewingAreas[i][1],kViewingAreas[i][2]),zoom:kViewingAreas[i][3]});}}
function populateRegionSelect(){var i;if(kViewingAreas.length>0){gMapFormUpper.elements[kRegionSelect].options[0]=new Option("","",true);gMapFormUpper.elements[kRegionSelect].options[0].innerHTML="Go to Neighbourhood &darr;";for(i=0;i<kViewingAreas.length;i++){gMapFormUpper.elements[kRegionSelect].options[i+1]=new Option("",i);gMapFormUpper.elements[kRegionSelect].options[i+1].innerHTML=kViewingAreas[i][0];}}else{document.getElementById(kPanArea).style.display="none";}}
function loadLabels(){labelDB=[];if(kShowExtraNames){try{gLabelLoad=new XMLHttpRequest();gLabelLoad.open("GET",kMapLabelFile,false);gLabelLoad.setRequestHeader("Content-Type","application/x-www-form-urlencoded");gLabelLoad.send(null);processLabels();}catch(e){}}}
function processLabels(){var i;var f;var db,dbRecords;var label;var z=gMap.getZoom();if(gLabelLoad.readyState==4){if(gLabelLoad.status==200||gLabelLoad.status==0){db=gLabelLoad.responseText;dbRecords=db.split("\n");for(i=0;i<dbRecords.length;i++){dbRecords[i]=dbRecords[i].trim();if(dbRecords[i]!=""){f=dbRecords[i].split("\t");label=new InfoBox({content:f[0],position:new google.maps.LatLng(f[1],f[2]),boxClass:kMapLabelClass,disableAutoPan:true,closeBoxURL:"",pane:"mapPane",enableEventPropagation:true});label.theZoomLevel=f[3];labelDB.push(label);}}
setMapLabelVisibility(z);}}}
function setMapLabelVisibility(z){var i;var label;for(i=0;i<labelDB.length;i++){label=labelDB[i];if(label.theZoomLevel>z){label.close();}else{label.open(gMap);}}}
function loadLandmarks(){landmarkDB=[];landmarkDB.push(makeLandmarkRecord("","","","",kSpot,0,0));try{gLandmarkLoad=new XMLHttpRequest();gLandmarkLoad.open("GET",kMapLandmarkFile,false);gLandmarkLoad.setRequestHeader("Content-Type","application/x-www-form-urlencoded");gLandmarkLoad.send(null);processLandmarks();}catch(e){}}
function processLandmarks(){var i;var f;var db,dbRecords;var rec;if(gLandmarkLoad.readyState==4){if(gLandmarkLoad.status==200||gLandmarkLoad.status==0){db=gLandmarkLoad.responseText;dbRecords=db.split("\n");for(i=0;i<dbRecords.length;i++){dbRecords[i]=dbRecords[i].trim();if(dbRecords[i]!=""){f=dbRecords[i].split("\t");f[4]=parseInt(f[4],10);rec=makeLandmarkRecord(f[0],f[1],f[2],f[3],f[4],f[5],f[6]);landmarkDB.push(rec);}}
addLandmarks();}}}
function makeLandmarkRecord(description,streetAddress,town,telephoneNumber,landmarkCode,latitude,longitude){var theIcon;var size,origin,anchor;var spriteOffsetV=0;var spriteOffsetH=0;var landmarkLabel;var tt="";var rec={};switch(landmarkCode){case kPolice:spriteOffsetH=0*kLandmarkMarkerWidth;break;case kPostOffice:spriteOffsetH=1*kLandmarkMarkerWidth;break;case kWharf:spriteOffsetH=2*kLandmarkMarkerWidth;break;case kFire:spriteOffsetH=3*kLandmarkMarkerWidth;break;case kHospital:spriteOffsetH=4*kLandmarkMarkerWidth;break;case kSchool:spriteOffsetH=5*kLandmarkMarkerWidth;break;case kLibrary:spriteOffsetH=6*kLandmarkMarkerWidth;break;case kRecreation:spriteOffsetH=7*kLandmarkMarkerWidth;break;case kAccess:spriteOffsetH=8*kLandmarkMarkerWidth;break;case kHistory:spriteOffsetH=9*kLandmarkMarkerWidth;break;case kWorship:spriteOffsetH=10*kLandmarkMarkerWidth;break;case kFerry:spriteOffsetH=11*kLandmarkMarkerWidth;break;}
if(landmarkCode==kBrokerage){theIcon=new google.maps.MarkerImage(kBrokerageIconURL,new google.maps.Size(kBrokerageIconWidth,kBrokerageIconHeight),new google.maps.Point(0,0),new google.maps.Point(kBrokerageIconWidth/2,kBrokerageIconHeight/2));rec.theMarker=new google.maps.Marker({position:new google.maps.LatLng(latitude,longitude),icon:theIcon});}else{if(landmarkCode!=kSpot){gLandmarksExist=true;}
size=new google.maps.Size(kLandmarkMarkerWidth,kLandmarkMarkerHeight);origin=new google.maps.Point(spriteOffsetH,spriteOffsetV);anchor=new google.maps.Point(kLandmarkMarkerWidth/2,kLandmarkMarkerHeight/2);theIcon=new google.maps.MarkerImage(kLandmarksURL,size,origin,anchor);rec.theMarker=new google.maps.Marker({position:new google.maps.LatLng(latitude,longitude),icon:theIcon,clickable:true,visible:true});}
tt+="<div id='"+kTooltipID+"'>";if(description!==""){tt+="<b>"+description+"</b>";}
if(streetAddress!==""){tt+="<br>"+streetAddress;}
if(town!==""){tt+="<br>"+town;}
if(landmarkCode==kPhoto){tt+="<br>Click the marker to see the photo";rec.theMarker.url=telephoneNumber;}else if(telephoneNumber!==""){tt+="<br><b>"+telephoneNumber+"</b>";}
tt+="</div>";rec.theMarker.tooltip=tt;rec.code=landmarkCode;rec.inFoundSet=false;return rec;}
function addLandmarks(){var i;var marker;for(i=0;i<landmarkDB.length;i++){marker=landmarkDB[i].theMarker;if(landmarkDB[i].code==kPhoto){google.maps.event.addListener(marker,"click",function(){window.open(this.url);});}
google.maps.event.addListener(marker,"dblclick",function(c){gMap.setZoom(gMap.getZoom()+1);gMap.setCenter(this.getPosition());});google.maps.event.addListener(marker,"mouseover",function(){showTooltipLandmark(this);});google.maps.event.addListener(marker,"mouseout",function(){gSummaryBox.hide();});if(landmarkDB[i].code==kBrokerage){landmarkDB[i].inFoundSet=true;marker.setMap(gMap);}else{landmarkDB[i].inFoundSet=false;marker.setMap(null);}}}
function showTooltipLandmark(marker){var c=marker.getPosition();c=adjustTooltipPosition(c,100);gSummaryBox.setContent(marker.tooltip);gSummaryBox.setPosition(c);if(gPanoViewer.getVisible()){gSummaryBox.open(gPanoViewer);}else{gSummaryBox.open(gMap);}
google.maps.event.addListenerOnce(gSummaryBox,"domready",function(){gSummaryBox.show();});}
function adjustTooltipPosition(c,vClearance){var p;var w,h;var kBoxWidth=322;p=gMapOverlay.getProjection().fromLatLngToContainerPixel(c);w=parseInt(gMap.getDiv().style.width,10);h=parseInt(gMap.getDiv().style.height,10);if(p.x<kBoxWidth/2){p.x=kBoxWidth/2;}else if(p.x>(w-kBoxWidth/2)){p.x=w-kBoxWidth/2;}
if(p.y>(h-vClearance)){p.y-=vClearance;}
p.y+=6;return gMapOverlay.getProjection().fromContainerPixelToLatLng(p);}
function resetLandmarks(){var i;try{gMapFormLower.elements[kPoliceBox].checked=false;}catch(e1){}
try{gMapFormLower.elements[kFireBox].checked=false;}catch(e2){}
try{gMapFormLower.elements[kHospitalBox].checked=false;}catch(e3){}
try{gMapFormLower.elements[kPostOfficeBox].checked=false;}catch(e4){}
try{gMapFormLower.elements[kFerryBox].checked=false;}catch(e5){}
try{gMapFormLower.elements[kWharfBox].checked=false;}catch(e6){}
try{gMapFormLower.elements[kSchoolBox].checked=false;}catch(e7){}
try{gMapFormLower.elements[kLibraryBox].checked=false;}catch(e8){}
try{gMapFormLower.elements[kRecreationBox].checked=false;}catch(e9){}
try{gMapFormLower.elements[kPhotoBox].checked=false;}catch(e10){}
try{gMapFormLower.elements[kAccessBox].checked=false;}catch(e11){}
try{gMapFormLower.elements[kHistoryBox].checked=false;}catch(e12){}
try{gMapFormLower.elements[kWorshipBox].checked=false;}catch(e13){}
for(i=1;i<landmarkDB.length;i++){if(landmarkDB[i].code==kBrokerage){landmarkDB[i].inFoundSet=true;landmarkDB[i].theMarker.setMap(gMap);}else{landmarkDB[i].inFoundSet=false;landmarkDB[i].theMarker.setMap(null);}}}
function hideLandmarks(landmarkCode){var i;for(i=1;i<landmarkDB.length;i++){if(landmarkDB[i].code==landmarkCode){landmarkDB[i].inFoundSet=false;landmarkDB[i].theMarker.setMap(null);}}}
function showLandmarks(landmarkCode){var i;for(i=1;i<landmarkDB.length;i++){if(landmarkDB[i].code==landmarkCode){landmarkDB[i].inFoundSet=true;landmarkDB[i].theMarker.setMap(gMap);landmarkDB[i].theMarker.setAnimation(google.maps.Animation.DROP);}}}
function setLandmarks(landmarkList){var i;var s;landmarkList=landmarkList.toLowerCase();if(landmarkList=="all"){landmarkList="police,fire,hospital,post,ferry,wharf,school,library,recreation,photo,access,history,worship";}
s=landmarkList.split(",");if(s.length>0){for(i=0;i<s.length;i++){switch(s[i].trim()){case"police":try{gMapFormLower.elements[kPoliceBox].checked=true;}catch(e1){}
showLandmarks(kPolice);break;case"fire":try{gMapFormLower.elements[kFireBox].checked=true;}catch(e2){}
showLandmarks(kFire);break;case"hospital":try{gMapFormLower.elements[kHospitalBox].checked=true;}catch(e3){}
showLandmarks(kHospital);break;case"post":try{gMapFormLower.elements[kPostOfficeBox].checked=true;}catch(e4){}
showLandmarks(kPostOffice);break;case"ferry":try{gMapFormLower.elements[kFerryBox].checked=true;}catch(e5){}
showLandmarks(kFerry);break;case"wharf":try{gMapFormLower.elements[kWharfBox].checked=true;}catch(e6){}
showLandmarks(kWharf);break;case"school":try{gMapFormLower.elements[kSchoolBox].checked=true;}catch(e7){}
showLandmarks(kSchool);break;case"library":try{gMapFormLower.elements[kLibraryBox].checked=true;}catch(e8){}
showLandmarks(kLibrary);break;case"recreation":try{gMapFormLower.elements[kRecreationBox].checked=true;}catch(e9){}
showLandmarks(kRecreation);break;case"photo":try{gMapFormLower.elements[kPhotoBox].checked=true;}catch(e10){}
showLandmarks(kPhoto);break;case"access":try{gMapFormLower.elements[kAccessBox].checked=true;}catch(e11){}
showLandmarks(kAccess);break;case"history":try{gMapFormLower.elements[kHistoryBox].checked=true;}catch(e12){}
showLandmarks(kHistory);break;case"worship":try{gMapFormLower.elements[kWorshipBox].checked=true;}catch(e13){}
showLandmarks(kWorship);break;default:}}}}
function getLandmarkList(){var landmarkList=[];try{if(gMapFormLower.elements[kPoliceBox].checked){landmarkList.push("police");}}catch(e1){}
try{if(gMapFormLower.elements[kFireBox].checked){landmarkList.push("fire");}}catch(e2){}
try{if(gMapFormLower.elements[kHospitalBox].checked){landmarkList.push("hospital");}}catch(e3){}
try{if(gMapFormLower.elements[kPostOfficeBox].checked){landmarkList.push("post");}}catch(e4){}
try{if(gMapFormLower.elements[kFerryBox].checked){landmarkList.push("ferry");}}catch(e5){}
try{if(gMapFormLower.elements[kWharfBox].checked){landmarkList.push("wharf");}}catch(e6){}
try{if(gMapFormLower.elements[kSchoolBox].checked){landmarkList.push("school");}}catch(e7){}
try{if(gMapFormLower.elements[kLibraryBox].checked){landmarkList.push("library");}}catch(e8){}
try{if(gMapFormLower.elements[kRecreationBox].checked){landmarkList.push("recreation");}}catch(e9){}
try{if(gMapFormLower.elements[kPhotoBox].checked){landmarkList.push("photo");}}catch(e10){}
try{if(gMapFormLower.elements[kAccessBox].checked){landmarkList.push("access");}}catch(e11){}
try{if(gMapFormLower.elements[kHistoryBox].checked){landmarkList.push("history");}}catch(e12){}
try{if(gMapFormLower.elements[kWorshipBox].checked){landmarkList.push("worship");}}catch(e13){}
return landmarkList.join(",");}
function togglePolice(f){if(f.elements[kPoliceBox].checked){showLandmarks(kPolice);}else{hideLandmarks(kPolice);}}
function toggleFire(f){if(f.elements[kFireBox].checked){showLandmarks(kFire);}else{hideLandmarks(kFire);}}
function toggleHospital(f){if(f.elements[kHospitalBox].checked){showLandmarks(kHospital);}else{hideLandmarks(kHospital);}}
function togglePostOffice(f){if(f.elements[kPostOfficeBox].checked){showLandmarks(kPostOffice);}else{hideLandmarks(kPostOffice);}}
function toggleFerry(f){if(f.elements[kFerryBox].checked){showLandmarks(kFerry);}else{hideLandmarks(kFerry);}}
function toggleWharf(f){if(f.elements[kWharfBox].checked){showLandmarks(kWharf);}else{hideLandmarks(kWharf);}}
function toggleSchool(f){if(f.elements[kSchoolBox].checked){showLandmarks(kSchool);}else{hideLandmarks(kSchool);}}
function toggleLibrary(f){if(f.elements[kLibraryBox].checked){showLandmarks(kLibrary);}else{hideLandmarks(kLibrary);}}
function toggleRecreation(f){if(f.elements[kRecreationBox].checked){showLandmarks(kRecreation);}else{hideLandmarks(kRecreation);}}
function togglePhoto(f){if(f.elements[kPhotoBox].checked){showLandmarks(kPhoto);}else{hideLandmarks(kPhoto);}}
function toggleAccess(f){if(f.elements[kAccessBox].checked){showLandmarks(kAccess);}else{hideLandmarks(kAccess);}}
function toggleHistory(f){if(f.elements[kHistoryBox].checked){showLandmarks(kHistory);}else{hideLandmarks(kHistory);}}
function toggleWorship(f){if(f.elements[kWorshipBox].checked){showLandmarks(kWorship);}else{hideLandmarks(kWorship);}}
function getWalkScore(mlsNumber){var req;var parms;var i=getIndexFromID(mlsNumber);var address=propertyDB[i].theStreetAddress;var town=propertyDB[i].theTown;var city=propertyDB[i].theCity;var coords=propertyDB[i].theMarker.getPosition();var latitude=coords.lat().toFixed(5);var longitude=coords.lng().toFixed(5);if(city!==""){address+=", "+city;}else{address+=", "+town;}
address+=", "+kProvinceCountry;parms="?address="+escape(address);parms+="&lat="+latitude;parms+="&lon="+longitude;req=new XMLHttpRequest();req.open("GET",kWalkScoreURL+parms,true);req.onreadystatechange=function(message,errorCode){var json,result;var h;if(req.readyState==4){if(req.status==200||req.status==0){result=req.responseText;json=result?eval('('+result+')'):"";if(json){if(json.status==1){h='<a target="_blank" href="'+json.ws_link+'"><img src="'+json.logo_url+'" border="0" /> <span class="walkscore-scoretext">'+json.walkscore+'</span></a>'+" ("+json.description+")";h+=' <a target="_blank" href="'+json.more_info_link+'"><img src="'+json.more_info_icon+'" border="0" /></a>';}else if(json.status==2){h='<a target="_blank" href="'+json.ws_link+'"><img src="'+json.logo_url+'" border="0" /> <span class="walkscore-noscoretext">Get Score</span></a>';}else{h='<a target="_blank" href="http://www.walkscore.com"><img src="http://www2.walkscore.com/images/api-logo.gif" border="0" /> <span class="walkscore-noscoretext">Get Score</span></a> ';}}
try{document.getElementById("walkscore").innerHTML=h;}catch(e){}}}};req.send(null);}
function displayPanoButton(i){var latlng=propertyDB[i].theMarker.getPosition();gStreetViewService.getPanoramaByLocation(latlng,100,function(data,status){if(status!=google.maps.StreetViewStatus.OK){document.getElementById(kStreetViewButtonID).disabled=true;}});}
function showPano(i){var latlng=propertyDB[i].theMarker.getPosition();gPanoAddress.innerHTML=propertyDB[i].theStreetAddress;gStreetViewService.getPanoramaByLocation(latlng,100,function(data,status){if(status==google.maps.StreetViewStatus.OK){gPanoViewer.setPano(data.location.pano);gPanoViewer.setPov({heading:getBearing(data.location.latLng,latlng),pitch:0,zoom:0});gPanoViewer.setVisible(true);}});}
function getBearing(startPt,endPt){var lat1=rad(startPt.lat());var lat2=rad(endPt.lat());var dLon=rad(endPt.lng()-startPt.lng());var y=Math.sin(dLon)*Math.cos(lat2);var x=(Math.cos(lat1)*Math.sin(lat2))-(Math.sin(lat1)*Math.cos(lat2)*Math.cos(dLon));var bearing=Math.atan2(y,x)*180/Math.PI;return bearing;}
function rad(d){return d*Math.PI/180;}
function showLoginBox(){showDialogBox(getLoginHTML());showSidebar();document.getElementById("loginForm").elements[0].focus();}
function getLoginHTML(){var h="";h+="<div style='border: 2px solid black; padding: 10px; width: "+(kMapSidebarWidth-24)+"px; font-size: 10pt; text-align: center;'>";h+="<div style='font-size: 18pt; font-weight: bold;'>Map Log In</div>";h+="<hr>";h+="<form id='loginForm' action='javascript:void(0)'>";h+="Don't have an Account? <a href='javascript:void(0)' onclick='showRegisterBox();'>Go to Registration page</a>";h+="<br>";h+="Forgot your Password? <a href='javascript:void(0)' onclick='showChangePasswordBox();'>Go to Change Password page</a>";h+="<p>";h+="<div style='border: 1px solid black; margin: 5px; padding: 5px; font-size: 9pt; text-align: justify;'>";h+="Log in to load map information that was saved the last time you used the map while logged in. ";h+="When you are logged in you also have access to advanced map features as well as additional ";h+="property information.";h+="</div>";h+="Your Email Address:";h+="<br>";h+="<input name='email' style='width: 240px;'>";h+="<br>";h+="Your Password:";h+="<br>";h+="<input name='password' type=password style='width: 240px;'>";h+="<br>";h+="<input name='loginPref' type=checkbox value='1' checked>Remember Me on this browser";h+="<p>";h+="<div id='loginStatus' style='color: red; font-weight: bold; display: none;'></div>";h+="<input type=button value='Cancel' onclick='hideDialogBox();'> <input type=submit value='Log In' onclick='userLogin(); return false;'>";h+="</form>";h+="</div>";return h;}
function showRegisterBox(){showDialogBox(getRegisterHTML());showSidebar();document.getElementById("registerForm").elements[0].focus();}
function getRegisterHTML(){var h="";h+="<div style='border: 2px solid black; padding: 10px; width: "+(kMapSidebarWidth-24)+"px; font-size: 10pt; text-align: center;'>";h+="<div style='font-size: 18pt; font-weight: bold;'>Map Registration</div>";h+="<hr>";h+="Already have an Account? <a href='javascript:void(0)' onclick='showLoginBox();'>Go to Log In page</a>";h+="<p>";h+="<div style='border: 1px solid black; margin: 5px; padding: 5px; font-size: 8pt; text-align: justify;'>";h+="Registration creates an Account for you so that you can log in to the map. When logged in, a variety of map data ";h+="are saved automatically when you leave the map page and restored when you return and log in ";h+="(even if you return on a different computer). More property information is also shown when you are logged in.";h+="</div>";h+="<form id='registerForm' action='javascript:void(0)'>";h+="Your Name:";h+="<br>";h+="<input name='realName' style='width: 240px;'>";h+="<br>";h+="Your Email Address:";h+="<br>";h+="<input name='email' style='width: 240px;'>";h+="<br>";h+="Your Telephone Number:";h+="<br>";h+="<input name='telephone' style='width: 240px;'>";h+="<br>";h+="Provide a Password:";h+="<br>";h+="<input name='password' type=password style='width: 240px;'>";h+="<br>";h+="<input name='legal' type=checkbox value='1'>I agree to the <a href='"+kMapTermsName+"'>Terms of Use</a> at the bottom of this page.";h+="<br>";h+="<input name='loginPref' type=checkbox value='1' checked>Remember Me on this browser";h+="<p>";h+="<center>";h+="<table align=center style='font-size: 10pt;'><tr><td>";h+="<img id='captcha' src='"+kCaptchaFolder+"securimage_show.php' border=2>";h+="<td align=center>";h+="Type security word<br>";h+="<i>Not case sensitive</i><br>";h+="<a href='javascript:void(0)' onclick='document.getElementById(\"captcha\").src = \""+kCaptchaFolder+"securimage_show.php?\" + Math.random(); return false;'>Show a New Word</a><br>";h+="<input type='text' name='captcha_code' size='10' maxlength='6'><br>(required)";h+="</table>";h+="</center>";h+="<div id='registerStatus' style='color: red; font-weight: bold; display: none;'></div>";h+="<input type=button value='Cancel' onclick='hideDialogBox();'> <input type=submit value='Register' onclick='userRegister(); return false;'>";h+="</form>";h+="</div>";return h;}
function showChangePasswordBox(){showDialogBox(getChangeHTML());showSidebar();document.getElementById("changeForm").elements[0].focus();}
function getChangeHTML(){var h="";h+="<div style='border: 2px solid black; padding: 10px; width: "+(kMapSidebarWidth-24)+"px; font-size: 10pt; text-align: center;'>";h+="<div style='font-size: 18pt; font-weight: bold;'>Change Password</div>";h+="<hr>";h+="<form id='changeForm' action='javascript:void(0)'>";h+="Your Email Address:";h+="<br>";h+="<input name='email' style='width: 240px;'>";h+="<br>";h+="Your New Password:";h+="<br>";h+="<input name='pw' type=password style='width: 240px;'>";h+="<p>";h+="<center>";h+="<table align=center style='font-size: 10pt;'><tr><td>";h+="<img id='captcha' src='"+kCaptchaFolder+"securimage_show.php' border=2>";h+="<td align=center>";h+="Type security word<br>";h+="<i>Not case sensitive</i><br>";h+="<a href='javascript:void(0)' onclick='document.getElementById(\"captcha\").src = \""+kCaptchaFolder+"securimage_show.php?\" + Math.random(); return false;'>Show a New Word</a><br>";h+="<input type='text' name='captcha_code' size='10' maxlength='6'><br>(required)";h+="</table>";h+="</center>";h+="<div id='changeStatus' style='color: red; font-weight: bold; display: none;'></div>";h+="<input type=button value='Cancel' onclick='hideDialogBox();'> <input type=submit value='Change Password' onclick='userChange(); return false;'>";h+="</form>";h+="</div>";return h;}
function getConfirmHTML(){var h="";h+="<div style='border: 2px solid black; padding: 10px; width: "+(kMapSidebarWidth-24)+"px; font-size: 10pt; text-align: center;'>";h+="<div style='font-size: 18pt; font-weight: bold;'>Confirm Password</div>";h+="<hr>";h+="<div style='border: 1px solid black; margin: 5px; padding: 5px; text-align: justify;'>";h+="For security reasons, you must confirm your new password before you can log in. ";h+="An email has been sent to you with instructions on how to do this.";h+="<p>";h+="Once you confirm, you can log in by clicking the <i>Log In</i> link in the bar above the map.";h+="<p>";h+="<span style='color: red;'>";h+="NOTE: If you do not receive the confirmation email, check your Junk or Spam folder. If you ";h+="still can't find the email, send me an email at ";h+="<span style='color: black; font-weight: bold;'>"+kAgentEmail+"</span>";h+=" and I will activate your account.";h+="</span>";h+="</div>";h+="<form>";h+="<input type=button value=' OK ' onclick='hideDialogBox();'>";h+="</form>";h+="</div>";return h;}
function getExpiredHTML(a,b,c){var h="";h+="<div style='border: 2px solid black; padding: 10px; width: "+(kMapSidebarWidth-24)+"px; font-size: 10pt; text-align: center;'>";h+="<div style='font-size: 18pt; font-weight: bold;'>Renew Password</div>";h+="<hr>";h+="<div style='border: 1px solid black; margin: 5px; padding: 5px; text-align: justify;'>";h+="Your password has expired. To renew it for another 30 days, click the <i>Renew</i> ";h+="button below.";h+="</div>";h+="<form>";h+="<input type=button value='Cancel' onclick='hideDialogBox();'> <input type=button value='Renew' onclick='gUserName=\""+a+"\"; gUserPassword=\""+b+"\"; gRememberLogin=\""+c+"\"; userSet(\"registration-date\",\""+getCurrentTimeString()+"\"); initLoginData(); hideDialogBox();'>";h+="</form>";h+="</div>";return h;}
function getRefusedHTML(){var h="";h+="<div style='border: 2px solid black; padding: 10px; width: "+(kMapSidebarWidth-24)+"px; font-size: 10pt; text-align: center;'>";h+="<div style='font-size: 18pt; font-weight: bold;'>Confirm Password</div>";h+="<hr>";h+="<div style='border: 1px solid black; margin: 5px; padding: 5px; text-align: justify;'>";h+="You have not yet confirmed your password so you cannot log in. An email was previously ";h+="sent to you with instructions on how to confirm; if you no longer have this email, click ";h+="the <i>Change Password</i> button below to provide a new password, otherwise click ";h+="the <i>Cancel</i> button.";h+="<p>";h+="<span style='color: red;'>";h+="NOTE: If you do not receive the confirmation email, check your Junk or Spam folder. If you ";h+="still can't find the email, send me an email at ";h+="<span style='color: black; font-weight: bold;'>"+kAgentEmail+"</span>";h+=" and I will activate your account.";h+="</span>";h+="</div>";h+="<form>";h+="<input type=button value='Cancel' onclick='hideDialogBox();'> <input type=button value='Change Password' onclick='showChangePasswordBox();'>";h+="</form>";h+="</div>";return h;}
function userRegister(){var reply;var f=document.getElementById("registerForm");var lineElement=document.getElementById(kRegisterStatusID);var parms="";parms+="&email="+escape(f.email.value);parms+="&password="+escape(f.password.value);parms+="&realName="+escape(f.realName.value);parms+="&telephone="+escape(f.telephone.value);parms+="&dbFolder="+escape(kAccountsFolder);parms+="&mapurl="+escape(gBaseURL);parms+="&confirmurl="+escape(kUserConfirmURL+"?map="+kMapName+"&user="+kUserData);parms+="&contactinfo="+escape(kAgentContactInfo);parms+="&agentemail="+(kShowSheetBranding?escape(kAgentEmail):escape(kAgentBrokerageEmail));parms+="&captcha_code="+escape(f.captcha_code.value);parms+="&action=register";if(!f.legal.checked){reply="Error: You did not agree to the Terms of Use.";}else{reply=userRequest(kUserActionsURL,parms);}
if(reply=="OK"){showDialogBox(getConfirmHTML());showSidebar();}else{lineElement.innerHTML=reply;lineElement.style.display="";}
return reply;}
function userLogin(){var reply;var f=document.getElementById("loginForm");var lineElement=document.getElementById(kLoginStatusID);var parms="";parms+="&email="+escape(f.email.value);parms+="&password="+escape(f.password.value);parms+="&dbFolder="+escape(kAccountsFolder);parms+="&action=login";reply=userRequest(kUserActionsURL,parms);if(reply.substr(0,2)=="OK"){if(reply.substr(0,4)=="OK-1"){showDialogBox(getRefusedHTML());showSidebar();document.getElementById(kChangePageID).style.display="none";return;}
if(reply.substr(0,4)=="OK-2"){showDialogBox(getExpiredHTML(f.email.value,reply.substr(4),(f.loginPref.checked?"1":"")));showSidebar();return;}
gUserName=f.email.value;gUserPassword=reply.substr(2);gRememberLogin=(f.loginPref.checked?"1":"");document.getElementById("savedSearchLine").style.display="";initLoginData();hideDialogBox();hideInfoPanel();gVOWactive=true;}else{gUserName="";gUserPassword="";gRememberLogin="";gVOWactive=false;reply="Log In Failed (network error)";lineElement.innerHTML=reply;lineElement.style.display="";}
filterProperties();saveUserLogin();return reply;}
function userLoginDirect(){var reply;var name;var parms="";parms+="&email="+escape(gUserName);parms+="&password="+escape(gUserPassword);parms+="&dbFolder="+escape(kAccountsFolder);parms+="&encoded=1";parms+="&action=login";reply=userRequest(kUserActionsURL,parms);if(reply.substr(0,2)=="OK"&&reply!="OK-1"&&reply!="OK-2"){name=userGet("real-name");if(name.indexOf(" ")!=-1){name=name.substr(0,name.indexOf(" "));}
document.getElementById("loginName").innerHTML="Hello <b>"+name+"</b>";document.getElementById("loginButton").style.display="none";document.getElementById("logoutButton").style.display="";document.getElementById("savedSearchLine").style.display="";gRememberLogin="1";gVOWactive=true;}else{document.getElementById("loginName").innerHTML="";document.getElementById("loginButton").style.display="";document.getElementById("logoutButton").style.display="none";document.getElementById("savedSearchLine").style.display="none";gUserName="";gUserPassword="";gRememberLogin="";saveUserLogin();gVOWactive=false;}
return reply;}
function userChange(){var reply;var f=document.getElementById("changeForm");var lineElement=document.getElementById(kChangeStatusID);var parms="";parms+="&email="+escape(f.email.value);parms+="&password="+escape(f.pw.value);parms+="&dbFolder="+escape(kAccountsFolder);parms+="&mapurl="+escape(gBaseURL);parms+="&confirmurl="+escape(kUserConfirmURL+"?map="+kMapName+"&user="+kUserData);parms+="&contactinfo="+escape(kAgentContactInfo);parms+="&agentemail="+(kShowSheetBranding?escape(kAgentEmail):escape(kAgentBrokerageEmail));parms+="&captcha_code="+escape(f.captcha_code.value);parms+="&action=change";reply=userRequest(kUserActionsURL,parms);if(reply=="OK"){showDialogBox(getConfirmHTML());showSidebar();}else{lineElement.innerHTML=reply;lineElement.style.display="";}
return reply;}
function userLogout(){saveUserData();gUserName="";gUserPassword="";gRememberLogin="";saveUserLogin();clearNotesField();document.getElementById("loginName").innerHTML="";document.getElementById("loginButton").style.display="";document.getElementById("logoutButton").style.display="none";document.getElementById("savedSearchLine").style.display="none";gParametersInit="";parseCommandLine(gParametersInit);gFavoritesList="";loadUserData();showSearchBar();window.onresize();invokeCommandLine();markForceOffAll();markPropertiesByID(gFavoritesList);showFavoritesList();showFoundList();hideInfoPanel();gVOWactive=false;filterProperties();}
function userGet(field){var reply;var parms="";parms+="&email="+escape(gUserName);parms+="&password="+escape(gUserPassword);parms+="&dbFolder="+escape(kAccountsFolder);parms+="&field="+escape(field);parms+="&action=get";reply=userRequest(kUserActionsURL,parms);return reply;}
function userGetAll(){var reply;var parms="";parms+="&email="+escape(gUserName);parms+="&password="+escape(gUserPassword);parms+="&dbFolder="+escape(kAccountsFolder);parms+="&action=getall";reply=userRequest(kUserActionsURL,parms);return reply;}
function userSet(field,value){var reply;var parms="";parms+="&email="+escape(gUserName);parms+="&password="+escape(gUserPassword);parms+="&dbFolder="+escape(kAccountsFolder);parms+="&field="+escape(field);parms+="&value="+escape(value);parms+="&action=set";reply=userRequest(kUserActionsURL,parms);return reply;}
function userSetAll(value){var reply;var parms="";parms+="&email="+escape(gUserName);parms+="&password="+escape(gUserPassword);parms+="&dbFolder="+escape(kAccountsFolder);parms+="&value="+escape(value);parms+="&action=setall";reply=userRequest(kUserActionsURL,parms);return reply;}
function userRemove(field){var reply;var parms="";parms+="&email="+escape(gUserName);parms+="&password="+escape(gUserPassword);parms+="&dbFolder="+escape(kAccountsFolder);parms+="&field="+escape(field);parms+="&action=remove";reply=userRequest(kUserActionsURL,parms);return reply;}
function userRequest(url,parms){var request;var reply=null;try{request=new XMLHttpRequest();request.open("POST",url,false);request.setRequestHeader("Content-Type","application/x-www-form-urlencoded");request.send(parms);if(request.status==200||request.status==0){reply=request.responseText;}}catch(e){reply=e.message;}
return reply;}
function initLoginData(){var name;gParametersInit="";parseCommandLine(gParametersInit);loadUserData();markForceOffAll();if(gFavoritesList!=""){markPropertiesByID(gFavoritesList);}
showFavoritesList();showFoundList();window.onresize();gMap.setOptions({center:gStartCoordinates,zoom:gStartZoom,mapTypeId:gStartMode});name=userGet("real-name");if(name.indexOf(" ")!=-1){name=name.substr(0,name.indexOf(" "));}
document.getElementById("loginName").innerHTML="Hello <b>"+name+"</b>";document.getElementById("loginButton").style.display="none";document.getElementById("logoutButton").style.display="";}/*!
 Places API Interface
 
 © 2011 Gary Little
 gary@garylittle.ca

 May 27, 2011
 */function showPlaces(){if(gPlacesFlag){placeSearch({location:gMap.getCenter(),radius:kPlaceRadius,types:""});}else{gPlaceInfoBox.hide();gPlaceCircleOverlay.setMap(null);removePlaceMarkers();}}
function togglePlacesFlag(){gPlacesFlag=!gPlacesFlag;setPlacesOverlay();}
function setPlacesOverlay(){gPlacesBox.className=(gPlacesFlag?kMapControlOnClass:kMapControlOffClass)+" "+kNoprintClass;gPlacesBox.style.marginRight="5px";if(gPlacesFlag){gPlacesBox.title="Hide businesses";}else{gPlacesBox.title="Show businesses";}
try{document.getElementById("bizBox").checked=gPlacesFlag;}catch(e){}
showPlaces();}
function placeSearch(request){var parms;var location="";var radius=0;var types="";if(request.location){location=request.location.lat()+","+request.location.lng();}
if(request.radius){radius=request.radius;}
if(request.types){types=request.types.join("|");}
parms="?location="+escape(location);parms+="&radius="+escape(radius);parms+="&types="+escape(types);parms+="&language="+escape(kPlaceLanguage);parms+="&sensor="+escape(kPlaceSensor);parms+="&f="+escape(kPlaceLocationsFile);parms+="&action=search";callPlacesService(parms,function(data,status){var i;if(status=="OK"){gPlaceInfoBox.hide();gPlaceCircleOverlay.setCenter(gMap.getCenter());gPlaceCircleOverlay.setMap(gMap);removePlaceMarkers();gPlaceAttribution.innerHTML=data.html_attributions.join(" ");for(i=0;i<data.results.length;i++){createPlaceMarker(data.results[i]);}}else{}});}
function placeDetails(request,newWindow){var parms;var reference="";if(request.reference){reference=request.reference;}
parms="?reference="+escape(reference);parms+="&language="+escape(kPlaceLanguage);parms+="&sensor="+escape(kPlaceSensor);parms+="&f="+escape(kPlaceLocationsFile);parms+="&action=details";callPlacesService(parms,function(data,status){var r;if(status=="OK"){r=getPlaceBoxContent(data.result);gPlaceInfoBox.setContent(r);gPlaceInfoBox.setMap(gMap);if(newWindow&&data.result.url){window.open(data.result.url);}}});}
function placeMove(placeID,newLocation){var parms;var location;location=newLocation.lat().toFixed(6)+","+newLocation.lng().toFixed(6);parms="?id="+escape(placeID);parms+="&location="+escape(location);parms+="&sensor="+escape(kPlaceSensor);parms+="&f="+escape(kPlaceLocationsFile);parms+="&action=move";callPlacesService(parms,function(data,status){if(status=="OK"){}else{}});}
function callPlacesService(parms,callback){var req;try{req=new XMLHttpRequest();req.open("GET",kPlaceServiceURL+parms,true);req.onreadystatechange=function(message,errorCode){var json="";var status;if(req.readyState==4){if(req.status==200){if(req.responseText==""){status="UNKNOWN_ERROR";}else{json=eval('('+req.responseText+')');status=json.status;if(json.results&&(json.results.length==0)){status="ZERO_RESULTS";}}}else{status="INVALID_REQUEST";}
callback(json,status);}};req.send(null);}catch(e){}}
function createPlaceMarker(placeResult){var marker,markerImage;if(typeof placeResult.icon=="undefined"){placeResult.icon=kPlacesDefaultIcon;}
markerImage=new google.maps.MarkerImage(placeResult.icon,null,null,new google.maps.Point(6,6),new google.maps.Size(13,13));marker=new google.maps.Marker({map:gMap,position:new google.maps.LatLng(placeResult.geometry.location.lat,placeResult.geometry.location.lng),draggable:(gUserName.toLowerCase()==kCopyrightEmail.toLowerCase()),icon:markerImage,placeID:placeResult.id,reference:placeResult.reference});gPlaceMarkers.push(marker);google.maps.event.addListener(marker,'mouseover',function(){var r=getPlaceBoxContent(placeResult);var p=adjustTooltipPosition(this.getPosition(),165);gPlaceInfoBox.setPosition(p);gPlaceInfoBox.setContent(r);gPlaceInfoBox.open(gMap);gPlaceInfoBox.show();gPlaceIndex=0;gPlaceDetails=false;});google.maps.event.addListener(marker,'mouseout',function(){gPlaceInfoBox.hide();});google.maps.event.addListener(marker,'click',function(){var newWindow=gOptionKeyDown;if(gPlaceMarkersAt.length>1&&!gOptionKeyDown){gPlaceDetails=false;gPlaceIndex=showNextPlaceMarkerAt(gPlaceIndex);}else{if(gPlaceMarkersAt.length>1&&!gPlaceDetails){newWindow=false;}
gPlaceDetails=true;placeDetails({reference:gPlaceMarkersAt[gPlaceIndex].reference},newWindow);}});if(gUserName.toLowerCase()==kCopyrightEmail.toLowerCase()){google.maps.event.addListener(marker,"dragend",function(mEvent){placeMove(placeResult.id,mEvent.latLng);});}
return marker;}
function getPlaceBoxContent(placeResult){var r;var n;var position=new google.maps.LatLng(placeResult.geometry.location.lat,placeResult.geometry.location.lng);n=getPlaceMarkersAt(position,placeResult.id);r="<div style='background: yellow; border: 2px solid black; width: 322px; padding: 2px; text-align: center; font-size: 10pt;'>";r+="<table width='100%'><tr><td>";if(placeResult.icon){r+="<img src='"+placeResult.icon+"'>";}
r+="</td><td>";if(placeResult.name){r+="<span style='color: red; font-weight: bold;'>"+placeResult.name+"</span><br>";}
if(placeResult.formatted_address){r+=placeResult.formatted_address+"<br>";}else if(placeResult.vicinity){r+=placeResult.vicinity+"<br>";}
if(placeResult.formatted_phone_number){r+=placeResult.formatted_phone_number+"<br>";}
if(placeResult.rating){r+="Rating: "+placeResult.rating+"<br>";}
if(placeResult.types){r+=placeResult.types.join(" / ").replace(/_/g," ")+"<br>";}
r+="</td></tr>";r+="<tr><td colspan=2>";if(gPlaceMarkersAt.length>1){r+="Click the marker to see the next nearby result.<br>";r+="Option- or Alt-Click the marker ";if(gPlaceDetails){r+="to visit website.";}else{r+="for more detail.";}}else{if(placeResult.formatted_address){r+="Option- or Alt-Click the marker to visit website.";}else{r+="Click the marker for more detail.";}}
r+="</td></tr></table>";if(gPlaceMarkersAt.length>1){r+="<div style='text-align: right; font-size: 8pt; padding: 5px;'>";r+=(n+1)+" of "+gPlaceMarkersAt.length+" nearby results";r+="</div>";}
r+="</div>";return r;}
function removePlaceMarkers(){var i;for(i=0;i<gPlaceMarkers.length;i++){google.maps.event.clearInstanceListeners(gPlaceMarkers[i]);gPlaceMarkers[i].setMap(null);}
gPlaceMarkers=[];}
function getPlaceMarkersAt(position,id){var i;var nActive;gPlaceMarkersAt=[];for(i=gPlaceMarkers.length-1;i>=0;i--){if(Math.round(gPlaceMarkers[i].getPosition().lat()*10000)==Math.round(position.lat()*10000)&&Math.round(gPlaceMarkers[i].getPosition().lng()*10000)==Math.round(position.lng()*10000)){if(gPlaceMarkers[i].placeID==id){nActive=gPlaceMarkersAt.length;}
gPlaceMarkersAt.push(gPlaceMarkers[i]);}}
return nActive;}
function showNextPlaceMarkerAt(i){var iNext=i+1;if(iNext==gPlaceMarkersAt.length){iNext=0;}
google.maps.event.trigger(gPlaceMarkersAt[iNext],"mouseover");return iNext;}
function PropertyMarker(opt_options){opt_options=opt_options||{};opt_options.boundary=opt_options.boundary||"";this.setBoundary(opt_options.boundary);google.maps.Marker.apply(this,arguments);}
PropertyMarker.prototype=new google.maps.Marker();PropertyMarker.prototype.setMap=function(theMap){google.maps.Marker.prototype.setMap.apply(this,arguments);if(this.getBoundary()){this.getBoundary().setMap(theMap);}};PropertyMarker.prototype.setVisible=function(visible){google.maps.Marker.prototype.setVisible.apply(this,arguments);if(this.getBoundary()){if(visible){this.getBoundary().setMap(this.getMap());}else{this.getBoundary().setMap(null);}}};PropertyMarker.prototype.setBoundary=function(boundary){var i,j;var polygons,rings;var coordList,points;var theMap=null;if(this.boundary_ instanceof google.maps.Polygon){theMap=this.boundary_.getMap();this.boundary_.setMap(null);}
this.boundary_=null;if(boundary!==""){polygons=boundary.split("/");rings=[];for(i=0;i<polygons.length;i++){coordList=polygons[i].split(",");points=[];for(j=0;j<coordList.length;j+=2){points.push(new google.maps.LatLng(coordList[j],coordList[j+1]));}
rings.push(points);}
this.boundary_=new google.maps.Polygon({paths:rings,strokeColor:"#FF0000",strokeWeight:3,strokeOpacity:1,fillOpacity:0.10,clickable:false});if(theMap!==null){this.getBoundary().setMap(theMap);}}};PropertyMarker.prototype.getBoundary=function(){return this.boundary_;};var kSpriteAC=kMapServerURL+"map/artwork/areacontrol.png";var kSizeAC=new google.maps.Size(20,20);var kPositionAC=google.maps.ControlPosition.LEFT_TOP;var kPositionOffsetAC=new google.maps.Size(35,0);var kTipsAC={off:" Begin defining a custom area ",on:" Cancel defining a custom area "};var kFirstHelpAC="<span style='color: yellow;'>Click</span> after moving mouse to first corner.";var kOtherHelpAC="<span style='color: yellow;'>Click</span> after moving mouse to next corner<br>or <span style='color: yellow;'>double-click</span> to set last corner.";var kNameHelpAC="<form onsubmit='return false;'>Enter a name for this area:<br><input id='areaName' name='areaName' size=30><br><input type=button value='Cancel' onclick='cancelAC();'> <input type=submit value='OK' style='color: red;' onclick='returnAC(this.form.areaName.value, addCustomArea);'></form>";var kClassAC="noprint";var gAC;var gHelpAC;var gListenersAC;var gDefiningAC;var gPolygonAC;var gSavedZoomAC,gSavedCursorAC;function initAC(){var ibOptions,img;ibOptions={boxStyle:{background:"black",fontSize:"8pt",textAlign:"center",color:"white",padding:"3px 0px",opacity:1.0,width:"300px",isHidden:true},closeBoxURL:"",disableAutoPan:true,pixelOffset:new google.maps.Size(-150,10)};gHelpAC=new InfoBox(ibOptions);gAC=document.createElement("div");gAC.className=kClassAC;gAC.style.position="relative";gAC.style.overflow="hidden";gAC.style.height=kSizeAC.height+"px";gAC.style.width=kSizeAC.width+"px";gAC.title=kTipsAC.off;img=document.createElement("img");img.src=kSpriteAC;img.style.position="absolute";img.style.left=-(kSizeAC.width*2)+"px";img.style.top=0+"px";gAC.appendChild(img);gAC.onclick=function(){if(gDefiningAC){cancelAC();gAC.title=kTipsAC.off;gAC.firstChild.style.left=-(kSizeAC.width*2)+"px";}else{beginAC();gAC.title=kTipsAC.on;gAC.firstChild.style.left=-(kSizeAC.width*0)+"px";}};gAC.onmouseover=function(){gAC.firstChild.style.left=-(kSizeAC.width*1)+"px";};gAC.onmouseout=function(){if(gDefiningAC){gAC.firstChild.style.left=-(kSizeAC.width*0)+"px";}else{gAC.firstChild.style.left=-(kSizeAC.width*2)+"px";}};gAC.ondragstart=function(){return false;};gAC.style.cursor="pointer";gAC.style.marginTop=kPositionOffsetAC.height+"px";gAC.style.marginLeft=kPositionOffsetAC.width+"px";gMap.controls[kPositionAC].push(gAC);}
function beginAC(){var cInitStart=true;if(gPolygonAC){gPolygonAC.setMap(null);}
gHelpAC.open(gMap);gDefiningAC=true;gListenersAC=[google.maps.event.addListener(gMap,"click",function(e){var path;if(cInitStart){cInitStart=false;gPolygonAC=new google.maps.Polygon({clickable:false,fillOpacity:0.03,map:gMap,path:[e.latLng,e.latLng],strokeColor:"#00FF00",strokeOpacity:0.50,strokeWeight:4});}else{path=gPolygonAC.getPath();path.push(e.latLng);}}),google.maps.event.addListener(gMap,"mousemove",function(e){var path;if(cInitStart){gHelpAC.setContent(kFirstHelpAC);gHelpAC.show();}else{path=gPolygonAC.getPath();path.setAt(path.getLength()-1,e.latLng);gHelpAC.setContent(kOtherHelpAC);}
gHelpAC.setPosition(e.latLng);}),google.maps.event.addListener(gMap,"dblclick",function(){var path;path=gPolygonAC.getPath();path.removeAt(path.getLength()-1);gPolygonAC.setOptions({strokeWeight:6,strokeOpacity:1.0});endAC(true);})];gSavedZoomAC=gMap.get("disableDoubleClickZoom");gSavedCursorAC=gMap.get("draggableCursor");gMap.setOptions({disableDoubleClickZoom:true,draggableCursor:"crosshair"});}
function endAC(askForName){var i;for(i=0;i<gListenersAC.length;i++){google.maps.event.removeListener(gListenersAC[i]);}
setTimeout(function(){gMap.setOptions({disableDoubleClickZoom:gSavedZoomAC,draggableCursor:gSavedCursorAC});},0);gDefiningAC=false;gAC.title=kTipsAC.off;gAC.firstChild.style.left=-(kSizeAC.width*2)+"px";if(askForName){gHelpAC.setContent(kNameHelpAC);gHelpAC.setPosition(gMap.getCenter());setTimeout(function(){document.getElementById("areaName").focus();},0);}else{gHelpAC.hide();}}
function cancelAC(){if(gPolygonAC){gPolygonAC.setMap(null);}
endAC(false);}
function returnAC(name,resultHandler){name=name.replace(/^\s+|\s+$/g,"");if(name!=""){gHelpAC.hide();resultHandler(name,gPolygonAC);}}
var kSearches_;var kWatches_;function showSearchDetail(forceShow){var i,j;var dataArray;var searches,searchArray;var search;var watchArray,watchArrayNew;var freq,title,lastActive,sendTo,desc;var q;var rowColor;var r="";r+="<div id='searchDialog'>";r+="<div id='"+kDetailBodyID+"'>";r+="<center>";r+="<h2>Custom Property Search Manager</h2>";r+="<p>";r+="Custom property searches for <b>"+gUserName+"</b>";r+="</center>";r+="<center>";r+="<form>";dataArray=getDataArray();searches=dataArray[kSearchValueCookie]||"";searchArray=searches.split("\t");kSearches_=searches;watchList=dataArray[kWatchCookie]||"";kWatches_=watchList;if(searches==""){r+="<table cellpadding=2 style='background: silver;'>";r+="<tr>";r+="<td>No Custom Property Searches Found.";r+="</table>";}else{rowColor="tan";for(i=0;i<searchArray.length;i++){search=searchArray[i];freq=getParameter("freq",search);title=unescape(getParameter("title",search));sendTo=unescape(getParameter("sendto",search));lastActive=getParameter("searchdate",search);if(sendTo==""){sendTo=gUserName;}
desc=getSearchDescription(search);rowColor=(rowColor=="tan"?"silver":"tan");r+="<div style='border: 2px solid black; margin-bottom: 5px;' id='search"+i+"'>";r+="<table width='100%' cellpadding=2 style='background: "+rowColor+"'>";r+="<tr>";r+="<td>";r+="<input id='T"+i+"' value='"+title+"' size=40>";r+="<td align=center>";r+="Email updates: <select id='F"+i+"'>";r+="<option value='0'"+(freq==0?"selected":"")+">Never</option>";r+="<option value='1'"+(freq==1?"selected":"")+">Daily</option>";r+="<option value='7'"+(freq==7?"selected":"")+">Weekly</option>";r+="</select>";r+="<tr><td colspan=2>"+desc;if(gUserName.toLowerCase()==kAgentEmail.toLowerCase()){r+="<tr><td colspan=2>Send email updates to: <input id='M"+i+"' value='"+sendTo+"' size=40>";}
r+="<tr><td colspan=2 align=center>";r+="<input type=button value=' Delete ' onclick='deleteSearch("+i+");'> ";r+="<input type=button value=' Save Changes ' onclick='modifySearch("+i+");'>";r+="</table>";r+="</div>";}}
r+="<hr>";r+="Watch List for <b>"+gUserName+"</b>";r+="<p>";r+="<div style='border: 2px solid black;'>";if(watchList==""){r+="<table cellpadding=2 style='background: silver;'>";r+="<tr>";r+="<td>No Properties Are Being Watched.";r+="</table>";}else{q=getParameter("q",watchList);q=q.substring(1,q.length-1);watchArray=q.split(",");watchArrayNew=[];rowColor="tan";for(i=0;i<watchArray.length;i++){j=getIndexFromID(watchArray[i]);if(j!=-1){watchArrayNew.push(watchArray[i]);rowColor=(rowColor=="tan"?"silver":"tan");r+="<table width='100%' cellpadding=2 style='background: "+rowColor+"' id='watch"+i+"'>";r+="<tr>";r+="<td>"+propertyDB[j].theStreetAddress+" ("+formatPrice(propertyDB[j].thePrice)+")";r+="<td align=right><input type=button value=' Stop Watching ' onclick='deleteWatch("+i+");'>";r+="</table>";}}
if(watchArrayNew.length>0){kWatches_=changeParameter(watchList,"q","("+watchArrayNew.join(",")+")");}else{kWatches_="";}}
r+="</div>";r+="<br>";r+="<input type=button value=' Close ' onclick='hideInfoPanel()'>";r+="</form>";r+="</center>";r+="</div>";r+="</div>";r=getTitleBar()+r;setInfoPanelContent(r);if(forceShow){showInfoPanel();}}
function getDataArray(){var i,j;var dataArray;var userLines;var key,value;dataArray=[];userLines=userGetAll().split(/[\n\r]+/);for(i=0;i<userLines.length;i++){if(userLines[i]==""){continue;}
j=userLines[i].indexOf("\t");key=userLines[i].substr(0,j);value=userLines[i].substr(j+1);dataArray[key]=value;}
return dataArray;}
function deleteWatch(i){var j;var q=getParameter("q",kWatches_);q=q.substring(1,q.length-1);watchArray=q.split(",");document.getElementById("watch"+i).style.display="none";j=getIndexFromID(watchArray[i]);if(j!=-1){propertyDB[j].watched=false;}
saveWatches();}
function deleteSearch(i){document.getElementById("search"+i).style.display="none";saveSearches();}
function modifySearch(i){var parms;var searchArray=kSearches_.split("\t");var newTitle=document.getElementById("T"+i).value;var newFreq=document.getElementById("F"+i).value;var newSendTo="";try{newSendTo=document.getElementById("M"+i).value;}catch(e){}
searchArray[i]=changeParameter(searchArray[i],"title",newTitle);searchArray[i]=changeParameter(searchArray[i],"freq",newFreq);searchArray[i]=changeParameter(searchArray[i],"sendto",newSendTo);kSearches_=searchArray.join("\t");saveSearches();}
function saveSearches(){var i;var searchArray=kSearches_.split("\t");var activeSearches=[];for(i=0;i<searchArray.length;i++){if(document.getElementById("search"+i).style.display!="none"){activeSearches.push(searchArray[i]);}}
activeSearches=activeSearches.join("\t");userSet(kSearchValueCookie,activeSearches);searchMenuRefresh();}
function saveWatches(){var i;var q;var watchParam;var activeWatches=[];q=getParameter("q",kWatches_);q=q.substring(1,q.length-1);watchArray=q.split(",");for(i=0;i<watchArray.length;i++){if(document.getElementById("watch"+i).style.display!="none"){activeWatches.push(watchArray[i]);}}
activeWatches=activeWatches.join(",");if(activeWatches==""){watchParam="";}else{watchParam=changeParameter(kWatches_,"q","("+activeWatches+")");}
userSet(kWatchCookie,watchParam);}
function getSearchDescription(search){var h;var query;var minPrice,maxPrice,upper;var priceInfo;var propertyType;var type,town,townDesc;var minBedrooms,minBathrooms;var minHouseSize,maxHouseSize;var minLotSize;var features;h="<table cellpadding=5>";query=getParameter("q",search);if(query==""){minPrice=getParameter("minprice",search);if(minPrice===""){minPrice=kPriceLowest;}
maxPrice=getParameter("maxprice",search);if(maxPrice===""){maxPrice=kPriceHighest;}
if(maxPrice==kPriceHighest){upper="unlimited";}else{upper=formatPrice(maxPrice);}
if(minPrice==kPriceLowest&&maxPrice==kPriceHighest){priceInfo="Any Price";}else{priceInfo=formatPrice(minPrice)+" &mdash; "+upper;}
h+="<tr><td>Price Range:<td><b>"+priceInfo+"</b>";propertyType=getParameter("type",search);switch(propertyType){case"h":type=kPropertyHouse;break;case"a":case"c":type=kPropertyCondo;break;case"m":type=kPropertyManufacturedHome;break;case"l":type=kPropertyLot;break;default:type=kPropertyAll;}
h+="<tr><td>Property Type:<td><b>"+((type==kPropertyAll)?"Any Property Type":type)+"</b>";town=getParameter("town",search);town=unescape(town);if(town===""){town=getParameter("area",search);}
if(town===""){town=kTownAll;}
if(town.indexOf(":")===-1){townDesc=town;}else{townDesc="Custom Area ("+town.substr(0,town.indexOf(":"))+")";}
h+="<tr><td>Area:<td><b>"+((town==kTownAll)?"Any Area":townDesc)+"</b>";minBedrooms=getParameter("minbeds",search);if(minBedrooms===""){minBedrooms=kBedroomsAll;}
if(minBedrooms==kBedroomsAll){minBedrooms="Any Number";}else{minBedrooms+="+";}
h+="<tr><td>Bedrooms:<td><b>"+minBedrooms+"</b>";minBathrooms=getParameter("minbaths",search);if(minBathrooms===""){minBathrooms=kBathroomsAll;}
if(minBathrooms==kBathroomsAll){minBathrooms="Any Number";}else{minBathrooms+="+";}
h+="<tr><td>Bathrooms:<td><b>"+minBathrooms+"</b>";minHouseSize=getParameter("minhousesize",search);if(minHouseSize==""){minHouseSize=kHouseSizesAll;}
maxHouseSize=getParameter("maxhousesize",search);if(maxHouseSize==""){maxHouseSize=kHouseSizesAll;}
h+="<tr><td>House Size:<td><b>";if(minHouseSize==kHouseSizesAll&&maxHouseSize==kHouseSizesAll){h+="Any Size";}else{h+=minHouseSize+" sq.ft. ";if(maxHouseSize==kHouseSizesAll){h+="or more";}else{h+=" to "+maxHouseSize+" sq.ft.";}}
h+="</b>";minLotSize=getParameter("minlotsize",search);if(minLotSize==""){minLotSize=kLotSizesAll;}
h+="<tr><td>Lot Size:<td><b>"+((minLotSize==kLotSizesAll)?"Any Size":minLotSize+" sq.m. or more")+"</b>";features=getParameter("features",search);if(features==""){features="Any Features";}
features=features.replace("tub","hot tub");features=features.replace("security","security system");h+="<tr><td>Features:<td><b>"+features.replace(/,/g,", ")+"</b>";}else{h+="<tr><td>Keyword search:<td><b>"+query+"</b>";}
h+="</table>";return h;}
