function addMarkers() { mySelect = document.getElementById('selection'); Newport = [];California = [];Bellevue = [];Alexandria = [];Dayton = [];Cold_Spring = [];Highland_Heights = [];Fort_Thomas = [];Silver_Grove = [];Southgate = [];mySelect.options[mySelect.options.length] = new Option("Alexandria schools",'all=Alexandria'); mySelect.options[mySelect.options.length] = new Option("Bellevue schools",'all=Bellevue'); mySelect.options[mySelect.options.length] = new Option("California schools",'all=California'); mySelect.options[mySelect.options.length] = new Option("Cold Spring schools",'all=Cold_Spring'); mySelect.options[mySelect.options.length] = new Option("Dayton schools",'all=Dayton'); mySelect.options[mySelect.options.length] = new Option("Fort Thomas schools",'all=Fort_Thomas'); mySelect.options[mySelect.options.length] = new Option("Highland Heights schools",'all=Highland_Heights'); mySelect.options[mySelect.options.length] = new Option("Newport schools",'all=Newport'); mySelect.options[mySelect.options.length] = new Option("Silver Grove schools",'all=Silver_Grove'); mySelect.options[mySelect.options.length] = new Option("Southgate schools",'all=Southgate'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Newport[Newport.length] = createMarker(new GPoint(-84.48955536,39.08494949),"
A D Owens Elementary School
1102 York St
Newport, KY 41071

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("A D Owens Elementary School",'Newport=' + Newport.length); California[California.length] = createMarker(new GPoint(-84.28530121,38.89979935),"
A.j. Jolly Elementary School
10517 Mary Engles Hwy
California, KY 41007

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("A.j. Jolly Elementary School",'California=' + California.length); Bellevue[Bellevue.length] = createMarker(new GPoint(-84.48209381,39.10187912),"
Bellevue High School
201 Center St
Bellevue, KY 41073

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bellevue High School",'Bellevue=' + Bellevue.length); Newport[Newport.length] = createMarker(new GPoint(-84.49625397,39.09002686),"
Campbell Co Reg Juvenile Det Ctr Alt School
590 Columbia St
Newport, KY 41071

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Campbell Co Reg Juvenile Det Ctr Alt School",'Newport=' + Newport.length); Alexandria[Alexandria.length] = createMarker(new GPoint(-84.39394900,38.95726100),"
Campbell County Central
51 Orchard Ln
Alexandria, KY 41001

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Campbell County Central",'Alexandria=' + Alexandria.length); Alexandria[Alexandria.length] = createMarker(new GPoint(-84.43480682,39.01856613),"
Campbell County Day Treatment Ctr Alt
51 Orchard Ln
Alexandria, KY 41001

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Campbell County Day Treatment Ctr Alt",'Alexandria=' + Alexandria.length); Alexandria[Alexandria.length] = createMarker(new GPoint(-84.39277649,38.92036057),"
Campbell County High School
909 Camel Crossing
Alexandria, KY 41001

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Campbell County High School",'Alexandria=' + Alexandria.length); Alexandria[Alexandria.length] = createMarker(new GPoint(-84.39283752,38.96456528),"
Campbell County Middle School
8000 Alexandria Pk
Alexandria, KY 41001

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Campbell County Middle School",'Alexandria=' + Alexandria.length); Alexandria[Alexandria.length] = createMarker(new GPoint(-84.35639500,38.95944200),"
Campbell Ridge Elementary School
2500 Grandview Rd
Alexandria, KY 41001

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Campbell Ridge Elementary School",'Alexandria=' + Alexandria.length); Dayton[Dayton.length] = createMarker(new GPoint(-84.47114563,39.11697769),"
Dayton High School
200 Greendevil Ln
Dayton, KY 41074

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Dayton High School",'Dayton=' + Dayton.length); Cold_Spring[Cold_Spring.length] = createMarker(new GPoint(-84.43351746,39.01897812),"
Donald E. Cline Elementary School
20 E Alexandria Pk
Cold Spring, KY 41076

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Donald E. Cline Elementary School",'Cold_Spring=' + Cold_Spring.length); Newport[Newport.length] = createMarker(new GPoint(-84.49487305,39.09302139),"
Fourth Street Elementary School
101 E Fourth St
Newport, KY 41071

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Fourth Street Elementary School",'Newport=' + Newport.length); Bellevue[Bellevue.length] = createMarker(new GPoint(-84.47651672,39.10216904),"
Grandview Elementary School
500 Grandview Ave
Bellevue, KY 41073

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Grandview Elementary School",'Bellevue=' + Bellevue.length); Alexandria[Alexandria.length] = createMarker(new GPoint(-84.39437866,38.86150742),"
Grant's Lick Elementary School
9944 Clay Ridge Rd.
Alexandria, KY 41001

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Grant's Lick Elementary School",'Alexandria=' + Alexandria.length); Highland_Heights[Highland_Heights.length] = createMarker(new GPoint(-84.45159912,39.04460144),"
Highland Heights Elementary School
515 Main And Renshaw
Highland Heights, KY 41076

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Highland Heights Elementary School",'Highland_Heights=' + Highland_Heights.length); Fort_Thomas[Fort_Thomas.length] = createMarker(new GPoint(-84.45104980,39.08402634),"
Highlands High School
2400 Memorial Pkwy
Fort Thomas, KY 41075

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Highlands High School",'Fort_Thomas=' + Fort_Thomas.length); Fort_Thomas[Fort_Thomas.length] = createMarker(new GPoint(-84.45069885,39.08495712),"
Highlands Middle School
2350 Memorial Pkwy
Fort Thomas, KY 41075

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Highlands Middle School",'Fort_Thomas=' + Fort_Thomas.length); Alexandria[Alexandria.length] = createMarker(new GPoint(-84.38646698,38.90328217),"
John W. Reiley Elementary School
10631 Alexandria Pike
Alexandria, KY 41001

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("John W. Reiley Elementary School",'Alexandria=' + Alexandria.length); Fort_Thomas[Fort_Thomas.length] = createMarker(new GPoint(-84.44730377,39.09189987),"
Johnson Elementary School
1180 N Ft Thomas Ave
Fort Thomas, KY 41075

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Johnson Elementary School",'Fort_Thomas=' + Fort_Thomas.length); Dayton[Dayton.length] = createMarker(new GPoint(-84.46334076,39.11407852),"
Lincoln Elementary School
701 Fifth Ave
Dayton, KY 41074

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Lincoln Elementary School",'Dayton=' + Dayton.length); Newport[Newport.length] = createMarker(new GPoint(-84.48876190,39.09096146),"
Marquette Elementary School
8th Columbia
Newport, KY 41071

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Marquette Elementary School",'Newport=' + Newport.length); Newport[Newport.length] = createMarker(new GPoint(-84.47710419,39.08822632),"
Mildred Dean Elementary School
1360 Grand Ave
Newport, KY 41071

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Mildred Dean Elementary School",'Newport=' + Newport.length); Fort_Thomas[Fort_Thomas.length] = createMarker(new GPoint(-84.45354462,39.07649231),"
Moyer Elementary School
219 Highland Ave
Fort Thomas, KY 41075

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Moyer Elementary School",'Fort_Thomas=' + Fort_Thomas.length); Newport[Newport.length] = createMarker(new GPoint(-84.48522949,39.09613037),"
Newport High School
900 E 6th St
Newport, KY 41071

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Newport High School",'Newport=' + Newport.length); Newport[Newport.length] = createMarker(new GPoint(-84.49364471,39.08822632),"
Newport Middle School
30 West Eighth Street
Newport, KY 41071

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Newport Middle School",'Newport=' + Newport.length); Newport[Newport.length] = createMarker(new GPoint(-84.48876190,39.09096146),"
Northern Ky Learning Academy Alt School
30 W 8th Street
Newport, KY 41071

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Northern Ky Learning Academy Alt School",'Newport=' + Newport.length); Alexandria[Alexandria.length] = createMarker(new GPoint(-84.39052000,38.96453900),"
Northern Ky Learning Academy Alt School
51 Orchard Ln
Alexandria, KY 41001

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Northern Ky Learning Academy Alt School",'Alexandria=' + Alexandria.length); Cold_Spring[Cold_Spring.length] = createMarker(new GPoint(-84.43480682,39.01856613),"
Phoenix Program Special Education
10 E Alexandria
Cold Spring, KY 41076

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Phoenix Program Special Education",'Cold_Spring=' + Cold_Spring.length); Silver_Grove[Silver_Grove.length] = createMarker(new GPoint(-84.39044189,39.03377914),"
Silver Grove School
101 W Third St
Silver Grove, KY 41085

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Silver Grove School",'Silver_Grove=' + Silver_Grove.length); Southgate[Southgate.length] = createMarker(new GPoint(-84.47332001,39.07265854),"
Southgate Elementary School
Wm Blatt And Evergreen
Southgate, KY 41071

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Southgate Elementary School",'Southgate=' + Southgate.length); Fort_Thomas[Fort_Thomas.length] = createMarker(new GPoint(-84.45144653,39.05905533),"
Woodfill Elementary School
1025 Alexandria Pk
Fort Thomas, KY 41075

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Woodfill Elementary School",'Fort_Thomas=' + Fort_Thomas.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(Alexandria); map.removeOverlays(Bellevue); map.removeOverlays(California); map.removeOverlays(Cold_Spring); map.removeOverlays(Dayton); map.removeOverlays(Fort_Thomas); map.removeOverlays(Highland_Heights); map.removeOverlays(Newport); map.removeOverlays(Silver_Grove); map.removeOverlays(Southgate); 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(Newport);map.removeOverlays(Alexandria); map.removeOverlays(Bellevue); map.removeOverlays(California); map.removeOverlays(Cold_Spring); map.removeOverlays(Dayton); map.removeOverlays(Fort_Thomas); map.removeOverlays(Highland_Heights); map.removeOverlays(Newport); map.removeOverlays(Silver_Grove); map.removeOverlays(Southgate); map.addOverlays(Alexandria); centerByArray(Alexandria, false, false); cntMarker += Alexandria.length; map.addOverlays(Bellevue); centerByArray(Bellevue, false, false); cntMarker += Bellevue.length; map.addOverlays(California); centerByArray(California, false, false); cntMarker += California.length; map.addOverlays(Cold_Spring); centerByArray(Cold_Spring, false, false); cntMarker += Cold_Spring.length; map.addOverlays(Dayton); centerByArray(Dayton, false, false); cntMarker += Dayton.length; map.addOverlays(Fort_Thomas); centerByArray(Fort_Thomas, false, false); cntMarker += Fort_Thomas.length; map.addOverlays(Highland_Heights); centerByArray(Highland_Heights, false, false); cntMarker += Highland_Heights.length; map.addOverlays(Newport); centerByArray(Newport, false, false); cntMarker += Newport.length; map.addOverlays(Silver_Grove); centerByArray(Silver_Grove, false, false); cntMarker += Silver_Grove.length; map.addOverlays(Southgate); centerByArray(Southgate, false, false); cntMarker += Southgate.length; centerByArray(Newport,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'); } }