function addMarkers(){ mySelect = document.getElementById('selection'); Stuart = [];Hobe_Sound = [];Indiantown = [];Palm_City = [];mySelect.options[mySelect.options.length] = new Option("Hobe Sound schools",'all=Hobe_Sound'); mySelect.options[mySelect.options.length] = new Option("Indiantown schools",'all=Indiantown'); mySelect.options[mySelect.options.length] = new Option("Palm City schools",'all=Palm_City'); mySelect.options[mySelect.options.length] = new Option("Stuart schools",'all=Stuart'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Stuart[Stuart.length] = createMarker(new GPoint(-80.24398800,27.12748900),"
Community Christian Academy
777 Se Salerno Road
Stuart, FL 34997
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Community Christian Academy",'Stuart=' + Stuart.length); Stuart[Stuart.length] = createMarker(new GPoint(-80.25466000,27.19773700),"
First Baptist Christian School
201 W Ocean Blvd
Stuart, FL 34994
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("First Baptist Christian School",'Stuart=' + Stuart.length); Hobe_Sound[Hobe_Sound.length] = createMarker(new GPoint(-80.13657900,27.05950000),"
Hobe Sound Christian Academy
Po Box 1065
Hobe Sound, FL 33475
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Hobe Sound Christian Academy",'Hobe_Sound=' + Hobe_Sound.length); Indiantown[Indiantown.length] = createMarker(new GPoint(-80.46955100,27.02716100),"
Hope Rural School
15929 Sw 150th Street
Indiantown, FL 34956
Co-ed school, PK-5
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Hope Rural School",'Indiantown=' + Indiantown.length); Palm_City[Palm_City.length] = createMarker(new GPoint(-80.29330300,27.16420400),"
Martin Downs Montessori School
3001 Sw Mill Creek Way
Palm City, FL 34990
Co-ed school, NS-PK
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Martin Downs Montessori School",'Palm_City=' + Palm_City.length); Hobe_Sound[Hobe_Sound.length] = createMarker(new GPoint(-80.12861300,27.05075700),"
The Pine School
12350 SE Federal Highway and 1300 E. Tenth Street in Stuart
Hobe Sound, FL 33455
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("The Pine School",'Hobe_Sound=' + Hobe_Sound.length); Stuart[Stuart.length] = createMarker(new GPoint(-80.21954100,27.19630800),"
Redeemer Lutheran School
2450 SE Ocean Blvd
Stuart, FL 34996
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Redeemer Lutheran School",'Stuart=' + Stuart.length); Stuart[Stuart.length] = createMarker(new GPoint(-80.23126600,27.19006300),"
St. Joseph Catholic School
1200 Se 10th Street
Stuart, FL 34996
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Joseph Catholic School",'Stuart=' + Stuart.length); Stuart[Stuart.length] = createMarker(new GPoint(-80.23347500,27.12344400),"
Samaritan House For Boys
1490 Se Cove Rd
Stuart, FL 34997
All-boys school, 5-8
[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Samaritan House For Boys",'Stuart=' + Stuart.length); } // End addStateMarkers JavaScript Function // Takes an array of markers and centers/zooms map based on marker range function centerByArray(myArray, recenter, newMaxMin) { if (newMaxMin == true) reMaxMin(myArray); for (var i = 0; i < myArray.length; i++) { var markLng = myArray[i].getPoint().x; var markLat = myArray[i].getPoint().y; if (markLat > maxLat) maxLat = markLat; if (markLng > maxLng) maxLng = markLng; if (markLat < minLat) minLat = markLat; if (markLng < minLng) minLng = markLng; } if (recenter) reCenterMap(); } // Reinit max/mins function reMaxMin(myArray) { maxLng = myArray[0].getPoint().x; maxLat = myArray[0].getPoint().y; minLng = myArray[0].getPoint().x; minLat = myArray[0].getPoint().y; } // Recenter map based on global max/mins function reCenterMap() { var bounds = new GLatLngBounds(); bounds.extend(new GLatLng(minLat, minLng)); bounds.extend(new GLatLng(maxLat, maxLng)); var center_lat = (bounds.getNorthEast().lat() + bounds.getSouthWest().lat()) / 2.0; var center_lng = (bounds.getNorthEast().lng() + bounds.getSouthWest().lng()) / 2.0; var center = new GLatLng(center_lat, center_lng); var zoom = map.getBoundsZoomLevel(bounds); map.setCenter(center,zoom); //map.setCenter(center,11); /* var center = new GPoint( (maxLng + minLng)/2, (maxLat+minLat)/2 ); var delta = new GSize(maxLng - minLng, maxLat - minLat); var minZoom = map.spec.getLowestZoomLevel(center, delta, map.viewSize); if (minZoom < 4) minZoom = 4; // Lowest possible zoom is 4 map.centerAndZoom(center, minZoom); */ } // Fires when drop down list of schools changes function selectChange(selection) { var myVal = selection.options[selection.selectedIndex].value; map.closeInfoWindow(); // Add entire array based on variable type if (myVal.indexOf('all') != -1 && myVal != 'all') { var temp = myVal.split('='); var showArray = temp[1]; // If Array is > X amount of markers, then open in a new page if (eval(showArray).length > 20) // New window depends on whether or not we're on the search page if (location.href.indexOf('nearby_schools.php') == -1) window.open(location.href + '/map/' + showArray); else window.open('/search/////1/' + showArray); map.removeOverlays(Hobe_Sound); map.removeOverlays(Indiantown); map.removeOverlays(Palm_City); map.removeOverlays(Stuart); map.addOverlays(eval(showArray)); centerByArray(eval(showArray), true, true); // Center and zoom on set of markers } // Add individual markers if (myVal.indexOf('all') == -1 && myVal != 'all' && myVal.length) { var temp = myVal.split('='); var myArray = temp[0]; var myIndex = parseInt(temp[1]) - 1; document.getElementById('map').width = "750"; map.removeOverlay(eval(myArray)[myIndex]); map.addOverlay(eval(myArray)[myIndex]); GEvent.trigger(eval(myArray)[myIndex],'click'); } // Show all markers if (myVal == 'all') { cntMarker = 0; reMaxMin(Stuart);map.removeOverlays(Hobe_Sound); map.removeOverlays(Indiantown); map.removeOverlays(Palm_City); map.removeOverlays(Stuart); map.addOverlays(Hobe_Sound); centerByArray(Hobe_Sound, false, false); cntMarker += Hobe_Sound.length; map.addOverlays(Indiantown); centerByArray(Indiantown, false, false); cntMarker += Indiantown.length; map.addOverlays(Palm_City); centerByArray(Palm_City, false, false); cntMarker += Palm_City.length; map.addOverlays(Stuart); centerByArray(Stuart, false, false); cntMarker += Stuart.length; centerByArray(Stuart,true, false); if (cntMarker > 20) // New window depends on whether or not we're on the search page if (location.href.indexOf('schools-by-distance') == -1) window.open(location.href + '/map/all'); else window.open('/search////all'); //window.open('/map.php?type=1&schools=&school_level=1&radius=&zipcode=&school_type_search=&school_type_code='); } } function createMarker(point, label, icon) { var marker = new GMarker(point, icon); var html = label; GEvent.addListener(marker, "click", function() { marker.openInfoWindowHtml(html); }); return marker; }