function addMarkers() { mySelect = document.getElementById('selection'); Kokomo = [];Greentown = [];Russiaville = [];mySelect.options[mySelect.options.length] = new Option("Greentown schools",'all=Greentown'); mySelect.options[mySelect.options.length] = new Option("Kokomo schools",'all=Kokomo'); mySelect.options[mySelect.options.length] = new Option("Russiaville schools",'all=Russiaville'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Kokomo[Kokomo.length] = createMarker(new GPoint(-86.12671661,40.51525116),"
Bon Air Elementary School
2800 Apperson Way N
Kokomo, IN 46901

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Bon Air Elementary School",'Kokomo=' + Kokomo.length); Kokomo[Kokomo.length] = createMarker(new GPoint(-86.12671661,40.51520157),"
Bon Air Middle School
2796 Apperson Way N
Kokomo, IN 46901

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Bon Air Middle School",'Kokomo=' + Kokomo.length); Kokomo[Kokomo.length] = createMarker(new GPoint(-86.13369751,40.48643112),"
Boulevard Elementary School
1901 W Blvd
Kokomo, IN 46902

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Boulevard Elementary School",'Kokomo=' + Kokomo.length); Kokomo[Kokomo.length] = createMarker(new GPoint(-86.12847137,40.48537827),"
Central Middle School
303 E Superior
Kokomo, IN 46901

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Central Middle School",'Kokomo=' + Kokomo.length); Kokomo[Kokomo.length] = createMarker(new GPoint(-86.13732147,40.49722290),"
Columbian Elementary School
1234 N Courtland
Kokomo, IN 46901

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Columbian Elementary School",'Kokomo=' + Kokomo.length); Kokomo[Kokomo.length] = createMarker(new GPoint(-86.09832001,40.47763443),"
Darrough Chapel Elementary School
900 S Goyer Rd
Kokomo, IN 46902

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Darrough Chapel Elementary School",'Kokomo=' + Kokomo.length); Greentown[Greentown.length] = createMarker(new GPoint(-85.96676636,40.47564316),"
Eastern Elementary School
301 S Meridian St
Greentown, IN 46936

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Eastern Elementary School",'Greentown=' + Greentown.length); Greentown[Greentown.length] = createMarker(new GPoint(-85.97058105,40.47356415),"
Eastern Junior & Senior High School
421 S Harrison St
Greentown, IN 46936

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Eastern Junior & Senior High School",'Greentown=' + Greentown.length); Kokomo[Kokomo.length] = createMarker(new GPoint(-86.11195374,40.47752380),"
Elwood Haynes Elementary School
910 S Cooper
Kokomo, IN 46901

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Elwood Haynes Elementary School",'Kokomo=' + Kokomo.length); Kokomo[Kokomo.length] = createMarker(new GPoint(-86.06968689,40.52826309),"
Howard Elementary School
3526 N 300 E
Kokomo, IN 46901

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Howard Elementary School",'Kokomo=' + Kokomo.length); Kokomo[Kokomo.length] = createMarker(new GPoint(-86.14208221,40.43820190),"
Kokomo Area Career Center
2415 S Berkley Rd
Kokomo, IN 46902

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Kokomo Area Career Center",'Kokomo=' + Kokomo.length); Kokomo[Kokomo.length] = createMarker(new GPoint(-86.15567780,40.45595551),"
Kokomo High School
2501 S Berkley
Kokomo, IN 46902

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Kokomo High School",'Kokomo=' + Kokomo.length); Kokomo[Kokomo.length] = createMarker(new GPoint(-86.14897919,40.49367523),"
Lafayette Park Elementary School
919 N Korby St
Kokomo, IN 46901

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Lafayette Park Elementary School",'Kokomo=' + Kokomo.length); Kokomo[Kokomo.length] = createMarker(new GPoint(-86.14897919,40.49370575),"
Lafayette Park Middle School
923 N Korby St
Kokomo, IN 46901

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Lafayette Park Middle School",'Kokomo=' + Kokomo.length); Kokomo[Kokomo.length] = createMarker(new GPoint(-86.13282013,40.45528030),"
Maple Crest Elementary School
300 W Lincoln Rd
Kokomo, IN 46902

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Maple Crest Elementary School",'Kokomo=' + Kokomo.length); Kokomo[Kokomo.length] = createMarker(new GPoint(-86.13197327,40.45689011),"
Maple Crest Middle School
2727 S Washington
Kokomo, IN 46902

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Maple Crest Middle School",'Kokomo=' + Kokomo.length); Kokomo[Kokomo.length] = createMarker(new GPoint(-86.13369751,40.48643112),"
Northwestern Elementary School
4223 W Rd 350 N
Kokomo, IN 46901

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Northwestern Elementary School",'Kokomo=' + Kokomo.length); Kokomo[Kokomo.length] = createMarker(new GPoint(-86.05083466,40.52069473),"
Northwestern Middle School
3431 N 400 W
Kokomo, IN 46901

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Northwestern Middle School",'Kokomo=' + Kokomo.length); Kokomo[Kokomo.length] = createMarker(new GPoint(-86.20336151,40.52521896),"
Northwestern Senior High School
3431 N 400 W
Kokomo, IN 46901

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Northwestern Senior High School",'Kokomo=' + Kokomo.length); Kokomo[Kokomo.length] = createMarker(new GPoint(-86.14118958,40.49426270),"
Pettit Park School
901 W Havens
Kokomo, IN 46901

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Pettit Park School",'Kokomo=' + Kokomo.length); Kokomo[Kokomo.length] = createMarker(new GPoint(-86.11054230,40.48891449),"
Sycamore Elementary School
1600 E Sycamore
Kokomo, IN 46901

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Sycamore Elementary School",'Kokomo=' + Kokomo.length); Kokomo[Kokomo.length] = createMarker(new GPoint(-86.13369751,40.48643112),"
Taylor High School
3794 E Cr 300 S
Kokomo, IN 46902

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Taylor High School",'Kokomo=' + Kokomo.length); Kokomo[Kokomo.length] = createMarker(new GPoint(-86.05674744,40.43436813),"
Taylor Intermediate School
3700 E 300 S
Kokomo, IN 46902

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Taylor Intermediate School",'Kokomo=' + Kokomo.length); Kokomo[Kokomo.length] = createMarker(new GPoint(-86.13369751,40.48643112),"
Taylor Middle School
3794 E Cr 300 S
Kokomo, IN 46902

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Taylor Middle School",'Kokomo=' + Kokomo.length); Kokomo[Kokomo.length] = createMarker(new GPoint(-86.11854553,40.42671204),"
Taylor Primary School
5500 Wea Dr
Kokomo, IN 46902

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Taylor Primary School",'Kokomo=' + Kokomo.length); Kokomo[Kokomo.length] = createMarker(new GPoint(-86.16368866,40.49073792),"
Wallace Elementary School
2326 W Jefferson St
Kokomo, IN 46901

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Wallace Elementary School",'Kokomo=' + Kokomo.length); Kokomo[Kokomo.length] = createMarker(new GPoint(-86.13362122,40.46926117),"
Washington Elementary School
1500 S Washington St
Kokomo, IN 46902

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Washington Elementary School",'Kokomo=' + Kokomo.length); Russiaville[Russiaville.length] = createMarker(new GPoint(-86.27137756,40.41748047),"
Western High School
600 W 2606 S
Russiaville, IN 46979

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Western High School",'Russiaville=' + Russiaville.length); Russiaville[Russiaville.length] = createMarker(new GPoint(-86.27137756,40.41748047),"
Western Intermediate School
600 W 2607 S
Russiaville, IN 46979

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Western Intermediate School",'Russiaville=' + Russiaville.length); Russiaville[Russiaville.length] = createMarker(new GPoint(-86.27137756,40.41748047),"
Western Middle School
600 W 2600 S
Russiaville, IN 46979

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Western Middle School",'Russiaville=' + Russiaville.length); Russiaville[Russiaville.length] = createMarker(new GPoint(-86.27137756,40.41748047),"
Western Primary School
600 W 2671 S
Russiaville, IN 46979

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Western Primary School",'Russiaville=' + Russiaville.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(Greentown); map.removeOverlays(Kokomo); map.removeOverlays(Russiaville); 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(Kokomo);map.removeOverlays(Greentown); map.removeOverlays(Kokomo); map.removeOverlays(Russiaville); map.addOverlays(Greentown); centerByArray(Greentown, false, false); cntMarker += Greentown.length; map.addOverlays(Kokomo); centerByArray(Kokomo, false, false); cntMarker += Kokomo.length; map.addOverlays(Russiaville); centerByArray(Russiaville, false, false); cntMarker += Russiaville.length; centerByArray(Kokomo,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'); } }