function addMarkers() { mySelect = document.getElementById('selection'); Altheimer = [];Pine_Bluff = [];White_Hall = [];Redfield = [];mySelect.options[mySelect.options.length] = new Option("Altheimer schools",'all=Altheimer'); mySelect.options[mySelect.options.length] = new Option("Pine Bluff schools",'all=Pine_Bluff'); mySelect.options[mySelect.options.length] = new Option("Redfield schools",'all=Redfield'); mySelect.options[mySelect.options.length] = new Option("White Hall schools",'all=White_Hall'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Altheimer[Altheimer.length] = createMarker(new GPoint(-91.84677400,34.31931500),"
",iconBl); mySelect.options[mySelect.options.length] = new Option("Altheimer Middle School",'Altheimer=' + Altheimer.length); Altheimer[Altheimer.length] = createMarker(new GPoint(-91.83753204,34.32390976),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Altheimer-sherrill High School",'Altheimer=' + Altheimer.length); Pine_Bluff[Pine_Bluff.length] = createMarker(new GPoint(-91.97203064,34.21685410),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Belair Elementary School",'Pine_Bluff=' + Pine_Bluff.length); Pine_Bluff[Pine_Bluff.length] = createMarker(new GPoint(-91.98635101,34.21856308),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Broadmoor Elementary School",'Pine_Bluff=' + Pine_Bluff.length); Pine_Bluff[Pine_Bluff.length] = createMarker(new GPoint(-92.05346680,34.21626282),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Coleman Elementary School",'Pine_Bluff=' + Pine_Bluff.length); Pine_Bluff[Pine_Bluff.length] = createMarker(new GPoint(-92.05321503,34.24083710),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Dollarway High School",'Pine_Bluff=' + Pine_Bluff.length); Pine_Bluff[Pine_Bluff.length] = createMarker(new GPoint(-92.02808380,34.23929977),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Dollarway Junior High School",'Pine_Bluff=' + Pine_Bluff.length); Pine_Bluff[Pine_Bluff.length] = createMarker(new GPoint(-92.04526520,34.19764709),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Edgewood Elementary School",'Pine_Bluff=' + Pine_Bluff.length); Pine_Bluff[Pine_Bluff.length] = createMarker(new GPoint(-92.02051544,34.19513702),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Forrest Park Elementary School",'Pine_Bluff=' + Pine_Bluff.length); White_Hall[White_Hall.length] = createMarker(new GPoint(-92.09361267,34.25682068),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Gandy Elementary School",'White_Hall=' + White_Hall.length); Pine_Bluff[Pine_Bluff.length] = createMarker(new GPoint(-92.02837372,34.21923828),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Greenville Elementary School",'Pine_Bluff=' + Pine_Bluff.length); Redfield[Redfield.length] = createMarker(new GPoint(-92.17469788,34.44609833),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Hardin Elementary School",'Redfield=' + Redfield.length); Pine_Bluff[Pine_Bluff.length] = createMarker(new GPoint(-91.99373627,34.21425247),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Indiana Street Elementary School",'Pine_Bluff=' + Pine_Bluff.length); Pine_Bluff[Pine_Bluff.length] = createMarker(new GPoint(-92.00671387,34.18857956),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Jack Robey Jr. High School",'Pine_Bluff=' + Pine_Bluff.length); Pine_Bluff[Pine_Bluff.length] = createMarker(new GPoint(-92.00953900,34.22819900),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Jefferson Area Vocational Center",'Pine_Bluff=' + Pine_Bluff.length); Pine_Bluff[Pine_Bluff.length] = createMarker(new GPoint(-92.06522369,34.19541168),"",iconRd); mySelect.options[mySelect.options.length] = new Option("L. L. Owen Elementary School",'Pine_Bluff=' + Pine_Bluff.length); Pine_Bluff[Pine_Bluff.length] = createMarker(new GPoint(-92.00844574,34.21461487),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Lakeside Elementary School",'Pine_Bluff=' + Pine_Bluff.length); Altheimer[Altheimer.length] = createMarker(new GPoint(-91.83753204,34.32390976),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Martin Elementary School",'Altheimer=' + Altheimer.length); Pine_Bluff[Pine_Bluff.length] = createMarker(new GPoint(-92.04926300,34.23939514),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Matthews Elementary School",'Pine_Bluff=' + Pine_Bluff.length); White_Hall[White_Hall.length] = createMarker(new GPoint(-92.98959351,35.14810181),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Moody Elementary School",'White_Hall=' + White_Hall.length); Pine_Bluff[Pine_Bluff.length] = createMarker(new GPoint(-92.01159668,34.19910049),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Oak Park Elementary School",'Pine_Bluff=' + Pine_Bluff.length); Pine_Bluff[Pine_Bluff.length] = createMarker(new GPoint(-92.00946045,34.21873856),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Pine Bluff High School",'Pine_Bluff=' + Pine_Bluff.length); Pine_Bluff[Pine_Bluff.length] = createMarker(new GPoint(-92.06419373,34.24013519),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Pinecrest Elementary School",'Pine_Bluff=' + Pine_Bluff.length); Redfield[Redfield.length] = createMarker(new GPoint(-92.17469788,34.44609833),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Redfield Junior High School",'Redfield=' + Redfield.length); Pine_Bluff[Pine_Bluff.length] = createMarker(new GPoint(-92.01628876,34.21643829),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Sam Taylor Elementary School",'Pine_Bluff=' + Pine_Bluff.length); Pine_Bluff[Pine_Bluff.length] = createMarker(new GPoint(-91.98923492,34.20915604),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Southeast Middle School",'Pine_Bluff=' + Pine_Bluff.length); Pine_Bluff[Pine_Bluff.length] = createMarker(new GPoint(-92.02896881,34.18659210),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Southwood Elementary School",'Pine_Bluff=' + Pine_Bluff.length); White_Hall[White_Hall.length] = createMarker(new GPoint(-92.09300995,34.26713181),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Taylor Elementary School",'White_Hall=' + White_Hall.length); Pine_Bluff[Pine_Bluff.length] = createMarker(new GPoint(-92.00743866,34.19499969),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Thirty-fourth Ave. Elementary School",'Pine_Bluff=' + Pine_Bluff.length); Pine_Bluff[Pine_Bluff.length] = createMarker(new GPoint(-92.02824402,34.23954010),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Townsend Park Elementary School",'Pine_Bluff=' + Pine_Bluff.length); Pine_Bluff[Pine_Bluff.length] = createMarker(new GPoint(-92.02733612,34.16526413),"",iconRd); mySelect.options[mySelect.options.length] = new Option("W. T. Cheney Elementary School",'Pine_Bluff=' + Pine_Bluff.length); Pine_Bluff[Pine_Bluff.length] = createMarker(new GPoint(-92.05475616,34.19708633),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Watson Chapel High School",'Pine_Bluff=' + Pine_Bluff.length); Pine_Bluff[Pine_Bluff.length] = createMarker(new GPoint(-92.05455017,34.19723892),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Watson Chapel Junior High School",'Pine_Bluff=' + Pine_Bluff.length); White_Hall[White_Hall.length] = createMarker(new GPoint(-92.11171700,34.28236600),"",iconGr); mySelect.options[mySelect.options.length] = new Option("White Hall High School",'White_Hall=' + White_Hall.length); White_Hall[White_Hall.length] = createMarker(new GPoint(-92.08194733,34.26131439),"",iconBl); mySelect.options[mySelect.options.length] = new Option("White Hall Junior High School",'White_Hall=' + White_Hall.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(Altheimer); map.removeOverlays(Pine_Bluff); map.removeOverlays(Redfield); map.removeOverlays(White_Hall); 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(Altheimer);map.removeOverlays(Altheimer); map.removeOverlays(Pine_Bluff); map.removeOverlays(Redfield); map.removeOverlays(White_Hall); map.addOverlays(Altheimer); centerByArray(Altheimer, false, false); cntMarker += Altheimer.length; map.addOverlays(Pine_Bluff); centerByArray(Pine_Bluff, false, false); cntMarker += Pine_Bluff.length; map.addOverlays(Redfield); centerByArray(Redfield, false, false); cntMarker += Redfield.length; map.addOverlays(White_Hall); centerByArray(White_Hall, false, false); cntMarker += White_Hall.length; centerByArray(Altheimer,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'); } }