function addMarkers() { mySelect = document.getElementById('selection'); Olathe = [];Olathe[Olathe.length] = createMarker(new GPoint(-94.77241516,38.83455276),"
",iconRd); mySelect.options[mySelect.options.length] = new Option("Arbor Creek Elementary School",'Olathe=' + Olathe.length); Olathe[Olathe.length] = createMarker(new GPoint(-94.76966095,38.86171722),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Black Bob Elementary School",'Olathe=' + Olathe.length); Olathe[Olathe.length] = createMarker(new GPoint(-94.76561737,38.87276459),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Briarwood Elementary School",'Olathe=' + Olathe.length); Olathe[Olathe.length] = createMarker(new GPoint(-94.77172089,38.84708023),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Brougham Elementary School",'Olathe=' + Olathe.length); Olathe[Olathe.length] = createMarker(new GPoint(-94.74626923,38.88702774),"",iconBl); mySelect.options[mySelect.options.length] = new Option("California Trail Junior High School",'Olathe=' + Olathe.length); Olathe[Olathe.length] = createMarker(new GPoint(-94.87137604,38.92599487),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Cedar Creek Elementary School",'Olathe=' + Olathe.length); Olathe[Olathe.length] = createMarker(new GPoint(-94.81707764,38.87874603),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Central Elementary School",'Olathe=' + Olathe.length); Olathe[Olathe.length] = createMarker(new GPoint(-94.77957916,38.84024429),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Chisholm Trail Junior Middle School",'Olathe=' + Olathe.length); Olathe[Olathe.length] = createMarker(new GPoint(-94.81887400,38.88353000),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Clearwater Creek Elementary School",'Olathe=' + Olathe.length); Olathe[Olathe.length] = createMarker(new GPoint(-94.77531433,38.90240097),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Countryside Elementary School",'Olathe=' + Olathe.length); Olathe[Olathe.length] = createMarker(new GPoint(-94.83218384,38.88918686),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Fairview Elementary School",'Olathe=' + Olathe.length); Olathe[Olathe.length] = createMarker(new GPoint(-94.76351166,38.86908722),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Frontier Trail Junior High School",'Olathe=' + Olathe.length); Olathe[Olathe.length] = createMarker(new GPoint(-94.75687408,38.86234283),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Green Springs Elementary School",'Olathe=' + Olathe.length); Olathe[Olathe.length] = createMarker(new GPoint(-94.79148102,38.86946106),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Havencroft Elementary School",'Olathe=' + Olathe.length); Olathe[Olathe.length] = createMarker(new GPoint(-94.74690247,38.90602875),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Heatherstone Elementary School",'Olathe=' + Olathe.length); Olathe[Olathe.length] = createMarker(new GPoint(-94.78792572,38.85909653),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Heritage Elementary School",'Olathe=' + Olathe.length); Olathe[Olathe.length] = createMarker(new GPoint(-94.77996826,38.81107330),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Hilltop Elementary School",'Olathe=' + Olathe.length); Olathe[Olathe.length] = createMarker(new GPoint(-94.76101685,38.89469147),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Indian Creek Elementary School",'Olathe=' + Olathe.length); Olathe[Olathe.length] = createMarker(new GPoint(-94.79441071,38.85463333),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Indian Trail Junior High School",'Olathe=' + Olathe.length); Olathe[Olathe.length] = createMarker(new GPoint(-94.75008392,38.85942078),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Liberty View Elementary School",'Olathe=' + Olathe.length); Olathe[Olathe.length] = createMarker(new GPoint(-94.80672455,38.90410233),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Mahaffie Elementary School",'Olathe=' + Olathe.length); Olathe[Olathe.length] = createMarker(new GPoint(-94.79084778,38.92509079),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Meadow Lane Elementary School",'Olathe=' + Olathe.length); Olathe[Olathe.length] = createMarker(new GPoint(-94.81372070,38.89521790),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Northview Elementary School",'Olathe=' + Olathe.length); Olathe[Olathe.length] = createMarker(new GPoint(-94.75555420,38.89815140),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Olathe East Senior High School",'Olathe=' + Olathe.length); Olathe[Olathe.length] = createMarker(new GPoint(-94.80938721,38.88733673),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Olathe North Senior High School",'Olathe=' + Olathe.length); Olathe[Olathe.length] = createMarker(new GPoint(-94.84329987,38.89590073),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Olathe Northwest High School",'Olathe=' + Olathe.length); Olathe[Olathe.length] = createMarker(new GPoint(-94.79020691,38.85468674),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Olathe South Senior High School",'Olathe=' + Olathe.length); Olathe[Olathe.length] = createMarker(new GPoint(-94.84762573,38.86912537),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Oregon Trail Junior High School",'Olathe=' + Olathe.length); Olathe[Olathe.length] = createMarker(new GPoint(-94.76101685,38.89817047),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Pioneer Trail Junior High School",'Olathe=' + Olathe.length); Olathe[Olathe.length] = createMarker(new GPoint(-94.86057281,38.89141464),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Prairie Center Elementary School",'Olathe=' + Olathe.length); Olathe[Olathe.length] = createMarker(new GPoint(-94.83573900,38.93519300),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Prairie Trail Junior High School",'Olathe=' + Olathe.length); Olathe[Olathe.length] = createMarker(new GPoint(-94.82634700,38.90691600),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Ravenwood Elementary School",'Olathe=' + Olathe.length); Olathe[Olathe.length] = createMarker(new GPoint(-94.74968719,38.88751221),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Regency Place Elementary School",'Olathe=' + Olathe.length); Olathe[Olathe.length] = createMarker(new GPoint(-94.79837036,38.87770081),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Ridgeview Elementary School",'Olathe=' + Olathe.length); Olathe[Olathe.length] = createMarker(new GPoint(-94.84314728,38.87686157),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Rolling Ridge Elementary School",'Olathe=' + Olathe.length); Olathe[Olathe.length] = createMarker(new GPoint(-94.79730225,38.89799118),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Santa Fe Trail Junior High School",'Olathe=' + Olathe.length); Olathe[Olathe.length] = createMarker(new GPoint(-94.79002380,38.84989548),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Scarborough Elementary School",'Olathe=' + Olathe.length); Olathe[Olathe.length] = createMarker(new GPoint(-94.81298065,38.88213730),"",iconRd); mySelect.options[mySelect.options.length] = new Option("School For Deaf Elementary School",'Olathe=' + Olathe.length); Olathe[Olathe.length] = createMarker(new GPoint(-94.81298065,38.88213730),"",iconGr); mySelect.options[mySelect.options.length] = new Option("School For Deaf High School",'Olathe=' + Olathe.length); Olathe[Olathe.length] = createMarker(new GPoint(-94.78720093,38.84080124),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Sunnyside Elementary School",'Olathe=' + Olathe.length); Olathe[Olathe.length] = createMarker(new GPoint(-94.76922607,38.87768173),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Tomahawk Elementary School",'Olathe=' + Olathe.length); Olathe[Olathe.length] = createMarker(new GPoint(-94.74247742,38.91455460),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Walnut Grove Elementary School",'Olathe=' + Olathe.length); Olathe[Olathe.length] = createMarker(new GPoint(-94.79730988,38.89937592),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Washington Elementary School",'Olathe=' + Olathe.length); Olathe[Olathe.length] = createMarker(new GPoint(-94.82975769,38.87529373),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Westview Elementary School",'Olathe=' + Olathe.length); map.removeOverlays(Olathe); setTimeout(function(){map.addOverlays(Olathe)},1000); maxLng = -94.74247742; maxLat = 38.93519300; minLng = -94.87137604; minLat = 38.81107330; reCenterMap(); } // 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(Olathe); 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(Olathe);map.removeOverlays(Olathe); map.addOverlays(Olathe); centerByArray(Olathe, false, false); cntMarker += Olathe.length; centerByArray(Olathe,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'); } }