function addMarkers(){ mySelect = document.getElementById('selection'); Broken_Arrow = [];Edmond = [];Guthrie = [];Lawton = [];Mustang = [];Norman = [];Oklahoma_City = [];Tulsa = [];mySelect.options[mySelect.options.length] = new Option("Broken Arrow schools",'all=Broken_Arrow'); mySelect.options[mySelect.options.length] = new Option("Edmond schools",'all=Edmond'); mySelect.options[mySelect.options.length] = new Option("Guthrie schools",'all=Guthrie'); mySelect.options[mySelect.options.length] = new Option("Lawton schools",'all=Lawton'); mySelect.options[mySelect.options.length] = new Option("Mustang schools",'all=Mustang'); mySelect.options[mySelect.options.length] = new Option("Norman schools",'all=Norman'); mySelect.options[mySelect.options.length] = new Option("Oklahoma City schools",'all=Oklahoma_City'); mySelect.options[mySelect.options.length] = new Option("Tulsa schools",'all=Tulsa'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Broken_Arrow[Broken_Arrow.length] = createMarker(new GPoint(-95.81214700,36.03173400),"
Council Oaks Learning Campus
2009 W Washington Street
Broken Arrow, OK 74012
Co-ed school, NS-PK
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Council Oaks Learning Campus",'Broken_Arrow=' + Broken_Arrow.length); Edmond[Edmond.length] = createMarker(new GPoint(-97.47384400,35.64390100),"
First Presbyterian Ecp
1001 S Rankin Street
Edmond, OK 73034
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("First Presbyterian Ecp",'Edmond=' + Edmond.length); Guthrie[Guthrie.length] = createMarker(new GPoint(-97.42540000,35.85050000),"
Guthrie Christian School
Po Box 1307
Guthrie, OK 73044
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Guthrie Christian School",'Guthrie=' + Guthrie.length); Lawton[Lawton.length] = createMarker(new GPoint(-98.43996600,34.61689200),"
Play To Learn Preschool-kinder
910 N.w. 38th St.
Lawton, OK 73505
Co-ed school, PK-KG
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Play To Learn Preschool-kinder",'Lawton=' + Lawton.length); Mustang[Mustang.length] = createMarker(new GPoint(-97.76026700,35.39614700),"
Christ Lutheran School
501 N Clear Springs Road
Mustang, OK 73064
Co-ed school, NS-PK
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Christ Lutheran School",'Mustang=' + Mustang.length); Norman[Norman.length] = createMarker(new GPoint(-97.42796700,35.21821500),"
Gingerbread Nursery School
602 Villa Drive
Norman, OK 73071
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Gingerbread Nursery School",'Norman=' + Norman.length); Norman[Norman.length] = createMarker(new GPoint(-97.44480000,35.22120000),"
Mcfarlin Kindergarten Day Care
Po Box 6390
Norman, OK 73070
Co-ed school, K-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Mcfarlin Kindergarten Day Care",'Norman=' + Norman.length); Norman[Norman.length] = createMarker(new GPoint(-97.44489500,35.19134500),"
Ou Childrens World
2727 Asp Avenue
Norman, OK 73072
Co-ed school, NS-PK
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Ou Childrens World",'Norman=' + Norman.length); Norman[Norman.length] = createMarker(new GPoint(-97.44036700,35.20359000),"
Pumpkin Shell School Inc
1312 Lincoln Avenue
Norman, OK 73072
Co-ed school, NS-PK
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Pumpkin Shell School Inc",'Norman=' + Norman.length); Oklahoma_City[Oklahoma_City.length] = createMarker(new GPoint(-97.53003300,35.33276000),"
Villa Teresa Moore
13501 S Western Avenue
Oklahoma City, OK 73170
Co-ed school, NS-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Villa Teresa Moore",'Oklahoma_City=' + Oklahoma_City.length); Oklahoma_City[Oklahoma_City.length] = createMarker(new GPoint(-97.51770000,35.47300000),"
Celebrations Preschool
Po Box 2656
Oklahoma City, OK 73101
Co-ed school, NS-PK
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Celebrations Preschool",'Oklahoma_City=' + Oklahoma_City.length); Oklahoma_City[Oklahoma_City.length] = createMarker(new GPoint(-97.56576700,35.38837300),"
Okc Comm. College Cdc
7777 S May Ave
Oklahoma City, OK 73159
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Okc Comm. College Cdc",'Oklahoma_City=' + Oklahoma_City.length); Oklahoma_City[Oklahoma_City.length] = createMarker(new GPoint(-97.57443000,35.52665300),"
The Childrens Place Integris
5600 N Independence Avenue
Oklahoma City, OK 73112
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("The Childrens Place Integris",'Oklahoma_City=' + Oklahoma_City.length); Oklahoma_City[Oklahoma_City.length] = createMarker(new GPoint(-97.52967400,35.51168000),"
Crown Heights Christian Center
4020 N Western Avenue
Oklahoma City, OK 73118
Co-ed school, NS-PK
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Crown Heights Christian Center",'Oklahoma_City=' + Oklahoma_City.length); Oklahoma_City[Oklahoma_City.length] = createMarker(new GPoint(-97.58484300,35.58479300),"
King's Gate Christian School
11400 N Portland Avenue
Oklahoma City, OK 73120
Co-ed school, NS-PK
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("King's Gate Christian School",'Oklahoma_City=' + Oklahoma_City.length); Tulsa[Tulsa.length] = createMarker(new GPoint(-95.95428500,36.06066300),"
Christ The Redeemer-ecc
2550 E 71st Street
Tulsa, OK 74136
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Christ The Redeemer-ecc",'Tulsa=' + Tulsa.length); Tulsa[Tulsa.length] = createMarker(new GPoint(-95.98796300,36.15320000),"
1st Baptist Learning Center
403 S Cincinnati Avenue
Tulsa, OK 74103
Co-ed school, NS-PK
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("1st Baptist Learning Center",'Tulsa=' + Tulsa.length); map.removeOverlays(Broken_Arrow); map.removeOverlays(Edmond); map.removeOverlays(Guthrie); map.removeOverlays(Lawton); map.removeOverlays(Mustang); map.removeOverlays(Norman); map.removeOverlays(Oklahoma_City); map.removeOverlays(Tulsa); setTimeout(function(){map.addOverlays(Broken_Arrow)},1000); setTimeout(function(){map.addOverlays(Edmond)},1000); setTimeout(function(){map.addOverlays(Guthrie)},1000); setTimeout(function(){map.addOverlays(Lawton)},1000); setTimeout(function(){map.addOverlays(Mustang)},1000); setTimeout(function(){map.addOverlays(Norman)},1000); setTimeout(function(){map.addOverlays(Oklahoma_City)},1000); setTimeout(function(){map.addOverlays(Tulsa)},1000); maxLng = -95.81214700; maxLat = 36.15320000; minLng = -98.43996600; minLat = 34.61689200; reCenterMap(); } // 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//////' + showArray); map.removeOverlays(Broken_Arrow); map.removeOverlays(Edmond); map.removeOverlays(Guthrie); map.removeOverlays(Lawton); map.removeOverlays(Mustang); map.removeOverlays(Norman); map.removeOverlays(Oklahoma_City); map.removeOverlays(Tulsa); 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(Broken_Arrow);map.removeOverlays(Broken_Arrow); map.removeOverlays(Edmond); map.removeOverlays(Guthrie); map.removeOverlays(Lawton); map.removeOverlays(Mustang); map.removeOverlays(Norman); map.removeOverlays(Oklahoma_City); map.removeOverlays(Tulsa); map.addOverlays(Broken_Arrow); centerByArray(Broken_Arrow, false, false); cntMarker += Broken_Arrow.length; map.addOverlays(Edmond); centerByArray(Edmond, false, false); cntMarker += Edmond.length; map.addOverlays(Guthrie); centerByArray(Guthrie, false, false); cntMarker += Guthrie.length; map.addOverlays(Lawton); centerByArray(Lawton, false, false); cntMarker += Lawton.length; map.addOverlays(Mustang); centerByArray(Mustang, false, false); cntMarker += Mustang.length; map.addOverlays(Norman); centerByArray(Norman, false, false); cntMarker += Norman.length; map.addOverlays(Oklahoma_City); centerByArray(Oklahoma_City, false, false); cntMarker += Oklahoma_City.length; map.addOverlays(Tulsa); centerByArray(Tulsa, false, false); cntMarker += Tulsa.length; centerByArray(Broken_Arrow,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=2&schools=&school_level=&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; }