function addMarkers() { mySelect = document.getElementById('selection'); Tulsa = [];Drumright = [];Bristow = [];Depew = [];Sapulpa = [];Oilton = [];Kellyville = [];Kiefer = [];Mannford = [];Milfay = [];Mounds = [];mySelect.options[mySelect.options.length] = new Option("Bristow schools",'all=Bristow'); mySelect.options[mySelect.options.length] = new Option("Depew schools",'all=Depew'); mySelect.options[mySelect.options.length] = new Option("Drumright schools",'all=Drumright'); mySelect.options[mySelect.options.length] = new Option("Kellyville schools",'all=Kellyville'); mySelect.options[mySelect.options.length] = new Option("Kiefer schools",'all=Kiefer'); mySelect.options[mySelect.options.length] = new Option("Mannford schools",'all=Mannford'); mySelect.options[mySelect.options.length] = new Option("Milfay schools",'all=Milfay'); mySelect.options[mySelect.options.length] = new Option("Mounds schools",'all=Mounds'); mySelect.options[mySelect.options.length] = new Option("Oilton schools",'all=Oilton'); mySelect.options[mySelect.options.length] = new Option("Sapulpa schools",'all=Sapulpa'); mySelect.options[mySelect.options.length] = new Option("Tulsa schools",'all=Tulsa'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Tulsa[Tulsa.length] = createMarker(new GPoint(-96.08753204,36.06207275),"
Allen-bowden Elementary School
7049 Frankoma Rd
Tulsa, OK 74131

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Allen-bowden Elementary School",'Tulsa=' + Tulsa.length); Drumright[Drumright.length] = createMarker(new GPoint(-96.61052704,35.98451233),"
Bradley Elementary School
508 S Skinner Ave
Drumright, OK 74030

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Bradley Elementary School",'Drumright=' + Drumright.length); Bristow[Bristow.length] = createMarker(new GPoint(-96.39180756,35.83566284),"
Bristow High School
420 N Main
Bristow, OK 74010

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bristow High School",'Bristow=' + Bristow.length); Bristow[Bristow.length] = createMarker(new GPoint(-96.39180756,35.83566284),"
Bristow Middle School
420 N Main
Bristow, OK 74010

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Bristow Middle School",'Bristow=' + Bristow.length); Bristow[Bristow.length] = createMarker(new GPoint(-96.39180756,35.83566284),"
Collins Elementary School
420 N Main
Bristow, OK 74010

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Collins Elementary School",'Bristow=' + Bristow.length); Depew[Depew.length] = createMarker(new GPoint(-96.50920105,35.76639938),"
Depew Elementary School
Po Box 257
Depew, OK 74028

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Depew Elementary School",'Depew=' + Depew.length); Depew[Depew.length] = createMarker(new GPoint(-96.50920105,35.76639938),"
Depew High School
Po Box 257
Depew, OK 74028

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Depew High School",'Depew=' + Depew.length); Drumright[Drumright.length] = createMarker(new GPoint(-96.60163116,35.98685074),"
Drumright High School
301 S Pennsylvania Ave
Drumright, OK 74030

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Drumright High School",'Drumright=' + Drumright.length); Bristow[Bristow.length] = createMarker(new GPoint(-96.39180756,35.83566284),"
Edison Elementary School
420 N Main
Bristow, OK 74010

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Edison Elementary School",'Bristow=' + Bristow.length); Drumright[Drumright.length] = createMarker(new GPoint(-96.59803009,35.99486160),"
Edison Elementary School
300 E Pine St
Drumright, OK 74030

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Edison Elementary School",'Drumright=' + Drumright.length); Sapulpa[Sapulpa.length] = createMarker(new GPoint(-96.07437134,36.03133011),"
Freedom Elementary School
9170 S 73rd West Ave
Sapulpa, OK 74066

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Freedom Elementary School",'Sapulpa=' + Sapulpa.length); Sapulpa[Sapulpa.length] = createMarker(new GPoint(-96.11173248,36.00794983),"
Garfield Elementary School
801 N 9th
Sapulpa, OK 74066

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Garfield Elementary School",'Sapulpa=' + Sapulpa.length); Depew[Depew.length] = createMarker(new GPoint(-96.45870209,35.72626114),"
Gypsy Elementary School
30899 S 417th West Ave
Depew, OK 74028

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Gypsy Elementary School",'Depew=' + Depew.length); Oilton[Oilton.length] = createMarker(new GPoint(-96.50820160,35.97529984),"
J. F. Kennedy Elementary School
Po Box 130
Oilton, OK 74052

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("J. F. Kennedy Elementary School",'Oilton=' + Oilton.length); Sapulpa[Sapulpa.length] = createMarker(new GPoint(-96.11676025,35.99172592),"
Jefferson Elementary School
602 S Mounds
Sapulpa, OK 74066

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Jefferson Elementary School",'Sapulpa=' + Sapulpa.length); Kellyville[Kellyville.length] = createMarker(new GPoint(-96.23509979,35.93579865),"
Kellyville Elementary School
Po Box 99
Kellyville, OK 74039

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Kellyville Elementary School",'Kellyville=' + Kellyville.length); Kellyville[Kellyville.length] = createMarker(new GPoint(-96.23509979,35.93579865),"
Kellyville High School
Po Box 99
Kellyville, OK 74039

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Kellyville High School",'Kellyville=' + Kellyville.length); Kellyville[Kellyville.length] = createMarker(new GPoint(-96.23509979,35.93579865),"
Kellyville Middle School
Po Box 99
Kellyville, OK 74039

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Kellyville Middle School",'Kellyville=' + Kellyville.length); Kellyville[Kellyville.length] = createMarker(new GPoint(-96.23509979,35.93579865),"
Kellyville Upper Elementary School
Po Box 99
Kellyville, OK 74039

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Kellyville Upper Elementary School",'Kellyville=' + Kellyville.length); Kiefer[Kiefer.length] = createMarker(new GPoint(-96.06289673,35.94499969),"
Kiefer Elementary School
Po Box 850
Kiefer, OK 74041

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Kiefer Elementary School",'Kiefer=' + Kiefer.length); Kiefer[Kiefer.length] = createMarker(new GPoint(-96.06289673,35.94499969),"
Kiefer High School
Po Box 850
Kiefer, OK 74041

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Kiefer High School",'Kiefer=' + Kiefer.length); Sapulpa[Sapulpa.length] = createMarker(new GPoint(-96.09192657,36.00712204),"
Liberty Elementary School
631 N Brown
Sapulpa, OK 74066

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Liberty Elementary School",'Sapulpa=' + Sapulpa.length); Sapulpa[Sapulpa.length] = createMarker(new GPoint(-96.11380005,35.99290085),"
Lone Star Elementary School
Po Box 1170
Sapulpa, OK 74067

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Lone Star Elementary School",'Sapulpa=' + Sapulpa.length); Mannford[Mannford.length] = createMarker(new GPoint(-96.38359833,36.11140060),"
Mannford High School
Po Box 100
Mannford, OK 74044

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Mannford High School",'Mannford=' + Mannford.length); Mannford[Mannford.length] = createMarker(new GPoint(-96.38359833,36.11140060),"
Mannford Lower Elementary School
Po Box 100
Mannford, OK 74044

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Mannford Lower Elementary School",'Mannford=' + Mannford.length); Mannford[Mannford.length] = createMarker(new GPoint(-96.38359833,36.11140060),"
Mannford Middle School
Po Box 100
Mannford, OK 74044

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Mannford Middle School",'Mannford=' + Mannford.length); Mannford[Mannford.length] = createMarker(new GPoint(-96.38359833,36.11140060),"
Mannford Upper Elementary School
Po Box 100
Mannford, OK 74044

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Mannford Upper Elementary School",'Mannford=' + Mannford.length); Milfay[Milfay.length] = createMarker(new GPoint(-96.56340027,35.75350189),"
Milfay Elementary School
Po Box 219
Milfay, OK 74046

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Milfay Elementary School",'Milfay=' + Milfay.length); Mounds[Mounds.length] = createMarker(new GPoint(-96.02330017,35.87760162),"
Mounds Elementary School
Po Box 189
Mounds, OK 74047

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Mounds Elementary School",'Mounds=' + Mounds.length); Mounds[Mounds.length] = createMarker(new GPoint(-96.02330017,35.87760162),"
Mounds High School
Po Box 189
Mounds, OK 74047

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Mounds High School",'Mounds=' + Mounds.length); Tulsa[Tulsa.length] = createMarker(new GPoint(-96.04126740,36.06961060),"
Oakridge Elementary School
6500 S 43 West Ave
Tulsa, OK 74132

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Oakridge Elementary School",'Tulsa=' + Tulsa.length); Oilton[Oilton.length] = createMarker(new GPoint(-96.50820160,35.97529984),"
Oilton High School
Po Box 130
Oilton, OK 74052

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Oilton High School",'Oilton=' + Oilton.length); Drumright[Drumright.length] = createMarker(new GPoint(-96.52580261,35.99580002),"
Olive Elementary School
9352 S 436th West Ave
Drumright, OK 74030

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Olive Elementary School",'Drumright=' + Drumright.length); Drumright[Drumright.length] = createMarker(new GPoint(-96.52580261,35.99580002),"
Olive High School
9352 S 436th West Ave
Drumright, OK 74030

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Olive High School",'Drumright=' + Drumright.length); Sapulpa[Sapulpa.length] = createMarker(new GPoint(-96.16240692,36.04675293),"
Pretty Water Elementary School
15223 W 81st St
Sapulpa, OK 74066

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Pretty Water Elementary School",'Sapulpa=' + Sapulpa.length); Kiefer[Kiefer.length] = createMarker(new GPoint(-96.06500244,35.94469833),"
Rongey Middle School
Po Box 850
Kiefer, OK 74041

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Rongey Middle School",'Kiefer=' + Kiefer.length); Sapulpa[Sapulpa.length] = createMarker(new GPoint(-96.09863281,35.99884796),"
Sapulpa High School
3 S Mission St
Sapulpa, OK 74066

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Sapulpa High School",'Sapulpa=' + Sapulpa.length); Sapulpa[Sapulpa.length] = createMarker(new GPoint(-96.09863281,35.99881744),"
Sapulpa Jhs
7 S Mission St
Sapulpa, OK 74066

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Sapulpa Jhs",'Sapulpa=' + Sapulpa.length); Sapulpa[Sapulpa.length] = createMarker(new GPoint(-96.09414673,35.99196243),"
Sapulpa Middle School
1304 E Cleveland
Sapulpa, OK 74066

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Sapulpa Middle School",'Sapulpa=' + Sapulpa.length); Sapulpa[Sapulpa.length] = createMarker(new GPoint(-96.11318970,35.97943878),"
South Heights Elementary School
23 E Ross
Sapulpa, OK 74066

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("South Heights Elementary School",'Sapulpa=' + Sapulpa.length); Sapulpa[Sapulpa.length] = createMarker(new GPoint(-96.10713959,35.99785614),"
Washington Elementary School
511 E Lee
Sapulpa, OK 74066

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Washington Elementary School",'Sapulpa=' + Sapulpa.length); Sapulpa[Sapulpa.length] = createMarker(new GPoint(-96.09815979,35.99583817),"
Woodlawn Elementary School
1125 E Lincoln
Sapulpa, OK 74066

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Woodlawn Elementary School",'Sapulpa=' + Sapulpa.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(Bristow); map.removeOverlays(Depew); map.removeOverlays(Drumright); map.removeOverlays(Kellyville); map.removeOverlays(Kiefer); map.removeOverlays(Mannford); map.removeOverlays(Milfay); map.removeOverlays(Mounds); map.removeOverlays(Oilton); map.removeOverlays(Sapulpa); map.removeOverlays(Tulsa); 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(Tulsa);map.removeOverlays(Bristow); map.removeOverlays(Depew); map.removeOverlays(Drumright); map.removeOverlays(Kellyville); map.removeOverlays(Kiefer); map.removeOverlays(Mannford); map.removeOverlays(Milfay); map.removeOverlays(Mounds); map.removeOverlays(Oilton); map.removeOverlays(Sapulpa); map.removeOverlays(Tulsa); map.addOverlays(Bristow); centerByArray(Bristow, false, false); cntMarker += Bristow.length; map.addOverlays(Depew); centerByArray(Depew, false, false); cntMarker += Depew.length; map.addOverlays(Drumright); centerByArray(Drumright, false, false); cntMarker += Drumright.length; map.addOverlays(Kellyville); centerByArray(Kellyville, false, false); cntMarker += Kellyville.length; map.addOverlays(Kiefer); centerByArray(Kiefer, false, false); cntMarker += Kiefer.length; map.addOverlays(Mannford); centerByArray(Mannford, false, false); cntMarker += Mannford.length; map.addOverlays(Milfay); centerByArray(Milfay, false, false); cntMarker += Milfay.length; map.addOverlays(Mounds); centerByArray(Mounds, false, false); cntMarker += Mounds.length; map.addOverlays(Oilton); centerByArray(Oilton, false, false); cntMarker += Oilton.length; map.addOverlays(Sapulpa); centerByArray(Sapulpa, false, false); cntMarker += Sapulpa.length; map.addOverlays(Tulsa); centerByArray(Tulsa, false, false); cntMarker += Tulsa.length; centerByArray(Tulsa,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'); } }