function addMarkers(){
mySelect = document.getElementById('selection');
Sugar_Land = [];Pasadena = [];Houston = [];Stafford = [];Beaumont = [];Humble = [];Waxahachie = [];Cuero = [];Grand_Prairie = [];Garland = [];Dallas = [];Fort_Worth = [];Laredo = [];Conroe = [];Nacogdoches = [];Plainview = [];Mcallen = [];Rowlett = [];Baytown = [];Cedar_Hill = [];San_Antonio = [];Lancaster = [];mySelect.options[mySelect.options.length] = new Option("Baytown schools",'all=Baytown');
mySelect.options[mySelect.options.length] = new Option("Beaumont schools",'all=Beaumont');
mySelect.options[mySelect.options.length] = new Option("Cedar Hill schools",'all=Cedar_Hill');
mySelect.options[mySelect.options.length] = new Option("Conroe schools",'all=Conroe');
mySelect.options[mySelect.options.length] = new Option("Cuero schools",'all=Cuero');
mySelect.options[mySelect.options.length] = new Option("Dallas schools",'all=Dallas');
mySelect.options[mySelect.options.length] = new Option("Fort Worth schools",'all=Fort_Worth');
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("Houston schools",'all=Houston');
mySelect.options[mySelect.options.length] = new Option("Humble schools",'all=Humble');
mySelect.options[mySelect.options.length] = new Option("Lancaster schools",'all=Lancaster');
mySelect.options[mySelect.options.length] = new Option("Laredo schools",'all=Laredo');
mySelect.options[mySelect.options.length] = new Option("Mcallen schools",'all=Mcallen');
mySelect.options[mySelect.options.length] = new Option("Nacogdoches schools",'all=Nacogdoches');
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("Rowlett schools",'all=Rowlett');
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("Sugar Land schools",'all=Sugar_Land');
mySelect.options[mySelect.options.length] = new Option("Waxahachie schools",'all=Waxahachie');
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.22101100,29.67137800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Apostolic Christian Academy",'Pasadena=' + Pasadena.length);
Houston[Houston.length] = createMarker(new GPoint(-95.39995100,29.80382900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Baptist Temple School",'Houston=' + Houston.length);
Stafford[Stafford.length] = createMarker(new GPoint(-95.52728900,29.60864500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Bearrington Academy for Success and Excellence",'Stafford=' + Stafford.length);
Beaumont[Beaumont.length] = createMarker(new GPoint(-94.13600600,30.10088900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Cathedral Christian School",'Beaumont=' + Beaumont.length);
Humble[Humble.length] = createMarker(new GPoint(-95.26244200,30.00217200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Christian Life Center Academy",'Humble=' + Humble.length);
Waxahachie[Waxahachie.length] = createMarker(new GPoint(-96.84525300,32.42042800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Cornerstone Christian School",'Waxahachie=' + Waxahachie.length);
Cuero[Cuero.length] = createMarker(new GPoint(-97.27560000,29.08000000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Cuero Christian Academy",'Cuero=' + Cuero.length);
Houston[Houston.length] = createMarker(new GPoint(-95.43974400,29.91483700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Eternity Christian School",'Houston=' + Houston.length);
Grand_Prairie[Grand_Prairie.length] = createMarker(new GPoint(-97.00756100,32.70973700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Evangel Temple Christian School",'Grand_Prairie=' + Grand_Prairie.length);
Pasadena[Pasadena.length] = createMarker(new GPoint(-95.18594100,29.65653900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Faith Christian Academy",'Pasadena=' + Pasadena.length);
Garland[Garland.length] = createMarker(new GPoint(-96.60950100,32.96638000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Firewheel Christian Academy",'Garland=' + Garland.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);
Fort_Worth[Fort_Worth.length] = createMarker(new GPoint(-97.34837200,32.63809700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Harvest Christian School",'Fort_Worth=' + Fort_Worth.length);
Laredo[Laredo.length] = createMarker(new GPoint(-99.47594200,27.55819000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Laredo Christian Academy",'Laredo=' + Laredo.length);
Conroe[Conroe.length] = createMarker(new GPoint(-95.48509400,30.35939300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Lifestyle Christian School",'Conroe=' + Conroe.length);
Dallas[Dallas.length] = createMarker(new GPoint(-96.89071900,32.73609500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Lighthouse Christian Academy",'Dallas=' + Dallas.length);
Nacogdoches[Nacogdoches.length] = createMarker(new GPoint(-94.66831000,31.57638300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Nacogdoches Christian Academy",'Nacogdoches=' + Nacogdoches.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);
Laredo[Laredo.length] = createMarker(new GPoint(-99.47033300,27.59463300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Power Christian Academy",'Laredo=' + Laredo.length);
Mcallen[Mcallen.length] = createMarker(new GPoint(-98.22128000,26.20184900),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Regional Bible Institute Christian Academy",'Mcallen=' + Mcallen.length);
Houston[Houston.length] = createMarker(new GPoint(-95.44250000,29.92070000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Restoration Outreach Christian",'Houston=' + Houston.length);
Rowlett[Rowlett.length] = createMarker(new GPoint(-96.52303600,32.89996300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Rowlett Christian Academy",'Rowlett=' + Rowlett.length);
Baytown[Baytown.length] = createMarker(new GPoint(-95.05611900,29.78309400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("San Jacinto Christian Academy",'Baytown=' + Baytown.length);
Cedar_Hill[Cedar_Hill.length] = createMarker(new GPoint(-96.91634800,32.60449000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Trinity Christian School",'Cedar_Hill=' + Cedar_Hill.length);
San_Antonio[San_Antonio.length] = createMarker(new GPoint(-98.64233900,29.38317200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Valley Hi Assembly Of God Daycare",'San_Antonio=' + San_Antonio.length);
Lancaster[Lancaster.length] = createMarker(new GPoint(-96.77400000,32.59020000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Victory Christian Academy",'Lancaster=' + Lancaster.length);
map.removeOverlays(Baytown);
map.removeOverlays(Beaumont);
map.removeOverlays(Cedar_Hill);
map.removeOverlays(Conroe);
map.removeOverlays(Cuero);
map.removeOverlays(Dallas);
map.removeOverlays(Fort_Worth);
map.removeOverlays(Garland);
map.removeOverlays(Grand_Prairie);
map.removeOverlays(Houston);
map.removeOverlays(Humble);
map.removeOverlays(Lancaster);
map.removeOverlays(Laredo);
map.removeOverlays(Mcallen);
map.removeOverlays(Nacogdoches);
map.removeOverlays(Pasadena);
map.removeOverlays(Plainview);
map.removeOverlays(Rowlett);
map.removeOverlays(San_Antonio);
map.removeOverlays(Stafford);
map.removeOverlays(Sugar_Land);
map.removeOverlays(Waxahachie);
setTimeout(function(){map.addOverlays(Baytown)},1000);
setTimeout(function(){map.addOverlays(Beaumont)},1000);
setTimeout(function(){map.addOverlays(Cedar_Hill)},1000);
setTimeout(function(){map.addOverlays(Conroe)},1000);
setTimeout(function(){map.addOverlays(Cuero)},1000);
setTimeout(function(){map.addOverlays(Dallas)},1000);
setTimeout(function(){map.addOverlays(Fort_Worth)},1000);
setTimeout(function(){map.addOverlays(Garland)},1000);
setTimeout(function(){map.addOverlays(Grand_Prairie)},1000);
setTimeout(function(){map.addOverlays(Houston)},1000);
setTimeout(function(){map.addOverlays(Humble)},1000);
setTimeout(function(){map.addOverlays(Lancaster)},1000);
setTimeout(function(){map.addOverlays(Laredo)},1000);
setTimeout(function(){map.addOverlays(Mcallen)},1000);
setTimeout(function(){map.addOverlays(Nacogdoches)},1000);
setTimeout(function(){map.addOverlays(Pasadena)},1000);
setTimeout(function(){map.addOverlays(Plainview)},1000);
setTimeout(function(){map.addOverlays(Rowlett)},1000);
setTimeout(function(){map.addOverlays(San_Antonio)},1000);
setTimeout(function(){map.addOverlays(Stafford)},1000);
setTimeout(function(){map.addOverlays(Sugar_Land)},1000);
setTimeout(function(){map.addOverlays(Waxahachie)},1000);
maxLng = -94.13600600;
maxLat = 34.17492500;
minLng = -101.74186000;
minLat = 26.20184900;
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(Baytown);
map.removeOverlays(Beaumont);
map.removeOverlays(Cedar_Hill);
map.removeOverlays(Conroe);
map.removeOverlays(Cuero);
map.removeOverlays(Dallas);
map.removeOverlays(Fort_Worth);
map.removeOverlays(Garland);
map.removeOverlays(Grand_Prairie);
map.removeOverlays(Houston);
map.removeOverlays(Humble);
map.removeOverlays(Lancaster);
map.removeOverlays(Laredo);
map.removeOverlays(Mcallen);
map.removeOverlays(Nacogdoches);
map.removeOverlays(Pasadena);
map.removeOverlays(Plainview);
map.removeOverlays(Rowlett);
map.removeOverlays(San_Antonio);
map.removeOverlays(Stafford);
map.removeOverlays(Sugar_Land);
map.removeOverlays(Waxahachie);
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(Baytown);
map.removeOverlays(Beaumont);
map.removeOverlays(Cedar_Hill);
map.removeOverlays(Conroe);
map.removeOverlays(Cuero);
map.removeOverlays(Dallas);
map.removeOverlays(Fort_Worth);
map.removeOverlays(Garland);
map.removeOverlays(Grand_Prairie);
map.removeOverlays(Houston);
map.removeOverlays(Humble);
map.removeOverlays(Lancaster);
map.removeOverlays(Laredo);
map.removeOverlays(Mcallen);
map.removeOverlays(Nacogdoches);
map.removeOverlays(Pasadena);
map.removeOverlays(Plainview);
map.removeOverlays(Rowlett);
map.removeOverlays(San_Antonio);
map.removeOverlays(Stafford);
map.removeOverlays(Sugar_Land);
map.removeOverlays(Waxahachie);
map.addOverlays(Baytown);
centerByArray(Baytown, false, false);
cntMarker += Baytown.length;
map.addOverlays(Beaumont);
centerByArray(Beaumont, false, false);
cntMarker += Beaumont.length;
map.addOverlays(Cedar_Hill);
centerByArray(Cedar_Hill, false, false);
cntMarker += Cedar_Hill.length;
map.addOverlays(Conroe);
centerByArray(Conroe, false, false);
cntMarker += Conroe.length;
map.addOverlays(Cuero);
centerByArray(Cuero, false, false);
cntMarker += Cuero.length;
map.addOverlays(Dallas);
centerByArray(Dallas, false, false);
cntMarker += Dallas.length;
map.addOverlays(Fort_Worth);
centerByArray(Fort_Worth, false, false);
cntMarker += Fort_Worth.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(Houston);
centerByArray(Houston, false, false);
cntMarker += Houston.length;
map.addOverlays(Humble);
centerByArray(Humble, false, false);
cntMarker += Humble.length;
map.addOverlays(Lancaster);
centerByArray(Lancaster, false, false);
cntMarker += Lancaster.length;
map.addOverlays(Laredo);
centerByArray(Laredo, false, false);
cntMarker += Laredo.length;
map.addOverlays(Mcallen);
centerByArray(Mcallen, false, false);
cntMarker += Mcallen.length;
map.addOverlays(Nacogdoches);
centerByArray(Nacogdoches, false, false);
cntMarker += Nacogdoches.length;
map.addOverlays(Pasadena);
centerByArray(Pasadena, false, false);
cntMarker += Pasadena.length;
map.addOverlays(Plainview);
centerByArray(Plainview, false, false);
cntMarker += Plainview.length;
map.addOverlays(Rowlett);
centerByArray(Rowlett, false, false);
cntMarker += Rowlett.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(Sugar_Land);
centerByArray(Sugar_Land, false, false);
cntMarker += Sugar_Land.length;
map.addOverlays(Waxahachie);
centerByArray(Waxahachie, false, false);
cntMarker += Waxahachie.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///27623,27004,26721,26790,26880,26764,27220,26659,27665,26994,33817,33818,23038,26772,27190,27235,26694,27267,26614,27623,27004,26721,26790,26850,26880,27055,26764,26545,26763,27220,26659,27665,26994,33817,33818,27601,23038,26772,27190,27235,27661,35255,26467,26694,/all');
//window.open('/map.php?type=2&schools=27623,27004,26721,26790,26880,26764,27220,26659,27665,26994,33817,33818,23038,26772,27190,27235,26694,27267,26614,27623,27004,26721,26790,26850,26880,27055,26764,26545,26763,27220,26659,27665,26994,33817,33818,27601,23038,26772,27190,27235,27661,35255,26467,26694,&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;
}