function addMarkers() { mySelect = document.getElementById('selection'); Bowling_Green = [];Alvaton = [];Smiths_Grove = [];Oakland = [];mySelect.options[mySelect.options.length] = new Option("Alvaton schools",'all=Alvaton'); mySelect.options[mySelect.options.length] = new Option("Bowling Green schools",'all=Bowling_Green'); mySelect.options[mySelect.options.length] = new Option("Oakland schools",'all=Oakland'); mySelect.options[mySelect.options.length] = new Option("Smiths Grove schools",'all=Smiths_Grove'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Bowling_Green[Bowling_Green.length] = createMarker(new GPoint(-86.45379639,36.93582153),"
11th Street Alternative School
877 E 11th St
Bowling Green, KY 42101

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("11th Street Alternative School",'Bowling_Green=' + Bowling_Green.length); Alvaton[Alvaton.length] = createMarker(new GPoint(-86.38950348,36.87630081),"
Alvaton Elementary School
1 Robert Morgan Ln
Alvaton, KY 42122

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Alvaton Elementary School",'Alvaton=' + Alvaton.length); Bowling_Green[Bowling_Green.length] = createMarker(new GPoint(-86.50563049,36.99163818),"
Bellewood Alternative School
331 Brookwood Dr
Bowling Green, KY 42101

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bellewood Alternative School",'Bowling_Green=' + Bowling_Green.length); Bowling_Green[Bowling_Green.length] = createMarker(new GPoint(-86.43995667,36.96493912),"
Bowling Green High School
1801 Rockingham Lane
Bowling Green, KY 42104

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bowling Green High School",'Bowling_Green=' + Bowling_Green.length); Bowling_Green[Bowling_Green.length] = createMarker(new GPoint(-86.45915985,36.96113968),"
Bowling Green Middle School
900 Campbell Ln
Bowling Green, KY 42104

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Bowling Green Middle School",'Bowling_Green=' + Bowling_Green.length); Bowling_Green[Bowling_Green.length] = createMarker(new GPoint(-86.39998627,36.97426987),"
Briarwood Elementary School
265 Lovers Ln
Bowling Green, KY 42103

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Briarwood Elementary School",'Bowling_Green=' + Bowling_Green.length); Bowling_Green[Bowling_Green.length] = createMarker(new GPoint(-86.34837341,37.03148270),"
Bristow Elementary School
6151 Louisville Rd
Bowling Green, KY 42101

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Bristow Elementary School",'Bowling_Green=' + Bowling_Green.length); Bowling_Green[Bowling_Green.length] = createMarker(new GPoint(-86.43453979,36.99522018),"
Children's Crisis Stabilization Unit Alt
7501 Chestnut St
Bowling Green, KY 42101

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Children's Crisis Stabilization Unit Alt",'Bowling_Green=' + Bowling_Green.length); Bowling_Green[Bowling_Green.length] = createMarker(new GPoint(-86.39488220,36.96908951),"
Cumberland Trace Elementary School
830 Cumberland Tr
Bowling Green, KY 42103

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Cumberland Trace Elementary School",'Bowling_Green=' + Bowling_Green.length); Bowling_Green[Bowling_Green.length] = createMarker(new GPoint(-86.44558400,36.99462500),"
Day Treatment Center Alternative High School
1901 Russellville Rd
Bowling Green, KY 42101

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Day Treatment Center Alternative High School",'Bowling_Green=' + Bowling_Green.length); Bowling_Green[Bowling_Green.length] = createMarker(new GPoint(-86.46211243,36.98836136),"
Dishman Mcginnis Elementary School
503 Old Morgantown Road
Bowling Green, KY 42101

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Dishman Mcginnis Elementary School",'Bowling_Green=' + Bowling_Green.length); Bowling_Green[Bowling_Green.length] = createMarker(new GPoint(-86.41176605,36.92674637),"
Drakes Creek Middle School
704 Cypress Wood Way
Bowling Green, KY 42104

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Drakes Creek Middle School",'Bowling_Green=' + Bowling_Green.length); Bowling_Green[Bowling_Green.length] = createMarker(new GPoint(-86.41180420,36.92742920),"
Greenwood High School
5065 Scottsville Road
Bowling Green, KY 42104

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Greenwood High School",'Bowling_Green=' + Bowling_Green.length); Bowling_Green[Bowling_Green.length] = createMarker(new GPoint(-86.48677826,36.96387482),"
Henry F Moss Middle School
2565 Russellville Rd
Bowling Green, KY 42101

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Henry F Moss Middle School",'Bowling_Green=' + Bowling_Green.length); Bowling_Green[Bowling_Green.length] = createMarker(new GPoint(-86.45885468,36.99278641),"
L C Curry Elementary School
1350 Durbin Dr
Bowling Green, KY 42101

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("L C Curry Elementary School",'Bowling_Green=' + Bowling_Green.length); Bowling_Green[Bowling_Green.length] = createMarker(new GPoint(-86.45269012,37.00725555),"
Lighthouse Academy Alternative School
877 Jackson St
Bowling Green, KY 42101

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Lighthouse Academy Alternative School",'Bowling_Green=' + Bowling_Green.length); Bowling_Green[Bowling_Green.length] = createMarker(new GPoint(-86.48088074,36.94954681),"
Lost River Elementary School
450 Modern Way
Bowling Green, KY 42101

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Lost River Elementary School",'Bowling_Green=' + Bowling_Green.length); Bowling_Green[Bowling_Green.length] = createMarker(new GPoint(-86.46985626,36.98403931),"
Middle School Alternative Learning Center
559 Morgantown Rd
Bowling Green, KY 42101

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Middle School Alternative Learning Center",'Bowling_Green=' + Bowling_Green.length); Smiths_Grove[Smiths_Grove.length] = createMarker(new GPoint(-86.20643616,37.05596161),"
North Warren Elementary School
420 College St
Smiths Grove, KY 42171

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("North Warren Elementary School",'Smiths_Grove=' + Smiths_Grove.length); Oakland[Oakland.length] = createMarker(new GPoint(-86.24928284,37.03680038),"
Oakland Elementary School
2494 Church St
Oakland, KY 42159

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Oakland Elementary School",'Oakland=' + Oakland.length); Bowling_Green[Bowling_Green.length] = createMarker(new GPoint(-86.44118500,37.00675583),"
Parker Bennett Curry Elementary School
165 Webb Dr
Bowling Green, KY 42101

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Parker Bennett Curry Elementary School",'Bowling_Green=' + Bowling_Green.length); Bowling_Green[Bowling_Green.length] = createMarker(new GPoint(-86.41726685,36.98411179),"
Potter Gray Elementary School
610 Wakefield Dr.
Bowling Green, KY 42103

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Potter Gray Elementary School",'Bowling_Green=' + Bowling_Green.length); Bowling_Green[Bowling_Green.length] = createMarker(new GPoint(-86.51101685,36.89509583),"
Rich Pond Elementary School
530 Rich Pond Road
Bowling Green, KY 42104

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Rich Pond Elementary School",'Bowling_Green=' + Bowling_Green.length); Bowling_Green[Bowling_Green.length] = createMarker(new GPoint(-86.47167206,37.10123825),"
Richardsville Elementary School
1775 Richardsville Rd
Bowling Green, KY 42101

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Richardsville Elementary School",'Bowling_Green=' + Bowling_Green.length); Bowling_Green[Bowling_Green.length] = createMarker(new GPoint(-86.38192749,36.99964523),"
Rivendell Psychiatric Alt High School
1035 Porter Pike Rd
Bowling Green, KY 42103

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Rivendell Psychiatric Alt High School",'Bowling_Green=' + Bowling_Green.length); Bowling_Green[Bowling_Green.length] = createMarker(new GPoint(-86.38192749,36.99964523),"
Rivendell Psychiatric Alternative Center
1035 Porter Pike Rd
Bowling Green, KY 42103

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Rivendell Psychiatric Alternative Center",'Bowling_Green=' + Bowling_Green.length); Bowling_Green[Bowling_Green.length] = createMarker(new GPoint(-86.54586792,36.92865753),"
Rockfield Elementary School
7597 Russellville Rd
Bowling Green, KY 42101

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Rockfield Elementary School",'Bowling_Green=' + Bowling_Green.length); Bowling_Green[Bowling_Green.length] = createMarker(new GPoint(-86.44741821,36.97683716),"
T C Cherry Elementary School
1001 Liberty Ave
Bowling Green, KY 42104

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("T C Cherry Elementary School",'Bowling_Green=' + Bowling_Green.length); Bowling_Green[Bowling_Green.length] = createMarker(new GPoint(-86.46147156,36.98128128),"
W R Mcneill Elementary School
1800 Creason Drive
Bowling Green, KY 42101

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("W R Mcneill Elementary School",'Bowling_Green=' + Bowling_Green.length); Bowling_Green[Bowling_Green.length] = createMarker(new GPoint(-86.46985626,36.98403931),"
Warren Central High School
559 Morgantown Rd
Bowling Green, KY 42101

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Warren Central High School",'Bowling_Green=' + Bowling_Green.length); Bowling_Green[Bowling_Green.length] = createMarker(new GPoint(-86.47977448,36.98387527),"
Warren County Elementary School
1846 Loop Drive
Bowling Green, KY 42101

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Warren County Elementary School",'Bowling_Green=' + Bowling_Green.length); Bowling_Green[Bowling_Green.length] = createMarker(new GPoint(-86.33927917,37.03615570),"
Warren East High School
6867 Louisville Rd
Bowling Green, KY 42101

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Warren East High School",'Bowling_Green=' + Bowling_Green.length); Bowling_Green[Bowling_Green.length] = createMarker(new GPoint(-86.33639526,37.03754807),"
Warren East Middle School
7031 Louisville Rd
Bowling Green, KY 42101

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Warren East Middle School",'Bowling_Green=' + Bowling_Green.length); Bowling_Green[Bowling_Green.length] = createMarker(new GPoint(-86.44519806,36.99476242),"
Warren Regional Juv Detention Center Alt
N
Bowling Green, KY 42102

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Warren Regional Juv Detention Center Alt",'Bowling_Green=' + Bowling_Green.length); Bowling_Green[Bowling_Green.length] = createMarker(new GPoint(-86.44828796,36.94227600),"
William Natcher Elementary School
1434 Cave Mill Rd
Bowling Green, KY 42104

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("William Natcher Elementary School",'Bowling_Green=' + Bowling_Green.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(Alvaton); map.removeOverlays(Bowling_Green); map.removeOverlays(Oakland); map.removeOverlays(Smiths_Grove); 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(Bowling_Green);map.removeOverlays(Alvaton); map.removeOverlays(Bowling_Green); map.removeOverlays(Oakland); map.removeOverlays(Smiths_Grove); map.addOverlays(Alvaton); centerByArray(Alvaton, false, false); cntMarker += Alvaton.length; map.addOverlays(Bowling_Green); centerByArray(Bowling_Green, false, false); cntMarker += Bowling_Green.length; map.addOverlays(Oakland); centerByArray(Oakland, false, false); cntMarker += Oakland.length; map.addOverlays(Smiths_Grove); centerByArray(Smiths_Grove, false, false); cntMarker += Smiths_Grove.length; centerByArray(Bowling_Green,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'); } }