function addMarkers() { mySelect = document.getElementById('selection'); Wingate = [];Bellefonte = [];State_College = [];Pleasant_Gap = [];Centre_Hall = [];Pine_Grove_Mills = [];Port_Matilda = [];Spring_Mills = [];Howard = [];Blanchard = [];Rebersburg = [];Snow_Shoe = [];Philipsburg = [];mySelect.options[mySelect.options.length] = new Option("Bellefonte schools",'all=Bellefonte'); mySelect.options[mySelect.options.length] = new Option("Blanchard schools",'all=Blanchard'); mySelect.options[mySelect.options.length] = new Option("Centre Hall schools",'all=Centre_Hall'); mySelect.options[mySelect.options.length] = new Option("Howard schools",'all=Howard'); mySelect.options[mySelect.options.length] = new Option("Philipsburg schools",'all=Philipsburg'); mySelect.options[mySelect.options.length] = new Option("Pine Grove Mills schools",'all=Pine_Grove_Mills'); mySelect.options[mySelect.options.length] = new Option("Pleasant Gap schools",'all=Pleasant_Gap'); mySelect.options[mySelect.options.length] = new Option("Port Matilda schools",'all=Port_Matilda'); mySelect.options[mySelect.options.length] = new Option("Rebersburg schools",'all=Rebersburg'); mySelect.options[mySelect.options.length] = new Option("Snow Shoe schools",'all=Snow_Shoe'); mySelect.options[mySelect.options.length] = new Option("Spring Mills schools",'all=Spring_Mills'); mySelect.options[mySelect.options.length] = new Option("State College schools",'all=State_College'); mySelect.options[mySelect.options.length] = new Option("Wingate schools",'all=Wingate'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Wingate[Wingate.length] = createMarker(new GPoint(-77.81133270,40.93569183),"
Bald Eagle Area Junior Senior High School
751 S Eagle Valley Rd
Wingate, PA 16823

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bald Eagle Area Junior Senior High School",'Wingate=' + Wingate.length); Bellefonte[Bellefonte.length] = createMarker(new GPoint(-77.76392365,40.91344070),"
Bellefonte Area High School
830 E Bishop St
Bellefonte, PA 16823

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bellefonte Area High School",'Bellefonte=' + Bellefonte.length); Bellefonte[Bellefonte.length] = createMarker(new GPoint(-77.76168060,40.91389847),"
Bellefonte Area Middle School
100 N School St
Bellefonte, PA 16823

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Bellefonte Area Middle School",'Bellefonte=' + Bellefonte.length); Bellefonte[Bellefonte.length] = createMarker(new GPoint(-77.77941895,40.91563034),"
Bellefonte Elementary School
100 W Linn St
Bellefonte, PA 16823

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Bellefonte Elementary School",'Bellefonte=' + Bellefonte.length); Bellefonte[Bellefonte.length] = createMarker(new GPoint(-77.81150818,40.89393616),"
Benner Elementary School
490 Buffalo Run Rd
Bellefonte, PA 16823

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Benner Elementary School",'Bellefonte=' + Bellefonte.length); State_College[State_College.length] = createMarker(new GPoint(-77.80871582,40.78605270),"
Boalsburg/panorama Village Elementary School
240 Villa Crest Dr
State College, PA 16801

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Boalsburg/panorama Village Elementary School",'State_College=' + State_College.length); Pleasant_Gap[Pleasant_Gap.length] = createMarker(new GPoint(-77.73718262,40.87977982),"
Central Pa Institute Of Scienc
540 N Harrison Rd
Pleasant Gap, PA 16823

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Central Pa Institute Of Scienc",'Pleasant_Gap=' + Pleasant_Gap.length); Centre_Hall[Centre_Hall.length] = createMarker(new GPoint(-77.68808746,40.84646225),"
Centre Hall-potter Elementary School
211 North Hoffer Street
Centre Hall, PA 16828

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Centre Hall-potter Elementary School",'Centre_Hall=' + Centre_Hall.length); State_College[State_College.length] = createMarker(new GPoint(-77.88449860,40.76617813),"
Centre Learning Community Charter School
2643 W College Ave
State College, PA 16801

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Centre Learning Community Charter School",'State_College=' + State_College.length); State_College[State_College.length] = createMarker(new GPoint(-77.87272644,40.78247833),"
Corl Street Elementary School
235 Corl St
State College, PA 16801

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Corl Street Elementary School",'State_College=' + State_College.length); State_College[State_College.length] = createMarker(new GPoint(-77.84806824,40.78889847),"
Easterly Parkway Elementary School
234 Easterly Pkwy
State College, PA 16801

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Easterly Parkway Elementary School",'State_College=' + State_College.length); State_College[State_College.length] = createMarker(new GPoint(-77.85850525,40.79019928),"
Fairmount Avenue Elementary School
411 S Fraser St
State College, PA 16801

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Fairmount Avenue Elementary School",'State_College=' + State_College.length); Pine_Grove_Mills[Pine_Grove_Mills.length] = createMarker(new GPoint(-77.76293900,41.90403000),"
Ferguson Township Elementary School
215 West Main Street
Pine Grove Mills, PA 16868

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Ferguson Township Elementary School",'Pine_Grove_Mills=' + Pine_Grove_Mills.length); Port_Matilda[Port_Matilda.length] = createMarker(new GPoint(-77.95900726,40.80123901),"
Gray's Woods Elementary School
0160 Brackenbourne Drive
Port Matilda, PA 16870

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Gray's Woods Elementary School",'Port_Matilda=' + Port_Matilda.length); Spring_Mills[Spring_Mills.length] = createMarker(new GPoint(-77.49909210,40.87602234),"
Gregg Township Elementary School
106 School Street
Spring Mills, PA 16875

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Gregg Township Elementary School",'Spring_Mills=' + Spring_Mills.length); State_College[State_College.length] = createMarker(new GPoint(-77.82291412,40.81024170),"
Houserville/lemont Elementary School
675 Elmwood St
State College, PA 16801

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Houserville/lemont Elementary School",'State_College=' + State_College.length); Howard[Howard.length] = createMarker(new GPoint(-77.66889954,41.01990128),"
Howard Elementary School
Po Box 406
Howard, PA 16841

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Howard Elementary School",'Howard=' + Howard.length); Blanchard[Blanchard.length] = createMarker(new GPoint(-77.59880066,41.06499863),"
Liberty Curtain Elementary School
Po Box 329
Blanchard, PA 16826

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Liberty Curtain Elementary School",'Blanchard=' + Blanchard.length); Bellefonte[Bellefonte.length] = createMarker(new GPoint(-77.61122131,40.95853806),"
Marion-walker Elementary School
100 School Dr
Bellefonte, PA 16823

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Marion-walker Elementary School",'Bellefonte=' + Bellefonte.length); Port_Matilda[Port_Matilda.length] = createMarker(new GPoint(-78.02079773,40.80519867),"
Matternville Elementary School
Rr 1 Box 354
Port Matilda, PA 16870

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Matternville Elementary School",'Port_Matilda=' + Port_Matilda.length); Rebersburg[Rebersburg.length] = createMarker(new GPoint(-77.44339752,40.94581985),"
Miles Township Elementary School
80 Town Lane Road
Rebersburg, PA 16872

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Miles Township Elementary School",'Rebersburg=' + Rebersburg.length); State_College[State_College.length] = createMarker(new GPoint(-77.80598450,40.78521347),"
Mount Nittany Middle School
656 Brandywine Dr
State College, PA 16801

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Mount Nittany Middle School",'State_College=' + State_College.length); Snow_Shoe[Snow_Shoe.length] = createMarker(new GPoint(-77.95330048,41.01959991),"
Mountaintop Area Elementary School
100 School Dr 865
Snow Shoe, PA 16874

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Mountaintop Area Elementary School",'Snow_Shoe=' + Snow_Shoe.length); State_College[State_College.length] = createMarker(new GPoint(-77.90473938,40.78387833),"
Nittany Valley Charter School
1612 Norma St
State College, PA 16801

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Nittany Valley Charter School",'State_College=' + State_College.length); State_College[State_College.length] = createMarker(new GPoint(-77.92182922,40.80705643),"
Park Forest Elementary School
2181 School Dr
State College, PA 16803

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Park Forest Elementary School",'State_College=' + State_College.length); State_College[State_College.length] = createMarker(new GPoint(-77.92216492,40.80694580),"
Park Forest Middle School
2180 School Dr
State College, PA 16803

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Park Forest Middle School",'State_College=' + State_College.length); Spring_Mills[Spring_Mills.length] = createMarker(new GPoint(-77.52936554,40.87622833),"
Penns Valley Area Elementary School
4528 Penns Valley Road
Spring Mills, PA 16875

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Penns Valley Area Elementary School",'Spring_Mills=' + Spring_Mills.length); Spring_Mills[Spring_Mills.length] = createMarker(new GPoint(-77.52825928,40.87691116),"
Penns Valley Area Junior Senior High School
4545 Penns Valley Road
Spring Mills, PA 16875

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Penns Valley Area Junior Senior High School",'Spring_Mills=' + Spring_Mills.length); Philipsburg[Philipsburg.length] = createMarker(new GPoint(-78.21044922,40.89083862),"
Philipsburg-osceola Area High School
502 Philips St
Philipsburg, PA 16866

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Philipsburg-osceola Area High School",'Philipsburg=' + Philipsburg.length); Philipsburg[Philipsburg.length] = createMarker(new GPoint(-78.21814728,40.89859390),"
Philipsburg-osceola Junior High School
100-130 N 6th St
Philipsburg, PA 16866

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Philipsburg-osceola Junior High School",'Philipsburg=' + Philipsburg.length); Pleasant_Gap[Pleasant_Gap.length] = createMarker(new GPoint(-77.74023437,40.86647415),"
Pleasant Gap Elementary School
230 S Main St
Pleasant Gap, PA 16823

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Pleasant Gap Elementary School",'Pleasant_Gap=' + Pleasant_Gap.length); Port_Matilda[Port_Matilda.length] = createMarker(new GPoint(-78.02079773,40.80519867),"
Port Matilda Elementary School
Po Box 508
Port Matilda, PA 16870

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Port Matilda Elementary School",'Port_Matilda=' + Port_Matilda.length); State_College[State_College.length] = createMarker(new GPoint(-77.88448334,40.80006027),"
Radio Park Elementary School
800 W Cherry Ln
State College, PA 16803

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Radio Park Elementary School",'State_College=' + State_College.length); State_College[State_College.length] = createMarker(new GPoint(-77.85831451,40.78253937),"
State College Area High School
653 Westerly Pkwy
State College, PA 16801

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("State College Area High School",'State_College=' + State_College.length); Wingate[Wingate.length] = createMarker(new GPoint(-77.81133270,40.93569183),"
Wingate Elementary School
751 S Eagle Valley Rd
Wingate, PA 16823

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Wingate Elementary School",'Wingate=' + Wingate.length); State_College[State_College.length] = createMarker(new GPoint(-77.88800800,40.80569600),"
Wonderland Charter School
2112 Sandy Drive
State College, PA 16803

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Wonderland Charter School",'State_College=' + State_College.length); State_College[State_College.length] = createMarker(new GPoint(-10.00000000,10.00000000),"
Young Scholars Of Central Pa C
Po Box
State College, PA 16804

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Young Scholars Of Central Pa C",'State_College=' + State_College.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(Bellefonte); map.removeOverlays(Blanchard); map.removeOverlays(Centre_Hall); map.removeOverlays(Howard); map.removeOverlays(Philipsburg); map.removeOverlays(Pine_Grove_Mills); map.removeOverlays(Pleasant_Gap); map.removeOverlays(Port_Matilda); map.removeOverlays(Rebersburg); map.removeOverlays(Snow_Shoe); map.removeOverlays(Spring_Mills); map.removeOverlays(State_College); map.removeOverlays(Wingate); 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(Wingate);map.removeOverlays(Bellefonte); map.removeOverlays(Blanchard); map.removeOverlays(Centre_Hall); map.removeOverlays(Howard); map.removeOverlays(Philipsburg); map.removeOverlays(Pine_Grove_Mills); map.removeOverlays(Pleasant_Gap); map.removeOverlays(Port_Matilda); map.removeOverlays(Rebersburg); map.removeOverlays(Snow_Shoe); map.removeOverlays(Spring_Mills); map.removeOverlays(State_College); map.removeOverlays(Wingate); map.addOverlays(Bellefonte); centerByArray(Bellefonte, false, false); cntMarker += Bellefonte.length; map.addOverlays(Blanchard); centerByArray(Blanchard, false, false); cntMarker += Blanchard.length; map.addOverlays(Centre_Hall); centerByArray(Centre_Hall, false, false); cntMarker += Centre_Hall.length; map.addOverlays(Howard); centerByArray(Howard, false, false); cntMarker += Howard.length; map.addOverlays(Philipsburg); centerByArray(Philipsburg, false, false); cntMarker += Philipsburg.length; map.addOverlays(Pine_Grove_Mills); centerByArray(Pine_Grove_Mills, false, false); cntMarker += Pine_Grove_Mills.length; map.addOverlays(Pleasant_Gap); centerByArray(Pleasant_Gap, false, false); cntMarker += Pleasant_Gap.length; map.addOverlays(Port_Matilda); centerByArray(Port_Matilda, false, false); cntMarker += Port_Matilda.length; map.addOverlays(Rebersburg); centerByArray(Rebersburg, false, false); cntMarker += Rebersburg.length; map.addOverlays(Snow_Shoe); centerByArray(Snow_Shoe, false, false); cntMarker += Snow_Shoe.length; map.addOverlays(Spring_Mills); centerByArray(Spring_Mills, false, false); cntMarker += Spring_Mills.length; map.addOverlays(State_College); centerByArray(State_College, false, false); cntMarker += State_College.length; map.addOverlays(Wingate); centerByArray(Wingate, false, false); cntMarker += Wingate.length; centerByArray(Wingate,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'); } }