function addMarkers(){ mySelect = document.getElementById('selection'); Bakersfield = [];Rosamond = [];Wasco = [];North_Edwards = [];Ridgecrest = [];California_City = [];Tehachapi = [];Lake_Isabella = [];Inyokern = [];Delano = [];mySelect.options[mySelect.options.length] = new Option("Bakersfield schools",'all=Bakersfield'); mySelect.options[mySelect.options.length] = new Option("California City schools",'all=California_City'); mySelect.options[mySelect.options.length] = new Option("Delano schools",'all=Delano'); mySelect.options[mySelect.options.length] = new Option("Inyokern schools",'all=Inyokern'); mySelect.options[mySelect.options.length] = new Option("Lake Isabella schools",'all=Lake_Isabella'); mySelect.options[mySelect.options.length] = new Option("North Edwards schools",'all=North_Edwards'); mySelect.options[mySelect.options.length] = new Option("Ridgecrest schools",'all=Ridgecrest'); mySelect.options[mySelect.options.length] = new Option("Rosamond schools",'all=Rosamond'); mySelect.options[mySelect.options.length] = new Option("Tehachapi schools",'all=Tehachapi'); mySelect.options[mySelect.options.length] = new Option("Wasco schools",'all=Wasco'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Bakersfield[Bakersfield.length] = createMarker(new GPoint(-119.11726700,35.37986300),"
Apostolic Christian Academy
2203 Dean Avenue
Bakersfield, CA 93312
Co-ed school, 7-10
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Apostolic Christian Academy",'Bakersfield=' + Bakersfield.length); Rosamond[Rosamond.length] = createMarker(new GPoint(-118.17086400,34.86264000),"
Assembly Of God Christ Sch-ag
2881 C Street
Rosamond, CA 93560
Co-ed school, KG-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Assembly Of God Christ Sch-ag",'Rosamond=' + Rosamond.length); Bakersfield[Bakersfield.length] = createMarker(new GPoint(-118.95501600,35.39203400),"
Bakersfield Adventist Academy
3333 Bernard Street
Bakersfield, CA 93306
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bakersfield Adventist Academy",'Bakersfield=' + Bakersfield.length); Bakersfield[Bakersfield.length] = createMarker(new GPoint(-119.14383300,35.35401700),"
Bakersfield Christian High School
12775 Stockdale Highway
Bakersfield, CA 93314
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bakersfield Christian High School",'Bakersfield=' + Bakersfield.length); Wasco[Wasco.length] = createMarker(new GPoint(-119.33570300,35.59446500),"
Bethany Christian School
942 7th Street
Wasco, CA 93280
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bethany Christian School",'Wasco=' + Wasco.length); Bakersfield[Bakersfield.length] = createMarker(new GPoint(-119.01774900,35.39833700),"
Bethel Apostolic Academy
1418 W Columbus Street
Bakersfield, CA 93301
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bethel Apostolic Academy",'Bakersfield=' + Bakersfield.length); Bakersfield[Bakersfield.length] = createMarker(new GPoint(-118.96689200,35.36877700),"
Bethel Christian School
2236 E Calif. Avenue
Bakersfield, CA 93307
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bethel Christian School",'Bakersfield=' + Bakersfield.length); North_Edwards[North_Edwards.length] = createMarker(new GPoint(-117.82303100,35.02519200),"
Calvary Christian School
13768 Gulf St.
North Edwards, CA 93523
Co-ed school, 1-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Calvary Christian School",'North_Edwards=' + North_Edwards.length); Ridgecrest[Ridgecrest.length] = createMarker(new GPoint(-117.67000000,35.62250000),"
Calvary Christian School
Po Box 2138
Ridgecrest, CA 93556
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Calvary Christian School",'Ridgecrest=' + Ridgecrest.length); Bakersfield[Bakersfield.length] = createMarker(new GPoint(-118.95370000,35.37640000),"
Chapel School
Po Box 60815
Bakersfield, CA 93386
Co-ed school, 2-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Chapel School",'Bakersfield=' + Bakersfield.length); California_City[California_City.length] = createMarker(new GPoint(-118.01209300,35.12565500),"
Eagles Way Academy
9031 California City Blvd
California City, CA 93505
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Eagles Way Academy",'California_City=' + California_City.length); Bakersfield[Bakersfield.length] = createMarker(new GPoint(-119.02613100,35.37707800),"
Eternity Preparatory High School & Academy
2119 20th Street
Bakersfield, CA 93301
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Eternity Preparatory High School & Academy",'Bakersfield=' + Bakersfield.length); Bakersfield[Bakersfield.length] = createMarker(new GPoint(-118.99866700,35.40013900),"
Garces Memorial High School
2800 Loma Linda Drive
Bakersfield, CA 93305
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Garces Memorial High School",'Bakersfield=' + Bakersfield.length); Bakersfield[Bakersfield.length] = createMarker(new GPoint(-119.02847600,35.41626300),"
Golden State Baptist Schools
427 Woodrow Avenue
Bakersfield, CA 93308
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Golden State Baptist Schools",'Bakersfield=' + Bakersfield.length); Bakersfield[Bakersfield.length] = createMarker(new GPoint(-119.00429100,35.27424500),"
Harvest Christian Academy
110 Mckee Road
Bakersfield, CA 93307
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Harvest Christian Academy",'Bakersfield=' + Bakersfield.length); Tehachapi[Tehachapi.length] = createMarker(new GPoint(-118.50253300,35.11708200),"
Heritage Oak School
20915 Schout Road
Tehachapi, CA 93561
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Heritage Oak School",'Tehachapi=' + Tehachapi.length); Ridgecrest[Ridgecrest.length] = createMarker(new GPoint(-117.67179300,35.64786300),"
Immanuel Christian School
201 W Graaf Avenue
Ridgecrest, CA 93555
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Immanuel Christian School",'Ridgecrest=' + Ridgecrest.length); Bakersfield[Bakersfield.length] = createMarker(new GPoint(-119.14460600,35.38856100),"
J. C. Worthy Institute
12801 Allen Lane
Bakersfield, CA 93312
Co-ed school, 2-11
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("J. C. Worthy Institute",'Bakersfield=' + Bakersfield.length); Lake_Isabella[Lake_Isabella.length] = createMarker(new GPoint(-118.36571100,35.64443200),"
Kern River Valley Christ School
14900 Highway 178
Lake Isabella, CA 93240
Co-ed school, 11-11
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Kern River Valley Christ School",'Lake_Isabella=' + Lake_Isabella.length); Bakersfield[Bakersfield.length] = createMarker(new GPoint(-119.02138100,35.37075200),"
Lighthouse Christian
1417 H Street
Bakersfield, CA 93301
Co-ed school, 2-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Lighthouse Christian",'Bakersfield=' + Bakersfield.length); California_City[California_City.length] = createMarker(new GPoint(-118.00498300,35.13756200),"
Little Flock Academy, The
21792 69th Street
California City, CA 93505
Co-ed school, K-11
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Little Flock Academy, The",'California_City=' + California_City.length); Inyokern[Inyokern.length] = createMarker(new GPoint(-117.80357000,35.63010900),"
Mariposa Christian
6117 Las Flores Avenue
Inyokern, CA 93527
Co-ed school, 1-11
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Mariposa Christian",'Inyokern=' + Inyokern.length); Bakersfield[Bakersfield.length] = createMarker(new GPoint(-119.05694100,35.31682800),"
New Life Christian School
4201 Stine Road
Bakersfield, CA 93313
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("New Life Christian School",'Bakersfield=' + Bakersfield.length); Inyokern[Inyokern.length] = createMarker(new GPoint(-117.86839900,35.67589000),"
Oasis Christian Academy
Po Box 1627
Inyokern, CA 93527
Co-ed school, 1-11
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Oasis Christian Academy",'Inyokern=' + Inyokern.length); Bakersfield[Bakersfield.length] = createMarker(new GPoint(-118.37397300,35.34590500),"
Rosewall Christian Academy
35891 Big Springs Drive
Bakersfield, CA 93518
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Rosewall Christian Academy",'Bakersfield=' + Bakersfield.length); Delano[Delano.length] = createMarker(new GPoint(-119.24460000,35.76890000),"
Sequoia Christian Academy
Po Box 1876
Delano, CA 93216
Co-ed school, 2-10
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Sequoia Christian Academy",'Delano=' + Delano.length); Bakersfield[Bakersfield.length] = createMarker(new GPoint(-119.03021400,35.32200300),"
Southwest Education Center
3637 Hughes Lane
Bakersfield, CA 93304
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Southwest Education Center",'Bakersfield=' + Bakersfield.length); Bakersfield[Bakersfield.length] = createMarker(new GPoint(-118.89846600,35.36522600),"
Turner Christian Academy
9517 Eucalyptus Drive
Bakersfield, CA 93306
Co-ed school, 1-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Turner Christian Academy",'Bakersfield=' + Bakersfield.length); Bakersfield[Bakersfield.length] = createMarker(new GPoint(-118.96597200,35.35420300),"
Valley Schools
2300 E. Brundage Lane
Bakersfield, CA 93307
Co-ed school, K-7
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Valley Schools",'Bakersfield=' + Bakersfield.length); California_City[California_City.length] = createMarker(new GPoint(-117.96501800,35.12558700),"
Western Education Center
9100 California City Blvd
California City, CA 93505
Co-ed school, 4-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Western Education Center",'California_City=' + California_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,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/////2/' + showArray); map.removeOverlays(Bakersfield); map.removeOverlays(California_City); map.removeOverlays(Delano); map.removeOverlays(Inyokern); map.removeOverlays(Lake_Isabella); map.removeOverlays(North_Edwards); map.removeOverlays(Ridgecrest); map.removeOverlays(Rosamond); map.removeOverlays(Tehachapi); map.removeOverlays(Wasco); 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(Bakersfield);map.removeOverlays(Bakersfield); map.removeOverlays(California_City); map.removeOverlays(Delano); map.removeOverlays(Inyokern); map.removeOverlays(Lake_Isabella); map.removeOverlays(North_Edwards); map.removeOverlays(Ridgecrest); map.removeOverlays(Rosamond); map.removeOverlays(Tehachapi); map.removeOverlays(Wasco); map.addOverlays(Bakersfield); centerByArray(Bakersfield, false, false); cntMarker += Bakersfield.length; map.addOverlays(California_City); centerByArray(California_City, false, false); cntMarker += California_City.length; map.addOverlays(Delano); centerByArray(Delano, false, false); cntMarker += Delano.length; map.addOverlays(Inyokern); centerByArray(Inyokern, false, false); cntMarker += Inyokern.length; map.addOverlays(Lake_Isabella); centerByArray(Lake_Isabella, false, false); cntMarker += Lake_Isabella.length; map.addOverlays(North_Edwards); centerByArray(North_Edwards, false, false); cntMarker += North_Edwards.length; map.addOverlays(Ridgecrest); centerByArray(Ridgecrest, false, false); cntMarker += Ridgecrest.length; map.addOverlays(Rosamond); centerByArray(Rosamond, false, false); cntMarker += Rosamond.length; map.addOverlays(Tehachapi); centerByArray(Tehachapi, false, false); cntMarker += Tehachapi.length; map.addOverlays(Wasco); centerByArray(Wasco, false, false); cntMarker += Wasco.length; centerByArray(Bakersfield,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=2&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; }