function addMarkers(){
mySelect = document.getElementById('selection');
League_City = [];El_Paso = [];San_Antonio = [];Lancaster = [];Lake_Jackson = [];Midland = [];Southlake = [];Pilot_Point = [];Sugar_Land = [];Houston = [];Conroe = [];Galena_Park = [];Arlington = [];Dallas = [];Webster = [];Humble = [];Universal_City = [];Adkins = [];Austin = [];Burleson = [];Spring = [];Sherman = [];The_Woodlands = [];mySelect.options[mySelect.options.length] = new Option("Adkins schools",'all=Adkins');
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("Conroe schools",'all=Conroe');
mySelect.options[mySelect.options.length] = new Option("Dallas schools",'all=Dallas');
mySelect.options[mySelect.options.length] = new Option("El Paso schools",'all=El_Paso');
mySelect.options[mySelect.options.length] = new Option("Galena Park schools",'all=Galena_Park');
mySelect.options[mySelect.options.length] = new Option("Houston schools",'all=Houston');
mySelect.options[mySelect.options.length] = new Option("Humble schools",'all=Humble');
mySelect.options[mySelect.options.length] = new Option("Lake Jackson schools",'all=Lake_Jackson');
mySelect.options[mySelect.options.length] = new Option("Lancaster schools",'all=Lancaster');
mySelect.options[mySelect.options.length] = new Option("League City schools",'all=League_City');
mySelect.options[mySelect.options.length] = new Option("Midland schools",'all=Midland');
mySelect.options[mySelect.options.length] = new Option("Pilot Point schools",'all=Pilot_Point');
mySelect.options[mySelect.options.length] = new Option("San Antonio schools",'all=San_Antonio');
mySelect.options[mySelect.options.length] = new Option("Sherman schools",'all=Sherman');
mySelect.options[mySelect.options.length] = new Option("Southlake schools",'all=Southlake');
mySelect.options[mySelect.options.length] = new Option("Spring schools",'all=Spring');
mySelect.options[mySelect.options.length] = new Option("Sugar Land schools",'all=Sugar_Land');
mySelect.options[mySelect.options.length] = new Option("The Woodlands schools",'all=The_Woodlands');
mySelect.options[mySelect.options.length] = new Option("Universal City schools",'all=Universal_City');
mySelect.options[mySelect.options.length] = new Option("Webster schools",'all=Webster');
mySelect.options[mySelect.options.length] = new Option("---------------------------",'');
League_City[League_City.length] = createMarker(new GPoint(-95.11830000,29.43440000),"
",iconGr);
mySelect.options[mySelect.options.length] = new Option("The Academy Of Clear Lake",'League_City=' + League_City.length);
El_Paso[El_Paso.length] = createMarker(new GPoint(-106.53842300,31.85917000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Ascension Lutheran Day School",'El_Paso=' + El_Paso.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);
Lancaster[Lancaster.length] = createMarker(new GPoint(-96.77076200,32.60559300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Berne Academy",'Lancaster=' + Lancaster.length);
Lake_Jackson[Lake_Jackson.length] = createMarker(new GPoint(-95.42764200,29.04483700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Brazosport Christian School",'Lake_Jackson=' + Lake_Jackson.length);
Midland[Midland.length] = createMarker(new GPoint(-102.07750000,31.99720000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Bynum School",'Midland=' + Midland.length);
Southlake[Southlake.length] = createMarker(new GPoint(-97.15728800,32.99081600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Clariden School",'Southlake=' + Southlake.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);
El_Paso[El_Paso.length] = createMarker(new GPoint(-106.48694200,31.76932700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("El Paso Bridges Academy",'El_Paso=' + El_Paso.length);
Sugar_Land[Sugar_Land.length] = createMarker(new GPoint(-95.63500900,29.61107200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Faith Lutheran School",'Sugar_Land=' + Sugar_Land.length);
Houston[Houston.length] = createMarker(new GPoint(-95.45924800,29.78200300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("First Baptist Academy",'Houston=' + Houston.length);
Conroe[Conroe.length] = createMarker(new GPoint(-95.45691400,30.31351900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("First Baptist Academy",'Conroe=' + Conroe.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.11675200,29.55120900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Galloway School Upper School",'Houston=' + Houston.length);
Arlington[Arlington.length] = createMarker(new GPoint(-97.14795400,32.76602800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Gateway School",'Arlington=' + Arlington.length);
Houston[Houston.length] = createMarker(new GPoint(-95.55457200,29.73977500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Grace School",'Houston=' + Houston.length);
Dallas[Dallas.length] = createMarker(new GPoint(-96.83837700,32.94013700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Greenhill School",'Dallas=' + Dallas.length);
Houston[Houston.length] = createMarker(new GPoint(-95.29103100,29.88323700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Helon's Academy",'Houston=' + Houston.length);
Dallas[Dallas.length] = createMarker(new GPoint(-96.77559100,32.91503900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("The Hillcrest Academy",'Dallas=' + Dallas.length);
Webster[Webster.length] = createMarker(new GPoint(-95.11846100,29.53780300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Houston Learning Academy",'Webster=' + Webster.length);
Humble[Humble.length] = createMarker(new GPoint(-95.15740100,30.00067500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Lake Houston Academy",'Humble=' + Humble.length);
Houston[Houston.length] = createMarker(new GPoint(-95.32719900,29.77126300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Neighborhood Educational Cen",'Houston=' + Houston.length);
San_Antonio[San_Antonio.length] = createMarker(new GPoint(-98.52414100,29.38706300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Palm Heights Baptist School",'San_Antonio=' + San_Antonio.length);
Arlington[Arlington.length] = createMarker(new GPoint(-97.14056400,32.72137600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Pantego Christian Academy",'Arlington=' + Arlington.length);
Houston[Houston.length] = createMarker(new GPoint(-95.50089500,29.73456700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("The Phoenix Academy",'Houston=' + Houston.length);
Universal_City[Universal_City.length] = createMarker(new GPoint(-98.29553400,29.55002800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Randolph Christian Academy",'Universal_City=' + Universal_City.length);
San_Antonio[San_Antonio.length] = createMarker(new GPoint(-98.40359200,29.41367300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St. Benedict Catholic School",'San_Antonio=' + San_Antonio.length);
Houston[Houston.length] = createMarker(new GPoint(-95.38887500,29.72640100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St. Paul School",'Houston=' + Houston.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.66045500,29.54642000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Scenic Hills SDA Christian School",'San_Antonio=' + San_Antonio.length);
Austin[Austin.length] = createMarker(new GPoint(-97.72242500,30.29987200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Sri Atmananda Memorial School",'Austin=' + Austin.length);
Burleson[Burleson.length] = createMarker(new GPoint(-97.32050000,32.54190000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Steppingstone Christian Aca",'Burleson=' + Burleson.length);
Spring[Spring.length] = createMarker(new GPoint(-95.48625800,30.06442300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Summerfield Academy",'Spring=' + Spring.length);
Sherman[Sherman.length] = createMarker(new GPoint(-96.64774900,33.62716300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Texoma Christian School",'Sherman=' + Sherman.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);
Houston[Houston.length] = createMarker(new GPoint(-95.45671700,29.66801900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Trafton Academy",'Houston=' + Houston.length);
Houston[Houston.length] = createMarker(new GPoint(-95.47119500,29.73030600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Waldorf Education For Houston",'Houston=' + Houston.length);
The_Woodlands[The_Woodlands.length] = createMarker(new GPoint(-95.48038300,30.22292100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Woodlands Christian Academy",'The_Woodlands=' + The_Woodlands.length);
Houston[Houston.length] = createMarker(new GPoint(-95.59255200,29.77017800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Yorkshire Academy",'Houston=' + Houston.length);
map.removeOverlays(Adkins);
map.removeOverlays(Arlington);
map.removeOverlays(Austin);
map.removeOverlays(Burleson);
map.removeOverlays(Conroe);
map.removeOverlays(Dallas);
map.removeOverlays(El_Paso);
map.removeOverlays(Galena_Park);
map.removeOverlays(Houston);
map.removeOverlays(Humble);
map.removeOverlays(Lake_Jackson);
map.removeOverlays(Lancaster);
map.removeOverlays(League_City);
map.removeOverlays(Midland);
map.removeOverlays(Pilot_Point);
map.removeOverlays(San_Antonio);
map.removeOverlays(Sherman);
map.removeOverlays(Southlake);
map.removeOverlays(Spring);
map.removeOverlays(Sugar_Land);
map.removeOverlays(The_Woodlands);
map.removeOverlays(Universal_City);
map.removeOverlays(Webster);
setTimeout(function(){map.addOverlays(Adkins)},1000);
setTimeout(function(){map.addOverlays(Arlington)},1000);
setTimeout(function(){map.addOverlays(Austin)},1000);
setTimeout(function(){map.addOverlays(Burleson)},1000);
setTimeout(function(){map.addOverlays(Conroe)},1000);
setTimeout(function(){map.addOverlays(Dallas)},1000);
setTimeout(function(){map.addOverlays(El_Paso)},1000);
setTimeout(function(){map.addOverlays(Galena_Park)},1000);
setTimeout(function(){map.addOverlays(Houston)},1000);
setTimeout(function(){map.addOverlays(Humble)},1000);
setTimeout(function(){map.addOverlays(Lake_Jackson)},1000);
setTimeout(function(){map.addOverlays(Lancaster)},1000);
setTimeout(function(){map.addOverlays(League_City)},1000);
setTimeout(function(){map.addOverlays(Midland)},1000);
setTimeout(function(){map.addOverlays(Pilot_Point)},1000);
setTimeout(function(){map.addOverlays(San_Antonio)},1000);
setTimeout(function(){map.addOverlays(Sherman)},1000);
setTimeout(function(){map.addOverlays(Southlake)},1000);
setTimeout(function(){map.addOverlays(Spring)},1000);
setTimeout(function(){map.addOverlays(Sugar_Land)},1000);
setTimeout(function(){map.addOverlays(The_Woodlands)},1000);
setTimeout(function(){map.addOverlays(Universal_City)},1000);
setTimeout(function(){map.addOverlays(Webster)},1000);
maxLng = -95.11675200;
maxLat = 33.62716300;
minLng = -106.53842300;
minLat = 29.04483700;
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(Adkins);
map.removeOverlays(Arlington);
map.removeOverlays(Austin);
map.removeOverlays(Burleson);
map.removeOverlays(Conroe);
map.removeOverlays(Dallas);
map.removeOverlays(El_Paso);
map.removeOverlays(Galena_Park);
map.removeOverlays(Houston);
map.removeOverlays(Humble);
map.removeOverlays(Lake_Jackson);
map.removeOverlays(Lancaster);
map.removeOverlays(League_City);
map.removeOverlays(Midland);
map.removeOverlays(Pilot_Point);
map.removeOverlays(San_Antonio);
map.removeOverlays(Sherman);
map.removeOverlays(Southlake);
map.removeOverlays(Spring);
map.removeOverlays(Sugar_Land);
map.removeOverlays(The_Woodlands);
map.removeOverlays(Universal_City);
map.removeOverlays(Webster);
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(League_City);map.removeOverlays(Adkins);
map.removeOverlays(Arlington);
map.removeOverlays(Austin);
map.removeOverlays(Burleson);
map.removeOverlays(Conroe);
map.removeOverlays(Dallas);
map.removeOverlays(El_Paso);
map.removeOverlays(Galena_Park);
map.removeOverlays(Houston);
map.removeOverlays(Humble);
map.removeOverlays(Lake_Jackson);
map.removeOverlays(Lancaster);
map.removeOverlays(League_City);
map.removeOverlays(Midland);
map.removeOverlays(Pilot_Point);
map.removeOverlays(San_Antonio);
map.removeOverlays(Sherman);
map.removeOverlays(Southlake);
map.removeOverlays(Spring);
map.removeOverlays(Sugar_Land);
map.removeOverlays(The_Woodlands);
map.removeOverlays(Universal_City);
map.removeOverlays(Webster);
map.addOverlays(Adkins);
centerByArray(Adkins, false, false);
cntMarker += Adkins.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(Conroe);
centerByArray(Conroe, false, false);
cntMarker += Conroe.length;
map.addOverlays(Dallas);
centerByArray(Dallas, false, false);
cntMarker += Dallas.length;
map.addOverlays(El_Paso);
centerByArray(El_Paso, false, false);
cntMarker += El_Paso.length;
map.addOverlays(Galena_Park);
centerByArray(Galena_Park, false, false);
cntMarker += Galena_Park.length;
map.addOverlays(Houston);
centerByArray(Houston, false, false);
cntMarker += Houston.length;
map.addOverlays(Humble);
centerByArray(Humble, false, false);
cntMarker += Humble.length;
map.addOverlays(Lake_Jackson);
centerByArray(Lake_Jackson, false, false);
cntMarker += Lake_Jackson.length;
map.addOverlays(Lancaster);
centerByArray(Lancaster, false, false);
cntMarker += Lancaster.length;
map.addOverlays(League_City);
centerByArray(League_City, false, false);
cntMarker += League_City.length;
map.addOverlays(Midland);
centerByArray(Midland, false, false);
cntMarker += Midland.length;
map.addOverlays(Pilot_Point);
centerByArray(Pilot_Point, false, false);
cntMarker += Pilot_Point.length;
map.addOverlays(San_Antonio);
centerByArray(San_Antonio, false, false);
cntMarker += San_Antonio.length;
map.addOverlays(Sherman);
centerByArray(Sherman, false, false);
cntMarker += Sherman.length;
map.addOverlays(Southlake);
centerByArray(Southlake, false, false);
cntMarker += Southlake.length;
map.addOverlays(Spring);
centerByArray(Spring, false, false);
cntMarker += Spring.length;
map.addOverlays(Sugar_Land);
centerByArray(Sugar_Land, false, false);
cntMarker += Sugar_Land.length;
map.addOverlays(The_Woodlands);
centerByArray(The_Woodlands, false, false);
cntMarker += The_Woodlands.length;
map.addOverlays(Universal_City);
centerByArray(Universal_City, false, false);
cntMarker += Universal_City.length;
map.addOverlays(Webster);
centerByArray(Webster, false, false);
cntMarker += Webster.length;
centerByArray(League_City,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///27260,26835,27169,27313,27533,26584,26791,27182,27616,26991,26581,26559,26480,30620,26554,27273,27560,27563,26668,27702,26930,27260,27169,27313,27533,35791,26870,26897,26534,26584,26829,26791,26426,26864,26403,27106,27463,27616,26425,27706,26581,26559,26480,26596,30620,26554,27168,27341,27273,27560,27563,26668,26457,26782,27702,27210,/all');
//window.open('/map.php?type=2&schools=27260,26835,27169,27313,27533,26584,26791,27182,27616,26991,26581,26559,26480,30620,26554,27273,27560,27563,26668,27702,26930,27260,27169,27313,27533,35791,26870,26897,26534,26584,26829,26791,26426,26864,26403,27106,27463,27616,26425,27706,26581,26559,26480,26596,30620,26554,27168,27341,27273,27560,27563,26668,26457,26782,27702,27210,&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;
}