function addMarkers(){ mySelect = document.getElementById('selection'); Williamsport = [];Cogan_Station = [];Montoursville = [];Duboistown = [];Jersey_Shore = [];Allenwood = [];mySelect.options[mySelect.options.length] = new Option("Allenwood schools",'all=Allenwood'); mySelect.options[mySelect.options.length] = new Option("Cogan Station schools",'all=Cogan_Station'); mySelect.options[mySelect.options.length] = new Option("Duboistown schools",'all=Duboistown'); mySelect.options[mySelect.options.length] = new Option("Jersey Shore schools",'all=Jersey_Shore'); mySelect.options[mySelect.options.length] = new Option("Montoursville schools",'all=Montoursville'); mySelect.options[mySelect.options.length] = new Option("Williamsport schools",'all=Williamsport'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Williamsport[Williamsport.length] = createMarker(new GPoint(-76.99591300,41.24897500),"
Bishop Neumann High School
901 Penn Street
Williamsport, PA 17701
Co-ed school, 7-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bishop Neumann High School",'Williamsport=' + Williamsport.length); Williamsport[Williamsport.length] = createMarker(new GPoint(-77.04792400,41.25156700),"
Bostleys Preschool Learning Center
1743 Dewey Avenue
Williamsport, PA 17701
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bostleys Preschool Learning Center",'Williamsport=' + Williamsport.length); Cogan_Station[Cogan_Station.length] = createMarker(new GPoint(-77.06810000,41.31770000),"
Christian School At Cogan Station
Po Box 230
Cogan Station, PA 17728
Co-ed school, PK-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Christian School At Cogan Station",'Cogan_Station=' + Cogan_Station.length); Montoursville[Montoursville.length] = createMarker(new GPoint(-76.90093100,41.24611000),"
Fairfield Private Academic School
1504 Broad Street
Montoursville, PA 17754
Co-ed school, K-7
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Fairfield Private Academic School",'Montoursville=' + Montoursville.length); Williamsport[Williamsport.length] = createMarker(new GPoint(-77.13473300,41.17587800),"
Immaculate Conception School
6101 Jacks Hollow Road
Williamsport, PA 17702
Co-ed school, K-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Immaculate Conception School",'Williamsport=' + Williamsport.length); Williamsport[Williamsport.length] = createMarker(new GPoint(-76.97876500,41.26173700),"
Magic Years Child Care And Lea
1355 Four Mile Drive
Williamsport, PA 17701
Co-ed school, PK-KG
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Magic Years Child Care And Lea",'Williamsport=' + Williamsport.length); Duboistown[Duboistown.length] = createMarker(new GPoint(-77.00276600,41.22836200),"
Paddington Station
126 Summer Street
Duboistown, PA 17702
Co-ed school, NS-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Paddington Station",'Duboistown=' + Duboistown.length); Jersey_Shore[Jersey_Shore.length] = createMarker(new GPoint(-77.19823900,41.14376300),"
Pine Woods School
Quarry Road.
Jersey Shore, PA 17740
Co-ed school, 1-9
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Pine Woods School",'Jersey_Shore=' + Jersey_Shore.length); Williamsport[Williamsport.length] = createMarker(new GPoint(-76.97085800,41.25456900),"
St Anns School
1225 Northway Road
Williamsport, PA 17701
Co-ed school, PK-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St Anns School",'Williamsport=' + Williamsport.length); Williamsport[Williamsport.length] = createMarker(new GPoint(-76.99781600,41.24678000),"
St Boniface School
710 Franklin Street
Williamsport, PA 17701
Co-ed school, PK-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St Boniface School",'Williamsport=' + Williamsport.length); Williamsport[Williamsport.length] = createMarker(new GPoint(-77.01438800,41.24044600),"
St Joseph School
711 West Edwin Street
Williamsport, PA 17701
Co-ed school, PK-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St Joseph School",'Williamsport=' + Williamsport.length); Williamsport[Williamsport.length] = createMarker(new GPoint(-77.05008200,41.23809300),"
West Branch School
755 Moore Avenue
Williamsport, PA 17701
Co-ed school, KG-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("West Branch School",'Williamsport=' + Williamsport.length); Allenwood[Allenwood.length] = createMarker(new GPoint(-77.03004700,41.12817700),"
White Deer Parochial School
15866 S State Route 44
Allenwood, PA 17810
Co-ed school, 1-9
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("White Deer Parochial School",'Allenwood=' + Allenwood.length); Williamsport[Williamsport.length] = createMarker(new GPoint(-77.00820000,41.23932600),"
Ymca Kindergarten
320 Elmira Street
Williamsport, PA 17701
Co-ed school, KG-KG
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Ymca Kindergarten",'Williamsport=' + Williamsport.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,11); /* 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/////3/' + showArray); map.removeOverlays(Allenwood); map.removeOverlays(Cogan_Station); map.removeOverlays(Duboistown); map.removeOverlays(Jersey_Shore); map.removeOverlays(Montoursville); map.removeOverlays(Williamsport); 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(Williamsport);map.removeOverlays(Allenwood); map.removeOverlays(Cogan_Station); map.removeOverlays(Duboistown); map.removeOverlays(Jersey_Shore); map.removeOverlays(Montoursville); map.removeOverlays(Williamsport); map.addOverlays(Allenwood); centerByArray(Allenwood, false, false); cntMarker += Allenwood.length; map.addOverlays(Cogan_Station); centerByArray(Cogan_Station, false, false); cntMarker += Cogan_Station.length; map.addOverlays(Duboistown); centerByArray(Duboistown, false, false); cntMarker += Duboistown.length; map.addOverlays(Jersey_Shore); centerByArray(Jersey_Shore, false, false); cntMarker += Jersey_Shore.length; map.addOverlays(Montoursville); centerByArray(Montoursville, false, false); cntMarker += Montoursville.length; map.addOverlays(Williamsport); centerByArray(Williamsport, false, false); cntMarker += Williamsport.length; centerByArray(Williamsport,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'); //window.open('/map.php?type=1&schools=&school_level=3&radius=&zipcode=&school_type_search=&school_type_code='); } } function createMarker(point, label, icon) { var marker = new GMarker(point, icon); var html = label; GEvent.addListener(marker, "click", function() { marker.openInfoWindowHtml(html); }); return marker; }