function addMarkers(){
mySelect = document.getElementById('selection');
Alice = [];El_Paso = [];Lancaster = [];Houston = [];Conroe = [];Lumberton = [];Dallas = [];Austin = [];San_Antonio = [];Crowley = [];The_Woodlands = [];Corpus_Christi = [];Dickinson = [];Plainview = [];Universal_City = [];Round_Rock = [];Lubbock = [];Arlington = [];Groves = [];Garland = [];Grand_Prairie = [];Stafford = [];mySelect.options[mySelect.options.length] = new Option("Alice schools",'all=Alice');
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("Corpus Christi schools",'all=Corpus_Christi');
mySelect.options[mySelect.options.length] = new Option("Crowley schools",'all=Crowley');
mySelect.options[mySelect.options.length] = new Option("Dallas schools",'all=Dallas');
mySelect.options[mySelect.options.length] = new Option("Dickinson schools",'all=Dickinson');
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("Grand Prairie schools",'all=Grand_Prairie');
mySelect.options[mySelect.options.length] = new Option("Groves schools",'all=Groves');
mySelect.options[mySelect.options.length] = new Option("Houston schools",'all=Houston');
mySelect.options[mySelect.options.length] = new Option("Lancaster schools",'all=Lancaster');
mySelect.options[mySelect.options.length] = new Option("Lubbock schools",'all=Lubbock');
mySelect.options[mySelect.options.length] = new Option("Lumberton schools",'all=Lumberton');
mySelect.options[mySelect.options.length] = new Option("Plainview schools",'all=Plainview');
mySelect.options[mySelect.options.length] = new Option("Round Rock schools",'all=Round_Rock');
mySelect.options[mySelect.options.length] = new Option("San Antonio schools",'all=San_Antonio');
mySelect.options[mySelect.options.length] = new Option("Stafford schools",'all=Stafford');
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("---------------------------",'');
Alice[Alice.length] = createMarker(new GPoint(-98.05698200,27.76216600),"
",iconGr);
mySelect.options[mySelect.options.length] = new Option("Alice Christian School",'Alice=' + Alice.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);
Lancaster[Lancaster.length] = createMarker(new GPoint(-96.77076200,32.60559300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Berne Academy",'Lancaster=' + Lancaster.length);
Houston[Houston.length] = createMarker(new GPoint(-95.51687100,29.83241500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Clay Road Baptist School",'Houston=' + Houston.length);
Conroe[Conroe.length] = createMarker(new GPoint(-95.40356400,30.29669800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Conroe Seventh Day Adventist",'Conroe=' + Conroe.length);
Lumberton[Lumberton.length] = createMarker(new GPoint(-94.20150000,30.24070000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("East Texas Christian School",'Lumberton=' + Lumberton.length);
Dallas[Dallas.length] = createMarker(new GPoint(-96.79990300,32.78391500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("First Baptist Academy",'Dallas=' + Dallas.length);
Austin[Austin.length] = createMarker(new GPoint(-97.74966800,30.39919000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Great Hills Christian School",'Austin=' + Austin.length);
Houston[Houston.length] = createMarker(new GPoint(-95.59895800,29.77483400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Great Pines Academy",'Houston=' + Houston.length);
San_Antonio[San_Antonio.length] = createMarker(new GPoint(-98.44991200,29.37629500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Highland Hills Baptist School",'San_Antonio=' + San_Antonio.length);
Houston[Houston.length] = createMarker(new GPoint(-95.64442300,29.74618400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Mcgee Chapel Rainbow Academy",'Houston=' + Houston.length);
Houston[Houston.length] = createMarker(new GPoint(-95.36144100,29.84036200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Melrose Baptist School",'Houston=' + Houston.length);
Crowley[Crowley.length] = createMarker(new GPoint(-97.33561200,32.57791800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Nazarene Christian Academy",'Crowley=' + Crowley.length);
El_Paso[El_Paso.length] = createMarker(new GPoint(-106.32561400,31.71491400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("North Loop Christian Academy",'El_Paso=' + El_Paso.length);
San_Antonio[San_Antonio.length] = createMarker(new GPoint(-98.64335000,29.49361600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Northwest Hills Christian School",'San_Antonio=' + San_Antonio.length);
The_Woodlands[The_Woodlands.length] = createMarker(new GPoint(-95.44101900,30.15717000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Oak Ridge Christian Academy",'The_Woodlands=' + The_Woodlands.length);
Corpus_Christi[Corpus_Christi.length] = createMarker(new GPoint(-97.38585200,27.73620500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Parkdale Baptist School",'Corpus_Christi=' + Corpus_Christi.length);
Dickinson[Dickinson.length] = createMarker(new GPoint(-95.07191100,29.45233100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Pine Drive Christian School",'Dickinson=' + Dickinson.length);
Plainview[Plainview.length] = createMarker(new GPoint(-101.74186000,34.17492500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Plainview Christian Academy",'Plainview=' + Plainview.length);
Corpus_Christi[Corpus_Christi.length] = createMarker(new GPoint(-97.41367800,27.76198400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Primera Day School",'Corpus_Christi=' + Corpus_Christi.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);
Round_Rock[Round_Rock.length] = createMarker(new GPoint(-97.69435500,30.50787200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Round Rock Christian Academy",'Round_Rock=' + Round_Rock.length);
Lubbock[Lubbock.length] = createMarker(new GPoint(-101.89656400,33.52886600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Southcrest Christian School",'Lubbock=' + Lubbock.length);
Arlington[Arlington.length] = createMarker(new GPoint(-97.19151200,32.68368200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Tate Springs Christian School",'Arlington=' + Arlington.length);
Houston[Houston.length] = createMarker(new GPoint(-95.67101000,29.84933700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Texas Christian School",'Houston=' + Houston.length);
Groves[Groves.length] = createMarker(new GPoint(-93.93003900,29.93672700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Triangle Seventh Day Adventist",'Groves=' + Groves.length);
Garland[Garland.length] = createMarker(new GPoint(-96.57625100,32.86156600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Trinity Life Christian Academy",'Garland=' + Garland.length);
San_Antonio[San_Antonio.length] = createMarker(new GPoint(-98.63578600,29.36690500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Valley-hi Baptist Academy",'San_Antonio=' + San_Antonio.length);
San_Antonio[San_Antonio.length] = createMarker(new GPoint(-98.65385100,29.47158600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Village Parkway Christian School",'San_Antonio=' + San_Antonio.length);
Grand_Prairie[Grand_Prairie.length] = createMarker(new GPoint(-97.02834000,32.76438000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Westridge Academy",'Grand_Prairie=' + Grand_Prairie.length);
Stafford[Stafford.length] = createMarker(new GPoint(-95.55733400,29.61480200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Willowridge Day Care & Learning Center",'Stafford=' + Stafford.length);
map.removeOverlays(Alice);
map.removeOverlays(Arlington);
map.removeOverlays(Austin);
map.removeOverlays(Conroe);
map.removeOverlays(Corpus_Christi);
map.removeOverlays(Crowley);
map.removeOverlays(Dallas);
map.removeOverlays(Dickinson);
map.removeOverlays(El_Paso);
map.removeOverlays(Garland);
map.removeOverlays(Grand_Prairie);
map.removeOverlays(Groves);
map.removeOverlays(Houston);
map.removeOverlays(Lancaster);
map.removeOverlays(Lubbock);
map.removeOverlays(Lumberton);
map.removeOverlays(Plainview);
map.removeOverlays(Round_Rock);
map.removeOverlays(San_Antonio);
map.removeOverlays(Stafford);
map.removeOverlays(The_Woodlands);
map.removeOverlays(Universal_City);
setTimeout(function(){map.addOverlays(Alice)},1000);
setTimeout(function(){map.addOverlays(Arlington)},1000);
setTimeout(function(){map.addOverlays(Austin)},1000);
setTimeout(function(){map.addOverlays(Conroe)},1000);
setTimeout(function(){map.addOverlays(Corpus_Christi)},1000);
setTimeout(function(){map.addOverlays(Crowley)},1000);
setTimeout(function(){map.addOverlays(Dallas)},1000);
setTimeout(function(){map.addOverlays(Dickinson)},1000);
setTimeout(function(){map.addOverlays(El_Paso)},1000);
setTimeout(function(){map.addOverlays(Garland)},1000);
setTimeout(function(){map.addOverlays(Grand_Prairie)},1000);
setTimeout(function(){map.addOverlays(Groves)},1000);
setTimeout(function(){map.addOverlays(Houston)},1000);
setTimeout(function(){map.addOverlays(Lancaster)},1000);
setTimeout(function(){map.addOverlays(Lubbock)},1000);
setTimeout(function(){map.addOverlays(Lumberton)},1000);
setTimeout(function(){map.addOverlays(Plainview)},1000);
setTimeout(function(){map.addOverlays(Round_Rock)},1000);
setTimeout(function(){map.addOverlays(San_Antonio)},1000);
setTimeout(function(){map.addOverlays(Stafford)},1000);
setTimeout(function(){map.addOverlays(The_Woodlands)},1000);
setTimeout(function(){map.addOverlays(Universal_City)},1000);
maxLng = -93.93003900;
maxLat = 34.17492500;
minLng = -106.53842300;
minLat = 27.73620500;
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(Alice);
map.removeOverlays(Arlington);
map.removeOverlays(Austin);
map.removeOverlays(Conroe);
map.removeOverlays(Corpus_Christi);
map.removeOverlays(Crowley);
map.removeOverlays(Dallas);
map.removeOverlays(Dickinson);
map.removeOverlays(El_Paso);
map.removeOverlays(Garland);
map.removeOverlays(Grand_Prairie);
map.removeOverlays(Groves);
map.removeOverlays(Houston);
map.removeOverlays(Lancaster);
map.removeOverlays(Lubbock);
map.removeOverlays(Lumberton);
map.removeOverlays(Plainview);
map.removeOverlays(Round_Rock);
map.removeOverlays(San_Antonio);
map.removeOverlays(Stafford);
map.removeOverlays(The_Woodlands);
map.removeOverlays(Universal_City);
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(Alice);map.removeOverlays(Alice);
map.removeOverlays(Arlington);
map.removeOverlays(Austin);
map.removeOverlays(Conroe);
map.removeOverlays(Corpus_Christi);
map.removeOverlays(Crowley);
map.removeOverlays(Dallas);
map.removeOverlays(Dickinson);
map.removeOverlays(El_Paso);
map.removeOverlays(Garland);
map.removeOverlays(Grand_Prairie);
map.removeOverlays(Groves);
map.removeOverlays(Houston);
map.removeOverlays(Lancaster);
map.removeOverlays(Lubbock);
map.removeOverlays(Lumberton);
map.removeOverlays(Plainview);
map.removeOverlays(Round_Rock);
map.removeOverlays(San_Antonio);
map.removeOverlays(Stafford);
map.removeOverlays(The_Woodlands);
map.removeOverlays(Universal_City);
map.addOverlays(Alice);
centerByArray(Alice, false, false);
cntMarker += Alice.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(Corpus_Christi);
centerByArray(Corpus_Christi, false, false);
cntMarker += Corpus_Christi.length;
map.addOverlays(Crowley);
centerByArray(Crowley, false, false);
cntMarker += Crowley.length;
map.addOverlays(Dallas);
centerByArray(Dallas, false, false);
cntMarker += Dallas.length;
map.addOverlays(Dickinson);
centerByArray(Dickinson, false, false);
cntMarker += Dickinson.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(Grand_Prairie);
centerByArray(Grand_Prairie, false, false);
cntMarker += Grand_Prairie.length;
map.addOverlays(Groves);
centerByArray(Groves, false, false);
cntMarker += Groves.length;
map.addOverlays(Houston);
centerByArray(Houston, false, false);
cntMarker += Houston.length;
map.addOverlays(Lancaster);
centerByArray(Lancaster, false, false);
cntMarker += Lancaster.length;
map.addOverlays(Lubbock);
centerByArray(Lubbock, false, false);
cntMarker += Lubbock.length;
map.addOverlays(Lumberton);
centerByArray(Lumberton, false, false);
cntMarker += Lumberton.length;
map.addOverlays(Plainview);
centerByArray(Plainview, false, false);
cntMarker += Plainview.length;
map.addOverlays(Round_Rock);
centerByArray(Round_Rock, false, false);
cntMarker += Round_Rock.length;
map.addOverlays(San_Antonio);
centerByArray(San_Antonio, false, false);
cntMarker += San_Antonio.length;
map.addOverlays(Stafford);
centerByArray(Stafford, false, false);
cntMarker += Stafford.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;
centerByArray(Alice,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///26495,26867,26690,27103,26790,27186,27118,27559,26559,27190,27234,27668,26495,27768,26867,26690,27172,27198,27103,26790,27186,26534,27118,34205,34206,27618,26669,26442,27036,27040,27559,26559,27301,26745,27190,27234,26890,27127,27659,27670,27696,27668,27210,/all');
//window.open('/map.php?type=2&schools=26495,26867,26690,27103,26790,27186,27118,27559,26559,27190,27234,27668,26495,27768,26867,26690,27172,27198,27103,26790,27186,26534,27118,34205,34206,27618,26669,26442,27036,27040,27559,26559,27301,26745,27190,27234,26890,27127,27659,27670,27696,27668,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;
}