function addMarkers() { mySelect = document.getElementById('selection'); Shepherdsville = [];Mount_Washington = [];Lebanon_Junction = [];Louisville = [];West_Point = [];mySelect.options[mySelect.options.length] = new Option("Lebanon Junction schools",'all=Lebanon_Junction'); mySelect.options[mySelect.options.length] = new Option("Louisville schools",'all=Louisville'); mySelect.options[mySelect.options.length] = new Option("Mount Washington schools",'all=Mount_Washington'); mySelect.options[mySelect.options.length] = new Option("Shepherdsville schools",'all=Shepherdsville'); mySelect.options[mySelect.options.length] = new Option("West Point schools",'all=West_Point'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Shepherdsville[Shepherdsville.length] = createMarker(new GPoint(-85.68569183,37.92391205),"
Bernheim Middle School
700 Audubon Dr
Shepherdsville, KY 40165

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Bernheim Middle School",'Shepherdsville=' + Shepherdsville.length); Shepherdsville[Shepherdsville.length] = createMarker(new GPoint(-85.69947815,38.05690384),"
Brooks Elementary School
1800 E Blue Lick Rd
Shepherdsville, KY 40165

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Brooks Elementary School",'Shepherdsville=' + Shepherdsville.length); Shepherdsville[Shepherdsville.length] = createMarker(new GPoint(-85.69700623,37.99839020),"
Bullitt Central High School
1330 Hwy 44 E
Shepherdsville, KY 40165

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bullitt Central High School",'Shepherdsville=' + Shepherdsville.length); Shepherdsville[Shepherdsville.length] = createMarker(new GPoint(-85.69955444,38.00214386),"
Bullitt County Day Treatment Ctr Alt School
381 High School Dr
Shepherdsville, KY 40165

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bullitt County Day Treatment Ctr Alt School",'Shepherdsville=' + Shepherdsville.length); Mount_Washington[Mount_Washington.length] = createMarker(new GPoint(-85.55570221,38.04579926),"
Bullitt East High School
11450 Hwy 44e
Mount Washington, KY 40047

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bullitt East High School",'Mount_Washington=' + Mount_Washington.length); Shepherdsville[Shepherdsville.length] = createMarker(new GPoint(-85.72068024,38.00031662),"
Bullitt Lick Middle School
555 W Blue Lick Rd
Shepherdsville, KY 40165

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Bullitt Lick Middle School",'Shepherdsville=' + Shepherdsville.length); Shepherdsville[Shepherdsville.length] = createMarker(new GPoint(-85.68602753,37.97855377),"
Cedar Grove Elementary School
1900 Cedar Grove Road
Shepherdsville, KY 40165

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Cedar Grove Elementary School",'Shepherdsville=' + Shepherdsville.length); Mount_Washington[Mount_Washington.length] = createMarker(new GPoint(-85.62858300,38.02126600),"
Eastside Middle School
6925 Hwy 44e
Mount Washington, KY 40047

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Eastside Middle School",'Mount_Washington=' + Mount_Washington.length); Shepherdsville[Shepherdsville.length] = createMarker(new GPoint(-85.67935181,38.04642487),"
Freedom Elementary School
4682 North Preston Hwy.
Shepherdsville, KY 40165

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Freedom Elementary School",'Shepherdsville=' + Shepherdsville.length); Shepherdsville[Shepherdsville.length] = createMarker(new GPoint(-85.67089844,38.04957199),"
Hebron Middle School
3300 E Hebron Ln
Shepherdsville, KY 40165

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Hebron Middle School",'Shepherdsville=' + Shepherdsville.length); Lebanon_Junction[Lebanon_Junction.length] = createMarker(new GPoint(-85.72870636,37.84399033),"
Lebanon Junction Elementary School
10920 S Preston Hwy
Lebanon Junction, KY 40150

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Lebanon Junction Elementary School",'Lebanon_Junction=' + Lebanon_Junction.length); Louisville[Louisville.length] = createMarker(new GPoint(-85.68630219,38.06200790),"
Maryville Elementary School
4504 Summers Dr
Louisville, KY 40229

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Maryville Elementary School",'Louisville=' + Louisville.length); Mount_Washington[Mount_Washington.length] = createMarker(new GPoint(-85.55617523,38.03928757),"
Mount Washington Elementary School
9234 Hwy 44 E
Mount Washington, KY 40047

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Mount Washington Elementary School",'Mount_Washington=' + Mount_Washington.length); Mount_Washington[Mount_Washington.length] = createMarker(new GPoint(-85.54304504,38.04761124),"
Mount Washington Middle School
269 Water St
Mount Washington, KY 40047

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Mount Washington Middle School",'Mount_Washington=' + Mount_Washington.length); West_Point[West_Point.length] = createMarker(new GPoint(-85.90153503,38.01602936),"
Nichols Elementary School
10665 Hwy 44 W
West Point, KY 40177

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Nichols Elementary School",'West_Point=' + West_Point.length); Shepherdsville[Shepherdsville.length] = createMarker(new GPoint(-85.67089844,38.04957199),"
North Bullitt High School
3200 E Hebron Ln
Shepherdsville, KY 40165

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("North Bullitt High School",'Shepherdsville=' + Shepherdsville.length); Mount_Washington[Mount_Washington.length] = createMarker(new GPoint(-85.52246857,38.05855179),"
Old Mill Elementary School
11540 Hwy 44 E
Mount Washington, KY 40047

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Old Mill Elementary School",'Mount_Washington=' + Mount_Washington.length); Louisville[Louisville.length] = createMarker(new GPoint(-85.67768860,38.08171844),"
Overdale Elementary School
651 Overdale Dr
Louisville, KY 40229

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Overdale Elementary School",'Louisville=' + Louisville.length); Mount_Washington[Mount_Washington.length] = createMarker(new GPoint(-85.61104584,38.02652740),"
Pleasant Grove Elementary School
6415 Hwy 44 E
Mount Washington, KY 40047

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Pleasant Grove Elementary School",'Mount_Washington=' + Mount_Washington.length); Shepherdsville[Shepherdsville.length] = createMarker(new GPoint(-85.69958496,38.00211334),"
Riverview High Alternative School
383 High School Dr
Shepherdsville, KY 40165

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Riverview High Alternative School",'Shepherdsville=' + Shepherdsville.length); Shepherdsville[Shepherdsville.length] = createMarker(new GPoint(-85.70139313,37.99642944),"
Roby Elementary School
1148 Hwy 44 E
Shepherdsville, KY 40165

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Roby Elementary School",'Shepherdsville=' + Shepherdsville.length); Shepherdsville[Shepherdsville.length] = createMarker(new GPoint(-85.71896800,37.99815500),"
Shepherdsville Elementary School
527 W Blue Lick Rd
Shepherdsville, KY 40165

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Shepherdsville Elementary School",'Shepherdsville=' + Shepherdsville.length); Shepherdsville[Shepherdsville.length] = createMarker(new GPoint(-85.66599400,38.06768800),"
Zoneton Middle School
797 Old Preston Hwy N
Shepherdsville, KY 40165

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Zoneton Middle School",'Shepherdsville=' + Shepherdsville.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(Lebanon_Junction); map.removeOverlays(Louisville); map.removeOverlays(Mount_Washington); map.removeOverlays(Shepherdsville); map.removeOverlays(West_Point); 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(Shepherdsville);map.removeOverlays(Lebanon_Junction); map.removeOverlays(Louisville); map.removeOverlays(Mount_Washington); map.removeOverlays(Shepherdsville); map.removeOverlays(West_Point); map.addOverlays(Lebanon_Junction); centerByArray(Lebanon_Junction, false, false); cntMarker += Lebanon_Junction.length; map.addOverlays(Louisville); centerByArray(Louisville, false, false); cntMarker += Louisville.length; map.addOverlays(Mount_Washington); centerByArray(Mount_Washington, false, false); cntMarker += Mount_Washington.length; map.addOverlays(Shepherdsville); centerByArray(Shepherdsville, false, false); cntMarker += Shepherdsville.length; map.addOverlays(West_Point); centerByArray(West_Point, false, false); cntMarker += West_Point.length; centerByArray(Shepherdsville,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'); } }