- Multiple outages exist here. Click this icon to zoom to them.
- After that, select one of these inside the map to get outage details.
'; $(".mapButtonClose").click(function(){ $(this).parents('.mapPopUp').hide(); });outageInfoBoxText = document.createElement("div");outageInfoBoxText.innerHTML = outageMarkerHTML;multioutageMarkerInfoWindow.setContent(outageInfoBoxText);multioutageMarkerInfoWindow.open(map); } else if(multioutageMarkerInfoWindow.getMap() == null){ multioutageMarkerInfoWindow.close(); multioutageMarkerInfoWindow = new InfoBox(outageInfoBoxOptions);multioutageMarkerInfoWindow.setPosition(clusterStyles.getCenter()); outageMarkerHTML = '
Outage Information
Close
- Multiple outages exist here. Click this icon to zoom to them.
- After that, select one of these inside the map to get outage details.
'; $(".mapButtonClose").click(function(){ $(this).parents('.mapPopUp').hide(); });outageInfoBoxText = document.createElement("div");outageInfoBoxText.innerHTML = outageMarkerHTML;multioutageMarkerInfoWindow.setContent(outageInfoBoxText);multioutageMarkerInfoWindow.open(map); } else{ doNothing();} });});downloadUrlForLastUpdatedTime("/pnm_portal_static_resources/customers/outage_map/xml/Outage_Points_LastUpdated.xml",function(data) {var browser = navigator.appVersion;var xml = parseXml(data);var lastUpdatedTimeTag = "ns0:LastModifiedDateTime";var lastUpdatedTime;if(xml.documentElement.getElementsByTagName(lastUpdatedTimeTag).length != 0){lastUpdatedTime=xml.documentElement.getElementsByTagName(lastUpdatedTimeTag)[0].firstChild.nodeValue;}else{lastUpdatedTimeTag = lastUpdatedTimeTag.substr(4);lastUpdatedTime=xml.documentElement.getElementsByTagName(lastUpdatedTimeTag)[0].firstChild.nodeValue;}var lastUpdatedDateTime=lastUpdatedTime.split("GMT");if(lastUpdatedDateTime[1]!='' && lastUpdatedDateTime[1].indexOf('06:00')!=-1 ){$(".lastUpdatedOn span").html('').append(lastUpdatedDateTime[0]+'(MDT)');}else{$(".lastUpdatedOn span").html('').append(lastUpdatedDateTime[0]+'(MST)');}});//limit how far the user can zoom ingoogle.maps.event.addListener(map, 'zoom_changed', function() {//alert("Zoomed in"); if(undefined != multioutageMarkerInfoWindow || null != multioutageMarkerInfoWindow){ multioutageMarkerInfoWindow.close();} if(undefined != outageMarkerInfoWindow || null != outageMarkerInfoWindow){outageMarkerInfoWindow.close();}if (map.getZoom() > maxZoomIn) {map.setZoom(maxZoomIn);//clearAllMarkers();//initialize();map.panBy(1, 1); //added for bug in IE 7 where clicking the zoom in button at maximum zoom drops the outage marker from the map; this slight pan re-draws the map and thus outage marker(s); do I want to implement it? or is there a better fix?}});//geocode user input (e.g. - an address or a zipcode)geocoder = new google.maps.Geocoder();// geocodePlace(); //***probably need to add something indicating this function was called after onload (e.g. - geocodingInitialized); otherwise wonkiness could ensue (like if the user attempts to load this page directly)} setInterval(function(){clearAllMarkers(),initialize()},600000); function bindOutageMarkerInfoWindow(outageMarker, map,strCustomersAffected,strEstTimePowerOutTag,strEstTimePowerBackOn,strStatus,strStatusCauseTag) {google.maps.event.addListener(outageMarker, 'click', function() { if(undefined != outageMarkerInfoWindow || null != outageMarkerInfoWindow){outageMarkerInfoWindow.close();} if(undefined != multioutageMarkerInfoWindow || null != multioutageMarkerInfoWindow){ multioutageMarkerInfoWindow.close();}if(undefined == outageMarkerInfoWindow || null == outageMarkerInfoWindow){outageMarkerInfoWindow = new InfoBox(outageInfoBoxOptions);outageMarkerPosition = outageMarker.positionmap.setCenter(outageMarker.getPosition()); //map.setCenter(outageMarker.getPosition());outageMarkerInfoWindow.setPosition(outageMarker.getPosition());//set outageMarker window infoif (parseInt(strCustomersAffected) == 0) { //zero outagesoutageMarkerHTML = '
Outage Information
Close
- Status
- '+strStatus+'
Zoom to Outage >
';} else if (map.getZoom() >= maxZoomIn - 1) { //all outage info minus "zoom to outage" linkoutageMarkerHTML = '
Outage Information
Close
- Customers Affected
- '+strCustomersAffected+'
- Outage Reported
- '+strEstTimePowerOutTag+'
- Estimated restore time
- '+strEstTimePowerBackOn+'
- Status
- '+strStatus+'
- Cause
- '+strStatusCauseTag+'
'; //this won't all display using Google's InfoWindow in my phone (but does in my PC web browser); so I'm using custom InfoBox instead} else { //all outage info with "zoom to outage" linkoutageMarkerHTML = '
Outage Information
Close
- Customers Affected
- '+strCustomersAffected+'
- Outage Reported
- '+strEstTimePowerOutTag+'
- Estimated restore time
- '+strEstTimePowerBackOn+'
- Status
- '+strStatus+'
- Cause
- '+strStatusCauseTag+'
Zoom to Outage >
'; //this won't all display using Google's InfoWindow in my phone (but does in my PC web browser); so I'm using custom InfoBox instead} $(".mapButtonClose").click(function(){ $(this).parents('.mapPopUp').hide(); });//outageMarkerInfoWindow.setContent("
whatever
");outageInfoBoxText = document.createElement("div");//outageInfoBoxText.style.cssText = "border: 1px solid black; margin-top: 8px; background: white; padding: 1px;";outageInfoBoxText.innerHTML = outageMarkerHTML;outageMarkerInfoWindow.setContent(outageInfoBoxText);outageMarkerInfoWindow.open(map, outageMarker);}else if(outageMarkerInfoWindow.getMap() == null){outageMarkerInfoWindow.close();outageMarkerInfoWindow = new InfoBox(outageInfoBoxOptions);outageMarkerPosition = outageMarker.positionmap.setCenter(outageMarker.getPosition());// map.setCenter(outageMarker.getPosition());outageMarkerInfoWindow.setPosition(outageMarker.getPosition());//set outageMarker window infoif (parseInt(strCustomersAffected) == 0) { //zero outagesoutageMarkerHTML = '
Outage Information
Close
- Status
- '+strStatus+'
Zoom to Outage >
';} else if (map.getZoom() >= maxZoomIn - 1) { //all outage info minus "zoom to outage" linkoutageMarkerHTML = '
Outage Information
Close
- Status
- '+strStatus+'
- Outage Reported
- '+strEstTimePowerOutTag+'
- Estimated restore time
- '+strEstTimePowerBackOn+'
- Customers Affected
- '+strCustomersAffected+'
- Cause
- '+strStatusCauseTag+'
'; //this won't all display using Google's InfoWindow in my phone (but does in my PC web browser); so I'm using custom InfoBox instead} else { //all outage info with "zoom to outage" linkoutageMarkerHTML = '
Outage Information
Close
- Status
- '+strStatus+'
- Outage Reported
- '+strEstTimePowerOutTag+'
- Estimated restore time
- '+strEstTimePowerBackOn+'
- Customers Affected
- '+strCustomersAffected+'
- Cause
- '+strStatusCauseTag+'
Zoom to Outage >
'; //this won't all display using Google's InfoWindow in my phone (but does in my PC web browser); so I'm using custom InfoBox instead} $(".mapButtonClose").click(function(){ $(this).parents('.mapPopUp').hide(); });//outageMarkerInfoWindow.setContent("
whatever
");outageInfoBoxText = document.createElement("div");//outageInfoBoxText.style.cssText = "border: 1px solid black; margin-top: 8px; background: white; padding: 1px;";outageInfoBoxText.innerHTML = outageMarkerHTML;outageMarkerInfoWindow.setContent(outageInfoBoxText);outageMarkerInfoWindow.open(map, outageMarker);}else{doNothing();}});} //geocode user input (e.g. - an address or a zipcode)geocoder = new google.maps.Geocoder();//geocodePlace(); //***probably need to add something indicating this function was called after onload (e.g. - geocodingInitialized); otherwise wonkiness could ensue (like if the user attempts to load this page directly)function geocodePlace() { $(".mapButtonClose").parents('.mapPopUp').hide();hrefWithGeoInfo = document.getElementById("outageZipCode").value;var geoSearchType = hrefWithGeoInfo.slice((hrefWithGeoInfo.search("html?") + 5), (hrefWithGeoInfo.search("html?") + 12)); //get geo search type/* var strToBeGeocoded = hrefWithGeoInfo.slice(hrefWithGeoInfo.search(geoSearchType + "=") + 8); //get zipcode or address string to be geocodedstrToBeGeocoded = strToBeGeocoded.replace(/%20/g, " "); *///URL-encoding replaces a space character with %20; we need to change it back for geocodinghrefWithGeoInfo = hrefWithGeoInfo + " New Mexico USA"; //New Mexico USA string added to keep results within NM if (hrefWithGeoInfo == "") {blankString = true;} else {blankString = false;}if (geocoder && !(blankString)) {geocoder.geocode({'address' : hrefWithGeoInfo},function(results, status) {if (status == google.maps.GeocoderStatus.OK) { if (bGeocodeMarkerAdded) { //is there already a geocode marker on the map? geocodeMarker.setMap(null); //if yes, remove geocode marker from map }if (results[0].geometry.bounds == null) {geocodeLatLng = results[0].geometry.location; //used for geocodeMarker position belowmap.setZoom(maxZoomIn);map.setCenter(geocodeLatLng);} else {zipBoundingBox = new google.maps.Rectangle({ //for testing: create zipBoundingBox to confirm zip geocode point is in zip centerbounds : results[0].geometry.bounds,strokeColor : "blue",strokeOpacity : 1.0,strokeWeight : 2,fillOpacity : 0,clickable : false})//zipBoundingBox.setMap(map);geocodeLatLng = results[0].geometry.bounds.getCenter(); //used for geocodeMarker position below; use center of zip bounding box because zip point returned (results[0].geometry.location) is often far from center of zipmap.fitBounds(results[0].geometry.bounds); //zoom to bounds of geocode results (i.e. - the zipcode)}geocodeMarker = new google.maps.Marker({map : map,position : geocodeLatLng});var geocodeInfoBoxOptions = {content : geocodeInfoBoxText,pixelOffset : new google.maps.Size(-130, 0),boxStyle : {background : "url('/o/PNMR-ViewOutage-portlet/images/tipbox_arrow.gif') no-repeat",opacity : 1.0,width : "260px"},closeBoxURL : "",infoBoxClearance : new google.maps.Size(20, 75)};geocodeMarkerInfoWindow = new InfoBox(geocodeInfoBoxOptions);geocodeInfoBoxText = document.createElement("div");//geocodeInfoBoxText.style.cssText = "border: 1px solid black; margin-top: 8px; background: white; padding: 1px;";/* geocodeMarkerHTML = "
If you see one of these icons nearby, the power may be out here.
Select one of these inside the map to get outage details." + "
Close
";*/geocodeMarkerHTML = "
Outage Information
Close
- If you see one of these icons nearby, the power may be out here.
- Select one of these inside the map to get outage details
"; geocodeInfoBoxText.innerHTML = geocodeMarkerHTML;geocodeMarkerInfoWindow.setContent(geocodeInfoBoxText);geocodeMarkerInfoWindow.open(map,geocodeMarker); google.maps.event.addListener(geocodeMarker, 'click', function() {geocodeMarkerInfoWindow.open(map, geocodeMarker); }); bGeocodeMarkerAdded = true;} else {}});}data = $('#viewOutage').serialize()var actionUrl = "https://www.pnm.com/search-an-outage-old?p_p_id=PNMRViewOutageportlet_WAR_PNMRViewOutageportlet&p_p_lifecycle=1&p_p_state=normal&p_p_mode=view&_PNMRViewOutageportlet_WAR_PNMRViewOutageportlet_myaction=viewOutage&p_auth=sU2xuX1e";actionUrl = actionUrl.replace("p_p_state=normal", "p_p_state=exclusive");$.ajax({type : "POST",url : actionUrl,data : data,success : function(response) {$('#errorListForViewOutage').html(response);}});} function downloadUrl(url, callback) { //download outages xml file (even though it's local)var request = window.ActiveXObject ? new ActiveXObject('Microsoft.XMLHTTP') : new XMLHttpRequest;request.onreadystatechange = function() {if (request.readyState == 4) {request.onreadystatechange = doNothing;callback(request.responseText, request.status);}};if(url.indexOf('?')==-1){url+="?time="+new Date().getTime();}else{url+="&time="+new Date().getTime();}request.open('GET', url, true);request.send(null);}function downloadUrlForLastUpdatedTime(url, callback) { //download outages xml file (even though it's local)var request = window.ActiveXObject ? new ActiveXObject('Microsoft.XMLHTTP') : new XMLHttpRequest;request.onreadystatechange = function() {if (request.readyState == 4) {request.onreadystatechange = doNothing;callback(request.responseText, request.status);}};if(url.indexOf('?')==-1){url+="?time="+new Date().getTime();}else{url+="&time="+new Date().getTime();}request.open('GET', url, true);request.send(null);}function parseXml(str) { //parse outages xml dataif (window.ActiveXObject) {var doc = new ActiveXObject('Microsoft.XMLDOM');doc.loadXML(str);return doc;} else if (window.DOMParser) {return (new DOMParser).parseFromString(str, 'text/xml');}}function doNothing() {} //used in downloadUrl() function abovejQuery(function ($) {$('#outageZipCode').keypress(function (e) { var key = e.which; if(key == 13) // the enter key code { $('#FindIt_Button').click(); return false; }});});//