function addMarkers()
{
mySelect = document.getElementById('selection');
Hollywood = [];Hollywood[Hollywood.length] = createMarker(new GPoint(-80.22386932,26.02076721),"
",iconBl);
mySelect.options[mySelect.options.length] = new Option("Apollo Middle School",'Hollywood=' + Hollywood.length);
Hollywood[Hollywood.length] = createMarker(new GPoint(-80.15184021,26.04196739),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Attucks Middle School",'Hollywood=' + Hollywood.length);
Hollywood[Hollywood.length] = createMarker(new GPoint(-80.15523529,26.04448509),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Bethune Mary M Elementary School",'Hollywood=' + Hollywood.length);
Hollywood[Hollywood.length] = createMarker(new GPoint(-80.23217010,26.01686859),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Boulevard Heights Elementary School",'Hollywood=' + Hollywood.length);
Hollywood[Hollywood.length] = createMarker(new GPoint(-80.16107178,25.99996758),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Colbert Elementary School",'Hollywood=' + Hollywood.length);
Hollywood[Hollywood.length] = createMarker(new GPoint(-80.22657013,26.03246689),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Driftwood Elementary School",'Hollywood=' + Hollywood.length);
Hollywood[Hollywood.length] = createMarker(new GPoint(-80.22967529,26.03370285),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Driftwood Middle School",'Hollywood=' + Hollywood.length);
Hollywood[Hollywood.length] = createMarker(new GPoint(-80.24196700,26.03610200),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Early Beginnings Academy West",'Hollywood=' + Hollywood.length);
Hollywood[Hollywood.length] = createMarker(new GPoint(-80.29236603,26.03170395),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Embassy Creek Elementary School",'Hollywood=' + Hollywood.length);
Hollywood[Hollywood.length] = createMarker(new GPoint(-80.14164200,26.01715700),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Florida Intercultural Academy",'Hollywood=' + Hollywood.length);
Hollywood[Hollywood.length] = createMarker(new GPoint(-80.14123000,26.01068300),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Hollywood Academy Of Arts & Science",'Hollywood=' + Hollywood.length);
Hollywood[Hollywood.length] = createMarker(new GPoint(-80.16008400,26.01040300),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Hollywood Academy Of Arts And Science Middle Schoo",'Hollywood=' + Hollywood.length);
Hollywood[Hollywood.length] = createMarker(new GPoint(-80.14116669,26.00796890),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Hollywood Central Elementary School",'Hollywood=' + Hollywood.length);
Hollywood[Hollywood.length] = createMarker(new GPoint(-80.17926788,26.02516747),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Hollywood Hills Elementary School",'Hollywood=' + Hollywood.length);
Hollywood[Hollywood.length] = createMarker(new GPoint(-80.19922638,26.04678154),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Hollywood Hills High School",'Hollywood=' + Hollywood.length);
Hollywood[Hollywood.length] = createMarker(new GPoint(-80.22766876,26.01706886),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Hollywood Park Elementary School",'Hollywood=' + Hollywood.length);
Hollywood[Hollywood.length] = createMarker(new GPoint(-80.21901703,26.00986862),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Mcarthur High School",'Hollywood=' + Hollywood.length);
Hollywood[Hollywood.length] = createMarker(new GPoint(-80.16086578,25.99734879),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Mcnicol Middle School",'Hollywood=' + Hollywood.length);
Hollywood[Hollywood.length] = createMarker(new GPoint(-80.16316986,26.02402496),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Oakridge Elementary School",'Hollywood=' + Hollywood.length);
Hollywood[Hollywood.length] = createMarker(new GPoint(-80.18987274,26.00461006),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Orange Brook Elementary School",'Hollywood=' + Hollywood.length);
Hollywood[Hollywood.length] = createMarker(new GPoint(-80.15137100,26.01627100),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Paragon Academy Of Technology",'Hollywood=' + Hollywood.length);
Hollywood[Hollywood.length] = createMarker(new GPoint(-80.21782684,26.03926659),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Quest Center",'Hollywood=' + Hollywood.length);
Hollywood[Hollywood.length] = createMarker(new GPoint(-80.19572449,26.03063583),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Sheridan Hills Elementary School",'Hollywood=' + Hollywood.length);
Hollywood[Hollywood.length] = createMarker(new GPoint(-80.22917175,26.01696777),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Sheridan Park Elementary School",'Hollywood=' + Hollywood.length);
Hollywood[Hollywood.length] = createMarker(new GPoint(-80.19847870,26.03246689),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Sheridan Technical Center",'Hollywood=' + Hollywood.length);
Hollywood[Hollywood.length] = createMarker(new GPoint(-80.14356995,26.02816772),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("South Broward High School",'Hollywood=' + Hollywood.length);
Hollywood[Hollywood.length] = createMarker(new GPoint(-80.19966888,26.04676628),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Stirling Elementary School",'Hollywood=' + Hollywood.length);
Hollywood[Hollywood.length] = createMarker(new GPoint(-80.21376801,26.01016808),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("West Hollywood Elementary School",'Hollywood=' + Hollywood.length);
map.removeOverlays(Hollywood);
setTimeout(function(){map.addOverlays(Hollywood)},1000);
maxLng = -80.14116669;
maxLat = 26.04678154;
minLng = -80.29236603;
minLat = 25.99734879;
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,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(Hollywood);
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(Hollywood);map.removeOverlays(Hollywood);
map.addOverlays(Hollywood);
centerByArray(Hollywood, false, false);
cntMarker += Hollywood.length;
centerByArray(Hollywood,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');
}
}