function addMarkers() { mySelect = document.getElementById('selection'); East_Grand_Forks = [];Climax = [];Crookston = [];Fertile = [];Fisher = [];Fosston = [];Erskine = [];mySelect.options[mySelect.options.length] = new Option("Climax schools",'all=Climax'); mySelect.options[mySelect.options.length] = new Option("Crookston schools",'all=Crookston'); mySelect.options[mySelect.options.length] = new Option("East Grand Forks schools",'all=East_Grand_Forks'); mySelect.options[mySelect.options.length] = new Option("Erskine schools",'all=Erskine'); mySelect.options[mySelect.options.length] = new Option("Fertile schools",'all=Fertile'); mySelect.options[mySelect.options.length] = new Option("Fisher schools",'all=Fisher'); mySelect.options[mySelect.options.length] = new Option("Fosston schools",'all=Fosston'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); East_Grand_Forks[East_Grand_Forks.length] = createMarker(new GPoint(-97.02040100,47.94018173),"
Area Special Education Coop.
1505 Central Avenue Nw
East Grand Forks, MN 56721

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Area Special Education Coop.",'East_Grand_Forks=' + East_Grand_Forks.length); East_Grand_Forks[East_Grand_Forks.length] = createMarker(new GPoint(-97.01799774,47.93149948),"
Central Middle School
Box 151
East Grand Forks, MN 56721

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Central Middle School",'East_Grand_Forks=' + East_Grand_Forks.length); Climax[Climax.length] = createMarker(new GPoint(-96.76280212,47.65499878),"
Climax Elementary School
Box 67
Climax, MN 56523

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Climax Elementary School",'Climax=' + Climax.length); Climax[Climax.length] = createMarker(new GPoint(-96.76280212,47.65499878),"
Climax Secondary School
Box 67
Climax, MN 56523

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Climax Secondary School",'Climax=' + Climax.length); Crookston[Crookston.length] = createMarker(new GPoint(-96.61364600,47.76054900),"
Crookston Pre-k
1407 Erskine Street
Crookston, MN 56716

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Crookston Pre-k",'Crookston=' + Crookston.length); Crookston[Crookston.length] = createMarker(new GPoint(-96.59474182,47.78941345),"
Crookston Secondary School
402 Fisher Avenue
Crookston, MN 56716

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Crookston Secondary School",'Crookston=' + Crookston.length); East_Grand_Forks[East_Grand_Forks.length] = createMarker(new GPoint(-97.01799774,47.93149948),"
East Grand Forks Senior High School
Box 151
East Grand Forks, MN 56721

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("East Grand Forks Senior High School",'East_Grand_Forks=' + East_Grand_Forks.length); Fertile[Fertile.length] = createMarker(new GPoint(-96.24420166,47.51219940),"
Fertile-beltrami Elementary School
Box 648
Fertile, MN 56540

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Fertile-beltrami Elementary School",'Fertile=' + Fertile.length); Fertile[Fertile.length] = createMarker(new GPoint(-96.28054100,47.53456500),"
Fertile-beltrami Secondary
Box 648
Fertile, MN 56540

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Fertile-beltrami Secondary",'Fertile=' + Fertile.length); Fisher[Fisher.length] = createMarker(new GPoint(-96.79429626,47.79772186),"
Fisher Elementary School
313 Park Avenue
Fisher, MN 56723

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Fisher Elementary School",'Fisher=' + Fisher.length); Fisher[Fisher.length] = createMarker(new GPoint(-96.79429626,47.79772186),"
Fisher Secondary School
313 Park Avenue
Fisher, MN 56723

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Fisher Secondary School",'Fisher=' + Fisher.length); Fosston[Fosston.length] = createMarker(new GPoint(-95.75420380,47.57744598),"
Fosston Secondary School
301 E 1st Street
Fosston, MN 56542

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Fosston Secondary School",'Fosston=' + Fosston.length); Crookston[Crookston.length] = createMarker(new GPoint(-96.58927917,47.77842331),"
Highland Elementary School
801 N Central Avenue
Crookston, MN 56716

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Highland Elementary School",'Crookston=' + Crookston.length); Fosston[Fosston.length] = createMarker(new GPoint(-95.74302673,47.57406616),"
Magelssen Elementary School
700 E 1st Street
Fosston, MN 56542

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Magelssen Elementary School",'Fosston=' + Fosston.length); East_Grand_Forks[East_Grand_Forks.length] = createMarker(new GPoint(-97.01799774,47.93149948),"
New Heights Elementary School
Box 151
East Grand Forks, MN 56721

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("New Heights Elementary School",'East_Grand_Forks=' + East_Grand_Forks.length); Crookston[Crookston.length] = createMarker(new GPoint(-96.60532379,47.77566528),"
New Paths Area Learning Center
121 E 3rd Street
Crookston, MN 56716

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("New Paths Area Learning Center",'Crookston=' + Crookston.length); Crookston[Crookston.length] = createMarker(new GPoint(-96.62380981,47.77137375),"
Red River Juvenile Center
600 Bruce Street
Crookston, MN 56716

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Red River Juvenile Center",'Crookston=' + Crookston.length); East_Grand_Forks[East_Grand_Forks.length] = createMarker(new GPoint(-97.01799774,47.93149948),"
South Point Elementary School
Box 151
East Grand Forks, MN 56721

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("South Point Elementary School",'East_Grand_Forks=' + East_Grand_Forks.length); Crookston[Crookston.length] = createMarker(new GPoint(-96.61112976,47.78230667),"
Washington Elementary School
724 University Avenue
Crookston, MN 56716

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Washington Elementary School",'Crookston=' + Crookston.length); Erskine[Erskine.length] = createMarker(new GPoint(-95.99729919,47.67240143),"
Win-e-mac Elementary School
23130 345th Street Se
Erskine, MN 56535

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Win-e-mac Elementary School",'Erskine=' + Erskine.length); Erskine[Erskine.length] = createMarker(new GPoint(-95.99729919,47.67240143),"
Win-e-mac Secondary School
Rr 2, Box 148a
Erskine, MN 56535

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Win-e-mac Secondary School",'Erskine=' + Erskine.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(Climax); map.removeOverlays(Crookston); map.removeOverlays(East_Grand_Forks); map.removeOverlays(Erskine); map.removeOverlays(Fertile); map.removeOverlays(Fisher); map.removeOverlays(Fosston); 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(East_Grand_Forks);map.removeOverlays(Climax); map.removeOverlays(Crookston); map.removeOverlays(East_Grand_Forks); map.removeOverlays(Erskine); map.removeOverlays(Fertile); map.removeOverlays(Fisher); map.removeOverlays(Fosston); map.addOverlays(Climax); centerByArray(Climax, false, false); cntMarker += Climax.length; map.addOverlays(Crookston); centerByArray(Crookston, false, false); cntMarker += Crookston.length; map.addOverlays(East_Grand_Forks); centerByArray(East_Grand_Forks, false, false); cntMarker += East_Grand_Forks.length; map.addOverlays(Erskine); centerByArray(Erskine, false, false); cntMarker += Erskine.length; map.addOverlays(Fertile); centerByArray(Fertile, false, false); cntMarker += Fertile.length; map.addOverlays(Fisher); centerByArray(Fisher, false, false); cntMarker += Fisher.length; map.addOverlays(Fosston); centerByArray(Fosston, false, false); cntMarker += Fosston.length; centerByArray(East_Grand_Forks,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'); } }