function addMarkers(){ mySelect = document.getElementById('selection'); Dupo = [];East_Peoria = [];Carbondale = [];Bourbonnais = [];Decatur = [];Homewood = [];Chicago = [];Roberts = [];Robbins = [];Peoria = [];Forrest = [];Pana = [];Pinckneyville = [];Riverdale = [];Zion = [];Bellwood = [];mySelect.options[mySelect.options.length] = new Option("Bellwood schools",'all=Bellwood'); mySelect.options[mySelect.options.length] = new Option("Bourbonnais schools",'all=Bourbonnais'); mySelect.options[mySelect.options.length] = new Option("Carbondale schools",'all=Carbondale'); mySelect.options[mySelect.options.length] = new Option("Chicago schools",'all=Chicago'); mySelect.options[mySelect.options.length] = new Option("Decatur schools",'all=Decatur'); mySelect.options[mySelect.options.length] = new Option("Dupo schools",'all=Dupo'); mySelect.options[mySelect.options.length] = new Option("East Peoria schools",'all=East_Peoria'); mySelect.options[mySelect.options.length] = new Option("Forrest schools",'all=Forrest'); mySelect.options[mySelect.options.length] = new Option("Homewood schools",'all=Homewood'); mySelect.options[mySelect.options.length] = new Option("Pana schools",'all=Pana'); mySelect.options[mySelect.options.length] = new Option("Peoria schools",'all=Peoria'); mySelect.options[mySelect.options.length] = new Option("Pinckneyville schools",'all=Pinckneyville'); mySelect.options[mySelect.options.length] = new Option("Riverdale schools",'all=Riverdale'); mySelect.options[mySelect.options.length] = new Option("Robbins schools",'all=Robbins'); mySelect.options[mySelect.options.length] = new Option("Roberts schools",'all=Roberts'); mySelect.options[mySelect.options.length] = new Option("Zion schools",'all=Zion'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Dupo[Dupo.length] = createMarker(new GPoint(-90.20917300,38.51574300),"
Apostolic Learning Academy
400 Louisa Avenue
Dupo, IL 62239
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Apostolic Learning Academy",'Dupo=' + Dupo.length); East_Peoria[East_Peoria.length] = createMarker(new GPoint(-89.53920000,40.69260000),"
Christian Life Academy
Po Box 2070
East Peoria, IL 61611
Co-ed school, 5-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Christian Life Academy",'East_Peoria=' + East_Peoria.length); Carbondale[Carbondale.length] = createMarker(new GPoint(-89.27271700,37.73096500),"
Ed Resource Center
7076 Old Highway 13
Carbondale, IL 62901
Co-ed school, 1-10
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Ed Resource Center",'Carbondale=' + Carbondale.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); Decatur[Decatur.length] = createMarker(new GPoint(-88.90105700,39.82841700),"
Hillside Bethel Christian School
3575 E Greenhill Road
Decatur, IL 62521
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Hillside Bethel Christian School",'Decatur=' + Decatur.length); Homewood[Homewood.length] = createMarker(new GPoint(-87.69418200,41.55119200),"
Homewood Community Academy
18620 Kedzie Avenue
Homewood, IL 60430
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Homewood Community Academy",'Homewood=' + Homewood.length); Chicago[Chicago.length] = createMarker(new GPoint(-87.67950600,41.75006200),"
Liberty Temple Full Gospel Academy
2255 W 79th Street
Chicago, IL 60620
Co-ed school, PK-5
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Liberty Temple Full Gospel Academy",'Chicago=' + Chicago.length); Roberts[Roberts.length] = createMarker(new GPoint(-88.17970000,40.62360000),"
Living Word Christian School
110 E State Rte 54
Roberts, IL 60962
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Living Word Christian School",'Roberts=' + Roberts.length); Robbins[Robbins.length] = createMarker(new GPoint(-87.71000000,41.64320000),"
Mary P Moody Christian Academy
Po Box 145 3811 W 139th St
Robbins, IL 60472
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Mary P Moody Christian Academy",'Robbins=' + Robbins.length); Chicago[Chicago.length] = createMarker(new GPoint(-87.55988300,41.70986300),"
Mighty God Christian Academy
10200 South Torrence
Chicago, IL 60617
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Mighty God Christian Academy",'Chicago=' + Chicago.length); Peoria[Peoria.length] = createMarker(new GPoint(-89.64906600,40.67506300),"
New Life Christian Academy
3510 W Malone Street
Peoria, IL 61605
Co-ed school, 1-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("New Life Christian Academy",'Peoria=' + Peoria.length); Forrest[Forrest.length] = createMarker(new GPoint(-88.40611900,40.75387000),"
Open Door Of Hope Christian Academy
Rr 2 Box 40
Forrest, IL 61741
All-girls school, 7-7
[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Open Door Of Hope Christian Academy",'Forrest=' + Forrest.length); Pana[Pana.length] = createMarker(new GPoint(-89.09029400,39.39396800),"
Pana Christian Academy
409 W Orange Street
Pana, IL 62557
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Pana Christian Academy",'Pana=' + Pana.length); Pinckneyville[Pinckneyville.length] = createMarker(new GPoint(-89.37949300,38.07747000),"
Pinckneyville Christian Academy
310 South First Street
Pinckneyville, IL 62274
Co-ed school, 3-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Pinckneyville Christian Academy",'Pinckneyville=' + Pinckneyville.length); Riverdale[Riverdale.length] = createMarker(new GPoint(-87.61738300,41.64846100),"
The Promise Christian Academy
13560 S Indiana Avenue
Riverdale, IL 60827
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("The Promise Christian Academy",'Riverdale=' + Riverdale.length); Chicago[Chicago.length] = createMarker(new GPoint(-87.61512800,41.75009500),"
Rescue Missionary Christian Church Ctr & School
7956 S King Drive
Chicago, IL 60619
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Rescue Missionary Christian Church Ctr & School",'Chicago=' + Chicago.length); Zion[Zion.length] = createMarker(new GPoint(-87.87303300,42.47248200),"
Spirit Of Life Christian Ed Un
1222 Lorelei Drive
Zion, IL 60099
Co-ed school, 7-11
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Spirit Of Life Christian Ed Un",'Zion=' + Zion.length); Bellwood[Bellwood.length] = createMarker(new GPoint(-87.86147600,41.88555700),"
True Vine Christian Academy
400 23rd Avenue
Bellwood, IL 60104
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("True Vine Christian Academy",'Bellwood=' + Bellwood.length); map.removeOverlays(Bellwood); map.removeOverlays(Bourbonnais); map.removeOverlays(Carbondale); map.removeOverlays(Chicago); map.removeOverlays(Decatur); map.removeOverlays(Dupo); map.removeOverlays(East_Peoria); map.removeOverlays(Forrest); map.removeOverlays(Homewood); map.removeOverlays(Pana); map.removeOverlays(Peoria); map.removeOverlays(Pinckneyville); map.removeOverlays(Riverdale); map.removeOverlays(Robbins); map.removeOverlays(Roberts); map.removeOverlays(Zion); setTimeout(function(){map.addOverlays(Bellwood)},1000); setTimeout(function(){map.addOverlays(Bourbonnais)},1000); setTimeout(function(){map.addOverlays(Carbondale)},1000); setTimeout(function(){map.addOverlays(Chicago)},1000); setTimeout(function(){map.addOverlays(Decatur)},1000); setTimeout(function(){map.addOverlays(Dupo)},1000); setTimeout(function(){map.addOverlays(East_Peoria)},1000); setTimeout(function(){map.addOverlays(Forrest)},1000); setTimeout(function(){map.addOverlays(Homewood)},1000); setTimeout(function(){map.addOverlays(Pana)},1000); setTimeout(function(){map.addOverlays(Peoria)},1000); setTimeout(function(){map.addOverlays(Pinckneyville)},1000); setTimeout(function(){map.addOverlays(Riverdale)},1000); setTimeout(function(){map.addOverlays(Robbins)},1000); setTimeout(function(){map.addOverlays(Roberts)},1000); setTimeout(function(){map.addOverlays(Zion)},1000); maxLng = -87.55988300; maxLat = 42.47248200; minLng = -90.20917300; minLat = 37.73096500; reCenterMap(); } // 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//////' + showArray); map.removeOverlays(Bellwood); map.removeOverlays(Bourbonnais); map.removeOverlays(Carbondale); map.removeOverlays(Chicago); map.removeOverlays(Decatur); map.removeOverlays(Dupo); map.removeOverlays(East_Peoria); map.removeOverlays(Forrest); map.removeOverlays(Homewood); map.removeOverlays(Pana); map.removeOverlays(Peoria); map.removeOverlays(Pinckneyville); map.removeOverlays(Riverdale); map.removeOverlays(Robbins); map.removeOverlays(Roberts); map.removeOverlays(Zion); 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(Dupo);map.removeOverlays(Bellwood); map.removeOverlays(Bourbonnais); map.removeOverlays(Carbondale); map.removeOverlays(Chicago); map.removeOverlays(Decatur); map.removeOverlays(Dupo); map.removeOverlays(East_Peoria); map.removeOverlays(Forrest); map.removeOverlays(Homewood); map.removeOverlays(Pana); map.removeOverlays(Peoria); map.removeOverlays(Pinckneyville); map.removeOverlays(Riverdale); map.removeOverlays(Robbins); map.removeOverlays(Roberts); map.removeOverlays(Zion); map.addOverlays(Bellwood); centerByArray(Bellwood, false, false); cntMarker += Bellwood.length; map.addOverlays(Bourbonnais); centerByArray(Bourbonnais, false, false); cntMarker += Bourbonnais.length; map.addOverlays(Carbondale); centerByArray(Carbondale, false, false); cntMarker += Carbondale.length; map.addOverlays(Chicago); centerByArray(Chicago, false, false); cntMarker += Chicago.length; map.addOverlays(Decatur); centerByArray(Decatur, false, false); cntMarker += Decatur.length; map.addOverlays(Dupo); centerByArray(Dupo, false, false); cntMarker += Dupo.length; map.addOverlays(East_Peoria); centerByArray(East_Peoria, false, false); cntMarker += East_Peoria.length; map.addOverlays(Forrest); centerByArray(Forrest, false, false); cntMarker += Forrest.length; map.addOverlays(Homewood); centerByArray(Homewood, false, false); cntMarker += Homewood.length; map.addOverlays(Pana); centerByArray(Pana, false, false); cntMarker += Pana.length; map.addOverlays(Peoria); centerByArray(Peoria, false, false); cntMarker += Peoria.length; map.addOverlays(Pinckneyville); centerByArray(Pinckneyville, false, false); cntMarker += Pinckneyville.length; map.addOverlays(Riverdale); centerByArray(Riverdale, false, false); cntMarker += Riverdale.length; map.addOverlays(Robbins); centerByArray(Robbins, false, false); cntMarker += Robbins.length; map.addOverlays(Roberts); centerByArray(Roberts, false, false); cntMarker += Roberts.length; map.addOverlays(Zion); centerByArray(Zion, false, false); cntMarker += Zion.length; centerByArray(Dupo,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///9730,8692,8616,8953,8718,33869,8558,33522,33806,9019,9113,8876,9228,9730,8692,8616,8859,8953,9149,8718,33869,8558,8748,33806,9019,9113,9694,8918,8876,/all'); //window.open('/map.php?type=2&schools=9730,8692,8616,8953,8718,33869,8558,33522,33806,9019,9113,8876,9228,9730,8692,8616,8859,8953,9149,8718,33869,8558,8748,33806,9019,9113,9694,8918,8876,&school_level=&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; }