function addMarkers() { mySelect = document.getElementById('selection'); Ridgeland = [];Canton = [];Flora = [];Madison = [];Camden = [];mySelect.options[mySelect.options.length] = new Option("Camden schools",'all=Camden'); mySelect.options[mySelect.options.length] = new Option("Canton schools",'all=Canton'); mySelect.options[mySelect.options.length] = new Option("Flora schools",'all=Flora'); mySelect.options[mySelect.options.length] = new Option("Madison schools",'all=Madison'); mySelect.options[mySelect.options.length] = new Option("Ridgeland schools",'all=Ridgeland'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Ridgeland[Ridgeland.length] = createMarker(new GPoint(-90.12344360,32.42105484),"
Ann Smith Elementary School
306 Pear Orchard Road
Ridgeland, MS 39158

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Ann Smith Elementary School",'Ridgeland=' + Ridgeland.length); Canton[Canton.length] = createMarker(new GPoint(-90.03611000,32.61975100),"
Canton Career Center
487 North Union Extension
Canton, MS 39046

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Canton Career Center",'Canton=' + Canton.length); Canton[Canton.length] = createMarker(new GPoint(-90.01706696,32.60996628),"
Canton Elementary School
740 East Academy Street
Canton, MS 39046

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Canton Elementary School",'Canton=' + Canton.length); Canton[Canton.length] = createMarker(new GPoint(-90.00333405,32.63333511),"
Canton Public High School
634 Finney Road
Canton, MS 39046

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Canton Public High School",'Canton=' + Canton.length); Flora[Flora.length] = createMarker(new GPoint(-90.30548096,32.54586029),"
East Flora Elementary School
4759 Hwy 22 East
Flora, MS 39071

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("East Flora Elementary School",'Flora=' + Flora.length); Flora[Flora.length] = createMarker(new GPoint(-90.28701782,32.54595947),"
East Flora Middle School
4759 Highway 22 E
Flora, MS 39071

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("East Flora Middle School",'Flora=' + Flora.length); Ridgeland[Ridgeland.length] = createMarker(new GPoint(-90.15169525,32.41955948),"
Highland Elementary School
330 Brame Road
Ridgeland, MS 39157

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Highland Elementary School",'Ridgeland=' + Ridgeland.length); Canton[Canton.length] = createMarker(new GPoint(-89.81723022,32.66732407),"
Luther Branson School
3903 Highway 16 E
Canton, MS 39046

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Luther Branson School",'Canton=' + Canton.length); Madison[Madison.length] = createMarker(new GPoint(-90.08919525,32.45735931),"
Madison Avenue Lower Elementary School
1199 Madison Avenue
Madison, MS 39110

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Madison Avenue Lower Elementary School",'Madison=' + Madison.length); Madison[Madison.length] = createMarker(new GPoint(-90.09883881,32.45748520),"
Madison Avenue Upper Elementary School
1209 Madison Avenue
Madison, MS 39110

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Madison Avenue Upper Elementary School",'Madison=' + Madison.length); Madison[Madison.length] = createMarker(new GPoint(-90.15341949,32.46825790),"
Madison Central High School
1417 Highland Colony Parkway
Madison, MS 39110

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Madison Central High School",'Madison=' + Madison.length); Canton[Canton.length] = createMarker(new GPoint(-90.07315600,32.60461200),"
Madison Co Voc Complex
1633 W Peace Street
Canton, MS 39046

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Madison Co Voc Complex",'Canton=' + Canton.length); Madison[Madison.length] = createMarker(new GPoint(-90.12376404,32.46586227),"
Madison Middle School
1365 Mannsdale Road
Madison, MS 39110

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Madison Middle School",'Madison=' + Madison.length); Madison[Madison.length] = createMarker(new GPoint(-90.12360382,32.46556091),"
Madison Station Elementary School
311 Bozeman Road
Madison, MS 39110

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Madison Station Elementary School",'Madison=' + Madison.length); Canton[Canton.length] = createMarker(new GPoint(-90.03388977,32.62393570),"
Mc Neal Elementary School
364 Martin Luther King Drive
Canton, MS 39046

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Mc Neal Elementary School",'Canton=' + Canton.length); Canton[Canton.length] = createMarker(new GPoint(-90.04875946,32.62007523),"
Nichols Middle School
529 North Mace Street
Canton, MS 39046

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Nichols Middle School",'Canton=' + Canton.length); Canton[Canton.length] = createMarker(new GPoint(-89.81845856,32.70965958),"
Northeast Madison Middle School
820 Sulphur Springs Road
Canton, MS 39046

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Northeast Madison Middle School",'Canton=' + Canton.length); Ridgeland[Ridgeland.length] = createMarker(new GPoint(-90.14064789,32.43222046),"
Olde Towne Middle School
210 Sunnybrook Road
Ridgeland, MS 39158

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Olde Towne Middle School",'Ridgeland=' + Ridgeland.length); Ridgeland[Ridgeland.length] = createMarker(new GPoint(-90.13880157,32.42039871),"
Ridgeland High School
586 Sunnybrook Road
Ridgeland, MS 39157

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Ridgeland High School",'Ridgeland=' + Ridgeland.length); Madison[Madison.length] = createMarker(new GPoint(-90.12360382,32.46556091),"
Rosa Scott Middle School
200 Crawford Street
Madison, MS 39130

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Rosa Scott Middle School",'Madison=' + Madison.length); Madison[Madison.length] = createMarker(new GPoint(-90.12359000,32.46571800),"
Rosa Scott School
200 Crawford Street
Madison, MS 39110

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Rosa Scott School",'Madison=' + Madison.length); Camden[Camden.length] = createMarker(new GPoint(-89.83999634,32.79119873),"
Velma Jackson Elementary School
P.o. Box 130
Camden, MS 39045

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Velma Jackson Elementary School",'Camden=' + Camden.length); Camden[Camden.length] = createMarker(new GPoint(-89.86633301,32.77473068),"
Velma Jackson High School
2000 Loring Road
Camden, MS 39045

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Velma Jackson High School",'Camden=' + Camden.length); Camden[Camden.length] = createMarker(new GPoint(-89.86633301,32.77473068),"
Velma Jackson Middle School
2000 Loring Road
Camden, MS 39045

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Velma Jackson Middle School",'Camden=' + Camden.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(Camden); map.removeOverlays(Canton); map.removeOverlays(Flora); map.removeOverlays(Madison); map.removeOverlays(Ridgeland); 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(Ridgeland);map.removeOverlays(Camden); map.removeOverlays(Canton); map.removeOverlays(Flora); map.removeOverlays(Madison); map.removeOverlays(Ridgeland); map.addOverlays(Camden); centerByArray(Camden, false, false); cntMarker += Camden.length; map.addOverlays(Canton); centerByArray(Canton, false, false); cntMarker += Canton.length; map.addOverlays(Flora); centerByArray(Flora, false, false); cntMarker += Flora.length; map.addOverlays(Madison); centerByArray(Madison, false, false); cntMarker += Madison.length; map.addOverlays(Ridgeland); centerByArray(Ridgeland, false, false); cntMarker += Ridgeland.length; centerByArray(Ridgeland,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'); } }