function addMarkers(){
mySelect = document.getElementById('selection');
Carrollton = [];Amarillo = [];Humble = [];Austin = [];Colleyville = [];Houston = [];Cedar_Park = [];San_Antonio = [];Corinth = [];Rockwall = [];Sugar_Land = [];Fort_Worth = [];Greenville = [];Pearland = [];Beaumont = [];El_Paso = [];Longview = [];Bellaire = [];Odessa = [];Rockport = [];Nederland = [];Pasadena = [];Huntsville = [];Dallas = [];mySelect.options[mySelect.options.length] = new Option("Amarillo schools",'all=Amarillo');
mySelect.options[mySelect.options.length] = new Option("Austin schools",'all=Austin');
mySelect.options[mySelect.options.length] = new Option("Beaumont schools",'all=Beaumont');
mySelect.options[mySelect.options.length] = new Option("Bellaire schools",'all=Bellaire');
mySelect.options[mySelect.options.length] = new Option("Carrollton schools",'all=Carrollton');
mySelect.options[mySelect.options.length] = new Option("Cedar Park schools",'all=Cedar_Park');
mySelect.options[mySelect.options.length] = new Option("Colleyville schools",'all=Colleyville');
mySelect.options[mySelect.options.length] = new Option("Corinth schools",'all=Corinth');
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("Fort Worth schools",'all=Fort_Worth');
mySelect.options[mySelect.options.length] = new Option("Greenville schools",'all=Greenville');
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("Huntsville schools",'all=Huntsville');
mySelect.options[mySelect.options.length] = new Option("Longview schools",'all=Longview');
mySelect.options[mySelect.options.length] = new Option("Nederland schools",'all=Nederland');
mySelect.options[mySelect.options.length] = new Option("Odessa schools",'all=Odessa');
mySelect.options[mySelect.options.length] = new Option("Pasadena schools",'all=Pasadena');
mySelect.options[mySelect.options.length] = new Option("Pearland schools",'all=Pearland');
mySelect.options[mySelect.options.length] = new Option("Rockport schools",'all=Rockport');
mySelect.options[mySelect.options.length] = new Option("Rockwall schools",'all=Rockwall');
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("---------------------------",'');
Carrollton[Carrollton.length] = createMarker(new GPoint(-96.91237200,32.96684500),"
",iconGr);
mySelect.options[mySelect.options.length] = new Option("A Childs Garden Montessori School",'Carrollton=' + Carrollton.length);
Amarillo[Amarillo.length] = createMarker(new GPoint(-101.85756700,35.17270100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Amarillo Montessori Academy",'Amarillo=' + Amarillo.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);
Houston[Houston.length] = createMarker(new GPoint(-95.36097300,29.75996800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Cathedral House Montessori School",'Houston=' + Houston.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);
Corinth[Corinth.length] = createMarker(new GPoint(-97.07728000,33.15739500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Corinth Montessori School",'Corinth=' + Corinth.length);
Rockwall[Rockwall.length] = createMarker(new GPoint(-96.44996300,32.90512400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Country Day Montessori School",'Rockwall=' + Rockwall.length);
Sugar_Land[Sugar_Land.length] = createMarker(new GPoint(-95.59371800,29.59344800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("First Colony Montessori",'Sugar_Land=' + Sugar_Land.length);
Sugar_Land[Sugar_Land.length] = createMarker(new GPoint(-95.60496100,29.59135200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("First Colony Montessori South",'Sugar_Land=' + Sugar_Land.length);
Fort_Worth[Fort_Worth.length] = createMarker(new GPoint(-97.40136100,32.64217100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Fort Worth Montessori School",'Fort_Worth=' + Fort_Worth.length);
San_Antonio[San_Antonio.length] = createMarker(new GPoint(-98.49962200,29.44931800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Kriterion Montessori School",'San_Antonio=' + San_Antonio.length);
Greenville[Greenville.length] = createMarker(new GPoint(-96.23508700,32.92392300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Lakeland Academy",'Greenville=' + Greenville.length);
Houston[Houston.length] = createMarker(new GPoint(-95.60600300,29.99636300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Lakewood Montessori School",'Houston=' + Houston.length);
Austin[Austin.length] = createMarker(new GPoint(-97.74791000,30.24711600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Montessori House Of Children",'Austin=' + Austin.length);
Houston[Houston.length] = createMarker(new GPoint(-95.53174800,29.77423300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Montessori Morning Glory School",'Houston=' + Houston.length);
Pearland[Pearland.length] = createMarker(new GPoint(-95.28371600,29.56878000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Montessori School Of Dt",'Pearland=' + Pearland.length);
Beaumont[Beaumont.length] = createMarker(new GPoint(-94.13051600,30.10162900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("The Montessori School On 11th Street",'Beaumont=' + Beaumont.length);
Sugar_Land[Sugar_Land.length] = createMarker(new GPoint(-95.60708100,29.65307500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("New Southwest Montessori Center",'Sugar_Land=' + Sugar_Land.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);
Longview[Longview.length] = createMarker(new GPoint(-94.77006100,32.53626300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Oak Forest Montessori School",'Longview=' + Longview.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);
Odessa[Odessa.length] = createMarker(new GPoint(-102.35852000,31.88830100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Rainey School Of Montessori",'Odessa=' + Odessa.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);
Rockport[Rockport.length] = createMarker(new GPoint(-97.05368300,28.02379800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Sacred Heart School",'Rockport=' + Rockport.length);
Houston[Houston.length] = createMarker(new GPoint(-95.40756300,29.70142600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Saint Nicholas School, II",'Houston=' + Houston.length);
Houston[Houston.length] = createMarker(new GPoint(-95.63443000,29.90269400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Sand Castle Montessori Academy",'Houston=' + Houston.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);
Pasadena[Pasadena.length] = createMarker(new GPoint(-95.15298900,29.68996300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Small Planet Montessori",'Pasadena=' + Pasadena.length);
Houston[Houston.length] = createMarker(new GPoint(-95.40761300,29.70165100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St Nicholas Schools",'Houston=' + Houston.length);
Huntsville[Huntsville.length] = createMarker(new GPoint(-95.54023900,30.70027600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Tomorrow S Promise",'Huntsville=' + Huntsville.length);
Houston[Houston.length] = createMarker(new GPoint(-95.41350100,29.72543000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("The Village Montessori School",'Houston=' + Houston.length);
Houston[Houston.length] = createMarker(new GPoint(-95.64347300,29.89215400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("West Montessori School Of Copperfield",'Houston=' + Houston.length);
Dallas[Dallas.length] = createMarker(new GPoint(-96.68841000,32.82186500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("White Rock Montessori School",'Dallas=' + Dallas.length);
map.removeOverlays(Amarillo);
map.removeOverlays(Austin);
map.removeOverlays(Beaumont);
map.removeOverlays(Bellaire);
map.removeOverlays(Carrollton);
map.removeOverlays(Cedar_Park);
map.removeOverlays(Colleyville);
map.removeOverlays(Corinth);
map.removeOverlays(Dallas);
map.removeOverlays(El_Paso);
map.removeOverlays(Fort_Worth);
map.removeOverlays(Greenville);
map.removeOverlays(Houston);
map.removeOverlays(Humble);
map.removeOverlays(Huntsville);
map.removeOverlays(Longview);
map.removeOverlays(Nederland);
map.removeOverlays(Odessa);
map.removeOverlays(Pasadena);
map.removeOverlays(Pearland);
map.removeOverlays(Rockport);
map.removeOverlays(Rockwall);
map.removeOverlays(San_Antonio);
map.removeOverlays(Sugar_Land);
setTimeout(function(){map.addOverlays(Amarillo)},1000);
setTimeout(function(){map.addOverlays(Austin)},1000);
setTimeout(function(){map.addOverlays(Beaumont)},1000);
setTimeout(function(){map.addOverlays(Bellaire)},1000);
setTimeout(function(){map.addOverlays(Carrollton)},1000);
setTimeout(function(){map.addOverlays(Cedar_Park)},1000);
setTimeout(function(){map.addOverlays(Colleyville)},1000);
setTimeout(function(){map.addOverlays(Corinth)},1000);
setTimeout(function(){map.addOverlays(Dallas)},1000);
setTimeout(function(){map.addOverlays(El_Paso)},1000);
setTimeout(function(){map.addOverlays(Fort_Worth)},1000);
setTimeout(function(){map.addOverlays(Greenville)},1000);
setTimeout(function(){map.addOverlays(Houston)},1000);
setTimeout(function(){map.addOverlays(Humble)},1000);
setTimeout(function(){map.addOverlays(Huntsville)},1000);
setTimeout(function(){map.addOverlays(Longview)},1000);
setTimeout(function(){map.addOverlays(Nederland)},1000);
setTimeout(function(){map.addOverlays(Odessa)},1000);
setTimeout(function(){map.addOverlays(Pasadena)},1000);
setTimeout(function(){map.addOverlays(Pearland)},1000);
setTimeout(function(){map.addOverlays(Rockport)},1000);
setTimeout(function(){map.addOverlays(Rockwall)},1000);
setTimeout(function(){map.addOverlays(San_Antonio)},1000);
setTimeout(function(){map.addOverlays(Sugar_Land)},1000);
maxLng = -93.98014600;
maxLat = 35.17270100;
minLng = -106.33192600;
minLat = 28.02379800;
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(Amarillo);
map.removeOverlays(Austin);
map.removeOverlays(Beaumont);
map.removeOverlays(Bellaire);
map.removeOverlays(Carrollton);
map.removeOverlays(Cedar_Park);
map.removeOverlays(Colleyville);
map.removeOverlays(Corinth);
map.removeOverlays(Dallas);
map.removeOverlays(El_Paso);
map.removeOverlays(Fort_Worth);
map.removeOverlays(Greenville);
map.removeOverlays(Houston);
map.removeOverlays(Humble);
map.removeOverlays(Huntsville);
map.removeOverlays(Longview);
map.removeOverlays(Nederland);
map.removeOverlays(Odessa);
map.removeOverlays(Pasadena);
map.removeOverlays(Pearland);
map.removeOverlays(Rockport);
map.removeOverlays(Rockwall);
map.removeOverlays(San_Antonio);
map.removeOverlays(Sugar_Land);
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(Carrollton);map.removeOverlays(Amarillo);
map.removeOverlays(Austin);
map.removeOverlays(Beaumont);
map.removeOverlays(Bellaire);
map.removeOverlays(Carrollton);
map.removeOverlays(Cedar_Park);
map.removeOverlays(Colleyville);
map.removeOverlays(Corinth);
map.removeOverlays(Dallas);
map.removeOverlays(El_Paso);
map.removeOverlays(Fort_Worth);
map.removeOverlays(Greenville);
map.removeOverlays(Houston);
map.removeOverlays(Humble);
map.removeOverlays(Huntsville);
map.removeOverlays(Longview);
map.removeOverlays(Nederland);
map.removeOverlays(Odessa);
map.removeOverlays(Pasadena);
map.removeOverlays(Pearland);
map.removeOverlays(Rockport);
map.removeOverlays(Rockwall);
map.removeOverlays(San_Antonio);
map.removeOverlays(Sugar_Land);
map.addOverlays(Amarillo);
centerByArray(Amarillo, false, false);
cntMarker += Amarillo.length;
map.addOverlays(Austin);
centerByArray(Austin, false, false);
cntMarker += Austin.length;
map.addOverlays(Beaumont);
centerByArray(Beaumont, false, false);
cntMarker += Beaumont.length;
map.addOverlays(Bellaire);
centerByArray(Bellaire, false, false);
cntMarker += Bellaire.length;
map.addOverlays(Carrollton);
centerByArray(Carrollton, false, false);
cntMarker += Carrollton.length;
map.addOverlays(Cedar_Park);
centerByArray(Cedar_Park, false, false);
cntMarker += Cedar_Park.length;
map.addOverlays(Colleyville);
centerByArray(Colleyville, false, false);
cntMarker += Colleyville.length;
map.addOverlays(Corinth);
centerByArray(Corinth, false, false);
cntMarker += Corinth.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(Fort_Worth);
centerByArray(Fort_Worth, false, false);
cntMarker += Fort_Worth.length;
map.addOverlays(Greenville);
centerByArray(Greenville, false, false);
cntMarker += Greenville.length;
map.addOverlays(Houston);
centerByArray(Houston, false, false);
cntMarker += Houston.length;
map.addOverlays(Humble);
centerByArray(Humble, false, false);
cntMarker += Humble.length;
map.addOverlays(Huntsville);
centerByArray(Huntsville, false, false);
cntMarker += Huntsville.length;
map.addOverlays(Longview);
centerByArray(Longview, false, false);
cntMarker += Longview.length;
map.addOverlays(Nederland);
centerByArray(Nederland, false, false);
cntMarker += Nederland.length;
map.addOverlays(Odessa);
centerByArray(Odessa, false, false);
cntMarker += Odessa.length;
map.addOverlays(Pasadena);
centerByArray(Pasadena, false, false);
cntMarker += Pasadena.length;
map.addOverlays(Pearland);
centerByArray(Pearland, false, false);
cntMarker += Pearland.length;
map.addOverlays(Rockport);
centerByArray(Rockport, false, false);
cntMarker += Rockport.length;
map.addOverlays(Rockwall);
centerByArray(Rockwall, false, false);
cntMarker += Rockwall.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;
centerByArray(Carrollton,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,27256,26510,26537,27080,34813,34812,26469,34808,26546,34807,27693,26742,34809,34810,26550,26616,26433,34811,27225,27256,26450,36191,27605,27681,34806,27612,27133,27277,34814,26414,27086,27248,26703,26632,26987,34804,34805,27115,/all');
//window.open('/map.php?type=2&schools=26537,27256,26510,26537,27080,34813,34812,26469,34808,26546,34807,27693,26742,34809,34810,26550,26616,26433,34811,27225,27256,26450,36191,27605,27681,34806,27612,27133,27277,34814,26414,27086,27248,26703,26632,26987,34804,34805,27115,&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;
}