function addMarkers() { mySelect = document.getElementById('selection'); Greenfield = [];New_Palestine = [];Charlottesville = [];Maxwell = [];Mccordsville = [];Fortville = [];mySelect.options[mySelect.options.length] = new Option("Charlottesville schools",'all=Charlottesville'); mySelect.options[mySelect.options.length] = new Option("Fortville schools",'all=Fortville'); mySelect.options[mySelect.options.length] = new Option("Greenfield schools",'all=Greenfield'); mySelect.options[mySelect.options.length] = new Option("Maxwell schools",'all=Maxwell'); mySelect.options[mySelect.options.length] = new Option("Mccordsville schools",'all=Mccordsville'); mySelect.options[mySelect.options.length] = new Option("New Palestine schools",'all=New_Palestine'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Greenfield[Greenfield.length] = createMarker(new GPoint(-85.79315186,39.72806168),"
Brandywine Elementary School
413 E 400 S
Greenfield, IN 46140

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Brandywine Elementary School",'Greenfield=' + Greenfield.length); New_Palestine[New_Palestine.length] = createMarker(new GPoint(-85.90119934,39.73059845),"
Doe Creek Middle School
Po Box 478
New Palestine, IN 46163

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Doe Creek Middle School",'New_Palestine=' + New_Palestine.length); Charlottesville[Charlottesville.length] = createMarker(new GPoint(-85.61270142,39.78934860),"
Eastern Hancock Elementary School
10450 E 250 N
Charlottesville, IN 46117

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Eastern Hancock Elementary School",'Charlottesville=' + Charlottesville.length); Charlottesville[Charlottesville.length] = createMarker(new GPoint(-85.61270142,39.78934860),"
Eastern Hancock High School
10320 E 250 N
Charlottesville, IN 46117

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Eastern Hancock High School",'Charlottesville=' + Charlottesville.length); Charlottesville[Charlottesville.length] = createMarker(new GPoint(-85.61270142,39.78934860),"
Eastern Hancock Middle School
10380 E 250 N
Charlottesville, IN 46117

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Eastern Hancock Middle School",'Charlottesville=' + Charlottesville.length); Greenfield[Greenfield.length] = createMarker(new GPoint(-85.76841736,39.78527069),"
Eden Elementary School
8185 N Sr 9
Greenfield, IN 46140

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Eden Elementary School",'Greenfield=' + Greenfield.length); Greenfield[Greenfield.length] = createMarker(new GPoint(-85.77205658,39.79233551),"
Greenfield Middle School
204 W Park Ave
Greenfield, IN 46140

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Greenfield Middle School",'Greenfield=' + Greenfield.length); Greenfield[Greenfield.length] = createMarker(new GPoint(-85.77967834,39.79250717),"
Greenfield-central High School
810 N Broadway
Greenfield, IN 46140

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Greenfield-central High School",'Greenfield=' + Greenfield.length); Greenfield[Greenfield.length] = createMarker(new GPoint(-85.78109741,39.79790115),"
Hancock-south Madison Joint Srvs
Po Box 718
Greenfield, IN 46140

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Hancock-south Madison Joint Srvs",'Greenfield=' + Greenfield.length); Greenfield[Greenfield.length] = createMarker(new GPoint(-85.77198029,39.79233551),"
Harris Elementary School
200 W Park Ave
Greenfield, IN 46140

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Harris Elementary School",'Greenfield=' + Greenfield.length); Greenfield[Greenfield.length] = createMarker(new GPoint(-85.77779388,39.78592682),"
J B Stephens Elementary School
1331 N Blue Rd
Greenfield, IN 46140

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("J B Stephens Elementary School",'Greenfield=' + Greenfield.length); Maxwell[Maxwell.length] = createMarker(new GPoint(-85.76210022,39.79800034),"
Maxwell Middle School
102 N Main St
Maxwell, IN 46154

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Maxwell Middle School",'Maxwell=' + Maxwell.length); Mccordsville[Mccordsville.length] = createMarker(new GPoint(-85.91904000,39.90919400),"
Mccordsville Elementary School
7177 N 600 W
Mccordsville, IN 46055

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Mccordsville Elementary School",'Mccordsville=' + Mccordsville.length); Greenfield[Greenfield.length] = createMarker(new GPoint(-85.91019440,39.82718658),"
Mount Comfort Elementary School
5694 W 300 N
Greenfield, IN 46140

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Mount Comfort Elementary School",'Greenfield=' + Greenfield.length); Fortville[Fortville.length] = createMarker(new GPoint(-85.84786987,39.93252945),"
Mount Vernon Elementary School
1806 W Sr 234
Fortville, IN 46040

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Mount Vernon Elementary School",'Fortville=' + Fortville.length); Fortville[Fortville.length] = createMarker(new GPoint(-85.85189819,39.93439865),"
Mount Vernon High School
8112 N 200 W
Fortville, IN 46040

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Mount Vernon High School",'Fortville=' + Fortville.length); Fortville[Fortville.length] = createMarker(new GPoint(-85.85179901,39.93450165),"
Mount Vernon Intermediate School
8414 N 200 W
Fortville, IN 46040

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Mount Vernon Intermediate School",'Fortville=' + Fortville.length); Fortville[Fortville.length] = createMarker(new GPoint(-85.84786987,39.93252945),"
Mount Vernon Middle School
1862 W Sr 234
Fortville, IN 46040

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Mount Vernon Middle School",'Fortville=' + Fortville.length); New_Palestine[New_Palestine.length] = createMarker(new GPoint(-85.90119934,39.73059845),"
New Palestine Elementry School
Po Box 538
New Palestine, IN 46163

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("New Palestine Elementry School",'New_Palestine=' + New_Palestine.length); New_Palestine[New_Palestine.length] = createMarker(new GPoint(-85.90119934,39.73059845),"
New Palestine High School
Po Box 448
New Palestine, IN 46163

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("New Palestine High School",'New_Palestine=' + New_Palestine.length); New_Palestine[New_Palestine.length] = createMarker(new GPoint(-85.90119934,39.73059845),"
Sugar Creek Elementary School
Po Box 558
New Palestine, IN 46163

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Sugar Creek Elementary School",'New_Palestine=' + New_Palestine.length); Greenfield[Greenfield.length] = createMarker(new GPoint(-85.78690338,39.78743744),"
Weston Elementary School
140 Polk St
Greenfield, IN 46140

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Weston Elementary School",'Greenfield=' + Greenfield.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(Charlottesville); map.removeOverlays(Fortville); map.removeOverlays(Greenfield); map.removeOverlays(Maxwell); map.removeOverlays(Mccordsville); map.removeOverlays(New_Palestine); 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(Greenfield);map.removeOverlays(Charlottesville); map.removeOverlays(Fortville); map.removeOverlays(Greenfield); map.removeOverlays(Maxwell); map.removeOverlays(Mccordsville); map.removeOverlays(New_Palestine); map.addOverlays(Charlottesville); centerByArray(Charlottesville, false, false); cntMarker += Charlottesville.length; map.addOverlays(Fortville); centerByArray(Fortville, false, false); cntMarker += Fortville.length; map.addOverlays(Greenfield); centerByArray(Greenfield, false, false); cntMarker += Greenfield.length; map.addOverlays(Maxwell); centerByArray(Maxwell, false, false); cntMarker += Maxwell.length; map.addOverlays(Mccordsville); centerByArray(Mccordsville, false, false); cntMarker += Mccordsville.length; map.addOverlays(New_Palestine); centerByArray(New_Palestine, false, false); cntMarker += New_Palestine.length; centerByArray(Greenfield,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'); } }