function addMarkers() { mySelect = document.getElementById('selection'); Barnesville = [];Moorhead = [];Dilworth = [];Glyndon = [];Hawley = [];Ulen = [];mySelect.options[mySelect.options.length] = new Option("Barnesville schools",'all=Barnesville'); mySelect.options[mySelect.options.length] = new Option("Dilworth schools",'all=Dilworth'); mySelect.options[mySelect.options.length] = new Option("Glyndon schools",'all=Glyndon'); mySelect.options[mySelect.options.length] = new Option("Hawley schools",'all=Hawley'); mySelect.options[mySelect.options.length] = new Option("Moorhead schools",'all=Moorhead'); mySelect.options[mySelect.options.length] = new Option("Ulen schools",'all=Ulen'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Barnesville[Barnesville.length] = createMarker(new GPoint(-96.40920258,46.67789841),"
Barnesville Elementary School
Box 189
Barnesville, MN 56514

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Barnesville Elementary School",'Barnesville=' + Barnesville.length); Barnesville[Barnesville.length] = createMarker(new GPoint(-96.40920258,46.67789841),"
Barnesville Secondary School
Box 189
Barnesville, MN 56514

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Barnesville Secondary School",'Barnesville=' + Barnesville.length); Moorhead[Moorhead.length] = createMarker(new GPoint(-96.74256134,46.87192917),"
Clay County Outreach Center
324 24th Street S
Moorhead, MN 56560

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Clay County Outreach Center",'Moorhead=' + Moorhead.length); Moorhead[Moorhead.length] = createMarker(new GPoint(-96.77166400,46.87504500),"
Clay County Shelter Care
919 8th Avenue N
Moorhead, MN 56560

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Clay County Shelter Care",'Moorhead=' + Moorhead.length); Moorhead[Moorhead.length] = createMarker(new GPoint(-96.76531982,46.88356400),"
Clay County Shelter Care High School
919 8th Avenue N
Moorhead, MN 56560

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Clay County Shelter Care High School",'Moorhead=' + Moorhead.length); Dilworth[Dilworth.length] = createMarker(new GPoint(-96.70089722,46.87829971),"
Dilworth Elementary School
Box 188 113 1st Street Nw
Dilworth, MN 56529

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Dilworth Elementary School",'Dilworth=' + Dilworth.length); Dilworth[Dilworth.length] = createMarker(new GPoint(-96.70089722,46.87829971),"
Dilworth-glyndon-felton Junior Middle School
Box 188
Dilworth, MN 56529

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Dilworth-glyndon-felton Junior Middle School",'Dilworth=' + Dilworth.length); Glyndon[Glyndon.length] = createMarker(new GPoint(-96.57039642,46.88259888),"
Dilworth-glyndon-felton Senior High School
513 Parke Avenue S
Glyndon, MN 56547

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Dilworth-glyndon-felton Senior High School",'Glyndon=' + Glyndon.length); Moorhead[Moorhead.length] = createMarker(new GPoint(-96.75730133,46.86280823),"
Edison Elementary School
1201 40th Avenue S
Moorhead, MN 56560

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Edison Elementary School",'Moorhead=' + Moorhead.length); Glyndon[Glyndon.length] = createMarker(new GPoint(-96.57039642,46.88259888),"
Glyndon-felton Elementary School
513 Parke Avenue S
Glyndon, MN 56547

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Glyndon-felton Elementary School",'Glyndon=' + Glyndon.length); Hawley[Hawley.length] = createMarker(new GPoint(-96.30439758,46.87670135),"
Hawley Elementary School
Box 608
Hawley, MN 56549

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Hawley Elementary School",'Hawley=' + Hawley.length); Hawley[Hawley.length] = createMarker(new GPoint(-96.30439758,46.87670135),"
Hawley Secondary School
Box 608
Hawley, MN 56549

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Hawley Secondary School",'Hawley=' + Hawley.length); Moorhead[Moorhead.length] = createMarker(new GPoint(-96.77160900,46.87504000),"
Moorhead Alternative Program
1100 32nd Avenue S
Moorhead, MN 56560

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Moorhead Alternative Program",'Moorhead=' + Moorhead.length); Moorhead[Moorhead.length] = createMarker(new GPoint(-96.76259613,46.85469818),"
Moorhead Junior Middle School
2020 South 11th Street
Moorhead, MN 56560

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Moorhead Junior Middle School",'Moorhead=' + Moorhead.length); Moorhead[Moorhead.length] = createMarker(new GPoint(-96.74419403,46.87143707),"
Moorhead Senior High School
2300 4th Avenue S
Moorhead, MN 56560

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Moorhead Senior High School",'Moorhead=' + Moorhead.length); Moorhead[Moorhead.length] = createMarker(new GPoint(-96.76290131,46.84203720),"
Moorhead Ts
1100 32nd Avenue S
Moorhead, MN 56560

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Moorhead Ts",'Moorhead=' + Moorhead.length); Moorhead[Moorhead.length] = createMarker(new GPoint(-96.75745400,46.85121000),"
Probstfield Center For Ed.
2410 14th Street S
Moorhead, MN 56560

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Probstfield Center For Ed.",'Moorhead=' + Moorhead.length); Moorhead[Moorhead.length] = createMarker(new GPoint(-96.75720978,46.85108185),"
Probstfield Elementary School
3601 12th Avenue S
Moorhead, MN 56560

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Probstfield Elementary School",'Moorhead=' + Moorhead.length); Moorhead[Moorhead.length] = createMarker(new GPoint(-96.76229858,46.88510513),"
Robert Asp Elementary School
910 N 11th Street
Moorhead, MN 56560

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Robert Asp Elementary School",'Moorhead=' + Moorhead.length); Moorhead[Moorhead.length] = createMarker(new GPoint(-96.76290131,46.84203720),"
Rralc
1100 32nd Ave. S.
Moorhead, MN 56560

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Rralc",'Moorhead=' + Moorhead.length); Hawley[Hawley.length] = createMarker(new GPoint(-96.30439758,46.87670135),"
Spring Prairie Elementary School
Box 608
Hawley, MN 56549

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Spring Prairie Elementary School",'Hawley=' + Hawley.length); Ulen[Ulen.length] = createMarker(new GPoint(-96.28160095,47.09049988),"
Ulen-hitterdal Elementary School
Box 389
Ulen, MN 56585

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Ulen-hitterdal Elementary School",'Ulen=' + Ulen.length); Ulen[Ulen.length] = createMarker(new GPoint(-96.28160095,47.09049988),"
Ulen-hitterdal Secondary School
Box 389
Ulen, MN 56585

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Ulen-hitterdal Secondary School",'Ulen=' + Ulen.length); Moorhead[Moorhead.length] = createMarker(new GPoint(-96.76531982,46.88356400),"
W. Central Juvenile Center
919 8th Ave. N.
Moorhead, MN 56560

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("W. Central Juvenile Center",'Moorhead=' + Moorhead.length); Moorhead[Moorhead.length] = createMarker(new GPoint(-96.74543762,46.86206436),"
Youth Educational Services High School
2215 12th Avenue S
Moorhead, MN 56560

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Youth Educational Services High School",'Moorhead=' + Moorhead.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(Barnesville); map.removeOverlays(Dilworth); map.removeOverlays(Glyndon); map.removeOverlays(Hawley); map.removeOverlays(Moorhead); map.removeOverlays(Ulen); 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(Barnesville);map.removeOverlays(Barnesville); map.removeOverlays(Dilworth); map.removeOverlays(Glyndon); map.removeOverlays(Hawley); map.removeOverlays(Moorhead); map.removeOverlays(Ulen); map.addOverlays(Barnesville); centerByArray(Barnesville, false, false); cntMarker += Barnesville.length; map.addOverlays(Dilworth); centerByArray(Dilworth, false, false); cntMarker += Dilworth.length; map.addOverlays(Glyndon); centerByArray(Glyndon, false, false); cntMarker += Glyndon.length; map.addOverlays(Hawley); centerByArray(Hawley, false, false); cntMarker += Hawley.length; map.addOverlays(Moorhead); centerByArray(Moorhead, false, false); cntMarker += Moorhead.length; map.addOverlays(Ulen); centerByArray(Ulen, false, false); cntMarker += Ulen.length; centerByArray(Barnesville,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'); } }