function addMarkers(){
mySelect = document.getElementById('selection');
Abilene = [];Longview = [];Austin = [];San_Antonio = [];Kingwood = [];Sugar_Land = [];Mesquite = [];Tyler = [];Fort_Worth = [];Lubbock = [];Houston = [];Midland = [];Conroe = [];Mckinney = [];Odessa = [];Arlington = [];Uvalde = [];San_Angelo = [];Port_Arthur = [];Sweeny = [];Grand_Prairie = [];Alamo = [];Victoria = [];Wichita_Falls = [];mySelect.options[mySelect.options.length] = new Option("Abilene schools",'all=Abilene');
mySelect.options[mySelect.options.length] = new Option("Alamo schools",'all=Alamo');
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("Conroe schools",'all=Conroe');
mySelect.options[mySelect.options.length] = new Option("Fort Worth schools",'all=Fort_Worth');
mySelect.options[mySelect.options.length] = new Option("Grand Prairie schools",'all=Grand_Prairie');
mySelect.options[mySelect.options.length] = new Option("Houston schools",'all=Houston');
mySelect.options[mySelect.options.length] = new Option("Kingwood schools",'all=Kingwood');
mySelect.options[mySelect.options.length] = new Option("Longview schools",'all=Longview');
mySelect.options[mySelect.options.length] = new Option("Lubbock schools",'all=Lubbock');
mySelect.options[mySelect.options.length] = new Option("Mckinney schools",'all=Mckinney');
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("Odessa schools",'all=Odessa');
mySelect.options[mySelect.options.length] = new Option("Port Arthur schools",'all=Port_Arthur');
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("Sugar Land schools",'all=Sugar_Land');
mySelect.options[mySelect.options.length] = new Option("Sweeny schools",'all=Sweeny');
mySelect.options[mySelect.options.length] = new Option("Tyler schools",'all=Tyler');
mySelect.options[mySelect.options.length] = new Option("Uvalde schools",'all=Uvalde');
mySelect.options[mySelect.options.length] = new Option("Victoria schools",'all=Victoria');
mySelect.options[mySelect.options.length] = new Option("Wichita Falls schools",'all=Wichita_Falls');
mySelect.options[mySelect.options.length] = new Option("---------------------------",'');
Abilene[Abilene.length] = createMarker(new GPoint(-99.70783600,32.47910700),"
",iconGr);
mySelect.options[mySelect.options.length] = new Option("Abilene Christian Schools",'Abilene=' + Abilene.length);
Longview[Longview.length] = createMarker(new GPoint(-94.72042500,32.53671900),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Alpine Christian Academy",'Longview=' + Longview.length);
Austin[Austin.length] = createMarker(new GPoint(-97.68243500,30.39076100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Brentwood Christian School",'Austin=' + Austin.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);
Kingwood[Kingwood.length] = createMarker(new GPoint(-95.21400400,30.05367400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Christian School Of Kingwood",'Kingwood=' + Kingwood.length);
Sugar_Land[Sugar_Land.length] = createMarker(new GPoint(-95.63715900,29.59648000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Cornerstone Christian Academy",'Sugar_Land=' + Sugar_Land.length);
Mesquite[Mesquite.length] = createMarker(new GPoint(-96.80000000,32.78330000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Dallas Christian School",'Mesquite=' + Mesquite.length);
Tyler[Tyler.length] = createMarker(new GPoint(-95.28035500,32.29516300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("East Texas Christian Academy",'Tyler=' + Tyler.length);
Fort_Worth[Fort_Worth.length] = createMarker(new GPoint(-97.21850500,32.85889100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Fort Worth Christian School",'Fort_Worth=' + Fort_Worth.length);
Lubbock[Lubbock.length] = createMarker(new GPoint(-101.93412300,33.57046000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Lubbock Christian School",'Lubbock=' + Lubbock.length);
Houston[Houston.length] = createMarker(new GPoint(-95.60594100,29.75760200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Memorial Christian Academy",'Houston=' + Houston.length);
Midland[Midland.length] = createMarker(new GPoint(-102.11531000,32.01022800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Midland Christian School",'Midland=' + Midland.length);
Conroe[Conroe.length] = createMarker(new GPoint(-95.46351200,30.32462800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Montgomery County Christian School",'Conroe=' + Conroe.length);
Mckinney[Mckinney.length] = createMarker(new GPoint(-96.63236700,33.23379300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("North Texas Christian Academy - A Private Christian School in McKinney Texas",'Mckinney=' + Mckinney.length);
Fort_Worth[Fort_Worth.length] = createMarker(new GPoint(-97.40832300,32.80434400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("North West Christian Academy",'Fort_Worth=' + Fort_Worth.length);
Houston[Houston.length] = createMarker(new GPoint(-95.49395900,29.98736200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Northland Christian School Pk-12",'Houston=' + Houston.length);
Odessa[Odessa.length] = createMarker(new GPoint(-102.35553700,31.87156300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Odessa Christian School",'Odessa=' + Odessa.length);
Arlington[Arlington.length] = createMarker(new GPoint(-97.11784200,32.72131600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Park Row Christian Academy",'Arlington=' + Arlington.length);
Houston[Houston.length] = createMarker(new GPoint(-95.45614100,29.65501000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Robert M. Beren Academy",'Houston=' + Houston.length);
Uvalde[Uvalde.length] = createMarker(new GPoint(-99.79458600,29.21340700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Sacred Heart Parish School",'Uvalde=' + Uvalde.length);
San_Angelo[San_Angelo.length] = createMarker(new GPoint(-100.43416300,31.39216700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("San Angelo Christian Academy",'San_Angelo=' + San_Angelo.length);
Fort_Worth[Fort_Worth.length] = createMarker(new GPoint(-97.40786700,32.64791000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Southwest Christian School",'Fort_Worth=' + Fort_Worth.length);
Port_Arthur[Port_Arthur.length] = createMarker(new GPoint(-93.92129600,29.90711000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Sr Thea Bowman Academy",'Port_Arthur=' + Port_Arthur.length);
Houston[Houston.length] = createMarker(new GPoint(-95.36873500,29.71989400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St Mary Of The Purification Montessori",'Houston=' + Houston.length);
Sweeny[Sweeny.length] = createMarker(new GPoint(-95.71440000,29.06080000),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Sweeny Christian School",'Sweeny=' + Sweeny.length);
Grand_Prairie[Grand_Prairie.length] = createMarker(new GPoint(-97.01207900,32.75733600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Turnpike Christian School",'Grand_Prairie=' + Grand_Prairie.length);
Alamo[Alamo.length] = createMarker(new GPoint(-98.12132400,26.19387100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Valley Christian Heritage School",'Alamo=' + Alamo.length);
Victoria[Victoria.length] = createMarker(new GPoint(-96.99722800,28.82061300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Victoria Christian School",'Victoria=' + Victoria.length);
Houston[Houston.length] = createMarker(new GPoint(-95.49240800,29.66847000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Westbury Christian School",'Houston=' + Houston.length);
Wichita_Falls[Wichita_Falls.length] = createMarker(new GPoint(-98.49715700,33.85955700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Wichita Christian School",'Wichita_Falls=' + Wichita_Falls.length);
map.removeOverlays(Abilene);
map.removeOverlays(Alamo);
map.removeOverlays(Arlington);
map.removeOverlays(Austin);
map.removeOverlays(Conroe);
map.removeOverlays(Fort_Worth);
map.removeOverlays(Grand_Prairie);
map.removeOverlays(Houston);
map.removeOverlays(Kingwood);
map.removeOverlays(Longview);
map.removeOverlays(Lubbock);
map.removeOverlays(Mckinney);
map.removeOverlays(Mesquite);
map.removeOverlays(Midland);
map.removeOverlays(Odessa);
map.removeOverlays(Port_Arthur);
map.removeOverlays(San_Angelo);
map.removeOverlays(San_Antonio);
map.removeOverlays(Sugar_Land);
map.removeOverlays(Sweeny);
map.removeOverlays(Tyler);
map.removeOverlays(Uvalde);
map.removeOverlays(Victoria);
map.removeOverlays(Wichita_Falls);
setTimeout(function(){map.addOverlays(Abilene)},1000);
setTimeout(function(){map.addOverlays(Alamo)},1000);
setTimeout(function(){map.addOverlays(Arlington)},1000);
setTimeout(function(){map.addOverlays(Austin)},1000);
setTimeout(function(){map.addOverlays(Conroe)},1000);
setTimeout(function(){map.addOverlays(Fort_Worth)},1000);
setTimeout(function(){map.addOverlays(Grand_Prairie)},1000);
setTimeout(function(){map.addOverlays(Houston)},1000);
setTimeout(function(){map.addOverlays(Kingwood)},1000);
setTimeout(function(){map.addOverlays(Longview)},1000);
setTimeout(function(){map.addOverlays(Lubbock)},1000);
setTimeout(function(){map.addOverlays(Mckinney)},1000);
setTimeout(function(){map.addOverlays(Mesquite)},1000);
setTimeout(function(){map.addOverlays(Midland)},1000);
setTimeout(function(){map.addOverlays(Odessa)},1000);
setTimeout(function(){map.addOverlays(Port_Arthur)},1000);
setTimeout(function(){map.addOverlays(San_Angelo)},1000);
setTimeout(function(){map.addOverlays(San_Antonio)},1000);
setTimeout(function(){map.addOverlays(Sugar_Land)},1000);
setTimeout(function(){map.addOverlays(Sweeny)},1000);
setTimeout(function(){map.addOverlays(Tyler)},1000);
setTimeout(function(){map.addOverlays(Uvalde)},1000);
setTimeout(function(){map.addOverlays(Victoria)},1000);
setTimeout(function(){map.addOverlays(Wichita_Falls)},1000);
maxLng = -93.92129600;
maxLat = 33.85955700;
minLng = -102.35553700;
minLat = 26.19387100;
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(Alamo);
map.removeOverlays(Arlington);
map.removeOverlays(Austin);
map.removeOverlays(Conroe);
map.removeOverlays(Fort_Worth);
map.removeOverlays(Grand_Prairie);
map.removeOverlays(Houston);
map.removeOverlays(Kingwood);
map.removeOverlays(Longview);
map.removeOverlays(Lubbock);
map.removeOverlays(Mckinney);
map.removeOverlays(Mesquite);
map.removeOverlays(Midland);
map.removeOverlays(Odessa);
map.removeOverlays(Port_Arthur);
map.removeOverlays(San_Angelo);
map.removeOverlays(San_Antonio);
map.removeOverlays(Sugar_Land);
map.removeOverlays(Sweeny);
map.removeOverlays(Tyler);
map.removeOverlays(Uvalde);
map.removeOverlays(Victoria);
map.removeOverlays(Wichita_Falls);
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(Alamo);
map.removeOverlays(Arlington);
map.removeOverlays(Austin);
map.removeOverlays(Conroe);
map.removeOverlays(Fort_Worth);
map.removeOverlays(Grand_Prairie);
map.removeOverlays(Houston);
map.removeOverlays(Kingwood);
map.removeOverlays(Longview);
map.removeOverlays(Lubbock);
map.removeOverlays(Mckinney);
map.removeOverlays(Mesquite);
map.removeOverlays(Midland);
map.removeOverlays(Odessa);
map.removeOverlays(Port_Arthur);
map.removeOverlays(San_Angelo);
map.removeOverlays(San_Antonio);
map.removeOverlays(Sugar_Land);
map.removeOverlays(Sweeny);
map.removeOverlays(Tyler);
map.removeOverlays(Uvalde);
map.removeOverlays(Victoria);
map.removeOverlays(Wichita_Falls);
map.addOverlays(Abilene);
centerByArray(Abilene, false, false);
cntMarker += Abilene.length;
map.addOverlays(Alamo);
centerByArray(Alamo, false, false);
cntMarker += Alamo.length;
map.addOverlays(Arlington);
centerByArray(Arlington, false, false);
cntMarker += Arlington.length;
map.addOverlays(Austin);
centerByArray(Austin, false, false);
cntMarker += Austin.length;
map.addOverlays(Conroe);
centerByArray(Conroe, false, false);
cntMarker += Conroe.length;
map.addOverlays(Fort_Worth);
centerByArray(Fort_Worth, false, false);
cntMarker += Fort_Worth.length;
map.addOverlays(Grand_Prairie);
centerByArray(Grand_Prairie, false, false);
cntMarker += Grand_Prairie.length;
map.addOverlays(Houston);
centerByArray(Houston, false, false);
cntMarker += Houston.length;
map.addOverlays(Kingwood);
centerByArray(Kingwood, false, false);
cntMarker += Kingwood.length;
map.addOverlays(Longview);
centerByArray(Longview, false, false);
cntMarker += Longview.length;
map.addOverlays(Lubbock);
centerByArray(Lubbock, false, false);
cntMarker += Lubbock.length;
map.addOverlays(Mckinney);
centerByArray(Mckinney, false, false);
cntMarker += Mckinney.length;
map.addOverlays(Mesquite);
centerByArray(Mesquite, false, false);
cntMarker += Mesquite.length;
map.addOverlays(Midland);
centerByArray(Midland, false, false);
cntMarker += Midland.length;
map.addOverlays(Odessa);
centerByArray(Odessa, false, false);
cntMarker += Odessa.length;
map.addOverlays(Port_Arthur);
centerByArray(Port_Arthur, false, false);
cntMarker += Port_Arthur.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(Sugar_Land);
centerByArray(Sugar_Land, false, false);
cntMarker += Sugar_Land.length;
map.addOverlays(Sweeny);
centerByArray(Sweeny, false, false);
cntMarker += Sweeny.length;
map.addOverlays(Tyler);
centerByArray(Tyler, false, false);
cntMarker += Tyler.length;
map.addOverlays(Uvalde);
centerByArray(Uvalde, false, false);
cntMarker += Uvalde.length;
map.addOverlays(Victoria);
centerByArray(Victoria, false, false);
cntMarker += Victoria.length;
map.addOverlays(Wichita_Falls);
centerByArray(Wichita_Falls, false, false);
cntMarker += Wichita_Falls.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///26475,27655,26583,26815,27305,27124,27569,27685,27022,26727,27058,34154,26654,26743,27694,26475,27655,30461,26583,27092,26815,27120,27305,27646,26439,27124,27569,27425,27685,26661,34152,27022,34153,26727,27058,27138,27312,34154,26654,35720,27544,26743,27242,27663,27694,/all');
//window.open('/map.php?type=2&schools=26475,27655,26583,26815,27305,27124,27569,27685,27022,26727,27058,34154,26654,26743,27694,26475,27655,30461,26583,27092,26815,27120,27305,27646,26439,27124,27569,27425,27685,26661,34152,27022,34153,26727,27058,27138,27312,34154,26654,35720,27544,26743,27242,27663,27694,&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;
}