function addMarkers(){ mySelect = document.getElementById('selection'); Placerville = [];Nipomo = [];Davis = [];Mill_Valley = [];Northridge = [];Altadena = [];Calpella = [];San_Diego = [];mySelect.options[mySelect.options.length] = new Option("Altadena schools",'all=Altadena'); mySelect.options[mySelect.options.length] = new Option("Calpella schools",'all=Calpella'); mySelect.options[mySelect.options.length] = new Option("Davis schools",'all=Davis'); mySelect.options[mySelect.options.length] = new Option("Mill Valley schools",'all=Mill_Valley'); mySelect.options[mySelect.options.length] = new Option("Nipomo schools",'all=Nipomo'); mySelect.options[mySelect.options.length] = new Option("Northridge schools",'all=Northridge'); mySelect.options[mySelect.options.length] = new Option("Placerville schools",'all=Placerville'); mySelect.options[mySelect.options.length] = new Option("San Diego schools",'all=San_Diego'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Placerville[Placerville.length] = createMarker(new GPoint(-120.86252000,38.69235700),"
Cedar Springs Waldorf School
6029 Gold Meadows Road
Placerville, CA 95667
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Cedar Springs Waldorf School",'Placerville=' + Placerville.length); Nipomo[Nipomo.length] = createMarker(new GPoint(-120.49962900,35.04041000),"
Clarity Steiner School
745 Sandydale Drive
Nipomo, CA 93444
Co-ed school, 1-3
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Clarity Steiner School",'Nipomo=' + Nipomo.length); Davis[Davis.length] = createMarker(new GPoint(-121.76698600,38.57031100),"
Davis Waldorf School
3100 Sycamore Lane
Davis, CA 95616
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Davis Waldorf School",'Davis=' + Davis.length); Mill_Valley[Mill_Valley.length] = createMarker(new GPoint(-122.54565400,37.90707100),"
Greenwood School
17 Buena Vista Ave
Mill Valley, CA 94941
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Greenwood School",'Mill_Valley=' + Mill_Valley.length); Northridge[Northridge.length] = createMarker(new GPoint(-118.50567800,34.24651100),"
Highland Hall Waldorf School
17100 Superior Street
Northridge, CA 91325
Co-ed school, NS-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Highland Hall Waldorf School",'Northridge=' + Northridge.length); Altadena[Altadena.length] = createMarker(new GPoint(-118.14462400,34.19177200),"
Pasadena Waldorf School
209 E. Mariposa Street
Altadena, CA 91001
Co-ed school, NS-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Pasadena Waldorf School",'Altadena=' + Altadena.length); Calpella[Calpella.length] = createMarker(new GPoint(-123.20757900,39.23429000),"
The Waldorf School Of Mendocino County
6280 Third St.
Calpella, CA 95418
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("The Waldorf School Of Mendocino County",'Calpella=' + Calpella.length); San_Diego[San_Diego.length] = createMarker(new GPoint(-117.08600300,32.74324200),"
The Waldorf School Of San Diego
3547 Altadena Ave.
San Diego, CA 92105
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("The Waldorf School Of San Diego",'San_Diego=' + San_Diego.length); map.removeOverlays(Altadena); map.removeOverlays(Calpella); map.removeOverlays(Davis); map.removeOverlays(Mill_Valley); map.removeOverlays(Nipomo); map.removeOverlays(Northridge); map.removeOverlays(Placerville); map.removeOverlays(San_Diego); setTimeout(function(){map.addOverlays(Altadena)},1000); setTimeout(function(){map.addOverlays(Calpella)},1000); setTimeout(function(){map.addOverlays(Davis)},1000); setTimeout(function(){map.addOverlays(Mill_Valley)},1000); setTimeout(function(){map.addOverlays(Nipomo)},1000); setTimeout(function(){map.addOverlays(Northridge)},1000); setTimeout(function(){map.addOverlays(Placerville)},1000); setTimeout(function(){map.addOverlays(San_Diego)},1000); maxLng = -117.08600300; maxLat = 39.23429000; minLng = -123.20757900; minLat = 32.74324200; 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,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//////' + showArray); map.removeOverlays(Altadena); map.removeOverlays(Calpella); map.removeOverlays(Davis); map.removeOverlays(Mill_Valley); map.removeOverlays(Nipomo); map.removeOverlays(Northridge); map.removeOverlays(Placerville); map.removeOverlays(San_Diego); 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(Placerville);map.removeOverlays(Altadena); map.removeOverlays(Calpella); map.removeOverlays(Davis); map.removeOverlays(Mill_Valley); map.removeOverlays(Nipomo); map.removeOverlays(Northridge); map.removeOverlays(Placerville); map.removeOverlays(San_Diego); map.addOverlays(Altadena); centerByArray(Altadena, false, false); cntMarker += Altadena.length; map.addOverlays(Calpella); centerByArray(Calpella, false, false); cntMarker += Calpella.length; map.addOverlays(Davis); centerByArray(Davis, false, false); cntMarker += Davis.length; map.addOverlays(Mill_Valley); centerByArray(Mill_Valley, false, false); cntMarker += Mill_Valley.length; map.addOverlays(Nipomo); centerByArray(Nipomo, false, false); cntMarker += Nipomo.length; map.addOverlays(Northridge); centerByArray(Northridge, false, false); cntMarker += Northridge.length; map.addOverlays(Placerville); centerByArray(Placerville, false, false); cntMarker += Placerville.length; map.addOverlays(San_Diego); centerByArray(San_Diego, false, false); cntMarker += San_Diego.length; centerByArray(Placerville,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///4436,2383,3392,4436,1929,1932,30595,2383,1634,4606,/all'); //window.open('/map.php?type=2&schools=4436,2383,3392,4436,1929,1932,30595,2383,1634,4606,&school_level=&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; }