function addMarkers() { mySelect = document.getElementById('selection'); Blackwell = [];Braman = [];Ponca_City = [];Kaw_City = [];Newkirk = [];Tonkawa = [];mySelect.options[mySelect.options.length] = new Option("Blackwell schools",'all=Blackwell'); mySelect.options[mySelect.options.length] = new Option("Braman schools",'all=Braman'); mySelect.options[mySelect.options.length] = new Option("Kaw City schools",'all=Kaw_City'); mySelect.options[mySelect.options.length] = new Option("Newkirk schools",'all=Newkirk'); mySelect.options[mySelect.options.length] = new Option("Ponca City schools",'all=Ponca_City'); mySelect.options[mySelect.options.length] = new Option("Tonkawa schools",'all=Tonkawa'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Blackwell[Blackwell.length] = createMarker(new GPoint(-97.27971649,36.78956223),"
Blackwell High School
303 E Coolidge Ave
Blackwell, OK 74631

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Blackwell High School",'Blackwell=' + Blackwell.length); Blackwell[Blackwell.length] = createMarker(new GPoint(-97.28446960,36.79278946),"
Blackwell Middle School
1041 S 1st St
Blackwell, OK 74631

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Blackwell Middle School",'Blackwell=' + Blackwell.length); Braman[Braman.length] = createMarker(new GPoint(-97.31449890,36.93870163),"
Braman Elementary School
Po Box 130
Braman, OK 74632

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Braman Elementary School",'Braman=' + Braman.length); Braman[Braman.length] = createMarker(new GPoint(-97.31449890,36.93870163),"
Braman High School
Po Box 130
Braman, OK 74632

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Braman High School",'Braman=' + Braman.length); Ponca_City[Ponca_City.length] = createMarker(new GPoint(-97.05714417,36.73863602),"
E. M. Trout Elementary School
2109 E Prospect
Ponca City, OK 74604

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("E. M. Trout Elementary School",'Ponca_City=' + Ponca_City.length); Ponca_City[Ponca_City.length] = createMarker(new GPoint(-97.07612610,36.69805527),"
Garfield Academy
601 S 7th
Ponca City, OK 74601

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Garfield Academy",'Ponca_City=' + Ponca_City.length); Blackwell[Blackwell.length] = createMarker(new GPoint(-97.28670502,36.78643799),"
Huston Center Elementary School
304 Vinnedge Ave
Blackwell, OK 74631

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Huston Center Elementary School",'Blackwell=' + Blackwell.length); Kaw_City[Kaw_City.length] = createMarker(new GPoint(-96.86569977,36.81000137),"
Kaw City Elementary School
Po Box 150
Kaw City, OK 74641

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Kaw City Elementary School",'Kaw_City=' + Kaw_City.length); Ponca_City[Ponca_City.length] = createMarker(new GPoint(-97.04912567,36.80608749),"
Kildare Elementary School
1265 Church St
Ponca City, OK 74604

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Kildare Elementary School",'Ponca_City=' + Ponca_City.length); Ponca_City[Ponca_City.length] = createMarker(new GPoint(-97.08795166,36.71713638),"
Liberty Elementary School
505 W Liberty
Ponca City, OK 74601

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Liberty Elementary School",'Ponca_City=' + Ponca_City.length); Ponca_City[Ponca_City.length] = createMarker(new GPoint(-97.10026550,36.70409775),"
Lincoln Elementary School
1501 W Grand Ave
Ponca City, OK 74601

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Lincoln Elementary School",'Ponca_City=' + Ponca_City.length); Newkirk[Newkirk.length] = createMarker(new GPoint(-97.05220032,36.89849854),"
Newkirk Elementary School
Po Box 288
Newkirk, OK 74647

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Newkirk Elementary School",'Newkirk=' + Newkirk.length); Newkirk[Newkirk.length] = createMarker(new GPoint(-97.05220032,36.89849854),"
Newkirk High School
Po Box 91
Newkirk, OK 74647

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Newkirk High School",'Newkirk=' + Newkirk.length); Newkirk[Newkirk.length] = createMarker(new GPoint(-97.05220032,36.89849854),"
Newkirk Middle School
Po Box 485
Newkirk, OK 74647

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Newkirk Middle School",'Newkirk=' + Newkirk.length); Blackwell[Blackwell.length] = createMarker(new GPoint(-97.27661133,36.80143738),"
Parkside Center Elementary School
502 E College Ave
Blackwell, OK 74631

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Parkside Center Elementary School",'Blackwell=' + Blackwell.length); Newkirk[Newkirk.length] = createMarker(new GPoint(-97.17649841,36.88560104),"
Peckham Elementary School
7175 W School St
Newkirk, OK 74647

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Peckham Elementary School",'Newkirk=' + Newkirk.length); Ponca_City[Ponca_City.length] = createMarker(new GPoint(-97.07701111,36.70336151),"
Ponca City East MiddleSchool
612 E Grand
Ponca City, OK 74601

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Ponca City East MiddleSchool",'Ponca_City=' + Ponca_City.length); Ponca_City[Ponca_City.length] = createMarker(new GPoint(-97.07817841,36.71380997),"
Ponca City High School
927 N 5th
Ponca City, OK 74601

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Ponca City High School",'Ponca_City=' + Ponca_City.length); Ponca_City[Ponca_City.length] = createMarker(new GPoint(-97.09830475,36.70413589),"
Ponca City West Middle School
1401 W Grand Ave
Ponca City, OK 74601

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Ponca City West Middle School",'Ponca_City=' + Ponca_City.length); Ponca_City[Ponca_City.length] = createMarker(new GPoint(-97.07418060,36.70973587),"
Roosevelt Elementary School
815 E Highland Ave
Ponca City, OK 74601

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Roosevelt Elementary School",'Ponca_City=' + Ponca_City.length); Tonkawa[Tonkawa.length] = createMarker(new GPoint(-97.31800079,36.67770004),"
Tonkawa Elementary School
501 N Public
Tonkawa, OK 74653

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Tonkawa Elementary School",'Tonkawa=' + Tonkawa.length); Tonkawa[Tonkawa.length] = createMarker(new GPoint(-97.31800079,36.67770004),"
Tonkawa High School
500 E N Ave
Tonkawa, OK 74653

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Tonkawa High School",'Tonkawa=' + Tonkawa.length); Tonkawa[Tonkawa.length] = createMarker(new GPoint(-97.31800079,36.67770004),"
Tonkawa Middle School
500 E N Ave
Tonkawa, OK 74653

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Tonkawa Middle School",'Tonkawa=' + Tonkawa.length); Ponca_City[Ponca_City.length] = createMarker(new GPoint(-97.08502960,36.73461533),"
Union Elementary School
2617 N Union
Ponca City, OK 74601

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Union Elementary School",'Ponca_City=' + Ponca_City.length); Blackwell[Blackwell.length] = createMarker(new GPoint(-97.29239655,36.80116272),"
Washington Center Elementary School
723 W College Ave
Blackwell, OK 74631

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Washington Center Elementary School",'Blackwell=' + Blackwell.length); Ponca_City[Ponca_City.length] = createMarker(new GPoint(-97.07563019,36.72195053),"
Washington Elementary School
1615 N 7th St
Ponca City, OK 74601

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Washington Elementary School",'Ponca_City=' + Ponca_City.length); Ponca_City[Ponca_City.length] = createMarker(new GPoint(-97.05863953,36.72038269),"
Woodlands Elementary School
2005 E Woodland Rd
Ponca City, OK 74604

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Woodlands Elementary School",'Ponca_City=' + Ponca_City.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(Blackwell); map.removeOverlays(Braman); map.removeOverlays(Kaw_City); map.removeOverlays(Newkirk); map.removeOverlays(Ponca_City); map.removeOverlays(Tonkawa); 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(Blackwell);map.removeOverlays(Blackwell); map.removeOverlays(Braman); map.removeOverlays(Kaw_City); map.removeOverlays(Newkirk); map.removeOverlays(Ponca_City); map.removeOverlays(Tonkawa); map.addOverlays(Blackwell); centerByArray(Blackwell, false, false); cntMarker += Blackwell.length; map.addOverlays(Braman); centerByArray(Braman, false, false); cntMarker += Braman.length; map.addOverlays(Kaw_City); centerByArray(Kaw_City, false, false); cntMarker += Kaw_City.length; map.addOverlays(Newkirk); centerByArray(Newkirk, false, false); cntMarker += Newkirk.length; map.addOverlays(Ponca_City); centerByArray(Ponca_City, false, false); cntMarker += Ponca_City.length; map.addOverlays(Tonkawa); centerByArray(Tonkawa, false, false); cntMarker += Tonkawa.length; centerByArray(Blackwell,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'); } }