function addMarkers(){ mySelect = document.getElementById('selection'); Columbia = [];Harrisburg = [];Centralia = [];mySelect.options[mySelect.options.length] = new Option("Centralia schools",'all=Centralia'); mySelect.options[mySelect.options.length] = new Option("Columbia schools",'all=Columbia'); mySelect.options[mySelect.options.length] = new Option("Harrisburg schools",'all=Harrisburg'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Columbia[Columbia.length] = createMarker(new GPoint(-92.33593500,38.89293800),"
Apple School
5155 S Providence Road
Columbia, MO 65203
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Apple School",'Columbia=' + Columbia.length); Columbia[Columbia.length] = createMarker(new GPoint(-92.33051600,38.94065000),"
Childrens House Montessori Of Columbia
915 Maryland Avenue
Columbia, MO 65201
Co-ed school, PK-1
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Childrens House Montessori Of Columbia",'Columbia=' + Columbia.length); Columbia[Columbia.length] = createMarker(new GPoint(-92.33444200,38.91471400),"
Christian Chapel Academy
3300 S Providence Rd
Columbia, MO 65203
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Christian Chapel Academy",'Columbia=' + Columbia.length); Columbia[Columbia.length] = createMarker(new GPoint(-92.40224000,38.95425300),"
Christian Fellowship School
4600 Christian Fellowship Road
Columbia, MO 65203
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Christian Fellowship School",'Columbia=' + Columbia.length); Columbia[Columbia.length] = createMarker(new GPoint(-92.36854050,38.96200060),"
Columbia Catholic School
817 Bernadette Drive
Columbia, MO 65203
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Columbia Catholic School",'Columbia=' + Columbia.length); Columbia[Columbia.length] = createMarker(new GPoint(-92.37118400,38.97223400),"
Columbia Independent School
1801 N. Stadium Blvd.
Columbia, MO 65202
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Columbia Independent School",'Columbia=' + Columbia.length); Columbia[Columbia.length] = createMarker(new GPoint(-92.34946600,38.95197200),"
Columbia Montessori School
3 Anderson Ave
Columbia, MO 65203
Co-ed school, PK-KG
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Columbia Montessori School",'Columbia=' + Columbia.length); Columbia[Columbia.length] = createMarker(new GPoint(-92.36692300,38.94038800),"
Columbia Sda Junior Academy
1114 College Park Drive
Columbia, MO 65203
Co-ed school, K-9
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Columbia Sda Junior Academy",'Columbia=' + Columbia.length); Columbia[Columbia.length] = createMarker(new GPoint(-92.37296500,38.94684200),"
Good Shepherd Lutheran School
2201 West Rollins Road
Columbia, MO 65203
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Good Shepherd Lutheran School",'Columbia=' + Columbia.length); Harrisburg[Harrisburg.length] = createMarker(new GPoint(-92.46571900,39.14435000),"
Harrisburg Presch & Dcc
450 West Sexton
Harrisburg, MO 65256
Co-ed school, PK-5
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Harrisburg Presch & Dcc",'Harrisburg=' + Harrisburg.length); Columbia[Columbia.length] = createMarker(new GPoint(-92.33207500,38.94944600),"
Islamic School Of Columbia-missouri
Po Box 92 408 Locust Street
Columbia, MO 65205
Co-ed school, PK-5
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Islamic School Of Columbia-missouri",'Columbia=' + Columbia.length); Columbia[Columbia.length] = createMarker(new GPoint(-92.36249700,38.95288500),"
Morningside Community School
1600 W Broadway
Columbia, MO 65203
Co-ed school, 5-7
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Morningside Community School",'Columbia=' + Columbia.length); Columbia[Columbia.length] = createMarker(new GPoint(-92.31990000,38.95270000),"
Stephens College Childrens School
Po Box 2022 Stephens College
Columbia, MO 65215
Co-ed school, PK-5
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Stephens College Childrens School",'Columbia=' + Columbia.length); Centralia[Centralia.length] = createMarker(new GPoint(-92.21238700,39.24317000),"
Sunnydale Sda Elementary School
6979 Audrain Road 9139
Centralia, MO 65240
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Sunnydale Sda Elementary School",'Centralia=' + Centralia.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/////1/' + showArray); map.removeOverlays(Centralia); map.removeOverlays(Columbia); map.removeOverlays(Harrisburg); 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(Columbia);map.removeOverlays(Centralia); map.removeOverlays(Columbia); map.removeOverlays(Harrisburg); map.addOverlays(Centralia); centerByArray(Centralia, false, false); cntMarker += Centralia.length; map.addOverlays(Columbia); centerByArray(Columbia, false, false); cntMarker += Columbia.length; map.addOverlays(Harrisburg); centerByArray(Harrisburg, false, false); cntMarker += Harrisburg.length; centerByArray(Columbia,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=1&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; }