function addMarkers() { mySelect = document.getElementById('selection'); Enid = [];Lahoma = [];Covington = [];Drummond = [];Garber = [];Kremlin = [];Waukomis = [];mySelect.options[mySelect.options.length] = new Option("Covington schools",'all=Covington'); mySelect.options[mySelect.options.length] = new Option("Drummond schools",'all=Drummond'); mySelect.options[mySelect.options.length] = new Option("Enid schools",'all=Enid'); mySelect.options[mySelect.options.length] = new Option("Garber schools",'all=Garber'); mySelect.options[mySelect.options.length] = new Option("Kremlin schools",'all=Kremlin'); mySelect.options[mySelect.options.length] = new Option("Lahoma schools",'all=Lahoma'); mySelect.options[mySelect.options.length] = new Option("Waukomis schools",'all=Waukomis'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Enid[Enid.length] = createMarker(new GPoint(-97.84562683,36.39813614),"
Adams Elementary School
2200 E Randolph Ave
Enid, OK 73701

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Adams Elementary School",'Enid=' + Enid.length); Enid[Enid.length] = createMarker(new GPoint(-97.86907196,36.43663788),"
Chisholm Elementary School
300 Colorado Ave
Enid, OK 73701

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Chisholm Elementary School",'Enid=' + Enid.length); Enid[Enid.length] = createMarker(new GPoint(-97.86907196,36.43663788),"
Chisholm High School
4018 W Carrier Rd
Enid, OK 73703

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Chisholm High School",'Enid=' + Enid.length); Enid[Enid.length] = createMarker(new GPoint(-97.86907196,36.43663788),"
Chisholm Middle School
4202 W Carrier Rd
Enid, OK 73703

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Chisholm Middle School",'Enid=' + Enid.length); Lahoma[Lahoma.length] = createMarker(new GPoint(-98.06880188,36.39199829),"
Cimarron Elementary School
Po Box 8
Lahoma, OK 73754

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Cimarron Elementary School",'Lahoma=' + Lahoma.length); Lahoma[Lahoma.length] = createMarker(new GPoint(-98.06880188,36.39199829),"
Cimarron High School
Po Box 8
Lahoma, OK 73754

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Cimarron High School",'Lahoma=' + Lahoma.length); Enid[Enid.length] = createMarker(new GPoint(-97.85579681,36.40696335),"
Coolidge Elementary School
1515 E Ash Ave
Enid, OK 73701

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Coolidge Elementary School",'Enid=' + Enid.length); Covington[Covington.length] = createMarker(new GPoint(-97.56040192,36.30099869),"
Covington-douglas Elementary School
Po Box 9
Covington, OK 73730

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Covington-douglas Elementary School",'Covington=' + Covington.length); Covington[Covington.length] = createMarker(new GPoint(-97.56040192,36.30099869),"
Covington-douglas High School
Po Box 9
Covington, OK 73730

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Covington-douglas High School",'Covington=' + Covington.length); Enid[Enid.length] = createMarker(new GPoint(-97.91051483,36.39813614),"
Dewitt Waller Junior High School
2604 W Randolph Ave
Enid, OK 73703

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Dewitt Waller Junior High School",'Enid=' + Enid.length); Drummond[Drummond.length] = createMarker(new GPoint(-98.04370117,36.26720047),"
Drummond Elementary School
Po Box 240
Drummond, OK 73735

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Drummond Elementary School",'Drummond=' + Drummond.length); Drummond[Drummond.length] = createMarker(new GPoint(-98.04370117,36.26720047),"
Drummond High School
Po Box 240
Drummond, OK 73735

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Drummond High School",'Drummond=' + Drummond.length); Enid[Enid.length] = createMarker(new GPoint(-97.89225006,36.34716415),"
Eisenhower Elementary School
1301 W Fox Dr
Enid, OK 73703

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Eisenhower Elementary School",'Enid=' + Enid.length); Enid[Enid.length] = createMarker(new GPoint(-97.88667297,36.40023804),"
Emerson Junior High School
700 W Elm Ave
Enid, OK 73701

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Emerson Junior High School",'Enid=' + Enid.length); Enid[Enid.length] = createMarker(new GPoint(-97.88556671,36.38866425),"
Enid High School
611 W Wabash Ave
Enid, OK 73701

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Enid High School",'Enid=' + Enid.length); Garber[Garber.length] = createMarker(new GPoint(-97.56929779,36.44520187),"
Garber Elementary School
Po Box 539
Garber, OK 73738

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Garber Elementary School",'Garber=' + Garber.length); Garber[Garber.length] = createMarker(new GPoint(-97.56929779,36.44520187),"
Garber High School
Po Box 539
Garber, OK 73738

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Garber High School",'Garber=' + Garber.length); Enid[Enid.length] = createMarker(new GPoint(-97.86512756,36.39673615),"
Garfield Elementary School
900 E Broadway Ave
Enid, OK 73701

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Garfield Elementary School",'Enid=' + Enid.length); Enid[Enid.length] = createMarker(new GPoint(-97.92604828,36.40353012),"
Glenwood Elementary School
824 N Oakwood Rd
Enid, OK 73703

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Glenwood Elementary School",'Enid=' + Enid.length); Enid[Enid.length] = createMarker(new GPoint(-97.88017273,36.40943527),"
Harrison Elementary School
200 W Birch Ave
Enid, OK 73701

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Harrison Elementary School",'Enid=' + Enid.length); Enid[Enid.length] = createMarker(new GPoint(-97.90467072,36.38063812),"
Hayes Elementary School
2102 Beverly Dr
Enid, OK 73703

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Hayes Elementary School",'Enid=' + Enid.length); Enid[Enid.length] = createMarker(new GPoint(-97.91226959,36.39563751),"
Hoover Elementary School
2800 W Maine Ave
Enid, OK 73703

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Hoover Elementary School",'Enid=' + Enid.length); Kremlin[Kremlin.length] = createMarker(new GPoint(-97.83032990,36.54447556),"
Kremlin-hillsdale Elementary School
Po Box 198
Kremlin, OK 73753

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Kremlin-hillsdale Elementary School",'Kremlin=' + Kremlin.length); Kremlin[Kremlin.length] = createMarker(new GPoint(-97.83032990,36.54447556),"
Kremlin-hillsdale High School
Po Box 198
Kremlin, OK 73753

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Kremlin-hillsdale High School",'Kremlin=' + Kremlin.length); Enid[Enid.length] = createMarker(new GPoint(-97.86512756,36.39673615),"
Longfellow Junior High School
900 E Broadway Ave
Enid, OK 73701

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Longfellow Junior High School",'Enid=' + Enid.length); Enid[Enid.length] = createMarker(new GPoint(-97.89917755,36.39666367),"
Mckinley Elementary School
1701 W Broadway Ave
Enid, OK 73703

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Mckinley Elementary School",'Enid=' + Enid.length); Enid[Enid.length] = createMarker(new GPoint(-97.88325500,36.41873550),"
Monroe Elementary School
400 W Cottonwood Ave
Enid, OK 73701

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Monroe Elementary School",'Enid=' + Enid.length); Enid[Enid.length] = createMarker(new GPoint(-97.79354858,36.41963577),"
Pioneer-pleasant Vale Elementary School
6020 E Willow Rd
Enid, OK 73701

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Pioneer-pleasant Vale Elementary School",'Enid=' + Enid.length); Waukomis[Waukomis.length] = createMarker(new GPoint(-97.93240356,36.27659988),"
Pioneer-pleasant Vale High School
6520 E Wood Rd
Waukomis, OK 73773

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Pioneer-pleasant Vale High School",'Waukomis=' + Waukomis.length); Waukomis[Waukomis.length] = createMarker(new GPoint(-97.89885900,36.27956000),"
Pioneer-pleasant Vale Jhs
6520 E Wood Rd
Waukomis, OK 73773

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Pioneer-pleasant Vale Jhs",'Waukomis=' + Waukomis.length); Enid[Enid.length] = createMarker(new GPoint(-97.89047241,36.39022446),"
Taft Elementary School
1002 Sequoyah Dr
Enid, OK 73703

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Taft Elementary School",'Enid=' + Enid.length); Waukomis[Waukomis.length] = createMarker(new GPoint(-97.89379883,36.26520157),"
Waukomis Elementary School
Po Box 729
Waukomis, OK 73773

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Waukomis Elementary School",'Waukomis=' + Waukomis.length); Waukomis[Waukomis.length] = createMarker(new GPoint(-97.89379883,36.26520157),"
Waukomis High School
Po Box 729
Waukomis, OK 73773

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Waukomis High School",'Waukomis=' + Waukomis.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(Covington); map.removeOverlays(Drummond); map.removeOverlays(Enid); map.removeOverlays(Garber); map.removeOverlays(Kremlin); map.removeOverlays(Lahoma); map.removeOverlays(Waukomis); 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(Enid);map.removeOverlays(Covington); map.removeOverlays(Drummond); map.removeOverlays(Enid); map.removeOverlays(Garber); map.removeOverlays(Kremlin); map.removeOverlays(Lahoma); map.removeOverlays(Waukomis); map.addOverlays(Covington); centerByArray(Covington, false, false); cntMarker += Covington.length; map.addOverlays(Drummond); centerByArray(Drummond, false, false); cntMarker += Drummond.length; map.addOverlays(Enid); centerByArray(Enid, false, false); cntMarker += Enid.length; map.addOverlays(Garber); centerByArray(Garber, false, false); cntMarker += Garber.length; map.addOverlays(Kremlin); centerByArray(Kremlin, false, false); cntMarker += Kremlin.length; map.addOverlays(Lahoma); centerByArray(Lahoma, false, false); cntMarker += Lahoma.length; map.addOverlays(Waukomis); centerByArray(Waukomis, false, false); cntMarker += Waukomis.length; centerByArray(Enid,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'); } }