function addMarkers(){ mySelect = document.getElementById('selection'); Fairfield = [];Hamilton = [];West_Chester = [];Middletown = [];Oxford = [];mySelect.options[mySelect.options.length] = new Option("Fairfield schools",'all=Fairfield'); mySelect.options[mySelect.options.length] = new Option("Hamilton schools",'all=Hamilton'); mySelect.options[mySelect.options.length] = new Option("Middletown schools",'all=Middletown'); mySelect.options[mySelect.options.length] = new Option("Oxford schools",'all=Oxford'); mySelect.options[mySelect.options.length] = new Option("West Chester schools",'all=West_Chester'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Fairfield[Fairfield.length] = createMarker(new GPoint(-84.48639800,39.30590800),"
Cincinnati Christian Schools I
7350 Dixie Highway
Fairfield, OH 45014
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Cincinnati Christian Schools I",'Fairfield=' + Fairfield.length); Hamilton[Hamilton.length] = createMarker(new GPoint(-84.59227100,39.42059500),"
The Colonial Schools
855 Stahlheber Road
Hamilton, OH 45013
Co-ed school, NS-PK
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("The Colonial Schools",'Hamilton=' + Hamilton.length); Fairfield[Fairfield.length] = createMarker(new GPoint(-84.54150500,39.34883700),"
Daysprings Children's Center
110 Bacher Square
Fairfield, OH 45014
Co-ed school, PK-KG
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Daysprings Children's Center",'Fairfield=' + Fairfield.length); West_Chester[West_Chester.length] = createMarker(new GPoint(-84.41067400,39.32694800),"
The Discovery Center
9035 Cincinnati Dayton Road
West Chester, OH 45069
Co-ed school, NS-PK
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("The Discovery Center",'West_Chester=' + West_Chester.length); Fairfield[Fairfield.length] = createMarker(new GPoint(-84.56020400,39.31505800),"
Fairfield Educational Bulding
1748 Happy Valley Drive
Fairfield, OH 45014
Co-ed school, NS-PK
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Fairfield Educational Bulding",'Fairfield=' + Fairfield.length); Hamilton[Hamilton.length] = createMarker(new GPoint(-84.50228400,39.36212100),"
Farmview Montessori Garden
3501 Tylersville Road
Hamilton, OH 45011
Co-ed school, NS-PK
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Farmview Montessori Garden",'Hamilton=' + Hamilton.length); Middletown[Middletown.length] = createMarker(new GPoint(-84.42028600,39.45536300),"
H.t.r. Christian School
6342 Hamilton-middletown Rd
Middletown, OH 45044
Co-ed school, KG-11
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("H.t.r. Christian School",'Middletown=' + Middletown.length); Hamilton[Hamilton.length] = createMarker(new GPoint(-84.50400000,39.39760000),"
Ham-mid Sda Elementary School
3570 Ham-mid Hwy Rt 4
Hamilton, OH 45011
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Ham-mid Sda Elementary School",'Hamilton=' + Hamilton.length); Hamilton[Hamilton.length] = createMarker(new GPoint(-84.60132100,39.40798700),"
Hamilton Christian School
40 Wrenwood Drive
Hamilton, OH 45013
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Hamilton Christian School",'Hamilton=' + Hamilton.length); Hamilton[Hamilton.length] = createMarker(new GPoint(-84.58765000,39.41831300),"
Immanuel Lutheran School
1285 Main Street
Hamilton, OH 45013
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Immanuel Lutheran School",'Hamilton=' + Hamilton.length); West_Chester[West_Chester.length] = createMarker(new GPoint(-84.38184900,39.34890900),"
International Academy Of Cincinnati
8094 Plantation Drive
West Chester, OH 45069
Co-ed school, PK-7
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("International Academy Of Cincinnati",'West_Chester=' + West_Chester.length); Middletown[Middletown.length] = createMarker(new GPoint(-84.36212000,39.51132100),"
John Xxiii Catholic Elementary School
3806 Manchester Road
Middletown, OH 45042
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("John Xxiii Catholic Elementary School",'Middletown=' + Middletown.length); Fairfield[Fairfield.length] = createMarker(new GPoint(-84.51643700,39.32144100),"
Lavalle Private School
3200 Woodside Drive
Fairfield, OH 45014
Co-ed school, PK-7
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Lavalle Private School",'Fairfield=' + Fairfield.length); Oxford[Oxford.length] = createMarker(new GPoint(-84.73860000,39.50050000),"
Mcguffey Foundation School
Po Box 502
Oxford, OH 45056
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Mcguffey Foundation School",'Oxford=' + Oxford.length); Middletown[Middletown.length] = createMarker(new GPoint(-84.38221400,39.39800800),"
Mother Theresa Catholic Elementary
6085 Jackie Drive
Middletown, OH 45044
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Mother Theresa Catholic Elementary",'Middletown=' + Middletown.length); Hamilton[Hamilton.length] = createMarker(new GPoint(-84.64379900,39.39364900),"
Queen Of Peace Elementary School
2550 Millville Avenue
Hamilton, OH 45013
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Queen Of Peace Elementary School",'Hamilton=' + Hamilton.length); Fairfield[Fairfield.length] = createMarker(new GPoint(-84.56620200,39.33813700),"
Sacred Heart Elementary School
400 Nilles Road
Fairfield, OH 45014
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Sacred Heart Elementary School",'Fairfield=' + Fairfield.length); Hamilton[Hamilton.length] = createMarker(new GPoint(-84.55754200,39.36658700),"
St. Ann Catholic School
3064 Pleasant Avenue
Hamilton, OH 45015
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Ann Catholic School",'Hamilton=' + Hamilton.length); Hamilton[Hamilton.length] = createMarker(new GPoint(-84.56510800,39.39094400),"
St. Joseph Consolidated School
925 South 2nd Street
Hamilton, OH 45011
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Joseph Consolidated School",'Hamilton=' + Hamilton.length); Hamilton[Hamilton.length] = createMarker(new GPoint(-84.54433800,39.38409800),"
St Julie Billiart School
1206 Shuler Avenue
Hamilton, OH 45011
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St Julie Billiart School",'Hamilton=' + Hamilton.length); Hamilton[Hamilton.length] = createMarker(new GPoint(-84.56694800,39.40818100),"
St Peters In Chains School
451 Ridgelawn Avenue
Hamilton, OH 45013
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St Peters In Chains School",'Hamilton=' + Hamilton.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(Fairfield); map.removeOverlays(Hamilton); map.removeOverlays(Middletown); map.removeOverlays(Oxford); map.removeOverlays(West_Chester); 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(Fairfield);map.removeOverlays(Fairfield); map.removeOverlays(Hamilton); map.removeOverlays(Middletown); map.removeOverlays(Oxford); map.removeOverlays(West_Chester); map.addOverlays(Fairfield); centerByArray(Fairfield, false, false); cntMarker += Fairfield.length; map.addOverlays(Hamilton); centerByArray(Hamilton, false, false); cntMarker += Hamilton.length; map.addOverlays(Middletown); centerByArray(Middletown, false, false); cntMarker += Middletown.length; map.addOverlays(Oxford); centerByArray(Oxford, false, false); cntMarker += Oxford.length; map.addOverlays(West_Chester); centerByArray(West_Chester, false, false); cntMarker += West_Chester.length; centerByArray(Fairfield,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; }