function addMarkers() { mySelect = document.getElementById('selection'); Cumberland = [];Frostburg = [];Lavale = [];Cresaptown = [];Flintstone = [];Lonaconing = [];Mount_Savage = [];Mt_Savage = [];Westernport = [];mySelect.options[mySelect.options.length] = new Option("Cresaptown schools",'all=Cresaptown'); mySelect.options[mySelect.options.length] = new Option("Cumberland schools",'all=Cumberland'); mySelect.options[mySelect.options.length] = new Option("Flintstone schools",'all=Flintstone'); mySelect.options[mySelect.options.length] = new Option("Frostburg schools",'all=Frostburg'); mySelect.options[mySelect.options.length] = new Option("Lavale schools",'all=Lavale'); mySelect.options[mySelect.options.length] = new Option("Lonaconing schools",'all=Lonaconing'); mySelect.options[mySelect.options.length] = new Option("Mount Savage schools",'all=Mount_Savage'); mySelect.options[mySelect.options.length] = new Option("Mt Savage schools",'all=Mt_Savage'); mySelect.options[mySelect.options.length] = new Option("Westernport schools",'all=Westernport'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Cumberland[Cumberland.length] = createMarker(new GPoint(-78.76790619,39.65098953),"
Allegany County Home & Hospital
108 Washington St
Cumberland, MD 21502

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Allegany County Home & Hospital",'Cumberland=' + Cumberland.length); Cumberland[Cumberland.length] = createMarker(new GPoint(-78.77497101,39.65643692),"
Allegany High School
616 Sedgwick St
Cumberland, MD 21502

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Allegany High School",'Cumberland=' + Cumberland.length); Frostburg[Frostburg.length] = createMarker(new GPoint(-78.93160248,39.65470123),"
Beall Elementary School
3 E College Ave
Frostburg, MD 21532

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Beall Elementary School",'Frostburg=' + Frostburg.length); Frostburg[Frostburg.length] = createMarker(new GPoint(-78.92767334,39.65675354),"
Beall High School
331 E Main St
Frostburg, MD 21532

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Beall High School",'Frostburg=' + Frostburg.length); Cumberland[Cumberland.length] = createMarker(new GPoint(-78.85165405,39.57735825),"
Bel Air Elementary School
14401 Barton Blvd
Cumberland, MD 21502

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Bel Air Elementary School",'Cumberland=' + Cumberland.length); Cumberland[Cumberland.length] = createMarker(new GPoint(-78.77143097,39.66606903),"
Braddock Middle School
909 Holland St
Cumberland, MD 21502

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Braddock Middle School",'Cumberland=' + Cumberland.length); Lavale[Lavale.length] = createMarker(new GPoint(-78.81488037,39.66051483),"
Cash Valley Elementary School
10601 Cash Valley Rd Nw
Lavale, MD 21502

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Cash Valley Elementary School",'Lavale=' + Lavale.length); Cresaptown[Cresaptown.length] = createMarker(new GPoint(-78.82469177,39.60004044),"
Center For Career & Technology Education
14211 Mcmullen Hwy Sw
Cresaptown, MD 21502

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Center For Career & Technology Education",'Cresaptown=' + Cresaptown.length); Cresaptown[Cresaptown.length] = createMarker(new GPoint(-78.83192444,39.58982468),"
Cresaptown Elementary School
13202 6th Ave
Cresaptown, MD 21502

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Cresaptown Elementary School",'Cresaptown=' + Cresaptown.length); Frostburg[Frostburg.length] = createMarker(new GPoint(-78.90110016,39.65428162),"
Eckhart Alternative School
17000 National Hwy Sw
Frostburg, MD 21532

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Eckhart Alternative School",'Frostburg=' + Frostburg.length); Flintstone[Flintstone.length] = createMarker(new GPoint(-78.56502533,39.70207214),"
Flintstone Elementary School
22000 National Pike Ne
Flintstone, MD 21530

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Flintstone Elementary School",'Flintstone=' + Flintstone.length); Cumberland[Cumberland.length] = createMarker(new GPoint(-78.74902344,39.64446259),"
Fort Hill High School
500 Greenway Ave
Cumberland, MD 21502

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Fort Hill High School",'Cumberland=' + Cumberland.length); Frostburg[Frostburg.length] = createMarker(new GPoint(-78.93033600,39.66979599),"
Frost Elementary School
260 Shaw St
Frostburg, MD 21532

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Frost Elementary School",'Frostburg=' + Frostburg.length); Lonaconing[Lonaconing.length] = createMarker(new GPoint(-78.95311737,39.58125687),"
George's Creek Elementary School
215600 Lower Georges Creek Rd
Lonaconing, MD 21539

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("George's Creek Elementary School",'Lonaconing=' + Lonaconing.length); Cumberland[Cumberland.length] = createMarker(new GPoint(-78.77043915,39.62765884),"
John Humbird Elementary School
120 Mary St
Cumberland, MD 21502

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("John Humbird Elementary School",'Cumberland=' + Cumberland.length); Mount_Savage[Mount_Savage.length] = createMarker(new GPoint(-78.88531494,39.70081711),"
Mount Savage Middle School
13201 New School Rd Nw
Mount Savage, MD 21545

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Mount Savage Middle School",'Mount_Savage=' + Mount_Savage.length); Mt_Savage[Mt_Savage.length] = createMarker(new GPoint(-78.84472100,39.70077300),"
Mt. Savage Elementary School
13201 New School Rd Nw
Mt Savage, MD 21545

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Mt. Savage Elementary School",'Mt_Savage=' + Mt_Savage.length); Cumberland[Cumberland.length] = createMarker(new GPoint(-78.75489807,39.67598343),"
Northeast Elementary School
11001 Forest Ave Ne
Cumberland, MD 21502

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Northeast Elementary School",'Cumberland=' + Cumberland.length); Lavale[Lavale.length] = createMarker(new GPoint(-78.82666016,39.64425278),"
Parkside Elementary School
50 Parkside Blvd
Lavale, MD 21502

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Parkside Elementary School",'Lavale=' + Lavale.length); Cumberland[Cumberland.length] = createMarker(new GPoint(-78.75768280,39.63570404),"
South Penn Elementary School
500 E 2nd St
Cumberland, MD 21502

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("South Penn Elementary School",'Cumberland=' + Cumberland.length); Cumberland[Cumberland.length] = createMarker(new GPoint(-10.00000000,10.00000000),"
Transition Program At Cumberland
3 Pershing St Rm303
Cumberland, MD 21502

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Transition Program At Cumberland",'Cumberland=' + Cumberland.length); Frostburg[Frostburg.length] = createMarker(new GPoint(-78.93180084,39.64799881),"
Transition Program At Frostburg
101 Braddock Rd Guild Hall 00
Frostburg, MD 21532

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Transition Program At Frostburg",'Frostburg=' + Frostburg.length); Cumberland[Cumberland.length] = createMarker(new GPoint(-78.74566650,39.63721085),"
Washington Middle School
200 Massachusetts Ave
Cumberland, MD 21502

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Washington Middle School",'Cumberland=' + Cumberland.length); Cumberland[Cumberland.length] = createMarker(new GPoint(-78.77252960,39.64948273),"
West Side Elementary School
425 Paca St
Cumberland, MD 21502

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("West Side Elementary School",'Cumberland=' + Cumberland.length); Westernport[Westernport.length] = createMarker(new GPoint(-79.04071045,39.48139191),"
Westernport Elementary School
172 Church St
Westernport, MD 21562

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Westernport Elementary School",'Westernport=' + Westernport.length); Lonaconing[Lonaconing.length] = createMarker(new GPoint(-78.99021912,39.55567932),"
Westmar High School
16915 Lower George''s Creek Rd
Lonaconing, MD 21539

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Westmar High School",'Lonaconing=' + Lonaconing.length); Westernport[Westernport.length] = createMarker(new GPoint(-79.03826141,39.48601913),"
Westmar Middle School
400 Philos Avenue
Westernport, MD 21562

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Westmar Middle School",'Westernport=' + Westernport.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(Cresaptown); map.removeOverlays(Cumberland); map.removeOverlays(Flintstone); map.removeOverlays(Frostburg); map.removeOverlays(Lavale); map.removeOverlays(Lonaconing); map.removeOverlays(Mount_Savage); map.removeOverlays(Mt_Savage); map.removeOverlays(Westernport); 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(Cumberland);map.removeOverlays(Cresaptown); map.removeOverlays(Cumberland); map.removeOverlays(Flintstone); map.removeOverlays(Frostburg); map.removeOverlays(Lavale); map.removeOverlays(Lonaconing); map.removeOverlays(Mount_Savage); map.removeOverlays(Mt_Savage); map.removeOverlays(Westernport); map.addOverlays(Cresaptown); centerByArray(Cresaptown, false, false); cntMarker += Cresaptown.length; map.addOverlays(Cumberland); centerByArray(Cumberland, false, false); cntMarker += Cumberland.length; map.addOverlays(Flintstone); centerByArray(Flintstone, false, false); cntMarker += Flintstone.length; map.addOverlays(Frostburg); centerByArray(Frostburg, false, false); cntMarker += Frostburg.length; map.addOverlays(Lavale); centerByArray(Lavale, false, false); cntMarker += Lavale.length; map.addOverlays(Lonaconing); centerByArray(Lonaconing, false, false); cntMarker += Lonaconing.length; map.addOverlays(Mount_Savage); centerByArray(Mount_Savage, false, false); cntMarker += Mount_Savage.length; map.addOverlays(Mt_Savage); centerByArray(Mt_Savage, false, false); cntMarker += Mt_Savage.length; map.addOverlays(Westernport); centerByArray(Westernport, false, false); cntMarker += Westernport.length; centerByArray(Cumberland,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'); } }