// on load scale the content and start the map. addLoadEvent(initialize); // Bind resize event to the window Event.observe(window, "resize", scaleContent); // set all basic variables to default values var madeMarkers = false; var geocoded,map,geocoder,markerBounds,propertyCenter,showPropertyByDefault,PropertyMap,request = null; var polyHash,encPoly,listingImageArray,markerHash,pts,eventHandlers = []; var normalProj = G_NORMAL_MAP.getProjection(); var currentMarker,manager,polygonsCreated,clusterHash,cluster,created,localSearch,currentFocus,snappedTo; var propertyLength,currentProperty,selectedProperty = ''; var zoom = null; var altCount = 0; var statisticsInformation = []; var firstPropSel,firstGeocode = true; var zoomLevelSnap,polygonInitialSnap,closedMapOverlay,loadedURLProperty,loadedDetailsPropertyIntoMap,loadingProperty,requestInProgress,changedSearchOption,enableTooltip,allowTooltip,pendingMapRefresh = false; var shownPolygons,totalPolygons,allMatchListings,end,totalListings,begin,displayedResults,clusterCount,markerCount,minPrice,maxPrice = 0; var currentTab = 'MapView'; var PropertyMapSelectedTab = "Map"; var timeouts = []; var polyType = [{ id: 'City', type: "1", pluralTitle: 'Cities', title: 'City', showing: 0, count: "10", minZoom: "12", maxZoom: "5", color: '#339933', defaultChecked: '0', autoShow: '1'},{ id: 'GatedCommunity', type: "6", pluralTitle: 'Gated Communities', title: 'Gated Community', showing: 0, count: "315", minZoom: "18", maxZoom: "13", color: '#000099', defaultChecked: '1', autoShow: '1'},{ id: 'GatedGolfCommunity', type: "4", pluralTitle: 'Gated Golf Course Communities', title: 'Gated Golf Course Community', showing: 0, count: "108", minZoom: "18", maxZoom: "13", color: '#009900', defaultChecked: '1', autoShow: '1'},{ id: 'NonGatedCommunity', type: "2", pluralTitle: 'Non Gated Communities', title: 'Non Gated Community', showing: 0, count: "295", minZoom: "18", maxZoom: "13", color: '#207eb9', defaultChecked: '1', autoShow: '1'},{ id: 'NonGatedGolfCommunity', type: "5", pluralTitle: 'Non Gated Golf Course Communities', title: 'Non Gated Golf Course Community', showing: 0, count: "19", minZoom: "18", maxZoom: "13", color: '#68cc82', defaultChecked: '1', autoShow: '1'}]; // pages info var pages,pageOffset,properties,offset,numResults; // map bounds variables var markersCreatedAtZoom,mapInitialBounds,mapInitialBoundsSW,mapInitialBoundsNE,mapInitialBoundsSWCoordinatesX,mapInitialBoundsSWCoordinatesY,mapInitialBoundsNECoordinatesX,mapInitialBoundsNECoordinatesY; // the minimum zoom you have to be zoomed to for properties to be displayed var minPropZoom = 15; // the snap zoom levels for Cities and Communities var snapZoomCity = 11; var snapZoomCommunity = 15; // property information var managerOptions = { maxZoom:18 }; var minZoom = 5; var maxZoom = 18; function getURLVar(urlVarName) { var urlHalves = String(document.location).toLowerCase().split('?'); var urlVarValue = ''; if(urlHalves[1]){ var urlVars = urlHalves[1].split('&'); for(var i=0; i<=(urlVars.length); i++){ if(urlVars[i]){ var urlVarPair = urlVars[i].split('='); if (urlVarPair[0] && urlVarPair[0] == urlVarName.toLowerCase()) { urlVarValue = urlVarPair[1]; } } } } var urlVarValue = urlVarValue.split("#"); return urlVarValue[0]; } // start everything going - mapping, bounds info, etc.. function initialize() { if(navigator.appVersion.indexOf("Safari")!=-1) { scaleContent(); } if(GBrowserIsCompatible()) { // window.onunload=google.maps.Unload; // if(getURLVar('zoom') == '' && ((getURLVar('mls') != '' && getURLVar('mls') != 'null') || (getURLVar('view') == "list+view" || getURLVar('view') == "list") || getURLVar('view') == 'detail')) { var mapDefaultZoom = minPropZoom; } if(getURLVar('zoom') == '' && (getURLVar('mls') != '' && getURLVar('mls') != 'null')) { var mapDefaultZoom = minPropZoom; } else if(getURLVar('zoom') == 'prop') { var mapDefaultZoom = minPropZoom; } else if(getURLVar('zoom') == '') { var mapDefaultZoom = 11; } else { var mapDefaultZoom = parseFloat(getURLVar('zoom')); } //map = new GMap2(document.getElementById("MapView"),{mapTypes: [G_NORMAL_MAP, G_SATELLITE_MAP,G_HYBRID_MAP,G_PHYSICAL_MAP]}); map=new GMap2(document.getElementById("MapView"),{mapTypes: [G_NORMAL_MAP, G_HYBRID_MAP]}); if(getURLVar('center') != '') { var urlCenter = getURLVar('center').split(","); var mapCenter = new GLatLng(parseFloat(urlCenter[0]),parseFloat(urlCenter[1])); } else { var mapCenter = new GLatLng(33.7152, -116.32427); if((getURLVar('view') == '' || getURLVar('view') == "map+view" || getURLVar('view') == 'map') && getURLVar('mls') != '') { var mapDefaultZoom = 17; } else if(getURLVar('subdiv') != '') { var mapDefaultZoom = snapZoomCommunity; } } map.setCenter(mapCenter, mapDefaultZoom); // check all Default Checked area types for(var i = 0; i < polyType.length; i++) { if(document.getElementById(polyType[i].id + '-PolyRow') && polyType[i].minZoom >= map.getZoom() && polyType[i].maxZoom <= map.getZoom() && polyType[i].defaultChecked == '1') { document.getElementById(polyType[i].id + '-PolySH').checked = true; } } Event.observe('ListContent_Map', "scroll", loadListImages); localSearch = new google.maps.LocalSearch(localSearchControlOptions); geocoder = new GClientGeocoder(); map.addControl(new GLargeMapControl()); map.addControl(new GMapTypeControl()); map.addControl(localSearch); localSearchExists = true; map.enableScrollWheelZoom(); map.enableDoubleClickZoom(); GEvent.addListener(map, 'dblclick', cancelTimeouts); GEvent.addListener(map, 'dragend', trackChanges); GEvent.addListener(map, 'zoomend', trackChanges); //G_PHYSICAL_MAP.getMinimumResolution = function () { return 5 }; G_NORMAL_MAP.getMinimumResolution = function () { return 5 }; //G_SATELLITE_MAP.getMinimumResolution = function () { return 5 }; G_HYBRID_MAP.getMinimumResolution = function () { return 5 }; manager = new MarkerManager(map, managerOptions); if(getURLVar('city') != '' && (getURLVar('subdiv') == '' || getURLVar('subdiv') == 'undefined')) { filterDiv(true); polygonInitialSnap = false; trackChanges(); } else if(getURLVar('city') != '' && getURLVar('subdiv') != '' && getURLVar('subdiv') != 'undefined') { filterDiv(getURLVar('subdiv')); polygonInitialSnap = false; } else { trackChanges(); } setBounds(); if(getURLVar('view') == "detail" && getURLVar('mls') != '' && getURLVar('mls') != 'null') { showDetails(parseFloat(getURLVar('mls')),true); currentProperty = parseFloat(getURLVar('mls')); } else if(getURLVar('mls') != '' && getURLVar('mls') != 'null' && getURLVar('center') != '' ) { propertyCenter = getURLVar('center'); currentProperty = parseFloat(getURLVar('mls')); showProperty(parseFloat(getURLVar('mls'))); } else if(getURLVar('view') == "list+view" || getURLVar('view') == "list") { switchMapTab('ListView'); } } } function cancelTimeouts() { allowTooltip = false;hidePolygonTooltip(); for(var i=0; i < timeouts.length;i++) { clearTimeout(timeouts[i]); } } function trackChanges(force) { create = 'prop'; if(changedSearchOption == true) { force = true; changedSearchOption = false; } if (currentMarker) { closeInfoWindowMarker(); } var currentZoom = map.getZoom(); var mapBounds = map.getBounds(); var mapBoundsSW = mapBounds.getSouthWest(); var mapBoundsNE = mapBounds.getNorthEast(); if(force == true || zoom != map.getZoom()) { setBounds(); } if(mapBoundsNE.lng() > mapBoundsSW.lng()) { if(mapBoundsSW.lng() > mapInitialBoundsSW.lng() && mapBoundsSW.lng() < mapInitialBoundsNE.lng() && mapBoundsSW.lat() <= mapInitialBoundsNE.lat() && mapBoundsSW.lat() >= mapInitialBoundsSW.lat() && mapBoundsNE.lng() > mapInitialBoundsSW.lng() && mapBoundsNE.lng() < mapInitialBoundsNE.lng() && mapBoundsNE.lat() <= mapInitialBoundsNE.lat() && mapBoundsNE.lat() >= mapInitialBoundsSW.lat()) { inBounds = true; } else { inBounds = false; } } else { if(((mapBoundsSW.lng() >= mapInitialBoundsSW.lng() || mapBoundsSW.lng() < mapInitialBoundsNE.lng()) && mapBoundsSW.lat() <= mapInitialBoundsNE.lat() && mapBoundsSW.lat() >= mapInitialBoundsSW.lat()) && ((mapBoundsNE.lng() >= mapInitialBoundsSW.lng() || mapBoundsNE.lng() < mapInitialBoundsNE.lng()) && mapBoundsNE.lat() <= mapInitialBoundsNE.lat() && mapBoundsNE.lat() >= mapInitialBoundsSW.lat())) { inBounds = true; } else { inBounds = false; } } if(force == true || zoom != map.getZoom()) { allowTooltip = false;hidePolygonTooltip(); if(map.getZoom() != zoom) { force = true; } zoom = map.getZoom(); if(polygonInitialSnap == false) { snappedTo = null; } map.clearOverlays(); for(var i = 0; i < eventHandlers.length; i++) { GEvent.removeListener(eventHandlers[i]); } eventHandlers.length = 0; polyHash = []; encPoly = []; clusterHash = []; markerHash = []; manager.clearMarkers(); closedMapOverlay = false; clusterCount = 0; displayedResults = 0; markerCount = 0; if(localSearch) { localSearch.goIdle(); } } // loop through polygon types and hide or show checkboxes based on zoom level checkedPolygonTypes = 0; for(var i = 0; i < polyType.length; i++) { if(document.getElementById(polyType[i].id + '-PolyRow') && polyType[i].minZoom >= zoom && polyType[i].maxZoom <= zoom) { document.getElementById(polyType[i].id + 'Link').style.textDecoration = 'none'; document.getElementById(polyType[i].id + 'Link').style.color = '#000'; document.getElementById(polyType[i].id + '-Color').style.background = polyType[i].color; document.getElementById(polyType[i].id + '-PolySH').checked = true; } else if(document.getElementById(polyType[i].id + '-PolyRow')) { document.getElementById(polyType[i].id + '-PolySH').checked = false; document.getElementById(polyType[i].id + 'Link').style.textDecoration = 'line-through'; document.getElementById(polyType[i].id + 'Link').style.color = '#ccc'; } if(document.getElementById(polyType[i].id + '-PolyRow') && document.getElementById(polyType[i].id + '-PolySH').checked == true) { checkedPolygonTypes++; } } // loop through again if the zoom is out of the property zoom and there are no checked polygon types if(zoom < minPropZoom && checkedPolygonTypes == 0) { // if(checkedPolygonTypes == 0) { for(var i = 0; i < polyType.length; i++) { if(document.getElementById(polyType[i].id + '-PolyRow') && polyType[i].minZoom >= zoom && polyType[i].maxZoom <= zoom && polyType[i].autoShow == '1') { document.getElementById(polyType[i].id + '-PolySH').checked = true; } } } if(inBounds == false || force == true) { setBounds(); // if we are no longer within the bounds that the elements were intially created, we must recreate them. document.getElementById('mapOverlay').style.display = ''; if(force == true) { document.getElementById('PropertyListPopulated_Map').value = '0'; } Element.update('mapOverlay','

Loading... Processing Listings...

'); search(); } // if we are creating or created anything other than properties and for some reason clustered markers are still appearing, remove them. if(document.getElementById('ListView-Tab') && document.getElementById('DetailView-Tab')) { if(map.getZoom() < minPropZoom) { document.getElementById('DetailView-Tab').style.display = 'none'; selectedProperty = null; currentProperty = null; Element.update('ListContent_Map','
Loading Property Listings...
'); } else { // if we created or are creating properties and the detail tab is hidden, unhide it, otherwise re-hide it. if(document.getElementById('DetailView-Tab').style.display == 'none' && selectedProperty) { document.getElementById('DetailView-Tab').style.display = ''; } } } } function clearValues() { document.getElementById('PropertyListPopulated_Map').value = '0' geocoded = null; created = "changed"; } // set the bounds of the map // used when we-loading content from the database, if we have already loaded the content in these bounds then we don't need to reload function setBounds() { markersCreatedAtZoom = map.getZoom(); mapInitialBounds = map.getBounds(); // convert the map bounds to X,Y coordinates mapInitialBoundsSWCoordinates = map.fromLatLngToDivPixel(mapInitialBounds.getSouthWest()); mapInitialBoundsNECoordinates = map.fromLatLngToDivPixel(mapInitialBounds.getNorthEast()); // expand the bounds by 20 pixels // this keeps the "fringe" markers from causing the map to reload markers due to the map scrolling just outside of the current bounds mapInitialBoundsSWCoordinatesX = mapInitialBoundsSWCoordinates.x - 20; mapInitialBoundsSWCoordinatesY = mapInitialBoundsSWCoordinates.y + 20; mapInitialBoundsNECoordinatesX = mapInitialBoundsNECoordinates.x + 20; mapInitialBoundsNECoordinatesY = mapInitialBoundsNECoordinates.y - 20; // convert eh X,Y coordinates back to Lat,Lng coordinates and set the bounds mapInitialBoundsSW = map.fromDivPixelToLatLng(new GPoint(mapInitialBoundsSWCoordinatesX,mapInitialBoundsSWCoordinatesY)); mapInitialBoundsNE = map.fromDivPixelToLatLng(new GPoint(mapInitialBoundsNECoordinatesX,mapInitialBoundsNECoordinatesY)); } function scaleContent(fullPage) { /* bodyHeight - the height of the entire page contentHeight - defines the height of the innter content contentWidth - defines the width of the inner content subMainAreaInteriorWidth - this is the width of the container boxes, Map View, Detail View, List View subFullBox - this is the width of the entire containing box that holds Map View, Detail View & List View subFullTopBottom - this is the width of the top and bottom shadows of the entire containing box arrowLeft - defines how far left the Hide/Show arrow will be, also defines how far left the map area box will be. mapContainerHeight - this is the height of the entire containing box searchInteriorSubtraction - this is the amount (in pixels) to be subtracted from the height of the search tabs (Map, Land, Local, Layers) */ Event.stopObserving(window, "resize", scaleContent); if(document.getElementById('sidebar').style.display == 'none') { fullPage = 'true'; } // var bodyHeight = wHeight() - Element.getHeight('Header') - Element.getHeight('Navigation') - Element.getHeight('Footer'); var bodyHeight = wHeight() - Element.getHeight('Header') - Element.getHeight('BottomBanner'); if(bodyHeight < 525 && version != 6) { bodyHeight = 525; var scrollBarWidth = 35; var scrollWidthNeg = -35; var scrolling = true; } else if(bodyHeight < 595 && version == 6) { bodyHeight = 670; var scrollBarWidth = 20; var scrollWidthNeg = -20; var scrolling = true; } else { var scrollBarWidth = 25; var scrollWidthNeg = -25; } if(version >= 5.5) { var contentWidth = wWidth() - 155; var contentHeight = bodyHeight- 205; } else { var contentWidth = wWidth() - 125; var contentHeight = bodyHeight-147; } if(contentWidth < 862) { contentWidth = 853; $('MainContainer').setStyle({ 'width': contentWidth + (version >= 7 ? 115 : 95) + 'px' }); $('ContentWrapperBottomCorner').setStyle({ 'width': contentWidth + 95 + 'px' }); } else { $('MainContainer').setStyle({ 'width': '100%' }); $('ContentWrapperBottomCorner').setStyle({ 'width': '100%' }); } if(fullPage == 'true') { var subFullBox = (version >= 5.5 ? -42 : -56 ) - scrollWidthNeg; var subMainAreaInteriorWidth = (version >= 5.5 ? -32 : -60) - scrollWidthNeg; var subFullTopBottom = (version >= 5.5 ? ((version >= 7 ? -20 : -20) - scrollWidthNeg) : -41 - scrollWidthNeg); var arrowLeft = 25; } else { // var subFullBox = (version >= 5.5 ? (contentWidth <= 853 && version < 7 ? 265 : 245) : 245) + scrollBarWidth; // var subMainAreaInteriorWidth = (version >= 5.5 ? (contentWidth && version < 7 <= 853 ? 270 : 250) : 245) + scrollBarWidth; // var subFullTopBottom = (version >= 5.5 ? (contentWidth <= 853 && version < 7 ? 282 : 262) : 263) + scrollBarWidth; var subFullBox = (version >= 5.5 ? (contentWidth <= 853 ? 265 : (version >= 7 ? 245 : 235)) : 245) + scrollBarWidth; var subMainAreaInteriorWidth = (version >= 5.5 ? (contentWidth <= 853 ? (version >= 7 ? 270 : 280) : 250) : 245) + scrollBarWidth; var subFullTopBottom = (version >= 5.5 ? (contentWidth <= 853 ? (version >= 7 ? 282 : 292) : 262) : 263) + scrollBarWidth; var arrowLeft = 330; } // main map container area height var mapContainerHeight = (version >= 5.5 ? 75 : 25); // move the bottom row of content - content provided by line //$('MapBottomRow').setStyle({ 'left': '25px', 'top': contentHeight + mapContainerHeight + (version >= 7 ? 162 : 172) + 'px' }); if(fullPage == 'true') { if(version >= 5.5) { $('MapBox').setStyle({ 'left': (arrowLeft + (version >= 7 ? 6 : 8)) + 'px', 'height': (contentHeight + mapContainerHeight) + 'px', 'width': contentWidth - subFullBox + 8 + 'px' }); } else { $('MapBox').setStyle({ 'left': (arrowLeft + 8) + 'px', 'height': (contentHeight + mapContainerHeight) + 'px', 'width': contentWidth - subFullBox + 4 + 'px' }); } } else { if (version>=5.5) { $('MapBox').setStyle({ 'left': (arrowLeft - (version >= 5.5 ? -15 : 140)) + 'px', 'height': (contentHeight + mapContainerHeight) + 'px', 'width': contentWidth - subFullBox + 8 + 'px' }); } else { $('MapBox').setStyle({ 'left': (arrowLeft + 8) + 'px', 'height': (contentHeight + mapContainerHeight) + 'px', 'width': contentWidth - subFullBox + 'px' }); } } if(version >= 7) { $('MapWrapper').style.backgroundPosition='100% 4px'; } if(version >= 5.5) { $('MapWrapper').setStyle({ 'width': contentWidth - subFullBox + 'px' }); } // interior search box subtraction value var searchInteriorSubtraction = (version >= 7 ? 125 : 170); $('MapTop').setStyle({ 'width': contentWidth - subFullTopBottom + (version >= 5.5 ? (version >= 7 ? 20 : 30) : 15) + 'px' }); if(version >= 5.5) { $('MapBottom').setStyle({ 'width': contentWidth - subFullTopBottom + (fullPage == "true" ? 58 : (version >= 7 ? 53 : 62)) + 'px' }); $('MapLeft').setStyle({ 'height': (contentHeight + 73) + 'px', 'top': '-8px' }); $('DetailView').setStyle({ 'height': (contentHeight + 45) + 'px', 'width': contentWidth - subMainAreaInteriorWidth - 23 + 'px' }); $('MapView').setStyle({ 'height': (contentHeight + 35) + 'px', 'width': contentWidth - subMainAreaInteriorWidth + 'px' }); $('ListContent_Map').setStyle({ 'height': contentHeight-15 + 'px' }); } else { $('MapBottom').setStyle({ 'width': contentWidth - subFullTopBottom + 47 + 'px' }); $('MapLeft').setStyle({ 'height': (contentHeight + 31) + 'px', 'top': '-1px' }); $('DetailView').setStyle({ 'height': (contentHeight) + 'px', 'width': contentWidth - subMainAreaInteriorWidth + 'px' }); $('MapView').setStyle({ 'height': (contentHeight) + 'px', 'width': contentWidth - subMainAreaInteriorWidth + 'px' }); $('ListContent_Map').setStyle({ 'height': contentHeight-45 + 'px' }); } $('ListView').setStyle({ 'height': (contentHeight + 45) + 'px', 'width': contentWidth - subMainAreaInteriorWidth + 'px' }); // var sidebarTop = Element.getHeight('Header') + Element.getHeight('Navigation') + Element.getHeight('MapTab') - 12; var sidebarTop = 0; $('sidebar').setStyle({ 'height': Element.getHeight('MapBox') + 'px', 'top': sidebarTop + 'px' }); $('HideShowArrowWrapper').setStyle({ 'left': (arrowLeft - 12) + 'px', 'top': (sidebarTop + (Element.getHeight('sidebar')/2)) + 'px' }); if(document.getElementById('Content-LocalSearch')) { $('Content-LocalSearch').setStyle({ 'height': (contentHeight - searchInteriorSubtraction + Element.getHeight('MapTab')) + 'px'}); } if(document.getElementById('SidebarMainContainer')) { $('SidebarMainContainer').setStyle({ 'height': (contentHeight - searchInteriorSubtraction + Element.getHeight('MapTab')) + 'px'}); } if(document.getElementById('Residential_Box')) { $('Residential_Box').setStyle({ 'height': (contentHeight - (searchInteriorSubtraction + 30) + Element.getHeight('MapTab')) + 'px'}); } if(document.getElementById('Land_Box')) { $('Land_Box').setStyle({ 'height': (contentHeight - (searchInteriorSubtraction + 30) + Element.getHeight('MapTab')) + 'px'}); } // $('ContentWrapperBottomCorner').setStyle({ 'width': (contentWidth+ (version >= 5.5 ? (scrolling == true ? 95 : 105) : (scrolling == true ? 100 : 114 ))) + 'px' }); Event.observe(window, "resize", scaleContent); if(map) { map.checkResize(); } } // function to hide or show the sidebar function hideShowToolbar(action) { if(action == 'true') { document.getElementById('sidebar').style.display = 'none'; document.getElementById('sidebar-show').style.display = 'block'; document.getElementById('sidebar-hide').style.display = 'none'; } else { document.getElementById('sidebar').style.display = 'block'; document.getElementById('sidebar-hide').style.display = 'block'; document.getElementById('sidebar-show').style.display = 'none'; } scaleContent(action); if(currentTab == "DetailView" || currentTab == "ListView") { pendingMapRefresh = true; } else { trackChanges(true); } } // subdivision and city filtering function function resetPolygonSnap() {polygonInitialSnap = false; zoomLevelSnap = false; } // function to post requests to schedule a viewing email function postScheduleShowing() { var name = document.getElementById('ScheduleViewingName').value; var dateMM = document.getElementById('ScheduleViewingDateMM').value; var dateDD = document.getElementById('ScheduleViewingDateDD').value; var dateYYYY = document.getElementById('ScheduleViewingDateYYYY').value; var phone = document.getElementById('ScheduleViewingPhone').value; var email = document.getElementById('ScheduleViewingEmail').value; var comment = document.getElementById('ScheduleViewingComment').value; var mls = document.getElementById('ScheduleViewingMLS').value; if(name != '' && (dateMM != '' && dateDD != '' && dateYYYY != '') && phone != '') { var opt = { method: 'post', postBody: "mls=" + mls + "&name=" + encodeURI(name) + "&comment=" + encodeURI(comment) + "&phone=" + encodeURI(phone) + "&email=" + encodeURI(email) + "&dateMM=" + encodeURI(dateMM) + "&dateDD=" + encodeURI(dateDD) + "&dateYYYY=" + encodeURI(dateYYYY), onSuccess: function(t) { eval(t.responseText); } }; new Ajax.Request('/call/postScheduleViewing.php', opt); } else { document.getElementById("ScheduleViewingResponse").innerHTML = "Some required fields were missing."; } } // function to post comments on properties function postPropertyComment() { var message = document.getElementById('CommentMessage').value; var mls = document.getElementById('CommentMLS').value; if(document.getElementById('CommentPostedTo') && document.postPropertyCommentForm.CommentPostedTo.options[document.postPropertyCommentForm.CommentPostedTo.selectedIndex].value != '' && document.postPropertyCommentForm.CommentPostedTo.options[document.postPropertyCommentForm.CommentPostedTo.selectedIndex].value != 'undefined') { var postedTo = "&CommentPostedTo=" + document.postPropertyCommentForm.CommentPostedTo.options[document.postPropertyCommentForm.CommentPostedTo.selectedIndex].value; } else { var postedTo = ''; } if(document.getElementById('guestName') && document.getElementById('guestName').value != '' && document.getElementById('guestName').value != 'undefined') { var guestName = "&guestName=" + document.getElementById('guestName').value; } else { var guestName = ''; } if(message != '') { var opt = { method: 'post', postBody: "mls=" + mls + "&message=" + encodeURI(message) + guestName + postedTo, onSuccess: function(t) { eval(t.responseText); if(comment != '') { // add the comment to the list if(document.getElementById('CommentCount').value == 0) { document.getElementById('PropertyComments').innerHTML = ''; document.getElementById('CommentCount').value = 1; } else { document.getElementById('CommentCount').value = parseFloat(document.getElementById('CommentCount').value)+1; } var postedMessage = document.createElement("div"); postedMessage.setAttribute('class',"PropertyCommentRow"); postedMessage.setAttribute('id','Comment-' + comment); var messageContent = '
' + message + '<\/div>'; messageContent += '
'; if(!document.getElementById('guestName')) { messageContent += '
delete<\/a><\/div>'; } messageContent += '<\/div>'; postedMessage.innerHTML = messageContent; document.getElementById("PropertyComments").appendChild(postedMessage); document.getElementById('CommentMessage').value = ''; } else { document.getElementById("PostCommentResponse").innerHTML = response; } } }; new Ajax.Request('/call/postPropertyComment.php', opt); } else { document.getElementById("PostCommentResponse").innerHTML = "Some required fields were missing."; } } // functions for saving & removing wishlist properties function saveProperty(element,id) { var opt = { method: 'post',postBody: "MLS=" + id + "&div=" + element,evalScripts:true,asynchronous:true }; new Ajax.Updater(element, '/call/saveProperty.php', opt); } // functions for saving searches function updateSavedSearch() { if(document.getElementById("Content-Residential").style.display != 'none' || document.getElementById("Content-Land").style.display == 'none') { var searchValue = document.Residential_Search.Residential_SavedSearch.options[document.Residential_Search.Residential_SavedSearch.selectedIndex].id; var searchString = document.Residential_Search.Residential_SavedSearch.options[document.Residential_Search.Residential_SavedSearch.selectedIndex].value; var Identifier = "Residential"; } if(document.getElementById("Content-Land").style.display != 'none') { var searchValue = document.Land_Search.Land_SavedSearch.options[document.Land_Search.Land_SavedSearch.selectedIndex].id; var searchString = document.Land_Search.Land_SavedSearch.options[document.Land_Search.Land_SavedSearch.selectedIndex].value; var Identifier = "Land"; } if(searchString == "00New00") { document.getElementById(Identifier + '_NewSavedSearch').style.display = 'block'; } else { resetSearchName(Identifier); } if(searchValue != '') { loadSearch(); } } function saveSearch() { if(document.getElementById("Content-Residential").style.display != 'none' || document.getElementById("Content-Land").style.display == 'none') { var searchValue = document.Residential_Search.Residential_SavedSearch.options[document.Residential_Search.Residential_SavedSearch.selectedIndex].id; var searchString = document.Residential_Search.Residential_SavedSearch.options[document.Residential_Search.Residential_SavedSearch.selectedIndex].value; var Identifier = "Residential"; } if(document.getElementById("Content-Land").style.display != 'none') { var searchValue = document.Land_Search.Land_SavedSearch.options[document.Land_Search.Land_SavedSearch.selectedIndex].id; var searchString = document.Land_Search.Land_SavedSearch.options[document.Land_Search.Land_SavedSearch.selectedIndex].value; var Identifier = "Land"; } if(searchString == "00New00") { searchValue = document.getElementById(Identifier + '_NewSavedSearch').value + "&new=1"; } if(searchValue != '' && searchValue != "Enter a search name") { if(searchString != "00New00") { if(document.getElementById("Content-Residential").style.display != 'none' || document.getElementById("Content-Land").style.display == 'none') { document.Residential_Search.Residential_SavedSearch.options[document.Residential_Search.Residential_SavedSearch.selectedIndex].value = postQuery(null,null,null,true); } if(document.getElementById("Content-Land").style.display != 'none') { document.Land_Search.Land_SavedSearch.options[document.Land_Search.Land_SavedSearch.selectedIndex].value = postQuery(null,null,null,true); } } var opt = { method: 'post', postBody: "Type=" + Identifier + "&Name=" + searchValue + "&Search=" + encodeURIComponent( postQuery(null,null,null,true) ), onSuccess: function(t) { resetSearchName(Identifier); eval(t.responseText); } }; new Ajax.Request('/call/saveSearch.php', opt); // setSearchInfo(Identifier,"Search Saved"); } } function loadSearch() { if(document.getElementById("Content-Residential").style.display != 'none' || document.getElementById("Content-Land").style.display == 'none') { var searchValue = document.Residential_Search.Residential_SavedSearch.options[document.Residential_Search.Residential_SavedSearch.selectedIndex].id; var searchString = document.Residential_Search.Residential_SavedSearch.options[document.Residential_Search.Residential_SavedSearch.selectedIndex].value; var Identifier = "Residential"; } if(document.getElementById("Content-Land").style.display != 'none') { var searchValue = document.Land_Search.Land_SavedSearch.options[document.Land_Search.Land_SavedSearch.selectedIndex].id; var searchString = document.Land_Search.Land_SavedSearch.options[document.Land_Search.Land_SavedSearch.selectedIndex].value; var Identifier = "Land"; } var opt = { method: 'get',parameters: stripslashes(searchString),evalScripts:true,asynchronous:true}; new Ajax.Updater(Identifier + "_Box", '/call/loadSearch.php', opt); // setSearchInfo(Identifier,"Search Loaded"); } function resetSearchName(Identifier) { if(document.getElementById(Identifier + '_NewSavedSearch').style.display != 'none') { document.getElementById(Identifier + '_NewSavedSearch').style.display = 'none'; document.getElementById(Identifier + '_NewSavedSearch').style.color = '#666'; document.getElementById(Identifier + '_NewSavedSearch').value = 'Enter a search name'; } } function clearSearchName(Identifier) { document.getElementById(Identifier + '_NewSavedSearch').value = ''; document.getElementById(Identifier + '_NewSavedSearch').style.color = '#000'; } // set the search info window status and then time it out //function setSearchInfo(id,info) { // Element.update(id + "_Search_StatusInfo",info); // document.getElementById(id + "_Search_StatusInfo").style.display = "block"; // setTimeout(function() { document.getElementById(id + "_Search_StatusInfo").style.display = "none"},3500); //} function passFormThroughMap(id) { if(currentTab == "MapView") { var action = "?" + postQuery(null,null,null,true); } else if(currentTab == "ListView") { var action = "?view=list&" + postQuery(null,null,null,true); } else if(currentTab == "DetailView") { var action = "?view=detail&mls=" + currentProperty; } document.getElementById(id).action = action; return true; } function viewAllProperties() { document.getElementById("Residential_Search_OurProperties").value = ''; document.getElementById("Land_Search_OurProperties").value = ''; document.getElementById('TopInformation').style.display = 'none'; trackChanges(true); } function clearForm(resetForm) { if(document.getElementById("Content-Residential").style.display != 'none' || document.getElementById("Content-Land").style.display == 'none') { //document.Residential_Search.Residential_SavedSearch.value = ''; document.Residential_Search.Residential_Search_city.value = ''; document.Residential_Search.Residential_Search_subdiv.value = ''; document.Residential_Search.Residential_Search_PropertyType.value = 'RESI,RESD,COND,CNDD,TOWN'; document.getElementById("Residential_Search_minPrice").value = ''; document.getElementById("Residential_Search_maxPrice").value = ''; document.getElementById("Residential_Search_minBeds").value = ''; document.getElementById("Residential_Search_maxBeds").value = ''; document.getElementById("Residential_Search_minBaths").value = ''; document.getElementById("Residential_Search_maxBaths").value = ''; document.getElementById("Residential_Search_minSqFt").value = ''; document.getElementById("Residential_Search_maxSqFt").value = ''; document.getElementById("Residential_Search_Keywords").value = ''; document.Residential_Search.Residential_Search_CommunityType.value = ''; document.Residential_Search.Residential_Search_Golf.value = ''; document.getElementById("Residential_Search_minHOADues").value = ''; document.getElementById("Residential_Search_maxHOADues").value = ''; } if(document.getElementById("Content-Land").style.display != 'none') { //document.Land_Search.Land_SavedSearch.value = ''; document.Land_Search.Land_Search_city.value = ''; document.Land_Search.Land_Search_subdiv.value = ''; document.getElementById("Land_Search_minPrice").value = ''; document.getElementById("Land_Search_maxPrice").value = ''; document.getElementById("Land_Search_minSize").value = ''; document.getElementById("Land_Search_maxSize").value = ''; document.getElementById("Land_Search_minPricePerAcre").value = ''; document.getElementById("Land_Search_maxPricePerAcre").value = ''; document.getElementById("Land_Search_Keywords").value = ''; document.Land_Search.Land_Search_CommunityType.value = ''; document.Land_Search.Land_Search_Golf.value = ''; document.getElementById("Land_Search_minHOADues").value = ''; document.getElementById("Land_Search_maxHOADues").value = ''; } if(resetForm == true) { resetSearchOptions(); } // changedSearchOption=true; } function loadSearchOption() { if(document.getElementById("Content-Residential").style.display != 'none' || document.getElementById("Content-Land").style.display == 'none') { var sel = document.getElementById('Residential_AdditionalOptions'); } if(document.getElementById("Content-Land").style.display != 'none') { var sel = document.getElementById('Land_AdditionalOptions'); } var selectedField = sel.value; var parentGroup = document.getElementById(selectedField).parentNode; var fieldContent = document.getElementById(selectedField).innerHTML; parentGroup.removeChild(document.getElementById(selectedField)); var fieldContainer = document.createElement('div'); fieldContainer.setAttribute('id',selectedField); if(parentGroup.lastChild.className == "SearchRow clearfix Alt") { fieldContainer.className = "SearchRow clearfix"; } else { fieldContainer.className = "SearchRow clearfix Alt"; } fieldContainer.innerHTML = fieldContent; parentGroup.appendChild(fieldContainer); for (var i = 0; i < sel.length; i++) { if (sel[i].value == selectedField) { sel.remove(i); } } sel[0].selected = true; } function removeSearchOption(id) { document.getElementById(id).style.display = 'none'; if(document.getElementById("Content-Residential").style.display != 'none' || document.getElementById("Content-Land").style.display == 'none') { if(id == "Residential_SearchRow_PropertyType") { document.Residential_Search.Residential_Search_PropertyType.value = ''; } if(id == "Residential_SearchRow_Price") { document.getElementById("Residential_Search_minPrice").value = ''; document.getElementById("Residential_Search_maxPrice").value = ''; } if(id == "Residential_SearchRow_Beds") { document.getElementById("Residential_Search_minBeds").value = ''; document.getElementById("Residential_Search_maxBeds").value = ''; } if(id == "Residential_SearchRow_Baths") { document.getElementById("Residential_Search_minBaths").value = ''; document.getElementById("Residential_Search_maxBaths").value = ''; } if(id == "Residential_SearchRow_SqFt") { document.getElementById("Residential_Search_minSqFt").value = ''; document.getElementById("Residential_Search_maxSqFt").value = ''; } if(id == "Residential_SearchRow_Keywords") { } if(id == "Residential_SearchRow_CommunityType") { document.Residential_Search.Residential_Search_CommunityType.value = ''; } if(id == "Residential_SearchRow_Golf") { document.Residential_Search.Residential_Search_Golf.value = ''; } if(id == "Residential_SearchRow_HOADues") { document.getElementById("Residential_Search_minHOADues").value = ''; document.getElementById("Residential_Search_maxHOADues").value = ''; } var formField = "Residential_AdditionalOptions"; var formFields = [{ VisibleByDefault: false, SearchID: 'Residential_SearchRow_PropertyType', Title: 'Property Type' },{ VisibleByDefault: true, SearchID: 'Residential_SearchRow_Price', Title: 'Price' },{ VisibleByDefault: true, SearchID: 'Residential_SearchRow_Beds', Title: 'Beds' },{ VisibleByDefault: false, SearchID: 'Residential_SearchRow_Baths', Title: 'Baths' },{ VisibleByDefault: true, SearchID: 'Residential_SearchRow_SqFt', Title: 'Sq. Ft' },{ VisibleByDefault: false, SearchID: 'Residential_SearchRow_Keywords', Title: 'Keywords' },{ VisibleByDefault: false, SearchID: 'Residential_SearchRow_CommunityType', Title: 'Community Type' },{ VisibleByDefault: true, SearchID: 'Residential_SearchRow_Golf', Title: 'Golf Course' },{ VisibleByDefault: false, SearchID: 'Residential_SearchRow_HOADues', Title: 'HOA Dues' }]; } if(document.getElementById("Content-Land").style.display != 'none') { if(id == "Land_SearchRow_Price") { document.getElementById("Land_Search_minPrice").value = ''; document.getElementById("Land_Search_maxPrice").value = ''; } if(id == "Land_SearchRow_Size") { document.getElementById("Land_Search_minSize").value = ''; document.getElementById("Land_Search_maxSize").value = ''; } if(id == "Land_SearchRow_PricePerAcre") { document.getElementById("Land_Search_minPricePerAcre").value = ''; document.getElementById("Land_Search_maxPricePerAcre").value = ''; } if(id == "Land_SearchRow_Keywords") { } if(id == "Land_SearchRow_Golf") { document.Land_Search.Land_Search_Golf.value = ''; } if(id == "Land_SearchRow_HOADues") { document.getElementById("Land_Search_minHOADues").value = ''; document.getElementById("Land_Search_maxHOADues").value = ''; } var formField = "Land_AdditionalOptions"; var formFields = [{ VisibleByDefault: true, SearchID: 'Land_SearchRow_Price', Title: 'Price' },{ VisibleByDefault: true, SearchID: 'Land_SearchRow_Size', Title: 'Size' },{ VisibleByDefault: false, SearchID: 'Land_SearchRow_PricePerAcre', Title: 'Price Per Acre' },{ VisibleByDefault: false, SearchID: 'Land_SearchRow_Keywords', Title: 'Keywords' },{ VisibleByDefault: true, SearchID: 'Land_SearchRow_Golf', Title: 'Golf Course' },{ VisibleByDefault: false, SearchID: 'Land_SearchRow_HOADues', Title: 'HOA Dues' }]; } for(var i = 0; i < formFields.length; i++) { if(formFields[i].SearchID == id) { addSelectOption(formField,formFields[i].Title,id); } } } function resetSearchOptions(visibleFields) { if(document.getElementById("Content-Residential").style.display != 'none' || document.getElementById("Content-Land").style.display == 'none') { var sel = document.getElementById('Residential_AdditionalOptions'); var formField = "Residential_AdditionalOptions"; var formFields = [{ VisibleByDefault: false, SearchID: 'Residential_SearchRow_PropertyType', Title: 'Property Type' },{ VisibleByDefault: true, SearchID: 'Residential_SearchRow_Price', Title: 'Price' },{ VisibleByDefault: true, SearchID: 'Residential_SearchRow_Beds', Title: 'Beds' },{ VisibleByDefault: false, SearchID: 'Residential_SearchRow_Baths', Title: 'Baths' },{ VisibleByDefault: true, SearchID: 'Residential_SearchRow_SqFt', Title: 'Sq. Ft' },{ VisibleByDefault: false, SearchID: 'Residential_SearchRow_Keywords', Title: 'Keywords' },{ VisibleByDefault: false, SearchID: 'Residential_SearchRow_CommunityType', Title: 'Community Type' },{ VisibleByDefault: true, SearchID: 'Residential_SearchRow_Golf', Title: 'Golf Course' },{ VisibleByDefault: false, SearchID: 'Residential_SearchRow_HOADues', Title: 'HOA Dues' }]; } if(document.getElementById("Content-Land").style.display != 'none') { var sel = document.getElementById('Land_AdditionalOptions'); var formField = "Land_AdditionalOptions"; var formFields = [{ VisibleByDefault: true, SearchID: 'Land_SearchRow_Price', Title: 'Price' },{ VisibleByDefault: true, SearchID: 'Land_SearchRow_Size', Title: 'Size' },{ VisibleByDefault: false, SearchID: 'Land_SearchRow_PricePerAcre', Title: 'Price Per Acre' },{ VisibleByDefault: false, SearchID: 'Land_SearchRow_Keywords', Title: 'Keywords' },{ VisibleByDefault: true, SearchID: 'Land_SearchRow_Golf', Title: 'Golf Course' },{ VisibleByDefault: false, SearchID: 'Land_SearchRow_HOADues', Title: 'HOA Dues' }]; } sel.length = 0; addSelectOption(formField,'','',null,true); for(var fi = 0; fi < formFields.length; fi++) { var ignoreField = false; if(visibleFields) { for(var i = 0; i < visibleFields.length; i++) { if(formFields[fi].SearchID == visibleFields[i]) { ignoreField = true; break; } } } if(ignoreField == false) { if(formFields[fi].VisibleByDefault == false) { document.getElementById(formFields[fi].SearchID).style.display = 'none'; addSelectOption(formField,formFields[fi].Title,formFields[fi].SearchID); } else { document.getElementById(formFields[fi].SearchID).style.display = 'block'; } } } } function loadListImages() { if(document.getElementById('ListContent_Map').firstChild && document.getElementById('ListContent_Map').firstChild.firstChild && document.getElementById('ListContent_Map').firstChild.firstChild.childNodes) { var listContent = document.getElementById('ListContent_Map').firstChild.firstChild.childNodes; var listScrollBottom = (document.getElementById('ListContent_Map').scrollTop + Element.getHeight('ListContent_Map')); var listScrollTop = document.getElementById('ListContent_Map').scrollTop var listContentLength = listContent.length; for(var i = 0; i < listContentLength; i++) { var node = listContent[i]; if(node.nodeName == 'TR') { var nodeOffset = node.offsetTop; if(listScrollBottom >= nodeOffset && listScrollTop <= nodeOffset && listingImageArray) { var mls = node.id.split("-"); for(var ti = 0; ti < listingImageArray.length; ti++) { if(mls[1] == listingImageArray[ti].id && node.firstChild.firstChild.firstChild.childNodes.length == 0) { var img = document.createElement('img'); img.setAttribute("src",listingImageArray[ti].src); img.setAttribute("alt","Property List Image"); node.firstChild.firstChild.firstChild.appendChild(img); break; } } } } } } } function switchMapTab(id,noLoad) { if(id != currentTab) { document.getElementById(currentTab).style.display = 'none'; document.getElementById(id).style.display = ''; if((currentTab) == 'MapView') { document.getElementById(currentTab + '-Tab').className = "first"; } else { document.getElementById(currentTab + '-Tab').className = ""; } } if(!noLoad && id == 'DetailView' && currentProperty != selectedProperty && selectedProperty) { showDetails(selectedProperty); } if(id == 'ListView') { loadListImages(); } if(id != 'MapView') { document.getElementById('zoomKey').style.display = 'none'; document.getElementById('mapOverlay').style.display = 'none'; } else { map.checkResize(); document.getElementById('zoomKey').style.display = 'block'; if(numResults == 0 && map.getZoom() > minPropZoom) { document.getElementById('mapOverlay').style.display = ''; } if(pendingMapRefresh == true) { trackChanges(true); pendingMapRefresh = false; } } if('MapView' == id) { tabClass = "SelectedTab first-child"; } else { tabClass = "SelectedTab"; } document.getElementById(id + "-Tab").className = tabClass; currentTab = id; if(!noLoad && loadedDetailsPropertyIntoMap == false && currentProperty && id == "MapView") { showProperty(currentProperty); loadedDetailsPropertyIntoMap = true; } } function switchDetailMapTab(id) { if(PropertyMap) { if(id == "Street") { document.getElementById('DetailsMapView_Street').style.display = 'block'; document.getElementById('DetailsMapView').style.display = 'none'; document.getElementById('li-DetailsMapView_Street').className = 'SelectedTab'; document.getElementById("li-DetailsMapView_" + PropertyMapSelectedTab).className = ''; PropertyMapSelectedTab = "Street"; } else { document.getElementById('DetailsMapView').style.display = 'block'; document.getElementById('DetailsMapView_Street').style.display = 'none'; document.getElementById('li-DetailsMapView_' + PropertyMapSelectedTab).className = ''; document.getElementById("li-DetailsMapView_" + id).className = 'SelectedTab'; PropertyMapSelectedTab = id; } if(id == "Map") { PropertyMap.setMapType(G_NORMAL_MAP); } else if(id == "Hybrid") { PropertyMap.setMapType(G_HYBRID_MAP); } //else if(id == "Satellite") { PropertyMap.setMapType(G_SATELLITE_MAP); } } } function createMarker(point, type, id, pCount, hover, mlsid) { if(id == 0) { var iZ = "zero"; } else { var iZ = id; } var icon = new GIcon(); if(type == 'cluster' || type == 'cluster-gray') { if(type == 'cluster-gray') { icon.image= "/images/marker/cluster-gray.png"; } else { icon.image= "/images/marker/cluster.png"; } icon.iconAnchor=new GPoint(9, 33); icon.iconSize=new GSize(31, 34); icon.infoWindowAnchor=new GPoint(14,14); } else { icon.iconSize = new GSize(28,28); icon.iconAnchor = new GPoint(14,26); icon.infoWindowAnchor = new GPoint(14,14); if(type == 'resi') { icon.image = "/images/marker/resi.png"; } else if(type == 'resi-gray') { icon.image = "/images/marker/resi-gray.png"; } else if(type == 'lotl') { icon.image = "/images/marker/lotl.png"; } else if(type == 'lotl-gray') { icon.image = "/images/marker/lotl-gray.png"; } else { icon.image = "/images/marker/resi.png"; } } var markerOptions = {icon: icon }; var marker = new GMarker(point,markerOptions); var tooltip = new Tooltip(marker,hover,4); marker.tooltip = tooltip; map.addOverlay(tooltip); eventHandlers.push(GEvent.addListener(marker,'mouseover',function(){ this.tooltip.show(); })); eventHandlers.push(GEvent.addListener(marker,'mouseout',function(){ this.tooltip.hide(); })); if(type !== 'cluster' && type !== 'cluster-gray') { eventHandlers.push(GEvent.addListener(marker, "click", function() { timeouts.push(setTimeout( function(){ showMarkerInfoWindow(iZ); setProperty(mlsid); },250)); })); eventHandlers.push(GEvent.addListener(marker, "dblclick", function() { map.setZoom(zoom+1); })); } else { eventHandlers.push(GEvent.addListener(marker, "click", function() { markerInfo = '
'; markerInfo += '
Group of Properties<\/b><\/div>'; markerInfo += "This is a group of " + pCount + " properties that are too close together to be displayed at this zoom level.
Zoom in to view the properties in this group.<\/a>"; markerInfo += "<\/div>"; if (typeof InfoWindow !== 'undefined') { if (currentMarker) { closeInfoWindowMarker(); } if (!marker.overlay) { marker.overlay = new InfoWindow(marker, markerInfo, true); } currentMarker = marker; map.addOverlay(marker.overlay); } })); eventHandlers.push(GEvent.addListener(marker, "dblclick", function() { zoomToCluster(id); })); } return marker; } function zoomToCluster(id) { thisCluster = clusterHash[id]; closeInfoWindowMarker(); cancelTimeouts(); map.setCenter(new GLatLng(parseFloat(thisCluster.lat),parseFloat(thisCluster.lon)),(map.getZoom()+1)); } function showMarkerInfoWindow(id) { var iZ = id; if(id == 'zero') { var id = 0; } if(id || iZ == 'zero') { var type = markerHash[id].type; var mlsid = markerHash[id].mlsid; var marker = markerHash[id].marker; var mlsLength = mlsid.length; var location = "Property"; var opt = { method: 'post', postBody: "mlsid=" + mlsid, onSuccess: function(t) { if(t.responseText == "0") { } else { var markerInfo=t.responseText; // markerInfo += '