function addMarkers() { mySelect = document.getElementById('selection'); Owatonna = [];Blooming_Prairie = [];Medford = [];Ellendale = [];mySelect.options[mySelect.options.length] = new Option("Blooming Prairie schools",'all=Blooming_Prairie'); mySelect.options[mySelect.options.length] = new Option("Ellendale schools",'all=Ellendale'); mySelect.options[mySelect.options.length] = new Option("Medford schools",'all=Medford'); mySelect.options[mySelect.options.length] = new Option("Owatonna schools",'all=Owatonna'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Owatonna[Owatonna.length] = createMarker(new GPoint(-93.23980713,44.09091187),"
Actions School
565 Dunnell Drive
Owatonna, MN 55060

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Actions School",'Owatonna=' + Owatonna.length); Blooming_Prairie[Blooming_Prairie.length] = createMarker(new GPoint(-93.05596924,43.86896133),"
Blooming Prairie Elementary School
123 2nd Street Nw
Blooming Prairie, MN 55917

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Blooming Prairie Elementary School",'Blooming_Prairie=' + Blooming_Prairie.length); Blooming_Prairie[Blooming_Prairie.length] = createMarker(new GPoint(-93.06257629,43.86806488),"
Blooming Prairie Secondary School
202 4th Avenue Nw
Blooming Prairie, MN 55917

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Blooming Prairie Secondary School",'Blooming_Prairie=' + Blooming_Prairie.length); Owatonna[Owatonna.length] = createMarker(new GPoint(-93.22599792,44.02940369),"
Crossroads Of Owatonna
4327 County Road 45 S
Owatonna, MN 55060

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Crossroads Of Owatonna",'Owatonna=' + Owatonna.length); Owatonna[Owatonna.length] = createMarker(new GPoint(-93.22548676,44.08776474),"
Day School 9-12 (610)
115 E Rose Street
Owatonna, MN 55060

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Day School 9-12 (610)",'Owatonna=' + Owatonna.length); Owatonna[Owatonna.length] = createMarker(new GPoint(-93.22563300,44.08795000),"
Extended Day K-8 (611)
115 E Rose Street
Owatonna, MN 55060

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Extended Day K-8 (611)",'Owatonna=' + Owatonna.length); Owatonna[Owatonna.length] = createMarker(new GPoint(-93.21063232,44.07326126),"
Lincoln Elementary School
747 Havana Road
Owatonna, MN 55060

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Lincoln Elementary School",'Owatonna=' + Owatonna.length); Owatonna[Owatonna.length] = createMarker(new GPoint(-93.21812439,44.09846115),"
Mckinley Elementary School
423 14th Street Ne
Owatonna, MN 55060

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Mckinley Elementary School",'Owatonna=' + Owatonna.length); Medford[Medford.length] = createMarker(new GPoint(-93.24400330,44.17430115),"
Medford Elementary School
750 2nd Avenue Se
Medford, MN 55049

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Medford Elementary School",'Medford=' + Medford.length); Medford[Medford.length] = createMarker(new GPoint(-93.24400330,44.17430115),"
Medford Secondary School
Box 38, 104 2nd St. N.e.
Medford, MN 55049

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Medford Secondary School",'Medford=' + Medford.length); Owatonna[Owatonna.length] = createMarker(new GPoint(-93.22548676,44.08776474),"
Night School 9-12 (610)
115 Rose Street E
Owatonna, MN 55060

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Night School 9-12 (610)",'Owatonna=' + Owatonna.length); Ellendale[Ellendale.length] = createMarker(new GPoint(-93.29683685,43.87310410),"
Nrheg Elem/middle Elementary School
600 School Street
Ellendale, MN 56026

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Nrheg Elem/middle Elementary School",'Ellendale=' + Ellendale.length); Owatonna[Owatonna.length] = createMarker(new GPoint(-93.22938400,44.09338800),"
Owatonna Alc 6-8 (610)
115 E Rose Street
Owatonna, MN 55060

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Owatonna Alc 6-8 (610)",'Owatonna=' + Owatonna.length); Owatonna[Owatonna.length] = createMarker(new GPoint(-93.21620941,44.09983826),"
Owatonna Junior Middle School
500 15th Street Ne
Owatonna, MN 55060

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Owatonna Junior Middle School",'Owatonna=' + Owatonna.length); Owatonna[Owatonna.length] = createMarker(new GPoint(-93.21983337,44.08046341),"
Owatonna Senior High School
333 E School Street
Owatonna, MN 55060

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Owatonna Senior High School",'Owatonna=' + Owatonna.length); Owatonna[Owatonna.length] = createMarker(new GPoint(-93.21601900,44.07136700),"
Recovery School Of Southern Mn
1225 Lincoln Avenue S
Owatonna, MN 55060

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Recovery School Of Southern Mn",'Owatonna=' + Owatonna.length); Owatonna[Owatonna.length] = createMarker(new GPoint(-93.22534180,44.07303619),"
Roosevelt Community Service Cntr Elementary School
122 E Mckinley
Owatonna, MN 55060

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Roosevelt Community Service Cntr Elementary School",'Owatonna=' + Owatonna.length); Owatonna[Owatonna.length] = createMarker(new GPoint(-93.22548676,44.08776474),"
Summer School 9-12 (610)
115 Rose St. E.
Owatonna, MN 55060

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Summer School 9-12 (610)",'Owatonna=' + Owatonna.length); Owatonna[Owatonna.length] = createMarker(new GPoint(-93.22563300,44.08795000),"
Summer School K-8 (611)
115 Rose St. E.
Owatonna, MN 55060

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Summer School K-8 (611)",'Owatonna=' + Owatonna.length); Owatonna[Owatonna.length] = createMarker(new GPoint(-93.22029114,44.08383560),"
Washington Elementary School
338 E Main Street
Owatonna, MN 55060

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Washington Elementary School",'Owatonna=' + Owatonna.length); Owatonna[Owatonna.length] = createMarker(new GPoint(-93.20402527,44.10583878),"
Willow Creek Intermediate Elementary School
1050 22nd Street Ne
Owatonna, MN 55060

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Willow Creek Intermediate Elementary School",'Owatonna=' + Owatonna.length); Owatonna[Owatonna.length] = createMarker(new GPoint(-93.22938400,44.09338800),"
Wilson Elementary School
325 Meadow Lane
Owatonna, MN 55060

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Wilson Elementary School",'Owatonna=' + Owatonna.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(Blooming_Prairie); map.removeOverlays(Ellendale); map.removeOverlays(Medford); map.removeOverlays(Owatonna); 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(Owatonna);map.removeOverlays(Blooming_Prairie); map.removeOverlays(Ellendale); map.removeOverlays(Medford); map.removeOverlays(Owatonna); map.addOverlays(Blooming_Prairie); centerByArray(Blooming_Prairie, false, false); cntMarker += Blooming_Prairie.length; map.addOverlays(Ellendale); centerByArray(Ellendale, false, false); cntMarker += Ellendale.length; map.addOverlays(Medford); centerByArray(Medford, false, false); cntMarker += Medford.length; map.addOverlays(Owatonna); centerByArray(Owatonna, false, false); cntMarker += Owatonna.length; centerByArray(Owatonna,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'); } }