function addMarkers() { mySelect = document.getElementById('selection'); Red_Wing = [];Cannon_Falls = [];Kenyon = [];Goodhue = [];Wanamingo = [];Pine_Island = [];Zumbrota = [];mySelect.options[mySelect.options.length] = new Option("Cannon Falls schools",'all=Cannon_Falls'); mySelect.options[mySelect.options.length] = new Option("Goodhue schools",'all=Goodhue'); mySelect.options[mySelect.options.length] = new Option("Kenyon schools",'all=Kenyon'); mySelect.options[mySelect.options.length] = new Option("Pine Island schools",'all=Pine_Island'); mySelect.options[mySelect.options.length] = new Option("Red Wing schools",'all=Red_Wing'); mySelect.options[mySelect.options.length] = new Option("Wanamingo schools",'all=Wanamingo'); mySelect.options[mySelect.options.length] = new Option("Zumbrota schools",'all=Zumbrota'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Red_Wing[Red_Wing.length] = createMarker(new GPoint(-92.62809753,44.56677246),"
Burnside Elementary School
5001 Learning Lane
Red Wing, MN 55066

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Burnside Elementary School",'Red_Wing=' + Red_Wing.length); Cannon_Falls[Cannon_Falls.length] = createMarker(new GPoint(-92.91408539,44.51071167),"
Cannon Falls Elementary School
1020 E Minnesota Street
Cannon Falls, MN 55009

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Cannon Falls Elementary School",'Cannon_Falls=' + Cannon_Falls.length); Cannon_Falls[Cannon_Falls.length] = createMarker(new GPoint(-92.91166687,44.51070786),"
Cannon Falls Secondary School
820 E. Minnesota St.
Cannon Falls, MN 55009

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Cannon Falls Secondary School",'Cannon_Falls=' + Cannon_Falls.length); Red_Wing[Red_Wing.length] = createMarker(new GPoint(-92.52654266,44.56636047),"
Colvill Family Education Center
269 E 5th Street
Red Wing, MN 55066

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Colvill Family Education Center",'Red_Wing=' + Red_Wing.length); Red_Wing[Red_Wing.length] = createMarker(new GPoint(-92.55000305,44.54869843),"
Correctional Facility-red Wing High School
Box 45
Red Wing, MN 55066

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Correctional Facility-red Wing High School",'Red_Wing=' + Red_Wing.length); Kenyon[Kenyon.length] = createMarker(new GPoint(-92.97869873,44.26810074),"
Expelled Students
400 6th St.
Kenyon, MN 55946

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Expelled Students",'Kenyon=' + Kenyon.length); Cannon_Falls[Cannon_Falls.length] = createMarker(new GPoint(-92.83099365,44.39880371),"
Goodhue County Ed. District High School
38095 100th Avenue
Cannon Falls, MN 55009

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Goodhue County Ed. District High School",'Cannon_Falls=' + Cannon_Falls.length); Goodhue[Goodhue.length] = createMarker(new GPoint(-92.61679840,44.40790176),"
Goodhue Elementary School
Box 128 510 3rd Avenue
Goodhue, MN 55027

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Goodhue Elementary School",'Goodhue=' + Goodhue.length); Goodhue[Goodhue.length] = createMarker(new GPoint(-92.61679840,44.40790176),"
Goodhue Secondary School
Box 128, 510 3rd Ave.
Goodhue, MN 55027

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Goodhue Secondary School",'Goodhue=' + Goodhue.length); Red_Wing[Red_Wing.length] = createMarker(new GPoint(-92.55207062,44.55897141),"
Jefferson Elementary School
609 Buchanan St.
Red Wing, MN 55066

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Jefferson Elementary School",'Red_Wing=' + Red_Wing.length); Kenyon[Kenyon.length] = createMarker(new GPoint(-92.99010468,44.26723862),"
Kenyon-wanamingo Alternative
400 6th Street
Kenyon, MN 55946

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Kenyon-wanamingo Alternative",'Kenyon=' + Kenyon.length); Wanamingo[Wanamingo.length] = createMarker(new GPoint(-92.78770447,44.30390549),"
Kenyon-wanamingo Elementary School
225 3rd Avenue
Wanamingo, MN 55983

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Kenyon-wanamingo Elementary School",'Wanamingo=' + Wanamingo.length); Kenyon[Kenyon.length] = createMarker(new GPoint(-92.99010468,44.26723862),"
Kenyon-wanamingo Middle School
400 6th Street
Kenyon, MN 55946

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Kenyon-wanamingo Middle School",'Kenyon=' + Kenyon.length); Kenyon[Kenyon.length] = createMarker(new GPoint(-92.99010468,44.26723862),"
Kenyon-wanamingo Senior High School
400 6th Street
Kenyon, MN 55946

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Kenyon-wanamingo Senior High School",'Kenyon=' + Kenyon.length); Red_Wing[Red_Wing.length] = createMarker(new GPoint(-92.56746400,44.55643300),"
Mcf-redwing Maginnis High School
1079 Highway 292
Red Wing, MN 55066

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Mcf-redwing Maginnis High School",'Red_Wing=' + Red_Wing.length); Pine_Island[Pine_Island.length] = createMarker(new GPoint(-92.65499878,44.19810104),"
Pi/zm Alp High School
Box 398, 223 Se 1st Ave.
Pine Island, MN 55963

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Pi/zm Alp High School",'Pine_Island=' + Pine_Island.length); Pine_Island[Pine_Island.length] = createMarker(new GPoint(-92.65499878,44.19810104),"
Pine Island Elementary School
Box 398
Pine Island, MN 55963

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Pine Island Elementary School",'Pine_Island=' + Pine_Island.length); Pine_Island[Pine_Island.length] = createMarker(new GPoint(-92.65470123,44.19120026),"
Pine Island Middle School
Box 398
Pine Island, MN 55963

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Pine Island Middle School",'Pine_Island=' + Pine_Island.length); Pine_Island[Pine_Island.length] = createMarker(new GPoint(-92.65499878,44.19810104),"
Pine Island Secondary School
Box 398 223 Se 1st Avenue
Pine Island, MN 55963

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Pine Island Secondary School",'Pine_Island=' + Pine_Island.length); Zumbrota[Zumbrota.length] = createMarker(new GPoint(-92.66913300,44.28948500),"
Pine Island/zumbrota-mazeppa Alp
705 Mill Street
Zumbrota, MN 55992

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Pine Island/zumbrota-mazeppa Alp",'Zumbrota=' + Zumbrota.length); Red_Wing[Red_Wing.length] = createMarker(new GPoint(-92.63738251,44.56956482),"
Red Wing Alc High School
154 Tower View Dr.
Red Wing, MN 55066

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Red Wing Alc High School",'Red_Wing=' + Red_Wing.length); Red_Wing[Red_Wing.length] = createMarker(new GPoint(-92.53435400,44.56658500),"
Red Wing High School Alc Day Program
2451 Eagle Ridge Drive
Red Wing, MN 55066

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Red Wing High School Alc Day Program",'Red_Wing=' + Red_Wing.length); Red_Wing[Red_Wing.length] = createMarker(new GPoint(-92.51816300,44.53401800),"
Red Wing Middle Level Day Alc
2120 Twin Bluff Road
Red Wing, MN 55066

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Red Wing Middle Level Day Alc",'Red_Wing=' + Red_Wing.length); Red_Wing[Red_Wing.length] = createMarker(new GPoint(-92.52130127,44.53960037),"
Red Wing Senior High School
2451 Eagle Ridge Drive
Red Wing, MN 55066

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Red Wing Senior High School",'Red_Wing=' + Red_Wing.length); Red_Wing[Red_Wing.length] = createMarker(new GPoint(-92.51816300,44.53401800),"
Red Wing Targeted Services
2451 Eagle Ridge Drive
Red Wing, MN 55066

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Red Wing Targeted Services",'Red_Wing=' + Red_Wing.length); Red_Wing[Red_Wing.length] = createMarker(new GPoint(-92.54220581,44.55029297),"
Sunnyside Elementary School
1669 Southwood Avenue
Red Wing, MN 55066

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Sunnyside Elementary School",'Red_Wing=' + Red_Wing.length); Red_Wing[Red_Wing.length] = createMarker(new GPoint(-92.63738251,44.56956482),"
Tower View Opportunity Program Alc High School
154 Tower View Drive
Red Wing, MN 55066

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Tower View Opportunity Program Alc High School",'Red_Wing=' + Red_Wing.length); Red_Wing[Red_Wing.length] = createMarker(new GPoint(-92.54325867,44.54399872),"
Twin Bluff Middle School
2120 Twin Bluff Road
Red Wing, MN 55066

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Twin Bluff Middle School",'Red_Wing=' + Red_Wing.length); Red_Wing[Red_Wing.length] = createMarker(new GPoint(-92.52069855,44.56589890),"
Walter Maginnis High School
1079 Highway 292
Red Wing, MN 55066

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Walter Maginnis High School",'Red_Wing=' + Red_Wing.length); Zumbrota[Zumbrota.length] = createMarker(new GPoint(-92.67424011,44.29067612),"
Zumbrota-mazeppa Elementary School
799 Mill Street
Zumbrota, MN 55992

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Zumbrota-mazeppa Elementary School",'Zumbrota=' + Zumbrota.length); Zumbrota[Zumbrota.length] = createMarker(new GPoint(-92.67382812,44.29156876),"
Zumbrota-mazeppa Senior High School
705 Mill Street
Zumbrota, MN 55992

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Zumbrota-mazeppa Senior High School",'Zumbrota=' + Zumbrota.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(Cannon_Falls); map.removeOverlays(Goodhue); map.removeOverlays(Kenyon); map.removeOverlays(Pine_Island); map.removeOverlays(Red_Wing); map.removeOverlays(Wanamingo); map.removeOverlays(Zumbrota); 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(Red_Wing);map.removeOverlays(Cannon_Falls); map.removeOverlays(Goodhue); map.removeOverlays(Kenyon); map.removeOverlays(Pine_Island); map.removeOverlays(Red_Wing); map.removeOverlays(Wanamingo); map.removeOverlays(Zumbrota); map.addOverlays(Cannon_Falls); centerByArray(Cannon_Falls, false, false); cntMarker += Cannon_Falls.length; map.addOverlays(Goodhue); centerByArray(Goodhue, false, false); cntMarker += Goodhue.length; map.addOverlays(Kenyon); centerByArray(Kenyon, false, false); cntMarker += Kenyon.length; map.addOverlays(Pine_Island); centerByArray(Pine_Island, false, false); cntMarker += Pine_Island.length; map.addOverlays(Red_Wing); centerByArray(Red_Wing, false, false); cntMarker += Red_Wing.length; map.addOverlays(Wanamingo); centerByArray(Wanamingo, false, false); cntMarker += Wanamingo.length; map.addOverlays(Zumbrota); centerByArray(Zumbrota, false, false); cntMarker += Zumbrota.length; centerByArray(Red_Wing,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'); } }