function addMarkers(){
mySelect = document.getElementById('selection');
Abilene = [];Houston = [];Austin = [];Texarkana = [];Burleson = [];Arlington = [];Keene = [];Cleburne = [];Conroe = [];Jefferson = [];Weatherford = [];El_Paso = [];Elgin = [];Missouri_City = [];Fort_Worth = [];Galena_Park = [];Kerrville = [];Katy = [];Mesquite = [];Midland = [];Waco = [];Rusk = [];San_Antonio = [];San_Marcos = [];Mcallen = [];Groves = [];Tyler = [];Weslaco = [];mySelect.options[mySelect.options.length] = new Option("Abilene schools",'all=Abilene');
mySelect.options[mySelect.options.length] = new Option("Arlington schools",'all=Arlington');
mySelect.options[mySelect.options.length] = new Option("Austin schools",'all=Austin');
mySelect.options[mySelect.options.length] = new Option("Burleson schools",'all=Burleson');
mySelect.options[mySelect.options.length] = new Option("Cleburne schools",'all=Cleburne');
mySelect.options[mySelect.options.length] = new Option("Conroe schools",'all=Conroe');
mySelect.options[mySelect.options.length] = new Option("El Paso schools",'all=El_Paso');
mySelect.options[mySelect.options.length] = new Option("Elgin schools",'all=Elgin');
mySelect.options[mySelect.options.length] = new Option("Fort Worth schools",'all=Fort_Worth');
mySelect.options[mySelect.options.length] = new Option("Galena Park schools",'all=Galena_Park');
mySelect.options[mySelect.options.length] = new Option("Groves schools",'all=Groves');
mySelect.options[mySelect.options.length] = new Option("Houston schools",'all=Houston');
mySelect.options[mySelect.options.length] = new Option("Jefferson schools",'all=Jefferson');
mySelect.options[mySelect.options.length] = new Option("Katy schools",'all=Katy');
mySelect.options[mySelect.options.length] = new Option("Keene schools",'all=Keene');
mySelect.options[mySelect.options.length] = new Option("Kerrville schools",'all=Kerrville');
mySelect.options[mySelect.options.length] = new Option("Mcallen schools",'all=Mcallen');
mySelect.options[mySelect.options.length] = new Option("Mesquite schools",'all=Mesquite');
mySelect.options[mySelect.options.length] = new Option("Midland schools",'all=Midland');
mySelect.options[mySelect.options.length] = new Option("Missouri City schools",'all=Missouri_City');
mySelect.options[mySelect.options.length] = new Option("Rusk schools",'all=Rusk');
mySelect.options[mySelect.options.length] = new Option("San Antonio schools",'all=San_Antonio');
mySelect.options[mySelect.options.length] = new Option("San Marcos schools",'all=San_Marcos');
mySelect.options[mySelect.options.length] = new Option("Texarkana schools",'all=Texarkana');
mySelect.options[mySelect.options.length] = new Option("Tyler schools",'all=Tyler');
mySelect.options[mySelect.options.length] = new Option("Waco schools",'all=Waco');
mySelect.options[mySelect.options.length] = new Option("Weatherford schools",'all=Weatherford');
mySelect.options[mySelect.options.length] = new Option("Weslaco schools",'all=Weslaco');
mySelect.options[mySelect.options.length] = new Option("---------------------------",'');
Abilene[Abilene.length] = createMarker(new GPoint(-99.69640000,32.50130000),"
",iconGr);
mySelect.options[mySelect.options.length] = new Option("Abilene Junior Academy",'Abilene=' + Abilene.length);
Houston[Houston.length] = createMarker(new GPoint(-95.32962500,29.66623900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Ar Carethers Academy Sda School",'Houston=' + Houston.length);
Austin[Austin.length] = createMarker(new GPoint(-97.70728800,30.34462800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Austin Sda Jr Academy",'Austin=' + Austin.length);
Texarkana[Texarkana.length] = createMarker(new GPoint(-94.22020000,33.35490000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Bethel Sda School",'Texarkana=' + Texarkana.length);
Burleson[Burleson.length] = createMarker(new GPoint(-97.28047500,32.54231500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Burleson Adventist School",'Burleson=' + Burleson.length);
Arlington[Arlington.length] = createMarker(new GPoint(-97.17544500,32.67090300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Burton Adventist Academy",'Arlington=' + Arlington.length);
Keene[Keene.length] = createMarker(new GPoint(-97.32730000,32.39350000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Chisholm Trail Academy",'Keene=' + Keene.length);
Cleburne[Cleburne.length] = createMarker(new GPoint(-97.42588800,32.33333500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Cleburne Adv Chr School",'Cleburne=' + Cleburne.length);
Conroe[Conroe.length] = createMarker(new GPoint(-95.40356400,30.29669800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Conroe Sda School",'Conroe=' + Conroe.length);
Conroe[Conroe.length] = createMarker(new GPoint(-95.40356400,30.29669800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Conroe Seventh Day Adventist",'Conroe=' + Conroe.length);
Jefferson[Jefferson.length] = createMarker(new GPoint(-94.40379800,32.80629700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Cypress Bend Elementary School",'Jefferson=' + Jefferson.length);
Weatherford[Weatherford.length] = createMarker(new GPoint(-97.79315000,32.78746500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Eden Road Schoolda Christian School",'Weatherford=' + Weatherford.length);
El_Paso[El_Paso.length] = createMarker(new GPoint(-106.33726900,31.74611300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("El Paso Adventist Jr Academy",'El_Paso=' + El_Paso.length);
Elgin[Elgin.length] = createMarker(new GPoint(-97.28213200,30.31097600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Elgin S D A Jr Academy",'Elgin=' + Elgin.length);
Missouri_City[Missouri_City.length] = createMarker(new GPoint(-95.54180000,29.54820000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Excel Adventist Academy",'Missouri_City=' + Missouri_City.length);
Fort_Worth[Fort_Worth.length] = createMarker(new GPoint(-97.36428800,32.63513700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Ft Worth Adventist Jr Academy",'Fort_Worth=' + Fort_Worth.length);
Galena_Park[Galena_Park.length] = createMarker(new GPoint(-95.23909700,29.74401200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Galena Park Sda School",'Galena_Park=' + Galena_Park.length);
Houston[Houston.length] = createMarker(new GPoint(-95.52655700,29.82883800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Greater Houston Adventist School",'Houston=' + Houston.length);
Kerrville[Kerrville.length] = createMarker(new GPoint(-99.15512500,30.06913300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Hill Country Seventh-day Adventist School",'Kerrville=' + Kerrville.length);
Katy[Katy.length] = createMarker(new GPoint(-95.82006000,29.79981200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Katy Adventist Christian School",'Katy=' + Katy.length);
Keene[Keene.length] = createMarker(new GPoint(-97.32239300,32.39713700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Keene Adventist Elementary School",'Keene=' + Keene.length);
Mesquite[Mesquite.length] = createMarker(new GPoint(-96.59435600,32.75474800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Mesquite Adventist School",'Mesquite=' + Mesquite.length);
Midland[Midland.length] = createMarker(new GPoint(-102.10928700,31.98622400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Midland Odessa Sda School",'Midland=' + Midland.length);
Waco[Waco.length] = createMarker(new GPoint(-97.20679600,31.51817100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("New Creation Adventist School",'Waco=' + Waco.length);
Houston[Houston.length] = createMarker(new GPoint(-95.58614700,29.85053800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("The Oaks Adventist Christian School",'Houston=' + Houston.length);
Rusk[Rusk.length] = createMarker(new GPoint(-95.17740000,31.80620000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Rusk S D A School",'Rusk=' + Rusk.length);
San_Antonio[San_Antonio.length] = createMarker(new GPoint(-98.41971400,29.49209300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("San Antonio Jr Academy",'San_Antonio=' + San_Antonio.length);
San_Marcos[San_Marcos.length] = createMarker(new GPoint(-97.94110000,29.88300000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("San Marcos Adventist Junior Academy",'San_Marcos=' + San_Marcos.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);
Mcallen[Mcallen.length] = createMarker(new GPoint(-98.26287000,26.18761000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("South Texas Christian Academy",'Mcallen=' + Mcallen.length);
Texarkana[Texarkana.length] = createMarker(new GPoint(-94.11537700,33.46543600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Texarkana Sda School",'Texarkana=' + Texarkana.length);
Groves[Groves.length] = createMarker(new GPoint(-93.91981400,29.94550500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Triangle Adventist Christian School",'Groves=' + Groves.length);
Groves[Groves.length] = createMarker(new GPoint(-93.93003900,29.93672700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Triangle Seventh Day Adventist",'Groves=' + Groves.length);
Tyler[Tyler.length] = createMarker(new GPoint(-95.26611300,32.31655900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Tyler Adventist Christian School",'Tyler=' + Tyler.length);
Weslaco[Weslaco.length] = createMarker(new GPoint(-97.98254200,26.14807000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Valley Grande Adventist Academy",'Weslaco=' + Weslaco.length);
Weslaco[Weslaco.length] = createMarker(new GPoint(-97.99050000,26.15910000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Valley Grande Elementary School",'Weslaco=' + Weslaco.length);
map.removeOverlays(Abilene);
map.removeOverlays(Arlington);
map.removeOverlays(Austin);
map.removeOverlays(Burleson);
map.removeOverlays(Cleburne);
map.removeOverlays(Conroe);
map.removeOverlays(El_Paso);
map.removeOverlays(Elgin);
map.removeOverlays(Fort_Worth);
map.removeOverlays(Galena_Park);
map.removeOverlays(Groves);
map.removeOverlays(Houston);
map.removeOverlays(Jefferson);
map.removeOverlays(Katy);
map.removeOverlays(Keene);
map.removeOverlays(Kerrville);
map.removeOverlays(Mcallen);
map.removeOverlays(Mesquite);
map.removeOverlays(Midland);
map.removeOverlays(Missouri_City);
map.removeOverlays(Rusk);
map.removeOverlays(San_Antonio);
map.removeOverlays(San_Marcos);
map.removeOverlays(Texarkana);
map.removeOverlays(Tyler);
map.removeOverlays(Waco);
map.removeOverlays(Weatherford);
map.removeOverlays(Weslaco);
setTimeout(function(){map.addOverlays(Abilene)},1000);
setTimeout(function(){map.addOverlays(Arlington)},1000);
setTimeout(function(){map.addOverlays(Austin)},1000);
setTimeout(function(){map.addOverlays(Burleson)},1000);
setTimeout(function(){map.addOverlays(Cleburne)},1000);
setTimeout(function(){map.addOverlays(Conroe)},1000);
setTimeout(function(){map.addOverlays(El_Paso)},1000);
setTimeout(function(){map.addOverlays(Elgin)},1000);
setTimeout(function(){map.addOverlays(Fort_Worth)},1000);
setTimeout(function(){map.addOverlays(Galena_Park)},1000);
setTimeout(function(){map.addOverlays(Groves)},1000);
setTimeout(function(){map.addOverlays(Houston)},1000);
setTimeout(function(){map.addOverlays(Jefferson)},1000);
setTimeout(function(){map.addOverlays(Katy)},1000);
setTimeout(function(){map.addOverlays(Keene)},1000);
setTimeout(function(){map.addOverlays(Kerrville)},1000);
setTimeout(function(){map.addOverlays(Mcallen)},1000);
setTimeout(function(){map.addOverlays(Mesquite)},1000);
setTimeout(function(){map.addOverlays(Midland)},1000);
setTimeout(function(){map.addOverlays(Missouri_City)},1000);
setTimeout(function(){map.addOverlays(Rusk)},1000);
setTimeout(function(){map.addOverlays(San_Antonio)},1000);
setTimeout(function(){map.addOverlays(San_Marcos)},1000);
setTimeout(function(){map.addOverlays(Texarkana)},1000);
setTimeout(function(){map.addOverlays(Tyler)},1000);
setTimeout(function(){map.addOverlays(Waco)},1000);
setTimeout(function(){map.addOverlays(Weatherford)},1000);
setTimeout(function(){map.addOverlays(Weslaco)},1000);
maxLng = -93.91981400;
maxLat = 33.46543600;
minLng = -106.33726900;
minLat = 26.14807000;
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(Abilene);
map.removeOverlays(Arlington);
map.removeOverlays(Austin);
map.removeOverlays(Burleson);
map.removeOverlays(Cleburne);
map.removeOverlays(Conroe);
map.removeOverlays(El_Paso);
map.removeOverlays(Elgin);
map.removeOverlays(Fort_Worth);
map.removeOverlays(Galena_Park);
map.removeOverlays(Groves);
map.removeOverlays(Houston);
map.removeOverlays(Jefferson);
map.removeOverlays(Katy);
map.removeOverlays(Keene);
map.removeOverlays(Kerrville);
map.removeOverlays(Mcallen);
map.removeOverlays(Mesquite);
map.removeOverlays(Midland);
map.removeOverlays(Missouri_City);
map.removeOverlays(Rusk);
map.removeOverlays(San_Antonio);
map.removeOverlays(San_Marcos);
map.removeOverlays(Texarkana);
map.removeOverlays(Tyler);
map.removeOverlays(Waco);
map.removeOverlays(Weatherford);
map.removeOverlays(Weslaco);
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(Abilene);map.removeOverlays(Abilene);
map.removeOverlays(Arlington);
map.removeOverlays(Austin);
map.removeOverlays(Burleson);
map.removeOverlays(Cleburne);
map.removeOverlays(Conroe);
map.removeOverlays(El_Paso);
map.removeOverlays(Elgin);
map.removeOverlays(Fort_Worth);
map.removeOverlays(Galena_Park);
map.removeOverlays(Groves);
map.removeOverlays(Houston);
map.removeOverlays(Jefferson);
map.removeOverlays(Katy);
map.removeOverlays(Keene);
map.removeOverlays(Kerrville);
map.removeOverlays(Mcallen);
map.removeOverlays(Mesquite);
map.removeOverlays(Midland);
map.removeOverlays(Missouri_City);
map.removeOverlays(Rusk);
map.removeOverlays(San_Antonio);
map.removeOverlays(San_Marcos);
map.removeOverlays(Texarkana);
map.removeOverlays(Tyler);
map.removeOverlays(Waco);
map.removeOverlays(Weatherford);
map.removeOverlays(Weslaco);
map.addOverlays(Abilene);
centerByArray(Abilene, false, false);
cntMarker += Abilene.length;
map.addOverlays(Arlington);
centerByArray(Arlington, false, false);
cntMarker += Arlington.length;
map.addOverlays(Austin);
centerByArray(Austin, false, false);
cntMarker += Austin.length;
map.addOverlays(Burleson);
centerByArray(Burleson, false, false);
cntMarker += Burleson.length;
map.addOverlays(Cleburne);
centerByArray(Cleburne, false, false);
cntMarker += Cleburne.length;
map.addOverlays(Conroe);
centerByArray(Conroe, false, false);
cntMarker += Conroe.length;
map.addOverlays(El_Paso);
centerByArray(El_Paso, false, false);
cntMarker += El_Paso.length;
map.addOverlays(Elgin);
centerByArray(Elgin, false, false);
cntMarker += Elgin.length;
map.addOverlays(Fort_Worth);
centerByArray(Fort_Worth, false, false);
cntMarker += Fort_Worth.length;
map.addOverlays(Galena_Park);
centerByArray(Galena_Park, false, false);
cntMarker += Galena_Park.length;
map.addOverlays(Groves);
centerByArray(Groves, false, false);
cntMarker += Groves.length;
map.addOverlays(Houston);
centerByArray(Houston, false, false);
cntMarker += Houston.length;
map.addOverlays(Jefferson);
centerByArray(Jefferson, false, false);
cntMarker += Jefferson.length;
map.addOverlays(Katy);
centerByArray(Katy, false, false);
cntMarker += Katy.length;
map.addOverlays(Keene);
centerByArray(Keene, false, false);
cntMarker += Keene.length;
map.addOverlays(Kerrville);
centerByArray(Kerrville, false, false);
cntMarker += Kerrville.length;
map.addOverlays(Mcallen);
centerByArray(Mcallen, false, false);
cntMarker += Mcallen.length;
map.addOverlays(Mesquite);
centerByArray(Mesquite, false, false);
cntMarker += Mesquite.length;
map.addOverlays(Midland);
centerByArray(Midland, false, false);
cntMarker += Midland.length;
map.addOverlays(Missouri_City);
centerByArray(Missouri_City, false, false);
cntMarker += Missouri_City.length;
map.addOverlays(Rusk);
centerByArray(Rusk, false, false);
cntMarker += Rusk.length;
map.addOverlays(San_Antonio);
centerByArray(San_Antonio, false, false);
cntMarker += San_Antonio.length;
map.addOverlays(San_Marcos);
centerByArray(San_Marcos, false, false);
cntMarker += San_Marcos.length;
map.addOverlays(Texarkana);
centerByArray(Texarkana, false, false);
cntMarker += Texarkana.length;
map.addOverlays(Tyler);
centerByArray(Tyler, false, false);
cntMarker += Tyler.length;
map.addOverlays(Waco);
centerByArray(Waco, false, false);
cntMarker += Waco.length;
map.addOverlays(Weatherford);
centerByArray(Weatherford, false, false);
cntMarker += Weatherford.length;
map.addOverlays(Weslaco);
centerByArray(Weslaco, false, false);
cntMarker += Weslaco.length;
centerByArray(Abilene,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///26594,26538,26673,26689,26690,26753,26470,26929,33963,26639,27652,27273,27268,33962,27657,26476,26594,26538,26593,26673,26689,26690,26753,26754,26823,26829,36116,27618,26470,26929,33963,26722,33961,26974,26976,27652,27050,27059,26765,27238,27264,27273,27268,26566,996,27647,33962,26747,27657,27658,/all');
//window.open('/map.php?type=2&schools=26594,26538,26673,26689,26690,26753,26470,26929,33963,26639,27652,27273,27268,33962,27657,26476,26594,26538,26593,26673,26689,26690,26753,26754,26823,26829,36116,27618,26470,26929,33963,26722,33961,26974,26976,27652,27050,27059,26765,27238,27264,27273,27268,26566,996,27647,33962,26747,27657,27658,&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;
}