function addMarkers() { mySelect = document.getElementById('selection'); Hoover = [];Hoover[Hoover.length] = createMarker(new GPoint(-86.80678558,33.42080688),"
Berry Middle School
4500 Jaguar Dr.
Hoover, AL 35242

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Berry Middle School",'Hoover=' + Hoover.length); Hoover[Hoover.length] = createMarker(new GPoint(-86.85489655,33.40992737),"
Bluff Park Elementary School
569 Park Avenue
Hoover, AL 35226

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Bluff Park Elementary School",'Hoover=' + Hoover.length); Hoover[Hoover.length] = createMarker(new GPoint(-86.87078857,33.35556412),"
Deer Valley Elementary School
4990 Ross Bridge Parkway
Hoover, AL 35226

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Deer Valley Elementary School",'Hoover=' + Hoover.length); Hoover[Hoover.length] = createMarker(new GPoint(-86.80728912,33.39710999),"
Green Valley Elementary School
3200 Old Columbiana Rd
Hoover, AL 35226

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Green Valley Elementary School",'Hoover=' + Hoover.length); Hoover[Hoover.length] = createMarker(new GPoint(-86.66006470,33.41431808),"
Greystone Elementary School
300 Village Street
Hoover, AL 35242

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Greystone Elementary School",'Hoover=' + Hoover.length); Hoover[Hoover.length] = createMarker(new GPoint(-86.82946777,33.38735580),"
Gwin Elementary School
1580 Patton Chapel Road
Hoover, AL 35226

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Gwin Elementary School",'Hoover=' + Hoover.length); Hoover[Hoover.length] = createMarker(new GPoint(-86.75399900,33.37900600),"
Hoover High School
1000 Buccaneer Drive
Hoover, AL 35244

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Hoover High School",'Hoover=' + Hoover.length); Hoover[Hoover.length] = createMarker(new GPoint(-86.82894135,33.38767624),"
Ira F Simmons Middle School
1575 Patton Chapel Road
Hoover, AL 35226

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Ira F Simmons Middle School",'Hoover=' + Hoover.length); Hoover[Hoover.length] = createMarker(new GPoint(-86.80916600,33.35682800),"
Riverchase Elementary School
1950 Old Montgomery Highway
Hoover, AL 35244

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Riverchase Elementary School",'Hoover=' + Hoover.length); Hoover[Hoover.length] = createMarker(new GPoint(-86.89799500,33.34398651),"
Robert F Bumpus Middle School
1730 Lake Cyrus Club Dr
Hoover, AL 35244

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Robert F Bumpus Middle School",'Hoover=' + Hoover.length); Hoover[Hoover.length] = createMarker(new GPoint(-86.76534271,33.41003418),"
Rocky Ridge Elementary School
2876 Old Rocky Ridge Rd
Hoover, AL 35243

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Rocky Ridge Elementary School",'Hoover=' + Hoover.length); Hoover[Hoover.length] = createMarker(new GPoint(-86.82418823,33.42810822),"
Shades Mountain Elementary School
2250 Sumpter Street
Hoover, AL 35226

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Shades Mountain Elementary School",'Hoover=' + Hoover.length); Hoover[Hoover.length] = createMarker(new GPoint(-86.89318848,33.31844711),"
South Shades Crest Elementary School
3770 So Shades Crest Rd
Hoover, AL 35244

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("South Shades Crest Elementary School",'Hoover=' + Hoover.length); Hoover[Hoover.length] = createMarker(new GPoint(-86.72810364,33.38628006),"
Spain Park High School
4700 Jaguar Drive
Hoover, AL 35242

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Spain Park High School",'Hoover=' + Hoover.length); Hoover[Hoover.length] = createMarker(new GPoint(-86.84323883,33.34671783),"
Trace Crossings Elementary School
5454 Learning Lane
Hoover, AL 35244

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