function addMarkers() { mySelect = document.getElementById('selection'); Chambersburg = [];Waynesboro = [];Willow_Hill = [];Fayetteville = [];Greencastle = [];Mercersburg = [];Orrstown = [];Lurgan = [];Marion = [];Shippensburg = [];Scotland = [];South_Mountain = [];Saint_Thomas = [];mySelect.options[mySelect.options.length] = new Option("Chambersburg schools",'all=Chambersburg'); mySelect.options[mySelect.options.length] = new Option("Fayetteville schools",'all=Fayetteville'); mySelect.options[mySelect.options.length] = new Option("Greencastle schools",'all=Greencastle'); mySelect.options[mySelect.options.length] = new Option("Lurgan schools",'all=Lurgan'); mySelect.options[mySelect.options.length] = new Option("Marion schools",'all=Marion'); mySelect.options[mySelect.options.length] = new Option("Mercersburg schools",'all=Mercersburg'); mySelect.options[mySelect.options.length] = new Option("Orrstown schools",'all=Orrstown'); mySelect.options[mySelect.options.length] = new Option("Saint Thomas schools",'all=Saint_Thomas'); mySelect.options[mySelect.options.length] = new Option("Scotland schools",'all=Scotland'); mySelect.options[mySelect.options.length] = new Option("Shippensburg schools",'all=Shippensburg'); mySelect.options[mySelect.options.length] = new Option("South Mountain schools",'all=South_Mountain'); mySelect.options[mySelect.options.length] = new Option("Waynesboro schools",'all=Waynesboro'); mySelect.options[mySelect.options.length] = new Option("Willow Hill schools",'all=Willow_Hill'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Chambersburg[Chambersburg.length] = createMarker(new GPoint(-77.64831543,39.93229675),"
Buchanan Elementary School
730 E Washington St
Chambersburg, PA 17201

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Buchanan Elementary School",'Chambersburg=' + Chambersburg.length); Chambersburg[Chambersburg.length] = createMarker(new GPoint(-77.63889313,39.92011261),"
Chambersburg Area Middle School
1151 E Mckinley St
Chambersburg, PA 17201

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Chambersburg Area Middle School",'Chambersburg=' + Chambersburg.length); Chambersburg[Chambersburg.length] = createMarker(new GPoint(-77.65142059,39.92716217),"
Chambersburg Area Senior High School
511 S 6th St
Chambersburg, PA 17201

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Chambersburg Area Senior High School",'Chambersburg=' + Chambersburg.length); Chambersburg[Chambersburg.length] = createMarker(new GPoint(-77.65103912,39.92443085),"
Coldbrook Elementary School
756 S Coldbrook Ave
Chambersburg, PA 17201

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Coldbrook Elementary School",'Chambersburg=' + Chambersburg.length); Chambersburg[Chambersburg.length] = createMarker(new GPoint(-77.57550049,39.88416290),"
Duffield Elementary School
2168 Mont Alto Rd
Chambersburg, PA 17201

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Duffield Elementary School",'Chambersburg=' + Chambersburg.length); Waynesboro[Waynesboro.length] = createMarker(new GPoint(-77.58943176,39.75644302),"
Fairview Avenue Elementary School
220 Fairview Ave
Waynesboro, PA 17268

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Fairview Avenue Elementary School",'Waynesboro=' + Waynesboro.length); Chambersburg[Chambersburg.length] = createMarker(new GPoint(-77.62379456,39.91468048),"
Falling Spring Elementary School
1006 Falling Spring Rd
Chambersburg, PA 17201

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Falling Spring Elementary School",'Chambersburg=' + Chambersburg.length); Willow_Hill[Willow_Hill.length] = createMarker(new GPoint(-77.79769897,40.10670090),"
Fannett-metal Elementary School
14823 Pathvalley Rd Po Box 91
Willow Hill, PA 17271

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Fannett-metal Elementary School",'Willow_Hill=' + Willow_Hill.length); Willow_Hill[Willow_Hill.length] = createMarker(new GPoint(-77.79769897,40.10670090),"
Fannett-metal Middle School
14823 Pathvalley Rd Po Box 91
Willow Hill, PA 17271

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Fannett-metal Middle School",'Willow_Hill=' + Willow_Hill.length); Willow_Hill[Willow_Hill.length] = createMarker(new GPoint(-77.79769897,40.10670090),"
Fannett-metal Senior High School
Po Box 91
Willow Hill, PA 17271

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Fannett-metal Senior High School",'Willow_Hill=' + Willow_Hill.length); Chambersburg[Chambersburg.length] = createMarker(new GPoint(-77.63453674,39.95623779),"
Faust Jhs
1957 Scotland Ave
Chambersburg, PA 17201

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Faust Jhs",'Chambersburg=' + Chambersburg.length); Fayetteville[Fayetteville.length] = createMarker(new GPoint(-77.54946136,39.91082764),"
Fayetteville Elementary School
8 E Main St
Fayetteville, PA 17222

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Fayetteville Elementary School",'Fayetteville=' + Fayetteville.length); Chambersburg[Chambersburg.length] = createMarker(new GPoint(-77.68041992,39.89979935),"
Franklin County Ctc
2463 Loop Rd
Chambersburg, PA 17201

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Franklin County Ctc",'Chambersburg=' + Chambersburg.length); Chambersburg[Chambersburg.length] = createMarker(new GPoint(-77.66868591,39.94274139),"
Gordy Elementary School
401 Miller St
Chambersburg, PA 17201

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Gordy Elementary School",'Chambersburg=' + Chambersburg.length); Chambersburg[Chambersburg.length] = createMarker(new GPoint(-77.61263275,39.99546051),"
Grandview Elementary School
5538 Cumberland Hwy
Chambersburg, PA 17201

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Grandview Elementary School",'Chambersburg=' + Chambersburg.length); Greencastle[Greencastle.length] = createMarker(new GPoint(-77.72335052,39.78092575),"
Greencastle-antrim Elementary School
500 East Leitersburg Street
Greencastle, PA 17225

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Greencastle-antrim Elementary School",'Greencastle=' + Greencastle.length); Greencastle[Greencastle.length] = createMarker(new GPoint(-77.72499847,39.78307724),"
Greencastle-antrim Middle School
370 S Ridge Ave
Greencastle, PA 17225

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Greencastle-antrim Middle School",'Greencastle=' + Greencastle.length); Greencastle[Greencastle.length] = createMarker(new GPoint(-77.72325134,39.78086472),"
Greencastle-antrim Pri School
504 East Leitersburg Street
Greencastle, PA 17225

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Greencastle-antrim Pri School",'Greencastle=' + Greencastle.length); Greencastle[Greencastle.length] = createMarker(new GPoint(-77.72451019,39.78391647),"
Greencastle-antrim Senior High School
300 S Ridge Ave
Greencastle, PA 17225

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Greencastle-antrim Senior High School",'Greencastle=' + Greencastle.length); Chambersburg[Chambersburg.length] = createMarker(new GPoint(-77.58260345,39.91812134),"
Guilford Hills Elementary School
2105 Lincoln Way E
Chambersburg, PA 17201

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Guilford Hills Elementary School",'Chambersburg=' + Chambersburg.length); Chambersburg[Chambersburg.length] = createMarker(new GPoint(-77.68501282,39.95357513),"
Hamilton Heights Elementary School
1589 Johnson Rd
Chambersburg, PA 17201

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Hamilton Heights Elementary School",'Chambersburg=' + Chambersburg.length); Waynesboro[Waynesboro.length] = createMarker(new GPoint(-77.53546906,39.73968887),"
Hooverville Elementary School
10829 Buchanan Trl E
Waynesboro, PA 17268

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Hooverville Elementary School",'Waynesboro=' + Waynesboro.length); Mercersburg[Mercersburg.length] = createMarker(new GPoint(-77.89747620,39.85327148),"
James Buchanan High School
4773 Fort Loudon Rd
Mercersburg, PA 17236

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("James Buchanan High School",'Mercersburg=' + Mercersburg.length); Mercersburg[Mercersburg.length] = createMarker(new GPoint(-77.89727783,39.84722137),"
James Buchanan Middle School
5191 Fort Loudon Rd
Mercersburg, PA 17236

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("James Buchanan Middle School",'Mercersburg=' + Mercersburg.length); Chambersburg[Chambersburg.length] = createMarker(new GPoint(-77.65381622,39.93827820),"
King Street Elementary School
East King Street
Chambersburg, PA 17201

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("King Street Elementary School",'Chambersburg=' + Chambersburg.length); Orrstown[Orrstown.length] = createMarker(new GPoint(-77.70925140,40.06095886),"
Letterkenny Elementary School
10255 Mountain Rd
Orrstown, PA 17244

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Letterkenny Elementary School",'Orrstown=' + Orrstown.length); Lurgan[Lurgan.length] = createMarker(new GPoint(-77.63746643,40.09917068),"
Lurgan Elementary School
8888 Roxbury Rd
Lurgan, PA 17232

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Lurgan Elementary School",'Lurgan=' + Lurgan.length); Marion[Marion.length] = createMarker(new GPoint(-77.69550323,39.85720062),"
Marion Elementary School
Po Box 248
Marion, PA 17235

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Marion Elementary School",'Marion=' + Marion.length); Mercersburg[Mercersburg.length] = createMarker(new GPoint(-77.90609741,39.82775116),"
Mercersburg Elementary School
30 S Park Ave
Mercersburg, PA 17236

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Mercersburg Elementary School",'Mercersburg=' + Mercersburg.length); Mercersburg[Mercersburg.length] = createMarker(new GPoint(-77.90080261,39.79816437),"
Montgomery Elementary School
9138 Fort Loudon Rd
Mercersburg, PA 17236

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Montgomery Elementary School",'Mercersburg=' + Mercersburg.length); Mercersburg[Mercersburg.length] = createMarker(new GPoint(-77.89594269,39.88563538),"
Mountain View Elementary School
2311 Lemar Rd
Mercersburg, PA 17236

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Mountain View Elementary School",'Mercersburg=' + Mercersburg.length); Waynesboro[Waynesboro.length] = createMarker(new GPoint(-77.57469940,39.80329895),"
Mowrey Elementary School
7891 Tomstown Rd
Waynesboro, PA 17268

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Mowrey Elementary School",'Waynesboro=' + Waynesboro.length); Shippensburg[Shippensburg.length] = createMarker(new GPoint(-77.53527069,40.05017853),"
Nancy Grayson Elementary School
301 Lurgan Ave
Shippensburg, PA 17257

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Nancy Grayson Elementary School",'Shippensburg=' + Shippensburg.length); Chambersburg[Chambersburg.length] = createMarker(new GPoint(-77.63565826,39.87790680),"
New Franklin Elementary School
3584 Wayne Rd
Chambersburg, PA 17201

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("New Franklin Elementary School",'Chambersburg=' + Chambersburg.length); Scotland[Scotland.length] = createMarker(new GPoint(-77.58412170,39.96723557),"
Scotland Elementary School
3832 Main Street
Scotland, PA 17254

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Scotland Elementary School",'Scotland=' + Scotland.length); Scotland[Scotland.length] = createMarker(new GPoint(-77.58750153,39.96860123),"
Scotland Sch Veterans Children
3583 Scotland Rd
Scotland, PA 17254

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Scotland Sch Veterans Children",'Scotland=' + Scotland.length); Chambersburg[Chambersburg.length] = createMarker(new GPoint(-77.65069580,39.94556427),"
Sharpe Elementary School
850 Broad St
Chambersburg, PA 17201

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Sharpe Elementary School",'Chambersburg=' + Chambersburg.length); Shippensburg[Shippensburg.length] = createMarker(new GPoint(-77.53991699,40.04631424),"
Shippensburg Area Middle School
101 Park Place
Shippensburg, PA 17257

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Shippensburg Area Middle School",'Shippensburg=' + Shippensburg.length); Chambersburg[Chambersburg.length] = createMarker(new GPoint(-77.70866394,39.91042709),"
South Hamilton Elementary School
1019 Warm Spring Rd
Chambersburg, PA 17201

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("South Hamilton Elementary School",'Chambersburg=' + Chambersburg.length); South_Mountain[South_Mountain.length] = createMarker(new GPoint(-77.48799896,39.84629822),"
South Mountain Secure Trmnt Un
Po Box 374
South Mountain, PA 17261

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("South Mountain Secure Trmnt Un",'South_Mountain=' + South_Mountain.length); Saint_Thomas[Saint_Thomas.length] = createMarker(new GPoint(-77.79782104,39.91812515),"
St Thomas Elementary School
70 School House Rd
Saint Thomas, PA 17252

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("St Thomas Elementary School",'Saint_Thomas=' + Saint_Thomas.length); Chambersburg[Chambersburg.length] = createMarker(new GPoint(-77.66976929,39.92752838),"
Stevens Elementary School
800 Hollywell Ave
Chambersburg, PA 17201

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Stevens Elementary School",'Chambersburg=' + Chambersburg.length); Waynesboro[Waynesboro.length] = createMarker(new GPoint(-77.56380463,39.74751282),"
Summitview Elementary School
840 E 2nd St
Waynesboro, PA 17268

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Summitview Elementary School",'Waynesboro=' + Waynesboro.length); Waynesboro[Waynesboro.length] = createMarker(new GPoint(-77.56716156,39.74793625),"
Waynesboro Area Middle School
702 E 2nd St
Waynesboro, PA 17268

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Waynesboro Area Middle School",'Waynesboro=' + Waynesboro.length); Waynesboro[Waynesboro.length] = createMarker(new GPoint(-77.56970978,39.74908829),"
Waynesboro Area Senior High School
550 E 2nd St
Waynesboro, PA 17268

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Waynesboro Area Senior High School",'Waynesboro=' + Waynesboro.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(Chambersburg); map.removeOverlays(Fayetteville); map.removeOverlays(Greencastle); map.removeOverlays(Lurgan); map.removeOverlays(Marion); map.removeOverlays(Mercersburg); map.removeOverlays(Orrstown); map.removeOverlays(Saint_Thomas); map.removeOverlays(Scotland); map.removeOverlays(Shippensburg); map.removeOverlays(South_Mountain); map.removeOverlays(Waynesboro); map.removeOverlays(Willow_Hill); 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(Chambersburg);map.removeOverlays(Chambersburg); map.removeOverlays(Fayetteville); map.removeOverlays(Greencastle); map.removeOverlays(Lurgan); map.removeOverlays(Marion); map.removeOverlays(Mercersburg); map.removeOverlays(Orrstown); map.removeOverlays(Saint_Thomas); map.removeOverlays(Scotland); map.removeOverlays(Shippensburg); map.removeOverlays(South_Mountain); map.removeOverlays(Waynesboro); map.removeOverlays(Willow_Hill); map.addOverlays(Chambersburg); centerByArray(Chambersburg, false, false); cntMarker += Chambersburg.length; map.addOverlays(Fayetteville); centerByArray(Fayetteville, false, false); cntMarker += Fayetteville.length; map.addOverlays(Greencastle); centerByArray(Greencastle, false, false); cntMarker += Greencastle.length; map.addOverlays(Lurgan); centerByArray(Lurgan, false, false); cntMarker += Lurgan.length; map.addOverlays(Marion); centerByArray(Marion, false, false); cntMarker += Marion.length; map.addOverlays(Mercersburg); centerByArray(Mercersburg, false, false); cntMarker += Mercersburg.length; map.addOverlays(Orrstown); centerByArray(Orrstown, false, false); cntMarker += Orrstown.length; map.addOverlays(Saint_Thomas); centerByArray(Saint_Thomas, false, false); cntMarker += Saint_Thomas.length; map.addOverlays(Scotland); centerByArray(Scotland, false, false); cntMarker += Scotland.length; map.addOverlays(Shippensburg); centerByArray(Shippensburg, false, false); cntMarker += Shippensburg.length; map.addOverlays(South_Mountain); centerByArray(South_Mountain, false, false); cntMarker += South_Mountain.length; map.addOverlays(Waynesboro); centerByArray(Waynesboro, false, false); cntMarker += Waynesboro.length; map.addOverlays(Willow_Hill); centerByArray(Willow_Hill, false, false); cntMarker += Willow_Hill.length; centerByArray(Chambersburg,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'); } }