function addMarkers() { mySelect = document.getElementById('selection'); Corydon = [];Central = [];Lanesville = [];Palmyra = [];New_Middletown = [];Ramsey = [];Elizabeth = [];mySelect.options[mySelect.options.length] = new Option("Central schools",'all=Central'); mySelect.options[mySelect.options.length] = new Option("Corydon schools",'all=Corydon'); mySelect.options[mySelect.options.length] = new Option("Elizabeth schools",'all=Elizabeth'); mySelect.options[mySelect.options.length] = new Option("Lanesville schools",'all=Lanesville'); mySelect.options[mySelect.options.length] = new Option("New Middletown schools",'all=New_Middletown'); mySelect.options[mySelect.options.length] = new Option("Palmyra schools",'all=Palmyra'); mySelect.options[mySelect.options.length] = new Option("Ramsey schools",'all=Ramsey'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Corydon[Corydon.length] = createMarker(new GPoint(-86.12750244,38.20999908),"
Corydon Central High School
375 Country Club Rd
Corydon, IN 47112

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Corydon Central High School",'Corydon=' + Corydon.length); Corydon[Corydon.length] = createMarker(new GPoint(-86.11544037,38.20056152),"
Corydon Central Junior High School
377 Country Club Rd
Corydon, IN 47112

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Corydon Central Junior High School",'Corydon=' + Corydon.length); Corydon[Corydon.length] = createMarker(new GPoint(-86.12094116,38.20732498),"
Corydon Elementary School
125 Beechmont Dr
Corydon, IN 47112

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Corydon Elementary School",'Corydon=' + Corydon.length); Corydon[Corydon.length] = createMarker(new GPoint(-86.12184143,38.20175171),"
Corydon Intermediate School
100 High School Rd
Corydon, IN 47112

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Corydon Intermediate School",'Corydon=' + Corydon.length); Corydon[Corydon.length] = createMarker(new GPoint(-86.16619873,38.20824051),"
Harrison County Spec Ed Coop
121 High School Rd
Corydon, IN 47112

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Harrison County Spec Ed Coop",'Corydon=' + Corydon.length); Central[Central.length] = createMarker(new GPoint(-86.17508698,38.10043716),"
Heth-washington Elementary School
2450 Heth-washington Rd Sw
Central, IN 47110

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Heth-washington Elementary School",'Central=' + Central.length); Lanesville[Lanesville.length] = createMarker(new GPoint(-85.98782349,38.23808289),"
Lanesville Elementary School
2725 Crestview
Lanesville, IN 47136

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Lanesville Elementary School",'Lanesville=' + Lanesville.length); Lanesville[Lanesville.length] = createMarker(new GPoint(-85.98782349,38.23808289),"
Lanesville Junior Senior High School
2725 Crestview
Lanesville, IN 47136

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Lanesville Junior Senior High School",'Lanesville=' + Lanesville.length); Palmyra[Palmyra.length] = createMarker(new GPoint(-86.09999847,38.40489960),"
Morgan Elementary School
12225 Old Sr 135 Ne
Palmyra, IN 47164

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Morgan Elementary School",'Palmyra=' + Palmyra.length); New_Middletown[New_Middletown.length] = createMarker(new GPoint(-86.04492187,38.12717819),"
New Middletown Elementary School
2460 New Middletown Rd Se
New Middletown, IN 47160

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("New Middletown Elementary School",'New_Middletown=' + New_Middletown.length); Ramsey[Ramsey.length] = createMarker(new GPoint(-86.14453125,38.32658386),"
North Harrison Elementary School
1115 W Whiskey Run Rd Nw
Ramsey, IN 47166

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("North Harrison Elementary School",'Ramsey=' + Ramsey.length); Ramsey[Ramsey.length] = createMarker(new GPoint(-86.16609955,38.31069946),"
North Harrison High School
1070 Hwy 64 Nw
Ramsey, IN 47166

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("North Harrison High School",'Ramsey=' + Ramsey.length); Ramsey[Ramsey.length] = createMarker(new GPoint(-86.14654541,38.32111359),"
North Harrison Middle School
1180 Hwy 64 Nw
Ramsey, IN 47166

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("North Harrison Middle School",'Ramsey=' + Ramsey.length); Ramsey[Ramsey.length] = createMarker(new GPoint(-86.16609955,38.31069946),"
North Harrison Upper Elementary School
1230 Hwy 64 Nw
Ramsey, IN 47166

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("North Harrison Upper Elementary School",'Ramsey=' + Ramsey.length); Elizabeth[Elizabeth.length] = createMarker(new GPoint(-86.00402832,38.08256149),"
South Central Elementary School
6595 E Hwy 11 Se
Elizabeth, IN 47117

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("South Central Elementary School",'Elizabeth=' + Elizabeth.length); Elizabeth[Elizabeth.length] = createMarker(new GPoint(-86.00302124,38.08256149),"
South Central Junior & Senior High School
6675 E Hwy 11 Se
Elizabeth, IN 47117

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("South Central Junior & Senior High School",'Elizabeth=' + Elizabeth.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(Central); map.removeOverlays(Corydon); map.removeOverlays(Elizabeth); map.removeOverlays(Lanesville); map.removeOverlays(New_Middletown); map.removeOverlays(Palmyra); map.removeOverlays(Ramsey); 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(Corydon);map.removeOverlays(Central); map.removeOverlays(Corydon); map.removeOverlays(Elizabeth); map.removeOverlays(Lanesville); map.removeOverlays(New_Middletown); map.removeOverlays(Palmyra); map.removeOverlays(Ramsey); map.addOverlays(Central); centerByArray(Central, false, false); cntMarker += Central.length; map.addOverlays(Corydon); centerByArray(Corydon, false, false); cntMarker += Corydon.length; map.addOverlays(Elizabeth); centerByArray(Elizabeth, false, false); cntMarker += Elizabeth.length; map.addOverlays(Lanesville); centerByArray(Lanesville, false, false); cntMarker += Lanesville.length; map.addOverlays(New_Middletown); centerByArray(New_Middletown, false, false); cntMarker += New_Middletown.length; map.addOverlays(Palmyra); centerByArray(Palmyra, false, false); cntMarker += Palmyra.length; map.addOverlays(Ramsey); centerByArray(Ramsey, false, false); cntMarker += Ramsey.length; centerByArray(Corydon,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'); } }