function addMarkers() { mySelect = document.getElementById('selection'); Roseville = [];Roseville[Roseville.length] = createMarker(new GPoint(-82.93370056,42.51479721),"
Alumni Memorial School
29725 John J Street
Roseville, MI 48066

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Alumni Memorial School",'Roseville=' + Roseville.length); Roseville[Roseville.length] = createMarker(new GPoint(-82.92333221,42.50006485),"
Arbor Elementary School
19140 Meier Street
Roseville, MI 48066

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Arbor Elementary School",'Roseville=' + Roseville.length); Roseville[Roseville.length] = createMarker(new GPoint(-82.95388794,42.48851013),"
Conner Creek Academy (6-9)
26200 Ridgemont Road
Roseville, MI 48066

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Conner Creek Academy (6-9)",'Roseville=' + Roseville.length); Roseville[Roseville.length] = createMarker(new GPoint(-82.94648743,42.51317978),"
Conner Creek Academy East
16911 Eastland
Roseville, MI 48066

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Conner Creek Academy East",'Roseville=' + Roseville.length); Roseville[Roseville.length] = createMarker(new GPoint(-82.92622375,42.52360153),"
Conner Creek Academy East (7-8)
29695 Gratiot
Roseville, MI 48066

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Conner Creek Academy East (7-8)",'Roseville=' + Roseville.length); Roseville[Roseville.length] = createMarker(new GPoint(-82.95385742,42.48782730),"
Conner Creek Academy East (9-10)
26200 Ridgemont
Roseville, MI 48066

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Conner Creek Academy East (9-10)",'Roseville=' + Roseville.length); Roseville[Roseville.length] = createMarker(new GPoint(-82.95700836,42.52309418),"
Dooley Elementary School
16170 Canberra
Roseville, MI 48066

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Dooley Elementary School",'Roseville=' + Roseville.length); Roseville[Roseville.length] = createMarker(new GPoint(-82.95490265,42.48533630),"
Dort Elementary School
16225 Dort
Roseville, MI 48066

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Dort Elementary School",'Roseville=' + Roseville.length); Roseville[Roseville.length] = createMarker(new GPoint(-82.91548920,42.51383591),"
Eastland Elementary School
20033 Washington Street
Roseville, MI 48066

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Eastland Elementary School",'Roseville=' + Roseville.length); Roseville[Roseville.length] = createMarker(new GPoint(-82.93074799,42.52026367),"
Eastland Junior High School
18700 Frank Street
Roseville, MI 48066

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Eastland Junior High School",'Roseville=' + Roseville.length); Roseville[Roseville.length] = createMarker(new GPoint(-82.95079803,42.50654984),"
Fountain Elementary School
16850 Wellington Avenue
Roseville, MI 48066

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Fountain Elementary School",'Roseville=' + Roseville.length); Roseville[Roseville.length] = createMarker(new GPoint(-82.95470428,42.48713684),"
Guest Community Ed. Center
16221 Frazho Road
Roseville, MI 48066

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Guest Community Ed. Center",'Roseville=' + Roseville.length); Roseville[Roseville.length] = createMarker(new GPoint(-82.92908478,42.49076462),"
Huron Park Elementary School
18530 Marquette Street
Roseville, MI 48066

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Huron Park Elementary School",'Roseville=' + Roseville.length); Roseville[Roseville.length] = createMarker(new GPoint(-82.94831085,42.49246216),"
Kaiser Elementary School
16700 Wildwood
Roseville, MI 48066

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Kaiser Elementary School",'Roseville=' + Roseville.length); Roseville[Roseville.length] = createMarker(new GPoint(-82.95224762,42.49823761),"
Lincoln Elementary School
16435 Chestnut Street
Roseville, MI 48066

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Lincoln Elementary School",'Roseville=' + Roseville.length); Roseville[Roseville.length] = createMarker(new GPoint(-82.92749786,42.52953720),"
Lucile S. Patton Elementary School
18851 Mckinnon
Roseville, MI 48066

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Lucile S. Patton Elementary School",'Roseville=' + Roseville.length); Roseville[Roseville.length] = createMarker(new GPoint(-82.96382904,42.52095413),"
Mark Twain Elementary School
30601 Calahan Road
Roseville, MI 48066

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Mark Twain Elementary School",'Roseville=' + Roseville.length); Roseville[Roseville.length] = createMarker(new GPoint(-82.92660522,42.50566483),"
Pierce Elementary School
18800 Melvin Street
Roseville, MI 48066

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Pierce Elementary School",'Roseville=' + Roseville.length); Roseville[Roseville.length] = createMarker(new GPoint(-82.93659973,42.51711273),"
Roseville High School
17855 Common Road
Roseville, MI 48066

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Roseville High School",'Roseville=' + Roseville.length); Roseville[Roseville.length] = createMarker(new GPoint(-82.95462036,42.50159073),"
Roseville Junior High School
16250 Martin Road
Roseville, MI 48066

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Roseville Junior High School",'Roseville=' + Roseville.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(Roseville); 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(Roseville);map.removeOverlays(Roseville); map.addOverlays(Roseville); centerByArray(Roseville, false, false); cntMarker += Roseville.length; centerByArray(Roseville,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'); } }