function addMarkers() { mySelect = document.getElementById('selection'); Sault_Ste_Marie = [];Brimley = [];Dafter = [];Kincheloe = [];Detour_Village = [];Drummond_Island = [];Pickford = [];Rudyard = [];Paradise = [];mySelect.options[mySelect.options.length] = new Option("Brimley schools",'all=Brimley'); mySelect.options[mySelect.options.length] = new Option("Dafter schools",'all=Dafter'); mySelect.options[mySelect.options.length] = new Option("Detour Village schools",'all=Detour_Village'); mySelect.options[mySelect.options.length] = new Option("Drummond Island schools",'all=Drummond_Island'); mySelect.options[mySelect.options.length] = new Option("Kincheloe schools",'all=Kincheloe'); mySelect.options[mySelect.options.length] = new Option("Paradise schools",'all=Paradise'); mySelect.options[mySelect.options.length] = new Option("Pickford schools",'all=Pickford'); mySelect.options[mySelect.options.length] = new Option("Rudyard schools",'all=Rudyard'); mySelect.options[mySelect.options.length] = new Option("Sault Ste Marie schools",'all=Sault_Ste_Marie'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Sault_Ste_Marie[Sault_Ste_Marie.length] = createMarker(new GPoint(-84.34543610,46.50092697),"
Alternative High School
460 West Spruce Street
Sault Ste. Marie, MI 49783

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Alternative High School",'Sault_Ste_Marie=' + Sault_Ste_Marie.length); Sault_Ste_Marie[Sault_Ste_Marie.length] = createMarker(new GPoint(-84.33255768,46.48103714),"
Bahweting Anishnabe Psa Elementary School
1301 Marquette Street
Sault Ste. Marie, MI 49783

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Bahweting Anishnabe Psa Elementary School",'Sault_Ste_Marie=' + Sault_Ste_Marie.length); Sault_Ste_Marie[Sault_Ste_Marie.length] = createMarker(new GPoint(-94.07180023,46.48699951),"
Bahweting Saulte Ojibwa School
1301 Marquette Avenue
Sault Ste Marie, MI 49783

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bahweting Saulte Ojibwa School",'Sault_Ste_Marie=' + Sault_Ste_Marie.length); Brimley[Brimley.length] = createMarker(new GPoint(-84.57249451,46.40298080),"
Brimley Elementary School
7134 S. M-221
Brimley, MI 49715

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Brimley Elementary School",'Brimley=' + Brimley.length); Brimley[Brimley.length] = createMarker(new GPoint(-84.57249451,46.40298080),"
Brimley Jr./sr. High School
7134 S. M-221
Brimley, MI 49715

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Brimley Jr./sr. High School",'Brimley=' + Brimley.length); Dafter[Dafter.length] = createMarker(new GPoint(-84.29727936,46.33179474),"
Bruce Township School
3199 E. 12 Mile Road
Dafter, MI 49724

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Bruce Township School",'Dafter=' + Dafter.length); Kincheloe[Kincheloe.length] = createMarker(new GPoint(-84.46488200,46.26036000),"
Consolidated Community School Services
4900 W. Davis Court
Kincheloe, MI 49788

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Consolidated Community School Services",'Kincheloe=' + Kincheloe.length); Detour_Village[Detour_Village.length] = createMarker(new GPoint(-83.90564728,45.98980713),"
Detour Elementary School
202 S. Division Street
Detour Village, MI 49725

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Detour Elementary School",'Detour_Village=' + Detour_Village.length); Detour_Village[Detour_Village.length] = createMarker(new GPoint(-83.90564728,45.98980713),"
Detour High School
Po Box 429
Detour Village, MI 49725

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Detour High School",'Detour_Village=' + Detour_Village.length); Drummond_Island[Drummond_Island.length] = createMarker(new GPoint(-83.74642600,46.01030000),"
Drummond Island Elementary School
Po Box 39
Drummond Island, MI 49726

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Drummond Island Elementary School",'Drummond_Island=' + Drummond_Island.length); Sault_Ste_Marie[Sault_Ste_Marie.length] = createMarker(new GPoint(-84.34313965,46.48706436),"
Lincoln School
810 E. 5th Avenue
Sault Ste. Marie, MI 49783

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Lincoln School",'Sault_Ste_Marie=' + Sault_Ste_Marie.length); Sault_Ste_Marie[Sault_Ste_Marie.length] = createMarker(new GPoint(-84.39791107,46.48773575),"
Mckinley Elementary School
2023 W. 4th Avenue
Sault Ste. Marie, MI 49783

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Mckinley Elementary School",'Sault_Ste_Marie=' + Sault_Ste_Marie.length); Brimley[Brimley.length] = createMarker(new GPoint(-86.54503632,41.94607925),"
Ojibwe Charter School
11507 West Industrial Drive
Brimley, MI 49715

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Ojibwe Charter School",'Brimley=' + Brimley.length); Pickford[Pickford.length] = createMarker(new GPoint(-84.33329773,46.15710068),"
Pickford Elementary School
P.o. Box 278
Pickford, MI 49774

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Pickford Elementary School",'Pickford=' + Pickford.length); Pickford[Pickford.length] = createMarker(new GPoint(-84.33329773,46.15710068),"
Pickford High School
P.o. Box 278
Pickford, MI 49774

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Pickford High School",'Pickford=' + Pickford.length); Kincheloe[Kincheloe.length] = createMarker(new GPoint(-84.44670105,46.27504730),"
R.j. Wallis Elementary School
15901 Country Club Drive
Kincheloe, MI 49788

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("R.j. Wallis Elementary School",'Kincheloe=' + Kincheloe.length); Rudyard[Rudyard.length] = createMarker(new GPoint(-84.72589874,46.21870041),"
Rudyard Center
Po Box 246, 11185 W. Second
Rudyard, MI 49780

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Rudyard Center",'Rudyard=' + Rudyard.length); Rudyard[Rudyard.length] = createMarker(new GPoint(-84.72589874,46.21870041),"
Rudyard High School
P.o. Box 246
Rudyard, MI 49780

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Rudyard High School",'Rudyard=' + Rudyard.length); Rudyard[Rudyard.length] = createMarker(new GPoint(-84.72589874,46.21870041),"
Rudyard Middle School
P.o. Box 246
Rudyard, MI 49780

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Rudyard Middle School",'Rudyard=' + Rudyard.length); Sault_Ste_Marie[Sault_Ste_Marie.length] = createMarker(new GPoint(-84.34450531,46.48066330),"
Sault Area High School
904 Marquette Avenue
Sault Ste. Marie, MI 49783

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Sault Area High School",'Sault_Ste_Marie=' + Sault_Ste_Marie.length); Sault_Ste_Marie[Sault_Ste_Marie.length] = createMarker(new GPoint(-84.34532166,46.48066330),"
Sault Area Middle School
684 Marquette Avenue
Sault Ste. Marie, MI 49783

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Sault Area Middle School",'Sault_Ste_Marie=' + Sault_Ste_Marie.length); Sault_Ste_Marie[Sault_Ste_Marie.length] = createMarker(new GPoint(-84.35369873,46.42258072),"
Soo Township School
5788 S. M-129
Sault Ste. Marie, MI 49783

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Soo Township School",'Sault_Ste_Marie=' + Sault_Ste_Marie.length); Rudyard[Rudyard.length] = createMarker(new GPoint(-84.72589874,46.21870041),"
Turner-howson Elementary School
P.o. Box 246
Rudyard, MI 49780

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Turner-howson Elementary School",'Rudyard=' + Rudyard.length); Sault_Ste_Marie[Sault_Ste_Marie.length] = createMarker(new GPoint(-84.35910034,46.49036407),"
Washington Elementary School
1200 Ryan Avenue
Sault Ste. Marie, MI 49783

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Washington Elementary School",'Sault_Ste_Marie=' + Sault_Ste_Marie.length); Paradise[Paradise.length] = createMarker(new GPoint(-85.10900116,46.61370087),"
Whitefish Township School
P.o. Box 58
Paradise, MI 49768

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Whitefish Township School",'Paradise=' + Paradise.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(Brimley); map.removeOverlays(Dafter); map.removeOverlays(Detour_Village); map.removeOverlays(Drummond_Island); map.removeOverlays(Kincheloe); map.removeOverlays(Paradise); map.removeOverlays(Pickford); map.removeOverlays(Rudyard); map.removeOverlays(Sault_Ste_Marie); 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(Sault_Ste_Marie);map.removeOverlays(Brimley); map.removeOverlays(Dafter); map.removeOverlays(Detour_Village); map.removeOverlays(Drummond_Island); map.removeOverlays(Kincheloe); map.removeOverlays(Paradise); map.removeOverlays(Pickford); map.removeOverlays(Rudyard); map.removeOverlays(Sault_Ste_Marie); map.addOverlays(Brimley); centerByArray(Brimley, false, false); cntMarker += Brimley.length; map.addOverlays(Dafter); centerByArray(Dafter, false, false); cntMarker += Dafter.length; map.addOverlays(Detour_Village); centerByArray(Detour_Village, false, false); cntMarker += Detour_Village.length; map.addOverlays(Drummond_Island); centerByArray(Drummond_Island, false, false); cntMarker += Drummond_Island.length; map.addOverlays(Kincheloe); centerByArray(Kincheloe, false, false); cntMarker += Kincheloe.length; map.addOverlays(Paradise); centerByArray(Paradise, false, false); cntMarker += Paradise.length; map.addOverlays(Pickford); centerByArray(Pickford, false, false); cntMarker += Pickford.length; map.addOverlays(Rudyard); centerByArray(Rudyard, false, false); cntMarker += Rudyard.length; map.addOverlays(Sault_Ste_Marie); centerByArray(Sault_Ste_Marie, false, false); cntMarker += Sault_Ste_Marie.length; centerByArray(Sault_Ste_Marie,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'); } }