function addMarkers() { mySelect = document.getElementById('selection'); Crystal_River = [];Lecanto = [];Inverness = [];Citrus_Springs = [];Floral_City = [];Hernando = [];Homosassa = [];mySelect.options[mySelect.options.length] = new Option("Citrus Springs schools",'all=Citrus_Springs'); mySelect.options[mySelect.options.length] = new Option("Crystal River schools",'all=Crystal_River'); mySelect.options[mySelect.options.length] = new Option("Floral City schools",'all=Floral_City'); mySelect.options[mySelect.options.length] = new Option("Hernando schools",'all=Hernando'); mySelect.options[mySelect.options.length] = new Option("Homosassa schools",'all=Homosassa'); mySelect.options[mySelect.options.length] = new Option("Inverness schools",'all=Inverness'); mySelect.options[mySelect.options.length] = new Option("Lecanto schools",'all=Lecanto'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Crystal_River[Crystal_River.length] = createMarker(new GPoint(-82.65081787,28.90307045),"
Academy Of Environ. Sciences
12695 W Fort Island Trail
Crystal River, FL 34429

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Academy Of Environ. Sciences",'Crystal_River=' + Crystal_River.length); Lecanto[Lecanto.length] = createMarker(new GPoint(-82.47926331,28.90502930),"
Brown Schools Of Florida (inactiv
2804 W Marc Knighton Ct
Lecanto, FL 34461

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Brown Schools Of Florida (inactiv",'Lecanto=' + Lecanto.length); Inverness[Inverness.length] = createMarker(new GPoint(-82.34459686,28.83559418),"
Citrus County Renaissance Center
221 S Montgomery Avenue
Inverness, FL 34452

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Citrus County Renaissance Center",'Inverness=' + Inverness.length); Inverness[Inverness.length] = createMarker(new GPoint(-82.33114900,28.83546400),"
Citrus County Superintendent's Office
11007 W Main Street
Inverness, FL 34450

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Citrus County Superintendent's Office",'Inverness=' + Inverness.length); Inverness[Inverness.length] = createMarker(new GPoint(-82.33652496,28.83223534),"
Citrus High School
600 W Highland Boulevard
Inverness, FL 34452

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Citrus High School",'Inverness=' + Inverness.length); Citrus_Springs[Citrus_Springs.length] = createMarker(new GPoint(-82.49555206,28.98140526),"
Citrus Springs Elementary School
3570 W Century Boulevard
Citrus Springs, FL 34430

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Citrus Springs Elementary School",'Citrus_Springs=' + Citrus_Springs.length); Citrus_Springs[Citrus_Springs.length] = createMarker(new GPoint(-82.45748901,28.97091103),"
Citrus Springs Middle School
150 W Citrus Springs Boul
Citrus Springs, FL 34434

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Citrus Springs Middle School",'Citrus_Springs=' + Citrus_Springs.length); Lecanto[Lecanto.length] = createMarker(new GPoint(-82.49671936,28.82650375),"
Crest School
2600 S Panther Pride Dr.
Lecanto, FL 34461

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Crest School",'Lecanto=' + Lecanto.length); Crystal_River[Crystal_River.length] = createMarker(new GPoint(-82.58065796,28.90631676),"
Crystal River High School
1205 Ne 8th Avenue
Crystal River, FL 34428

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Crystal River High School",'Crystal_River=' + Crystal_River.length); Crystal_River[Crystal_River.length] = createMarker(new GPoint(-82.58843994,28.90253830),"
Crystal River Middle School
344 Ne Crystal Street
Crystal River, FL 34428

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Crystal River Middle School",'Crystal_River=' + Crystal_River.length); Crystal_River[Crystal_River.length] = createMarker(new GPoint(-82.57775116,28.89990616),"
Crystal River Primary School
947 Ne 6th Street
Crystal River, FL 34428

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Crystal River Primary School",'Crystal_River=' + Crystal_River.length); Lecanto[Lecanto.length] = createMarker(new GPoint(-82.48764801,28.83706093),"
Cypress Creek Academy
2855 W. Woodland Ridge Dr
Lecanto, FL 34461

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Cypress Creek Academy",'Lecanto=' + Lecanto.length); Floral_City[Floral_City.length] = createMarker(new GPoint(-82.29239655,28.73769951),"
Floral City Elementary School
P O Box 340
Floral City, FL 34436

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Floral City Elementary School",'Floral_City=' + Floral_City.length); Hernando[Hernando.length] = createMarker(new GPoint(-82.44435120,28.90660095),"
Forest Ridge Elementary School
2927 N Forest Ridge Boule
Hernando, FL 34442

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Forest Ridge Elementary School",'Hernando=' + Hernando.length); Hernando[Hernando.length] = createMarker(new GPoint(-82.38591003,28.89738655),"
Hernando Elementary School
2353 N Croft Avenue
Hernando, FL 34442

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Hernando Elementary School",'Hernando=' + Hernando.length); Homosassa[Homosassa.length] = createMarker(new GPoint(-82.61519623,28.78109932),"
Homosassa Elementary School
P. O. Box 498
Homosassa, FL 34448

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Homosassa Elementary School",'Homosassa=' + Homosassa.length); Crystal_River[Crystal_River.length] = createMarker(new GPoint(-82.59283447,28.89843941),"
Horizon Educational Center
16 Ne 5th Street
Crystal River, FL 34429

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Horizon Educational Center",'Crystal_River=' + Crystal_River.length); Inverness[Inverness.length] = createMarker(new GPoint(-82.34442139,28.85061646),"
Inverness Middle School
1950 Highway 41 N
Inverness, FL 34450

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Inverness Middle School",'Inverness=' + Inverness.length); Inverness[Inverness.length] = createMarker(new GPoint(-82.33660126,28.83389473),"
Inverness Primary School
206 S Line Avenue
Inverness, FL 34452

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Inverness Primary School",'Inverness=' + Inverness.length); Lecanto[Lecanto.length] = createMarker(new GPoint(-82.49645996,28.82632446),"
Lecanto High School
3810 W Educational Path
Lecanto, FL 34461

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Lecanto High School",'Lecanto=' + Lecanto.length); Lecanto[Lecanto.length] = createMarker(new GPoint(-82.49571991,28.81980324),"
Lecanto Middle School
3800 W Educational Path
Lecanto, FL 34461

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Lecanto Middle School",'Lecanto=' + Lecanto.length); Lecanto[Lecanto.length] = createMarker(new GPoint(-82.49550629,28.81980896),"
Lecanto Primary School
3790 W Educational Path
Lecanto, FL 34461

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Lecanto Primary School",'Lecanto=' + Lecanto.length); Crystal_River[Crystal_River.length] = createMarker(new GPoint(-82.63532300,28.90008400),"
Marine Science Station
12646 W Fort Island Tr.
Crystal River, FL 34429

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Marine Science Station",'Crystal_River=' + Crystal_River.length); Inverness[Inverness.length] = createMarker(new GPoint(-82.35272217,28.82525635),"
Pleasant Grove Elementary School
630 Pleasant Grove Road
Inverness, FL 34452

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Pleasant Grove Elementary School",'Inverness=' + Inverness.length); Homosassa[Homosassa.length] = createMarker(new GPoint(-82.53114319,28.84342384),"
Rock Crusher Elementary School
814 S Rock Crusher Road
Homosassa, FL 34448

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Rock Crusher Elementary School",'Homosassa=' + Homosassa.length); Inverness[Inverness.length] = createMarker(new GPoint(-82.34459686,28.83585358),"
Withlachoochee Technical Insti High School
1201 W Main Street
Inverness, FL 34450

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Withlachoochee Technical Insti High School",'Inverness=' + Inverness.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(Citrus_Springs); map.removeOverlays(Crystal_River); map.removeOverlays(Floral_City); map.removeOverlays(Hernando); map.removeOverlays(Homosassa); map.removeOverlays(Inverness); map.removeOverlays(Lecanto); 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(Crystal_River);map.removeOverlays(Citrus_Springs); map.removeOverlays(Crystal_River); map.removeOverlays(Floral_City); map.removeOverlays(Hernando); map.removeOverlays(Homosassa); map.removeOverlays(Inverness); map.removeOverlays(Lecanto); map.addOverlays(Citrus_Springs); centerByArray(Citrus_Springs, false, false); cntMarker += Citrus_Springs.length; map.addOverlays(Crystal_River); centerByArray(Crystal_River, false, false); cntMarker += Crystal_River.length; map.addOverlays(Floral_City); centerByArray(Floral_City, false, false); cntMarker += Floral_City.length; map.addOverlays(Hernando); centerByArray(Hernando, false, false); cntMarker += Hernando.length; map.addOverlays(Homosassa); centerByArray(Homosassa, false, false); cntMarker += Homosassa.length; map.addOverlays(Inverness); centerByArray(Inverness, false, false); cntMarker += Inverness.length; map.addOverlays(Lecanto); centerByArray(Lecanto, false, false); cntMarker += Lecanto.length; centerByArray(Crystal_River,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'); } }