function addMarkers(){ mySelect = document.getElementById('selection'); Covington = [];Georgetown = [];Louisville = [];Dayton = [];Highland_Heights = [];Erlanger = [];Nicholasville = [];Danville = [];Ashland = [];Frankfort = [];Maysville = [];Crescent_Springs = [];Lexington = [];Nazareth = [];Paducah = [];Villa_Hills = [];mySelect.options[mySelect.options.length] = new Option("Ashland schools",'all=Ashland'); mySelect.options[mySelect.options.length] = new Option("Covington schools",'all=Covington'); mySelect.options[mySelect.options.length] = new Option("Crescent Springs schools",'all=Crescent_Springs'); mySelect.options[mySelect.options.length] = new Option("Danville schools",'all=Danville'); mySelect.options[mySelect.options.length] = new Option("Dayton schools",'all=Dayton'); mySelect.options[mySelect.options.length] = new Option("Erlanger schools",'all=Erlanger'); mySelect.options[mySelect.options.length] = new Option("Frankfort schools",'all=Frankfort'); mySelect.options[mySelect.options.length] = new Option("Georgetown schools",'all=Georgetown'); mySelect.options[mySelect.options.length] = new Option("Highland Heights schools",'all=Highland_Heights'); mySelect.options[mySelect.options.length] = new Option("Lexington schools",'all=Lexington'); mySelect.options[mySelect.options.length] = new Option("Louisville schools",'all=Louisville'); mySelect.options[mySelect.options.length] = new Option("Maysville schools",'all=Maysville'); mySelect.options[mySelect.options.length] = new Option("Nazareth schools",'all=Nazareth'); mySelect.options[mySelect.options.length] = new Option("Nicholasville schools",'all=Nicholasville'); mySelect.options[mySelect.options.length] = new Option("Paducah schools",'all=Paducah'); mySelect.options[mySelect.options.length] = new Option("Villa Hills schools",'all=Villa_Hills'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Covington[Covington.length] = createMarker(new GPoint(-84.50897800,39.07850400),"
Cathedral Child Development Center
1125 Madison Avenue
Covington, KY 41011
Co-ed school, NS-PK
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Cathedral Child Development Center",'Covington=' + Covington.length); Georgetown[Georgetown.length] = createMarker(new GPoint(-84.55802400,38.20868300),"
Childrens Montessori School
800 Cincinnati Road 8
Georgetown, KY 40324
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Childrens Montessori School",'Georgetown=' + Georgetown.length); Louisville[Louisville.length] = createMarker(new GPoint(-85.82527600,38.24948700),"
Christ The King Learning Center
724 S 44th Street
Louisville, KY 40211
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Christ The King Learning Center",'Louisville=' + Louisville.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); Erlanger[Erlanger.length] = createMarker(new GPoint(-84.61439500,39.03054800),"
Country Hills Montessori-erlanger
630 Viox Drive
Erlanger, KY 41018
Co-ed school, NS-PK
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Country Hills Montessori-erlanger",'Erlanger=' + Erlanger.length); Nicholasville[Nicholasville.length] = createMarker(new GPoint(-84.35726000,38.14126000),"
Creative Montessori School
3220 Lexington Road
Nicholasville, KY 40356
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Creative Montessori School",'Nicholasville=' + Nicholasville.length); Danville[Danville.length] = createMarker(new GPoint(-84.76547600,37.64553700),"
Danville Montessori School
411 E Main Street
Danville, KY 40422
Co-ed school, PK-5
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Danville Montessori School",'Danville=' + Danville.length); Ashland[Ashland.length] = createMarker(new GPoint(-82.64707700,38.48229600),"
Holy Family School
932 Winchester Avenue
Ashland, KY 41101
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Holy Family School",'Ashland=' + Ashland.length); Louisville[Louisville.length] = createMarker(new GPoint(-85.67814800,38.21754700),"
Mercy Montessori School
2181 Tyler Lane
Louisville, KY 40205
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Mercy Montessori School",'Louisville=' + Louisville.length); Frankfort[Frankfort.length] = createMarker(new GPoint(-84.85092900,38.21799300),"
Montessori School Of Frankfort
104 Cove Spring
Frankfort, KY 40601
Co-ed school, PK-KG
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Montessori School Of Frankfort",'Frankfort=' + Frankfort.length); Maysville[Maysville.length] = createMarker(new GPoint(-83.76486400,38.64689700),"
Nativity Montessori School
31 E 3rd Street
Maysville, KY 41056
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Nativity Montessori School",'Maysville=' + Maysville.length); Crescent_Springs[Crescent_Springs.length] = createMarker(new GPoint(-84.58249600,39.04895500),"
Northern Ky Montessori Center
2625 Anderson Road
Crescent Springs, KY 41017
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Northern Ky Montessori Center",'Crescent_Springs=' + Crescent_Springs.length); Covington[Covington.length] = createMarker(new GPoint(-84.52149900,39.07697700),"
Prince Of Peace School
625 Pike Street
Covington, KY 41011
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Prince Of Peace School",'Covington=' + Covington.length); Lexington[Lexington.length] = createMarker(new GPoint(-84.52038400,38.05976800),"
Providence Montessori School
1209 Texaco Rd
Lexington, KY 40508
Co-ed school, PK-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Providence Montessori School",'Lexington=' + Lexington.length); Nazareth[Nazareth.length] = createMarker(new GPoint(-85.47410300,37.84716200),"
St. Joseph Montessori Children's Center
Po Box 44 161 West Drive
Nazareth, KY 40048
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Joseph Montessori Children's Center",'Nazareth=' + Nazareth.length); Paducah[Paducah.length] = createMarker(new GPoint(-88.59732300,37.06367100),"
Speedwell Montessori
1128 Murray Ave
Paducah, KY 42003
Co-ed school, PK-2
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Speedwell Montessori",'Paducah=' + Paducah.length); Louisville[Louisville.length] = createMarker(new GPoint(-85.67729600,38.24883700),"
Ursuline Montessori School
3105 Lexington Road
Louisville, KY 40206
Co-ed school, NS-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Ursuline Montessori School",'Louisville=' + Louisville.length); Villa_Hills[Villa_Hills.length] = createMarker(new GPoint(-84.58580200,39.06624800),"
Villa Madonna Montessori
2402 Amsterdam Road
Villa Hills, KY 41017
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Villa Madonna Montessori",'Villa_Hills=' + Villa_Hills.length); map.removeOverlays(Ashland); map.removeOverlays(Covington); map.removeOverlays(Crescent_Springs); map.removeOverlays(Danville); map.removeOverlays(Dayton); map.removeOverlays(Erlanger); map.removeOverlays(Frankfort); map.removeOverlays(Georgetown); map.removeOverlays(Highland_Heights); map.removeOverlays(Lexington); map.removeOverlays(Louisville); map.removeOverlays(Maysville); map.removeOverlays(Nazareth); map.removeOverlays(Nicholasville); map.removeOverlays(Paducah); map.removeOverlays(Villa_Hills); setTimeout(function(){map.addOverlays(Ashland)},1000); setTimeout(function(){map.addOverlays(Covington)},1000); setTimeout(function(){map.addOverlays(Crescent_Springs)},1000); setTimeout(function(){map.addOverlays(Danville)},1000); setTimeout(function(){map.addOverlays(Dayton)},1000); setTimeout(function(){map.addOverlays(Erlanger)},1000); setTimeout(function(){map.addOverlays(Frankfort)},1000); setTimeout(function(){map.addOverlays(Georgetown)},1000); setTimeout(function(){map.addOverlays(Highland_Heights)},1000); setTimeout(function(){map.addOverlays(Lexington)},1000); setTimeout(function(){map.addOverlays(Louisville)},1000); setTimeout(function(){map.addOverlays(Maysville)},1000); setTimeout(function(){map.addOverlays(Nazareth)},1000); setTimeout(function(){map.addOverlays(Nicholasville)},1000); setTimeout(function(){map.addOverlays(Paducah)},1000); setTimeout(function(){map.addOverlays(Villa_Hills)},1000); maxLng = -82.64707700; maxLat = 39.11494700; minLng = -88.59732300; minLat = 37.06367100; reCenterMap(); } // 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//////' + showArray); map.removeOverlays(Ashland); map.removeOverlays(Covington); map.removeOverlays(Crescent_Springs); map.removeOverlays(Danville); map.removeOverlays(Dayton); map.removeOverlays(Erlanger); map.removeOverlays(Frankfort); map.removeOverlays(Georgetown); map.removeOverlays(Highland_Heights); map.removeOverlays(Lexington); map.removeOverlays(Louisville); map.removeOverlays(Maysville); map.removeOverlays(Nazareth); map.removeOverlays(Nicholasville); map.removeOverlays(Paducah); map.removeOverlays(Villa_Hills); 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(Covington);map.removeOverlays(Ashland); map.removeOverlays(Covington); map.removeOverlays(Crescent_Springs); map.removeOverlays(Danville); map.removeOverlays(Dayton); map.removeOverlays(Erlanger); map.removeOverlays(Frankfort); map.removeOverlays(Georgetown); map.removeOverlays(Highland_Heights); map.removeOverlays(Lexington); map.removeOverlays(Louisville); map.removeOverlays(Maysville); map.removeOverlays(Nazareth); map.removeOverlays(Nicholasville); map.removeOverlays(Paducah); map.removeOverlays(Villa_Hills); map.addOverlays(Ashland); centerByArray(Ashland, false, false); cntMarker += Ashland.length; map.addOverlays(Covington); centerByArray(Covington, false, false); cntMarker += Covington.length; map.addOverlays(Crescent_Springs); centerByArray(Crescent_Springs, false, false); cntMarker += Crescent_Springs.length; map.addOverlays(Danville); centerByArray(Danville, false, false); cntMarker += Danville.length; map.addOverlays(Dayton); centerByArray(Dayton, false, false); cntMarker += Dayton.length; map.addOverlays(Erlanger); centerByArray(Erlanger, false, false); cntMarker += Erlanger.length; map.addOverlays(Frankfort); centerByArray(Frankfort, false, false); cntMarker += Frankfort.length; map.addOverlays(Georgetown); centerByArray(Georgetown, false, false); cntMarker += Georgetown.length; map.addOverlays(Highland_Heights); centerByArray(Highland_Heights, false, false); cntMarker += Highland_Heights.length; map.addOverlays(Lexington); centerByArray(Lexington, false, false); cntMarker += Lexington.length; map.addOverlays(Louisville); centerByArray(Louisville, false, false); cntMarker += Louisville.length; map.addOverlays(Maysville); centerByArray(Maysville, false, false); cntMarker += Maysville.length; map.addOverlays(Nazareth); centerByArray(Nazareth, false, false); cntMarker += Nazareth.length; map.addOverlays(Nicholasville); centerByArray(Nicholasville, false, false); cntMarker += Nicholasville.length; map.addOverlays(Paducah); centerByArray(Paducah, false, false); cntMarker += Paducah.length; map.addOverlays(Villa_Hills); centerByArray(Villa_Hills, false, false); cntMarker += Villa_Hills.length; centerByArray(Covington,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///11177,11410,11265,11237,11133,34762,11420,11226,11101,11419,11266,11475,11218,11389,11141,34582,11421,11287,11394,/all'); //window.open('/map.php?type=2&schools=11177,11410,11265,11237,11133,34762,11420,11226,11101,11419,11266,11475,11218,11389,11141,34582,11421,11287,11394,&school_level=&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; }