function addMarkers() { mySelect = document.getElementById('selection'); Bushnell = [];Lake_Panasoffkee = [];Wildwood = [];Webster = [];The_Villages = [];mySelect.options[mySelect.options.length] = new Option("Bushnell schools",'all=Bushnell'); mySelect.options[mySelect.options.length] = new Option("Lake Panasoffkee schools",'all=Lake_Panasoffkee'); mySelect.options[mySelect.options.length] = new Option("The Villages schools",'all=The_Villages'); mySelect.options[mySelect.options.length] = new Option("Webster schools",'all=Webster'); mySelect.options[mySelect.options.length] = new Option("Wildwood schools",'all=Wildwood'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Bushnell[Bushnell.length] = createMarker(new GPoint(-82.05545807,28.65010071),"
Acs Alternative School
P O Box 2021
Bushnell, FL 33513

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Acs Alternative School",'Bushnell=' + Bushnell.length); Bushnell[Bushnell.length] = createMarker(new GPoint(-82.11523437,28.66283607),"
Bushnell Elementary School
218 W Flannery Avenue
Bushnell, FL 33513

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Bushnell Elementary School",'Bushnell=' + Bushnell.length); Lake_Panasoffkee[Lake_Panasoffkee.length] = createMarker(new GPoint(-82.09757996,28.75679016),"
Lake Panasoffkee Elementary School
790 Cr 482 North
Lake Panasoffkee, FL 33538

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Lake Panasoffkee Elementary School",'Lake_Panasoffkee=' + Lake_Panasoffkee.length); Wildwood[Wildwood.length] = createMarker(new GPoint(-82.04124451,28.85816383),"
North Sumter Intermediate
300 Huey Street
Wildwood, FL 34785

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("North Sumter Intermediate",'Wildwood=' + Wildwood.length); Wildwood[Wildwood.length] = createMarker(new GPoint(-82.03475189,28.86009026),"
North Sumter Primary School
104 N Warfield Avenue
Wildwood, FL 34785

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("North Sumter Primary School",'Wildwood=' + Wildwood.length); Bushnell[Bushnell.length] = createMarker(new GPoint(-82.11202240,28.67108345),"
South Sumter High School
706 N Main Street
Bushnell, FL 33513

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("South Sumter High School",'Bushnell=' + Bushnell.length); Webster[Webster.length] = createMarker(new GPoint(-82.06379700,28.62106323),"
South Sumter Middle School
773 Nw 10th Avenue
Webster, FL 33597

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("South Sumter Middle School",'Webster=' + Webster.length); Bushnell[Bushnell.length] = createMarker(new GPoint(-10.00000000,10.00000000),"
Sumter Migrant School
2680 Wc 476
Bushnell, FL 33513

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Sumter Migrant School",'Bushnell=' + Bushnell.length); The_Villages[The_Villages.length] = createMarker(new GPoint(-81.99970245,28.94140053),"
Village Charter Middle School
450 Village Campus Circle
The Villages, FL 32159

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Village Charter Middle School",'The_Villages=' + The_Villages.length); The_Villages[The_Villages.length] = createMarker(new GPoint(-81.99970245,28.94140053),"
Villages Charter Elementary School
521 Old School Road
The Villages, FL 32162

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Villages Charter Elementary School",'The_Villages=' + The_Villages.length); The_Villages[The_Villages.length] = createMarker(new GPoint(-81.99970245,28.94140053),"
Villages Charter Elementary School
521 Old School Road
The Villages, FL 32159

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Villages Charter Elementary School",'The_Villages=' + The_Villages.length); The_Villages[The_Villages.length] = createMarker(new GPoint(-82.00579834,28.95770073),"
Villages Charter High School
251 Buffalo Trail
The Villages, FL 32162

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Villages Charter High School",'The_Villages=' + The_Villages.length); The_Villages[The_Villages.length] = createMarker(new GPoint(-81.99970245,28.94140053),"
Villages Charter Middle School
450 Village Campus Circle
The Villages, FL 32162

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Villages Charter Middle School",'The_Villages=' + The_Villages.length); Webster[Webster.length] = createMarker(new GPoint(-82.05454254,28.60646057),"
Webster Elementary School
349 S Market Boulevard
Webster, FL 33597

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Webster Elementary School",'Webster=' + Webster.length); Bushnell[Bushnell.length] = createMarker(new GPoint(-82.12107849,28.67566681),"
West Street School
709 N West Street
Bushnell, FL 33513

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("West Street School",'Bushnell=' + Bushnell.length); Wildwood[Wildwood.length] = createMarker(new GPoint(-82.03541565,28.85833740),"
Wildwood High School
700 Huey Street
Wildwood, FL 34785

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Wildwood High School",'Wildwood=' + Wildwood.length); Wildwood[Wildwood.length] = createMarker(new GPoint(-82.03774261,28.86536217),"
Wildwood Middle School
200 Cleveland Avenue
Wildwood, FL 34785

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Wildwood Middle School",'Wildwood=' + Wildwood.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(Bushnell); map.removeOverlays(Lake_Panasoffkee); map.removeOverlays(The_Villages); map.removeOverlays(Webster); map.removeOverlays(Wildwood); 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(Bushnell);map.removeOverlays(Bushnell); map.removeOverlays(Lake_Panasoffkee); map.removeOverlays(The_Villages); map.removeOverlays(Webster); map.removeOverlays(Wildwood); map.addOverlays(Bushnell); centerByArray(Bushnell, false, false); cntMarker += Bushnell.length; map.addOverlays(Lake_Panasoffkee); centerByArray(Lake_Panasoffkee, false, false); cntMarker += Lake_Panasoffkee.length; map.addOverlays(The_Villages); centerByArray(The_Villages, false, false); cntMarker += The_Villages.length; map.addOverlays(Webster); centerByArray(Webster, false, false); cntMarker += Webster.length; map.addOverlays(Wildwood); centerByArray(Wildwood, false, false); cntMarker += Wildwood.length; centerByArray(Bushnell,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'); } }