function addMarkers(){ mySelect = document.getElementById('selection'); Oklahoma_City = [];Bethany = [];Del_City = [];Midwest_City = [];Harrah = [];Edmond = [];mySelect.options[mySelect.options.length] = new Option("Bethany schools",'all=Bethany'); mySelect.options[mySelect.options.length] = new Option("Del City schools",'all=Del_City'); mySelect.options[mySelect.options.length] = new Option("Edmond schools",'all=Edmond'); mySelect.options[mySelect.options.length] = new Option("Harrah schools",'all=Harrah'); mySelect.options[mySelect.options.length] = new Option("Midwest City schools",'all=Midwest_City'); mySelect.options[mySelect.options.length] = new Option("Oklahoma City schools",'all=Oklahoma_City'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Oklahoma_City[Oklahoma_City.length] = createMarker(new GPoint(-97.51407800,35.47424600),"
Bayard Rustin Living Learning Center
722 N Broadway Avenue 5th Floor
Oklahoma City, OK 73102
Co-ed school, 7-11
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bayard Rustin Living Learning Center",'Oklahoma_City=' + Oklahoma_City.length); Bethany[Bethany.length] = createMarker(new GPoint(-97.63053900,35.49348500),"
Bethany Christian Academy
6719 Nw 23rd Street
Bethany, OK 73008
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bethany Christian Academy",'Bethany=' + Bethany.length); Oklahoma_City[Oklahoma_City.length] = createMarker(new GPoint(-97.52686700,35.52243700),"
Bishop Mcguinness High School
801 Nw 50th Street
Oklahoma City, OK 73118
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bishop Mcguinness High School",'Oklahoma_City=' + Oklahoma_City.length); Oklahoma_City[Oklahoma_City.length] = createMarker(new GPoint(-97.54913800,35.56735900),"
Casady School
9500 North Pennsylvania Ave
Oklahoma City, OK 73120
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Casady School",'Oklahoma_City=' + Oklahoma_City.length); Del_City[Del_City.length] = createMarker(new GPoint(-97.43848100,35.43707100),"
Christian Heritage Academy
4400 SE 27th STREET
Del City, OK 73115
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Christian Heritage Academy",'Del_City=' + Del_City.length); Oklahoma_City[Oklahoma_City.length] = createMarker(new GPoint(-97.54946800,35.57357100),"
Crescent Academy
10105 N Pennsylvania Avenue
Oklahoma City, OK 73120
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Crescent Academy",'Oklahoma_City=' + Oklahoma_City.length); Oklahoma_City[Oklahoma_City.length] = createMarker(new GPoint(-97.58490100,35.62012000),"
Crossings Christian School
14400 N Portland Ave
Oklahoma City, OK 73134
Co-ed school, PK-10
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Crossings Christian School",'Oklahoma_City=' + Oklahoma_City.length); Midwest_City[Midwest_City.length] = createMarker(new GPoint(-97.40760300,35.45146300),"
Faith Academy Christian School
504 Askew Drive
Midwest City, OK 73110
Co-ed school, PK-10
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Faith Academy Christian School",'Midwest_City=' + Midwest_City.length); Oklahoma_City[Oklahoma_City.length] = createMarker(new GPoint(-97.54229700,35.59446300),"
Heritage Hall
1800 Nw 122nd Street
Oklahoma City, OK 73120
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Heritage Hall",'Oklahoma_City=' + Oklahoma_City.length); Oklahoma_City[Oklahoma_City.length] = createMarker(new GPoint(-97.31791400,35.39931200),"
Life Christian Academy
6801 S Anderson Rd
Oklahoma City, OK 73150
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Life Christian Academy",'Oklahoma_City=' + Oklahoma_City.length); Oklahoma_City[Oklahoma_City.length] = createMarker(new GPoint(-97.43760000,35.42030000),"
Mid-del Christian School
Po Box 15300
Oklahoma City, OK 73155
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Mid-del Christian School",'Oklahoma_City=' + Oklahoma_City.length); Oklahoma_City[Oklahoma_City.length] = createMarker(new GPoint(-97.52576700,35.43715300),"
Mount St Mary High School
2801 S Shartel Avenue
Oklahoma City, OK 73109
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Mount St Mary High School",'Oklahoma_City=' + Oklahoma_City.length); Oklahoma_City[Oklahoma_City.length] = createMarker(new GPoint(-97.63682100,35.48352500),"
New Life Christian Academy
1429 N Rockwell Avenue Ste A
Oklahoma City, OK 73127
Co-ed school, 1-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("New Life Christian Academy",'Oklahoma_City=' + Oklahoma_City.length); Harrah[Harrah.length] = createMarker(new GPoint(-97.20213000,35.53422100),"
Oklahoma Academy
6100 Academy Lane
Harrah, OK 73045
Co-ed school, 1-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Oklahoma Academy",'Harrah=' + Harrah.length); Edmond[Edmond.length] = createMarker(new GPoint(-97.46631500,35.64563700),"
Oklahoma Christian Academy
1101 E 9th Street
Edmond, OK 73034
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Oklahoma Christian Academy",'Edmond=' + Edmond.length); Edmond[Edmond.length] = createMarker(new GPoint(-97.47795800,35.65447100),"
Oklahoma Christian School
Po Box 509
Edmond, OK 73083
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Oklahoma Christian School",'Edmond=' + Edmond.length); Oklahoma_City[Oklahoma_City.length] = createMarker(new GPoint(-97.47679000,35.51417200),"
Parkview Adventist Academy
4201 N Martin Luther King Avenue
Oklahoma City, OK 73111
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Parkview Adventist Academy",'Oklahoma_City=' + Oklahoma_City.length); Bethany[Bethany.length] = createMarker(new GPoint(-97.62685900,35.49340600),"
Redeemer Lutheran Academy
6501 NW 23rd Street
Bethany, OK 73008
Co-ed school, 7-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Redeemer Lutheran Academy",'Bethany=' + Bethany.length); Oklahoma_City[Oklahoma_City.length] = createMarker(new GPoint(-97.61355900,35.49341000),"
Windsor Hills Baptist School
5517 Nw 23rd Street
Oklahoma City, OK 73127
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Windsor Hills Baptist School",'Oklahoma_City=' + Oklahoma_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,11); /* 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/////2/' + showArray); map.removeOverlays(Bethany); map.removeOverlays(Del_City); map.removeOverlays(Edmond); map.removeOverlays(Harrah); map.removeOverlays(Midwest_City); map.removeOverlays(Oklahoma_City); 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(Oklahoma_City);map.removeOverlays(Bethany); map.removeOverlays(Del_City); map.removeOverlays(Edmond); map.removeOverlays(Harrah); map.removeOverlays(Midwest_City); map.removeOverlays(Oklahoma_City); map.addOverlays(Bethany); centerByArray(Bethany, false, false); cntMarker += Bethany.length; map.addOverlays(Del_City); centerByArray(Del_City, false, false); cntMarker += Del_City.length; map.addOverlays(Edmond); centerByArray(Edmond, false, false); cntMarker += Edmond.length; map.addOverlays(Harrah); centerByArray(Harrah, false, false); cntMarker += Harrah.length; map.addOverlays(Midwest_City); centerByArray(Midwest_City, false, false); cntMarker += Midwest_City.length; map.addOverlays(Oklahoma_City); centerByArray(Oklahoma_City, false, false); cntMarker += Oklahoma_City.length; centerByArray(Oklahoma_City,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'); //window.open('/map.php?type=1&schools=&school_level=2&radius=&zipcode=&school_type_search=&school_type_code='); } } function createMarker(point, label, icon) { var marker = new GMarker(point, icon); var html = label; GEvent.addListener(marker, "click", function() { marker.openInfoWindowHtml(html); }); return marker; }