function addMarkers(){ mySelect = document.getElementById('selection'); League_City = [];Friendswood = [];Galveston = [];Texas_City = [];Hitchcock = [];Dickinson = [];mySelect.options[mySelect.options.length] = new Option("Dickinson schools",'all=Dickinson'); mySelect.options[mySelect.options.length] = new Option("Friendswood schools",'all=Friendswood'); mySelect.options[mySelect.options.length] = new Option("Galveston schools",'all=Galveston'); mySelect.options[mySelect.options.length] = new Option("Hitchcock schools",'all=Hitchcock'); mySelect.options[mySelect.options.length] = new Option("League City schools",'all=League_City'); mySelect.options[mySelect.options.length] = new Option("Texas City schools",'all=Texas_City'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); League_City[League_City.length] = createMarker(new GPoint(-95.14852100,29.49202200),"
Bay Area Christian School
4800 W Main Street
League City, TX 77573
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bay Area Christian School",'League_City=' + League_City.length); Friendswood[Friendswood.length] = createMarker(new GPoint(-95.19757600,29.52681100),"
Country Meadows Montessori School
607 S Friendswood Dr
Friendswood, TX 77546
Co-ed school, NS-PK
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Country Meadows Montessori School",'Friendswood=' + Friendswood.length); League_City[League_City.length] = createMarker(new GPoint(-95.10597300,29.50848600),"
Devereux School
1150 Devereux Drive
League City, TX 77573
Co-ed school, 5-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Devereux School",'League_City=' + League_City.length); Galveston[Galveston.length] = createMarker(new GPoint(-94.78872800,29.30472100),"
East End Preschool
1903 Church Street
Galveston, TX 77550
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("East End Preschool",'Galveston=' + Galveston.length); Friendswood[Friendswood.length] = createMarker(new GPoint(-95.20929400,29.53066900),"
Friendswood Children's House
304 W Edgewood Drive
Friendswood, TX 77546
Co-ed school, NS-PK
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Friendswood Children's House",'Friendswood=' + Friendswood.length); Friendswood[Friendswood.length] = createMarker(new GPoint(-95.19100000,29.52490000),"
Friendswood Montessori School
809 S. Frwd. Drive
Friendswood, TX 77546
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Friendswood Montessori School",'Friendswood=' + Friendswood.length); Friendswood[Friendswood.length] = createMarker(new GPoint(-95.18215200,29.50921300),"
Friendwoods Christian School
301 Leisure Lane
Friendswood, TX 77546
Co-ed school, PK-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Friendwoods Christian School",'Friendswood=' + Friendswood.length); Galveston[Galveston.length] = createMarker(new GPoint(-94.79771900,29.30513400),"
Galveston Catholic School
2601 Ursuline Street
Galveston, TX 77550
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Galveston Catholic School",'Galveston=' + Galveston.length); Friendswood[Friendswood.length] = createMarker(new GPoint(-95.19207800,29.51714700),"
Good Shepherd Episcopal School
1207 Winding Way Drive
Friendswood, TX 77546
Co-ed school, NS-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Good Shepherd Episcopal School",'Friendswood=' + Friendswood.length); Texas_City[Texas_City.length] = createMarker(new GPoint(-94.99590000,29.39500000),"
Mainland Christian School
3210 Ih 45 Fwy
Texas City, TX 77591
Co-ed school, K-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Mainland Christian School",'Texas_City=' + Texas_City.length); Galveston[Galveston.length] = createMarker(new GPoint(-94.79075200,29.29715200),"
Oconnell High School
1320 Tremont Street
Galveston, TX 77550
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Oconnell High School",'Galveston=' + Galveston.length); Texas_City[Texas_City.length] = createMarker(new GPoint(-94.91737500,29.39353700),"
Our Lady Of Fatima Catholic School
1600 9th Avenue N
Texas City, TX 77590
Co-ed school, PK-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Our Lady Of Fatima Catholic School",'Texas_City=' + Texas_City.length); Hitchcock[Hitchcock.length] = createMarker(new GPoint(-95.04943400,29.35914700),"
Our Lady Of Lourdes School
10114 Highway 6
Hitchcock, TX 77563
Co-ed school, PK-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Our Lady Of Lourdes School",'Hitchcock=' + Hitchcock.length); Dickinson[Dickinson.length] = createMarker(new GPoint(-95.07191100,29.45233100),"
Pine Drive Christian School
705 FM 517 E
Dickinson, TX 77539
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Pine Drive Christian School",'Dickinson=' + Dickinson.length); League_City[League_City.length] = createMarker(new GPoint(-95.07907600,29.51499400),"
St. Mary Catholic School
1612 E Walker Street
League City, TX 77573
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Mary Catholic School",'League_City=' + League_City.length); League_City[League_City.length] = createMarker(new GPoint(-95.04770300,29.52620700),"
South Shore Montessori School
201 South Shore Boulevard
League City, TX 77573
Co-ed school, PK-5
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("South Shore Montessori School",'League_City=' + League_City.length); League_City[League_City.length] = createMarker(new GPoint(-95.08027600,29.51598700),"
Southshore Christian Academy
400 Vance St
League City, TX 77573
Co-ed school, KG-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Southshore Christian Academy",'League_City=' + League_City.length); Texas_City[Texas_City.length] = createMarker(new GPoint(-94.93707400,29.40571300),"
Trinity Baptist Christian School
2220 29th St. N.
Texas City, TX 77590
Co-ed school, 1-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Trinity Baptist Christian School",'Texas_City=' + Texas_City.length); Galveston[Galveston.length] = createMarker(new GPoint(-94.79266100,29.30257800),"
Trinity Episcopal School
720 Tremont Street
Galveston, TX 77550
Co-ed school, 5-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Trinity Episcopal School",'Galveston=' + Galveston.length); Dickinson[Dickinson.length] = createMarker(new GPoint(-95.07429200,29.45029800),"
True Cross School
400 Fm 517 Road E
Dickinson, TX 77539
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("True Cross School",'Dickinson=' + Dickinson.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/////3/' + showArray); map.removeOverlays(Dickinson); map.removeOverlays(Friendswood); map.removeOverlays(Galveston); map.removeOverlays(Hitchcock); map.removeOverlays(League_City); map.removeOverlays(Texas_City); 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(League_City);map.removeOverlays(Dickinson); map.removeOverlays(Friendswood); map.removeOverlays(Galveston); map.removeOverlays(Hitchcock); map.removeOverlays(League_City); map.removeOverlays(Texas_City); map.addOverlays(Dickinson); centerByArray(Dickinson, false, false); cntMarker += Dickinson.length; map.addOverlays(Friendswood); centerByArray(Friendswood, false, false); cntMarker += Friendswood.length; map.addOverlays(Galveston); centerByArray(Galveston, false, false); cntMarker += Galveston.length; map.addOverlays(Hitchcock); centerByArray(Hitchcock, false, false); cntMarker += Hitchcock.length; map.addOverlays(League_City); centerByArray(League_City, false, false); cntMarker += League_City.length; map.addOverlays(Texas_City); centerByArray(Texas_City, false, false); cntMarker += Texas_City.length; centerByArray(League_City,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=3&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; }