function addMarkers() { mySelect = document.getElementById('selection'); Apple_River = [];East_Dubuque = [];Elizabeth = [];Galena = [];Hanover = [];Scales_Mound = [];Stockton = [];Warren = [];mySelect.options[mySelect.options.length] = new Option("Apple River schools",'all=Apple_River'); mySelect.options[mySelect.options.length] = new Option("East Dubuque schools",'all=East_Dubuque'); mySelect.options[mySelect.options.length] = new Option("Elizabeth schools",'all=Elizabeth'); mySelect.options[mySelect.options.length] = new Option("Galena schools",'all=Galena'); mySelect.options[mySelect.options.length] = new Option("Hanover schools",'all=Hanover'); mySelect.options[mySelect.options.length] = new Option("Scales Mound schools",'all=Scales_Mound'); mySelect.options[mySelect.options.length] = new Option("Stockton schools",'all=Stockton'); mySelect.options[mySelect.options.length] = new Option("Warren schools",'all=Warren'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Apple_River[Apple_River.length] = createMarker(new GPoint(-90.14610291,42.44609833),"
Apple River Middle School
301 W Hickory St
Apple River, IL 61001

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Apple River Middle School",'Apple_River=' + Apple_River.length); East_Dubuque[East_Dubuque.length] = createMarker(new GPoint(-90.63998413,42.49796295),"
East Dubuque Elementary School
100 School Rd
East Dubuque, IL 61025

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("East Dubuque Elementary School",'East_Dubuque=' + East_Dubuque.length); East_Dubuque[East_Dubuque.length] = createMarker(new GPoint(-90.62435150,42.49766922),"
East Dubuque High School
200 Park Lane Dr
East Dubuque, IL 61025

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("East Dubuque High School",'East_Dubuque=' + East_Dubuque.length); Elizabeth[Elizabeth.length] = createMarker(new GPoint(-90.22605896,42.31927109),"
Elizabeth Elementary School
300 N West St
Elizabeth, IL 61028

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Elizabeth Elementary School",'Elizabeth=' + Elizabeth.length); Galena[Galena.length] = createMarker(new GPoint(-90.43878174,42.42704773),"
Galena High School
1206 N Franklin St
Galena, IL 61036

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Galena High School",'Galena=' + Galena.length); Galena[Galena.length] = createMarker(new GPoint(-90.43891144,42.42709351),"
Galena Middle School
1230 N Franklin St
Galena, IL 61036

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Galena Middle School",'Galena=' + Galena.length); Galena[Galena.length] = createMarker(new GPoint(-90.43900299,42.42513657),"
Galena Primary School
219 Kelly Ln
Galena, IL 61036

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Galena Primary School",'Galena=' + Galena.length); Hanover[Hanover.length] = createMarker(new GPoint(-90.27529907,42.25543594),"
Hanover Elementary School
800 Fillmore St
Hanover, IL 61041

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Hanover Elementary School",'Hanover=' + Hanover.length); Elizabeth[Elizabeth.length] = createMarker(new GPoint(-90.18260193,42.29479980),"
Jo Daviess-carrol Area Voc Center
Po Box 602
Elizabeth, IL 61028

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Jo Daviess-carrol Area Voc Center",'Elizabeth=' + Elizabeth.length); Hanover[Hanover.length] = createMarker(new GPoint(-90.29650116,42.26490021),"
River Ridge Elementary School
4141 Il Rt 84 S
Hanover, IL 61041

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("River Ridge Elementary School",'Hanover=' + Hanover.length); Hanover[Hanover.length] = createMarker(new GPoint(-90.22605896,42.31927109),"
River Ridge High School
4141 Il Rt 84 S
Hanover, IL 61041

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("River Ridge High School",'Hanover=' + Hanover.length); Hanover[Hanover.length] = createMarker(new GPoint(-90.27529907,42.25543594),"
River Ridge Middle School
4141 Il Rt 84 S
Hanover, IL 61041

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("River Ridge Middle School",'Hanover=' + Hanover.length); Scales_Mound[Scales_Mound.length] = createMarker(new GPoint(-90.25599670,42.46979904),"
Scales Mound Elementary School
Po Box 191
Scales Mound, IL 61075

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Scales Mound Elementary School",'Scales_Mound=' + Scales_Mound.length); Scales_Mound[Scales_Mound.length] = createMarker(new GPoint(-90.25599670,42.46979904),"
Scales Mound High School
Po Box 191
Scales Mound, IL 61075

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Scales Mound High School",'Scales_Mound=' + Scales_Mound.length); Scales_Mound[Scales_Mound.length] = createMarker(new GPoint(-90.25599670,42.46979904),"
Scales Mound Junior High School
Po Box 191
Scales Mound, IL 61075

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Scales Mound Junior High School",'Scales_Mound=' + Scales_Mound.length); Stockton[Stockton.length] = createMarker(new GPoint(-90.00875092,42.35177612),"
Stockton Elementary School
236 N Pearl St
Stockton, IL 61085

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Stockton Elementary School",'Stockton=' + Stockton.length); Stockton[Stockton.length] = createMarker(new GPoint(-90.01138306,42.35464096),"
Stockton Middle School
500 N Rush St
Stockton, IL 61085

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Stockton Middle School",'Stockton=' + Stockton.length); Stockton[Stockton.length] = createMarker(new GPoint(-90.01140594,42.35521698),"
Stockton Senior High School
540 N Rush St
Stockton, IL 61085

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Stockton Senior High School",'Stockton=' + Stockton.length); Warren[Warren.length] = createMarker(new GPoint(-89.98958588,42.49453735),"
Warren Elementary School
311 S Water St
Warren, IL 61087

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Warren Elementary School",'Warren=' + Warren.length); Warren[Warren.length] = createMarker(new GPoint(-89.98958588,42.49453735),"
Warren Junior High School
311 S Water
Warren, IL 61087

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Warren Junior High School",'Warren=' + Warren.length); Warren[Warren.length] = createMarker(new GPoint(-89.98958588,42.49453735),"
Warren Senior High School
311 S Water
Warren, IL 61087

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Warren Senior High School",'Warren=' + Warren.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(Apple_River); map.removeOverlays(East_Dubuque); map.removeOverlays(Elizabeth); map.removeOverlays(Galena); map.removeOverlays(Hanover); map.removeOverlays(Scales_Mound); map.removeOverlays(Stockton); map.removeOverlays(Warren); 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(Apple_River);map.removeOverlays(Apple_River); map.removeOverlays(East_Dubuque); map.removeOverlays(Elizabeth); map.removeOverlays(Galena); map.removeOverlays(Hanover); map.removeOverlays(Scales_Mound); map.removeOverlays(Stockton); map.removeOverlays(Warren); map.addOverlays(Apple_River); centerByArray(Apple_River, false, false); cntMarker += Apple_River.length; map.addOverlays(East_Dubuque); centerByArray(East_Dubuque, false, false); cntMarker += East_Dubuque.length; map.addOverlays(Elizabeth); centerByArray(Elizabeth, false, false); cntMarker += Elizabeth.length; map.addOverlays(Galena); centerByArray(Galena, false, false); cntMarker += Galena.length; map.addOverlays(Hanover); centerByArray(Hanover, false, false); cntMarker += Hanover.length; map.addOverlays(Scales_Mound); centerByArray(Scales_Mound, false, false); cntMarker += Scales_Mound.length; map.addOverlays(Stockton); centerByArray(Stockton, false, false); cntMarker += Stockton.length; map.addOverlays(Warren); centerByArray(Warren, false, false); cntMarker += Warren.length; centerByArray(Apple_River,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'); } }