function addMarkers(){ mySelect = document.getElementById('selection'); Wickliffe = [];Willoughby = [];Concord_Twp = [];Mentor = [];Painesville = [];Kirtland = [];Eastlake = [];Willowick = [];mySelect.options[mySelect.options.length] = new Option("Concord Twp schools",'all=Concord_Twp'); mySelect.options[mySelect.options.length] = new Option("Eastlake schools",'all=Eastlake'); mySelect.options[mySelect.options.length] = new Option("Kirtland schools",'all=Kirtland'); mySelect.options[mySelect.options.length] = new Option("Mentor schools",'all=Mentor'); mySelect.options[mySelect.options.length] = new Option("Painesville schools",'all=Painesville'); mySelect.options[mySelect.options.length] = new Option("Wickliffe schools",'all=Wickliffe'); mySelect.options[mySelect.options.length] = new Option("Willoughby schools",'all=Willoughby'); mySelect.options[mySelect.options.length] = new Option("Willowick schools",'all=Willowick'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Wickliffe[Wickliffe.length] = createMarker(new GPoint(-81.48359100,41.59895900),"
All Saints Of St John Vianney
28702 Euclid Avenue
Wickliffe, OH 44092
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("All Saints Of St John Vianney",'Wickliffe=' + Wickliffe.length); Willoughby[Willoughby.length] = createMarker(new GPoint(-81.39728000,41.64314900),"
Andrews Osborne Academy
38588 Mentor Avenue
Willoughby, OH 44094
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Andrews Osborne Academy",'Willoughby=' + Willoughby.length); Willoughby[Willoughby.length] = createMarker(new GPoint(-81.43955600,41.58177600),"
Cornerstone Christian Academy
2846 Som Center Road
Willoughby, OH 44094
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Cornerstone Christian Academy",'Willoughby=' + Willoughby.length); Concord_Twp[Concord_Twp.length] = createMarker(new GPoint(-81.23990100,41.66444900),"
The Goddard School
7645 Fredle Drive
Concord Twp, OH 44077
Co-ed school, NS-PK
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("The Goddard School",'Concord_Twp=' + Concord_Twp.length); Concord_Twp[Concord_Twp.length] = createMarker(new GPoint(-81.27219700,41.68028300),"
Hershey Montessori School
10229 Prouty Road
Concord Twp, OH 44077
Co-ed school, PK-9
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Hershey Montessori School",'Concord_Twp=' + Concord_Twp.length); Willoughby[Willoughby.length] = createMarker(new GPoint(-81.40976600,41.63512700),"
Immaculate Conception School
37940 Euclid Avenue
Willoughby, OH 44094
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Immaculate Conception School",'Willoughby=' + Willoughby.length); Mentor[Mentor.length] = createMarker(new GPoint(-81.33093100,41.71833600),"
Mentor Christian School
8600 Lake Shore Blvd
Mentor, OH 44060
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Mentor Christian School",'Mentor=' + Mentor.length); Wickliffe[Wickliffe.length] = createMarker(new GPoint(-81.46674100,41.61167900),"
Our Lady Of Mt Carmel School
29840 Euclid Avenue
Wickliffe, OH 44092
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Our Lady Of Mt Carmel School",'Wickliffe=' + Wickliffe.length); Painesville[Painesville.length] = createMarker(new GPoint(-81.25459900,41.71738700),"
Our Shepherd Lutheran School
508 Mentor Avenue
Painesville, OH 44077
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Our Shepherd Lutheran School",'Painesville=' + Painesville.length); Painesville[Painesville.length] = createMarker(new GPoint(-81.25873100,41.70079800),"
Painesville Christian Preschool and Daycare
6235 Chestnut Street
Painesville, OH 44077
Co-ed school, NS-PK
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Painesville Christian Preschool and Daycare",'Painesville=' + Painesville.length); Kirtland[Kirtland.length] = createMarker(new GPoint(-81.35426700,41.60457400),"
Peaceful Children Montessori
8100 Eagle Road
Kirtland, OH 44094
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Peaceful Children Montessori",'Kirtland=' + Kirtland.length); Mentor[Mentor.length] = createMarker(new GPoint(-81.33454000,41.66833500),"
St. Mary Of The Assumption School
8540 Mentor Avenue
Mentor, OH 44060
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Mary Of The Assumption School",'Mentor=' + Mentor.length); Mentor[Mentor.length] = createMarker(new GPoint(-81.28359300,41.67906900),"
St Gabriel School
9935 Johnnycake Ridge Road
Mentor, OH 44060
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St Gabriel School",'Mentor=' + Mentor.length); Eastlake[Eastlake.length] = createMarker(new GPoint(-81.43335200,41.64836200),"
St Justin Martyr School
35741 Stevens Blvd
Eastlake, OH 44095
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St Justin Martyr School",'Eastlake=' + Eastlake.length); Willowick[Willowick.length] = createMarker(new GPoint(-81.46108300,41.64236300),"
St Mary Magdalene School
32114 Vine Street
Willowick, OH 44095
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St Mary Magdalene School",'Willowick=' + Willowick.length); Painesville[Painesville.length] = createMarker(new GPoint(-81.24403200,41.73054300),"
St Mary School
268 N State Street
Painesville, OH 44077
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St Mary School",'Painesville=' + Painesville.length); Willoughby[Willoughby.length] = createMarker(new GPoint(-81.36960800,41.63572300),"
Willo-Hill Christian School
4200 State Route 306
Willoughby, OH 44094
Co-ed school, PK-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Willo-Hill Christian School",'Willoughby=' + Willoughby.length); Willoughby[Willoughby.length] = createMarker(new GPoint(-81.43968000,41.61452600),"
Willoughby Montessori Day School
5543 Som Center Road
Willoughby, OH 44094
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Willoughby Montessori Day School",'Willoughby=' + Willoughby.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(Concord_Twp); map.removeOverlays(Eastlake); map.removeOverlays(Kirtland); map.removeOverlays(Mentor); map.removeOverlays(Painesville); map.removeOverlays(Wickliffe); map.removeOverlays(Willoughby); map.removeOverlays(Willowick); 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(Wickliffe);map.removeOverlays(Concord_Twp); map.removeOverlays(Eastlake); map.removeOverlays(Kirtland); map.removeOverlays(Mentor); map.removeOverlays(Painesville); map.removeOverlays(Wickliffe); map.removeOverlays(Willoughby); map.removeOverlays(Willowick); map.addOverlays(Concord_Twp); centerByArray(Concord_Twp, false, false); cntMarker += Concord_Twp.length; map.addOverlays(Eastlake); centerByArray(Eastlake, false, false); cntMarker += Eastlake.length; map.addOverlays(Kirtland); centerByArray(Kirtland, false, false); cntMarker += Kirtland.length; map.addOverlays(Mentor); centerByArray(Mentor, false, false); cntMarker += Mentor.length; map.addOverlays(Painesville); centerByArray(Painesville, false, false); cntMarker += Painesville.length; map.addOverlays(Wickliffe); centerByArray(Wickliffe, false, false); cntMarker += Wickliffe.length; map.addOverlays(Willoughby); centerByArray(Willoughby, false, false); cntMarker += Willoughby.length; map.addOverlays(Willowick); centerByArray(Willowick, false, false); cntMarker += Willowick.length; centerByArray(Wickliffe,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; }