function addMarkers(){
mySelect = document.getElementById('selection');
Sybertsville = [];Mountain_Top = [];Sweet_Valley = [];Dallas = [];Plymouth = [];Wilkes_Barre = [];Hazleton = [];Duryea = [];Pittston = [];Hanover_Township = [];Kingston = [];Nanticoke = [];Shickshinny = [];Plains = [];Wyoming = [];Freeland = [];Hunlock_Creek = [];Swoyersville = [];Forty_Fort = [];Luzerne = [];Dupont = [];Avoca = [];West_Hazleton = [];Exeter = [];mySelect.options[mySelect.options.length] = new Option("Avoca schools",'all=Avoca');
mySelect.options[mySelect.options.length] = new Option("Dallas schools",'all=Dallas');
mySelect.options[mySelect.options.length] = new Option("Dupont schools",'all=Dupont');
mySelect.options[mySelect.options.length] = new Option("Duryea schools",'all=Duryea');
mySelect.options[mySelect.options.length] = new Option("Exeter schools",'all=Exeter');
mySelect.options[mySelect.options.length] = new Option("Forty Fort schools",'all=Forty_Fort');
mySelect.options[mySelect.options.length] = new Option("Freeland schools",'all=Freeland');
mySelect.options[mySelect.options.length] = new Option("Hanover Township schools",'all=Hanover_Township');
mySelect.options[mySelect.options.length] = new Option("Hazleton schools",'all=Hazleton');
mySelect.options[mySelect.options.length] = new Option("Hunlock Creek schools",'all=Hunlock_Creek');
mySelect.options[mySelect.options.length] = new Option("Kingston schools",'all=Kingston');
mySelect.options[mySelect.options.length] = new Option("Luzerne schools",'all=Luzerne');
mySelect.options[mySelect.options.length] = new Option("Mountain Top schools",'all=Mountain_Top');
mySelect.options[mySelect.options.length] = new Option("Nanticoke schools",'all=Nanticoke');
mySelect.options[mySelect.options.length] = new Option("Pittston schools",'all=Pittston');
mySelect.options[mySelect.options.length] = new Option("Plains schools",'all=Plains');
mySelect.options[mySelect.options.length] = new Option("Plymouth schools",'all=Plymouth');
mySelect.options[mySelect.options.length] = new Option("Shickshinny schools",'all=Shickshinny');
mySelect.options[mySelect.options.length] = new Option("Sweet Valley schools",'all=Sweet_Valley');
mySelect.options[mySelect.options.length] = new Option("Swoyersville schools",'all=Swoyersville');
mySelect.options[mySelect.options.length] = new Option("Sybertsville schools",'all=Sybertsville');
mySelect.options[mySelect.options.length] = new Option("West Hazleton schools",'all=West_Hazleton');
mySelect.options[mySelect.options.length] = new Option("Wilkes Barre schools",'all=Wilkes_Barre');
mySelect.options[mySelect.options.length] = new Option("Wyoming schools",'all=Wyoming');
mySelect.options[mySelect.options.length] = new Option("---------------------------",'');
Sybertsville[Sybertsville.length] = createMarker(new GPoint(-76.07660000,41.00130000),"
",iconGr);
mySelect.options[mySelect.options.length] = new Option("Anne Mclaughlin's Child Care",'Sybertsville=' + Sybertsville.length);
Mountain_Top[Mountain_Top.length] = createMarker(new GPoint(-75.93750000,41.13250000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("The Childrens Ark",'Mountain_Top=' + Mountain_Top.length);
Sweet_Valley[Sweet_Valley.length] = createMarker(new GPoint(-76.14187700,41.28440300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("The Christian Academy Of Commu",'Sweet_Valley=' + Sweet_Valley.length);
Sweet_Valley[Sweet_Valley.length] = createMarker(new GPoint(-76.14193200,41.28439400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("The Christian Of Community Bible Church",'Sweet_Valley=' + Sweet_Valley.length);
Dallas[Dallas.length] = createMarker(new GPoint(-75.96281600,41.33280000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Dallas Little People Day Care School Inc.",'Dallas=' + Dallas.length);
Plymouth[Plymouth.length] = createMarker(new GPoint(-75.95200000,41.24310000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Ebenezer Faith Christian School",'Plymouth=' + Plymouth.length);
Dallas[Dallas.length] = createMarker(new GPoint(-75.96504000,41.33525600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Gate Of Heaven School",'Dallas=' + Dallas.length);
Wilkes_Barre[Wilkes_Barre.length] = createMarker(new GPoint(-75.89222700,41.23516300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Genesis School",'Wilkes_Barre=' + Wilkes_Barre.length);
Hazleton[Hazleton.length] = createMarker(new GPoint(-75.97582700,40.95739500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Hazleton Trinity Nursery & Kindergarten School",'Hazleton=' + Hazleton.length);
Duryea[Duryea.length] = createMarker(new GPoint(-75.76487800,41.35279300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Holy Rosary Elementary School",'Duryea=' + Duryea.length);
Hazleton[Hazleton.length] = createMarker(new GPoint(-75.96732400,40.96365800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Holy Spirit Academy-hazleton Catholic School",'Hazleton=' + Hazleton.length);
Hazleton[Hazleton.length] = createMarker(new GPoint(-75.97639600,40.95568000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Holy Trinity School",'Hazleton=' + Hazleton.length);
Pittston[Pittston.length] = createMarker(new GPoint(-75.77977100,41.33545300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Humpty Dumpty Kollege",'Pittston=' + Pittston.length);
Dallas[Dallas.length] = createMarker(new GPoint(-75.97540000,41.35420000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Im Big Now Learning Center",'Dallas=' + Dallas.length);
Hazleton[Hazleton.length] = createMarker(new GPoint(-75.98089800,40.96542400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Immanuel Christian School",'Hazleton=' + Hazleton.length);
Hanover_Township[Hanover_Township.length] = createMarker(new GPoint(-75.92375700,41.22651700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Its A Small World Day Care School",'Hanover_Township=' + Hanover_Township.length);
Kingston[Kingston.length] = createMarker(new GPoint(-75.88294900,41.27059300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Jenny Lynn Ferraro Academy",'Kingston=' + Kingston.length);
Wilkes_Barre[Wilkes_Barre.length] = createMarker(new GPoint(-75.84350000,41.28700000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Kings Kids Christian School",'Wilkes_Barre=' + Wilkes_Barre.length);
Nanticoke[Nanticoke.length] = createMarker(new GPoint(-76.01191500,41.19260400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("The Learning Station",'Nanticoke=' + Nanticoke.length);
Wilkes_Barre[Wilkes_Barre.length] = createMarker(new GPoint(-75.91035900,41.23922000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Little People Day Care School",'Wilkes_Barre=' + Wilkes_Barre.length);
Kingston[Kingston.length] = createMarker(new GPoint(-75.88554100,41.25671500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Little People Day Care School",'Kingston=' + Kingston.length);
Shickshinny[Shickshinny.length] = createMarker(new GPoint(-76.24039100,41.21565400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Living Word Baptist Academy",'Shickshinny=' + Shickshinny.length);
Plains[Plains.length] = createMarker(new GPoint(-75.82309200,41.26613700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Magic Years",'Plains=' + Plains.length);
Wilkes_Barre[Wilkes_Barre.length] = createMarker(new GPoint(-75.93412100,41.21169200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Magic Years",'Wilkes_Barre=' + Wilkes_Barre.length);
Wyoming[Wyoming.length] = createMarker(new GPoint(-75.85709200,41.29991500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Mba Academy",'Wyoming=' + Wyoming.length);
Wyoming[Wyoming.length] = createMarker(new GPoint(-75.85576300,41.30031300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Milestones Achievement Center",'Wyoming=' + Wyoming.length);
Freeland[Freeland.length] = createMarker(new GPoint(-75.89738200,41.01288600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("MMI Preparatory School",'Freeland=' + Freeland.length);
Hunlock_Creek[Hunlock_Creek.length] = createMarker(new GPoint(-76.17407800,41.23429700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Muhlinburg Christian Academy",'Hunlock_Creek=' + Hunlock_Creek.length);
Nanticoke[Nanticoke.length] = createMarker(new GPoint(-76.00442800,41.19882500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Pope John Paul Ii Catholic School",'Nanticoke=' + Nanticoke.length);
Swoyersville[Swoyersville.length] = createMarker(new GPoint(-75.86909000,41.29616800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Regis Academy",'Swoyersville=' + Swoyersville.length);
Forty_Fort[Forty_Fort.length] = createMarker(new GPoint(-75.87614400,41.28164100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Regis Elementary School",'Forty_Fort=' + Forty_Fort.length);
Luzerne[Luzerne.length] = createMarker(new GPoint(-75.88922500,41.28405600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Sacred Heart Elementary School",'Luzerne=' + Luzerne.length);
Dupont[Dupont.length] = createMarker(new GPoint(-75.74307000,41.32374900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Sacred Heart Of Jesus School",'Dupont=' + Dupont.length);
Wilkes_Barre[Wilkes_Barre.length] = createMarker(new GPoint(-75.86437200,41.25720100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Sacred Heart School",'Wilkes_Barre=' + Wilkes_Barre.length);
Kingston[Kingston.length] = createMarker(new GPoint(-75.90104100,41.26849900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St. Hedwig Elementary School",'Kingston=' + Kingston.length);
Pittston[Pittston.length] = createMarker(new GPoint(-75.78955000,41.32340200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St. John The Baptist School",'Pittston=' + Pittston.length);
Mountain_Top[Mountain_Top.length] = createMarker(new GPoint(-75.90979300,41.12002300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St. Jude School",'Mountain_Top=' + Mountain_Top.length);
Avoca[Avoca.length] = createMarker(new GPoint(-75.74198000,41.33939100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St. Marys School",'Avoca=' + Avoca.length);
Mountain_Top[Mountain_Top.length] = createMarker(new GPoint(-75.88146600,41.16694200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Shining Stars",'Mountain_Top=' + Mountain_Top.length);
Plains[Plains.length] = createMarker(new GPoint(-75.84321500,41.27375500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Ss Peter & Paul School",'Plains=' + Plains.length);
Wilkes_Barre[Wilkes_Barre.length] = createMarker(new GPoint(-75.91235500,41.23272600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St Aloysius' School",'Wilkes_Barre=' + Wilkes_Barre.length);
Wilkes_Barre[Wilkes_Barre.length] = createMarker(new GPoint(-75.89837900,41.22948800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St Boniface School",'Wilkes_Barre=' + Wilkes_Barre.length);
Hazleton[Hazleton.length] = createMarker(new GPoint(-75.97326600,40.96316600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St Joseph Memorial School-hazleton Catholic School",'Hazleton=' + Hazleton.length);
Pittston[Pittston.length] = createMarker(new GPoint(-75.78694100,41.32505600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St Mary Assumption School",'Pittston=' + Pittston.length);
Wilkes_Barre[Wilkes_Barre.length] = createMarker(new GPoint(-75.88765200,41.24065300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St Nicholas-st. Mary's",'Wilkes_Barre=' + Wilkes_Barre.length);
West_Hazleton[West_Hazleton.length] = createMarker(new GPoint(-75.97695100,40.95615800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Transfiguration School",'West_Hazleton=' + West_Hazleton.length);
Kingston[Kingston.length] = createMarker(new GPoint(-75.88555100,41.25704300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("United Hebrew Institute",'Kingston=' + Kingston.length);
Wilkes_Barre[Wilkes_Barre.length] = createMarker(new GPoint(-75.86354700,41.24092400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Wilkes-barre Academy",'Wilkes_Barre=' + Wilkes_Barre.length);
Exeter[Exeter.length] = createMarker(new GPoint(-75.82467400,41.31772800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Wyoming Area Catholic School",'Exeter=' + Exeter.length);
Forty_Fort[Forty_Fort.length] = createMarker(new GPoint(-75.86790500,41.29174100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Wyoming Seminary Lower School",'Forty_Fort=' + Forty_Fort.length);
Kingston[Kingston.length] = createMarker(new GPoint(-75.89990500,41.26483600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Wyoming Valley Montessori School",'Kingston=' + Kingston.length);
Mountain_Top[Mountain_Top.length] = createMarker(new GPoint(-75.95629900,41.15097900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Wyoming Valley Sda Elementary School",'Mountain_Top=' + Mountain_Top.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/////1/' + showArray);
map.removeOverlays(Avoca);
map.removeOverlays(Dallas);
map.removeOverlays(Dupont);
map.removeOverlays(Duryea);
map.removeOverlays(Exeter);
map.removeOverlays(Forty_Fort);
map.removeOverlays(Freeland);
map.removeOverlays(Hanover_Township);
map.removeOverlays(Hazleton);
map.removeOverlays(Hunlock_Creek);
map.removeOverlays(Kingston);
map.removeOverlays(Luzerne);
map.removeOverlays(Mountain_Top);
map.removeOverlays(Nanticoke);
map.removeOverlays(Pittston);
map.removeOverlays(Plains);
map.removeOverlays(Plymouth);
map.removeOverlays(Shickshinny);
map.removeOverlays(Sweet_Valley);
map.removeOverlays(Swoyersville);
map.removeOverlays(Sybertsville);
map.removeOverlays(West_Hazleton);
map.removeOverlays(Wilkes_Barre);
map.removeOverlays(Wyoming);
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(Sybertsville);map.removeOverlays(Avoca);
map.removeOverlays(Dallas);
map.removeOverlays(Dupont);
map.removeOverlays(Duryea);
map.removeOverlays(Exeter);
map.removeOverlays(Forty_Fort);
map.removeOverlays(Freeland);
map.removeOverlays(Hanover_Township);
map.removeOverlays(Hazleton);
map.removeOverlays(Hunlock_Creek);
map.removeOverlays(Kingston);
map.removeOverlays(Luzerne);
map.removeOverlays(Mountain_Top);
map.removeOverlays(Nanticoke);
map.removeOverlays(Pittston);
map.removeOverlays(Plains);
map.removeOverlays(Plymouth);
map.removeOverlays(Shickshinny);
map.removeOverlays(Sweet_Valley);
map.removeOverlays(Swoyersville);
map.removeOverlays(Sybertsville);
map.removeOverlays(West_Hazleton);
map.removeOverlays(Wilkes_Barre);
map.removeOverlays(Wyoming);
map.addOverlays(Avoca);
centerByArray(Avoca, false, false);
cntMarker += Avoca.length;
map.addOverlays(Dallas);
centerByArray(Dallas, false, false);
cntMarker += Dallas.length;
map.addOverlays(Dupont);
centerByArray(Dupont, false, false);
cntMarker += Dupont.length;
map.addOverlays(Duryea);
centerByArray(Duryea, false, false);
cntMarker += Duryea.length;
map.addOverlays(Exeter);
centerByArray(Exeter, false, false);
cntMarker += Exeter.length;
map.addOverlays(Forty_Fort);
centerByArray(Forty_Fort, false, false);
cntMarker += Forty_Fort.length;
map.addOverlays(Freeland);
centerByArray(Freeland, false, false);
cntMarker += Freeland.length;
map.addOverlays(Hanover_Township);
centerByArray(Hanover_Township, false, false);
cntMarker += Hanover_Township.length;
map.addOverlays(Hazleton);
centerByArray(Hazleton, false, false);
cntMarker += Hazleton.length;
map.addOverlays(Hunlock_Creek);
centerByArray(Hunlock_Creek, false, false);
cntMarker += Hunlock_Creek.length;
map.addOverlays(Kingston);
centerByArray(Kingston, false, false);
cntMarker += Kingston.length;
map.addOverlays(Luzerne);
centerByArray(Luzerne, false, false);
cntMarker += Luzerne.length;
map.addOverlays(Mountain_Top);
centerByArray(Mountain_Top, false, false);
cntMarker += Mountain_Top.length;
map.addOverlays(Nanticoke);
centerByArray(Nanticoke, false, false);
cntMarker += Nanticoke.length;
map.addOverlays(Pittston);
centerByArray(Pittston, false, false);
cntMarker += Pittston.length;
map.addOverlays(Plains);
centerByArray(Plains, false, false);
cntMarker += Plains.length;
map.addOverlays(Plymouth);
centerByArray(Plymouth, false, false);
cntMarker += Plymouth.length;
map.addOverlays(Shickshinny);
centerByArray(Shickshinny, false, false);
cntMarker += Shickshinny.length;
map.addOverlays(Sweet_Valley);
centerByArray(Sweet_Valley, false, false);
cntMarker += Sweet_Valley.length;
map.addOverlays(Swoyersville);
centerByArray(Swoyersville, false, false);
cntMarker += Swoyersville.length;
map.addOverlays(Sybertsville);
centerByArray(Sybertsville, false, false);
cntMarker += Sybertsville.length;
map.addOverlays(West_Hazleton);
centerByArray(West_Hazleton, false, false);
cntMarker += West_Hazleton.length;
map.addOverlays(Wilkes_Barre);
centerByArray(Wilkes_Barre, false, false);
cntMarker += Wilkes_Barre.length;
map.addOverlays(Wyoming);
centerByArray(Wyoming, false, false);
cntMarker += Wyoming.length;
centerByArray(Sybertsville,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=1&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;
}