function addMarkers(){ mySelect = document.getElementById('selection'); Kankakee = [];Bourbonnais = [];Bradley = [];Momence = [];Chebanse = [];mySelect.options[mySelect.options.length] = new Option("Bourbonnais schools",'all=Bourbonnais'); mySelect.options[mySelect.options.length] = new Option("Bradley schools",'all=Bradley'); mySelect.options[mySelect.options.length] = new Option("Chebanse schools",'all=Chebanse'); mySelect.options[mySelect.options.length] = new Option("Kankakee schools",'all=Kankakee'); mySelect.options[mySelect.options.length] = new Option("Momence schools",'all=Momence'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Kankakee[Kankakee.length] = createMarker(new GPoint(-87.86238400,41.11609100),"
Aquinas Catholic Academy
366 E Hickory Street
Kankakee, IL 60901
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Aquinas Catholic Academy",'Kankakee=' + Kankakee.length); Bourbonnais[Bourbonnais.length] = createMarker(new GPoint(-87.87780000,41.16930000),"
Gospel Assembly Christian School
1706-a West Rte 102
Bourbonnais, IL 60914
Co-ed school, 1-10
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Gospel Assembly Christian School",'Bourbonnais=' + Bourbonnais.length); Kankakee[Kankakee.length] = createMarker(new GPoint(-87.82783500,41.09908400),"
Grace Baptist Academy
2499 Waldron Road
Kankakee, IL 60901
Co-ed school, 5-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Grace Baptist Academy",'Kankakee=' + Kankakee.length); Kankakee[Kankakee.length] = createMarker(new GPoint(-87.88556900,41.11716200),"
Kankakee Trinity Academy
410 S Small Ave
Kankakee, IL 60901
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Kankakee Trinity Academy",'Kankakee=' + Kankakee.length); Bourbonnais[Bourbonnais.length] = createMarker(new GPoint(-87.87299500,41.16736600),"
Kankakee Valley Montessori School
165 Mohawk Drive
Bourbonnais, IL 60914
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Kankakee Valley Montessori School",'Bourbonnais=' + Bourbonnais.length); Bourbonnais[Bourbonnais.length] = createMarker(new GPoint(-87.87730600,41.16561000),"
Kindercare Learning Center #300924
150 W John Casey Road
Bourbonnais, IL 60914
Co-ed school, NS-PK
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Kindercare Learning Center #300924",'Bourbonnais=' + Bourbonnais.length); Bourbonnais[Bourbonnais.length] = createMarker(new GPoint(-87.87586500,41.15699700),"
Maternity BVM School
324 E Marsile St
Bourbonnais, IL 60914
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Maternity BVM School",'Bourbonnais=' + Bourbonnais.length); Kankakee[Kankakee.length] = createMarker(new GPoint(-87.87568100,41.14913900),"
Provena Fortin Villa Learning Center
1025 N Washington Avenue
Kankakee, IL 60901
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Provena Fortin Villa Learning Center",'Kankakee=' + Kankakee.length); Bradley[Bradley.length] = createMarker(new GPoint(-87.86898300,41.14479300),"
St. Joseph School
247 N Center Avenue
Bradley, IL 60915
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Joseph School",'Bradley=' + Bradley.length); Kankakee[Kankakee.length] = createMarker(new GPoint(-87.87952900,41.11142400),"
St. Martin Of Tours
907 S 9th Ave
Kankakee, IL 60901
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Martin Of Tours",'Kankakee=' + Kankakee.length); Momence[Momence.length] = createMarker(new GPoint(-87.66752900,41.16396300),"
St. Patrick Academy
404 W 2nd Street
Momence, IL 60954
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Patrick Academy",'Momence=' + Momence.length); Kankakee[Kankakee.length] = createMarker(new GPoint(-87.88962400,41.12416300),"
St. Paul's Lutheran School
1580 Butterfield Trail
Kankakee, IL 60901
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Paul's Lutheran School",'Kankakee=' + Kankakee.length); Momence[Momence.length] = createMarker(new GPoint(-87.67497300,41.16433700),"
Unity Christian School
920 W 2nd Street
Momence, IL 60954
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Unity Christian School",'Momence=' + Momence.length); Chebanse[Chebanse.length] = createMarker(new GPoint(-87.90976700,41.00622700),"
Zion Lutheran School
160 Concordia Drive
Chebanse, IL 60922
Co-ed school, PK-7
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Zion Lutheran School",'Chebanse=' + Chebanse.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(Bourbonnais); map.removeOverlays(Bradley); map.removeOverlays(Chebanse); map.removeOverlays(Kankakee); map.removeOverlays(Momence); 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(Kankakee);map.removeOverlays(Bourbonnais); map.removeOverlays(Bradley); map.removeOverlays(Chebanse); map.removeOverlays(Kankakee); map.removeOverlays(Momence); map.addOverlays(Bourbonnais); centerByArray(Bourbonnais, false, false); cntMarker += Bourbonnais.length; map.addOverlays(Bradley); centerByArray(Bradley, false, false); cntMarker += Bradley.length; map.addOverlays(Chebanse); centerByArray(Chebanse, false, false); cntMarker += Chebanse.length; map.addOverlays(Kankakee); centerByArray(Kankakee, false, false); cntMarker += Kankakee.length; map.addOverlays(Momence); centerByArray(Momence, false, false); cntMarker += Momence.length; centerByArray(Kankakee,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; }