function addMarkers() { mySelect = document.getElementById('selection'); Vincennes = [];Bicknell = [];Edwardsport = [];Bruceville = [];mySelect.options[mySelect.options.length] = new Option("Bicknell schools",'all=Bicknell'); mySelect.options[mySelect.options.length] = new Option("Bruceville schools",'all=Bruceville'); mySelect.options[mySelect.options.length] = new Option("Edwardsport schools",'all=Edwardsport'); mySelect.options[mySelect.options.length] = new Option("Vincennes schools",'all=Vincennes'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Vincennes[Vincennes.length] = createMarker(new GPoint(-87.49537659,38.66828918),"
Benjamin Franklin Elementary School
2600 Wabash Ave
Vincennes, IN 47591

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Benjamin Franklin Elementary School",'Vincennes=' + Vincennes.length); Vincennes[Vincennes.length] = createMarker(new GPoint(-87.52831268,38.67742920),"
Frances Vigo Elementary School
15thmain Sts
Vincennes, IN 47591

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Frances Vigo Elementary School",'Vincennes=' + Vincennes.length); Vincennes[Vincennes.length] = createMarker(new GPoint(-87.52715302,38.67916489),"
George Rogers Clark School
500 Buntin
Vincennes, IN 47591

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("George Rogers Clark School",'Vincennes=' + Vincennes.length); Vincennes[Vincennes.length] = createMarker(new GPoint(-87.52831268,38.67742920),"
James Whitcomb Riley Elementary School
Upper 11thcollege Ave
Vincennes, IN 47591

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("James Whitcomb Riley Elementary School",'Vincennes=' + Vincennes.length); Vincennes[Vincennes.length] = createMarker(new GPoint(-87.51770782,38.67178726),"
Lincoln High School
1545 S Hart St
Vincennes, IN 47591

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Lincoln High School",'Vincennes=' + Vincennes.length); Bicknell[Bicknell.length] = createMarker(new GPoint(-87.31536200,38.85176500),"
North Knox Alternative Education
11110 N Sr 159
Bicknell, IN 47512

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("North Knox Alternative Education",'Bicknell=' + Bicknell.length); Bicknell[Bicknell.length] = createMarker(new GPoint(-87.30749512,38.77544403),"
North Knox Central Elementary School
215 E 4th St
Bicknell, IN 47512

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("North Knox Central Elementary School",'Bicknell=' + Bicknell.length); Edwardsport[Edwardsport.length] = createMarker(new GPoint(-87.25070190,38.80920029),"
North Knox East Elementary & Junior High School
Box 128
Edwardsport, IN 47528

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("North Knox East Elementary & Junior High School",'Edwardsport=' + Edwardsport.length); Bicknell[Bicknell.length] = createMarker(new GPoint(-87.30870056,38.77420044),"
North Knox High School
10890 N Sr 159
Bicknell, IN 47512

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("North Knox High School",'Bicknell=' + Bicknell.length); Bruceville[Bruceville.length] = createMarker(new GPoint(-87.44207764,38.79005051),"
North Knox West Elementary School
7820 N Camp Arthur Rd
Bruceville, IN 47516

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("North Knox West Elementary School",'Bruceville=' + Bruceville.length); Vincennes[Vincennes.length] = createMarker(new GPoint(-87.52831268,38.67742920),"
South Knox Elementary School
6078 E Sr 61
Vincennes, IN 47591

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("South Knox Elementary School",'Vincennes=' + Vincennes.length); Vincennes[Vincennes.length] = createMarker(new GPoint(-87.52831268,38.67742920),"
South Knox Middle-high School
6136 E Sr 61
Vincennes, IN 47591

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("South Knox Middle-high School",'Vincennes=' + Vincennes.length); Vincennes[Vincennes.length] = createMarker(new GPoint(-87.51031494,38.68952942),"
Tecumseh-harrison Elementary School
2116 N 2nd St
Vincennes, IN 47591

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Tecumseh-harrison Elementary School",'Vincennes=' + Vincennes.length); Vincennes[Vincennes.length] = createMarker(new GPoint(-87.50309753,38.68327713),"
Washington Elementary School
2134 Washington Ave
Vincennes, IN 47591

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Washington Elementary School",'Vincennes=' + Vincennes.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(Bicknell); map.removeOverlays(Bruceville); map.removeOverlays(Edwardsport); map.removeOverlays(Vincennes); 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(Vincennes);map.removeOverlays(Bicknell); map.removeOverlays(Bruceville); map.removeOverlays(Edwardsport); map.removeOverlays(Vincennes); map.addOverlays(Bicknell); centerByArray(Bicknell, false, false); cntMarker += Bicknell.length; map.addOverlays(Bruceville); centerByArray(Bruceville, false, false); cntMarker += Bruceville.length; map.addOverlays(Edwardsport); centerByArray(Edwardsport, false, false); cntMarker += Edwardsport.length; map.addOverlays(Vincennes); centerByArray(Vincennes, false, false); cntMarker += Vincennes.length; centerByArray(Vincennes,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'); } }