function addMarkers(){
mySelect = document.getElementById('selection');
Huntsville = [];Huntsville[Huntsville.length] = createMarker(new GPoint(-86.68797200,34.80078600),"
",iconGr);
mySelect.options[mySelect.options.length] = new Option("Calvary Baptist Academy",'Huntsville=' + Huntsville.length);
Huntsville[Huntsville.length] = createMarker(new GPoint(-86.59334500,34.76120300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Care To Learn School",'Huntsville=' + Huntsville.length);
Huntsville[Huntsville.length] = createMarker(new GPoint(-86.64889600,34.72633700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Catholic High School",'Huntsville=' + Huntsville.length);
Huntsville[Huntsville.length] = createMarker(new GPoint(-86.70343800,34.73263800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Childrens House Of Montessori",'Huntsville=' + Huntsville.length);
Huntsville[Huntsville.length] = createMarker(new GPoint(-86.57235600,34.65719100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Community Fellowship Baptist Preparatory",'Huntsville=' + Huntsville.length);
Huntsville[Huntsville.length] = createMarker(new GPoint(-86.68769900,34.75752400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("The Country Day School",'Huntsville=' + Huntsville.length);
Huntsville[Huntsville.length] = createMarker(new GPoint(-86.59911200,34.76825200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("First Baptist Child Development Center & Academy",'Huntsville=' + Huntsville.length);
Huntsville[Huntsville.length] = createMarker(new GPoint(-86.58436900,34.69845600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Grace Lutheran School",'Huntsville=' + Huntsville.length);
Huntsville[Huntsville.length] = createMarker(new GPoint(-86.61676600,34.77714900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Heritage Christian School",'Huntsville=' + Huntsville.length);
Huntsville[Huntsville.length] = createMarker(new GPoint(-86.60190600,34.73449100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Holy Family Parochial School",'Huntsville=' + Huntsville.length);
Huntsville[Huntsville.length] = createMarker(new GPoint(-86.57277200,34.69104500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Holy Spirit School",'Huntsville=' + Huntsville.length);
Huntsville[Huntsville.length] = createMarker(new GPoint(-86.58552200,34.72012800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Huntsville Achievement School",'Huntsville=' + Huntsville.length);
Huntsville[Huntsville.length] = createMarker(new GPoint(-86.69162100,34.74326500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Huntsville Christian Academy",'Huntsville=' + Huntsville.length);
Huntsville[Huntsville.length] = createMarker(new GPoint(-86.64636600,34.74693700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Islamic Academy Of Huntsville",'Huntsville=' + Huntsville.length);
Huntsville[Huntsville.length] = createMarker(new GPoint(-86.64573300,34.76924600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Janice Mitchell Isbell Academy, Inc.",'Huntsville=' + Huntsville.length);
Huntsville[Huntsville.length] = createMarker(new GPoint(-86.56515300,34.64683700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Latham Kindergarten And Preschool",'Huntsville=' + Huntsville.length);
Huntsville[Huntsville.length] = createMarker(new GPoint(-86.55811800,34.68986200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Mayfair Child Development Center",'Huntsville=' + Huntsville.length);
Huntsville[Huntsville.length] = createMarker(new GPoint(-86.57776600,34.71355100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("The Montessori Learning Center",'Huntsville=' + Huntsville.length);
Huntsville[Huntsville.length] = createMarker(new GPoint(-86.53838200,34.66340800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Montessori School Of Huntsville #1",'Huntsville=' + Huntsville.length);
Huntsville[Huntsville.length] = createMarker(new GPoint(-86.59203800,34.69759500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Mrs Rondas Montessori School",'Huntsville=' + Huntsville.length);
Huntsville[Huntsville.length] = createMarker(new GPoint(-86.58610000,34.73020000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Oakwood Academy/elementary",'Huntsville=' + Huntsville.length);
Huntsville[Huntsville.length] = createMarker(new GPoint(-86.66057200,34.75574700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Oakwood Adventist Academy K-8",'Huntsville=' + Huntsville.length);
Huntsville[Huntsville.length] = createMarker(new GPoint(-86.55849500,34.70528600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Randolph School",'Huntsville=' + Huntsville.length);
Huntsville[Huntsville.length] = createMarker(new GPoint(-86.58241500,34.69897200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Schola Maxima",'Huntsville=' + Huntsville.length);
Huntsville[Huntsville.length] = createMarker(new GPoint(-86.75903200,34.64706300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Uaw Daimlerchrysler Child Dev",'Huntsville=' + Huntsville.length);
Huntsville[Huntsville.length] = createMarker(new GPoint(-86.56193500,34.79279700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Union Chapel Christian Academy",'Huntsville=' + Huntsville.length);
Huntsville[Huntsville.length] = createMarker(new GPoint(-86.56226700,34.79278800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Union Chapel Mb Church Child Development Center",'Huntsville=' + Huntsville.length);
Huntsville[Huntsville.length] = createMarker(new GPoint(-86.63975500,34.72756200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("University Preschool Learning Center",'Huntsville=' + Huntsville.length);
Huntsville[Huntsville.length] = createMarker(new GPoint(-86.62101500,34.72760900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Valley Fellowship Christian Academy",'Huntsville=' + Huntsville.length);
Huntsville[Huntsville.length] = createMarker(new GPoint(-86.58496000,34.72912000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Westminster Christian Academy",'Huntsville=' + Huntsville.length);
Huntsville[Huntsville.length] = createMarker(new GPoint(-86.56800300,34.67527000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Whitesburg Baptist Weekday Early Education",'Huntsville=' + Huntsville.length);
Huntsville[Huntsville.length] = createMarker(new GPoint(-86.56799200,34.67507800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Whitesburg Christian Academy",'Huntsville=' + Huntsville.length);
Huntsville[Huntsville.length] = createMarker(new GPoint(-86.53913200,34.66727600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Willowbrook Baptist Kindergarten",'Huntsville=' + Huntsville.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//////' + showArray);
map.removeOverlays(Huntsville);
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(Huntsville);map.removeOverlays(Huntsville);
map.addOverlays(Huntsville);
centerByArray(Huntsville, false, false);
cntMarker += Huntsville.length;
centerByArray(Huntsville,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=&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;
}