function addMarkers(){
mySelect = document.getElementById('selection');
Lafayette = [];Alexandria = [];Pineville = [];Deridder = [];Belmont = [];Bogalusa = [];Jennings = [];Baton_Rouge = [];Shreveport = [];Slidell = [];New_Orleans = [];Vinton = [];Marrero = [];Morgan_City = [];Lake_Charles = [];Kenner = [];Jonesville = [];New_Iberia = [];Metairie = [];Bastrop = [];West_Monroe = [];Port_Allen = [];Jena = [];mySelect.options[mySelect.options.length] = new Option("Alexandria schools",'all=Alexandria');
mySelect.options[mySelect.options.length] = new Option("Bastrop schools",'all=Bastrop');
mySelect.options[mySelect.options.length] = new Option("Baton Rouge schools",'all=Baton_Rouge');
mySelect.options[mySelect.options.length] = new Option("Belmont schools",'all=Belmont');
mySelect.options[mySelect.options.length] = new Option("Bogalusa schools",'all=Bogalusa');
mySelect.options[mySelect.options.length] = new Option("Deridder schools",'all=Deridder');
mySelect.options[mySelect.options.length] = new Option("Jena schools",'all=Jena');
mySelect.options[mySelect.options.length] = new Option("Jennings schools",'all=Jennings');
mySelect.options[mySelect.options.length] = new Option("Jonesville schools",'all=Jonesville');
mySelect.options[mySelect.options.length] = new Option("Kenner schools",'all=Kenner');
mySelect.options[mySelect.options.length] = new Option("Lafayette schools",'all=Lafayette');
mySelect.options[mySelect.options.length] = new Option("Lake Charles schools",'all=Lake_Charles');
mySelect.options[mySelect.options.length] = new Option("Marrero schools",'all=Marrero');
mySelect.options[mySelect.options.length] = new Option("Metairie schools",'all=Metairie');
mySelect.options[mySelect.options.length] = new Option("Morgan City schools",'all=Morgan_City');
mySelect.options[mySelect.options.length] = new Option("New Iberia schools",'all=New_Iberia');
mySelect.options[mySelect.options.length] = new Option("New Orleans schools",'all=New_Orleans');
mySelect.options[mySelect.options.length] = new Option("Pineville schools",'all=Pineville');
mySelect.options[mySelect.options.length] = new Option("Port Allen schools",'all=Port_Allen');
mySelect.options[mySelect.options.length] = new Option("Shreveport schools",'all=Shreveport');
mySelect.options[mySelect.options.length] = new Option("Slidell schools",'all=Slidell');
mySelect.options[mySelect.options.length] = new Option("Vinton schools",'all=Vinton');
mySelect.options[mySelect.options.length] = new Option("West Monroe schools",'all=West_Monroe');
mySelect.options[mySelect.options.length] = new Option("---------------------------",'');
Lafayette[Lafayette.length] = createMarker(new GPoint(-92.09935500,30.17342000),"
",iconGr);
mySelect.options[mySelect.options.length] = new Option("Acadiana Christian School",'Lafayette=' + Lafayette.length);
Alexandria[Alexandria.length] = createMarker(new GPoint(-92.52259600,31.33285400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Airbase Baptist School",'Alexandria=' + Alexandria.length);
Pineville[Pineville.length] = createMarker(new GPoint(-92.46787700,31.41428500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Alpine Christian School",'Pineville=' + Pineville.length);
Deridder[Deridder.length] = createMarker(new GPoint(-93.35438900,30.74404500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Beckwith Christian School",'Deridder=' + Deridder.length);
Belmont[Belmont.length] = createMarker(new GPoint(-93.49760000,31.71050000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Belmont Union Christian Academy",'Belmont=' + Belmont.length);
Bogalusa[Bogalusa.length] = createMarker(new GPoint(-89.90291000,30.73844600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Bens Ford Christian School",'Bogalusa=' + Bogalusa.length);
Jennings[Jennings.length] = createMarker(new GPoint(-92.65525800,30.25063600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Bethel Christian School",'Jennings=' + Jennings.length);
Baton_Rouge[Baton_Rouge.length] = createMarker(new GPoint(-91.13439700,30.55492600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Brownfields Baptist Academy",'Baton_Rouge=' + Baton_Rouge.length);
Shreveport[Shreveport.length] = createMarker(new GPoint(-93.76313900,32.40336800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Calvary Baptist Academy",'Shreveport=' + Shreveport.length);
Slidell[Slidell.length] = createMarker(new GPoint(-89.77138500,30.25538600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Calvary Baptist School",'Slidell=' + Slidell.length);
New_Orleans[New_Orleans.length] = createMarker(new GPoint(-90.03290800,29.92944900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Calvary Baptist School",'New_Orleans=' + New_Orleans.length);
Baton_Rouge[Baton_Rouge.length] = createMarker(new GPoint(-90.99969400,30.46769500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Central Baptist School",'Baton_Rouge=' + Baton_Rouge.length);
Baton_Rouge[Baton_Rouge.length] = createMarker(new GPoint(-91.04807400,30.49891400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Comite Christian Academy",'Baton_Rouge=' + Baton_Rouge.length);
Slidell[Slidell.length] = createMarker(new GPoint(-89.73604000,30.28312900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Early Learning Ctr At Grace Mem Baptist Church",'Slidell=' + Slidell.length);
Vinton[Vinton.length] = createMarker(new GPoint(-93.58862900,30.19660000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Emmanuel Christian Academy",'Vinton=' + Vinton.length);
Marrero[Marrero.length] = createMarker(new GPoint(-90.11229800,29.88990300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Faith Academy",'Marrero=' + Marrero.length);
Morgan_City[Morgan_City.length] = createMarker(new GPoint(-91.26340400,29.69544000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Faith Baptist School",'Morgan_City=' + Morgan_City.length);
Lake_Charles[Lake_Charles.length] = createMarker(new GPoint(-93.16264000,30.14198700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Faith Christian Academy",'Lake_Charles=' + Lake_Charles.length);
Kenner[Kenner.length] = createMarker(new GPoint(-90.24160000,29.99380000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("First Baptist Christian School",'Kenner=' + Kenner.length);
Lafayette[Lafayette.length] = createMarker(new GPoint(-92.01996400,30.22156300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("First Baptist Christian School",'Lafayette=' + Lafayette.length);
Slidell[Slidell.length] = createMarker(new GPoint(-89.77140000,30.27400000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("First Baptist Christian School",'Slidell=' + Slidell.length);
Shreveport[Shreveport.length] = createMarker(new GPoint(-93.73893800,32.46976700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("First Baptist Church School",'Shreveport=' + Shreveport.length);
Baton_Rouge[Baton_Rouge.length] = createMarker(new GPoint(-91.11415900,30.48898100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("God's Way Christian Academy",'Baton_Rouge=' + Baton_Rouge.length);
Jonesville[Jonesville.length] = createMarker(new GPoint(-91.84566000,31.62186000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Grace Christian Academy",'Jonesville=' + Jonesville.length);
Shreveport[Shreveport.length] = createMarker(new GPoint(-93.80580200,32.38176300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Heritage Free Will Baptist Chu",'Shreveport=' + Shreveport.length);
New_Iberia[New_Iberia.length] = createMarker(new GPoint(-91.80027800,30.00996900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Highland Baptist Christian School",'New_Iberia=' + New_Iberia.length);
Alexandria[Alexandria.length] = createMarker(new GPoint(-92.55207100,31.29602300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Hope Baptist School",'Alexandria=' + Alexandria.length);
Morgan_City[Morgan_City.length] = createMarker(new GPoint(-91.17590000,29.70270000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Immanuel Christian School",'Morgan_City=' + Morgan_City.length);
Metairie[Metairie.length] = createMarker(new GPoint(-90.20419600,30.00629300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Memorial Baptist Christian",'Metairie=' + Metairie.length);
Bastrop[Bastrop.length] = createMarker(new GPoint(-91.81641800,32.87779600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Mt Zion Christian Academy",'Bastrop=' + Bastrop.length);
West_Monroe[West_Monroe.length] = createMarker(new GPoint(-92.21264600,32.50971700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Northeast Baptist School",'West_Monroe=' + West_Monroe.length);
Baton_Rouge[Baton_Rouge.length] = createMarker(new GPoint(-91.04941100,30.39882900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Parkview Baptist School",'Baton_Rouge=' + Baton_Rouge.length);
Port_Allen[Port_Allen.length] = createMarker(new GPoint(-91.35235900,30.54116500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Sharon Baptist Academy",'Port_Allen=' + Port_Allen.length);
Baton_Rouge[Baton_Rouge.length] = createMarker(new GPoint(-91.17581400,30.44644400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Shiloh Baptist Early Learning Academy",'Baton_Rouge=' + Baton_Rouge.length);
Jena[Jena.length] = createMarker(new GPoint(-92.11231900,31.69129000),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Temple Christian Academy",'Jena=' + Jena.length);
Pineville[Pineville.length] = createMarker(new GPoint(-92.39750000,31.34510000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Weekday Early Education",'Pineville=' + Pineville.length);
map.removeOverlays(Alexandria);
map.removeOverlays(Bastrop);
map.removeOverlays(Baton_Rouge);
map.removeOverlays(Belmont);
map.removeOverlays(Bogalusa);
map.removeOverlays(Deridder);
map.removeOverlays(Jena);
map.removeOverlays(Jennings);
map.removeOverlays(Jonesville);
map.removeOverlays(Kenner);
map.removeOverlays(Lafayette);
map.removeOverlays(Lake_Charles);
map.removeOverlays(Marrero);
map.removeOverlays(Metairie);
map.removeOverlays(Morgan_City);
map.removeOverlays(New_Iberia);
map.removeOverlays(New_Orleans);
map.removeOverlays(Pineville);
map.removeOverlays(Port_Allen);
map.removeOverlays(Shreveport);
map.removeOverlays(Slidell);
map.removeOverlays(Vinton);
map.removeOverlays(West_Monroe);
setTimeout(function(){map.addOverlays(Alexandria)},1000);
setTimeout(function(){map.addOverlays(Bastrop)},1000);
setTimeout(function(){map.addOverlays(Baton_Rouge)},1000);
setTimeout(function(){map.addOverlays(Belmont)},1000);
setTimeout(function(){map.addOverlays(Bogalusa)},1000);
setTimeout(function(){map.addOverlays(Deridder)},1000);
setTimeout(function(){map.addOverlays(Jena)},1000);
setTimeout(function(){map.addOverlays(Jennings)},1000);
setTimeout(function(){map.addOverlays(Jonesville)},1000);
setTimeout(function(){map.addOverlays(Kenner)},1000);
setTimeout(function(){map.addOverlays(Lafayette)},1000);
setTimeout(function(){map.addOverlays(Lake_Charles)},1000);
setTimeout(function(){map.addOverlays(Marrero)},1000);
setTimeout(function(){map.addOverlays(Metairie)},1000);
setTimeout(function(){map.addOverlays(Morgan_City)},1000);
setTimeout(function(){map.addOverlays(New_Iberia)},1000);
setTimeout(function(){map.addOverlays(New_Orleans)},1000);
setTimeout(function(){map.addOverlays(Pineville)},1000);
setTimeout(function(){map.addOverlays(Port_Allen)},1000);
setTimeout(function(){map.addOverlays(Shreveport)},1000);
setTimeout(function(){map.addOverlays(Slidell)},1000);
setTimeout(function(){map.addOverlays(Vinton)},1000);
setTimeout(function(){map.addOverlays(West_Monroe)},1000);
maxLng = -89.73604000;
maxLat = 32.87779600;
minLng = -93.80580200;
minLat = 29.69544000;
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(Alexandria);
map.removeOverlays(Bastrop);
map.removeOverlays(Baton_Rouge);
map.removeOverlays(Belmont);
map.removeOverlays(Bogalusa);
map.removeOverlays(Deridder);
map.removeOverlays(Jena);
map.removeOverlays(Jennings);
map.removeOverlays(Jonesville);
map.removeOverlays(Kenner);
map.removeOverlays(Lafayette);
map.removeOverlays(Lake_Charles);
map.removeOverlays(Marrero);
map.removeOverlays(Metairie);
map.removeOverlays(Morgan_City);
map.removeOverlays(New_Iberia);
map.removeOverlays(New_Orleans);
map.removeOverlays(Pineville);
map.removeOverlays(Port_Allen);
map.removeOverlays(Shreveport);
map.removeOverlays(Slidell);
map.removeOverlays(Vinton);
map.removeOverlays(West_Monroe);
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(Lafayette);map.removeOverlays(Alexandria);
map.removeOverlays(Bastrop);
map.removeOverlays(Baton_Rouge);
map.removeOverlays(Belmont);
map.removeOverlays(Bogalusa);
map.removeOverlays(Deridder);
map.removeOverlays(Jena);
map.removeOverlays(Jennings);
map.removeOverlays(Jonesville);
map.removeOverlays(Kenner);
map.removeOverlays(Lafayette);
map.removeOverlays(Lake_Charles);
map.removeOverlays(Marrero);
map.removeOverlays(Metairie);
map.removeOverlays(Morgan_City);
map.removeOverlays(New_Iberia);
map.removeOverlays(New_Orleans);
map.removeOverlays(Pineville);
map.removeOverlays(Port_Allen);
map.removeOverlays(Shreveport);
map.removeOverlays(Slidell);
map.removeOverlays(Vinton);
map.removeOverlays(West_Monroe);
map.addOverlays(Alexandria);
centerByArray(Alexandria, false, false);
cntMarker += Alexandria.length;
map.addOverlays(Bastrop);
centerByArray(Bastrop, false, false);
cntMarker += Bastrop.length;
map.addOverlays(Baton_Rouge);
centerByArray(Baton_Rouge, false, false);
cntMarker += Baton_Rouge.length;
map.addOverlays(Belmont);
centerByArray(Belmont, false, false);
cntMarker += Belmont.length;
map.addOverlays(Bogalusa);
centerByArray(Bogalusa, false, false);
cntMarker += Bogalusa.length;
map.addOverlays(Deridder);
centerByArray(Deridder, false, false);
cntMarker += Deridder.length;
map.addOverlays(Jena);
centerByArray(Jena, false, false);
cntMarker += Jena.length;
map.addOverlays(Jennings);
centerByArray(Jennings, false, false);
cntMarker += Jennings.length;
map.addOverlays(Jonesville);
centerByArray(Jonesville, false, false);
cntMarker += Jonesville.length;
map.addOverlays(Kenner);
centerByArray(Kenner, false, false);
cntMarker += Kenner.length;
map.addOverlays(Lafayette);
centerByArray(Lafayette, false, false);
cntMarker += Lafayette.length;
map.addOverlays(Lake_Charles);
centerByArray(Lake_Charles, false, false);
cntMarker += Lake_Charles.length;
map.addOverlays(Marrero);
centerByArray(Marrero, false, false);
cntMarker += Marrero.length;
map.addOverlays(Metairie);
centerByArray(Metairie, false, false);
cntMarker += Metairie.length;
map.addOverlays(Morgan_City);
centerByArray(Morgan_City, false, false);
cntMarker += Morgan_City.length;
map.addOverlays(New_Iberia);
centerByArray(New_Iberia, false, false);
cntMarker += New_Iberia.length;
map.addOverlays(New_Orleans);
centerByArray(New_Orleans, false, false);
cntMarker += New_Orleans.length;
map.addOverlays(Pineville);
centerByArray(Pineville, false, false);
cntMarker += Pineville.length;
map.addOverlays(Port_Allen);
centerByArray(Port_Allen, false, false);
cntMarker += Port_Allen.length;
map.addOverlays(Shreveport);
centerByArray(Shreveport, false, false);
cntMarker += Shreveport.length;
map.addOverlays(Slidell);
centerByArray(Slidell, false, false);
cntMarker += Slidell.length;
map.addOverlays(Vinton);
centerByArray(Vinton, false, false);
cntMarker += Vinton.length;
map.addOverlays(West_Monroe);
centerByArray(West_Monroe, false, false);
cntMarker += West_Monroe.length;
centerByArray(Lafayette,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///11486,11616,11670,11538,34354,35971,11508,11505,11511,11484,11575,31316,11625,11602,11526,11583,11674,11486,11616,11670,11524,11538,11555,34354,35971,34357,11507,11508,11505,33558,11511,11592,11582,11484,11584,11575,32439,11659,31316,11625,11602,11527,11489,11886,33557,11526,11585,11882,11529,11878,11583,33552,11674,/all');
//window.open('/map.php?type=2&schools=11486,11616,11670,11538,34354,35971,11508,11505,11511,11484,11575,31316,11625,11602,11526,11583,11674,11486,11616,11670,11524,11538,11555,34354,35971,34357,11507,11508,11505,33558,11511,11592,11582,11484,11584,11575,32439,11659,31316,11625,11602,11527,11489,11886,33557,11526,11585,11882,11529,11878,11583,33552,11674,&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;
}