function addMarkers() { mySelect = document.getElementById('selection'); Mill_Creek = [];Huntingdon = [];Alexandria = [];Mapleton_Depot = [];Mount_Union = [];Robertsdale = [];Rockhill_Furnace = [];Shade_Gap = [];Three_Springs = [];Cassville = [];James_Creek = [];mySelect.options[mySelect.options.length] = new Option("Alexandria schools",'all=Alexandria'); mySelect.options[mySelect.options.length] = new Option("Cassville schools",'all=Cassville'); mySelect.options[mySelect.options.length] = new Option("Huntingdon schools",'all=Huntingdon'); mySelect.options[mySelect.options.length] = new Option("James Creek schools",'all=James_Creek'); mySelect.options[mySelect.options.length] = new Option("Mapleton Depot schools",'all=Mapleton_Depot'); mySelect.options[mySelect.options.length] = new Option("Mill Creek schools",'all=Mill_Creek'); mySelect.options[mySelect.options.length] = new Option("Mount Union schools",'all=Mount_Union'); mySelect.options[mySelect.options.length] = new Option("Robertsdale schools",'all=Robertsdale'); mySelect.options[mySelect.options.length] = new Option("Rockhill Furnace schools",'all=Rockhill_Furnace'); mySelect.options[mySelect.options.length] = new Option("Shade Gap schools",'all=Shade_Gap'); mySelect.options[mySelect.options.length] = new Option("Three Springs schools",'all=Three_Springs'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Mill_Creek[Mill_Creek.length] = createMarker(new GPoint(-77.91259766,40.45209885),"
Brady-henderson Mill Creek Elementary School
Po Box B
Mill Creek, PA 17060

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Brady-henderson Mill Creek Elementary School",'Mill_Creek=' + Mill_Creek.length); Huntingdon[Huntingdon.length] = createMarker(new GPoint(-78.01089478,40.50399399),"
Huntingdon Area Middle School
2500 Cassady Ave
Huntingdon, PA 16652

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Huntingdon Area Middle School",'Huntingdon=' + Huntingdon.length); Huntingdon[Huntingdon.length] = createMarker(new GPoint(-78.01173401,40.50319290),"
Huntingdon Area Senior High School
2400 Cassady Ave Ste 1
Huntingdon, PA 16652

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Huntingdon Area Senior High School",'Huntingdon=' + Huntingdon.length); Mill_Creek[Mill_Creek.length] = createMarker(new GPoint(-77.91259766,40.45209885),"
Huntingdon Co Ctc
Po Box E
Mill Creek, PA 17060

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Huntingdon Co Ctc",'Mill_Creek=' + Mill_Creek.length); Huntingdon[Huntingdon.length] = createMarker(new GPoint(-77.97239685,40.51430130),"
Jackson-miller Elementary School
Rr 2 Box 173
Huntingdon, PA 16652

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Jackson-miller Elementary School",'Huntingdon=' + Huntingdon.length); Alexandria[Alexandria.length] = createMarker(new GPoint(-78.09980011,40.53760147),"
Juniata Valley Elementary School
Po Box 318
Alexandria, PA 16611

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Juniata Valley Elementary School",'Alexandria=' + Alexandria.length); Alexandria[Alexandria.length] = createMarker(new GPoint(-78.09980011,40.53760147),"
Juniata Valley Junior Senior High School
Po Box 318
Alexandria, PA 16611

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Juniata Valley Junior Senior High School",'Alexandria=' + Alexandria.length); Mapleton_Depot[Mapleton_Depot.length] = createMarker(new GPoint(-77.97409821,40.38180161),"
Mapleton-union Elementary School
Rr 1 Box 135
Mapleton Depot, PA 17052

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Mapleton-union Elementary School",'Mapleton_Depot=' + Mapleton_Depot.length); Mount_Union[Mount_Union.length] = createMarker(new GPoint(-77.87633514,40.39033890),"
Mount Union Area Junior Senior High School
706 N Shaver St
Mount Union, PA 17066

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Mount Union Area Junior Senior High School",'Mount_Union=' + Mount_Union.length); Mount_Union[Mount_Union.length] = createMarker(new GPoint(-77.88387299,40.38385391),"
Mount Union Elementary School
10 W Market St
Mount Union, PA 17066

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Mount Union Elementary School",'Mount_Union=' + Mount_Union.length); Robertsdale[Robertsdale.length] = createMarker(new GPoint(-78.11679840,40.17359924),"
Robertsdale Gr School
Po Box 37
Robertsdale, PA 16674

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Robertsdale Gr School",'Robertsdale=' + Robertsdale.length); Rockhill_Furnace[Rockhill_Furnace.length] = createMarker(new GPoint(-77.90059662,40.24250031),"
Rockhill Elementary School
Po Box 184
Rockhill Furnace, PA 17249

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Rockhill Elementary School",'Rockhill_Furnace=' + Rockhill_Furnace.length); Shade_Gap[Shade_Gap.length] = createMarker(new GPoint(-77.86139679,40.18080139),"
Shade Gap Elementary School
Hc 83 Box 408
Shade Gap, PA 17255

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Shade Gap Elementary School",'Shade_Gap=' + Shade_Gap.length); Mount_Union[Mount_Union.length] = createMarker(new GPoint(-77.87319946,40.38150024),"
Shirley Township Elementary School
Rr 1 Box 2070 Lloyd St
Mount Union, PA 17066

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Shirley Township Elementary School",'Mount_Union=' + Mount_Union.length); Three_Springs[Three_Springs.length] = createMarker(new GPoint(-77.98870087,40.16680145),"
Southern Huntingdon Co Junior Senior High School
Rr 1 Box 1124
Three Springs, PA 17264

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Southern Huntingdon Co Junior Senior High School",'Three_Springs=' + Three_Springs.length); Huntingdon[Huntingdon.length] = createMarker(new GPoint(-78.06490326,40.46080017),"
Southside Elementary School
Rr 3 Box 1b
Huntingdon, PA 16652

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Southside Elementary School",'Huntingdon=' + Huntingdon.length); Three_Springs[Three_Springs.length] = createMarker(new GPoint(-77.93119812,40.25120163),"
Spring Farms Elementary School
Rr 1 Box 1876
Three Springs, PA 17264

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Spring Farms Elementary School",'Three_Springs=' + Three_Springs.length); Huntingdon[Huntingdon.length] = createMarker(new GPoint(-78.01113129,40.50890732),"
Standing Stone Elementary School
10 29th Street
Huntingdon, PA 16652

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Standing Stone Elementary School",'Huntingdon=' + Huntingdon.length); Cassville[Cassville.length] = createMarker(new GPoint(-78.02770233,40.29529953),"
Trough Creek Valley Elementary School
Hc 1 Box 27
Cassville, PA 16623

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Trough Creek Valley Elementary School",'Cassville=' + Cassville.length); James_Creek[James_Creek.length] = createMarker(new GPoint(-78.18888855,40.34572983),"
Youth Forestry Camp #3
Trough Creek St Pk Rd 1 Bx 175
James Creek, PA 16657

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Youth Forestry Camp #3",'James_Creek=' + James_Creek.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(Alexandria); map.removeOverlays(Cassville); map.removeOverlays(Huntingdon); map.removeOverlays(James_Creek); map.removeOverlays(Mapleton_Depot); map.removeOverlays(Mill_Creek); map.removeOverlays(Mount_Union); map.removeOverlays(Robertsdale); map.removeOverlays(Rockhill_Furnace); map.removeOverlays(Shade_Gap); map.removeOverlays(Three_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(Mill_Creek);map.removeOverlays(Alexandria); map.removeOverlays(Cassville); map.removeOverlays(Huntingdon); map.removeOverlays(James_Creek); map.removeOverlays(Mapleton_Depot); map.removeOverlays(Mill_Creek); map.removeOverlays(Mount_Union); map.removeOverlays(Robertsdale); map.removeOverlays(Rockhill_Furnace); map.removeOverlays(Shade_Gap); map.removeOverlays(Three_Springs); map.addOverlays(Alexandria); centerByArray(Alexandria, false, false); cntMarker += Alexandria.length; map.addOverlays(Cassville); centerByArray(Cassville, false, false); cntMarker += Cassville.length; map.addOverlays(Huntingdon); centerByArray(Huntingdon, false, false); cntMarker += Huntingdon.length; map.addOverlays(James_Creek); centerByArray(James_Creek, false, false); cntMarker += James_Creek.length; map.addOverlays(Mapleton_Depot); centerByArray(Mapleton_Depot, false, false); cntMarker += Mapleton_Depot.length; map.addOverlays(Mill_Creek); centerByArray(Mill_Creek, false, false); cntMarker += Mill_Creek.length; map.addOverlays(Mount_Union); centerByArray(Mount_Union, false, false); cntMarker += Mount_Union.length; map.addOverlays(Robertsdale); centerByArray(Robertsdale, false, false); cntMarker += Robertsdale.length; map.addOverlays(Rockhill_Furnace); centerByArray(Rockhill_Furnace, false, false); cntMarker += Rockhill_Furnace.length; map.addOverlays(Shade_Gap); centerByArray(Shade_Gap, false, false); cntMarker += Shade_Gap.length; map.addOverlays(Three_Springs); centerByArray(Three_Springs, false, false); cntMarker += Three_Springs.length; centerByArray(Mill_Creek,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'); } }