function addMarkers() { mySelect = document.getElementById('selection'); New_Castle = [];Volant = [];Ellwood_City = [];Bessemer = [];New_Wilmington = [];Pulaski = [];mySelect.options[mySelect.options.length] = new Option("Bessemer schools",'all=Bessemer'); mySelect.options[mySelect.options.length] = new Option("Ellwood City schools",'all=Ellwood_City'); mySelect.options[mySelect.options.length] = new Option("New Castle schools",'all=New_Castle'); mySelect.options[mySelect.options.length] = new Option("New Wilmington schools",'all=New_Wilmington'); mySelect.options[mySelect.options.length] = new Option("Pulaski schools",'all=Pulaski'); mySelect.options[mySelect.options.length] = new Option("Volant schools",'all=Volant'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); New_Castle[New_Castle.length] = createMarker(new GPoint(-80.33708191,40.99105453),"
Ben Franklin Junior High School
815 Cunningham Ave
New Castle, PA 16101

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Ben Franklin Junior High School",'New_Castle=' + New_Castle.length); New_Castle[New_Castle.length] = createMarker(new GPoint(-80.32315063,41.00617599),"
Croton Kdg Elementary School
420 Fern St
New Castle, PA 16101

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Croton Kdg Elementary School",'New_Castle=' + New_Castle.length); Volant[Volant.length] = createMarker(new GPoint(-80.14746094,41.07164001),"
East Lawrence Elementary School
1352 Golf Course Rd
Volant, PA 16156

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("East Lawrence Elementary School",'Volant=' + Volant.length); New_Castle[New_Castle.length] = createMarker(new GPoint(-80.32991791,41.00083542),"
Harry W Lockley School
900 E Main St
New Castle, PA 16101

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Harry W Lockley School",'New_Castle=' + New_Castle.length); Ellwood_City[Ellwood_City.length] = createMarker(new GPoint(-80.28922272,40.85739899),"
Hartman School
Crescent Avenue 4th Street
Ellwood City, PA 16117

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Hartman School",'Ellwood_City=' + Ellwood_City.length); New_Castle[New_Castle.length] = createMarker(new GPoint(-80.33914185,41.00986862),"
John F Kennedy School
326 Laurel Blvd
New Castle, PA 16101

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("John F Kennedy School",'New_Castle=' + New_Castle.length); New_Castle[New_Castle.length] = createMarker(new GPoint(-80.34719849,41.00360107),"
Laurel Elementary School
223 Mccaslin Rd
New Castle, PA 16101

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Laurel Elementary School",'New_Castle=' + New_Castle.length); New_Castle[New_Castle.length] = createMarker(new GPoint(-80.34719849,41.00360107),"
Laurel Junior Senior High School
2497 Harlansburg Rd
New Castle, PA 16101

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Laurel Junior Senior High School",'New_Castle=' + New_Castle.length); New_Castle[New_Castle.length] = createMarker(new GPoint(-80.32951355,40.97723770),"
Lawrence County Avts High School
750 Phelps Way
New Castle, PA 16101

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Lawrence County Avts High School",'New_Castle=' + New_Castle.length); Ellwood_City[Ellwood_City.length] = createMarker(new GPoint(-80.28739166,40.85726166),"
Lincoln Junior Senior High School
501 Crescent Ave
Ellwood City, PA 16117

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Lincoln Junior Senior High School",'Ellwood_City=' + Ellwood_City.length); Bessemer[Bessemer.length] = createMarker(new GPoint(-80.49500275,40.96640015),"
Mohawk Elementary School
Po Box 799
Bessemer, PA 16112

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Mohawk Elementary School",'Bessemer=' + Bessemer.length); Bessemer[Bessemer.length] = createMarker(new GPoint(-80.49374400,40.97490000),"
Mohawk Junior Senior High School
Po Box 25
Bessemer, PA 16112

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Mohawk Junior Senior High School",'Bessemer=' + Bessemer.length); New_Castle[New_Castle.length] = createMarker(new GPoint(-80.34816742,41.06540680),"
Neshannock Junior Senior High School
3834 Mitchell Rd
New Castle, PA 16105

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Neshannock Junior Senior High School",'New_Castle=' + New_Castle.length); New_Castle[New_Castle.length] = createMarker(new GPoint(-80.34857941,41.06544113),"
Neshannock Memorial Elementary School
3832 Mitchell Rd
New Castle, PA 16105

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Neshannock Memorial Elementary School",'New_Castle=' + New_Castle.length); New_Castle[New_Castle.length] = createMarker(new GPoint(-80.33992004,41.00563812),"
New Castle Senior High School
300 E Lincoln Ave
New Castle, PA 16101

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("New Castle Senior High School",'New_Castle=' + New_Castle.length); New_Castle[New_Castle.length] = createMarker(new GPoint(-80.32900238,40.99259949),"
New Castle Youth Dev Center
1745 Frew Mill Road
New Castle, PA 16101

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("New Castle Youth Dev Center",'New_Castle=' + New_Castle.length); New_Wilmington[New_Wilmington.length] = createMarker(new GPoint(-80.33761597,41.12353134),"
New Wilmington Elementary School
450 Wood St
New Wilmington, PA 16142

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("New Wilmington Elementary School",'New_Wilmington=' + New_Wilmington.length); Ellwood_City[Ellwood_City.length] = createMarker(new GPoint(-80.28742218,40.86920166),"
North Side School
Orchard North Streets
Ellwood City, PA 16117

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("North Side School",'Ellwood_City=' + Ellwood_City.length); Ellwood_City[Ellwood_City.length] = createMarker(new GPoint(-80.25758362,40.85810089),"
Perry Township School
Portersville Road
Ellwood City, PA 16117

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Perry Township School",'Ellwood_City=' + Ellwood_City.length); Pulaski[Pulaski.length] = createMarker(new GPoint(-80.43250275,41.09815979),"
Pulaski Elementary School
320 Shenango St
Pulaski, PA 16143

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Pulaski Elementary School",'Pulaski=' + Pulaski.length); New_Castle[New_Castle.length] = createMarker(new GPoint(-80.31671143,40.96894836),"
Shenango Elementary School
2501 Old Pittsburgh Rd
New Castle, PA 16101

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Shenango Elementary School",'New_Castle=' + New_Castle.length); New_Castle[New_Castle.length] = createMarker(new GPoint(-80.31168365,40.96884155),"
Shenango High School
2550 Ellwood Rd
New Castle, PA 16101

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Shenango High School",'New_Castle=' + New_Castle.length); New_Castle[New_Castle.length] = createMarker(new GPoint(-80.33071899,40.98875427),"
Thaddeus Stevens School
831 Harrison St
New Castle, PA 16101

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Thaddeus Stevens School",'New_Castle=' + New_Castle.length); New_Castle[New_Castle.length] = createMarker(new GPoint(-80.38228607,40.99923706),"
Union Area High School
2106 Camden Ave
New Castle, PA 16101

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Union Area High School",'New_Castle=' + New_Castle.length); New_Castle[New_Castle.length] = createMarker(new GPoint(-80.38228607,40.99923706),"
Union Area Middle School
2106 Camden Ave
New Castle, PA 16101

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Union Area Middle School",'New_Castle=' + New_Castle.length); New_Castle[New_Castle.length] = createMarker(new GPoint(-80.37688446,40.99886322),"
Union Memorial Elementary School
500 S Scotland Ln
New Castle, PA 16101

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Union Memorial Elementary School",'New_Castle=' + New_Castle.length); Ellwood_City[Ellwood_City.length] = createMarker(new GPoint(-80.27210236,40.87424088),"
Walnut Ridge School
Aetna Drive Sunset
Ellwood City, PA 16117

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Walnut Ridge School",'Ellwood_City=' + Ellwood_City.length); New_Castle[New_Castle.length] = createMarker(new GPoint(-80.34615326,41.01623535),"
Washington Intrmd School
101 East Euclid Avenue
New Castle, PA 16105

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Washington Intrmd School",'New_Castle=' + New_Castle.length); New_Castle[New_Castle.length] = createMarker(new GPoint(-80.35793304,40.99983597),"
West Side School
708 W Washington St
New Castle, PA 16101

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("West Side School",'New_Castle=' + New_Castle.length); New_Wilmington[New_Wilmington.length] = createMarker(new GPoint(-80.33530426,41.12356186),"
Wilmington Area High School
350 Wood St
New Wilmington, PA 16142

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Wilmington Area High School",'New_Wilmington=' + New_Wilmington.length); New_Wilmington[New_Wilmington.length] = createMarker(new GPoint(-80.33647919,41.12356186),"
Wilmington Area Middle School
400 Wood St
New Wilmington, PA 16142

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Wilmington Area Middle School",'New_Wilmington=' + New_Wilmington.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(Bessemer); map.removeOverlays(Ellwood_City); map.removeOverlays(New_Castle); map.removeOverlays(New_Wilmington); map.removeOverlays(Pulaski); map.removeOverlays(Volant); 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(New_Castle);map.removeOverlays(Bessemer); map.removeOverlays(Ellwood_City); map.removeOverlays(New_Castle); map.removeOverlays(New_Wilmington); map.removeOverlays(Pulaski); map.removeOverlays(Volant); map.addOverlays(Bessemer); centerByArray(Bessemer, false, false); cntMarker += Bessemer.length; map.addOverlays(Ellwood_City); centerByArray(Ellwood_City, false, false); cntMarker += Ellwood_City.length; map.addOverlays(New_Castle); centerByArray(New_Castle, false, false); cntMarker += New_Castle.length; map.addOverlays(New_Wilmington); centerByArray(New_Wilmington, false, false); cntMarker += New_Wilmington.length; map.addOverlays(Pulaski); centerByArray(Pulaski, false, false); cntMarker += Pulaski.length; map.addOverlays(Volant); centerByArray(Volant, false, false); cntMarker += Volant.length; centerByArray(New_Castle,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'); } }