function addMarkers(){ mySelect = document.getElementById('selection'); Herculaneum = [];Hillsboro = [];Arnold = [];Festus = [];House_Springs = [];Imperial = [];High_Ridge = [];De_Soto = [];Crystal_City = [];mySelect.options[mySelect.options.length] = new Option("Arnold schools",'all=Arnold'); mySelect.options[mySelect.options.length] = new Option("Crystal City schools",'all=Crystal_City'); mySelect.options[mySelect.options.length] = new Option("De Soto schools",'all=De_Soto'); mySelect.options[mySelect.options.length] = new Option("Festus schools",'all=Festus'); mySelect.options[mySelect.options.length] = new Option("Herculaneum schools",'all=Herculaneum'); mySelect.options[mySelect.options.length] = new Option("High Ridge schools",'all=High_Ridge'); mySelect.options[mySelect.options.length] = new Option("Hillsboro schools",'all=Hillsboro'); mySelect.options[mySelect.options.length] = new Option("House Springs schools",'all=House_Springs'); mySelect.options[mySelect.options.length] = new Option("Imperial schools",'all=Imperial'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Herculaneum[Herculaneum.length] = createMarker(new GPoint(-90.39197500,38.25927900),"
Christ The Vine Lutheran School
Po Box 487
Herculaneum, MO 63048
Co-ed school, PK-3
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Christ The Vine Lutheran School",'Herculaneum=' + Herculaneum.length); Hillsboro[Hillsboro.length] = createMarker(new GPoint(-90.52183300,38.29978600),"
Christian Outreach School
4450 Outreach Drive
Hillsboro, MO 63050
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Christian Outreach School",'Hillsboro=' + Hillsboro.length); Hillsboro[Hillsboro.length] = createMarker(new GPoint(-90.56631500,38.23295000),"
Good Shepherd Catholic School
701 3rd Street
Hillsboro, MO 63050
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Good Shepherd Catholic School",'Hillsboro=' + Hillsboro.length); Arnold[Arnold.length] = createMarker(new GPoint(-90.39020000,38.43040000),"
Holy Child School
2316 Church Road 2322 Tenbrook
Arnold, MO 63010
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Holy Child School",'Arnold=' + Arnold.length); Festus[Festus.length] = createMarker(new GPoint(-90.41848700,38.22576200),"
Our Lady Catholic School
1599 Saint Marys Lane
Festus, MO 63028
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Our Lady Catholic School",'Festus=' + Festus.length); House_Springs[House_Springs.length] = createMarker(new GPoint(-90.58879600,38.40668800),"
Our Lady Queen Of Peace School
4675 Notre Dame Drive
House Springs, MO 63051
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Our Lady Queen Of Peace School",'House_Springs=' + House_Springs.length); Arnold[Arnold.length] = createMarker(new GPoint(-90.39912400,38.44267900),"
People's Christian Academy
1770 Missouri State Road
Arnold, MO 63010
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("People's Christian Academy",'Arnold=' + Arnold.length); Festus[Festus.length] = createMarker(new GPoint(-90.38824100,38.22175900),"
Sacred Heart School
201 Brierton Lane
Festus, MO 63028
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Sacred Heart School",'Festus=' + Festus.length); Imperial[Imperial.length] = createMarker(new GPoint(-90.39106200,38.36889600),"
St. Joseph School
6024 Old Antonia Road
Imperial, MO 63052
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Joseph School",'Imperial=' + Imperial.length); High_Ridge[High_Ridge.length] = createMarker(new GPoint(-90.53627200,38.45899000),"
St Anthony School
3005 High Ridge Blvd
High Ridge, MO 63049
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St Anthony School",'High_Ridge=' + High_Ridge.length); Imperial[Imperial.length] = createMarker(new GPoint(-90.48802900,38.41707300),"
St John School
4525 Highway 21
Imperial, MO 63052
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St John School",'Imperial=' + Imperial.length); Arnold[Arnold.length] = createMarker(new GPoint(-90.37885700,38.41418600),"
St Johns Lutheran School
3511 Jeffco Boulevard
Arnold, MO 63010
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St Johns Lutheran School",'Arnold=' + Arnold.length); De_Soto[De_Soto.length] = createMarker(new GPoint(-90.55855700,38.13567600),"
St Rose Of Lima School
523 S 4th Street
De Soto, MO 63020
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St Rose Of Lima School",'De_Soto=' + De_Soto.length); Festus[Festus.length] = createMarker(new GPoint(-90.40553800,38.22675800),"
Twin City Christian Academy
723 Horine Road
Festus, MO 63028
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Twin City Christian Academy",'Festus=' + Festus.length); Crystal_City[Crystal_City.length] = createMarker(new GPoint(-90.38250000,38.22810000),"
Wee Care Learning Center
P.o. Box 680
Crystal City, MO 63019
Co-ed school, KG-KG
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Wee Care Learning Center",'Crystal_City=' + Crystal_City.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(Arnold); map.removeOverlays(Crystal_City); map.removeOverlays(De_Soto); map.removeOverlays(Festus); map.removeOverlays(Herculaneum); map.removeOverlays(High_Ridge); map.removeOverlays(Hillsboro); map.removeOverlays(House_Springs); map.removeOverlays(Imperial); 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(Herculaneum);map.removeOverlays(Arnold); map.removeOverlays(Crystal_City); map.removeOverlays(De_Soto); map.removeOverlays(Festus); map.removeOverlays(Herculaneum); map.removeOverlays(High_Ridge); map.removeOverlays(Hillsboro); map.removeOverlays(House_Springs); map.removeOverlays(Imperial); map.addOverlays(Arnold); centerByArray(Arnold, false, false); cntMarker += Arnold.length; map.addOverlays(Crystal_City); centerByArray(Crystal_City, false, false); cntMarker += Crystal_City.length; map.addOverlays(De_Soto); centerByArray(De_Soto, false, false); cntMarker += De_Soto.length; map.addOverlays(Festus); centerByArray(Festus, false, false); cntMarker += Festus.length; map.addOverlays(Herculaneum); centerByArray(Herculaneum, false, false); cntMarker += Herculaneum.length; map.addOverlays(High_Ridge); centerByArray(High_Ridge, false, false); cntMarker += High_Ridge.length; map.addOverlays(Hillsboro); centerByArray(Hillsboro, false, false); cntMarker += Hillsboro.length; map.addOverlays(House_Springs); centerByArray(House_Springs, false, false); cntMarker += House_Springs.length; map.addOverlays(Imperial); centerByArray(Imperial, false, false); cntMarker += Imperial.length; centerByArray(Herculaneum,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; }