function addMarkers(){ mySelect = document.getElementById('selection'); Mercer = [];Jackson_Center = [];Greenville = [];Fredonia = [];Grove_City = [];Farrell = [];Hermitage = [];Hadley = [];Sharon = [];Stoneboro = [];mySelect.options[mySelect.options.length] = new Option("Farrell schools",'all=Farrell'); mySelect.options[mySelect.options.length] = new Option("Fredonia schools",'all=Fredonia'); mySelect.options[mySelect.options.length] = new Option("Greenville schools",'all=Greenville'); mySelect.options[mySelect.options.length] = new Option("Grove City schools",'all=Grove_City'); mySelect.options[mySelect.options.length] = new Option("Hadley schools",'all=Hadley'); mySelect.options[mySelect.options.length] = new Option("Hermitage schools",'all=Hermitage'); mySelect.options[mySelect.options.length] = new Option("Jackson Center schools",'all=Jackson_Center'); mySelect.options[mySelect.options.length] = new Option("Mercer schools",'all=Mercer'); mySelect.options[mySelect.options.length] = new Option("Sharon schools",'all=Sharon'); mySelect.options[mySelect.options.length] = new Option("Stoneboro schools",'all=Stoneboro'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Mercer[Mercer.length] = createMarker(new GPoint(-80.23998100,41.29216700),"
Calvary Christian Academy
1033 N Perry Highway
Mercer, PA 16137
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Calvary Christian Academy",'Mercer=' + Mercer.length); Jackson_Center[Jackson_Center.length] = createMarker(new GPoint(-80.15486600,41.29997500),"
Dutch Lane Amish School
47 Dutch Lane
Jackson Center, PA 16133
Co-ed school, 1-9
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Dutch Lane Amish School",'Jackson_Center=' + Jackson_Center.length); Greenville[Greenville.length] = createMarker(new GPoint(-80.29793800,41.36390600),"
Fairview Amish School
565 Donation Road
Greenville, PA 16125
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Fairview Amish School",'Greenville=' + Greenville.length); Fredonia[Fredonia.length] = createMarker(new GPoint(-80.25784100,41.32883100),"
Green Meadow Parochial School
38 Breese Road
Fredonia, PA 16124
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Green Meadow Parochial School",'Fredonia=' + Fredonia.length); Grove_City[Grove_City.length] = createMarker(new GPoint(-80.08496100,41.16544100),"
Grove City Christian Academy
Po Box 7
Grove City, PA 16127
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Grove City Christian Academy",'Grove_City=' + Grove_City.length); Greenville[Greenville.length] = createMarker(new GPoint(-80.45677600,41.40119800),"
Living Word Christian School
21 S. Maysville Rd.
Greenville, PA 16125
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Living Word Christian School",'Greenville=' + Greenville.length); Farrell[Farrell.length] = createMarker(new GPoint(-80.49293100,41.21466300),"
Msgr Geno J Monti School
1225 Union Street
Farrell, PA 16121
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Msgr Geno J Monti School",'Farrell=' + Farrell.length); Hermitage[Hermitage.length] = createMarker(new GPoint(-80.46688700,41.23943700),"
Notre Dame School
2335 Highland Road
Hermitage, PA 16148
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Notre Dame School",'Hermitage=' + Hermitage.length); Mercer[Mercer.length] = createMarker(new GPoint(-80.17400700,41.29942800),"
Orchard Hill School
449a Orchard Road
Mercer, PA 16137
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Orchard Hill School",'Mercer=' + Mercer.length); Hadley[Hadley.length] = createMarker(new GPoint(-80.19480300,41.44439200),"
Pilgrim Fellowship School
93 Milledgeville Road
Hadley, PA 16130
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Pilgrim Fellowship School",'Hadley=' + Hadley.length); Fredonia[Fredonia.length] = createMarker(new GPoint(-80.27320000,41.32530000),"
Pine Hollow School
110 Mccartney Road
Fredonia, PA 16124
Co-ed school, 1-9
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Pine Hollow School",'Fredonia=' + Fredonia.length); Sharon[Sharon.length] = createMarker(new GPoint(-80.49498800,41.23286300),"
St. Joseph Elementary School
760 E State Street
Sharon, PA 16146
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Joseph Elementary School",'Sharon=' + Sharon.length); Greenville[Greenville.length] = createMarker(new GPoint(-80.39707700,41.40616600),"
St. Michael School
80 North High Street
Greenville, PA 16125
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Michael School",'Greenville=' + Greenville.length); Stoneboro[Stoneboro.length] = createMarker(new GPoint(-80.20535300,41.34385200),"
Shady Maple School
93 School Road
Stoneboro, PA 16153
Co-ed school, 1-9
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Shady Maple School",'Stoneboro=' + Stoneboro.length); Sharon[Sharon.length] = createMarker(new GPoint(-80.49916300,41.23569100),"
Shenango Valley Faith Academy
192 North Oakland Avenue
Sharon, PA 16146
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Shenango Valley Faith Academy",'Sharon=' + Sharon.length); Hermitage[Hermitage.length] = createMarker(new GPoint(-80.44103700,41.25251200),"
Shenango Valley Faith Academy
1455 N Keel Ridge Road
Hermitage, PA 16148
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Shenango Valley Faith Academy",'Hermitage=' + Hermitage.length); Stoneboro[Stoneboro.length] = createMarker(new GPoint(-80.12719100,41.33833700),"
Stoneboro Wesleyan School
947 Fredonia Road
Stoneboro, PA 16153
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Stoneboro Wesleyan School",'Stoneboro=' + Stoneboro.length); Sharon[Sharon.length] = createMarker(new GPoint(-80.49321700,41.22333700),"
Sts. Peter & Paul Lutheran Preschool
699 Stambaugh Ave
Sharon, PA 16146
Co-ed school, PK-KG
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Sts. Peter & Paul Lutheran Preschool",'Sharon=' + Sharon.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(Farrell); map.removeOverlays(Fredonia); map.removeOverlays(Greenville); map.removeOverlays(Grove_City); map.removeOverlays(Hadley); map.removeOverlays(Hermitage); map.removeOverlays(Jackson_Center); map.removeOverlays(Mercer); map.removeOverlays(Sharon); map.removeOverlays(Stoneboro); 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(Mercer);map.removeOverlays(Farrell); map.removeOverlays(Fredonia); map.removeOverlays(Greenville); map.removeOverlays(Grove_City); map.removeOverlays(Hadley); map.removeOverlays(Hermitage); map.removeOverlays(Jackson_Center); map.removeOverlays(Mercer); map.removeOverlays(Sharon); map.removeOverlays(Stoneboro); map.addOverlays(Farrell); centerByArray(Farrell, false, false); cntMarker += Farrell.length; map.addOverlays(Fredonia); centerByArray(Fredonia, false, false); cntMarker += Fredonia.length; map.addOverlays(Greenville); centerByArray(Greenville, false, false); cntMarker += Greenville.length; map.addOverlays(Grove_City); centerByArray(Grove_City, false, false); cntMarker += Grove_City.length; map.addOverlays(Hadley); centerByArray(Hadley, false, false); cntMarker += Hadley.length; map.addOverlays(Hermitage); centerByArray(Hermitage, false, false); cntMarker += Hermitage.length; map.addOverlays(Jackson_Center); centerByArray(Jackson_Center, false, false); cntMarker += Jackson_Center.length; map.addOverlays(Mercer); centerByArray(Mercer, false, false); cntMarker += Mercer.length; map.addOverlays(Sharon); centerByArray(Sharon, false, false); cntMarker += Sharon.length; map.addOverlays(Stoneboro); centerByArray(Stoneboro, false, false); cntMarker += Stoneboro.length; centerByArray(Mercer,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; }