function addMarkers(){
mySelect = document.getElementById('selection');
El_Paso = [];Beaumont = [];Kingsville = [];Humble = [];West_Columbia = [];Orange = [];Waxahachie = [];Mesquite = [];Cuero = [];Houston = [];Grand_Prairie = [];Pasadena = [];Vidor = [];Garland = [];Seagoville = [];San_Antonio = [];Fort_Worth = [];Laredo = [];Conroe = [];Sulphur_Springs = [];Rowlett = [];Wylie = [];Huntsville = [];Cedar_Hill = [];Lancaster = [];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("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("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("Huntsville schools",'all=Huntsville');
mySelect.options[mySelect.options.length] = new Option("Kingsville schools",'all=Kingsville');
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("Mesquite schools",'all=Mesquite');
mySelect.options[mySelect.options.length] = new Option("Orange schools",'all=Orange');
mySelect.options[mySelect.options.length] = new Option("Pasadena schools",'all=Pasadena');
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("Seagoville schools",'all=Seagoville');
mySelect.options[mySelect.options.length] = new Option("Sulphur Springs schools",'all=Sulphur_Springs');
mySelect.options[mySelect.options.length] = new Option("Vidor schools",'all=Vidor');
mySelect.options[mySelect.options.length] = new Option("Waxahachie schools",'all=Waxahachie');
mySelect.options[mySelect.options.length] = new Option("West Columbia schools",'all=West_Columbia');
mySelect.options[mySelect.options.length] = new Option("Wylie schools",'all=Wylie');
mySelect.options[mySelect.options.length] = new Option("---------------------------",'');
El_Paso[El_Paso.length] = createMarker(new GPoint(-106.45642800,31.83471900),"
",iconGr);
mySelect.options[mySelect.options.length] = new Option("Bethel Temple Christian School",'El_Paso=' + El_Paso.length);
Beaumont[Beaumont.length] = createMarker(new GPoint(-94.20427300,30.13317600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Cathedral Christian High School",'Beaumont=' + Beaumont.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);
Kingsville[Kingsville.length] = createMarker(new GPoint(-97.84220000,27.49600000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Christian Life Academy",'Kingsville=' + Kingsville.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);
West_Columbia[West_Columbia.length] = createMarker(new GPoint(-95.65265000,29.14563800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Columbia Christian School",'West_Columbia=' + West_Columbia.length);
Orange[Orange.length] = createMarker(new GPoint(-93.80330000,30.17410000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Community Christian School",'Orange=' + Orange.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);
Mesquite[Mesquite.length] = createMarker(new GPoint(-96.59880000,32.76660000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Ctca - Calvary Temple Christian Academy",'Mesquite=' + Mesquite.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);
Vidor[Vidor.length] = createMarker(new GPoint(-94.01390000,30.12430000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Faith Christian Academy",'Vidor=' + Vidor.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);
Seagoville[Seagoville.length] = createMarker(new GPoint(-96.54930000,32.64110000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("First Assembly Christian Academy",'Seagoville=' + Seagoville.length);
San_Antonio[San_Antonio.length] = createMarker(new GPoint(-98.64087900,29.54426300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Fortress Christian Academy",'San_Antonio=' + San_Antonio.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);
Houston[Houston.length] = createMarker(new GPoint(-95.40377500,29.80093700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Heights Christian Academy",'Houston=' + Houston.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);
Sulphur_Springs[Sulphur_Springs.length] = createMarker(new GPoint(-95.70229400,33.26773700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Peerless Christian Academy",'Sulphur_Springs=' + Sulphur_Springs.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);
El_Paso[El_Paso.length] = createMarker(new GPoint(-106.43999400,31.77187100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Solid Rock Christian Academy",'El_Paso=' + El_Paso.length);
Wylie[Wylie.length] = createMarker(new GPoint(-96.54800000,33.01810000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Sonlight Christian Academy",'Wylie=' + Wylie.length);
Huntsville[Huntsville.length] = createMarker(new GPoint(-95.55138300,30.69630900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Summit Christian Academy",'Huntsville=' + Huntsville.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(Beaumont);
map.removeOverlays(Cedar_Hill);
map.removeOverlays(Conroe);
map.removeOverlays(Cuero);
map.removeOverlays(El_Paso);
map.removeOverlays(Fort_Worth);
map.removeOverlays(Garland);
map.removeOverlays(Grand_Prairie);
map.removeOverlays(Houston);
map.removeOverlays(Humble);
map.removeOverlays(Huntsville);
map.removeOverlays(Kingsville);
map.removeOverlays(Lancaster);
map.removeOverlays(Laredo);
map.removeOverlays(Mesquite);
map.removeOverlays(Orange);
map.removeOverlays(Pasadena);
map.removeOverlays(Rowlett);
map.removeOverlays(San_Antonio);
map.removeOverlays(Seagoville);
map.removeOverlays(Sulphur_Springs);
map.removeOverlays(Vidor);
map.removeOverlays(Waxahachie);
map.removeOverlays(West_Columbia);
map.removeOverlays(Wylie);
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(El_Paso)},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(Huntsville)},1000);
setTimeout(function(){map.addOverlays(Kingsville)},1000);
setTimeout(function(){map.addOverlays(Lancaster)},1000);
setTimeout(function(){map.addOverlays(Laredo)},1000);
setTimeout(function(){map.addOverlays(Mesquite)},1000);
setTimeout(function(){map.addOverlays(Orange)},1000);
setTimeout(function(){map.addOverlays(Pasadena)},1000);
setTimeout(function(){map.addOverlays(Rowlett)},1000);
setTimeout(function(){map.addOverlays(San_Antonio)},1000);
setTimeout(function(){map.addOverlays(Seagoville)},1000);
setTimeout(function(){map.addOverlays(Sulphur_Springs)},1000);
setTimeout(function(){map.addOverlays(Vidor)},1000);
setTimeout(function(){map.addOverlays(Waxahachie)},1000);
setTimeout(function(){map.addOverlays(West_Columbia)},1000);
setTimeout(function(){map.addOverlays(Wylie)},1000);
maxLng = -93.80330000;
maxLat = 33.26773700;
minLng = -106.45642800;
minLat = 27.49600000;
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(Beaumont);
map.removeOverlays(Cedar_Hill);
map.removeOverlays(Conroe);
map.removeOverlays(Cuero);
map.removeOverlays(El_Paso);
map.removeOverlays(Fort_Worth);
map.removeOverlays(Garland);
map.removeOverlays(Grand_Prairie);
map.removeOverlays(Houston);
map.removeOverlays(Humble);
map.removeOverlays(Huntsville);
map.removeOverlays(Kingsville);
map.removeOverlays(Lancaster);
map.removeOverlays(Laredo);
map.removeOverlays(Mesquite);
map.removeOverlays(Orange);
map.removeOverlays(Pasadena);
map.removeOverlays(Rowlett);
map.removeOverlays(San_Antonio);
map.removeOverlays(Seagoville);
map.removeOverlays(Sulphur_Springs);
map.removeOverlays(Vidor);
map.removeOverlays(Waxahachie);
map.removeOverlays(West_Columbia);
map.removeOverlays(Wylie);
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(El_Paso);map.removeOverlays(Beaumont);
map.removeOverlays(Cedar_Hill);
map.removeOverlays(Conroe);
map.removeOverlays(Cuero);
map.removeOverlays(El_Paso);
map.removeOverlays(Fort_Worth);
map.removeOverlays(Garland);
map.removeOverlays(Grand_Prairie);
map.removeOverlays(Houston);
map.removeOverlays(Humble);
map.removeOverlays(Huntsville);
map.removeOverlays(Kingsville);
map.removeOverlays(Lancaster);
map.removeOverlays(Laredo);
map.removeOverlays(Mesquite);
map.removeOverlays(Orange);
map.removeOverlays(Pasadena);
map.removeOverlays(Rowlett);
map.removeOverlays(San_Antonio);
map.removeOverlays(Seagoville);
map.removeOverlays(Sulphur_Springs);
map.removeOverlays(Vidor);
map.removeOverlays(Waxahachie);
map.removeOverlays(West_Columbia);
map.removeOverlays(Wylie);
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(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(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(Huntsville);
centerByArray(Huntsville, false, false);
cntMarker += Huntsville.length;
map.addOverlays(Kingsville);
centerByArray(Kingsville, false, false);
cntMarker += Kingsville.length;
map.addOverlays(Lancaster);
centerByArray(Lancaster, false, false);
cntMarker += Lancaster.length;
map.addOverlays(Laredo);
centerByArray(Laredo, false, false);
cntMarker += Laredo.length;
map.addOverlays(Mesquite);
centerByArray(Mesquite, false, false);
cntMarker += Mesquite.length;
map.addOverlays(Orange);
centerByArray(Orange, false, false);
cntMarker += Orange.length;
map.addOverlays(Pasadena);
centerByArray(Pasadena, false, false);
cntMarker += Pasadena.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(Seagoville);
centerByArray(Seagoville, false, false);
cntMarker += Seagoville.length;
map.addOverlays(Sulphur_Springs);
centerByArray(Sulphur_Springs, false, false);
cntMarker += Sulphur_Springs.length;
map.addOverlays(Vidor);
centerByArray(Vidor, false, false);
cntMarker += Vidor.length;
map.addOverlays(Waxahachie);
centerByArray(Waxahachie, false, false);
cntMarker += Waxahachie.length;
map.addOverlays(West_Columbia);
centerByArray(West_Columbia, false, false);
cntMarker += West_Columbia.length;
map.addOverlays(Wylie);
centerByArray(Wylie, false, false);
cntMarker += Wylie.length;
centerByArray(El_Paso,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///36102,27623,27004,26721,26567,31871,26880,26764,27220,26659,26658,27665,26994,26603,26682,26772,27235,26787,27179,26773,26694,26679,27295,26614,27623,27004,26721,26567,31871,26880,27055,26764,26763,26883,27220,26659,27541,26658,27665,26994,26603,26682,26772,27235,26816,27661,26787,27179,26773,26694,26679,27295,/all');
//window.open('/map.php?type=2&schools=36102,27623,27004,26721,26567,31871,26880,26764,27220,26659,26658,27665,26994,26603,26682,26772,27235,26787,27179,26773,26694,26679,27295,26614,27623,27004,26721,26567,31871,26880,27055,26764,26763,26883,27220,26659,27541,26658,27665,26994,26603,26682,26772,27235,26816,27661,26787,27179,26773,26694,26679,27295,&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;
}