function addMarkers() { mySelect = document.getElementById('selection'); Memphis = [];Memphis[Memphis.length] = createMarker(new GPoint(-89.97766876,35.22896957),"
Brookmeade Elementary School
3777 Edenburg Dr
Memphis, TN 38127

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Brookmeade Elementary School",'Memphis=' + Memphis.length); Memphis[Memphis.length] = createMarker(new GPoint(-90.00774384,35.22733688),"
Corning Elementary School
1662 Dabbs
Memphis, TN 38127

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Corning Elementary School",'Memphis=' + Memphis.length); Memphis[Memphis.length] = createMarker(new GPoint(-90.00630951,35.19937515),"
Delano Elementary School
1716 Delano Rd
Memphis, TN 38127

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Delano Elementary School",'Memphis=' + Memphis.length); Memphis[Memphis.length] = createMarker(new GPoint(-89.99890900,35.21753693),"
Denver Elementary School
1940 Frayser Bl
Memphis, TN 38127

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Denver Elementary School",'Memphis=' + Memphis.length); Memphis[Memphis.length] = createMarker(new GPoint(-89.98683167,35.16700363),"
Diamond Academy
2109 Howell
Memphis, TN 38127

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Diamond Academy",'Memphis=' + Memphis.length); Memphis[Memphis.length] = createMarker(new GPoint(-90.01059723,35.21323776),"
Frayser Elementary School
1602 Dellwood
Memphis, TN 38127

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Frayser Elementary School",'Memphis=' + Memphis.length); Memphis[Memphis.length] = createMarker(new GPoint(-90.01303864,35.21326065),"
Frayser High School
1530 Dellwood
Memphis, TN 38127

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Frayser High School",'Memphis=' + Memphis.length); Memphis[Memphis.length] = createMarker(new GPoint(-89.99793243,35.23204041),"
Georgian Hills Elementary School
3930 Leweir Av
Memphis, TN 38127

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Georgian Hills Elementary School",'Memphis=' + Memphis.length); Memphis[Memphis.length] = createMarker(new GPoint(-89.99548340,35.23286819),"
Georgian Hills Junior High School
3925 Denver Rd
Memphis, TN 38127

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Georgian Hills Junior High School",'Memphis=' + Memphis.length); Memphis[Memphis.length] = createMarker(new GPoint(-89.98621368,35.20701981),"
Grandview Heights Elementary School
2342 Clifton Rd
Memphis, TN 38127

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Grandview Heights Elementary School",'Memphis=' + Memphis.length); Memphis[Memphis.length] = createMarker(new GPoint(-89.98307037,35.24295807),"
Hawkins Mill Elementary School
4295 Mountain Terrace
Memphis, TN 38127

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Hawkins Mill Elementary School",'Memphis=' + Memphis.length); Memphis[Memphis.length] = createMarker(new GPoint(-90.00669861,35.22740173),"
Lucie E. Champbell Elementary School
3232 Birchfield
Memphis, TN 38127

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Lucie E. Champbell Elementary School",'Memphis=' + Memphis.length); Memphis[Memphis.length] = createMarker(new GPoint(-89.98156400,35.22007300),"
Memphis Business Academy
2450 Frayser Blvd
Memphis, TN 38127

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Memphis Business Academy",'Memphis=' + Memphis.length); Memphis[Memphis.length] = createMarker(new GPoint(-90.04092407,35.26633453),"
Northhaven Elementary School
5157 North Circle Rd
Memphis, TN 38127

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Northhaven Elementary School",'Memphis=' + Memphis.length); Memphis[Memphis.length] = createMarker(new GPoint(-90.00945600,35.23133000),"
Promise Academy
1635 Georgian Dr
Memphis, TN 38127

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Promise Academy",'Memphis=' + Memphis.length); Memphis[Memphis.length] = createMarker(new GPoint(-89.97543335,35.21356201),"
Trezevant Career And Technical School
3224 Rangeline Rd
Memphis, TN 38127

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Trezevant Career And Technical School",'Memphis=' + Memphis.length); Memphis[Memphis.length] = createMarker(new GPoint(-89.97853088,35.21743774),"
Trezevant High School
3350 Trezevant
Memphis, TN 38127

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Trezevant High School",'Memphis=' + Memphis.length); Memphis[Memphis.length] = createMarker(new GPoint(-90.03656006,35.21730804),"
Westside Elementary School
3347 Dawn Dr
Memphis, TN 38127

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Westside Elementary School",'Memphis=' + Memphis.length); Memphis[Memphis.length] = createMarker(new GPoint(-90.03652954,35.21800613),"
Westside High School
3389 Dawn Dr
Memphis, TN 38127

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Westside High School",'Memphis=' + Memphis.length); Memphis[Memphis.length] = createMarker(new GPoint(-89.83726501,35.15856934),"
Whitney Elementary School
1219 Whitney Rd
Memphis, TN 38127

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Whitney Elementary School",'Memphis=' + Memphis.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,10); /* 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////' + showArray); map.removeOverlays(Memphis); 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(Memphis);map.removeOverlays(Memphis); map.addOverlays(Memphis); centerByArray(Memphis, false, false); cntMarker += Memphis.length; centerByArray(Memphis,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'); } }