function addMarkers() { mySelect = document.getElementById('selection'); Bloomington = [];Ellettsville = [];Stinesville = [];Unionville = [];mySelect.options[mySelect.options.length] = new Option("Bloomington schools",'all=Bloomington'); mySelect.options[mySelect.options.length] = new Option("Ellettsville schools",'all=Ellettsville'); mySelect.options[mySelect.options.length] = new Option("Stinesville schools",'all=Stinesville'); mySelect.options[mySelect.options.length] = new Option("Unionville schools",'all=Unionville'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Bloomington[Bloomington.length] = createMarker(new GPoint(-86.54217529,39.18653870),"
Arlington Heights Elementary School
800 Gourley Pike
Bloomington, IN 47404

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Arlington Heights Elementary School",'Bloomington=' + Bloomington.length); Bloomington[Bloomington.length] = createMarker(new GPoint(-86.54092407,39.17078781),"
Aurora Alternative School
524 N Fairview St
Bloomington, IN 47404

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Aurora Alternative School",'Bloomington=' + Bloomington.length); Bloomington[Bloomington.length] = createMarker(new GPoint(-86.50563049,39.16085815),"
Binford Elementary School
2300 E Second St
Bloomington, IN 47401

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Binford Elementary School",'Bloomington=' + Bloomington.length); Bloomington[Bloomington.length] = createMarker(new GPoint(-86.54753113,39.20400620),"
Bloomington High School North
3901 Kinser Pike
Bloomington, IN 47404

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bloomington High School North",'Bloomington=' + Bloomington.length); Bloomington[Bloomington.length] = createMarker(new GPoint(-86.53123474,39.14275742),"
Bloomington High School South
1965 S Walnut St
Bloomington, IN 47401

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bloomington High School South",'Bloomington=' + Bloomington.length); Bloomington[Bloomington.length] = createMarker(new GPoint(-86.54131317,39.14116287),"
Broadview Elementary School
705 W Coolidge Dr
Bloomington, IN 47403

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Broadview Elementary School",'Bloomington=' + Bloomington.length); Bloomington[Bloomington.length] = createMarker(new GPoint(-86.50801849,39.13930511),"
Childs Elementary School
2211 S High St
Bloomington, IN 47401

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Childs Elementary School",'Bloomington=' + Bloomington.length); Bloomington[Bloomington.length] = createMarker(new GPoint(-86.53507996,39.11123657),"
Clear Creek Elementary School
300 Clear Creek Dr
Bloomington, IN 47403

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Clear Creek Elementary School",'Bloomington=' + Bloomington.length); Bloomington[Bloomington.length] = createMarker(new GPoint(-86.46881866,39.12889862),"
Eagle View Jr-sr High School
1500 N Packinghouse Rd
Bloomington, IN 47404

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Eagle View Jr-sr High School",'Bloomington=' + Bloomington.length); Ellettsville[Ellettsville.length] = createMarker(new GPoint(-86.62400055,39.23434067),"
Edgewood Early Childhood Cntr Elementary School
8045 W Sr 46
Ellettsville, IN 47429

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Edgewood Early Childhood Cntr Elementary School",'Ellettsville=' + Ellettsville.length); Ellettsville[Ellettsville.length] = createMarker(new GPoint(-86.63838196,39.23278046),"
Edgewood High School
601 S Edgewood Dr
Ellettsville, IN 47429

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Edgewood High School",'Ellettsville=' + Ellettsville.length); Bloomington[Bloomington.length] = createMarker(new GPoint(-86.46881866,39.12889862),"
Edgewood Intermediate School
7600 W Reeves Rd
Bloomington, IN 47404

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Edgewood Intermediate School",'Bloomington=' + Bloomington.length); Ellettsville[Ellettsville.length] = createMarker(new GPoint(-86.62400055,39.23434067),"
Edgewood Junior High School
851 W Edgewood Rd
Ellettsville, IN 47429

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Edgewood Junior High School",'Ellettsville=' + Ellettsville.length); Bloomington[Bloomington.length] = createMarker(new GPoint(-86.46881866,39.12889862),"
Edgewood Primary School
7700 W Reeves Rd
Bloomington, IN 47404

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Edgewood Primary School",'Bloomington=' + Bloomington.length); Ellettsville[Ellettsville.length] = createMarker(new GPoint(-86.62161255,39.23024750),"
Ellettsville Elementary School
200 Association St
Ellettsville, IN 47429

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Ellettsville Elementary School",'Ellettsville=' + Ellettsville.length); Bloomington[Bloomington.length] = createMarker(new GPoint(-86.54026031,39.16936111),"
Fairview Elementary School
627 W 8th St
Bloomington, IN 47404

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Fairview Elementary School",'Bloomington=' + Bloomington.length); Ellettsville[Ellettsville.length] = createMarker(new GPoint(-86.61878204,39.22496033),"
Forest Hills Spec Educ Coop
8045 W Sr 46
Ellettsville, IN 47429

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Forest Hills Spec Educ Coop",'Ellettsville=' + Ellettsville.length); Bloomington[Bloomington.length] = createMarker(new GPoint(-86.59647369,39.14223099),"
Grandview Elementary School
2300 S Endwright Rd
Bloomington, IN 47403

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Grandview Elementary School",'Bloomington=' + Bloomington.length); Bloomington[Bloomington.length] = createMarker(new GPoint(-86.59187317,39.15676117),"
Highland Park Elementary School
900 Park Square Dr
Bloomington, IN 47403

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Highland Park Elementary School",'Bloomington=' + Bloomington.length); Bloomington[Bloomington.length] = createMarker(new GPoint(-86.46881866,39.12889862),"
Hoosier Hills Career Center
3070 Prow Rd
Bloomington, IN 47404

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Hoosier Hills Career Center",'Bloomington=' + Bloomington.length); Bloomington[Bloomington.length] = createMarker(new GPoint(-86.51073456,39.12301636),"
Jackson Creek Middle School
3980 S Sare Rd
Bloomington, IN 47401

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Jackson Creek Middle School",'Bloomington=' + Bloomington.length); Bloomington[Bloomington.length] = createMarker(new GPoint(-86.52136230,39.03039932),"
Lakeview Elementary School
9090 S Strain Ridge
Bloomington, IN 47401

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Lakeview Elementary School",'Bloomington=' + Bloomington.length); Bloomington[Bloomington.length] = createMarker(new GPoint(-86.54302216,39.12183762),"
Lora L Batchelor Middle School
900 Gordon Pike
Bloomington, IN 47403

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Lora L Batchelor Middle School",'Bloomington=' + Bloomington.length); Bloomington[Bloomington.length] = createMarker(new GPoint(-86.51578522,39.21543884),"
Marlin Elementary School
1655 E Bethel Ln
Bloomington, IN 47408

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Marlin Elementary School",'Bloomington=' + Bloomington.length); Bloomington[Bloomington.length] = createMarker(new GPoint(-86.50714111,39.16086197),"
Rogers Elementary School
2200 E 2nd St
Bloomington, IN 47401

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Rogers Elementary School",'Bloomington=' + Bloomington.length); Stinesville[Stinesville.length] = createMarker(new GPoint(-86.63002014,39.23878098),"
Stinesville Elementary School
7973 W Main St
Stinesville, IN 47464

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Stinesville Elementary School",'Stinesville=' + Stinesville.length); Bloomington[Bloomington.length] = createMarker(new GPoint(-86.54735800,39.14285300),"
Summit Elementary School
1450 W Countryside Ln
Bloomington, IN 47403

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Summit Elementary School",'Bloomington=' + Bloomington.length); Bloomington[Bloomington.length] = createMarker(new GPoint(-86.52568054,39.15169144),"
Templeton Elementary School
1400 S Brenda Ln
Bloomington, IN 47401

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Templeton Elementary School",'Bloomington=' + Bloomington.length); Bloomington[Bloomington.length] = createMarker(new GPoint(-86.54726410,39.17755127),"
Tri-north Middle School
1000 W 15th St
Bloomington, IN 47404

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Tri-north Middle School",'Bloomington=' + Bloomington.length); Unionville[Unionville.length] = createMarker(new GPoint(-86.41606140,39.22991943),"
Unionville Elementary School
8144 E Sr 45
Unionville, IN 47468

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Unionville Elementary School",'Unionville=' + Unionville.length); Bloomington[Bloomington.length] = createMarker(new GPoint(-86.48157501,39.17527008),"
University Elementary School
1111 N Russell Rd
Bloomington, IN 47408

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("University Elementary School",'Bloomington=' + Bloomington.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(Bloomington); map.removeOverlays(Ellettsville); map.removeOverlays(Stinesville); map.removeOverlays(Unionville); 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(Bloomington);map.removeOverlays(Bloomington); map.removeOverlays(Ellettsville); map.removeOverlays(Stinesville); map.removeOverlays(Unionville); map.addOverlays(Bloomington); centerByArray(Bloomington, false, false); cntMarker += Bloomington.length; map.addOverlays(Ellettsville); centerByArray(Ellettsville, false, false); cntMarker += Ellettsville.length; map.addOverlays(Stinesville); centerByArray(Stinesville, false, false); cntMarker += Stinesville.length; map.addOverlays(Unionville); centerByArray(Unionville, false, false); cntMarker += Unionville.length; centerByArray(Bloomington,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'); } }