function addMarkers() { mySelect = document.getElementById('selection'); San_Rafael = [];San_Rafael[San_Rafael.length] = createMarker(new GPoint(-122.51219940,37.97340012),"
Bahia Vista Elementary School
125 Bahia Way
San Rafael, CA 94901

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Bahia Vista Elementary School",'San_Rafael=' + San_Rafael.length); San_Rafael[San_Rafael.length] = createMarker(new GPoint(-122.51860809,37.97712708),"
Coleman Elementary School
800 Belle Ave.
San Rafael, CA 94901

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Coleman Elementary School",'San_Rafael=' + San_Rafael.length); San_Rafael[San_Rafael.length] = createMarker(new GPoint(-122.57355499,38.02963638),"
Dixie Elementary School
1175 Idylberry Dr.
San Rafael, CA 94903

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Dixie Elementary School",'San_Rafael=' + San_Rafael.length); San_Rafael[San_Rafael.length] = createMarker(new GPoint(-122.51219940,37.97340012),"
Gallinas Elementary School
177 North San Pedro Rd.
San Rafael, CA 94903

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Gallinas Elementary School",'San_Rafael=' + San_Rafael.length); San_Rafael[San_Rafael.length] = createMarker(new GPoint(-122.51219940,37.97340012),"
Glenwood Elementary School
25 Castlewood Dr.
San Rafael, CA 94901

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Glenwood Elementary School",'San_Rafael=' + San_Rafael.length); San_Rafael[San_Rafael.length] = createMarker(new GPoint(-122.51219940,37.97340012),"
James B. Davidson Middle School
280 Woodland Ave.
San Rafael, CA 94901

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("James B. Davidson Middle School",'San_Rafael=' + San_Rafael.length); San_Rafael[San_Rafael.length] = createMarker(new GPoint(-122.54570007,38.02320099),"
Juvenile Hall/community
Po Box 4925
San Rafael, CA 94913

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Juvenile Hall/community",'San_Rafael=' + San_Rafael.length); San_Rafael[San_Rafael.length] = createMarker(new GPoint(-122.52597046,37.96391296),"
Laurel Dell Elementary School
225 Woodland Ave.
San Rafael, CA 94901

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Laurel Dell Elementary School",'San_Rafael=' + San_Rafael.length); San_Rafael[San_Rafael.length] = createMarker(new GPoint(-122.51219940,37.97340012),"
Madrone High Continuation School
185 Mission Ave.
San Rafael, CA 94901

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Madrone High Continuation School",'San_Rafael=' + San_Rafael.length); San_Rafael[San_Rafael.length] = createMarker(new GPoint(-122.52693400,37.98839500),"
Marin County Rop
Po Box 4925
San Rafael, CA 94913

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Marin County Rop",'San_Rafael=' + San_Rafael.length); San_Rafael[San_Rafael.length] = createMarker(new GPoint(-122.54557800,38.02998352),"
Miller Creek Middle School
2255 Las Gallinas Ave.
San Rafael, CA 94903

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Miller Creek Middle School",'San_Rafael=' + San_Rafael.length); San_Rafael[San_Rafael.length] = createMarker(new GPoint(-122.54570007,38.02320099),"
Phoenix Academy
Po Box 4925
San Rafael, CA 94903

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Phoenix Academy",'San_Rafael=' + San_Rafael.length); San_Rafael[San_Rafael.length] = createMarker(new GPoint(-122.51219940,37.97340012),"
San Pedro Elementary School
498 Point San Pedro Rd.
San Rafael, CA 94901

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("San Pedro Elementary School",'San_Rafael=' + San_Rafael.length); San_Rafael[San_Rafael.length] = createMarker(new GPoint(-122.51219940,37.97340012),"
San Rafael High School
185 Mission Ave.
San Rafael, CA 94901

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("San Rafael High School",'San_Rafael=' + San_Rafael.length); San_Rafael[San_Rafael.length] = createMarker(new GPoint(-122.54428101,38.03806305),"
Silveira (mary E.) Elementary School
375 Blackstone Dr.
San Rafael, CA 94903

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Silveira (mary E.) Elementary School",'San_Rafael=' + San_Rafael.length); San_Rafael[San_Rafael.length] = createMarker(new GPoint(-122.52961731,37.97226715),"
Special Education
Po Box 4925
San Rafael, CA 94913

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Special Education",'San_Rafael=' + San_Rafael.length); San_Rafael[San_Rafael.length] = createMarker(new GPoint(-122.55017853,37.98520660),"
Sun Valley Elementary School
75 Happy Ln.
San Rafael, CA 94901

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Sun Valley Elementary School",'San_Rafael=' + San_Rafael.length); San_Rafael[San_Rafael.length] = createMarker(new GPoint(-122.54470062,38.01490021),"
Terra Linda High School
320 Nova Albion Way
San Rafael, CA 94903

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Terra Linda High School",'San_Rafael=' + San_Rafael.length); San_Rafael[San_Rafael.length] = createMarker(new GPoint(-122.54677582,37.99992371),"
Vallecito Elementary School
50 Nova Albion Way
San Rafael, CA 94903

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Vallecito Elementary School",'San_Rafael=' + San_Rafael.length); map.removeOverlays(San_Rafael); setTimeout(function(){map.addOverlays(San_Rafael)},1000); maxLng = -122.51219940; maxLat = 38.03806305; minLng = -122.57355499; minLat = 37.96391296; 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,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(San_Rafael); 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(San_Rafael);map.removeOverlays(San_Rafael); map.addOverlays(San_Rafael); centerByArray(San_Rafael, false, false); cntMarker += San_Rafael.length; centerByArray(San_Rafael,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'); } }