function addMarkers() { mySelect = document.getElementById('selection'); Hillsboro = [];Coffeen = [];Farmersville = [];Litchfield = [];Raymond = [];Nokomis = [];Witt = [];mySelect.options[mySelect.options.length] = new Option("Coffeen schools",'all=Coffeen'); mySelect.options[mySelect.options.length] = new Option("Farmersville schools",'all=Farmersville'); mySelect.options[mySelect.options.length] = new Option("Hillsboro schools",'all=Hillsboro'); mySelect.options[mySelect.options.length] = new Option("Litchfield schools",'all=Litchfield'); mySelect.options[mySelect.options.length] = new Option("Nokomis schools",'all=Nokomis'); mySelect.options[mySelect.options.length] = new Option("Raymond schools",'all=Raymond'); mySelect.options[mySelect.options.length] = new Option("Witt schools",'all=Witt'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Hillsboro[Hillsboro.length] = createMarker(new GPoint(-89.50122070,39.15084457),"
Beckemeyer Elementary School
1035 Seymour Ave
Hillsboro, IL 62049

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Beckemeyer Elementary School",'Hillsboro=' + Hillsboro.length); Coffeen[Coffeen.length] = createMarker(new GPoint(-89.37989807,39.07590103),"
Coffeen Elementary School
Po Box 188
Coffeen, IL 62017

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Coffeen Elementary School",'Coffeen=' + Coffeen.length); Farmersville[Farmersville.length] = createMarker(new GPoint(-89.63890076,39.45000076),"
Farmersville Elementary School
Po Box 170
Farmersville, IL 62533

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Farmersville Elementary School",'Farmersville=' + Farmersville.length); Hillsboro[Hillsboro.length] = createMarker(new GPoint(-89.48699951,39.15000153),"
Graham Correctional Center
Po Box 499
Hillsboro, IL 62049

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Graham Correctional Center",'Hillsboro=' + Hillsboro.length); Hillsboro[Hillsboro.length] = createMarker(new GPoint(-89.48907471,39.15443420),"
Hillsboro High School
522 E Tremont St
Hillsboro, IL 62049

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Hillsboro High School",'Hillsboro=' + Hillsboro.length); Hillsboro[Hillsboro.length] = createMarker(new GPoint(-89.49121857,39.15348816),"
Hillsboro Junior High School
909 Rountree St
Hillsboro, IL 62049

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Hillsboro Junior High School",'Hillsboro=' + Hillsboro.length); Litchfield[Litchfield.length] = createMarker(new GPoint(-89.64936066,39.16973877),"
J D Colt Elementary School
615 E Tyler Ave
Litchfield, IL 62056

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("J D Colt Elementary School",'Litchfield=' + Litchfield.length); Raymond[Raymond.length] = createMarker(new GPoint(-89.57689667,39.30839920),"
Lincolnwood High School
Po Box 110
Raymond, IL 62560

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Lincolnwood High School",'Raymond=' + Raymond.length); Raymond[Raymond.length] = createMarker(new GPoint(-89.57689667,39.30839920),"
Lincolnwood Junior High School
Po Box 110
Raymond, IL 62560

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Lincolnwood Junior High School",'Raymond=' + Raymond.length); Litchfield[Litchfield.length] = createMarker(new GPoint(-89.65537262,39.18814468),"
Litchfield Middle School
1701 N State St
Litchfield, IL 62056

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Litchfield Middle School",'Litchfield=' + Litchfield.length); Litchfield[Litchfield.length] = createMarker(new GPoint(-89.64916229,39.17900467),"
Litchfield Prekindergarten
601 S State St
Litchfield, IL 62056

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Litchfield Prekindergarten",'Litchfield=' + Litchfield.length); Litchfield[Litchfield.length] = createMarker(new GPoint(-89.65537262,39.18817520),"
Litchfield Senior High School
1705 N State St
Litchfield, IL 62056

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Litchfield Senior High School",'Litchfield=' + Litchfield.length); Litchfield[Litchfield.length] = createMarker(new GPoint(-89.64802551,39.18073654),"
Madison Park Elementary School
800 N Chestnut St
Litchfield, IL 62056

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Madison Park Elementary School",'Litchfield=' + Litchfield.length); Nokomis[Nokomis.length] = createMarker(new GPoint(-89.29485321,39.30496216),"
Nokomis Jr/sr High School
511 Oberle St
Nokomis, IL 62075

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Nokomis Jr/sr High School",'Nokomis=' + Nokomis.length); Nokomis[Nokomis.length] = createMarker(new GPoint(-89.28033447,39.30013657),"
Nokomis South Middle School
316 E South St
Nokomis, IL 62075

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Nokomis South Middle School",'Nokomis=' + Nokomis.length); Nokomis[Nokomis.length] = createMarker(new GPoint(-89.28903198,39.30436707),"
North Elementary School
110 W Hamilton
Nokomis, IL 62075

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("North Elementary School",'Nokomis=' + Nokomis.length); Raymond[Raymond.length] = createMarker(new GPoint(-89.57689667,39.30839920),"
Raymond Grade School
Po Box 80
Raymond, IL 62560

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Raymond Grade School",'Raymond=' + Raymond.length); Litchfield[Litchfield.length] = createMarker(new GPoint(-89.65787506,39.17967224),"
Russell Elementary School
705 N Jefferson St
Litchfield, IL 62056

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Russell Elementary School",'Litchfield=' + Litchfield.length); Litchfield[Litchfield.length] = createMarker(new GPoint(-89.65567780,39.17145538),"
Sihler Elementary School
601 S State St
Litchfield, IL 62056

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Sihler Elementary School",'Litchfield=' + Litchfield.length); Witt[Witt.length] = createMarker(new GPoint(-89.34799957,39.24850082),"
Witt Elementary School
220 N 3rd St
Witt, IL 62094

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Witt Elementary School",'Witt=' + Witt.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(Coffeen); map.removeOverlays(Farmersville); map.removeOverlays(Hillsboro); map.removeOverlays(Litchfield); map.removeOverlays(Nokomis); map.removeOverlays(Raymond); map.removeOverlays(Witt); 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(Hillsboro);map.removeOverlays(Coffeen); map.removeOverlays(Farmersville); map.removeOverlays(Hillsboro); map.removeOverlays(Litchfield); map.removeOverlays(Nokomis); map.removeOverlays(Raymond); map.removeOverlays(Witt); map.addOverlays(Coffeen); centerByArray(Coffeen, false, false); cntMarker += Coffeen.length; map.addOverlays(Farmersville); centerByArray(Farmersville, false, false); cntMarker += Farmersville.length; map.addOverlays(Hillsboro); centerByArray(Hillsboro, false, false); cntMarker += Hillsboro.length; map.addOverlays(Litchfield); centerByArray(Litchfield, false, false); cntMarker += Litchfield.length; map.addOverlays(Nokomis); centerByArray(Nokomis, false, false); cntMarker += Nokomis.length; map.addOverlays(Raymond); centerByArray(Raymond, false, false); cntMarker += Raymond.length; map.addOverlays(Witt); centerByArray(Witt, false, false); cntMarker += Witt.length; centerByArray(Hillsboro,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'); } }