function addMarkers(){
mySelect = document.getElementById('selection');
Pittsburgh = [];Gibsonia = [];Homestead = [];Allison_Park = [];Cheswick = [];Turtle_Creek = [];East_Pittsburgh = [];Monroeville = [];Mckeesport = [];Munhall = [];Bethel_Park = [];White_Oak = [];Coraopolis = [];Mc_Kees_Rocks = [];Wexford = [];Sewickley = [];Natrona_Heights = [];Clairton = [];West_Mifflin = [];mySelect.options[mySelect.options.length] = new Option("Allison Park schools",'all=Allison_Park');
mySelect.options[mySelect.options.length] = new Option("Bethel Park schools",'all=Bethel_Park');
mySelect.options[mySelect.options.length] = new Option("Cheswick schools",'all=Cheswick');
mySelect.options[mySelect.options.length] = new Option("Clairton schools",'all=Clairton');
mySelect.options[mySelect.options.length] = new Option("Coraopolis schools",'all=Coraopolis');
mySelect.options[mySelect.options.length] = new Option("East Pittsburgh schools",'all=East_Pittsburgh');
mySelect.options[mySelect.options.length] = new Option("Gibsonia schools",'all=Gibsonia');
mySelect.options[mySelect.options.length] = new Option("Homestead schools",'all=Homestead');
mySelect.options[mySelect.options.length] = new Option("Mc Kees Rocks schools",'all=Mc_Kees_Rocks');
mySelect.options[mySelect.options.length] = new Option("Mckeesport schools",'all=Mckeesport');
mySelect.options[mySelect.options.length] = new Option("Monroeville schools",'all=Monroeville');
mySelect.options[mySelect.options.length] = new Option("Munhall schools",'all=Munhall');
mySelect.options[mySelect.options.length] = new Option("Natrona Heights schools",'all=Natrona_Heights');
mySelect.options[mySelect.options.length] = new Option("Pittsburgh schools",'all=Pittsburgh');
mySelect.options[mySelect.options.length] = new Option("Sewickley schools",'all=Sewickley');
mySelect.options[mySelect.options.length] = new Option("Turtle Creek schools",'all=Turtle_Creek');
mySelect.options[mySelect.options.length] = new Option("West Mifflin schools",'all=West_Mifflin');
mySelect.options[mySelect.options.length] = new Option("Wexford schools",'all=Wexford');
mySelect.options[mySelect.options.length] = new Option("White Oak schools",'all=White_Oak');
mySelect.options[mySelect.options.length] = new Option("---------------------------",'');
Pittsburgh[Pittsburgh.length] = createMarker(new GPoint(-79.97147600,40.36080100),"
",iconGr);
mySelect.options[mySelect.options.length] = new Option("A C L D/tillotson School",'Pittsburgh=' + Pittsburgh.length);
Gibsonia[Gibsonia.length] = createMarker(new GPoint(-79.96825200,40.59850900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Aquinas Academy",'Gibsonia=' + Gibsonia.length);
Homestead[Homestead.length] = createMarker(new GPoint(-79.91094300,40.40558100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("The Auberle Education Center",'Homestead=' + Homestead.length);
Pittsburgh[Pittsburgh.length] = createMarker(new GPoint(-80.03268400,40.46479500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Bethel Christian Academy",'Pittsburgh=' + Pittsburgh.length);
Pittsburgh[Pittsburgh.length] = createMarker(new GPoint(-80.07049000,40.42358400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Bishop Canevin High School",'Pittsburgh=' + Pittsburgh.length);
Pittsburgh[Pittsburgh.length] = createMarker(new GPoint(-80.15637900,40.44196300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Bradley School",'Pittsburgh=' + Pittsburgh.length);
Pittsburgh[Pittsburgh.length] = createMarker(new GPoint(-79.88273400,40.58214300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Bradley School- Robinson",'Pittsburgh=' + Pittsburgh.length);
Allison_Park[Allison_Park.length] = createMarker(new GPoint(-79.95024300,40.59611000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Calvary Christian Academy",'Allison_Park=' + Allison_Park.length);
Pittsburgh[Pittsburgh.length] = createMarker(new GPoint(-79.94693500,40.44696300),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Central Catholic High School",'Pittsburgh=' + Pittsburgh.length);
Cheswick[Cheswick.length] = createMarker(new GPoint(-79.80046600,40.54143600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Cheswick Christian Academy",'Cheswick=' + Cheswick.length);
Pittsburgh[Pittsburgh.length] = createMarker(new GPoint(-80.00334900,40.53040600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Eden Christian Academy",'Pittsburgh=' + Pittsburgh.length);
Pittsburgh[Pittsburgh.length] = createMarker(new GPoint(-79.91853200,40.45332500),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("The Ellis School",'Pittsburgh=' + Pittsburgh.length);
Turtle_Creek[Turtle_Creek.length] = createMarker(new GPoint(-79.82586200,40.41659700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Faith Christian School",'Turtle_Creek=' + Turtle_Creek.length);
East_Pittsburgh[East_Pittsburgh.length] = createMarker(new GPoint(-79.89721600,40.45833500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Grace Non-traditional Christian Academy",'East_Pittsburgh=' + East_Pittsburgh.length);
Monroeville[Monroeville.length] = createMarker(new GPoint(-79.73830900,40.44807700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Greater Works Christian School",'Monroeville=' + Monroeville.length);
Pittsburgh[Pittsburgh.length] = createMarker(new GPoint(-79.78168000,40.49540600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Heritage Christian School",'Pittsburgh=' + Pittsburgh.length);
Pittsburgh[Pittsburgh.length] = createMarker(new GPoint(-79.92509400,40.43459700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Hillel Academy Pittsburgh",'Pittsburgh=' + Pittsburgh.length);
Mckeesport[Mckeesport.length] = createMarker(new GPoint(-79.84820900,40.34556300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Holy Family Inst Day School East",'Mckeesport=' + Mckeesport.length);
Pittsburgh[Pittsburgh.length] = createMarker(new GPoint(-80.09971500,40.51092500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Holy Family Institute",'Pittsburgh=' + Pittsburgh.length);
Munhall[Munhall.length] = createMarker(new GPoint(-79.90216800,40.40758600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Holy Family Institute",'Munhall=' + Munhall.length);
Pittsburgh[Pittsburgh.length] = createMarker(new GPoint(-80.09728000,40.51077400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Holy Family Learning Alt Education",'Pittsburgh=' + Pittsburgh.length);
Pittsburgh[Pittsburgh.length] = createMarker(new GPoint(-79.89841400,40.45567800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Holy Rosary School",'Pittsburgh=' + Pittsburgh.length);
Pittsburgh[Pittsburgh.length] = createMarker(new GPoint(-79.86976300,40.45905600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Imani Christian Academy",'Pittsburgh=' + Pittsburgh.length);
Bethel_Park[Bethel_Park.length] = createMarker(new GPoint(-80.05135100,40.29791200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Jesus Fellowship Academy",'Bethel_Park=' + Bethel_Park.length);
White_Oak[White_Oak.length] = createMarker(new GPoint(-79.82189700,40.34920600),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Mesivta Of Allegheny County",'White_Oak=' + White_Oak.length);
Pittsburgh[Pittsburgh.length] = createMarker(new GPoint(-79.93960300,40.46469600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("The Neighborhood Academy",'Pittsburgh=' + Pittsburgh.length);
Pittsburgh[Pittsburgh.length] = createMarker(new GPoint(-79.98594400,40.45949800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("North Catholic",'Pittsburgh=' + Pittsburgh.length);
Pittsburgh[Pittsburgh.length] = createMarker(new GPoint(-79.94995500,40.44860400),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Oakland Catholic High School",'Pittsburgh=' + Pittsburgh.length);
Pittsburgh[Pittsburgh.length] = createMarker(new GPoint(-79.95646500,40.43721600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Oakland School",'Pittsburgh=' + Pittsburgh.length);
Coraopolis[Coraopolis.length] = createMarker(new GPoint(-80.15763200,40.50312500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Our Lady of the Sacred Heart High School350/4",'Coraopolis=' + Coraopolis.length);
Pittsburgh[Pittsburgh.length] = createMarker(new GPoint(-80.01745400,40.47076600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Pressley Ridge",'Pittsburgh=' + Pittsburgh.length);
Mc_Kees_Rocks[Mc_Kees_Rocks.length] = createMarker(new GPoint(-80.14535100,40.46925300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Robinson Twp Christian School",'Mc_Kees_Rocks=' + Mc_Kees_Rocks.length);
Wexford[Wexford.length] = createMarker(new GPoint(-80.05622400,40.62639700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St. Alphonsus School",'Wexford=' + Wexford.length);
Mckeesport[Mckeesport.length] = createMarker(new GPoint(-79.82847900,40.32794100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Serra Catholic High School",'Mckeesport=' + Mckeesport.length);
Sewickley[Sewickley.length] = createMarker(new GPoint(-80.18959800,40.54389500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Sewickley Academy",'Sewickley=' + Sewickley.length);
Pittsburgh[Pittsburgh.length] = createMarker(new GPoint(-79.87956900,40.52197100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Shady Side Academy Senior School",'Pittsburgh=' + Pittsburgh.length);
Pittsburgh[Pittsburgh.length] = createMarker(new GPoint(-79.96758200,40.39921600),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Sleepy Hollow",'Pittsburgh=' + Pittsburgh.length);
Wexford[Wexford.length] = createMarker(new GPoint(-80.08936600,40.60994400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St Anthony School Programs",'Wexford=' + Wexford.length);
Natrona_Heights[Natrona_Heights.length] = createMarker(new GPoint(-79.72664300,40.61975300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St Joseph High School",'Natrona_Heights=' + Natrona_Heights.length);
Pittsburgh[Pittsburgh.length] = createMarker(new GPoint(-79.85455300,40.42733100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Trinity Christian School",'Pittsburgh=' + Pittsburgh.length);
Pittsburgh[Pittsburgh.length] = createMarker(new GPoint(-79.93026900,40.45144700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("The University School",'Pittsburgh=' + Pittsburgh.length);
Pittsburgh[Pittsburgh.length] = createMarker(new GPoint(-80.02130000,40.55440000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Vincentian Academy/duquesne Univ",'Pittsburgh=' + Pittsburgh.length);
Pittsburgh[Pittsburgh.length] = createMarker(new GPoint(-80.07970000,40.31845500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Wesley Academy",'Pittsburgh=' + Pittsburgh.length);
Pittsburgh[Pittsburgh.length] = createMarker(new GPoint(-80.00464000,40.36550300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Wesley Highland School",'Pittsburgh=' + Pittsburgh.length);
Clairton[Clairton.length] = createMarker(new GPoint(-79.93998100,40.32403000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Wesley Spectrum Institute School (step)",'Clairton=' + Clairton.length);
Pittsburgh[Pittsburgh.length] = createMarker(new GPoint(-79.88264400,40.43480500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Western Pennsylvania School For The Deaf",'Pittsburgh=' + Pittsburgh.length);
West_Mifflin[West_Mifflin.length] = createMarker(new GPoint(-79.93520100,40.33421800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Wilson Christian Academy",'West_Mifflin=' + West_Mifflin.length);
Allison_Park[Allison_Park.length] = createMarker(new GPoint(-79.95491800,40.44308100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Winchester Thurston School",'Allison_Park=' + Allison_Park.length);
Pittsburgh[Pittsburgh.length] = createMarker(new GPoint(-79.92430000,40.43160000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Yeshiva Schools Boys",'Pittsburgh=' + Pittsburgh.length);
} // 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/////2/' + showArray);
map.removeOverlays(Allison_Park);
map.removeOverlays(Bethel_Park);
map.removeOverlays(Cheswick);
map.removeOverlays(Clairton);
map.removeOverlays(Coraopolis);
map.removeOverlays(East_Pittsburgh);
map.removeOverlays(Gibsonia);
map.removeOverlays(Homestead);
map.removeOverlays(Mc_Kees_Rocks);
map.removeOverlays(Mckeesport);
map.removeOverlays(Monroeville);
map.removeOverlays(Munhall);
map.removeOverlays(Natrona_Heights);
map.removeOverlays(Pittsburgh);
map.removeOverlays(Sewickley);
map.removeOverlays(Turtle_Creek);
map.removeOverlays(West_Mifflin);
map.removeOverlays(Wexford);
map.removeOverlays(White_Oak);
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(Pittsburgh);map.removeOverlays(Allison_Park);
map.removeOverlays(Bethel_Park);
map.removeOverlays(Cheswick);
map.removeOverlays(Clairton);
map.removeOverlays(Coraopolis);
map.removeOverlays(East_Pittsburgh);
map.removeOverlays(Gibsonia);
map.removeOverlays(Homestead);
map.removeOverlays(Mc_Kees_Rocks);
map.removeOverlays(Mckeesport);
map.removeOverlays(Monroeville);
map.removeOverlays(Munhall);
map.removeOverlays(Natrona_Heights);
map.removeOverlays(Pittsburgh);
map.removeOverlays(Sewickley);
map.removeOverlays(Turtle_Creek);
map.removeOverlays(West_Mifflin);
map.removeOverlays(Wexford);
map.removeOverlays(White_Oak);
map.addOverlays(Allison_Park);
centerByArray(Allison_Park, false, false);
cntMarker += Allison_Park.length;
map.addOverlays(Bethel_Park);
centerByArray(Bethel_Park, false, false);
cntMarker += Bethel_Park.length;
map.addOverlays(Cheswick);
centerByArray(Cheswick, false, false);
cntMarker += Cheswick.length;
map.addOverlays(Clairton);
centerByArray(Clairton, false, false);
cntMarker += Clairton.length;
map.addOverlays(Coraopolis);
centerByArray(Coraopolis, false, false);
cntMarker += Coraopolis.length;
map.addOverlays(East_Pittsburgh);
centerByArray(East_Pittsburgh, false, false);
cntMarker += East_Pittsburgh.length;
map.addOverlays(Gibsonia);
centerByArray(Gibsonia, false, false);
cntMarker += Gibsonia.length;
map.addOverlays(Homestead);
centerByArray(Homestead, false, false);
cntMarker += Homestead.length;
map.addOverlays(Mc_Kees_Rocks);
centerByArray(Mc_Kees_Rocks, false, false);
cntMarker += Mc_Kees_Rocks.length;
map.addOverlays(Mckeesport);
centerByArray(Mckeesport, false, false);
cntMarker += Mckeesport.length;
map.addOverlays(Monroeville);
centerByArray(Monroeville, false, false);
cntMarker += Monroeville.length;
map.addOverlays(Munhall);
centerByArray(Munhall, false, false);
cntMarker += Munhall.length;
map.addOverlays(Natrona_Heights);
centerByArray(Natrona_Heights, false, false);
cntMarker += Natrona_Heights.length;
map.addOverlays(Pittsburgh);
centerByArray(Pittsburgh, false, false);
cntMarker += Pittsburgh.length;
map.addOverlays(Sewickley);
centerByArray(Sewickley, false, false);
cntMarker += Sewickley.length;
map.addOverlays(Turtle_Creek);
centerByArray(Turtle_Creek, false, false);
cntMarker += Turtle_Creek.length;
map.addOverlays(West_Mifflin);
centerByArray(West_Mifflin, false, false);
cntMarker += West_Mifflin.length;
map.addOverlays(Wexford);
centerByArray(Wexford, false, false);
cntMarker += Wexford.length;
map.addOverlays(White_Oak);
centerByArray(White_Oak, false, false);
cntMarker += White_Oak.length;
centerByArray(Pittsburgh,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////all');
//window.open('/map.php?type=1&schools=&school_level=2&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;
}