function addMarkers(){
mySelect = document.getElementById('selection');
College_Station = [];Alpine = [];Humble = [];Austin = [];Colleyville = [];Houston = [];Flower_Mound = [];Cedar_Park = [];San_Antonio = [];Southlake = [];Georgetown = [];Cypress = [];Mount_Pleasant = [];El_Paso = [];Pflugerville = [];Kingwood = [];Bellaire = [];Dallas = [];Nederland = [];Port_Arthur = [];Harker_Heights = [];Spicewood = [];Farmers_Branch = [];mySelect.options[mySelect.options.length] = new Option("Alpine schools",'all=Alpine');
mySelect.options[mySelect.options.length] = new Option("Austin schools",'all=Austin');
mySelect.options[mySelect.options.length] = new Option("Bellaire schools",'all=Bellaire');
mySelect.options[mySelect.options.length] = new Option("Cedar Park schools",'all=Cedar_Park');
mySelect.options[mySelect.options.length] = new Option("College Station schools",'all=College_Station');
mySelect.options[mySelect.options.length] = new Option("Colleyville schools",'all=Colleyville');
mySelect.options[mySelect.options.length] = new Option("Cypress schools",'all=Cypress');
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("Farmers Branch schools",'all=Farmers_Branch');
mySelect.options[mySelect.options.length] = new Option("Flower Mound schools",'all=Flower_Mound');
mySelect.options[mySelect.options.length] = new Option("Georgetown schools",'all=Georgetown');
mySelect.options[mySelect.options.length] = new Option("Harker Heights schools",'all=Harker_Heights');
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("Kingwood schools",'all=Kingwood');
mySelect.options[mySelect.options.length] = new Option("Mount Pleasant schools",'all=Mount_Pleasant');
mySelect.options[mySelect.options.length] = new Option("Nederland schools",'all=Nederland');
mySelect.options[mySelect.options.length] = new Option("Pflugerville schools",'all=Pflugerville');
mySelect.options[mySelect.options.length] = new Option("Port Arthur schools",'all=Port_Arthur');
mySelect.options[mySelect.options.length] = new Option("San Antonio schools",'all=San_Antonio');
mySelect.options[mySelect.options.length] = new Option("Southlake schools",'all=Southlake');
mySelect.options[mySelect.options.length] = new Option("Spicewood schools",'all=Spicewood');
mySelect.options[mySelect.options.length] = new Option("---------------------------",'');
College_Station[College_Station.length] = createMarker(new GPoint(-96.28930000,30.57460000),"
",iconGr);
mySelect.options[mySelect.options.length] = new Option("Aggieland Country School",'College_Station=' + College_Station.length);
Alpine[Alpine.length] = createMarker(new GPoint(-103.66515700,30.36427100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Alpine Montessori School",'Alpine=' + Alpine.length);
Humble[Humble.length] = createMarker(new GPoint(-95.16226600,29.99931600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Atascocita Montessori School",'Humble=' + Humble.length);
Austin[Austin.length] = createMarker(new GPoint(-97.80486200,30.22769300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Austin Montessori School",'Austin=' + Austin.length);
Colleyville[Colleyville.length] = createMarker(new GPoint(-97.14530200,32.89226300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("The Barbara Gordon Montessori School",'Colleyville=' + Colleyville.length);
Houston[Houston.length] = createMarker(new GPoint(-95.11706400,29.55116900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Bay Area Montessori House",'Houston=' + Houston.length);
Flower_Mound[Flower_Mound.length] = createMarker(new GPoint(-97.07849200,33.03456300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Castle Mound Montessori",'Flower_Mound=' + Flower_Mound.length);
Cedar_Park[Cedar_Park.length] = createMarker(new GPoint(-97.82607800,30.52207100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Cedar Park Montessori School",'Cedar_Park=' + Cedar_Park.length);
San_Antonio[San_Antonio.length] = createMarker(new GPoint(-98.53974100,29.56973100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Child Montessori",'San_Antonio=' + San_Antonio.length);
San_Antonio[San_Antonio.length] = createMarker(new GPoint(-98.58425800,29.47807000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Children's House & Montessori",'San_Antonio=' + San_Antonio.length);
Southlake[Southlake.length] = createMarker(new GPoint(-97.15728800,32.99081600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Clariden School",'Southlake=' + Southlake.length);
Houston[Houston.length] = createMarker(new GPoint(-95.11086500,29.57476500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Clear Lake Montessori",'Houston=' + Houston.length);
Georgetown[Georgetown.length] = createMarker(new GPoint(-97.67695900,30.61667000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Community Montessori School",'Georgetown=' + Georgetown.length);
Houston[Houston.length] = createMarker(new GPoint(-95.59595600,29.73653700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Innovative Montessori School",'Houston=' + Houston.length);
Houston[Houston.length] = createMarker(new GPoint(-95.38795000,29.72806300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Montessori Country Day School",'Houston=' + Houston.length);
Flower_Mound[Flower_Mound.length] = createMarker(new GPoint(-97.14195300,33.05558000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Montessori Country Day School",'Flower_Mound=' + Flower_Mound.length);
Cypress[Cypress.length] = createMarker(new GPoint(-95.61670800,29.99616300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Montessori-longwood",'Cypress=' + Cypress.length);
Mount_Pleasant[Mount_Pleasant.length] = createMarker(new GPoint(-94.97691800,33.16885600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Mount Pleasant Montessori School",'Mount_Pleasant=' + Mount_Pleasant.length);
El_Paso[El_Paso.length] = createMarker(new GPoint(-106.33192600,31.79641000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("New World Montessori School",'El_Paso=' + El_Paso.length);
Houston[Houston.length] = createMarker(new GPoint(-95.47012000,29.99565200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Northwood Montessori School",'Houston=' + Houston.length);
Austin[Austin.length] = createMarker(new GPoint(-97.74270000,30.26690000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Parkside Community School",'Austin=' + Austin.length);
Pflugerville[Pflugerville.length] = createMarker(new GPoint(-97.65346000,30.44773700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Pflugerville Montessori School",'Pflugerville=' + Pflugerville.length);
Kingwood[Kingwood.length] = createMarker(new GPoint(-95.20139600,30.05441200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Pines Montessori School",'Kingwood=' + Kingwood.length);
Bellaire[Bellaire.length] = createMarker(new GPoint(-95.45594300,29.71388300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("The Post Oak School",'Bellaire=' + Bellaire.length);
Houston[Houston.length] = createMarker(new GPoint(-95.41530000,29.72321800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("River Oaks Montessori",'Houston=' + Houston.length);
Dallas[Dallas.length] = createMarker(new GPoint(-96.79992100,32.91686300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St. Alcuin Montessori School",'Dallas=' + Dallas.length);
Nederland[Nederland.length] = createMarker(new GPoint(-93.98014600,29.96319200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("The School Of Montessori",'Nederland=' + Nederland.length);
Houston[Houston.length] = createMarker(new GPoint(-95.48515700,29.79339100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("School Of The Woods",'Houston=' + Houston.length);
Houston[Houston.length] = createMarker(new GPoint(-95.21299700,29.58494600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Southbelt Country Meadows Mont",'Houston=' + Houston.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.41611200,29.68226800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St Catherines Montessori",'Houston=' + Houston.length);
Austin[Austin.length] = createMarker(new GPoint(-97.68525500,30.27163100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St James Episcopal School",'Austin=' + Austin.length);
Harker_Heights[Harker_Heights.length] = createMarker(new GPoint(-97.36030600,31.08789800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Temple Montessori School",'Harker_Heights=' + Harker_Heights.length);
Spicewood[Spicewood.length] = createMarker(new GPoint(-98.06430900,30.40043000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Tierra Vista Montessori School",'Spicewood=' + Spicewood.length);
Houston[Houston.length] = createMarker(new GPoint(-95.62755500,29.75550800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Westside Montessori School",'Houston=' + Houston.length);
Farmers_Branch[Farmers_Branch.length] = createMarker(new GPoint(-96.88410800,32.92463700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Windsong Montessori School Inc",'Farmers_Branch=' + Farmers_Branch.length);
map.removeOverlays(Alpine);
map.removeOverlays(Austin);
map.removeOverlays(Bellaire);
map.removeOverlays(Cedar_Park);
map.removeOverlays(College_Station);
map.removeOverlays(Colleyville);
map.removeOverlays(Cypress);
map.removeOverlays(Dallas);
map.removeOverlays(El_Paso);
map.removeOverlays(Farmers_Branch);
map.removeOverlays(Flower_Mound);
map.removeOverlays(Georgetown);
map.removeOverlays(Harker_Heights);
map.removeOverlays(Houston);
map.removeOverlays(Humble);
map.removeOverlays(Kingwood);
map.removeOverlays(Mount_Pleasant);
map.removeOverlays(Nederland);
map.removeOverlays(Pflugerville);
map.removeOverlays(Port_Arthur);
map.removeOverlays(San_Antonio);
map.removeOverlays(Southlake);
map.removeOverlays(Spicewood);
setTimeout(function(){map.addOverlays(Alpine)},1000);
setTimeout(function(){map.addOverlays(Austin)},1000);
setTimeout(function(){map.addOverlays(Bellaire)},1000);
setTimeout(function(){map.addOverlays(Cedar_Park)},1000);
setTimeout(function(){map.addOverlays(College_Station)},1000);
setTimeout(function(){map.addOverlays(Colleyville)},1000);
setTimeout(function(){map.addOverlays(Cypress)},1000);
setTimeout(function(){map.addOverlays(Dallas)},1000);
setTimeout(function(){map.addOverlays(El_Paso)},1000);
setTimeout(function(){map.addOverlays(Farmers_Branch)},1000);
setTimeout(function(){map.addOverlays(Flower_Mound)},1000);
setTimeout(function(){map.addOverlays(Georgetown)},1000);
setTimeout(function(){map.addOverlays(Harker_Heights)},1000);
setTimeout(function(){map.addOverlays(Houston)},1000);
setTimeout(function(){map.addOverlays(Humble)},1000);
setTimeout(function(){map.addOverlays(Kingwood)},1000);
setTimeout(function(){map.addOverlays(Mount_Pleasant)},1000);
setTimeout(function(){map.addOverlays(Nederland)},1000);
setTimeout(function(){map.addOverlays(Pflugerville)},1000);
setTimeout(function(){map.addOverlays(Port_Arthur)},1000);
setTimeout(function(){map.addOverlays(San_Antonio)},1000);
setTimeout(function(){map.addOverlays(Southlake)},1000);
setTimeout(function(){map.addOverlays(Spicewood)},1000);
maxLng = -93.92129600;
maxLat = 33.16885600;
minLng = -106.33192600;
minLat = 29.47807000;
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(Alpine);
map.removeOverlays(Austin);
map.removeOverlays(Bellaire);
map.removeOverlays(Cedar_Park);
map.removeOverlays(College_Station);
map.removeOverlays(Colleyville);
map.removeOverlays(Cypress);
map.removeOverlays(Dallas);
map.removeOverlays(El_Paso);
map.removeOverlays(Farmers_Branch);
map.removeOverlays(Flower_Mound);
map.removeOverlays(Georgetown);
map.removeOverlays(Harker_Heights);
map.removeOverlays(Houston);
map.removeOverlays(Humble);
map.removeOverlays(Kingwood);
map.removeOverlays(Mount_Pleasant);
map.removeOverlays(Nederland);
map.removeOverlays(Pflugerville);
map.removeOverlays(Port_Arthur);
map.removeOverlays(San_Antonio);
map.removeOverlays(Southlake);
map.removeOverlays(Spicewood);
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(College_Station);map.removeOverlays(Alpine);
map.removeOverlays(Austin);
map.removeOverlays(Bellaire);
map.removeOverlays(Cedar_Park);
map.removeOverlays(College_Station);
map.removeOverlays(Colleyville);
map.removeOverlays(Cypress);
map.removeOverlays(Dallas);
map.removeOverlays(El_Paso);
map.removeOverlays(Farmers_Branch);
map.removeOverlays(Flower_Mound);
map.removeOverlays(Georgetown);
map.removeOverlays(Harker_Heights);
map.removeOverlays(Houston);
map.removeOverlays(Humble);
map.removeOverlays(Kingwood);
map.removeOverlays(Mount_Pleasant);
map.removeOverlays(Nederland);
map.removeOverlays(Pflugerville);
map.removeOverlays(Port_Arthur);
map.removeOverlays(San_Antonio);
map.removeOverlays(Southlake);
map.removeOverlays(Spicewood);
map.addOverlays(Alpine);
centerByArray(Alpine, false, false);
cntMarker += Alpine.length;
map.addOverlays(Austin);
centerByArray(Austin, false, false);
cntMarker += Austin.length;
map.addOverlays(Bellaire);
centerByArray(Bellaire, false, false);
cntMarker += Bellaire.length;
map.addOverlays(Cedar_Park);
centerByArray(Cedar_Park, false, false);
cntMarker += Cedar_Park.length;
map.addOverlays(College_Station);
centerByArray(College_Station, false, false);
cntMarker += College_Station.length;
map.addOverlays(Colleyville);
centerByArray(Colleyville, false, false);
cntMarker += Colleyville.length;
map.addOverlays(Cypress);
centerByArray(Cypress, false, false);
cntMarker += Cypress.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(Farmers_Branch);
centerByArray(Farmers_Branch, false, false);
cntMarker += Farmers_Branch.length;
map.addOverlays(Flower_Mound);
centerByArray(Flower_Mound, false, false);
cntMarker += Flower_Mound.length;
map.addOverlays(Georgetown);
centerByArray(Georgetown, false, false);
cntMarker += Georgetown.length;
map.addOverlays(Harker_Heights);
centerByArray(Harker_Heights, false, false);
cntMarker += Harker_Heights.length;
map.addOverlays(Houston);
centerByArray(Houston, false, false);
cntMarker += Houston.length;
map.addOverlays(Humble);
centerByArray(Humble, false, false);
cntMarker += Humble.length;
map.addOverlays(Kingwood);
centerByArray(Kingwood, false, false);
cntMarker += Kingwood.length;
map.addOverlays(Mount_Pleasant);
centerByArray(Mount_Pleasant, false, false);
cntMarker += Mount_Pleasant.length;
map.addOverlays(Nederland);
centerByArray(Nederland, false, false);
cntMarker += Nederland.length;
map.addOverlays(Pflugerville);
centerByArray(Pflugerville, false, false);
cntMarker += Pflugerville.length;
map.addOverlays(Port_Arthur);
centerByArray(Port_Arthur, false, false);
cntMarker += Port_Arthur.length;
map.addOverlays(San_Antonio);
centerByArray(San_Antonio, false, false);
cntMarker += San_Antonio.length;
map.addOverlays(Southlake);
centerByArray(Southlake, false, false);
cntMarker += Southlake.length;
map.addOverlays(Spicewood);
centerByArray(Spicewood, false, false);
cntMarker += Spicewood.length;
centerByArray(College_Station,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///26537,27279,26668,26508,26537,27173,34689,34812,34808,26487,26546,26409,27319,26742,27697,36158,27077,34687,27553,26550,26671,26951,27078,27128,27225,27279,26446,36187,26441,34806,27187,27095,27277,34688,27312,26632,26638,26668,34690,/all');
//window.open('/map.php?type=2&schools=26537,27279,26668,26508,26537,27173,34689,34812,34808,26487,26546,26409,27319,26742,27697,36158,27077,34687,27553,26550,26671,26951,27078,27128,27225,27279,26446,36187,26441,34806,27187,27095,27277,34688,27312,26632,26638,26668,34690,&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;
}