function addMarkers(){
mySelect = document.getElementById('selection');
New_Orleans = [];Metairie = [];Vidalia = [];Lake_Charles = [];New_Roads = [];Covington = [];Marrero = [];Gonzales = [];Harahan = [];Baton_Rouge = [];Amite = [];Monroe = [];Abbeville = [];Hammond = [];Shreveport = [];Gretna = [];Alexandria = [];Duson = [];Grand_Coteau = [];Reserve = [];Lafayette = [];mySelect.options[mySelect.options.length] = new Option("Abbeville schools",'all=Abbeville');
mySelect.options[mySelect.options.length] = new Option("Alexandria schools",'all=Alexandria');
mySelect.options[mySelect.options.length] = new Option("Amite schools",'all=Amite');
mySelect.options[mySelect.options.length] = new Option("Baton Rouge schools",'all=Baton_Rouge');
mySelect.options[mySelect.options.length] = new Option("Covington schools",'all=Covington');
mySelect.options[mySelect.options.length] = new Option("Duson schools",'all=Duson');
mySelect.options[mySelect.options.length] = new Option("Gonzales schools",'all=Gonzales');
mySelect.options[mySelect.options.length] = new Option("Grand Coteau schools",'all=Grand_Coteau');
mySelect.options[mySelect.options.length] = new Option("Gretna schools",'all=Gretna');
mySelect.options[mySelect.options.length] = new Option("Hammond schools",'all=Hammond');
mySelect.options[mySelect.options.length] = new Option("Harahan schools",'all=Harahan');
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("Monroe schools",'all=Monroe');
mySelect.options[mySelect.options.length] = new Option("New Orleans schools",'all=New_Orleans');
mySelect.options[mySelect.options.length] = new Option("New Roads schools",'all=New_Roads');
mySelect.options[mySelect.options.length] = new Option("Reserve schools",'all=Reserve');
mySelect.options[mySelect.options.length] = new Option("Shreveport schools",'all=Shreveport');
mySelect.options[mySelect.options.length] = new Option("Vidalia schools",'all=Vidalia');
mySelect.options[mySelect.options.length] = new Option("---------------------------",'');
New_Orleans[New_Orleans.length] = createMarker(new GPoint(-90.10365200,29.92660800),"
",iconRd);
mySelect.options[mySelect.options.length] = new Option("Academy Of The Sacred Heart",'New_Orleans=' + New_Orleans.length);
Metairie[Metairie.length] = createMarker(new GPoint(-90.21673200,30.00918700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Atonement Lutheran School",'Metairie=' + Metairie.length);
Vidalia[Vidalia.length] = createMarker(new GPoint(-91.50323800,31.58159400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Bethel Missionary School",'Vidalia=' + Vidalia.length);
Lake_Charles[Lake_Charles.length] = createMarker(new GPoint(-93.20964000,30.23009000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Bishop Noland Episcopal Day School",'Lake_Charles=' + Lake_Charles.length);
New_Roads[New_Roads.length] = createMarker(new GPoint(-91.43591800,30.69498300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Catholic Elementary School Of Pt Coupee",'New_Roads=' + New_Roads.length);
Covington[Covington.length] = createMarker(new GPoint(-90.09531500,30.47287500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Christ Episcopal School",'Covington=' + Covington.length);
New_Orleans[New_Orleans.length] = createMarker(new GPoint(-90.09235600,29.98812500),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Christian Bros School",'New_Orleans=' + New_Orleans.length);
Marrero[Marrero.length] = createMarker(new GPoint(-90.12215700,29.89403700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Concordia Lutheran School",'Marrero=' + Marrero.length);
Gonzales[Gonzales.length] = createMarker(new GPoint(-90.89049000,30.21828700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Faith Academy",'Gonzales=' + Gonzales.length);
Harahan[Harahan.length] = createMarker(new GPoint(-90.20593900,29.93801800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Faith Lutheran School",'Harahan=' + Harahan.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);
Amite[Amite.length] = createMarker(new GPoint(-90.50790900,30.73987000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Gordon-richardson Christian Academy",'Amite=' + Amite.length);
Monroe[Monroe.length] = createMarker(new GPoint(-92.12435300,32.51499300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Grace Episcopal School",'Monroe=' + Monroe.length);
Baton_Rouge[Baton_Rouge.length] = createMarker(new GPoint(-91.14064900,30.50223700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Jehova-Jireh Christian Academy",'Baton_Rouge=' + Baton_Rouge.length);
Baton_Rouge[Baton_Rouge.length] = createMarker(new GPoint(-91.01478300,30.41314100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Jones Creek Adventist Academy",'Baton_Rouge=' + Baton_Rouge.length);
Abbeville[Abbeville.length] = createMarker(new GPoint(-92.14052800,29.97920900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Mount Carmel Elementary School",'Abbeville=' + Abbeville.length);
Hammond[Hammond.length] = createMarker(new GPoint(-90.44650000,30.46455300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Oaks Montessori School",'Hammond=' + Hammond.length);
Metairie[Metairie.length] = createMarker(new GPoint(-90.22688100,29.98782000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Our Lady Of Divine Providence School",'Metairie=' + Metairie.length);
Metairie[Metairie.length] = createMarker(new GPoint(-90.20414300,29.98942800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Parkway Presbyterian Pre-school",'Metairie=' + Metairie.length);
Shreveport[Shreveport.length] = createMarker(new GPoint(-93.74979100,32.48397100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St. Mark S Cathedral School",'Shreveport=' + Shreveport.length);
New_Orleans[New_Orleans.length] = createMarker(new GPoint(-90.11420500,29.95650000),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("St. Marys Dominican High School",'New_Orleans=' + New_Orleans.length);
New_Orleans[New_Orleans.length] = createMarker(new GPoint(-90.07368400,29.99527600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St. Raymond Elementary School",'New_Orleans=' + New_Orleans.length);
Gretna[Gretna.length] = createMarker(new GPoint(-90.06104200,29.91759900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Salem Lutheran School",'Gretna=' + Gretna.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);
Alexandria[Alexandria.length] = createMarker(new GPoint(-92.45070000,31.28560000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Smyrna Jr Academy",'Alexandria=' + Alexandria.length);
Duson[Duson.length] = createMarker(new GPoint(-92.12352600,30.18143300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Southside Christian Academy",'Duson=' + Duson.length);
Grand_Coteau[Grand_Coteau.length] = createMarker(new GPoint(-92.04910000,30.41790000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St Ignatius Elementary School",'Grand_Coteau=' + Grand_Coteau.length);
New_Orleans[New_Orleans.length] = createMarker(new GPoint(-90.07379000,29.96843000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St Peter Claver Elementary School",'New_Orleans=' + New_Orleans.length);
Reserve[Reserve.length] = createMarker(new GPoint(-90.56035500,30.05761000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St Peter School",'Reserve=' + Reserve.length);
Lafayette[Lafayette.length] = createMarker(new GPoint(-91.98925800,30.24107300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Teurlings Catholic High School",'Lafayette=' + Lafayette.length);
Baton_Rouge[Baton_Rouge.length] = createMarker(new GPoint(-91.15593400,30.41700200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Trinity Episcopal Day School",'Baton_Rouge=' + Baton_Rouge.length);
New_Orleans[New_Orleans.length] = createMarker(new GPoint(-90.12746600,29.94132100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("University Montessori School",'New_Orleans=' + New_Orleans.length);
map.removeOverlays(Abbeville);
map.removeOverlays(Alexandria);
map.removeOverlays(Amite);
map.removeOverlays(Baton_Rouge);
map.removeOverlays(Covington);
map.removeOverlays(Duson);
map.removeOverlays(Gonzales);
map.removeOverlays(Grand_Coteau);
map.removeOverlays(Gretna);
map.removeOverlays(Hammond);
map.removeOverlays(Harahan);
map.removeOverlays(Lafayette);
map.removeOverlays(Lake_Charles);
map.removeOverlays(Marrero);
map.removeOverlays(Metairie);
map.removeOverlays(Monroe);
map.removeOverlays(New_Orleans);
map.removeOverlays(New_Roads);
map.removeOverlays(Reserve);
map.removeOverlays(Shreveport);
map.removeOverlays(Vidalia);
setTimeout(function(){map.addOverlays(Abbeville)},1000);
setTimeout(function(){map.addOverlays(Alexandria)},1000);
setTimeout(function(){map.addOverlays(Amite)},1000);
setTimeout(function(){map.addOverlays(Baton_Rouge)},1000);
setTimeout(function(){map.addOverlays(Covington)},1000);
setTimeout(function(){map.addOverlays(Duson)},1000);
setTimeout(function(){map.addOverlays(Gonzales)},1000);
setTimeout(function(){map.addOverlays(Grand_Coteau)},1000);
setTimeout(function(){map.addOverlays(Gretna)},1000);
setTimeout(function(){map.addOverlays(Hammond)},1000);
setTimeout(function(){map.addOverlays(Harahan)},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(Monroe)},1000);
setTimeout(function(){map.addOverlays(New_Orleans)},1000);
setTimeout(function(){map.addOverlays(New_Roads)},1000);
setTimeout(function(){map.addOverlays(Reserve)},1000);
setTimeout(function(){map.addOverlays(Shreveport)},1000);
setTimeout(function(){map.addOverlays(Vidalia)},1000);
maxLng = -90.06104200;
maxLat = 32.51499300;
minLng = -93.74979100;
minLat = 29.89403700;
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(Abbeville);
map.removeOverlays(Alexandria);
map.removeOverlays(Amite);
map.removeOverlays(Baton_Rouge);
map.removeOverlays(Covington);
map.removeOverlays(Duson);
map.removeOverlays(Gonzales);
map.removeOverlays(Grand_Coteau);
map.removeOverlays(Gretna);
map.removeOverlays(Hammond);
map.removeOverlays(Harahan);
map.removeOverlays(Lafayette);
map.removeOverlays(Lake_Charles);
map.removeOverlays(Marrero);
map.removeOverlays(Metairie);
map.removeOverlays(Monroe);
map.removeOverlays(New_Orleans);
map.removeOverlays(New_Roads);
map.removeOverlays(Reserve);
map.removeOverlays(Shreveport);
map.removeOverlays(Vidalia);
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(New_Orleans);map.removeOverlays(Abbeville);
map.removeOverlays(Alexandria);
map.removeOverlays(Amite);
map.removeOverlays(Baton_Rouge);
map.removeOverlays(Covington);
map.removeOverlays(Duson);
map.removeOverlays(Gonzales);
map.removeOverlays(Grand_Coteau);
map.removeOverlays(Gretna);
map.removeOverlays(Hammond);
map.removeOverlays(Harahan);
map.removeOverlays(Lafayette);
map.removeOverlays(Lake_Charles);
map.removeOverlays(Marrero);
map.removeOverlays(Metairie);
map.removeOverlays(Monroe);
map.removeOverlays(New_Orleans);
map.removeOverlays(New_Roads);
map.removeOverlays(Reserve);
map.removeOverlays(Shreveport);
map.removeOverlays(Vidalia);
map.addOverlays(Abbeville);
centerByArray(Abbeville, false, false);
cntMarker += Abbeville.length;
map.addOverlays(Alexandria);
centerByArray(Alexandria, false, false);
cntMarker += Alexandria.length;
map.addOverlays(Amite);
centerByArray(Amite, false, false);
cntMarker += Amite.length;
map.addOverlays(Baton_Rouge);
centerByArray(Baton_Rouge, false, false);
cntMarker += Baton_Rouge.length;
map.addOverlays(Covington);
centerByArray(Covington, false, false);
cntMarker += Covington.length;
map.addOverlays(Duson);
centerByArray(Duson, false, false);
cntMarker += Duson.length;
map.addOverlays(Gonzales);
centerByArray(Gonzales, false, false);
cntMarker += Gonzales.length;
map.addOverlays(Grand_Coteau);
centerByArray(Grand_Coteau, false, false);
cntMarker += Grand_Coteau.length;
map.addOverlays(Gretna);
centerByArray(Gretna, false, false);
cntMarker += Gretna.length;
map.addOverlays(Hammond);
centerByArray(Hammond, false, false);
cntMarker += Hammond.length;
map.addOverlays(Harahan);
centerByArray(Harahan, false, false);
cntMarker += Harahan.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(Monroe);
centerByArray(Monroe, false, false);
cntMarker += Monroe.length;
map.addOverlays(New_Orleans);
centerByArray(New_Orleans, false, false);
cntMarker += New_Orleans.length;
map.addOverlays(New_Roads);
centerByArray(New_Roads, false, false);
cntMarker += New_Roads.length;
map.addOverlays(Reserve);
centerByArray(Reserve, false, false);
cntMarker += Reserve.length;
map.addOverlays(Shreveport);
centerByArray(Shreveport, false, false);
cntMarker += Shreveport.length;
map.addOverlays(Vidalia);
centerByArray(Vidalia, false, false);
cntMarker += Vidalia.length;
centerByArray(New_Orleans,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///34354,11628,11573,11850,11481,11807,11803,11668,11737,34355,34354,11628,11632,34357,11859,11548,34352,11573,11776,11730,11680,11576,11515,11557,11503,11684,11884,11594,11481,11550,11822,34358,11862,11532,34359,11803,34353,/all');
//window.open('/map.php?type=2&schools=34354,11628,11573,11850,11481,11807,11803,11668,11737,34355,34354,11628,11632,34357,11859,11548,34352,11573,11776,11730,11680,11576,11515,11557,11503,11684,11884,11594,11481,11550,11822,34358,11862,11532,34359,11803,34353,&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;
}