function addMarkers() { mySelect = document.getElementById('selection'); Columbus = [];Clifford = [];Hope = [];Taylorsville = [];mySelect.options[mySelect.options.length] = new Option("Clifford schools",'all=Clifford'); mySelect.options[mySelect.options.length] = new Option("Columbus schools",'all=Columbus'); mySelect.options[mySelect.options.length] = new Option("Hope schools",'all=Hope'); mySelect.options[mySelect.options.length] = new Option("Taylorsville schools",'all=Taylorsville'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Columbus[Columbus.length] = createMarker(new GPoint(-85.91685486,39.20556259),"
Central Middle School
725 7th St
Columbus, IN 47201

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Central Middle School",'Columbus=' + Columbus.length); Columbus[Columbus.length] = createMarker(new GPoint(-85.86982727,39.20876312),"
Clifty Creek Elementary School
4625 E 50 N
Columbus, IN 47203

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Clifty Creek Elementary School",'Columbus=' + Columbus.length); Columbus[Columbus.length] = createMarker(new GPoint(-85.89547729,39.19770050),"
Columbus Area Vocational Program
1200 Central Ave
Columbus, IN 47201

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Columbus Area Vocational Program",'Columbus=' + Columbus.length); Columbus[Columbus.length] = createMarker(new GPoint(-85.88471985,39.19387817),"
Columbus East High School
230 S Marr Rd
Columbus, IN 47201

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Columbus East High School",'Columbus=' + Columbus.length); Columbus[Columbus.length] = createMarker(new GPoint(-85.90952301,39.22313690),"
Columbus North High School
1400 25th St
Columbus, IN 47201

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Columbus North High School",'Columbus=' + Columbus.length); Clifford[Clifford.length] = createMarker(new GPoint(-85.86920166,39.28260040),"
Cross Cliff Elementary School
Po Box 120 - 4355 E 600 N
Clifford, IN 47226

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Cross Cliff Elementary School",'Clifford=' + Clifford.length); Columbus[Columbus.length] = createMarker(new GPoint(-85.89276886,39.19566345),"
Fodrea Community School
2775 Illinois St
Columbus, IN 47201

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Fodrea Community School",'Columbus=' + Columbus.length); Hope[Hope.length] = createMarker(new GPoint(-85.76280212,39.29230118),"
Hauser Junior Senior High School
Box 24
Hope, IN 47246

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Hauser Junior Senior High School",'Hope=' + Hope.length); Hope[Hope.length] = createMarker(new GPoint(-85.76280212,39.29230118),"
Hope Elementary School
Box 93
Hope, IN 47246

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Hope Elementary School",'Hope=' + Hope.length); Columbus[Columbus.length] = createMarker(new GPoint(-85.86993408,39.22076416),"
L Smith School
4505 Waycross Dr
Columbus, IN 47203

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("L Smith School",'Columbus=' + Columbus.length); Columbus[Columbus.length] = createMarker(new GPoint(-85.91442108,39.22657394),"
Lillian Schmitt Elementary School
2675 California
Columbus, IN 47201

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Lillian Schmitt Elementary School",'Columbus=' + Columbus.length); Columbus[Columbus.length] = createMarker(new GPoint(-85.91659546,39.20373535),"
Lincoln Elementary School
750 5th St
Columbus, IN 47201

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Lincoln Elementary School",'Columbus=' + Columbus.length); Columbus[Columbus.length] = createMarker(new GPoint(-85.92133331,39.20140839),"
Mount Healthy Elementary School
12150 S Sr 58
Columbus, IN 47201

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Mount Healthy Elementary School",'Columbus=' + Columbus.length); Columbus[Columbus.length] = createMarker(new GPoint(-85.90934753,39.22743607),"
Northside Middle School
1400 27th St
Columbus, IN 47201

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Northside Middle School",'Columbus=' + Columbus.length); Columbus[Columbus.length] = createMarker(new GPoint(-85.91172028,39.24103546),"
Parkside Elementary School
1400 Parkside Dr
Columbus, IN 47201

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Parkside Elementary School",'Columbus=' + Columbus.length); Columbus[Columbus.length] = createMarker(new GPoint(-85.77840424,39.17401886),"
Rockcreek Elementary School
13000 E 200 S
Columbus, IN 47201

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Rockcreek Elementary School",'Columbus=' + Columbus.length); Columbus[Columbus.length] = createMarker(new GPoint(-85.94078064,39.17143631),"
Southside Elementary School
1320 W 200 S
Columbus, IN 47201

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Southside Elementary School",'Columbus=' + Columbus.length); Taylorsville[Taylorsville.length] = createMarker(new GPoint(-85.94899750,39.29270172),"
Taylorsville Elementary School
Po Box 277
Taylorsville, IN 47280

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Taylorsville Elementary School",'Taylorsville=' + Taylorsville.length); Columbus[Columbus.length] = createMarker(new GPoint(-85.87091827,39.23348236),"
W D Richards Elementary School
3311 Fairlawn Dr
Columbus, IN 47201

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("W D Richards Elementary School",'Columbus=' + Columbus.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(Clifford); map.removeOverlays(Columbus); map.removeOverlays(Hope); map.removeOverlays(Taylorsville); 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(Columbus);map.removeOverlays(Clifford); map.removeOverlays(Columbus); map.removeOverlays(Hope); map.removeOverlays(Taylorsville); map.addOverlays(Clifford); centerByArray(Clifford, false, false); cntMarker += Clifford.length; map.addOverlays(Columbus); centerByArray(Columbus, false, false); cntMarker += Columbus.length; map.addOverlays(Hope); centerByArray(Hope, false, false); cntMarker += Hope.length; map.addOverlays(Taylorsville); centerByArray(Taylorsville, false, false); cntMarker += Taylorsville.length; centerByArray(Columbus,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'); } }