function addMarkers(){ mySelect = document.getElementById('selection'); South_Roxana = [];Alton = [];Granite_City = [];Collinsville = [];Wood_River = [];Glen_Carbon = [];Edwardsville = [];mySelect.options[mySelect.options.length] = new Option("Alton schools",'all=Alton'); mySelect.options[mySelect.options.length] = new Option("Collinsville schools",'all=Collinsville'); mySelect.options[mySelect.options.length] = new Option("Edwardsville schools",'all=Edwardsville'); mySelect.options[mySelect.options.length] = new Option("Glen Carbon schools",'all=Glen_Carbon'); mySelect.options[mySelect.options.length] = new Option("Granite City schools",'all=Granite_City'); mySelect.options[mySelect.options.length] = new Option("South Roxana schools",'all=South_Roxana'); mySelect.options[mySelect.options.length] = new Option("Wood River schools",'all=Wood_River'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); South_Roxana[South_Roxana.length] = createMarker(new GPoint(-90.05870000,38.82810000),"
Bethel Christian Academy
Po Box 535 1417 Herbert St
South Roxana, IL 62087
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bethel Christian Academy",'South_Roxana=' + South_Roxana.length); Alton[Alton.length] = createMarker(new GPoint(-90.19393000,38.90427300),"
Catholic Childrens Home
1400 State Street
Alton, IL 62002
Co-ed school, 1-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Catholic Childrens Home",'Alton=' + Alton.length); Granite_City[Granite_City.length] = createMarker(new GPoint(-90.07070300,38.72975400),"
Central Baptist School
3940 Highway 111
Granite City, IL 62040
Co-ed school, 1-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Central Baptist School",'Granite_City=' + Granite_City.length); Collinsville[Collinsville.length] = createMarker(new GPoint(-89.97793600,38.68248700),"
Collinsville Christian Academy
1203 Vandalia Street
Collinsville, IL 62234
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Collinsville Christian Academy",'Collinsville=' + Collinsville.length); Granite_City[Granite_City.length] = createMarker(new GPoint(-90.14603100,38.69978200),"
Coordinated Youth & Human Services
2016 Madison Avenue
Granite City, IL 62040
Co-ed school, 5-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Coordinated Youth & Human Services",'Granite_City=' + Granite_City.length); Wood_River[Wood_River.length] = createMarker(new GPoint(-90.08301900,38.86363500),"
Faith Christian Academy
Po Box 376
Wood River, IL 62095
Co-ed school, 10-11
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Faith Christian Academy",'Wood_River=' + Wood_River.length); South_Roxana[South_Roxana.length] = createMarker(new GPoint(-90.05970000,38.82620000),"
Hope Christian Academy
Box 518
South Roxana, IL 62087
Co-ed school, 1-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Hope Christian Academy",'South_Roxana=' + South_Roxana.length); Glen_Carbon[Glen_Carbon.length] = createMarker(new GPoint(-89.97099600,38.76185300),"
Lahr-well Academy
131 N Main St, PO Box 401
Glen Carbon, IL 62034
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Lahr-well Academy",'Glen_Carbon=' + Glen_Carbon.length); Alton[Alton.length] = createMarker(new GPoint(-90.15600000,38.91060000),"
Marquette Catholic High School
219 E 4th Street
Alton, IL 62002
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Marquette Catholic High School",'Alton=' + Alton.length); Edwardsville[Edwardsville.length] = createMarker(new GPoint(-89.96886000,38.78627100),"
Metro-east Lutheran High School
6305 Center Grove Road
Edwardsville, IL 62025
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Metro-east Lutheran High School",'Edwardsville=' + Edwardsville.length); Alton[Alton.length] = createMarker(new GPoint(-90.14527700,38.90721700),"
Mississippi Valley Christian School
2009 Seminary Street
Alton, IL 62002
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Mississippi Valley Christian School",'Alton=' + Alton.length); Granite_City[Granite_City.length] = createMarker(new GPoint(-90.12175000,38.76197400),"
Rivers of Life Christian School
3237 W Chain of Rocks
Granite City, IL 62040
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Rivers of Life Christian School",'Granite_City=' + Granite_City.length); Alton[Alton.length] = createMarker(new GPoint(-90.09859000,38.86543000),"
Westminster Christian Academy-river Bend
1145 College Avenue
Alton, IL 62002
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Westminster Christian Academy-river Bend",'Alton=' + Alton.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(Alton); map.removeOverlays(Collinsville); map.removeOverlays(Edwardsville); map.removeOverlays(Glen_Carbon); map.removeOverlays(Granite_City); map.removeOverlays(South_Roxana); map.removeOverlays(Wood_River); 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(South_Roxana);map.removeOverlays(Alton); map.removeOverlays(Collinsville); map.removeOverlays(Edwardsville); map.removeOverlays(Glen_Carbon); map.removeOverlays(Granite_City); map.removeOverlays(South_Roxana); map.removeOverlays(Wood_River); map.addOverlays(Alton); centerByArray(Alton, false, false); cntMarker += Alton.length; map.addOverlays(Collinsville); centerByArray(Collinsville, false, false); cntMarker += Collinsville.length; map.addOverlays(Edwardsville); centerByArray(Edwardsville, false, false); cntMarker += Edwardsville.length; map.addOverlays(Glen_Carbon); centerByArray(Glen_Carbon, false, false); cntMarker += Glen_Carbon.length; map.addOverlays(Granite_City); centerByArray(Granite_City, false, false); cntMarker += Granite_City.length; map.addOverlays(South_Roxana); centerByArray(South_Roxana, false, false); cntMarker += South_Roxana.length; map.addOverlays(Wood_River); centerByArray(Wood_River, false, false); cntMarker += Wood_River.length; centerByArray(South_Roxana,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; }