function addMarkers() { mySelect = document.getElementById('selection'); Batesville = [];Charlotte = [];Cushman = [];Floral = [];Pleasant_Plains = [];Newark = [];Oil_Trough = [];Sulphur_Rock = [];mySelect.options[mySelect.options.length] = new Option("Batesville schools",'all=Batesville'); mySelect.options[mySelect.options.length] = new Option("Charlotte schools",'all=Charlotte'); mySelect.options[mySelect.options.length] = new Option("Cushman schools",'all=Cushman'); mySelect.options[mySelect.options.length] = new Option("Floral schools",'all=Floral'); mySelect.options[mySelect.options.length] = new Option("Newark schools",'all=Newark'); mySelect.options[mySelect.options.length] = new Option("Oil Trough schools",'all=Oil_Trough'); mySelect.options[mySelect.options.length] = new Option("Pleasant Plains schools",'all=Pleasant_Plains'); mySelect.options[mySelect.options.length] = new Option("Sulphur Rock schools",'all=Sulphur_Rock'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Batesville[Batesville.length] = createMarker(new GPoint(-91.50015259,35.93426132),"
Batesville High School
1 Pioneer Drive
Batesville, AR 72501

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Batesville High School",'Batesville=' + Batesville.length); Batesville[Batesville.length] = createMarker(new GPoint(-91.50015259,35.93453598),"
Batesville Junior High School
2 Pioneer Drive
Batesville, AR 72501

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Batesville Junior High School",'Batesville=' + Batesville.length); Batesville[Batesville.length] = createMarker(new GPoint(-91.64620972,35.77598572),"
Batesville Middle School
955 Water Street
Batesville, AR 72501

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Batesville Middle School",'Batesville=' + Batesville.length); Batesville[Batesville.length] = createMarker(new GPoint(-91.64601135,35.77136612),"
Central Elementary School
650 Vine
Batesville, AR 72501

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Central Elementary School",'Batesville=' + Batesville.length); Charlotte[Charlotte.length] = createMarker(new GPoint(-91.43852997,35.81900024),"
Cord-charlotte Elementary School
225 School Road
Charlotte, AR 72522

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Cord-charlotte Elementary School",'Charlotte=' + Charlotte.length); Charlotte[Charlotte.length] = createMarker(new GPoint(-91.43852997,35.81900024),"
Cord-charlotte High School
225 School Road
Charlotte, AR 72522

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Cord-charlotte High School",'Charlotte=' + Charlotte.length); Cushman[Cushman.length] = createMarker(new GPoint(-91.75859833,35.87789917),"
Cushman Elementary School
P.o.box 370
Cushman, AR 72526

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Cushman Elementary School",'Cushman=' + Cushman.length); Cushman[Cushman.length] = createMarker(new GPoint(-91.75859833,35.87789917),"
Cushman High School
P.o.box 370
Cushman, AR 72526

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Cushman High School",'Cushman=' + Cushman.length); Batesville[Batesville.length] = createMarker(new GPoint(-91.60108185,35.75276184),"
Eagle Mountain Elementary School
Eagle Mountain Blvd
Batesville, AR 72501

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Eagle Mountain Elementary School",'Batesville=' + Batesville.length); Batesville[Batesville.length] = createMarker(new GPoint(-91.63253021,35.77326202),"
Kindergarten Center
1900 Lyon Street
Batesville, AR 72501

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Kindergarten Center",'Batesville=' + Batesville.length); Floral[Floral.length] = createMarker(new GPoint(-91.72589874,35.60839844),"
Midland Elementary School
P.o. Box 119
Floral, AR 72534

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Midland Elementary School",'Floral=' + Floral.length); Pleasant_Plains[Pleasant_Plains.length] = createMarker(new GPoint(-91.62819672,35.56769943),"
Midland High School
P.o. Box 630
Pleasant Plains, AR 72568

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Midland High School",'Pleasant_Plains=' + Pleasant_Plains.length); Newark[Newark.length] = createMarker(new GPoint(-91.43880463,35.71517944),"
Newark Elementary School
3549 Cord Road
Newark, AR 72562

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Newark Elementary School",'Newark=' + Newark.length); Newark[Newark.length] = createMarker(new GPoint(-91.44393158,35.70887756),"
Newark High School
1500 N Hill Street
Newark, AR 72562

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Newark High School",'Newark=' + Newark.length); Oil_Trough[Oil_Trough.length] = createMarker(new GPoint(-91.45539856,35.61700058),"
Oil Trough Elementary School
P.o. Box 177
Oil Trough, AR 72564

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Oil Trough Elementary School",'Oil_Trough=' + Oil_Trough.length); Batesville[Batesville.length] = createMarker(new GPoint(-91.63437653,35.69963837),"
Southside Elementary School
70 Scott Drive
Batesville, AR 72501

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Southside Elementary School",'Batesville=' + Batesville.length); Batesville[Batesville.length] = createMarker(new GPoint(-91.63437653,35.69963837),"
Southside High School
70 Scott Drive
Batesville, AR 72501

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Southside High School",'Batesville=' + Batesville.length); Batesville[Batesville.length] = createMarker(new GPoint(-91.63437653,35.69963837),"
Southside Middle School
70 Scott Drive
Batesville, AR 72501

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Southside Middle School",'Batesville=' + Batesville.length); Sulphur_Rock[Sulphur_Rock.length] = createMarker(new GPoint(-91.49590302,35.76229858),"
Sulphur Rock Elementary School
P.o. Box 98
Sulphur Rock, AR 72579

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Sulphur Rock Elementary School",'Sulphur_Rock=' + Sulphur_Rock.length); Sulphur_Rock[Sulphur_Rock.length] = createMarker(new GPoint(-91.49590302,35.76229858),"
Sulphur Rock High School
P.o. Box 98
Sulphur Rock, AR 72579

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Sulphur Rock High School",'Sulphur_Rock=' + Sulphur_Rock.length); Batesville[Batesville.length] = createMarker(new GPoint(-91.65532684,35.77749634),"
West Elementary School
850 Hill Street
Batesville, AR 72501

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("West Elementary School",'Batesville=' + Batesville.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(Batesville); map.removeOverlays(Charlotte); map.removeOverlays(Cushman); map.removeOverlays(Floral); map.removeOverlays(Newark); map.removeOverlays(Oil_Trough); map.removeOverlays(Pleasant_Plains); map.removeOverlays(Sulphur_Rock); 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(Batesville);map.removeOverlays(Batesville); map.removeOverlays(Charlotte); map.removeOverlays(Cushman); map.removeOverlays(Floral); map.removeOverlays(Newark); map.removeOverlays(Oil_Trough); map.removeOverlays(Pleasant_Plains); map.removeOverlays(Sulphur_Rock); map.addOverlays(Batesville); centerByArray(Batesville, false, false); cntMarker += Batesville.length; map.addOverlays(Charlotte); centerByArray(Charlotte, false, false); cntMarker += Charlotte.length; map.addOverlays(Cushman); centerByArray(Cushman, false, false); cntMarker += Cushman.length; map.addOverlays(Floral); centerByArray(Floral, false, false); cntMarker += Floral.length; map.addOverlays(Newark); centerByArray(Newark, false, false); cntMarker += Newark.length; map.addOverlays(Oil_Trough); centerByArray(Oil_Trough, false, false); cntMarker += Oil_Trough.length; map.addOverlays(Pleasant_Plains); centerByArray(Pleasant_Plains, false, false); cntMarker += Pleasant_Plains.length; map.addOverlays(Sulphur_Rock); centerByArray(Sulphur_Rock, false, false); cntMarker += Sulphur_Rock.length; centerByArray(Batesville,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'); } }