function addMarkers(){ mySelect = document.getElementById('selection'); Houston = [];El_Paso = [];San_Antonio = [];Irving = [];Dallas = [];Harlingen = [];mySelect.options[mySelect.options.length] = new Option("Dallas schools",'all=Dallas'); mySelect.options[mySelect.options.length] = new Option("El Paso schools",'all=El_Paso'); mySelect.options[mySelect.options.length] = new Option("Harlingen schools",'all=Harlingen'); mySelect.options[mySelect.options.length] = new Option("Houston schools",'all=Houston'); mySelect.options[mySelect.options.length] = new Option("Irving schools",'all=Irving'); mySelect.options[mySelect.options.length] = new Option("San Antonio schools",'all=San_Antonio'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Houston[Houston.length] = createMarker(new GPoint(-95.11313500,29.59496300),"
Armand Bayou Montessori
16204 Hickory Knoll Drive
Houston, TX 77059
All-boys school, PK-3
[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Armand Bayou Montessori",'Houston=' + Houston.length); El_Paso[El_Paso.length] = createMarker(new GPoint(-106.49354900,31.76742800),"
Cathedral High School
1309 N. Stanton
El Paso, TX 79902
All-boys school, 9-12
[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Cathedral High School",'El_Paso=' + El_Paso.length); San_Antonio[San_Antonio.length] = createMarker(new GPoint(-98.48124500,29.43839500),"
Central Catholic High School
1403 N. St. Mary''s
San Antonio, TX 78215
All-boys school, 9-12
[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Central Catholic High School",'San_Antonio=' + San_Antonio.length); Irving[Irving.length] = createMarker(new GPoint(-96.92200800,32.85561200),"
Cistercian Preparatory School
3660 Cistercian Road
Irving, TX 75039
All-boys school, 5-12
[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Cistercian Preparatory School",'Irving=' + Irving.length); Dallas[Dallas.length] = createMarker(new GPoint(-96.81864700,32.91664800),"
Jesuit College Preparatory School of Dallas
12345 Inwood Road
Dallas, TX 75244
All-boys school, 9-12
[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Jesuit College Preparatory School of Dallas",'Dallas=' + Dallas.length); Harlingen[Harlingen.length] = createMarker(new GPoint(-97.66628400,26.22356300),"
Marine Military Academy
320 Iwo Jima Blvd
Harlingen, TX 78550
All-boys school, 8-8
[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Marine Military Academy",'Harlingen=' + Harlingen.length); Houston[Houston.length] = createMarker(new GPoint(-95.47618800,29.79473700),"
The Regis School Of The Sacred Heart
7330 Westview Drive
Houston, TX 77055
All-boys school, 5-8
[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("The Regis School Of The Sacred Heart",'Houston=' + Houston.length); Dallas[Dallas.length] = createMarker(new GPoint(-96.80373600,32.89013700),"
St. Mark's School Of Texas
10600 Preston Road
Dallas, TX 75230
All-boys school, 1-12
[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("St. Mark's School Of Texas",'Dallas=' + Dallas.length); Houston[Houston.length] = createMarker(new GPoint(-95.40765600,29.76193700),"
St. Thomas High School
4500 Memorial Drive
Houston, TX 77007
All-boys school, 9-12
[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("St. Thomas High School",'Houston=' + Houston.length); San_Antonio[San_Antonio.length] = createMarker(new GPoint(-98.49346600,29.45025500),"
San Antonio Academy Of Texas
117 East French Place
San Antonio, TX 78212
All-boys school, PK-8
[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("San Antonio Academy Of Texas",'San_Antonio=' + San_Antonio.length); Houston[Houston.length] = createMarker(new GPoint(-95.54145600,29.70523700),"
Strake Jesuit College Prep School
8900 Bellaire Blvd
Houston, TX 77036
All-boys school, 9-12
[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Strake Jesuit College Prep School",'Houston=' + Houston.length); map.removeOverlays(Dallas); map.removeOverlays(El_Paso); map.removeOverlays(Harlingen); map.removeOverlays(Houston); map.removeOverlays(Irving); map.removeOverlays(San_Antonio); setTimeout(function(){map.addOverlays(Dallas)},1000); setTimeout(function(){map.addOverlays(El_Paso)},1000); setTimeout(function(){map.addOverlays(Harlingen)},1000); setTimeout(function(){map.addOverlays(Houston)},1000); setTimeout(function(){map.addOverlays(Irving)},1000); setTimeout(function(){map.addOverlays(San_Antonio)},1000); maxLng = -95.11313500; maxLat = 32.91664800; minLng = -106.49354900; minLat = 26.22356300; 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(Dallas); map.removeOverlays(El_Paso); map.removeOverlays(Harlingen); map.removeOverlays(Houston); map.removeOverlays(Irving); map.removeOverlays(San_Antonio); 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(Houston);map.removeOverlays(Dallas); map.removeOverlays(El_Paso); map.removeOverlays(Harlingen); map.removeOverlays(Houston); map.removeOverlays(Irving); map.removeOverlays(San_Antonio); map.addOverlays(Dallas); centerByArray(Dallas, false, false); cntMarker += Dallas.length; map.addOverlays(El_Paso); centerByArray(El_Paso, false, false); cntMarker += El_Paso.length; map.addOverlays(Harlingen); centerByArray(Harlingen, false, false); cntMarker += Harlingen.length; map.addOverlays(Houston); centerByArray(Houston, false, false); cntMarker += Houston.length; map.addOverlays(Irving); centerByArray(Irving, false, false); cntMarker += Irving.length; map.addOverlays(San_Antonio); centerByArray(San_Antonio, false, false); cntMarker += San_Antonio.length; centerByArray(Houston,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///26962,27413,26615,27501,27535,26665,26621,27413,27031,26531,27602,26665,27262,/all'); //window.open('/map.php?type=2&schools=26962,27413,26615,27501,27535,26665,26621,27413,27031,26531,27602,26665,27262,&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; }