function addMarkers() { mySelect = document.getElementById('selection'); Baxter_Springs = [];Fort_Riley = [];Ottawa = [];Junction_City = [];Fort_Scott = [];Arkansas_City = [];Augusta = [];Ft_Riley = [];Shawnee_Mission = [];Olathe = [];Overland_Park = [];mySelect.options[mySelect.options.length] = new Option("Arkansas City schools",'all=Arkansas_City'); mySelect.options[mySelect.options.length] = new Option("Augusta schools",'all=Augusta'); mySelect.options[mySelect.options.length] = new Option("Baxter Springs schools",'all=Baxter_Springs'); mySelect.options[mySelect.options.length] = new Option("Fort Riley schools",'all=Fort_Riley'); mySelect.options[mySelect.options.length] = new Option("Fort Scott schools",'all=Fort_Scott'); mySelect.options[mySelect.options.length] = new Option("Ft Riley schools",'all=Ft_Riley'); mySelect.options[mySelect.options.length] = new Option("Junction City schools",'all=Junction_City'); mySelect.options[mySelect.options.length] = new Option("Olathe schools",'all=Olathe'); mySelect.options[mySelect.options.length] = new Option("Ottawa schools",'all=Ottawa'); mySelect.options[mySelect.options.length] = new Option("Overland Park schools",'all=Overland_Park'); mySelect.options[mySelect.options.length] = new Option("Shawnee Mission schools",'all=Shawnee_Mission'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Baxter_Springs[Baxter_Springs.length] = createMarker(new GPoint(-94.73491669,37.03767395),"
Baxter Springs High School
100 N Military
Baxter Springs, KS 66713

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Baxter Springs High School",'Baxter_Springs=' + Baxter_Springs.length); Fort_Riley[Fort_Riley.length] = createMarker(new GPoint(-96.81369781,39.08791351),"
Custer Hill Elementary School
6344 Hampton Place
Fort Riley, KS 66442

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Custer Hill Elementary School",'Fort_Riley=' + Fort_Riley.length); Ottawa[Ottawa.length] = createMarker(new GPoint(-95.27717590,38.59579086),"
Eisenhower Elementary School
1404 South Ash
Ottawa, KS 66067

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Eisenhower Elementary School",'Ottawa=' + Ottawa.length); Junction_City[Junction_City.length] = createMarker(new GPoint(-96.85205841,39.01037979),"
Eisenhower Elementary School
1625 St Marys Rd
Junction City, KS 66441

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Eisenhower Elementary School",'Junction_City=' + Junction_City.length); Fort_Scott[Fort_Scott.length] = createMarker(new GPoint(-94.69692230,37.83893585),"
Eugene Ware Elementary School
900 E Third
Fort Scott, KS 66701

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Eugene Ware Elementary School",'Fort_Scott=' + Fort_Scott.length); Arkansas_City[Arkansas_City.length] = createMarker(new GPoint(-97.04417419,37.06364822),"
Frances Willard Elementary School
201 N 4th
Arkansas City, KS 67005

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Frances Willard Elementary School",'Arkansas_City=' + Arkansas_City.length); Augusta[Augusta.length] = createMarker(new GPoint(-96.97840881,37.68432617),"
Garfield Elementary School
135 High
Augusta, KS 67010

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Garfield Elementary School",'Augusta=' + Augusta.length); Ft_Riley[Ft_Riley.length] = createMarker(new GPoint(-96.80794525,39.09641647),"
Jefferson Elementary School
4720 Jackson Avenue
Ft Riley, KS 66442

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Jefferson Elementary School",'Ft_Riley=' + Ft_Riley.length); Shawnee_Mission[Shawnee_Mission.length] = createMarker(new GPoint(-94.74622345,38.98559189),"
Mill Creek Elementary School
13951 W 79th St
Shawnee Mission, KS 66215

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Mill Creek Elementary School",'Shawnee_Mission=' + Shawnee_Mission.length); Fort_Riley[Fort_Riley.length] = createMarker(new GPoint(-96.78582001,39.07107544),"
Morris Hill Elementary School
4400 First Division Rd
Fort Riley, KS 66442

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Morris Hill Elementary School",'Fort_Riley=' + Fort_Riley.length); Olathe[Olathe.length] = createMarker(new GPoint(-94.74968719,38.88751221),"
Regency Place Elementary School
13250 S Greenwood
Olathe, KS 66062

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Regency Place Elementary School",'Olathe=' + Olathe.length); Junction_City[Junction_City.length] = createMarker(new GPoint(-96.83583069,39.01556396),"
Sheridan Elementary School
429 W Ash
Junction City, KS 66441

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Sheridan Elementary School",'Junction_City=' + Junction_City.length); Overland_Park[Overland_Park.length] = createMarker(new GPoint(-94.65592194,38.84123993),"
Stanley Elementary School
6121 W 158th Street
Overland Park, KS 66223

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Stanley Elementary School",'Overland_Park=' + Overland_Park.length); Olathe[Olathe.length] = createMarker(new GPoint(-94.82975769,38.87529373),"
Westview Elementary School
601 Lee
Olathe, KS 66061

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Westview Elementary School",'Olathe=' + Olathe.length); map.removeOverlays(Arkansas_City); map.removeOverlays(Augusta); map.removeOverlays(Baxter_Springs); map.removeOverlays(Fort_Riley); map.removeOverlays(Fort_Scott); map.removeOverlays(Ft_Riley); map.removeOverlays(Junction_City); map.removeOverlays(Olathe); map.removeOverlays(Ottawa); map.removeOverlays(Overland_Park); map.removeOverlays(Shawnee_Mission); setTimeout(function(){map.addOverlays(Arkansas_City)},1000); setTimeout(function(){map.addOverlays(Augusta)},1000); setTimeout(function(){map.addOverlays(Baxter_Springs)},1000); setTimeout(function(){map.addOverlays(Fort_Riley)},1000); setTimeout(function(){map.addOverlays(Fort_Scott)},1000); setTimeout(function(){map.addOverlays(Ft_Riley)},1000); setTimeout(function(){map.addOverlays(Junction_City)},1000); setTimeout(function(){map.addOverlays(Olathe)},1000); setTimeout(function(){map.addOverlays(Ottawa)},1000); setTimeout(function(){map.addOverlays(Overland_Park)},1000); setTimeout(function(){map.addOverlays(Shawnee_Mission)},1000); maxLng = -94.65592194; maxLat = 39.09641647; minLng = -97.04417419; minLat = 37.03767395; 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(Arkansas_City); map.removeOverlays(Augusta); map.removeOverlays(Baxter_Springs); map.removeOverlays(Fort_Riley); map.removeOverlays(Fort_Scott); map.removeOverlays(Ft_Riley); map.removeOverlays(Junction_City); map.removeOverlays(Olathe); map.removeOverlays(Ottawa); map.removeOverlays(Overland_Park); map.removeOverlays(Shawnee_Mission); 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(Baxter_Springs);map.removeOverlays(Arkansas_City); map.removeOverlays(Augusta); map.removeOverlays(Baxter_Springs); map.removeOverlays(Fort_Riley); map.removeOverlays(Fort_Scott); map.removeOverlays(Ft_Riley); map.removeOverlays(Junction_City); map.removeOverlays(Olathe); map.removeOverlays(Ottawa); map.removeOverlays(Overland_Park); map.removeOverlays(Shawnee_Mission); map.addOverlays(Arkansas_City); centerByArray(Arkansas_City, false, false); cntMarker += Arkansas_City.length; map.addOverlays(Augusta); centerByArray(Augusta, false, false); cntMarker += Augusta.length; map.addOverlays(Baxter_Springs); centerByArray(Baxter_Springs, false, false); cntMarker += Baxter_Springs.length; map.addOverlays(Fort_Riley); centerByArray(Fort_Riley, false, false); cntMarker += Fort_Riley.length; map.addOverlays(Fort_Scott); centerByArray(Fort_Scott, false, false); cntMarker += Fort_Scott.length; map.addOverlays(Ft_Riley); centerByArray(Ft_Riley, false, false); cntMarker += Ft_Riley.length; map.addOverlays(Junction_City); centerByArray(Junction_City, false, false); cntMarker += Junction_City.length; map.addOverlays(Olathe); centerByArray(Olathe, false, false); cntMarker += Olathe.length; map.addOverlays(Ottawa); centerByArray(Ottawa, false, false); cntMarker += Ottawa.length; map.addOverlays(Overland_Park); centerByArray(Overland_Park, false, false); cntMarker += Overland_Park.length; map.addOverlays(Shawnee_Mission); centerByArray(Shawnee_Mission, false, false); cntMarker += Shawnee_Mission.length; centerByArray(Baxter_Springs,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///30817,30773,30793,31302,31307,31083,31305,31315,31308,31616,31602,30715,31862,31809,/all'); } }