function addMarkers(){ mySelect = document.getElementById('selection'); Belleville = [];Dupo = [];Fairview_Heights = [];East_Saint_Louis = [];East_St_Louis = [];Fairview_Hgts = [];mySelect.options[mySelect.options.length] = new Option("Belleville schools",'all=Belleville'); mySelect.options[mySelect.options.length] = new Option("Dupo schools",'all=Dupo'); mySelect.options[mySelect.options.length] = new Option("East Saint Louis schools",'all=East_Saint_Louis'); mySelect.options[mySelect.options.length] = new Option("East St Louis schools",'all=East_St_Louis'); mySelect.options[mySelect.options.length] = new Option("Fairview Heights schools",'all=Fairview_Heights'); mySelect.options[mySelect.options.length] = new Option("Fairview Hgts schools",'all=Fairview_Hgts'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Belleville[Belleville.length] = createMarker(new GPoint(-90.03267200,38.54689700),"
Althoff Catholic High School
5401 West Main Street
Belleville, IL 62226
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Althoff Catholic High School",'Belleville=' + Belleville.length); 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); Fairview_Heights[Fairview_Heights.length] = createMarker(new GPoint(-89.98469400,38.57735900),"
Berean Christian School
5100 North Illinois St.
Fairview Heights, IL 62208
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Berean Christian School",'Fairview_Heights=' + Fairview_Heights.length); Belleville[Belleville.length] = createMarker(new GPoint(-89.96919100,38.52313500),"
Calvary Baptist Academy
423 Lucinda Avenue
Belleville, IL 62221
Co-ed school, 1-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Calvary Baptist Academy",'Belleville=' + Belleville.length); East_Saint_Louis[East_Saint_Louis.length] = createMarker(new GPoint(-90.06873500,38.58438800),"
Childrens Center For Behavioral Development
353 N 88th Street
East Saint Louis, IL 62203
Co-ed school, 3-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Childrens Center For Behavioral Development",'East_Saint_Louis=' + East_Saint_Louis.length); Belleville[Belleville.length] = createMarker(new GPoint(-89.97880600,38.51373700),"
Faith Baptist School
405 E Main Street
Belleville, IL 62220
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Faith Baptist School",'Belleville=' + Belleville.length); Belleville[Belleville.length] = createMarker(new GPoint(-89.98088700,38.50260000),"
The Governor French Academy
219 West Main Street
Belleville, IL 62220
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("The Governor French Academy",'Belleville=' + Belleville.length); East_St_Louis[East_St_Louis.length] = createMarker(new GPoint(-90.12397900,38.61430700),"
Hazel Bland Promise Center
2900 State St
East St Louis, IL 62205
Co-ed school, Ungraded
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Hazel Bland Promise Center",'East_St_Louis=' + East_St_Louis.length); Fairview_Hgts[Fairview_Hgts.length] = createMarker(new GPoint(-89.99435200,38.58220400),"
Illinois Center For Autism
548 S Ruby Lane
Fairview Hgts, IL 62208
Co-ed school, NS-NS
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Illinois Center For Autism",'Fairview_Hgts=' + Fairview_Hgts.length); Belleville[Belleville.length] = createMarker(new GPoint(-89.96689100,38.49978600),"
Mamie O Stookey School
1306 Wabash Ave
Belleville, IL 62220
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Mamie O Stookey School",'Belleville=' + Belleville.length); East_St_Louis[East_St_Louis.length] = createMarker(new GPoint(-90.15400000,38.62230000),"
Vincent Gray Alternative H School
P O Box 428
East St Louis, IL 62202
Co-ed school, Ungraded
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Vincent Gray Alternative H School",'East_St_Louis=' + East_St_Louis.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/////2/' + showArray); map.removeOverlays(Belleville); map.removeOverlays(Dupo); map.removeOverlays(East_Saint_Louis); map.removeOverlays(East_St_Louis); map.removeOverlays(Fairview_Heights); map.removeOverlays(Fairview_Hgts); 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(Belleville);map.removeOverlays(Belleville); map.removeOverlays(Dupo); map.removeOverlays(East_Saint_Louis); map.removeOverlays(East_St_Louis); map.removeOverlays(Fairview_Heights); map.removeOverlays(Fairview_Hgts); map.addOverlays(Belleville); centerByArray(Belleville, false, false); cntMarker += Belleville.length; map.addOverlays(Dupo); centerByArray(Dupo, false, false); cntMarker += Dupo.length; map.addOverlays(East_Saint_Louis); centerByArray(East_Saint_Louis, false, false); cntMarker += East_Saint_Louis.length; map.addOverlays(East_St_Louis); centerByArray(East_St_Louis, false, false); cntMarker += East_St_Louis.length; map.addOverlays(Fairview_Heights); centerByArray(Fairview_Heights, false, false); cntMarker += Fairview_Heights.length; map.addOverlays(Fairview_Hgts); centerByArray(Fairview_Hgts, false, false); cntMarker += Fairview_Hgts.length; centerByArray(Belleville,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=2&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; }