function addMarkers() { mySelect = document.getElementById('selection'); Cape_Coral = [];Cape_Coral[Cape_Coral.length] = createMarker(new GPoint(-81.94105530,26.64014244),"
Caloosa Elementary School
620 S Del Prado Boulevard
Cape Coral, FL 33990

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Caloosa Elementary School",'Cape_Coral=' + Cape_Coral.length); Cape_Coral[Cape_Coral.length] = createMarker(new GPoint(-81.94105530,26.64028549),"
Caloosa Middle School
610 S Del Prado Boulevard
Cape Coral, FL 33990

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Caloosa Middle School",'Cape_Coral=' + Cape_Coral.length); Cape_Coral[Cape_Coral.length] = createMarker(new GPoint(-10.00000000,10.00000000),"
Cape Coral High School
2300 Santa Barbara Boulev
Cape Coral, FL 33991

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Cape Coral High School",'Cape_Coral=' + Cape_Coral.length); Cape_Coral[Cape_Coral.length] = createMarker(new GPoint(-81.94984436,26.56849289),"
Cape Elementary School
4519 Vincennes Boulevard
Cape Coral, FL 33904

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Cape Elementary School",'Cape_Coral=' + Cape_Coral.length); Cape_Coral[Cape_Coral.length] = createMarker(new GPoint(-81.95023346,26.68389130),"
Diplomat Elementary School
1115 Ne 16th Terrace
Cape Coral, FL 33909

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Diplomat Elementary School",'Cape_Coral=' + Cape_Coral.length); Cape_Coral[Cape_Coral.length] = createMarker(new GPoint(-81.95161438,26.68392563),"
Diplomat Middle School
1039 Ne 16th Terrace
Cape Coral, FL 33909

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Diplomat Middle School",'Cape_Coral=' + Cape_Coral.length); Cape_Coral[Cape_Coral.length] = createMarker(new GPoint(-82.01283300,26.58968500),"
Gulf Elementary School
3400 Sw 17th Place
Cape Coral, FL 33914

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Gulf Elementary School",'Cape_Coral=' + Cape_Coral.length); Cape_Coral[Cape_Coral.length] = createMarker(new GPoint(-82.01194000,26.58473778),"
Gulf Middle School
1809 Sw 36th Terrace
Cape Coral, FL 33914

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Gulf Middle School",'Cape_Coral=' + Cape_Coral.length); Cape_Coral[Cape_Coral.length] = createMarker(new GPoint(-81.97460600,26.65696300),"
Hector Cafferata Jr Elementary School
250 Santa Barbara Blvd N
Cape Coral, FL 33993

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Hector Cafferata Jr Elementary School",'Cape_Coral=' + Cape_Coral.length); Cape_Coral[Cape_Coral.length] = createMarker(new GPoint(-82.01733400,26.56718200),"
Ida S. Baker High School
3500 Agualinda Blvd
Cape Coral, FL 33914

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Ida S. Baker High School",'Cape_Coral=' + Cape_Coral.length); Cape_Coral[Cape_Coral.length] = createMarker(new GPoint(-81.97475433,26.66142845),"
Lee County High Technical Center North
360 Santa Barbara Blvd.n
Cape Coral, FL 33993

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Lee County High Technical Center North",'Cape_Coral=' + Cape_Coral.length); Cape_Coral[Cape_Coral.length] = createMarker(new GPoint(-82.00675964,26.66574478),"
Mariner High School
701 Chiquita Blvd N
Cape Coral, FL 33993

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Mariner High School",'Cape_Coral=' + Cape_Coral.length); Cape_Coral[Cape_Coral.length] = createMarker(new GPoint(-81.91130066,26.69389915),"
Mariner Middle School
425 Chiquita Blvd. North
Cape Coral, FL 33993

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Mariner Middle School",'Cape_Coral=' + Cape_Coral.length); Cape_Coral[Cape_Coral.length] = createMarker(new GPoint(-81.97988300,26.58609700),"
Pelican Elementary School
3525 Sw 3rd Avenue
Cape Coral, FL 33914

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Pelican Elementary School",'Cape_Coral=' + Cape_Coral.length); Cape_Coral[Cape_Coral.length] = createMarker(new GPoint(-81.98762512,26.61746216),"
Skyline Elementary School
620 Sw 19th Street
Cape Coral, FL 33991

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Skyline Elementary School",'Cape_Coral=' + Cape_Coral.length); Cape_Coral[Cape_Coral.length] = createMarker(new GPoint(-81.91130066,26.69389915),"
Trafalgar Elementary School
1850 Sw 20th Avenue
Cape Coral, FL 33991

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Trafalgar Elementary School",'Cape_Coral=' + Cape_Coral.length); Cape_Coral[Cape_Coral.length] = createMarker(new GPoint(-82.01734924,26.62246323),"
Trafalgar Middle School
2120 Trafalgar Parkway
Cape Coral, FL 33991

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