function addMarkers() { mySelect = document.getElementById('selection'); Robinson = [];Hutsonville = [];Oblong = [];Palestine = [];mySelect.options[mySelect.options.length] = new Option("Hutsonville schools",'all=Hutsonville'); mySelect.options[mySelect.options.length] = new Option("Oblong schools",'all=Oblong'); mySelect.options[mySelect.options.length] = new Option("Palestine schools",'all=Palestine'); mySelect.options[mySelect.options.length] = new Option("Robinson schools",'all=Robinson'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Robinson[Robinson.length] = createMarker(new GPoint(-87.73957062,39.00394440),"
Crawford Memorial Hospital
1000 N Allen
Robinson, IL 62454

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Crawford Memorial Hospital",'Robinson=' + Robinson.length); Hutsonville[Hutsonville.length] = createMarker(new GPoint(-87.67209625,39.11019897),"
Hutsonville Elementary And Junior High School
Po Box 218
Hutsonville, IL 62433

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Hutsonville Elementary And Junior High School",'Hutsonville=' + Hutsonville.length); Hutsonville[Hutsonville.length] = createMarker(new GPoint(-87.67209625,39.11019897),"
Hutsonville High School
Po Box 218
Hutsonville, IL 62433

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Hutsonville High School",'Hutsonville=' + Hutsonville.length); Robinson[Robinson.length] = createMarker(new GPoint(-87.73692322,39.00116348),"
Lincoln Elementary School
301 E Poplar St
Robinson, IL 62454

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Lincoln Elementary School",'Robinson=' + Robinson.length); Robinson[Robinson.length] = createMarker(new GPoint(-87.73957062,39.00394440),"
Ltc/twin Rivers Efe 500
301 S Cross Ste 235
Robinson, IL 62454

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Ltc/twin Rivers Efe 500",'Robinson=' + Robinson.length); Robinson[Robinson.length] = createMarker(new GPoint(-87.74211884,39.01833725),"
Nuttall Middle School
400 W Rustic St
Robinson, IL 62454

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Nuttall Middle School",'Robinson=' + Robinson.length); Oblong[Oblong.length] = createMarker(new GPoint(-87.91427612,39.00156403),"
Oblong Elementary School
600 W Main St
Oblong, IL 62449

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Oblong Elementary School",'Oblong=' + Oblong.length); Oblong[Oblong.length] = createMarker(new GPoint(-87.90897369,38.99616241),"
Oblong High School
700 S Range St
Oblong, IL 62449

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Oblong High School",'Oblong=' + Oblong.length); Palestine[Palestine.length] = createMarker(new GPoint(-87.61262512,39.00295258),"
Palestine Grade School
102 N Main St
Palestine, IL 62451

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Palestine Grade School",'Palestine=' + Palestine.length); Palestine[Palestine.length] = createMarker(new GPoint(-87.62167358,39.00184631),"
Palestine High School
203 S Washington
Palestine, IL 62451

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Palestine High School",'Palestine=' + Palestine.length); Robinson[Robinson.length] = createMarker(new GPoint(-87.74839783,39.00329971),"
Robinson Correctional Center
Po Box 1000
Robinson, IL 62454

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Robinson Correctional Center",'Robinson=' + Robinson.length); Robinson[Robinson.length] = createMarker(new GPoint(-87.73879242,39.01783752),"
Robinson High School
2000 N Cross St
Robinson, IL 62454

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Robinson High School",'Robinson=' + Robinson.length); Robinson[Robinson.length] = createMarker(new GPoint(-87.75420380,39.00059891),"
Safe School Roe12 Crawford Cnty
206 S Jackson St
Robinson, IL 62454

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Safe School Roe12 Crawford Cnty",'Robinson=' + Robinson.length); Robinson[Robinson.length] = createMarker(new GPoint(-87.74379730,39.01116180),"
Washington Elementary School
507 Condit St
Robinson, IL 62454

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Washington Elementary School",'Robinson=' + Robinson.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,10); /* 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(Hutsonville); map.removeOverlays(Oblong); map.removeOverlays(Palestine); map.removeOverlays(Robinson); 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(Robinson);map.removeOverlays(Hutsonville); map.removeOverlays(Oblong); map.removeOverlays(Palestine); map.removeOverlays(Robinson); map.addOverlays(Hutsonville); centerByArray(Hutsonville, false, false); cntMarker += Hutsonville.length; map.addOverlays(Oblong); centerByArray(Oblong, false, false); cntMarker += Oblong.length; map.addOverlays(Palestine); centerByArray(Palestine, false, false); cntMarker += Palestine.length; map.addOverlays(Robinson); centerByArray(Robinson, false, false); cntMarker += Robinson.length; centerByArray(Robinson,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'); } }