function addMarkers(){ mySelect = document.getElementById('selection'); Jackson = [];Hattiesburg = [];Clarksdale = [];Wesson = [];Decatur = [];Scooba = [];Raymond = [];Goodman = [];Fulton = [];Ellisville = [];West_Point = [];Meridian = [];Moorhead = [];Perkinston = [];Booneville = [];Senatobia = [];Poplarville = [];Summit = [];mySelect.options[mySelect.options.length] = new Option("Booneville Schools",'all=Booneville'); mySelect.options[mySelect.options.length] = new Option("Clarksdale Schools",'all=Clarksdale'); mySelect.options[mySelect.options.length] = new Option("Decatur Schools",'all=Decatur'); mySelect.options[mySelect.options.length] = new Option("Ellisville Schools",'all=Ellisville'); mySelect.options[mySelect.options.length] = new Option("Fulton Schools",'all=Fulton'); mySelect.options[mySelect.options.length] = new Option("Goodman Schools",'all=Goodman'); mySelect.options[mySelect.options.length] = new Option("Hattiesburg Schools",'all=Hattiesburg'); mySelect.options[mySelect.options.length] = new Option("Jackson Schools",'all=Jackson'); mySelect.options[mySelect.options.length] = new Option("Meridian Schools",'all=Meridian'); mySelect.options[mySelect.options.length] = new Option("Moorhead Schools",'all=Moorhead'); mySelect.options[mySelect.options.length] = new Option("Perkinston Schools",'all=Perkinston'); mySelect.options[mySelect.options.length] = new Option("Poplarville Schools",'all=Poplarville'); mySelect.options[mySelect.options.length] = new Option("Raymond Schools",'all=Raymond'); mySelect.options[mySelect.options.length] = new Option("Scooba Schools",'all=Scooba'); mySelect.options[mySelect.options.length] = new Option("Senatobia Schools",'all=Senatobia'); mySelect.options[mySelect.options.length] = new Option("Summit Schools",'all=Summit'); mySelect.options[mySelect.options.length] = new Option("Wesson Schools",'all=Wesson'); mySelect.options[mySelect.options.length] = new Option("West Point Schools",'all=West_Point'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); var tmpLatLng=0; var tmpLen=0; tmpLatLng=new GLatLng(32.33231899999999825,-90.1048799999999943); tmpLen=Jackson.length; Jackson[tmpLen] = createMarker(tmpLatLng,"
Antonelli College
2323 Lakeland Drive
Jackson, MS 39232

[ View School Profile ]
",iconGr); Jackson[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Antonelli College",'Jackson=' + Jackson.length); tmpLatLng=new GLatLng(31.34712999999999993,-89.3352110000000010); tmpLen=Hattiesburg.length; Hattiesburg[tmpLen] = createMarker(tmpLatLng,"
Antonelli College
1500 N 31st Ave
Hattiesburg, MS 39401

[ View School Profile ]
",iconGr); Hattiesburg[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Antonelli College",'Hattiesburg=' + Hattiesburg.length); tmpLatLng=new GLatLng(34.23202899999999715,-90.5711139999999943); tmpLen=Clarksdale.length; Clarksdale[tmpLen] = createMarker(tmpLatLng,"
Coahoma Community College
3240 Friars Point Rd
Clarksdale, MS 38614

[ View School Profile ]
",iconGr); Clarksdale[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Coahoma Community College",'Clarksdale=' + Clarksdale.length); tmpLatLng=new GLatLng(31.69158300000000139,-90.3994940000000042); tmpLen=Wesson.length; Wesson[tmpLen] = createMarker(tmpLatLng,"
Copiah-lincoln Community College
1001 Copiah Lincoln Lane
Wesson, MS 39191

[ View School Profile ]
",iconGr); Wesson[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Copiah-lincoln Community College",'Wesson=' + Wesson.length); tmpLatLng=new GLatLng(32.43897499999999922,-89.1105809999999962); tmpLen=Decatur.length; Decatur[tmpLen] = createMarker(tmpLatLng,"
East Central Community College
275 West Broad Street
Decatur, MS 39327

[ View School Profile ]
",iconGr); Decatur[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("East Central Community College",'Decatur=' + Decatur.length); tmpLatLng=new GLatLng(32.83077999999999718,-88.4848290000000048); tmpLen=Scooba.length; Scooba[tmpLen] = createMarker(tmpLatLng,"
East Mississippi Community College
1512 Kemper Street
Scooba, MS 39358

[ View School Profile ]
",iconGr); Scooba[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("East Mississippi Community College",'Scooba=' + Scooba.length); tmpLatLng=new GLatLng(32.25446800000000280,-90.4153900000000021); tmpLen=Raymond.length; Raymond[tmpLen] = createMarker(tmpLatLng,"
Hinds Community College
501 E Main St
Raymond, MS 39154

[ View School Profile ]
",iconGr); Raymond[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Hinds Community College",'Raymond=' + Raymond.length); tmpLatLng=new GLatLng(32.96909999999999740,-89.9130799999999936); tmpLen=Goodman.length; Goodman[tmpLen] = createMarker(tmpLatLng,"
Holmes Community College
1 Hill St
Goodman, MS 39079

[ View School Profile ]
",iconGr); Goodman[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Holmes Community College",'Goodman=' + Goodman.length); tmpLatLng=new GLatLng(34.27604199999999679,-88.4123850000000004); tmpLen=Fulton.length; Fulton[tmpLen] = createMarker(tmpLatLng,"
Itawamba Community College
602 W Hill St
Fulton, MS 38843

[ View School Profile ]
",iconGr); Fulton[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Itawamba Community College",'Fulton=' + Fulton.length); tmpLatLng=new GLatLng(31.59777100000000160,-89.1999760000000065); tmpLen=Ellisville.length; Ellisville[tmpLen] = createMarker(tmpLatLng,"
Jones County Junior College
900 S Court St
Ellisville, MS 39437

[ View School Profile ]
",iconGr); Ellisville[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Jones County Junior College",'Ellisville=' + Ellisville.length); tmpLatLng=new GLatLng(33.60674999999999812,-88.6505279999999942); tmpLen=West_Point.length; West_Point[tmpLen] = createMarker(tmpLatLng,"
Mary Holmes College
Hwy 50 W
West Point, MS 39773

[ View School Profile ]
",iconRd); West_Point[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Mary Holmes College",'West_Point=' + West_Point.length); tmpLatLng=new GLatLng(32.36632300000000128,-88.7337780000000009); tmpLen=Meridian.length; Meridian[tmpLen] = createMarker(tmpLatLng,"
Meridian Community College
910 Hwy 19 N
Meridian, MS 39307

[ View School Profile ]
",iconGr); Meridian[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Meridian Community College",'Meridian=' + Meridian.length); tmpLatLng=new GLatLng(33.44570000000000220,-90.5053000000000054); tmpLen=Moorhead.length; Moorhead[tmpLen] = createMarker(tmpLatLng,"
Mississippi Delta Community College
Hwy 3 And Cherry St
Moorhead, MS 38761

[ View School Profile ]
",iconGr); Moorhead[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Mississippi Delta Community College",'Moorhead=' + Moorhead.length); tmpLatLng=new GLatLng(30.74433099999999896,-89.3178529999999994); tmpLen=Perkinston.length; Perkinston[tmpLen] = createMarker(tmpLatLng,"
Mississippi Gulf Coast Community College
51 Main Street
Perkinston, MS 39573

[ View School Profile ]
",iconGr); Perkinston[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Mississippi Gulf Coast Community College",'Perkinston=' + Perkinston.length); tmpLatLng=new GLatLng(34.66740000000000065,-88.5608200000000067); tmpLen=Booneville.length; Booneville[tmpLen] = createMarker(tmpLatLng,"
Northeast Mississippi Community College
101 Cunningham Blvd
Booneville, MS 38829

[ View School Profile ]
",iconGr); Booneville[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Northeast Mississippi Community College",'Booneville=' + Booneville.length); tmpLatLng=new GLatLng(34.64370000000000260,-89.9714249999999964); tmpLen=Senatobia.length; Senatobia[tmpLen] = createMarker(tmpLatLng,"
Northwest Mississippi Community College
4975 Hwy 51 N
Senatobia, MS 38668

[ View School Profile ]
",iconGr); Senatobia[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Northwest Mississippi Community College",'Senatobia=' + Senatobia.length); tmpLatLng=new GLatLng(30.84315499999999943,-89.5423349999999942); tmpLen=Poplarville.length; Poplarville[tmpLen] = createMarker(tmpLatLng,"
Pearl River Community College
101 Hwy 11 N
Poplarville, MS 39470

[ View School Profile ]
",iconGr); Poplarville[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Pearl River Community College",'Poplarville=' + Poplarville.length); tmpLatLng=new GLatLng(31.28343999999999880,-90.4511799999999936); tmpLen=Summit.length; Summit[tmpLen] = createMarker(tmpLatLng,"
Southwest Mississippi Community College
1156 College Drive
Summit, MS 39666

[ View School Profile ]
",iconGr); Summit[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Southwest Mississippi Community College",'Summit=' + Summit.length); map.removeOverlays(Booneville); map.removeOverlays(Clarksdale); map.removeOverlays(Decatur); map.removeOverlays(Ellisville); map.removeOverlays(Fulton); map.removeOverlays(Goodman); map.removeOverlays(Hattiesburg); map.removeOverlays(Jackson); map.removeOverlays(Meridian); map.removeOverlays(Moorhead); map.removeOverlays(Perkinston); map.removeOverlays(Poplarville); map.removeOverlays(Raymond); map.removeOverlays(Scooba); map.removeOverlays(Senatobia); map.removeOverlays(Summit); map.removeOverlays(Wesson); map.removeOverlays(West_Point); setTimeout(function(){map.addOverlays(Booneville)},1000); setTimeout(function(){map.addOverlays(Clarksdale)},1000); setTimeout(function(){map.addOverlays(Decatur)},1000); setTimeout(function(){map.addOverlays(Ellisville)},1000); setTimeout(function(){map.addOverlays(Fulton)},1000); setTimeout(function(){map.addOverlays(Goodman)},1000); setTimeout(function(){map.addOverlays(Hattiesburg)},1000); setTimeout(function(){map.addOverlays(Jackson)},1000); setTimeout(function(){map.addOverlays(Meridian)},1000); setTimeout(function(){map.addOverlays(Moorhead)},1000); setTimeout(function(){map.addOverlays(Perkinston)},1000); setTimeout(function(){map.addOverlays(Poplarville)},1000); setTimeout(function(){map.addOverlays(Raymond)},1000); setTimeout(function(){map.addOverlays(Scooba)},1000); setTimeout(function(){map.addOverlays(Senatobia)},1000); setTimeout(function(){map.addOverlays(Summit)},1000); setTimeout(function(){map.addOverlays(Wesson)},1000); setTimeout(function(){map.addOverlays(West_Point)},1000); getPoly("","state","","MS");} // 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(Booneville); map.removeOverlays(Clarksdale); map.removeOverlays(Decatur); map.removeOverlays(Ellisville); map.removeOverlays(Fulton); map.removeOverlays(Goodman); map.removeOverlays(Hattiesburg); map.removeOverlays(Jackson); map.removeOverlays(Meridian); map.removeOverlays(Moorhead); map.removeOverlays(Perkinston); map.removeOverlays(Poplarville); map.removeOverlays(Raymond); map.removeOverlays(Scooba); map.removeOverlays(Senatobia); map.removeOverlays(Summit); map.removeOverlays(Wesson); map.removeOverlays(West_Point); 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(Jackson);map.removeOverlays(Booneville); map.removeOverlays(Clarksdale); map.removeOverlays(Decatur); map.removeOverlays(Ellisville); map.removeOverlays(Fulton); map.removeOverlays(Goodman); map.removeOverlays(Hattiesburg); map.removeOverlays(Jackson); map.removeOverlays(Meridian); map.removeOverlays(Moorhead); map.removeOverlays(Perkinston); map.removeOverlays(Poplarville); map.removeOverlays(Raymond); map.removeOverlays(Scooba); map.removeOverlays(Senatobia); map.removeOverlays(Summit); map.removeOverlays(Wesson); map.removeOverlays(West_Point); map.addOverlays(Booneville); centerByArray(Booneville, false, false); cntMarker += Booneville.length; map.addOverlays(Clarksdale); centerByArray(Clarksdale, false, false); cntMarker += Clarksdale.length; map.addOverlays(Decatur); centerByArray(Decatur, false, false); cntMarker += Decatur.length; map.addOverlays(Ellisville); centerByArray(Ellisville, false, false); cntMarker += Ellisville.length; map.addOverlays(Fulton); centerByArray(Fulton, false, false); cntMarker += Fulton.length; map.addOverlays(Goodman); centerByArray(Goodman, false, false); cntMarker += Goodman.length; map.addOverlays(Hattiesburg); centerByArray(Hattiesburg, false, false); cntMarker += Hattiesburg.length; map.addOverlays(Jackson); centerByArray(Jackson, false, false); cntMarker += Jackson.length; map.addOverlays(Meridian); centerByArray(Meridian, false, false); cntMarker += Meridian.length; map.addOverlays(Moorhead); centerByArray(Moorhead, false, false); cntMarker += Moorhead.length; map.addOverlays(Perkinston); centerByArray(Perkinston, false, false); cntMarker += Perkinston.length; map.addOverlays(Poplarville); centerByArray(Poplarville, false, false); cntMarker += Poplarville.length; map.addOverlays(Raymond); centerByArray(Raymond, false, false); cntMarker += Raymond.length; map.addOverlays(Scooba); centerByArray(Scooba, false, false); cntMarker += Scooba.length; map.addOverlays(Senatobia); centerByArray(Senatobia, false, false); cntMarker += Senatobia.length; map.addOverlays(Summit); centerByArray(Summit, false, false); cntMarker += Summit.length; map.addOverlays(Wesson); centerByArray(Wesson, false, false); cntMarker += Wesson.length; map.addOverlays(West_Point); centerByArray(West_Point, false, false); cntMarker += West_Point.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; }