function addMarkers(){ mySelect = document.getElementById('selection'); Yellow_Springs = [];Beavercreek = [];Fairborn = [];Xenia = [];Dayton = [];mySelect.options[mySelect.options.length] = new Option("Beavercreek schools",'all=Beavercreek'); mySelect.options[mySelect.options.length] = new Option("Dayton schools",'all=Dayton'); mySelect.options[mySelect.options.length] = new Option("Fairborn schools",'all=Fairborn'); mySelect.options[mySelect.options.length] = new Option("Xenia schools",'all=Xenia'); mySelect.options[mySelect.options.length] = new Option("Yellow Springs schools",'all=Yellow_Springs'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Yellow_Springs[Yellow_Springs.length] = createMarker(new GPoint(-83.88394800,39.79469000),"
The Antioch School
Po Box 242
Yellow Springs, OH 45387
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("The Antioch School",'Yellow_Springs=' + Yellow_Springs.length); Beavercreek[Beavercreek.length] = createMarker(new GPoint(-84.05630100,39.74414600),"
Beavercreek Christian Learning Center
1850 N Fairfield Road
Beavercreek, OH 45432
Co-ed school, NS-PK
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Beavercreek Christian Learning Center",'Beavercreek=' + Beavercreek.length); Fairborn[Fairborn.length] = createMarker(new GPoint(-84.01962600,39.80486800),"
Bethlehem Lutheran School
1240 S Maple Avenue
Fairborn, OH 45324
Co-ed school, PK-5
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bethlehem Lutheran School",'Fairborn=' + Fairborn.length); Beavercreek[Beavercreek.length] = createMarker(new GPoint(-84.04492800,39.73546000),"
Bright Beginnings Elementary School
2973 Lantz Road
Beavercreek, OH 45434
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bright Beginnings Elementary School",'Beavercreek=' + Beavercreek.length); Beavercreek[Beavercreek.length] = createMarker(new GPoint(-84.07215000,39.72579000),"
Dayton Islamic School
3662 E Patterson Road
Beavercreek, OH 45430
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Dayton Islamic School",'Beavercreek=' + Beavercreek.length); Beavercreek[Beavercreek.length] = createMarker(new GPoint(-84.05866400,39.70561000),"
Discovery House Montessori School
570 Rustic Trail
Beavercreek, OH 45434
Co-ed school, PK-3
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Discovery House Montessori School",'Beavercreek=' + Beavercreek.length); Fairborn[Fairborn.length] = createMarker(new GPoint(-83.96624900,39.86055700),"
Enon Montessori
8001 Dayton Springfield Road
Fairborn, OH 45324
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Enon Montessori",'Fairborn=' + Fairborn.length); Beavercreek[Beavercreek.length] = createMarker(new GPoint(-84.03256100,39.71878200),"
Evergreen Children's Center Inc.
2659 Dayton Xenia Road
Beavercreek, OH 45434
Co-ed school, NS-PK
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Evergreen Children's Center Inc.",'Beavercreek=' + Beavercreek.length); Fairborn[Fairborn.length] = createMarker(new GPoint(-84.02742700,39.82370700),"
Fairborn Preschool & Day Care Center
100 N Broad Street
Fairborn, OH 45324
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Fairborn Preschool & Day Care Center",'Fairborn=' + Fairborn.length); Fairborn[Fairborn.length] = createMarker(new GPoint(-84.01652800,39.83639900),"
First Baptist Church Wee School
1167 Highview Drive
Fairborn, OH 45324
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("First Baptist Church Wee School",'Fairborn=' + Fairborn.length); Xenia[Xenia.length] = createMarker(new GPoint(-83.90650600,39.65109200),"
Freedom Christian Academy
1067 Us Route 68 South
Xenia, OH 45385
Co-ed school, 1-3
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Freedom Christian Academy",'Xenia=' + Xenia.length); Dayton[Dayton.length] = createMarker(new GPoint(-84.17770000,39.75780000),"
Mini University-wright State University
3640 Colonel Glenn Highway
Dayton, OH 45435
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Mini University-wright State University",'Dayton=' + Dayton.length); Beavercreek[Beavercreek.length] = createMarker(new GPoint(-84.05755900,39.73191200),"
St. Luke Catholic Elementary School
1442 N Fairfield Road
Beavercreek, OH 45432
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Luke Catholic Elementary School",'Beavercreek=' + Beavercreek.length); Xenia[Xenia.length] = createMarker(new GPoint(-83.94767000,39.70403600),"
St Brigid School
312 Fairground Road
Xenia, OH 45385
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St Brigid School",'Xenia=' + Xenia.length); Xenia[Xenia.length] = createMarker(new GPoint(-83.92313300,39.66981500),"
Xenia Christian High School
1101 Wesley Ave
Xenia, OH 45385
Co-ed school, 7-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Xenia Christian High School",'Xenia=' + Xenia.length); Xenia[Xenia.length] = createMarker(new GPoint(-83.95153700,39.68181900),"
Xenia Nazarene Christian School
1204 West 2nd Street
Xenia, OH 45385
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Xenia Nazarene Christian School",'Xenia=' + Xenia.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(Beavercreek); map.removeOverlays(Dayton); map.removeOverlays(Fairborn); map.removeOverlays(Xenia); map.removeOverlays(Yellow_Springs); 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(Yellow_Springs);map.removeOverlays(Beavercreek); map.removeOverlays(Dayton); map.removeOverlays(Fairborn); map.removeOverlays(Xenia); map.removeOverlays(Yellow_Springs); map.addOverlays(Beavercreek); centerByArray(Beavercreek, false, false); cntMarker += Beavercreek.length; map.addOverlays(Dayton); centerByArray(Dayton, false, false); cntMarker += Dayton.length; map.addOverlays(Fairborn); centerByArray(Fairborn, false, false); cntMarker += Fairborn.length; map.addOverlays(Xenia); centerByArray(Xenia, false, false); cntMarker += Xenia.length; map.addOverlays(Yellow_Springs); centerByArray(Yellow_Springs, false, false); cntMarker += Yellow_Springs.length; centerByArray(Yellow_Springs,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; }