function addMarkers() { mySelect = document.getElementById('selection'); Meridian = [];Meridain = [];Collinsville = [];mySelect.options[mySelect.options.length] = new Option("Collinsville schools",'all=Collinsville'); mySelect.options[mySelect.options.length] = new Option("Meridain schools",'all=Meridain'); mySelect.options[mySelect.options.length] = new Option("Meridian schools",'all=Meridian'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Meridian[Meridian.length] = createMarker(new GPoint(-88.70452118,32.36394119),"
Clarkdale Attendance Center
7000 Highway 145
Meridian, MS 39301

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Clarkdale Attendance Center",'Meridian=' + Meridian.length); Meridian[Meridian.length] = createMarker(new GPoint(-88.68803406,32.35342026),"
Crestwood Elementary School
730 Crestwood Dr.
Meridian, MS 39301

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Crestwood Elementary School",'Meridian=' + Meridian.length); Meridian[Meridian.length] = createMarker(new GPoint(-88.72184753,32.36561584),"
George Washington Carver Middle School
900 44th Avenue
Meridian, MS 39307

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("George Washington Carver Middle School",'Meridian=' + Meridian.length); Meridian[Meridian.length] = createMarker(new GPoint(-88.71765900,32.36864090),"
Harris Upper Elementary School
3951 12th St
Meridian, MS 39307

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Harris Upper Elementary School",'Meridian=' + Meridian.length); Meridian[Meridian.length] = createMarker(new GPoint(-88.70601654,32.36219788),"
Kate Griffin Junior High School
2814 Davis Street
Meridian, MS 39301

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Kate Griffin Junior High School",'Meridian=' + Meridian.length); Meridian[Meridian.length] = createMarker(new GPoint(-88.72270203,32.36560059),"
Magnolia Grove School
1401 College Drive
Meridian, MS 39304

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Magnolia Grove School",'Meridian=' + Meridian.length); Meridian[Meridian.length] = createMarker(new GPoint(-88.70257568,32.38526535),"
Magnolia Middle School
1350 24th Street
Meridian, MS 39305

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Magnolia Middle School",'Meridian=' + Meridian.length); Meridian[Meridian.length] = createMarker(new GPoint(-88.70130157,32.39074326),"
Meridian High School
2320 32nd Street
Meridian, MS 39305

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Meridian High School",'Meridian=' + Meridian.length); Meridian[Meridian.length] = createMarker(new GPoint(-88.67110443,32.42932129),"
Northeast Lauderdale Elementary School
6750 Newell Road
Meridian, MS 39305

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Northeast Lauderdale Elementary School",'Meridian=' + Meridian.length); Meridian[Meridian.length] = createMarker(new GPoint(-88.64544678,32.47188568),"
Northeast Lauderdale High School
702 Briarwood Road
Meridian, MS 39305

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Northeast Lauderdale High School",'Meridian=' + Meridian.length); Meridain[Meridain.length] = createMarker(new GPoint(-88.67124176,32.44895172),"
Northeast Middle School
7763 Highway 39 North
Meridain, MS 39305

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Northeast Middle School",'Meridain=' + Meridain.length); Meridian[Meridian.length] = createMarker(new GPoint(-88.72016907,32.38984680),"
Northwest Junior High School
4400 32nd Street
Meridian, MS 39307

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Northwest Junior High School",'Meridian=' + Meridian.length); Meridian[Meridian.length] = createMarker(new GPoint(-88.73805237,32.36103058),"
Oakland Heights Elementary School
601 59th Ave.
Meridian, MS 39307

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Oakland Heights Elementary School",'Meridian=' + Meridian.length); Meridian[Meridian.length] = createMarker(new GPoint(-88.69345093,32.38529205),"
Parkview Elementary School
1225 26th Street
Meridian, MS 39305

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Parkview Elementary School",'Meridian=' + Meridian.length); Meridian[Meridian.length] = createMarker(new GPoint(-88.70496368,32.40068054),"
Poplar Springs Elementary School
4101 27th Ave.
Meridian, MS 39305

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Poplar Springs Elementary School",'Meridian=' + Meridian.length); Meridian[Meridian.length] = createMarker(new GPoint(-88.71308700,32.37808200),"
Ross Collins Voc Center
P. O. Box 31
Meridian, MS 39302

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Ross Collins Voc Center",'Meridian=' + Meridian.length); Meridian[Meridian.length] = createMarker(new GPoint(-88.57283783,32.32603836),"
Southeast Attendance Center
2362 Longcreek Raod
Meridian, MS 39301

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Southeast Attendance Center",'Meridian=' + Meridian.length); Meridian[Meridian.length] = createMarker(new GPoint(-88.65299988,32.34009933),"
Southeast Elementary School
2362 Long Creek Road
Meridian, MS 39301

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Southeast Elementary School",'Meridian=' + Meridian.length); Meridian[Meridian.length] = createMarker(new GPoint(-88.56405640,32.33099365),"
Southeast Middle School
2535 Old Hihgway 19 S.e.
Meridian, MS 39301

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Southeast Middle School",'Meridian=' + Meridian.length); Meridian[Meridian.length] = createMarker(new GPoint(-88.71739960,32.37042236),"
West End Elementary School
3930 14th Street
Meridian, MS 39307

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("West End Elementary School",'Meridian=' + Meridian.length); Meridian[Meridian.length] = createMarker(new GPoint(-88.72293854,32.38986588),"
West Hills Elementary School
4100 32nd Street
Meridian, MS 39307

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("West Hills Elementary School",'Meridian=' + Meridian.length); Collinsville[Collinsville.length] = createMarker(new GPoint(-88.82145691,32.52567291),"
West Lauderdale Attendance Center
9916 West Lauderdale Road
Collinsville, MS 39325

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("West Lauderdale Attendance Center",'Collinsville=' + Collinsville.length); Meridian[Meridian.length] = createMarker(new GPoint(-88.77027893,32.54166412),"
West Lauderdale Elementary School
10350 Highway 495
Meridian, MS 39305

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("West Lauderdale Elementary School",'Meridian=' + Meridian.length); Meridian[Meridian.length] = createMarker(new GPoint(-88.69070435,32.37204361),"
Witherspoon Elementary School
1516 12th Ave.
Meridian, MS 39301

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Witherspoon Elementary School",'Meridian=' + Meridian.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,10); /* 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////' + showArray); map.removeOverlays(Collinsville); map.removeOverlays(Meridain); map.removeOverlays(Meridian); 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(Meridian);map.removeOverlays(Collinsville); map.removeOverlays(Meridain); map.removeOverlays(Meridian); map.addOverlays(Collinsville); centerByArray(Collinsville, false, false); cntMarker += Collinsville.length; map.addOverlays(Meridain); centerByArray(Meridain, false, false); cntMarker += Meridain.length; map.addOverlays(Meridian); centerByArray(Meridian, false, false); cntMarker += Meridian.length; centerByArray(Meridian,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'); } }