function addMarkers() { mySelect = document.getElementById('selection'); Lafayette = [];Battle_Ground = [];West_Lafayette = [];Dayton = [];mySelect.options[mySelect.options.length] = new Option("Battle Ground schools",'all=Battle_Ground'); mySelect.options[mySelect.options.length] = new Option("Dayton schools",'all=Dayton'); mySelect.options[mySelect.options.length] = new Option("Lafayette schools",'all=Lafayette'); mySelect.options[mySelect.options.length] = new Option("West Lafayette schools",'all=West_Lafayette'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Lafayette[Lafayette.length] = createMarker(new GPoint(-86.88578033,40.37868118),"
Amelia Earhart Elementary School
3280 S 9th St
Lafayette, IN 47909

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Amelia Earhart Elementary School",'Lafayette=' + Lafayette.length); Battle_Ground[Battle_Ground.length] = createMarker(new GPoint(-86.83508301,40.51095581),"
Battle Ground Elementary School
303 Main St
Battle Ground, IN 47920

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Battle Ground Elementary School",'Battle_Ground=' + Battle_Ground.length); Battle_Ground[Battle_Ground.length] = createMarker(new GPoint(-86.83074951,40.51246262),"
Battle Ground Middle School
511 Main St
Battle Ground, IN 47920

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Battle Ground Middle School",'Battle_Ground=' + Battle_Ground.length); West_Lafayette[West_Lafayette.length] = createMarker(new GPoint(-86.91591644,40.50087357),"
Burnett Creek Elementary School
5700 N 50 W
West Lafayette, IN 47906

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Burnett Creek Elementary School",'West_Lafayette=' + West_Lafayette.length); West_Lafayette[West_Lafayette.length] = createMarker(new GPoint(-86.90618134,40.46063614),"
Cumberland Elementary School
600 Cumberland Ave
West Lafayette, IN 47906

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Cumberland Elementary School",'West_Lafayette=' + West_Lafayette.length); Dayton[Dayton.length] = createMarker(new GPoint(-86.76999664,40.37409973),"
Dayton Elementary School
Po Box 187 - 320 College St
Dayton, IN 47941

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Dayton Elementary School",'Dayton=' + Dayton.length); Lafayette[Lafayette.length] = createMarker(new GPoint(-86.76322174,40.46093369),"
East Tipp Middle School
7501 E 300 N
Lafayette, IN 47905

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("East Tipp Middle School",'Lafayette=' + Lafayette.length); Lafayette[Lafayette.length] = createMarker(new GPoint(-86.87648010,40.38771820),"
Edgelea Elementary School
2910 S 18th St
Lafayette, IN 47909

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Edgelea Elementary School",'Lafayette=' + Lafayette.length); Lafayette[Lafayette.length] = createMarker(new GPoint(-86.87673187,40.39854813),"
George R Durgan Elementary School
1840 S 18th St
Lafayette, IN 47905

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("George R Durgan Elementary School",'Lafayette=' + Lafayette.length); Lafayette[Lafayette.length] = createMarker(new GPoint(-86.84179687,40.42985153),"
Glen Acres Elementary School
3767 Kimberly Dr
Lafayette, IN 47905

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Glen Acres Elementary School",'Lafayette=' + Lafayette.length); Lafayette[Lafayette.length] = createMarker(new GPoint(-86.90239716,40.31819916),"
Greater Lafayette Area Se
2300 Cason St
Lafayette, IN 47904

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Greater Lafayette Area Se",'Lafayette=' + Lafayette.length); West_Lafayette[West_Lafayette.length] = createMarker(new GPoint(-86.90612030,40.43759155),"
Happy Hollow Elementary School
1200 N Salisbury
West Lafayette, IN 47906

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Happy Hollow Elementary School",'West_Lafayette=' + West_Lafayette.length); Lafayette[Lafayette.length] = createMarker(new GPoint(-86.76296234,40.46093750),"
Hershey Elementary School
7521 E 300 N
Lafayette, IN 47905

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Hershey Elementary School",'Lafayette=' + Lafayette.length); Lafayette[Lafayette.length] = createMarker(new GPoint(-86.78430176,40.28733826),"
James Cole Elementary School
6418 E 900 S
Lafayette, IN 47909

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("James Cole Elementary School",'Lafayette=' + Lafayette.length); Lafayette[Lafayette.length] = createMarker(new GPoint(-86.87638092,40.39878464),"
Jefferson High School
1801 S 18th St
Lafayette, IN 47905

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Jefferson High School",'Lafayette=' + Lafayette.length); West_Lafayette[West_Lafayette.length] = createMarker(new GPoint(-86.96224213,40.46436310),"
Klondike Elementary School
3311 Klondike Rd
West Lafayette, IN 47906

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Klondike Elementary School",'West_Lafayette=' + West_Lafayette.length); West_Lafayette[West_Lafayette.length] = createMarker(new GPoint(-86.96224213,40.46430206),"
Klondike Middle School
3307 Klondike Rd
West Lafayette, IN 47906

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Klondike Middle School",'West_Lafayette=' + West_Lafayette.length); Lafayette[Lafayette.length] = createMarker(new GPoint(-86.88233185,40.43316269),"
Linnwood Elementary School
1415 Ball St
Lafayette, IN 47904

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Linnwood Elementary School",'Lafayette=' + Lafayette.length); Lafayette[Lafayette.length] = createMarker(new GPoint(-86.90165710,40.34528732),"
Mayflower Mill Elementary School
200 E 500 S
Lafayette, IN 47909

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Mayflower Mill Elementary School",'Lafayette=' + Lafayette.length); Lafayette[Lafayette.length] = createMarker(new GPoint(-86.87470245,40.41642761),"
Mccutcheon High School
4951 Us 231 S
Lafayette, IN 47909

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Mccutcheon High School",'Lafayette=' + Lafayette.length); Lafayette[Lafayette.length] = createMarker(new GPoint(-86.86970520,40.38796234),"
Miami Elementary School
2401 Beck Ln
Lafayette, IN 47909

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Miami Elementary School",'Lafayette=' + Lafayette.length); Lafayette[Lafayette.length] = createMarker(new GPoint(-86.94237518,40.30133820),"
Mintonye Elementary School
2000 W 800 S
Lafayette, IN 47909

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Mintonye Elementary School",'Lafayette=' + Lafayette.length); Lafayette[Lafayette.length] = createMarker(new GPoint(-86.87444305,40.42082214),"
Murdock Elementary School
2100 Cason St
Lafayette, IN 47904

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Murdock Elementary School",'Lafayette=' + Lafayette.length); West_Lafayette[West_Lafayette.length] = createMarker(new GPoint(-86.90239716,40.31819916),"
New Community School
620 Cumberland Ave
West Lafayette, IN 47906

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("New Community School",'West_Lafayette=' + West_Lafayette.length); Lafayette[Lafayette.length] = createMarker(new GPoint(-86.87269592,40.41106796),"
Oakland Elementary School
611 S 21st St
Lafayette, IN 47904

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Oakland Elementary School",'Lafayette=' + Lafayette.length); Lafayette[Lafayette.length] = createMarker(new GPoint(-86.94417572,40.30133820),"
Southwestern Middle School
2100 W 800 S
Lafayette, IN 47905

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Southwestern Middle School",'Lafayette=' + Lafayette.length); Lafayette[Lafayette.length] = createMarker(new GPoint(-86.86858368,40.42070389),"
Sunnyside Middle School
2500 Cason St
Lafayette, IN 47904

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Sunnyside Middle School",'Lafayette=' + Lafayette.length); Lafayette[Lafayette.length] = createMarker(new GPoint(-86.87470245,40.41642761),"
Tecumseh Middle School
2101 S 18th St
Lafayette, IN 47905

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Tecumseh Middle School",'Lafayette=' + Lafayette.length); Lafayette[Lafayette.length] = createMarker(new GPoint(-86.89318085,40.40976334),"
Thomas Miller Elementary School
700 S 4th St
Lafayette, IN 47905

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Thomas Miller Elementary School",'Lafayette=' + Lafayette.length); Lafayette[Lafayette.length] = createMarker(new GPoint(-86.86332703,40.43429947),"
Vinton Elementary School
3101 Elmwood Ave
Lafayette, IN 47904

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Vinton Elementary School",'Lafayette=' + Lafayette.length); Lafayette[Lafayette.length] = createMarker(new GPoint(-86.76111603,40.31567383),"
Wainwright Middle School
7501 E 700 S
Lafayette, IN 47905

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Wainwright Middle School",'Lafayette=' + Lafayette.length); Lafayette[Lafayette.length] = createMarker(new GPoint(-86.88481903,40.42373657),"
Washington Elementary School
1100 Elizabeth St
Lafayette, IN 47904

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Washington Elementary School",'Lafayette=' + Lafayette.length); Lafayette[Lafayette.length] = createMarker(new GPoint(-86.87881470,40.35614395),"
Wea Ridge Elementary School
1333 E 430 S
Lafayette, IN 47909

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Wea Ridge Elementary School",'Lafayette=' + Lafayette.length); Lafayette[Lafayette.length] = createMarker(new GPoint(-86.90239716,40.31819916),"
Wea Ridge Middle School
4410 S 150 E
Lafayette, IN 47909

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Wea Ridge Middle School",'Lafayette=' + Lafayette.length); West_Lafayette[West_Lafayette.length] = createMarker(new GPoint(-86.91078186,40.43568802),"
West Lafayette Jr/sr High School
1105 N Grant St
West Lafayette, IN 47906

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("West Lafayette Jr/sr High School",'West_Lafayette=' + West_Lafayette.length); West_Lafayette[West_Lafayette.length] = createMarker(new GPoint(-86.91628265,40.50088882),"
William Henry Harrison High School
5701 N 50 W
West Lafayette, IN 47906

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("William Henry Harrison High School",'West_Lafayette=' + West_Lafayette.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(Battle_Ground); map.removeOverlays(Dayton); map.removeOverlays(Lafayette); map.removeOverlays(West_Lafayette); 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(Lafayette);map.removeOverlays(Battle_Ground); map.removeOverlays(Dayton); map.removeOverlays(Lafayette); map.removeOverlays(West_Lafayette); map.addOverlays(Battle_Ground); centerByArray(Battle_Ground, false, false); cntMarker += Battle_Ground.length; map.addOverlays(Dayton); centerByArray(Dayton, false, false); cntMarker += Dayton.length; map.addOverlays(Lafayette); centerByArray(Lafayette, false, false); cntMarker += Lafayette.length; map.addOverlays(West_Lafayette); centerByArray(West_Lafayette, false, false); cntMarker += West_Lafayette.length; centerByArray(Lafayette,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'); } }