function addMarkers(){ mySelect = document.getElementById('selection'); Norman = [];Oklahoma_City = [];Moore = [];mySelect.options[mySelect.options.length] = new Option("Moore schools",'all=Moore'); 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("---------------------------",''); Norman[Norman.length] = createMarker(new GPoint(-97.49413100,35.26482300),"
All Saints Catholic
4001 36th Avenue Nw
Norman, OK 73072
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("All Saints Catholic",'Norman=' + Norman.length); Oklahoma_City[Oklahoma_City.length] = createMarker(new GPoint(-97.58186500,35.34839100),"
Antioch Christian Academy
3616 Sw 119th Street
Oklahoma City, OK 73170
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Antioch Christian Academy",'Oklahoma_City=' + Oklahoma_City.length); Norman[Norman.length] = createMarker(new GPoint(-97.42662700,35.19667400),"
Blue Eagle Christian Academy
2404 Classen Blvd
Norman, OK 73071
Co-ed school, PK-10
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Blue Eagle Christian Academy",'Norman=' + Norman.length); Norman[Norman.length] = createMarker(new GPoint(-97.44242700,35.21515600),"
Children's House Of Norman
606 S Santa Fe Avenue
Norman, OK 73069
Co-ed school, PK-2
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Children's House Of Norman",'Norman=' + Norman.length); Norman[Norman.length] = createMarker(new GPoint(-97.48609000,35.25365700),"
Community Christian School
3002 Broce Drive
Norman, OK 73072
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Community Christian School",'Norman=' + Norman.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); Oklahoma_City[Oklahoma_City.length] = createMarker(new GPoint(-97.54763100,35.37199800),"
Kingspark Baptist Academy
9600 S Pennsylvania
Oklahoma City, OK 73159
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Kingspark Baptist Academy",'Oklahoma_City=' + Oklahoma_City.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); Moore[Moore.length] = createMarker(new GPoint(-97.47664800,35.34640700),"
Moore Christian School
836 N Eastern Avenue
Moore, OK 73160
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Moore Christian School",'Moore=' + Moore.length); Moore[Moore.length] = createMarker(new GPoint(-97.48118500,35.34457000),"
Oklahoma City Christian Academy
408 Century Dr
Moore, OK 73160
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Oklahoma City Christian Academy",'Moore=' + Moore.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); Norman[Norman.length] = createMarker(new GPoint(-97.43436300,35.23294100),"
Robinson St. Christian School
801 E Robinson Street
Norman, OK 73071
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Robinson St. Christian School",'Norman=' + Norman.length); Moore[Moore.length] = createMarker(new GPoint(-97.48270000,35.34080000),"
Southwest Christian Academy
1005 Sw 4th Street A
Moore, OK 73160
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Southwest Christian Academy",'Moore=' + Moore.length); Norman[Norman.length] = createMarker(new GPoint(-97.46557300,35.18953700),"
Southwind Montessori
1601 W Imhoff Road
Norman, OK 73072
Co-ed school, NS-PK
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Southwind Montessori",'Norman=' + Norman.length); Moore[Moore.length] = createMarker(new GPoint(-97.51073900,35.34875000),"
St John S Lutheran School
1032 Nw 12th Street
Moore, OK 73160
Co-ed school, PK-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St John S Lutheran School",'Moore=' + Moore.length); Norman[Norman.length] = createMarker(new GPoint(-97.43628400,35.21820000),"
Trinity Lutheran School
603 Classen Blvd
Norman, OK 73071
Co-ed school, PK-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Trinity Lutheran School",'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); } // 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/////3/' + showArray); map.removeOverlays(Moore); map.removeOverlays(Norman); 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(Norman);map.removeOverlays(Moore); map.removeOverlays(Norman); map.removeOverlays(Oklahoma_City); map.addOverlays(Moore); centerByArray(Moore, false, false); cntMarker += Moore.length; map.addOverlays(Norman); centerByArray(Norman, false, false); cntMarker += Norman.length; map.addOverlays(Oklahoma_City); centerByArray(Oklahoma_City, false, false); cntMarker += Oklahoma_City.length; centerByArray(Norman,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=3&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; }