Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var title=[];
- var markerDisplay = [];
- var iconDisplay = [];
- var panelAddresses = [];
- var zipGroup = 1;
- var infowindow;
- var marker;
- var markers = [];
- var map;
- var prevnIndex = 1;
- var geoLoc = [[0,0],[32.2457184,-110.85640139999998]
- ,[32.246458,-110.8582007]
- ,[32.3224437,-111.00827270000002]
- ,[32.247539,-110.92618199999998]
- ,[32.2257361,-110.85321369999997]
- ,[32.2638195,-110.89144929999998]
- ,[32.313664,-111.01083]
- ,[32.313664,-111.01083]
- ,[32.344373,-111.01081899999997]
- ,[32.235073,-110.83515899999998]
- ,[32.2586974,-110.89205820000001]
- ,[32.2485879,-110.88064029999998]
- ,[32.2432085,-110.87005019999998]
- ,[32.2381581,-110.85689350000001]
- ,[32.2258746,-110.85299429999998]
- ,[32.249105,-110.87909100000002]
- ,[32.264106,-110.89633400000002]
- ,[32.24041,-110.85727259999999]
- ,[32.248571,-110.88324799999998]
- ,[32.2461598,-110.85703910000001]
- ,[32.241707,-110.93604399999998]
- ,[32.2381581,-110.85689350000001]
- ,[32.235073,-110.83515899999998]
- ,[31.8557023,-110.97441500000002]
- ,[32.314228,-111.01089999999999]
- ,[32.2385679,-110.8582381]
- ,[32.224974,-110.85333100000003]
- ,[32.3180573,-111.01086370000002]
- ,[32.2509671,-110.8352984]
- ,[32.24041,-110.85727259999999]
- ,[32.264085,-110.89645999999999]
- ,[32.3387729,-111.0472153]
- ,[32.224996,-110.85387700000001]
- ,[32.3186531,-111.01102330000003]
- ,[32.3358583,-111.03179410000001]
- ,[32.2724941,-110.9771265]
- ,[32.322515,-111.013375]
- ,[32.3960367,-110.96033080000001]
- ,[32.428912,-110.9500051]
- ,[32.13428500000001,-110.99491]
- ,[32.2576229,-110.88258100000002]
- ,[32.34111,-111.01158700000002]
- ,[32.2509671,-110.8352984]
- ,[32.24041,-110.85727259999999]
- ,[32.2261052,-111.0012089]
- ,[32.2505613,-110.8581221]
- ,[32.205767,-110.79347899999999]
- ,[32.2419153,-110.85927149999998]
- ,[32.251126,-110.834792]
- ,[32.3224437,-111.00827270000002]
- ,[32.2495664,-110.88038819999997]
- ,[31.886166,-110.995948]
- ,[32.342049,-111.010829]
- ,[32.2458201,-110.85734580000002]
- ,[32.24041,-110.85727259999999] ];
- function zipCoder() {
- try {
- var addresses = "85716";
- var address = "85716";
- var prevZip = "";
- var panelDisplay = "";
- var prevAddress;
- var docsList="";
- var doctors="";
- var docsArray="";
- address = document.getElementById('officeList_id').innerHTML;
- docsList = document.getElementById('docsList_id').innerHTML;
- if (address == undefined || address == null || address == "") {
- return;
- } else {
- addresses = address.split("?");
- if (docsList != undefined && docsList != null && docsList != "") {
- docsArray = docsList.split("?");
- }
- if (addresses != undefined && addresses != null && addresses != "") {
- var infowindow;
- for (var i = 0; i < addresses.length; i++) {
- address = addresses[i].split("^");
- if (address != undefined && address != null && address != "") {
- if (docsArray != undefined && docsArray != null && docsArray != "") {
- doctors = docsArray[i].split("!");
- }
- panelDisplay += "<div style='width:250px; height: 240;'> <div id='id_imageOffice' class ='mainProviderMaph3'>" + address[0] + "</div>";
- panelDisplay += "<div class='providerMapData1'>" + "Location:" + "</div>";
- panelDisplay += "<div id = 'id_officeLoc' name = 'officeLocation' class='providerMapData1 providerMapData2'>" + address[1] + "</div>";
- panelDisplay += "<div id = 'id_officeLoc2' name = 'officeLocation2' class='providerMapData1 providerMapData2'>" + address[2] + " " + address[3] + "  " + address[4] + "</div>" ;
- panelDisplay += "<div id = 'id_officeLoc3' name = 'officeLocation3' class='providerMapData1 providerMapData2'>" + address[5] + "</div>" ;
- panelDisplay += "<div class='providerMapData1'>" + "Hours:" + "</div>";
- panelDisplay += "<div id = 'id_officeLoc4' name = 'officeLocation4' class='providerMapData1 providerMapData2'>" + address[6] + "</div>";
- panelDisplay += "<div class='providerMapData1'>" + "Providers:" + "</div>";
- if (doctors != undefined && doctors != null && doctors != "") {
- var docs;
- for (var j = 0; j < doctors.length; j++) {
- docs = doctors[j].split("^");
- panelDisplay += "<div id = 'id_officeLoc5' name = 'officeLocation5' class='providerMapData1 providerMapData2'> <a style='text-decoration: underline; color: #0000FF;' onclick='providerBio(" + """ + docs[0] + """ + ", " + """ + docs[1] + """ + ")'>" + docs[0] + " " + docs[1] + "</a></div>" ;
- }
- }
- panelDisplay += "</div>";
- title[zipGroup] = address[0];
- panelAddresses[zipGroup] = address[1] + ", " + address[4];
- markerDisplay[zipGroup] = panelDisplay;
- iconDisplay[zipGroup] = zipGroup;
- zipGroup = zipGroup + 1;
- panelDisplay = "";
- }
- }
- }
- // if (zipGroup > 1) {
- // zipGroup = 1;
- delayGeoCode();
- // }
- }
- document.getElementById('officeList_id').innerHTML = "";
- document.getElementById('docsList_id').innerHTML = "";
- }
- catch (err) {
- alert(err.message);
- }
- }
- function delayGeoCode() {
- for (var i = 1; i < zipGroup; i++) {
- var myLatlng = new google.maps.LatLng(geoLoc[i][0],geoLoc[i][1]);
- marker = new MarkerWithLabel({
- position: myLatlng,
- map: map,
- title: title[i],
- labelContent: iconDisplay[i],
- labelAnchor: new google.maps.Point(7, 35),
- labelClass: "labels", // the CSS class for the label
- labelInBackground: false
- });
- (function (data, marker) {
- google.maps.event.addListener(marker, 'click', function () {
- if (!infowindow) {
- infowindow = new google.maps.InfoWindow();
- }
- infowindow.setContent(data);
- infowindow.open(map, marker);
- });
- markers.push(marker);
- })(markerDisplay[i], marker);
- }
- }
- function addressResolved(results, status)
- {
- return function (results, status) {
- if (status == google.maps.GeocoderStatus.OK) {
- // document.getElementById('geocodeList_id').innerHTML = document.getElementById('geocodeList_id').innerHTML + "<br />" + ",[" + results[0].geometry.location.lat() + "," + results[0].geometry.location.lng() + "]";
- marker = new MarkerWithLabel({
- position: results[0].geometry.location,
- map: map,
- title: title[zipGroup],
- labelContent: iconDisplay[zipGroup],
- labelAnchor: new google.maps.Point(7, 35),
- labelClass: "labels", // the CSS class for the label
- labelInBackground: false
- });
- (function (data, marker) {
- google.maps.event.addListener(marker, 'click', function () {
- if (!infowindow) {
- infowindow = new google.maps.InfoWindow();
- }
- infowindow.setContent(data);
- infowindow.open(map, marker);
- showOffice(marker.getTitle());
- });
- markers.push(marker);
- })(markerDisplay[zipGroup], marker);
- zipGroup = zipGroup + 1;
- } else {
- //alert("Geocode was not successful for the following reason: " + status);
- }
- window.setTimeout(delayGeoCode, 50);
- };
- }
- // Removes the markers from the map, but keeps them in the array.
- // Shows any markers currently in the array.
- function showMarkers(nIndex) {
- if (markers[prevnIndex].getAnimation() != null) {
- markers[prevnIndex].setAnimation(null);
- markers[prevnIndex].setZIndex(prevnIndex);
- }
- markers[nIndex].setZIndex(google.maps.Marker.MAX_ZINDEX + 1);
- markers[nIndex].setAnimation(google.maps.Animation.BOUNCE);
- map.setCenter(markers[nIndex].getPosition());
- map.setZoom(12);
- prevnIndex = nIndex;
- }
- function initializeMap() {
- geoCoder = new google.maps.Geocoder();
- var loc = [];
- var address = ""
- var addresses = "85716";
- var address = "85716";
- var prevZip = "";
- var panelDisplay = "";
- var zoomLevel = 4;
- zoomLevel = 10;
- address = "";
- if (address == undefined || address == null || address == "") {
- address = "85716";
- } else {
- addresses = address.split("?");
- if (addresses != undefined && addresses != null && addresses != "") {
- address = addresses[0].split("^");
- var infowindow;
- address = address[5];
- }
- }
- address = "United States, " + address;
- var lat = '';
- var lng = '';
- geoCoder.geocode({ 'address': address }, function (results, status) {
- if (status == google.maps.GeocoderStatus.OK) {
- lat = results[0].geometry.location.lat();
- lng = results[0].geometry.location.lng();
- var options =
- {
- zoom: Number(zoomLevel),
- center: new google.maps.LatLng(lat, lng),
- mapTypeId: google.maps.MapTypeId.ROADMAP,
- mapTypeControl: true,
- mapTypeControlOptions:
- {
- poistion: google.maps.ControlPosition.TOP_RIGHT
- },
- navigationControl: true,
- navigationControlOptions: {
- style: google.maps.NavigationControlStyle.ZOOM_PAN
- },
- scaleControl: true,
- draggable: true,
- draggableCursor: 'move'
- };
- map = new google.maps.Map(document.getElementById('id_mapPanel'), options);
- zipCoder();
- } else {
- alert("Geocode was not successful for the following reason: " + status);
- }
- });
- }
- window.onload = initializeMap;
- function showOffice(title){
- document.getElementById('id_OfficeName').value = title;
- form1.submit();
- }
- function providerBio(first, last){
- var windowFeatures = "status=0, toolbar=0, location=0, menubar=0, directories=0,scrollbars=1, left=0, height=405, width=810";
- window.open("providerPortrait.php?first=" + first + "&last=" + last, "", "width=930, height=465",windowFeatures);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement