function addMarkers(){
mySelect = document.getElementById('selection');
Sugar_Land = [];Pasadena = [];Houston = [];Plainview = [];Carrollton = [];The_Woodlands = [];San_Antonio = [];Garland = [];Richardson = [];El_Paso = [];Missouri_City = [];Terrell = [];Austin = [];Lubbock = [];Dallas = [];Richmond = [];Mesquite = [];Katy = [];Stephenville = [];Irving = [];mySelect.options[mySelect.options.length] = new Option("Austin schools",'all=Austin');
mySelect.options[mySelect.options.length] = new Option("Carrollton schools",'all=Carrollton');
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("Garland schools",'all=Garland');
mySelect.options[mySelect.options.length] = new Option("Houston schools",'all=Houston');
mySelect.options[mySelect.options.length] = new Option("Irving schools",'all=Irving');
mySelect.options[mySelect.options.length] = new Option("Katy schools",'all=Katy');
mySelect.options[mySelect.options.length] = new Option("Lubbock schools",'all=Lubbock');
mySelect.options[mySelect.options.length] = new Option("Mesquite schools",'all=Mesquite');
mySelect.options[mySelect.options.length] = new Option("Missouri City schools",'all=Missouri_City');
mySelect.options[mySelect.options.length] = new Option("Pasadena schools",'all=Pasadena');
mySelect.options[mySelect.options.length] = new Option("Plainview schools",'all=Plainview');
mySelect.options[mySelect.options.length] = new Option("Richardson schools",'all=Richardson');
mySelect.options[mySelect.options.length] = new Option("Richmond schools",'all=Richmond');
mySelect.options[mySelect.options.length] = new Option("San Antonio schools",'all=San_Antonio');
mySelect.options[mySelect.options.length] = new Option("Stephenville schools",'all=Stephenville');
mySelect.options[mySelect.options.length] = new Option("Sugar Land schools",'all=Sugar_Land');
mySelect.options[mySelect.options.length] = new Option("Terrell schools",'all=Terrell');
mySelect.options[mySelect.options.length] = new Option("The Woodlands schools",'all=The_Woodlands');
mySelect.options[mySelect.options.length] = new Option("---------------------------",'');
Sugar_Land[Sugar_Land.length] = createMarker(new GPoint(-95.61885700,29.62845200),"
",iconGr);
mySelect.options[mySelect.options.length] = new Option("1st United Methd Ch School Little",'Sugar_Land=' + Sugar_Land.length);
Pasadena[Pasadena.length] = createMarker(new GPoint(-95.14305700,29.63271400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Asbury Methodist Day School",'Pasadena=' + Pasadena.length);
Houston[Houston.length] = createMarker(new GPoint(-95.64084400,29.84702000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Bear Creek United Methodist Church School",'Houston=' + Houston.length);
Plainview[Plainview.length] = createMarker(new GPoint(-101.71445800,34.18674900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Calico Caboose",'Plainview=' + Plainview.length);
Carrollton[Carrollton.length] = createMarker(new GPoint(-96.86628700,33.02486900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Carrollton Christian Academy",'Carrollton=' + Carrollton.length);
Houston[Houston.length] = createMarker(new GPoint(-95.51028800,29.76269500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Chapelwood School",'Houston=' + Houston.length);
The_Woodlands[The_Woodlands.length] = createMarker(new GPoint(-95.46855500,30.16660700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Children Of The Woodlands",'The_Woodlands=' + The_Woodlands.length);
Sugar_Land[Sugar_Land.length] = createMarker(new GPoint(-95.60371500,29.57350500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Christ Church School",'Sugar_Land=' + Sugar_Land.length);
San_Antonio[San_Antonio.length] = createMarker(new GPoint(-98.54010500,29.52836800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Colonial Hills United Methodist School",'San_Antonio=' + San_Antonio.length);
Houston[Houston.length] = createMarker(new GPoint(-95.54444100,29.79251300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Fair Haven Methodist Day School",'Houston=' + Houston.length);
Pasadena[Pasadena.length] = createMarker(new GPoint(-95.19362700,29.65127800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("First Umc & First Friends Day School",'Pasadena=' + Pasadena.length);
Garland[Garland.length] = createMarker(new GPoint(-96.64020000,32.91090000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("First Umc Day School",'Garland=' + Garland.length);
Richardson[Richardson.length] = createMarker(new GPoint(-96.73750600,32.95103700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("First Umc Preschool & Kindergarten",'Richardson=' + Richardson.length);
Houston[Houston.length] = createMarker(new GPoint(-95.19403700,29.78173700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Holy Trinity Day School",'Houston=' + Houston.length);
Houston[Houston.length] = createMarker(new GPoint(-95.46344100,29.64700100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("The Imani School",'Houston=' + Houston.length);
Houston[Houston.length] = createMarker(new GPoint(-95.52232900,29.98575700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Jwumc Child Development Program",'Houston=' + Houston.length);
El_Paso[El_Paso.length] = createMarker(new GPoint(-106.48180000,31.75544700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Lydia Patterson Institute",'El_Paso=' + El_Paso.length);
Houston[Houston.length] = createMarker(new GPoint(-95.56462400,29.77258300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Memorial Dr United Methodist Church Kids",'Houston=' + Houston.length);
Missouri_City[Missouri_City.length] = createMarker(new GPoint(-95.56452100,29.60199400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Methodist Day School",'Missouri_City=' + Missouri_City.length);
Terrell[Terrell.length] = createMarker(new GPoint(-96.28160200,32.73968500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Methodist Day School",'Terrell=' + Terrell.length);
Houston[Houston.length] = createMarker(new GPoint(-95.64441800,29.71765700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Mission Bend Christian Academy",'Houston=' + Houston.length);
Austin[Austin.length] = createMarker(new GPoint(-97.66772200,30.28618300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Praise Christian Academy",'Austin=' + Austin.length);
Lubbock[Lubbock.length] = createMarker(new GPoint(-101.89461000,33.55336600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St. Luke's Pre-school",'Lubbock=' + Lubbock.length);
El_Paso[El_Paso.length] = createMarker(new GPoint(-106.58547000,31.84045100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St. Mark's Elementary School",'El_Paso=' + El_Paso.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);
Dallas[Dallas.length] = createMarker(new GPoint(-96.77283500,32.93976300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Spring Valley United Methodist",'Dallas=' + Dallas.length);
Houston[Houston.length] = createMarker(new GPoint(-95.45543100,30.01149200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Spring Woods Weekday Ministrie",'Houston=' + Houston.length);
San_Antonio[San_Antonio.length] = createMarker(new GPoint(-98.45055600,29.49854200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St Andrews Umc Weekday School",'San_Antonio=' + San_Antonio.length);
Richmond[Richmond.length] = createMarker(new GPoint(-95.76154900,29.58215900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St John's Methodist School For Little Children",'Richmond=' + Richmond.length);
Houston[Houston.length] = createMarker(new GPoint(-95.43650000,29.73920000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St Luke's Day School",'Houston=' + Houston.length);
Mesquite[Mesquite.length] = createMarker(new GPoint(-96.64900800,32.80479300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St Marks United Methodist Child Development Center",'Mesquite=' + Mesquite.length);
Houston[Houston.length] = createMarker(new GPoint(-95.38887500,29.72640100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St Paul's School",'Houston=' + Houston.length);
Katy[Katy.length] = createMarker(new GPoint(-95.73258200,29.77565700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St Peters Early Childhood Development Center",'Katy=' + Katy.length);
Stephenville[Stephenville.length] = createMarker(new GPoint(-98.20590000,32.21900000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Stepping Stones Day School",'Stephenville=' + Stephenville.length);
San_Antonio[San_Antonio.length] = createMarker(new GPoint(-98.59081400,29.49643700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Trinity United Methodist School",'San_Antonio=' + San_Antonio.length);
Dallas[Dallas.length] = createMarker(new GPoint(-96.83798400,32.74653700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Tyler Street Christian Academy",'Dallas=' + Dallas.length);
Houston[Houston.length] = createMarker(new GPoint(-95.55518300,29.72241100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Wesley Academy",'Houston=' + Houston.length);
Dallas[Dallas.length] = createMarker(new GPoint(-96.82199200,32.86660800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Wesley Prep",'Dallas=' + Dallas.length);
Irving[Irving.length] = createMarker(new GPoint(-96.96714600,32.83743700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Wesleyan Academy",'Irving=' + Irving.length);
Houston[Houston.length] = createMarker(new GPoint(-95.53506500,29.73715500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("West Chase Methodist School",'Houston=' + Houston.length);
Houston[Houston.length] = createMarker(new GPoint(-95.46925600,29.66608800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Westbury Methodist Day School",'Houston=' + Houston.length);
map.removeOverlays(Austin);
map.removeOverlays(Carrollton);
map.removeOverlays(Dallas);
map.removeOverlays(El_Paso);
map.removeOverlays(Garland);
map.removeOverlays(Houston);
map.removeOverlays(Irving);
map.removeOverlays(Katy);
map.removeOverlays(Lubbock);
map.removeOverlays(Mesquite);
map.removeOverlays(Missouri_City);
map.removeOverlays(Pasadena);
map.removeOverlays(Plainview);
map.removeOverlays(Richardson);
map.removeOverlays(Richmond);
map.removeOverlays(San_Antonio);
map.removeOverlays(Stephenville);
map.removeOverlays(Sugar_Land);
map.removeOverlays(Terrell);
map.removeOverlays(The_Woodlands);
setTimeout(function(){map.addOverlays(Austin)},1000);
setTimeout(function(){map.addOverlays(Carrollton)},1000);
setTimeout(function(){map.addOverlays(Dallas)},1000);
setTimeout(function(){map.addOverlays(El_Paso)},1000);
setTimeout(function(){map.addOverlays(Garland)},1000);
setTimeout(function(){map.addOverlays(Houston)},1000);
setTimeout(function(){map.addOverlays(Irving)},1000);
setTimeout(function(){map.addOverlays(Katy)},1000);
setTimeout(function(){map.addOverlays(Lubbock)},1000);
setTimeout(function(){map.addOverlays(Mesquite)},1000);
setTimeout(function(){map.addOverlays(Missouri_City)},1000);
setTimeout(function(){map.addOverlays(Pasadena)},1000);
setTimeout(function(){map.addOverlays(Plainview)},1000);
setTimeout(function(){map.addOverlays(Richardson)},1000);
setTimeout(function(){map.addOverlays(Richmond)},1000);
setTimeout(function(){map.addOverlays(San_Antonio)},1000);
setTimeout(function(){map.addOverlays(Stephenville)},1000);
setTimeout(function(){map.addOverlays(Sugar_Land)},1000);
setTimeout(function(){map.addOverlays(Terrell)},1000);
setTimeout(function(){map.addOverlays(The_Woodlands)},1000);
maxLng = -95.14305700;
maxLat = 34.18674900;
minLng = -106.58547000;
minLat = 29.49643700;
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(Austin);
map.removeOverlays(Carrollton);
map.removeOverlays(Dallas);
map.removeOverlays(El_Paso);
map.removeOverlays(Garland);
map.removeOverlays(Houston);
map.removeOverlays(Irving);
map.removeOverlays(Katy);
map.removeOverlays(Lubbock);
map.removeOverlays(Mesquite);
map.removeOverlays(Missouri_City);
map.removeOverlays(Pasadena);
map.removeOverlays(Plainview);
map.removeOverlays(Richardson);
map.removeOverlays(Richmond);
map.removeOverlays(San_Antonio);
map.removeOverlays(Stephenville);
map.removeOverlays(Sugar_Land);
map.removeOverlays(Terrell);
map.removeOverlays(The_Woodlands);
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(Sugar_Land);map.removeOverlays(Austin);
map.removeOverlays(Carrollton);
map.removeOverlays(Dallas);
map.removeOverlays(El_Paso);
map.removeOverlays(Garland);
map.removeOverlays(Houston);
map.removeOverlays(Irving);
map.removeOverlays(Katy);
map.removeOverlays(Lubbock);
map.removeOverlays(Mesquite);
map.removeOverlays(Missouri_City);
map.removeOverlays(Pasadena);
map.removeOverlays(Plainview);
map.removeOverlays(Richardson);
map.removeOverlays(Richmond);
map.removeOverlays(San_Antonio);
map.removeOverlays(Stephenville);
map.removeOverlays(Sugar_Land);
map.removeOverlays(Terrell);
map.removeOverlays(The_Woodlands);
map.addOverlays(Austin);
centerByArray(Austin, false, false);
cntMarker += Austin.length;
map.addOverlays(Carrollton);
centerByArray(Carrollton, false, false);
cntMarker += Carrollton.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(Garland);
centerByArray(Garland, false, false);
cntMarker += Garland.length;
map.addOverlays(Houston);
centerByArray(Houston, false, false);
cntMarker += Houston.length;
map.addOverlays(Irving);
centerByArray(Irving, false, false);
cntMarker += Irving.length;
map.addOverlays(Katy);
centerByArray(Katy, false, false);
cntMarker += Katy.length;
map.addOverlays(Lubbock);
centerByArray(Lubbock, false, false);
cntMarker += Lubbock.length;
map.addOverlays(Mesquite);
centerByArray(Mesquite, false, false);
cntMarker += Mesquite.length;
map.addOverlays(Missouri_City);
centerByArray(Missouri_City, false, false);
cntMarker += Missouri_City.length;
map.addOverlays(Pasadena);
centerByArray(Pasadena, false, false);
cntMarker += Pasadena.length;
map.addOverlays(Plainview);
centerByArray(Plainview, false, false);
cntMarker += Plainview.length;
map.addOverlays(Richardson);
centerByArray(Richardson, false, false);
cntMarker += Richardson.length;
map.addOverlays(Richmond);
centerByArray(Richmond, false, false);
cntMarker += Richmond.length;
map.addOverlays(San_Antonio);
centerByArray(San_Antonio, false, false);
cntMarker += San_Antonio.length;
map.addOverlays(Stephenville);
centerByArray(Stephenville, false, false);
cntMarker += Stephenville.length;
map.addOverlays(Sugar_Land);
centerByArray(Sugar_Land, false, false);
cntMarker += Sugar_Land.length;
map.addOverlays(Terrell);
centerByArray(Terrell, false, false);
cntMarker += Terrell.length;
map.addOverlays(The_Woodlands);
centerByArray(The_Woodlands, false, false);
cntMarker += The_Woodlands.length;
centerByArray(Sugar_Land,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///26608,27648,27027,27191,26608,27763,27648,36306,27765,27742,26552,26629,26766,26923,27589,26972,27043,27065,27463,27311,27521,27258,27679,27307,27686,27774,35262,27764,27766,27054,26532,36097,27720,27743,27381,27729,27324,27644,27767,26467,31851,27754,26634,/all');
//window.open('/map.php?type=2&schools=26608,27648,27027,27191,26608,27763,27648,36306,27765,27742,26552,26629,26766,26923,27589,26972,27043,27065,27463,27311,27521,27258,27679,27307,27686,27774,35262,27764,27766,27054,26532,36097,27720,27743,27381,27729,27324,27644,27767,26467,31851,27754,26634,&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;
}