function addMarkers() { mySelect = document.getElementById('selection'); Macon = [];Lizella = [];mySelect.options[mySelect.options.length] = new Option("Lizella schools",'all=Lizella'); mySelect.options[mySelect.options.length] = new Option("Macon schools",'all=Macon'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Macon[Macon.length] = createMarker(new GPoint(-83.65933990,32.83414841),"
",iconRd); mySelect.options[mySelect.options.length] = new Option("Alexander Ii Magnet School",'Macon=' + Macon.length); Macon[Macon.length] = createMarker(new GPoint(-83.60308075,32.85973740),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Appling Middle School",'Macon=' + Macon.length); Macon[Macon.length] = createMarker(new GPoint(-83.67122650,32.82006454),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Ballard Hudson Middle School",'Macon=' + Macon.length); Macon[Macon.length] = createMarker(new GPoint(-83.70400238,32.78828430),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Barden Elementary School",'Macon=' + Macon.length); Macon[Macon.length] = createMarker(new GPoint(-83.56873322,32.81388855),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Bernd Elementary School",'Macon=' + Macon.length); Macon[Macon.length] = createMarker(new GPoint(-83.62339400,32.84884500),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Bibb County Learning Center",'Macon=' + Macon.length); Macon[Macon.length] = createMarker(new GPoint(-83.68486023,32.85266113),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Brookdale Elementary School",'Macon=' + Macon.length); Macon[Macon.length] = createMarker(new GPoint(-83.65226746,32.79845810),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Bruce Elementary School",'Macon=' + Macon.length); Macon[Macon.length] = createMarker(new GPoint(-83.61294300,32.85337900),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Burdell Elementary School",'Macon=' + Macon.length); Macon[Macon.length] = createMarker(new GPoint(-83.70763397,32.77743530),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Burghard Elementary School",'Macon=' + Macon.length); Macon[Macon.length] = createMarker(new GPoint(-83.64431000,32.81959915),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Burke Elementary School",'Macon=' + Macon.length); Macon[Macon.length] = createMarker(new GPoint(-83.69393158,32.84915161),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Butler Early Childhood Center",'Macon=' + Macon.length); Macon[Macon.length] = createMarker(new GPoint(-83.75588989,32.87966156),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Carter Elementary School",'Macon=' + Macon.length); Macon[Macon.length] = createMarker(new GPoint(-83.65580750,32.83608627),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Central High School",'Macon=' + Macon.length); Macon[Macon.length] = createMarker(new GPoint(-83.60054779,32.85956192),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Danforth Primary School",'Macon=' + Macon.length); Macon[Macon.length] = createMarker(new GPoint(-83.66924600,32.84715000),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Georgia Academy For Blind",'Macon=' + Macon.length); Macon[Macon.length] = createMarker(new GPoint(-83.66253662,32.82496643),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Hamilton Elementary School",'Macon=' + Macon.length); Macon[Macon.length] = createMarker(new GPoint(-83.67932129,32.82213593),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Hartley Elementary School",'Macon=' + Macon.length); Macon[Macon.length] = createMarker(new GPoint(-83.68578339,32.72326660),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Heard Elementary School",'Macon=' + Macon.length); Macon[Macon.length] = createMarker(new GPoint(-83.75539398,32.84516144),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Heritage Elementary School",'Macon=' + Macon.length); Macon[Macon.length] = createMarker(new GPoint(-83.77093500,32.90098900),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Howard Middle School",'Macon=' + Macon.length); Macon[Macon.length] = createMarker(new GPoint(-83.60768890,32.85973740),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Hunt/burdell Elementary School",'Macon=' + Macon.length); Macon[Macon.length] = createMarker(new GPoint(-83.65176392,32.82013702),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Ingram/pye Elementary School",'Macon=' + Macon.length); Macon[Macon.length] = createMarker(new GPoint(-83.59649658,32.86531067),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Jones Elementary School",'Macon=' + Macon.length); Macon[Macon.length] = createMarker(new GPoint(-83.70227814,32.81200027),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Joseph N. Neel Academy",'Macon=' + Macon.length); Macon[Macon.length] = createMarker(new GPoint(-83.69477844,32.89077377),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Lane Elementary School",'Macon=' + Macon.length); Macon[Macon.length] = createMarker(new GPoint(-83.68237500,32.89534500),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Macon Behavior Health System",'Macon=' + Macon.length); Macon[Macon.length] = createMarker(new GPoint(-83.55938300,32.82993000),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Macon Regional Youth Detention Center",'Macon=' + Macon.length); Macon[Macon.length] = createMarker(new GPoint(-83.55842100,32.82941500),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Macon Youth Development Campus",'Macon=' + Macon.length); Macon[Macon.length] = createMarker(new GPoint(-83.60054779,32.85956192),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Martin Luther King Elementary School",'Macon=' + Macon.length); Macon[Macon.length] = createMarker(new GPoint(-83.67347717,32.80613708),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Mcevoy Middle School",'Macon=' + Macon.length); Macon[Macon.length] = createMarker(new GPoint(-83.68555300,32.86305900),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Middle Georgia Psychoeducational Program",'Macon=' + Macon.length); Macon[Macon.length] = createMarker(new GPoint(-83.65676117,32.84019089),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Miller Magnet Middle School",'Macon=' + Macon.length); Macon[Macon.length] = createMarker(new GPoint(-83.71356201,32.81386185),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Morgan Elementary School",'Macon=' + Macon.length); Macon[Macon.length] = createMarker(new GPoint(-83.71356201,32.81386185),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Morgan Magnet School",'Macon=' + Macon.length); Macon[Macon.length] = createMarker(new GPoint(-83.61948395,32.86699295),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Northeast High School",'Macon=' + Macon.length); Macon[Macon.length] = createMarker(new GPoint(-83.69373322,32.73764420),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Porter Elementary School",'Macon=' + Macon.length); Lizella[Lizella.length] = createMarker(new GPoint(-83.81501770,32.80541229),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Redding Elementary School",'Lizella=' + Lizella.length); Macon[Macon.length] = createMarker(new GPoint(-83.70227814,32.81200027),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Renaissance Academy",'Macon=' + Macon.length); Macon[Macon.length] = createMarker(new GPoint(-83.69279480,32.79585648),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Rice Elementary School",'Macon=' + Macon.length); Macon[Macon.length] = createMarker(new GPoint(-83.68995667,32.83406448),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Riley Elementary School",'Macon=' + Macon.length); Macon[Macon.length] = createMarker(new GPoint(-83.70227814,32.81200027),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Rutland High School",'Macon=' + Macon.length); Macon[Macon.length] = createMarker(new GPoint(-83.70227814,32.81200027),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Rutland Middle School",'Macon=' + Macon.length); Lizella[Lizella.length] = createMarker(new GPoint(-83.76400757,32.74988174),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Skyview Elementary School",'Lizella=' + Lizella.length); Macon[Macon.length] = createMarker(new GPoint(-83.65820312,32.81992722),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Southeast High School",'Macon=' + Macon.length); Macon[Macon.length] = createMarker(new GPoint(-83.67472839,32.80951691),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Southwest High School",'Macon=' + Macon.length); Macon[Macon.length] = createMarker(new GPoint(-83.71915436,32.90400314),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Springdale Elementary School",'Macon=' + Macon.length); Macon[Macon.length] = createMarker(new GPoint(-83.66213226,32.86782837),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Taylor At Tinsley Elementary School",'Macon=' + Macon.length); Macon[Macon.length] = createMarker(new GPoint(-83.67812347,32.87696457),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Taylor Elementary School",'Macon=' + Macon.length); Macon[Macon.length] = createMarker(new GPoint(-83.70227814,32.81200027),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Teen Parent Center",'Macon=' + Macon.length); Macon[Macon.length] = createMarker(new GPoint(-83.72148895,32.83567047),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Union Elementary School",'Macon=' + Macon.length); Macon[Macon.length] = createMarker(new GPoint(-83.65534210,32.84519958),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Vineville Academy",'Macon=' + Macon.length); Macon[Macon.length] = createMarker(new GPoint(-83.74513245,32.82678223),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Weaver Middle School",'Macon=' + Macon.length); Macon[Macon.length] = createMarker(new GPoint(-83.65873718,32.79141235),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Weir Elementary School",'Macon=' + Macon.length); Macon[Macon.length] = createMarker(new GPoint(-83.74565887,32.81690979),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Westside High School",'Macon=' + Macon.length); Macon[Macon.length] = createMarker(new GPoint(-83.64517975,32.85586929),"",iconGr); mySelect.options[mySelect.options.length] = new Option("William S. Hutchings Career Center",'Macon=' + Macon.length); Macon[Macon.length] = createMarker(new GPoint(-83.64659882,32.84527969),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Williams Elementary School",'Macon=' + Macon.length); Macon[Macon.length] = createMarker(new GPoint(-83.66180420,32.83482361),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Winship Magnet School",'Macon=' + Macon.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(Lizella); map.removeOverlays(Macon); 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(Macon);map.removeOverlays(Lizella); map.removeOverlays(Macon); map.addOverlays(Lizella); centerByArray(Lizella, false, false); cntMarker += Lizella.length; map.addOverlays(Macon); centerByArray(Macon, false, false); cntMarker += Macon.length; centerByArray(Macon,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'); } }