function addMarkers(){ mySelect = document.getElementById('selection'); Saint_Louis = [];Webster_Groves = [];Kansas_City = [];mySelect.options[mySelect.options.length] = new Option("Kansas City schools",'all=Kansas_City'); mySelect.options[mySelect.options.length] = new Option("Saint Louis schools",'all=Saint_Louis'); mySelect.options[mySelect.options.length] = new Option("Webster Groves schools",'all=Webster_Groves'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Saint_Louis[Saint_Louis.length] = createMarker(new GPoint(-90.33710900,38.66032500),"
Bais Yaakov High School Of St Louis
700 N And South Road
Saint Louis, MO 63130
All-girls school, 9-12
[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Bais Yaakov High School Of St Louis",'Saint_Louis=' + Saint_Louis.length); Saint_Louis[Saint_Louis.length] = createMarker(new GPoint(-90.34539800,38.54773500),"
Cor Jesu Academy
10230 Gravois Road
Saint Louis, MO 63123
All-girls school, 9-12
[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Cor Jesu Academy",'Saint_Louis=' + Saint_Louis.length); Saint_Louis[Saint_Louis.length] = createMarker(new GPoint(-90.31293400,38.70020100),"
Incarnate Word Academy
2788 Normandy Drive
Saint Louis, MO 63121
All-girls school, 9-12
[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Incarnate Word Academy",'Saint_Louis=' + Saint_Louis.length); Webster_Groves[Webster_Groves.length] = createMarker(new GPoint(-90.34280900,38.59109700),"
Nerinx Hall High School
530 E Lockwood Avenue
Webster Groves, MO 63119
All-girls school, 9-12
[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Nerinx Hall High School",'Webster_Groves=' + Webster_Groves.length); Saint_Louis[Saint_Louis.length] = createMarker(new GPoint(-90.27267500,38.52416300),"
Notre Dame High School
320 East Ripa Avenue
Saint Louis, MO 63125
All-girls school, 9-12
[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Notre Dame High School",'Saint_Louis=' + Saint_Louis.length); Saint_Louis[Saint_Louis.length] = createMarker(new GPoint(-90.25350600,38.64169500),"
Rosati-Kain High School
4389 Lindell Blvd
Saint Louis, MO 63108
All-girls school, 9-12
[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Rosati-Kain High School",'Saint_Louis=' + Saint_Louis.length); Saint_Louis[Saint_Louis.length] = createMarker(new GPoint(-90.40614200,38.62375200),"
St. Josephs Academy
2307 S Lindbergh Blvd
Saint Louis, MO 63131
All-girls school, 9-12
[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("St. Josephs Academy",'Saint_Louis=' + Saint_Louis.length); Kansas_City[Kansas_City.length] = createMarker(new GPoint(-94.58799100,39.02567500),"
St. Teresa's Academy
5600 Main Street
Kansas City, MO 64113
All-girls school, 9-12
[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("St. Teresa's Academy",'Kansas_City=' + Kansas_City.length); Saint_Louis[Saint_Louis.length] = createMarker(new GPoint(-90.35984700,38.67423700),"
Torah Prep School
8659 Olive Blvd
Saint Louis, MO 63132
All-girls school, PK-8
[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Torah Prep School",'Saint_Louis=' + Saint_Louis.length); Saint_Louis[Saint_Louis.length] = createMarker(new GPoint(-90.38567500,38.57706000),"
Ursuline Academy Of St Louis
341 S Sappington Road
Saint Louis, MO 63122
All-girls school, 9-12
[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Ursuline Academy Of St Louis",'Saint_Louis=' + Saint_Louis.length); Saint_Louis[Saint_Louis.length] = createMarker(new GPoint(-90.44345600,38.63612600),"
Visitation Academy Of St Louis
3020 North Ballas Road
Saint Louis, MO 63131
All-girls school, PK-12
[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Visitation Academy Of St Louis",'Saint_Louis=' + Saint_Louis.length); map.removeOverlays(Kansas_City); map.removeOverlays(Saint_Louis); map.removeOverlays(Webster_Groves); setTimeout(function(){map.addOverlays(Kansas_City)},1000); setTimeout(function(){map.addOverlays(Saint_Louis)},1000); setTimeout(function(){map.addOverlays(Webster_Groves)},1000); maxLng = -90.25350600; maxLat = 39.02567500; minLng = -94.58799100; minLat = 38.52416300; 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(Kansas_City); map.removeOverlays(Saint_Louis); map.removeOverlays(Webster_Groves); 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_Louis);map.removeOverlays(Kansas_City); map.removeOverlays(Saint_Louis); map.removeOverlays(Webster_Groves); map.addOverlays(Kansas_City); centerByArray(Kansas_City, false, false); cntMarker += Kansas_City.length; map.addOverlays(Saint_Louis); centerByArray(Saint_Louis, false, false); cntMarker += Saint_Louis.length; map.addOverlays(Webster_Groves); centerByArray(Webster_Groves, false, false); cntMarker += Webster_Groves.length; centerByArray(Saint_Louis,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///16107,15631,15693,15791,15860,15907,16039,16163,16171,15847,16145,16171,/all'); //window.open('/map.php?type=2&schools=16107,15631,15693,15791,15860,15907,16039,16163,16171,15847,16145,16171,&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; }