function addMarkers() { mySelect = document.getElementById('selection'); Ardmore = [];Fox = [];Healdton = [];Lone_Grove = [];Springer = [];Wilson = [];mySelect.options[mySelect.options.length] = new Option("Ardmore schools",'all=Ardmore'); mySelect.options[mySelect.options.length] = new Option("Fox schools",'all=Fox'); mySelect.options[mySelect.options.length] = new Option("Healdton schools",'all=Healdton'); mySelect.options[mySelect.options.length] = new Option("Lone Grove schools",'all=Lone_Grove'); mySelect.options[mySelect.options.length] = new Option("Springer schools",'all=Springer'); mySelect.options[mySelect.options.length] = new Option("Wilson schools",'all=Wilson'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Ardmore[Ardmore.length] = createMarker(new GPoint(-97.18299866,34.25880051),"
Ardmore High School
Po Box 1709
Ardmore, OK 73402

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Ardmore High School",'Ardmore=' + Ardmore.length); Ardmore[Ardmore.length] = createMarker(new GPoint(-97.18299866,34.25880051),"
Ardmore Middle School
Po Box 1709
Ardmore, OK 73402

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Ardmore Middle School",'Ardmore=' + Ardmore.length); Ardmore[Ardmore.length] = createMarker(new GPoint(-97.18299866,34.25880051),"
Charles Evans Elementary School
Po Box 1709
Ardmore, OK 73402

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Charles Evans Elementary School",'Ardmore=' + Ardmore.length); Ardmore[Ardmore.length] = createMarker(new GPoint(-97.07319641,34.18719864),"
Dickson Elementary School
4762 State Highway 199
Ardmore, OK 73401

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Dickson Elementary School",'Ardmore=' + Ardmore.length); Ardmore[Ardmore.length] = createMarker(new GPoint(-97.07319641,34.18719864),"
Dickson High School
4762 State Highway 199
Ardmore, OK 73401

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Dickson High School",'Ardmore=' + Ardmore.length); Ardmore[Ardmore.length] = createMarker(new GPoint(-97.07319641,34.18719864),"
Dickson Junior High School
4762 State Highway 199
Ardmore, OK 73401

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Dickson Junior High School",'Ardmore=' + Ardmore.length); Ardmore[Ardmore.length] = createMarker(new GPoint(-97.07319641,34.18719864),"
Dickson Upper Elementary School
4762 State Highway 199
Ardmore, OK 73401

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Dickson Upper Elementary School",'Ardmore=' + Ardmore.length); Fox[Fox.length] = createMarker(new GPoint(-97.49279785,34.36289978),"
Fox Elementary School
Po Box 248
Fox, OK 73435

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Fox Elementary School",'Fox=' + Fox.length); Fox[Fox.length] = createMarker(new GPoint(-97.49279785,34.36289978),"
Fox Junior Senior High School
Po Box 248
Fox, OK 73435

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Fox Junior Senior High School",'Fox=' + Fox.length); Ardmore[Ardmore.length] = createMarker(new GPoint(-97.18299866,34.25880051),"
Franklin Elementary School
Po Box 1709
Ardmore, OK 73402

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Franklin Elementary School",'Ardmore=' + Ardmore.length); Healdton[Healdton.length] = createMarker(new GPoint(-97.48509979,34.22539902),"
Healdton Elementary School
Po Box 490
Healdton, OK 73438

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Healdton Elementary School",'Healdton=' + Healdton.length); Healdton[Healdton.length] = createMarker(new GPoint(-97.48509979,34.22539902),"
Healdton High School
Po Box 490
Healdton, OK 73438

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Healdton High School",'Healdton=' + Healdton.length); Healdton[Healdton.length] = createMarker(new GPoint(-97.48509979,34.22539902),"
Healdton Middle School
Po Box 490
Healdton, OK 73438

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Healdton Middle School",'Healdton=' + Healdton.length); Ardmore[Ardmore.length] = createMarker(new GPoint(-97.18299866,34.25880051),"
Jefferson Elementary School
Po Box 1709
Ardmore, OK 73402

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Jefferson Elementary School",'Ardmore=' + Ardmore.length); Ardmore[Ardmore.length] = createMarker(new GPoint(-97.18299866,34.25880051),"
Lincoln Elementary School
Po Box 1709
Ardmore, OK 73402

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Lincoln Elementary School",'Ardmore=' + Ardmore.length); Lone_Grove[Lone_Grove.length] = createMarker(new GPoint(-97.27790070,34.17250061),"
Lone Grove High School
Po Box 1330
Lone Grove, OK 73443

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Lone Grove High School",'Lone_Grove=' + Lone_Grove.length); Lone_Grove[Lone_Grove.length] = createMarker(new GPoint(-97.27790070,34.17250061),"
Lone Grove Jhs
Po Box 1330
Lone Grove, OK 73443

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Lone Grove Jhs",'Lone_Grove=' + Lone_Grove.length); Lone_Grove[Lone_Grove.length] = createMarker(new GPoint(-97.27790070,34.17250061),"
Lone Grove Lower Elementary School
Po Box 1330
Lone Grove, OK 73443

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Lone Grove Lower Elementary School",'Lone_Grove=' + Lone_Grove.length); Lone_Grove[Lone_Grove.length] = createMarker(new GPoint(-97.27790070,34.17250061),"
Lone Grove Middle School
Po Box 1330
Lone Grove, OK 73443

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Lone Grove Middle School",'Lone_Grove=' + Lone_Grove.length); Lone_Grove[Lone_Grove.length] = createMarker(new GPoint(-97.27790070,34.17250061),"
Lone Grove Upper Elementary School
Po Box 1330
Lone Grove, OK 73443

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Lone Grove Upper Elementary School",'Lone_Grove=' + Lone_Grove.length); Ardmore[Ardmore.length] = createMarker(new GPoint(-97.18299866,34.25880051),"
Northwest Elementary School
Po Box 1709
Ardmore, OK 73402

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Northwest Elementary School",'Ardmore=' + Ardmore.length); Ardmore[Ardmore.length] = createMarker(new GPoint(-97.17803192,34.16148376),"
Plainview High School
1140 S Plainview Rd
Ardmore, OK 73401

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Plainview High School",'Ardmore=' + Ardmore.length); Ardmore[Ardmore.length] = createMarker(new GPoint(-97.17803192,34.16148376),"
Plainview Ies Elementary School
1140 S Plainview Rd
Ardmore, OK 73401

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Plainview Ies Elementary School",'Ardmore=' + Ardmore.length); Ardmore[Ardmore.length] = createMarker(new GPoint(-97.17803192,34.16148376),"
Plainview Middle School
1140 S Plainview Rd
Ardmore, OK 73401

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Plainview Middle School",'Ardmore=' + Ardmore.length); Ardmore[Ardmore.length] = createMarker(new GPoint(-97.17803192,34.16148376),"
Plainview Primary Elementary School
1140 S Plainview Rd
Ardmore, OK 73401

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Plainview Primary Elementary School",'Ardmore=' + Ardmore.length); Springer[Springer.length] = createMarker(new GPoint(-97.12779999,34.30339813),"
Springer Elementary School
Po Box 249
Springer, OK 73458

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Springer Elementary School",'Springer=' + Springer.length); Springer[Springer.length] = createMarker(new GPoint(-97.12779999,34.30339813),"
Springer High School
Po Box 249
Springer, OK 73458

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Springer High School",'Springer=' + Springer.length); Ardmore[Ardmore.length] = createMarker(new GPoint(-97.18299866,34.25880051),"
Will Rogers Elementary School
Po Box 1709
Ardmore, OK 73402

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Will Rogers Elementary School",'Ardmore=' + Ardmore.length); Wilson[Wilson.length] = createMarker(new GPoint(-97.41843414,34.16536331),"
Wilson Elementary School
1860 Hewitt Rd
Wilson, OK 73463

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Wilson Elementary School",'Wilson=' + Wilson.length); Wilson[Wilson.length] = createMarker(new GPoint(-97.42109680,34.16429901),"
Wilson High School
1860 Hewitt Rd
Wilson, OK 73463

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Wilson High School",'Wilson=' + Wilson.length); Wilson[Wilson.length] = createMarker(new GPoint(-97.41680145,34.16490173),"
Zaneis Elementary School
30515 Us Highway 70
Wilson, OK 73463

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Zaneis Elementary School",'Wilson=' + Wilson.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(Ardmore); map.removeOverlays(Fox); map.removeOverlays(Healdton); map.removeOverlays(Lone_Grove); map.removeOverlays(Springer); map.removeOverlays(Wilson); 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(Ardmore);map.removeOverlays(Ardmore); map.removeOverlays(Fox); map.removeOverlays(Healdton); map.removeOverlays(Lone_Grove); map.removeOverlays(Springer); map.removeOverlays(Wilson); map.addOverlays(Ardmore); centerByArray(Ardmore, false, false); cntMarker += Ardmore.length; map.addOverlays(Fox); centerByArray(Fox, false, false); cntMarker += Fox.length; map.addOverlays(Healdton); centerByArray(Healdton, false, false); cntMarker += Healdton.length; map.addOverlays(Lone_Grove); centerByArray(Lone_Grove, false, false); cntMarker += Lone_Grove.length; map.addOverlays(Springer); centerByArray(Springer, false, false); cntMarker += Springer.length; map.addOverlays(Wilson); centerByArray(Wilson, false, false); cntMarker += Wilson.length; centerByArray(Ardmore,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'); } }