function addMarkers(){ mySelect = document.getElementById('selection'); Fort_Thomas = [];Wilder = [];Dayton = [];Highland_Heights = [];Newport = [];Bellevue = [];Alexandria = [];Cold_Spring = [];Melbourne = [];Southgate = [];California = [];Campsprings = [];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("Campsprings schools",'all=Campsprings'); 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("Melbourne schools",'all=Melbourne'); mySelect.options[mySelect.options.length] = new Option("Newport schools",'all=Newport'); mySelect.options[mySelect.options.length] = new Option("Southgate schools",'all=Southgate'); mySelect.options[mySelect.options.length] = new Option("Wilder schools",'all=Wilder'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Fort_Thomas[Fort_Thomas.length] = createMarker(new GPoint(-84.46467100,39.08165100),"
Abby's Child Enrichment Center
29 Churchill Drive
Fort Thomas, KY 41075
Co-ed school, KG-KG
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Abby's Child Enrichment Center",'Fort_Thomas=' + Fort_Thomas.length); Wilder[Wilder.length] = createMarker(new GPoint(-84.47164000,39.01150500),"
Churchill Academy
1411 Saint Johns Lane
Wilder, KY 41076
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Churchill Academy",'Wilder=' + Wilder.length); Dayton[Dayton.length] = createMarker(new GPoint(-84.47222700,39.11494700),"
Cornerstone Montessori School
401 Berry Avenue
Dayton, KY 41074
Co-ed school, PK-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Cornerstone Montessori School",'Dayton=' + Dayton.length); Highland_Heights[Highland_Heights.length] = createMarker(new GPoint(-84.44628900,39.04465400),"
Cornerstone Montessori School
2048 Alexandria Pike
Highland Heights, KY 41076
Co-ed school, PK-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Cornerstone Montessori School",'Highland_Heights=' + Highland_Heights.length); Newport[Newport.length] = createMarker(new GPoint(-84.48857900,39.09031500),"
Holy Spirit Elementary School
840 Washington Avenue
Newport, KY 41071
Co-ed school, K-4
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Holy Spirit Elementary School",'Newport=' + Newport.length); Newport[Newport.length] = createMarker(new GPoint(-84.47610600,39.08804200),"
Holy Spirit Jr High School
10 Chesapeake Ave
Newport, KY 41071
Co-ed school, 5-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Holy Spirit Jr High School",'Newport=' + Newport.length); Bellevue[Bellevue.length] = createMarker(new GPoint(-84.48246700,39.10311700),"
Holy Trinity Elementary School
235 Division Street
Bellevue, KY 41073
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Holy Trinity Elementary School",'Bellevue=' + Bellevue.length); Alexandria[Alexandria.length] = createMarker(new GPoint(-84.39253000,38.97503800),"
Little Red School House
7717 Alexandria Pike
Alexandria, KY 41001
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Little Red School House",'Alexandria=' + Alexandria.length); Dayton[Dayton.length] = createMarker(new GPoint(-84.47214700,39.11497200),"
St. Bernard School
401 Berry St.
Dayton, KY 41074
Co-ed school, KG-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Bernard School",'Dayton=' + Dayton.length); Fort_Thomas[Fort_Thomas.length] = createMarker(new GPoint(-84.45112700,39.09737700),"
St. Catherine Of Siena
23 Rossford Avenue
Fort Thomas, KY 41075
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Catherine Of Siena",'Fort_Thomas=' + Fort_Thomas.length); Cold_Spring[Cold_Spring.length] = createMarker(new GPoint(-84.44118100,39.02299300),"
St. Joseph Elementary School
4011 Alexandria Pike
Cold Spring, KY 41076
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Joseph Elementary School",'Cold_Spring=' + Cold_Spring.length); Alexandria[Alexandria.length] = createMarker(new GPoint(-84.38904900,38.95848300),"
St. Mary Elementary School
9 South Jefferson Street
Alexandria, KY 41001
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Mary Elementary School",'Alexandria=' + Alexandria.length); Melbourne[Melbourne.length] = createMarker(new GPoint(-84.36182600,39.02937300),"
St. Philip School
1400 Mary Ingles Highway
Melbourne, KY 41059
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Philip School",'Melbourne=' + Melbourne.length); Southgate[Southgate.length] = createMarker(new GPoint(-84.47115700,39.07208800),"
St. Therese School
2516 Alexandria Pike
Southgate, KY 41071
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Therese School",'Southgate=' + Southgate.length); Fort_Thomas[Fort_Thomas.length] = createMarker(new GPoint(-84.44688300,39.07377200),"
St. Thomas School
428 South Fort Thomas Avenue
Fort Thomas, KY 41075
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Thomas School",'Fort_Thomas=' + Fort_Thomas.length); California[California.length] = createMarker(new GPoint(-84.31634500,38.87553800),"
Ss Peter & Paul Elementary School
2160 California Cross Road
California, KY 41007
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Ss Peter & Paul Elementary School",'California=' + California.length); Campsprings[Campsprings.length] = createMarker(new GPoint(-84.36342000,38.99512300),"
St Joseph Elementary School
6829 Four Mile Road
Campsprings, KY 41059
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St Joseph Elementary School",'Campsprings=' + Campsprings.length); Newport[Newport.length] = createMarker(new GPoint(-84.49110400,39.09679700),"
Trent Montessori Preschool
305 Park Avenue
Newport, KY 41071
Co-ed school, NS-PK
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Trent Montessori Preschool",'Newport=' + Newport.length); Cold_Spring[Cold_Spring.length] = createMarker(new GPoint(-84.42531200,39.01840800),"
Walnut Hills Academy
5696 E Alexandria Pike
Cold Spring, KY 41076
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Walnut Hills Academy",'Cold_Spring=' + Cold_Spring.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,11); /* 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/////1/' + showArray); map.removeOverlays(Alexandria); map.removeOverlays(Bellevue); map.removeOverlays(California); map.removeOverlays(Campsprings); map.removeOverlays(Cold_Spring); map.removeOverlays(Dayton); map.removeOverlays(Fort_Thomas); map.removeOverlays(Highland_Heights); map.removeOverlays(Melbourne); map.removeOverlays(Newport); map.removeOverlays(Southgate); map.removeOverlays(Wilder); 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(Fort_Thomas);map.removeOverlays(Alexandria); map.removeOverlays(Bellevue); map.removeOverlays(California); map.removeOverlays(Campsprings); map.removeOverlays(Cold_Spring); map.removeOverlays(Dayton); map.removeOverlays(Fort_Thomas); map.removeOverlays(Highland_Heights); map.removeOverlays(Melbourne); map.removeOverlays(Newport); map.removeOverlays(Southgate); map.removeOverlays(Wilder); 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(Campsprings); centerByArray(Campsprings, false, false); cntMarker += Campsprings.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(Melbourne); centerByArray(Melbourne, false, false); cntMarker += Melbourne.length; map.addOverlays(Newport); centerByArray(Newport, false, false); cntMarker += Newport.length; map.addOverlays(Southgate); centerByArray(Southgate, false, false); cntMarker += Southgate.length; map.addOverlays(Wilder); centerByArray(Wilder, false, false); cntMarker += Wilder.length; centerByArray(Fort_Thomas,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'); //window.open('/map.php?type=1&schools=&school_level=1&radius=&zipcode=&school_type_search=&school_type_code='); } } function createMarker(point, label, icon) { var marker = new GMarker(point, icon); var html = label; GEvent.addListener(marker, "click", function() { marker.openInfoWindowHtml(html); }); return marker; }