function addMarkers() { mySelect = document.getElementById('selection'); Arkoma = [];Bokoshe = [];Cameron = [];Fanshawe = [];Heavener = [];Hodgen = [];Howe = [];Leflore = [];Monroe = [];Panama = [];Poteau = [];Pocola = [];Shady_Point = [];Spiro = [];Talihina = [];Whitesboro = [];Wister = [];mySelect.options[mySelect.options.length] = new Option("Arkoma schools",'all=Arkoma'); mySelect.options[mySelect.options.length] = new Option("Bokoshe schools",'all=Bokoshe'); mySelect.options[mySelect.options.length] = new Option("Cameron schools",'all=Cameron'); mySelect.options[mySelect.options.length] = new Option("Fanshawe schools",'all=Fanshawe'); mySelect.options[mySelect.options.length] = new Option("Heavener schools",'all=Heavener'); mySelect.options[mySelect.options.length] = new Option("Hodgen schools",'all=Hodgen'); mySelect.options[mySelect.options.length] = new Option("Howe schools",'all=Howe'); mySelect.options[mySelect.options.length] = new Option("Leflore schools",'all=Leflore'); mySelect.options[mySelect.options.length] = new Option("Monroe schools",'all=Monroe'); mySelect.options[mySelect.options.length] = new Option("Panama schools",'all=Panama'); mySelect.options[mySelect.options.length] = new Option("Pocola schools",'all=Pocola'); mySelect.options[mySelect.options.length] = new Option("Poteau schools",'all=Poteau'); mySelect.options[mySelect.options.length] = new Option("Shady Point schools",'all=Shady_Point'); mySelect.options[mySelect.options.length] = new Option("Spiro schools",'all=Spiro'); mySelect.options[mySelect.options.length] = new Option("Talihina schools",'all=Talihina'); mySelect.options[mySelect.options.length] = new Option("Whitesboro schools",'all=Whitesboro'); mySelect.options[mySelect.options.length] = new Option("Wister schools",'all=Wister'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Arkoma[Arkoma.length] = createMarker(new GPoint(-94.43900299,35.34059906),"
Arkoma High School
Po Box 349
Arkoma, OK 74901

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Arkoma High School",'Arkoma=' + Arkoma.length); Arkoma[Arkoma.length] = createMarker(new GPoint(-94.43900299,35.34059906),"
Arkoma Junior High School
Po Box 349
Arkoma, OK 74901

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Arkoma Junior High School",'Arkoma=' + Arkoma.length); Bokoshe[Bokoshe.length] = createMarker(new GPoint(-94.75610352,35.16070175),"
Bokoshe Elementary School
Po Box 158
Bokoshe, OK 74930

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Bokoshe Elementary School",'Bokoshe=' + Bokoshe.length); Bokoshe[Bokoshe.length] = createMarker(new GPoint(-94.75610352,35.16070175),"
Bokoshe High School
Po Box 158
Bokoshe, OK 74930

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bokoshe High School",'Bokoshe=' + Bokoshe.length); Bokoshe[Bokoshe.length] = createMarker(new GPoint(-94.75610352,35.16070175),"
Bokoshe Junior High School
Po Box 158
Bokoshe, OK 74930

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Bokoshe Junior High School",'Bokoshe=' + Bokoshe.length); Cameron[Cameron.length] = createMarker(new GPoint(-94.50720215,35.15200043),"
Cameron Elementary School
Po Box 190
Cameron, OK 74932

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Cameron Elementary School",'Cameron=' + Cameron.length); Cameron[Cameron.length] = createMarker(new GPoint(-94.50720215,35.15200043),"
Cameron High School
Po Box 190
Cameron, OK 74932

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Cameron High School",'Cameron=' + Cameron.length); Fanshawe[Fanshawe.length] = createMarker(new GPoint(-94.90799713,34.95080185),"
Fanshawe Elementary School
Po Box 100
Fanshawe, OK 74935

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Fanshawe Elementary School",'Fanshawe=' + Fanshawe.length); Heavener[Heavener.length] = createMarker(new GPoint(-94.63030243,34.80360031),"
Heavener Elementary School
Po Box 698
Heavener, OK 74937

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Heavener Elementary School",'Heavener=' + Heavener.length); Heavener[Heavener.length] = createMarker(new GPoint(-94.63030243,34.80360031),"
Heavener High School
Po Box 698
Heavener, OK 74937

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Heavener High School",'Heavener=' + Heavener.length); Hodgen[Hodgen.length] = createMarker(new GPoint(-94.60260010,34.76139832),"
Hodgen Elementary School
Po Box 69
Hodgen, OK 74939

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Hodgen Elementary School",'Hodgen=' + Hodgen.length); Howe[Howe.length] = createMarker(new GPoint(-94.66719818,34.93159866),"
Howe Elementary School
Po Box 259
Howe, OK 74940

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Howe Elementary School",'Howe=' + Howe.length); Howe[Howe.length] = createMarker(new GPoint(-94.66719818,34.93159866),"
Howe High School
Po Box 259
Howe, OK 74940

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Howe High School",'Howe=' + Howe.length); Leflore[Leflore.length] = createMarker(new GPoint(-94.98000336,34.89860153),"
Leflore Elementary School
Po Box 147
Leflore, OK 74942

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Leflore Elementary School",'Leflore=' + Leflore.length); Leflore[Leflore.length] = createMarker(new GPoint(-94.98000336,34.89860153),"
Leflore High School
Po Box 147
Leflore, OK 74942

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Leflore High School",'Leflore=' + Leflore.length); Monroe[Monroe.length] = createMarker(new GPoint(-94.64559937,34.72060013),"
Monroe Elementary School
Po Box 10
Monroe, OK 74947

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Monroe Elementary School",'Monroe=' + Monroe.length); Panama[Panama.length] = createMarker(new GPoint(-94.67220306,35.16719818),"
Panama Elementary School
Po Box 1680
Panama, OK 74951

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Panama Elementary School",'Panama=' + Panama.length); Panama[Panama.length] = createMarker(new GPoint(-94.67220306,35.16719818),"
Panama High School
Po Box 1680
Panama, OK 74951

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Panama High School",'Panama=' + Panama.length); Panama[Panama.length] = createMarker(new GPoint(-94.67220306,35.16719818),"
Panama Middle School
Po Box 1680
Panama, OK 74951

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Panama Middle School",'Panama=' + Panama.length); Poteau[Poteau.length] = createMarker(new GPoint(-94.62702942,35.06375504),"
Pansy Kidd Middle School
100 Mockingbird Ln
Poteau, OK 74953

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Pansy Kidd Middle School",'Poteau=' + Poteau.length); Pocola[Pocola.length] = createMarker(new GPoint(-94.47129822,35.25159836),"
Pocola Elementary School
Po Box 640
Pocola, OK 74902

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Pocola Elementary School",'Pocola=' + Pocola.length); Pocola[Pocola.length] = createMarker(new GPoint(-94.47129822,35.25159836),"
Pocola High School
Po Box 640
Pocola, OK 74902

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Pocola High School",'Pocola=' + Pocola.length); Pocola[Pocola.length] = createMarker(new GPoint(-94.47129822,35.25159836),"
Pocola Middle School
Po Box 640
Pocola, OK 74902

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Pocola Middle School",'Pocola=' + Pocola.length); Poteau[Poteau.length] = createMarker(new GPoint(-94.62702942,35.06375504),"
Poteau High School
100 Mockingbird Ln
Poteau, OK 74953

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Poteau High School",'Poteau=' + Poteau.length); Poteau[Poteau.length] = createMarker(new GPoint(-94.62702942,35.06375504),"
Poteau Primary Elementary School
100 Mockingbird Ln
Poteau, OK 74953

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Poteau Primary Elementary School",'Poteau=' + Poteau.length); Poteau[Poteau.length] = createMarker(new GPoint(-94.62702942,35.06375504),"
Poteau Upper Elementary School
100 Mockingbird Ln
Poteau, OK 74953

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Poteau Upper Elementary School",'Poteau=' + Poteau.length); Shady_Point[Shady_Point.length] = createMarker(new GPoint(-94.66059875,35.12189865),"
Shady Point Elementary School
Po Box 1005
Shady Point, OK 74956

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Shady Point Elementary School",'Shady_Point=' + Shady_Point.length); Arkoma[Arkoma.length] = createMarker(new GPoint(-94.43900299,35.34059906),"
Singleton Elementary School
Po Box 349
Arkoma, OK 74901

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Singleton Elementary School",'Arkoma=' + Arkoma.length); Spiro[Spiro.length] = createMarker(new GPoint(-94.62756348,35.24086380),"
Spiro Elementary School
600 W Broadway St
Spiro, OK 74959

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Spiro Elementary School",'Spiro=' + Spiro.length); Spiro[Spiro.length] = createMarker(new GPoint(-94.62756348,35.24086380),"
Spiro High School
600 W Broadway St
Spiro, OK 74959

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Spiro High School",'Spiro=' + Spiro.length); Spiro[Spiro.length] = createMarker(new GPoint(-94.62756348,35.24086380),"
Spiro Middle School
600 W Broadway St
Spiro, OK 74959

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Spiro Middle School",'Spiro=' + Spiro.length); Talihina[Talihina.length] = createMarker(new GPoint(-95.02510071,34.74919891),"
Talihina Elementary School
Po Box 38
Talihina, OK 74571

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Talihina Elementary School",'Talihina=' + Talihina.length); Talihina[Talihina.length] = createMarker(new GPoint(-95.02510071,34.74919891),"
Talihina High School
Po Box 38
Talihina, OK 74571

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Talihina High School",'Talihina=' + Talihina.length); Talihina[Talihina.length] = createMarker(new GPoint(-95.02510071,34.74919891),"
Talihina Junior High School
Po Box 38
Talihina, OK 74571

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Talihina Junior High School",'Talihina=' + Talihina.length); Whitesboro[Whitesboro.length] = createMarker(new GPoint(-94.82759857,34.68349838),"
Whitesboro Elementary School
Po Box 150
Whitesboro, OK 74577

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Whitesboro Elementary School",'Whitesboro=' + Whitesboro.length); Whitesboro[Whitesboro.length] = createMarker(new GPoint(-94.82759857,34.68349838),"
Whitesboro High School
Po Box 150
Whitesboro, OK 74577

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Whitesboro High School",'Whitesboro=' + Whitesboro.length); Wister[Wister.length] = createMarker(new GPoint(-94.72476196,34.96950531),"
Wister Elementary School
201 Logan St
Wister, OK 74966

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Wister Elementary School",'Wister=' + Wister.length); Wister[Wister.length] = createMarker(new GPoint(-94.72476196,34.96950531),"
Wister High School
201 Logan St
Wister, OK 74966

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Wister High School",'Wister=' + Wister.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(Arkoma); map.removeOverlays(Bokoshe); map.removeOverlays(Cameron); map.removeOverlays(Fanshawe); map.removeOverlays(Heavener); map.removeOverlays(Hodgen); map.removeOverlays(Howe); map.removeOverlays(Leflore); map.removeOverlays(Monroe); map.removeOverlays(Panama); map.removeOverlays(Pocola); map.removeOverlays(Poteau); map.removeOverlays(Shady_Point); map.removeOverlays(Spiro); map.removeOverlays(Talihina); map.removeOverlays(Whitesboro); map.removeOverlays(Wister); 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(Arkoma);map.removeOverlays(Arkoma); map.removeOverlays(Bokoshe); map.removeOverlays(Cameron); map.removeOverlays(Fanshawe); map.removeOverlays(Heavener); map.removeOverlays(Hodgen); map.removeOverlays(Howe); map.removeOverlays(Leflore); map.removeOverlays(Monroe); map.removeOverlays(Panama); map.removeOverlays(Pocola); map.removeOverlays(Poteau); map.removeOverlays(Shady_Point); map.removeOverlays(Spiro); map.removeOverlays(Talihina); map.removeOverlays(Whitesboro); map.removeOverlays(Wister); map.addOverlays(Arkoma); centerByArray(Arkoma, false, false); cntMarker += Arkoma.length; map.addOverlays(Bokoshe); centerByArray(Bokoshe, false, false); cntMarker += Bokoshe.length; map.addOverlays(Cameron); centerByArray(Cameron, false, false); cntMarker += Cameron.length; map.addOverlays(Fanshawe); centerByArray(Fanshawe, false, false); cntMarker += Fanshawe.length; map.addOverlays(Heavener); centerByArray(Heavener, false, false); cntMarker += Heavener.length; map.addOverlays(Hodgen); centerByArray(Hodgen, false, false); cntMarker += Hodgen.length; map.addOverlays(Howe); centerByArray(Howe, false, false); cntMarker += Howe.length; map.addOverlays(Leflore); centerByArray(Leflore, false, false); cntMarker += Leflore.length; map.addOverlays(Monroe); centerByArray(Monroe, false, false); cntMarker += Monroe.length; map.addOverlays(Panama); centerByArray(Panama, false, false); cntMarker += Panama.length; map.addOverlays(Pocola); centerByArray(Pocola, false, false); cntMarker += Pocola.length; map.addOverlays(Poteau); centerByArray(Poteau, false, false); cntMarker += Poteau.length; map.addOverlays(Shady_Point); centerByArray(Shady_Point, false, false); cntMarker += Shady_Point.length; map.addOverlays(Spiro); centerByArray(Spiro, false, false); cntMarker += Spiro.length; map.addOverlays(Talihina); centerByArray(Talihina, false, false); cntMarker += Talihina.length; map.addOverlays(Whitesboro); centerByArray(Whitesboro, false, false); cntMarker += Whitesboro.length; map.addOverlays(Wister); centerByArray(Wister, false, false); cntMarker += Wister.length; centerByArray(Arkoma,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'); } }