function addMarkers(){ mySelect = document.getElementById('selection'); Saint_Clair = [];Villa_Ridge = [];Saint_Albans = [];Union = [];Washington = [];Pacific = [];Sullivan = [];mySelect.options[mySelect.options.length] = new Option("Pacific schools",'all=Pacific'); mySelect.options[mySelect.options.length] = new Option("Saint Albans schools",'all=Saint_Albans'); mySelect.options[mySelect.options.length] = new Option("Saint Clair schools",'all=Saint_Clair'); mySelect.options[mySelect.options.length] = new Option("Sullivan schools",'all=Sullivan'); mySelect.options[mySelect.options.length] = new Option("Union schools",'all=Union'); mySelect.options[mySelect.options.length] = new Option("Villa Ridge schools",'all=Villa_Ridge'); mySelect.options[mySelect.options.length] = new Option("Washington schools",'all=Washington'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Saint_Clair[Saint_Clair.length] = createMarker(new GPoint(-90.96835700,38.33638700),"
Cornerstone Baptist Academy
1352 Parkway Drive
Saint Clair, MO 63077
Co-ed school, 1-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Cornerstone Baptist Academy",'Saint_Clair=' + Saint_Clair.length); Villa_Ridge[Villa_Ridge.length] = createMarker(new GPoint(-90.88000000,38.45950000),"
Crosspoint Christian School
Po Box 100
Villa Ridge, MO 63089
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Crosspoint Christian School",'Villa_Ridge=' + Villa_Ridge.length); Saint_Albans[Saint_Albans.length] = createMarker(new GPoint(-90.75384900,38.58160000),"
The Fulton School at St. Albans
123 Schoolhouse Road, P.O.Box 78
Saint Albans, MO 63073
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("The Fulton School at St. Albans",'Saint_Albans=' + Saint_Albans.length); Union[Union.length] = createMarker(new GPoint(-91.00894300,38.44693700),"
Immaculate Conception School
6 W State Street
Union, MO 63084
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Immaculate Conception School",'Union=' + Union.length); Washington[Washington.length] = createMarker(new GPoint(-91.01528200,38.55706300),"
Immanuel Lutheran
214 W 5th Street
Washington, MO 63090
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Immanuel Lutheran",'Washington=' + Washington.length); Washington[Washington.length] = createMarker(new GPoint(-91.00243900,38.54836600),"
Our Lady Of Lourdes
950 Madison Avenue
Washington, MO 63090
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Our Lady Of Lourdes",'Washington=' + Washington.length); Pacific[Pacific.length] = createMarker(new GPoint(-90.74309400,38.48323700),"
St. Bridget Elementary School
223 West Union St
Pacific, MO 63069
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Bridget Elementary School",'Pacific=' + Pacific.length); Washington[Washington.length] = createMarker(new GPoint(-91.02535100,38.55115600),"
St. Francis Borgia Regional High School
1000 Borgia Drive
Washington, MO 63090
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Francis Borgia Regional High School",'Washington=' + Washington.length); Washington[Washington.length] = createMarker(new GPoint(-90.98724500,38.54266700),"
Small Wonder Early Childhood
1890 E 9th St
Washington, MO 63090
Co-ed school, PK-KG
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Small Wonder Early Childhood",'Washington=' + Washington.length); Sullivan[Sullivan.length] = createMarker(new GPoint(-91.16339900,38.21384100),"
St Anthony Elementary School
119 W Springfield Road
Sullivan, MO 63080
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St Anthony Elementary School",'Sullivan=' + Sullivan.length); Saint_Clair[Saint_Clair.length] = createMarker(new GPoint(-90.98609500,38.34220200),"
St Clare Catholic School
125 East Springfield Road
Saint Clair, MO 63077
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St Clare Catholic School",'Saint_Clair=' + Saint_Clair.length); Washington[Washington.length] = createMarker(new GPoint(-91.01504600,38.56040800),"
St Francis Borgia School
225 Cedar Street
Washington, MO 63090
Co-ed school, 5-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St Francis Borgia School",'Washington=' + Washington.length); Washington[Washington.length] = createMarker(new GPoint(-91.04726500,38.49728900),"
St Gertrude School
6520 State Road Yy
Washington, MO 63090
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St Gertrude School",'Washington=' + Washington.length); Villa_Ridge[Villa_Ridge.length] = createMarker(new GPoint(-90.92942000,38.47292100),"
St John The Baptist School
5579 Gildehaus Road
Villa Ridge, MO 63089
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St John The Baptist School",'Villa_Ridge=' + Villa_Ridge.length); Washington[Washington.length] = createMarker(new GPoint(-91.02284500,38.56363000),"
Washington Montessori School
210 High Street
Washington, MO 63090
Co-ed school, NS-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Washington Montessori School",'Washington=' + Washington.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(Pacific); map.removeOverlays(Saint_Albans); map.removeOverlays(Saint_Clair); map.removeOverlays(Sullivan); map.removeOverlays(Union); map.removeOverlays(Villa_Ridge); map.removeOverlays(Washington); 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(Saint_Clair);map.removeOverlays(Pacific); map.removeOverlays(Saint_Albans); map.removeOverlays(Saint_Clair); map.removeOverlays(Sullivan); map.removeOverlays(Union); map.removeOverlays(Villa_Ridge); map.removeOverlays(Washington); map.addOverlays(Pacific); centerByArray(Pacific, false, false); cntMarker += Pacific.length; map.addOverlays(Saint_Albans); centerByArray(Saint_Albans, false, false); cntMarker += Saint_Albans.length; map.addOverlays(Saint_Clair); centerByArray(Saint_Clair, false, false); cntMarker += Saint_Clair.length; map.addOverlays(Sullivan); centerByArray(Sullivan, false, false); cntMarker += Sullivan.length; map.addOverlays(Union); centerByArray(Union, false, false); cntMarker += Union.length; map.addOverlays(Villa_Ridge); centerByArray(Villa_Ridge, false, false); cntMarker += Villa_Ridge.length; map.addOverlays(Washington); centerByArray(Washington, false, false); cntMarker += Washington.length; centerByArray(Saint_Clair,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; }