function addMarkers() { mySelect = document.getElementById('selection'); Mount_Summit = [];New_Castle = [];Kennard = [];Knightstown = [];Middletown = [];Spiceland = [];Straughn = [];mySelect.options[mySelect.options.length] = new Option("Kennard schools",'all=Kennard'); mySelect.options[mySelect.options.length] = new Option("Knightstown schools",'all=Knightstown'); mySelect.options[mySelect.options.length] = new Option("Middletown schools",'all=Middletown'); mySelect.options[mySelect.options.length] = new Option("Mount Summit schools",'all=Mount_Summit'); mySelect.options[mySelect.options.length] = new Option("New Castle schools",'all=New_Castle'); mySelect.options[mySelect.options.length] = new Option("Spiceland schools",'all=Spiceland'); mySelect.options[mySelect.options.length] = new Option("Straughn schools",'all=Straughn'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Mount_Summit[Mount_Summit.length] = createMarker(new GPoint(-85.38610077,40.00400162),"
Blue River Valley Elementary School
Box 187
Mount Summit, IN 47361

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Blue River Valley Elementary School",'Mount_Summit=' + Mount_Summit.length); Mount_Summit[Mount_Summit.length] = createMarker(new GPoint(-85.38610077,40.00400162),"
Blue River Valley Junior Senior High School
Box 249
Mount Summit, IN 47361

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Blue River Valley Junior Senior High School",'Mount_Summit=' + Mount_Summit.length); New_Castle[New_Castle.length] = createMarker(new GPoint(-85.35801697,39.92392349),"
Eastwood Elementary School
806 S 22nd St
New Castle, IN 47362

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Eastwood Elementary School",'New_Castle=' + New_Castle.length); New_Castle[New_Castle.length] = createMarker(new GPoint(-85.37918091,39.92848969),"
Greenstreet Elementary School
329 S 5th St
New Castle, IN 47362

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Greenstreet Elementary School",'New_Castle=' + New_Castle.length); New_Castle[New_Castle.length] = createMarker(new GPoint(-85.36637000,39.91690300),"
Henry Co Youth Center
Po Box 469
New Castle, IN 47362

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Henry Co Youth Center",'New_Castle=' + New_Castle.length); New_Castle[New_Castle.length] = createMarker(new GPoint(-85.37200928,39.90226364),"
James Whitcomb Riley Elementary School
1201 Riley Rd
New Castle, IN 47362

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("James Whitcomb Riley Elementary School",'New_Castle=' + New_Castle.length); Kennard[Kennard.length] = createMarker(new GPoint(-85.51969910,39.90349960),"
Kennard Elementary School
Po Box 228
Kennard, IN 47351

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Kennard Elementary School",'Kennard=' + Kennard.length); Knightstown[Knightstown.length] = createMarker(new GPoint(-85.52617645,39.79541016),"
Knightstown Elementary School
8632 S Sr 109
Knightstown, IN 46148

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Knightstown Elementary School",'Knightstown=' + Knightstown.length); Knightstown[Knightstown.length] = createMarker(new GPoint(-85.52130127,39.80250168),"
Knightstown High School
8149 W Us Hwy 40
Knightstown, IN 46148

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Knightstown High School",'Knightstown=' + Knightstown.length); Knightstown[Knightstown.length] = createMarker(new GPoint(-85.51509857,39.80759811),"
Knightstown Intermediate School
1 Panther Trl
Knightstown, IN 46148

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Knightstown Intermediate School",'Knightstown=' + Knightstown.length); New_Castle[New_Castle.length] = createMarker(new GPoint(-85.37001801,39.92890167),"
New Castle Area Vocational School
801 Parkview Dr
New Castle, IN 47362

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("New Castle Area Vocational School",'New_Castle=' + New_Castle.length); New_Castle[New_Castle.length] = createMarker(new GPoint(-85.37787628,39.91390991),"
New Castle Chrysler High School
801 Parkview Dr
New Castle, IN 47362

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("New Castle Chrysler High School",'New_Castle=' + New_Castle.length); New_Castle[New_Castle.length] = createMarker(new GPoint(-85.38091278,39.91386414),"
New Castle Middle School
601 Parkview Dr
New Castle, IN 47362

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("New Castle Middle School",'New_Castle=' + New_Castle.length); New_Castle[New_Castle.length] = createMarker(new GPoint(-85.36864471,39.92776489),"
North Campus Alternative School
1407 Walnut St
New Castle, IN 47362

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("North Campus Alternative School",'New_Castle=' + New_Castle.length); New_Castle[New_Castle.length] = createMarker(new GPoint(-85.36867523,39.91386032),"
Parker Elementary School
1819 Roosevelt
New Castle, IN 47362

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Parker Elementary School",'New_Castle=' + New_Castle.length); Middletown[Middletown.length] = createMarker(new GPoint(-85.52789307,40.00833511),"
Shenandoah Elementary School
5256 N Raider Rd
Middletown, IN 47356

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Shenandoah Elementary School",'Middletown=' + Middletown.length); Middletown[Middletown.length] = createMarker(new GPoint(-85.53620911,40.05731964),"
Shenandoah High School
7354 W Us 36
Middletown, IN 47356

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Shenandoah High School",'Middletown=' + Middletown.length); Middletown[Middletown.length] = createMarker(new GPoint(-85.52794647,40.00692749),"
Shenandoah Middle School
5156 N Raider Rd
Middletown, IN 47356

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Shenandoah Middle School",'Middletown=' + Middletown.length); Spiceland[Spiceland.length] = createMarker(new GPoint(-85.44300079,39.83853531),"
Spiceland Elementary School
408 W Main St
Spiceland, IN 47385

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Spiceland Elementary School",'Spiceland=' + Spiceland.length); New_Castle[New_Castle.length] = createMarker(new GPoint(-85.36250305,39.90801620),"
Sunnyside Elementary School
2601 S 14th St
New Castle, IN 47362

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Sunnyside Elementary School",'New_Castle=' + New_Castle.length); Straughn[Straughn.length] = createMarker(new GPoint(-85.29099274,39.80913162),"
Tri Junior-senior High School
6972 S Sr 103
Straughn, IN 47387

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Tri Junior-senior High School",'Straughn=' + Straughn.length); Straughn[Straughn.length] = createMarker(new GPoint(-85.29099274,39.80913162),"
Tri-elementary School
6972 S Sr 103
Straughn, IN 47387

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Tri-elementary School",'Straughn=' + Straughn.length); New_Castle[New_Castle.length] = createMarker(new GPoint(-85.42262268,39.90314484),"
Westwood Elementary School
1015 S Greensboro Pike
New Castle, IN 47362

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Westwood Elementary School",'New_Castle=' + New_Castle.length); New_Castle[New_Castle.length] = createMarker(new GPoint(-85.36148071,39.93873596),"
Wilbur Wright Elementary School
1950 Washington St
New Castle, IN 47362

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Wilbur Wright Elementary School",'New_Castle=' + New_Castle.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(Kennard); map.removeOverlays(Knightstown); map.removeOverlays(Middletown); map.removeOverlays(Mount_Summit); map.removeOverlays(New_Castle); map.removeOverlays(Spiceland); map.removeOverlays(Straughn); 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(Mount_Summit);map.removeOverlays(Kennard); map.removeOverlays(Knightstown); map.removeOverlays(Middletown); map.removeOverlays(Mount_Summit); map.removeOverlays(New_Castle); map.removeOverlays(Spiceland); map.removeOverlays(Straughn); map.addOverlays(Kennard); centerByArray(Kennard, false, false); cntMarker += Kennard.length; map.addOverlays(Knightstown); centerByArray(Knightstown, false, false); cntMarker += Knightstown.length; map.addOverlays(Middletown); centerByArray(Middletown, false, false); cntMarker += Middletown.length; map.addOverlays(Mount_Summit); centerByArray(Mount_Summit, false, false); cntMarker += Mount_Summit.length; map.addOverlays(New_Castle); centerByArray(New_Castle, false, false); cntMarker += New_Castle.length; map.addOverlays(Spiceland); centerByArray(Spiceland, false, false); cntMarker += Spiceland.length; map.addOverlays(Straughn); centerByArray(Straughn, false, false); cntMarker += Straughn.length; centerByArray(Mount_Summit,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'); } }