function addMarkers(){ mySelect = document.getElementById('selection'); Longview = [];Houston = [];Austin = [];Dallas = [];San_Antonio = [];Mcallen = [];Kerrville = [];Sweeny = [];mySelect.options[mySelect.options.length] = new Option("Austin schools",'all=Austin'); mySelect.options[mySelect.options.length] = new Option("Dallas schools",'all=Dallas'); mySelect.options[mySelect.options.length] = new Option("Houston schools",'all=Houston'); mySelect.options[mySelect.options.length] = new Option("Kerrville schools",'all=Kerrville'); mySelect.options[mySelect.options.length] = new Option("Longview schools",'all=Longview'); mySelect.options[mySelect.options.length] = new Option("Mcallen schools",'all=Mcallen'); mySelect.options[mySelect.options.length] = new Option("San Antonio schools",'all=San_Antonio'); mySelect.options[mySelect.options.length] = new Option("Sweeny schools",'all=Sweeny'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Longview[Longview.length] = createMarker(new GPoint(-94.72042500,32.53671900),"
Alpine Christian Academy
610 E Loop 281
Longview, TX 75605
All-girls school, PK-4
[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Alpine Christian Academy",'Longview=' + Longview.length); Houston[Houston.length] = createMarker(new GPoint(-95.48527900,29.77765500),"
Duchesne Academy
10202 Memorial Drive
Houston, TX 77024
All-girls school, PK-12
[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Duchesne Academy",'Houston=' + Houston.length); Austin[Austin.length] = createMarker(new GPoint(-97.76384600,30.29253300),"
The Girls' School of Austin
2007 McCall
Austin, TX 78703
All-girls school, K-8
[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("The Girls' School of Austin",'Austin=' + Austin.length); Dallas[Dallas.length] = createMarker(new GPoint(-96.82956200,32.90725600),"
The Hockaday School
11600 Welch Road
Dallas, TX 75229
All-girls school, PK-12
[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("The Hockaday School",'Dallas=' + Dallas.length); Houston[Houston.length] = createMarker(new GPoint(-95.35739100,29.75665700),"
Incarnate Word Academy
609 Crawford Street
Houston, TX 77002
All-girls school, 9-12
[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Incarnate Word Academy",'Houston=' + Houston.length); San_Antonio[San_Antonio.length] = createMarker(new GPoint(-98.47673200,29.46566900),"
Incarnate Word High School
727 E Hildebrand Avenue
San Antonio, TX 78212
All-girls school, 9-12
[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Incarnate Word High School",'San_Antonio=' + San_Antonio.length); San_Antonio[San_Antonio.length] = createMarker(new GPoint(-98.48610100,29.43438000),"
Providence High School
1215 N St Marys
San Antonio, TX 78215
All-girls school, 6-12
[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Providence High School",'San_Antonio=' + San_Antonio.length); Mcallen[Mcallen.length] = createMarker(new GPoint(-98.22128000,26.20184900),"
Regional Bible Institute Christian Academy
Po Box 6283
Mcallen, TX 78502
All-girls school, 7-12
[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Regional Bible Institute Christian Academy",'Mcallen=' + Mcallen.length); Houston[Houston.length] = createMarker(new GPoint(-95.54263800,29.70514500),"
St. Agnes Academy
9000 Bellaire Blvd
Houston, TX 77036
All-girls school, 9-12
[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("St. Agnes Academy",'Houston=' + Houston.length); San_Antonio[San_Antonio.length] = createMarker(new GPoint(-98.53816800,29.37686900),"
St. Francis Academy
1807 Centennial
San Antonio, TX 78211
All-girls school, 9-12
[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("St. Francis Academy",'San_Antonio=' + San_Antonio.length); Kerrville[Kerrville.length] = createMarker(new GPoint(-99.13645300,30.04444000),"
St Peter's Episcopal School
321 Saint Peter Street
Kerrville, TX 78028
All-girls school, PK-K
[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("St Peter's Episcopal School",'Kerrville=' + Kerrville.length); Sweeny[Sweeny.length] = createMarker(new GPoint(-95.71440000,29.06080000),"
Sweeny Christian School
Po Box 156
Sweeny, TX 77480
All-girls school, PK-5
[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Sweeny Christian School",'Sweeny=' + Sweeny.length); Dallas[Dallas.length] = createMarker(new GPoint(-96.82463300,32.87996300),"
Ursuline Academy Of Dallas
4900 Walnut Hill Lane
Dallas, TX 75229
All-girls school, 9-12
[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Ursuline Academy Of Dallas",'Dallas=' + Dallas.length); map.removeOverlays(Austin); map.removeOverlays(Dallas); map.removeOverlays(Houston); map.removeOverlays(Kerrville); map.removeOverlays(Longview); map.removeOverlays(Mcallen); map.removeOverlays(San_Antonio); map.removeOverlays(Sweeny); setTimeout(function(){map.addOverlays(Austin)},1000); setTimeout(function(){map.addOverlays(Dallas)},1000); setTimeout(function(){map.addOverlays(Houston)},1000); setTimeout(function(){map.addOverlays(Kerrville)},1000); setTimeout(function(){map.addOverlays(Longview)},1000); setTimeout(function(){map.addOverlays(Mcallen)},1000); setTimeout(function(){map.addOverlays(San_Antonio)},1000); setTimeout(function(){map.addOverlays(Sweeny)},1000); maxLng = -94.72042500; maxLat = 32.90725600; minLng = -99.13645300; minLat = 26.20184900; 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(Austin); map.removeOverlays(Dallas); map.removeOverlays(Houston); map.removeOverlays(Kerrville); map.removeOverlays(Longview); map.removeOverlays(Mcallen); map.removeOverlays(San_Antonio); map.removeOverlays(Sweeny); 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(Longview);map.removeOverlays(Austin); map.removeOverlays(Dallas); map.removeOverlays(Houston); map.removeOverlays(Kerrville); map.removeOverlays(Longview); map.removeOverlays(Mcallen); map.removeOverlays(San_Antonio); map.removeOverlays(Sweeny); map.addOverlays(Austin); centerByArray(Austin, false, false); cntMarker += Austin.length; map.addOverlays(Dallas); centerByArray(Dallas, false, false); cntMarker += Dallas.length; map.addOverlays(Houston); centerByArray(Houston, false, false); cntMarker += Houston.length; map.addOverlays(Kerrville); centerByArray(Kerrville, false, false); cntMarker += Kerrville.length; map.addOverlays(Longview); centerByArray(Longview, false, false); cntMarker += Longview.length; map.addOverlays(Mcallen); centerByArray(Mcallen, false, false); cntMarker += Mcallen.length; map.addOverlays(San_Antonio); centerByArray(San_Antonio, false, false); cntMarker += San_Antonio.length; map.addOverlays(Sweeny); centerByArray(Sweeny, false, false); cntMarker += Sweeny.length; centerByArray(Longview,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///26901,27653,26739,26947,27315,33818,26950,27203,27357,35297,26901,26739,35260,34152,33818,27544,/all'); //window.open('/map.php?type=2&schools=26901,27653,26739,26947,27315,33818,26950,27203,27357,35297,26901,26739,35260,34152,33818,27544,&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; }