function addMarkers() { mySelect = document.getElementById('selection'); Detroit_Lakes = [];White_Earth = [];Frazee = [];Audubon = [];Lake_Park = [];Ogema = [];Ponsford = [];mySelect.options[mySelect.options.length] = new Option("Audubon schools",'all=Audubon'); mySelect.options[mySelect.options.length] = new Option("Detroit Lakes schools",'all=Detroit_Lakes'); mySelect.options[mySelect.options.length] = new Option("Frazee schools",'all=Frazee'); mySelect.options[mySelect.options.length] = new Option("Lake Park schools",'all=Lake_Park'); mySelect.options[mySelect.options.length] = new Option("Ogema schools",'all=Ogema'); mySelect.options[mySelect.options.length] = new Option("Ponsford schools",'all=Ponsford'); mySelect.options[mySelect.options.length] = new Option("White Earth schools",'all=White_Earth'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Detroit_Lakes[Detroit_Lakes.length] = createMarker(new GPoint(-95.84690094,46.81914520),"
Callaway Targeted Services
702 Lake Avenue
Detroit Lakes, MN 56501

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Callaway Targeted Services",'Detroit_Lakes=' + Detroit_Lakes.length); White_Earth[White_Earth.length] = createMarker(new GPoint(-95.84300232,47.09659958),"
Circle Of Life Survival School
Country Road 21, P.o. Box 447
White Earth, MN 56591

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Circle Of Life Survival School",'White_Earth=' + White_Earth.length); Detroit_Lakes[Detroit_Lakes.length] = createMarker(new GPoint(-95.84696960,46.81921387),"
Detroit Lakes Alc High School
702 Lake Avenue
Detroit Lakes, MN 56501

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Detroit Lakes Alc High School",'Detroit_Lakes=' + Detroit_Lakes.length); Detroit_Lakes[Detroit_Lakes.length] = createMarker(new GPoint(-95.84333038,46.81698990),"
Detroit Lakes Altern. Program High School
702 Lake Avenue
Detroit Lakes, MN 56501

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Detroit Lakes Altern. Program High School",'Detroit_Lakes=' + Detroit_Lakes.length); Detroit_Lakes[Detroit_Lakes.length] = createMarker(new GPoint(-95.84523900,46.81946000),"
Detroit Lakes Mid. Sch. Target Svc.
500 11th Avenue S
Detroit Lakes, MN 56501

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Detroit Lakes Mid. Sch. Target Svc.",'Detroit_Lakes=' + Detroit_Lakes.length); Detroit_Lakes[Detroit_Lakes.length] = createMarker(new GPoint(-95.84523900,46.81946000),"
Detroit Lakes Middle Alc
702 Lake Avenue
Detroit Lakes, MN 56501

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Detroit Lakes Middle Alc",'Detroit_Lakes=' + Detroit_Lakes.length); Detroit_Lakes[Detroit_Lakes.length] = createMarker(new GPoint(-95.83059692,46.82051086),"
Detroit Lakes Middle School
510 11th Avenue
Detroit Lakes, MN 56501

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Detroit Lakes Middle School",'Detroit_Lakes=' + Detroit_Lakes.length); Detroit_Lakes[Detroit_Lakes.length] = createMarker(new GPoint(-95.83917236,46.80892944),"
Detroit Lakes Senior High School
1301 Roosevelt Avenue
Detroit Lakes, MN 56501

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Detroit Lakes Senior High School",'Detroit_Lakes=' + Detroit_Lakes.length); Frazee[Frazee.length] = createMarker(new GPoint(-95.56909943,46.74340057),"
Frazee Elementary School
Box 186
Frazee, MN 56544

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Frazee Elementary School",'Frazee=' + Frazee.length); Frazee[Frazee.length] = createMarker(new GPoint(-95.56909943,46.74340057),"
Frazee Secondary School
Box 186
Frazee, MN 56544

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Frazee Secondary School",'Frazee=' + Frazee.length); Detroit_Lakes[Detroit_Lakes.length] = createMarker(new GPoint(-95.84500122,46.81719971),"
Frazee Targeted Services
Box 766
Detroit Lakes, MN 56501

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Frazee Targeted Services",'Detroit_Lakes=' + Detroit_Lakes.length); Audubon[Audubon.length] = createMarker(new GPoint(-95.97760010,46.86560059),"
Lake Agassiz Sp. Ed. Coop. Elementary School
Box 209
Audubon, MN 56511

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Lake Agassiz Sp. Ed. Coop. Elementary School",'Audubon=' + Audubon.length); Audubon[Audubon.length] = createMarker(new GPoint(-95.97760010,46.86560059),"
Lake Park Audubon Elementary School
601 4th Street
Audubon, MN 56511

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Lake Park Audubon Elementary School",'Audubon=' + Audubon.length); Lake_Park[Lake_Park.length] = createMarker(new GPoint(-96.08200073,46.81959915),"
Lake Park Audubon Secondary School
429 Lake Street
Lake Park, MN 56554

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Lake Park Audubon Secondary School",'Lake_Park=' + Lake_Park.length); Detroit_Lakes[Detroit_Lakes.length] = createMarker(new GPoint(-95.84739685,46.81107712),"
Lincoln Community Ed
204 E Willow Street
Detroit Lakes, MN 56501

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Lincoln Community Ed",'Detroit_Lakes=' + Detroit_Lakes.length); Ogema[Ogema.length] = createMarker(new GPoint(-95.95290375,47.10419846),"
Ogema Elementary School
Box 68
Ogema, MN 56569

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Ogema Elementary School",'Ogema=' + Ogema.length); Ponsford[Ponsford.length] = createMarker(new GPoint(-95.33059692,47.04169846),"
Pine Point Elementary School
P.o. Box 8
Ponsford, MN 56575

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Pine Point Elementary School",'Ponsford=' + Ponsford.length); Detroit_Lakes[Detroit_Lakes.length] = createMarker(new GPoint(-95.84690094,46.81914520),"
Rooseveldt Targeted Services
702 Lake Ave.
Detroit Lakes, MN 56501

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Rooseveldt Targeted Services",'Detroit_Lakes=' + Detroit_Lakes.length); Detroit_Lakes[Detroit_Lakes.length] = createMarker(new GPoint(-95.83059692,46.82051086),"
Roosevelt Elementary School
510 11th Avenue
Detroit Lakes, MN 56501

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Roosevelt Elementary School",'Detroit_Lakes=' + Detroit_Lakes.length); Detroit_Lakes[Detroit_Lakes.length] = createMarker(new GPoint(-95.85321045,46.81073380),"
Rossman Elementary School
1221 Rossman Avenue
Detroit Lakes, MN 56501

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Rossman Elementary School",'Detroit_Lakes=' + Detroit_Lakes.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(Audubon); map.removeOverlays(Detroit_Lakes); map.removeOverlays(Frazee); map.removeOverlays(Lake_Park); map.removeOverlays(Ogema); map.removeOverlays(Ponsford); map.removeOverlays(White_Earth); 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(Detroit_Lakes);map.removeOverlays(Audubon); map.removeOverlays(Detroit_Lakes); map.removeOverlays(Frazee); map.removeOverlays(Lake_Park); map.removeOverlays(Ogema); map.removeOverlays(Ponsford); map.removeOverlays(White_Earth); map.addOverlays(Audubon); centerByArray(Audubon, false, false); cntMarker += Audubon.length; map.addOverlays(Detroit_Lakes); centerByArray(Detroit_Lakes, false, false); cntMarker += Detroit_Lakes.length; map.addOverlays(Frazee); centerByArray(Frazee, false, false); cntMarker += Frazee.length; map.addOverlays(Lake_Park); centerByArray(Lake_Park, false, false); cntMarker += Lake_Park.length; map.addOverlays(Ogema); centerByArray(Ogema, false, false); cntMarker += Ogema.length; map.addOverlays(Ponsford); centerByArray(Ponsford, false, false); cntMarker += Ponsford.length; map.addOverlays(White_Earth); centerByArray(White_Earth, false, false); cntMarker += White_Earth.length; centerByArray(Detroit_Lakes,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'); } }