function addMarkers() { mySelect = document.getElementById('selection'); Donaldsonville = [];Darrow = [];Gonzales = [];Geismar = [];Prairieville = [];Saint_Amant = [];mySelect.options[mySelect.options.length] = new Option("Darrow schools",'all=Darrow'); mySelect.options[mySelect.options.length] = new Option("Donaldsonville schools",'all=Donaldsonville'); mySelect.options[mySelect.options.length] = new Option("Geismar schools",'all=Geismar'); mySelect.options[mySelect.options.length] = new Option("Gonzales schools",'all=Gonzales'); mySelect.options[mySelect.options.length] = new Option("Prairieville schools",'all=Prairieville'); mySelect.options[mySelect.options.length] = new Option("Saint Amant schools",'all=Saint_Amant'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Donaldsonville[Donaldsonville.length] = createMarker(new GPoint(-90.98265839,30.10151863),"
Ascension Head Start Elementary School
406 Lee Avenue
Donaldsonville, LA 70376

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Ascension Head Start Elementary School",'Donaldsonville=' + Donaldsonville.length); Darrow[Darrow.length] = createMarker(new GPoint(-90.94895935,30.14047813),"
Ascension Parish Alternative School
38608 Highway 22
Darrow, LA 70725

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Ascension Parish Alternative School",'Darrow=' + Darrow.length); Gonzales[Gonzales.length] = createMarker(new GPoint(-90.90425110,30.27205276),"
Central Elementary School
14101 Roddy Road
Gonzales, LA 70737

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Central Elementary School",'Gonzales=' + Gonzales.length); Donaldsonville[Donaldsonville.length] = createMarker(new GPoint(-90.96308899,30.08060455),"
Donaldsonville Elementary School
38210 Highway 3089
Donaldsonville, LA 70346

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Donaldsonville Elementary School",'Donaldsonville=' + Donaldsonville.length); Donaldsonville[Donaldsonville.length] = createMarker(new GPoint(-91.00131226,30.09741783),"
Donaldsonville High School
100 Tiger Drive
Donaldsonville, LA 70346

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Donaldsonville High School",'Donaldsonville=' + Donaldsonville.length); Gonzales[Gonzales.length] = createMarker(new GPoint(-90.97027588,30.26906395),"
Duplessis Primary School
38101 Highway 621
Gonzales, LA 70737

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Duplessis Primary School",'Gonzales=' + Gonzales.length); Geismar[Geismar.length] = createMarker(new GPoint(-90.98925781,30.25900269),"
Dutchtown High School
13165 Highway 73
Geismar, LA 70734

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Dutchtown High School",'Geismar=' + Geismar.length); Geismar[Geismar.length] = createMarker(new GPoint(-90.98896027,30.25926590),"
Dutchtown Middle School
13078 Highway 73
Geismar, LA 70734

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Dutchtown Middle School",'Geismar=' + Geismar.length); Geismar[Geismar.length] = createMarker(new GPoint(-90.98896027,30.25852776),"
Dutchtown Primary School
13046 Highway 73
Geismar, LA 70734

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Dutchtown Primary School",'Geismar=' + Geismar.length); Gonzales[Gonzales.length] = createMarker(new GPoint(-90.91548920,30.22560120),"
East Ascension High School
612 East Worthey Road
Gonzales, LA 70737

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("East Ascension High School",'Gonzales=' + Gonzales.length); Gonzales[Gonzales.length] = createMarker(new GPoint(-90.92496490,30.24465942),"
G. W. Carver Primary School
518 West Oak Street
Gonzales, LA 70737

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("G. W. Carver Primary School",'Gonzales=' + Gonzales.length); Prairieville[Prairieville.length] = createMarker(new GPoint(-90.90424347,30.31376266),"
Galvez Middle School
42018 Highway 933
Prairieville, LA 70769

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Galvez Middle School",'Prairieville=' + Prairieville.length); Prairieville[Prairieville.length] = createMarker(new GPoint(-90.88422394,30.30279160),"
Galvez Primary School
16093 Henderson Bayou Road
Prairieville, LA 70769

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Galvez Primary School",'Prairieville=' + Prairieville.length); Gonzales[Gonzales.length] = createMarker(new GPoint(-90.93606567,30.21822929),"
Gonzales Middle School
1502 West Orice Roth Street
Gonzales, LA 70737

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Gonzales Middle School",'Gonzales=' + Gonzales.length); Gonzales[Gonzales.length] = createMarker(new GPoint(-90.92053986,30.23571587),"
Gonzales Primary School
521 North Burnside Avenue
Gonzales, LA 70737

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Gonzales Primary School",'Gonzales=' + Gonzales.length); Saint_Amant[Saint_Amant.length] = createMarker(new GPoint(-90.87032318,30.27424622),"
Lake Elementary School
14185 Highway 431
Saint Amant, LA 70774

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Lake Elementary School",'Saint_Amant=' + Saint_Amant.length); Donaldsonville[Donaldsonville.length] = createMarker(new GPoint(-90.99824524,30.10458755),"
Lowery Middle School
2389 Highway 1 South
Donaldsonville, LA 70346

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Lowery Middle School",'Donaldsonville=' + Donaldsonville.length); Prairieville[Prairieville.length] = createMarker(new GPoint(-90.97766876,30.32446289),"
Oak Grove Primary School
17550 Old Jefferson Highway
Prairieville, LA 70769

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Oak Grove Primary School",'Prairieville=' + Prairieville.length); Prairieville[Prairieville.length] = createMarker(new GPoint(-90.95554352,30.30443954),"
Prairieville Middle School
16200 Highway 930
Prairieville, LA 70769

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Prairieville Middle School",'Prairieville=' + Prairieville.length); Saint_Amant[Saint_Amant.length] = createMarker(new GPoint(-90.86978149,30.24128914),"
Saint Amant High School
12035 Highway 431
Saint Amant, LA 70774

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Saint Amant High School",'Saint_Amant=' + Saint_Amant.length); Saint_Amant[Saint_Amant.length] = createMarker(new GPoint(-90.86016083,30.22368622),"
Saint Amant Middle School
44317 Highway 429
Saint Amant, LA 70774

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Saint Amant Middle School",'Saint_Amant=' + Saint_Amant.length); Saint_Amant[Saint_Amant.length] = createMarker(new GPoint(-90.85932922,30.22375870),"
Saint Amant Primary School
44365 Highway 429
Saint Amant, LA 70774

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Saint Amant Primary School",'Saint_Amant=' + Saint_Amant.length); Donaldsonville[Donaldsonville.length] = createMarker(new GPoint(-90.99192810,30.09372711),"
West Ascension Elementary School
2389 Highway 1 South
Donaldsonville, LA 70346

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("West Ascension Elementary School",'Donaldsonville=' + Donaldsonville.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(Darrow); map.removeOverlays(Donaldsonville); map.removeOverlays(Geismar); map.removeOverlays(Gonzales); map.removeOverlays(Prairieville); map.removeOverlays(Saint_Amant); 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(Donaldsonville);map.removeOverlays(Darrow); map.removeOverlays(Donaldsonville); map.removeOverlays(Geismar); map.removeOverlays(Gonzales); map.removeOverlays(Prairieville); map.removeOverlays(Saint_Amant); map.addOverlays(Darrow); centerByArray(Darrow, false, false); cntMarker += Darrow.length; map.addOverlays(Donaldsonville); centerByArray(Donaldsonville, false, false); cntMarker += Donaldsonville.length; map.addOverlays(Geismar); centerByArray(Geismar, false, false); cntMarker += Geismar.length; map.addOverlays(Gonzales); centerByArray(Gonzales, false, false); cntMarker += Gonzales.length; map.addOverlays(Prairieville); centerByArray(Prairieville, false, false); cntMarker += Prairieville.length; map.addOverlays(Saint_Amant); centerByArray(Saint_Amant, false, false); cntMarker += Saint_Amant.length; centerByArray(Donaldsonville,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'); } }