function addMarkers(){ mySelect = document.getElementById('selection'); Merced = [];Atwater = [];Los_Banos = [];Le_Grand = [];Winton = [];Turlock = [];Livingston = [];Planada = [];mySelect.options[mySelect.options.length] = new Option("Atwater schools",'all=Atwater'); mySelect.options[mySelect.options.length] = new Option("Le Grand schools",'all=Le_Grand'); mySelect.options[mySelect.options.length] = new Option("Livingston schools",'all=Livingston'); mySelect.options[mySelect.options.length] = new Option("Los Banos schools",'all=Los_Banos'); mySelect.options[mySelect.options.length] = new Option("Merced schools",'all=Merced'); mySelect.options[mySelect.options.length] = new Option("Planada schools",'all=Planada'); mySelect.options[mySelect.options.length] = new Option("Turlock schools",'all=Turlock'); mySelect.options[mySelect.options.length] = new Option("Winton schools",'all=Winton'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Merced[Merced.length] = createMarker(new GPoint(-120.43880600,37.29523700),"
Acts Christian School
2745 E Hwy 140
Merced, CA 95340
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Acts Christian School",'Merced=' + Merced.length); Atwater[Atwater.length] = createMarker(new GPoint(-120.59746000,37.34250100),"
Ariel Dear Academy
250 Broadway
Atwater, CA 95301
Co-ed school, 2-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Ariel Dear Academy",'Atwater=' + Atwater.length); Los_Banos[Los_Banos.length] = createMarker(new GPoint(-120.83917100,37.07036500),"
Cornerstone Christian Academy
221 N Santa Clara Street
Los Banos, CA 93635
Co-ed school, 1-11
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Cornerstone Christian Academy",'Los_Banos=' + Los_Banos.length); Merced[Merced.length] = createMarker(new GPoint(-120.52816700,37.33010000),"
Gospel Defenders Christian Academy
2909 Beachwood Drive
Merced, CA 95348
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Gospel Defenders Christian Academy",'Merced=' + Merced.length); Le_Grand[Le_Grand.length] = createMarker(new GPoint(-120.30687100,37.28149500),"
Grace Christian School
511 Ivett Rd.
Le Grand, CA 95333
Co-ed school, 1-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Grace Christian School",'Le_Grand=' + Le_Grand.length); Winton[Winton.length] = createMarker(new GPoint(-120.61310000,37.39740000),"
Grace Mennonite School
Po Box 1149 7200 W Central Avenue
Winton, CA 95388
Co-ed school, 1-10
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Grace Mennonite School",'Winton=' + Winton.length); Merced[Merced.length] = createMarker(new GPoint(-120.48040000,37.30200000),"
Harvest Christian School
Po Box 861
Merced, CA 95341
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Harvest Christian School",'Merced=' + Merced.length); Turlock[Turlock.length] = createMarker(new GPoint(-120.84910400,37.51870100),"
Joseph Novack Academy
2855 Geer Road
Turlock, CA 95382
Co-ed school, 3-11
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Joseph Novack Academy",'Turlock=' + Turlock.length); Atwater[Atwater.length] = createMarker(new GPoint(-120.59955200,37.34783800),"
Landmark Christian School
Po Box 81 1925 Olive Avenue
Atwater, CA 95301
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Landmark Christian School",'Atwater=' + Atwater.length); Livingston[Livingston.length] = createMarker(new GPoint(-120.71873300,37.35325100),"
Longview Mennonite School
12725 Longview Avenue
Livingston, CA 95334
Co-ed school, 1-10
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Longview Mennonite School",'Livingston=' + Livingston.length); Merced[Merced.length] = createMarker(new GPoint(-120.46896300,37.32340400),"
Merced Christian School
3312 G Street
Merced, CA 95340
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Merced Christian School",'Merced=' + Merced.length); Planada[Planada.length] = createMarker(new GPoint(-120.31240000,37.35850000),"
Planada Christian Academy
9182 E Stanford Po Box 1047
Planada, CA 95365
Co-ed school, 1-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Planada Christian Academy",'Planada=' + Planada.length); Merced[Merced.length] = createMarker(new GPoint(-120.47589300,37.32718100),"
Stone Ridge Christian High School
500 Buena Vista Drive
Merced, CA 95348
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Stone Ridge Christian High School",'Merced=' + Merced.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/////2/' + showArray); map.removeOverlays(Atwater); map.removeOverlays(Le_Grand); map.removeOverlays(Livingston); map.removeOverlays(Los_Banos); map.removeOverlays(Merced); map.removeOverlays(Planada); map.removeOverlays(Turlock); map.removeOverlays(Winton); 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(Merced);map.removeOverlays(Atwater); map.removeOverlays(Le_Grand); map.removeOverlays(Livingston); map.removeOverlays(Los_Banos); map.removeOverlays(Merced); map.removeOverlays(Planada); map.removeOverlays(Turlock); map.removeOverlays(Winton); map.addOverlays(Atwater); centerByArray(Atwater, false, false); cntMarker += Atwater.length; map.addOverlays(Le_Grand); centerByArray(Le_Grand, false, false); cntMarker += Le_Grand.length; map.addOverlays(Livingston); centerByArray(Livingston, false, false); cntMarker += Livingston.length; map.addOverlays(Los_Banos); centerByArray(Los_Banos, false, false); cntMarker += Los_Banos.length; map.addOverlays(Merced); centerByArray(Merced, false, false); cntMarker += Merced.length; map.addOverlays(Planada); centerByArray(Planada, false, false); cntMarker += Planada.length; map.addOverlays(Turlock); centerByArray(Turlock, false, false); cntMarker += Turlock.length; map.addOverlays(Winton); centerByArray(Winton, false, false); cntMarker += Winton.length; centerByArray(Merced,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=2&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; }