function addMarkers() { mySelect = document.getElementById('selection'); Camden = [];Bearden = [];Chidester = [];Stephens = [];Thornton = [];mySelect.options[mySelect.options.length] = new Option("Bearden schools",'all=Bearden'); mySelect.options[mySelect.options.length] = new Option("Camden schools",'all=Camden'); mySelect.options[mySelect.options.length] = new Option("Chidester schools",'all=Chidester'); mySelect.options[mySelect.options.length] = new Option("Stephens schools",'all=Stephens'); mySelect.options[mySelect.options.length] = new Option("Thornton schools",'all=Thornton'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Camden[Camden.length] = createMarker(new GPoint(-92.85128021,33.59703827),"
Alternative Learning Center
327 Stewart Street
Camden, AR 71701

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Alternative Learning Center",'Camden=' + Camden.length); Bearden[Bearden.length] = createMarker(new GPoint(-92.64689636,33.71979904),"
Bearden Elementary School
P.o. Box 195
Bearden, AR 71720

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Bearden Elementary School",'Bearden=' + Bearden.length); Bearden[Bearden.length] = createMarker(new GPoint(-75.66201019,39.76017761),"
Bearden High School
P.o. Box 176
Bearden, AR 71720

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bearden High School",'Bearden=' + Bearden.length); Bearden[Bearden.length] = createMarker(new GPoint(-92.64689636,33.71979904),"
Bearden Middle School
P.o. Box 195
Bearden, AR 71720

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Bearden Middle School",'Bearden=' + Bearden.length); Camden[Camden.length] = createMarker(new GPoint(-92.85211945,33.55288315),"
Camden Fairview High School
1750 Cash Road
Camden, AR 71701

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Camden Fairview High School",'Camden=' + Camden.length); Camden[Camden.length] = createMarker(new GPoint(-92.83232880,33.58119965),"
Camden Fairview Intermediate
255 Pope Street
Camden, AR 71701

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Camden Fairview Intermediate",'Camden=' + Camden.length); Camden[Camden.length] = createMarker(new GPoint(-92.85091400,33.59377670),"
Camden Fairview Middle School
647 Jefferson Drive
Camden, AR 71701

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Camden Fairview Middle School",'Camden=' + Camden.length); Chidester[Chidester.length] = createMarker(new GPoint(-93.01999664,33.69319916),"
Chidester Elementary School
P.o. Box 67
Chidester, AR 71726

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Chidester Elementary School",'Chidester=' + Chidester.length); Camden[Camden.length] = createMarker(new GPoint(-92.84191895,33.53252029),"
Fairview Elementary School
1 Robin Street
Camden, AR 71701

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Fairview Elementary School",'Camden=' + Camden.length); Camden[Camden.length] = createMarker(new GPoint(-92.83424377,33.58443069),"
Harmony Grove Elementary School
401 Ouachita 88
Camden, AR 71701

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Harmony Grove Elementary School",'Camden=' + Camden.length); Camden[Camden.length] = createMarker(new GPoint(-92.84671783,33.58449936),"
Harmony Grove High School
401 Ouachita 88
Camden, AR 71701

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Harmony Grove High School",'Camden=' + Camden.length); Camden[Camden.length] = createMarker(new GPoint(-92.83759308,33.58275223),"
Ivory Primary School
575 Jefferson Street
Camden, AR 71701

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Ivory Primary School",'Camden=' + Camden.length); Camden[Camden.length] = createMarker(new GPoint(-92.83203000,33.57599800),"
Sau Tech Career Academy
327 Stewart Street Sw
Camden, AR 71701

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Sau Tech Career Academy",'Camden=' + Camden.length); Stephens[Stephens.length] = createMarker(new GPoint(-93.07835388,33.40892029),"
Stephens Elementary School
655 Arch St.
Stephens, AR 71764

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Stephens Elementary School",'Stephens=' + Stephens.length); Stephens[Stephens.length] = createMarker(new GPoint(-93.07122040,33.41358185),"
Stephens High School
315 W. Chert St.
Stephens, AR 71764

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Stephens High School",'Stephens=' + Stephens.length); Thornton[Thornton.length] = createMarker(new GPoint(-92.47389984,33.76800156),"
Thornton Elementary School
P O Box 37
Thornton, AR 71766

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Thornton Elementary School",'Thornton=' + Thornton.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(Bearden); map.removeOverlays(Camden); map.removeOverlays(Chidester); map.removeOverlays(Stephens); map.removeOverlays(Thornton); 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(Camden);map.removeOverlays(Bearden); map.removeOverlays(Camden); map.removeOverlays(Chidester); map.removeOverlays(Stephens); map.removeOverlays(Thornton); map.addOverlays(Bearden); centerByArray(Bearden, false, false); cntMarker += Bearden.length; map.addOverlays(Camden); centerByArray(Camden, false, false); cntMarker += Camden.length; map.addOverlays(Chidester); centerByArray(Chidester, false, false); cntMarker += Chidester.length; map.addOverlays(Stephens); centerByArray(Stephens, false, false); cntMarker += Stephens.length; map.addOverlays(Thornton); centerByArray(Thornton, false, false); cntMarker += Thornton.length; centerByArray(Camden,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'); } }