function addMarkers(){ mySelect = document.getElementById('selection'); Lake_Jackson = [];Pearland = [];West_Columbia = [];Angleton = [];Alvin = [];Clute = [];Monaville = [];Sweeny = [];mySelect.options[mySelect.options.length] = new Option("Alvin schools",'all=Alvin'); mySelect.options[mySelect.options.length] = new Option("Angleton schools",'all=Angleton'); mySelect.options[mySelect.options.length] = new Option("Clute schools",'all=Clute'); mySelect.options[mySelect.options.length] = new Option("Lake Jackson schools",'all=Lake_Jackson'); mySelect.options[mySelect.options.length] = new Option("Monaville schools",'all=Monaville'); mySelect.options[mySelect.options.length] = new Option("Pearland schools",'all=Pearland'); mySelect.options[mySelect.options.length] = new Option("Sweeny schools",'all=Sweeny'); mySelect.options[mySelect.options.length] = new Option("West Columbia schools",'all=West_Columbia'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Lake_Jackson[Lake_Jackson.length] = createMarker(new GPoint(-95.42764200,29.04483700),"
Brazosport Christian School
200b Willow Drive
Lake Jackson, TX 77566
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Brazosport Christian School",'Lake_Jackson=' + Lake_Jackson.length); Pearland[Pearland.length] = createMarker(new GPoint(-95.26078800,29.54710300),"
Carden-jackson School
3801 Liberty Drive
Pearland, TX 77581
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Carden-jackson School",'Pearland=' + Pearland.length); West_Columbia[West_Columbia.length] = createMarker(new GPoint(-95.65265000,29.14563800),"
Columbia Christian School
725 West Brazos Ave
West Columbia, TX 77486
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Columbia Christian School",'West_Columbia=' + West_Columbia.length); Pearland[Pearland.length] = createMarker(new GPoint(-95.26769700,29.55148800),"
Eagle Heights Christian Academy
3005 Pearland Parkway
Pearland, TX 77581
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Eagle Heights Christian Academy",'Pearland=' + Pearland.length); Angleton[Angleton.length] = createMarker(new GPoint(-95.43160000,29.16910000),"
Holy Comforter Episcopal School
P.o. Box 786
Angleton, TX 77515
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Holy Comforter Episcopal School",'Angleton=' + Angleton.length); Alvin[Alvin.length] = createMarker(new GPoint(-95.23097100,29.45232200),"
Living Stones Christian School
1407 Victory Lane
Alvin, TX 77511
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Living Stones Christian School",'Alvin=' + Alvin.length); Pearland[Pearland.length] = createMarker(new GPoint(-95.28371600,29.56878000),"
Montessori School Of Dt
2121 Grand Blvd
Pearland, TX 77581
Co-ed school, PK-1
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Montessori School Of Dt",'Pearland=' + Pearland.length); Clute[Clute.length] = createMarker(new GPoint(-95.41921400,29.06669400),"
Our Lady Queen Of Peace Cathol
1600 Highway 2004
Clute, TX 77531
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Our Lady Queen Of Peace Cathol",'Clute=' + Clute.length); Monaville[Monaville.length] = createMarker(new GPoint(-96.04004400,29.95064000),"
Pearland Heritage Christian Academy
Po Box 848
Monaville, TX 77445
Co-ed school, K-7
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Pearland Heritage Christian Academy",'Monaville=' + Monaville.length); Pearland[Pearland.length] = createMarker(new GPoint(-95.27724100,29.56723100),"
St. Helen Catholic School
2213 Old Alvin Road
Pearland, TX 77581
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Helen Catholic School",'Pearland=' + Pearland.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); } // 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(Alvin); map.removeOverlays(Angleton); map.removeOverlays(Clute); map.removeOverlays(Lake_Jackson); map.removeOverlays(Monaville); map.removeOverlays(Pearland); map.removeOverlays(Sweeny); map.removeOverlays(West_Columbia); 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(Lake_Jackson);map.removeOverlays(Alvin); map.removeOverlays(Angleton); map.removeOverlays(Clute); map.removeOverlays(Lake_Jackson); map.removeOverlays(Monaville); map.removeOverlays(Pearland); map.removeOverlays(Sweeny); map.removeOverlays(West_Columbia); map.addOverlays(Alvin); centerByArray(Alvin, false, false); cntMarker += Alvin.length; map.addOverlays(Angleton); centerByArray(Angleton, false, false); cntMarker += Angleton.length; map.addOverlays(Clute); centerByArray(Clute, false, false); cntMarker += Clute.length; map.addOverlays(Lake_Jackson); centerByArray(Lake_Jackson, false, false); cntMarker += Lake_Jackson.length; map.addOverlays(Monaville); centerByArray(Monaville, false, false); cntMarker += Monaville.length; map.addOverlays(Pearland); centerByArray(Pearland, false, false); cntMarker += Pearland.length; map.addOverlays(Sweeny); centerByArray(Sweeny, false, false); cntMarker += Sweeny.length; map.addOverlays(West_Columbia); centerByArray(West_Columbia, false, false); cntMarker += West_Columbia.length; centerByArray(Lake_Jackson,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; }