function addMarkers(){ mySelect = document.getElementById('selection'); Mahanoy_City = [];Pottsville = [];Pine_Grove = [];Frackville = [];Minersville = [];Hegins = [];Girardville = [];Mc_Alisterville = [];Mcadoo = [];Tamaqua = [];Orwigsburg = [];Port_Carbon = [];Schuylkill_Haven = [];mySelect.options[mySelect.options.length] = new Option("Frackville schools",'all=Frackville'); mySelect.options[mySelect.options.length] = new Option("Girardville schools",'all=Girardville'); mySelect.options[mySelect.options.length] = new Option("Hegins schools",'all=Hegins'); mySelect.options[mySelect.options.length] = new Option("Mahanoy City schools",'all=Mahanoy_City'); mySelect.options[mySelect.options.length] = new Option("Mc Alisterville schools",'all=Mc_Alisterville'); mySelect.options[mySelect.options.length] = new Option("Mcadoo schools",'all=Mcadoo'); mySelect.options[mySelect.options.length] = new Option("Minersville schools",'all=Minersville'); mySelect.options[mySelect.options.length] = new Option("Orwigsburg schools",'all=Orwigsburg'); mySelect.options[mySelect.options.length] = new Option("Pine Grove schools",'all=Pine_Grove'); mySelect.options[mySelect.options.length] = new Option("Port Carbon schools",'all=Port_Carbon'); mySelect.options[mySelect.options.length] = new Option("Pottsville schools",'all=Pottsville'); mySelect.options[mySelect.options.length] = new Option("Schuylkill Haven schools",'all=Schuylkill_Haven'); mySelect.options[mySelect.options.length] = new Option("Tamaqua schools",'all=Tamaqua'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Mahanoy_City[Mahanoy_City.length] = createMarker(new GPoint(-76.14448600,40.81148700),"
Academy Of The Blessed Virgin Mary
29 S Catawissa Street
Mahanoy City, PA 17948
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Academy Of The Blessed Virgin Mary",'Mahanoy_City=' + Mahanoy_City.length); Pottsville[Pottsville.length] = createMarker(new GPoint(-76.19950300,40.68195300),"
All Saints Catholic Elementary School
112 S 7th Street
Pottsville, PA 17901
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("All Saints Catholic Elementary School",'Pottsville=' + Pottsville.length); Pine_Grove[Pine_Grove.length] = createMarker(new GPoint(-76.30563100,40.57112100),"
Flat Hill Amish Parochial School
245 Flat Hill Road
Pine Grove, PA 17963
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Flat Hill Amish Parochial School",'Pine_Grove=' + Pine_Grove.length); Frackville[Frackville.length] = createMarker(new GPoint(-76.23121800,40.78691500),"
Frackville Learning Center
25 E Spring Street
Frackville, PA 17931
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Frackville Learning Center",'Frackville=' + Frackville.length); Minersville[Minersville.length] = createMarker(new GPoint(-76.26161700,40.68745300),"
Good Shepherd Regional Catholic School
301 Heffner Street
Minersville, PA 17954
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Good Shepherd Regional Catholic School",'Minersville=' + Minersville.length); Minersville[Minersville.length] = createMarker(new GPoint(-76.26704400,40.69242100),"
Good Shepherd Regional School
538 Sunbury Street
Minersville, PA 17954
Co-ed school, K-3
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Good Shepherd Regional School",'Minersville=' + Minersville.length); Hegins[Hegins.length] = createMarker(new GPoint(-76.47101100,40.66107500),"
Hegins Valley Mennonite School
176 East Mountain Road
Hegins, PA 17938
Co-ed school, 1-10
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Hegins Valley Mennonite School",'Hegins=' + Hegins.length); Frackville[Frackville.length] = createMarker(new GPoint(-76.22770200,40.78552600),"
Holy Family School
29 S Broad Mountain Avenue
Frackville, PA 17931
Co-ed school, K-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Holy Family School",'Frackville=' + Frackville.length); Girardville[Girardville.length] = createMarker(new GPoint(-76.28791800,40.79120000),"
Immaculate Heart School
20 South Richard Street
Girardville, PA 17935
Co-ed school, K-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Immaculate Heart School",'Girardville=' + Girardville.length); Mc_Alisterville[Mc_Alisterville.length] = createMarker(new GPoint(-77.27460000,40.63630000),"
Laurel Run School
Rr 2 Box 128
Mc Alisterville, PA 17049
Co-ed school, 1-9
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Laurel Run School",'Mc_Alisterville=' + Mc_Alisterville.length); Mcadoo[Mcadoo.length] = createMarker(new GPoint(-75.99200700,40.90261300),"
Mcadoo Catholic Elementary School
35 N Cleveland Street
Mcadoo, PA 18237
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Mcadoo Catholic Elementary School",'Mcadoo=' + Mcadoo.length); Tamaqua[Tamaqua.length] = createMarker(new GPoint(-75.98678700,40.77619300),"
New England Valley Mennonite
1020 Evergreen Drive
Tamaqua, PA 18252
Co-ed school, 1-10
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("New England Valley Mennonite",'Tamaqua=' + Tamaqua.length); Orwigsburg[Orwigsburg.length] = createMarker(new GPoint(-76.09471200,40.64115600),"
New Life Christian Academy
10 Hollenbush Lane
Orwigsburg, PA 17961
Co-ed school, K-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("New Life Christian Academy",'Orwigsburg=' + Orwigsburg.length); Pottsville[Pottsville.length] = createMarker(new GPoint(-76.22123200,40.67527600),"
St. Joseph Center For Special L
2075 W Norwegian Street
Pottsville, PA 17901
Co-ed school, NS-NS
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Joseph Center For Special L",'Pottsville=' + Pottsville.length); Port_Carbon[Port_Carbon.length] = createMarker(new GPoint(-76.16436300,40.69623000),"
St. Stephen Regional School
214 Valley Street
Port Carbon, PA 17965
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Stephen Regional School",'Port_Carbon=' + Port_Carbon.length); Schuylkill_Haven[Schuylkill_Haven.length] = createMarker(new GPoint(-76.16150100,40.63538300),"
St Ambrose School
302 Randel Street
Schuylkill Haven, PA 17972
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St Ambrose School",'Schuylkill_Haven=' + Schuylkill_Haven.length); Tamaqua[Tamaqua.length] = createMarker(new GPoint(-75.97492900,40.79679000),"
St Jerome Regional School
250 W Broad Street
Tamaqua, PA 18252
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St Jerome Regional School",'Tamaqua=' + Tamaqua.length); Minersville[Minersville.length] = createMarker(new GPoint(-76.25789800,40.69422500),"
St Nicholas School
515 N Front Street
Minersville, PA 17954
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St Nicholas School",'Minersville=' + Minersville.length); Pottsville[Pottsville.length] = createMarker(new GPoint(-76.19475900,40.68343200),"
Trinity Center For Children
200 S 2nd Street
Pottsville, PA 17901
Co-ed school, PK-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Trinity Center For Children",'Pottsville=' + Pottsville.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/////1/' + showArray); map.removeOverlays(Frackville); map.removeOverlays(Girardville); map.removeOverlays(Hegins); map.removeOverlays(Mahanoy_City); map.removeOverlays(Mc_Alisterville); map.removeOverlays(Mcadoo); map.removeOverlays(Minersville); map.removeOverlays(Orwigsburg); map.removeOverlays(Pine_Grove); map.removeOverlays(Port_Carbon); map.removeOverlays(Pottsville); map.removeOverlays(Schuylkill_Haven); map.removeOverlays(Tamaqua); 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(Mahanoy_City);map.removeOverlays(Frackville); map.removeOverlays(Girardville); map.removeOverlays(Hegins); map.removeOverlays(Mahanoy_City); map.removeOverlays(Mc_Alisterville); map.removeOverlays(Mcadoo); map.removeOverlays(Minersville); map.removeOverlays(Orwigsburg); map.removeOverlays(Pine_Grove); map.removeOverlays(Port_Carbon); map.removeOverlays(Pottsville); map.removeOverlays(Schuylkill_Haven); map.removeOverlays(Tamaqua); map.addOverlays(Frackville); centerByArray(Frackville, false, false); cntMarker += Frackville.length; map.addOverlays(Girardville); centerByArray(Girardville, false, false); cntMarker += Girardville.length; map.addOverlays(Hegins); centerByArray(Hegins, false, false); cntMarker += Hegins.length; map.addOverlays(Mahanoy_City); centerByArray(Mahanoy_City, false, false); cntMarker += Mahanoy_City.length; map.addOverlays(Mc_Alisterville); centerByArray(Mc_Alisterville, false, false); cntMarker += Mc_Alisterville.length; map.addOverlays(Mcadoo); centerByArray(Mcadoo, false, false); cntMarker += Mcadoo.length; map.addOverlays(Minersville); centerByArray(Minersville, false, false); cntMarker += Minersville.length; map.addOverlays(Orwigsburg); centerByArray(Orwigsburg, false, false); cntMarker += Orwigsburg.length; map.addOverlays(Pine_Grove); centerByArray(Pine_Grove, false, false); cntMarker += Pine_Grove.length; map.addOverlays(Port_Carbon); centerByArray(Port_Carbon, false, false); cntMarker += Port_Carbon.length; map.addOverlays(Pottsville); centerByArray(Pottsville, false, false); cntMarker += Pottsville.length; map.addOverlays(Schuylkill_Haven); centerByArray(Schuylkill_Haven, false, false); cntMarker += Schuylkill_Haven.length; map.addOverlays(Tamaqua); centerByArray(Tamaqua, false, false); cntMarker += Tamaqua.length; centerByArray(Mahanoy_City,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=1&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; }