function addMarkers(){ mySelect = document.getElementById('selection'); Cumberland = [];Arnold = [];Baltimore = [];Westminster = [];North_East = [];Wye_Mills = [];La_Plata = [];Frederick = [];Mchenry = [];Hagerstown = [];Bel_Air = [];Columbia = [];Silver_Spring = [];Rockville = [];Largo = [];Salisbury = [];mySelect.options[mySelect.options.length] = new Option("Arnold Schools",'all=Arnold'); mySelect.options[mySelect.options.length] = new Option("Baltimore Schools",'all=Baltimore'); mySelect.options[mySelect.options.length] = new Option("Bel Air Schools",'all=Bel_Air'); mySelect.options[mySelect.options.length] = new Option("Columbia Schools",'all=Columbia'); mySelect.options[mySelect.options.length] = new Option("Cumberland Schools",'all=Cumberland'); mySelect.options[mySelect.options.length] = new Option("Frederick Schools",'all=Frederick'); mySelect.options[mySelect.options.length] = new Option("Hagerstown Schools",'all=Hagerstown'); mySelect.options[mySelect.options.length] = new Option("La Plata Schools",'all=La_Plata'); mySelect.options[mySelect.options.length] = new Option("Largo Schools",'all=Largo'); mySelect.options[mySelect.options.length] = new Option("Mchenry Schools",'all=Mchenry'); mySelect.options[mySelect.options.length] = new Option("North East Schools",'all=North_East'); mySelect.options[mySelect.options.length] = new Option("Rockville Schools",'all=Rockville'); mySelect.options[mySelect.options.length] = new Option("Salisbury Schools",'all=Salisbury'); mySelect.options[mySelect.options.length] = new Option("Silver Spring Schools",'all=Silver_Spring'); mySelect.options[mySelect.options.length] = new Option("Westminster Schools",'all=Westminster'); mySelect.options[mySelect.options.length] = new Option("Wye Mills Schools",'all=Wye_Mills'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); var tmpLatLng=0; var tmpLen=0; tmpLatLng=new GLatLng(39.65078299999999700,-78.7340080000000028); tmpLen=Cumberland.length; Cumberland[tmpLen] = createMarker(tmpLatLng,"
Allegany College Of Maryland
12401 Willowbrook Rd Se
Cumberland, MD 21502

[ View School Profile ]
",iconGr); Cumberland[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Allegany College Of Maryland",'Cumberland=' + Cumberland.length); tmpLatLng=new GLatLng(39.05431000000000096,-76.5125840000000039); tmpLen=Arnold.length; Arnold[tmpLen] = createMarker(tmpLatLng,"
Anne Arundel Community College
101 College Pky
Arnold, MD 21012

[ View School Profile ]
",iconGr); Arnold[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Anne Arundel Community College",'Arnold=' + Arnold.length); tmpLatLng=new GLatLng(39.32150099999999781,-76.6633800000000036); tmpLen=Baltimore.length; Baltimore[tmpLen] = createMarker(tmpLatLng,"
Baltimore City Community College
2901 Liberty Hts Ave
Baltimore, MD 21215

[ View School Profile ]
",iconGr); Baltimore[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Baltimore City Community College",'Baltimore=' + Baltimore.length); tmpLatLng=new GLatLng(39.29048199999999724,-76.6123199999999968); tmpLen=Baltimore.length; Baltimore[tmpLen] = createMarker(tmpLatLng,"
Baltimore International College
17 Commerce Street, Commerce Exchange
Baltimore, MD 21202

[ View School Profile ]
",iconRd); Baltimore[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Baltimore International College",'Baltimore=' + Baltimore.length); tmpLatLng=new GLatLng(39.52998199999999684,-76.9938250000000010); tmpLen=Westminster.length; Westminster[tmpLen] = createMarker(tmpLatLng,"
Carroll Community College
1601 Washington Rd
Westminster, MD 21157

[ View School Profile ]
",iconGr); Westminster[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Carroll Community College",'Westminster=' + Westminster.length); tmpLatLng=new GLatLng(39.64095999999999975,-75.9567519999999944); tmpLen=North_East.length; North_East[tmpLen] = createMarker(tmpLatLng,"
Cecil Community College
One Seahawk Dr
North East, MD 21901

[ View School Profile ]
",iconGr); North_East[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Cecil Community College",'North_East=' + North_East.length); tmpLatLng=new GLatLng(38.95277600000000006,-76.0784610000000043); tmpLen=Wye_Mills.length; Wye_Mills[tmpLen] = createMarker(tmpLatLng,"
Chesapeake College
1000 College Circle
Wye Mills, MD 21679

[ View School Profile ]
",iconGr); Wye_Mills[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Chesapeake College",'Wye_Mills=' + Wye_Mills.length); tmpLatLng=new GLatLng(38.56784400000000090,-76.9978310000000050); tmpLen=La_Plata.length; La_Plata[tmpLen] = createMarker(tmpLatLng,"
College Of Southern Maryland
8730 Mitchell Rd
La Plata, MD 20646

[ View School Profile ]
",iconGr); La_Plata[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("College Of Southern Maryland",'La_Plata=' + La_Plata.length); tmpLatLng=new GLatLng(39.350551,-76.485391); tmpLen=Baltimore.length; Baltimore[tmpLen] = createMarker(tmpLatLng,"
Community College Of Baltimore County
7201 Rossville Blvd.
Baltimore, MD 21237

[ View School Profile ]
",iconGr); Baltimore[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Community College Of Baltimore County",'Baltimore=' + Baltimore.length); tmpLatLng=new GLatLng(39.45061400000000162,-77.4129130000000031); tmpLen=Frederick.length; Frederick[tmpLen] = createMarker(tmpLatLng,"
Frederick Community College
7932 Opossumtown Pike
Frederick, MD 21702

[ View School Profile ]
",iconGr); Frederick[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Frederick Community College",'Frederick=' + Frederick.length); tmpLatLng=new GLatLng(39.56054300000000267,-79.3411119999999954); tmpLen=Mchenry.length; Mchenry[tmpLen] = createMarker(tmpLatLng,"
Garrett College
687 Mosser Rd
Mchenry, MD 21541

[ View School Profile ]
",iconGr); Mchenry[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Garrett College",'Mchenry=' + Mchenry.length); tmpLatLng=new GLatLng(39.67259399999999658,-77.7242289999999940); tmpLen=Hagerstown.length; Hagerstown[tmpLen] = createMarker(tmpLatLng,"
Hagerstown Business College
18618 Crestwood Dr
Hagerstown, MD 21742

[ View School Profile ]
",iconRd); Hagerstown[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Hagerstown Business College",'Hagerstown=' + Hagerstown.length); tmpLatLng=new GLatLng(39.62745000000000317,-77.6663130000000023); tmpLen=Hagerstown.length; Hagerstown[tmpLen] = createMarker(tmpLatLng,"
Hagerstown Community College
11400 Robinwood Dr
Hagerstown, MD 21742

[ View School Profile ]
",iconGr); Hagerstown[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Hagerstown Community College",'Hagerstown=' + Hagerstown.length); tmpLatLng=new GLatLng(39.56621100000000268,-76.2887599999999963); tmpLen=Bel_Air.length; Bel_Air[tmpLen] = createMarker(tmpLatLng,"
Harford Community College
401 Thomas Run Rd
Bel Air, MD 21015

[ View School Profile ]
",iconGr); Bel_Air[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Harford Community College",'Bel_Air=' + Bel_Air.length); tmpLatLng=new GLatLng(39.21587000000000244,-76.8846439999999944); tmpLen=Columbia.length; Columbia[tmpLen] = createMarker(tmpLatLng,"
Howard Community College
10901 Little Patuxent Pkwy
Columbia, MD 21044

[ View School Profile ]
",iconGr); Columbia[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Howard Community College",'Columbia=' + Columbia.length); tmpLatLng=new GLatLng(39.02671800000000246,-77.0465999999999979); tmpLen=Silver_Spring.length; Silver_Spring[tmpLen] = createMarker(tmpLatLng,"
Maryland College Of Art And Design
10500 Georgia Ave
Silver Spring, MD 20902

[ View School Profile ]
",iconRd); Silver_Spring[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Maryland College Of Art And Design",'Silver_Spring=' + Silver_Spring.length); tmpLatLng=new GLatLng(39.08750899999999717,-77.1501379999999983); tmpLen=Rockville.length; Rockville[tmpLen] = createMarker(tmpLatLng,"
Montgomery College
900 Hungerford Drive
Rockville, MD 20850

[ View School Profile ]
",iconGr); Rockville[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Montgomery College",'Rockville=' + Rockville.length); tmpLatLng=new GLatLng(38.89069700000000295,-76.8248430000000013); tmpLen=Largo.length; Largo[tmpLen] = createMarker(tmpLatLng,"
Prince George's Community College
301 Largo Rd
Largo, MD 20774

[ View School Profile ]
",iconGr); Largo[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Prince George's Community College",'Largo=' + Largo.length); tmpLatLng=new GLatLng(38.37370299999999900,-75.5026340000000004); tmpLen=Salisbury.length; Salisbury[tmpLen] = createMarker(tmpLatLng,"
Wor-wic Community College
32000 Campus Drive
Salisbury, MD 21804

[ View School Profile ]
",iconGr); Salisbury[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Wor-wic Community College",'Salisbury=' + Salisbury.length); map.removeOverlays(Arnold); map.removeOverlays(Baltimore); map.removeOverlays(Bel_Air); map.removeOverlays(Columbia); map.removeOverlays(Cumberland); map.removeOverlays(Frederick); map.removeOverlays(Hagerstown); map.removeOverlays(La_Plata); map.removeOverlays(Largo); map.removeOverlays(Mchenry); map.removeOverlays(North_East); map.removeOverlays(Rockville); map.removeOverlays(Salisbury); map.removeOverlays(Silver_Spring); map.removeOverlays(Westminster); map.removeOverlays(Wye_Mills); setTimeout(function(){map.addOverlays(Arnold)},1000); setTimeout(function(){map.addOverlays(Baltimore)},1000); setTimeout(function(){map.addOverlays(Bel_Air)},1000); setTimeout(function(){map.addOverlays(Columbia)},1000); setTimeout(function(){map.addOverlays(Cumberland)},1000); setTimeout(function(){map.addOverlays(Frederick)},1000); setTimeout(function(){map.addOverlays(Hagerstown)},1000); setTimeout(function(){map.addOverlays(La_Plata)},1000); setTimeout(function(){map.addOverlays(Largo)},1000); setTimeout(function(){map.addOverlays(Mchenry)},1000); setTimeout(function(){map.addOverlays(North_East)},1000); setTimeout(function(){map.addOverlays(Rockville)},1000); setTimeout(function(){map.addOverlays(Salisbury)},1000); setTimeout(function(){map.addOverlays(Silver_Spring)},1000); setTimeout(function(){map.addOverlays(Westminster)},1000); setTimeout(function(){map.addOverlays(Wye_Mills)},1000); getPoly("","state","","MD");} // End addStateMarkers JavaScript Function //open all when map is defined function openAll() { if (map) { selectChange("all"); } else { setTimeout("openAll()",200); } } // 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].point.x; var markLat = myArray[i].point.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].point.x; maxLat = myArray[0].point.y; minLng = myArray[0].point.x; minLat = myArray[0].point.y; } // Recenter map based on global max/mins function reCenterMap(){ //alert('#' + minLat + '#' + minLng + '#' + maxLat + '#' + maxLng); 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,10); /* 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) { if (selection.options) { var _openNewWindow=true; var myVal = selection.options[selection.selectedIndex].value; } else { var _openNewWindow=false; var myVal=selection; } 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('schools-by-distance') == -1) window.open(location.href + '/map/all'); else window.open('/search////all'); map.removeOverlays(Arnold); map.removeOverlays(Baltimore); map.removeOverlays(Bel_Air); map.removeOverlays(Columbia); map.removeOverlays(Cumberland); map.removeOverlays(Frederick); map.removeOverlays(Hagerstown); map.removeOverlays(La_Plata); map.removeOverlays(Largo); map.removeOverlays(Mchenry); map.removeOverlays(North_East); map.removeOverlays(Rockville); map.removeOverlays(Salisbury); map.removeOverlays(Silver_Spring); map.removeOverlays(Westminster); map.removeOverlays(Wye_Mills); 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(Cumberland);map.removeOverlays(Arnold); map.removeOverlays(Baltimore); map.removeOverlays(Bel_Air); map.removeOverlays(Columbia); map.removeOverlays(Cumberland); map.removeOverlays(Frederick); map.removeOverlays(Hagerstown); map.removeOverlays(La_Plata); map.removeOverlays(Largo); map.removeOverlays(Mchenry); map.removeOverlays(North_East); map.removeOverlays(Rockville); map.removeOverlays(Salisbury); map.removeOverlays(Silver_Spring); map.removeOverlays(Westminster); map.removeOverlays(Wye_Mills); map.addOverlays(Arnold); centerByArray(Arnold, false, false); cntMarker += Arnold.length; map.addOverlays(Baltimore); centerByArray(Baltimore, false, false); cntMarker += Baltimore.length; map.addOverlays(Bel_Air); centerByArray(Bel_Air, false, false); cntMarker += Bel_Air.length; map.addOverlays(Columbia); centerByArray(Columbia, false, false); cntMarker += Columbia.length; map.addOverlays(Cumberland); centerByArray(Cumberland, false, false); cntMarker += Cumberland.length; map.addOverlays(Frederick); centerByArray(Frederick, false, false); cntMarker += Frederick.length; map.addOverlays(Hagerstown); centerByArray(Hagerstown, false, false); cntMarker += Hagerstown.length; map.addOverlays(La_Plata); centerByArray(La_Plata, false, false); cntMarker += La_Plata.length; map.addOverlays(Largo); centerByArray(Largo, false, false); cntMarker += Largo.length; map.addOverlays(Mchenry); centerByArray(Mchenry, false, false); cntMarker += Mchenry.length; map.addOverlays(North_East); centerByArray(North_East, false, false); cntMarker += North_East.length; map.addOverlays(Rockville); centerByArray(Rockville, false, false); cntMarker += Rockville.length; map.addOverlays(Salisbury); centerByArray(Salisbury, false, false); cntMarker += Salisbury.length; map.addOverlays(Silver_Spring); centerByArray(Silver_Spring, false, false); cntMarker += Silver_Spring.length; map.addOverlays(Westminster); centerByArray(Westminster, false, false); cntMarker += Westminster.length; map.addOverlays(Wye_Mills); centerByArray(Wye_Mills, false, false); cntMarker += Wye_Mills.length; reCenterMap(); //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'); } } function createMarker(point, label, icon){ var marker = new GMarker(point, icon); var html = label; GEvent.addListener(marker, "click", function() { marker.openInfoWindowHtml(html); }); return marker; }