function addMarkers(){ mySelect = document.getElementById('selection'); Mission = [];Mcallen = [];Edinburg = [];Palmhurst = [];Pharr = [];Mercedes = [];Weslaco = [];Alamo = [];mySelect.options[mySelect.options.length] = new Option("Alamo schools",'all=Alamo'); mySelect.options[mySelect.options.length] = new Option("Edinburg schools",'all=Edinburg'); mySelect.options[mySelect.options.length] = new Option("Mcallen schools",'all=Mcallen'); mySelect.options[mySelect.options.length] = new Option("Mercedes schools",'all=Mercedes'); mySelect.options[mySelect.options.length] = new Option("Mission schools",'all=Mission'); mySelect.options[mySelect.options.length] = new Option("Palmhurst schools",'all=Palmhurst'); mySelect.options[mySelect.options.length] = new Option("Pharr schools",'all=Pharr'); mySelect.options[mySelect.options.length] = new Option("Weslaco schools",'all=Weslaco'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Mission[Mission.length] = createMarker(new GPoint(-98.29605000,26.22810400),"
Agape Christian School
1401 E 24th Street
Mission, TX 78574
Co-ed school, PK-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Agape Christian School",'Mission=' + Mission.length); Mcallen[Mcallen.length] = createMarker(new GPoint(-98.23381100,26.24084100),"
Central Christian School
1320 Nolana Street
Mcallen, TX 78504
Co-ed school, PK-7
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Central Christian School",'Mcallen=' + Mcallen.length); Mcallen[Mcallen.length] = createMarker(new GPoint(-98.25525000,26.24517400),"
Covenant Christian Academy
4201 N Ware Road
Mcallen, TX 78504
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Covenant Christian Academy",'Mcallen=' + Mcallen.length); Edinburg[Edinburg.length] = createMarker(new GPoint(-98.18921300,26.25695800),"
The Discovery School
1711 W Alberta Road
Edinburg, TX 78539
Co-ed school, PK-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("The Discovery School",'Edinburg=' + Edinburg.length); Edinburg[Edinburg.length] = createMarker(new GPoint(-98.16296100,26.29623500),"
Edinburg Christian Learning Center
122 East Champion
Edinburg, TX 78539
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Edinburg Christian Learning Center",'Edinburg=' + Edinburg.length); Palmhurst[Palmhurst.length] = createMarker(new GPoint(-98.28028400,26.24435500),"
Faith Christian Academy
4301 N Shary Rd
Palmhurst, TX 78573
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Faith Christian Academy",'Palmhurst=' + Palmhurst.length); Pharr[Pharr.length] = createMarker(new GPoint(-98.19549300,26.19780800),"
Grace Christian School
132 N Sugar Road
Pharr, TX 78577
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Grace Christian School",'Pharr=' + Pharr.length); Mercedes[Mercedes.length] = createMarker(new GPoint(-97.92068000,26.14866300),"
Immanuel Lutheran School
703 W 3rd Street
Mercedes, TX 78570
Co-ed school, PK-2
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Immanuel Lutheran School",'Mercedes=' + Mercedes.length); Weslaco[Weslaco.length] = createMarker(new GPoint(-98.00685200,26.15805900),"
Mid Valley Christian School
417 S Westgate Drive
Weslaco, TX 78596
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Mid Valley Christian School",'Weslaco=' + Weslaco.length); Pharr[Pharr.length] = createMarker(new GPoint(-98.20470500,26.17573600),"
Oratory Schools
1407 W Moore Road
Pharr, TX 78577
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Oratory Schools",'Pharr=' + Pharr.length); Mcallen[Mcallen.length] = createMarker(new GPoint(-98.23029900,26.21006100),"
Our Lady Of Sorrows School
1100 Gumwood Avenue
Mcallen, TX 78501
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Our Lady Of Sorrows School",'Mcallen=' + Mcallen.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); Edinburg[Edinburg.length] = createMarker(new GPoint(-98.16504800,26.27884500),"
St. Matthew's Episcopal School
2620 Crestview Drive
Edinburg, TX 78539
Co-ed school, PK-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Matthew's Episcopal School",'Edinburg=' + Edinburg.length); Mcallen[Mcallen.length] = createMarker(new GPoint(-98.22096900,26.21691000),"
St. Paul Lutheran School-McAllen
300 West Pecan Blvd
Mcallen, TX 78501
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Paul Lutheran School-McAllen",'Mcallen=' + Mcallen.length); Weslaco[Weslaco.length] = createMarker(new GPoint(-97.99095200,26.16836800),"
San Martin De Porres Catholic School
905 N Texas Blvd
Weslaco, TX 78596
Co-ed school, 1-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("San Martin De Porres Catholic School",'Weslaco=' + Weslaco.length); Mcallen[Mcallen.length] = createMarker(new GPoint(-98.26287000,26.18761000),"
South Texas Christian Academy
7001 N Ware Road
Mcallen, TX 78504
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("South Texas Christian Academy",'Mcallen=' + Mcallen.length); Mcallen[Mcallen.length] = createMarker(new GPoint(-98.22607800,26.22583300),"
St Johns Episcopal Day School
2500 North 10th Street
Mcallen, TX 78501
Co-ed school, PK-5
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St Johns Episcopal Day School",'Mcallen=' + Mcallen.length); Edinburg[Edinburg.length] = createMarker(new GPoint(-98.16339400,26.29759100),"
St Joseph Catholic School
119 W Fay Street
Edinburg, TX 78539
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St Joseph Catholic School",'Edinburg=' + Edinburg.length); Mcallen[Mcallen.length] = createMarker(new GPoint(-98.24258900,26.19563200),"
Taylor Christian School
2021 W Jackson Avenue
Mcallen, TX 78501
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Taylor Christian School",'Mcallen=' + Mcallen.length); Alamo[Alamo.length] = createMarker(new GPoint(-98.12132400,26.19387100),"
Valley Christian Heritage School
932 North Alamo Road
Alamo, TX 78516
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Valley Christian Heritage School",'Alamo=' + Alamo.length); Weslaco[Weslaco.length] = createMarker(new GPoint(-97.98254200,26.14807000),"
Valley Grande Adventist Academy
1000 S Bridge Avenue
Weslaco, TX 78596
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Valley Grande Adventist Academy",'Weslaco=' + Weslaco.length); Weslaco[Weslaco.length] = createMarker(new GPoint(-97.99050000,26.15910000),"
Valley Grande Elementary School
Po Box 8205
Weslaco, TX 78599
Co-ed school, PK-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Valley Grande Elementary School",'Weslaco=' + Weslaco.length); Mission[Mission.length] = createMarker(new GPoint(-98.35442300,26.23407100),"
World Center Leadership Academy
2214 W Griffin Parkway
Mission, TX 78574
Co-ed school, PK-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("World Center Leadership Academy",'Mission=' + Mission.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(Alamo); map.removeOverlays(Edinburg); map.removeOverlays(Mcallen); map.removeOverlays(Mercedes); map.removeOverlays(Mission); map.removeOverlays(Palmhurst); map.removeOverlays(Pharr); map.removeOverlays(Weslaco); 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(Mission);map.removeOverlays(Alamo); map.removeOverlays(Edinburg); map.removeOverlays(Mcallen); map.removeOverlays(Mercedes); map.removeOverlays(Mission); map.removeOverlays(Palmhurst); map.removeOverlays(Pharr); map.removeOverlays(Weslaco); map.addOverlays(Alamo); centerByArray(Alamo, false, false); cntMarker += Alamo.length; map.addOverlays(Edinburg); centerByArray(Edinburg, false, false); cntMarker += Edinburg.length; map.addOverlays(Mcallen); centerByArray(Mcallen, false, false); cntMarker += Mcallen.length; map.addOverlays(Mercedes); centerByArray(Mercedes, false, false); cntMarker += Mercedes.length; map.addOverlays(Mission); centerByArray(Mission, false, false); cntMarker += Mission.length; map.addOverlays(Palmhurst); centerByArray(Palmhurst, false, false); cntMarker += Palmhurst.length; map.addOverlays(Pharr); centerByArray(Pharr, false, false); cntMarker += Pharr.length; map.addOverlays(Weslaco); centerByArray(Weslaco, false, false); cntMarker += Weslaco.length; centerByArray(Mission,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; }