function addMarkers() { mySelect = document.getElementById('selection'); Backus = [];Bena = [];Cass_Lake = [];Remer = [];Longville = [];Pillager = [];Pine_River = [];Pequot_Lakes = [];Walker = [];mySelect.options[mySelect.options.length] = new Option("Backus schools",'all=Backus'); mySelect.options[mySelect.options.length] = new Option("Bena schools",'all=Bena'); mySelect.options[mySelect.options.length] = new Option("Cass Lake schools",'all=Cass_Lake'); mySelect.options[mySelect.options.length] = new Option("Longville schools",'all=Longville'); mySelect.options[mySelect.options.length] = new Option("Pequot Lakes schools",'all=Pequot_Lakes'); mySelect.options[mySelect.options.length] = new Option("Pillager schools",'all=Pillager'); mySelect.options[mySelect.options.length] = new Option("Pine River schools",'all=Pine_River'); mySelect.options[mySelect.options.length] = new Option("Remer schools",'all=Remer'); mySelect.options[mySelect.options.length] = new Option("Walker schools",'all=Walker'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Backus[Backus.length] = createMarker(new GPoint(-94.41400146,46.86280060),"
Backus Elementary School
Box 47
Backus, MN 56435

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Backus Elementary School",'Backus=' + Backus.length); Bena[Bena.length] = createMarker(new GPoint(-94.60456848,47.37908936),"
Bug-0-nay-ge-shig School
1553 Silver Eagle Drive Nw
Bena, MN 56626

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bug-0-nay-ge-shig School",'Bena=' + Bena.length); Cass_Lake[Cass_Lake.length] = createMarker(new GPoint(-94.60330200,47.37939072),"
Cass Lake-bena Alc High School
208 Central Avenue Nw
Cass Lake, MN 56633

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Cass Lake-bena Alc High School",'Cass_Lake=' + Cass_Lake.length); Cass_Lake[Cass_Lake.length] = createMarker(new GPoint(-94.60456848,47.37908936),"
Cass Lake-bena Elementary School
15 4th Street Nw
Cass Lake, MN 56633

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Cass Lake-bena Elementary School",'Cass_Lake=' + Cass_Lake.length); Cass_Lake[Cass_Lake.length] = createMarker(new GPoint(-94.60456848,47.37908936),"
Cass Lake-bena Middle School
15314 State 371 Nw
Cass Lake, MN 56633

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Cass Lake-bena Middle School",'Cass_Lake=' + Cass_Lake.length); Cass_Lake[Cass_Lake.length] = createMarker(new GPoint(-94.60456848,47.37908936),"
Cass Lake-bena Secondary School
15308 State 371 Nw
Cass Lake, MN 56633

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Cass Lake-bena Secondary School",'Cass_Lake=' + Cass_Lake.length); Cass_Lake[Cass_Lake.length] = createMarker(new GPoint(-94.60330200,47.37939072),"
Cass Lake-bena Targeted Services
208 Central Avenue Nw
Cass Lake, MN 56633

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Cass Lake-bena Targeted Services",'Cass_Lake=' + Cass_Lake.length); Remer[Remer.length] = createMarker(new GPoint(-93.91836400,47.05631300),"
Little Sand
316 Main Street E
Remer, MN 56672

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Little Sand",'Remer=' + Remer.length); Longville[Longville.length] = createMarker(new GPoint(-94.19730377,47.00469971),"
Longville Elementary School
Box 117
Longville, MN 56655

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Longville Elementary School",'Longville=' + Longville.length); Remer[Remer.length] = createMarker(new GPoint(-93.91289520,47.05643845),"
Northland Secondary School
316 Main Street E
Remer, MN 56672

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Northland Secondary School",'Remer=' + Remer.length); Pillager[Pillager.length] = createMarker(new GPoint(-94.48711395,46.33630371),"
Pillager Area Charter School
Box 130
Pillager, MN 56473

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Pillager Area Charter School",'Pillager=' + Pillager.length); Pillager[Pillager.length] = createMarker(new GPoint(-94.47149658,46.32830048),"
Pillager Elementary School
323 E Second Street S
Pillager, MN 56473

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Pillager Elementary School",'Pillager=' + Pillager.length); Pillager[Pillager.length] = createMarker(new GPoint(-94.47149658,46.32830048),"
Pillager Secondary School
323 East Second St. S.
Pillager, MN 56473

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Pillager Secondary School",'Pillager=' + Pillager.length); Pine_River[Pine_River.length] = createMarker(new GPoint(-94.41120148,46.70959854),"
Pine River 9 Grade Alc
Box 610
Pine River, MN 56474

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Pine River 9 Grade Alc",'Pine_River=' + Pine_River.length); Pine_River[Pine_River.length] = createMarker(new GPoint(-94.41120148,46.70959854),"
Pine River Alc High School
Box 610
Pine River, MN 56474

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Pine River Alc High School",'Pine_River=' + Pine_River.length); Pine_River[Pine_River.length] = createMarker(new GPoint(-94.40606900,46.71895000),"
Pine River Backus Targeted Svcs.
Box 610
Pine River, MN 56474

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Pine River Backus Targeted Svcs.",'Pine_River=' + Pine_River.length); Pine_River[Pine_River.length] = createMarker(new GPoint(-94.41120148,46.70959854),"
Pine River Elementary School
Box 610
Pine River, MN 56474

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Pine River Elementary School",'Pine_River=' + Pine_River.length); Pine_River[Pine_River.length] = createMarker(new GPoint(-94.41120148,46.70959854),"
Pine River Middle Alc
Box 610
Pine River, MN 56474

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Pine River Middle Alc",'Pine_River=' + Pine_River.length); Pequot_Lakes[Pequot_Lakes.length] = createMarker(new GPoint(-93.26360321,44.97999954),"
Pine River Pequot Lakes Ts
Box 368
Pequot Lakes, MN 55472

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Pine River Pequot Lakes Ts",'Pequot_Lakes=' + Pequot_Lakes.length); Pequot_Lakes[Pequot_Lakes.length] = createMarker(new GPoint(-94.38457200,46.73311000),"
Pine River Pequot Middle - Alc
Box 368
Pequot Lakes, MN 56474

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Pine River Pequot Middle - Alc",'Pequot_Lakes=' + Pequot_Lakes.length); Pine_River[Pine_River.length] = createMarker(new GPoint(-94.41120148,46.70959854),"
Pine River Secondary School
Box 610
Pine River, MN 56474

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Pine River Secondary School",'Pine_River=' + Pine_River.length); Remer[Remer.length] = createMarker(new GPoint(-93.91289520,47.05643845),"
Remer Elementary School
316 Main Street E
Remer, MN 56672

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Remer Elementary School",'Remer=' + Remer.length); Walker[Walker.length] = createMarker(new GPoint(-10.00000000,10.00000000),"
Turning Point Day Treatment
Box 4000
Walker, MN 56484

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Turning Point Day Treatment",'Walker=' + Walker.length); Walker[Walker.length] = createMarker(new GPoint(-94.54280090,47.08349991),"
W H A Alternative Program High School
Box 4000
Walker, MN 56484

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("W H A Alternative Program High School",'Walker=' + Walker.length); Walker[Walker.length] = createMarker(new GPoint(-94.54280090,47.08349991),"
W H A Midlevel Alternative Prg. Middle School
Box 4000
Walker, MN 56484

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("W H A Midlevel Alternative Prg. Middle School",'Walker=' + Walker.length); Walker[Walker.length] = createMarker(new GPoint(-94.58526400,47.10161000),"
W. H. A. Midlevel Alternative Prg.
Box 4000
Walker, MN 56484

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("W. H. A. Midlevel Alternative Prg.",'Walker=' + Walker.length); Walker[Walker.length] = createMarker(new GPoint(-94.54280090,47.08349991),"
W.h.a. Elementary School
Box 4000
Walker, MN 56484

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("W.h.a. Elementary School",'Walker=' + Walker.length); Walker[Walker.length] = createMarker(new GPoint(-94.54280090,47.08349991),"
W.h.a. Middle School
Box 4000
Walker, MN 56484

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("W.h.a. Middle School",'Walker=' + Walker.length); Walker[Walker.length] = createMarker(new GPoint(-94.54280090,47.08349991),"
Walker-hackensack-akeley Secondary School
Box 4000
Walker, MN 56484

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Walker-hackensack-akeley Secondary School",'Walker=' + Walker.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(Backus); map.removeOverlays(Bena); map.removeOverlays(Cass_Lake); map.removeOverlays(Longville); map.removeOverlays(Pequot_Lakes); map.removeOverlays(Pillager); map.removeOverlays(Pine_River); map.removeOverlays(Remer); map.removeOverlays(Walker); 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(Backus);map.removeOverlays(Backus); map.removeOverlays(Bena); map.removeOverlays(Cass_Lake); map.removeOverlays(Longville); map.removeOverlays(Pequot_Lakes); map.removeOverlays(Pillager); map.removeOverlays(Pine_River); map.removeOverlays(Remer); map.removeOverlays(Walker); map.addOverlays(Backus); centerByArray(Backus, false, false); cntMarker += Backus.length; map.addOverlays(Bena); centerByArray(Bena, false, false); cntMarker += Bena.length; map.addOverlays(Cass_Lake); centerByArray(Cass_Lake, false, false); cntMarker += Cass_Lake.length; map.addOverlays(Longville); centerByArray(Longville, false, false); cntMarker += Longville.length; map.addOverlays(Pequot_Lakes); centerByArray(Pequot_Lakes, false, false); cntMarker += Pequot_Lakes.length; map.addOverlays(Pillager); centerByArray(Pillager, false, false); cntMarker += Pillager.length; map.addOverlays(Pine_River); centerByArray(Pine_River, false, false); cntMarker += Pine_River.length; map.addOverlays(Remer); centerByArray(Remer, false, false); cntMarker += Remer.length; map.addOverlays(Walker); centerByArray(Walker, false, false); cntMarker += Walker.length; centerByArray(Backus,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'); } }