function addMarkers(){ mySelect = document.getElementById('selection'); Berkeley = [];Hayward = [];Alameda = [];Oakland = [];Livermore = [];Fremont = [];San_Leandro = [];mySelect.options[mySelect.options.length] = new Option("Alameda Schools",'all=Alameda'); mySelect.options[mySelect.options.length] = new Option("Berkeley Schools",'all=Berkeley'); mySelect.options[mySelect.options.length] = new Option("Fremont Schools",'all=Fremont'); mySelect.options[mySelect.options.length] = new Option("Hayward Schools",'all=Hayward'); mySelect.options[mySelect.options.length] = new Option("Livermore Schools",'all=Livermore'); mySelect.options[mySelect.options.length] = new Option("Oakland Schools",'all=Oakland'); mySelect.options[mySelect.options.length] = new Option("San Leandro Schools",'all=San_Leandro'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); var tmpLatLng=0; var tmpLen=0; tmpLatLng=new GLatLng(37.87164099999999677,-122.271079999999997); tmpLen=Berkeley.length; Berkeley[tmpLen] = createMarker(tmpLatLng,"
Berkeley City College
2050 Center St
Berkeley, CA 94704

[ View School Profile ]
",iconGr); Berkeley[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Berkeley City College",'Berkeley=' + Berkeley.length); tmpLatLng=new GLatLng(37.64135300000000228,-122.103057000000006); tmpLen=Hayward.length; Hayward[tmpLen] = createMarker(tmpLatLng,"
Chabot College
25555 Hesperian Blvd
Hayward, CA 94545

[ View School Profile ]
",iconGr); Hayward[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Chabot College",'Hayward=' + Hayward.length); tmpLatLng=new GLatLng(37.78014999999999901,-122.281154999999998); tmpLen=Alameda.length; Alameda[tmpLen] = createMarker(tmpLatLng,"
College Of Alameda
555 Ralph Appezzato Memorial Parkway
Alameda, CA 94501

[ View School Profile ]
",iconGr); Alameda[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("College Of Alameda",'Alameda=' + Alameda.length); tmpLatLng=new GLatLng(37.63607700000000022,-122.114067000000005); tmpLen=Hayward.length; Hayward[tmpLen] = createMarker(tmpLatLng,"
Heald College-hayward
25500 Industrial Blvd.
Hayward, CA 94545

[ View School Profile ]
",iconRd); Hayward[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Heald College-hayward",'Hayward=' + Hayward.length); tmpLatLng=new GLatLng(37.62339999999999662,-122.126175000000003); tmpLen=Hayward.length; Hayward[tmpLen] = createMarker(tmpLatLng,"
Itt Technical Institute
3979 Trust Way
Hayward, CA 94545

[ View School Profile ]
",iconRd); Hayward[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Itt Technical Institute",'Hayward=' + Hayward.length); tmpLatLng=new GLatLng(37.79762699999999853,-122.264380000000002); tmpLen=Oakland.length; Oakland[tmpLen] = createMarker(tmpLatLng,"
Laney College
900 Fallon St
Oakland, CA 94607

[ View School Profile ]
",iconGr); Oakland[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Laney College",'Oakland=' + Oakland.length); tmpLatLng=new GLatLng(37.70509400000000255,-121.805700000000001); tmpLen=Livermore.length; Livermore[tmpLen] = createMarker(tmpLatLng,"
Las Positas College
3033 Collier Cyn Rd
Livermore, CA 94551

[ View School Profile ]
",iconGr); Livermore[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Las Positas College",'Livermore=' + Livermore.length); tmpLatLng=new GLatLng(37.78975799999999907,-122.171397999999996); tmpLen=Oakland.length; Oakland[tmpLen] = createMarker(tmpLatLng,"
Merritt College
12500 Campus Dr
Oakland, CA 94619

[ View School Profile ]
",iconGr); Oakland[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Merritt College",'Oakland=' + Oakland.length); tmpLatLng=new GLatLng(37.52803600000000017,-121.918668999999994); tmpLen=Fremont.length; Fremont[tmpLen] = createMarker(tmpLatLng,"
Ohlone College
43600 Mission Boulevard
Fremont, CA 94539

[ View School Profile ]
",iconGr); Fremont[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Ohlone College",'Fremont=' + Fremont.length); tmpLatLng=new GLatLng(37.51350800000000163,-121.981739000000004); tmpLen=Fremont.length; Fremont[tmpLen] = createMarker(tmpLatLng,"
Silicon Valley College-fremont
41350 Christy St
Fremont, CA 94538

[ View School Profile ]
",iconRd); Fremont[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Silicon Valley College-fremont",'Fremont=' + Fremont.length); tmpLatLng=new GLatLng(37.70162100000000293,-122.126814999999993); tmpLen=San_Leandro.length; San_Leandro[tmpLen] = createMarker(tmpLatLng,"
Western Career College - San Leandro
170 Bay Fair Mall
San Leandro, CA 95478

[ View School Profile ]
",iconRd); San_Leandro[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Western Career College - San Leandro",'San_Leandro=' + San_Leandro.length); tmpLatLng=new GLatLng(37.46991899999999731,-121.918666999999999); tmpLen=Fremont.length; Fremont[tmpLen] = createMarker(tmpLatLng,"
Wyo Tech
200 Whitney Place
Fremont, CA 94539

[ View School Profile ]
",iconGr); Fremont[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Wyo Tech",'Fremont=' + Fremont.length); map.removeOverlays(Alameda); map.removeOverlays(Berkeley); map.removeOverlays(Fremont); map.removeOverlays(Hayward); map.removeOverlays(Livermore); map.removeOverlays(Oakland); map.removeOverlays(San_Leandro); setTimeout(function(){map.addOverlays(Alameda)},1000); setTimeout(function(){map.addOverlays(Berkeley)},1000); setTimeout(function(){map.addOverlays(Fremont)},1000); setTimeout(function(){map.addOverlays(Hayward)},1000); setTimeout(function(){map.addOverlays(Livermore)},1000); setTimeout(function(){map.addOverlays(Oakland)},1000); setTimeout(function(){map.addOverlays(San_Leandro)},1000); maxLng = -121.805700000000001; maxLat = 37.87164099999999677; minLng = -122.281154999999998; minLat = 37.46991899999999731; reCenterMap(); } // End addStateMarkers JavaScript Function //open all when map is defined function openAll() { if (map) { selectChange("all"); } else { setTimeout("openAll()",200); } } // 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].point.x; var markLat = myArray[i].point.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].point.x; maxLat = myArray[0].point.y; minLng = myArray[0].point.x; minLat = myArray[0].point.y; } // Recenter map based on global max/mins function reCenterMap(){ //alert('#' + minLat + '#' + minLng + '#' + maxLat + '#' + maxLng); 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) { if (selection.options) { var _openNewWindow=true; var myVal = selection.options[selection.selectedIndex].value; } else { var _openNewWindow=false; var myVal=selection; } 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('schools-by-distance') == -1) window.open(location.href + '/map/all'); else window.open('/search////all'); map.removeOverlays(Alameda); map.removeOverlays(Berkeley); map.removeOverlays(Fremont); map.removeOverlays(Hayward); map.removeOverlays(Livermore); map.removeOverlays(Oakland); map.removeOverlays(San_Leandro); 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(Berkeley);map.removeOverlays(Alameda); map.removeOverlays(Berkeley); map.removeOverlays(Fremont); map.removeOverlays(Hayward); map.removeOverlays(Livermore); map.removeOverlays(Oakland); map.removeOverlays(San_Leandro); map.addOverlays(Alameda); centerByArray(Alameda, false, false); cntMarker += Alameda.length; map.addOverlays(Berkeley); centerByArray(Berkeley, false, false); cntMarker += Berkeley.length; map.addOverlays(Fremont); centerByArray(Fremont, false, false); cntMarker += Fremont.length; map.addOverlays(Hayward); centerByArray(Hayward, false, false); cntMarker += Hayward.length; map.addOverlays(Livermore); centerByArray(Livermore, false, false); cntMarker += Livermore.length; map.addOverlays(Oakland); centerByArray(Oakland, false, false); cntMarker += Oakland.length; map.addOverlays(San_Leandro); centerByArray(San_Leandro, false, false); cntMarker += San_Leandro.length; reCenterMap(); //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'); } } function createMarker(point, label, icon){ var marker = new GMarker(point, icon); var html = label; GEvent.addListener(marker, "click", function() { marker.openInfoWindowHtml(html); }); return marker; }