function addMarkers(){
mySelect = document.getElementById('selection');
Garland = [];Balch_Springs = [];Burleson = [];De_Soto = [];Houston = [];Pilot_Point = [];Palmhurst = [];Post = [];Brenham = [];Boerne = [];La_Porte = [];San_Angelo = [];Mesquite = [];El_Paso = [];Monaville = [];Plano = [];Dallas = [];Fort_Worth = [];Texas_City = [];San_Antonio = [];Canton = [];mySelect.options[mySelect.options.length] = new Option("Balch Springs schools",'all=Balch_Springs');
mySelect.options[mySelect.options.length] = new Option("Boerne schools",'all=Boerne');
mySelect.options[mySelect.options.length] = new Option("Brenham schools",'all=Brenham');
mySelect.options[mySelect.options.length] = new Option("Burleson schools",'all=Burleson');
mySelect.options[mySelect.options.length] = new Option("Canton schools",'all=Canton');
mySelect.options[mySelect.options.length] = new Option("Dallas schools",'all=Dallas');
mySelect.options[mySelect.options.length] = new Option("De Soto schools",'all=De_Soto');
mySelect.options[mySelect.options.length] = new Option("El Paso schools",'all=El_Paso');
mySelect.options[mySelect.options.length] = new Option("Fort Worth schools",'all=Fort_Worth');
mySelect.options[mySelect.options.length] = new Option("Garland schools",'all=Garland');
mySelect.options[mySelect.options.length] = new Option("Houston schools",'all=Houston');
mySelect.options[mySelect.options.length] = new Option("La Porte schools",'all=La_Porte');
mySelect.options[mySelect.options.length] = new Option("Mesquite schools",'all=Mesquite');
mySelect.options[mySelect.options.length] = new Option("Monaville schools",'all=Monaville');
mySelect.options[mySelect.options.length] = new Option("Palmhurst schools",'all=Palmhurst');
mySelect.options[mySelect.options.length] = new Option("Pilot Point schools",'all=Pilot_Point');
mySelect.options[mySelect.options.length] = new Option("Plano schools",'all=Plano');
mySelect.options[mySelect.options.length] = new Option("Post schools",'all=Post');
mySelect.options[mySelect.options.length] = new Option("San Angelo schools",'all=San_Angelo');
mySelect.options[mySelect.options.length] = new Option("San Antonio schools",'all=San_Antonio');
mySelect.options[mySelect.options.length] = new Option("Texas City schools",'all=Texas_City');
mySelect.options[mySelect.options.length] = new Option("---------------------------",'');
Garland[Garland.length] = createMarker(new GPoint(-96.65133600,32.89416200),"
",iconGr);
mySelect.options[mySelect.options.length] = new Option("Abc Christian Preschool And Baptist Academy",'Garland=' + Garland.length);
Balch_Springs[Balch_Springs.length] = createMarker(new GPoint(-96.62946400,32.70476300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Balch Springs Christian Academy",'Balch_Springs=' + Balch_Springs.length);
Burleson[Burleson.length] = createMarker(new GPoint(-97.31733100,32.54761100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Boulevard Baptist Christian School",'Burleson=' + Burleson.length);
De_Soto[De_Soto.length] = createMarker(new GPoint(-96.85811900,32.61877400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Brook Hollow Christian Academy",'De_Soto=' + De_Soto.length);
Houston[Houston.length] = createMarker(new GPoint(-95.66853300,29.85348300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Brookhollow Christian Academy",'Houston=' + Houston.length);
Houston[Houston.length] = createMarker(new GPoint(-95.48527900,29.77765500),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Duchesne Academy",'Houston=' + Houston.length);
Pilot_Point[Pilot_Point.length] = createMarker(new GPoint(-96.96828300,33.38870100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Education Plus+ Ministries",'Pilot_Point=' + Pilot_Point.length);
Palmhurst[Palmhurst.length] = createMarker(new GPoint(-98.28028400,26.24435500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Faith Christian Academy",'Palmhurst=' + Palmhurst.length);
Post[Post.length] = createMarker(new GPoint(-101.38238400,33.19103700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("First Baptist Church Christian School",'Post=' + Post.length);
Brenham[Brenham.length] = createMarker(new GPoint(-96.39686600,30.17036700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("First Baptist Church School",'Brenham=' + Brenham.length);
Garland[Garland.length] = createMarker(new GPoint(-96.62713100,32.92569400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Garland Christian Academy",'Garland=' + Garland.length);
Boerne[Boerne.length] = createMarker(new GPoint(-98.68812100,29.75139800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Geneva School Of Boerne",'Boerne=' + Boerne.length);
La_Porte[La_Porte.length] = createMarker(new GPoint(-95.01910000,29.66550000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Grace Baptist Academy",'La_Porte=' + La_Porte.length);
San_Angelo[San_Angelo.length] = createMarker(new GPoint(-100.42082900,31.46543700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Harris Ave Baptist Church School",'San_Angelo=' + San_Angelo.length);
Houston[Houston.length] = createMarker(new GPoint(-95.36598400,29.83154600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Helmers Street Christian School",'Houston=' + Houston.length);
Mesquite[Mesquite.length] = createMarker(new GPoint(-96.61448900,32.79426700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Macedonia Christian Academy",'Mesquite=' + Mesquite.length);
Houston[Houston.length] = createMarker(new GPoint(-95.40001500,29.86979200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("North Houston Baptist School",'Houston=' + Houston.length);
El_Paso[El_Paso.length] = createMarker(new GPoint(-106.40686100,31.89574500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Northeast Christian Academy",'El_Paso=' + El_Paso.length);
Monaville[Monaville.length] = createMarker(new GPoint(-96.04004400,29.95064000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Pearland Heritage Christian Academy",'Monaville=' + Monaville.length);
Houston[Houston.length] = createMarker(new GPoint(-95.21738900,29.63260800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("South Shaver Baptist School",'Houston=' + Houston.length);
Plano[Plano.length] = createMarker(new GPoint(-96.69734500,33.04589700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Temple Baptist Christian Academy",'Plano=' + Plano.length);
Dallas[Dallas.length] = createMarker(new GPoint(-96.67591400,32.74283700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Temple Christian School",'Dallas=' + Dallas.length);
Fort_Worth[Fort_Worth.length] = createMarker(new GPoint(-97.21056600,32.77835900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Temple Christian Schools",'Fort_Worth=' + Fort_Worth.length);
Texas_City[Texas_City.length] = createMarker(new GPoint(-94.93707400,29.40571300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Trinity Baptist Christian School",'Texas_City=' + Texas_City.length);
San_Antonio[San_Antonio.length] = createMarker(new GPoint(-98.64233900,29.38317200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Valley Hi Assembly Of God Daycare",'San_Antonio=' + San_Antonio.length);
Canton[Canton.length] = createMarker(new GPoint(-95.90290000,32.52170000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Victory Christian School",'Canton=' + Canton.length);
map.removeOverlays(Balch_Springs);
map.removeOverlays(Boerne);
map.removeOverlays(Brenham);
map.removeOverlays(Burleson);
map.removeOverlays(Canton);
map.removeOverlays(Dallas);
map.removeOverlays(De_Soto);
map.removeOverlays(El_Paso);
map.removeOverlays(Fort_Worth);
map.removeOverlays(Garland);
map.removeOverlays(Houston);
map.removeOverlays(La_Porte);
map.removeOverlays(Mesquite);
map.removeOverlays(Monaville);
map.removeOverlays(Palmhurst);
map.removeOverlays(Pilot_Point);
map.removeOverlays(Plano);
map.removeOverlays(Post);
map.removeOverlays(San_Angelo);
map.removeOverlays(San_Antonio);
map.removeOverlays(Texas_City);
setTimeout(function(){map.addOverlays(Balch_Springs)},1000);
setTimeout(function(){map.addOverlays(Boerne)},1000);
setTimeout(function(){map.addOverlays(Brenham)},1000);
setTimeout(function(){map.addOverlays(Burleson)},1000);
setTimeout(function(){map.addOverlays(Canton)},1000);
setTimeout(function(){map.addOverlays(Dallas)},1000);
setTimeout(function(){map.addOverlays(De_Soto)},1000);
setTimeout(function(){map.addOverlays(El_Paso)},1000);
setTimeout(function(){map.addOverlays(Fort_Worth)},1000);
setTimeout(function(){map.addOverlays(Garland)},1000);
setTimeout(function(){map.addOverlays(Houston)},1000);
setTimeout(function(){map.addOverlays(La_Porte)},1000);
setTimeout(function(){map.addOverlays(Mesquite)},1000);
setTimeout(function(){map.addOverlays(Monaville)},1000);
setTimeout(function(){map.addOverlays(Palmhurst)},1000);
setTimeout(function(){map.addOverlays(Pilot_Point)},1000);
setTimeout(function(){map.addOverlays(Plano)},1000);
setTimeout(function(){map.addOverlays(Post)},1000);
setTimeout(function(){map.addOverlays(San_Angelo)},1000);
setTimeout(function(){map.addOverlays(San_Antonio)},1000);
setTimeout(function(){map.addOverlays(Texas_City)},1000);
maxLng = -94.93707400;
maxLat = 33.38870100;
minLng = -106.40686100;
minLat = 26.24435500;
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,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(Balch_Springs);
map.removeOverlays(Boerne);
map.removeOverlays(Brenham);
map.removeOverlays(Burleson);
map.removeOverlays(Canton);
map.removeOverlays(Dallas);
map.removeOverlays(De_Soto);
map.removeOverlays(El_Paso);
map.removeOverlays(Fort_Worth);
map.removeOverlays(Garland);
map.removeOverlays(Houston);
map.removeOverlays(La_Porte);
map.removeOverlays(Mesquite);
map.removeOverlays(Monaville);
map.removeOverlays(Palmhurst);
map.removeOverlays(Pilot_Point);
map.removeOverlays(Plano);
map.removeOverlays(Post);
map.removeOverlays(San_Angelo);
map.removeOverlays(San_Antonio);
map.removeOverlays(Texas_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(Garland);map.removeOverlays(Balch_Springs);
map.removeOverlays(Boerne);
map.removeOverlays(Brenham);
map.removeOverlays(Burleson);
map.removeOverlays(Canton);
map.removeOverlays(Dallas);
map.removeOverlays(De_Soto);
map.removeOverlays(El_Paso);
map.removeOverlays(Fort_Worth);
map.removeOverlays(Garland);
map.removeOverlays(Houston);
map.removeOverlays(La_Porte);
map.removeOverlays(Mesquite);
map.removeOverlays(Monaville);
map.removeOverlays(Palmhurst);
map.removeOverlays(Pilot_Point);
map.removeOverlays(Plano);
map.removeOverlays(Post);
map.removeOverlays(San_Angelo);
map.removeOverlays(San_Antonio);
map.removeOverlays(Texas_City);
map.addOverlays(Balch_Springs);
centerByArray(Balch_Springs, false, false);
cntMarker += Balch_Springs.length;
map.addOverlays(Boerne);
centerByArray(Boerne, false, false);
cntMarker += Boerne.length;
map.addOverlays(Brenham);
centerByArray(Brenham, false, false);
cntMarker += Brenham.length;
map.addOverlays(Burleson);
centerByArray(Burleson, false, false);
cntMarker += Burleson.length;
map.addOverlays(Canton);
centerByArray(Canton, false, false);
cntMarker += Canton.length;
map.addOverlays(Dallas);
centerByArray(Dallas, false, false);
cntMarker += Dallas.length;
map.addOverlays(De_Soto);
centerByArray(De_Soto, false, false);
cntMarker += De_Soto.length;
map.addOverlays(El_Paso);
centerByArray(El_Paso, false, false);
cntMarker += El_Paso.length;
map.addOverlays(Fort_Worth);
centerByArray(Fort_Worth, false, false);
cntMarker += Fort_Worth.length;
map.addOverlays(Garland);
centerByArray(Garland, false, false);
cntMarker += Garland.length;
map.addOverlays(Houston);
centerByArray(Houston, false, false);
cntMarker += Houston.length;
map.addOverlays(La_Porte);
centerByArray(La_Porte, false, false);
cntMarker += La_Porte.length;
map.addOverlays(Mesquite);
centerByArray(Mesquite, false, false);
cntMarker += Mesquite.length;
map.addOverlays(Monaville);
centerByArray(Monaville, false, false);
cntMarker += Monaville.length;
map.addOverlays(Palmhurst);
centerByArray(Palmhurst, false, false);
cntMarker += Palmhurst.length;
map.addOverlays(Pilot_Point);
centerByArray(Pilot_Point, false, false);
cntMarker += Pilot_Point.length;
map.addOverlays(Plano);
centerByArray(Plano, false, false);
cntMarker += Plano.length;
map.addOverlays(Post);
centerByArray(Post, false, false);
cntMarker += Post.length;
map.addOverlays(San_Angelo);
centerByArray(San_Angelo, false, false);
cntMarker += San_Angelo.length;
map.addOverlays(San_Antonio);
centerByArray(San_Antonio, false, false);
cntMarker += San_Antonio.length;
map.addOverlays(Texas_City);
centerByArray(Texas_City, false, false);
cntMarker += Texas_City.length;
centerByArray(Garland,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///26542,27551,26590,27123,27552,26833,26739,27297,26852,27051,26776,30620,27548,27620,26542,33319,26800,26577,27669,27551,26590,27123,27552,27061,26833,33318,26739,26884,33320,27297,26852,27051,33321,26776,30620,27548,26789,26879,27661,27620,/all');
//window.open('/map.php?type=2&schools=26542,27551,26590,27123,27552,26833,26739,27297,26852,27051,26776,30620,27548,27620,26542,33319,26800,26577,27669,27551,26590,27123,27552,27061,26833,33318,26739,26884,33320,27297,26852,27051,33321,26776,30620,27548,26789,26879,27661,27620,&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;
}