function addMarkers(){ mySelect = document.getElementById('selection'); St_Augustine = [];Key_Largo = [];Big_Pine_Key = [];Tampa_Bay = [];Orlando = [];Coral_Gables = [];mySelect.options[mySelect.options.length] = new Option("Big Pine Key Schools",'all=Big_Pine_Key'); mySelect.options[mySelect.options.length] = new Option("Coral Gables Schools",'all=Coral_Gables'); mySelect.options[mySelect.options.length] = new Option("Key Largo Schools",'all=Key_Largo'); mySelect.options[mySelect.options.length] = new Option("Orlando Schools",'all=Orlando'); mySelect.options[mySelect.options.length] = new Option("St Augustine Schools",'all=St_Augustine'); mySelect.options[mySelect.options.length] = new Option("Tampa Bay Schools",'all=Tampa_Bay'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); St_Augustine[St_Augustine.length] = createMarker(new GLatLng(29.90173200,-81.32020600),"
Acadia Institute Of Oceanography
P.o. Box 2220
St. Augustine, FL 32085

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Acadia Institute Of Oceanography",'St_Augustine=' + St_Augustine.length); Key_Largo[Key_Largo.length] = createMarker(new GLatLng(25.11910900,-80.41783800),"
Camp Betsey Cox
P.o. Box 886
Key Largo, FL 33037

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Camp Betsey Cox",'Key_Largo=' + Key_Largo.length); Key_Largo[Key_Largo.length] = createMarker(new GLatLng(25.11910900,-80.41783800),"
Camp Sangamon For Boys, Inc.
P.o. Box 886
Key Largo, FL 33037

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Camp Sangamon For Boys, Inc.",'Key_Largo=' + Key_Largo.length); Big_Pine_Key[Big_Pine_Key.length] = createMarker(new GLatLng(24.65569800,-81.36974800),"
Seacamp
1300 Big Pine Avenue
Big Pine Key, FL 33043

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Seacamp",'Big_Pine_Key=' + Big_Pine_Key.length); Tampa_Bay[Tampa_Bay.length] = createMarker(new GLatLng(28.27434700,-82.38857830),"
Seaworld Adventure Park
P.o. Box 9157
Tampa Bay, FL 33674

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Seaworld Adventure Park",'Tampa_Bay=' + Tampa_Bay.length); Orlando[Orlando.length] = createMarker(new GLatLng(28.40678300,-81.47092900),"
Seaworld Adventure Park
7007 Seaworld Drive
Orlando, FL 32821

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Seaworld Adventure Park",'Orlando=' + Orlando.length); Coral_Gables[Coral_Gables.length] = createMarker(new GLatLng(25.70505700,-80.27137800),"
University Of Miami
P.o. Box 248005
Coral Gables, FL 33124

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("University Of Miami",'Coral_Gables=' + Coral_Gables.length); map.removeOverlays(Big_Pine_Key); map.removeOverlays(Coral_Gables); map.removeOverlays(Key_Largo); map.removeOverlays(Orlando); map.removeOverlays(St_Augustine); map.removeOverlays(Tampa_Bay); setTimeout(function(){map.addOverlays(Big_Pine_Key)},1000); setTimeout(function(){map.addOverlays(Coral_Gables)},1000); setTimeout(function(){map.addOverlays(Key_Largo)},1000); setTimeout(function(){map.addOverlays(Orlando)},1000); setTimeout(function(){map.addOverlays(St_Augustine)},1000); setTimeout(function(){map.addOverlays(Tampa_Bay)},1000); maxLng = -80.27137800; maxLat = 29.90173200; minLng = -82.38857830; minLat = 24.65569800; reCenterMap(); } // End addStateMarkers JavaScript Function function openAll() { if (map) { selectChange("all"); } else { setTimeout("openAll()",200); } } // 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].point.x; var markLat = myArray[i].point.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){ //alert(myArray[0].point.x); maxLng = myArray[0].point.x; maxLat = myArray[0].point.y; minLng = myArray[0].point.x; minLat = myArray[0].point.y; } // Recenter map based on global max/mins function reCenterMap(){ //alert('#' + minLat + '#' + minLng + '#' + maxLat + '#' + maxLng); 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); if(minLat == maxLat) zoom = 9; 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////all'); map.removeOverlays(Big_Pine_Key); map.removeOverlays(Coral_Gables); map.removeOverlays(Key_Largo); map.removeOverlays(Orlando); map.removeOverlays(St_Augustine); map.removeOverlays(Tampa_Bay); 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(St_Augustine);map.removeOverlays(Big_Pine_Key); map.removeOverlays(Coral_Gables); map.removeOverlays(Key_Largo); map.removeOverlays(Orlando); map.removeOverlays(St_Augustine); map.removeOverlays(Tampa_Bay); map.addOverlays(Big_Pine_Key); centerByArray(Big_Pine_Key, false, false); cntMarker += Big_Pine_Key.length; map.addOverlays(Coral_Gables); centerByArray(Coral_Gables, false, false); cntMarker += Coral_Gables.length; map.addOverlays(Key_Largo); centerByArray(Key_Largo, false, false); cntMarker += Key_Largo.length; map.addOverlays(Orlando); centerByArray(Orlando, false, false); cntMarker += Orlando.length; map.addOverlays(St_Augustine); centerByArray(St_Augustine, false, false); cntMarker += St_Augustine.length; map.addOverlays(Tampa_Bay); centerByArray(Tampa_Bay, false, false); cntMarker += Tampa_Bay.length; centerByArray(St_Augustine,true, false); //if (cntMarker > 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/all'); //else //window.open('/search////all'); } } function createMarker(point, label, icon){ var marker = new GMarker(point, icon); var html = label; GEvent.addListener(marker, "click", function() { marker.openInfoWindowHtml(html); }); return marker; }