function addMarkers() { mySelect = document.getElementById('selection'); Barnesville = [];Bellaire = [];Saint_Clairsville = [];Bridgeport = [];Martins_Ferry = [];Dillonvale = [];Shadyside = [];Lansing = [];Powhatan_Point = [];Belmont = [];mySelect.options[mySelect.options.length] = new Option("Barnesville schools",'all=Barnesville'); mySelect.options[mySelect.options.length] = new Option("Bellaire schools",'all=Bellaire'); mySelect.options[mySelect.options.length] = new Option("Belmont schools",'all=Belmont'); mySelect.options[mySelect.options.length] = new Option("Bridgeport schools",'all=Bridgeport'); mySelect.options[mySelect.options.length] = new Option("Dillonvale schools",'all=Dillonvale'); mySelect.options[mySelect.options.length] = new Option("Lansing schools",'all=Lansing'); mySelect.options[mySelect.options.length] = new Option("Martins Ferry schools",'all=Martins_Ferry'); mySelect.options[mySelect.options.length] = new Option("Powhatan Point schools",'all=Powhatan_Point'); mySelect.options[mySelect.options.length] = new Option("Saint Clairsville schools",'all=Saint_Clairsville'); mySelect.options[mySelect.options.length] = new Option("Shadyside schools",'all=Shadyside'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Barnesville[Barnesville.length] = createMarker(new GPoint(-81.17838287,39.98915863),"
Barnesville Elementary School
210 W Church St
Barnesville, OH 43713

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Barnesville Elementary School",'Barnesville=' + Barnesville.length); Barnesville[Barnesville.length] = createMarker(new GPoint(-81.15631866,39.98825836),"
Barnesville High School
910 Shamrock Dr
Barnesville, OH 43713

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Barnesville High School",'Barnesville=' + Barnesville.length); Barnesville[Barnesville.length] = createMarker(new GPoint(-81.15447235,39.98820114),"
Barnesville Middle School
970 Shamrock Dr
Barnesville, OH 43713

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Barnesville Middle School",'Barnesville=' + Barnesville.length); Bellaire[Bellaire.length] = createMarker(new GPoint(-80.80937195,40.02639389),"
Bellaire Elementary School
53299 Pike St
Bellaire, OH 43906

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Bellaire Elementary School",'Bellaire=' + Bellaire.length); Bellaire[Bellaire.length] = createMarker(new GPoint(-80.74266052,40.01757431),"
Bellaire High School
349 35th St
Bellaire, OH 43906

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bellaire High School",'Bellaire=' + Bellaire.length); Bellaire[Bellaire.length] = createMarker(new GPoint(-80.74288940,40.01623917),"
Bellaire Middle School
54555 Bellaire-neffs Rd
Bellaire, OH 43906

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Bellaire Middle School",'Bellaire=' + Bellaire.length); Saint_Clairsville[Saint_Clairsville.length] = createMarker(new GPoint(-80.96688080,40.07646179),"
Belmont Career Center
110 Fox Shannon Pl
Saint Clairsville, OH 43950

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Belmont Career Center",'Saint_Clairsville=' + Saint_Clairsville.length); Bridgeport[Bridgeport.length] = createMarker(new GPoint(-80.74599457,40.06917953),"
Bridgeport High School
501 Bennett St
Bridgeport, OH 43912

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bridgeport High School",'Bridgeport=' + Bridgeport.length); Martins_Ferry[Martins_Ferry.length] = createMarker(new GPoint(-80.73220062,40.09377289),"
Elm Middle School
701 Euclid Ave
Martins Ferry, OH 43935

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Elm Middle School",'Martins_Ferry=' + Martins_Ferry.length); Dillonvale[Dillonvale.length] = createMarker(new GPoint(-80.81902313,40.12995148),"
Hilltop Elementary School
72559 Colerain Rd
Dillonvale, OH 43917

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Hilltop Elementary School",'Dillonvale=' + Dillonvale.length); Shadyside[Shadyside.length] = createMarker(new GPoint(-80.75931549,39.96735764),"
Jefferson Ave Elementary School
4895 Jefferson Ave
Shadyside, OH 43947

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Jefferson Ave Elementary School",'Shadyside=' + Shadyside.length); Bridgeport[Bridgeport.length] = createMarker(new GPoint(-80.74599457,40.06917953),"
Kirkwood Middle School
501 Bennett St
Bridgeport, OH 43912

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Kirkwood Middle School",'Bridgeport=' + Bridgeport.length); Lansing[Lansing.length] = createMarker(new GPoint(-80.79002380,40.07524872),"
Lansing Primary Elementary School
68583 Scott St
Lansing, OH 43934

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Lansing Primary Elementary School",'Lansing=' + Lansing.length); Shadyside[Shadyside.length] = createMarker(new GPoint(-80.74787903,39.97382736),"
Leona Ave Middle School
3795 Leona Ave
Shadyside, OH 43947

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Leona Ave Middle School",'Shadyside=' + Shadyside.length); Martins_Ferry[Martins_Ferry.length] = createMarker(new GPoint(-80.72641754,40.09846497),"
Martins Ferry High School
810 Hanover St
Martins Ferry, OH 43935

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Martins Ferry High School",'Martins_Ferry=' + Martins_Ferry.length); Martins_Ferry[Martins_Ferry.length] = createMarker(new GPoint(-80.71870422,40.10117340),"
North Elementary School
500 N 5th St
Martins Ferry, OH 43935

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("North Elementary School",'Martins_Ferry=' + Martins_Ferry.length); Powhatan_Point[Powhatan_Point.length] = createMarker(new GPoint(-80.80633545,39.85898590),"
Powhatan Elementary School
125 2nd St
Powhatan Point, OH 43942

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Powhatan Elementary School",'Powhatan_Point=' + Powhatan_Point.length); Shadyside[Shadyside.length] = createMarker(new GPoint(-80.74685669,39.97129059),"
Shadyside High School
3890 Lincoln Ave
Shadyside, OH 43947

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Shadyside High School",'Shadyside=' + Shadyside.length); Martins_Ferry[Martins_Ferry.length] = createMarker(new GPoint(-80.73140717,40.08847046),"
South Elementary School
Broadway And School Sts
Martins Ferry, OH 43935

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("South Elementary School",'Martins_Ferry=' + Martins_Ferry.length); Saint_Clairsville[Saint_Clairsville.length] = createMarker(new GPoint(-80.89050293,40.08175659),"
St Clairsville Elementary School
120 Norris St
Saint Clairsville, OH 43950

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("St Clairsville Elementary School",'Saint_Clairsville=' + Saint_Clairsville.length); Saint_Clairsville[Saint_Clairsville.length] = createMarker(new GPoint(-80.90275574,40.07863235),"
St Clairsville High School
102 Woodrow Ave
Saint Clairsville, OH 43950

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St Clairsville High School",'Saint_Clairsville=' + Saint_Clairsville.length); Saint_Clairsville[Saint_Clairsville.length] = createMarker(new GPoint(-80.90277100,40.07863235),"
St Clairsville Middle School
104 Woodrow Ave
Saint Clairsville, OH 43950

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("St Clairsville Middle School",'Saint_Clairsville=' + Saint_Clairsville.length); Belmont[Belmont.length] = createMarker(new GPoint(-81.05528259,40.06402969),"
Union Local Elementary School
66699 Belmont Morristown Rd
Belmont, OH 43718

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Union Local Elementary School",'Belmont=' + Belmont.length); Belmont[Belmont.length] = createMarker(new GPoint(-81.05625916,40.06509399),"
Union Local High School
66779 Belmont Morristown Rd
Belmont, OH 43718

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Union Local High School",'Belmont=' + Belmont.length); Belmont[Belmont.length] = createMarker(new GPoint(-81.05720520,40.06568909),"
Union Local Middle School
66859 Belmont Morristown Rd
Belmont, OH 43718

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Union Local Middle School",'Belmont=' + Belmont.length); Bridgeport[Bridgeport.length] = createMarker(new GPoint(-80.75154114,40.07189941),"
Westbrooke Intermediate Elementary School
5 Water St
Bridgeport, OH 43912

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Westbrooke Intermediate Elementary School",'Bridgeport=' + Bridgeport.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(Barnesville); map.removeOverlays(Bellaire); map.removeOverlays(Belmont); map.removeOverlays(Bridgeport); map.removeOverlays(Dillonvale); map.removeOverlays(Lansing); map.removeOverlays(Martins_Ferry); map.removeOverlays(Powhatan_Point); map.removeOverlays(Saint_Clairsville); map.removeOverlays(Shadyside); 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(Barnesville);map.removeOverlays(Barnesville); map.removeOverlays(Bellaire); map.removeOverlays(Belmont); map.removeOverlays(Bridgeport); map.removeOverlays(Dillonvale); map.removeOverlays(Lansing); map.removeOverlays(Martins_Ferry); map.removeOverlays(Powhatan_Point); map.removeOverlays(Saint_Clairsville); map.removeOverlays(Shadyside); map.addOverlays(Barnesville); centerByArray(Barnesville, false, false); cntMarker += Barnesville.length; map.addOverlays(Bellaire); centerByArray(Bellaire, false, false); cntMarker += Bellaire.length; map.addOverlays(Belmont); centerByArray(Belmont, false, false); cntMarker += Belmont.length; map.addOverlays(Bridgeport); centerByArray(Bridgeport, false, false); cntMarker += Bridgeport.length; map.addOverlays(Dillonvale); centerByArray(Dillonvale, false, false); cntMarker += Dillonvale.length; map.addOverlays(Lansing); centerByArray(Lansing, false, false); cntMarker += Lansing.length; map.addOverlays(Martins_Ferry); centerByArray(Martins_Ferry, false, false); cntMarker += Martins_Ferry.length; map.addOverlays(Powhatan_Point); centerByArray(Powhatan_Point, false, false); cntMarker += Powhatan_Point.length; map.addOverlays(Saint_Clairsville); centerByArray(Saint_Clairsville, false, false); cntMarker += Saint_Clairsville.length; map.addOverlays(Shadyside); centerByArray(Shadyside, false, false); cntMarker += Shadyside.length; centerByArray(Barnesville,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'); } }