function addMarkers() { mySelect = document.getElementById('selection'); Avon = [];Plainfield = [];Brownsburg = [];Clayton = [];Danville = [];Amo = [];North_Salem = [];Pittsboro = [];Lizton = [];mySelect.options[mySelect.options.length] = new Option("Amo schools",'all=Amo'); mySelect.options[mySelect.options.length] = new Option("Avon schools",'all=Avon'); mySelect.options[mySelect.options.length] = new Option("Brownsburg schools",'all=Brownsburg'); mySelect.options[mySelect.options.length] = new Option("Clayton schools",'all=Clayton'); mySelect.options[mySelect.options.length] = new Option("Danville schools",'all=Danville'); mySelect.options[mySelect.options.length] = new Option("Lizton schools",'all=Lizton'); mySelect.options[mySelect.options.length] = new Option("North Salem schools",'all=North_Salem'); mySelect.options[mySelect.options.length] = new Option("Pittsboro schools",'all=Pittsboro'); mySelect.options[mySelect.options.length] = new Option("Plainfield schools",'all=Plainfield'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Avon[Avon.length] = createMarker(new GPoint(-86.39958191,39.76279068),"
Avon High School
7575 E Cr 150 S
Avon, IN 46123

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Avon High School",'Avon=' + Avon.length); Avon[Avon.length] = createMarker(new GPoint(-86.39958191,39.76279068),"
Avon Intermediate School
174 S Sr 267
Avon, IN 46123

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Avon Intermediate School",'Avon=' + Avon.length); Avon[Avon.length] = createMarker(new GPoint(-86.39954600,39.76019700),"
Avon Intermediate School West
176 S Sr 267
Avon, IN 46123

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Avon Intermediate School West",'Avon=' + Avon.length); Avon[Avon.length] = createMarker(new GPoint(-86.39556122,39.76274872),"
Avon Middle School
7199 E Us Hwy 36
Avon, IN 46123

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Avon Middle School",'Avon=' + Avon.length); Plainfield[Plainfield.length] = createMarker(new GPoint(-86.38047791,39.70293808),"
Brentwood Elementary School
1630 E Oliver St
Plainfield, IN 46168

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Brentwood Elementary School",'Plainfield=' + Plainfield.length); Brownsburg[Brownsburg.length] = createMarker(new GPoint(-86.38917542,39.83838272),"
Brown Elementary School
340 Stadium Dr
Brownsburg, IN 46112

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Brown Elementary School",'Brownsburg=' + Brownsburg.length); Brownsburg[Brownsburg.length] = createMarker(new GPoint(-86.38726807,39.82846069),"
Brownsburg High School
1000 S Odell St
Brownsburg, IN 46112

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Brownsburg High School",'Brownsburg=' + Brownsburg.length); Brownsburg[Brownsburg.length] = createMarker(new GPoint(-86.38674927,39.82196426),"
Brownsburg Junior High School
1555 S Odell St
Brownsburg, IN 46112

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Brownsburg Junior High School",'Brownsburg=' + Brownsburg.length); Brownsburg[Brownsburg.length] = createMarker(new GPoint(-86.38221741,39.81923676),"
Cardinal Elementary School
1900 S Hornaday Rd
Brownsburg, IN 46112

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Cardinal Elementary School",'Brownsburg=' + Brownsburg.length); Clayton[Clayton.length] = createMarker(new GPoint(-86.52191925,39.68899155),"
Cascade Junior High School
6423 S Cr 200 W
Clayton, IN 46118

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Cascade Junior High School",'Clayton=' + Clayton.length); Clayton[Clayton.length] = createMarker(new GPoint(-86.52191925,39.68899155),"
Cascade Senior High School
6565 S Cr 200 W
Clayton, IN 46118

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Cascade Senior High School",'Clayton=' + Clayton.length); Plainfield[Plainfield.length] = createMarker(new GPoint(-86.39797211,39.70413589),"
Central Elementary School
110 Wabash St
Plainfield, IN 46168

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Central Elementary School",'Plainfield=' + Plainfield.length); Plainfield[Plainfield.length] = createMarker(new GPoint(-86.37538147,39.65224075),"
Charlton Jr-sr High School
501 W Main
Plainfield, IN 46168

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Charlton Jr-sr High School",'Plainfield=' + Plainfield.length); Brownsburg[Brownsburg.length] = createMarker(new GPoint(-86.39372253,39.84021378),"
Cooperative Achievement Program High School
225 S School St
Brownsburg, IN 46112

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Cooperative Achievement Program High School",'Brownsburg=' + Brownsburg.length); Danville[Danville.length] = createMarker(new GPoint(-86.52179718,39.76549911),"
Danville Community High School
100 Warrior Way
Danville, IN 46122

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Danville Community High School",'Danville=' + Danville.length); Danville[Danville.length] = createMarker(new GPoint(-86.52179718,39.76549911),"
Danville Middle School
49 N Wayne St
Danville, IN 46122

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Danville Middle School",'Danville=' + Danville.length); Brownsburg[Brownsburg.length] = createMarker(new GPoint(-86.38224792,39.81983948),"
Delaware Trail Elementary School
1800 S Hornaday Rd
Brownsburg, IN 46112

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Delaware Trail Elementary School",'Brownsburg=' + Brownsburg.length); Brownsburg[Brownsburg.length] = createMarker(new GPoint(-86.38941193,39.82863998),"
Eagle Elementary School
555 Sycamore
Brownsburg, IN 46112

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Eagle Elementary School",'Brownsburg=' + Brownsburg.length); Avon[Avon.length] = createMarker(new GPoint(-86.37162018,39.76776123),"
Hickory Elementary School
907 S Sr 267
Avon, IN 46123

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Hickory Elementary School",'Avon=' + Avon.length); Brownsburg[Brownsburg.length] = createMarker(new GPoint(-86.38917542,39.83911896),"
Lincoln Elementary School
1250 E Airport Rd
Brownsburg, IN 46112

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Lincoln Elementary School",'Brownsburg=' + Brownsburg.length); Avon[Avon.length] = createMarker(new GPoint(-86.39482880,39.76276398),"
Maple Elementary School
7237 E Us Hwy 36
Avon, IN 46123

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Maple Elementary School",'Avon=' + Avon.length); Clayton[Clayton.length] = createMarker(new GPoint(-86.52327728,39.69131088),"
Mill Creek East Elementary School
4740 Iowa St
Clayton, IN 46118

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Mill Creek East Elementary School",'Clayton=' + Clayton.length); Amo[Amo.length] = createMarker(new GPoint(-86.61380005,39.68899918),"
Mill Creek West Elementary School
Box 128-4704 Pearl St
Amo, IN 46103

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Mill Creek West Elementary School",'Amo=' + Amo.length); Danville[Danville.length] = createMarker(new GPoint(-86.52179718,39.76549911),"
North Elementary School
398 Urban St
Danville, IN 46122

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("North Elementary School",'Danville=' + Danville.length); North_Salem[North_Salem.length] = createMarker(new GPoint(-86.64489746,39.85720062),"
North Salem Elementary School
Po Box 69
North Salem, IN 46165

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("North Salem Elementary School",'North_Salem=' + North_Salem.length); Avon[Avon.length] = createMarker(new GPoint(-86.39958191,39.76279068),"
Pine Tree Elementary School
7866 E Cr 100 S
Avon, IN 46123

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Pine Tree Elementary School",'Avon=' + Avon.length); Pittsboro[Pittsboro.length] = createMarker(new GPoint(-86.46807861,39.86573029),"
Pittsboro School
206 N Meridian St
Pittsboro, IN 46167

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Pittsboro School",'Pittsboro=' + Pittsboro.length); Plainfield[Plainfield.length] = createMarker(new GPoint(-86.37746429,39.70434952),"
Plainfield Com Middle School
401 Elm Dr
Plainfield, IN 46168

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Plainfield Com Middle School",'Plainfield=' + Plainfield.length); Plainfield[Plainfield.length] = createMarker(new GPoint(-86.39180756,39.69676208),"
Plainfield High School
709 Stafford Rd
Plainfield, IN 46168

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Plainfield High School",'Plainfield=' + Plainfield.length); Plainfield[Plainfield.length] = createMarker(new GPoint(-86.39122009,39.69676208),"
Plainfield Kindergarten Center
757 Stafford Rd
Plainfield, IN 46168

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Plainfield Kindergarten Center",'Plainfield=' + Plainfield.length); Danville[Danville.length] = createMarker(new GPoint(-86.54189301,39.75297928),"
South Elementary School
1375 W Lincoln St
Danville, IN 46122

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("South Elementary School",'Danville=' + Danville.length); Avon[Avon.length] = createMarker(new GPoint(-86.39958191,39.76279068),"
Sycamore Elementary School
7878 E Cr 100 N
Avon, IN 46123

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Sycamore Elementary School",'Avon=' + Avon.length); Lizton[Lizton.length] = createMarker(new GPoint(-86.55190277,39.88669968),"
Tri-west Middle School
555 W Us Hwy 136
Lizton, IN 46149

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Tri-west Middle School",'Lizton=' + Lizton.length); Lizton[Lizton.length] = createMarker(new GPoint(-86.54910278,39.88800049),"
Tri-west Senior High School
Po Box 10 - 7883 N Sr 39
Lizton, IN 46149

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Tri-west Senior High School",'Lizton=' + Lizton.length); Plainfield[Plainfield.length] = createMarker(new GPoint(-86.39575958,39.70338058),"
Van Buren Elementary School
233 S Shaw St
Plainfield, IN 46168

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Van Buren Elementary School",'Plainfield=' + Plainfield.length); Brownsburg[Brownsburg.length] = createMarker(new GPoint(-86.34121704,39.82239914),"
White Lick Elementary School
1400 S Odell St
Brownsburg, IN 46112

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("White Lick Elementary School",'Brownsburg=' + Brownsburg.length); Avon[Avon.length] = createMarker(new GPoint(-86.39524841,39.76276398),"
White Oak Elementary School
7221 E Us Hwy 36
Avon, IN 46123

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("White Oak Elementary School",'Avon=' + Avon.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(Amo); map.removeOverlays(Avon); map.removeOverlays(Brownsburg); map.removeOverlays(Clayton); map.removeOverlays(Danville); map.removeOverlays(Lizton); map.removeOverlays(North_Salem); map.removeOverlays(Pittsboro); map.removeOverlays(Plainfield); 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(Avon);map.removeOverlays(Amo); map.removeOverlays(Avon); map.removeOverlays(Brownsburg); map.removeOverlays(Clayton); map.removeOverlays(Danville); map.removeOverlays(Lizton); map.removeOverlays(North_Salem); map.removeOverlays(Pittsboro); map.removeOverlays(Plainfield); map.addOverlays(Amo); centerByArray(Amo, false, false); cntMarker += Amo.length; map.addOverlays(Avon); centerByArray(Avon, false, false); cntMarker += Avon.length; map.addOverlays(Brownsburg); centerByArray(Brownsburg, false, false); cntMarker += Brownsburg.length; map.addOverlays(Clayton); centerByArray(Clayton, false, false); cntMarker += Clayton.length; map.addOverlays(Danville); centerByArray(Danville, false, false); cntMarker += Danville.length; map.addOverlays(Lizton); centerByArray(Lizton, false, false); cntMarker += Lizton.length; map.addOverlays(North_Salem); centerByArray(North_Salem, false, false); cntMarker += North_Salem.length; map.addOverlays(Pittsboro); centerByArray(Pittsboro, false, false); cntMarker += Pittsboro.length; map.addOverlays(Plainfield); centerByArray(Plainfield, false, false); cntMarker += Plainfield.length; centerByArray(Avon,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'); } }