function addMarkers() { mySelect = document.getElementById('selection'); Beview = [];Morgan = [];Morton = [];Milroy = [];Lamberton = [];Redwood_Falls = [];Wabasso = [];Walnut_Grove = [];mySelect.options[mySelect.options.length] = new Option("Beview schools",'all=Beview'); mySelect.options[mySelect.options.length] = new Option("Lamberton schools",'all=Lamberton'); mySelect.options[mySelect.options.length] = new Option("Milroy schools",'all=Milroy'); mySelect.options[mySelect.options.length] = new Option("Morgan schools",'all=Morgan'); mySelect.options[mySelect.options.length] = new Option("Morton schools",'all=Morton'); mySelect.options[mySelect.options.length] = new Option("Redwood Falls schools",'all=Redwood_Falls'); mySelect.options[mySelect.options.length] = new Option("Wabasso schools",'all=Wabasso'); mySelect.options[mySelect.options.length] = new Option("Walnut Grove schools",'all=Walnut_Grove'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Beview[Beview.length] = createMarker(new GPoint(-95.75827789,44.95087814),"
Belview Learning Center
102 S 2nd Street
Beview, MN 56214

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Belview Learning Center",'Beview=' + Beview.length); Morgan[Morgan.length] = createMarker(new GPoint(-94.91110229,44.38619995),"
Cedar Mountain Elementary School
Box 188
Morgan, MN 56266

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Cedar Mountain Elementary School",'Morgan=' + Morgan.length); Morgan[Morgan.length] = createMarker(new GPoint(-94.90760040,44.39049911),"
Cedar Mountain Secondary School
Box 188
Morgan, MN 56266

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Cedar Mountain Secondary School",'Morgan=' + Morgan.length); Morton[Morton.length] = createMarker(new GPoint(-93.11798700,39.42500800),"
Eci' Nompa Woonspe
55box 10
Morton, MN 56270

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Eci' Nompa Woonspe",'Morton=' + Morton.length); Milroy[Milroy.length] = createMarker(new GPoint(-95.54740143,44.44620132),"
Milroy Elementary School
Box 10
Milroy, MN 56263

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Milroy Elementary School",'Milroy=' + Milroy.length); Milroy[Milroy.length] = createMarker(new GPoint(-95.54740143,44.44620132),"
Milroy Junior Middle School
Box 10, 103 Prospect St.
Milroy, MN 56263

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Milroy Junior Middle School",'Milroy=' + Milroy.length); Lamberton[Lamberton.length] = createMarker(new GPoint(-95.27729797,44.23880005),"
Red Rock Central Secondary School
Box 278
Lamberton, MN 56152

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Red Rock Central Secondary School",'Lamberton=' + Lamberton.length); Redwood_Falls[Redwood_Falls.length] = createMarker(new GPoint(-95.09381866,44.53675842),"
Redwood Valley Alt. High School
100 George Ramseth Drive
Redwood Falls, MN 56283

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Redwood Valley Alt. High School",'Redwood_Falls=' + Redwood_Falls.length); Redwood_Falls[Redwood_Falls.length] = createMarker(new GPoint(-95.09465027,44.53671646),"
Redwood Valley Middle School
100 George Ramseth Drive
Redwood Falls, MN 56283

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Redwood Valley Middle School",'Redwood_Falls=' + Redwood_Falls.length); Redwood_Falls[Redwood_Falls.length] = createMarker(new GPoint(-95.09381866,44.53675842),"
Redwood Valley Senior High School
100 George Ramseth Drive
Redwood Falls, MN 56283

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Redwood Valley Senior High School",'Redwood_Falls=' + Redwood_Falls.length); Redwood_Falls[Redwood_Falls.length] = createMarker(new GPoint(-95.10390472,44.53654099),"
Reede Gray Elementary School
201 Mc Phail Drive
Redwood Falls, MN 56283

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Reede Gray Elementary School",'Redwood_Falls=' + Redwood_Falls.length); Wabasso[Wabasso.length] = createMarker(new GPoint(-95.26969910,44.41099930),"
Vesta Secondary School
Box 69 1333 May Street
Wabasso, MN 56293

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Vesta Secondary School",'Wabasso=' + Wabasso.length); Wabasso[Wabasso.length] = createMarker(new GPoint(-95.26969910,44.41099930),"
Wabasso Elementary School
Box 69
Wabasso, MN 56293

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Wabasso Elementary School",'Wabasso=' + Wabasso.length); Wabasso[Wabasso.length] = createMarker(new GPoint(-95.26969910,44.41099930),"
Wabasso Secondary School
Box 69, 1333 May St.
Wabasso, MN 56293

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Wabasso Secondary School",'Wabasso=' + Wabasso.length); Walnut_Grove[Walnut_Grove.length] = createMarker(new GPoint(-95.46966553,44.22097778),"
Walnut Grove Elementary School
601 Washington Avnue
Walnut Grove, MN 56180

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Walnut Grove Elementary School",'Walnut_Grove=' + Walnut_Grove.length); Walnut_Grove[Walnut_Grove.length] = createMarker(new GPoint(-95.46977997,44.22084808),"
Westbrook Walnut Grove Middle School
601 Washington Avenue
Walnut Grove, MN 56180

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Westbrook Walnut Grove Middle School",'Walnut_Grove=' + Walnut_Grove.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(Beview); map.removeOverlays(Lamberton); map.removeOverlays(Milroy); map.removeOverlays(Morgan); map.removeOverlays(Morton); map.removeOverlays(Redwood_Falls); map.removeOverlays(Wabasso); map.removeOverlays(Walnut_Grove); 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(Beview);map.removeOverlays(Beview); map.removeOverlays(Lamberton); map.removeOverlays(Milroy); map.removeOverlays(Morgan); map.removeOverlays(Morton); map.removeOverlays(Redwood_Falls); map.removeOverlays(Wabasso); map.removeOverlays(Walnut_Grove); map.addOverlays(Beview); centerByArray(Beview, false, false); cntMarker += Beview.length; map.addOverlays(Lamberton); centerByArray(Lamberton, false, false); cntMarker += Lamberton.length; map.addOverlays(Milroy); centerByArray(Milroy, false, false); cntMarker += Milroy.length; map.addOverlays(Morgan); centerByArray(Morgan, false, false); cntMarker += Morgan.length; map.addOverlays(Morton); centerByArray(Morton, false, false); cntMarker += Morton.length; map.addOverlays(Redwood_Falls); centerByArray(Redwood_Falls, false, false); cntMarker += Redwood_Falls.length; map.addOverlays(Wabasso); centerByArray(Wabasso, false, false); cntMarker += Wabasso.length; map.addOverlays(Walnut_Grove); centerByArray(Walnut_Grove, false, false); cntMarker += Walnut_Grove.length; centerByArray(Beview,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'); } }