function addMarkers() { mySelect = document.getElementById('selection'); Mercer = [];Hermitage = [];Sharon = [];Hadley = [];Greenville = [];Farrell = [];Grove_City = [];Jamestown = [];Stoneboro = [];West_Middlesex = [];Sharpsville = [];mySelect.options[mySelect.options.length] = new Option("Farrell schools",'all=Farrell'); mySelect.options[mySelect.options.length] = new Option("Greenville schools",'all=Greenville'); mySelect.options[mySelect.options.length] = new Option("Grove City schools",'all=Grove_City'); mySelect.options[mySelect.options.length] = new Option("Hadley schools",'all=Hadley'); mySelect.options[mySelect.options.length] = new Option("Hermitage schools",'all=Hermitage'); mySelect.options[mySelect.options.length] = new Option("Jamestown schools",'all=Jamestown'); mySelect.options[mySelect.options.length] = new Option("Mercer schools",'all=Mercer'); mySelect.options[mySelect.options.length] = new Option("Sharon schools",'all=Sharon'); mySelect.options[mySelect.options.length] = new Option("Sharpsville schools",'all=Sharpsville'); mySelect.options[mySelect.options.length] = new Option("Stoneboro schools",'all=Stoneboro'); mySelect.options[mySelect.options.length] = new Option("West Middlesex schools",'all=West_Middlesex'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Mercer[Mercer.length] = createMarker(new GPoint(-80.18753815,41.29117966),"
Advanced Charter Enterprise School
Po Box 328
Mercer, PA 16137

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Advanced Charter Enterprise School",'Mercer=' + Mercer.length); Hermitage[Hermitage.length] = createMarker(new GPoint(-80.44995117,41.23686600),"
Artman Elementary School
343 N Hermitage Rd
Hermitage, PA 16148

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Artman Elementary School",'Hermitage=' + Hermitage.length); Sharon[Sharon.length] = createMarker(new GPoint(-80.51757812,41.23337936),"
Brookfield Elementary School
115 Anson Way
Sharon, PA 16146

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Brookfield Elementary School",'Sharon=' + Sharon.length); Sharon[Sharon.length] = createMarker(new GPoint(-80.49061584,41.23371124),"
Case Avenue Elementary School
36 Case Ave
Sharon, PA 16146

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Case Avenue Elementary School",'Sharon=' + Sharon.length); Hadley[Hadley.length] = createMarker(new GPoint(-80.20934296,41.42690277),"
Commodore Perry Junior Senior High School
3002 Perry Hwy
Hadley, PA 16130

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Commodore Perry Junior Senior High School",'Hadley=' + Hadley.length); Hadley[Hadley.length] = createMarker(new GPoint(-80.20934296,41.42690277),"
Commodore Perry School
3002 Perry Hwy
Hadley, PA 16130

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Commodore Perry School",'Hadley=' + Hadley.length); Hermitage[Hermitage.length] = createMarker(new GPoint(-80.44998169,41.23792267),"
Delahunty Middle School
419 N Hermitage Rd
Hermitage, PA 16148

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Delahunty Middle School",'Hermitage=' + Hermitage.length); Greenville[Greenville.length] = createMarker(new GPoint(-80.37786102,41.40453339),"
East Elementary School
71 Columbia Ave
Greenville, PA 16125

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("East Elementary School",'Greenville=' + Greenville.length); Farrell[Farrell.length] = createMarker(new GPoint(-80.48592377,41.21224213),"
Farrell Area Es/lms Elementary School
1600 Roemer Blvd
Farrell, PA 16121

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Farrell Area Es/lms Elementary School",'Farrell=' + Farrell.length); Farrell[Farrell.length] = createMarker(new GPoint(-80.48399353,41.21228790),"
Farrell Area High School/ums
1700 Roemer Blvd
Farrell, PA 16121

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Farrell Area High School/ums",'Farrell=' + Farrell.length); Grove_City[Grove_City.length] = createMarker(new GPoint(-80.08801900,41.15748000),"
George Jr Republic MiddleSchool
200 George Junior Rd
Grove City, PA 16127

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("George Jr Republic MiddleSchool",'Grove_City=' + Grove_City.length); Grove_City[Grove_City.length] = createMarker(new GPoint(-80.11068726,41.16742706),"
George Junior Republic High School
200 George Junior Rd
Grove City, PA 16127

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("George Junior Republic High School",'Grove_City=' + Grove_City.length); Grove_City[Grove_City.length] = createMarker(new GPoint(-80.11068726,41.16742706),"
George Junior Republic Middle School
200 George Junior Rd
Grove City, PA 16127

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("George Junior Republic Middle School",'Grove_City=' + Grove_City.length); Greenville[Greenville.length] = createMarker(new GPoint(-80.37224579,41.40416336),"
Greenville Junior Senior High School
9 Donation Road
Greenville, PA 16125

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Greenville Junior Senior High School",'Greenville=' + Greenville.length); Grove_City[Grove_City.length] = createMarker(new GPoint(-80.09761810,41.16202927),"
Grove City Area High School
511 Highland Ave
Grove City, PA 16127

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Grove City Area High School",'Grove_City=' + Grove_City.length); Grove_City[Grove_City.length] = createMarker(new GPoint(-80.08615112,41.15610123),"
Grove City Area Middle School
130 E Main St
Grove City, PA 16127

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Grove City Area Middle School",'Grove_City=' + Grove_City.length); Greenville[Greenville.length] = createMarker(new GPoint(-80.36502838,41.39315414),"
Hempfield Elementary School
60 Fredonia Rd
Greenville, PA 16125

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Hempfield Elementary School",'Greenville=' + Greenville.length); Hermitage[Hermitage.length] = createMarker(new GPoint(-80.44988251,41.23566437),"
Hermitage Elementary School
233 N Hermitage Rd
Hermitage, PA 16148

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Hermitage Elementary School",'Hermitage=' + Hermitage.length); Hermitage[Hermitage.length] = createMarker(new GPoint(-80.44988251,41.23475647),"
Hermitage Middle School
123 N Hermitage Rd
Hermitage, PA 16148

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Hermitage Middle School",'Hermitage=' + Hermitage.length); Hermitage[Hermitage.length] = createMarker(new GPoint(-80.44971466,41.24166489),"
Hickory High School
640 N Hermitage Rd
Hermitage, PA 16148

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Hickory High School",'Hermitage=' + Hermitage.length); Grove_City[Grove_City.length] = createMarker(new GPoint(-80.09842682,41.16131592),"
Highland Elementary School
611 Highland Ave
Grove City, PA 16127

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Highland Elementary School",'Grove_City=' + Grove_City.length); Grove_City[Grove_City.length] = createMarker(new GPoint(-80.07589722,41.15134811),"
Hillview Elementary School
482 E Main Street Ext
Grove City, PA 16127

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Hillview Elementary School",'Grove_City=' + Grove_City.length); Jamestown[Jamestown.length] = createMarker(new GPoint(-80.47070312,41.52259827),"
Jamestown Area Junior Senior High School
Po Box 217
Jamestown, PA 16134

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Jamestown Area Junior Senior High School",'Jamestown=' + Jamestown.length); Greenville[Greenville.length] = createMarker(new GPoint(-80.44744873,41.39899445),"
Keystone Education Center Charter School
425 South Good Hope Road
Greenville, PA 16125

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Keystone Education Center Charter School",'Greenville=' + Greenville.length); Stoneboro[Stoneboro.length] = createMarker(new GPoint(-80.09007263,41.34052277),"
Lakeview High School
2482 Mercer St
Stoneboro, PA 16153

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Lakeview High School",'Stoneboro=' + Stoneboro.length); Stoneboro[Stoneboro.length] = createMarker(new GPoint(-80.09007263,41.34052277),"
Lakeview Middle School
2482 Mercer St
Stoneboro, PA 16153

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Lakeview Middle School",'Stoneboro=' + Stoneboro.length); West_Middlesex[West_Middlesex.length] = createMarker(new GPoint(-80.45166016,41.17223358),"
Luther W Low Elementary School
3591 Sharon Rd
West Middlesex, PA 16159

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Luther W Low Elementary School",'West_Middlesex=' + West_Middlesex.length); Mercer[Mercer.length] = createMarker(new GPoint(-80.24440002,41.22986221),"
Mercer Area Elementary School
301 Lamor Rd
Mercer, PA 16137

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Mercer Area Elementary School",'Mercer=' + Mercer.length); Mercer[Mercer.length] = createMarker(new GPoint(-80.24644470,41.22516632),"
Mercer Area Junior Senior High School
545 W Butler St
Mercer, PA 16137

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Mercer Area Junior Senior High School",'Mercer=' + Mercer.length); Mercer[Mercer.length] = createMarker(new GPoint(-80.24631400,41.22529900),"
Mercer Area MiddleSchool
545 W Butler Street
Mercer, PA 16137

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Mercer Area MiddleSchool",'Mercer=' + Mercer.length); Mercer[Mercer.length] = createMarker(new GPoint(-80.25046539,41.25089645),"
Mercer County Career Center
776 Greenville Rd Po Box 152
Mercer, PA 16137

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Mercer County Career Center",'Mercer=' + Mercer.length); Grove_City[Grove_City.length] = createMarker(new GPoint(-80.07951355,41.15103912),"
Midwestern Regional Virtual Charter School
453 Maple St
Grove City, PA 16127

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Midwestern Regional Virtual Charter School",'Grove_City=' + Grove_City.length); Sharon[Sharon.length] = createMarker(new GPoint(-80.49728394,41.22486115),"
Musser Elementary School
500 Cedar Ave
Sharon, PA 16146

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Musser Elementary School",'Sharon=' + Sharon.length); Stoneboro[Stoneboro.length] = createMarker(new GPoint(-80.08425140,41.33943558),"
Oakview Elementary School
1387 School Rd
Stoneboro, PA 16153

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Oakview Elementary School",'Stoneboro=' + Stoneboro.length); West_Middlesex[West_Middlesex.length] = createMarker(new GPoint(-80.45166016,41.17223358),"
Oakview Elementary School
3591 Sharon Rd
West Middlesex, PA 16159

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Oakview Elementary School",'West_Middlesex=' + West_Middlesex.length); Greenville[Greenville.length] = createMarker(new GPoint(-80.39651489,41.33813858),"
Reynolds Elementary School
1609 Brentwood Dr
Greenville, PA 16125

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Reynolds Elementary School",'Greenville=' + Greenville.length); Greenville[Greenville.length] = createMarker(new GPoint(-80.39788818,41.34800720),"
Reynolds Junior Senior High School
531 Reynolds Rd
Greenville, PA 16125

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Reynolds Junior Senior High School",'Greenville=' + Greenville.length); Sharon[Sharon.length] = createMarker(new GPoint(-80.48831940,41.23323822),"
Sharon Middle School High School
1129 E State St
Sharon, PA 16146

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Sharon Middle School High School",'Sharon=' + Sharon.length); Sharpsville[Sharpsville.length] = createMarker(new GPoint(-80.47861481,41.25686264),"
Sharpsville Area Elementary School
100 Hittle Drive
Sharpsville, PA 16150

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Sharpsville Area Elementary School",'Sharpsville=' + Sharpsville.length); Sharpsville[Sharpsville.length] = createMarker(new GPoint(-80.47653198,41.25526428),"
Sharpsville Area Middle School
303 Blue Devil Way
Sharpsville, PA 16150

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Sharpsville Area Middle School",'Sharpsville=' + Sharpsville.length); Sharpsville[Sharpsville.length] = createMarker(new GPoint(-80.47647858,41.25526428),"
Sharpsville Area Senior High School
301 Blue Devil Way
Sharpsville, PA 16150

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Sharpsville Area Senior High School",'Sharpsville=' + Sharpsville.length); Grove_City[Grove_City.length] = createMarker(new GPoint(-80.07626343,41.16245651),"
Washington Kdg Center
301 N Madison Ave
Grove City, PA 16127

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Washington Kdg Center",'Grove_City=' + Grove_City.length); Sharon[Sharon.length] = createMarker(new GPoint(-80.51478577,41.23586273),"
West Hill Elementary School
301 Ellsworth St
Sharon, PA 16146

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("West Hill Elementary School",'Sharon=' + Sharon.length); West_Middlesex[West_Middlesex.length] = createMarker(new GPoint(-80.45166016,41.17223358),"
West Middlesex Junior Senior High School
3591 Sharon Rd
West Middlesex, PA 16159

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("West Middlesex Junior Senior High School",'West_Middlesex=' + West_Middlesex.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(Farrell); map.removeOverlays(Greenville); map.removeOverlays(Grove_City); map.removeOverlays(Hadley); map.removeOverlays(Hermitage); map.removeOverlays(Jamestown); map.removeOverlays(Mercer); map.removeOverlays(Sharon); map.removeOverlays(Sharpsville); map.removeOverlays(Stoneboro); map.removeOverlays(West_Middlesex); 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(Mercer);map.removeOverlays(Farrell); map.removeOverlays(Greenville); map.removeOverlays(Grove_City); map.removeOverlays(Hadley); map.removeOverlays(Hermitage); map.removeOverlays(Jamestown); map.removeOverlays(Mercer); map.removeOverlays(Sharon); map.removeOverlays(Sharpsville); map.removeOverlays(Stoneboro); map.removeOverlays(West_Middlesex); map.addOverlays(Farrell); centerByArray(Farrell, false, false); cntMarker += Farrell.length; map.addOverlays(Greenville); centerByArray(Greenville, false, false); cntMarker += Greenville.length; map.addOverlays(Grove_City); centerByArray(Grove_City, false, false); cntMarker += Grove_City.length; map.addOverlays(Hadley); centerByArray(Hadley, false, false); cntMarker += Hadley.length; map.addOverlays(Hermitage); centerByArray(Hermitage, false, false); cntMarker += Hermitage.length; map.addOverlays(Jamestown); centerByArray(Jamestown, false, false); cntMarker += Jamestown.length; map.addOverlays(Mercer); centerByArray(Mercer, false, false); cntMarker += Mercer.length; map.addOverlays(Sharon); centerByArray(Sharon, false, false); cntMarker += Sharon.length; map.addOverlays(Sharpsville); centerByArray(Sharpsville, false, false); cntMarker += Sharpsville.length; map.addOverlays(Stoneboro); centerByArray(Stoneboro, false, false); cntMarker += Stoneboro.length; map.addOverlays(West_Middlesex); centerByArray(West_Middlesex, false, false); cntMarker += West_Middlesex.length; centerByArray(Mercer,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'); } }