function addMarkers(){ mySelect = document.getElementById('selection'); Gainesville = [];Alachua = [];Archer = [];mySelect.options[mySelect.options.length] = new Option("Alachua schools",'all=Alachua'); mySelect.options[mySelect.options.length] = new Option("Archer schools",'all=Archer'); mySelect.options[mySelect.options.length] = new Option("Gainesville schools",'all=Gainesville'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Gainesville[Gainesville.length] = createMarker(new GPoint(-82.47061800,29.56976100),"
Christian Life Academy
12000 Sw Archer Road
Gainesville, FL 32608
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Christian Life Academy",'Gainesville=' + Gainesville.length); Gainesville[Gainesville.length] = createMarker(new GPoint(-82.37665500,29.65964100),"
Cornerstone Academy
3536 NW 8th Ave
Gainesville, FL 32635
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Cornerstone Academy",'Gainesville=' + Gainesville.length); Gainesville[Gainesville.length] = createMarker(new GPoint(-82.45816000,29.68920000),"
Countryside Christian School
10926 Nw 39th Avenue
Gainesville, FL 32606
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Countryside Christian School",'Gainesville=' + Gainesville.length); Alachua[Alachua.length] = createMarker(new GPoint(-82.49427900,29.79309000),"
Destiny Christian Academy
Po Box 1708
Alachua, FL 32616
Co-ed school, 3-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Destiny Christian Academy",'Alachua=' + Alachua.length); Archer[Archer.length] = createMarker(new GPoint(-82.53570000,29.52573100),"
Family Life Academy
Po Box 799
Archer, FL 32618
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Family Life Academy",'Archer=' + Archer.length); Archer[Archer.length] = createMarker(new GPoint(-82.50642800,29.54036000),"
Jordan Glen School
12425 SW 154th St
Archer, FL 32618
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Jordan Glen School",'Archer=' + Archer.length); Gainesville[Gainesville.length] = createMarker(new GPoint(-82.42593600,29.63944000),"
Oak Hall School
8009 SW 14th Avenue
Gainesville, FL 32607
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Oak Hall School",'Gainesville=' + Gainesville.length); Gainesville[Gainesville.length] = createMarker(new GPoint(-82.45725000,29.63080500),"
Queen Of Peace Cath Academy
10900 Sw 24th Avenue
Gainesville, FL 32607
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Queen Of Peace Cath Academy",'Gainesville=' + Gainesville.length); Gainesville[Gainesville.length] = createMarker(new GPoint(-82.44871300,29.63073300),"
The Rock School
9818 SW 24th Ave
Gainesville, FL 32607
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("The Rock School",'Gainesville=' + Gainesville.length); Alachua[Alachua.length] = createMarker(new GPoint(-82.46259600,29.83042900),"
Vaishnava Academy For Girls
18925 Nw County Road 239
Alachua, FL 32615
All-girls school, 8-12
[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Vaishnava Academy For Girls",'Alachua=' + Alachua.length); Gainesville[Gainesville.length] = createMarker(new GPoint(-82.37255700,29.66577300),"
Westwood Hills Christian
1520 Nw 34th Street
Gainesville, FL 32605
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Westwood Hills Christian",'Gainesville=' + Gainesville.length); Gainesville[Gainesville.length] = createMarker(new GPoint(-82.19131600,29.63320400),"
Windsor Christian Academy
1918 Se County Road 234
Gainesville, FL 32641
Co-ed school, 1-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Windsor Christian Academy",'Gainesville=' + Gainesville.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,11); /* 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/////2/' + showArray); map.removeOverlays(Alachua); map.removeOverlays(Archer); map.removeOverlays(Gainesville); 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(Gainesville);map.removeOverlays(Alachua); map.removeOverlays(Archer); map.removeOverlays(Gainesville); map.addOverlays(Alachua); centerByArray(Alachua, false, false); cntMarker += Alachua.length; map.addOverlays(Archer); centerByArray(Archer, false, false); cntMarker += Archer.length; map.addOverlays(Gainesville); centerByArray(Gainesville, false, false); cntMarker += Gainesville.length; centerByArray(Gainesville,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'); //window.open('/map.php?type=1&schools=&school_level=2&radius=&zipcode=&school_type_search=&school_type_code='); } } function createMarker(point, label, icon) { var marker = new GMarker(point, icon); var html = label; GEvent.addListener(marker, "click", function() { marker.openInfoWindowHtml(html); }); return marker; }