function addMarkers() { mySelect = document.getElementById('selection'); Alexandria = [];Brandon = [];Carlos = [];Osakis = [];Evansville = [];Garfield = [];Miltona = [];Kensington = [];mySelect.options[mySelect.options.length] = new Option("Alexandria schools",'all=Alexandria'); mySelect.options[mySelect.options.length] = new Option("Brandon schools",'all=Brandon'); mySelect.options[mySelect.options.length] = new Option("Carlos schools",'all=Carlos'); mySelect.options[mySelect.options.length] = new Option("Evansville schools",'all=Evansville'); mySelect.options[mySelect.options.length] = new Option("Garfield schools",'all=Garfield'); mySelect.options[mySelect.options.length] = new Option("Kensington schools",'all=Kensington'); mySelect.options[mySelect.options.length] = new Option("Miltona schools",'all=Miltona'); mySelect.options[mySelect.options.length] = new Option("Osakis schools",'all=Osakis'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Alexandria[Alexandria.length] = createMarker(new GPoint(-95.38031900,45.87233700),"
American Spirit
1910 Aga Drive
Alexandria, MN 56308

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("American Spirit",'Alexandria=' + Alexandria.length); Brandon[Brandon.length] = createMarker(new GPoint(-95.58640289,45.98509979),"
Brandon Elementary School
Box 185
Brandon, MN 56315

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Brandon Elementary School",'Brandon=' + Brandon.length); Alexandria[Alexandria.length] = createMarker(new GPoint(-95.37902832,45.88339615),"
Brandon Mid Level Alc
817 Fillmore St.
Alexandria, MN 56308

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Brandon Mid Level Alc",'Alexandria=' + Alexandria.length); Brandon[Brandon.length] = createMarker(new GPoint(-95.58640289,45.98509979),"
Brandon Secondary School
Box 185, 206 W. Third St.
Brandon, MN 56315

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Brandon Secondary School",'Brandon=' + Brandon.length); Alexandria[Alexandria.length] = createMarker(new GPoint(-95.37902832,45.88339615),"
Brandon Ts
817 Fillmore St.
Alexandria, MN 56308

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Brandon Ts",'Alexandria=' + Alexandria.length); Carlos[Carlos.length] = createMarker(new GPoint(-95.27400208,45.98469925),"
Carlos Elementary School
Box 128
Carlos, MN 56319

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Carlos Elementary School",'Carlos=' + Carlos.length); Osakis[Osakis.length] = createMarker(new GPoint(-95.13960266,45.86970139),"
Central Minn Ed Telecom System
500 1st Ave. E.
Osakis, MN 56360

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Central Minn Ed Telecom System",'Osakis=' + Osakis.length); Alexandria[Alexandria.length] = createMarker(new GPoint(-95.36657715,45.89471436),"
Day Treatment Center
700 Northside Drive Ne
Alexandria, MN 56308

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Day Treatment Center",'Alexandria=' + Alexandria.length); Alexandria[Alexandria.length] = createMarker(new GPoint(-95.35175323,45.89055634),"
Discovery Junior Middle School
510 N Mckay
Alexandria, MN 56308

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Discovery Junior Middle School",'Alexandria=' + Alexandria.length); Alexandria[Alexandria.length] = createMarker(new GPoint(-95.36657715,45.89471436),"
El. Day Treatment
700 Northside Drive Ne
Alexandria, MN 56308

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("El. Day Treatment",'Alexandria=' + Alexandria.length); Evansville[Evansville.length] = createMarker(new GPoint(-95.68840027,46.01219940),"
Evansville Elementary School
Box 40 123 2nd Avenue
Evansville, MN 56326

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Evansville Elementary School",'Evansville=' + Evansville.length); Evansville[Evansville.length] = createMarker(new GPoint(-95.68840027,46.01219940),"
Evansville Secondary School
Box 40, 123 2nd Ave.
Evansville, MN 56326

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Evansville Secondary School",'Evansville=' + Evansville.length); Garfield[Garfield.length] = createMarker(new GPoint(-95.49569702,45.95940018),"
Garfield Elementary School
Box 158
Garfield, MN 56332

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Garfield Elementary School",'Garfield=' + Garfield.length); Alexandria[Alexandria.length] = createMarker(new GPoint(-95.37313843,45.87653732),"
Jefferson Senior High School
1401 Jefferson Street
Alexandria, MN 56308

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Jefferson Senior High School",'Alexandria=' + Alexandria.length); Osakis[Osakis.length] = createMarker(new GPoint(-95.16294861,45.86737442),"
Lakes Area Charter School
601 Nokomis Street W
Osakis, MN 56360

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Lakes Area Charter School",'Osakis=' + Osakis.length); Alexandria[Alexandria.length] = createMarker(new GPoint(-95.38830566,45.87981033),"
Lincoln Elementary School
1120 Lark Street
Alexandria, MN 56308

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Lincoln Elementary School",'Alexandria=' + Alexandria.length); Miltona[Miltona.length] = createMarker(new GPoint(-95.30490112,46.05550003),"
Miltona Elementary School
Box 113
Miltona, MN 56354

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Miltona Elementary School",'Miltona=' + Miltona.length); Osakis[Osakis.length] = createMarker(new GPoint(-95.15071106,45.86467361),"
Osakis Elementary School
Box
Osakis, MN 56360

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Osakis Elementary School",'Osakis=' + Osakis.length); Alexandria[Alexandria.length] = createMarker(new GPoint(-95.37902832,45.88339615),"
Osakis Mid Level Alc
817 Fillmore St.
Alexandria, MN 56308

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Osakis Mid Level Alc",'Alexandria=' + Alexandria.length); Osakis[Osakis.length] = createMarker(new GPoint(-95.15071106,45.86467361),"
Osakis Secondary School
Box
Osakis, MN 56360

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Osakis Secondary School",'Osakis=' + Osakis.length); Alexandria[Alexandria.length] = createMarker(new GPoint(-95.37902832,45.88339615),"
Osakis Ts
817 Fillmore Street
Alexandria, MN 56308

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Osakis Ts",'Alexandria=' + Alexandria.length); Alexandria[Alexandria.length] = createMarker(new GPoint(-95.37925720,45.88333511),"
Runestone Alc High School
817 Fillmore Street
Alexandria, MN 56308

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Runestone Alc High School",'Alexandria=' + Alexandria.length); Alexandria[Alexandria.length] = createMarker(new GPoint(-95.37902832,45.88339615),"
Runestone Middle Alc (alex)
817 Fillmore Street
Alexandria, MN 56308

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Runestone Middle Alc (alex)",'Alexandria=' + Alexandria.length); Alexandria[Alexandria.length] = createMarker(new GPoint(-95.37925720,45.88333511),"
Runestone Ts
817 Fillmore St.
Alexandria, MN 56308

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Runestone Ts",'Alexandria=' + Alexandria.length); Alexandria[Alexandria.length] = createMarker(new GPoint(-95.36634400,45.88939300),"
Voyager Elementary School
Box 339
Alexandria, MN 56308

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Voyager Elementary School",'Alexandria=' + Alexandria.length); Alexandria[Alexandria.length] = createMarker(new GPoint(-95.37301636,45.88684464),"
Washington Elementary School
515 Jefferson Street
Alexandria, MN 56308

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Washington Elementary School",'Alexandria=' + Alexandria.length); Kensington[Kensington.length] = createMarker(new GPoint(-95.69490814,45.77985382),"
West Central Area S. Elementary School
31 N. Central
Kensington, MN 56343

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("West Central Area S. Elementary School",'Kensington=' + Kensington.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(Alexandria); map.removeOverlays(Brandon); map.removeOverlays(Carlos); map.removeOverlays(Evansville); map.removeOverlays(Garfield); map.removeOverlays(Kensington); map.removeOverlays(Miltona); map.removeOverlays(Osakis); 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(Alexandria);map.removeOverlays(Alexandria); map.removeOverlays(Brandon); map.removeOverlays(Carlos); map.removeOverlays(Evansville); map.removeOverlays(Garfield); map.removeOverlays(Kensington); map.removeOverlays(Miltona); map.removeOverlays(Osakis); map.addOverlays(Alexandria); centerByArray(Alexandria, false, false); cntMarker += Alexandria.length; map.addOverlays(Brandon); centerByArray(Brandon, false, false); cntMarker += Brandon.length; map.addOverlays(Carlos); centerByArray(Carlos, false, false); cntMarker += Carlos.length; map.addOverlays(Evansville); centerByArray(Evansville, false, false); cntMarker += Evansville.length; map.addOverlays(Garfield); centerByArray(Garfield, false, false); cntMarker += Garfield.length; map.addOverlays(Kensington); centerByArray(Kensington, false, false); cntMarker += Kensington.length; map.addOverlays(Miltona); centerByArray(Miltona, false, false); cntMarker += Miltona.length; map.addOverlays(Osakis); centerByArray(Osakis, false, false); cntMarker += Osakis.length; centerByArray(Alexandria,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'); } }