function addMarkers() { mySelect = document.getElementById('selection'); Sunbury = [];Dalmatia = [];Leck_Kill = [];Herndon = [];Trevorton = [];Milton = [];Montandon = [];Mount_Carmel = [];Coal_Township = [];Northumberland = [];Riverside = [];Turbotville = [];Shamokin = [];mySelect.options[mySelect.options.length] = new Option("Coal Township schools",'all=Coal_Township'); mySelect.options[mySelect.options.length] = new Option("Dalmatia schools",'all=Dalmatia'); mySelect.options[mySelect.options.length] = new Option("Herndon schools",'all=Herndon'); mySelect.options[mySelect.options.length] = new Option("Leck Kill schools",'all=Leck_Kill'); mySelect.options[mySelect.options.length] = new Option("Milton schools",'all=Milton'); mySelect.options[mySelect.options.length] = new Option("Montandon schools",'all=Montandon'); mySelect.options[mySelect.options.length] = new Option("Mount Carmel schools",'all=Mount_Carmel'); mySelect.options[mySelect.options.length] = new Option("Northumberland schools",'all=Northumberland'); mySelect.options[mySelect.options.length] = new Option("Riverside schools",'all=Riverside'); mySelect.options[mySelect.options.length] = new Option("Shamokin schools",'all=Shamokin'); mySelect.options[mySelect.options.length] = new Option("Sunbury schools",'all=Sunbury'); mySelect.options[mySelect.options.length] = new Option("Trevorton schools",'all=Trevorton'); mySelect.options[mySelect.options.length] = new Option("Turbotville schools",'all=Turbotville'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Sunbury[Sunbury.length] = createMarker(new GPoint(-76.77610016,40.85269928),"
Chief Shikellamy School
Rr1 Box 246
Sunbury, PA 17801

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Chief Shikellamy School",'Sunbury=' + Sunbury.length); Dalmatia[Dalmatia.length] = createMarker(new GPoint(-76.85729980,40.62590027),"
Dalmatia Elementary School
Rr 1 Box 293
Dalmatia, PA 17017

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Dalmatia Elementary School",'Dalmatia=' + Dalmatia.length); Sunbury[Sunbury.length] = createMarker(new GPoint(-76.78579712,40.87104034),"
Edison School
4th Greenough Street
Sunbury, PA 17801

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Edison School",'Sunbury=' + Sunbury.length); Sunbury[Sunbury.length] = createMarker(new GPoint(-76.78755951,40.86186981),"
Grace S Beck School
600 Arch St
Sunbury, PA 17801

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Grace S Beck School",'Sunbury=' + Sunbury.length); Leck_Kill[Leck_Kill.length] = createMarker(new GPoint(-76.63008881,40.71659088),"
Leck Kill Elementary School
Hc 63 Box 18
Leck Kill, PA 17836

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Leck Kill Elementary School",'Leck_Kill=' + Leck_Kill.length); Herndon[Herndon.length] = createMarker(new GPoint(-76.79840088,40.69189835),"
Line Mountain Junior Senior High School
Rr 1 Box 1660
Herndon, PA 17830

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Line Mountain Junior Senior High School",'Herndon=' + Herndon.length); Trevorton[Trevorton.length] = createMarker(new GPoint(-76.67334747,40.78073883),"
Line Mountain Middle School
500 Shamokin Street
Trevorton, PA 17881

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Line Mountain Middle School",'Trevorton=' + Trevorton.length); Milton[Milton.length] = createMarker(new GPoint(-76.83750153,41.02016068),"
Milton Area Elementary School
60 Brenda Revenolt Circle
Milton, PA 17847

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Milton Area Elementary School",'Milton=' + Milton.length); Milton[Milton.length] = createMarker(new GPoint(-76.84137726,41.01062775),"
Milton Area Middle School
700 Mahoning St
Milton, PA 17847

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Milton Area Middle School",'Milton=' + Milton.length); Milton[Milton.length] = createMarker(new GPoint(-76.84137726,41.01062775),"
Milton High School
700 Mahoning St
Milton, PA 17847

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Milton High School",'Milton=' + Milton.length); Montandon[Montandon.length] = createMarker(new GPoint(-76.85569763,40.96319962),"
Montandon Elementary School
Po Box 130
Montandon, PA 17850

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Montandon Elementary School",'Montandon=' + Montandon.length); Mount_Carmel[Mount_Carmel.length] = createMarker(new GPoint(-76.42977905,40.78960037),"
Mount Carmel Area Elementary School
820 Highway
Mount Carmel, PA 17851

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Mount Carmel Area Elementary School",'Mount_Carmel=' + Mount_Carmel.length); Mount_Carmel[Mount_Carmel.length] = createMarker(new GPoint(-76.42123413,40.79313660),"
Mount Carmel Area Junior Senior High School
600 W 5th St
Mount Carmel, PA 17851

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Mount Carmel Area Junior Senior High School",'Mount_Carmel=' + Mount_Carmel.length); Coal_Township[Coal_Township.length] = createMarker(new GPoint(-76.55690002,40.78760147),"
Northumberland County Avts
1700 W Montgomery St 2000
Coal Township, PA 17866

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Northumberland County Avts",'Coal_Township=' + Coal_Township.length); Sunbury[Sunbury.length] = createMarker(new GPoint(-76.79476166,40.86246109),"
Oaklyn School
Rd 2
Sunbury, PA 17801

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Oaklyn School",'Sunbury=' + Sunbury.length); Northumberland[Northumberland.length] = createMarker(new GPoint(-76.78900146,40.90449905),"
Priestley School
423 Cannery Rd
Northumberland, PA 17857

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Priestley School",'Northumberland=' + Northumberland.length); Northumberland[Northumberland.length] = createMarker(new GPoint(-76.79837799,40.89321899),"
Rice Middle School
4th Hanover Streets
Northumberland, PA 17857

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Rice Middle School",'Northumberland=' + Northumberland.length); Riverside[Riverside.length] = createMarker(new GPoint(-76.63925934,40.95772171),"
Riverside Elementary School
Avenue A 5th Street
Riverside, PA 17868

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Riverside Elementary School",'Riverside=' + Riverside.length); Coal_Township[Coal_Township.length] = createMarker(new GPoint(-77.81849670,40.91429901),"
Shamokin Area Elementary School
3000 W State St
Coal Township, PA 17866

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Shamokin Area Elementary School",'Coal_Township=' + Coal_Township.length); Coal_Township[Coal_Township.length] = createMarker(new GPoint(-77.81849670,40.91429901),"
Shamokin Area Junior Senior High School
2000 W State St
Coal Township, PA 17866

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Shamokin Area Junior Senior High School",'Coal_Township=' + Coal_Township.length); Sunbury[Sunbury.length] = createMarker(new GPoint(-76.78843689,40.86053848),"
Shikellamy High School
6th Walnut Streets
Sunbury, PA 17801

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Shikellamy High School",'Sunbury=' + Sunbury.length); Sunbury[Sunbury.length] = createMarker(new GPoint(-76.78424072,40.86045456),"
Sunbury Middle School
115 Fairmount Ave
Sunbury, PA 17801

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Sunbury Middle School",'Sunbury=' + Sunbury.length); Milton[Milton.length] = createMarker(new GPoint(-76.84824371,40.96961975),"
Susq-cyber Charter School
90 Lawton Lane
Milton, PA 17847

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Susq-cyber Charter School",'Milton=' + Milton.length); Trevorton[Trevorton.length] = createMarker(new GPoint(-76.67334747,40.78073883),"
Trevorton Elementary School
542 W Shamokin St
Trevorton, PA 17881

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Trevorton Elementary School",'Trevorton=' + Trevorton.length); Turbotville[Turbotville.length] = createMarker(new GPoint(-76.77162170,41.10153961),"
Turbotville Elementary School
Rr 2 Box 151a
Turbotville, PA 17772

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Turbotville Elementary School",'Turbotville=' + Turbotville.length); Turbotville[Turbotville.length] = createMarker(new GPoint(-76.77162170,41.10153961),"
Warrior Run High School
4800 Susquehanna Trail
Turbotville, PA 17772

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Warrior Run High School",'Turbotville=' + Turbotville.length); Turbotville[Turbotville.length] = createMarker(new GPoint(-76.77162170,41.10153961),"
Warrior Run Middle School
4800 Susquehanna Trail
Turbotville, PA 17772

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Warrior Run Middle School",'Turbotville=' + Turbotville.length); Turbotville[Turbotville.length] = createMarker(new GPoint(-76.77162170,41.10153961),"
Watsontown Elementary School
Rr 2 Box 151a
Turbotville, PA 17772

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Watsontown Elementary School",'Turbotville=' + Turbotville.length); Shamokin[Shamokin.length] = createMarker(new GPoint(-76.55329895,40.78379822),"
West Cameron Elementary School
Rr 2 Box 538
Shamokin, PA 17872

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("West Cameron Elementary School",'Shamokin=' + Shamokin.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(Coal_Township); map.removeOverlays(Dalmatia); map.removeOverlays(Herndon); map.removeOverlays(Leck_Kill); map.removeOverlays(Milton); map.removeOverlays(Montandon); map.removeOverlays(Mount_Carmel); map.removeOverlays(Northumberland); map.removeOverlays(Riverside); map.removeOverlays(Shamokin); map.removeOverlays(Sunbury); map.removeOverlays(Trevorton); map.removeOverlays(Turbotville); 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(Sunbury);map.removeOverlays(Coal_Township); map.removeOverlays(Dalmatia); map.removeOverlays(Herndon); map.removeOverlays(Leck_Kill); map.removeOverlays(Milton); map.removeOverlays(Montandon); map.removeOverlays(Mount_Carmel); map.removeOverlays(Northumberland); map.removeOverlays(Riverside); map.removeOverlays(Shamokin); map.removeOverlays(Sunbury); map.removeOverlays(Trevorton); map.removeOverlays(Turbotville); map.addOverlays(Coal_Township); centerByArray(Coal_Township, false, false); cntMarker += Coal_Township.length; map.addOverlays(Dalmatia); centerByArray(Dalmatia, false, false); cntMarker += Dalmatia.length; map.addOverlays(Herndon); centerByArray(Herndon, false, false); cntMarker += Herndon.length; map.addOverlays(Leck_Kill); centerByArray(Leck_Kill, false, false); cntMarker += Leck_Kill.length; map.addOverlays(Milton); centerByArray(Milton, false, false); cntMarker += Milton.length; map.addOverlays(Montandon); centerByArray(Montandon, false, false); cntMarker += Montandon.length; map.addOverlays(Mount_Carmel); centerByArray(Mount_Carmel, false, false); cntMarker += Mount_Carmel.length; map.addOverlays(Northumberland); centerByArray(Northumberland, false, false); cntMarker += Northumberland.length; map.addOverlays(Riverside); centerByArray(Riverside, false, false); cntMarker += Riverside.length; map.addOverlays(Shamokin); centerByArray(Shamokin, false, false); cntMarker += Shamokin.length; map.addOverlays(Sunbury); centerByArray(Sunbury, false, false); cntMarker += Sunbury.length; map.addOverlays(Trevorton); centerByArray(Trevorton, false, false); cntMarker += Trevorton.length; map.addOverlays(Turbotville); centerByArray(Turbotville, false, false); cntMarker += Turbotville.length; centerByArray(Sunbury,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'); } }