function addMarkers() { mySelect = document.getElementById('selection'); Dodge_City = [];Overland_Park = [];Ellsworth = [];Humboldt = [];Iola = [];Laharpe = [];Liberal = [];Moran = [];Oakley = [];Phillipsburg = [];St_George = [];Syracuse = [];mySelect.options[mySelect.options.length] = new Option("Dodge City schools",'all=Dodge_City'); mySelect.options[mySelect.options.length] = new Option("Ellsworth schools",'all=Ellsworth'); mySelect.options[mySelect.options.length] = new Option("Humboldt schools",'all=Humboldt'); mySelect.options[mySelect.options.length] = new Option("Iola schools",'all=Iola'); mySelect.options[mySelect.options.length] = new Option("Laharpe schools",'all=Laharpe'); mySelect.options[mySelect.options.length] = new Option("Liberal schools",'all=Liberal'); mySelect.options[mySelect.options.length] = new Option("Moran schools",'all=Moran'); mySelect.options[mySelect.options.length] = new Option("Oakley schools",'all=Oakley'); mySelect.options[mySelect.options.length] = new Option("Overland Park schools",'all=Overland_Park'); mySelect.options[mySelect.options.length] = new Option("Phillipsburg schools",'all=Phillipsburg'); mySelect.options[mySelect.options.length] = new Option("St George schools",'all=St_George'); mySelect.options[mySelect.options.length] = new Option("Syracuse schools",'all=Syracuse'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Dodge_City[Dodge_City.length] = createMarker(new GPoint(-100.03697205,37.73664474),"
Beeson Elementary School
1700 W Beeson Rd
Dodge City, KS 67801

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Beeson Elementary School",'Dodge_City=' + Dodge_City.length); Overland_Park[Overland_Park.length] = createMarker(new GPoint(-94.65831757,38.90742111),"
Blue Valley North High School
12200 Lamar
Overland Park, KS 66209

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Blue Valley North High School",'Overland_Park=' + Overland_Park.length); Ellsworth[Ellsworth.length] = createMarker(new GPoint(-98.22907257,38.73096466),"
Ellsworth Elementary School
110 E 3rd
Ellsworth, KS 67439

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Ellsworth Elementary School",'Ellsworth=' + Ellsworth.length); Humboldt[Humboldt.length] = createMarker(new GPoint(-95.43272400,37.81323624),"
Humboldt Elementary School
1100 Central St
Humboldt, KS 66748

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Humboldt Elementary School",'Humboldt=' + Humboldt.length); Humboldt[Humboldt.length] = createMarker(new GPoint(-95.43315887,37.81114197),"
Humboldt High School
1011 Bridge St
Humboldt, KS 66748

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Humboldt High School",'Humboldt=' + Humboldt.length); Humboldt[Humboldt.length] = createMarker(new GPoint(-95.43279200,37.81128400),"
Humboldt Middle School
1105 Bridge Street
Humboldt, KS 66748

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Humboldt Middle School",'Humboldt=' + Humboldt.length); Iola[Iola.length] = createMarker(new GPoint(-95.39662170,37.92233658),"
Iola Middle School
600 East Street
Iola, KS 66749

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Iola Middle School",'Iola=' + Iola.length); Iola[Iola.length] = createMarker(new GPoint(-95.40082550,37.92323685),"
Iola Senior High School
300 E Jackson
Iola, KS 66749

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Iola Senior High School",'Iola=' + Iola.length); Iola[Iola.length] = createMarker(new GPoint(-95.40357208,37.91986465),"
Jefferson Elementary School
300 S Jefferson
Iola, KS 66749

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Jefferson Elementary School",'Iola=' + Iola.length); Laharpe[Laharpe.length] = createMarker(new GPoint(-95.29389954,37.93059921),"
Laharpe Elementary School
Box 93
Laharpe, KS 66751

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Laharpe Elementary School",'Laharpe=' + Laharpe.length); Iola[Iola.length] = createMarker(new GPoint(-95.40347290,37.92893600),"
Lincoln Elementary School
700 N Jefferson
Iola, KS 66749

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Lincoln Elementary School",'Iola=' + Iola.length); Liberal[Liberal.length] = createMarker(new GPoint(-100.96260071,37.12490082),"
Lincoln Elementary School
P. O. Box 949
Liberal, KS 67905

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Lincoln Elementary School",'Liberal=' + Liberal.length); Moran[Moran.length] = createMarker(new GPoint(-95.17053986,37.91893768),"
Marmaton Valley Elementary School
128 West Oak Street
Moran, KS 66755

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Marmaton Valley Elementary School",'Moran=' + Moran.length); Moran[Moran.length] = createMarker(new GPoint(-95.17053986,37.91893768),"
Marmaton Valley High School
128 West Oak Street
Moran, KS 66755

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Marmaton Valley High School",'Moran=' + Moran.length); Iola[Iola.length] = createMarker(new GPoint(-95.39062500,37.92078781),"
Mckinley Elementary School
209 S Kentucky
Iola, KS 66749

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Mckinley Elementary School",'Iola=' + Iola.length); Oakley[Oakley.length] = createMarker(new GPoint(-100.85403442,39.13092804),"
Oakley Elementary School
115 W 6th
Oakley, KS 67748

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Oakley Elementary School",'Oakley=' + Oakley.length); Phillipsburg[Phillipsburg.length] = createMarker(new GPoint(-99.32450867,39.75034332),"
Phillipsburg Elementary School
300 Nebraska Avenue
Phillipsburg, KS 67661

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Phillipsburg Elementary School",'Phillipsburg=' + Phillipsburg.length); St_George[St_George.length] = createMarker(new GPoint(-96.44056702,39.30062485),"
Rock Creek Jr/sr High School
9355 Flush Road
St George, KS 66535

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Rock Creek Jr/sr High School",'St_George=' + St_George.length); Syracuse[Syracuse.length] = createMarker(new GPoint(-101.77999878,38.02289963),"
Syracuse High School
Po Box 1187
Syracuse, KS 67878

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Syracuse High School",'Syracuse=' + Syracuse.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(Dodge_City); map.removeOverlays(Ellsworth); map.removeOverlays(Humboldt); map.removeOverlays(Iola); map.removeOverlays(Laharpe); map.removeOverlays(Liberal); map.removeOverlays(Moran); map.removeOverlays(Oakley); map.removeOverlays(Overland_Park); map.removeOverlays(Phillipsburg); map.removeOverlays(St_George); map.removeOverlays(Syracuse); 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(Dodge_City);map.removeOverlays(Dodge_City); map.removeOverlays(Ellsworth); map.removeOverlays(Humboldt); map.removeOverlays(Iola); map.removeOverlays(Laharpe); map.removeOverlays(Liberal); map.removeOverlays(Moran); map.removeOverlays(Oakley); map.removeOverlays(Overland_Park); map.removeOverlays(Phillipsburg); map.removeOverlays(St_George); map.removeOverlays(Syracuse); map.addOverlays(Dodge_City); centerByArray(Dodge_City, false, false); cntMarker += Dodge_City.length; map.addOverlays(Ellsworth); centerByArray(Ellsworth, false, false); cntMarker += Ellsworth.length; map.addOverlays(Humboldt); centerByArray(Humboldt, false, false); cntMarker += Humboldt.length; map.addOverlays(Iola); centerByArray(Iola, false, false); cntMarker += Iola.length; map.addOverlays(Laharpe); centerByArray(Laharpe, false, false); cntMarker += Laharpe.length; map.addOverlays(Liberal); centerByArray(Liberal, false, false); cntMarker += Liberal.length; map.addOverlays(Moran); centerByArray(Moran, false, false); cntMarker += Moran.length; map.addOverlays(Oakley); centerByArray(Oakley, false, false); cntMarker += Oakley.length; map.addOverlays(Overland_Park); centerByArray(Overland_Park, false, false); cntMarker += Overland_Park.length; map.addOverlays(Phillipsburg); centerByArray(Phillipsburg, false, false); cntMarker += Phillipsburg.length; map.addOverlays(St_George); centerByArray(St_George, false, false); cntMarker += St_George.length; map.addOverlays(Syracuse); centerByArray(Syracuse, false, false); cntMarker += Syracuse.length; centerByArray(Dodge_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'); } }