function addMarkers() { mySelect = document.getElementById('selection'); Warsaw = [];Atwood = [];Burket = [];Claypool = [];Winona_Lake = [];Leesburg = [];Mentone = [];Milford = [];North_Webster = [];Pierceton = [];Silver_Lake = [];Syracuse = [];Akron = [];mySelect.options[mySelect.options.length] = new Option("Akron schools",'all=Akron'); mySelect.options[mySelect.options.length] = new Option("Atwood schools",'all=Atwood'); mySelect.options[mySelect.options.length] = new Option("Burket schools",'all=Burket'); mySelect.options[mySelect.options.length] = new Option("Claypool schools",'all=Claypool'); mySelect.options[mySelect.options.length] = new Option("Leesburg schools",'all=Leesburg'); mySelect.options[mySelect.options.length] = new Option("Mentone schools",'all=Mentone'); mySelect.options[mySelect.options.length] = new Option("Milford schools",'all=Milford'); mySelect.options[mySelect.options.length] = new Option("North Webster schools",'all=North_Webster'); mySelect.options[mySelect.options.length] = new Option("Pierceton schools",'all=Pierceton'); mySelect.options[mySelect.options.length] = new Option("Silver Lake schools",'all=Silver_Lake'); mySelect.options[mySelect.options.length] = new Option("Syracuse schools",'all=Syracuse'); mySelect.options[mySelect.options.length] = new Option("Warsaw schools",'all=Warsaw'); mySelect.options[mySelect.options.length] = new Option("Winona Lake schools",'all=Winona_Lake'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Warsaw[Warsaw.length] = createMarker(new GPoint(-85.84697900,41.23434000),"
Alternative Learning Center
850 E Smith St
Warsaw, IN 46580

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Alternative Learning Center",'Warsaw=' + Warsaw.length); Atwood[Atwood.length] = createMarker(new GPoint(-85.97852325,41.26182175),"
Atwood Elementary School
2134 N 700 W Po Box 128
Atwood, IN 46502

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Atwood Elementary School",'Atwood=' + Atwood.length); Burket[Burket.length] = createMarker(new GPoint(-85.96900177,41.15570068),"
Burket Elementary School
Box 8
Burket, IN 46508

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Burket Elementary School",'Burket=' + Burket.length); Claypool[Claypool.length] = createMarker(new GPoint(-85.87496948,41.13016129),"
Claypool Elementary School
2024 W 700 S
Claypool, IN 46510

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Claypool Elementary School",'Claypool=' + Claypool.length); Warsaw[Warsaw.length] = createMarker(new GPoint(-85.86190033,41.22888565),"
Edgewood Middle School
900 S Union
Warsaw, IN 46580

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Edgewood Middle School",'Warsaw=' + Warsaw.length); Warsaw[Warsaw.length] = createMarker(new GPoint(-85.85222626,41.20868683),"
Eisenhower Elementary School
1900 S County Farm Rd
Warsaw, IN 46580

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Eisenhower Elementary School",'Warsaw=' + Warsaw.length); Warsaw[Warsaw.length] = createMarker(new GPoint(-85.82317352,41.24889755),"
Harrison Elementary School
1300 Husky Trl
Warsaw, IN 46582

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Harrison Elementary School",'Warsaw=' + Warsaw.length); Winona_Lake[Winona_Lake.length] = createMarker(new GPoint(-85.81629944,41.22537613),"
Jefferson Elementary School
100 Seminary Dr
Winona Lake, IN 46590

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Jefferson Elementary School",'Winona_Lake=' + Winona_Lake.length); Warsaw[Warsaw.length] = createMarker(new GPoint(-85.84535980,41.23426437),"
Lakeview Middle School
848 E Smith St
Warsaw, IN 46580

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Lakeview Middle School",'Warsaw=' + Warsaw.length); Leesburg[Leesburg.length] = createMarker(new GPoint(-85.77510071,41.31850052),"
Leesburg Elementary School
Po Box 247
Leesburg, IN 46538

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Leesburg Elementary School",'Leesburg=' + Leesburg.length); Warsaw[Warsaw.length] = createMarker(new GPoint(-85.83218384,41.23915482),"
Lincoln Elementary School
203 N Lincoln St
Warsaw, IN 46580

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Lincoln Elementary School",'Warsaw=' + Warsaw.length); Warsaw[Warsaw.length] = createMarker(new GPoint(-85.86228180,41.23924637),"
Madison Elementary School
201 N Union St
Warsaw, IN 46580

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Madison Elementary School",'Warsaw=' + Warsaw.length); Mentone[Mentone.length] = createMarker(new GPoint(-86.03498840,41.17335129),"
Mentone Elementary School
Po Box 457
Mentone, IN 46539

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Mentone Elementary School",'Mentone=' + Mentone.length); Milford[Milford.length] = createMarker(new GPoint(-85.85209656,41.40399933),"
Milford School
Po Box 548
Milford, IN 46542

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Milford School",'Milford=' + Milford.length); Warsaw[Warsaw.length] = createMarker(new GPoint(-85.88771820,41.24250031),"
N Central Indiana Sp Ed Co-op
Po Box 288
Warsaw, IN 46581

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("N Central Indiana Sp Ed Co-op",'Warsaw=' + Warsaw.length); North_Webster[North_Webster.length] = createMarker(new GPoint(-85.68789673,41.32550049),"
North Webster Elementary School
Po Box 358
North Webster, IN 46555

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("North Webster Elementary School",'North_Webster=' + North_Webster.length); Pierceton[Pierceton.length] = createMarker(new GPoint(-85.70030212,41.21799850),"
Pierceton Elementary School
Po Box 94
Pierceton, IN 46562

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Pierceton Elementary School",'Pierceton=' + Pierceton.length); Silver_Lake[Silver_Lake.length] = createMarker(new GPoint(-85.90470123,41.06449890),"
Silver Lake Elementary School
Po Box 99
Silver Lake, IN 46982

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Silver Lake Elementary School",'Silver_Lake=' + Silver_Lake.length); Syracuse[Syracuse.length] = createMarker(new GPoint(-85.75355530,41.42433548),"
Syracuse Elementary School
502 W Brooklyn St
Syracuse, IN 46567

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Syracuse Elementary School",'Syracuse=' + Syracuse.length); Akron[Akron.length] = createMarker(new GPoint(-86.02793121,41.03767014),"
Tippecanoe Valley High School
8345 S Sr 19
Akron, IN 46910

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Tippecanoe Valley High School",'Akron=' + Akron.length); Akron[Akron.length] = createMarker(new GPoint(-86.04402924,41.11436081),"
Tippecanoe Valley Middle School
11303 W 800 S
Akron, IN 46910

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Tippecanoe Valley Middle School",'Akron=' + Akron.length); Warsaw[Warsaw.length] = createMarker(new GPoint(-85.86288452,41.22286606),"
Warsaw Community High School
1 Tiger Ln
Warsaw, IN 46580

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Warsaw Community High School",'Warsaw=' + Warsaw.length); Warsaw[Warsaw.length] = createMarker(new GPoint(-85.86038971,41.22650528),"
Washington Elementary School
423 W Kincaide St
Warsaw, IN 46580

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Washington Elementary School",'Warsaw=' + Warsaw.length); Syracuse[Syracuse.length] = createMarker(new GPoint(-85.71340179,41.39270020),"
Wawasee High School
1 Warrior Path
Syracuse, IN 46567

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Wawasee High School",'Syracuse=' + Syracuse.length); Syracuse[Syracuse.length] = createMarker(new GPoint(-85.75302800,41.42810600),"
Wawasee Middle School
9850 N Sr 13
Syracuse, IN 46567

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Wawasee Middle School",'Syracuse=' + Syracuse.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(Akron); map.removeOverlays(Atwood); map.removeOverlays(Burket); map.removeOverlays(Claypool); map.removeOverlays(Leesburg); map.removeOverlays(Mentone); map.removeOverlays(Milford); map.removeOverlays(North_Webster); map.removeOverlays(Pierceton); map.removeOverlays(Silver_Lake); map.removeOverlays(Syracuse); map.removeOverlays(Warsaw); map.removeOverlays(Winona_Lake); 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(Warsaw);map.removeOverlays(Akron); map.removeOverlays(Atwood); map.removeOverlays(Burket); map.removeOverlays(Claypool); map.removeOverlays(Leesburg); map.removeOverlays(Mentone); map.removeOverlays(Milford); map.removeOverlays(North_Webster); map.removeOverlays(Pierceton); map.removeOverlays(Silver_Lake); map.removeOverlays(Syracuse); map.removeOverlays(Warsaw); map.removeOverlays(Winona_Lake); map.addOverlays(Akron); centerByArray(Akron, false, false); cntMarker += Akron.length; map.addOverlays(Atwood); centerByArray(Atwood, false, false); cntMarker += Atwood.length; map.addOverlays(Burket); centerByArray(Burket, false, false); cntMarker += Burket.length; map.addOverlays(Claypool); centerByArray(Claypool, false, false); cntMarker += Claypool.length; map.addOverlays(Leesburg); centerByArray(Leesburg, false, false); cntMarker += Leesburg.length; map.addOverlays(Mentone); centerByArray(Mentone, false, false); cntMarker += Mentone.length; map.addOverlays(Milford); centerByArray(Milford, false, false); cntMarker += Milford.length; map.addOverlays(North_Webster); centerByArray(North_Webster, false, false); cntMarker += North_Webster.length; map.addOverlays(Pierceton); centerByArray(Pierceton, false, false); cntMarker += Pierceton.length; map.addOverlays(Silver_Lake); centerByArray(Silver_Lake, false, false); cntMarker += Silver_Lake.length; map.addOverlays(Syracuse); centerByArray(Syracuse, false, false); cntMarker += Syracuse.length; map.addOverlays(Warsaw); centerByArray(Warsaw, false, false); cntMarker += Warsaw.length; map.addOverlays(Winona_Lake); centerByArray(Winona_Lake, false, false); cntMarker += Winona_Lake.length; centerByArray(Warsaw,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'); } }