function addMarkers() { mySelect = document.getElementById('selection'); Loveville = [];Lexington_Park = [];Morganza = [];Chaptico = [];Great_Mills = [];Hollywood = [];Leonardtown = [];Mechanicsville = [];Helen = [];Park_Hall = [];Tall_Timbers = [];Ridge = [];mySelect.options[mySelect.options.length] = new Option("Chaptico schools",'all=Chaptico'); mySelect.options[mySelect.options.length] = new Option("Great Mills schools",'all=Great_Mills'); mySelect.options[mySelect.options.length] = new Option("Helen schools",'all=Helen'); mySelect.options[mySelect.options.length] = new Option("Hollywood schools",'all=Hollywood'); mySelect.options[mySelect.options.length] = new Option("Leonardtown schools",'all=Leonardtown'); mySelect.options[mySelect.options.length] = new Option("Lexington Park schools",'all=Lexington_Park'); mySelect.options[mySelect.options.length] = new Option("Loveville schools",'all=Loveville'); mySelect.options[mySelect.options.length] = new Option("Mechanicsville schools",'all=Mechanicsville'); mySelect.options[mySelect.options.length] = new Option("Morganza schools",'all=Morganza'); mySelect.options[mySelect.options.length] = new Option("Park Hall schools",'all=Park_Hall'); mySelect.options[mySelect.options.length] = new Option("Ridge schools",'all=Ridge'); mySelect.options[mySelect.options.length] = new Option("Tall Timbers schools",'all=Tall_Timbers'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Loveville[Loveville.length] = createMarker(new GPoint(-76.67664337,38.33030319),"
Banneker-loveville Elementary School
27180 Point Lookout Rd
Loveville, MD 20656

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Banneker-loveville Elementary School",'Loveville=' + Loveville.length); Lexington_Park[Lexington_Park.length] = createMarker(new GPoint(-76.43612671,38.25365448),"
Carver Elementary School
20833 Great Mills Rd
Lexington Park, MD 20653

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Carver Elementary School",'Lexington_Park=' + Lexington_Park.length); Morganza[Morganza.length] = createMarker(new GPoint(-76.69835663,38.37203598),"
Chopticon High School
25390 Colton Point Rd
Morganza, MD 20660

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Chopticon High School",'Morganza=' + Morganza.length); Chaptico[Chaptico.length] = createMarker(new GPoint(-76.76638794,38.30920410),"
Dynard Elementary School
23510 Bushwood Rd
Chaptico, MD 20621

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Dynard Elementary School",'Chaptico=' + Chaptico.length); Lexington_Park[Lexington_Park.length] = createMarker(new GPoint(-76.49080658,38.29285431),"
Esperanza Middle School
22790 Maple Rd
Lexington Park, MD 20653

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Esperanza Middle School",'Lexington_Park=' + Lexington_Park.length); Great_Mills[Great_Mills.length] = createMarker(new GPoint(-76.49349976,38.26190186),"
Great Mills High School
21130 Great Mills Rd
Great Mills, MD 20634

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Great Mills High School",'Great_Mills=' + Great_Mills.length); Lexington_Park[Lexington_Park.length] = createMarker(new GPoint(-76.48036957,38.29559326),"
Green Holly School
46060 Millstone Landing Rd
Lexington Park, MD 20653

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Green Holly School",'Lexington_Park=' + Lexington_Park.length); Great_Mills[Great_Mills.length] = createMarker(new GPoint(-76.49251556,38.28129578),"
Greenview Knolls Elementary School
45711 Military Ln
Great Mills, MD 20634

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Greenview Knolls Elementary School",'Great_Mills=' + Great_Mills.length); Hollywood[Hollywood.length] = createMarker(new GPoint(-76.54161800,38.33871800),"
Hollywood Elementary School
44345 Joy Chapel Rd
Hollywood, MD 20636

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Hollywood Elementary School",'Hollywood=' + Hollywood.length); Leonardtown[Leonardtown.length] = createMarker(new GPoint(-76.63822174,38.29598236),"
Leonardtown Elementary School
22885 Duke St
Leonardtown, MD 20650

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Leonardtown Elementary School",'Leonardtown=' + Leonardtown.length); Leonardtown[Leonardtown.length] = createMarker(new GPoint(-76.61001587,38.27248764),"
Leonardtown High School
23995 Point Lookout Rd
Leonardtown, MD 20650

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Leonardtown High School",'Leonardtown=' + Leonardtown.length); Leonardtown[Leonardtown.length] = createMarker(new GPoint(-76.63613129,38.29108810),"
Leonardtown Middle School
24015 Point Lookout Rd
Leonardtown, MD 20650

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Leonardtown Middle School",'Leonardtown=' + Leonardtown.length); Mechanicsville[Mechanicsville.length] = createMarker(new GPoint(-76.76755400,38.47308300),"
Lettie Marshall Dent Elementary School
37840 New Market Turner Rd
Mechanicsville, MD 20659

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Lettie Marshall Dent Elementary School",'Mechanicsville=' + Mechanicsville.length); Lexington_Park[Lexington_Park.length] = createMarker(new GPoint(-76.45634460,38.26095200),"
Lexington Park Elementary School
46763 Shangri La Dr
Lexington Park, MD 20653

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Lexington Park Elementary School",'Lexington_Park=' + Lexington_Park.length); Helen[Helen.length] = createMarker(new GPoint(-76.72190094,38.38270187),"
Margaret Brent Middle School
29675 Point Lookout Rd
Helen, MD 20635

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Margaret Brent Middle School",'Helen=' + Helen.length); Mechanicsville[Mechanicsville.length] = createMarker(new GPoint(-76.75292206,38.45320892),"
Mechanicsville Elementary School
28585 Three Notch Rd
Mechanicsville, MD 20659

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Mechanicsville Elementary School",'Mechanicsville=' + Mechanicsville.length); Mechanicsville[Mechanicsville.length] = createMarker(new GPoint(-76.73200226,38.42449951),"
Oakville Elementary School
26410 Three Notch Rd
Mechanicsville, MD 20659

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Oakville Elementary School",'Mechanicsville=' + Mechanicsville.length); Park_Hall[Park_Hall.length] = createMarker(new GPoint(-76.44996643,38.22716904),"
Park Hall Elementary School
20343 Hermanville Rd
Park Hall, MD 20667

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Park Hall Elementary School",'Park_Hall=' + Park_Hall.length); Tall_Timbers[Tall_Timbers.length] = createMarker(new GPoint(-76.53328705,38.16733932),"
Piney Point Elementary School
44550 Tall Timbers Rd
Tall Timbers, MD 20690

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Piney Point Elementary School",'Tall_Timbers=' + Tall_Timbers.length); Ridge[Ridge.length] = createMarker(new GPoint(-76.36608124,38.11023712),"
Ridge Elementary School
49430 Airedale Rd
Ridge, MD 20680

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Ridge Elementary School",'Ridge=' + Ridge.length); Leonardtown[Leonardtown.length] = createMarker(new GPoint(-76.63390350,38.27140045),"
Saint Mary's County Alternative Learning Center
624005 Pt Lookout Rd
Leonardtown, MD 20650

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Saint Mary's County Alternative Learning Center",'Leonardtown=' + Leonardtown.length); Leonardtown[Leonardtown.length] = createMarker(new GPoint(-76.67631531,38.32577896),"
Saint Mary's County Evening High School
123160 Moakley St
Leonardtown, MD 20650

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Saint Mary's County Evening High School",'Leonardtown=' + Leonardtown.length); Lexington_Park[Lexington_Park.length] = createMarker(new GPoint(-76.40425110,38.21356201),"
Spring Ridge Middle School
19856 Three Notch Rd
Lexington Park, MD 20653

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Spring Ridge Middle School",'Lexington_Park=' + Lexington_Park.length); Lexington_Park[Lexington_Park.length] = createMarker(new GPoint(-76.45159912,38.25059891),"
Town Creek Elementary School
45805 Dent Dr
Lexington Park, MD 20653

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Town Creek Elementary School",'Lexington_Park=' + Lexington_Park.length); Mechanicsville[Mechanicsville.length] = createMarker(new GPoint(-76.77645874,38.46847534),"
White Marsh Elementary School
29090 Thompson Corner Rd
Mechanicsville, MD 20659

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("White Marsh Elementary School",'Mechanicsville=' + Mechanicsville.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(Chaptico); map.removeOverlays(Great_Mills); map.removeOverlays(Helen); map.removeOverlays(Hollywood); map.removeOverlays(Leonardtown); map.removeOverlays(Lexington_Park); map.removeOverlays(Loveville); map.removeOverlays(Mechanicsville); map.removeOverlays(Morganza); map.removeOverlays(Park_Hall); map.removeOverlays(Ridge); map.removeOverlays(Tall_Timbers); 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(Loveville);map.removeOverlays(Chaptico); map.removeOverlays(Great_Mills); map.removeOverlays(Helen); map.removeOverlays(Hollywood); map.removeOverlays(Leonardtown); map.removeOverlays(Lexington_Park); map.removeOverlays(Loveville); map.removeOverlays(Mechanicsville); map.removeOverlays(Morganza); map.removeOverlays(Park_Hall); map.removeOverlays(Ridge); map.removeOverlays(Tall_Timbers); map.addOverlays(Chaptico); centerByArray(Chaptico, false, false); cntMarker += Chaptico.length; map.addOverlays(Great_Mills); centerByArray(Great_Mills, false, false); cntMarker += Great_Mills.length; map.addOverlays(Helen); centerByArray(Helen, false, false); cntMarker += Helen.length; map.addOverlays(Hollywood); centerByArray(Hollywood, false, false); cntMarker += Hollywood.length; map.addOverlays(Leonardtown); centerByArray(Leonardtown, false, false); cntMarker += Leonardtown.length; map.addOverlays(Lexington_Park); centerByArray(Lexington_Park, false, false); cntMarker += Lexington_Park.length; map.addOverlays(Loveville); centerByArray(Loveville, false, false); cntMarker += Loveville.length; map.addOverlays(Mechanicsville); centerByArray(Mechanicsville, false, false); cntMarker += Mechanicsville.length; map.addOverlays(Morganza); centerByArray(Morganza, false, false); cntMarker += Morganza.length; map.addOverlays(Park_Hall); centerByArray(Park_Hall, false, false); cntMarker += Park_Hall.length; map.addOverlays(Ridge); centerByArray(Ridge, false, false); cntMarker += Ridge.length; map.addOverlays(Tall_Timbers); centerByArray(Tall_Timbers, false, false); cntMarker += Tall_Timbers.length; centerByArray(Loveville,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'); } }