function addMarkers() { mySelect = document.getElementById('selection'); Cabot = [];Carlisle = [];England = [];Lonoke = [];Ward = [];mySelect.options[mySelect.options.length] = new Option("Cabot schools",'all=Cabot'); mySelect.options[mySelect.options.length] = new Option("Carlisle schools",'all=Carlisle'); mySelect.options[mySelect.options.length] = new Option("England schools",'all=England'); mySelect.options[mySelect.options.length] = new Option("Lonoke schools",'all=Lonoke'); mySelect.options[mySelect.options.length] = new Option("Ward schools",'all=Ward'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Cabot[Cabot.length] = createMarker(new GPoint(-92.01477700,34.97643800),"
Academic Center For Excellence
404 N. Second
Cabot, AR 72023

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Academic Center For Excellence",'Cabot=' + Cabot.length); Cabot[Cabot.length] = createMarker(new GPoint(-92.01055145,34.97373581),"
Cabot High School
401 N. Lincoln
Cabot, AR 72023

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Cabot High School",'Cabot=' + Cabot.length); Cabot[Cabot.length] = createMarker(new GPoint(-92.00759888,34.97460175),"
Cabot Junior High North
38 Spirit Drive
Cabot, AR 72023

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Cabot Junior High North",'Cabot=' + Cabot.length); Cabot[Cabot.length] = createMarker(new GPoint(-92.01040649,34.94292450),"
Cabot Junior High School
38 Panther Trail
Cabot, AR 72023

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Cabot Junior High School",'Cabot=' + Cabot.length); Cabot[Cabot.length] = createMarker(new GPoint(-91.99946594,34.97779083),"
Cabot Middle School North
1900 N. Lincoln
Cabot, AR 72023

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Cabot Middle School North",'Cabot=' + Cabot.length); Cabot[Cabot.length] = createMarker(new GPoint(-92.02011108,34.94570923),"
Cabot Middle School South
2555 Kerr Station Rd
Cabot, AR 72023

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Cabot Middle School South",'Cabot=' + Cabot.length); Carlisle[Carlisle.length] = createMarker(new GPoint(-91.74829865,34.77899933),"
Carlisle Elementary School
707 East 5th
Carlisle, AR 72024

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Carlisle Elementary School",'Carlisle=' + Carlisle.length); Carlisle[Carlisle.length] = createMarker(new GPoint(-91.74662018,34.78292847),"
Carlisle High School
520 Center St
Carlisle, AR 72024

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Carlisle High School",'Carlisle=' + Carlisle.length); Cabot[Cabot.length] = createMarker(new GPoint(-92.01043701,34.96093750),"
Central Elementary School
36 Pond Street
Cabot, AR 72023

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Central Elementary School",'Cabot=' + Cabot.length); Cabot[Cabot.length] = createMarker(new GPoint(-92.00582886,34.96871185),"
Eastside Elementary School
17 Bellamy
Cabot, AR 72023

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Eastside Elementary School",'Cabot=' + Cabot.length); England[England.length] = createMarker(new GPoint(-91.96392822,34.54027939),"
England Elementary School
400 E Dewitt St
England, AR 72046

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("England Elementary School",'England=' + England.length); England[England.length] = createMarker(new GPoint(-91.95639038,34.54350281),"
England High School
501 Pine Bluff Hwy
England, AR 72046

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("England High School",'England=' + England.length); England[England.length] = createMarker(new GPoint(-91.97003174,34.55823517),"
England Middle School
1500 Ne 1st Street
England, AR 72046

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("England Middle School",'England=' + England.length); Lonoke[Lonoke.length] = createMarker(new GPoint(-91.91392517,34.77738953),"
Lonoke Elementary School
900 West Palm
Lonoke, AR 72086

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Lonoke Elementary School",'Lonoke=' + Lonoke.length); Lonoke[Lonoke.length] = createMarker(new GPoint(-91.90388489,34.78076172),"
Lonoke High School
501 West Academy
Lonoke, AR 72086

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Lonoke High School",'Lonoke=' + Lonoke.length); Lonoke[Lonoke.length] = createMarker(new GPoint(-91.89873505,34.77976227),"
Lonoke Middle School
200 East Locust
Lonoke, AR 72086

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Lonoke Middle School",'Lonoke=' + Lonoke.length); Lonoke[Lonoke.length] = createMarker(new GPoint(-91.90936279,34.77531052),"
Lonoke Primary School
800 Lincoln
Lonoke, AR 72086

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Lonoke Primary School",'Lonoke=' + Lonoke.length); Cabot[Cabot.length] = createMarker(new GPoint(-92.02226257,34.97974777),"
Northside Elementary School
814 W. Locust
Cabot, AR 72023

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Northside Elementary School",'Cabot=' + Cabot.length); Cabot[Cabot.length] = createMarker(new GPoint(-92.00886536,34.93989944),"
Southside Elementary School
2600 S. Pine
Cabot, AR 72023

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Southside Elementary School",'Cabot=' + Cabot.length); Ward[Ward.length] = createMarker(new GPoint(-91.95088959,35.02506256),"
Ward Central Elementary School
1570 Wilson Loop
Ward, AR 72176

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Ward Central Elementary School",'Ward=' + Ward.length); Cabot[Cabot.length] = createMarker(new GPoint(-92.03105164,34.96320343),"
Westside Elementary School
1701 S. Second
Cabot, AR 72023

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Westside Elementary School",'Cabot=' + Cabot.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(Cabot); map.removeOverlays(Carlisle); map.removeOverlays(England); map.removeOverlays(Lonoke); map.removeOverlays(Ward); 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(Cabot);map.removeOverlays(Cabot); map.removeOverlays(Carlisle); map.removeOverlays(England); map.removeOverlays(Lonoke); map.removeOverlays(Ward); map.addOverlays(Cabot); centerByArray(Cabot, false, false); cntMarker += Cabot.length; map.addOverlays(Carlisle); centerByArray(Carlisle, false, false); cntMarker += Carlisle.length; map.addOverlays(England); centerByArray(England, false, false); cntMarker += England.length; map.addOverlays(Lonoke); centerByArray(Lonoke, false, false); cntMarker += Lonoke.length; map.addOverlays(Ward); centerByArray(Ward, false, false); cntMarker += Ward.length; centerByArray(Cabot,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'); } }