function addMarkers() { mySelect = document.getElementById('selection'); Garden_City = [];Holcomb = [];mySelect.options[mySelect.options.length] = new Option("Garden City schools",'all=Garden_City'); mySelect.options[mySelect.options.length] = new Option("Holcomb schools",'all=Holcomb'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Garden_City[Garden_City.length] = createMarker(new GPoint(-100.87318400,37.96918000),"
Abe Hubert Middle School
1205 A Street
Garden City, KS 67846

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Abe Hubert Middle School",'Garden_City=' + Garden_City.length); Garden_City[Garden_City.length] = createMarker(new GPoint(-100.86074066,37.96706390),"
Alta Brown Elementary School
1110 East Pine
Garden City, KS 67846

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Alta Brown Elementary School",'Garden_City=' + Garden_City.length); Garden_City[Garden_City.length] = createMarker(new GPoint(-100.86127472,37.99670029),"
Bernadine Sitts Intermediate Center
3101 N Belmont
Garden City, KS 67846

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Bernadine Sitts Intermediate Center",'Garden_City=' + Garden_City.length); Garden_City[Garden_City.length] = createMarker(new GPoint(-100.88322449,37.97178650),"
Buffalo Jones Elementary School
708 Taylor Ave
Garden City, KS 67846

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Buffalo Jones Elementary School",'Garden_City=' + Garden_City.length); Garden_City[Garden_City.length] = createMarker(new GPoint(-100.82917023,37.96463776),"
Charles O Stones Intermediate Center
401 N Jennie Barker Rd
Garden City, KS 67846

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Charles O Stones Intermediate Center",'Garden_City=' + Garden_City.length); Garden_City[Garden_City.length] = createMarker(new GPoint(-100.89031982,37.98068237),"
Edith Scheuerman Elementary School
1901 Wilcox
Garden City, KS 67846

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Edith Scheuerman Elementary School",'Garden_City=' + Garden_City.length); Garden_City[Garden_City.length] = createMarker(new GPoint(-100.85244751,37.99163818),"
Florence Wilson Elementary School
1709 Labrador Blvd
Garden City, KS 67846

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Florence Wilson Elementary School",'Garden_City=' + Garden_City.length); Garden_City[Garden_City.length] = createMarker(new GPoint(-100.87046051,37.97777557),"
Garden City Senior High School
1412 N Main
Garden City, KS 67846

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Garden City Senior High School",'Garden_City=' + Garden_City.length); Garden_City[Garden_City.length] = createMarker(new GPoint(-100.87281036,37.97199249),"
Garfield Elementary School
121 West Walnut
Garden City, KS 67846

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Garfield Elementary School",'Garden_City=' + Garden_City.length); Garden_City[Garden_City.length] = createMarker(new GPoint(-100.86982727,37.98159790),"
Georgia Matthews Elementary School
111 Johnson
Garden City, KS 67846

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Georgia Matthews Elementary School",'Garden_City=' + Garden_City.length); Garden_City[Garden_City.length] = createMarker(new GPoint(-100.87841034,37.98423767),"
Gertrude Walker Elementary School
805 W Fair
Garden City, KS 67846

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Gertrude Walker Elementary School",'Garden_City=' + Garden_City.length); Holcomb[Holcomb.length] = createMarker(new GPoint(-101.00340271,38.03239822),"
Holcomb Elementary 4-5
Box 1025
Holcomb, KS 67851

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Holcomb Elementary 4-5",'Holcomb=' + Holcomb.length); Holcomb[Holcomb.length] = createMarker(new GPoint(-101.00340271,38.03239822),"
Holcomb High School
Box 38
Holcomb, KS 67851

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Holcomb High School",'Holcomb=' + Holcomb.length); Holcomb[Holcomb.length] = createMarker(new GPoint(-101.00340271,38.03239822),"
Holcomb Middle School
Box 89
Holcomb, KS 67851

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Holcomb Middle School",'Holcomb=' + Holcomb.length); Garden_City[Garden_City.length] = createMarker(new GPoint(-100.82937622,38.03168488),"
Jennie Barker Elementary School
5585 N Jennie Barker Rd
Garden City, KS 67846

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Jennie Barker Elementary School",'Garden_City=' + Garden_City.length); Garden_City[Garden_City.length] = createMarker(new GPoint(-100.85850525,37.97833633),"
Jennie Wilson Elementary School
1401 E Harding
Garden City, KS 67846

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Jennie Wilson Elementary School",'Garden_City=' + Garden_City.length); Garden_City[Garden_City.length] = createMarker(new GPoint(-100.85402679,37.98740387),"
Kenneth Henderson Middle School
2406 Fleming
Garden City, KS 67846

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Kenneth Henderson Middle School",'Garden_City=' + Garden_City.length); Garden_City[Garden_City.length] = createMarker(new GPoint(-100.87111664,37.80946350),"
Pierceville-plymell Elementary School
20 W Plymell Rd
Garden City, KS 67846

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Pierceville-plymell Elementary School",'Garden_City=' + Garden_City.length); Garden_City[Garden_City.length] = createMarker(new GPoint(-100.83046722,37.96773529),"
Victor Ornelas Elementary School
3401 E Spruce
Garden City, KS 67846

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Victor Ornelas Elementary School",'Garden_City=' + Garden_City.length); Holcomb[Holcomb.length] = createMarker(new GPoint(-100.99077606,37.98430252),"
Wiley Elementary School
P.o. Box 37
Holcomb, KS 67851

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Wiley Elementary School",'Holcomb=' + Holcomb.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(Garden_City); map.removeOverlays(Holcomb); 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(Garden_City);map.removeOverlays(Garden_City); map.removeOverlays(Holcomb); map.addOverlays(Garden_City); centerByArray(Garden_City, false, false); cntMarker += Garden_City.length; map.addOverlays(Holcomb); centerByArray(Holcomb, false, false); cntMarker += Holcomb.length; centerByArray(Garden_City,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'); } }