function addMarkers() { mySelect = document.getElementById('selection'); Jersey_Shore = [];Williamsport = [];Montoursville = [];Lairdsville = [];South_Williamsport = [];Chester = [];Picture_Rocks = [];Cogan_Station = [];Hughesville = [];Montgomery = [];Muncy = [];Linden = [];mySelect.options[mySelect.options.length] = new Option("Chester schools",'all=Chester'); mySelect.options[mySelect.options.length] = new Option("Cogan Station schools",'all=Cogan_Station'); mySelect.options[mySelect.options.length] = new Option("Hughesville schools",'all=Hughesville'); mySelect.options[mySelect.options.length] = new Option("Jersey Shore schools",'all=Jersey_Shore'); mySelect.options[mySelect.options.length] = new Option("Lairdsville schools",'all=Lairdsville'); mySelect.options[mySelect.options.length] = new Option("Linden schools",'all=Linden'); mySelect.options[mySelect.options.length] = new Option("Montgomery schools",'all=Montgomery'); mySelect.options[mySelect.options.length] = new Option("Montoursville schools",'all=Montoursville'); mySelect.options[mySelect.options.length] = new Option("Muncy schools",'all=Muncy'); mySelect.options[mySelect.options.length] = new Option("Picture Rocks schools",'all=Picture_Rocks'); mySelect.options[mySelect.options.length] = new Option("South Williamsport schools",'all=South_Williamsport'); mySelect.options[mySelect.options.length] = new Option("Williamsport schools",'all=Williamsport'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Jersey_Shore[Jersey_Shore.length] = createMarker(new GPoint(-77.19740295,41.08509827),"
Avis Elementary School
1088 Third St
Jersey Shore, PA 17740

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Avis Elementary School",'Jersey_Shore=' + Jersey_Shore.length); Williamsport[Williamsport.length] = createMarker(new GPoint(-76.96721649,41.25542068),"
Becht Elementary School
Clayton Sheridan
Williamsport, PA 17701

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Becht Elementary School",'Williamsport=' + Williamsport.length); Montoursville[Montoursville.length] = createMarker(new GPoint(-76.90640259,41.25502396),"
C E Mccall Middle School
600 Willow St
Montoursville, PA 17754

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("C E Mccall Middle School",'Montoursville=' + Montoursville.length); Lairdsville[Lairdsville.length] = createMarker(new GPoint(-76.61192322,41.23086166),"
Carl G Renn Elementary School
183 School Lane
Lairdsville, PA 17742

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Carl G Renn Elementary School",'Lairdsville=' + Lairdsville.length); South_Williamsport[South_Williamsport.length] = createMarker(new GPoint(-76.99916840,41.22746658),"
Central Elementary School
555 W Mountain Ave
South Williamsport, PA 17702

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Central Elementary School",'South_Williamsport=' + South_Williamsport.length); Chester[Chester.length] = createMarker(new GPoint(-81.17787170,34.71132660),"
Chester Park Complex Elementary School
835 Lancaster Hwy
Chester, PA 29706

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Chester Park Complex Elementary School",'Chester=' + Chester.length); Williamsport[Williamsport.length] = createMarker(new GPoint(-77.01213074,41.25424957),"
Cochran Elementary School
1500 Cherry St
Williamsport, PA 17701

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Cochran Elementary School",'Williamsport=' + Williamsport.length); Williamsport[Williamsport.length] = createMarker(new GPoint(-77.00373077,41.25177002),"
Curtin Middle School
85 Eldred St
Williamsport, PA 17701

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Curtin Middle School",'Williamsport=' + Williamsport.length); Williamsport[Williamsport.length] = createMarker(new GPoint(-77.03385925,41.22571945),"
Duboistown Elementary School
126 Summer St
Williamsport, PA 17702

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Duboistown Elementary School",'Williamsport=' + Williamsport.length); Montoursville[Montoursville.length] = createMarker(new GPoint(-76.94671631,41.26253510),"
Four Mile School
2800 Four Mile Dr
Montoursville, PA 17754

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Four Mile School",'Montoursville=' + Montoursville.length); Picture_Rocks[Picture_Rocks.length] = createMarker(new GPoint(-76.71691895,41.28107834),"
George A Ferrell Elementary School
34 Court Street
Picture Rocks, PA 17762

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("George A Ferrell Elementary School",'Picture_Rocks=' + Picture_Rocks.length); Cogan_Station[Cogan_Station.length] = createMarker(new GPoint(-77.06845093,41.32027817),"
Hepburn-lycoming Elementary School
355 Route 973 East
Cogan Station, PA 17728

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Hepburn-lycoming Elementary School",'Cogan_Station=' + Cogan_Station.length); Hughesville[Hughesville.length] = createMarker(new GPoint(-76.73300934,41.24124146),"
Hughesville Junior Senior High School
349 Cemetery St
Hughesville, PA 17737

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Hughesville Junior Senior High School",'Hughesville=' + Hughesville.length); Williamsport[Williamsport.length] = createMarker(new GPoint(-77.06194305,41.23857880),"
Jackson Elementary School
2500 Newberry St
Williamsport, PA 17701

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Jackson Elementary School",'Williamsport=' + Williamsport.length); Jersey_Shore[Jersey_Shore.length] = createMarker(new GPoint(-77.26390076,41.19968033),"
Jersey Shore Area Elementary School
601 Locust St
Jersey Shore, PA 17740

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Jersey Shore Area Elementary School",'Jersey_Shore=' + Jersey_Shore.length); Jersey_Shore[Jersey_Shore.length] = createMarker(new GPoint(-77.26184845,41.19696426),"
Jersey Shore Area Senior High School
701 Cemetery St
Jersey Shore, PA 17740

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Jersey Shore Area Senior High School",'Jersey_Shore=' + Jersey_Shore.length); Jersey_Shore[Jersey_Shore.length] = createMarker(new GPoint(-77.26261902,41.20089340),"
Jersey Shore Middle School
601 Thompson St
Jersey Shore, PA 17740

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Jersey Shore Middle School",'Jersey_Shore=' + Jersey_Shore.length); Hughesville[Hughesville.length] = createMarker(new GPoint(-76.72968292,41.23979950),"
Joseph C Ashkar Elementary School
350 South Broad Street
Hughesville, PA 17737

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Joseph C Ashkar Elementary School",'Hughesville=' + Hughesville.length); Williamsport[Williamsport.length] = createMarker(new GPoint(-77.02718353,41.24116135),"
Lose Elementary School
1121 Memorial Ave
Williamsport, PA 17701

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Lose Elementary School",'Williamsport=' + Williamsport.length); Williamsport[Williamsport.length] = createMarker(new GPoint(-76.96450043,41.26023865),"
Loyalsock Township Middle School
2101 Loyalsock Dr
Williamsport, PA 17701

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Loyalsock Township Middle School",'Williamsport=' + Williamsport.length); Williamsport[Williamsport.length] = createMarker(new GPoint(-76.96766663,41.25979614),"
Loyalsock Township Senior High School
1801 Loyalsock Dr
Williamsport, PA 17701

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Loyalsock Township Senior High School",'Williamsport=' + Williamsport.length); Montoursville[Montoursville.length] = createMarker(new GPoint(-76.92247772,41.25457001),"
Loyalsock Valley Elementary School
3790 Route 87 Highway
Montoursville, PA 17754

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Loyalsock Valley Elementary School",'Montoursville=' + Montoursville.length); Williamsport[Williamsport.length] = createMarker(new GPoint(-77.11045837,41.21835327),"
Lycoming Ctc
184 East Village Dr
Williamsport, PA 17702

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Lycoming Ctc",'Williamsport=' + Williamsport.length); Williamsport[Williamsport.length] = createMarker(new GPoint(-77.05394745,41.29022980),"
Lycoming Valley Middle School
1825 Hayes Ave
Williamsport, PA 17701

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Lycoming Valley Middle School",'Williamsport=' + Williamsport.length); Montoursville[Montoursville.length] = createMarker(new GPoint(-76.91445160,41.25323868),"
Lyter Elementary School
900 Spruce St
Montoursville, PA 17754

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Lyter Elementary School",'Montoursville=' + Montoursville.length); Montgomery[Montgomery.length] = createMarker(new GPoint(-76.87425995,41.17337036),"
Montgomery Elementary School
120 Penn St
Montgomery, PA 17752

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Montgomery Elementary School",'Montgomery=' + Montgomery.length); Montgomery[Montgomery.length] = createMarker(new GPoint(-76.87425995,41.17337036),"
Montgomery Senior High School
120 Penn Street
Montgomery, PA 17752

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Montgomery Senior High School",'Montgomery=' + Montgomery.length); Montoursville[Montoursville.length] = createMarker(new GPoint(-76.91980743,41.25011444),"
Montoursville Area Senior High School
100 N Arch St
Montoursville, PA 17754

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Montoursville Area Senior High School",'Montoursville=' + Montoursville.length); Muncy[Muncy.length] = createMarker(new GPoint(-76.78947449,41.20205307),"
Muncy Junior Senior High School
200 W Penn St
Muncy, PA 17756

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Muncy Junior Senior High School",'Muncy=' + Muncy.length); Williamsport[Williamsport.length] = createMarker(new GPoint(-77.16102600,41.14999390),"
Nippenose Valley Elementary School
7190 South Route 44 Highway
Williamsport, PA 17702

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Nippenose Valley Elementary School",'Williamsport=' + Williamsport.length); Williamsport[Williamsport.length] = createMarker(new GPoint(-77.03749847,41.21559906),"
Nisbet Elementary School
184 East Village Dr
Williamsport, PA 17702

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Nisbet Elementary School",'Williamsport=' + Williamsport.length); South_Williamsport[South_Williamsport.length] = createMarker(new GPoint(-76.99909973,41.22947311),"
Rommelt Elementary School
515 West Central Avenue
South Williamsport, PA 17702

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Rommelt Elementary School",'South_Williamsport=' + South_Williamsport.length); Williamsport[Williamsport.length] = createMarker(new GPoint(-77.06720734,41.23771667),"
Roosevelt Middle School
2800 W 4th St
Williamsport, PA 17701

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Roosevelt Middle School",'Williamsport=' + Williamsport.length); Williamsport[Williamsport.length] = createMarker(new GPoint(-77.07097626,41.25220490),"
Round Hills Elementary School
136 Grimesville Rd
Williamsport, PA 17701

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Round Hills Elementary School",'Williamsport=' + Williamsport.length); Jersey_Shore[Jersey_Shore.length] = createMarker(new GPoint(-77.26455688,41.20188904),"
Salladasburg Elementary School
3490 Route 287 Highway
Jersey Shore, PA 17740

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Salladasburg Elementary School",'Jersey_Shore=' + Jersey_Shore.length); Williamsport[Williamsport.length] = createMarker(new GPoint(-76.98737335,41.25333786),"
Sheridan Elementary School
915 Sheridan St
Williamsport, PA 17701

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Sheridan Elementary School",'Williamsport=' + Williamsport.length); South_Williamsport[South_Williamsport.length] = createMarker(new GPoint(-76.99558258,41.22641754),"
South Williamsport Area Junior Senior High School
700 Percy St
South Williamsport, PA 17702

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("South Williamsport Area Junior Senior High School",'South_Williamsport=' + South_Williamsport.length); Williamsport[Williamsport.length] = createMarker(new GPoint(-77.02871704,41.24608612),"
Stevens Elementary School
1150 Louisa St
Williamsport, PA 17701

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Stevens Elementary School",'Williamsport=' + Williamsport.length); Muncy[Muncy.length] = createMarker(new GPoint(-76.78256226,41.19951248),"
Ward L Myers Elementary School
125 New St
Muncy, PA 17756

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Ward L Myers Elementary School",'Muncy=' + Muncy.length); Linden[Linden.length] = createMarker(new GPoint(-77.13961792,41.23049164),"
Williamsport Area Alternative
5933 Route North 220
Linden, PA 17744

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Williamsport Area Alternative",'Linden=' + Linden.length); Williamsport[Williamsport.length] = createMarker(new GPoint(-77.00141400,41.24094500),"
Williamsport Area Senior High School
2990 W 4th St
Williamsport, PA 17701

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Williamsport Area Senior High School",'Williamsport=' + Williamsport.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(Chester); map.removeOverlays(Cogan_Station); map.removeOverlays(Hughesville); map.removeOverlays(Jersey_Shore); map.removeOverlays(Lairdsville); map.removeOverlays(Linden); map.removeOverlays(Montgomery); map.removeOverlays(Montoursville); map.removeOverlays(Muncy); map.removeOverlays(Picture_Rocks); map.removeOverlays(South_Williamsport); map.removeOverlays(Williamsport); 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(Jersey_Shore);map.removeOverlays(Chester); map.removeOverlays(Cogan_Station); map.removeOverlays(Hughesville); map.removeOverlays(Jersey_Shore); map.removeOverlays(Lairdsville); map.removeOverlays(Linden); map.removeOverlays(Montgomery); map.removeOverlays(Montoursville); map.removeOverlays(Muncy); map.removeOverlays(Picture_Rocks); map.removeOverlays(South_Williamsport); map.removeOverlays(Williamsport); map.addOverlays(Chester); centerByArray(Chester, false, false); cntMarker += Chester.length; map.addOverlays(Cogan_Station); centerByArray(Cogan_Station, false, false); cntMarker += Cogan_Station.length; map.addOverlays(Hughesville); centerByArray(Hughesville, false, false); cntMarker += Hughesville.length; map.addOverlays(Jersey_Shore); centerByArray(Jersey_Shore, false, false); cntMarker += Jersey_Shore.length; map.addOverlays(Lairdsville); centerByArray(Lairdsville, false, false); cntMarker += Lairdsville.length; map.addOverlays(Linden); centerByArray(Linden, false, false); cntMarker += Linden.length; map.addOverlays(Montgomery); centerByArray(Montgomery, false, false); cntMarker += Montgomery.length; map.addOverlays(Montoursville); centerByArray(Montoursville, false, false); cntMarker += Montoursville.length; map.addOverlays(Muncy); centerByArray(Muncy, false, false); cntMarker += Muncy.length; map.addOverlays(Picture_Rocks); centerByArray(Picture_Rocks, false, false); cntMarker += Picture_Rocks.length; map.addOverlays(South_Williamsport); centerByArray(South_Williamsport, false, false); cntMarker += South_Williamsport.length; map.addOverlays(Williamsport); centerByArray(Williamsport, false, false); cntMarker += Williamsport.length; centerByArray(Jersey_Shore,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'); } }