//= 5.5) && (document.body.filters)) { var img = document.images['mcontrol'] var imgID = (img.id) ? "id='" + img.id + "' " : "" var imgClass = (img.className) ? "class='" + img.className + "' " : "" var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' " var imgStyle = "display:inline-block;" + img.style.cssText if (img.align == "left") imgStyle = "float:left;" + imgStyle if (img.align == "right") imgStyle = "float:right;" + imgStyle if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle var strNewHTML = "" img.outerHTML = strNewHTML } } initsrch=true; forceAreas('madriver'); } } function updateMap(){ if (loading){return;} loading=true; //if (moved){GEvent.removeListener(moved);} map.clearOverlays(); batch = []; markerinfo= []; //mgr = new GMarkerManager(map); map.disableDragging(); //if (!initsrch){lookurl = $('mapsearchform').serialize();}else{lookurl="newmapsearch=1";} lookurl = $('mapsearchform').serialize(); loading=true; $("busyoverlay").style.visibility = 'visible'; $("searching").style.visibility = 'visible'; GDownloadUrl("/mapsearch/searchresults?"+lookurl, function(data, responseCode) { var xml = GXml.parse(data); markers = xml.documentElement.getElementsByTagName("marker"); bounds = new GLatLngBounds(); for (var i = 0; i < markers.length; i++) { if (!isNaN(parseFloat(markers[i].getAttribute("lat"))) && !isNaN(parseFloat(markers[i].getAttribute("lng")))){ var point = new GLatLng(parseFloat(markers[i].getAttribute("lat")), parseFloat(markers[i].getAttribute("lng"))); var markerinfoin = []; markerinfoin['lat'] = markers[i].getAttribute("lat"); markerinfoin['lng'] = markers[i].getAttribute("lng"); markerinfoin['id'] = markers[i].getAttribute("id"); markerinfoin['upd'] = markers[i].getAttribute("upd"); markerinfoin['name'] = markers[i].getAttribute("name"); markerinfoin['city'] = markers[i].getAttribute("city"); markerinfoin['price'] = markers[i].getAttribute("price"); markerinfoin['img'] = markers[i].getAttribute("img"); markerinfoin['beds'] = markers[i].getAttribute("beds"); markerinfoin['baths'] = markers[i].getAttribute("baths"); markerinfoin['sqft'] = markers[i].getAttribute("sqft"); markerinfoin['acre'] = markers[i].getAttribute("acre"); markerinfoin['type'] = markers[i].getAttribute("type"); markerinfoin['ihtml'] = markers[i].childNodes[0].childNodes[0].nodeValue; markerinfo.push(markerinfoin); bounds.extend(point); var marker = creatMarker(point,batch.length); map.addOverlay(marker); batch.push(marker); } } loading=false; if (map.getBoundsZoomLevel(bounds) > 0 && markerinfo.length > 0){ map.setCenter(bounds.getCenter()); map.setZoom(map.getBoundsZoomLevel(bounds)); createListHTML(); }else if (markerinfo.length==0){ //alert('No properties were found matching your search.\nPlease change your criteria and try again.'); } map.enableDragging(); $("searching").style.visibility = 'hidden'; $("busyoverlay").style.visibility = 'hidden'; });//end gdownload markers } function showInfoWin(id){ $("menu_bar_infowin").innerHTML = markerinfo[id]['ihtml']; $("menu_bar_infowin").style.display = 'inline'; } function hideInfoWin(){$("menu_bar_infowin").style.display = 'none';} function showSrchWin(){ map.closeInfoWindow(); $("srchbar").style.display = 'block'; $("resbar").style.display = 'none'; $("tab_mapsearch").setAttribute("class", "active"); $("tab_mapsearch").setAttribute("className", "active"); $("tab_mapresults").setAttribute("class", "inactive"); $("tab_mapresults").setAttribute("className", "inactive"); } function showResWin(){ $("srchbar").style.display = 'none'; $("resbar").style.display = 'inline'; $("tab_mapsearch").setAttribute("class", "inactive"); $("tab_mapsearch").setAttribute("className", "inactive"); $("tab_mapresults").setAttribute("class", "active"); $("tab_mapresults").setAttribute("className", "active"); } function hideSrchWin(){$("srchbar").style.display = 'none';} function showDetailWin(id){document.location.href='/search/detail/'+markerinfo[id]['id']; } function switchOptions(n){ switch(n) { case 'residential': $("mhomes").style.display = 'none'; $("acre").style.display = 'block'; $("homes").style.display = 'block'; break; case 'multi_family': $("homes").style.display = 'none'; $("acre").style.display = 'none'; $("mhomes").style.display = 'block'; break; case 'land': $("homes").style.display = 'none'; $("mhomes").style.display = 'none'; $("acre").style.display = 'block'; } } function creatMarker(point,id) { // Tom changed this line to restore the stock marker // if (markerinfo[id]['bhlisting']=='true'){var marker = new GMarker(point,bhicon);}else{var marker = new GMarker(point,gicon);} if (markerinfo[id]['bhlisting']=='true'){var marker = new GMarker(point);}else{var marker = new GMarker(point);} GEvent.addListener(marker, "mouseover", function() {showInfoWin(id);}); GEvent.addListener(marker, "mouseout", function() {hideInfoWin();}); GEvent.addListener(marker, "click", function() {showDetailWin(id);}); return marker; } function listrowOn(lr,id){ //map.removeOverlay(polyline);map.removeOverlay(polyline2); lr.style.backgroundColor='#ffff99'; var winhtml="
"; winhtml+=""+markerinfo[id]['name']+", "+markerinfo[id]['city']+""; winhtml+="
"; winhtml+="
List Price:$"+markerinfo[id]['price']+""; winhtml+="
Bedrooms: "+markerinfo[id]['beds']; winhtml+="
Bathrooms: "+markerinfo[id]['baths']; winhtml+="
Sq. Ft.: "+markerinfo[id]['sqft']; winhtml+="
Acreage: "+markerinfo[id]['acre']; winhtml+="
"; batch[id].openInfoWindow(winhtml); } function listrowOut(lr){lr.style.backgroundColor='#F6F4E8';} function createListHTML(){ var lhtml = ''; var openlink='
'; if (markerinfo.length==100){ lhtml += "
"+openlink+"Showing the first 200 listings only!
Click the search tab above to refine your search
"; }else{ lhtml += "
"+openlink+"Your search found "+markerinfo.length+" listings.
Refine Your Search
"; } lhtml += "
"; lhtml += ""; //for (var xx in markerinfo){ for (var xx = 0; xx < markerinfo.length; xx++) {oldclick=xx; lhtml += ""; lhtml += " "; lhtml += " "; lhtml += " "; lhtml += " "; lhtml += " "; lhtml += " "; lhtml += " "; lhtml += ""; } lhtml += "
Address:List Price:Beds:Baths:Sq. Ft:Acreage:MLS #:
" + markerinfo[xx]['name'] +"$" + markerinfo[xx]['price'] +"" + markerinfo[xx]['beds'] +"" + markerinfo[xx]['baths'] +"" + markerinfo[xx]['sqft'] +"" + markerinfo[xx]['acre'] +"" + markerinfo[xx]['upd'] +"
"; $("resbar").innerHTML = lhtml; if (initsrch==false){ showResWin(); }else{initsrch=false;} } function sortDist(a, b) { return a[0] - b[0]; } // This function picks up the click and opens the corresponding info window function myclick(i) { GEvent.trigger(gmarkers[i], "click"); } function reseticon() { if (oldclick!=null){ var oimg=gmarkers[oldclick].getIcon().image; gmarkers[oldclick].setImage(oimg);} } function openTable(){ var delay=50; var delm = $("menu_bar"); var width = parseInt(delm.style.width); if (width==893 && !opening){toWidth=230;}else if (!opening){toWidth=893;} var change = toWidth-width; var total=width+Math.ceil((change/2)); if (change==-1){total=width-1;} delm.style.width=total+'px'; function c() { openTable(); } if(change==0) { clearTimeout(timer);opening=false; return; } timer=setTimeout(c,delay); opening=true; } function toggleGroup(type) { if (type=='house'){var otype='condo';}else{var otype='house';} map.closeInfoWindow(); for (var i = 0; i < markerGroups[otype].length; i++) { var marker = markerGroups[otype][i]; if (!marker.isHidden()) {marker.hide();} } for (var i = 0; i < markerGroups[type].length; i++) { var marker = markerGroups[type][i]; if (marker.isHidden()) {marker.show();} } $("show"+otype).style.display = "inline"; $("show"+type).style.display = "none"; $("map_current_title").innerHTML = eval(type+"_title"); $("menu_bar").innerHTML = eval(type+"_html"); } function MyCustomControl() { } //Default constructor for GControl MyCustomControl.prototype = new GControl(false,false); // Default location for the control MyCustomControl.prototype.getDefaultPosition = function() { return new GControlPosition(G_ANCHOR_TOP_LEFT,new GSize(5,5)); }; MyCustomControl.prototype.initialize = function(gmapref) { var container=gmapref.getContainer(); var c = document.createElement("div"); c.innerHTML=""; c.innerHTML+="
"; c.innerHTML+="
"; c.innerHTML+="
"; c.innerHTML+="
"; c.innerHTML+="
"; c.innerHTML+="
"; //c.innerHTML+="
"; container.appendChild(c); GEvent.addDomListener($('zout'), "click", function() {map.zoomOut();}); GEvent.addDomListener($('zin'), "click", function() {map.zoomIn();}); GEvent.addDomListener($('panl'), "click", function() {map.panDirection(1, 0);}); GEvent.addDomListener($('panr'), "click", function() {map.panDirection(-1, 0);}); GEvent.addDomListener($('panu'), "click", function() {map.panDirection(0, 1);}); GEvent.addDomListener($('pand'), "click", function() {map.panDirection(0, -1);}); //GEvent.addDomListener($('srch'), "click", function() {showSrchWin();}); return c; } function addRegionOverlay(name) { overlay_polygon = new GPolygon(points[name], "#0000ff", 2, 1, "#ff0000", 0.0); map.addOverlay(overlay_polygon); } function forceAreas(which) { if (typeof which== 'undefined') { which = 'madriver'; } if (which=='burlington') { var sel_areas = ['Alburg', 'Bolton', 'Burlington', 'Charlotte', 'Colchester', 'Essex Junction', 'Essex', 'Grand Isle', 'Hinesburg', 'Huntington', 'Jericho Village', 'Jericho', 'Richmond-Chittenden', 'Richmond', 'Shelburne', 'South Burlington', 'North Hero', 'South Hero', 'St. George', 'Underhill', 'Williston', 'Winooski']; } else if (which=='waterbury') { var sel_areas = ['Morristown', 'Stowe', 'Waterbury']; } else if (which=='montpelier') { var sel_areas = ['Berlin', 'East Montpelier', 'Middlesex', 'Montpelier', 'Northfield Village', 'Northfield', 'Roxbury-Washington', 'Roxbury']; } else if (which=='middlebury') { var sel_areas = ['Addison', 'Bristol', 'Bristol-Addison', 'Buels Gore', 'Buel\'s Gore', 'Ferrisburg', 'Ferrisburgh', 'Granville', 'Hancock', 'Lincoln', 'Middlebury', 'Monkton', 'New Haven', 'Panton', 'Pittsfield', 'Ripton', 'Rochester', 'Starksboro', 'Vergennes', 'Waltham', 'Weybridge']; } else { var sel_areas = ['Duxbury', 'Fayston', 'Moretown', 'Waitsfield', 'Warren']; } obj = document.getElementById('my_regions'); for (i=0; i