function addMarkers() { mySelect = document.getElementById('selection'); Crawfordsville = [];Ladoga = [];New_Market = [];New_Ross = [];Waveland = [];mySelect.options[mySelect.options.length] = new Option("Crawfordsville schools",'all=Crawfordsville'); mySelect.options[mySelect.options.length] = new Option("Ladoga schools",'all=Ladoga'); mySelect.options[mySelect.options.length] = new Option("New Market schools",'all=New_Market'); mySelect.options[mySelect.options.length] = new Option("New Ross schools",'all=New_Ross'); mySelect.options[mySelect.options.length] = new Option("Waveland schools",'all=Waveland'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Crawfordsville[Crawfordsville.length] = createMarker(new GPoint(-86.89511871,40.03843689),"
Anna Willson Kindergarten Center
500 E Jefferson St
Crawfordsville, IN 47933

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Anna Willson Kindergarten Center",'Crawfordsville=' + Crawfordsville.length); Crawfordsville[Crawfordsville.length] = createMarker(new GPoint(-86.87149811,40.03870010),"
Beard Learning Center
1601 E College
Crawfordsville, IN 47933

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Beard Learning Center",'Crawfordsville=' + Crawfordsville.length); Crawfordsville[Crawfordsville.length] = createMarker(new GPoint(-86.90127563,40.01794052),"
Crawfordsville Senior High School
One Athenian Dr
Crawfordsville, IN 47933

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Crawfordsville Senior High School",'Crawfordsville=' + Crawfordsville.length); Crawfordsville[Crawfordsville.length] = createMarker(new GPoint(-86.89662170,40.03576279),"
Joseph F Tuttle Middle School
612 S Elm St
Crawfordsville, IN 47933

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Joseph F Tuttle Middle School",'Crawfordsville=' + Crawfordsville.length); Ladoga[Ladoga.length] = createMarker(new GPoint(-86.79798889,39.91585922),"
Ladoga Elementary School
418 E Taylor St
Ladoga, IN 47954

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Ladoga Elementary School",'Ladoga=' + Ladoga.length); Crawfordsville[Crawfordsville.length] = createMarker(new GPoint(-86.89111328,40.04529572),"
Laura Hose Elementary School
800 Fairview Ave
Crawfordsville, IN 47933

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Laura Hose Elementary School",'Crawfordsville=' + Crawfordsville.length); Crawfordsville[Crawfordsville.length] = createMarker(new GPoint(-86.87406921,40.04088974),"
Lester B Sommer Elementary School
3794 W Us 136
Crawfordsville, IN 47933

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Lester B Sommer Elementary School",'Crawfordsville=' + Crawfordsville.length); Crawfordsville[Crawfordsville.length] = createMarker(new GPoint(-86.91368866,40.04391861),"
Meredith Nicholson Elementary School
1010 Lane Ave
Crawfordsville, IN 47933

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Meredith Nicholson Elementary School",'Crawfordsville=' + Crawfordsville.length); Crawfordsville[Crawfordsville.length] = createMarker(new GPoint(-86.89698029,40.02835846),"
Mollie B Hoover Elementary School
1301 Elm St
Crawfordsville, IN 47933

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Mollie B Hoover Elementary School",'Crawfordsville=' + Crawfordsville.length); New_Market[New_Market.length] = createMarker(new GPoint(-86.92130280,39.95249939),"
New Market Elementary School
Po Box 128
New Market, IN 47965

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("New Market Elementary School",'New_Market=' + New_Market.length); Crawfordsville[Crawfordsville.length] = createMarker(new GPoint(-86.91439819,40.02719879),"
North Montgomery High School
5945 Us 231 N
Crawfordsville, IN 47933

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("North Montgomery High School",'Crawfordsville=' + Crawfordsville.length); Crawfordsville[Crawfordsville.length] = createMarker(new GPoint(-86.90933990,40.12281799),"
Northridge Middle School
482 W 580 N
Crawfordsville, IN 47933

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Northridge Middle School",'Crawfordsville=' + Crawfordsville.length); Crawfordsville[Crawfordsville.length] = createMarker(new GPoint(-86.95600128,40.02479935),"
Pleasant Hill Elementary School
6895 N 100 W
Crawfordsville, IN 47933

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Pleasant Hill Elementary School",'Crawfordsville=' + Crawfordsville.length); Crawfordsville[Crawfordsville.length] = createMarker(new GPoint(-86.87406921,40.04088974),"
Southmont Junior High School
6425 Us 231 S
Crawfordsville, IN 47933

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Southmont Junior High School",'Crawfordsville=' + Crawfordsville.length); Crawfordsville[Crawfordsville.length] = createMarker(new GPoint(-86.87406921,40.04088974),"
Southmont Senior High School
6425 Us 231 S
Crawfordsville, IN 47933

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Southmont Senior High School",'Crawfordsville=' + Crawfordsville.length); Crawfordsville[Crawfordsville.length] = createMarker(new GPoint(-86.87819672,40.04949951),"
Sugar Creek Elementary School
4702 E 300 N
Crawfordsville, IN 47933

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Sugar Creek Elementary School",'Crawfordsville=' + Crawfordsville.length); New_Ross[New_Ross.length] = createMarker(new GPoint(-86.73840332,39.98479843),"
Walnut Elementary School
Rr 1
New Ross, IN 47968

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Walnut Elementary School",'New_Ross=' + New_Ross.length); Waveland[Waveland.length] = createMarker(new GPoint(-87.04055023,39.87916565),"
Waveland Elementary School
506 E Green St
Waveland, IN 47989

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Waveland Elementary School",'Waveland=' + Waveland.length); Crawfordsville[Crawfordsville.length] = createMarker(new GPoint(-86.87149811,40.03870010),"
West Central In Special Srvs Coop
808 W Pike St
Crawfordsville, IN 47933

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("West Central In Special Srvs Coop",'Crawfordsville=' + Crawfordsville.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(Crawfordsville); map.removeOverlays(Ladoga); map.removeOverlays(New_Market); map.removeOverlays(New_Ross); map.removeOverlays(Waveland); 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(Crawfordsville);map.removeOverlays(Crawfordsville); map.removeOverlays(Ladoga); map.removeOverlays(New_Market); map.removeOverlays(New_Ross); map.removeOverlays(Waveland); map.addOverlays(Crawfordsville); centerByArray(Crawfordsville, false, false); cntMarker += Crawfordsville.length; map.addOverlays(Ladoga); centerByArray(Ladoga, false, false); cntMarker += Ladoga.length; map.addOverlays(New_Market); centerByArray(New_Market, false, false); cntMarker += New_Market.length; map.addOverlays(New_Ross); centerByArray(New_Ross, false, false); cntMarker += New_Ross.length; map.addOverlays(Waveland); centerByArray(Waveland, false, false); cntMarker += Waveland.length; centerByArray(Crawfordsville,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'); } }