function addMarkers(){ mySelect = document.getElementById('selection'); Imperial = [];Ellsworth = [];Fredericktown = [];Houston = [];Burgettstown = [];Washington = [];West_Middletown = [];Mcmurray = [];Lawrence = [];Donora = [];Prosperity = [];Canonsburg = [];mySelect.options[mySelect.options.length] = new Option("Burgettstown schools",'all=Burgettstown'); mySelect.options[mySelect.options.length] = new Option("Canonsburg schools",'all=Canonsburg'); mySelect.options[mySelect.options.length] = new Option("Donora schools",'all=Donora'); mySelect.options[mySelect.options.length] = new Option("Ellsworth schools",'all=Ellsworth'); mySelect.options[mySelect.options.length] = new Option("Fredericktown schools",'all=Fredericktown'); mySelect.options[mySelect.options.length] = new Option("Houston schools",'all=Houston'); mySelect.options[mySelect.options.length] = new Option("Imperial schools",'all=Imperial'); mySelect.options[mySelect.options.length] = new Option("Lawrence schools",'all=Lawrence'); mySelect.options[mySelect.options.length] = new Option("Mcmurray schools",'all=Mcmurray'); mySelect.options[mySelect.options.length] = new Option("Prosperity schools",'all=Prosperity'); mySelect.options[mySelect.options.length] = new Option("Washington schools",'all=Washington'); mySelect.options[mySelect.options.length] = new Option("West Middletown schools",'all=West_Middletown'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Imperial[Imperial.length] = createMarker(new GPoint(-80.25950000,40.45330000),"
Abundant Life Academy
Po Box 222
Imperial, PA 15126
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Abundant Life Academy",'Imperial=' + Imperial.length); Ellsworth[Ellsworth.length] = createMarker(new GPoint(-80.01980000,40.10720000),"
Ave Maria School
Po Box 590 - Oak Street
Ellsworth, PA 15331
Co-ed school, PK-5
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Ave Maria School",'Ellsworth=' + Ellsworth.length); Fredericktown[Fredericktown.length] = createMarker(new GPoint(-79.99765100,40.01243400),"
Calvary Chapel Christian School
Po Box 19
Fredericktown, PA 15333
Co-ed school, PK-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Calvary Chapel Christian School",'Fredericktown=' + Fredericktown.length); Houston[Houston.length] = createMarker(new GPoint(-80.21762900,40.23096500),"
Central Christian Academy
145 Mcgovern Road
Houston, PA 15342
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Central Christian Academy",'Houston=' + Houston.length); Burgettstown[Burgettstown.length] = createMarker(new GPoint(-80.47495700,40.34628700),"
Cornerstone Mennonite School
698 Cedar Grove Road
Burgettstown, PA 15021
Co-ed school, 1-10
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Cornerstone Mennonite School",'Burgettstown=' + Burgettstown.length); Washington[Washington.length] = createMarker(new GPoint(-80.23114100,40.17529100),"
Faith Christian School
524 East Beau Street
Washington, PA 15301
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Faith Christian School",'Washington=' + Washington.length); Washington[Washington.length] = createMarker(new GPoint(-80.24604900,40.16742500),"
The Family Y Children's Center
42 W Maiden St
Washington, PA 15301
Co-ed school, KG-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("The Family Y Children's Center",'Washington=' + Washington.length); West_Middletown[West_Middletown.length] = createMarker(new GPoint(-80.42670000,40.24210000),"
Grace Bible Christian School
Po Box 42 Rt 844
West Middletown, PA 15379
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Grace Bible Christian School",'West_Middletown=' + West_Middletown.length); Washington[Washington.length] = createMarker(new GPoint(-80.26040700,40.18068300),"
Gwens Day Care And Montessori
860 Allison Avenue
Washington, PA 15301
Co-ed school, PK-2
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Gwens Day Care And Montessori",'Washington=' + Washington.length); Washington[Washington.length] = createMarker(new GPoint(-80.25364200,40.19357800),"
Holy Family Learning
1530 Hillcrest Street
Washington, PA 15301
Co-ed school, 2-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Holy Family Learning",'Washington=' + Washington.length); Washington[Washington.length] = createMarker(new GPoint(-80.24894500,40.17289600),"
John F Kennedy Catholic School
111 W Spruce Street
Washington, PA 15301
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("John F Kennedy Catholic School",'Washington=' + Washington.length); Mcmurray[Mcmurray.length] = createMarker(new GPoint(-80.07685900,40.28761900),"
Just About Kids
732 E Mcmurray Road
Mcmurray, PA 15317
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Just About Kids",'Mcmurray=' + Mcmurray.length); Lawrence[Lawrence.length] = createMarker(new GPoint(-80.12610000,40.30410000),"
Kids World Inc
101 Springfield Dr
Lawrence, PA 15055
Co-ed school, PK-KG
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Kids World Inc",'Lawrence=' + Lawrence.length); Donora[Donora.length] = createMarker(new GPoint(-79.87014700,40.17516400),"
Madonna Catholic Regional School
1 Park Mnr
Donora, PA 15033
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Madonna Catholic Regional School",'Donora=' + Donora.length); Washington[Washington.length] = createMarker(new GPoint(-80.24807100,40.18274400),"
Magic Years Childcare & Learning Center
63 Wilson Avenue 67
Washington, PA 15301
Co-ed school, K-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Magic Years Childcare & Learning Center",'Washington=' + Washington.length); Washington[Washington.length] = createMarker(new GPoint(-80.25876900,40.17751300),"
Rainbows End Learning Center
655 Jefferson Ave
Washington, PA 15301
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Rainbows End Learning Center",'Washington=' + Washington.length); Washington[Washington.length] = createMarker(new GPoint(-80.24970400,40.17034200),"
Smart Kids Child Care
161 West Beau Street
Washington, PA 15301
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Smart Kids Child Care",'Washington=' + Washington.length); Prosperity[Prosperity.length] = createMarker(new GPoint(-80.33794900,40.00813900),"
Southwood School
110 Old Concord Road
Prosperity, PA 15329
All-boys school, K-12
[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Southwood School",'Prosperity=' + Prosperity.length); Canonsburg[Canonsburg.length] = createMarker(new GPoint(-80.19417900,40.25693700),"
St Patrick School
200 Murdock Street
Canonsburg, PA 15317
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St Patrick School",'Canonsburg=' + Canonsburg.length); Burgettstown[Burgettstown.length] = createMarker(new GPoint(-80.46093200,40.42026400),"
Tri-state Christian Academy
750 Steubenville Pike
Burgettstown, PA 15021
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Tri-state Christian Academy",'Burgettstown=' + Burgettstown.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(Burgettstown); map.removeOverlays(Canonsburg); map.removeOverlays(Donora); map.removeOverlays(Ellsworth); map.removeOverlays(Fredericktown); map.removeOverlays(Houston); map.removeOverlays(Imperial); map.removeOverlays(Lawrence); map.removeOverlays(Mcmurray); map.removeOverlays(Prosperity); map.removeOverlays(Washington); map.removeOverlays(West_Middletown); 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(Imperial);map.removeOverlays(Burgettstown); map.removeOverlays(Canonsburg); map.removeOverlays(Donora); map.removeOverlays(Ellsworth); map.removeOverlays(Fredericktown); map.removeOverlays(Houston); map.removeOverlays(Imperial); map.removeOverlays(Lawrence); map.removeOverlays(Mcmurray); map.removeOverlays(Prosperity); map.removeOverlays(Washington); map.removeOverlays(West_Middletown); map.addOverlays(Burgettstown); centerByArray(Burgettstown, false, false); cntMarker += Burgettstown.length; map.addOverlays(Canonsburg); centerByArray(Canonsburg, false, false); cntMarker += Canonsburg.length; map.addOverlays(Donora); centerByArray(Donora, false, false); cntMarker += Donora.length; map.addOverlays(Ellsworth); centerByArray(Ellsworth, false, false); cntMarker += Ellsworth.length; map.addOverlays(Fredericktown); centerByArray(Fredericktown, false, false); cntMarker += Fredericktown.length; map.addOverlays(Houston); centerByArray(Houston, false, false); cntMarker += Houston.length; map.addOverlays(Imperial); centerByArray(Imperial, false, false); cntMarker += Imperial.length; map.addOverlays(Lawrence); centerByArray(Lawrence, false, false); cntMarker += Lawrence.length; map.addOverlays(Mcmurray); centerByArray(Mcmurray, false, false); cntMarker += Mcmurray.length; map.addOverlays(Prosperity); centerByArray(Prosperity, false, false); cntMarker += Prosperity.length; map.addOverlays(Washington); centerByArray(Washington, false, false); cntMarker += Washington.length; map.addOverlays(West_Middletown); centerByArray(West_Middletown, false, false); cntMarker += West_Middletown.length; centerByArray(Imperial,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; }