function addMarkers() { mySelect = document.getElementById('selection'); Oroville = [];Oroville[Oroville.length] = createMarker(new GPoint(-121.56084442,39.51104736),"
",iconRd); mySelect.options[mySelect.options.length] = new Option("Bird Street Elementary School",'Oroville=' + Oroville.length); Oroville[Oroville.length] = createMarker(new GPoint(-121.54058838,39.50181961),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Central Middle School",'Oroville=' + Oroville.length); Oroville[Oroville.length] = createMarker(new GPoint(-121.46340179,39.49100113),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Challenge Charter High School",'Oroville=' + Oroville.length); Oroville[Oroville.length] = createMarker(new GPoint(-121.52801514,39.73048782),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Concow Elementary School",'Oroville=' + Oroville.length); Oroville[Oroville.length] = createMarker(new GPoint(-121.54565430,39.51306152),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Eastside Elementary School",'Oroville=' + Oroville.length); Oroville[Oroville.length] = createMarker(new GPoint(-121.55516052,39.51334000),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Feather Falls Elementary School",'Oroville=' + Oroville.length); Oroville[Oroville.length] = createMarker(new GPoint(-121.52801514,39.73048782),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Golden Feather Community Day",'Oroville=' + Oroville.length); Oroville[Oroville.length] = createMarker(new GPoint(-121.53562164,39.47579575),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Helen M. Wilcox Elementary School",'Oroville=' + Oroville.length); Oroville[Oroville.length] = createMarker(new GPoint(-121.57392883,39.51947021),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Heritage Community Day School",'Oroville=' + Oroville.length); Oroville[Oroville.length] = createMarker(new GPoint(-121.54591600,39.51292200),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Ishi Hills Middle School",'Oroville=' + Oroville.length); Oroville[Oroville.length] = createMarker(new GPoint(-121.56999969,39.52902603),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Juvenile Hall/community",'Oroville=' + Oroville.length); Oroville[Oroville.length] = createMarker(new GPoint(-121.54122162,39.48053741),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Las Plumas High School",'Oroville=' + Oroville.length); Oroville[Oroville.length] = createMarker(new GPoint(-121.55654907,39.51250458),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Learning Community Charter",'Oroville=' + Oroville.length); Oroville[Oroville.length] = createMarker(new GPoint(-121.57888031,39.52620316),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Nelson Avenue Middle School",'Oroville=' + Oroville.length); Oroville[Oroville.length] = createMarker(new GPoint(-10.00000000,10.00000000),"",iconGr); mySelect.options[mySelect.options.length] = new Option("North County Community",'Oroville=' + Oroville.length); Oroville[Oroville.length] = createMarker(new GPoint(-121.54415131,39.48026276),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Oakdale Heights Elementary School",'Oroville=' + Oroville.length); Oroville[Oroville.length] = createMarker(new GPoint(-121.49435425,39.50129700),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Ophir Elementary School",'Oroville=' + Oroville.length); Oroville[Oroville.length] = createMarker(new GPoint(-121.57479858,39.60549927),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Oroville High Community Day",'Oroville=' + Oroville.length); Oroville[Oroville.length] = createMarker(new GPoint(-121.54692078,39.51502228),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Oroville High School",'Oroville=' + Oroville.length); Oroville[Oroville.length] = createMarker(new GPoint(-121.55610400,39.51388000),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Pioneer Community Day",'Oroville=' + Oroville.length); Oroville[Oroville.length] = createMarker(new GPoint(-121.57459400,39.51970400),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Plumas Avenue Elementary School",'Oroville=' + Oroville.length); Oroville[Oroville.length] = createMarker(new GPoint(-121.60929871,39.52297592),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Poplar Avenue Elementary School",'Oroville=' + Oroville.length); Oroville[Oroville.length] = createMarker(new GPoint(-121.56941986,39.52118301),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Prospect High Continuation School",'Oroville=' + Oroville.length); Oroville[Oroville.length] = createMarker(new GPoint(-121.58831024,39.50903702),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Sierra Avenue Elementary School",'Oroville=' + Oroville.length); Oroville[Oroville.length] = createMarker(new GPoint(-121.55323029,39.51293945),"",iconGr); mySelect.options[mySelect.options.length] = new Option("South County Community Day",'Oroville=' + Oroville.length); Oroville[Oroville.length] = createMarker(new GPoint(-121.55654907,39.51250458),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Special Education",'Oroville=' + Oroville.length); Oroville[Oroville.length] = createMarker(new GPoint(-121.56208801,39.65206528),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Spring Valley Elementary School",'Oroville=' + Oroville.length); Oroville[Oroville.length] = createMarker(new GPoint(-121.53591919,39.51329803),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Stanford Avenue Elementary School",'Oroville=' + Oroville.length); Oroville[Oroville.length] = createMarker(new GPoint(-121.54141998,39.50063705),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Wyandotte Avenue Elementary School",'Oroville=' + Oroville.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,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(Oroville); 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(Oroville);map.removeOverlays(Oroville); map.addOverlays(Oroville); centerByArray(Oroville, false, false); cntMarker += Oroville.length; centerByArray(Oroville,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'); } }