function addMarkers() { mySelect = document.getElementById('selection'); Tahlequah = [];Hulbert = [];Park_Hill = [];Peggs = [];Welling = [];mySelect.options[mySelect.options.length] = new Option("Hulbert schools",'all=Hulbert'); mySelect.options[mySelect.options.length] = new Option("Park Hill schools",'all=Park_Hill'); mySelect.options[mySelect.options.length] = new Option("Peggs schools",'all=Peggs'); mySelect.options[mySelect.options.length] = new Option("Tahlequah schools",'all=Tahlequah'); mySelect.options[mySelect.options.length] = new Option("Welling schools",'all=Welling'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Tahlequah[Tahlequah.length] = createMarker(new GPoint(-95.03769684,35.65100098),"
Briggs Elementary School
17210 S 569 Rd
Tahlequah, OK 74464

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Briggs Elementary School",'Tahlequah=' + Tahlequah.length); Tahlequah[Tahlequah.length] = createMarker(new GPoint(-94.97367859,35.91768646),"
Central Elementary School
400 W Morgan
Tahlequah, OK 74464

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Central Elementary School",'Tahlequah=' + Tahlequah.length); Tahlequah[Tahlequah.length] = createMarker(new GPoint(-94.96041870,35.91736221),"
Cherokee Elementary School
800 Goingsnake St
Tahlequah, OK 74464

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Cherokee Elementary School",'Tahlequah=' + Tahlequah.length); Tahlequah[Tahlequah.length] = createMarker(new GPoint(-94.99359894,35.95077896),"
Grand View Elementary School
15481 N Jarvis Rd
Tahlequah, OK 74464

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Grand View Elementary School",'Tahlequah=' + Tahlequah.length); Tahlequah[Tahlequah.length] = createMarker(new GPoint(-94.96813202,35.90796280),"
Greenwood Elementary School
400 E Ross
Tahlequah, OK 74464

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Greenwood Elementary School",'Tahlequah=' + Tahlequah.length); Hulbert[Hulbert.length] = createMarker(new GPoint(-95.18769836,35.91989899),"
Hulbert Elementary School
Po Box 188
Hulbert, OK 74441

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Hulbert Elementary School",'Hulbert=' + Hulbert.length); Hulbert[Hulbert.length] = createMarker(new GPoint(-95.14319400,35.93275000),"
Hulbert Jr-sr High School
Po Box 188
Hulbert, OK 74441

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Hulbert Jr-sr High School",'Hulbert=' + Hulbert.length); Hulbert[Hulbert.length] = createMarker(new GPoint(-95.18769836,35.91989899),"
Hulbert Junior Senior High School
Po Box 188
Hulbert, OK 74441

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Hulbert Junior Senior High School",'Hulbert=' + Hulbert.length); Park_Hill[Park_Hill.length] = createMarker(new GPoint(-94.96304321,35.79756546),"
Keys Elementary School
19061 E 840 Rd
Park Hill, OK 74451

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Keys Elementary School",'Park_Hill=' + Park_Hill.length); Park_Hill[Park_Hill.length] = createMarker(new GPoint(-94.96776581,35.79589844),"
Keys High School
26622 S 520 Rd
Park Hill, OK 74451

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Keys High School",'Park_Hill=' + Park_Hill.length); Hulbert[Hulbert.length] = createMarker(new GPoint(-95.13490295,35.97480011),"
Lost City Elementary School
13243 N Lost City Rd
Hulbert, OK 74441

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Lost City Elementary School",'Hulbert=' + Hulbert.length); Tahlequah[Tahlequah.length] = createMarker(new GPoint(-94.99690247,35.72629929),"
Lowrey Elementary School
21132 E 640 Rd
Tahlequah, OK 74464

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Lowrey Elementary School",'Tahlequah=' + Tahlequah.length); Hulbert[Hulbert.length] = createMarker(new GPoint(-95.16404724,35.87116241),"
Norwood Elementary School
7966 W 790 Rd
Hulbert, OK 74441

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Norwood Elementary School",'Hulbert=' + Hulbert.length); Peggs[Peggs.length] = createMarker(new GPoint(-95.00559998,36.06380081),"
Peggs Elementary School
Po Box 119
Peggs, OK 74452

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Peggs Elementary School",'Peggs=' + Peggs.length); Tahlequah[Tahlequah.length] = createMarker(new GPoint(-94.97391510,35.91009903),"
Sequoyah Elementary School
425 S College
Tahlequah, OK 74464

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Sequoyah Elementary School",'Tahlequah=' + Tahlequah.length); Tahlequah[Tahlequah.length] = createMarker(new GPoint(-94.96970367,35.91519928),"
Sequoyah High School
Po Box 520
Tahlequah, OK 74465

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Sequoyah High School",'Tahlequah=' + Tahlequah.length); Hulbert[Hulbert.length] = createMarker(new GPoint(-95.10044861,35.95896149),"
Shady Grove Elementary School
11042 W Shady Grove Rd
Hulbert, OK 74441

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Shady Grove Elementary School",'Hulbert=' + Hulbert.length); Tahlequah[Tahlequah.length] = createMarker(new GPoint(-94.97576904,35.92009735),"
Tahlequah High School
625 N Jones Ave
Tahlequah, OK 74464

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Tahlequah High School",'Tahlequah=' + Tahlequah.length); Tahlequah[Tahlequah.length] = createMarker(new GPoint(-94.97264900,35.91136000),"
Tahlequah Jhs
613 N Jones Ave
Tahlequah, OK 74464

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Tahlequah Jhs",'Tahlequah=' + Tahlequah.length); Tahlequah[Tahlequah.length] = createMarker(new GPoint(-94.97576904,35.91992569),"
Tahlequah Junior High School
400 W Morgan
Tahlequah, OK 74464

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Tahlequah Junior High School",'Tahlequah=' + Tahlequah.length); Welling[Welling.length] = createMarker(new GPoint(-94.86889648,35.84640121),"
Tenkiller Elementary School
26106 E 863 Rd
Welling, OK 74471

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Tenkiller Elementary School",'Welling=' + Welling.length); Tahlequah[Tahlequah.length] = createMarker(new GPoint(-95.07640076,35.80730057),"
Woodall Elementary School
14090 W 835 Rd
Tahlequah, OK 74464

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Woodall Elementary School",'Tahlequah=' + Tahlequah.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(Hulbert); map.removeOverlays(Park_Hill); map.removeOverlays(Peggs); map.removeOverlays(Tahlequah); map.removeOverlays(Welling); 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(Tahlequah);map.removeOverlays(Hulbert); map.removeOverlays(Park_Hill); map.removeOverlays(Peggs); map.removeOverlays(Tahlequah); map.removeOverlays(Welling); map.addOverlays(Hulbert); centerByArray(Hulbert, false, false); cntMarker += Hulbert.length; map.addOverlays(Park_Hill); centerByArray(Park_Hill, false, false); cntMarker += Park_Hill.length; map.addOverlays(Peggs); centerByArray(Peggs, false, false); cntMarker += Peggs.length; map.addOverlays(Tahlequah); centerByArray(Tahlequah, false, false); cntMarker += Tahlequah.length; map.addOverlays(Welling); centerByArray(Welling, false, false); cntMarker += Welling.length; centerByArray(Tahlequah,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'); } }