function addMarkers(){ mySelect = document.getElementById('selection'); Aptos = [];Santa_Cruz = [];Scotts_Valley = [];Soquel = [];Watsonville = [];Boulder_Creek = [];La_Selva_Beach = [];Felton = [];Corralitos = [];mySelect.options[mySelect.options.length] = new Option("Aptos schools",'all=Aptos'); mySelect.options[mySelect.options.length] = new Option("Boulder Creek schools",'all=Boulder_Creek'); mySelect.options[mySelect.options.length] = new Option("Corralitos schools",'all=Corralitos'); mySelect.options[mySelect.options.length] = new Option("Felton schools",'all=Felton'); mySelect.options[mySelect.options.length] = new Option("La Selva Beach schools",'all=La_Selva_Beach'); mySelect.options[mySelect.options.length] = new Option("Santa Cruz schools",'all=Santa_Cruz'); mySelect.options[mySelect.options.length] = new Option("Scotts Valley schools",'all=Scotts_Valley'); mySelect.options[mySelect.options.length] = new Option("Soquel schools",'all=Soquel'); mySelect.options[mySelect.options.length] = new Option("Watsonville schools",'all=Watsonville'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Aptos[Aptos.length] = createMarker(new GPoint(-121.86467000,36.95763800),"
Aptos Academy, The
1940 Bonita Drive
Aptos, CA 95003
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Aptos Academy, The",'Aptos=' + Aptos.length); Santa_Cruz[Santa_Cruz.length] = createMarker(new GPoint(-121.97715100,36.98457200),"
The Bay School
5400 Soquel Avenue Suite F
Santa Cruz, CA 95062
Co-ed school, PK-5
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("The Bay School",'Santa_Cruz=' + Santa_Cruz.length); Scotts_Valley[Scotts_Valley.length] = createMarker(new GPoint(-122.00236700,37.06070300),"
Baymonte Christian School
5000 B Granite Creek Road
Scotts Valley, CA 95066
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Baymonte Christian School",'Scotts_Valley=' + Scotts_Valley.length); Soquel[Soquel.length] = createMarker(new GPoint(-121.94030000,37.05543700),"
Beach High School
5520 Old San Jose Road
Soquel, CA 95073
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Beach High School",'Soquel=' + Soquel.length); Santa_Cruz[Santa_Cruz.length] = createMarker(new GPoint(-122.03408900,36.98695800),"
Empire Academy
330 Encinal Street
Santa Cruz, CA 95060
Co-ed school, 6-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Empire Academy",'Santa_Cruz=' + Santa_Cruz.length); Santa_Cruz[Santa_Cruz.length] = createMarker(new GPoint(-122.02678900,36.95493700),"
Gateway School
126 Eucalyptus Ave
Santa Cruz, CA 95060
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Gateway School",'Santa_Cruz=' + Santa_Cruz.length); Santa_Cruz[Santa_Cruz.length] = createMarker(new GPoint(-122.03544800,36.98687800),"
Georgiana Bruce Kirby Preparat
425 Encinal Street
Santa Cruz, CA 95060
Co-ed school, 6-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Georgiana Bruce Kirby Preparat",'Santa_Cruz=' + Santa_Cruz.length); Santa_Cruz[Santa_Cruz.length] = createMarker(new GPoint(-121.97283400,36.98488800),"
Good Shepherd Catholic School
2727 Mattison Lane
Santa Cruz, CA 95065
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Good Shepherd Catholic School",'Santa_Cruz=' + Santa_Cruz.length); Watsonville[Watsonville.length] = createMarker(new GPoint(-121.77663000,36.93061400),"
Green Valley Christian School
376 S Green Valley Road
Watsonville, CA 95076
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Green Valley Christian School",'Watsonville=' + Watsonville.length); Santa_Cruz[Santa_Cruz.length] = createMarker(new GPoint(-122.02966300,36.97785300),"
Holy Cross School
150 Emmet
Santa Cruz, CA 95060
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Holy Cross School",'Santa_Cruz=' + Santa_Cruz.length); Santa_Cruz[Santa_Cruz.length] = createMarker(new GPoint(-122.00721600,36.97588400),"
Listen
812 Sumner St
Santa Cruz, CA 95062
Co-ed school, Ungraded
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Listen",'Santa_Cruz=' + Santa_Cruz.length); Boulder_Creek[Boulder_Creek.length] = createMarker(new GPoint(-122.13570000,37.14830000),"
Little People S School
Po Box 328
Boulder Creek, CA 95006
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Little People S School",'Boulder_Creek=' + Boulder_Creek.length); Aptos[Aptos.length] = createMarker(new GPoint(-121.88452300,36.99232000),"
Magic Apple School
2120 Trout Gulch Road
Aptos, CA 95003
Co-ed school, 2-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Magic Apple School",'Aptos=' + Aptos.length); Soquel[Soquel.length] = createMarker(new GPoint(-121.96166700,37.01756800),"
Merit Academy
2392 North Rodeo Gulch Road
Soquel, CA 95073
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Merit Academy",'Soquel=' + Soquel.length); Watsonville[Watsonville.length] = createMarker(new GPoint(-121.76794900,36.98208100),"
Monte Vista Christian School
2 School Way
Watsonville, CA 95076
Co-ed school, 6-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Monte Vista Christian School",'Watsonville=' + Watsonville.length); La_Selva_Beach[La_Selva_Beach.length] = createMarker(new GPoint(-121.83099500,36.91412100),"
Monterey Bay Academy
783 San Andreas Road
La Selva Beach, CA 95076
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Monterey Bay Academy",'La_Selva_Beach=' + La_Selva_Beach.length); Watsonville[Watsonville.length] = createMarker(new GPoint(-121.75943200,36.91524300),"
Moreland Notre Dame School
133 Brennan Street
Watsonville, CA 95076
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Moreland Notre Dame School",'Watsonville=' + Watsonville.length); Watsonville[Watsonville.length] = createMarker(new GPoint(-121.74165500,37.02919000),"
Mount Madonna School
491 Summit Road
Watsonville, CA 95076
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Mount Madonna School",'Watsonville=' + Watsonville.length); Santa_Cruz[Santa_Cruz.length] = createMarker(new GPoint(-122.03072900,36.97484000),"
New Horizons School
Po Box 3683
Santa Cruz, CA 95063
Co-ed school, K-5
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("New Horizons School",'Santa_Cruz=' + Santa_Cruz.length); Aptos[Aptos.length] = createMarker(new GPoint(-121.88502400,36.99442500),"
Orchard School
2288 Trout Gulch Road
Aptos, CA 95003
Co-ed school, 5-5
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Orchard School",'Aptos=' + Aptos.length); Watsonville[Watsonville.length] = createMarker(new GPoint(-121.73839000,36.94348200),"
St. Francis Central Coast Catholic High School
2400 East Lake Ave.
Watsonville, CA 95076
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Francis Central Coast Catholic High School",'Watsonville=' + Watsonville.length); Felton[Felton.length] = createMarker(new GPoint(-122.07306100,37.05102600),"
St. Lawrence Academy
6184 Highway 9
Felton, CA 95018
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Lawrence Academy",'Felton=' + Felton.length); Corralitos[Corralitos.length] = createMarker(new GPoint(-121.81766000,37.00263700),"
Salesian Elementary & Junior High School
605 Enos Lane
Corralitos, CA 95076
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Salesian Elementary & Junior High School",'Corralitos=' + Corralitos.length); Santa_Cruz[Santa_Cruz.length] = createMarker(new GPoint(-122.00521000,36.97982900),"
Santa Cruz Children's School
366 Gault Street
Santa Cruz, CA 95062
Co-ed school, K-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Santa Cruz Children's School",'Santa_Cruz=' + Santa_Cruz.length); Aptos[Aptos.length] = createMarker(new GPoint(-121.93189800,36.99020200),"
Santa Cruz Montessori School
6230 Soquel Drive
Aptos, CA 95003
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Santa Cruz Montessori School",'Aptos=' + Aptos.length); Santa_Cruz[Santa_Cruz.length] = createMarker(new GPoint(-122.07358600,37.00543700),"
Santa Cruz Waldorf School
2190 Empire Grade
Santa Cruz, CA 95060
Co-ed school, K-10
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Santa Cruz Waldorf School",'Santa_Cruz=' + Santa_Cruz.length); Santa_Cruz[Santa_Cruz.length] = createMarker(new GPoint(-122.00398700,36.97776100),"
Seabright Montessori
515 Frederick Street
Santa Cruz, CA 95062
Co-ed school, K-5
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Seabright Montessori",'Santa_Cruz=' + Santa_Cruz.length); Santa_Cruz[Santa_Cruz.length] = createMarker(new GPoint(-122.03502300,36.96517400),"
Spring Hill Advanced Elementary School
250 California Street
Santa Cruz, CA 95060
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Spring Hill Advanced Elementary School",'Santa_Cruz=' + Santa_Cruz.length); Soquel[Soquel.length] = createMarker(new GPoint(-121.93761800,37.00645700),"
Tara Redwood School
5810 Prescott Road
Soquel, CA 95073
Co-ed school, PK-1
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Tara Redwood School",'Soquel=' + Soquel.length); Watsonville[Watsonville.length] = createMarker(new GPoint(-121.78270100,36.92322100),"
Trinity Lutheran School
175 Lawrence Ave
Watsonville, CA 95076
Co-ed school, PK-3
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Trinity Lutheran School",'Watsonville=' + Watsonville.length); Aptos[Aptos.length] = createMarker(new GPoint(-121.92763100,36.98400500),"
Twin Lakes Christian School
2701 Cabrillo College Drive
Aptos, CA 95003
Co-ed school, K-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Twin Lakes Christian School",'Aptos=' + Aptos.length); Santa_Cruz[Santa_Cruz.length] = createMarker(new GPoint(-121.99258000,36.98090300),"
Vhm Christian School
427 Capitola Road Ext
Santa Cruz, CA 95062
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Vhm Christian School",'Santa_Cruz=' + Santa_Cruz.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/////3/' + showArray); map.removeOverlays(Aptos); map.removeOverlays(Boulder_Creek); map.removeOverlays(Corralitos); map.removeOverlays(Felton); map.removeOverlays(La_Selva_Beach); map.removeOverlays(Santa_Cruz); map.removeOverlays(Scotts_Valley); map.removeOverlays(Soquel); map.removeOverlays(Watsonville); 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(Aptos);map.removeOverlays(Aptos); map.removeOverlays(Boulder_Creek); map.removeOverlays(Corralitos); map.removeOverlays(Felton); map.removeOverlays(La_Selva_Beach); map.removeOverlays(Santa_Cruz); map.removeOverlays(Scotts_Valley); map.removeOverlays(Soquel); map.removeOverlays(Watsonville); map.addOverlays(Aptos); centerByArray(Aptos, false, false); cntMarker += Aptos.length; map.addOverlays(Boulder_Creek); centerByArray(Boulder_Creek, false, false); cntMarker += Boulder_Creek.length; map.addOverlays(Corralitos); centerByArray(Corralitos, false, false); cntMarker += Corralitos.length; map.addOverlays(Felton); centerByArray(Felton, false, false); cntMarker += Felton.length; map.addOverlays(La_Selva_Beach); centerByArray(La_Selva_Beach, false, false); cntMarker += La_Selva_Beach.length; map.addOverlays(Santa_Cruz); centerByArray(Santa_Cruz, false, false); cntMarker += Santa_Cruz.length; map.addOverlays(Scotts_Valley); centerByArray(Scotts_Valley, false, false); cntMarker += Scotts_Valley.length; map.addOverlays(Soquel); centerByArray(Soquel, false, false); cntMarker += Soquel.length; map.addOverlays(Watsonville); centerByArray(Watsonville, false, false); cntMarker += Watsonville.length; centerByArray(Aptos,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=3&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; }