function addMarkers(){ mySelect = document.getElementById('selection'); Liberty = [];Kansas_City = [];Holt = [];Gladstone = [];Avondale = [];mySelect.options[mySelect.options.length] = new Option("Avondale schools",'all=Avondale'); mySelect.options[mySelect.options.length] = new Option("Gladstone schools",'all=Gladstone'); mySelect.options[mySelect.options.length] = new Option("Holt schools",'all=Holt'); mySelect.options[mySelect.options.length] = new Option("Kansas City schools",'all=Kansas_City'); mySelect.options[mySelect.options.length] = new Option("Liberty schools",'all=Liberty'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Liberty[Liberty.length] = createMarker(new GPoint(-94.41690000,39.26010000),"
Childrens Montessori Center
Po Box 426
Liberty, MO 64069
Co-ed school, NS-PK
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Childrens Montessori Center",'Liberty=' + Liberty.length); Kansas_City[Kansas_City.length] = createMarker(new GPoint(-94.56705300,39.18005900),"
Covenant Memorial Baptist Day School
1115 Ne 47th Street
Kansas City, MO 64116
Co-ed school, K-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Covenant Memorial Baptist Day School",'Kansas_City=' + Kansas_City.length); Kansas_City[Kansas_City.length] = createMarker(new GPoint(-94.52127600,39.19573400),"
Eagle Heights Christian School
5600 N Brighton Avenue
Kansas City, MO 64119
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Eagle Heights Christian School",'Kansas_City=' + Kansas_City.length); Kansas_City[Kansas_City.length] = createMarker(new GPoint(-94.49527600,39.17083700),"
Faith Academy
4300 N Corrington Avenue
Kansas City, MO 64117
Co-ed school, PK-9
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Faith Academy",'Kansas_City=' + Kansas_City.length); Holt[Holt.length] = createMarker(new GPoint(-94.36949900,39.41812400),"
Northern Hills Christian School
17211 Ne 180th Street
Holt, MO 64048
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Northern Hills Christian School",'Holt=' + Holt.length); Gladstone[Gladstone.length] = createMarker(new GPoint(-94.57365000,39.22205400),"
Oakhill Day School
7019 N Cherry St
Gladstone, MO 64118
Co-ed school, NS-7
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Oakhill Day School",'Gladstone=' + Gladstone.length); Avondale[Avondale.length] = createMarker(new GPoint(-94.54612200,39.15493700),"
Outreach Christian Ed
2900 Ne Cates Street
Avondale, MO 64117
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Outreach Christian Ed",'Avondale=' + Avondale.length); Holt[Holt.length] = createMarker(new GPoint(-94.35920000,39.43860000),"
Prairie Church School
Po Box 253
Holt, MO 64048
Co-ed school, KG-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Prairie Church School",'Holt=' + Holt.length); Gladstone[Gladstone.length] = createMarker(new GPoint(-94.53628600,39.20975500),"
St. Andrew The Apostle Parish School
6415 Ne Antioch Road
Gladstone, MO 64119
Co-ed school, PK-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Andrew The Apostle Parish School",'Gladstone=' + Gladstone.length); Kansas_City[Kansas_City.length] = createMarker(new GPoint(-94.57060400,39.21023700),"
St. Charles Borromeo School
804 Ne Shady Lane Drive
Kansas City, MO 64118
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Charles Borromeo School",'Kansas_City=' + Kansas_City.length); Kansas_City[Kansas_City.length] = createMarker(new GPoint(-94.56226200,39.17186300),"
St. Patrick School
1401 Ne 42nd Ter
Kansas City, MO 64116
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Patrick School",'Kansas_City=' + Kansas_City.length); Kansas_City[Kansas_City.length] = createMarker(new GPoint(-94.56142500,39.17210500),"
St. Pius X High School
1500 NE 42nd Terrace
Kansas City, MO 64116
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Pius X High School",'Kansas_City=' + Kansas_City.length); Liberty[Liberty.length] = createMarker(new GPoint(-94.45605800,39.24291400),"
St James School
309 S Stewart Road
Liberty, MO 64068
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St James School",'Liberty=' + Liberty.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(Avondale); map.removeOverlays(Gladstone); map.removeOverlays(Holt); map.removeOverlays(Kansas_City); map.removeOverlays(Liberty); 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(Liberty);map.removeOverlays(Avondale); map.removeOverlays(Gladstone); map.removeOverlays(Holt); map.removeOverlays(Kansas_City); map.removeOverlays(Liberty); map.addOverlays(Avondale); centerByArray(Avondale, false, false); cntMarker += Avondale.length; map.addOverlays(Gladstone); centerByArray(Gladstone, false, false); cntMarker += Gladstone.length; map.addOverlays(Holt); centerByArray(Holt, false, false); cntMarker += Holt.length; map.addOverlays(Kansas_City); centerByArray(Kansas_City, false, false); cntMarker += Kansas_City.length; map.addOverlays(Liberty); centerByArray(Liberty, false, false); cntMarker += Liberty.length; centerByArray(Liberty,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; }