function addMarkers(){
mySelect = document.getElementById('selection');
San_Antonio = [];Universal_City = [];Adkins = [];mySelect.options[mySelect.options.length] = new Option("Adkins schools",'all=Adkins');
mySelect.options[mySelect.options.length] = new Option("San Antonio schools",'all=San_Antonio');
mySelect.options[mySelect.options.length] = new Option("Universal City schools",'all=Universal_City');
mySelect.options[mySelect.options.length] = new Option("---------------------------",'');
San_Antonio[San_Antonio.length] = createMarker(new GPoint(-98.49535400,29.64814000),"
",iconGr);
mySelect.options[mySelect.options.length] = new Option("The Montessori School of San Antonio",'San_Antonio=' + San_Antonio.length);
San_Antonio[San_Antonio.length] = createMarker(new GPoint(-98.52605700,29.52222300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Antonian College Prep",'San_Antonio=' + San_Antonio.length);
San_Antonio[San_Antonio.length] = createMarker(new GPoint(-98.64375300,29.58805400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("The Atonement Academy",'San_Antonio=' + San_Antonio.length);
San_Antonio[San_Antonio.length] = createMarker(new GPoint(-98.36997700,29.56357500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Believers Academy",'San_Antonio=' + San_Antonio.length);
San_Antonio[San_Antonio.length] = createMarker(new GPoint(-98.60080500,29.56133100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Blessed Hope Academy",'San_Antonio=' + San_Antonio.length);
San_Antonio[San_Antonio.length] = createMarker(new GPoint(-98.47921500,29.66430600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Buckner Fanning Christian School At Mission Springs",'San_Antonio=' + San_Antonio.length);
San_Antonio[San_Antonio.length] = createMarker(new GPoint(-98.52524200,29.53603500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Castle Hills First Baptist School",'San_Antonio=' + San_Antonio.length);
San_Antonio[San_Antonio.length] = createMarker(new GPoint(-98.48124500,29.43839500),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Central Catholic High School",'San_Antonio=' + San_Antonio.length);
San_Antonio[San_Antonio.length] = createMarker(new GPoint(-98.54306100,29.41926600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Christian Academy Of San Antonio",'San_Antonio=' + San_Antonio.length);
San_Antonio[San_Antonio.length] = createMarker(new GPoint(-98.47354200,29.58963000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Christian Heritage Schools",'San_Antonio=' + San_Antonio.length);
San_Antonio[San_Antonio.length] = createMarker(new GPoint(-98.57206700,29.51678900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("City Church Academy",'San_Antonio=' + San_Antonio.length);
San_Antonio[San_Antonio.length] = createMarker(new GPoint(-98.53535200,29.52141200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Cornerstone Christian School",'San_Antonio=' + San_Antonio.length);
Universal_City[Universal_City.length] = createMarker(new GPoint(-98.30115800,29.55122300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("First Baptist Academy",'Universal_City=' + Universal_City.length);
San_Antonio[San_Antonio.length] = createMarker(new GPoint(-98.61511000,29.36849100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Gateway Christian School",'San_Antonio=' + San_Antonio.length);
San_Antonio[San_Antonio.length] = createMarker(new GPoint(-98.47585700,29.60987100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Harvest Schools",'San_Antonio=' + San_Antonio.length);
San_Antonio[San_Antonio.length] = createMarker(new GPoint(-98.47673200,29.46566900),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Incarnate Word High School",'San_Antonio=' + San_Antonio.length);
San_Antonio[San_Antonio.length] = createMarker(new GPoint(-98.49342500,29.45211500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Keystone School",'San_Antonio=' + San_Antonio.length);
San_Antonio[San_Antonio.length] = createMarker(new GPoint(-98.62924200,29.61160200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Lutheran High School Of San An",'San_Antonio=' + San_Antonio.length);
San_Antonio[San_Antonio.length] = createMarker(new GPoint(-98.61859600,29.40382000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("New Life Christian Academy",'San_Antonio=' + San_Antonio.length);
San_Antonio[San_Antonio.length] = createMarker(new GPoint(-98.48143100,29.34997000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Omega School",'San_Antonio=' + San_Antonio.length);
San_Antonio[San_Antonio.length] = createMarker(new GPoint(-98.48610100,29.43438000),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Providence High School",'San_Antonio=' + San_Antonio.length);
San_Antonio[San_Antonio.length] = createMarker(new GPoint(-98.65495600,29.41725200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Rainbow Hills Baptist School",'San_Antonio=' + San_Antonio.length);
San_Antonio[San_Antonio.length] = createMarker(new GPoint(-98.50664100,29.50770500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("River City Christian School",'San_Antonio=' + San_Antonio.length);
San_Antonio[San_Antonio.length] = createMarker(new GPoint(-98.49164100,29.46003700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St. Anthony Catholic High School",'San_Antonio=' + San_Antonio.length);
San_Antonio[San_Antonio.length] = createMarker(new GPoint(-98.53816800,29.37686900),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("St. Francis Academy",'San_Antonio=' + San_Antonio.length);
San_Antonio[San_Antonio.length] = createMarker(new GPoint(-98.50051600,29.38148000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St. Leo The Great Catholic School",'San_Antonio=' + San_Antonio.length);
San_Antonio[San_Antonio.length] = createMarker(new GPoint(-98.42473700,29.52745900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Saint Mary's Hall",'San_Antonio=' + San_Antonio.length);
San_Antonio[San_Antonio.length] = createMarker(new GPoint(-98.42475600,29.52762600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St. Mary's Hall Middle School",'San_Antonio=' + San_Antonio.length);
San_Antonio[San_Antonio.length] = createMarker(new GPoint(-98.42475600,29.52762600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St. Mary's Hall Upper School",'San_Antonio=' + San_Antonio.length);
Adkins[Adkins.length] = createMarker(new GPoint(-98.24220000,29.35270000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Salem Sayers Baptist Academy",'Adkins=' + Adkins.length);
San_Antonio[San_Antonio.length] = createMarker(new GPoint(-98.46075300,29.62043300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("San Antonio Christian Schools",'San_Antonio=' + San_Antonio.length);
San_Antonio[San_Antonio.length] = createMarker(new GPoint(-98.66045500,29.54642000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Scenic Hills SDA Christian School",'San_Antonio=' + San_Antonio.length);
San_Antonio[San_Antonio.length] = createMarker(new GPoint(-98.59196200,29.48366500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Sendero Christian Academy",'San_Antonio=' + San_Antonio.length);
San_Antonio[San_Antonio.length] = createMarker(new GPoint(-98.56550000,29.52190000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Spirit Cristian Center",'San_Antonio=' + San_Antonio.length);
San_Antonio[San_Antonio.length] = createMarker(new GPoint(-98.46145700,29.41424400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St Gerard Catholic School",'San_Antonio=' + San_Antonio.length);
San_Antonio[San_Antonio.length] = createMarker(new GPoint(-98.47815500,29.46394800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Sunshine Cottage School For Deaf Children",'San_Antonio=' + San_Antonio.length);
San_Antonio[San_Antonio.length] = createMarker(new GPoint(-98.60176100,29.63559400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("TMI-The Episcopal School of Texas",'San_Antonio=' + San_Antonio.length);
San_Antonio[San_Antonio.length] = createMarker(new GPoint(-98.40036300,29.40158600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Town East Christian School",'San_Antonio=' + San_Antonio.length);
San_Antonio[San_Antonio.length] = createMarker(new GPoint(-98.38470400,29.60313700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Trinity Christian Academy",'San_Antonio=' + San_Antonio.length);
San_Antonio[San_Antonio.length] = createMarker(new GPoint(-98.57986300,29.51937100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("The Winston School San Antonio",'San_Antonio=' + San_Antonio.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(Adkins);
map.removeOverlays(San_Antonio);
map.removeOverlays(Universal_City);
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(San_Antonio);map.removeOverlays(Adkins);
map.removeOverlays(San_Antonio);
map.removeOverlays(Universal_City);
map.addOverlays(Adkins);
centerByArray(Adkins, false, false);
cntMarker += Adkins.length;
map.addOverlays(San_Antonio);
centerByArray(San_Antonio, false, false);
cntMarker += San_Antonio.length;
map.addOverlays(Universal_City);
centerByArray(Universal_City, false, false);
cntMarker += Universal_City.length;
centerByArray(San_Antonio,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;
}