function addMarkers(){ mySelect = document.getElementById('selection'); Iola = [];Great_Bend = [];Salina = [];El_Dorado = [];Concordia = [];Coffeyville = [];Colby = [];Arkansas_City = [];Dodge_City = [];Kansas_City = [];Fort_Scott = [];Garden_City = [];Hesston = [];Highland = [];Hutchinson = [];Independence = [];Overland_Park = [];Parsons = [];Chanute = [];Beloit = [];Pratt = [];Liberal = [];Topeka = [];mySelect.options[mySelect.options.length] = new Option("Arkansas City Schools",'all=Arkansas_City'); mySelect.options[mySelect.options.length] = new Option("Beloit Schools",'all=Beloit'); mySelect.options[mySelect.options.length] = new Option("Chanute Schools",'all=Chanute'); mySelect.options[mySelect.options.length] = new Option("Coffeyville Schools",'all=Coffeyville'); mySelect.options[mySelect.options.length] = new Option("Colby Schools",'all=Colby'); mySelect.options[mySelect.options.length] = new Option("Concordia Schools",'all=Concordia'); mySelect.options[mySelect.options.length] = new Option("Dodge City Schools",'all=Dodge_City'); mySelect.options[mySelect.options.length] = new Option("El Dorado Schools",'all=El_Dorado'); mySelect.options[mySelect.options.length] = new Option("Fort Scott Schools",'all=Fort_Scott'); mySelect.options[mySelect.options.length] = new Option("Garden City Schools",'all=Garden_City'); mySelect.options[mySelect.options.length] = new Option("Great Bend Schools",'all=Great_Bend'); mySelect.options[mySelect.options.length] = new Option("Hesston Schools",'all=Hesston'); mySelect.options[mySelect.options.length] = new Option("Highland Schools",'all=Highland'); mySelect.options[mySelect.options.length] = new Option("Hutchinson Schools",'all=Hutchinson'); mySelect.options[mySelect.options.length] = new Option("Independence Schools",'all=Independence'); mySelect.options[mySelect.options.length] = new Option("Iola Schools",'all=Iola'); mySelect.options[mySelect.options.length] = new Option("Kansas City Schools",'all=Kansas_City'); mySelect.options[mySelect.options.length] = new Option("Liberal Schools",'all=Liberal'); mySelect.options[mySelect.options.length] = new Option("Overland Park Schools",'all=Overland_Park'); mySelect.options[mySelect.options.length] = new Option("Parsons Schools",'all=Parsons'); mySelect.options[mySelect.options.length] = new Option("Pratt Schools",'all=Pratt'); mySelect.options[mySelect.options.length] = new Option("Salina Schools",'all=Salina'); mySelect.options[mySelect.options.length] = new Option("Topeka Schools",'all=Topeka'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); var tmpLatLng=0; var tmpLen=0; tmpLatLng=new GLatLng(37.93839200000000033,-95.3997690000000062); tmpLen=Iola.length; Iola[tmpLen] = createMarker(tmpLatLng,"
",iconGr); Iola[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Allen County Community College",'Iola=' + Iola.length); tmpLatLng=new GLatLng(38.23148199999999974,-98.6928230000000041); tmpLen=Great_Bend.length; Great_Bend[tmpLen] = createMarker(tmpLatLng,"",iconGr); Great_Bend[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Barton County Community College",'Great_Bend=' + Great_Bend.length); tmpLatLng=new GLatLng(38.80476800000000281,-97.6131689999999991); tmpLen=Salina.length; Salina[tmpLen] = createMarker(tmpLatLng,"",iconRd); Salina[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Brown Mackie College-salina",'Salina=' + Salina.length); tmpLatLng=new GLatLng(37.81085800000000318,-96.8809169999999966); tmpLen=El_Dorado.length; El_Dorado[tmpLen] = createMarker(tmpLatLng,"",iconGr); El_Dorado[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Butler Community College",'El_Dorado=' + El_Dorado.length); tmpLatLng=new GLatLng(39.55394499999999879,-97.6667120000000039); tmpLen=Concordia.length; Concordia[tmpLen] = createMarker(tmpLatLng,"",iconGr); Concordia[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Cloud County Community College",'Concordia=' + Concordia.length); tmpLatLng=new GLatLng(37.03296999999999883,-95.6206899999999961); tmpLen=Coffeyville.length; Coffeyville[tmpLen] = createMarker(tmpLatLng,"",iconGr); Coffeyville[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Coffeyville Community College",'Coffeyville=' + Coffeyville.length); tmpLatLng=new GLatLng(39.37880400000000236,-101.054810000000003); tmpLen=Colby.length; Colby[tmpLen] = createMarker(tmpLatLng,"",iconGr); Colby[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Colby Community College",'Colby=' + Colby.length); tmpLatLng=new GLatLng(37.06198299999999790,-97.0417529999999999); tmpLen=Arkansas_City.length; Arkansas_City[tmpLen] = createMarker(tmpLatLng,"",iconGr); Arkansas_City[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Cowley County Community College",'Arkansas_City=' + Arkansas_City.length); tmpLatLng=new GLatLng(37.77830199999999649,-100.033039999999999); tmpLen=Dodge_City.length; Dodge_City[tmpLen] = createMarker(tmpLatLng,"",iconGr); Dodge_City[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Dodge City Community College",'Dodge_City=' + Dodge_City.length); tmpLatLng=new GLatLng(39.11196100000000086,-94.6492350000000044); tmpLen=Kansas_City.length; Kansas_City[tmpLen] = createMarker(tmpLatLng,"",iconRd); Kansas_City[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Donnelly College",'Kansas_City=' + Kansas_City.length); tmpLatLng=new GLatLng(37.81547299999999722,-94.7135480000000029); tmpLen=Fort_Scott.length; Fort_Scott[tmpLen] = createMarker(tmpLatLng,"",iconGr); Fort_Scott[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Fort Scott Community College",'Fort_Scott=' + Fort_Scott.length); tmpLatLng=new GLatLng(37.97068800000000266,-100.847356000000004); tmpLen=Garden_City.length; Garden_City[tmpLen] = createMarker(tmpLatLng,"",iconGr); Garden_City[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Garden City Community College",'Garden_City=' + Garden_City.length); tmpLatLng=new GLatLng(38.13486300000000284,-97.4316730000000035); tmpLen=Hesston.length; Hesston[tmpLen] = createMarker(tmpLatLng,"",iconRd); Hesston[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Hesston College",'Hesston=' + Hesston.length); tmpLatLng=new GLatLng(39.85956300000000140,-95.2708899999999943); tmpLen=Highland.length; Highland[tmpLen] = createMarker(tmpLatLng,"",iconGr); Highland[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Highland Community College",'Highland=' + Highland.length); tmpLatLng=new GLatLng(38.06724200000000024,-97.9223970000000036); tmpLen=Hutchinson.length; Hutchinson[tmpLen] = createMarker(tmpLatLng,"",iconGr); Hutchinson[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Hutchinson Community College",'Hutchinson=' + Hutchinson.length); tmpLatLng=new GLatLng(37.19654599999999788,-95.7196799999999967); tmpLen=Independence.length; Independence[tmpLen] = createMarker(tmpLatLng,"",iconGr); Independence[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Independence Community College",'Independence=' + Independence.length); tmpLatLng=new GLatLng(38.92744199999999921,-94.7295050000000031); tmpLen=Overland_Park.length; Overland_Park[tmpLen] = createMarker(tmpLatLng,"",iconGr); Overland_Park[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Johnson County Community College",'Overland_Park=' + Overland_Park.length); tmpLatLng=new GLatLng(39.11660299999999779,-94.7467259999999953); tmpLen=Kansas_City.length; Kansas_City[tmpLen] = createMarker(tmpLatLng,"",iconGr); Kansas_City[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Kansas City Kansas Community College",'Kansas_City=' + Kansas_City.length); tmpLatLng=new GLatLng(37.33943099999999759,-95.2559179999999940); tmpLen=Parsons.length; Parsons[tmpLen] = createMarker(tmpLatLng,"",iconGr); Parsons[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Labette Community College",'Parsons=' + Parsons.length); tmpLatLng=new GLatLng(37.66745399999999932,-95.4631109999999978); tmpLen=Chanute.length; Chanute[tmpLen] = createMarker(tmpLatLng,"",iconGr); Chanute[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Neosho County Community College",'Chanute=' + Chanute.length); tmpLatLng=new GLatLng(39.45632200000000011,-98.1045909999999992); tmpLen=Beloit.length; Beloit[tmpLen] = createMarker(tmpLatLng,"",iconGr); Beloit[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("North Central Kansas Technical College",'Beloit=' + Beloit.length); tmpLatLng=new GLatLng(37.64800100000000071,-98.7165719999999993); tmpLen=Pratt.length; Pratt[tmpLen] = createMarker(tmpLatLng,"",iconGr); Pratt[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Pratt Community College",'Pratt=' + Pratt.length); tmpLatLng=new GLatLng(37.05808300000000343,-100.922121000000004); tmpLen=Liberal.length; Liberal[tmpLen] = createMarker(tmpLatLng,"",iconGr); Liberal[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Seward County Community College",'Liberal=' + Liberal.length); tmpLatLng=new GLatLng(39.08071300000000292,-95.7237509999999929); tmpLen=Topeka.length; Topeka[tmpLen] = createMarker(tmpLatLng,"",iconRd); Topeka[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Topeka Technical College",'Topeka=' + Topeka.length); map.removeOverlays(Arkansas_City); map.removeOverlays(Beloit); map.removeOverlays(Chanute); map.removeOverlays(Coffeyville); map.removeOverlays(Colby); map.removeOverlays(Concordia); map.removeOverlays(Dodge_City); map.removeOverlays(El_Dorado); map.removeOverlays(Fort_Scott); map.removeOverlays(Garden_City); map.removeOverlays(Great_Bend); map.removeOverlays(Hesston); map.removeOverlays(Highland); map.removeOverlays(Hutchinson); map.removeOverlays(Independence); map.removeOverlays(Iola); map.removeOverlays(Kansas_City); map.removeOverlays(Liberal); map.removeOverlays(Overland_Park); map.removeOverlays(Parsons); map.removeOverlays(Pratt); map.removeOverlays(Salina); map.removeOverlays(Topeka); setTimeout(function(){map.addOverlays(Arkansas_City)},1000); setTimeout(function(){map.addOverlays(Beloit)},1000); setTimeout(function(){map.addOverlays(Chanute)},1000); setTimeout(function(){map.addOverlays(Coffeyville)},1000); setTimeout(function(){map.addOverlays(Colby)},1000); setTimeout(function(){map.addOverlays(Concordia)},1000); setTimeout(function(){map.addOverlays(Dodge_City)},1000); setTimeout(function(){map.addOverlays(El_Dorado)},1000); setTimeout(function(){map.addOverlays(Fort_Scott)},1000); setTimeout(function(){map.addOverlays(Garden_City)},1000); setTimeout(function(){map.addOverlays(Great_Bend)},1000); setTimeout(function(){map.addOverlays(Hesston)},1000); setTimeout(function(){map.addOverlays(Highland)},1000); setTimeout(function(){map.addOverlays(Hutchinson)},1000); setTimeout(function(){map.addOverlays(Independence)},1000); setTimeout(function(){map.addOverlays(Iola)},1000); setTimeout(function(){map.addOverlays(Kansas_City)},1000); setTimeout(function(){map.addOverlays(Liberal)},1000); setTimeout(function(){map.addOverlays(Overland_Park)},1000); setTimeout(function(){map.addOverlays(Parsons)},1000); setTimeout(function(){map.addOverlays(Pratt)},1000); setTimeout(function(){map.addOverlays(Salina)},1000); setTimeout(function(){map.addOverlays(Topeka)},1000); getPoly("","state","","KS");} // 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(Arkansas_City); map.removeOverlays(Beloit); map.removeOverlays(Chanute); map.removeOverlays(Coffeyville); map.removeOverlays(Colby); map.removeOverlays(Concordia); map.removeOverlays(Dodge_City); map.removeOverlays(El_Dorado); map.removeOverlays(Fort_Scott); map.removeOverlays(Garden_City); map.removeOverlays(Great_Bend); map.removeOverlays(Hesston); map.removeOverlays(Highland); map.removeOverlays(Hutchinson); map.removeOverlays(Independence); map.removeOverlays(Iola); map.removeOverlays(Kansas_City); map.removeOverlays(Liberal); map.removeOverlays(Overland_Park); map.removeOverlays(Parsons); map.removeOverlays(Pratt); map.removeOverlays(Salina); map.removeOverlays(Topeka); 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(Iola);map.removeOverlays(Arkansas_City); map.removeOverlays(Beloit); map.removeOverlays(Chanute); map.removeOverlays(Coffeyville); map.removeOverlays(Colby); map.removeOverlays(Concordia); map.removeOverlays(Dodge_City); map.removeOverlays(El_Dorado); map.removeOverlays(Fort_Scott); map.removeOverlays(Garden_City); map.removeOverlays(Great_Bend); map.removeOverlays(Hesston); map.removeOverlays(Highland); map.removeOverlays(Hutchinson); map.removeOverlays(Independence); map.removeOverlays(Iola); map.removeOverlays(Kansas_City); map.removeOverlays(Liberal); map.removeOverlays(Overland_Park); map.removeOverlays(Parsons); map.removeOverlays(Pratt); map.removeOverlays(Salina); map.removeOverlays(Topeka); map.addOverlays(Arkansas_City); centerByArray(Arkansas_City, false, false); cntMarker += Arkansas_City.length; map.addOverlays(Beloit); centerByArray(Beloit, false, false); cntMarker += Beloit.length; map.addOverlays(Chanute); centerByArray(Chanute, false, false); cntMarker += Chanute.length; map.addOverlays(Coffeyville); centerByArray(Coffeyville, false, false); cntMarker += Coffeyville.length; map.addOverlays(Colby); centerByArray(Colby, false, false); cntMarker += Colby.length; map.addOverlays(Concordia); centerByArray(Concordia, false, false); cntMarker += Concordia.length; map.addOverlays(Dodge_City); centerByArray(Dodge_City, false, false); cntMarker += Dodge_City.length; map.addOverlays(El_Dorado); centerByArray(El_Dorado, false, false); cntMarker += El_Dorado.length; map.addOverlays(Fort_Scott); centerByArray(Fort_Scott, false, false); cntMarker += Fort_Scott.length; map.addOverlays(Garden_City); centerByArray(Garden_City, false, false); cntMarker += Garden_City.length; map.addOverlays(Great_Bend); centerByArray(Great_Bend, false, false); cntMarker += Great_Bend.length; map.addOverlays(Hesston); centerByArray(Hesston, false, false); cntMarker += Hesston.length; map.addOverlays(Highland); centerByArray(Highland, false, false); cntMarker += Highland.length; map.addOverlays(Hutchinson); centerByArray(Hutchinson, false, false); cntMarker += Hutchinson.length; map.addOverlays(Independence); centerByArray(Independence, false, false); cntMarker += Independence.length; map.addOverlays(Iola); centerByArray(Iola, false, false); cntMarker += Iola.length; map.addOverlays(Kansas_City); centerByArray(Kansas_City, false, false); cntMarker += Kansas_City.length; map.addOverlays(Liberal); centerByArray(Liberal, false, false); cntMarker += Liberal.length; map.addOverlays(Overland_Park); centerByArray(Overland_Park, false, false); cntMarker += Overland_Park.length; map.addOverlays(Parsons); centerByArray(Parsons, false, false); cntMarker += Parsons.length; map.addOverlays(Pratt); centerByArray(Pratt, false, false); cntMarker += Pratt.length; map.addOverlays(Salina); centerByArray(Salina, false, false); cntMarker += Salina.length; map.addOverlays(Topeka); centerByArray(Topeka, false, false); cntMarker += Topeka.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; }