function addMarkers() { mySelect = document.getElementById('selection'); Waconia = [];Chanhassen = [];Chaska = [];Norwood_Young_America = [];Carver = [];Excelsior = [];Victoria = [];Watertown = [];mySelect.options[mySelect.options.length] = new Option("Carver schools",'all=Carver'); mySelect.options[mySelect.options.length] = new Option("Chanhassen schools",'all=Chanhassen'); mySelect.options[mySelect.options.length] = new Option("Chaska schools",'all=Chaska'); mySelect.options[mySelect.options.length] = new Option("Excelsior schools",'all=Excelsior'); mySelect.options[mySelect.options.length] = new Option("Norwood Young America schools",'all=Norwood_Young_America'); mySelect.options[mySelect.options.length] = new Option("Victoria schools",'all=Victoria'); mySelect.options[mySelect.options.length] = new Option("Waconia schools",'all=Waconia'); mySelect.options[mySelect.options.length] = new Option("Watertown schools",'all=Watertown'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Waconia[Waconia.length] = createMarker(new GPoint(-93.79389191,44.85017014),"
Bayview Elementary School
24 S Walnut Street
Waconia, MN 55387

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Bayview Elementary School",'Waconia=' + Waconia.length); Chanhassen[Chanhassen.length] = createMarker(new GPoint(-93.54113007,44.86246490),"
Bluff Creek Elementary School
2300 Coulter Blvd
Chanhassen, MN 55317

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Bluff Creek Elementary School",'Chanhassen=' + Chanhassen.length); Chaska[Chaska.length] = createMarker(new GPoint(-93.60182400,44.78719500),"
Carver Alc High School
309 Lake Hazeltine Dr.
Chaska, MN 55318

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Carver Alc High School",'Chaska=' + Chaska.length); Chaska[Chaska.length] = createMarker(new GPoint(-93.58078766,44.84170151),"
Carver County Targeted Services
309 Lake Hazeltine Dr.
Chaska, MN 55318

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Carver County Targeted Services",'Chaska=' + Chaska.length); Chaska[Chaska.length] = createMarker(new GPoint(-93.59643555,44.78796387),"
Carver-scott Educational Coop.
401 E. 4th St.
Chaska, MN 55318

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Carver-scott Educational Coop.",'Chaska=' + Chaska.length); Norwood_Young_America[Norwood_Young_America.length] = createMarker(new GPoint(-93.92579651,44.76290131),"
Central Elementary School
Box 367
Norwood Young America, MN 55368

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Central Elementary School",'Norwood_Young_America=' + Norwood_Young_America.length); Norwood_Young_America[Norwood_Young_America.length] = createMarker(new GPoint(-93.92579651,44.76290131),"
Central Middle School
Box 247 531 Morse Street
Norwood Young America, MN 55368

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Central Middle School",'Norwood_Young_America=' + Norwood_Young_America.length); Norwood_Young_America[Norwood_Young_America.length] = createMarker(new GPoint(-93.92579651,44.76290131),"
Central Senior High School
Box 247 531 Morse Street
Norwood Young America, MN 55368

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Central Senior High School",'Norwood_Young_America=' + Norwood_Young_America.length); Chanhassen[Chanhassen.length] = createMarker(new GPoint(-93.53613281,44.86516190),"
Chanhassen Elementary School
7600 Laredo Drive
Chanhassen, MN 55317

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Chanhassen Elementary School",'Chanhassen=' + Chanhassen.length); Chaska[Chaska.length] = createMarker(new GPoint(-93.60153198,44.80849838),"
Chaska Elementary School
1800 N Chestnut Street
Chaska, MN 55318

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Chaska Elementary School",'Chaska=' + Chaska.length); Chaska[Chaska.length] = createMarker(new GPoint(-93.59523773,44.80516052),"
Chaska Mid. East Middle School
1600 Park Ridge Drive
Chaska, MN 55318

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Chaska Mid. East Middle School",'Chaska=' + Chaska.length); Chaska[Chaska.length] = createMarker(new GPoint(-93.58458710,44.80553436),"
Chaska Mid. West Middle School
140 Engler Blvd
Chaska, MN 55318

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Chaska Mid. West Middle School",'Chaska=' + Chaska.length); Chaska[Chaska.length] = createMarker(new GPoint(-93.59786987,44.82785034),"
Chaska Senior High School
545 Pioneer Trail
Chaska, MN 55318

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Chaska Senior High School",'Chaska=' + Chaska.length); Waconia[Waconia.length] = createMarker(new GPoint(-93.78916400,44.84772000),"
Clearwater Middle School
1650 Community Drive
Waconia, MN 55387

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Clearwater Middle School",'Waconia=' + Waconia.length); Chaska[Chaska.length] = createMarker(new GPoint(-93.63210297,44.81940842),"
Clover Ridge Elementary School
114000 Hundermark Road
Chaska, MN 55318

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Clover Ridge Elementary School",'Chaska=' + Chaska.length); Chaska[Chaska.length] = createMarker(new GPoint(-93.57611084,44.84174347),"
Csec Alc C Ind High School
309 Lake Hazeltine Dr.
Chaska, MN 55318

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Csec Alc C Ind High School",'Chaska=' + Chaska.length); Chaska[Chaska.length] = createMarker(new GPoint(-93.58078766,44.84170151),"
Csec Alc C Sb High School
309 Lake Hazeltine Dr.
Chaska, MN 55318

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Csec Alc C Sb High School",'Chaska=' + Chaska.length); Chaska[Chaska.length] = createMarker(new GPoint(-93.60182400,44.78719500),"
Csec Alc Juvenile Alternitive
309 Lake Hazeltine Dr.
Chaska, MN 55318

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Csec Alc Juvenile Alternitive",'Chaska=' + Chaska.length); Chaska[Chaska.length] = createMarker(new GPoint(-93.60182400,44.78719500),"
Csec Alc Newlemont
309 Lake Hazeltine Dr.
Chaska, MN 55318

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Csec Alc Newlemont",'Chaska=' + Chaska.length); Chaska[Chaska.length] = createMarker(new GPoint(-93.60182400,44.78719500),"
Csec Alc S Ind
309 Lake Hazeltine Dr.
Chaska, MN 55318

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Csec Alc S Ind",'Chaska=' + Chaska.length); Chaska[Chaska.length] = createMarker(new GPoint(-93.60182400,44.78719500),"
Csec Alc S Sb
309 Lake Hazeltine Dr.
Chaska, MN 55318

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Csec Alc S Sb",'Chaska=' + Chaska.length); Chaska[Chaska.length] = createMarker(new GPoint(-93.60182400,44.78719500),"
Csec Alc S Shak 720
309 Lake Hazeltine Dr.
Chaska, MN 55318

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Csec Alc S Shak 720",'Chaska=' + Chaska.length); Chaska[Chaska.length] = createMarker(new GPoint(-93.60182400,44.78719500),"
Csec Alc West Carver
309 Lake Hazeltine Dr.
Chaska, MN 55318

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Csec Alc West Carver",'Chaska=' + Chaska.length); Chaska[Chaska.length] = createMarker(new GPoint(-93.58078766,44.84170151),"
Csec Alc Westonka High School
309 Lake Hazeltine Dr.
Chaska, MN 55318

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Csec Alc Westonka High School",'Chaska=' + Chaska.length); Chaska[Chaska.length] = createMarker(new GPoint(-93.60182400,44.78719500),"
Csec Haven
309 Lake Hazeltine Drive
Chaska, MN 55318

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Csec Haven",'Chaska=' + Chaska.length); Chaska[Chaska.length] = createMarker(new GPoint(-93.58078766,44.84170151),"
Csec Special Ed West Carver
309 Lake Hazeltine Dr.
Chaska, MN 55318

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Csec Special Ed West Carver",'Chaska=' + Chaska.length); Chaska[Chaska.length] = createMarker(new GPoint(-93.58176000,44.84217600),"
Csec Special Ed. Spring Lake
309 Lake Hazeltine Dr.
Chaska, MN 55318

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Csec Special Ed. Spring Lake",'Chaska=' + Chaska.length); Chaska[Chaska.length] = createMarker(new GPoint(-93.60990143,44.81320190),"
Csec Special Ed. Waconia Middle School
401 East Fourth St.
Chaska, MN 55318

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Csec Special Ed. Waconia Middle School",'Chaska=' + Chaska.length); Chaska[Chaska.length] = createMarker(new GPoint(-93.58078766,44.84170151),"
Csec Special Ed. Westonka
309 Lake Hazeltine Dr.
Chaska, MN 55318

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Csec Special Ed. Westonka",'Chaska=' + Chaska.length); Chaska[Chaska.length] = createMarker(new GPoint(-93.60182400,44.78719500),"
Csec Targeted Services Shak 720
309 Lake Hazeltine Dr.
Chaska, MN 55318

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Csec Targeted Services Shak 720",'Chaska=' + Chaska.length); Chaska[Chaska.length] = createMarker(new GPoint(-93.60848999,44.82543945),"
Early Childhood Center
110600 Village Road
Chaska, MN 55318

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Early Childhood Center",'Chaska=' + Chaska.length); Carver[Carver.length] = createMarker(new GPoint(-93.68400574,44.72051239),"
East Union Elementary School
15655 County Road 43
Carver, MN 55315

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("East Union Elementary School",'Carver=' + Carver.length); Chaska[Chaska.length] = createMarker(new GPoint(-93.56553650,44.82586288),"
Jonathan Elementary School
110300 Pioneer Trail W
Chaska, MN 55318

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Jonathan Elementary School",'Chaska=' + Chaska.length); Excelsior[Excelsior.length] = createMarker(new GPoint(-93.58118439,44.88775635),"
Minnetonka West Middle School
6421 Hazeltine Blvd
Excelsior, MN 55331

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Minnetonka West Middle School",'Excelsior=' + Excelsior.length); Chaska[Chaska.length] = createMarker(new GPoint(-93.57375336,44.82286453),"
Pioneer Ridge Freshmen Center
1085 Pioneer Trail E
Chaska, MN 55318

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Pioneer Ridge Freshmen Center",'Chaska=' + Chaska.length); Chaska[Chaska.length] = createMarker(new GPoint(-93.57611084,44.84174347),"
Scott Alc High School
309 Lake Hazeltine Dr.
Chaska, MN 55318

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Scott Alc High School",'Chaska=' + Chaska.length); Chaska[Chaska.length] = createMarker(new GPoint(-93.57611084,44.84174347),"
Scott County Targeted Services
309 Lake Hazeltine Dr.
Chaska, MN 55318

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Scott County Targeted Services",'Chaska=' + Chaska.length); Waconia[Waconia.length] = createMarker(new GPoint(-93.78935242,44.84536362),"
Southview Elementary School
225 W 4th Street
Waconia, MN 55387

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Southview Elementary School",'Waconia=' + Waconia.length); Chaska[Chaska.length] = createMarker(new GPoint(-93.59500122,44.84447861),"
Unique Learners Elementary School
11 Peavey Road
Chaska, MN 55318

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Unique Learners Elementary School",'Chaska=' + Chaska.length); Victoria[Victoria.length] = createMarker(new GPoint(-10.00000000,10.00000000),"
Victoria Elementary School
9300 Red Fox Drive
Victoria, MN 55386

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Victoria Elementary School",'Victoria=' + Victoria.length); Waconia[Waconia.length] = createMarker(new GPoint(-93.80873871,44.83670807),"
Waconia Senior High School
1400 Community Drive
Waconia, MN 55387

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Waconia Senior High School",'Waconia=' + Waconia.length); Watertown[Watertown.length] = createMarker(new GPoint(-93.84500122,44.95899963),"
Watertown Senior High School
1001 Highway 25 Nw
Watertown, MN 55388

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Watertown Senior High School",'Watertown=' + Watertown.length); Watertown[Watertown.length] = createMarker(new GPoint(-93.84500122,44.95899963),"
Watertown-mayer Elementary School
301 State Street Nw
Watertown, MN 55388

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Watertown-mayer Elementary School",'Watertown=' + Watertown.length); Watertown[Watertown.length] = createMarker(new GPoint(-93.84500122,44.95899963),"
Watertown-mayer Middle School
1001 Highway 25 Nw
Watertown, MN 55388

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Watertown-mayer Middle School",'Watertown=' + Watertown.length); Chaska[Chaska.length] = createMarker(new GPoint(-93.59722137,44.82506943),"
World Learner Charter School
112050 Hundertmark Road
Chaska, MN 55318

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("World Learner Charter School",'Chaska=' + Chaska.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(Carver); map.removeOverlays(Chanhassen); map.removeOverlays(Chaska); map.removeOverlays(Excelsior); map.removeOverlays(Norwood_Young_America); map.removeOverlays(Victoria); map.removeOverlays(Waconia); map.removeOverlays(Watertown); 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(Waconia);map.removeOverlays(Carver); map.removeOverlays(Chanhassen); map.removeOverlays(Chaska); map.removeOverlays(Excelsior); map.removeOverlays(Norwood_Young_America); map.removeOverlays(Victoria); map.removeOverlays(Waconia); map.removeOverlays(Watertown); map.addOverlays(Carver); centerByArray(Carver, false, false); cntMarker += Carver.length; map.addOverlays(Chanhassen); centerByArray(Chanhassen, false, false); cntMarker += Chanhassen.length; map.addOverlays(Chaska); centerByArray(Chaska, false, false); cntMarker += Chaska.length; map.addOverlays(Excelsior); centerByArray(Excelsior, false, false); cntMarker += Excelsior.length; map.addOverlays(Norwood_Young_America); centerByArray(Norwood_Young_America, false, false); cntMarker += Norwood_Young_America.length; map.addOverlays(Victoria); centerByArray(Victoria, false, false); cntMarker += Victoria.length; map.addOverlays(Waconia); centerByArray(Waconia, false, false); cntMarker += Waconia.length; map.addOverlays(Watertown); centerByArray(Watertown, false, false); cntMarker += Watertown.length; centerByArray(Waconia,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'); } }