function addMarkers(){ mySelect = document.getElementById('selection'); Brownsville = [];Harlingen = [];South_Padre_Island = [];Seven_Points = [];mySelect.options[mySelect.options.length] = new Option("Brownsville schools",'all=Brownsville'); mySelect.options[mySelect.options.length] = new Option("Harlingen schools",'all=Harlingen'); mySelect.options[mySelect.options.length] = new Option("Seven Points schools",'all=Seven_Points'); mySelect.options[mySelect.options.length] = new Option("South Padre Island schools",'all=South_Padre_Island'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Brownsville[Brownsville.length] = createMarker(new GPoint(-97.47882600,25.92515700),"
Brownsville Sda School
243 Old Port Isabel Road
Brownsville, TX 78521
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Brownsville Sda School",'Brownsville=' + Brownsville.length); Harlingen[Harlingen.length] = createMarker(new GPoint(-97.68925200,26.21047600),"
Calvary Christian School
1815 N 7th Street
Harlingen, TX 78550
Co-ed school, PK-10
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Calvary Christian School",'Harlingen=' + Harlingen.length); Brownsville[Brownsville.length] = createMarker(new GPoint(-97.50885400,25.92670900),"
The Episcopal Day School
34 N Coria Street
Brownsville, TX 78520
Co-ed school, PK-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("The Episcopal Day School",'Brownsville=' + Brownsville.length); Brownsville[Brownsville.length] = createMarker(new GPoint(-97.49719800,25.92256300),"
First Baptist School
1600 Boca Chica Blvd
Brownsville, TX 78520
Co-ed school, PK-11
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("First Baptist School",'Brownsville=' + Brownsville.length); Brownsville[Brownsville.length] = createMarker(new GPoint(-97.48711700,25.91031300),"
Guadalupe Regional Middle School
1214 Lincoln Street
Brownsville, TX 78521
Co-ed school, 6-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Guadalupe Regional Middle School",'Brownsville=' + Brownsville.length); Brownsville[Brownsville.length] = createMarker(new GPoint(-97.50805200,25.91820700),"
Incarnate Word Academy
244 Resaca Blvd
Brownsville, TX 78520
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Incarnate Word Academy",'Brownsville=' + Brownsville.length); Brownsville[Brownsville.length] = createMarker(new GPoint(-97.50710300,25.94134700),"
Kenmont Montessori School
2734 N Coria Street
Brownsville, TX 78520
Co-ed school, PK-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Kenmont Montessori School",'Brownsville=' + Brownsville.length); South_Padre_Island[South_Padre_Island.length] = createMarker(new GPoint(-97.29814000,26.10794800),"
Laguna Madre Christian Academy
1441 Santa Isabel Blvd
South Padre Island, TX 78578
Co-ed school, PK-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Laguna Madre Christian Academy",'South_Padre_Island=' + South_Padre_Island.length); Seven_Points[Seven_Points.length] = createMarker(new GPoint(-96.19404300,32.29670200),"
Lake Pointe Christian Academy
1724 N Tool Drive
Seven Points, TX 75143
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Lake Pointe Christian Academy",'Seven_Points=' + Seven_Points.length); Brownsville[Brownsville.length] = createMarker(new GPoint(-97.49552900,25.89958500),"
Livingway Christian School
PO Box 3731
Brownsville, TX 78523
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Livingway Christian School",'Brownsville=' + Brownsville.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); Harlingen[Harlingen.length] = createMarker(new GPoint(-97.68032700,26.20243700),"
St. Albans Episcopal Day School
1417 E Austin Avenue
Harlingen, TX 78550
Co-ed school, PK-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Albans Episcopal Day School",'Harlingen=' + Harlingen.length); Harlingen[Harlingen.length] = createMarker(new GPoint(-97.68542600,26.19083700),"
St. Anthony Catholic School
1015 E Harrison Avenue
Harlingen, TX 78550
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Anthony Catholic School",'Harlingen=' + Harlingen.length); Brownsville[Brownsville.length] = createMarker(new GPoint(-97.60415400,26.01013900),"
St. Marys Catholic School
1300 E Los Ebanos Blvd
Brownsville, TX 78520
Co-ed school, PK-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Marys Catholic School",'Brownsville=' + Brownsville.length); Brownsville[Brownsville.length] = createMarker(new GPoint(-97.47636300,25.93273000),"
St Luke Catholic School
2850 Price Road
Brownsville, TX 78521
Co-ed school, PK-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St Luke Catholic School",'Brownsville=' + Brownsville.length); Harlingen[Harlingen.length] = createMarker(new GPoint(-97.67852700,26.19786300),"
St Paul Lutheran School
1920 E Washington Avenue
Harlingen, TX 78550
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St Paul Lutheran School",'Harlingen=' + Harlingen.length); Brownsville[Brownsville.length] = createMarker(new GPoint(-97.50839100,25.93067700),"
Sunnyside Day School, Inc
1914 N. Coria St
Brownsville, TX 78520
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Sunnyside Day School, Inc",'Brownsville=' + Brownsville.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(Brownsville); map.removeOverlays(Harlingen); map.removeOverlays(Seven_Points); map.removeOverlays(South_Padre_Island); 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(Brownsville);map.removeOverlays(Brownsville); map.removeOverlays(Harlingen); map.removeOverlays(Seven_Points); map.removeOverlays(South_Padre_Island); map.addOverlays(Brownsville); centerByArray(Brownsville, false, false); cntMarker += Brownsville.length; map.addOverlays(Harlingen); centerByArray(Harlingen, false, false); cntMarker += Harlingen.length; map.addOverlays(Seven_Points); centerByArray(Seven_Points, false, false); cntMarker += Seven_Points.length; map.addOverlays(South_Padre_Island); centerByArray(South_Padre_Island, false, false); cntMarker += South_Padre_Island.length; centerByArray(Brownsville,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; }