function addMarkers() { mySelect = document.getElementById('selection'); Auburn = [];Bay_City = [];Essexville = [];Pinconning = [];Linwood = [];mySelect.options[mySelect.options.length] = new Option("Auburn schools",'all=Auburn'); mySelect.options[mySelect.options.length] = new Option("Bay City schools",'all=Bay_City'); mySelect.options[mySelect.options.length] = new Option("Essexville schools",'all=Essexville'); mySelect.options[mySelect.options.length] = new Option("Linwood schools",'all=Linwood'); mySelect.options[mySelect.options.length] = new Option("Pinconning schools",'all=Pinconning'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Auburn[Auburn.length] = createMarker(new GPoint(-84.07509613,43.60336304),"
Auburn Elementary School
301 E. Midland Street
Auburn, MI 48611

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Auburn Elementary School",'Auburn=' + Auburn.length); Bay_City[Bay_City.length] = createMarker(new GPoint(-83.89801025,43.64117432),"
Bangor Central School
208 State Park Drive
Bay City, MI 48706

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Bangor Central School",'Bay_City=' + Bay_City.length); Bay_City[Bay_City.length] = createMarker(new GPoint(-83.91230774,43.65959549),"
Bangor Lincoln School
2771 N. Euclid Avenue
Bay City, MI 48706

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Bangor Lincoln School",'Bay_City=' + Bay_City.length); Bay_City[Bay_City.length] = createMarker(new GPoint(-83.89269257,43.65815353),"
Bangor North Preschool And Day Care
504 Revilo Drive
Bay City, MI 48706

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Bangor North Preschool And Day Care",'Bay_City=' + Bay_City.length); Bay_City[Bay_City.length] = createMarker(new GPoint(-83.92690277,43.62403870),"
Bangor West Central School
3175 E. Wilder Road
Bay City, MI 48706

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Bangor West Central School",'Bay_City=' + Bay_City.length); Bay_City[Bay_City.length] = createMarker(new GPoint(-83.89440918,43.61675262),"
Bay County Psa Elementary School
1110 State Street
Bay City, MI 48706

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Bay County Psa Elementary School",'Bay_City=' + Bay_City.length); Essexville[Essexville.length] = createMarker(new GPoint(-83.83943939,43.61096191),"
Bay-arenac Community High School
1608 Hudson Street
Essexville, MI 48732

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bay-arenac Community High School",'Essexville=' + Essexville.length); Bay_City[Bay_City.length] = createMarker(new GPoint(-83.94606781,43.62017441),"
Career Center
4155 Monitor Road
Bay City, MI 48706

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Career Center",'Bay_City=' + Bay_City.length); Bay_City[Bay_City.length] = createMarker(new GPoint(-83.87445831,43.58926392),"
Central High School
1624 Columbus Avenue
Bay City, MI 48708

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Central High School",'Bay_City=' + Bay_City.length); Bay_City[Bay_City.length] = createMarker(new GPoint(-83.92089081,43.61673737),"
Christa Mcauliffe Middle School
3281 E. Kiesel Road
Bay City, MI 48706

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Christa Mcauliffe Middle School",'Bay_City=' + Bay_City.length); Bay_City[Bay_City.length] = createMarker(new GPoint(-83.93185600,43.61730400),"
Community Based - Early Childhood
4228 Two Mile Rd.
Bay City, MI 48706

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Community Based - Early Childhood",'Bay_City=' + Bay_City.length); Essexville[Essexville.length] = createMarker(new GPoint(-83.83720398,43.60631943),"
Cramer Junior High School
313 Pine Street
Essexville, MI 48732

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Cramer Junior High School",'Essexville=' + Essexville.length); Essexville[Essexville.length] = createMarker(new GPoint(-83.80165100,43.61603546),"
Detention Center
520 Hampton Road
Essexville, MI 48732

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Detention Center",'Essexville=' + Essexville.length); Bay_City[Bay_City.length] = createMarker(new GPoint(-83.86546400,43.60537500),"
Eastside Middle School
201 Woodside Lane
Bay City, MI 48708

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Eastside Middle School",'Bay_City=' + Bay_City.length); Auburn[Auburn.length] = createMarker(new GPoint(-84.13537598,43.60442352),"
Forest Center
2169 Midland Road
Auburn, MI 48611

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Forest Center",'Auburn=' + Auburn.length); Essexville[Essexville.length] = createMarker(new GPoint(-83.83720398,43.60506058),"
Garber High School
213 Pine Street
Essexville, MI 48732

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Garber High School",'Essexville=' + Essexville.length); Pinconning[Pinconning.length] = createMarker(new GPoint(-84.08679962,43.79710007),"
Garfield-fraser Elementary S
1412 Garfield Road
Pinconning, MI 48650

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Garfield-fraser Elementary S",'Pinconning=' + Pinconning.length); Bay_City[Bay_City.length] = createMarker(new GPoint(-83.85314178,43.58013535),"
Hampton Elementary School
1908 W. Youngs Ditch Road
Bay City, MI 48708

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Hampton Elementary School",'Bay_City=' + Bay_City.length); Bay_City[Bay_City.length] = createMarker(new GPoint(-83.90938568,43.60674667),"
Handy Middle School
601 Blend Street
Bay City, MI 48706

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Handy Middle School",'Bay_City=' + Bay_City.length); Essexville[Essexville.length] = createMarker(new GPoint(-83.83966064,43.61189651),"
Hughes Elementary School
805 Langstaff Street
Essexville, MI 48732

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Hughes Elementary School",'Essexville=' + Essexville.length); Bay_City[Bay_City.length] = createMarker(new GPoint(-83.92258453,43.61673737),"
John Glenn High School
3201 E. Kiesel Road
Bay City, MI 48706

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("John Glenn High School",'Bay_City=' + Bay_City.length); Bay_City[Bay_City.length] = createMarker(new GPoint(-83.90772247,43.59256363),"
Kolb Elementary School
305 W. Crump Street
Bay City, MI 48706

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Kolb Elementary School",'Bay_City=' + Bay_City.length); Bay_City[Bay_City.length] = createMarker(new GPoint(-83.88967133,43.59421921),"
Linsday Elementary School
607 La Salle Street
Bay City, MI 48706

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Linsday Elementary School",'Bay_City=' + Bay_City.length); Linwood[Linwood.length] = createMarker(new GPoint(-83.96675110,43.73856354),"
Linwood Elementary School
517 Center Street
Linwood, MI 48634

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Linwood Elementary School",'Linwood=' + Linwood.length); Essexville[Essexville.length] = createMarker(new GPoint(-83.83477020,43.59410477),"
Llc---bay Campus
1435 W. Center Road
Essexville, MI 48732

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Llc---bay Campus",'Essexville=' + Essexville.length); Bay_City[Bay_City.length] = createMarker(new GPoint(-83.88491400,43.59527000),"
Macgregor Elementary School
1012 Fremont Street
Bay City, MI 48708

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Macgregor Elementary School",'Bay_City=' + Bay_City.length); Bay_City[Bay_City.length] = createMarker(new GPoint(-83.93446350,43.57970428),"
Mackensen Elementary School
5535 Dennis Street
Bay City, MI 48706

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Mackensen Elementary School",'Bay_City=' + Bay_City.length); Bay_City[Bay_City.length] = createMarker(new GPoint(-83.95716095,43.60236359),"
Mcalear-sawden Elementary School
2300 E. Midland Road
Bay City, MI 48706

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Mcalear-sawden Elementary School",'Bay_City=' + Bay_City.length); Pinconning[Pinconning.length] = createMarker(new GPoint(-84.10518646,43.85849380),"
Mt. Forest Elementary School
4197 N. 11 Mile Road
Pinconning, MI 48650

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Mt. Forest Elementary School",'Pinconning=' + Pinconning.length); Pinconning[Pinconning.length] = createMarker(new GPoint(-83.96743774,43.85326385),"
Pinconning Central Elementary School
605 W. 5th Street
Pinconning, MI 48650

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Pinconning Central Elementary School",'Pinconning=' + Pinconning.length); Pinconning[Pinconning.length] = createMarker(new GPoint(-83.96743774,43.85326385),"
Pinconning Community Education
605 W. Fifth Street
Pinconning, MI 48650

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Pinconning Community Education",'Pinconning=' + Pinconning.length); Pinconning[Pinconning.length] = createMarker(new GPoint(-83.96743774,43.85326385),"
Pinconning High School
605 W. 5th Street
Pinconning, MI 48650

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Pinconning High School",'Pinconning=' + Pinconning.length); Pinconning[Pinconning.length] = createMarker(new GPoint(-83.96586400,43.85398500),"
Pinconning Middle School
605 W. 5th Street
Pinconning, MI 48650

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Pinconning Middle School",'Pinconning=' + Pinconning.length); Bay_City[Bay_City.length] = createMarker(new GPoint(-83.91011047,43.58242035),"
Reigel Elementary School
1805 S. Raymond Street
Bay City, MI 48706

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Reigel Elementary School",'Bay_City=' + Bay_City.length); Bay_City[Bay_City.length] = createMarker(new GPoint(-83.91024780,43.58254623),"
Riegel Elementary School
1805 S. Raymond Street
Bay City, MI 48706

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Riegel Elementary School",'Bay_City=' + Bay_City.length); Bay_City[Bay_City.length] = createMarker(new GPoint(-83.86238861,43.59209824),"
Thomas Jefferson Elementary School
325 Park Avenue
Bay City, MI 48708

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Thomas Jefferson Elementary School",'Bay_City=' + Bay_City.length); Bay_City[Bay_City.length] = createMarker(new GPoint(-83.88092041,43.61682510),"
Trombley Center
401 Bangor Street
Bay City, MI 48706

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Trombley Center",'Bay_City=' + Bay_City.length); Essexville[Essexville.length] = createMarker(new GPoint(-83.75420380,43.60883713),"
Verellen Elementary School
612 Borton Road
Essexville, MI 48732

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Verellen Elementary School",'Essexville=' + Essexville.length); Essexville[Essexville.length] = createMarker(new GPoint(-83.81099701,43.60132980),"
W.r. Bush Elementary School
800 Nebobish Avenue
Essexville, MI 48732

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("W.r. Bush Elementary School",'Essexville=' + Essexville.length); Bay_City[Bay_City.length] = createMarker(new GPoint(-83.87091827,43.59379578),"
Washington Elementary School
1821 Mckinley Street
Bay City, MI 48708

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Washington Elementary School",'Bay_City=' + Bay_City.length); Bay_City[Bay_City.length] = createMarker(new GPoint(-83.90438843,43.59965134),"
Wenona Center
312 S. Dewitt Street
Bay City, MI 48706

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Wenona Center",'Bay_City=' + Bay_City.length); Auburn[Auburn.length] = createMarker(new GPoint(-84.07769012,43.60363770),"
Western High School
500 W. Midland Road
Auburn, MI 48611

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Western High School",'Auburn=' + Auburn.length); Auburn[Auburn.length] = createMarker(new GPoint(-84.07769012,43.60363770),"
Western Middle School
500 W. Midland Road
Auburn, MI 48611

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Western Middle School",'Auburn=' + Auburn.length); Bay_City[Bay_City.length] = createMarker(new GPoint(-83.89392090,43.63232040),"
Westside Alternative School
3736 State Street Road
Bay City, MI 48706

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Westside Alternative School",'Bay_City=' + Bay_City.length); Bay_City[Bay_City.length] = createMarker(new GPoint(-83.89370728,43.56252670),"
Whittier Elementary School
2515 Broadway Street
Bay City, MI 48708

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Whittier Elementary School",'Bay_City=' + Bay_City.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(Auburn); map.removeOverlays(Bay_City); map.removeOverlays(Essexville); map.removeOverlays(Linwood); map.removeOverlays(Pinconning); 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(Auburn);map.removeOverlays(Auburn); map.removeOverlays(Bay_City); map.removeOverlays(Essexville); map.removeOverlays(Linwood); map.removeOverlays(Pinconning); map.addOverlays(Auburn); centerByArray(Auburn, false, false); cntMarker += Auburn.length; map.addOverlays(Bay_City); centerByArray(Bay_City, false, false); cntMarker += Bay_City.length; map.addOverlays(Essexville); centerByArray(Essexville, false, false); cntMarker += Essexville.length; map.addOverlays(Linwood); centerByArray(Linwood, false, false); cntMarker += Linwood.length; map.addOverlays(Pinconning); centerByArray(Pinconning, false, false); cntMarker += Pinconning.length; centerByArray(Auburn,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'); } }