function addMarkers() { mySelect = document.getElementById('selection'); Littlestown = [];Arendtsville = [];Bendersville = [];York_Springs = [];Biglerville = [];Hanover = [];New_Oxford = [];Gettysburg = [];Fairfield = [];Cashtown = [];mySelect.options[mySelect.options.length] = new Option("Arendtsville schools",'all=Arendtsville'); mySelect.options[mySelect.options.length] = new Option("Bendersville schools",'all=Bendersville'); mySelect.options[mySelect.options.length] = new Option("Biglerville schools",'all=Biglerville'); mySelect.options[mySelect.options.length] = new Option("Cashtown schools",'all=Cashtown'); mySelect.options[mySelect.options.length] = new Option("Fairfield schools",'all=Fairfield'); mySelect.options[mySelect.options.length] = new Option("Gettysburg schools",'all=Gettysburg'); mySelect.options[mySelect.options.length] = new Option("Hanover schools",'all=Hanover'); mySelect.options[mySelect.options.length] = new Option("Littlestown schools",'all=Littlestown'); mySelect.options[mySelect.options.length] = new Option("New Oxford schools",'all=New_Oxford'); mySelect.options[mySelect.options.length] = new Option("York Springs schools",'all=York_Springs'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Littlestown[Littlestown.length] = createMarker(new GPoint(-77.08381653,39.74684143),"
Alloway Creek Intrmd School
162 Newark Street
Littlestown, PA 17340

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Alloway Creek Intrmd School",'Littlestown=' + Littlestown.length); Arendtsville[Arendtsville.length] = createMarker(new GPoint(-77.29879761,39.92300034),"
Arendtsville Elementary School
136 Fohl St
Arendtsville, PA 17303

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Arendtsville Elementary School",'Arendtsville=' + Arendtsville.length); Bendersville[Bendersville.length] = createMarker(new GPoint(-77.23023987,39.98659897),"
Bendersville Elementary School
137 Carlisle Street
Bendersville, PA 17306

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Bendersville Elementary School",'Bendersville=' + Bendersville.length); York_Springs[York_Springs.length] = createMarker(new GPoint(-77.10739899,40.00590134),"
Bermudian Springs Elementary School
Po Box 501
York Springs, PA 17372

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Bermudian Springs Elementary School",'York_Springs=' + York_Springs.length); York_Springs[York_Springs.length] = createMarker(new GPoint(-77.10739899,40.00590134),"
Bermudian Springs High School
Po Box 501
York Springs, PA 17372

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bermudian Springs High School",'York_Springs=' + York_Springs.length); York_Springs[York_Springs.length] = createMarker(new GPoint(-77.10739899,40.00590134),"
Bermudian Springs Middle School
Po Box 501
York Springs, PA 17372

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Bermudian Springs Middle School",'York_Springs=' + York_Springs.length); Biglerville[Biglerville.length] = createMarker(new GPoint(-77.24848175,39.91872025),"
Biglerville Elementary School
3270 Biglerville Road
Biglerville, PA 17307

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Biglerville Elementary School",'Biglerville=' + Biglerville.length); Biglerville[Biglerville.length] = createMarker(new GPoint(-77.24812317,39.93487549),"
Biglerville High School
161 N Main St
Biglerville, PA 17307

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Biglerville High School",'Biglerville=' + Biglerville.length); Hanover[Hanover.length] = createMarker(new GPoint(-77.00876617,39.80780411),"
Conewago Township Elementary School
1189 W Elm Ave
Hanover, PA 17331

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Conewago Township Elementary School",'Hanover=' + Hanover.length); New_Oxford[New_Oxford.length] = createMarker(new GPoint(-77.05672900,39.86363000),"
Conewago Valley Intrmd School
130 Berlin Road
New Oxford, PA 17350

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Conewago Valley Intrmd School",'New_Oxford=' + New_Oxford.length); Gettysburg[Gettysburg.length] = createMarker(new GPoint(-77.22705841,39.83810425),"
Eisenhower Elementary School
120 E Broadway
Gettysburg, PA 17325

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Eisenhower Elementary School",'Gettysburg=' + Gettysburg.length); Fairfield[Fairfield.length] = createMarker(new GPoint(-77.37687683,39.78178024),"
Fairfield Area Elementary School
4842 Fairfield Rd
Fairfield, PA 17320

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Fairfield Area Elementary School",'Fairfield=' + Fairfield.length); Fairfield[Fairfield.length] = createMarker(new GPoint(-77.37683868,39.78180695),"
Fairfield Area High School
4840 Fairfield Rd
Fairfield, PA 17320

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Fairfield Area High School",'Fairfield=' + Fairfield.length); Fairfield[Fairfield.length] = createMarker(new GPoint(-77.37683868,39.78180695),"
Fairfield Area Middle School
4840 Fairfield Rd
Fairfield, PA 17320

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Fairfield Area Middle School",'Fairfield=' + Fairfield.length); Cashtown[Cashtown.length] = createMarker(new GPoint(-77.38390350,39.88700104),"
Franklin Township Elementary School
870 Old Route 30
Cashtown, PA 17310

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Franklin Township Elementary School",'Cashtown=' + Cashtown.length); Gettysburg[Gettysburg.length] = createMarker(new GPoint(-77.21691132,39.85260773),"
Gettysburg Area High School
1130 Old Harrisburg Rd
Gettysburg, PA 17325

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Gettysburg Area High School",'Gettysburg=' + Gettysburg.length); Gettysburg[Gettysburg.length] = createMarker(new GPoint(-77.23004913,39.82562637),"
Gettysburg Area Middle School
37 Lefever St
Gettysburg, PA 17325

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Gettysburg Area Middle School",'Gettysburg=' + Gettysburg.length); Gettysburg[Gettysburg.length] = createMarker(new GPoint(-77.23284149,39.84999466),"
James Gettys Elementary School
898 Biglerville Rd
Gettysburg, PA 17325

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("James Gettys Elementary School",'Gettysburg=' + Gettysburg.length); Gettysburg[Gettysburg.length] = createMarker(new GPoint(-77.22702026,39.82768631),"
Keefauver Elementary School
157 Lefever St
Gettysburg, PA 17325

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Keefauver Elementary School",'Gettysburg=' + Gettysburg.length); Gettysburg[Gettysburg.length] = createMarker(new GPoint(-77.22960663,39.82651520),"
Lincoln Elementary School
98 Lefever Street
Gettysburg, PA 17325

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Lincoln Elementary School",'Gettysburg=' + Gettysburg.length); Littlestown[Littlestown.length] = createMarker(new GPoint(-77.08794403,39.74819183),"
Littlestown Senior High School
200 E Myrtle St
Littlestown, PA 17340

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Littlestown Senior High School",'Littlestown=' + Littlestown.length); Littlestown[Littlestown.length] = createMarker(new GPoint(-77.08743286,39.74762344),"
Maple Avenue Middle School
75 Maple Avenue
Littlestown, PA 17340

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Maple Avenue Middle School",'Littlestown=' + Littlestown.length); New_Oxford[New_Oxford.length] = createMarker(new GPoint(-77.05494690,39.86745071),"
New Oxford Elementary School
116 Berlin Avenue
New Oxford, PA 17350

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("New Oxford Elementary School",'New_Oxford=' + New_Oxford.length); New_Oxford[New_Oxford.length] = createMarker(new GPoint(-77.05422974,39.86832047),"
New Oxford Middle School
130 Berlin Road
New Oxford, PA 17350

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("New Oxford Middle School",'New_Oxford=' + New_Oxford.length); New_Oxford[New_Oxford.length] = createMarker(new GPoint(-77.05422974,39.86832047),"
New Oxford Senior High School
130 Berlin Road
New Oxford, PA 17350

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("New Oxford Senior High School",'New_Oxford=' + New_Oxford.length); Littlestown[Littlestown.length] = createMarker(new GPoint(-77.08673859,39.74929047),"
Rolling Acres Elementary School
150 E Myrtle St
Littlestown, PA 17340

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Rolling Acres Elementary School",'Littlestown=' + Littlestown.length); Biglerville[Biglerville.length] = createMarker(new GPoint(-77.24812317,39.93487549),"
Upper Adams Middle School
161 N Main St
Biglerville, PA 17307

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Upper Adams Middle School",'Biglerville=' + Biglerville.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(Arendtsville); map.removeOverlays(Bendersville); map.removeOverlays(Biglerville); map.removeOverlays(Cashtown); map.removeOverlays(Fairfield); map.removeOverlays(Gettysburg); map.removeOverlays(Hanover); map.removeOverlays(Littlestown); map.removeOverlays(New_Oxford); map.removeOverlays(York_Springs); 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(Littlestown);map.removeOverlays(Arendtsville); map.removeOverlays(Bendersville); map.removeOverlays(Biglerville); map.removeOverlays(Cashtown); map.removeOverlays(Fairfield); map.removeOverlays(Gettysburg); map.removeOverlays(Hanover); map.removeOverlays(Littlestown); map.removeOverlays(New_Oxford); map.removeOverlays(York_Springs); map.addOverlays(Arendtsville); centerByArray(Arendtsville, false, false); cntMarker += Arendtsville.length; map.addOverlays(Bendersville); centerByArray(Bendersville, false, false); cntMarker += Bendersville.length; map.addOverlays(Biglerville); centerByArray(Biglerville, false, false); cntMarker += Biglerville.length; map.addOverlays(Cashtown); centerByArray(Cashtown, false, false); cntMarker += Cashtown.length; map.addOverlays(Fairfield); centerByArray(Fairfield, false, false); cntMarker += Fairfield.length; map.addOverlays(Gettysburg); centerByArray(Gettysburg, false, false); cntMarker += Gettysburg.length; map.addOverlays(Hanover); centerByArray(Hanover, false, false); cntMarker += Hanover.length; map.addOverlays(Littlestown); centerByArray(Littlestown, false, false); cntMarker += Littlestown.length; map.addOverlays(New_Oxford); centerByArray(New_Oxford, false, false); cntMarker += New_Oxford.length; map.addOverlays(York_Springs); centerByArray(York_Springs, false, false); cntMarker += York_Springs.length; centerByArray(Littlestown,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'); } }